diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fcb5b0741f27b95c7a12d1cfdb4171cc77aeb782..8d612b75a88a8a76dc21d5167ee0c28377c04e2c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,19 +1,136 @@ # Phytium Iot gitlab-ci.yml file +workflow: + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + stages: - - basic_stage - -risk_controller: - stage: basic_stage - tags: - - normal_runner - script: - - pwd - - echo "Phytium Changsha Iot Gitlab Runner is at work." - - echo "This job only run manually to prevent merge request from not being reviewed by Jenkins pipeline." - - echo "Approve merge request to start Jenkins auto compile item." - - sleep 10 # 这个延时是为了让操作者明确知道自己已经开启了这项操作; - - exit 1 # 这个任务一定会失败,目的是保护被合入的分支 - rules: - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - when: manual \ No newline at end of file + - pre_stage # 准备阶段 + - compile_stage # 编译阶段 + - test_stage # 测试阶段 + - post_stage # 收尾阶段 + +# 所有soc覆盖编译启动 +all_soc_compile: + stage: compile_stage + script: + - echo "All soc config compile is about to start..." + tags: + - compile + when: manual + +# 各模块编译 +freertos_feature_compile: + stage: compile_stage + script: + - cd /home/gitlab-runner/auto_compile_tool/phytium-test-tools/test_tool + - python3 gitlab_pipeline_compile.py $CI_MERGE_REQUEST_PROJECT_PATH $CI_PROJECT_DIR $CI_PROJECT_DIR/example/freertos_feature + tags: + - compile + needs: ["all_soc_compile"] + +network_compile: + stage: compile_stage + script: + - cd /home/gitlab-runner/auto_compile_tool/phytium-test-tools/test_tool + - python3 gitlab_pipeline_compile.py $CI_MERGE_REQUEST_PROJECT_PATH $CI_PROJECT_DIR $CI_PROJECT_DIR/example/network + tags: + - compile + needs: ["all_soc_compile"] + +peripheral_compile: + stage: compile_stage + script: + - cd /home/gitlab-runner/auto_compile_tool/phytium-test-tools/test_tool + - python3 gitlab_pipeline_compile.py $CI_MERGE_REQUEST_PROJECT_PATH $CI_PROJECT_DIR $CI_PROJECT_DIR/example/peripheral + tags: + - compile + needs: ["all_soc_compile"] + +storage_compile: + stage: compile_stage + script: + - cd /home/gitlab-runner/auto_compile_tool/phytium-test-tools/test_tool + - python3 gitlab_pipeline_compile.py $CI_MERGE_REQUEST_PROJECT_PATH $CI_PROJECT_DIR $CI_PROJECT_DIR/example/storage + tags: + - compile + needs: ["all_soc_compile"] + +system_compile: + stage: compile_stage + script: + - cd /home/gitlab-runner/auto_compile_tool/phytium-test-tools/test_tool + - python3 gitlab_pipeline_compile.py $CI_MERGE_REQUEST_PROJECT_PATH $CI_PROJECT_DIR $CI_PROJECT_DIR/example/system + tags: + - compile + needs: ["all_soc_compile"] + +# 板级测试启动 +e2000d_board_test: + stage: test_stage + script: + - echo "test on E2000d board is about to start..." + tags: + - test + when: manual + +# 各模块板级测试 +freertos_feature_test: + stage: test_stage + script: + - cd /home/gitlab-runner/test_tool + - python3 set_common_info.py /home/gitlab-runner/test_tool/phytium-test-tools/test_tool/config_info/common.json freertos + - cd /home/gitlab-runner/test_tool/phytium-test-tools/test_tool + - python3 gitlab_pipeline_board_test.py $CI_PROJECT_DIR $CI_PROJECT_DIR/example/freertos_feature + tags: + - test + allow_failure: true + needs: ["e2000d_board_test"] + +network_test: + stage: test_stage + script: + - cd /home/gitlab-runner/test_tool + - python3 set_common_info.py /home/gitlab-runner/test_tool/phytium-test-tools/test_tool/config_info/common.json freertos + - cd /home/gitlab-runner/test_tool/phytium-test-tools/test_tool + - python3 gitlab_pipeline_board_test.py $CI_PROJECT_DIR $CI_PROJECT_DIR/example/network + tags: + - test + allow_failure: true + needs: ["e2000d_board_test"] + +peripheral_test: + stage: test_stage + script: + - cd /home/gitlab-runner/test_tool + - python3 set_common_info.py /home/gitlab-runner/test_tool/phytium-test-tools/test_tool/config_info/common.json freertos + - cd /home/gitlab-runner/test_tool/phytium-test-tools/test_tool + - python3 gitlab_pipeline_board_test.py $CI_PROJECT_DIR $CI_PROJECT_DIR/example/peripheral + tags: + - test + allow_failure: true + needs: ["e2000d_board_test"] + +storage_test: + stage: test_stage + script: + - cd /home/gitlab-runner/test_tool + - python3 set_common_info.py /home/gitlab-runner/test_tool/phytium-test-tools/test_tool/config_info/common.json freertos + - cd /home/gitlab-runner/test_tool/phytium-test-tools/test_tool + - python3 gitlab_pipeline_board_test.py $CI_PROJECT_DIR $CI_PROJECT_DIR/example/storage + tags: + - test + allow_failure: true + needs: ["e2000d_board_test"] + +system_test: + stage: test_stage + script: + - cd /home/gitlab-runner/test_tool + - python3 set_common_info.py /home/gitlab-runner/test_tool/phytium-test-tools/test_tool/config_info/common.json freertos + - cd /home/gitlab-runner/test_tool/phytium-test-tools/test_tool + - python3 gitlab_pipeline_board_test.py $CI_PROJECT_DIR $CI_PROJECT_DIR/example/system + tags: + - test + allow_failure: true + needs: ["e2000d_board_test"] \ No newline at end of file diff --git a/docs/ChangeLog.md b/docs/ChangeLog.md index 7c60497018b6392373d3ab14be9dba0e94b87e7f..9ff3d5cffd67783add0a66f7e1bef18aa0489583 100644 --- a/docs/ChangeLog.md +++ b/docs/ChangeLog.md @@ -1,4 +1,43 @@ -# Phytium Standalone SDK 2024-07-23 ChangeLog +# Phytium FreeRTOS SDK 2024-08-12 ChangeLog + +Change Log since 2024-08-05 + +## example + +- update xhci_platform and xhci_pcie example +- add pusb2_device and pusb2_host example +- update fatfs example for usb disk + +## third-party + +- remove cherryusb and move to standalone +- fix memory pool, lock-free in isr context + +# Phytium FreeRTOS SDK 2024-08-05 ChangeLog + +Change Log since 2024-08-01 + +## .gitlab-ci + +- E2000D board test pipeline first add + +# Phytium FreeRTOS SDK 2024-08-01 ChangeLog + +Change Log since 2024-07-31 + +## third-party + +- Override configSTACK_DEPTH_TYPE to uint32_t in FreeRTOSConfig.h + +# Phytium FreeRTOS SDK 2024-07-31 ChangeLog + +Change Log since 2024-07-30 + +## .gitlab-ci + +- Migrate Jenkins Pipeline Functionality to GitLab Native CI/CD Pipeline + +# Phytium FreeRTOS SDK 2024-07-23 ChangeLog Change Log since 2024-07-12 @@ -7,7 +46,7 @@ Change Log since 2024-07-12 - modify the openamp example to support linux - modify the openamp driver and device role -# Phytium Standalone SDK 2024-07-12 ChangeLog +# Phytium FreeRTOS SDK 2024-07-12 ChangeLog Change Log since 2024-07-10 @@ -15,7 +54,7 @@ Change Log since 2024-07-10 - modify the example with no device attached -# Phytium Standalone SDK 2024-07-10 ChangeLog +# Phytium FreeRTOS SDK 2024-07-10 ChangeLog Change Log since 2024-07-10 @@ -23,7 +62,7 @@ Change Log since 2024-07-10 - modify qspi indirect example, fix length problem in function FQspiFlashPortReadData -# Phytium Standalone SDK 2024-07-10 ChangeLog +# Phytium FreeRTOS SDK 2024-07-10 ChangeLog Change Log since 2024-06-18 @@ -35,7 +74,7 @@ Change Log since 2024-06-18 - init emmc by hs200 mode -# Phytium Standalone SDK 2024-06-18 ChangeLog +# Phytium FreeRTOS SDK 2024-06-18 ChangeLog Change Log since 2024-06-18 @@ -43,7 +82,7 @@ Change Log since 2024-06-18 - fix mmu_display cmd in aarch64 mode -# Phytium Standalone SDK 2024-06-13 ChangeLog +# Phytium FreeRTOS SDK 2024-06-13 ChangeLog Change Log since 2024-06-11 @@ -55,7 +94,7 @@ Change Log since 2024-06-11 # Phytium FreeRTOS SDK 2024-06-12 ChangeLog -## example +## example - change i2c example to use standalone drivers api @@ -434,17 +473,17 @@ Change Log since 2024-03-08 ## driver -- change gpio driver for adapting the sdk +- change gpio driver for adapting the sdk # Phytium FreeRTOS SDK 2024-03-08 ChangeLog Change Log since 2024-02-29 -## example +## example - add ui example -## third -party +## third -party - change shell with echo ctrl @@ -454,7 +493,7 @@ Change Log since 2024-02-29 ## example -- add i2s example +- add i2s example ## driver @@ -555,7 +594,7 @@ Change Log since 2023-12-25 ## driver - new standalone version adaptation of xmac and gmac. - + ## example - reconstruting network example:lwip-startup. @@ -777,7 +816,7 @@ Change Log sinc 2023-09-06 # example -- change the i2s example to adapt the phytiumpi, modify some bugs +- change the i2s example to adapt the phytiumpi, modify some bugs # driver @@ -788,7 +827,7 @@ Change Log sinc 2023-09-01 # example -- change the i2s example to adapt the phytiumpi, modify some bugs +- change the i2s example to adapt the phytiumpi, modify some bugs # driver @@ -844,7 +883,7 @@ Change Log sinc 2023-08-30 ## third-party -- Change the fatfs src.mk and include.mk +- Change the fatfs src.mk and include.mk # Phytium FreeRTOS SDK 2023-08-31 ChangeLog @@ -855,11 +894,11 @@ Change Log sinc 2023-08-29 ## example -- Change the peripheral makefile and Kconfig , compile the all example +- Change the peripheral makefile and Kconfig , compile the all example ## third-party -- Change the lvgl , cherryusb and sdmmc makefile and Kconfig +- Change the lvgl , cherryusb and sdmmc makefile and Kconfig - Change the third-party/include.mk , thirdparty.mk # Phytium FreeRTOS SDK 2023-08-29 ChangeLog @@ -878,16 +917,16 @@ Change Log sinc 2023-08-28 Change Log sinc 2023-08-20 -## example +## example - adapt to new frameworks -- adapt feature, qspi, atomic +- adapt feature, qspi, atomic # Phytium FreeRTOS SDK 2023-07-14 ChangeLog Change Log sinc 2023-07-10 -## example +## example - add template_new example to show new complier use ## third-party @@ -920,7 +959,7 @@ Change Log sinc 2023-07-02 ## third-party -- letter-shell adapt to new psci api +- letter-shell adapt to new psci api # Phytium FreeRTOS SDK 2023-06-28 ChangeLog @@ -1011,7 +1050,7 @@ Change Log sinc 2023-3-16 - modify cherryusb (ready to merge to cherryusb baseline) - reconstruct xhci driver - modify usbh_bus usage to support use multiple usb controller - - modify enumration proccedure to support enumrate usb 3.0 device (e.g mass storage) + - modify enumration proccedure to support enumrate usb 3.0 device (e.g mass storage) - implment for usb 3.0 hub ## example @@ -1027,7 +1066,7 @@ Change Log sinc 2023-3-15 - driver/media add the multi-display driver -## example +## example - media add config and example for the multi-display diff --git a/example/freertos_feature/eventgroup/configs/d2000_aarch32_test_eventgroup.config b/example/freertos_feature/eventgroup/configs/d2000_aarch32_test_eventgroup.config index 6922f0a738dbd753dd4a3913f07ab65dfd020401..ddbc8c4f3e08cbb1fcb92f8c2704e375d700c1d7 100644 --- a/example/freertos_feature/eventgroup/configs/d2000_aarch32_test_eventgroup.config +++ b/example/freertos_feature/eventgroup/configs/d2000_aarch32_test_eventgroup.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/eventgroup/configs/d2000_aarch64_test_eventgroup.config b/example/freertos_feature/eventgroup/configs/d2000_aarch64_test_eventgroup.config index 2219ca8e4dae4dac5fd781dace16a21494d95a45..1e979599acf5bdd1cfc6e5055544d3342d131114 100644 --- a/example/freertos_feature/eventgroup/configs/d2000_aarch64_test_eventgroup.config +++ b/example/freertos_feature/eventgroup/configs/d2000_aarch64_test_eventgroup.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/eventgroup/configs/e2000d_aarch32_demo_eventgroup.config b/example/freertos_feature/eventgroup/configs/e2000d_aarch32_demo_eventgroup.config index de807ef0290629c9bde0b5e96e09269d52770847..36ec22a7cacc8bc351150b033ed5590fa940e066 100644 --- a/example/freertos_feature/eventgroup/configs/e2000d_aarch32_demo_eventgroup.config +++ b/example/freertos_feature/eventgroup/configs/e2000d_aarch32_demo_eventgroup.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/eventgroup/configs/e2000d_aarch64_demo_eventgroup.config b/example/freertos_feature/eventgroup/configs/e2000d_aarch64_demo_eventgroup.config index 4d5a7fdeb02a10eebf2c00a3cffd835d4e459718..ed0894648a09bd988fc0661a77a1b9817ee4ddda 100644 --- a/example/freertos_feature/eventgroup/configs/e2000d_aarch64_demo_eventgroup.config +++ b/example/freertos_feature/eventgroup/configs/e2000d_aarch64_demo_eventgroup.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/eventgroup/configs/e2000q_aarch32_demo_eventgroup.config b/example/freertos_feature/eventgroup/configs/e2000q_aarch32_demo_eventgroup.config index f328af98db9d659258540609cf3b458c3245d3a5..a0ee85b699f8b5b764b471b033cafd4464b29a4e 100644 --- a/example/freertos_feature/eventgroup/configs/e2000q_aarch32_demo_eventgroup.config +++ b/example/freertos_feature/eventgroup/configs/e2000q_aarch32_demo_eventgroup.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/eventgroup/configs/e2000q_aarch64_demo_eventgroup.config b/example/freertos_feature/eventgroup/configs/e2000q_aarch64_demo_eventgroup.config index a3562eb8087bffac805b31d8e8436560cce840bd..5c1ddf31fcfe2492f36581e08c51616745422bb4 100644 --- a/example/freertos_feature/eventgroup/configs/e2000q_aarch64_demo_eventgroup.config +++ b/example/freertos_feature/eventgroup/configs/e2000q_aarch64_demo_eventgroup.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/eventgroup/configs/ft2004_aarch32_dsk_eventgroup.config b/example/freertos_feature/eventgroup/configs/ft2004_aarch32_dsk_eventgroup.config index f562819ce790516193b4d5503f45016c77a12a07..707209d98b7d98f21cc9fd9b35912c900364156b 100644 --- a/example/freertos_feature/eventgroup/configs/ft2004_aarch32_dsk_eventgroup.config +++ b/example/freertos_feature/eventgroup/configs/ft2004_aarch32_dsk_eventgroup.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/eventgroup/configs/ft2004_aarch64_dsk_eventgroup.config b/example/freertos_feature/eventgroup/configs/ft2004_aarch64_dsk_eventgroup.config index e8183d0bd79136115a80031aeade331bb4f4eac2..8f66c8a868405df4b3980541ec70b906ebb73e68 100644 --- a/example/freertos_feature/eventgroup/configs/ft2004_aarch64_dsk_eventgroup.config +++ b/example/freertos_feature/eventgroup/configs/ft2004_aarch64_dsk_eventgroup.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/eventgroup/configs/phytiumpi_aarch32_firefly_eventgroup.config b/example/freertos_feature/eventgroup/configs/phytiumpi_aarch32_firefly_eventgroup.config index 619579a843aebc2591db934ca43cfcc41089aa5a..b77b6348bcd2fa8d71ccec061f5a3f5a85e601ce 100644 --- a/example/freertos_feature/eventgroup/configs/phytiumpi_aarch32_firefly_eventgroup.config +++ b/example/freertos_feature/eventgroup/configs/phytiumpi_aarch32_firefly_eventgroup.config @@ -97,12 +97,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -132,7 +126,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/eventgroup/configs/phytiumpi_aarch64_firefly_eventgroup.config b/example/freertos_feature/eventgroup/configs/phytiumpi_aarch64_firefly_eventgroup.config index af84fedf8864fd600bd78bfa41341829505e929a..29126d74d3fdeda3c243808bf643342568d22157 100644 --- a/example/freertos_feature/eventgroup/configs/phytiumpi_aarch64_firefly_eventgroup.config +++ b/example/freertos_feature/eventgroup/configs/phytiumpi_aarch64_firefly_eventgroup.config @@ -91,12 +91,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -126,7 +120,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/eventgroup/main.c b/example/freertos_feature/eventgroup/main.c index e9800659f6f9324c14c6443231a767488a8e01af..566a1689af716061310068cc2452ac695f85d563 100644 --- a/example/freertos_feature/eventgroup/main.c +++ b/example/freertos_feature/eventgroup/main.c @@ -55,7 +55,7 @@ int main(void) /* used in no-letter-shell mode */ ret = xTaskCreate((TaskFunction_t)EventgroupExampleTaskEntry, (const char *)"EventgroupExampleTaskEntry", - (uint16_t)4096, + 4096, NULL, (UBaseType_t)EVENTGROUP_EXAMPLE_TASK_PRIORITY, NULL); diff --git a/example/freertos_feature/eventgroup/sdkconfig b/example/freertos_feature/eventgroup/sdkconfig index af84fedf8864fd600bd78bfa41341829505e929a..29126d74d3fdeda3c243808bf643342568d22157 100644 --- a/example/freertos_feature/eventgroup/sdkconfig +++ b/example/freertos_feature/eventgroup/sdkconfig @@ -91,12 +91,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -126,7 +120,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/eventgroup/sdkconfig.h b/example/freertos_feature/eventgroup/sdkconfig.h index ace1a90bd84c8fda3b69768b3a08e2e1bd4ef39c..cdc7fa45a19a21b9a7c6e9389543723fc4c79367 100644 --- a/example/freertos_feature/eventgroup/sdkconfig.h +++ b/example/freertos_feature/eventgroup/sdkconfig.h @@ -85,11 +85,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -116,7 +111,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/freertos_feature/interrupt/configs/d2000_aarch32_test_interrupt.config b/example/freertos_feature/interrupt/configs/d2000_aarch32_test_interrupt.config index 2bc4cc359c17915dd794a491510e50aecd5a229c..54a6d759cc5939088e79cf6f523527fde79ced2c 100644 --- a/example/freertos_feature/interrupt/configs/d2000_aarch32_test_interrupt.config +++ b/example/freertos_feature/interrupt/configs/d2000_aarch32_test_interrupt.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/interrupt/configs/d2000_aarch64_test_interrupt.config b/example/freertos_feature/interrupt/configs/d2000_aarch64_test_interrupt.config index 1549d99f7d59119bb14a79026e88c97bf9909321..572d613567191f80178aae630ab6c79ce4c29894 100644 --- a/example/freertos_feature/interrupt/configs/d2000_aarch64_test_interrupt.config +++ b/example/freertos_feature/interrupt/configs/d2000_aarch64_test_interrupt.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/interrupt/configs/e2000d_aarch32_demo_interrupt.config b/example/freertos_feature/interrupt/configs/e2000d_aarch32_demo_interrupt.config index 1072d559efe6959d7c7c2b41a0fb1b5e0237d9a3..8efa6b278803635d292f625489084d85f04fba98 100644 --- a/example/freertos_feature/interrupt/configs/e2000d_aarch32_demo_interrupt.config +++ b/example/freertos_feature/interrupt/configs/e2000d_aarch32_demo_interrupt.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/interrupt/configs/e2000d_aarch64_demo_interrupt.config b/example/freertos_feature/interrupt/configs/e2000d_aarch64_demo_interrupt.config index b740328f5e670b9cda124c7d8a7eb49345d6a90d..7a351643721731b3a0852ca1b2fdc9bf8afc4558 100644 --- a/example/freertos_feature/interrupt/configs/e2000d_aarch64_demo_interrupt.config +++ b/example/freertos_feature/interrupt/configs/e2000d_aarch64_demo_interrupt.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/interrupt/configs/e2000q_aarch32_demo_interrupt.config b/example/freertos_feature/interrupt/configs/e2000q_aarch32_demo_interrupt.config index 9f747ee952977f1b9a1b28853d11d1b13a02df52..c9b7f64b9ee00153f0fd04a3be310c4a345c174c 100644 --- a/example/freertos_feature/interrupt/configs/e2000q_aarch32_demo_interrupt.config +++ b/example/freertos_feature/interrupt/configs/e2000q_aarch32_demo_interrupt.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/interrupt/configs/e2000q_aarch64_demo_interrupt.config b/example/freertos_feature/interrupt/configs/e2000q_aarch64_demo_interrupt.config index af610b2993dc4b434414372aa061b600b0f22c6d..655538d284160851ee4c12826e73717b5ece3cc9 100644 --- a/example/freertos_feature/interrupt/configs/e2000q_aarch64_demo_interrupt.config +++ b/example/freertos_feature/interrupt/configs/e2000q_aarch64_demo_interrupt.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/interrupt/configs/ft2004_aarch32_dsk_interrupt.config b/example/freertos_feature/interrupt/configs/ft2004_aarch32_dsk_interrupt.config index ee1d01326b8bbe7cbe5d114139c9333df280e4b9..4eaa1e5e2ba11e09adfa4513d41ed2198710b54b 100644 --- a/example/freertos_feature/interrupt/configs/ft2004_aarch32_dsk_interrupt.config +++ b/example/freertos_feature/interrupt/configs/ft2004_aarch32_dsk_interrupt.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/interrupt/configs/ft2004_aarch64_dsk_interrupt.config b/example/freertos_feature/interrupt/configs/ft2004_aarch64_dsk_interrupt.config index 314a9d1b12a735da9488fb8ca38b6d97e1def16a..0080b72c53dd2c6636cd9c7494404247b66bb92c 100644 --- a/example/freertos_feature/interrupt/configs/ft2004_aarch64_dsk_interrupt.config +++ b/example/freertos_feature/interrupt/configs/ft2004_aarch64_dsk_interrupt.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/interrupt/configs/phytiumpi_aarch32_firefly_interrupt.config b/example/freertos_feature/interrupt/configs/phytiumpi_aarch32_firefly_interrupt.config index 7a2a3dcd36bb9c488891d81fd6601f7a10217435..f828ffe72a14f5e716939d9bf11e9634c539b533 100644 --- a/example/freertos_feature/interrupt/configs/phytiumpi_aarch32_firefly_interrupt.config +++ b/example/freertos_feature/interrupt/configs/phytiumpi_aarch32_firefly_interrupt.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/interrupt/configs/phytiumpi_aarch64_firefly_interrupt.config b/example/freertos_feature/interrupt/configs/phytiumpi_aarch64_firefly_interrupt.config index 8afba0b1036470d1e7d3703af2ef55e8b2e7bc40..0adf13c05cf1afebf0eac959576d1a342c09b5f1 100644 --- a/example/freertos_feature/interrupt/configs/phytiumpi_aarch64_firefly_interrupt.config +++ b/example/freertos_feature/interrupt/configs/phytiumpi_aarch64_firefly_interrupt.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/interrupt/main.c b/example/freertos_feature/interrupt/main.c index 0e0ee62fa1364f5be2cb11b80a915d2d46167e1f..839fa2910c3ba3972afbd2b0d6424e5c9b1bc6b2 100644 --- a/example/freertos_feature/interrupt/main.c +++ b/example/freertos_feature/interrupt/main.c @@ -59,7 +59,7 @@ int main(void) /* used in no-letter-shell mode */ ret = xTaskCreate((TaskFunction_t)FeatureInterruptExampleTaskEntry, /* 任务入口函数 */ (const char *)"FeatureInterruptExampleTaskEntry",/* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL,/* 任务入口函数参数 */ (UBaseType_t)FEATURE_INTERRUPT_EXAMPLE_TASK_PRIORITY, /* 任务的优先级 */ NULL); diff --git a/example/freertos_feature/interrupt/sdkconfig b/example/freertos_feature/interrupt/sdkconfig index 8afba0b1036470d1e7d3703af2ef55e8b2e7bc40..0adf13c05cf1afebf0eac959576d1a342c09b5f1 100644 --- a/example/freertos_feature/interrupt/sdkconfig +++ b/example/freertos_feature/interrupt/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/interrupt/sdkconfig.h b/example/freertos_feature/interrupt/sdkconfig.h index f09afa79a27ae058422d1f4ba32fa30b05c9984a..43acfeb0cf266451e9a017e22cd79ef7727aab43 100644 --- a/example/freertos_feature/interrupt/sdkconfig.h +++ b/example/freertos_feature/interrupt/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,7 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/freertos_feature/queue/configs/d2000_aarch32_test_queue.config b/example/freertos_feature/queue/configs/d2000_aarch32_test_queue.config index 155086ed1d76d0450791d54bbff8f42de5ede5bd..5831753b6ee951981141bccbeaa81838e9fb651e 100644 --- a/example/freertos_feature/queue/configs/d2000_aarch32_test_queue.config +++ b/example/freertos_feature/queue/configs/d2000_aarch32_test_queue.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/queue/configs/d2000_aarch64_test_queue.config b/example/freertos_feature/queue/configs/d2000_aarch64_test_queue.config index ebb7210c02922ebd53fcdeb2a5e8f666e856073b..05fa24b7f28c36add43989f73e64b4ab5a56434d 100644 --- a/example/freertos_feature/queue/configs/d2000_aarch64_test_queue.config +++ b/example/freertos_feature/queue/configs/d2000_aarch64_test_queue.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/queue/configs/e2000d_aarch32_demo_queue.config b/example/freertos_feature/queue/configs/e2000d_aarch32_demo_queue.config index 59142b235a062e800c3fcbd57b8367b72655a65c..c14faba96f775355645164a8a796059ec91e6e74 100644 --- a/example/freertos_feature/queue/configs/e2000d_aarch32_demo_queue.config +++ b/example/freertos_feature/queue/configs/e2000d_aarch32_demo_queue.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/queue/configs/e2000d_aarch64_demo_queue.config b/example/freertos_feature/queue/configs/e2000d_aarch64_demo_queue.config index 9be439969558f34e9e8cfdb0b75cdfb6e35a5589..75d88d078c2f174c875edbefada2ae15c4d3e893 100644 --- a/example/freertos_feature/queue/configs/e2000d_aarch64_demo_queue.config +++ b/example/freertos_feature/queue/configs/e2000d_aarch64_demo_queue.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/queue/configs/e2000q_aarch32_demo_queue.config b/example/freertos_feature/queue/configs/e2000q_aarch32_demo_queue.config index f12b3f3bef02d30f150b0da674a288283fe896e5..14e83f3f42dfe925acc6967fd48d6209a0bd57da 100644 --- a/example/freertos_feature/queue/configs/e2000q_aarch32_demo_queue.config +++ b/example/freertos_feature/queue/configs/e2000q_aarch32_demo_queue.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/queue/configs/e2000q_aarch64_demo_queue.config b/example/freertos_feature/queue/configs/e2000q_aarch64_demo_queue.config index 22520453e44bcdaa3d6bcd4dacef04384bcafce1..296be3029f39a4f7769590e3059d9bc2703d5920 100644 --- a/example/freertos_feature/queue/configs/e2000q_aarch64_demo_queue.config +++ b/example/freertos_feature/queue/configs/e2000q_aarch64_demo_queue.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/queue/configs/ft2004_aarch32_dsk_queue.config b/example/freertos_feature/queue/configs/ft2004_aarch32_dsk_queue.config index ab127692a575b2614d83552ebd77b6895168d14e..c9db9e65dad5ead940167b6cedf1f44489fda5ed 100644 --- a/example/freertos_feature/queue/configs/ft2004_aarch32_dsk_queue.config +++ b/example/freertos_feature/queue/configs/ft2004_aarch32_dsk_queue.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/queue/configs/ft2004_aarch64_dsk_queue.config b/example/freertos_feature/queue/configs/ft2004_aarch64_dsk_queue.config index dbe61f1891fcbb70f329193937184d24514772b5..926977403cb777d64542f69efbc47280e88573f0 100644 --- a/example/freertos_feature/queue/configs/ft2004_aarch64_dsk_queue.config +++ b/example/freertos_feature/queue/configs/ft2004_aarch64_dsk_queue.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/queue/configs/phytiumpi_aarch32_firefly_queue.config b/example/freertos_feature/queue/configs/phytiumpi_aarch32_firefly_queue.config index b7a7c3fdcf139cd0341dcb9f255e95fbcaef78e7..55fb5135b5572a5234846990219942fd9bd117c5 100644 --- a/example/freertos_feature/queue/configs/phytiumpi_aarch32_firefly_queue.config +++ b/example/freertos_feature/queue/configs/phytiumpi_aarch32_firefly_queue.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/queue/configs/phytiumpi_aarch64_firefly_queue.config b/example/freertos_feature/queue/configs/phytiumpi_aarch64_firefly_queue.config index f5be9c941ece6e9ea645f66de8bf82e55ebfe11b..804de2d0fb5c5390161f591c5c6db41fccbf6bc6 100644 --- a/example/freertos_feature/queue/configs/phytiumpi_aarch64_firefly_queue.config +++ b/example/freertos_feature/queue/configs/phytiumpi_aarch64_firefly_queue.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/queue/main.c b/example/freertos_feature/queue/main.c index a74c1c78c0951c5fd5c5b96bfc0f4d8afef53708..d184a3c0ecfd9f1ffe759092cccc7b791c31709e 100644 --- a/example/freertos_feature/queue/main.c +++ b/example/freertos_feature/queue/main.c @@ -57,7 +57,7 @@ int main(void) taskENTER_CRITICAL(); /*进入临界区*/ ret = xTaskCreate((TaskFunction_t)QueueExampleTaskEntry, /* 任务入口函数 */ (const char *)"QueueExampleTaskEntry",/* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL,/* 任务入口函数参数 */ (UBaseType_t)8, /* 任务的优先级 */ NULL); diff --git a/example/freertos_feature/queue/sdkconfig b/example/freertos_feature/queue/sdkconfig index f5be9c941ece6e9ea645f66de8bf82e55ebfe11b..804de2d0fb5c5390161f591c5c6db41fccbf6bc6 100644 --- a/example/freertos_feature/queue/sdkconfig +++ b/example/freertos_feature/queue/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/queue/sdkconfig.h b/example/freertos_feature/queue/sdkconfig.h index 4bd9076b39cb4a8604d89e021a6d78c11cc6e567..12b86c67707103fff1d4730cb19503b99d95cd26 100644 --- a/example/freertos_feature/queue/sdkconfig.h +++ b/example/freertos_feature/queue/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,7 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/freertos_feature/resource/configs/d2000_aarch32_test_resoure.config b/example/freertos_feature/resource/configs/d2000_aarch32_test_resoure.config index 4766547b5fd98b798a9e8c8acb5dfee1a3a31bc8..f393b868c95bdd923e28e92caec56437fac67f33 100644 --- a/example/freertos_feature/resource/configs/d2000_aarch32_test_resoure.config +++ b/example/freertos_feature/resource/configs/d2000_aarch32_test_resoure.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/resource/configs/d2000_aarch64_test_resoure.config b/example/freertos_feature/resource/configs/d2000_aarch64_test_resoure.config index a95f357c726bc97141467047bc037a44621d63a1..1ee7832410377f32f355f6f227ba27f54ae55a3b 100644 --- a/example/freertos_feature/resource/configs/d2000_aarch64_test_resoure.config +++ b/example/freertos_feature/resource/configs/d2000_aarch64_test_resoure.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/resource/configs/e2000d_aarch32_demo_resoure.config b/example/freertos_feature/resource/configs/e2000d_aarch32_demo_resoure.config index a9a9384e0553232c1bb7a6553e54b5c03af1dcf5..1b67bc961c430689fa8bc602cfe91f97c92ce292 100644 --- a/example/freertos_feature/resource/configs/e2000d_aarch32_demo_resoure.config +++ b/example/freertos_feature/resource/configs/e2000d_aarch32_demo_resoure.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/resource/configs/e2000d_aarch64_demo_resoure.config b/example/freertos_feature/resource/configs/e2000d_aarch64_demo_resoure.config index 90e234a15d47c6d1ca8045196eeea26c45e8f85d..3d30e3016131bda1cf47fcaa90dca837d3afb13f 100644 --- a/example/freertos_feature/resource/configs/e2000d_aarch64_demo_resoure.config +++ b/example/freertos_feature/resource/configs/e2000d_aarch64_demo_resoure.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/resource/configs/e2000q_aarch32_demo_resoure.config b/example/freertos_feature/resource/configs/e2000q_aarch32_demo_resoure.config index c1c479d3f6b899b8ec3df454d22c9a8c06b184e0..dc1e0b775a7479e6972a239906c0109a24f16e00 100644 --- a/example/freertos_feature/resource/configs/e2000q_aarch32_demo_resoure.config +++ b/example/freertos_feature/resource/configs/e2000q_aarch32_demo_resoure.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/resource/configs/e2000q_aarch64_demo_resoure.config b/example/freertos_feature/resource/configs/e2000q_aarch64_demo_resoure.config index 65a523f43788fe48bcaf514365fe2c48c29906d4..03e9adbe1966f91352ba194ae549633422ecaa36 100644 --- a/example/freertos_feature/resource/configs/e2000q_aarch64_demo_resoure.config +++ b/example/freertos_feature/resource/configs/e2000q_aarch64_demo_resoure.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/resource/configs/ft2004_aarch32_dsk_resoure.config b/example/freertos_feature/resource/configs/ft2004_aarch32_dsk_resoure.config index ceac1c7d3dc07d1623cf0dbad3a5c66c75cdbe30..c378fd3ffd5129a2821512fb249ea65ca4cb8dff 100644 --- a/example/freertos_feature/resource/configs/ft2004_aarch32_dsk_resoure.config +++ b/example/freertos_feature/resource/configs/ft2004_aarch32_dsk_resoure.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/resource/configs/ft2004_aarch64_dsk_resoure.config b/example/freertos_feature/resource/configs/ft2004_aarch64_dsk_resoure.config index 9c943e92b1a48929a09f311b0712dbe2de16345a..195394a5eec1a21588ab32d1cebac365a6b6c4d9 100644 --- a/example/freertos_feature/resource/configs/ft2004_aarch64_dsk_resoure.config +++ b/example/freertos_feature/resource/configs/ft2004_aarch64_dsk_resoure.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/resource/configs/phytiumpi_aarch32_firefly_resoure.config b/example/freertos_feature/resource/configs/phytiumpi_aarch32_firefly_resoure.config index f1c38b29d4e6ae7cc47c3f62556a9033a6647ace..bbc779d06ce146df14270cc90d19153e424cacad 100644 --- a/example/freertos_feature/resource/configs/phytiumpi_aarch32_firefly_resoure.config +++ b/example/freertos_feature/resource/configs/phytiumpi_aarch32_firefly_resoure.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/resource/configs/phytiumpi_aarch64_firefly_resoure.config b/example/freertos_feature/resource/configs/phytiumpi_aarch64_firefly_resoure.config index 6b19321b339f24dcd97c464634b3c06903afca53..6ef610d9af18fca85971515427dc6e3c9b02004a 100644 --- a/example/freertos_feature/resource/configs/phytiumpi_aarch64_firefly_resoure.config +++ b/example/freertos_feature/resource/configs/phytiumpi_aarch64_firefly_resoure.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/resource/main.c b/example/freertos_feature/resource/main.c index 8647fc91f50c1a1a473529b3d73e22cab3170754..4302dc499e9fdb71f0ee53c3c9d34ef33bafb7d3 100644 --- a/example/freertos_feature/resource/main.c +++ b/example/freertos_feature/resource/main.c @@ -58,7 +58,7 @@ int main(void) /* used in no-letter-shell mode */ ret = xTaskCreate((TaskFunction_t)FeatureResourceExampleTaskEntry, /* 任务入口函数 */ (const char *)"FeatureResourceExampleTaskEntry",/* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL,/* 任务入口函数参数 */ (UBaseType_t)FEATURE_RESOUCE_EXAMPLE_TASK_PRIORITY, /* 任务的优先级 */ NULL); diff --git a/example/freertos_feature/resource/sdkconfig b/example/freertos_feature/resource/sdkconfig index 6b19321b339f24dcd97c464634b3c06903afca53..6ef610d9af18fca85971515427dc6e3c9b02004a 100644 --- a/example/freertos_feature/resource/sdkconfig +++ b/example/freertos_feature/resource/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/resource/sdkconfig.h b/example/freertos_feature/resource/sdkconfig.h index 1c96d173d72a89a3dba569e86ec214b86d8d67de..a0b66d1752e3998f2ea0848a76f7f57deddd0dec 100644 --- a/example/freertos_feature/resource/sdkconfig.h +++ b/example/freertos_feature/resource/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,7 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/freertos_feature/software_timer/configs/d2000_aarch32_test_software_timer.config b/example/freertos_feature/software_timer/configs/d2000_aarch32_test_software_timer.config index e0adac535e4c09bee085b20bee03b3df2cd3dbe4..81d62a6f71b355b2195ba5dffcc435e4369be880 100644 --- a/example/freertos_feature/software_timer/configs/d2000_aarch32_test_software_timer.config +++ b/example/freertos_feature/software_timer/configs/d2000_aarch32_test_software_timer.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/software_timer/configs/d2000_aarch64_test_software_timer.config b/example/freertos_feature/software_timer/configs/d2000_aarch64_test_software_timer.config index d17e970ed6f8508f2194c587774db52f979d7a44..249e75b65500c0bcd0a10366a60320906e7e13c8 100644 --- a/example/freertos_feature/software_timer/configs/d2000_aarch64_test_software_timer.config +++ b/example/freertos_feature/software_timer/configs/d2000_aarch64_test_software_timer.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/software_timer/configs/e2000d_aarch32_demo_software_timer.config b/example/freertos_feature/software_timer/configs/e2000d_aarch32_demo_software_timer.config index 6b1b10a2409e4bba99f8bddf0a75971167482f2c..3e736184b16e58ed31034b95792cdb0728c86ce7 100644 --- a/example/freertos_feature/software_timer/configs/e2000d_aarch32_demo_software_timer.config +++ b/example/freertos_feature/software_timer/configs/e2000d_aarch32_demo_software_timer.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/software_timer/configs/e2000d_aarch64_demo_software_timer.config b/example/freertos_feature/software_timer/configs/e2000d_aarch64_demo_software_timer.config index b784dd8369d22438ed1a83cf77fc442abdbb8099..431241b0575836671fddc219575902f588c335f2 100644 --- a/example/freertos_feature/software_timer/configs/e2000d_aarch64_demo_software_timer.config +++ b/example/freertos_feature/software_timer/configs/e2000d_aarch64_demo_software_timer.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/software_timer/configs/e2000q_aarch32_demo_software_timer.config b/example/freertos_feature/software_timer/configs/e2000q_aarch32_demo_software_timer.config index 9a24a19969ef94d5615e8050724e3ee5b39a494a..3c35d420c224702af3bd541f12496b350c3f5a88 100644 --- a/example/freertos_feature/software_timer/configs/e2000q_aarch32_demo_software_timer.config +++ b/example/freertos_feature/software_timer/configs/e2000q_aarch32_demo_software_timer.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/software_timer/configs/e2000q_aarch64_demo_software_timer.config b/example/freertos_feature/software_timer/configs/e2000q_aarch64_demo_software_timer.config index e21296caa237bd5e59a36d7aaa81811dc9deca2f..7e651cb9eacd8163f79e1ffc50fd5802a8f2b674 100644 --- a/example/freertos_feature/software_timer/configs/e2000q_aarch64_demo_software_timer.config +++ b/example/freertos_feature/software_timer/configs/e2000q_aarch64_demo_software_timer.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/software_timer/configs/ft2004_aarch32_dsk_software_timer.config b/example/freertos_feature/software_timer/configs/ft2004_aarch32_dsk_software_timer.config index 328f4a3888ecf16c8c95c41f5ee1664a24ed28bb..aa975b7cdd4ac67f12029944e3bab2333bb14057 100644 --- a/example/freertos_feature/software_timer/configs/ft2004_aarch32_dsk_software_timer.config +++ b/example/freertos_feature/software_timer/configs/ft2004_aarch32_dsk_software_timer.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/software_timer/configs/ft2004_aarch64_dsk_software_timer.config b/example/freertos_feature/software_timer/configs/ft2004_aarch64_dsk_software_timer.config index a35750899fa8f602b802742b77a2ab3f83c77873..2bca5361d2008d5ea78727ee99d5be532131c4b7 100644 --- a/example/freertos_feature/software_timer/configs/ft2004_aarch64_dsk_software_timer.config +++ b/example/freertos_feature/software_timer/configs/ft2004_aarch64_dsk_software_timer.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/software_timer/configs/phytiumpi_aarch32_firefly_software_timer.config b/example/freertos_feature/software_timer/configs/phytiumpi_aarch32_firefly_software_timer.config index 9e47717a17440fb28696dbe3f75636f8737d93f0..f62ed8053dcd0980e47c5d4f5ad9e3f555c3de1e 100644 --- a/example/freertos_feature/software_timer/configs/phytiumpi_aarch32_firefly_software_timer.config +++ b/example/freertos_feature/software_timer/configs/phytiumpi_aarch32_firefly_software_timer.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/software_timer/configs/phytiumpi_aarch64_firefly_software_timer.config b/example/freertos_feature/software_timer/configs/phytiumpi_aarch64_firefly_software_timer.config index 46eb45712994794ee99bb3e87ba728848f6f4a16..b9835fcbf8d580e3e142cfa4bbf5dd10fe24199a 100644 --- a/example/freertos_feature/software_timer/configs/phytiumpi_aarch64_firefly_software_timer.config +++ b/example/freertos_feature/software_timer/configs/phytiumpi_aarch64_firefly_software_timer.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/software_timer/main.c b/example/freertos_feature/software_timer/main.c index 9cc5876fd534c1d30d3edb6672e53de6fd3d5610..fd1d77c94b7202dd7b0ce1af90c2d1c7901c3226 100644 --- a/example/freertos_feature/software_timer/main.c +++ b/example/freertos_feature/software_timer/main.c @@ -55,7 +55,7 @@ int main(void) /* used in no-letter-shell mode */ ret = xTaskCreate((TaskFunction_t)SoftwareTimerExampleTaskEntry, (const char *)"SoftwareTimerExampleTaskEntry", - (uint16_t)4096, + 4096, NULL, (UBaseType_t)SOFTWARE_TIMER_EXAMPLE_TASK_PRIORITY, NULL); diff --git a/example/freertos_feature/software_timer/sdkconfig b/example/freertos_feature/software_timer/sdkconfig index 46eb45712994794ee99bb3e87ba728848f6f4a16..b9835fcbf8d580e3e142cfa4bbf5dd10fe24199a 100644 --- a/example/freertos_feature/software_timer/sdkconfig +++ b/example/freertos_feature/software_timer/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/software_timer/sdkconfig.h b/example/freertos_feature/software_timer/sdkconfig.h index 10df592a7313be4ea956c186072db6c5511aaa61..fb36b65788defe6808a0eca4870d01c2d5fb134d 100644 --- a/example/freertos_feature/software_timer/sdkconfig.h +++ b/example/freertos_feature/software_timer/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,7 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/freertos_feature/task/configs/d2000_aarch32_test_task.config b/example/freertos_feature/task/configs/d2000_aarch32_test_task.config index fa8644ea87c6385ccae66de82273c4b342e4bb4f..aacc0958eb074b0a700a4a4bb87af188a7e9e57e 100644 --- a/example/freertos_feature/task/configs/d2000_aarch32_test_task.config +++ b/example/freertos_feature/task/configs/d2000_aarch32_test_task.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task/configs/d2000_aarch64_test_task.config b/example/freertos_feature/task/configs/d2000_aarch64_test_task.config index 33d029ef71454ac25d0c0149bbf6a2c481d4a98c..6bd09997d4a16eeaf44774f9bdfcd3d4c4dc83b6 100644 --- a/example/freertos_feature/task/configs/d2000_aarch64_test_task.config +++ b/example/freertos_feature/task/configs/d2000_aarch64_test_task.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task/configs/e2000d_aarch32_demo_task.config b/example/freertos_feature/task/configs/e2000d_aarch32_demo_task.config index d37f5725a7779547cdce42b10fb6e75cba443551..999f5bc20366bec0ae2951eaa6318e53b12d24b6 100644 --- a/example/freertos_feature/task/configs/e2000d_aarch32_demo_task.config +++ b/example/freertos_feature/task/configs/e2000d_aarch32_demo_task.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task/configs/e2000d_aarch64_demo_task.config b/example/freertos_feature/task/configs/e2000d_aarch64_demo_task.config index 560491b3a77a0715bdfaedb06ba54fbabaa4611f..eac9c5e34c7f27a2281dc15764935d339ed6c643 100644 --- a/example/freertos_feature/task/configs/e2000d_aarch64_demo_task.config +++ b/example/freertos_feature/task/configs/e2000d_aarch64_demo_task.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task/configs/e2000q_aarch32_demo_task.config b/example/freertos_feature/task/configs/e2000q_aarch32_demo_task.config index 3bcc6ddb2989210b91a75fc50c711a98d8f7cc70..b3518f362537ac72bd19c6eb1963091a482f2a68 100644 --- a/example/freertos_feature/task/configs/e2000q_aarch32_demo_task.config +++ b/example/freertos_feature/task/configs/e2000q_aarch32_demo_task.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task/configs/e2000q_aarch64_demo_task.config b/example/freertos_feature/task/configs/e2000q_aarch64_demo_task.config index 0f4e1314d094076a977278988c4e7e83cdddaf25..2aef1fe125cc2da5e10ceac43365514d629fcb0d 100644 --- a/example/freertos_feature/task/configs/e2000q_aarch64_demo_task.config +++ b/example/freertos_feature/task/configs/e2000q_aarch64_demo_task.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task/configs/ft2004_aarch32_dsk_task.config b/example/freertos_feature/task/configs/ft2004_aarch32_dsk_task.config index e19f2f7e8843132b3e6f2cd3fc0eaacee81de5c0..18aa8da66a579429349902490972b86f2f495bcc 100644 --- a/example/freertos_feature/task/configs/ft2004_aarch32_dsk_task.config +++ b/example/freertos_feature/task/configs/ft2004_aarch32_dsk_task.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task/configs/ft2004_aarch64_dsk_task.config b/example/freertos_feature/task/configs/ft2004_aarch64_dsk_task.config index d3b80df79508a997bb15c537c3e1c864f2dcd594..6d75425a870df7d77e66f193c21fe0edf7cd9f2a 100644 --- a/example/freertos_feature/task/configs/ft2004_aarch64_dsk_task.config +++ b/example/freertos_feature/task/configs/ft2004_aarch64_dsk_task.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task/configs/phytiumpi_aarch32_firefly_task.config b/example/freertos_feature/task/configs/phytiumpi_aarch32_firefly_task.config index e6de09f53d42317f0fffd3446a1640745675c557..972a2455ae544812db82fa70502d1ae7c6220f9e 100644 --- a/example/freertos_feature/task/configs/phytiumpi_aarch32_firefly_task.config +++ b/example/freertos_feature/task/configs/phytiumpi_aarch32_firefly_task.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task/configs/phytiumpi_aarch64_firefly_task.config b/example/freertos_feature/task/configs/phytiumpi_aarch64_firefly_task.config index ae1db029e2a445938b4d5060f6b411f7db002a1d..6961ce5ba7d912ce516df1bb73aa94a5b00ac2cd 100644 --- a/example/freertos_feature/task/configs/phytiumpi_aarch64_firefly_task.config +++ b/example/freertos_feature/task/configs/phytiumpi_aarch64_firefly_task.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task/main.c b/example/freertos_feature/task/main.c index 05bb329f9baa2438abac6ff3ab08830911e2df3d..01d57ff734ba2cd34d356c462d5fb2127e44d7ff 100755 --- a/example/freertos_feature/task/main.c +++ b/example/freertos_feature/task/main.c @@ -45,7 +45,7 @@ int main(void) #else ret = xTaskCreate((TaskFunction_t)TasksExampleEntry, (const char *)"TasksExampleEntry", - (uint16_t)4096, + 4096, NULL, (UBaseType_t)2, NULL); diff --git a/example/freertos_feature/task/sdkconfig b/example/freertos_feature/task/sdkconfig index ae1db029e2a445938b4d5060f6b411f7db002a1d..6961ce5ba7d912ce516df1bb73aa94a5b00ac2cd 100644 --- a/example/freertos_feature/task/sdkconfig +++ b/example/freertos_feature/task/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task/sdkconfig.h b/example/freertos_feature/task/sdkconfig.h index bc4f42f053fd5c23a74b7e949454b400d4d3a139..7212abd15a4cfdeecf416949391651a1761771cd 100644 --- a/example/freertos_feature/task/sdkconfig.h +++ b/example/freertos_feature/task/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,7 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/freertos_feature/task_notify/configs/d2000_aarch32_test_task_notify.config b/example/freertos_feature/task_notify/configs/d2000_aarch32_test_task_notify.config index 7cb13b86f58ccf3450deb3c41881871779039150..6c425a70f27f040a7ef2c2bf429567f3b5b5e95d 100644 --- a/example/freertos_feature/task_notify/configs/d2000_aarch32_test_task_notify.config +++ b/example/freertos_feature/task_notify/configs/d2000_aarch32_test_task_notify.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task_notify/configs/d2000_aarch64_test_task_notify.config b/example/freertos_feature/task_notify/configs/d2000_aarch64_test_task_notify.config index 79c49caa3e47a1b7e795d56b2b90dc9f35e7982a..899d58e63e743d9093d52106286c8d6373dc10f3 100644 --- a/example/freertos_feature/task_notify/configs/d2000_aarch64_test_task_notify.config +++ b/example/freertos_feature/task_notify/configs/d2000_aarch64_test_task_notify.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task_notify/configs/e2000d_aarch32_demo_task_notify.config b/example/freertos_feature/task_notify/configs/e2000d_aarch32_demo_task_notify.config index ae395259129386b64c6fd099bc35be7ed653f0c0..17ca77145999d1aa334c013af66562f87125d48c 100644 --- a/example/freertos_feature/task_notify/configs/e2000d_aarch32_demo_task_notify.config +++ b/example/freertos_feature/task_notify/configs/e2000d_aarch32_demo_task_notify.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task_notify/configs/e2000d_aarch64_demo_task_notify.config b/example/freertos_feature/task_notify/configs/e2000d_aarch64_demo_task_notify.config index 1bac5dd1f3fba7966f50ee18141d885b3db4bf85..901b2e55b49bd5f22266ab15a86201a9658d7ed9 100644 --- a/example/freertos_feature/task_notify/configs/e2000d_aarch64_demo_task_notify.config +++ b/example/freertos_feature/task_notify/configs/e2000d_aarch64_demo_task_notify.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task_notify/configs/e2000q_aarch32_demo_task_notify.config b/example/freertos_feature/task_notify/configs/e2000q_aarch32_demo_task_notify.config index 30f00f6b654465ec36804234392a1613a2eeaa9d..fc59368bbabbb12b1ed7118b1b7f1b132026cda0 100644 --- a/example/freertos_feature/task_notify/configs/e2000q_aarch32_demo_task_notify.config +++ b/example/freertos_feature/task_notify/configs/e2000q_aarch32_demo_task_notify.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task_notify/configs/e2000q_aarch64_demo_task_notify.config b/example/freertos_feature/task_notify/configs/e2000q_aarch64_demo_task_notify.config index d3988de1779b88e3a31c2465099247d65e591756..5d5d0b6d7734b00d082c80a91fe23380f22b60fb 100644 --- a/example/freertos_feature/task_notify/configs/e2000q_aarch64_demo_task_notify.config +++ b/example/freertos_feature/task_notify/configs/e2000q_aarch64_demo_task_notify.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task_notify/configs/ft2004_aarch32_dsk_task_notify.config b/example/freertos_feature/task_notify/configs/ft2004_aarch32_dsk_task_notify.config index 55dbbf2474429c4ca1249ebd45236cc10d90678c..9c6e8658f357516b293f5f26f65e49b6bfbdd53f 100644 --- a/example/freertos_feature/task_notify/configs/ft2004_aarch32_dsk_task_notify.config +++ b/example/freertos_feature/task_notify/configs/ft2004_aarch32_dsk_task_notify.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task_notify/configs/ft2004_aarch64_dsk_task_notify.config b/example/freertos_feature/task_notify/configs/ft2004_aarch64_dsk_task_notify.config index 9359d1eb65ab39679c41dcf98ec167ef752b7a46..aceabd1283984900655a0b718daa96898a67c1b8 100644 --- a/example/freertos_feature/task_notify/configs/ft2004_aarch64_dsk_task_notify.config +++ b/example/freertos_feature/task_notify/configs/ft2004_aarch64_dsk_task_notify.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task_notify/configs/phytiumpi_aarch32_firefly_task_notify.config b/example/freertos_feature/task_notify/configs/phytiumpi_aarch32_firefly_task_notify.config index a276beea52b5608e2cc21488a6777699de717cb0..1079c45de7be6ffb18bdd1241b57a84fb8b8b4d1 100644 --- a/example/freertos_feature/task_notify/configs/phytiumpi_aarch32_firefly_task_notify.config +++ b/example/freertos_feature/task_notify/configs/phytiumpi_aarch32_firefly_task_notify.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task_notify/configs/phytiumpi_aarch64_firefly_task_notify.config b/example/freertos_feature/task_notify/configs/phytiumpi_aarch64_firefly_task_notify.config index 1224bbafe34eb283fe74dbff4fcad8d1a3c8df28..b0f893a17b19e5a18c943d0be48c00ad5a770295 100644 --- a/example/freertos_feature/task_notify/configs/phytiumpi_aarch64_firefly_task_notify.config +++ b/example/freertos_feature/task_notify/configs/phytiumpi_aarch64_firefly_task_notify.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task_notify/main.c b/example/freertos_feature/task_notify/main.c index f4b3f2811488c6531b73f2d702bdc2b5cd08abc7..73d9d8b48867f98d6580e714e350ca689d89a6e4 100644 --- a/example/freertos_feature/task_notify/main.c +++ b/example/freertos_feature/task_notify/main.c @@ -56,7 +56,7 @@ int main(void) taskENTER_CRITICAL(); /*进入临界区*/ ret = xTaskCreate((TaskFunction_t)NotifyExampleTaskEntry, /* 任务入口函数 */ (const char *)"NotifyExampleTaskEntry",/* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL,/* 任务入口函数参数 */ (UBaseType_t)8, /* 任务的优先级 */ NULL); diff --git a/example/freertos_feature/task_notify/sdkconfig b/example/freertos_feature/task_notify/sdkconfig index 1224bbafe34eb283fe74dbff4fcad8d1a3c8df28..b0f893a17b19e5a18c943d0be48c00ad5a770295 100644 --- a/example/freertos_feature/task_notify/sdkconfig +++ b/example/freertos_feature/task_notify/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/freertos_feature/task_notify/sdkconfig.h b/example/freertos_feature/task_notify/sdkconfig.h index 6ff2990c4870e77dc6188521c62e18f98b4024ca..db587eff8efaaf2c54c39536013c57ed97967c98 100644 --- a/example/freertos_feature/task_notify/sdkconfig.h +++ b/example/freertos_feature/task_notify/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,7 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/network/lwip_iperf/configs/d2000_aarch32_test_lwip_iperf.config b/example/network/lwip_iperf/configs/d2000_aarch32_test_lwip_iperf.config index 21853b3f2b4a41af9cd4372461282a070f131e3f..545eea42017705333da9adebe1910f06687a2b7d 100644 --- a/example/network/lwip_iperf/configs/d2000_aarch32_test_lwip_iperf.config +++ b/example/network/lwip_iperf/configs/d2000_aarch32_test_lwip_iperf.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -146,7 +140,6 @@ CONFIG_FGMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -336,6 +329,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # CONFIG_USE_LWIP_APP_LWIPERF=y # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_iperf/configs/d2000_aarch64_test_lwip_iperf.config b/example/network/lwip_iperf/configs/d2000_aarch64_test_lwip_iperf.config index 6ceb16dbac3e8e86662dc7ee61b1b4a48ec0d00f..502738e586757f8cc7927a78791e78f26670b18d 100644 --- a/example/network/lwip_iperf/configs/d2000_aarch64_test_lwip_iperf.config +++ b/example/network/lwip_iperf/configs/d2000_aarch64_test_lwip_iperf.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -140,7 +134,6 @@ CONFIG_FGMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -325,6 +318,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # CONFIG_USE_LWIP_APP_LWIPERF=y # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_iperf/configs/e2000d_aarch32_demo_lwip_iperf.config b/example/network/lwip_iperf/configs/e2000d_aarch32_demo_lwip_iperf.config index d7db358dc502bbc421c564670a7b03f2b4b273a8..8d8584b5fe88db77b16922a76d75dd0fd70ff443 100644 --- a/example/network/lwip_iperf/configs/e2000d_aarch32_demo_lwip_iperf.config +++ b/example/network/lwip_iperf/configs/e2000d_aarch32_demo_lwip_iperf.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -159,7 +153,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -350,6 +343,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # CONFIG_USE_LWIP_APP_LWIPERF=y # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_iperf/configs/e2000d_aarch64_demo_lwip_iperf.config b/example/network/lwip_iperf/configs/e2000d_aarch64_demo_lwip_iperf.config index 2b75de017e275ab1ed27508e0b1598f9d02592df..34f1b2019840c0a816288816de342087f633567c 100644 --- a/example/network/lwip_iperf/configs/e2000d_aarch64_demo_lwip_iperf.config +++ b/example/network/lwip_iperf/configs/e2000d_aarch64_demo_lwip_iperf.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -153,7 +147,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -339,6 +332,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # CONFIG_USE_LWIP_APP_LWIPERF=y # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_iperf/configs/e2000q_aarch32_demo_lwip_iperf.config b/example/network/lwip_iperf/configs/e2000q_aarch32_demo_lwip_iperf.config index 8ffe7ec3b2c7110e02ab5dae9b19e75a6ddd0125..a540fd9d02fd38d06944630cc96656625a176e32 100644 --- a/example/network/lwip_iperf/configs/e2000q_aarch32_demo_lwip_iperf.config +++ b/example/network/lwip_iperf/configs/e2000q_aarch32_demo_lwip_iperf.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -158,7 +152,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -349,6 +342,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # CONFIG_USE_LWIP_APP_LWIPERF=y # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_iperf/configs/e2000q_aarch64_demo_lwip_iperf.config b/example/network/lwip_iperf/configs/e2000q_aarch64_demo_lwip_iperf.config index 00dabf7555da4ccc5abded6104aa6ccfebbc0c20..23a8058feaef427a9b6a255b46cc5af17c1f7834 100644 --- a/example/network/lwip_iperf/configs/e2000q_aarch64_demo_lwip_iperf.config +++ b/example/network/lwip_iperf/configs/e2000q_aarch64_demo_lwip_iperf.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -152,7 +146,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -338,6 +331,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # CONFIG_USE_LWIP_APP_LWIPERF=y # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_iperf/configs/ft2004_aarch32_dsk_lwip_iperf.config b/example/network/lwip_iperf/configs/ft2004_aarch32_dsk_lwip_iperf.config index fb2d3bb0af481d2f5482d1b9d277d0919e886098..a2079705517dcab9f842f769bace07e9233597fe 100644 --- a/example/network/lwip_iperf/configs/ft2004_aarch32_dsk_lwip_iperf.config +++ b/example/network/lwip_iperf/configs/ft2004_aarch32_dsk_lwip_iperf.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -146,7 +140,6 @@ CONFIG_FGMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -336,6 +329,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # CONFIG_USE_LWIP_APP_LWIPERF=y # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_iperf/configs/ft2004_aarch64_dsk_lwip_iperf.config b/example/network/lwip_iperf/configs/ft2004_aarch64_dsk_lwip_iperf.config index 7a5750870a239822d9a0dafde846cd8c433c7f0a..221f6dc9d4b62c754884e2cf1e8e300ae011ca39 100644 --- a/example/network/lwip_iperf/configs/ft2004_aarch64_dsk_lwip_iperf.config +++ b/example/network/lwip_iperf/configs/ft2004_aarch64_dsk_lwip_iperf.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -140,7 +134,6 @@ CONFIG_FGMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -325,6 +318,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # CONFIG_USE_LWIP_APP_LWIPERF=y # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_iperf/configs/phytiumpi_aarch32_firefly_lwip_iperf.config b/example/network/lwip_iperf/configs/phytiumpi_aarch32_firefly_lwip_iperf.config index 7681c3ee00259dec8148d4b5fbe76b1dd083dc26..fb47b17c0ab1207a1b563bd4ef70ce10af225940 100644 --- a/example/network/lwip_iperf/configs/phytiumpi_aarch32_firefly_lwip_iperf.config +++ b/example/network/lwip_iperf/configs/phytiumpi_aarch32_firefly_lwip_iperf.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -157,7 +151,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -348,6 +341,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # CONFIG_USE_LWIP_APP_LWIPERF=y # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_iperf/configs/phytiumpi_aarch64_firefly_lwip_iperf.config b/example/network/lwip_iperf/configs/phytiumpi_aarch64_firefly_lwip_iperf.config index 28a3a251a62cc9112a6fb3c63de8d9dddf4b747b..c8bdff45e4de153e15687b87db00dc8f64c26af3 100644 --- a/example/network/lwip_iperf/configs/phytiumpi_aarch64_firefly_lwip_iperf.config +++ b/example/network/lwip_iperf/configs/phytiumpi_aarch64_firefly_lwip_iperf.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -151,7 +145,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -337,6 +330,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # CONFIG_USE_LWIP_APP_LWIPERF=y # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_iperf/main.c b/example/network/lwip_iperf/main.c index dc881a5ff75262684a331155d4c1fd3c316f5b18..fdb0ab8d15d07c2db204e64ef1e9dc759251372b 100644 --- a/example/network/lwip_iperf/main.c +++ b/example/network/lwip_iperf/main.c @@ -62,7 +62,7 @@ int main(void) /* used in no-letter-shell mode */ ret = xTaskCreate((TaskFunction_t)LwipIperfExampleTaskEntry, /* 任务入口函数 */ (const char *)"LwipIperfExampleTaskEntry", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)LWIP_IPERF_EXAMPLE_TASK_PRIORITY, /* 任务优先级 */ NULL); /* 任务句柄 */ diff --git a/example/network/lwip_iperf/sdkconfig b/example/network/lwip_iperf/sdkconfig index 28a3a251a62cc9112a6fb3c63de8d9dddf4b747b..c8bdff45e4de153e15687b87db00dc8f64c26af3 100644 --- a/example/network/lwip_iperf/sdkconfig +++ b/example/network/lwip_iperf/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -151,7 +145,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -337,6 +330,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # CONFIG_USE_LWIP_APP_LWIPERF=y # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_iperf/sdkconfig.h b/example/network/lwip_iperf/sdkconfig.h index b24dfd292857cb1dd583d99126f1bcf137a2dd9a..c517004787dc3efe24ecb995b5c439609e6c743a 100644 --- a/example/network/lwip_iperf/sdkconfig.h +++ b/example/network/lwip_iperf/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -137,7 +132,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ @@ -191,7 +185,7 @@ #define CONFIG_DEFAULT_LINKER_SCRIPT /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_IMAGE_LOAD_ADDRESS 0x80100000 -#define CONFIG_IMAGE_MAX_LENGTH 0x1000000 +#define CONFIG_IMAGE_MAX_LENGTH 0x2000000 #define CONFIG_HEAP_SIZE 1 #define CONFIG_STACK_SIZE 0x400 /* end of Linker Options */ @@ -293,6 +287,7 @@ #define CONFIG_USE_LWIP_APP_LWIPERF /* CONFIG_USE_LWIP_APP_TFTP is not set */ +/* CONFIG_USE_LWIP_APP_SNTP is not set */ /* end of LWIP_APP */ /* Memory configuration */ diff --git a/example/network/lwip_iperf/src/lwip_iperf_client_example.c b/example/network/lwip_iperf/src/lwip_iperf_client_example.c index daa5a0b81307ed3e53608a845446f59fd3d33930..c620dc9d8841453a5b82da82e92204b03638f0d0 100644 --- a/example/network/lwip_iperf/src/lwip_iperf_client_example.c +++ b/example/network/lwip_iperf/src/lwip_iperf_client_example.c @@ -199,7 +199,7 @@ int FFreeRTOSLwipIperfClientTaskCreate(void) xReturn = xTaskCreate((TaskFunction_t)LwipIperfClientTestTask, /* 任务入口函数 */ (const char *)"LwipIperfClientTestTask", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 1, /* 任务的优先级 */ NULL); /* 任务控制块指针 */ diff --git a/example/network/lwip_iperf/src/lwip_iperf_server_example.c b/example/network/lwip_iperf/src/lwip_iperf_server_example.c index 5607c42ba47b83a8d9c88606d5a8a54b01754911..893440f771d7b1c88d7769f9e592f03f72a03ffb 100644 --- a/example/network/lwip_iperf/src/lwip_iperf_server_example.c +++ b/example/network/lwip_iperf/src/lwip_iperf_server_example.c @@ -197,7 +197,7 @@ int FFreeRTOSLwipIperfServerTaskCreate(void) xReturn = xTaskCreate((TaskFunction_t)LwipIperfServerTestTask, /* 任务入口函数 */ (const char *)"LwipIperfServerTestTask", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 1, /* 任务的优先级 */ NULL); /* 任务控制块指针 */ diff --git a/example/network/lwip_startup/configs/d2000_aarch32_test_lwip_startup.config b/example/network/lwip_startup/configs/d2000_aarch32_test_lwip_startup.config index df80adcb94c67e6f3e2e3e4662c03e26074cffd2..1ff6a28925c59b24c9a502ed1ce586703b96a8e7 100644 --- a/example/network/lwip_startup/configs/d2000_aarch32_test_lwip_startup.config +++ b/example/network/lwip_startup/configs/d2000_aarch32_test_lwip_startup.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -146,7 +140,6 @@ CONFIG_FGMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -336,6 +329,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_startup/configs/d2000_aarch64_test_lwip_startup.config b/example/network/lwip_startup/configs/d2000_aarch64_test_lwip_startup.config index 5fc01c4979ee0bf2c6fe3940fd4d2f6cd3b7e45d..ee31f56eeca611647c45e868691398e897d35222 100644 --- a/example/network/lwip_startup/configs/d2000_aarch64_test_lwip_startup.config +++ b/example/network/lwip_startup/configs/d2000_aarch64_test_lwip_startup.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -140,7 +134,6 @@ CONFIG_FGMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -325,6 +318,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_startup/configs/e2000d_aarch32_demo_lwip_startup.config b/example/network/lwip_startup/configs/e2000d_aarch32_demo_lwip_startup.config index c1d746b0199501ff6917b64df02fd3c106728437..0d12b462ae86a1ce3c5c5ce3a21806560d0182ec 100644 --- a/example/network/lwip_startup/configs/e2000d_aarch32_demo_lwip_startup.config +++ b/example/network/lwip_startup/configs/e2000d_aarch32_demo_lwip_startup.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -159,7 +153,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -349,6 +342,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_startup/configs/e2000d_aarch64_demo_lwip_startup.config b/example/network/lwip_startup/configs/e2000d_aarch64_demo_lwip_startup.config index 1c81da6f01a26222b5a3b86e081772af0e7db796..c68220f6533d41cb907331f34b768b59d3f4a53c 100644 --- a/example/network/lwip_startup/configs/e2000d_aarch64_demo_lwip_startup.config +++ b/example/network/lwip_startup/configs/e2000d_aarch64_demo_lwip_startup.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -153,7 +147,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -338,6 +331,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_startup/configs/e2000q_aarch32_demo_lwip_startup.config b/example/network/lwip_startup/configs/e2000q_aarch32_demo_lwip_startup.config index 16dc7e5b5ce35ffeb559f8050decbbd05d10bce3..d6c04967edac1c22b31e3b0db2eb23c6e4f6fa04 100644 --- a/example/network/lwip_startup/configs/e2000q_aarch32_demo_lwip_startup.config +++ b/example/network/lwip_startup/configs/e2000q_aarch32_demo_lwip_startup.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -158,7 +152,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -348,6 +341,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_startup/configs/e2000q_aarch64_demo_lwip_startup.config b/example/network/lwip_startup/configs/e2000q_aarch64_demo_lwip_startup.config index b7f31155df2ae5530bf5142a709d1619448bc445..31c14462c276c559dec64f616c15de886a0f33cd 100644 --- a/example/network/lwip_startup/configs/e2000q_aarch64_demo_lwip_startup.config +++ b/example/network/lwip_startup/configs/e2000q_aarch64_demo_lwip_startup.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -152,7 +146,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -337,6 +330,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_startup/configs/ft2004_aarch32_dsk_lwip_startup.config b/example/network/lwip_startup/configs/ft2004_aarch32_dsk_lwip_startup.config index e686baa9966484b5b3b684ef06601c5ecef1528b..fa7459c2e3d194f8a27394ca1f98df4d4452f350 100644 --- a/example/network/lwip_startup/configs/ft2004_aarch32_dsk_lwip_startup.config +++ b/example/network/lwip_startup/configs/ft2004_aarch32_dsk_lwip_startup.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -146,7 +140,6 @@ CONFIG_FGMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -336,6 +329,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_startup/configs/ft2004_aarch64_dsk_lwip_startup.config b/example/network/lwip_startup/configs/ft2004_aarch64_dsk_lwip_startup.config index b6f04e3aaff20d25f6a5fada0108f0ce7a6f8745..1dab7e686e670fcc18aa21b1916d1ac81f74862d 100644 --- a/example/network/lwip_startup/configs/ft2004_aarch64_dsk_lwip_startup.config +++ b/example/network/lwip_startup/configs/ft2004_aarch64_dsk_lwip_startup.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -140,7 +134,6 @@ CONFIG_FGMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -325,6 +318,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_startup/configs/phytiumpi_aarch32_firefly_lwip_startup.config b/example/network/lwip_startup/configs/phytiumpi_aarch32_firefly_lwip_startup.config index 521574a6b1aec8a69d1ceca0982e591c6e8101c5..ef901467d8875914fccdb3353b4dc133715b41f5 100644 --- a/example/network/lwip_startup/configs/phytiumpi_aarch32_firefly_lwip_startup.config +++ b/example/network/lwip_startup/configs/phytiumpi_aarch32_firefly_lwip_startup.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -157,7 +151,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -347,6 +340,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_startup/configs/phytiumpi_aarch64_firefly_lwip_startup.config b/example/network/lwip_startup/configs/phytiumpi_aarch64_firefly_lwip_startup.config index 94dbc83292d85b4751d5b3ae5520c681ff465874..146d78102c412208af07c1776ff22d9d202974cf 100644 --- a/example/network/lwip_startup/configs/phytiumpi_aarch64_firefly_lwip_startup.config +++ b/example/network/lwip_startup/configs/phytiumpi_aarch64_firefly_lwip_startup.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -151,7 +145,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -336,6 +329,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_startup/main.c b/example/network/lwip_startup/main.c index 5da7b22e0d55d397da2fde375a32393d427223ae..cd9d80015599719bcb1d2336842341b37e1c49b6 100644 --- a/example/network/lwip_startup/main.c +++ b/example/network/lwip_startup/main.c @@ -65,7 +65,7 @@ int main(void) /* used in no-letter-shell mode */ ret = xTaskCreate((TaskFunction_t)LwipStartupExampleTaskEntry, /* 任务入口函数 */ (const char *)"LwipStartupExampleTaskEntry", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)LWIP_STARTUP_EXAMPLE_TASK_PRIORITY, /* 任务优先级 */ NULL); /* 任务句柄 */ diff --git a/example/network/lwip_startup/sdkconfig b/example/network/lwip_startup/sdkconfig index 94dbc83292d85b4751d5b3ae5520c681ff465874..146d78102c412208af07c1776ff22d9d202974cf 100644 --- a/example/network/lwip_startup/sdkconfig +++ b/example/network/lwip_startup/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -151,7 +145,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -336,6 +329,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/lwip_startup/sdkconfig.h b/example/network/lwip_startup/sdkconfig.h index 7215ea6b0e223edb212d41b42519455c76253e0b..6388755df926bcd39d334f121d4bd65d83fcb7e7 100644 --- a/example/network/lwip_startup/sdkconfig.h +++ b/example/network/lwip_startup/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -137,7 +132,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ @@ -292,6 +286,7 @@ /* CONFIG_USE_LWIP_APP_LWIPERF is not set */ /* CONFIG_USE_LWIP_APP_TFTP is not set */ +/* CONFIG_USE_LWIP_APP_SNTP is not set */ /* end of LWIP_APP */ /* Memory configuration */ diff --git a/example/network/lwip_startup/src/lwip_dhcp_example.c b/example/network/lwip_startup/src/lwip_dhcp_example.c index 627be6b02015df0ea2a12954b8a95e70f76ea74f..08ae7c3cee43772d262c85d6c6715bf63facd2fc 100644 --- a/example/network/lwip_startup/src/lwip_dhcp_example.c +++ b/example/network/lwip_startup/src/lwip_dhcp_example.c @@ -211,7 +211,7 @@ int FFreeRTOSLwipDhcpTaskCreate(void) xReturn = xTaskCreate((TaskFunction_t)LwipDhcpInitTask, /* 任务入口函数 */ (const char *)"LwipDhcpInitTask", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 1, /* 任务的优先级 */ NULL); /* 任务控制块指针 */ diff --git a/example/network/lwip_startup/src/lwip_ipv4_example.c b/example/network/lwip_startup/src/lwip_ipv4_example.c index c8109e49b498e69c05fd8558bee4da388b68769a..fc95b96c9baa5babae98c522e98869264048db5d 100644 --- a/example/network/lwip_startup/src/lwip_ipv4_example.c +++ b/example/network/lwip_startup/src/lwip_ipv4_example.c @@ -181,7 +181,7 @@ int FFreeRTOSLwipIpv4TaskCreate(void) xReturn = xTaskCreate((TaskFunction_t)LwipIpv4InitTask, /* 任务入口函数 */ (const char *)"LwipIpv4InitTask", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 1, /* 任务的优先级 */ NULL); /* 任务控制块指针 */ diff --git a/example/network/lwip_startup/src/lwip_ipv6_example.c b/example/network/lwip_startup/src/lwip_ipv6_example.c index acbc6ebc28b6b7695ae34200172760ddbe28a4ac..2e4d1fe46cdfd6ede08c08b516a16f23d2c40e5b 100644 --- a/example/network/lwip_startup/src/lwip_ipv6_example.c +++ b/example/network/lwip_startup/src/lwip_ipv6_example.c @@ -190,7 +190,7 @@ int FFreeRTOSLwipIpv6TaskCreate(void) xReturn = xTaskCreate((TaskFunction_t)LwipIpv6InitTask, /* 任务入口函数 */ (const char *)"LwipIpv6InitTask", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 1, /* 任务的优先级 */ NULL); /* 任务控制块指针 */ diff --git a/example/network/sockets/udp_multicast/configs/d2000_aarch32_test_udp_multicast.config b/example/network/sockets/udp_multicast/configs/d2000_aarch32_test_udp_multicast.config index e3c2152e5a27ca0b729feebb15bb9f5866c5a432..2e1d8a04398fd7763cd809e03f6226d47249ac73 100644 --- a/example/network/sockets/udp_multicast/configs/d2000_aarch32_test_udp_multicast.config +++ b/example/network/sockets/udp_multicast/configs/d2000_aarch32_test_udp_multicast.config @@ -118,12 +118,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -163,7 +157,6 @@ CONFIG_FGMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -353,6 +346,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/sockets/udp_multicast/configs/d2000_aarch64_test_udp_multicast.config b/example/network/sockets/udp_multicast/configs/d2000_aarch64_test_udp_multicast.config index 053ef9d7b629ddaef18ba3fc30970569b5fe8262..1f17ef7688bccd79bf194e2ac342a392a2fdcd5b 100644 --- a/example/network/sockets/udp_multicast/configs/d2000_aarch64_test_udp_multicast.config +++ b/example/network/sockets/udp_multicast/configs/d2000_aarch64_test_udp_multicast.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -157,7 +151,6 @@ CONFIG_FGMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -342,6 +335,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/sockets/udp_multicast/configs/e2000d_aarch32_demo_udp_multicast.config b/example/network/sockets/udp_multicast/configs/e2000d_aarch32_demo_udp_multicast.config index d8bee899b022c1e8eafcd28286387a25854cc06a..db76ff72daf0b0e340addcbaa7637088bd2993d0 100644 --- a/example/network/sockets/udp_multicast/configs/e2000d_aarch32_demo_udp_multicast.config +++ b/example/network/sockets/udp_multicast/configs/e2000d_aarch32_demo_udp_multicast.config @@ -131,12 +131,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -176,7 +170,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -366,6 +359,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/sockets/udp_multicast/configs/e2000d_aarch64_demo_udp_multicast.config b/example/network/sockets/udp_multicast/configs/e2000d_aarch64_demo_udp_multicast.config index 359fadd2abd61513784f5c56e974a30e976bdb27..897ea773027c264362c278324755371a653a47ed 100644 --- a/example/network/sockets/udp_multicast/configs/e2000d_aarch64_demo_udp_multicast.config +++ b/example/network/sockets/udp_multicast/configs/e2000d_aarch64_demo_udp_multicast.config @@ -125,12 +125,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -170,7 +164,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -355,6 +348,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/sockets/udp_multicast/configs/e2000q_aarch32_demo_udp_multicast.config b/example/network/sockets/udp_multicast/configs/e2000q_aarch32_demo_udp_multicast.config index b936838e0f4e7ee552cb0cc3a5f29f11ce725610..09d4844c7117427c6fc744e9de284258a0d6563b 100644 --- a/example/network/sockets/udp_multicast/configs/e2000q_aarch32_demo_udp_multicast.config +++ b/example/network/sockets/udp_multicast/configs/e2000q_aarch32_demo_udp_multicast.config @@ -130,12 +130,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -175,7 +169,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -365,6 +358,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/sockets/udp_multicast/configs/e2000q_aarch64_demo_udp_multicast.config b/example/network/sockets/udp_multicast/configs/e2000q_aarch64_demo_udp_multicast.config index ca873b297d0bc54e6548cd7e74a0f9f868846a1f..2bb4f2be44083370257ada0ffe5e9dcc9890e146 100644 --- a/example/network/sockets/udp_multicast/configs/e2000q_aarch64_demo_udp_multicast.config +++ b/example/network/sockets/udp_multicast/configs/e2000q_aarch64_demo_udp_multicast.config @@ -124,12 +124,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -169,7 +163,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -354,6 +347,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/sockets/udp_multicast/configs/ft2004_aarch32_dsk_udp_multicast.config b/example/network/sockets/udp_multicast/configs/ft2004_aarch32_dsk_udp_multicast.config index fde94b6078731a37c711fdd0bf1c6697d1d7693b..f279e57211478bd1c74676b9e447a82a5187e5a4 100644 --- a/example/network/sockets/udp_multicast/configs/ft2004_aarch32_dsk_udp_multicast.config +++ b/example/network/sockets/udp_multicast/configs/ft2004_aarch32_dsk_udp_multicast.config @@ -118,12 +118,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -163,7 +157,6 @@ CONFIG_FGMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -353,6 +346,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/sockets/udp_multicast/configs/ft2004_aarch64_dsk_udp_multicast.config b/example/network/sockets/udp_multicast/configs/ft2004_aarch64_dsk_udp_multicast.config index 4b76a463b64cd8017d699923efb7ff274e40f7ca..5b46e1d1c2c927614203f232faa8fb9f6a842b3f 100644 --- a/example/network/sockets/udp_multicast/configs/ft2004_aarch64_dsk_udp_multicast.config +++ b/example/network/sockets/udp_multicast/configs/ft2004_aarch64_dsk_udp_multicast.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -157,7 +151,6 @@ CONFIG_FGMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -342,6 +335,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/sockets/udp_multicast/configs/phytiumpi_aarch32_firefly_udp_multicast.config b/example/network/sockets/udp_multicast/configs/phytiumpi_aarch32_firefly_udp_multicast.config index ae18f47714c54e64f51d9b10bfb78abe70e5f5f3..dc7b2db0a956e7cda1498a6c3f9d0b32afaed48f 100644 --- a/example/network/sockets/udp_multicast/configs/phytiumpi_aarch32_firefly_udp_multicast.config +++ b/example/network/sockets/udp_multicast/configs/phytiumpi_aarch32_firefly_udp_multicast.config @@ -129,12 +129,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -174,7 +168,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -364,6 +357,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/sockets/udp_multicast/configs/phytiumpi_aarch64_firefly_udp_multicast.config b/example/network/sockets/udp_multicast/configs/phytiumpi_aarch64_firefly_udp_multicast.config index 5499ee66aaf18a9de945a4938baaf06b69ac4bd2..3e13632e6e4d54c1ca54c7734fd49922361154cd 100644 --- a/example/network/sockets/udp_multicast/configs/phytiumpi_aarch64_firefly_udp_multicast.config +++ b/example/network/sockets/udp_multicast/configs/phytiumpi_aarch64_firefly_udp_multicast.config @@ -123,12 +123,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -168,7 +162,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -353,6 +346,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/sockets/udp_multicast/sdkconfig b/example/network/sockets/udp_multicast/sdkconfig index 5499ee66aaf18a9de945a4938baaf06b69ac4bd2..3e13632e6e4d54c1ca54c7734fd49922361154cd 100644 --- a/example/network/sockets/udp_multicast/sdkconfig +++ b/example/network/sockets/udp_multicast/sdkconfig @@ -123,12 +123,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -168,7 +162,6 @@ CONFIG_FXMAC_PHY_COMMON=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -353,6 +346,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # # CONFIG_USE_LWIP_APP_LWIPERF is not set # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/sockets/udp_multicast/sdkconfig.h b/example/network/sockets/udp_multicast/sdkconfig.h index 20d745c66b57a83355fd7d7b3713bcf6857df5bd..a0bb68af289954e20cbda8379377078d228014d5 100644 --- a/example/network/sockets/udp_multicast/sdkconfig.h +++ b/example/network/sockets/udp_multicast/sdkconfig.h @@ -112,11 +112,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -151,7 +146,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ @@ -306,6 +300,7 @@ /* CONFIG_USE_LWIP_APP_LWIPERF is not set */ /* CONFIG_USE_LWIP_APP_TFTP is not set */ +/* CONFIG_USE_LWIP_APP_SNTP is not set */ /* end of LWIP_APP */ /* Memory configuration */ diff --git a/example/network/sockets/udp_multicast/src/lwip_test.c b/example/network/sockets/udp_multicast/src/lwip_test.c index a39810af7b1346df5e3db6ac20ec91a1f4b2ab5d..4bab40b473a0639c13bdd1531645f203a505cc5d 100644 --- a/example/network/sockets/udp_multicast/src/lwip_test.c +++ b/example/network/sockets/udp_multicast/src/lwip_test.c @@ -197,7 +197,7 @@ void LwipTest(void *args) BaseType_t ret; ret = xTaskCreate((TaskFunction_t)LwipTestCreate, /* 任务入口函数 */ (const char *)"LwipTestCreate", /* 任务名字 */ - (uint16_t)2048, /* 任务栈大小 */ + 2048, /* 任务栈大小 */ (void *)args, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 1, /* 任务的优先级 */ NULL); /* 任务控制块指针 */ diff --git a/example/network/wlan/configs/e2000d_aarch32_demo_wlan.config b/example/network/wlan/configs/e2000d_aarch32_demo_wlan.config index 41a56a2acd1054c173eef6edbfcce107a482ee98..67034f480810f0436c4bc3d1b2841420d2f45cd2 100644 --- a/example/network/wlan/configs/e2000d_aarch32_demo_wlan.config +++ b/example/network/wlan/configs/e2000d_aarch32_demo_wlan.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -152,7 +146,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -342,6 +335,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # CONFIG_USE_LWIP_APP_LWIPERF=y # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/wlan/configs/e2000d_aarch64_demo_wlan.config b/example/network/wlan/configs/e2000d_aarch64_demo_wlan.config index 0bebd8c04d360df282b794ca1fb49ba15e9de7d2..5fa2e47a8020bb55aac249200026a913e4da65cc 100644 --- a/example/network/wlan/configs/e2000d_aarch64_demo_wlan.config +++ b/example/network/wlan/configs/e2000d_aarch64_demo_wlan.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -146,7 +140,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -331,6 +324,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # CONFIG_USE_LWIP_APP_LWIPERF=y # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/wlan/configs/e2000q_aarch32_demo_wlan.config b/example/network/wlan/configs/e2000q_aarch32_demo_wlan.config index fc3850d7032aba3edb357ee5409bda11dcbb6ff5..020343d57ad038ff37bea78ac0fe6165def56de5 100644 --- a/example/network/wlan/configs/e2000q_aarch32_demo_wlan.config +++ b/example/network/wlan/configs/e2000q_aarch32_demo_wlan.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -151,7 +145,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -341,6 +334,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # CONFIG_USE_LWIP_APP_LWIPERF=y # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/wlan/configs/e2000q_aarch64_demo_wlan.config b/example/network/wlan/configs/e2000q_aarch64_demo_wlan.config index dc39bdd02292009886b70c032638be54948a95dd..107182d324efd535722d8a024110ebbdc610fd17 100644 --- a/example/network/wlan/configs/e2000q_aarch64_demo_wlan.config +++ b/example/network/wlan/configs/e2000q_aarch64_demo_wlan.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -145,7 +139,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -330,6 +323,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # CONFIG_USE_LWIP_APP_LWIPERF=y # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/wlan/main.c b/example/network/wlan/main.c index 2bc117ee161233d142d640d190db96e945776e20..5fe6f80ceeaea1a1c988d277fd16d4ed8581924b 100755 --- a/example/network/wlan/main.c +++ b/example/network/wlan/main.c @@ -46,7 +46,7 @@ int main() xReturn = xTaskCreate((TaskFunction_t)WlanExampleEntry, (const char *)"WlanExampleEntry", - (uint16_t)4096, + 4096, NULL, (UBaseType_t)2, NULL); diff --git a/example/network/wlan/sdkconfig b/example/network/wlan/sdkconfig index dc39bdd02292009886b70c032638be54948a95dd..107182d324efd535722d8a024110ebbdc610fd17 100644 --- a/example/network/wlan/sdkconfig +++ b/example/network/wlan/sdkconfig @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -145,7 +139,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -330,6 +323,7 @@ CONFIG_LWIP_LOCAL_HOSTNAME="phytium" # CONFIG_USE_LWIP_APP_LWIPERF=y # CONFIG_USE_LWIP_APP_TFTP is not set +# CONFIG_USE_LWIP_APP_SNTP is not set # end of LWIP_APP # diff --git a/example/network/wlan/sdkconfig.h b/example/network/wlan/sdkconfig.h index 1c281bba86e29c2fcc87ab56f60e449ad580ea31..5af5f4dc1ad1f5db9f62af315bcfb0a067c083e4 100644 --- a/example/network/wlan/sdkconfig.h +++ b/example/network/wlan/sdkconfig.h @@ -99,11 +99,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -133,7 +128,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ @@ -288,6 +282,7 @@ #define CONFIG_USE_LWIP_APP_LWIPERF /* CONFIG_USE_LWIP_APP_TFTP is not set */ +/* CONFIG_USE_LWIP_APP_SNTP is not set */ /* end of LWIP_APP */ /* Memory configuration */ diff --git a/example/peripheral/can/can/configs/d2000_aarch32_test_can.config b/example/peripheral/can/can/configs/d2000_aarch32_test_can.config index 95d6a47765029d2386fa0b95e57215fa374c8b98..af4c7a5123a56706b0ad75299d4190413da8302c 100644 --- a/example/peripheral/can/can/configs/d2000_aarch32_test_can.config +++ b/example/peripheral/can/can/configs/d2000_aarch32_test_can.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -137,7 +131,6 @@ CONFIG_USE_FCAN=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/can/can/configs/d2000_aarch64_test_can.config b/example/peripheral/can/can/configs/d2000_aarch64_test_can.config index e827bc35d9b2147df444707086b4512dceb9df7f..727cde345e643537721ba391175f6190890a8a3e 100644 --- a/example/peripheral/can/can/configs/d2000_aarch64_test_can.config +++ b/example/peripheral/can/can/configs/d2000_aarch64_test_can.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -131,7 +125,6 @@ CONFIG_USE_FCAN=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/can/can/configs/e2000d_aarch32_demo_can.config b/example/peripheral/can/can/configs/e2000d_aarch32_demo_can.config index 1cf1d98841a2fdae4bc592811e2b41d2f65dab18..b1dc27aba81306a09be491c431d7cfa4a32c6a07 100644 --- a/example/peripheral/can/can/configs/e2000d_aarch32_demo_can.config +++ b/example/peripheral/can/can/configs/e2000d_aarch32_demo_can.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -150,7 +144,6 @@ CONFIG_USE_FCAN=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/can/can/configs/e2000d_aarch64_demo_can.config b/example/peripheral/can/can/configs/e2000d_aarch64_demo_can.config index c315e4bb3b83baae12cc927dfaeb120644a6d532..dd1e98591b6287a2f075e62e8ad49227dc7d7d1d 100644 --- a/example/peripheral/can/can/configs/e2000d_aarch64_demo_can.config +++ b/example/peripheral/can/can/configs/e2000d_aarch64_demo_can.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -144,7 +138,6 @@ CONFIG_USE_FCAN=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/can/can/configs/e2000q_aarch32_demo_can.config b/example/peripheral/can/can/configs/e2000q_aarch32_demo_can.config index 8464bee902d2e4cd4b48ac645d697bb45a3f1d0f..419e98746b1957e58af5666fe461e3d3643e65c5 100644 --- a/example/peripheral/can/can/configs/e2000q_aarch32_demo_can.config +++ b/example/peripheral/can/can/configs/e2000q_aarch32_demo_can.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_USE_FCAN=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/can/can/configs/e2000q_aarch64_demo_can.config b/example/peripheral/can/can/configs/e2000q_aarch64_demo_can.config index c16f2243136eb13630121f8fae9da14e6791f8c6..79a9a1002115c01cc81649b670ccbdd215ce9cfb 100644 --- a/example/peripheral/can/can/configs/e2000q_aarch64_demo_can.config +++ b/example/peripheral/can/can/configs/e2000q_aarch64_demo_can.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_USE_FCAN=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/can/can/configs/ft2004_aarch32_dsk_can.config b/example/peripheral/can/can/configs/ft2004_aarch32_dsk_can.config index e3e8c03cf1e399966a277e9ab976b109f6abbd45..ece63f38abf58354bf34833dbb505023042eb5e7 100644 --- a/example/peripheral/can/can/configs/ft2004_aarch32_dsk_can.config +++ b/example/peripheral/can/can/configs/ft2004_aarch32_dsk_can.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -137,7 +131,6 @@ CONFIG_USE_FCAN=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/can/can/configs/ft2004_aarch64_dsk_can.config b/example/peripheral/can/can/configs/ft2004_aarch64_dsk_can.config index def178973ca208d48f97c39957f8f300ffe9ac3a..6a2cb5595251eda9830eb4e2f33dae7c6d9a6fbe 100644 --- a/example/peripheral/can/can/configs/ft2004_aarch64_dsk_can.config +++ b/example/peripheral/can/can/configs/ft2004_aarch64_dsk_can.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -131,7 +125,6 @@ CONFIG_USE_FCAN=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/can/can/main.c b/example/peripheral/can/can/main.c index 773a4d31c68738526f3dd1487cc340fa0c293581..090d6d70627a8c5b3c84a837eb2874361b272a51 100644 --- a/example/peripheral/can/can/main.c +++ b/example/peripheral/can/can/main.c @@ -59,7 +59,7 @@ int main(void) /* used in no-letter-shell mode */ ret = xTaskCreate((TaskFunction_t)CanExampleTaskEntry, /* 任务入口函数 */ (const char *)"CanExampleTaskEntry",/* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL,/* 任务入口函数参数 */ (UBaseType_t)CAN_EXAMPLE_TASK_PRIORITY, /* 任务的优先级 */ NULL); diff --git a/example/peripheral/can/can/sdkconfig b/example/peripheral/can/can/sdkconfig index def178973ca208d48f97c39957f8f300ffe9ac3a..6a2cb5595251eda9830eb4e2f33dae7c6d9a6fbe 100644 --- a/example/peripheral/can/can/sdkconfig +++ b/example/peripheral/can/can/sdkconfig @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -131,7 +125,6 @@ CONFIG_USE_FCAN=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/can/can/sdkconfig.h b/example/peripheral/can/can/sdkconfig.h index 9722c7f13f22f116e9273dd8759ed34c8c1d0793..2d422f982bdbee949c7f79cf78447ebec9e8da3e 100644 --- a/example/peripheral/can/can/sdkconfig.h +++ b/example/peripheral/can/can/sdkconfig.h @@ -88,11 +88,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -120,7 +115,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/peripheral/can/can/src/can_id_filter_example.c b/example/peripheral/can/can/src/can_id_filter_example.c index 5477b834c50373e1dec572b3ee7c5c0c42e7b0ff..b00dad49fbd889aaa5dbe2a67c6f44f7afc26a28 100644 --- a/example/peripheral/can/can/src/can_id_filter_example.c +++ b/example/peripheral/can/can/src/can_id_filter_example.c @@ -448,7 +448,7 @@ BaseType_t FFreeRTOSCanCreateFilterTestTask(void) /* can filter test1 task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSCanFilterTask, /* 任务入口函数 */ (const char *)"FFreeRTOSCanFilterMode1Task", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)CAN_FILTER_MODE_1, /* 任务入口函数参数 */ (UBaseType_t)CAN_FILTER_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ @@ -468,7 +468,7 @@ BaseType_t FFreeRTOSCanCreateFilterTestTask(void) /* can filter test2 task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSCanFilterTask, /* 任务入口函数 */ (const char *)"FFreeRTOSCanFilterMode2Task", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)CAN_FILTER_MODE_2, /* 任务入口函数参数 */ (UBaseType_t)CAN_FILTER_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ diff --git a/example/peripheral/can/can/src/can_intr_loopback_mode_example.c b/example/peripheral/can/can/src/can_intr_loopback_mode_example.c index f7b59e7a9a58dbb9105950b99769d6873c75c16a..b8a27c63f94dc13ab8a95f81da07b7e19912591c 100644 --- a/example/peripheral/can/can/src/can_intr_loopback_mode_example.c +++ b/example/peripheral/can/can/src/can_intr_loopback_mode_example.c @@ -436,7 +436,7 @@ BaseType_t FFreeRTOSCreateCanIntrTestTask(void) /* can intr example standard frame task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSCanIntrTask, /* 任务入口函数 */ (const char *)"FFreeRTOSCanIntrStandardTask",/* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)STANDARD_FRAME,/* 任务入口函数参数 */ (UBaseType_t)CAN_INTR_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ @@ -456,7 +456,7 @@ BaseType_t FFreeRTOSCreateCanIntrTestTask(void) /* can intr example extended frame task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSCanIntrTask, /* 任务入口函数 */ (const char *)"FFreeRTOSCanIntrExtendedTask",/* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)EXTEND_FRAME,/* 任务入口函数参数 */ (UBaseType_t)CAN_INTR_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ diff --git a/example/peripheral/can/can/src/can_polled_loopback_mode_example.c b/example/peripheral/can/can/src/can_polled_loopback_mode_example.c index 248756934ed71185749942b164f4936e198c9294..9f6306d2c0f486ea19343f18fd05a25a34d859e9 100644 --- a/example/peripheral/can/can/src/can_polled_loopback_mode_example.c +++ b/example/peripheral/can/can/src/can_polled_loopback_mode_example.c @@ -342,7 +342,7 @@ BaseType_t FFreeRTOSCreateCanPolledTestTask(void) /* can polled example standard frame task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSCanPolledTask, /* 任务入口函数 */ (const char *)"FFreeRTOSCanPolledStandardTask",/* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)STANDARD_FRAME,/* 任务入口函数参数 */ (UBaseType_t)CAN_POLLED_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ @@ -362,7 +362,7 @@ BaseType_t FFreeRTOSCreateCanPolledTestTask(void) /* can polled example extended frame task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSCanPolledTask, /* 任务入口函数 */ (const char *)"FFreeRTOSCanPolledExtendedTask",/* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)EXTEND_FRAME,/* 任务入口函数参数 */ (UBaseType_t)CAN_POLLED_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ diff --git a/example/peripheral/can/canfd/configs/e2000d_aarch32_demo_canfd.config b/example/peripheral/can/canfd/configs/e2000d_aarch32_demo_canfd.config index 9939d1059a1ca31893f331887d2e5a7fbe76ecc5..c5090d060a4050053508c3e879e20c408709b041 100644 --- a/example/peripheral/can/canfd/configs/e2000d_aarch32_demo_canfd.config +++ b/example/peripheral/can/canfd/configs/e2000d_aarch32_demo_canfd.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -150,7 +144,6 @@ CONFIG_USE_FCAN=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/can/canfd/configs/e2000d_aarch64_demo_canfd.config b/example/peripheral/can/canfd/configs/e2000d_aarch64_demo_canfd.config index 8ca50802f1f6e11fb5e37d281ded82cbb12cfd2d..7cf83d5629c256018c47827b409256d79d044115 100644 --- a/example/peripheral/can/canfd/configs/e2000d_aarch64_demo_canfd.config +++ b/example/peripheral/can/canfd/configs/e2000d_aarch64_demo_canfd.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -144,7 +138,6 @@ CONFIG_USE_FCAN=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/can/canfd/configs/e2000q_aarch32_demo_canfd.config b/example/peripheral/can/canfd/configs/e2000q_aarch32_demo_canfd.config index 307b656562003411ae7b9ef82ac19f5f04e0986b..10f7b5ade026305e46a9715a9dd24b2ab8c7d6f6 100644 --- a/example/peripheral/can/canfd/configs/e2000q_aarch32_demo_canfd.config +++ b/example/peripheral/can/canfd/configs/e2000q_aarch32_demo_canfd.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_USE_FCAN=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/can/canfd/configs/e2000q_aarch64_demo_canfd.config b/example/peripheral/can/canfd/configs/e2000q_aarch64_demo_canfd.config index 41d480a80fa2d666ba25079139241254651b2e96..b2419bc86a068d7959504c500e8ddc6d34ef6b05 100644 --- a/example/peripheral/can/canfd/configs/e2000q_aarch64_demo_canfd.config +++ b/example/peripheral/can/canfd/configs/e2000q_aarch64_demo_canfd.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_USE_FCAN=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/can/canfd/main.c b/example/peripheral/can/canfd/main.c index a4304c9c017a89acb26fe34a7c0e47e1f6106466..13e5374150fecad9bdbc84277684d809693b42a5 100644 --- a/example/peripheral/can/canfd/main.c +++ b/example/peripheral/can/canfd/main.c @@ -59,7 +59,7 @@ int main(void) /* used in no-letter-shell mode */ ret = xTaskCreate((TaskFunction_t)CanfdExampleTaskEntry, /* 任务入口函数 */ (const char *)"CanfdExampleTaskEntry",/* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL,/* 任务入口函数参数 */ (UBaseType_t)CANFD_EXAMPLE_TASK_PRIORITY, /* 任务的优先级 */ NULL); diff --git a/example/peripheral/can/canfd/sdkconfig b/example/peripheral/can/canfd/sdkconfig index 41d480a80fa2d666ba25079139241254651b2e96..b2419bc86a068d7959504c500e8ddc6d34ef6b05 100644 --- a/example/peripheral/can/canfd/sdkconfig +++ b/example/peripheral/can/canfd/sdkconfig @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_USE_FCAN=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/can/canfd/sdkconfig.h b/example/peripheral/can/canfd/sdkconfig.h index 8a38240e21adc513ad3998f3f1cd3f96244f925d..5ad47dbc1bd84173bd691082c1a2a52bf2c996ca 100644 --- a/example/peripheral/can/canfd/sdkconfig.h +++ b/example/peripheral/can/canfd/sdkconfig.h @@ -99,11 +99,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -131,7 +126,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/peripheral/can/canfd/src/canfd_id_filter_example.c b/example/peripheral/can/canfd/src/canfd_id_filter_example.c index b7effe7d384109562886011ab8bb1029b779b786..e6988cb04ed2fbad2c0f9081a6c3c000dcae6f2c 100644 --- a/example/peripheral/can/canfd/src/canfd_id_filter_example.c +++ b/example/peripheral/can/canfd/src/canfd_id_filter_example.c @@ -450,7 +450,7 @@ BaseType_t FFreeRTOSCanfdCreateFilterTestTask(void) /* canfd filter test1 task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSCanfdFilterTask, /* 任务入口函数 */ (const char *)"FFreeRTOSCanfdFilterMode1Task",/* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)CAN_FILTER_MODE_1,/* 任务入口函数参数 */ (UBaseType_t)CAN_FILTER_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ @@ -470,7 +470,7 @@ BaseType_t FFreeRTOSCanfdCreateFilterTestTask(void) /* canfd filter test2 task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSCanfdFilterTask, /* 任务入口函数 */ (const char *)"FFreeRTOSCanfdFilterMode2Task",/* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)CAN_FILTER_MODE_2,/* 任务入口函数参数 */ (UBaseType_t)CAN_FILTER_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ diff --git a/example/peripheral/can/canfd/src/canfd_intr_loopback_mode_example.c b/example/peripheral/can/canfd/src/canfd_intr_loopback_mode_example.c index 108007f547c36fa6d43f0b58ea384fd5bc82158e..059bec84c05bd9458d681ea21e2a120316011bfa 100644 --- a/example/peripheral/can/canfd/src/canfd_intr_loopback_mode_example.c +++ b/example/peripheral/can/canfd/src/canfd_intr_loopback_mode_example.c @@ -419,7 +419,7 @@ BaseType_t FFreeRTOSCreateCanfdIntrTestTask(void) /* canfd intr example standard frame task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSCanfdIntrTask, /* 任务入口函数 */ (const char *)"FFreeRTOSCanfdIntrStandardTask",/* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)STANDARD_FRAME,/* 任务入口函数参数 */ (UBaseType_t)CANFD_INTR_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ @@ -439,7 +439,7 @@ BaseType_t FFreeRTOSCreateCanfdIntrTestTask(void) /* canfd intr example extended frame task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSCanfdIntrTask, /* 任务入口函数 */ (const char *)"FFreeRTOSCanfdIntrExtendedTask",/* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)EXTEND_FRAME,/* 任务入口函数参数 */ (UBaseType_t)CANFD_INTR_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ diff --git a/example/peripheral/can/canfd/src/canfd_polled_loopback_mode_example.c b/example/peripheral/can/canfd/src/canfd_polled_loopback_mode_example.c index cedc28065f369ec3c89c3fc7f1440f29b9f3b7eb..3252c60b69ab7a9068d8f23f292710c065cba9c6 100644 --- a/example/peripheral/can/canfd/src/canfd_polled_loopback_mode_example.c +++ b/example/peripheral/can/canfd/src/canfd_polled_loopback_mode_example.c @@ -341,7 +341,7 @@ BaseType_t FFreeRTOSCreateCanfdPolledTestTask(void) /* canfd polled example standard frame task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSCanfdPolledTask, /* 任务入口函数 */ (const char *)"FFreeRTOSCanfdPolledStandardTask",/* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)STANDARD_FRAME,/* 任务入口函数参数 */ (UBaseType_t)CANFD_POLLED_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ @@ -361,7 +361,7 @@ BaseType_t FFreeRTOSCreateCanfdPolledTestTask(void) /* canfd polled example extended frame task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSCanfdPolledTask, /* 任务入口函数 */ (const char *)"FFreeRTOSCanfdPolledExtendedTask",/* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)EXTEND_FRAME,/* 任务入口函数参数 */ (UBaseType_t)CANFD_POLLED_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ diff --git a/example/peripheral/dma/ddma/configs/e2000d_aarch32_demo_ddma.config b/example/peripheral/dma/ddma/configs/e2000d_aarch32_demo_ddma.config index 64af9dc5de38681db00e1cc317560fda0d787906..e48b06831b5875134a2783aba43958f83970a8d9 100644 --- a/example/peripheral/dma/ddma/configs/e2000d_aarch32_demo_ddma.config +++ b/example/peripheral/dma/ddma/configs/e2000d_aarch32_demo_ddma.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -152,7 +146,6 @@ CONFIG_ENABLE_FDDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/dma/ddma/configs/e2000d_aarch64_demo_ddma.config b/example/peripheral/dma/ddma/configs/e2000d_aarch64_demo_ddma.config index 43fc6d6d57d80e63f74d9bae00c11b825d1b5aa9..8ad1221509f0654bf0e378beec0688d8b3fe948b 100644 --- a/example/peripheral/dma/ddma/configs/e2000d_aarch64_demo_ddma.config +++ b/example/peripheral/dma/ddma/configs/e2000d_aarch64_demo_ddma.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -146,7 +140,6 @@ CONFIG_ENABLE_FDDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/dma/ddma/configs/e2000q_aarch32_demo_ddma.config b/example/peripheral/dma/ddma/configs/e2000q_aarch32_demo_ddma.config index 5721e469f347b9b164b9acf0218e3f7720a26a48..cc244d57273127b896b96cfc042dc70926c73795 100644 --- a/example/peripheral/dma/ddma/configs/e2000q_aarch32_demo_ddma.config +++ b/example/peripheral/dma/ddma/configs/e2000q_aarch32_demo_ddma.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -151,7 +145,6 @@ CONFIG_ENABLE_FDDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/dma/ddma/configs/e2000q_aarch64_demo_ddma.config b/example/peripheral/dma/ddma/configs/e2000q_aarch64_demo_ddma.config index 807c221284c87c353943ea516bfab76993c4ca35..17c350cb7d03eb2671a0135bbc211d19b6184e25 100644 --- a/example/peripheral/dma/ddma/configs/e2000q_aarch64_demo_ddma.config +++ b/example/peripheral/dma/ddma/configs/e2000q_aarch64_demo_ddma.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -145,7 +139,6 @@ CONFIG_ENABLE_FDDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/dma/ddma/configs/phytiumpi_aarch32_firefly_ddma.config b/example/peripheral/dma/ddma/configs/phytiumpi_aarch32_firefly_ddma.config index 9899d8be7be31b8b87676a19f8efbd0749676616..4bf666f8fb18b2ac7e61e1f4f4e698846712e3e6 100644 --- a/example/peripheral/dma/ddma/configs/phytiumpi_aarch32_firefly_ddma.config +++ b/example/peripheral/dma/ddma/configs/phytiumpi_aarch32_firefly_ddma.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -150,7 +144,6 @@ CONFIG_ENABLE_FDDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/dma/ddma/configs/phytiumpi_aarch64_firefly_ddma.config b/example/peripheral/dma/ddma/configs/phytiumpi_aarch64_firefly_ddma.config index d1dd6f5a6babfc1a5fd56d9d9872550cf6a61f2a..844c1b19b8cc5b3ae11d9821e9615768fc71bc88 100644 --- a/example/peripheral/dma/ddma/configs/phytiumpi_aarch64_firefly_ddma.config +++ b/example/peripheral/dma/ddma/configs/phytiumpi_aarch64_firefly_ddma.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -144,7 +138,6 @@ CONFIG_ENABLE_FDDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/dma/ddma/main.c b/example/peripheral/dma/ddma/main.c index 8bb4a24eba30c0f29cbd39add947d2668e45c834..9825ea4168d0580ef5c966be081d6bd61b4baeff 100755 --- a/example/peripheral/dma/ddma/main.c +++ b/example/peripheral/dma/ddma/main.c @@ -48,7 +48,7 @@ int main(void) taskENTER_CRITICAL(); ret = xTaskCreate((TaskFunction_t)DdmaTasksEntry, (const char *)"DdmaTaskEntry", - (uint16_t)4096, + 4096, NULL, (UBaseType_t)2, NULL); diff --git a/example/peripheral/dma/ddma/sdkconfig b/example/peripheral/dma/ddma/sdkconfig index d1dd6f5a6babfc1a5fd56d9d9872550cf6a61f2a..844c1b19b8cc5b3ae11d9821e9615768fc71bc88 100644 --- a/example/peripheral/dma/ddma/sdkconfig +++ b/example/peripheral/dma/ddma/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -144,7 +138,6 @@ CONFIG_ENABLE_FDDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/dma/ddma/sdkconfig.h b/example/peripheral/dma/ddma/sdkconfig.h index b2f4d06a58f213dc9a9d78a2609b14ab762aa7eb..47add5b68baa9c239cbf8fe7145b9dcfddba9619 100644 --- a/example/peripheral/dma/ddma/sdkconfig.h +++ b/example/peripheral/dma/ddma/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -132,7 +127,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/peripheral/dma/ddma/src/ddma_spi_loopback.c b/example/peripheral/dma/ddma/src/ddma_spi_loopback.c index 33823d2932499d6bcfc258e041f5cde8ecf987c2..8b37b0b0dfece38b3392155e6524c5d32c4ff94d 100755 --- a/example/peripheral/dma/ddma/src/ddma_spi_loopback.c +++ b/example/peripheral/dma/ddma/src/ddma_spi_loopback.c @@ -332,7 +332,7 @@ BaseType_t FFreeRTOSRunDDMASpiLoopback(u32 spi_id, u32 bytes) ret = xTaskCreate((TaskFunction_t)DdmaTask, /* task entry */ (const char *)"DdmaTask",/* task name */ - (uint16_t)4096, /* task stack size in words */ + 4096, /* task stack size in words */ (void *)&bytes, /* task params */ (UBaseType_t)configMAX_PRIORITIES - 1, /* task priority */ NULL); /* task handler */ diff --git a/example/peripheral/dma/gdma/configs/e2000d_aarch32_demo_gdma.config b/example/peripheral/dma/gdma/configs/e2000d_aarch32_demo_gdma.config index f93a362b5b675427ae3170ab8678076e5f9c8aa9..bf04a4c22ec5026f9dbc8fd53948990b68d2566b 100644 --- a/example/peripheral/dma/gdma/configs/e2000d_aarch32_demo_gdma.config +++ b/example/peripheral/dma/gdma/configs/e2000d_aarch32_demo_gdma.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -151,7 +145,6 @@ CONFIG_ENABLE_FGDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/dma/gdma/configs/e2000d_aarch64_demo_gdma.config b/example/peripheral/dma/gdma/configs/e2000d_aarch64_demo_gdma.config index 29b647531f6a6f5e930f3240c27a4ce873acb8f3..5528beec9e9e59a8e84ae40ba4047c05bab9eab5 100644 --- a/example/peripheral/dma/gdma/configs/e2000d_aarch64_demo_gdma.config +++ b/example/peripheral/dma/gdma/configs/e2000d_aarch64_demo_gdma.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -145,7 +139,6 @@ CONFIG_ENABLE_FGDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/dma/gdma/configs/e2000q_aarch32_demo_gdma.config b/example/peripheral/dma/gdma/configs/e2000q_aarch32_demo_gdma.config index bb1339aef8e806ed8b98a1a24efe0f26ec74627a..2cbc9b72cedc23dcbf04b0e95fe5c599e549a5be 100644 --- a/example/peripheral/dma/gdma/configs/e2000q_aarch32_demo_gdma.config +++ b/example/peripheral/dma/gdma/configs/e2000q_aarch32_demo_gdma.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -150,7 +144,6 @@ CONFIG_ENABLE_FGDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/dma/gdma/configs/e2000q_aarch64_demo_gdma.config b/example/peripheral/dma/gdma/configs/e2000q_aarch64_demo_gdma.config index 845319b07b9ab1eedaadc605b1995ab59802c24d..1274d885d94f534bba9100c27b7211aa4828d382 100644 --- a/example/peripheral/dma/gdma/configs/e2000q_aarch64_demo_gdma.config +++ b/example/peripheral/dma/gdma/configs/e2000q_aarch64_demo_gdma.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -144,7 +138,6 @@ CONFIG_ENABLE_FGDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/dma/gdma/configs/phytiumpi_aarch32_firefly_gdma.config b/example/peripheral/dma/gdma/configs/phytiumpi_aarch32_firefly_gdma.config index 2cdfbf909c0c93668f6c3e05222a3e8395b0e47b..2251b569f79878c83d87d8e850cfff5432030e54 100644 --- a/example/peripheral/dma/gdma/configs/phytiumpi_aarch32_firefly_gdma.config +++ b/example/peripheral/dma/gdma/configs/phytiumpi_aarch32_firefly_gdma.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_FGDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/dma/gdma/configs/phytiumpi_aarch64_firefly_gdma.config b/example/peripheral/dma/gdma/configs/phytiumpi_aarch64_firefly_gdma.config index f360ba0b2ae8baa760be4f2812d49dc75a1f25f9..a4078fe32cc53e840e9a5a468a475a27b1345708 100644 --- a/example/peripheral/dma/gdma/configs/phytiumpi_aarch64_firefly_gdma.config +++ b/example/peripheral/dma/gdma/configs/phytiumpi_aarch64_firefly_gdma.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_FGDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/dma/gdma/main.c b/example/peripheral/dma/gdma/main.c index 2d787192115c90f51e4e1d61e1b93148201ad7ae..de84abcfdcebfb240ee50ea3422b86004660a36d 100644 --- a/example/peripheral/dma/gdma/main.c +++ b/example/peripheral/dma/gdma/main.c @@ -59,7 +59,7 @@ int main(void) /* used in no-letter-shell mode */ ret = xTaskCreate((TaskFunction_t)GdmaExampleTaskEntry, /* 任务入口函数 */ (const char *)"GdmaExampleTaskEntry", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)GDMA_EXAMPLE_TASK_PRIORITY, /* 任务优先级 */ NULL); /* 任务句柄 */ diff --git a/example/peripheral/dma/gdma/sdkconfig b/example/peripheral/dma/gdma/sdkconfig index f360ba0b2ae8baa760be4f2812d49dc75a1f25f9..a4078fe32cc53e840e9a5a468a475a27b1345708 100644 --- a/example/peripheral/dma/gdma/sdkconfig +++ b/example/peripheral/dma/gdma/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_FGDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/dma/gdma/sdkconfig.h b/example/peripheral/dma/gdma/sdkconfig.h index 9fc5fac062654c27c493e2a2d5e746568c51bc6a..48c4a06b0f4aa5334f9fcb1b88e819cd449cf686 100644 --- a/example/peripheral/dma/gdma/sdkconfig.h +++ b/example/peripheral/dma/gdma/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -131,7 +126,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/peripheral/dma/gdma/src/gdma_memcpy.c b/example/peripheral/dma/gdma/src/gdma_memcpy.c index e98ba058854f29c96ccd84c82ea76d857c608b5e..0b12ba5c6c682288a773cc764d064c0b7d017001 100644 --- a/example/peripheral/dma/gdma/src/gdma_memcpy.c +++ b/example/peripheral/dma/gdma/src/gdma_memcpy.c @@ -215,7 +215,7 @@ int FFreeRTOSGdmaMemcpy(void) xReturn = xTaskCreate((TaskFunction_t)GdmaMemcpyTask, /* 任务入口函数 */ (const char *)"GdmaMemcpyTask", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)GDMA_MEMCPY_TASK_PRIORITY, /* 任务优先级 */ NULL); /* 任务句柄 */ diff --git a/example/peripheral/gpio/configs/d2000_aarch32_test_gpio.config b/example/peripheral/gpio/configs/d2000_aarch32_test_gpio.config index e2e26034c4f11b20d4daa736204039ce147c81ef..acf4fd389459837c1b66728c4e82a3659d3f7599 100644 --- a/example/peripheral/gpio/configs/d2000_aarch32_test_gpio.config +++ b/example/peripheral/gpio/configs/d2000_aarch32_test_gpio.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -137,7 +131,6 @@ CONFIG_ENABLE_FGPIO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/gpio/configs/d2000_aarch64_test_gpio.config b/example/peripheral/gpio/configs/d2000_aarch64_test_gpio.config index 04897b56fdcb6520c7e493bb9e90cb715ce75312..4a79bd42a32506ba9e67438e8c6ec9b740ef3b43 100644 --- a/example/peripheral/gpio/configs/d2000_aarch64_test_gpio.config +++ b/example/peripheral/gpio/configs/d2000_aarch64_test_gpio.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -131,7 +125,6 @@ CONFIG_ENABLE_FGPIO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/gpio/configs/e2000d_aarch32_demo_gpio.config b/example/peripheral/gpio/configs/e2000d_aarch32_demo_gpio.config index 2221685a0ce853c69e690df07ba0a76c33e2bcfe..90b6325c0117dd86754deae69083c45ad4d1a63c 100644 --- a/example/peripheral/gpio/configs/e2000d_aarch32_demo_gpio.config +++ b/example/peripheral/gpio/configs/e2000d_aarch32_demo_gpio.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -150,7 +144,6 @@ CONFIG_ENABLE_FGPIO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/gpio/configs/e2000d_aarch64_demo_gpio.config b/example/peripheral/gpio/configs/e2000d_aarch64_demo_gpio.config index f48654f2e770df7df3c12b8eb04fc5e2b5a45d0f..2a6e0de41b6bf965b601ee6d850ab34b8d00173e 100644 --- a/example/peripheral/gpio/configs/e2000d_aarch64_demo_gpio.config +++ b/example/peripheral/gpio/configs/e2000d_aarch64_demo_gpio.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -144,7 +138,6 @@ CONFIG_ENABLE_FGPIO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/gpio/configs/e2000q_aarch32_demo_gpio.config b/example/peripheral/gpio/configs/e2000q_aarch32_demo_gpio.config index c15250b77e957fe6996722af68a120f54324aca8..2907ec3e059db701c8cf720f51777f8155d270a2 100644 --- a/example/peripheral/gpio/configs/e2000q_aarch32_demo_gpio.config +++ b/example/peripheral/gpio/configs/e2000q_aarch32_demo_gpio.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_FGPIO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/gpio/configs/e2000q_aarch64_demo_gpio.config b/example/peripheral/gpio/configs/e2000q_aarch64_demo_gpio.config index 10b111a69adb2916328a00e7a0f014e288a7e2a5..e44db2244ef0eedb2aa3b355150be82f160ac04b 100644 --- a/example/peripheral/gpio/configs/e2000q_aarch64_demo_gpio.config +++ b/example/peripheral/gpio/configs/e2000q_aarch64_demo_gpio.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_FGPIO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/gpio/configs/phytiumpi_aarch32_firefly_gpio.config b/example/peripheral/gpio/configs/phytiumpi_aarch32_firefly_gpio.config index ce6b4229e18267a2f289de230accc447d1384cfa..2672e50121d696803305f385c2b03eaf82732396 100644 --- a/example/peripheral/gpio/configs/phytiumpi_aarch32_firefly_gpio.config +++ b/example/peripheral/gpio/configs/phytiumpi_aarch32_firefly_gpio.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_FGPIO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/gpio/configs/phytiumpi_aarch64_firefly_gpio.config b/example/peripheral/gpio/configs/phytiumpi_aarch64_firefly_gpio.config index eb7a2bc1afa386829361c3141e2cb844725f454b..0ef8fb65ca2abba917b9981f5d0f04db4a240ba0 100644 --- a/example/peripheral/gpio/configs/phytiumpi_aarch64_firefly_gpio.config +++ b/example/peripheral/gpio/configs/phytiumpi_aarch64_firefly_gpio.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_FGPIO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/gpio/main.c b/example/peripheral/gpio/main.c index 85cec53ff2f8e05434461ead6ec25c9cfd127470..e94d68eee965d058f0a178528837de8ea458f11b 100644 --- a/example/peripheral/gpio/main.c +++ b/example/peripheral/gpio/main.c @@ -59,7 +59,7 @@ int main(void) /* used in no-letter-shell mode */ ret = xTaskCreate((TaskFunction_t)GpioExampleTaskEntry, /* 任务入口函数 */ (const char *)"GpioExampleTaskEntry", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)GPIO_EXAMPLE_TASK_PRIORITY, /* 任务优先级 */ NULL); /* 任务句柄 */ diff --git a/example/peripheral/gpio/sdkconfig b/example/peripheral/gpio/sdkconfig index eb7a2bc1afa386829361c3141e2cb844725f454b..0ef8fb65ca2abba917b9981f5d0f04db4a240ba0 100644 --- a/example/peripheral/gpio/sdkconfig +++ b/example/peripheral/gpio/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_FGPIO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/gpio/sdkconfig.h b/example/peripheral/gpio/sdkconfig.h index 129b33863d452582b156d751d7095b1dbf5f4368..7215c87e10c740d689611de93e88fd560f1065ff 100644 --- a/example/peripheral/gpio/sdkconfig.h +++ b/example/peripheral/gpio/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -130,7 +125,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/peripheral/gpio/src/gpio_intr_example.c b/example/peripheral/gpio/src/gpio_intr_example.c index f053e6fd729af2d30d6e09bb99fb06afb9db320a..9f20d0a8139ac8cf0d5e17a19ce7c8ae295f7f41 100644 --- a/example/peripheral/gpio/src/gpio_intr_example.c +++ b/example/peripheral/gpio/src/gpio_intr_example.c @@ -293,7 +293,7 @@ BaseType_t FFreeRTOSRunGpioIrq(void) ret = xTaskCreate((TaskFunction_t)GpioIrqTestTask, /* 任务入口函数 */ (const char *)"GpioIrqTestTask", /* 任务名字 */ - (uint16_t)GPIO_IRQ_TEST_TASK_STACK_SIZE, /* 任务栈大小 */ + GPIO_IRQ_TEST_TASK_STACK_SIZE, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)GPIO_IRQ_TEST_TASK_PRIORITY, /* 任务优先级 */ NULL); /* 任务句柄 */ diff --git a/example/peripheral/i2c/configs/e2000d_aarch32_demo_i2c.config b/example/peripheral/i2c/configs/e2000d_aarch32_demo_i2c.config index f09f513c9f304306b2a4e85d7bc0295dbb0ff876..7fc449b05f2cf0ab03d2c99db375ff432f0ba66a 100644 --- a/example/peripheral/i2c/configs/e2000d_aarch32_demo_i2c.config +++ b/example/peripheral/i2c/configs/e2000d_aarch32_demo_i2c.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -157,7 +151,6 @@ CONFIG_ENABLE_MIO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/i2c/configs/e2000d_aarch64_demo_i2c.config b/example/peripheral/i2c/configs/e2000d_aarch64_demo_i2c.config index c5ec3864a2c413929ff6dc4cc877c93600242472..60d9b26e957f01de1039057d750176f3cac4ce97 100644 --- a/example/peripheral/i2c/configs/e2000d_aarch64_demo_i2c.config +++ b/example/peripheral/i2c/configs/e2000d_aarch64_demo_i2c.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -151,7 +145,6 @@ CONFIG_ENABLE_MIO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/i2c/configs/e2000q_aarch32_demo_i2c.config b/example/peripheral/i2c/configs/e2000q_aarch32_demo_i2c.config index 28d439fc5198ec0e91c3335149b4c574e3421232..2d3a0947bebae8e96b51975182e5980d533fba20 100644 --- a/example/peripheral/i2c/configs/e2000q_aarch32_demo_i2c.config +++ b/example/peripheral/i2c/configs/e2000q_aarch32_demo_i2c.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -156,7 +150,6 @@ CONFIG_ENABLE_MIO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/i2c/configs/e2000q_aarch64_demo_i2c.config b/example/peripheral/i2c/configs/e2000q_aarch64_demo_i2c.config index 5d5bd4e5370ca538ea840e3dc0614124267de34b..3a83ef6f836b0742eb3a087256826c5ce99f7ebd 100644 --- a/example/peripheral/i2c/configs/e2000q_aarch64_demo_i2c.config +++ b/example/peripheral/i2c/configs/e2000q_aarch64_demo_i2c.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -150,7 +144,6 @@ CONFIG_ENABLE_MIO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/i2c/configs/phytiumpi_aarch32_firefly_i2c.config b/example/peripheral/i2c/configs/phytiumpi_aarch32_firefly_i2c.config index ef0be5b8f22e7c9894e4cabe97f8ff20f9dba044..1d22c96984c04ed05080c386fa2e59f2754ee594 100644 --- a/example/peripheral/i2c/configs/phytiumpi_aarch32_firefly_i2c.config +++ b/example/peripheral/i2c/configs/phytiumpi_aarch32_firefly_i2c.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -155,7 +149,6 @@ CONFIG_ENABLE_MIO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/i2c/configs/phytiumpi_aarch64_firefly_i2c.config b/example/peripheral/i2c/configs/phytiumpi_aarch64_firefly_i2c.config index 8054cb5c687a66911be9abc91438d51e217f518d..5b884636b4e84d376c2826df7eda083a90bfa24f 100644 --- a/example/peripheral/i2c/configs/phytiumpi_aarch64_firefly_i2c.config +++ b/example/peripheral/i2c/configs/phytiumpi_aarch64_firefly_i2c.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_MIO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/i2c/main.c b/example/peripheral/i2c/main.c index a3ae60b2b811c8becb759581e6bf9fd2f9ccc491..a00d273ea300c7982f87312331819fa5d650ea7a 100644 --- a/example/peripheral/i2c/main.c +++ b/example/peripheral/i2c/main.c @@ -60,7 +60,7 @@ int main(void) taskENTER_CRITICAL(); /*进入临界区*/ ret = xTaskCreate((TaskFunction_t)I2cExampleTaskEntry, /* 任务入口函数 */ (const char *)"I2cExampleTaskEntry", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)I2C_EXAMPLE_TASK_PRIORITY, /* 任务的优先级 */ NULL); diff --git a/example/peripheral/i2c/sdkconfig b/example/peripheral/i2c/sdkconfig index 8054cb5c687a66911be9abc91438d51e217f518d..5b884636b4e84d376c2826df7eda083a90bfa24f 100644 --- a/example/peripheral/i2c/sdkconfig +++ b/example/peripheral/i2c/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_MIO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/i2c/sdkconfig.h b/example/peripheral/i2c/sdkconfig.h index 2fa7eac5ad5c90a88cc1db12063a1aa1bfc66d79..4f87f88b4b6a08345bea406629f25a646e29fa28 100644 --- a/example/peripheral/i2c/sdkconfig.h +++ b/example/peripheral/i2c/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -135,7 +130,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/peripheral/i2c/src/i2c_ms_example.c b/example/peripheral/i2c/src/i2c_ms_example.c index 4ab557391084dd78e2a020c92f7b57bef5c546e4..63d3fdf7ffe898a6bccc05ea11121eb6a2858851 100644 --- a/example/peripheral/i2c/src/i2c_ms_example.c +++ b/example/peripheral/i2c/src/i2c_ms_example.c @@ -485,7 +485,7 @@ BaseType_t FFreeRTOSI2cLoopbackCreate(void) xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSI2cLoopbackTask, /* 任务入口函数 */ (const char *)"FFreeRTOSI2cLoopbackTask",/* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)NULL,/* 任务入口函数参数 */ (UBaseType_t)I2C_MS_TEST_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ diff --git a/example/peripheral/i2c/src/i2c_rtc_example.c b/example/peripheral/i2c/src/i2c_rtc_example.c index 194f937e48e1c07f06411b2bfc186aaba6368465..607496d2b875ec37f6f47c9fec9182dd511df0fc 100644 --- a/example/peripheral/i2c/src/i2c_rtc_example.c +++ b/example/peripheral/i2c/src/i2c_rtc_example.c @@ -389,7 +389,7 @@ BaseType_t FFreeRTOSI2cRtcCreate(void) } xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSI2cRtcTask, /* 任务入口函数 */ (const char *)"FFreeRTOSI2cRtcTask", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)NULL, /* 任务入口函数参数 */ (UBaseType_t)I2C_RTC_TEST_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ diff --git a/example/peripheral/i2s/configs/e2000d_aarch32_demo_i2s.config b/example/peripheral/i2s/configs/e2000d_aarch32_demo_i2s.config index dcbb7c7ecfbe17ace4df22ce32ecfac6906585db..0eac5c9a767281008a3370bdff14452860da8692 100644 --- a/example/peripheral/i2s/configs/e2000d_aarch32_demo_i2s.config +++ b/example/peripheral/i2s/configs/e2000d_aarch32_demo_i2s.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -159,7 +153,6 @@ CONFIG_ENABLE_FDDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/i2s/configs/e2000d_aarch64_demo_i2s.config b/example/peripheral/i2s/configs/e2000d_aarch64_demo_i2s.config index b053c47fcf8d6eeabbdecd7679a72f36c845a221..b7e528425a64b71433226ac250108bd19443d1c8 100644 --- a/example/peripheral/i2s/configs/e2000d_aarch64_demo_i2s.config +++ b/example/peripheral/i2s/configs/e2000d_aarch64_demo_i2s.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -153,7 +147,6 @@ CONFIG_ENABLE_FDDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/i2s/configs/e2000q_aarch32_demo_i2s.config b/example/peripheral/i2s/configs/e2000q_aarch32_demo_i2s.config index a0d394adeae1509017e976ab76c6ca327118f06d..836d9de398dcd419706009adfa9ed607b7202c02 100644 --- a/example/peripheral/i2s/configs/e2000q_aarch32_demo_i2s.config +++ b/example/peripheral/i2s/configs/e2000q_aarch32_demo_i2s.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -158,7 +152,6 @@ CONFIG_ENABLE_FDDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/i2s/configs/e2000q_aarch64_demo_i2s.config b/example/peripheral/i2s/configs/e2000q_aarch64_demo_i2s.config index fc884d09cd37209babbae71804f6c22572e7b07a..5fb12bb7c71b0c86e131fa4ef7b51f1fcb2160ef 100644 --- a/example/peripheral/i2s/configs/e2000q_aarch64_demo_i2s.config +++ b/example/peripheral/i2s/configs/e2000q_aarch64_demo_i2s.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -152,7 +146,6 @@ CONFIG_ENABLE_FDDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/i2s/main.c b/example/peripheral/i2s/main.c index 9c9ba8cc546cd10c476b4928b1fd000e8460683b..f252320eea414375fdb5849658a4e1078997ba46 100644 --- a/example/peripheral/i2s/main.c +++ b/example/peripheral/i2s/main.c @@ -60,7 +60,7 @@ int main(void) /* used in no-letter-shell mode */ ret = xTaskCreate((TaskFunction_t)I2sExampleTaskEntry, /* 任务入口函数 */ (const char *)"I2sExampleTaskEntry", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)I2S_EXAMPLE_TASK_PRIORITY, /* 任务优先级 */ NULL); /* 任务句柄 */ diff --git a/example/peripheral/i2s/sdkconfig b/example/peripheral/i2s/sdkconfig index fc884d09cd37209babbae71804f6c22572e7b07a..5fb12bb7c71b0c86e131fa4ef7b51f1fcb2160ef 100644 --- a/example/peripheral/i2s/sdkconfig +++ b/example/peripheral/i2s/sdkconfig @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -152,7 +146,6 @@ CONFIG_ENABLE_FDDMA=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/i2s/sdkconfig.h b/example/peripheral/i2s/sdkconfig.h index 6a9aaa651bb11c435f6e7605137ff54ffc300730..659548331ce6ce8c45728f08efb16865e095cab1 100644 --- a/example/peripheral/i2s/sdkconfig.h +++ b/example/peripheral/i2s/sdkconfig.h @@ -99,11 +99,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -138,7 +133,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ @@ -197,7 +191,7 @@ #define CONFIG_DEFAULT_LINKER_SCRIPT /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_IMAGE_LOAD_ADDRESS 0x80100000 -#define CONFIG_IMAGE_MAX_LENGTH 0x10000000 +#define CONFIG_IMAGE_MAX_LENGTH 0x20000000 #define CONFIG_HEAP_SIZE 1 #define CONFIG_STACK_SIZE 0x400 /* end of Linker Options */ diff --git a/example/peripheral/i2s/src/i2s_example.c b/example/peripheral/i2s/src/i2s_example.c index 9216cc4ac5ddf918b94e1fb3470c3e677f0dc74a..830e1d05f3032185c589c9067dc0e8746c17203b 100644 --- a/example/peripheral/i2s/src/i2s_example.c +++ b/example/peripheral/i2s/src/i2s_example.c @@ -391,7 +391,7 @@ BaseType_t FFreeRTOSRunI2sExample(void) } xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSI2sTransTask, /* 任务入口函数 */ (const char *)"FFreeRTOSI2sTransTask", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)I2S_TEST_TASK_PRIORITY, /* 任务优先级 */ NULL); /* 任务句柄 */ diff --git a/example/peripheral/media/lvgl_demo/configs/e2000d_aarch32_demo_media.config b/example/peripheral/media/lvgl_demo/configs/e2000d_aarch32_demo_media.config index 75f3d8b715a82b622fcb38cc00f77f3da8869288..70536d723471fb5f688ead77bb1ee0ab04d13b82 100644 --- a/example/peripheral/media/lvgl_demo/configs/e2000d_aarch32_demo_media.config +++ b/example/peripheral/media/lvgl_demo/configs/e2000d_aarch32_demo_media.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/lvgl_demo/configs/e2000d_aarch64_demo_media.config b/example/peripheral/media/lvgl_demo/configs/e2000d_aarch64_demo_media.config index 1b0b25e96017f9c0fe76c0d218b3340f75f438cd..a81d31006afa2742d86842a0964908e280b74633 100644 --- a/example/peripheral/media/lvgl_demo/configs/e2000d_aarch64_demo_media.config +++ b/example/peripheral/media/lvgl_demo/configs/e2000d_aarch64_demo_media.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/lvgl_demo/configs/e2000q_aarch32_demo_media.config b/example/peripheral/media/lvgl_demo/configs/e2000q_aarch32_demo_media.config index 214452ca1ab33d346a682d40d7471c632c593062..7f6e8863c7aa61dec86e14c800f9a4be01461e5d 100644 --- a/example/peripheral/media/lvgl_demo/configs/e2000q_aarch32_demo_media.config +++ b/example/peripheral/media/lvgl_demo/configs/e2000q_aarch32_demo_media.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/lvgl_demo/configs/e2000q_aarch64_demo_media.config b/example/peripheral/media/lvgl_demo/configs/e2000q_aarch64_demo_media.config index 306f3fc2f1830ec7fc7a6389584d4a1f9af4998a..24f02f8d912f6a37aa9e805fcf15ed542c3d0e66 100644 --- a/example/peripheral/media/lvgl_demo/configs/e2000q_aarch64_demo_media.config +++ b/example/peripheral/media/lvgl_demo/configs/e2000q_aarch64_demo_media.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/lvgl_demo/configs/phytiumpi_aarch32_firefly_media.config b/example/peripheral/media/lvgl_demo/configs/phytiumpi_aarch32_firefly_media.config index ad8d4f622c4f620350c0dfa8ac53b9ff8ace992e..844e4d6a9ebe708c00122b9135a5a5abc4897f40 100644 --- a/example/peripheral/media/lvgl_demo/configs/phytiumpi_aarch32_firefly_media.config +++ b/example/peripheral/media/lvgl_demo/configs/phytiumpi_aarch32_firefly_media.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/lvgl_demo/configs/phytiumpi_aarch64_firefly_media.config b/example/peripheral/media/lvgl_demo/configs/phytiumpi_aarch64_firefly_media.config index ef72a662262fdf3042fdd501a3492d945d3de9b4..7342ecf51b4fe30ee4f493055b58d37c8efc3e6c 100644 --- a/example/peripheral/media/lvgl_demo/configs/phytiumpi_aarch64_firefly_media.config +++ b/example/peripheral/media/lvgl_demo/configs/phytiumpi_aarch64_firefly_media.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/lvgl_demo/sdkconfig b/example/peripheral/media/lvgl_demo/sdkconfig index ef72a662262fdf3042fdd501a3492d945d3de9b4..7342ecf51b4fe30ee4f493055b58d37c8efc3e6c 100644 --- a/example/peripheral/media/lvgl_demo/sdkconfig +++ b/example/peripheral/media/lvgl_demo/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/lvgl_demo/sdkconfig.h b/example/peripheral/media/lvgl_demo/sdkconfig.h index 4d88c9d9349216052fe51c9aaea3ef9d57a4af2d..28e899355822342737f3003ba49d4edfa1260ac0 100644 --- a/example/peripheral/media/lvgl_demo/sdkconfig.h +++ b/example/peripheral/media/lvgl_demo/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,7 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/peripheral/media/lvgl_demo/src/lv_demo_create.c b/example/peripheral/media/lvgl_demo/src/lv_demo_create.c index dbfc53564d43c029a0c2b9f293dd3e8d74bd5319..bac1d291eba6fb6569da2dd6adf01122ddc9b6a1 100644 --- a/example/peripheral/media/lvgl_demo/src/lv_demo_create.c +++ b/example/peripheral/media/lvgl_demo/src/lv_demo_create.c @@ -181,14 +181,14 @@ BaseType_t FFreeRTOSMediaInitCreate(void) /* Media init task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSMediaDeviceInit, /* 任务入口函数 */ (const char *)"FFreeRTOSMediaDeviceInit", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 2, /* 任务的优先级 */ (TaskHandle_t *)&init_task); /* 任务控制 */ /* Hpd task control */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSMediaHpdHandle, /* 任务入口函数 */ (const char *)"FFreeRTOSMediaHpdHandle", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 1, /* 任务的优先级 */ (TaskHandle_t *)&hpd_task); @@ -211,7 +211,7 @@ BaseType_t FFreeRTOSlVGLConfigCreate(void ) /* lvgl demo task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSLVGLConfigTask, /* 任务入口函数 */ (const char *)"FFreeRTOSLVGLConfigTask", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 3, /* 任务的优先级 */ (TaskHandle_t *)&lvgl_init_task); /* 任务控制 */ @@ -235,7 +235,7 @@ BaseType_t FFreeRTOSlVGLDemoCreate(void) /* lvgl demo task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSLVGLDemoTask, /* 任务入口函数 */ (const char *)"FFreeRTOSLVGLDemoTask", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 4, /* 任务的优先级 */ (TaskHandle_t *)&demo_task); /* 任务控制 */ diff --git a/example/peripheral/media/lvgl_indev/configs/e2000d_aarch32_demo_media.config b/example/peripheral/media/lvgl_indev/configs/e2000d_aarch32_demo_media.config index 59068317155e836324f5a4f2a513d9c9547163c7..b67648ed00d13d32aa628d4735db89105c4319a1 100644 --- a/example/peripheral/media/lvgl_indev/configs/e2000d_aarch32_demo_media.config +++ b/example/peripheral/media/lvgl_indev/configs/e2000d_aarch32_demo_media.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,8 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -348,16 +340,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/media/lvgl_indev/configs/e2000d_aarch64_demo_media.config b/example/peripheral/media/lvgl_indev/configs/e2000d_aarch64_demo_media.config index 51d0ad2771cc5f2438ffad9d59468257bd4d600c..16568bd41b37227313c94ebad50d27dc7541888a 100644 --- a/example/peripheral/media/lvgl_indev/configs/e2000d_aarch64_demo_media.config +++ b/example/peripheral/media/lvgl_indev/configs/e2000d_aarch64_demo_media.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,8 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -337,16 +329,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/media/lvgl_indev/configs/e2000q_aarch32_demo_media.config b/example/peripheral/media/lvgl_indev/configs/e2000q_aarch32_demo_media.config index 82cda4ba90d3f247756c673c9758fb86c749331a..e96319112cac8b15e33b5c376a2975bd28dd201e 100644 --- a/example/peripheral/media/lvgl_indev/configs/e2000q_aarch32_demo_media.config +++ b/example/peripheral/media/lvgl_indev/configs/e2000q_aarch32_demo_media.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,8 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -347,16 +339,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/media/lvgl_indev/configs/e2000q_aarch64_demo_media.config b/example/peripheral/media/lvgl_indev/configs/e2000q_aarch64_demo_media.config index a753898b5226f2a007a570f8293c26e0bb49fcda..f890f118d1aad5e02437d1db47ba09b97b6e16a1 100644 --- a/example/peripheral/media/lvgl_indev/configs/e2000q_aarch64_demo_media.config +++ b/example/peripheral/media/lvgl_indev/configs/e2000q_aarch64_demo_media.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,8 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -336,16 +328,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/media/lvgl_indev/configs/phytiumpi_aarch32_firefly_media.config b/example/peripheral/media/lvgl_indev/configs/phytiumpi_aarch32_firefly_media.config index 3339c98c8b0d672e3f02c56a3a9937bda41eab24..c763dc6daee5c3e42b7202950984b57ee0c55a3f 100644 --- a/example/peripheral/media/lvgl_indev/configs/phytiumpi_aarch32_firefly_media.config +++ b/example/peripheral/media/lvgl_indev/configs/phytiumpi_aarch32_firefly_media.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,8 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -346,16 +338,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/media/lvgl_indev/configs/phytiumpi_aarch64_firefly_media.config b/example/peripheral/media/lvgl_indev/configs/phytiumpi_aarch64_firefly_media.config index 7ec6a0233bf65668ab0f64f9786b3bd69a75b3ca..0844bbec2ae7bbabb207aedaaf45471e0e3a676a 100644 --- a/example/peripheral/media/lvgl_indev/configs/phytiumpi_aarch64_firefly_media.config +++ b/example/peripheral/media/lvgl_indev/configs/phytiumpi_aarch64_firefly_media.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,8 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -335,16 +327,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/media/lvgl_indev/inc/usb_config.h b/example/peripheral/media/lvgl_indev/inc/usb_config.h deleted file mode 100644 index 3cce59fdd809b0b3551651639bf4e8bd5ca9b069..0000000000000000000000000000000000000000 --- a/example/peripheral/media/lvgl_indev/inc/usb_config.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright : (C) 2022 Phytium Information Technology, Inc. - * All Rights Reserved. - * - * This program is OPEN SOURCE software: you can redistribute it and/or modify it - * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, - * either version 1.0 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the Phytium Public License for more details. - * - * - * FilePath: usb_config.h - * Date: 2022-09-19 17:28:44 - * LastEditTime: 2022-09-19 17:28:45 - * Description:  This file is for usb hc xhci configuration. - * - * Modify History: - * Ver   Who        Date         Changes - * ----- ------     --------    -------------------------------------- - * 1.0 zhugengyu 2022/9/19 init commit - * 1.1 liqiaozhong 2023/2/10 update to v0.7.0 - */ - -#ifndef USB_CONFIG_H -#define USB_CONFIG_H - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* ================ USB common Configuration ================ */ -void *usb_hc_malloc(size_t size); -void usb_hc_free(); -void *usb_hc_malloc_align(size_t align, size_t size); - -#define usb_malloc(size) usb_hc_malloc(size) -#define usb_free(ptr) usb_hc_free(ptr) -#define usb_align(align, size) usb_hc_malloc_align(align, size) - -#ifndef CONFIG_USB_DBG_LEVEL - #define CONFIG_USB_DBG_LEVEL USB_DBG_ERROR -#endif - -#ifndef CONFIG_USB_PRINTF - #define CONFIG_USB_PRINTF printf -#endif - -/* Enable print with color */ -#define CONFIG_USB_PRINTF_COLOR_ENABLE - -/* data align size when use dma */ -#ifndef CONFIG_USB_ALIGN_SIZE - #define CONFIG_USB_ALIGN_SIZE 4 -#endif - -/* attribute data into no cache ram */ -#define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable"))) - -/* ================= USB Device Stack Configuration ================ */ - -/* Ep0 max transfer buffer, specially for receiving data from ep0 out */ -#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 - - -#ifndef CONFIG_USBDEV_MSC_BLOCK_SIZE - #define CONFIG_USBDEV_MSC_BLOCK_SIZE 512 -#endif - -#ifndef CONFIG_USBDEV_MSC_MANUFACTURER_STRING - #define CONFIG_USBDEV_MSC_MANUFACTURER_STRING "" -#endif - -#ifndef CONFIG_USBDEV_MSC_PRODUCT_STRING - #define CONFIG_USBDEV_MSC_PRODUCT_STRING "" -#endif - -#ifndef CONFIG_USBDEV_MSC_VERSION_STRING - #define CONFIG_USBDEV_MSC_VERSION_STRING "0.01" -#endif - -// #define CONFIG_USBHOST_GET_STRING_DESC -#define CONFIG_USBHOST_GET_DEVICE_DESC - -// #define CONFIG_USBDEV_MSC_THREAD -#define CONFIG_INPUT_MOUSE_WHEEL - -#ifdef CONFIG_USBDEV_MSC_THREAD - #ifndef CONFIG_USBDEV_MSC_STACKSIZE - #define CONFIG_USBDEV_MSC_STACKSIZE 2048 - #endif - - #ifndef CONFIG_USBDEV_MSC_PRIO - #define CONFIG_USBDEV_MSC_PRIO 4 - #endif -#endif - -#ifndef CONFIG_USBDEV_AUDIO_VERSION - #define CONFIG_USBDEV_AUDIO_VERSION 0x0100 -#endif - -#ifndef CONFIG_USBDEV_AUDIO_MAX_CHANNEL - #define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 8 -#endif - -/* ================ USB HOST Stack Configuration ================== */ - -#define CONFIG_USBHOST_MAX_RHPORTS 2 -#define CONFIG_USBHOST_MAX_EXTHUBS 2 -#define CONFIG_USBHOST_MAX_EHPORTS 4 -#define CONFIG_USBHOST_MAX_INTERFACES 6 -#define CONFIG_USBHOST_MAX_INTF_ALTSETTINGS 1 -#define CONFIG_USBHOST_MAX_ENDPOINTS 4 - -#define CONFIG_USBHOST_DEV_NAMELEN 16 - -#ifndef CONFIG_USBHOST_PSC_PRIO - #define CONFIG_USBHOST_PSC_PRIO 4 -#endif -#ifndef CONFIG_USBHOST_PSC_STACKSIZE - #define CONFIG_USBHOST_PSC_STACKSIZE 4096 -#endif - -/* Ep0 max transfer buffer */ -#define CONFIG_USBHOST_REQUEST_BUFFER_LEN 512 - -#ifndef CONFIG_USBHOST_CONTROL_TRANSFER_TIMEOUT - #define CONFIG_USBHOST_CONTROL_TRANSFER_TIMEOUT 500 -#endif - -#ifndef CONFIG_USBHOST_MSC_TIMEOUT - #define CONFIG_USBHOST_MSC_TIMEOUT 5000 -#endif - -/* do not try to enumrate one interface */ -#ifndef CONFIG_USBHOST_ENUM_FIRST_INTERFACE_ONLY - #define CONFIG_USBHOST_ENUM_FIRST_INTERFACE_ONLY -#endif - -/* ================ USB Device Port Configuration ================*/ - -#define CONFIG_XHCI_PAGE_SIZE 4096U -#define CONFIG_XHCI_PAGE_SHIFT 12U - -/* ================ USB Host Port Configuration ==================*/ - -#define CONFIG_USBHOST_PIPE_NUM 10 - -/* ================ XHCI Configuration ================ */ -#define CONFIG_USBHOST_XHCI -#define CONFIG_USBHOST_XHCI_NUM 2 - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/example/peripheral/media/lvgl_indev/sdkconfig b/example/peripheral/media/lvgl_indev/sdkconfig index 7ec6a0233bf65668ab0f64f9786b3bd69a75b3ca..0844bbec2ae7bbabb207aedaaf45471e0e3a676a 100644 --- a/example/peripheral/media/lvgl_indev/sdkconfig +++ b/example/peripheral/media/lvgl_indev/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,8 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -335,16 +327,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/media/lvgl_indev/sdkconfig.h b/example/peripheral/media/lvgl_indev/sdkconfig.h index e0e2acad558fec1fd9e34a7ca8a0932e4b7944ce..658696135f303564d66be098fade655571e3e883 100644 --- a/example/peripheral/media/lvgl_indev/sdkconfig.h +++ b/example/peripheral/media/lvgl_indev/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,8 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -#define CONFIG_USE_USB -#define CONFIG_ENABLE_USB_FXHCI /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ @@ -295,16 +288,14 @@ /* CherryUSB Configuration */ +#define CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM +/* CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set */ +/* CONFIG_CHERRY_USB_PORT_PUSB2 is not set */ #define CONFIG_CHERRY_USB_PORT_XHCI -/* CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set */ #define CONFIG_CHERRYUSB_HOST -/* CONFIG_CHERRYUSB_DEVICE is not set */ #define CONFIG_CHERRY_USB_HOST_HUB #define CONFIG_CHERRY_USB_HOST_MSC #define CONFIG_CHERRY_USB_HOST_HID -/* CONFIG_CHERRY_USB_HOST_VEDIO is not set */ -/* CONFIG_CHERRY_USB_HOST_CDC is not set */ -/* CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set */ /* end of CherryUSB Configuration */ /* CONFIG_USE_FSL_SDMMC is not set */ /* CONFIG_USE_FSL_WIFI is not set */ diff --git a/example/peripheral/media/lvgl_indev/src/img_cursor.c b/example/peripheral/media/lvgl_indev/src/img_cursor.c index dfbad812e9976383ee028a7c8bee9ef3382b415f..922728ed64b3b064cf907a427d7cc514521b3197 100644 --- a/example/peripheral/media/lvgl_indev/src/img_cursor.c +++ b/example/peripheral/media/lvgl_indev/src/img_cursor.c @@ -4,11 +4,11 @@ #define LV_ATTRIBUTE_MEM_ALIGN #endif -#ifndef LV_ATTRIBUTE_IMG_LV_SHUBIAO -#define LV_ATTRIBUTE_IMG_LV_SHUBIAO +#ifndef LV_ATTRIBUTE_IMG_LV_MOUSE +#define LV_ATTRIBUTE_IMG_LV_MOUSE #endif -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_LV_SHUBIAO uint8_t lv_shubiao_map[] = { +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_LV_MOUSE uint8_t lv_mouse_map[] = { 0x00, 0x00, 0x00, 0x00, 0x33, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0xd8, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -79,12 +79,12 @@ const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_LV_SHUBIA 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -const lv_img_dsc_t lv_shubiao = { +const lv_img_dsc_t lv_mouse = { .header.cf = LV_IMG_CF_ALPHA_8BIT, .header.always_zero = 0, .header.reserved = 0, .header.w = 36, .header.h = 68, .data_size = 2448, - .data = lv_shubiao_map, + .data = lv_mouse_map, }; diff --git a/example/peripheral/media/lvgl_indev/src/lv_indev_create.c b/example/peripheral/media/lvgl_indev/src/lv_indev_create.c index 8f14117224f46a6f73449a312be44b3ba9ba8bbd..c3beb685ed35d4ec9ba5186c031c9d9377517658 100644 --- a/example/peripheral/media/lvgl_indev/src/lv_indev_create.c +++ b/example/peripheral/media/lvgl_indev/src/lv_indev_create.c @@ -105,7 +105,7 @@ BaseType_t FFreeRTOSInitKbCreate(u32 id) /* init keyborad task */ xReturn = xTaskCreate((TaskFunction_t)keyboardinit, /* 任务入口函数 */ (const char *)"keyboardinit", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)(uintptr)id, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 3, /* 任务的优先级 */ (TaskHandle_t *)&init_kb_task); /* 任务控制 */ @@ -123,7 +123,7 @@ BaseType_t FFreeRTOSInitMsCreate(u32 id) /* init mouse task */ xReturn = xTaskCreate((TaskFunction_t)mouseinit, /* 任务入口函数 */ (const char *)"mouseinit", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)(uintptr)id, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 3, /* 任务的优先级 */ (TaskHandle_t *)&init_ms_task); /* 任务控制 */ @@ -147,14 +147,14 @@ BaseType_t FFreeRTOSMediaInitCreate(void ) /* Media init task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSMediaDeviceInit, /* 任务入口函数 */ (const char *)"FFreeRTOSMediaDeviceInit", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 2, /* 任务的优先级 */ (TaskHandle_t *)&init_task); /* 任务控制 */ /* Hpd task control */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSMediaHpdHandle, /* 任务入口函数 */ (const char *)"FFreeRTOSMediaHpdHandle", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 1, /* 任务的优先级 */ (TaskHandle_t *)&hpd_task); @@ -176,7 +176,7 @@ BaseType_t FFreeRTOSlVGLConfigCreate(void) /* lvgl demo task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSLVGLConfigTask, /* 任务入口函数 */ (const char *)"FFreeRTOSLVGLConfigTask", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 3, /* 任务的优先级 */ (TaskHandle_t *)&lvgl_init_task); /* 任务控制 */ @@ -200,7 +200,7 @@ BaseType_t FFreeRTOSDemoCreate(void) /* lvgl demo task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSLVGLDemoTask, /* 任务入口函数 */ (const char *)"FFreeRTOSLVGLDemoTask", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 2, /* 任务的优先级 */ (TaskHandle_t *)&demo_task); /* 任务控制 */ diff --git a/example/peripheral/media/lvgl_indev/src/lv_indev_port.c b/example/peripheral/media/lvgl_indev/src/lv_indev_port.c index f9f9395d75868aa8e7a208548945c7592ae716e6..b67975094e015fe487345833d86af993d6cd457c 100644 --- a/example/peripheral/media/lvgl_indev/src/lv_indev_port.c +++ b/example/peripheral/media/lvgl_indev/src/lv_indev_port.c @@ -20,6 +20,7 @@ * ----- ------ -------- -------------------------------------- * 1.0 Wangzq 2023/04/20 Modify the format and establish the version * 1.1 Wangzq 2023/07/07 change the third-party and driver relation + * 1.2 Wangzq 2024/08/01 change the port to adapt the new cherryusb stack */ /********************* * INCLUDES @@ -38,6 +39,7 @@ #include "lvgl.h" #include "usbh_core.h" #include "usbh_hid.h" +#include "usb_config.h" #define HID_KEYCODE_TO_ASCII \ {0 , 0 }, /* 0x00 */ \ @@ -145,23 +147,28 @@ {'=' , '=' }, /* 0x67 */ \ +#define XHCI_INPUT_WAIT_TIME (pdMS_TO_TICKS(20000UL)) +#define TIMER_OUT (XHCI_INPUT_WAIT_TIME + (pdMS_TO_TICKS(10000UL))) /************************** Variable Definitions *****************************/ -#define FUSB_MEMP_TOTAL_SIZE SZ_1M +static u8 const keycode2ascii[128][2] = { HID_KEYCODE_TO_ASCII }; +static struct usbh_urb kbd_intin_urb; +static uint8_t kbd_buffer[128] __attribute__((aligned(sizeof(unsigned long)))) = {0}; +static struct usb_osal_timer *kbd_timer = NULL; +static QueueHandle_t xQueue = NULL; -static char *keyborad_name = "/usb0/kbd0"; -static char *mouse_name = "/usb1/mouse1"; +static char *keyborad_name = "/dev/input0"; +static char *mouse_name = "/dev/input2"; -static FMemp memp; -static u8 memp_buf[FUSB_MEMP_TOTAL_SIZE]; -static struct usbh_bus usb[FUSB3_NUM]; -static struct usbh_urb kbd_intin_urb; -static bool botton_press_state = false; +enum +{ + XHCI_USB_MOUSE_SUCCESS = 0, + XHCI_USB_MOUSE_FAIL = 1, +}; +static bool botton_press_state = false; static struct usbh_urb mouse_intin_urb; static uint8_t mouse_buffer[128] __attribute__((aligned(sizeof(unsigned long)))) = {0}; -static uint8_t kbd_buffer[128] __attribute__((aligned(sizeof(unsigned long)))) = {0}; -static u8 const keycode2ascii[128][2] = { HID_KEYCODE_TO_ASCII }; - +static struct usb_osal_timer *mouse_timer = NULL; static f32 mouse_xdisp; static f32 mouse_ydisp; static uint8_t mouse_wdisp;/*reserved,w is the botton of mouse*/ @@ -179,106 +186,6 @@ static void keypad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data); static uint32_t keypad_get_key(void); /************************** Function Prototypes ******************************/ -extern void USBH_IRQHandler(void *); - -static void UsbHcInterrruptHandler(s32 vector, void *param) -{ - USBH_IRQHandler(param); -} - -static u8 UsbInputGetInterfaceProtocol(struct usbh_hid *hid_class) -{ - struct usbh_hubport *hport = hid_class->hport; - u8 intf = hid_class->intf; - const struct usb_interface_descriptor *intf_desc = &hport->config.intf->altsetting[intf].intf_desc; - - return intf_desc->bInterfaceProtocol; -} - -static void UsbHcSetupInterrupt(u32 id) -{ - u32 cpu_id; - u32 irq_num = (id == FUSB3_ID_0) ? FUSB3_0_IRQ_NUM : FUSB3_1_IRQ_NUM; - u32 irq_priority = 13U; - - GetCpuId(&cpu_id); - InterruptSetTargetCpus(irq_num, cpu_id); - - InterruptSetPriority(irq_num, irq_priority); - - /* register intr callback */ - InterruptInstall(irq_num, - UsbHcInterrruptHandler, - &usb[id], - NULL); - - /* enable irq */ - InterruptUmask(irq_num); -} - -/*********************************hardware configure********************************************/ -void UsbHcSetupMemp(void) -{ - if (FT_COMPONENT_IS_READY != memp.is_ready) - { - USB_ASSERT(FT_SUCCESS == FMempInit(&memp, &memp_buf[0], &memp_buf[0] + FUSB_MEMP_TOTAL_SIZE)); - } -} - -/* implement cherryusb weak functions */ -void usb_hc_low_level_init(uint32_t id) -{ - UsbHcSetupMemp(); - UsbHcSetupInterrupt(id); -} - -unsigned long usb_hc_get_register_base(uint32_t id) -{ - if (FUSB3_ID_0 == id) - { - return FUSB3_0_BASE_ADDR + FUSB3_XHCI_OFFSET; - } - else - { - return FUSB3_1_BASE_ADDR + FUSB3_XHCI_OFFSET; - } -} - -void *usb_hc_malloc(size_t size) -{ - return usb_hc_malloc_align(sizeof(void *), size); -} - -void *usb_hc_malloc_align(size_t align, size_t size) -{ - void *result = FMempMallocAlign(&memp, size, align); - - if (result) - { - memset(result, 0U, size); - } - return result; -} - -void usb_hc_free(void *ptr) -{ - if (NULL != ptr) - { - FMempFree(&memp, ptr); - } -} - -void usb_assert(const char *filename, int linenum) -{ - FAssert(filename, linenum, 0xff); -} - -void usb_hc_dcache_invalidate(void *addr, unsigned long len) -{ - FCacheDCacheInvalidateRange((uintptr)addr, len); -} - -/*********************************usb indev function********************************************/ /* look up new key in previous keys */ static inline boolean FindKeyInPrevInput(const struct usb_hid_kbd_report *report, u8 keycode) { @@ -319,25 +226,16 @@ static void UsbKeyBoardHandleInput(struct usb_hid_kbd_report *input) static void UsbKeyboardCallback(void *arg, int nbytes) { - u8 intf_protocol; - struct usbh_hid *kbd_class = (struct usbh_hid *)arg; - intf_protocol = UsbInputGetInterfaceProtocol(kbd_class); - - if (HID_PROTOCOL_KEYBOARD == intf_protocol) /* handle input from keyboard */ + struct usbh_hid *hid_class = (struct usbh_hid *)arg; +printf("UsbKeyboardCallback **********\r\n"); + if (nbytes > 0) { - if (nbytes < (int)sizeof(struct usb_hid_kbd_report)) - { - printf("nbytes = %d", nbytes); - } - else - { - UsbKeyBoardHandleInput((struct usb_hid_kbd_report *)kbd_buffer); - } + UsbKeyBoardHandleInput((struct usb_hid_kbd_report *)kbd_buffer); } - else + + if (kbd_timer) { - printf("mismatch callback for protocol-%d", intf_protocol); - return; + usb_osal_timer_start(kbd_timer); } } @@ -376,7 +274,6 @@ static void UsbMouseHandleInput(struct usb_hid_mouse_report *input) { UsbMouseRightButtonCB(); } - mouse_xdisp = (f32)(LV_HOR_RES_MAX / 256.0) * input->xdisp + mouse_xdisp;/*relative to last position*/ mouse_ydisp = (f32)(LV_VER_RES_MAX / 256.0) * input->ydisp + mouse_ydisp; @@ -402,23 +299,14 @@ static void UsbMouseCallback(void *arg, int nbytes) { u8 intf_protocol; struct usbh_hid *mouse_class = (struct usbh_hid *)arg; - intf_protocol = UsbInputGetInterfaceProtocol(mouse_class); - - if (HID_PROTOCOL_MOUSE == intf_protocol) /* handle input from mouse */ + if (nbytes > 0) { - if (nbytes < (int)sizeof(struct usb_hid_mouse_report)) - { - printf("nbytes = %d", nbytes); - } - else - { - UsbMouseHandleInput((struct usb_hid_mouse_report *)mouse_buffer); - } + UsbMouseHandleInput((struct usb_hid_mouse_report *)mouse_buffer); } - else + + if (mouse_timer) { - printf("mismatch callback for protocol-%d", intf_protocol); - return; + usb_osal_timer_start(mouse_timer); } } @@ -435,10 +323,24 @@ void lv_port_kb_init(u32 id) indev_keypad = lv_indev_drv_register(&indev_drv_keyborad); } +static void UsbMouseTimeout(void *arg) +{ + struct usbh_hid *hid = (struct usbh_hid *)arg; + usbh_int_urb_fill(&hid->intin_urb, hid->hport, hid->intin, mouse_buffer, hid->intin->wMaxPacketSize, 0, UsbMouseCallback, hid); + usbh_submit_urb(&hid->intin_urb); +} + +static void UsbKeyboardTimeout(void *arg) +{ + struct usbh_hid *hid = (struct usbh_hid *)arg; + usbh_int_urb_fill(&hid->intin_urb, hid->hport, hid->intin, kbd_buffer, hid->intin->wMaxPacketSize, 0, UsbKeyboardCallback, hid); + usbh_submit_urb(&hid->intin_urb); +} + void lv_port_ms_init(u32 id) { static lv_indev_drv_t indev_drv_mouse; - LV_IMG_DECLARE(lv_shubiao); + LV_IMG_DECLARE(lv_mouse); mouse_init(id); /*Register a mouse input device*/ lv_indev_drv_init(&indev_drv_mouse); @@ -447,18 +349,18 @@ void lv_port_ms_init(u32 id) indev_mouse = lv_indev_drv_register(&indev_drv_mouse); /*Set cursor. For simplicity set a HOME symbol now.*/ lv_obj_t *mouse_cursor = lv_img_create(lv_scr_act()); - lv_img_set_src(mouse_cursor, &lv_shubiao); + lv_img_set_src(mouse_cursor, &lv_mouse); lv_img_set_angle(mouse_cursor, 0); lv_img_set_zoom(mouse_cursor, 128); lv_indev_set_cursor(indev_mouse, mouse_cursor); + } /*Initialize your mouse*/ static void mouse_init(u32 id) { u32 ret = 0; - memset(&usb[id], 0, sizeof(usb[id])); - ret = usbh_initialize(id, &usb[id]); + ret = usbh_initialize(id, usb_hc_get_register_base(id)); if (0 != ret) { printf("init usb failed \r\n"); @@ -504,22 +406,61 @@ static bool mouse_is_pressed(void) /*Get the x and y coordinates if the mouse is pressed*/ static void mouse_get_xy(lv_coord_t *x, lv_coord_t *y) { + (*x) = mouse_xdisp; + (*y) = mouse_ydisp; +} + +void usbh_hid_run(struct usbh_hid *hid_class) +{ + struct usbh_hubport *hport = hid_class->hport; + uint8_t intf = hid_class->intf; + struct usbh_hid *mouse_class; - u8 intf_protocol; + mouse_class = (struct usbh_hid *)usbh_find_class_instance(mouse_name); if (mouse_class == NULL) { - printf("mouse_class null \r\n"); + printf(" *********** mouse_class null \r\n"); + } + /*Your code comes here*/ + struct usbh_hid *kbd_class; + u8 intf_protocol; + + kbd_class = (struct usbh_hid *)usbh_find_class_instance(keyborad_name); + if (kbd_class == NULL) + { + printf("kbd_class null \r\n"); vTaskDelete(NULL); - return; } - else + + if (HID_PROTOCOL_KEYBOARD == hport->config.intf[intf].altsetting[0].intf_desc.bInterfaceProtocol) { - usbh_int_urb_fill(&mouse_intin_urb, mouse_class->intin, mouse_buffer, 8, 0, UsbMouseCallback, mouse_class); - usbh_submit_urb(&mouse_intin_urb); - (*x) = mouse_xdisp; - (*y) = mouse_ydisp; + printf("**/dev/input%d is keyboard \r\n", hid_class->minor); + + kbd_timer = usb_osal_timer_create("keyboard_timer", + USBH_GET_URB_INTERVAL(kbd_class->intin->bInterval, kbd_class->hport->speed), + UsbKeyboardTimeout, + kbd_class, + false); + if (kbd_timer != NULL) + { + usb_osal_timer_start(kbd_timer); + } + } + else if (HID_PROTOCOL_MOUSE == hport->config.intf[intf].altsetting[0].intf_desc.bInterfaceProtocol) + { + printf("**/dev/input%d is mouse \r\n", hid_class->minor); + + mouse_timer = usb_osal_timer_create("mouse_timer", + USBH_GET_URB_INTERVAL(mouse_class->intin->bInterval, mouse_class->hport->speed), + UsbMouseTimeout, + mouse_class, + false); + if (mouse_timer != NULL) + { + usb_osal_timer_start(mouse_timer); + } } } @@ -527,8 +468,8 @@ static void mouse_get_xy(lv_coord_t *x, lv_coord_t *y) static void keypad_init(u32 id) { u32 ret = 0; - memset(&usb[id], 0, sizeof(usb[id])); - ret = usbh_initialize(id, &usb[id]); + ret = usbh_initialize(id, usb_hc_get_register_base(id)); + if (0 != ret) { printf("init usb failed \r\n"); @@ -549,6 +490,7 @@ static void keypad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) keyborad_code = 0; if (act_key != 0) { + printf("act_key = %d \r\n", act_key); data->state = LV_INDEV_STATE_PR; /*Translate the keys to LVGL control characters according to your key definitions*/ last_key = act_key; @@ -563,25 +505,7 @@ static void keypad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) /*Get the currently being pressed key. 0 if no key is pressed*/ static uint32_t keypad_get_key(void) { - /*Your code comes here*/ - struct usbh_hid *kbd_class; - u8 intf_protocol; - - kbd_class = (struct usbh_hid *)usbh_find_class_instance(keyborad_name); - if (kbd_class == NULL) - { - printf("kbd_class null \r\n"); - vTaskDelete(NULL); - return 0; - } - else - { - usbh_int_urb_fill(&kbd_intin_urb, kbd_class->intin, kbd_buffer, 8, 0, UsbKeyboardCallback, kbd_class); - usbh_submit_urb(&kbd_intin_urb); - return keyborad_code; - } - - return 0; + return keyborad_code; } /*This dummy typedef exists purely to silence -Wpedantic.*/ diff --git a/example/peripheral/media/lvgl_ui/README.md b/example/peripheral/media/lvgl_ui/README.md index a02d4f7594528d3f6134e8ce494c9a37a3b32a57..62a32770b04ed8cabee1fca2422e8683c088089e 100644 --- a/example/peripheral/media/lvgl_ui/README.md +++ b/example/peripheral/media/lvgl_ui/README.md @@ -164,7 +164,6 @@ Media demo 输入以上命令后,鼠标和键盘均能正常使用 -![media_indev](fig/media_indev.jpg) ## 3. 如何解决问题 diff --git a/example/peripheral/media/lvgl_ui/configs/e2000d_aarch32_demo_media.config b/example/peripheral/media/lvgl_ui/configs/e2000d_aarch32_demo_media.config index 59068317155e836324f5a4f2a513d9c9547163c7..b67648ed00d13d32aa628d4735db89105c4319a1 100644 --- a/example/peripheral/media/lvgl_ui/configs/e2000d_aarch32_demo_media.config +++ b/example/peripheral/media/lvgl_ui/configs/e2000d_aarch32_demo_media.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,8 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -348,16 +340,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/media/lvgl_ui/configs/e2000d_aarch64_demo_media.config b/example/peripheral/media/lvgl_ui/configs/e2000d_aarch64_demo_media.config index 51d0ad2771cc5f2438ffad9d59468257bd4d600c..16568bd41b37227313c94ebad50d27dc7541888a 100644 --- a/example/peripheral/media/lvgl_ui/configs/e2000d_aarch64_demo_media.config +++ b/example/peripheral/media/lvgl_ui/configs/e2000d_aarch64_demo_media.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,8 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -337,16 +329,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/media/lvgl_ui/configs/e2000q_aarch32_demo_media.config b/example/peripheral/media/lvgl_ui/configs/e2000q_aarch32_demo_media.config index 82cda4ba90d3f247756c673c9758fb86c749331a..e96319112cac8b15e33b5c376a2975bd28dd201e 100644 --- a/example/peripheral/media/lvgl_ui/configs/e2000q_aarch32_demo_media.config +++ b/example/peripheral/media/lvgl_ui/configs/e2000q_aarch32_demo_media.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,8 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -347,16 +339,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/media/lvgl_ui/configs/e2000q_aarch64_demo_media.config b/example/peripheral/media/lvgl_ui/configs/e2000q_aarch64_demo_media.config index a753898b5226f2a007a570f8293c26e0bb49fcda..f890f118d1aad5e02437d1db47ba09b97b6e16a1 100644 --- a/example/peripheral/media/lvgl_ui/configs/e2000q_aarch64_demo_media.config +++ b/example/peripheral/media/lvgl_ui/configs/e2000q_aarch64_demo_media.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,8 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -336,16 +328,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/media/lvgl_ui/configs/phytiumpi_aarch32_firefly_media.config b/example/peripheral/media/lvgl_ui/configs/phytiumpi_aarch32_firefly_media.config index 3339c98c8b0d672e3f02c56a3a9937bda41eab24..c763dc6daee5c3e42b7202950984b57ee0c55a3f 100644 --- a/example/peripheral/media/lvgl_ui/configs/phytiumpi_aarch32_firefly_media.config +++ b/example/peripheral/media/lvgl_ui/configs/phytiumpi_aarch32_firefly_media.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,8 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -346,16 +338,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/media/lvgl_ui/configs/phytiumpi_aarch64_firefly_media.config b/example/peripheral/media/lvgl_ui/configs/phytiumpi_aarch64_firefly_media.config index 7ec6a0233bf65668ab0f64f9786b3bd69a75b3ca..0844bbec2ae7bbabb207aedaaf45471e0e3a676a 100644 --- a/example/peripheral/media/lvgl_ui/configs/phytiumpi_aarch64_firefly_media.config +++ b/example/peripheral/media/lvgl_ui/configs/phytiumpi_aarch64_firefly_media.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,8 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -335,16 +327,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/media/lvgl_ui/inc/usb_config.h b/example/peripheral/media/lvgl_ui/inc/usb_config.h deleted file mode 100644 index 3cce59fdd809b0b3551651639bf4e8bd5ca9b069..0000000000000000000000000000000000000000 --- a/example/peripheral/media/lvgl_ui/inc/usb_config.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright : (C) 2022 Phytium Information Technology, Inc. - * All Rights Reserved. - * - * This program is OPEN SOURCE software: you can redistribute it and/or modify it - * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, - * either version 1.0 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the Phytium Public License for more details. - * - * - * FilePath: usb_config.h - * Date: 2022-09-19 17:28:44 - * LastEditTime: 2022-09-19 17:28:45 - * Description:  This file is for usb hc xhci configuration. - * - * Modify History: - * Ver   Who        Date         Changes - * ----- ------     --------    -------------------------------------- - * 1.0 zhugengyu 2022/9/19 init commit - * 1.1 liqiaozhong 2023/2/10 update to v0.7.0 - */ - -#ifndef USB_CONFIG_H -#define USB_CONFIG_H - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* ================ USB common Configuration ================ */ -void *usb_hc_malloc(size_t size); -void usb_hc_free(); -void *usb_hc_malloc_align(size_t align, size_t size); - -#define usb_malloc(size) usb_hc_malloc(size) -#define usb_free(ptr) usb_hc_free(ptr) -#define usb_align(align, size) usb_hc_malloc_align(align, size) - -#ifndef CONFIG_USB_DBG_LEVEL - #define CONFIG_USB_DBG_LEVEL USB_DBG_ERROR -#endif - -#ifndef CONFIG_USB_PRINTF - #define CONFIG_USB_PRINTF printf -#endif - -/* Enable print with color */ -#define CONFIG_USB_PRINTF_COLOR_ENABLE - -/* data align size when use dma */ -#ifndef CONFIG_USB_ALIGN_SIZE - #define CONFIG_USB_ALIGN_SIZE 4 -#endif - -/* attribute data into no cache ram */ -#define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable"))) - -/* ================= USB Device Stack Configuration ================ */ - -/* Ep0 max transfer buffer, specially for receiving data from ep0 out */ -#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 - - -#ifndef CONFIG_USBDEV_MSC_BLOCK_SIZE - #define CONFIG_USBDEV_MSC_BLOCK_SIZE 512 -#endif - -#ifndef CONFIG_USBDEV_MSC_MANUFACTURER_STRING - #define CONFIG_USBDEV_MSC_MANUFACTURER_STRING "" -#endif - -#ifndef CONFIG_USBDEV_MSC_PRODUCT_STRING - #define CONFIG_USBDEV_MSC_PRODUCT_STRING "" -#endif - -#ifndef CONFIG_USBDEV_MSC_VERSION_STRING - #define CONFIG_USBDEV_MSC_VERSION_STRING "0.01" -#endif - -// #define CONFIG_USBHOST_GET_STRING_DESC -#define CONFIG_USBHOST_GET_DEVICE_DESC - -// #define CONFIG_USBDEV_MSC_THREAD -#define CONFIG_INPUT_MOUSE_WHEEL - -#ifdef CONFIG_USBDEV_MSC_THREAD - #ifndef CONFIG_USBDEV_MSC_STACKSIZE - #define CONFIG_USBDEV_MSC_STACKSIZE 2048 - #endif - - #ifndef CONFIG_USBDEV_MSC_PRIO - #define CONFIG_USBDEV_MSC_PRIO 4 - #endif -#endif - -#ifndef CONFIG_USBDEV_AUDIO_VERSION - #define CONFIG_USBDEV_AUDIO_VERSION 0x0100 -#endif - -#ifndef CONFIG_USBDEV_AUDIO_MAX_CHANNEL - #define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 8 -#endif - -/* ================ USB HOST Stack Configuration ================== */ - -#define CONFIG_USBHOST_MAX_RHPORTS 2 -#define CONFIG_USBHOST_MAX_EXTHUBS 2 -#define CONFIG_USBHOST_MAX_EHPORTS 4 -#define CONFIG_USBHOST_MAX_INTERFACES 6 -#define CONFIG_USBHOST_MAX_INTF_ALTSETTINGS 1 -#define CONFIG_USBHOST_MAX_ENDPOINTS 4 - -#define CONFIG_USBHOST_DEV_NAMELEN 16 - -#ifndef CONFIG_USBHOST_PSC_PRIO - #define CONFIG_USBHOST_PSC_PRIO 4 -#endif -#ifndef CONFIG_USBHOST_PSC_STACKSIZE - #define CONFIG_USBHOST_PSC_STACKSIZE 4096 -#endif - -/* Ep0 max transfer buffer */ -#define CONFIG_USBHOST_REQUEST_BUFFER_LEN 512 - -#ifndef CONFIG_USBHOST_CONTROL_TRANSFER_TIMEOUT - #define CONFIG_USBHOST_CONTROL_TRANSFER_TIMEOUT 500 -#endif - -#ifndef CONFIG_USBHOST_MSC_TIMEOUT - #define CONFIG_USBHOST_MSC_TIMEOUT 5000 -#endif - -/* do not try to enumrate one interface */ -#ifndef CONFIG_USBHOST_ENUM_FIRST_INTERFACE_ONLY - #define CONFIG_USBHOST_ENUM_FIRST_INTERFACE_ONLY -#endif - -/* ================ USB Device Port Configuration ================*/ - -#define CONFIG_XHCI_PAGE_SIZE 4096U -#define CONFIG_XHCI_PAGE_SHIFT 12U - -/* ================ USB Host Port Configuration ==================*/ - -#define CONFIG_USBHOST_PIPE_NUM 10 - -/* ================ XHCI Configuration ================ */ -#define CONFIG_USBHOST_XHCI -#define CONFIG_USBHOST_XHCI_NUM 2 - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/example/peripheral/media/lvgl_ui/sdkconfig b/example/peripheral/media/lvgl_ui/sdkconfig index 7ec6a0233bf65668ab0f64f9786b3bd69a75b3ca..0844bbec2ae7bbabb207aedaaf45471e0e3a676a 100644 --- a/example/peripheral/media/lvgl_ui/sdkconfig +++ b/example/peripheral/media/lvgl_ui/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,8 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -335,16 +327,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/media/lvgl_ui/sdkconfig.h b/example/peripheral/media/lvgl_ui/sdkconfig.h index d575253d6a29fae7f133b47c4f4d03fb554a3ae5..658696135f303564d66be098fade655571e3e883 100644 --- a/example/peripheral/media/lvgl_ui/sdkconfig.h +++ b/example/peripheral/media/lvgl_ui/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,8 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -#define CONFIG_USE_USB -#define CONFIG_ENABLE_USB_FXHCI /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ @@ -188,7 +181,7 @@ #define CONFIG_DEFAULT_LINKER_SCRIPT /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_IMAGE_LOAD_ADDRESS 0x80100000 -#define CONFIG_IMAGE_MAX_LENGTH 0x10000000 +#define CONFIG_IMAGE_MAX_LENGTH 0x20000000 #define CONFIG_HEAP_SIZE 1 #define CONFIG_STACK_SIZE 0x400 /* end of Linker Options */ @@ -295,16 +288,14 @@ /* CherryUSB Configuration */ +#define CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM +/* CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set */ +/* CONFIG_CHERRY_USB_PORT_PUSB2 is not set */ #define CONFIG_CHERRY_USB_PORT_XHCI -/* CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set */ #define CONFIG_CHERRYUSB_HOST -/* CONFIG_CHERRYUSB_DEVICE is not set */ #define CONFIG_CHERRY_USB_HOST_HUB #define CONFIG_CHERRY_USB_HOST_MSC #define CONFIG_CHERRY_USB_HOST_HID -/* CONFIG_CHERRY_USB_HOST_VEDIO is not set */ -/* CONFIG_CHERRY_USB_HOST_CDC is not set */ -/* CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set */ /* end of CherryUSB Configuration */ /* CONFIG_USE_FSL_SDMMC is not set */ /* CONFIG_USE_FSL_WIFI is not set */ diff --git a/example/peripheral/media/lvgl_ui/src/lv_cursor_data.c b/example/peripheral/media/lvgl_ui/src/lv_cursor_data.c index dc1913a8d07f59c3c8bce79c473a8ff684f88199..4e1f66e301780f73ae2e68fae4ea6004a96774f5 100644 --- a/example/peripheral/media/lvgl_ui/src/lv_cursor_data.c +++ b/example/peripheral/media/lvgl_ui/src/lv_cursor_data.c @@ -4,11 +4,11 @@ #define LV_ATTRIBUTE_MEM_ALIGN #endif -#ifndef LV_ATTRIBUTE_IMG_LV_SHUBIAO -#define LV_ATTRIBUTE_IMG_LV_SHUBIAO +#ifndef LV_ATTRIBUTE_IMG_LV_MOUSE +#define LV_ATTRIBUTE_IMG_LV_MOUSE #endif -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_LV_SHUBIAO uint8_t lv_shubiao_map[] = { +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_LV_MOUSE uint8_t lv_mouse_map[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x22, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -31,12 +31,12 @@ const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_LV_SHUBIA 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -const lv_img_dsc_t lv_shubiao = { +const lv_img_dsc_t lv_mouse = { .header.cf = LV_IMG_CF_ALPHA_8BIT, .header.always_zero = 0, .header.reserved = 0, .header.w = 20, .header.h = 20, .data_size = 400, - .data = lv_shubiao_map, + .data = lv_mouse_map, }; diff --git a/example/peripheral/media/lvgl_ui/src/lv_indev_create.c b/example/peripheral/media/lvgl_ui/src/lv_indev_create.c index 37ff45d4984b63a2e3f1f76c568b7d04556e8ced..d672eee2910961da8833b9a5aeead869cd1cdd6a 100644 --- a/example/peripheral/media/lvgl_ui/src/lv_indev_create.c +++ b/example/peripheral/media/lvgl_ui/src/lv_indev_create.c @@ -105,7 +105,7 @@ BaseType_t FFreeRTOSInitKbCreate(u32 id) /* init keyborad task */ xReturn = xTaskCreate((TaskFunction_t)keyboardinit, /* 任务入口函数 */ (const char *)"keyboardinit", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)(uintptr)id, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 3, /* 任务的优先级 */ (TaskHandle_t *)&init_kb_task); /* 任务控制 */ @@ -123,7 +123,7 @@ BaseType_t FFreeRTOSInitMsCreate(u32 id) /* init mouse task */ xReturn = xTaskCreate((TaskFunction_t)mouseinit, /* 任务入口函数 */ (const char *)"mouseinit", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)(uintptr)id, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 3, /* 任务的优先级 */ (TaskHandle_t *)&init_ms_task); /* 任务控制 */ @@ -147,14 +147,14 @@ BaseType_t FFreeRTOSMediaInitCreate(void ) /* Media init task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSMediaDeviceInit, /* 任务入口函数 */ (const char *)"FFreeRTOSMediaDeviceInit", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 2, /* 任务的优先级 */ (TaskHandle_t *)&init_task); /* 任务控制 */ /* Hpd task control */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSMediaHpdHandle, /* 任务入口函数 */ (const char *)"FFreeRTOSMediaHpdHandle", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 1, /* 任务的优先级 */ (TaskHandle_t *)&hpd_task); @@ -176,7 +176,7 @@ BaseType_t FFreeRTOSlVGLConfigCreate(void) /* lvgl demo task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSLVGLConfigTask, /* 任务入口函数 */ (const char *)"FFreeRTOSLVGLConfigTask", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 3, /* 任务的优先级 */ (TaskHandle_t *)&lvgl_init_task); /* 任务控制 */ diff --git a/example/peripheral/media/lvgl_ui/src/lv_indev_port.c b/example/peripheral/media/lvgl_ui/src/lv_indev_port.c index b01e8f4919bf2ad75118f2036554d9b0870a6a56..b67975094e015fe487345833d86af993d6cd457c 100644 --- a/example/peripheral/media/lvgl_ui/src/lv_indev_port.c +++ b/example/peripheral/media/lvgl_ui/src/lv_indev_port.c @@ -20,6 +20,7 @@ * ----- ------ -------- -------------------------------------- * 1.0 Wangzq 2023/04/20 Modify the format and establish the version * 1.1 Wangzq 2023/07/07 change the third-party and driver relation + * 1.2 Wangzq 2024/08/01 change the port to adapt the new cherryusb stack */ /********************* * INCLUDES @@ -38,6 +39,7 @@ #include "lvgl.h" #include "usbh_core.h" #include "usbh_hid.h" +#include "usb_config.h" #define HID_KEYCODE_TO_ASCII \ {0 , 0 }, /* 0x00 */ \ @@ -145,23 +147,28 @@ {'=' , '=' }, /* 0x67 */ \ +#define XHCI_INPUT_WAIT_TIME (pdMS_TO_TICKS(20000UL)) +#define TIMER_OUT (XHCI_INPUT_WAIT_TIME + (pdMS_TO_TICKS(10000UL))) /************************** Variable Definitions *****************************/ -#define FUSB_MEMP_TOTAL_SIZE SZ_1M +static u8 const keycode2ascii[128][2] = { HID_KEYCODE_TO_ASCII }; +static struct usbh_urb kbd_intin_urb; +static uint8_t kbd_buffer[128] __attribute__((aligned(sizeof(unsigned long)))) = {0}; +static struct usb_osal_timer *kbd_timer = NULL; +static QueueHandle_t xQueue = NULL; -static char *keyborad_name = "/usb0/kbd0"; -static char *mouse_name = "/usb1/mouse1"; +static char *keyborad_name = "/dev/input0"; +static char *mouse_name = "/dev/input2"; -static FMemp memp; -static u8 memp_buf[FUSB_MEMP_TOTAL_SIZE]; -static struct usbh_bus usb[FUSB3_NUM]; -static struct usbh_urb kbd_intin_urb; -static bool botton_press_state = false; +enum +{ + XHCI_USB_MOUSE_SUCCESS = 0, + XHCI_USB_MOUSE_FAIL = 1, +}; +static bool botton_press_state = false; static struct usbh_urb mouse_intin_urb; static uint8_t mouse_buffer[128] __attribute__((aligned(sizeof(unsigned long)))) = {0}; -static uint8_t kbd_buffer[128] __attribute__((aligned(sizeof(unsigned long)))) = {0}; -static u8 const keycode2ascii[128][2] = { HID_KEYCODE_TO_ASCII }; - +static struct usb_osal_timer *mouse_timer = NULL; static f32 mouse_xdisp; static f32 mouse_ydisp; static uint8_t mouse_wdisp;/*reserved,w is the botton of mouse*/ @@ -179,106 +186,6 @@ static void keypad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data); static uint32_t keypad_get_key(void); /************************** Function Prototypes ******************************/ -extern void USBH_IRQHandler(void *); - -static void UsbHcInterrruptHandler(s32 vector, void *param) -{ - USBH_IRQHandler(param); -} - -static u8 UsbInputGetInterfaceProtocol(struct usbh_hid *hid_class) -{ - struct usbh_hubport *hport = hid_class->hport; - u8 intf = hid_class->intf; - const struct usb_interface_descriptor *intf_desc = &hport->config.intf->altsetting[intf].intf_desc; - - return intf_desc->bInterfaceProtocol; -} - -static void UsbHcSetupInterrupt(u32 id) -{ - u32 cpu_id; - u32 irq_num = (id == FUSB3_ID_0) ? FUSB3_0_IRQ_NUM : FUSB3_1_IRQ_NUM; - u32 irq_priority = 13U; - - GetCpuId(&cpu_id); - InterruptSetTargetCpus(irq_num, cpu_id); - - InterruptSetPriority(irq_num, irq_priority); - - /* register intr callback */ - InterruptInstall(irq_num, - UsbHcInterrruptHandler, - &usb[id], - NULL); - - /* enable irq */ - InterruptUmask(irq_num); -} - -/*********************************hardware configure********************************************/ -void UsbHcSetupMemp(void) -{ - if (FT_COMPONENT_IS_READY != memp.is_ready) - { - USB_ASSERT(FT_SUCCESS == FMempInit(&memp, &memp_buf[0], &memp_buf[0] + FUSB_MEMP_TOTAL_SIZE)); - } -} - -/* implement cherryusb weak functions */ -void usb_hc_low_level_init(uint32_t id) -{ - UsbHcSetupMemp(); - UsbHcSetupInterrupt(id); -} - -unsigned long usb_hc_get_register_base(uint32_t id) -{ - if (FUSB3_ID_0 == id) - { - return FUSB3_0_BASE_ADDR + FUSB3_XHCI_OFFSET; - } - else - { - return FUSB3_1_BASE_ADDR + FUSB3_XHCI_OFFSET; - } -} - -void *usb_hc_malloc(size_t size) -{ - return usb_hc_malloc_align(sizeof(void *), size); -} - -void *usb_hc_malloc_align(size_t align, size_t size) -{ - void *result = FMempMallocAlign(&memp, size, align); - - if (result) - { - memset(result, 0U, size); - } - return result; -} - -void usb_hc_free(void *ptr) -{ - if (NULL != ptr) - { - FMempFree(&memp, ptr); - } -} - -void usb_assert(const char *filename, int linenum) -{ - FAssert(filename, linenum, 0xff); -} - -void usb_hc_dcache_invalidate(void *addr, unsigned long len) -{ - FCacheDCacheInvalidateRange((uintptr)addr, len); -} - -/*********************************usb indev function********************************************/ /* look up new key in previous keys */ static inline boolean FindKeyInPrevInput(const struct usb_hid_kbd_report *report, u8 keycode) { @@ -319,39 +226,34 @@ static void UsbKeyBoardHandleInput(struct usb_hid_kbd_report *input) static void UsbKeyboardCallback(void *arg, int nbytes) { - u8 intf_protocol; - struct usbh_hid *kbd_class = (struct usbh_hid *)arg; - intf_protocol = UsbInputGetInterfaceProtocol(kbd_class); - if (HID_PROTOCOL_KEYBOARD == intf_protocol) /* handle input from keyboard */ + struct usbh_hid *hid_class = (struct usbh_hid *)arg; +printf("UsbKeyboardCallback **********\r\n"); + if (nbytes > 0) { - if (nbytes < (int)sizeof(struct usb_hid_kbd_report)) - { - printf("nbytes = %d", nbytes); - } - else - { - UsbKeyBoardHandleInput((struct usb_hid_kbd_report *)kbd_buffer); - } + UsbKeyBoardHandleInput((struct usb_hid_kbd_report *)kbd_buffer); } - else + + if (kbd_timer) { - printf("mismatch callback for protocol-%d", intf_protocol); - return; + usb_osal_timer_start(kbd_timer); } } static inline void UsbMouseLeftButtonCB(void) { + printf("<-\r\n"); botton_press_state = true; } static inline void UsbMouseRightButtonCB(void) { + printf("->\r\n"); botton_press_state = true; } static inline void UsbMouseMiddleButtonCB(void) { + printf("C\r\n"); botton_press_state = true; } @@ -372,7 +274,6 @@ static void UsbMouseHandleInput(struct usb_hid_mouse_report *input) { UsbMouseRightButtonCB(); } - mouse_xdisp = (f32)(LV_HOR_RES_MAX / 256.0) * input->xdisp + mouse_xdisp;/*relative to last position*/ mouse_ydisp = (f32)(LV_VER_RES_MAX / 256.0) * input->ydisp + mouse_ydisp; @@ -398,23 +299,14 @@ static void UsbMouseCallback(void *arg, int nbytes) { u8 intf_protocol; struct usbh_hid *mouse_class = (struct usbh_hid *)arg; - intf_protocol = UsbInputGetInterfaceProtocol(mouse_class); - - if (HID_PROTOCOL_MOUSE == intf_protocol) /* handle input from mouse */ + if (nbytes > 0) { - if (nbytes < (int)sizeof(struct usb_hid_mouse_report)) - { - printf("nbytes = %d", nbytes); - } - else - { - UsbMouseHandleInput((struct usb_hid_mouse_report *)mouse_buffer); - } + UsbMouseHandleInput((struct usb_hid_mouse_report *)mouse_buffer); } - else + + if (mouse_timer) { - printf("mismatch callback for protocol-%d", intf_protocol); - return; + usb_osal_timer_start(mouse_timer); } } @@ -431,10 +323,24 @@ void lv_port_kb_init(u32 id) indev_keypad = lv_indev_drv_register(&indev_drv_keyborad); } +static void UsbMouseTimeout(void *arg) +{ + struct usbh_hid *hid = (struct usbh_hid *)arg; + usbh_int_urb_fill(&hid->intin_urb, hid->hport, hid->intin, mouse_buffer, hid->intin->wMaxPacketSize, 0, UsbMouseCallback, hid); + usbh_submit_urb(&hid->intin_urb); +} + +static void UsbKeyboardTimeout(void *arg) +{ + struct usbh_hid *hid = (struct usbh_hid *)arg; + usbh_int_urb_fill(&hid->intin_urb, hid->hport, hid->intin, kbd_buffer, hid->intin->wMaxPacketSize, 0, UsbKeyboardCallback, hid); + usbh_submit_urb(&hid->intin_urb); +} + void lv_port_ms_init(u32 id) { static lv_indev_drv_t indev_drv_mouse; - LV_IMG_DECLARE(lv_shubiao); + LV_IMG_DECLARE(lv_mouse); mouse_init(id); /*Register a mouse input device*/ lv_indev_drv_init(&indev_drv_mouse); @@ -443,18 +349,18 @@ void lv_port_ms_init(u32 id) indev_mouse = lv_indev_drv_register(&indev_drv_mouse); /*Set cursor. For simplicity set a HOME symbol now.*/ lv_obj_t *mouse_cursor = lv_img_create(lv_scr_act()); - lv_img_set_src(mouse_cursor, &lv_shubiao); + lv_img_set_src(mouse_cursor, &lv_mouse); lv_img_set_angle(mouse_cursor, 0); lv_img_set_zoom(mouse_cursor, 128); lv_indev_set_cursor(indev_mouse, mouse_cursor); + } /*Initialize your mouse*/ static void mouse_init(u32 id) { u32 ret = 0; - memset(&usb[id], 0, sizeof(usb[id])); - ret = usbh_initialize(id, &usb[id]); + ret = usbh_initialize(id, usb_hc_get_register_base(id)); if (0 != ret) { printf("init usb failed \r\n"); @@ -488,6 +394,7 @@ static bool mouse_is_pressed(void) { if (true == botton_press_state) { + printf("botton_press_state \r\n"); return true; } else @@ -499,22 +406,61 @@ static bool mouse_is_pressed(void) /*Get the x and y coordinates if the mouse is pressed*/ static void mouse_get_xy(lv_coord_t *x, lv_coord_t *y) { + (*x) = mouse_xdisp; + (*y) = mouse_ydisp; +} + +void usbh_hid_run(struct usbh_hid *hid_class) +{ + struct usbh_hubport *hport = hid_class->hport; + uint8_t intf = hid_class->intf; + struct usbh_hid *mouse_class; - u8 intf_protocol; + mouse_class = (struct usbh_hid *)usbh_find_class_instance(mouse_name); if (mouse_class == NULL) { - printf("mouse_class null \r\n"); + printf(" *********** mouse_class null \r\n"); + } + /*Your code comes here*/ + struct usbh_hid *kbd_class; + u8 intf_protocol; + + kbd_class = (struct usbh_hid *)usbh_find_class_instance(keyborad_name); + if (kbd_class == NULL) + { + printf("kbd_class null \r\n"); vTaskDelete(NULL); - return; } - else + + if (HID_PROTOCOL_KEYBOARD == hport->config.intf[intf].altsetting[0].intf_desc.bInterfaceProtocol) { - usbh_int_urb_fill(&mouse_intin_urb, mouse_class->intin, mouse_buffer, 8, 0, UsbMouseCallback, mouse_class); - usbh_submit_urb(&mouse_intin_urb); - (*x) = mouse_xdisp; - (*y) = mouse_ydisp; + printf("**/dev/input%d is keyboard \r\n", hid_class->minor); + + kbd_timer = usb_osal_timer_create("keyboard_timer", + USBH_GET_URB_INTERVAL(kbd_class->intin->bInterval, kbd_class->hport->speed), + UsbKeyboardTimeout, + kbd_class, + false); + if (kbd_timer != NULL) + { + usb_osal_timer_start(kbd_timer); + } + } + else if (HID_PROTOCOL_MOUSE == hport->config.intf[intf].altsetting[0].intf_desc.bInterfaceProtocol) + { + printf("**/dev/input%d is mouse \r\n", hid_class->minor); + + mouse_timer = usb_osal_timer_create("mouse_timer", + USBH_GET_URB_INTERVAL(mouse_class->intin->bInterval, mouse_class->hport->speed), + UsbMouseTimeout, + mouse_class, + false); + if (mouse_timer != NULL) + { + usb_osal_timer_start(mouse_timer); + } } } @@ -522,8 +468,8 @@ static void mouse_get_xy(lv_coord_t *x, lv_coord_t *y) static void keypad_init(u32 id) { u32 ret = 0; - memset(&usb[id], 0, sizeof(usb[id])); - ret = usbh_initialize(id, &usb[id]); + ret = usbh_initialize(id, usb_hc_get_register_base(id)); + if (0 != ret) { printf("init usb failed \r\n"); @@ -544,6 +490,7 @@ static void keypad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) keyborad_code = 0; if (act_key != 0) { + printf("act_key = %d \r\n", act_key); data->state = LV_INDEV_STATE_PR; /*Translate the keys to LVGL control characters according to your key definitions*/ last_key = act_key; @@ -553,31 +500,12 @@ static void keypad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) data->state = LV_INDEV_STATE_REL; } data->key = last_key; - } /*Get the currently being pressed key. 0 if no key is pressed*/ static uint32_t keypad_get_key(void) { - /*Your code comes here*/ - struct usbh_hid *kbd_class; - u8 intf_protocol; - - kbd_class = (struct usbh_hid *)usbh_find_class_instance(keyborad_name); - if (kbd_class == NULL) - { - printf("kbd_class null \r\n"); - vTaskDelete(NULL); - return 0; - } - else - { - usbh_int_urb_fill(&kbd_intin_urb, kbd_class->intin, kbd_buffer, 8, 0, UsbKeyboardCallback, kbd_class); - usbh_submit_urb(&kbd_intin_urb); - return keyborad_code; - } - - return 0; + return keyborad_code; } /*This dummy typedef exists purely to silence -Wpedantic.*/ diff --git a/example/peripheral/media/media_test/configs/e2000d_aarch32_demo_freertos.config b/example/peripheral/media/media_test/configs/e2000d_aarch32_demo_freertos.config index 5c1f1468d66613bb81961a9840e0c64bd87b1350..fa32385ee42de5181823418b309cabf2694e0571 100644 --- a/example/peripheral/media/media_test/configs/e2000d_aarch32_demo_freertos.config +++ b/example/peripheral/media/media_test/configs/e2000d_aarch32_demo_freertos.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/media_test/configs/e2000d_aarch32_demo_media.config b/example/peripheral/media/media_test/configs/e2000d_aarch32_demo_media.config index 7802b2b807437a9dc52fb92c396f2e2037a459a6..e1f43cc24cb0f2ac44a3876d307dc067e56d6565 100644 --- a/example/peripheral/media/media_test/configs/e2000d_aarch32_demo_media.config +++ b/example/peripheral/media/media_test/configs/e2000d_aarch32_demo_media.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/media_test/configs/e2000d_aarch64_demo_freertos.config b/example/peripheral/media/media_test/configs/e2000d_aarch64_demo_freertos.config index 7491c18b46947e8e02cee6fa8908e12d4c219d6b..2a178386c2e8975571e743943860adcc5b82b6e8 100644 --- a/example/peripheral/media/media_test/configs/e2000d_aarch64_demo_freertos.config +++ b/example/peripheral/media/media_test/configs/e2000d_aarch64_demo_freertos.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/media_test/configs/e2000d_aarch64_demo_media.config b/example/peripheral/media/media_test/configs/e2000d_aarch64_demo_media.config index 47d1f3b64acaebaf6fc375ee7875b18d401985b1..b85f6aa55df9e9a44785460f1378c27be2400369 100644 --- a/example/peripheral/media/media_test/configs/e2000d_aarch64_demo_media.config +++ b/example/peripheral/media/media_test/configs/e2000d_aarch64_demo_media.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/media_test/configs/e2000q_aarch32_demo_freertos.config b/example/peripheral/media/media_test/configs/e2000q_aarch32_demo_freertos.config index 268e8cf2279d10ea8bb2254775884b862d9738c7..5ed7b7dbfa8b119f40af8abd17f88a12d24ad088 100644 --- a/example/peripheral/media/media_test/configs/e2000q_aarch32_demo_freertos.config +++ b/example/peripheral/media/media_test/configs/e2000q_aarch32_demo_freertos.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/media_test/configs/e2000q_aarch32_demo_media.config b/example/peripheral/media/media_test/configs/e2000q_aarch32_demo_media.config index d5fd1b5a8b979c13f765654b01340256ee425230..0cb0a46d411d946feca543d69766dd2ca067a377 100644 --- a/example/peripheral/media/media_test/configs/e2000q_aarch32_demo_media.config +++ b/example/peripheral/media/media_test/configs/e2000q_aarch32_demo_media.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/media_test/configs/e2000q_aarch64_demo_freertos.config b/example/peripheral/media/media_test/configs/e2000q_aarch64_demo_freertos.config index 5b038189a37ae4d7a8b07964fbd60eb500b6904c..225ecf5df36b87ca12e7db8d8cf7a153ed69bfd2 100644 --- a/example/peripheral/media/media_test/configs/e2000q_aarch64_demo_freertos.config +++ b/example/peripheral/media/media_test/configs/e2000q_aarch64_demo_freertos.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/media_test/configs/e2000q_aarch64_demo_media.config b/example/peripheral/media/media_test/configs/e2000q_aarch64_demo_media.config index 456bbec5d7d0aa0469e7e1c7784d474aeff8c0f8..886a56468c648b131b54a770824c3ba8c9cd7c2c 100644 --- a/example/peripheral/media/media_test/configs/e2000q_aarch64_demo_media.config +++ b/example/peripheral/media/media_test/configs/e2000q_aarch64_demo_media.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/media_test/configs/phytiumpi_aarch32_firefly_freertos.config b/example/peripheral/media/media_test/configs/phytiumpi_aarch32_firefly_freertos.config index 5c7d8ffef9195354ca967205c5069773f226f6b7..4cf49b2716bbf47f859ed55f59205636d4302438 100644 --- a/example/peripheral/media/media_test/configs/phytiumpi_aarch32_firefly_freertos.config +++ b/example/peripheral/media/media_test/configs/phytiumpi_aarch32_firefly_freertos.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/media_test/configs/phytiumpi_aarch32_firefly_media.config b/example/peripheral/media/media_test/configs/phytiumpi_aarch32_firefly_media.config index 201a6d8a59fdfcf1d43b23d34f4cd78597c15ed5..cadc58ada9c1caddc323b604e4ff519a60fe7457 100644 --- a/example/peripheral/media/media_test/configs/phytiumpi_aarch32_firefly_media.config +++ b/example/peripheral/media/media_test/configs/phytiumpi_aarch32_firefly_media.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/media_test/configs/phytiumpi_aarch64_firefly_freertos.config b/example/peripheral/media/media_test/configs/phytiumpi_aarch64_firefly_freertos.config index 87720f592c019d34a5d3979d93bbe02bb5fd0593..efbfdcc5031078599c5233dc5130478ab393b388 100644 --- a/example/peripheral/media/media_test/configs/phytiumpi_aarch64_firefly_freertos.config +++ b/example/peripheral/media/media_test/configs/phytiumpi_aarch64_firefly_freertos.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/media_test/configs/phytiumpi_aarch64_firefly_media.config b/example/peripheral/media/media_test/configs/phytiumpi_aarch64_firefly_media.config index 6420a648463dd7fc6036d47681760a379e24e0a1..7ecbab110bb18aeaecf872bbbc25ec998e081e21 100644 --- a/example/peripheral/media/media_test/configs/phytiumpi_aarch64_firefly_media.config +++ b/example/peripheral/media/media_test/configs/phytiumpi_aarch64_firefly_media.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/media_test/sdkconfig b/example/peripheral/media/media_test/sdkconfig index 6420a648463dd7fc6036d47681760a379e24e0a1..7ecbab110bb18aeaecf872bbbc25ec998e081e21 100644 --- a/example/peripheral/media/media_test/sdkconfig +++ b/example/peripheral/media/media_test/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/media/media_test/sdkconfig.h b/example/peripheral/media/media_test/sdkconfig.h index 21ebd87666f04e378292abac4ad9f4c1c3454de2..e74ceaeb99a796d1e7b5f841a177cb8ab44b56f5 100644 --- a/example/peripheral/media/media_test/sdkconfig.h +++ b/example/peripheral/media/media_test/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,7 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/peripheral/media/media_test/src/media_example.c b/example/peripheral/media/media_test/src/media_example.c index 748e957a1821ccc48679e6e67be92061a1721056..ecc590418405920305a88d0af67d11ddb8322d54 100644 --- a/example/peripheral/media/media_test/src/media_example.c +++ b/example/peripheral/media/media_test/src/media_example.c @@ -354,7 +354,7 @@ BaseType_t FFreeRTOSMediaCreate(void) /* Media init task */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSMediaInitTask, /* 任务入口函数 */ (const char *)"FFreeRTOSMediaInitTask", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 2, /* 任务的优先级 */ (TaskHandle_t *)&init_task); @@ -362,7 +362,7 @@ BaseType_t FFreeRTOSMediaCreate(void) /* HPD任务控制 */ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSMediaHpdTask, /* 任务入口函数 */ (const char *)"FFreeRTOSMediaHpdTask", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)configMAX_PRIORITIES - 1, /* 任务的优先级 */ (TaskHandle_t *)&hpd_task); diff --git a/example/peripheral/pwm/configs/e2000d_aarch32_demo_pwm.config b/example/peripheral/pwm/configs/e2000d_aarch32_demo_pwm.config index 4d13b45ac4bdab8454c09d3966059e9306e8c12e..e7e87426037a3eee1e345b6ca77892a054181252 100644 --- a/example/peripheral/pwm/configs/e2000d_aarch32_demo_pwm.config +++ b/example/peripheral/pwm/configs/e2000d_aarch32_demo_pwm.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set CONFIG_USE_PWM=y diff --git a/example/peripheral/pwm/configs/e2000d_aarch64_demo_pwm.config b/example/peripheral/pwm/configs/e2000d_aarch64_demo_pwm.config index 77ed1647ce7ae06facfbf9a2c304133489d393c5..c023a8a977eb50931dce1b7fa5159726640f4173 100644 --- a/example/peripheral/pwm/configs/e2000d_aarch64_demo_pwm.config +++ b/example/peripheral/pwm/configs/e2000d_aarch64_demo_pwm.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set CONFIG_USE_PWM=y diff --git a/example/peripheral/pwm/configs/e2000q_aarch32_demo_pwm.config b/example/peripheral/pwm/configs/e2000q_aarch32_demo_pwm.config index 086d04b531e3487e807733671457ab9bcd9316c6..2d0aaf308691b88f375062b1afc47da606cacc68 100644 --- a/example/peripheral/pwm/configs/e2000q_aarch32_demo_pwm.config +++ b/example/peripheral/pwm/configs/e2000q_aarch32_demo_pwm.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set CONFIG_USE_PWM=y diff --git a/example/peripheral/pwm/configs/e2000q_aarch64_demo_pwm.config b/example/peripheral/pwm/configs/e2000q_aarch64_demo_pwm.config index 1b89afe0cfe53e3aa99338c57a002a5eea69a4c7..09991d847f0855b954a039a97b2582023b17ca42 100644 --- a/example/peripheral/pwm/configs/e2000q_aarch64_demo_pwm.config +++ b/example/peripheral/pwm/configs/e2000q_aarch64_demo_pwm.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set CONFIG_USE_PWM=y diff --git a/example/peripheral/pwm/configs/phytiumpi_aarch32_firefly_pwm.config b/example/peripheral/pwm/configs/phytiumpi_aarch32_firefly_pwm.config index af0d1f6d0c37c4e09051c7928310b027f62e8919..f71c8667c94a8e5bf4c4a7fc9cb78a60e80443fa 100644 --- a/example/peripheral/pwm/configs/phytiumpi_aarch32_firefly_pwm.config +++ b/example/peripheral/pwm/configs/phytiumpi_aarch32_firefly_pwm.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set CONFIG_USE_PWM=y diff --git a/example/peripheral/pwm/configs/phytiumpi_aarch64_firefly_pwm.config b/example/peripheral/pwm/configs/phytiumpi_aarch64_firefly_pwm.config index f573d7d1acef671b9ba2849d2c4b1eceda1c724c..9a8c35eebf2eb4d64965e489d25ff4307804899f 100644 --- a/example/peripheral/pwm/configs/phytiumpi_aarch64_firefly_pwm.config +++ b/example/peripheral/pwm/configs/phytiumpi_aarch64_firefly_pwm.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set CONFIG_USE_PWM=y diff --git a/example/peripheral/pwm/main.c b/example/peripheral/pwm/main.c index 6d288e41f102f8a4ed8351c19912ca83531e2256..a3311d3f44f504c06f23be6ea4050ab7c2076cab 100644 --- a/example/peripheral/pwm/main.c +++ b/example/peripheral/pwm/main.c @@ -55,7 +55,7 @@ int main(void) /* used in no-letter-shell mode */ ret = xTaskCreate((TaskFunction_t)PwmExampleTaskEntry, /* 任务入口函数 */ (const char *)"PwmExampleTaskEntry", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)5, /* 任务优先级 */ NULL); /* 任务句柄 */ diff --git a/example/peripheral/pwm/sdkconfig b/example/peripheral/pwm/sdkconfig index f573d7d1acef671b9ba2849d2c4b1eceda1c724c..9a8c35eebf2eb4d64965e489d25ff4307804899f 100644 --- a/example/peripheral/pwm/sdkconfig +++ b/example/peripheral/pwm/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set CONFIG_USE_PWM=y diff --git a/example/peripheral/pwm/sdkconfig.h b/example/peripheral/pwm/sdkconfig.h index 3704d285ebc56cd6f5151b248f3b42ba85742d88..d4d266fd7a3e613cd9bcc9156e67011328b664dd 100644 --- a/example/peripheral/pwm/sdkconfig.h +++ b/example/peripheral/pwm/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,7 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ #define CONFIG_USE_PWM diff --git a/example/peripheral/pwm/src/pwm_dead_band_example.c b/example/peripheral/pwm/src/pwm_dead_band_example.c index 74f2fb490d883966205486769402fda36fc272e2..a4ddf1ee7efb38a906af88a4df806308c69067c0 100644 --- a/example/peripheral/pwm/src/pwm_dead_band_example.c +++ b/example/peripheral/pwm/src/pwm_dead_band_example.c @@ -211,7 +211,7 @@ BaseType_t FFreeRTOSPwmDeadBandTaskCreate() xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSPwmDeadBandTask, /* 任务入口函数 */ (const char *)"FFreeRTOSPwmDeadBandTask", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)PWM_DEAD_BAND_TEST_TASK_PRIORITY, /* 任务优先级 */ NULL); /* 任务句柄 */ diff --git a/example/peripheral/pwm/src/pwm_dual_channel_example.c b/example/peripheral/pwm/src/pwm_dual_channel_example.c index 3f37c9fb77c6ecc25611f33a00e2aba1ecb5182c..27627495e21a76a5ad392c1e48cd9f64cf69c303 100644 --- a/example/peripheral/pwm/src/pwm_dual_channel_example.c +++ b/example/peripheral/pwm/src/pwm_dual_channel_example.c @@ -205,7 +205,7 @@ BaseType_t FFreeRTOSPwmDualChannelTaskCreate() xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSPwmDualChannelTask, /* 任务入口函数 */ (const char *)"FFreeRTOSPwmDualChannelTask", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)PWM_DUAL_CHANNEL_TEST_TASK_PRIORITY, /* 任务优先级 */ NULL); /* 任务句柄 */ diff --git a/example/peripheral/pwm/src/pwm_single_channel_example.c b/example/peripheral/pwm/src/pwm_single_channel_example.c index 0faa5438c9b7c0420bc8a1ce2c1fbbbd8e5ce477..b8dee825c6b85cfdc495cc598cd20d6c02c2d198 100644 --- a/example/peripheral/pwm/src/pwm_single_channel_example.c +++ b/example/peripheral/pwm/src/pwm_single_channel_example.c @@ -175,7 +175,7 @@ BaseType_t FFreeRTOSPwmSingleChannelTaskCreate() xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSSingleChannelTask, /* 任务入口函数 */ (const char *)"FFreeRTOSSingleChannelTask", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)PWM_SINGLE_CHANNEL_TEST_TASK_PRIORITY, /* 任务优先级 */ NULL); /* 任务句柄 */ diff --git a/example/peripheral/qspi/configs/d2000_aarch32_test_qspi.config b/example/peripheral/qspi/configs/d2000_aarch32_test_qspi.config index 564c7816df5bf468eaa6ddb4631aed33aeb29195..055a949ee4f1dc8647fd65edada4c0f38e15cde3 100644 --- a/example/peripheral/qspi/configs/d2000_aarch32_test_qspi.config +++ b/example/peripheral/qspi/configs/d2000_aarch32_test_qspi.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/qspi/configs/d2000_aarch64_test_qspi.config b/example/peripheral/qspi/configs/d2000_aarch64_test_qspi.config index 98b82721d71c22615b76b4ae04dcfdcd792f215e..49e84af21fec6c1f79e0c689d1903056294505bb 100644 --- a/example/peripheral/qspi/configs/d2000_aarch64_test_qspi.config +++ b/example/peripheral/qspi/configs/d2000_aarch64_test_qspi.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -137,7 +131,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/qspi/configs/e2000d_aarch32_demo_qspi.config b/example/peripheral/qspi/configs/e2000d_aarch32_demo_qspi.config index 54507102ca09dc86cfbc31312a1a3508b526dc2c..69e25ff7e5e11936610a872ca451723c391ea447 100644 --- a/example/peripheral/qspi/configs/e2000d_aarch32_demo_qspi.config +++ b/example/peripheral/qspi/configs/e2000d_aarch32_demo_qspi.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -156,7 +150,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/qspi/configs/e2000d_aarch64_demo_qspi.config b/example/peripheral/qspi/configs/e2000d_aarch64_demo_qspi.config index 5c5d00b0e8c7e53a1e5a30633cff0172ae6855dd..1b8ed6fc25aa8cacd33d224551dd891f9e453a68 100644 --- a/example/peripheral/qspi/configs/e2000d_aarch64_demo_qspi.config +++ b/example/peripheral/qspi/configs/e2000d_aarch64_demo_qspi.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -150,7 +144,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/qspi/configs/e2000q_aarch32_demo_qspi.config b/example/peripheral/qspi/configs/e2000q_aarch32_demo_qspi.config index 66a73d424dc5fd6a720e1ebd00c1dda1bc77fbe4..d8b57bce509a13d94e7bfb029f1a8816df95e8de 100644 --- a/example/peripheral/qspi/configs/e2000q_aarch32_demo_qspi.config +++ b/example/peripheral/qspi/configs/e2000q_aarch32_demo_qspi.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -155,7 +149,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/qspi/configs/e2000q_aarch64_demo_qspi.config b/example/peripheral/qspi/configs/e2000q_aarch64_demo_qspi.config index 6e7dad6bb32464d69aaece176a2cda1469320e74..2b5da9dd5179a4178e71e4cc478efe2a0ee0f2d2 100644 --- a/example/peripheral/qspi/configs/e2000q_aarch64_demo_qspi.config +++ b/example/peripheral/qspi/configs/e2000q_aarch64_demo_qspi.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/qspi/configs/ft2004_aarch32_dsk_qspi.config b/example/peripheral/qspi/configs/ft2004_aarch32_dsk_qspi.config index c544fca5418bbfa863a0ec9272ab03423ca599fa..52f6d18291867392b5b4e802c5a8be89aa466360 100644 --- a/example/peripheral/qspi/configs/ft2004_aarch32_dsk_qspi.config +++ b/example/peripheral/qspi/configs/ft2004_aarch32_dsk_qspi.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/qspi/configs/ft2004_aarch64_dsk_qspi.config b/example/peripheral/qspi/configs/ft2004_aarch64_dsk_qspi.config index d3aee07996dcac1048e9be0c5b40ddb433335f34..5b193cd663f2d8f567c8171ec5c055313c1d39a3 100644 --- a/example/peripheral/qspi/configs/ft2004_aarch64_dsk_qspi.config +++ b/example/peripheral/qspi/configs/ft2004_aarch64_dsk_qspi.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -137,7 +131,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/qspi/configs/phytiumpi_aarch32_firefly_qspi.config b/example/peripheral/qspi/configs/phytiumpi_aarch32_firefly_qspi.config index 4d6817c21299dccb7b040a69c8181dcbb44ade9c..d8d48cc192380143764d364de1a4b43763cb8bf9 100644 --- a/example/peripheral/qspi/configs/phytiumpi_aarch32_firefly_qspi.config +++ b/example/peripheral/qspi/configs/phytiumpi_aarch32_firefly_qspi.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -154,7 +148,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/qspi/configs/phytiumpi_aarch64_firefly_qspi.config b/example/peripheral/qspi/configs/phytiumpi_aarch64_firefly_qspi.config index 37275ee9b7889a0b26eed49c6847d6fb0bb33387..217aa275e2433562104c4b95c546d491ff688ac3 100644 --- a/example/peripheral/qspi/configs/phytiumpi_aarch64_firefly_qspi.config +++ b/example/peripheral/qspi/configs/phytiumpi_aarch64_firefly_qspi.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/qspi/main.c b/example/peripheral/qspi/main.c index ce906a1efa30980a46bcd098fac97c0a91e80983..31e4e911f0bd3df512e3f7a10e128b8838e3943e 100644 --- a/example/peripheral/qspi/main.c +++ b/example/peripheral/qspi/main.c @@ -59,7 +59,7 @@ int main(void) taskENTER_CRITICAL(); /*进入临界区*/ ret = xTaskCreate((TaskFunction_t)QspiExampleTaskEntry, /* 任务入口函数 */ (const char *)"QspiExampleTaskEntry", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)QSPI_EXAMPLE_TASK_PRIORITY, /* 任务的优先级 */ NULL); diff --git a/example/peripheral/qspi/sdkconfig b/example/peripheral/qspi/sdkconfig index 37275ee9b7889a0b26eed49c6847d6fb0bb33387..217aa275e2433562104c4b95c546d491ff688ac3 100644 --- a/example/peripheral/qspi/sdkconfig +++ b/example/peripheral/qspi/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/qspi/sdkconfig.h b/example/peripheral/qspi/sdkconfig.h index 129f0f3ca7fdbdaef6377ce387fb4ec9aa8bf8a4..b1435460126a0582644204d48cb61af943b57d59 100644 --- a/example/peripheral/qspi/sdkconfig.h +++ b/example/peripheral/qspi/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -134,7 +129,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/peripheral/qspi/src/qspi_dual_flash_stack_example.c b/example/peripheral/qspi/src/qspi_dual_flash_stack_example.c index a5953a19d4b5717d668a242dc6cb5e88c50ce93c..2843facb8d6d2aa464609c87da831585debcc3e1 100644 --- a/example/peripheral/qspi/src/qspi_dual_flash_stack_example.c +++ b/example/peripheral/qspi/src/qspi_dual_flash_stack_example.c @@ -225,7 +225,7 @@ BaseType_t FFreeRTOSQspiDualFlashTaskCreate(void) taskENTER_CRITICAL(); /*进入临界区*/ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSQspiDualFlashTask, /* 任务入口函数 */ (const char *)"FFreeRTOSQspiDualFlashTask", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)QSPI_DUAL_FLASH_TEST_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ diff --git a/example/peripheral/qspi/src/qspi_flash_connection_check_example.c b/example/peripheral/qspi/src/qspi_flash_connection_check_example.c index ea1d9213e32513fc0955cb0f597a730580efea7a..3ef449a66236b9b1c36e6126dfe477db1977b09b 100644 --- a/example/peripheral/qspi/src/qspi_flash_connection_check_example.c +++ b/example/peripheral/qspi/src/qspi_flash_connection_check_example.c @@ -98,7 +98,7 @@ BaseType_t FFreeRTOSQspiCheckTaskCreate(void) taskENTER_CRITICAL(); /*进入临界区*/ xReturn = xTaskCreate((TaskFunction_t)QspiConnectCheckTask, /* 任务入口函数 */ (const char *)"QspiConnectCheckTask", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, (UBaseType_t)QSPI_FLASH_CONNECT_TEST_TASK_PRIORITY, /* 任务的优先级 */ NULL); diff --git a/example/peripheral/qspi/src/qspi_flash_indirect_example.c b/example/peripheral/qspi/src/qspi_flash_indirect_example.c index 87e5cc6f39641786c89f913e2bcc8f7f801fbb29..dff4ff69546149c4e2b0c6ef572d56cdd7d0f39c 100644 --- a/example/peripheral/qspi/src/qspi_flash_indirect_example.c +++ b/example/peripheral/qspi/src/qspi_flash_indirect_example.c @@ -226,7 +226,7 @@ BaseType_t FFreeRTOSQspiIndirectTaskCreate(void) taskENTER_CRITICAL(); /*进入临界区*/ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSQspiIndirectTask, /* 任务入口函数 */ (const char *)"FFreeRTOSQspiIndirectTask", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)QSPI_FLASH_INDIRECT_TEST_TASK_PRIORITY, /* 任务的优先级 */ NULL); diff --git a/example/peripheral/qspi/src/qspi_flash_polled_example.c b/example/peripheral/qspi/src/qspi_flash_polled_example.c index 4750bcb8c891f4c58d036c1f6dc50430accbcf22..226f1c71c65b0207da0eb30580f23eb70344ebcb 100644 --- a/example/peripheral/qspi/src/qspi_flash_polled_example.c +++ b/example/peripheral/qspi/src/qspi_flash_polled_example.c @@ -220,7 +220,7 @@ BaseType_t FFreeRTOSQspiPolledTaskCreate(void) taskENTER_CRITICAL(); /*进入临界区*/ xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSQspiPolledTask, /* 任务入口函数 */ (const char *)"FFreeRTOSQspiPolledTask", /* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)QSPI_POLLED_TEST_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ diff --git a/example/peripheral/sdif/configs/e2000d_aarch32_demo_sdif.config b/example/peripheral/sdif/configs/e2000d_aarch32_demo_sdif.config index f207c9001cf8e1654a9552e414bdac63b65af3ab..f868f81d90a281aa36dbd1728c5236cfa124a182 100644 --- a/example/peripheral/sdif/configs/e2000d_aarch32_demo_sdif.config +++ b/example/peripheral/sdif/configs/e2000d_aarch32_demo_sdif.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -151,7 +145,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/sdif/configs/e2000d_aarch64_demo_sdif.config b/example/peripheral/sdif/configs/e2000d_aarch64_demo_sdif.config index 15f0b00e1676b88f2914a6f9d68b010620a02d4d..47e0e796fb2068ec26ffbed934d295cf844202c4 100644 --- a/example/peripheral/sdif/configs/e2000d_aarch64_demo_sdif.config +++ b/example/peripheral/sdif/configs/e2000d_aarch64_demo_sdif.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -145,7 +139,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/sdif/configs/e2000q_aarch32_demo_sdif.config b/example/peripheral/sdif/configs/e2000q_aarch32_demo_sdif.config index 507e233e26c02191a9b7138699e4adb70159ba35..e46a6c27f977c558925eac16444ce958da289c5d 100644 --- a/example/peripheral/sdif/configs/e2000q_aarch32_demo_sdif.config +++ b/example/peripheral/sdif/configs/e2000q_aarch32_demo_sdif.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -150,7 +144,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/sdif/configs/e2000q_aarch64_demo_sdif.config b/example/peripheral/sdif/configs/e2000q_aarch64_demo_sdif.config index 7e78f9034641e8afe80f80a83a68478e49a08d0c..fed9737b8987250977fa69c1a766d83a2098c112 100644 --- a/example/peripheral/sdif/configs/e2000q_aarch64_demo_sdif.config +++ b/example/peripheral/sdif/configs/e2000q_aarch64_demo_sdif.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -144,7 +138,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/sdif/main.c b/example/peripheral/sdif/main.c index 07986f0398222eac6350ccc30cfe39a014de930c..76ce3f6d9c735ad4407af738def83755a77555f3 100644 --- a/example/peripheral/sdif/main.c +++ b/example/peripheral/sdif/main.c @@ -59,7 +59,7 @@ int main(void) /* used in no-letter-shell mode */ ret = xTaskCreate((TaskFunction_t)SdifExampleTaskEntry, /* 任务入口函数 */ (const char *)"SdifExampleTaskEntry", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)GDMA_EXAMPLE_TASK_PRIORITY, /* 任务优先级 */ NULL); /* 任务句柄 */ diff --git a/example/peripheral/sdif/sdkconfig b/example/peripheral/sdif/sdkconfig index 7e78f9034641e8afe80f80a83a68478e49a08d0c..fed9737b8987250977fa69c1a766d83a2098c112 100644 --- a/example/peripheral/sdif/sdkconfig +++ b/example/peripheral/sdif/sdkconfig @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -144,7 +138,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/sdif/sdkconfig.h b/example/peripheral/sdif/sdkconfig.h index 04ab1ea91a5da85ecfa5a5b3770e933c6558fb4b..4904d833870fe28bcfc482f9d005c6937b0b160d 100644 --- a/example/peripheral/sdif/sdkconfig.h +++ b/example/peripheral/sdif/sdkconfig.h @@ -99,11 +99,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -132,7 +127,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/peripheral/sdif/src/sdif_emmc_read_write.c b/example/peripheral/sdif/src/sdif_emmc_read_write.c index 2030267032e16d41a6c30646ae465b155cd08254..fcae49f6323918341957f6a3279daf38746bd7d0 100644 --- a/example/peripheral/sdif/src/sdif_emmc_read_write.c +++ b/example/peripheral/sdif/src/sdif_emmc_read_write.c @@ -217,7 +217,7 @@ int FFreeRTOSEmmcWriteRead(void) /* 创建主要操作任务 */ xReturn = xTaskCreate((TaskFunction_t)SdifEmmcReadWriteTask, (const char *)"SdifEmmcReadWriteTask", - (uint16_t)4096, + 4096, NULL, (UBaseType_t)SDIF_EXAMPLE_TASK_PRIORITY, NULL); diff --git a/example/peripheral/sdif/src/sdif_tf_read_write.c b/example/peripheral/sdif/src/sdif_tf_read_write.c index 2b294217f059b9b794404017cf5cfcbdfb9c6ac8..e59d661ee18d8270f4ddede5a9df30a2381ba215 100644 --- a/example/peripheral/sdif/src/sdif_tf_read_write.c +++ b/example/peripheral/sdif/src/sdif_tf_read_write.c @@ -217,7 +217,7 @@ int FFreeRTOSTfWriteRead(void) /* 创建主要操作任务 */ xReturn = xTaskCreate((TaskFunction_t)SdifTFReadWriteTask, (const char *)"SdifTFReadWriteTask", - (uint16_t)4096, + 4096, NULL, (UBaseType_t)SDIF_EXAMPLE_TASK_PRIORITY, NULL); diff --git a/example/peripheral/spi/configs/e2000d_aarch32_demo_spi.config b/example/peripheral/spi/configs/e2000d_aarch32_demo_spi.config index a62f3f59829a1418666f0de3620ab6ad67d79482..7f6c795dca18187787a10047d71b2aced66a5f80 100644 --- a/example/peripheral/spi/configs/e2000d_aarch32_demo_spi.config +++ b/example/peripheral/spi/configs/e2000d_aarch32_demo_spi.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -150,7 +144,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/spi/configs/e2000d_aarch64_demo_spi.config b/example/peripheral/spi/configs/e2000d_aarch64_demo_spi.config index ddac73f3588454283f2085050702d3b454b01d1f..f72ab03c865130454f7d82d5a940d9760e537aa9 100644 --- a/example/peripheral/spi/configs/e2000d_aarch64_demo_spi.config +++ b/example/peripheral/spi/configs/e2000d_aarch64_demo_spi.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -144,7 +138,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/spi/configs/e2000q_aarch32_demo_spi.config b/example/peripheral/spi/configs/e2000q_aarch32_demo_spi.config index 122d23f281cc58110d4cef90b671d5378ff30a47..70e77fdb79da96fda60a14ab9952b7024d70953a 100644 --- a/example/peripheral/spi/configs/e2000q_aarch32_demo_spi.config +++ b/example/peripheral/spi/configs/e2000q_aarch32_demo_spi.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/spi/configs/e2000q_aarch64_demo_spi.config b/example/peripheral/spi/configs/e2000q_aarch64_demo_spi.config index 47290e7f0a5ba3124604dd0682c3210949766333..1071b17c8a46e08166ec7fb306ca1d96ce64aec2 100644 --- a/example/peripheral/spi/configs/e2000q_aarch64_demo_spi.config +++ b/example/peripheral/spi/configs/e2000q_aarch64_demo_spi.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/spi/configs/phytiumpi_aarch32_firefly_spi.config b/example/peripheral/spi/configs/phytiumpi_aarch32_firefly_spi.config index 7e5b4daf29dec6df3a45b955d93c7c43eb1092fc..9aaf744bb6b2aea2b2742b731c9d40f539437ba3 100644 --- a/example/peripheral/spi/configs/phytiumpi_aarch32_firefly_spi.config +++ b/example/peripheral/spi/configs/phytiumpi_aarch32_firefly_spi.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/spi/configs/phytiumpi_aarch64_firefly_spi.config b/example/peripheral/spi/configs/phytiumpi_aarch64_firefly_spi.config index 79dbdd46b58ae17b0d2fecdfc28239fc08cde13f..da9404987ce65c8c1fefc9ec9a4d4c7d3fb18fd5 100644 --- a/example/peripheral/spi/configs/phytiumpi_aarch64_firefly_spi.config +++ b/example/peripheral/spi/configs/phytiumpi_aarch64_firefly_spi.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/spi/main.c b/example/peripheral/spi/main.c index 4286392e93e8982f097705bd7fba40d952b93a8b..c08c88c32cae5a0b3cca5e869fb2535ddbbf7132 100644 --- a/example/peripheral/spi/main.c +++ b/example/peripheral/spi/main.c @@ -58,7 +58,7 @@ int main(void) taskENTER_CRITICAL(); /*进入临界区*/ ret = xTaskCreate((TaskFunction_t)SfudExampleTaskEntry, /* 任务入口函数 */ (const char *)"SfudExampleTaskEntry",/* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL,/* 任务入口函数参数 */ (UBaseType_t)SFUD_EXAMPLE_TASK_PRIORITY, /* 任务的优先级 */ NULL); diff --git a/example/peripheral/spi/sdkconfig b/example/peripheral/spi/sdkconfig index 79dbdd46b58ae17b0d2fecdfc28239fc08cde13f..da9404987ce65c8c1fefc9ec9a4d4c7d3fb18fd5 100644 --- a/example/peripheral/spi/sdkconfig +++ b/example/peripheral/spi/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/spi/sdkconfig.h b/example/peripheral/spi/sdkconfig.h index 7fc97e45fbce7031456eabc4db85ae1c929a5dbe..e2da861656bebb36a0ddb07073c724139d470663 100644 --- a/example/peripheral/spi/sdkconfig.h +++ b/example/peripheral/spi/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -130,7 +125,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/peripheral/spi/src/sfud_read_write.c b/example/peripheral/spi/src/sfud_read_write.c index 0cfac52ddbc708786df9a55cd1696cd04e2b342e..d5bc474253e32f73642815d917040774e21e5ecd 100644 --- a/example/peripheral/spi/src/sfud_read_write.c +++ b/example/peripheral/spi/src/sfud_read_write.c @@ -259,7 +259,7 @@ BaseType_t FFreeRTOSSfudWriteThenRead(void) } xReturn = xTaskCreate((TaskFunction_t)SpiSfudWriteThenReadTask, /* 任务入口函数 */ (const char *)"SpiSfudWriteThenReadTask",/* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL,/* 任务入口函数参数 */ (UBaseType_t)SFUD_WR_TEST_TASK_PRIORITY, /* 任务的优先级 */ NULL); diff --git a/example/peripheral/timer_tacho/configs/e2000d_aarch32_demo_timer.config b/example/peripheral/timer_tacho/configs/e2000d_aarch32_demo_timer.config index 5d07aeda6a3036cb988cf3cbd882bdd65a92d594..653168db5710e8d292e4a6a028eb593c1201b994 100644 --- a/example/peripheral/timer_tacho/configs/e2000d_aarch32_demo_timer.config +++ b/example/peripheral/timer_tacho/configs/e2000d_aarch32_demo_timer.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -156,7 +150,6 @@ CONFIG_ENABLE_TIMER_TACHO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/timer_tacho/configs/e2000d_aarch64_demo_timer.config b/example/peripheral/timer_tacho/configs/e2000d_aarch64_demo_timer.config index c6f26ee00c96c6b16d82ececa0fcd5b5d8a7d147..5bbff85d240a7cdfc6a6cc747269ce3ba23e3a3e 100644 --- a/example/peripheral/timer_tacho/configs/e2000d_aarch64_demo_timer.config +++ b/example/peripheral/timer_tacho/configs/e2000d_aarch64_demo_timer.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -150,7 +144,6 @@ CONFIG_ENABLE_TIMER_TACHO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/timer_tacho/configs/e2000q_aarch32_demo_timer.config b/example/peripheral/timer_tacho/configs/e2000q_aarch32_demo_timer.config index 317583f89dc6b9529cb7b3cc4535be0e5c84068a..8b2055c487a260556c60eef7418b54eca027562f 100644 --- a/example/peripheral/timer_tacho/configs/e2000q_aarch32_demo_timer.config +++ b/example/peripheral/timer_tacho/configs/e2000q_aarch32_demo_timer.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -155,7 +149,6 @@ CONFIG_ENABLE_TIMER_TACHO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/timer_tacho/configs/e2000q_aarch64_demo_timer.config b/example/peripheral/timer_tacho/configs/e2000q_aarch64_demo_timer.config index 20a9f848352a9901cb9b1916ae21b5cd2caed745..caa3e1ed2a3b7a3f3f04b25e3b88360adf7e4501 100644 --- a/example/peripheral/timer_tacho/configs/e2000q_aarch64_demo_timer.config +++ b/example/peripheral/timer_tacho/configs/e2000q_aarch64_demo_timer.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_TIMER_TACHO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/timer_tacho/configs/phytiumpi_aarch32_firefly_timer.config b/example/peripheral/timer_tacho/configs/phytiumpi_aarch32_firefly_timer.config index 0f312a669a914ee69f5d5f98a2e20f9b55b0a53f..a9e9328156ce399d07b3ccb738c9f2816f4a9772 100644 --- a/example/peripheral/timer_tacho/configs/phytiumpi_aarch32_firefly_timer.config +++ b/example/peripheral/timer_tacho/configs/phytiumpi_aarch32_firefly_timer.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -154,7 +148,6 @@ CONFIG_ENABLE_TIMER_TACHO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/timer_tacho/configs/phytiumpi_aarch64_firefly_timer.config b/example/peripheral/timer_tacho/configs/phytiumpi_aarch64_firefly_timer.config index d7742c33e43c810aadcf88e0fe682327c600b85e..a88d7f6bffdc58565ea88b51011a37044ded03c8 100644 --- a/example/peripheral/timer_tacho/configs/phytiumpi_aarch64_firefly_timer.config +++ b/example/peripheral/timer_tacho/configs/phytiumpi_aarch64_firefly_timer.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_TIMER_TACHO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/timer_tacho/main.c b/example/peripheral/timer_tacho/main.c index ee47d0ccea7cc61a11871deef82fdc46e25f681f..0bbdf1554f0a7a9b6b0fd1b0965530ee033d7548 100644 --- a/example/peripheral/timer_tacho/main.c +++ b/example/peripheral/timer_tacho/main.c @@ -59,7 +59,7 @@ int main(void) /* used in no-letter-shell mode */ ret = xTaskCreate((TaskFunction_t)TimerTachoExampleTaskEntry, /* 任务入口函数 */ (const char *)"TimerTachoExampleTaskEntry", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)TIMER_TACHO_EXAMPLE_TASK_PRIORITY, /* 任务优先级 */ NULL); /* 任务句柄 */ diff --git a/example/peripheral/timer_tacho/sdkconfig b/example/peripheral/timer_tacho/sdkconfig index d7742c33e43c810aadcf88e0fe682327c600b85e..a88d7f6bffdc58565ea88b51011a37044ded03c8 100644 --- a/example/peripheral/timer_tacho/sdkconfig +++ b/example/peripheral/timer_tacho/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_TIMER_TACHO=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/timer_tacho/sdkconfig.h b/example/peripheral/timer_tacho/sdkconfig.h index 47c1b0a05c25d854919f72740a258f44a121fdb5..c981920498a21d04243fb03adeab24df29c31c30 100644 --- a/example/peripheral/timer_tacho/sdkconfig.h +++ b/example/peripheral/timer_tacho/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -134,7 +129,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/peripheral/timer_tacho/src/timer_tacho_example.c b/example/peripheral/timer_tacho/src/timer_tacho_example.c index 76c70a9d578f6731007abbe79a4b55620033da02..6817873a96dfbd024c46a43289f8591747900eb4 100644 --- a/example/peripheral/timer_tacho/src/timer_tacho_example.c +++ b/example/peripheral/timer_tacho/src/timer_tacho_example.c @@ -405,7 +405,7 @@ BaseType_t FFreeRTOSTimerTachoCreate(void) xReturn = xTaskCreate((TaskFunction_t)TimerTachoTask, /* 任务入口函数 */ (const char *)"TimerTachoTask",/* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)NULL,/* 任务入口函数参数 */ (UBaseType_t)TIMER_TACHO_TEST_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务句柄 */ diff --git a/example/peripheral/usb/pusb2_device/Kconfig b/example/peripheral/usb/pusb2_device/Kconfig new file mode 100644 index 0000000000000000000000000000000000000000..10607d02dfd337248346ab3ec2d90e0aed77f733 --- /dev/null +++ b/example/peripheral/usb/pusb2_device/Kconfig @@ -0,0 +1,8 @@ +# +# For a description of the syntax of this configuration file, +# see tools/kconfiglib/kconfig-language.txt. +# + + +source "$(SDK_DIR)/../freertos.kconfig" + diff --git a/example/peripheral/usb/pusb2_device/README.md b/example/peripheral/usb/pusb2_device/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a77ca8935f360b2a06ae157f6a54c004b9a8bbc4 --- /dev/null +++ b/example/peripheral/usb/pusb2_device/README.md @@ -0,0 +1,152 @@ + +# PUSB2 Device 模式测试 + +## 1. 例程介绍 + +>介绍例程的用途,使用场景,相关基本概念,描述用户可以使用例程完成哪些工作
+ +E2000 和 PhytiumPI 上提供了 USB2.0 OTG 控制器,本例程通过 CherryUSB 提供了 USB2.0 Device 模式的例程,支持将开发板模拟为一个一个 U 盘供 PC 上位机读写,以及模拟成一个串口设备与 PC 上位机通信,本例程中使用的 PC 上位机是 Windows 11 PC + +使用例程前注意以下几点: +- 1)本例程不支持模式切换,需要确认开发板固件将 USB2.0 OTG 控制器置于 Host 模式还是 Device 模式,只有固件将板子默认设置为 Device 模式才能使用此例程,一般的,E2000 D/Q Demo 用 MicroUSB 接口引出,固件会默认设置为 Device 模式(可以使用例程),PhytiumPI 用 TypeA 接口引出,固件默认设置为 Host 模式(不能使用例程) + +## 2. 如何使用例程 + +>描述开发平台准备,使用例程配置,构建和下载镜像的过程
+ +### 2.1 硬件配置方法 + +>哪些硬件平台是支持的,需要哪些外设,例程与开发板哪些IO口相关等(建议附录开发板照片,展示哪些IO口被引出)
+ +本例程在 E2000 平台测试通过,您可以参考以下方法配置本例程所需要的硬件和软件环境, +- E2000 D/Q Demo 开发板 +- Windows PC +- Micro-USB 线 + +- 本例程基于 E2000 D/Q Demo 开发板完成 + +![E2000 D/Q Demo](./figs/e2000d_demo_usb2.png) + +### 2.2 SDK配置方法 + +>依赖哪些驱动、库和第三方组件,如何完成配置(列出需要使能的关键配置项)
+ +本例程需要的配置包括, +- Letter Shell组件,依赖 USE_LETTER_SHELL + +本例子已经提供好具体的编译指令,以下进行介绍: +- make 将目录下的工程进行编译 +- make clean 将目录下的工程进行清理 +- make boot 将目录下的工程进行编译,并将生成的elf 复制到目标地址 +- make load_e2000d_aarch64 将预设64bit e2000d 下的配置加载至工程中 +- make load_e2000d_aarch32 将预设32bit e2000d 下的配置加载至工程中 +- make load_e2000q_aarch64 将预设64bit e2000q 下的配置加载至工程中 +- make load_e2000q_aarch32 将预设32bit e2000q 下的配置加载至工程中 +- make menuconfig 配置目录下的参数变量 +- make backup_kconfig 将目录下的sdkconfig 备份到./configs下 + +- 具体使用方法为: + - 在当前目录下 + - 执行以上指令 + +### 2.3 构建和下载 + +>描述构建、烧录下载镜像的过程,列出相关的命令
+ +使用例程的一般过程为 + +- 选择目标平台和例程需要的配置 +``` +make load_e2000d_aarch64 +``` + +- 进行编译 +``` +make +``` + +- 将编译出的镜像放置到tftp目录下 +``` +make image +``` + +- host侧设置重启host侧tftp服务器 +``` +sudo service tftpd-hpa restart +``` + +- 开发板侧使用bootelf命令跳转 +``` +setenv ipaddr 192.168.4.20 +setenv serverip 192.168.4.30 +setenv gatewayip 192.168.4.1 +tftpboot 0x90100000 freertos.elf +bootelf -p 0x90100000 +``` + +### 2.4 输出与实验现象 + +>描述输入输出情况,列出存在哪些输出,对应的输出是什么(建议附录相关现象图片)
+ +- 首先如上图所示将开发板和 PC 通过 USB 线连接 + +#### 2.4.1 将开发板模拟成 U 盘 + +- 首先如上图所示将开发板和 PC 通过 USB 线连接 + +#### 2.4.1 将开发板模拟成 U 盘 + +- 将开发板模拟成 U 盘,U 盘的存储介质用开发板的内存实现 +- 完成开发板和 PC 的连接后,将编译好的裸机镜像加载到开发板上 +- 输入下列命令启动任务,开始模拟 U 盘 + +``` +pusb2 mass_storage +``` + +- PC 识别到开发板模拟的 U 盘后,会弹出弹出提示信息,由于 U 盘里没有文件系统,同时保存在开发板内存中的数据掉电后就会全部丢失,所以每次识别后都需要进行格式化才能使用 + +![格式化U盘](./figs/format_usb_disk.png) + +![格式化U盘](./figs/format_usb_disk2.png) + +- 之后可以在 U 盘中创建文件,同时通过设备管理器可以看到 U 盘对应的设备 `CherryUSB USB MSC DEMO` + +![U盘设备](./figs/usb_disk_device.png) + +- 识别到 U 盘后,可以尝试拷贝文件进行使用,拷贝的数据实际上存在开发板内存空间中 + +![拷贝读写](./figs/copy_file_to_usb_disk.png) + + + +#### 2.4.2 将开发板模拟成串口 + +- 输入下列命令,开始模拟串口 +``` +pusb2 virtual_serial +``` + +- PC 识别到开发板模拟的串口后,会增加一个串口设备和USB设备,然后通过 Putty 等串口工具可以发送字符,然后在开发板串口上可以观察到输入的字符 + +![串口设备](./figs/usb2_cdc.png) + +![虚拟串口](./figs/usb_virtual_serial.png) + +- 随后打开新识别到的 COM11, 输入一系列字符后会回显在控制台串口侧 + +![串口输入](./figs/input_by_serial.png) + +## 3. 如何解决问题 + +>主要记录使用例程中可能会遇到的问题,给出相应的解决方案
+ + +## 4. 修改历史记录 + +>记录例程的重大修改记录,标明修改发生的版本号
+ +- V1.1.1 首次合入 + + + diff --git a/example/peripheral/usb/pusb2_device/configs/e2000d_aarch32_demo_pusb2.config b/example/peripheral/usb/pusb2_device/configs/e2000d_aarch32_demo_pusb2.config new file mode 100644 index 0000000000000000000000000000000000000000..7ca4ca6ea04b02b0c8892e2f45437b5fdb0c9916 --- /dev/null +++ b/example/peripheral/usb/pusb2_device/configs/e2000d_aarch32_demo_pusb2.config @@ -0,0 +1,371 @@ +CONFIG_USE_FREERTOS=y + +# +# Arch configuration +# +CONFIG_TARGET_ARMv8=y +CONFIG_ARCH_NAME="armv8" + +# +# Arm architecture configuration +# +# CONFIG_ARCH_ARMV8_AARCH64 is not set +CONFIG_ARCH_ARMV8_AARCH32=y + +# +# Compiler configuration +# +CONFIG_ARM_GCC_SELECT=y +# CONFIG_ARM_CLANG_SELECT is not set +CONFIG_TOOLCHAIN_NAME="gcc" +CONFIG_TARGET_ARMV8_AARCH32=y +CONFIG_ARCH_EXECUTION_STATE="aarch32" + +# +# Fpu configuration +# +CONFIG_CRYPTO_NEON_FP_ARMV8=y +# CONFIG_VFPV4 is not set +# CONFIG_VFPV4_D16 is not set +# CONFIG_VFPV3 is not set +# CONFIG_VFPV3_D16 is not set +CONFIG_ARM_MFPU="crypto-neon-fp-armv8" +CONFIG_MFLOAT_ABI_HARD=y +# CONFIG_MFLOAT_ABI_SOFTFP is not set +CONFIG_ARM_MFLOAT_ABI="hard" +# end of Fpu configuration +# end of Compiler configuration + +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arm architecture configuration + +CONFIG_MMU_PAGE_SIZE=0x1000 +CONFIG_FMMU_NUM_L2_TABLES=256 +# end of Arch configuration + +# +# Soc configuration +# +# CONFIG_TARGET_PHYTIUMPI is not set +# CONFIG_TARGET_E2000Q is not set +CONFIG_TARGET_E2000D=y +# CONFIG_TARGET_E2000S is not set +# CONFIG_TARGET_FT2004 is not set +# CONFIG_TARGET_D2000 is not set +# CONFIG_TARGET_PD2308 is not set +CONFIG_SOC_NAME="e2000" +CONFIG_TARGET_TYPE_NAME="d" +CONFIG_SOC_CORE_NUM=2 +CONFIG_F32BIT_MEMORY_ADDRESS=0x80000000 +CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 +CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 +CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 +CONFIG_TARGET_E2000=y +CONFIG_DEFAULT_DEBUG_PRINT_UART1=y +# CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set +# CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set +# end of Soc configuration + +# +# Board Configuration +# +CONFIG_E2000D_DEMO_BOARD=y +CONFIG_BOARD_NAME="demo" + +# +# IO mux configuration when board start up +# +# CONFIG_USE_SPI_IOPAD is not set +# CONFIG_USE_GPIO_IOPAD is not set +# CONFIG_USE_CAN_IOPAD is not set +# CONFIG_USE_QSPI_IOPAD is not set +# CONFIG_USE_PWM_IOPAD is not set +# CONFIG_USE_ADC_IOPAD is not set +# CONFIG_USE_MIO_IOPAD is not set +# CONFIG_USE_TACHO_IOPAD is not set +# CONFIG_USE_UART_IOPAD is not set +# CONFIG_USE_THIRD_PARTY_IOPAD is not set +# end of IO mux configuration when board start up + +# CONFIG_CUS_DEMO_BOARD is not set + +# +# Build project name +# +CONFIG_TARGET_NAME="pusb2" +# end of Build project name +# end of Board Configuration + +# +# Sdk common configuration +# +CONFIG_ELOG_LINE_BUF_SIZE=0x100 +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +# CONFIG_LOG_INFO is not set +# CONFIG_LOG_WARN is not set +CONFIG_LOG_ERROR=y +# CONFIG_LOG_NONE is not set +CONFIG_LOG_EXTRA_INFO=y +# CONFIG_LOG_DISPALY_CORE_NUM is not set +# CONFIG_BOOTUP_DEBUG_PRINTS is not set +CONFIG_USE_DEFAULT_INTERRUPT_CONFIG=y +CONFIG_INTERRUPT_ROLE_MASTER=y +# CONFIG_INTERRUPT_ROLE_SLAVE is not set +# end of Sdk common configuration + +# +# Drivers configuration +# +CONFIG_USE_IOMUX=y +# CONFIG_ENABLE_IOCTRL is not set +CONFIG_ENABLE_IOPAD=y +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_ETH is not set +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_MIO is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# CONFIG_USE_SATA is not set +# CONFIG_USE_ADC is not set +# CONFIG_USE_PWM is not set +# CONFIG_USE_IPC is not set +# CONFIG_USE_MEDIA is not set +# CONFIG_USE_SCMI_MHU is not set +# CONFIG_USE_I2S is not set +# CONFIG_USE_I3C is not set +# end of Drivers configuration + +# +# Build setup +# +CONFIG_CHECK_DEPS=y +CONFIG_OUTPUT_BINARY=y + +# +# Optimization options +# +CONFIG_DEBUG_NOOPT=y +# CONFIG_DEBUG_CUSTOMOPT is not set +# CONFIG_DEBUG_FULLOPT is not set +CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y +CONFIG_DEBUG_LINK_MAP=y +# CONFIG_CCACHE is not set +# CONFIG_ARCH_COVERAGE is not set +# CONFIG_LTO_FULL is not set +# end of Optimization options + +# +# Debug options +# +# CONFIG_DEBUG_ENABLE_ALL_WARNING is not set +# CONFIG_WALL_WARNING_ERROR is not set +# CONFIG_STRICT_PROTOTYPES is not set +# CONFIG_DEBUG_SYMBOLS is not set +# CONFIG_FRAME_POINTER is not set +# CONFIG_OUTPUT_ASM_DIS is not set +# CONFIG_ENABLE_WSHADOW is not set +# CONFIG_ENABLE_WUNDEF is not set +CONFIG_DOWNGRADE_DIAG_WARNING=y +# end of Debug options + +# +# Lib +# +CONFIG_USE_COMPILE_CHAIN=y +# CONFIG_USE_NEWLIB is not set +# CONFIG_USE_USER_DEFINED is not set +# end of Lib + +# CONFIG_ENABLE_CXX is not set + +# +# Linker Options +# +CONFIG_DEFAULT_LINKER_SCRIPT=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_IMAGE_LOAD_ADDRESS=0x80100000 +CONFIG_IMAGE_MAX_LENGTH=0x5000000 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Build setup + +# +# Component Configuration +# + +# +# Freertos Uart Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Uart Drivers + +# +# Freertos Pwm Drivers +# +# CONFIG_FREERTOS_USE_PWM is not set +# end of Freertos Pwm Drivers + +# +# Freertos Qspi Drivers +# +# CONFIG_FREERTOS_USE_QSPI is not set +# end of Freertos Qspi Drivers + +# +# Freertos Wdt Drivers +# +# CONFIG_FREERTOS_USE_WDT is not set +# end of Freertos Wdt Drivers + +# +# Freertos Eth Drivers +# +# CONFIG_FREERTOS_USE_XMAC is not set +# CONFIG_FREERTOS_USE_GMAC is not set +# end of Freertos Eth Drivers + +# +# Freertos Spim Drivers +# +# CONFIG_FREERTOS_USE_FSPIM is not set +# end of Freertos Spim Drivers + +# +# Freertos DMA Drivers +# +# CONFIG_FREERTOS_USE_FDDMA is not set +# CONFIG_FREERTOS_USE_FGDMA is not set +# end of Freertos DMA Drivers + +# +# Freertos Adc Drivers +# +# CONFIG_FREERTOS_USE_ADC is not set +# end of Freertos Adc Drivers + +# +# Freertos Can Drivers +# +# CONFIG_FREERTOS_USE_CAN is not set +# end of Freertos Can Drivers + +# +# Freertos I2c Drivers +# +# CONFIG_FREERTOS_USE_I2C is not set +# end of Freertos I2c Drivers + +# +# Freertos Mio Drivers +# +# CONFIG_FREERTOS_USE_MIO is not set +# end of Freertos Mio Drivers + +# +# Freertos Timer Drivers +# +# CONFIG_FREERTOS_USE_TIMER is not set +# end of Freertos Timer Drivers + +# +# Freertos Media Drivers +# +# CONFIG_FREERTOS_USE_MEDIA is not set +# end of Freertos Media Drivers + +# +# Freertos I2s Drivers +# +# CONFIG_FREERTOS_USE_I2S is not set +# end of Freertos I2s Drivers +# end of Component Configuration + +# +# Third-party configuration +# +# CONFIG_USE_LWIP is not set +CONFIG_USE_LETTER_SHELL=y + +# +# Letter Shell Configuration +# +CONFIG_LS_PL011_UART=y +CONFIG_DEFAULT_LETTER_SHELL_USE_UART1=y +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set +# end of Letter Shell Configuration + +# CONFIG_USE_AMP is not set +# CONFIG_USE_YMODEM is not set +# CONFIG_USE_SFUD is not set +CONFIG_USE_BACKTRACE=y +# CONFIG_USE_FATFS_0_1_4 is not set +CONFIG_USE_TLSF=y +# CONFIG_USE_SPIFFS is not set +# CONFIG_USE_LITTLE_FS is not set +# CONFIG_USE_LVGL is not set +# CONFIG_USE_FREEMODBUS is not set +CONFIG_USE_CHERRY_USB=y + +# +# CherryUSB Configuration +# +# CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +CONFIG_CHERRY_USB_PORT_PUSB2=y +# CONFIG_CHERRYUSB_HOST is not set +CONFIG_CHERRYUSB_DEVICE=y +CONFIG_CHERRY_USB_DEVICE_MSC=y +CONFIG_CHERRY_USB_DEVICE_CDC=y +# end of CherryUSB Configuration + +# CONFIG_USE_FSL_SDMMC is not set +# CONFIG_USE_FSL_WIFI is not set +# end of Third-party configuration + +# +# FreeRTOS Kernel Configuration +# +CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_MAX_PRIORITIES=32 +CONFIG_FREERTOS_KERNEL_INTERRUPT_PRIORITIES=13 +CONFIG_FREERTOS_MAX_API_CALL_INTERRUPT_PRIORITIES=11 +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +CONFIG_FREERTOS_MINIMAL_TASK_STACKSIZE=1024 +CONFIG_FREERTOS_MAX_TASK_NAME_LEN=32 +CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y +# CONFIG_FREERTOS_USE_TICKLESS_IDLE is not set +CONFIG_FREERTOS_TOTAL_HEAP_SIZE=10240 +CONFIG_FREERTOS_TASK_FPU_SUPPORT=1 +# CONFIG_FREERTOS_USE_POSIX is not set +# end of FreeRTOS Kernel Configuration diff --git a/example/peripheral/usb/pusb2_device/configs/e2000d_aarch64_demo_pusb2.config b/example/peripheral/usb/pusb2_device/configs/e2000d_aarch64_demo_pusb2.config new file mode 100644 index 0000000000000000000000000000000000000000..ba34e3318f81e17b0dfa5c2148b72bb86221600e --- /dev/null +++ b/example/peripheral/usb/pusb2_device/configs/e2000d_aarch64_demo_pusb2.config @@ -0,0 +1,360 @@ +CONFIG_USE_FREERTOS=y + +# +# Arch configuration +# +CONFIG_TARGET_ARMv8=y +CONFIG_ARCH_NAME="armv8" + +# +# Arm architecture configuration +# +CONFIG_ARCH_ARMV8_AARCH64=y +# CONFIG_ARCH_ARMV8_AARCH32 is not set + +# +# Compiler configuration +# +CONFIG_ARM_GCC_SELECT=y +# CONFIG_ARM_CLANG_SELECT is not set +CONFIG_TOOLCHAIN_NAME="gcc" +CONFIG_TARGET_ARMV8_AARCH64=y +CONFIG_ARCH_EXECUTION_STATE="aarch64" +CONFIG_ARM_NEON=y +CONFIG_ARM_CRC=y +CONFIG_ARM_CRYPTO=y +CONFIG_ARM_FLOAT_POINT=y +# CONFIG_GCC_CODE_MODEL_TINY is not set +CONFIG_GCC_CODE_MODEL_SMALL=y +# CONFIG_GCC_CODE_MODEL_LARGE is not set +# end of Compiler configuration + +CONFIG_BOOT_WITH_FLUSH_CACHE=y +# CONFIG_MMU_DEBUG_PRINTS is not set +# end of Arm architecture configuration + +CONFIG_MMU_PAGE_SIZE=0x1000 +CONFIG_MAX_XLAT_TABLES=256 +# end of Arch configuration + +# +# Soc configuration +# +# CONFIG_TARGET_PHYTIUMPI is not set +# CONFIG_TARGET_E2000Q is not set +CONFIG_TARGET_E2000D=y +# CONFIG_TARGET_E2000S is not set +# CONFIG_TARGET_FT2004 is not set +# CONFIG_TARGET_D2000 is not set +# CONFIG_TARGET_PD2308 is not set +CONFIG_SOC_NAME="e2000" +CONFIG_TARGET_TYPE_NAME="d" +CONFIG_SOC_CORE_NUM=2 +CONFIG_F32BIT_MEMORY_ADDRESS=0x80000000 +CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 +CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 +CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 +CONFIG_TARGET_E2000=y +CONFIG_DEFAULT_DEBUG_PRINT_UART1=y +# CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set +# CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set +# end of Soc configuration + +# +# Board Configuration +# +CONFIG_E2000D_DEMO_BOARD=y +CONFIG_BOARD_NAME="demo" + +# +# IO mux configuration when board start up +# +# CONFIG_USE_SPI_IOPAD is not set +# CONFIG_USE_GPIO_IOPAD is not set +# CONFIG_USE_CAN_IOPAD is not set +# CONFIG_USE_QSPI_IOPAD is not set +# CONFIG_USE_PWM_IOPAD is not set +# CONFIG_USE_ADC_IOPAD is not set +# CONFIG_USE_MIO_IOPAD is not set +# CONFIG_USE_TACHO_IOPAD is not set +# CONFIG_USE_UART_IOPAD is not set +# CONFIG_USE_THIRD_PARTY_IOPAD is not set +# end of IO mux configuration when board start up + +# CONFIG_CUS_DEMO_BOARD is not set + +# +# Build project name +# +CONFIG_TARGET_NAME="pusb2" +# end of Build project name +# end of Board Configuration + +# +# Sdk common configuration +# +CONFIG_ELOG_LINE_BUF_SIZE=0x100 +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +# CONFIG_LOG_INFO is not set +# CONFIG_LOG_WARN is not set +CONFIG_LOG_ERROR=y +# CONFIG_LOG_NONE is not set +CONFIG_LOG_EXTRA_INFO=y +# CONFIG_LOG_DISPALY_CORE_NUM is not set +# CONFIG_BOOTUP_DEBUG_PRINTS is not set +CONFIG_USE_DEFAULT_INTERRUPT_CONFIG=y +CONFIG_INTERRUPT_ROLE_MASTER=y +# CONFIG_INTERRUPT_ROLE_SLAVE is not set +# end of Sdk common configuration + +# +# Drivers configuration +# +CONFIG_USE_IOMUX=y +# CONFIG_ENABLE_IOCTRL is not set +CONFIG_ENABLE_IOPAD=y +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_ETH is not set +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_MIO is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# CONFIG_USE_SATA is not set +# CONFIG_USE_ADC is not set +# CONFIG_USE_PWM is not set +# CONFIG_USE_IPC is not set +# CONFIG_USE_MEDIA is not set +# CONFIG_USE_SCMI_MHU is not set +# CONFIG_USE_I2S is not set +# CONFIG_USE_I3C is not set +# end of Drivers configuration + +# +# Build setup +# +CONFIG_CHECK_DEPS=y +CONFIG_OUTPUT_BINARY=y + +# +# Optimization options +# +CONFIG_DEBUG_NOOPT=y +# CONFIG_DEBUG_CUSTOMOPT is not set +# CONFIG_DEBUG_FULLOPT is not set +CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y +CONFIG_DEBUG_LINK_MAP=y +# CONFIG_CCACHE is not set +# CONFIG_ARCH_COVERAGE is not set +# CONFIG_LTO_FULL is not set +# end of Optimization options + +# +# Debug options +# +# CONFIG_DEBUG_ENABLE_ALL_WARNING is not set +# CONFIG_WALL_WARNING_ERROR is not set +# CONFIG_STRICT_PROTOTYPES is not set +# CONFIG_DEBUG_SYMBOLS is not set +# CONFIG_FRAME_POINTER is not set +# CONFIG_OUTPUT_ASM_DIS is not set +# CONFIG_ENABLE_WSHADOW is not set +# CONFIG_ENABLE_WUNDEF is not set +CONFIG_DOWNGRADE_DIAG_WARNING=y +# end of Debug options + +# +# Lib +# +CONFIG_USE_COMPILE_CHAIN=y +# CONFIG_USE_NEWLIB is not set +# CONFIG_USE_USER_DEFINED is not set +# end of Lib + +# CONFIG_ENABLE_CXX is not set + +# +# Linker Options +# +CONFIG_DEFAULT_LINKER_SCRIPT=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_IMAGE_LOAD_ADDRESS=0x80100000 +CONFIG_IMAGE_MAX_LENGTH=0x5000000 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Build setup + +# +# Component Configuration +# + +# +# Freertos Uart Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Uart Drivers + +# +# Freertos Pwm Drivers +# +# CONFIG_FREERTOS_USE_PWM is not set +# end of Freertos Pwm Drivers + +# +# Freertos Qspi Drivers +# +# CONFIG_FREERTOS_USE_QSPI is not set +# end of Freertos Qspi Drivers + +# +# Freertos Wdt Drivers +# +# CONFIG_FREERTOS_USE_WDT is not set +# end of Freertos Wdt Drivers + +# +# Freertos Eth Drivers +# +# CONFIG_FREERTOS_USE_XMAC is not set +# CONFIG_FREERTOS_USE_GMAC is not set +# end of Freertos Eth Drivers + +# +# Freertos Spim Drivers +# +# CONFIG_FREERTOS_USE_FSPIM is not set +# end of Freertos Spim Drivers + +# +# Freertos DMA Drivers +# +# CONFIG_FREERTOS_USE_FDDMA is not set +# CONFIG_FREERTOS_USE_FGDMA is not set +# end of Freertos DMA Drivers + +# +# Freertos Adc Drivers +# +# CONFIG_FREERTOS_USE_ADC is not set +# end of Freertos Adc Drivers + +# +# Freertos Can Drivers +# +# CONFIG_FREERTOS_USE_CAN is not set +# end of Freertos Can Drivers + +# +# Freertos I2c Drivers +# +# CONFIG_FREERTOS_USE_I2C is not set +# end of Freertos I2c Drivers + +# +# Freertos Mio Drivers +# +# CONFIG_FREERTOS_USE_MIO is not set +# end of Freertos Mio Drivers + +# +# Freertos Timer Drivers +# +# CONFIG_FREERTOS_USE_TIMER is not set +# end of Freertos Timer Drivers + +# +# Freertos Media Drivers +# +# CONFIG_FREERTOS_USE_MEDIA is not set +# end of Freertos Media Drivers + +# +# Freertos I2s Drivers +# +# CONFIG_FREERTOS_USE_I2S is not set +# end of Freertos I2s Drivers +# end of Component Configuration + +# +# Third-party configuration +# +# CONFIG_USE_LWIP is not set +CONFIG_USE_LETTER_SHELL=y + +# +# Letter Shell Configuration +# +CONFIG_LS_PL011_UART=y +CONFIG_DEFAULT_LETTER_SHELL_USE_UART1=y +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set +# end of Letter Shell Configuration + +# CONFIG_USE_AMP is not set +# CONFIG_USE_YMODEM is not set +# CONFIG_USE_SFUD is not set +CONFIG_USE_BACKTRACE=y +# CONFIG_USE_FATFS_0_1_4 is not set +CONFIG_USE_TLSF=y +# CONFIG_USE_SPIFFS is not set +# CONFIG_USE_LITTLE_FS is not set +# CONFIG_USE_LVGL is not set +# CONFIG_USE_FREEMODBUS is not set +CONFIG_USE_CHERRY_USB=y + +# +# CherryUSB Configuration +# +# CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +CONFIG_CHERRY_USB_PORT_PUSB2=y +# CONFIG_CHERRYUSB_HOST is not set +CONFIG_CHERRYUSB_DEVICE=y +CONFIG_CHERRY_USB_DEVICE_MSC=y +CONFIG_CHERRY_USB_DEVICE_CDC=y +# end of CherryUSB Configuration + +# CONFIG_USE_FSL_SDMMC is not set +# CONFIG_USE_FSL_WIFI is not set +# end of Third-party configuration + +# +# FreeRTOS Kernel Configuration +# +CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_MAX_PRIORITIES=32 +CONFIG_FREERTOS_KERNEL_INTERRUPT_PRIORITIES=13 +CONFIG_FREERTOS_MAX_API_CALL_INTERRUPT_PRIORITIES=11 +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +CONFIG_FREERTOS_MINIMAL_TASK_STACKSIZE=1024 +CONFIG_FREERTOS_MAX_TASK_NAME_LEN=32 +CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y +# CONFIG_FREERTOS_USE_TICKLESS_IDLE is not set +CONFIG_FREERTOS_TOTAL_HEAP_SIZE=10240 +CONFIG_FREERTOS_TASK_FPU_SUPPORT=1 +# CONFIG_FREERTOS_USE_POSIX is not set +# end of FreeRTOS Kernel Configuration diff --git a/example/peripheral/usb/pusb2_device/configs/e2000q_aarch32_demo_pusb2.config b/example/peripheral/usb/pusb2_device/configs/e2000q_aarch32_demo_pusb2.config new file mode 100644 index 0000000000000000000000000000000000000000..23357541f11a52f8f822060bdfe56681cb919599 --- /dev/null +++ b/example/peripheral/usb/pusb2_device/configs/e2000q_aarch32_demo_pusb2.config @@ -0,0 +1,370 @@ +CONFIG_USE_FREERTOS=y + +# +# Arch configuration +# +CONFIG_TARGET_ARMv8=y +CONFIG_ARCH_NAME="armv8" + +# +# Arm architecture configuration +# +# CONFIG_ARCH_ARMV8_AARCH64 is not set +CONFIG_ARCH_ARMV8_AARCH32=y + +# +# Compiler configuration +# +CONFIG_ARM_GCC_SELECT=y +# CONFIG_ARM_CLANG_SELECT is not set +CONFIG_TOOLCHAIN_NAME="gcc" +CONFIG_TARGET_ARMV8_AARCH32=y +CONFIG_ARCH_EXECUTION_STATE="aarch32" + +# +# Fpu configuration +# +CONFIG_CRYPTO_NEON_FP_ARMV8=y +# CONFIG_VFPV4 is not set +# CONFIG_VFPV4_D16 is not set +# CONFIG_VFPV3 is not set +# CONFIG_VFPV3_D16 is not set +CONFIG_ARM_MFPU="crypto-neon-fp-armv8" +CONFIG_MFLOAT_ABI_HARD=y +# CONFIG_MFLOAT_ABI_SOFTFP is not set +CONFIG_ARM_MFLOAT_ABI="hard" +# end of Fpu configuration +# end of Compiler configuration + +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arm architecture configuration + +CONFIG_MMU_PAGE_SIZE=0x1000 +CONFIG_FMMU_NUM_L2_TABLES=256 +# end of Arch configuration + +# +# Soc configuration +# +# CONFIG_TARGET_PHYTIUMPI is not set +CONFIG_TARGET_E2000Q=y +# CONFIG_TARGET_E2000D is not set +# CONFIG_TARGET_E2000S is not set +# CONFIG_TARGET_FT2004 is not set +# CONFIG_TARGET_D2000 is not set +# CONFIG_TARGET_PD2308 is not set +CONFIG_SOC_NAME="e2000" +CONFIG_TARGET_TYPE_NAME="q" +CONFIG_SOC_CORE_NUM=4 +CONFIG_F32BIT_MEMORY_ADDRESS=0x80000000 +CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 +CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 +CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 +CONFIG_TARGET_E2000=y +CONFIG_DEFAULT_DEBUG_PRINT_UART1=y +# CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set +# CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set +# end of Soc configuration + +# +# Board Configuration +# +CONFIG_BOARD_NAME="demo" +# CONFIG_USE_SPI_IOPAD is not set +# CONFIG_USE_GPIO_IOPAD is not set +# CONFIG_USE_CAN_IOPAD is not set +# CONFIG_USE_QSPI_IOPAD is not set +# CONFIG_USE_PWM_IOPAD is not set +# CONFIG_USE_MIO_IOPAD is not set +# CONFIG_USE_TACHO_IOPAD is not set +# CONFIG_USE_UART_IOPAD is not set +# CONFIG_USE_THIRD_PARTY_IOPAD is not set +CONFIG_E2000Q_DEMO_BOARD=y + +# +# IO mux configuration when board start up +# +# end of IO mux configuration when board start up + +# CONFIG_CUS_DEMO_BOARD is not set + +# +# Build project name +# +CONFIG_TARGET_NAME="pusb2" +# end of Build project name +# end of Board Configuration + +# +# Sdk common configuration +# +CONFIG_ELOG_LINE_BUF_SIZE=0x100 +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +# CONFIG_LOG_INFO is not set +# CONFIG_LOG_WARN is not set +CONFIG_LOG_ERROR=y +# CONFIG_LOG_NONE is not set +CONFIG_LOG_EXTRA_INFO=y +# CONFIG_LOG_DISPALY_CORE_NUM is not set +# CONFIG_BOOTUP_DEBUG_PRINTS is not set +CONFIG_USE_DEFAULT_INTERRUPT_CONFIG=y +CONFIG_INTERRUPT_ROLE_MASTER=y +# CONFIG_INTERRUPT_ROLE_SLAVE is not set +# end of Sdk common configuration + +# +# Drivers configuration +# +CONFIG_USE_IOMUX=y +# CONFIG_ENABLE_IOCTRL is not set +CONFIG_ENABLE_IOPAD=y +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_ETH is not set +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_MIO is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# CONFIG_USE_SATA is not set +# CONFIG_USE_ADC is not set +# CONFIG_USE_PWM is not set +# CONFIG_USE_IPC is not set +# CONFIG_USE_MEDIA is not set +# CONFIG_USE_SCMI_MHU is not set +# CONFIG_USE_I2S is not set +# CONFIG_USE_I3C is not set +# end of Drivers configuration + +# +# Build setup +# +CONFIG_CHECK_DEPS=y +CONFIG_OUTPUT_BINARY=y + +# +# Optimization options +# +CONFIG_DEBUG_NOOPT=y +# CONFIG_DEBUG_CUSTOMOPT is not set +# CONFIG_DEBUG_FULLOPT is not set +CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y +CONFIG_DEBUG_LINK_MAP=y +# CONFIG_CCACHE is not set +# CONFIG_ARCH_COVERAGE is not set +# CONFIG_LTO_FULL is not set +# end of Optimization options + +# +# Debug options +# +# CONFIG_DEBUG_ENABLE_ALL_WARNING is not set +# CONFIG_WALL_WARNING_ERROR is not set +# CONFIG_STRICT_PROTOTYPES is not set +# CONFIG_DEBUG_SYMBOLS is not set +# CONFIG_FRAME_POINTER is not set +# CONFIG_OUTPUT_ASM_DIS is not set +# CONFIG_ENABLE_WSHADOW is not set +# CONFIG_ENABLE_WUNDEF is not set +CONFIG_DOWNGRADE_DIAG_WARNING=y +# end of Debug options + +# +# Lib +# +CONFIG_USE_COMPILE_CHAIN=y +# CONFIG_USE_NEWLIB is not set +# CONFIG_USE_USER_DEFINED is not set +# end of Lib + +# CONFIG_ENABLE_CXX is not set + +# +# Linker Options +# +CONFIG_DEFAULT_LINKER_SCRIPT=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_IMAGE_LOAD_ADDRESS=0x80100000 +CONFIG_IMAGE_MAX_LENGTH=0x5000000 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Build setup + +# +# Component Configuration +# + +# +# Freertos Uart Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Uart Drivers + +# +# Freertos Pwm Drivers +# +# CONFIG_FREERTOS_USE_PWM is not set +# end of Freertos Pwm Drivers + +# +# Freertos Qspi Drivers +# +# CONFIG_FREERTOS_USE_QSPI is not set +# end of Freertos Qspi Drivers + +# +# Freertos Wdt Drivers +# +# CONFIG_FREERTOS_USE_WDT is not set +# end of Freertos Wdt Drivers + +# +# Freertos Eth Drivers +# +# CONFIG_FREERTOS_USE_XMAC is not set +# CONFIG_FREERTOS_USE_GMAC is not set +# end of Freertos Eth Drivers + +# +# Freertos Spim Drivers +# +# CONFIG_FREERTOS_USE_FSPIM is not set +# end of Freertos Spim Drivers + +# +# Freertos DMA Drivers +# +# CONFIG_FREERTOS_USE_FDDMA is not set +# CONFIG_FREERTOS_USE_FGDMA is not set +# end of Freertos DMA Drivers + +# +# Freertos Adc Drivers +# +# CONFIG_FREERTOS_USE_ADC is not set +# end of Freertos Adc Drivers + +# +# Freertos Can Drivers +# +# CONFIG_FREERTOS_USE_CAN is not set +# end of Freertos Can Drivers + +# +# Freertos I2c Drivers +# +# CONFIG_FREERTOS_USE_I2C is not set +# end of Freertos I2c Drivers + +# +# Freertos Mio Drivers +# +# CONFIG_FREERTOS_USE_MIO is not set +# end of Freertos Mio Drivers + +# +# Freertos Timer Drivers +# +# CONFIG_FREERTOS_USE_TIMER is not set +# end of Freertos Timer Drivers + +# +# Freertos Media Drivers +# +# CONFIG_FREERTOS_USE_MEDIA is not set +# end of Freertos Media Drivers + +# +# Freertos I2s Drivers +# +# CONFIG_FREERTOS_USE_I2S is not set +# end of Freertos I2s Drivers +# end of Component Configuration + +# +# Third-party configuration +# +# CONFIG_USE_LWIP is not set +CONFIG_USE_LETTER_SHELL=y + +# +# Letter Shell Configuration +# +CONFIG_LS_PL011_UART=y +CONFIG_DEFAULT_LETTER_SHELL_USE_UART1=y +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set +# end of Letter Shell Configuration + +# CONFIG_USE_AMP is not set +# CONFIG_USE_YMODEM is not set +# CONFIG_USE_SFUD is not set +CONFIG_USE_BACKTRACE=y +# CONFIG_USE_FATFS_0_1_4 is not set +CONFIG_USE_TLSF=y +# CONFIG_USE_SPIFFS is not set +# CONFIG_USE_LITTLE_FS is not set +# CONFIG_USE_LVGL is not set +# CONFIG_USE_FREEMODBUS is not set +CONFIG_USE_CHERRY_USB=y + +# +# CherryUSB Configuration +# +# CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +CONFIG_CHERRY_USB_PORT_PUSB2=y +# CONFIG_CHERRYUSB_HOST is not set +CONFIG_CHERRYUSB_DEVICE=y +CONFIG_CHERRY_USB_DEVICE_MSC=y +CONFIG_CHERRY_USB_DEVICE_CDC=y +# end of CherryUSB Configuration + +# CONFIG_USE_FSL_SDMMC is not set +# CONFIG_USE_FSL_WIFI is not set +# end of Third-party configuration + +# +# FreeRTOS Kernel Configuration +# +CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_MAX_PRIORITIES=32 +CONFIG_FREERTOS_KERNEL_INTERRUPT_PRIORITIES=13 +CONFIG_FREERTOS_MAX_API_CALL_INTERRUPT_PRIORITIES=11 +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +CONFIG_FREERTOS_MINIMAL_TASK_STACKSIZE=1024 +CONFIG_FREERTOS_MAX_TASK_NAME_LEN=32 +CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y +# CONFIG_FREERTOS_USE_TICKLESS_IDLE is not set +CONFIG_FREERTOS_TOTAL_HEAP_SIZE=10240 +CONFIG_FREERTOS_TASK_FPU_SUPPORT=1 +# CONFIG_FREERTOS_USE_POSIX is not set +# end of FreeRTOS Kernel Configuration diff --git a/example/peripheral/usb/pusb2_device/configs/e2000q_aarch64_demo_pusb2.config b/example/peripheral/usb/pusb2_device/configs/e2000q_aarch64_demo_pusb2.config new file mode 100644 index 0000000000000000000000000000000000000000..f5edb30e906a8c987eeaa054f5d74992d9d99e9c --- /dev/null +++ b/example/peripheral/usb/pusb2_device/configs/e2000q_aarch64_demo_pusb2.config @@ -0,0 +1,359 @@ +CONFIG_USE_FREERTOS=y + +# +# Arch configuration +# +CONFIG_TARGET_ARMv8=y +CONFIG_ARCH_NAME="armv8" + +# +# Arm architecture configuration +# +CONFIG_ARCH_ARMV8_AARCH64=y +# CONFIG_ARCH_ARMV8_AARCH32 is not set + +# +# Compiler configuration +# +CONFIG_ARM_GCC_SELECT=y +# CONFIG_ARM_CLANG_SELECT is not set +CONFIG_TOOLCHAIN_NAME="gcc" +CONFIG_TARGET_ARMV8_AARCH64=y +CONFIG_ARCH_EXECUTION_STATE="aarch64" +CONFIG_ARM_NEON=y +CONFIG_ARM_CRC=y +CONFIG_ARM_CRYPTO=y +CONFIG_ARM_FLOAT_POINT=y +# CONFIG_GCC_CODE_MODEL_TINY is not set +CONFIG_GCC_CODE_MODEL_SMALL=y +# CONFIG_GCC_CODE_MODEL_LARGE is not set +# end of Compiler configuration + +CONFIG_BOOT_WITH_FLUSH_CACHE=y +# CONFIG_MMU_DEBUG_PRINTS is not set +# end of Arm architecture configuration + +CONFIG_MMU_PAGE_SIZE=0x1000 +CONFIG_MAX_XLAT_TABLES=256 +# end of Arch configuration + +# +# Soc configuration +# +# CONFIG_TARGET_PHYTIUMPI is not set +CONFIG_TARGET_E2000Q=y +# CONFIG_TARGET_E2000D is not set +# CONFIG_TARGET_E2000S is not set +# CONFIG_TARGET_FT2004 is not set +# CONFIG_TARGET_D2000 is not set +# CONFIG_TARGET_PD2308 is not set +CONFIG_SOC_NAME="e2000" +CONFIG_TARGET_TYPE_NAME="q" +CONFIG_SOC_CORE_NUM=4 +CONFIG_F32BIT_MEMORY_ADDRESS=0x80000000 +CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 +CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 +CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 +CONFIG_TARGET_E2000=y +CONFIG_DEFAULT_DEBUG_PRINT_UART1=y +# CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set +# CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set +# end of Soc configuration + +# +# Board Configuration +# +CONFIG_BOARD_NAME="demo" +# CONFIG_USE_SPI_IOPAD is not set +# CONFIG_USE_GPIO_IOPAD is not set +# CONFIG_USE_CAN_IOPAD is not set +# CONFIG_USE_QSPI_IOPAD is not set +# CONFIG_USE_PWM_IOPAD is not set +# CONFIG_USE_MIO_IOPAD is not set +# CONFIG_USE_TACHO_IOPAD is not set +# CONFIG_USE_UART_IOPAD is not set +# CONFIG_USE_THIRD_PARTY_IOPAD is not set +CONFIG_E2000Q_DEMO_BOARD=y + +# +# IO mux configuration when board start up +# +# end of IO mux configuration when board start up + +# CONFIG_CUS_DEMO_BOARD is not set + +# +# Build project name +# +CONFIG_TARGET_NAME="pusb2" +# end of Build project name +# end of Board Configuration + +# +# Sdk common configuration +# +CONFIG_ELOG_LINE_BUF_SIZE=0x100 +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +# CONFIG_LOG_INFO is not set +# CONFIG_LOG_WARN is not set +CONFIG_LOG_ERROR=y +# CONFIG_LOG_NONE is not set +CONFIG_LOG_EXTRA_INFO=y +# CONFIG_LOG_DISPALY_CORE_NUM is not set +# CONFIG_BOOTUP_DEBUG_PRINTS is not set +CONFIG_USE_DEFAULT_INTERRUPT_CONFIG=y +CONFIG_INTERRUPT_ROLE_MASTER=y +# CONFIG_INTERRUPT_ROLE_SLAVE is not set +# end of Sdk common configuration + +# +# Drivers configuration +# +CONFIG_USE_IOMUX=y +# CONFIG_ENABLE_IOCTRL is not set +CONFIG_ENABLE_IOPAD=y +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_ETH is not set +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_MIO is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# CONFIG_USE_SATA is not set +# CONFIG_USE_ADC is not set +# CONFIG_USE_PWM is not set +# CONFIG_USE_IPC is not set +# CONFIG_USE_MEDIA is not set +# CONFIG_USE_SCMI_MHU is not set +# CONFIG_USE_I2S is not set +# CONFIG_USE_I3C is not set +# end of Drivers configuration + +# +# Build setup +# +CONFIG_CHECK_DEPS=y +CONFIG_OUTPUT_BINARY=y + +# +# Optimization options +# +CONFIG_DEBUG_NOOPT=y +# CONFIG_DEBUG_CUSTOMOPT is not set +# CONFIG_DEBUG_FULLOPT is not set +CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y +CONFIG_DEBUG_LINK_MAP=y +# CONFIG_CCACHE is not set +# CONFIG_ARCH_COVERAGE is not set +# CONFIG_LTO_FULL is not set +# end of Optimization options + +# +# Debug options +# +# CONFIG_DEBUG_ENABLE_ALL_WARNING is not set +# CONFIG_WALL_WARNING_ERROR is not set +# CONFIG_STRICT_PROTOTYPES is not set +# CONFIG_DEBUG_SYMBOLS is not set +# CONFIG_FRAME_POINTER is not set +# CONFIG_OUTPUT_ASM_DIS is not set +# CONFIG_ENABLE_WSHADOW is not set +# CONFIG_ENABLE_WUNDEF is not set +CONFIG_DOWNGRADE_DIAG_WARNING=y +# end of Debug options + +# +# Lib +# +CONFIG_USE_COMPILE_CHAIN=y +# CONFIG_USE_NEWLIB is not set +# CONFIG_USE_USER_DEFINED is not set +# end of Lib + +# CONFIG_ENABLE_CXX is not set + +# +# Linker Options +# +CONFIG_DEFAULT_LINKER_SCRIPT=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_IMAGE_LOAD_ADDRESS=0x80100000 +CONFIG_IMAGE_MAX_LENGTH=0x5000000 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Build setup + +# +# Component Configuration +# + +# +# Freertos Uart Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Uart Drivers + +# +# Freertos Pwm Drivers +# +# CONFIG_FREERTOS_USE_PWM is not set +# end of Freertos Pwm Drivers + +# +# Freertos Qspi Drivers +# +# CONFIG_FREERTOS_USE_QSPI is not set +# end of Freertos Qspi Drivers + +# +# Freertos Wdt Drivers +# +# CONFIG_FREERTOS_USE_WDT is not set +# end of Freertos Wdt Drivers + +# +# Freertos Eth Drivers +# +# CONFIG_FREERTOS_USE_XMAC is not set +# CONFIG_FREERTOS_USE_GMAC is not set +# end of Freertos Eth Drivers + +# +# Freertos Spim Drivers +# +# CONFIG_FREERTOS_USE_FSPIM is not set +# end of Freertos Spim Drivers + +# +# Freertos DMA Drivers +# +# CONFIG_FREERTOS_USE_FDDMA is not set +# CONFIG_FREERTOS_USE_FGDMA is not set +# end of Freertos DMA Drivers + +# +# Freertos Adc Drivers +# +# CONFIG_FREERTOS_USE_ADC is not set +# end of Freertos Adc Drivers + +# +# Freertos Can Drivers +# +# CONFIG_FREERTOS_USE_CAN is not set +# end of Freertos Can Drivers + +# +# Freertos I2c Drivers +# +# CONFIG_FREERTOS_USE_I2C is not set +# end of Freertos I2c Drivers + +# +# Freertos Mio Drivers +# +# CONFIG_FREERTOS_USE_MIO is not set +# end of Freertos Mio Drivers + +# +# Freertos Timer Drivers +# +# CONFIG_FREERTOS_USE_TIMER is not set +# end of Freertos Timer Drivers + +# +# Freertos Media Drivers +# +# CONFIG_FREERTOS_USE_MEDIA is not set +# end of Freertos Media Drivers + +# +# Freertos I2s Drivers +# +# CONFIG_FREERTOS_USE_I2S is not set +# end of Freertos I2s Drivers +# end of Component Configuration + +# +# Third-party configuration +# +# CONFIG_USE_LWIP is not set +CONFIG_USE_LETTER_SHELL=y + +# +# Letter Shell Configuration +# +CONFIG_LS_PL011_UART=y +CONFIG_DEFAULT_LETTER_SHELL_USE_UART1=y +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set +# end of Letter Shell Configuration + +# CONFIG_USE_AMP is not set +# CONFIG_USE_YMODEM is not set +# CONFIG_USE_SFUD is not set +CONFIG_USE_BACKTRACE=y +# CONFIG_USE_FATFS_0_1_4 is not set +CONFIG_USE_TLSF=y +# CONFIG_USE_SPIFFS is not set +# CONFIG_USE_LITTLE_FS is not set +# CONFIG_USE_LVGL is not set +# CONFIG_USE_FREEMODBUS is not set +CONFIG_USE_CHERRY_USB=y + +# +# CherryUSB Configuration +# +# CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +CONFIG_CHERRY_USB_PORT_PUSB2=y +# CONFIG_CHERRYUSB_HOST is not set +CONFIG_CHERRYUSB_DEVICE=y +CONFIG_CHERRY_USB_DEVICE_MSC=y +CONFIG_CHERRY_USB_DEVICE_CDC=y +# end of CherryUSB Configuration + +# CONFIG_USE_FSL_SDMMC is not set +# CONFIG_USE_FSL_WIFI is not set +# end of Third-party configuration + +# +# FreeRTOS Kernel Configuration +# +CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_MAX_PRIORITIES=32 +CONFIG_FREERTOS_KERNEL_INTERRUPT_PRIORITIES=13 +CONFIG_FREERTOS_MAX_API_CALL_INTERRUPT_PRIORITIES=11 +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +CONFIG_FREERTOS_MINIMAL_TASK_STACKSIZE=1024 +CONFIG_FREERTOS_MAX_TASK_NAME_LEN=32 +CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y +# CONFIG_FREERTOS_USE_TICKLESS_IDLE is not set +CONFIG_FREERTOS_TOTAL_HEAP_SIZE=10240 +CONFIG_FREERTOS_TASK_FPU_SUPPORT=1 +# CONFIG_FREERTOS_USE_POSIX is not set +# end of FreeRTOS Kernel Configuration diff --git a/example/peripheral/usb/pusb2_device/figs/copy_file_to_usb_disk.png b/example/peripheral/usb/pusb2_device/figs/copy_file_to_usb_disk.png new file mode 100644 index 0000000000000000000000000000000000000000..83d712921859f4a5410211296ddeee5c51c23525 Binary files /dev/null and b/example/peripheral/usb/pusb2_device/figs/copy_file_to_usb_disk.png differ diff --git a/example/peripheral/usb/pusb2_device/figs/e2000d_demo_usb2.png b/example/peripheral/usb/pusb2_device/figs/e2000d_demo_usb2.png new file mode 100644 index 0000000000000000000000000000000000000000..a836aadae53ca868d46cec9348382ce5f759bd5d Binary files /dev/null and b/example/peripheral/usb/pusb2_device/figs/e2000d_demo_usb2.png differ diff --git a/example/peripheral/usb/pusb2_device/figs/format_usb_disk.png b/example/peripheral/usb/pusb2_device/figs/format_usb_disk.png new file mode 100644 index 0000000000000000000000000000000000000000..af3072215fbd2be45cab7a97895df5e04a5e89df Binary files /dev/null and b/example/peripheral/usb/pusb2_device/figs/format_usb_disk.png differ diff --git a/example/peripheral/usb/pusb2_device/figs/format_usb_disk2.png b/example/peripheral/usb/pusb2_device/figs/format_usb_disk2.png new file mode 100644 index 0000000000000000000000000000000000000000..ddab483f2b234c6e0aafbd23c3e45d07072221ba Binary files /dev/null and b/example/peripheral/usb/pusb2_device/figs/format_usb_disk2.png differ diff --git a/example/peripheral/usb/pusb2_device/figs/input_by_serial.png b/example/peripheral/usb/pusb2_device/figs/input_by_serial.png new file mode 100644 index 0000000000000000000000000000000000000000..b7e302955615ccfdf384eb99048dbdd207572fea Binary files /dev/null and b/example/peripheral/usb/pusb2_device/figs/input_by_serial.png differ diff --git a/example/peripheral/usb/pusb2_device/figs/usb2_cdc.png b/example/peripheral/usb/pusb2_device/figs/usb2_cdc.png new file mode 100644 index 0000000000000000000000000000000000000000..29f85ce2b3c0b5bea8d0b52f2342b835dd1b64e2 Binary files /dev/null and b/example/peripheral/usb/pusb2_device/figs/usb2_cdc.png differ diff --git a/example/peripheral/usb/pusb2_device/figs/usb_disk_device.png b/example/peripheral/usb/pusb2_device/figs/usb_disk_device.png new file mode 100644 index 0000000000000000000000000000000000000000..e8b252e964a8315fc4bde6393404239157c40c6b Binary files /dev/null and b/example/peripheral/usb/pusb2_device/figs/usb_disk_device.png differ diff --git a/example/peripheral/usb/pusb2_device/figs/usb_virtual_serial.png b/example/peripheral/usb/pusb2_device/figs/usb_virtual_serial.png new file mode 100644 index 0000000000000000000000000000000000000000..1a9317065c7a0bc98abdbe08d323c41cbe04b951 Binary files /dev/null and b/example/peripheral/usb/pusb2_device/figs/usb_virtual_serial.png differ diff --git a/third-party/cherryusb/port/xhci/usb_hc_xhci.h b/example/peripheral/usb/pusb2_device/inc/pusb2_mass_storage_example.h similarity index 63% rename from third-party/cherryusb/port/xhci/usb_hc_xhci.h rename to example/peripheral/usb/pusb2_device/inc/pusb2_mass_storage_example.h index 151b5bdc348e2e733fcbaa78764f1aa5b3ca3c68..4a00441742535fb014b95d914b3a91a32cd433c3 100644 --- a/third-party/cherryusb/port/xhci/usb_hc_xhci.h +++ b/example/peripheral/usb/pusb2_device/inc/pusb2_mass_storage_example.h @@ -1,5 +1,5 @@ /* - * Copyright : (C) 2022 Phytium Information Technology, Inc. + * Copyright : (C) 2023 Phytium Information Technology, Inc. * All Rights Reserved. * * This program is OPEN SOURCE software: you can redistribute it and/or modify it @@ -11,28 +11,42 @@ * See the Phytium Public License for more details. * * - * FilePath: usb_hc_xhci.h - * Date: 2022-07-19 09:26:25 - * LastEditTime: 2022-07-19 09:26:25 - * Description:  This file is for xhci data structure definition. + * FilePath: pusb2_mass_storage_example.h + * Date: 2022-02-10 14:53:42 + * LastEditTime: 2022-02-17 17:46:03 + * Description:  This file is for pusb2 cherryusb mass storage example function definition * * Modify History: * Ver   Who        Date         Changes * ----- ------     --------    -------------------------------------- - * 1.0 zhugengyu 2022/9/19 init commit - * 2.0 zhugengyu 2023/3/29 support usb3.0 device attached at roothub + * 1.0 zhugengyu 2023/7/18 first release */ -#ifndef USB_HC_XHCI_H -#define USB_HC_XHCI_H +#ifndef PUSB2_MASS_STORAGE_H +#define PUSB2_MASS_STORAGE_H /***************************** Include Files *********************************/ -#include "usbh_core.h" +#include "ftypes.h" + +#ifdef __cplusplus +extern "C" +{ +#endif /************************** Constant Definitions *****************************/ +/**************************** Type Definitions *******************************/ + /************************** Variable Definitions *****************************/ /***************** Macros (Inline Functions) Definitions *********************/ /************************** Function Prototypes ******************************/ +int FPUsb2MassStorageExample(u32 id); +void FPUsb2MassStorageExampleEnd(u32 id); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/example/peripheral/usb/pusb2_device/inc/pusb2_virtual_serial_example.h b/example/peripheral/usb/pusb2_device/inc/pusb2_virtual_serial_example.h new file mode 100644 index 0000000000000000000000000000000000000000..6eacdbf3194d24df039d470f6e2761ed212f60d7 --- /dev/null +++ b/example/peripheral/usb/pusb2_device/inc/pusb2_virtual_serial_example.h @@ -0,0 +1,52 @@ +/* + * Copyright : (C) 2023 Phytium Information Technology, Inc. + * All Rights Reserved. + * + * This program is OPEN SOURCE software: you can redistribute it and/or modify it + * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, + * either version 1.0 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Phytium Public License for more details. + * + * + * FilePath: pusb2_virtual_serial_example.h + * Date: 2022-02-10 14:53:42 + * LastEditTime: 2022-02-17 17:46:03 + * Description:  This file is for pusb2 cherryusb device virutal serial example function definition + * + * Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + * 1.0 zhugengyu 2023/7/18 first release + */ + +#ifndef PUSB2_VIRTUAL_SERIAL_H +#define PUSB2_VIRTUAL_SERIAL_H + +/***************************** Include Files *********************************/ +#include "ftypes.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +/************************** Constant Definitions *****************************/ + +/**************************** Type Definitions *******************************/ + +/************************** Variable Definitions *****************************/ + +/***************** Macros (Inline Functions) Definitions *********************/ + +/************************** Function Prototypes ******************************/ +int FPUsb2VirtualSerialExample(u32 id); +void FPUsb2VirtualSerialExampleEnd(u32 id); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/example/peripheral/usb/pusb2_device/main.c b/example/peripheral/usb/pusb2_device/main.c new file mode 100644 index 0000000000000000000000000000000000000000..de4a11e7f2e6c0b7cfe5769ebb0efcfdbd044773 --- /dev/null +++ b/example/peripheral/usb/pusb2_device/main.c @@ -0,0 +1,57 @@ +/* + * Copyright : (C) 2022 Phytium Information Technology, Inc. + * All Rights Reserved. + * + * This program is OPEN SOURCE software: you can redistribute it and/or modify it + * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, + * either version 1.0 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Phytium Public License for more details. + * + * + * FilePath: main.c + * Date: 2022-06-17 08:17:59 + * LastEditTime: 2022-06-17 08:17:59 + * Description:  This file is for cherry-usb test main entry. + * + * Modify History: + * Ver   Who         Date         Changes + * ----- ------     --------    -------------------------------------- + * 1.0 zhugengyu 2022/10/19 init commit + * 2.0 zhugengyu 2024/7/26 support auto-run + */ + +#include +#include "FreeRTOS.h" +#include "fparameters.h" + +#include "pusb2_mass_storage_example.h" +#include "pusb2_virtual_serial_example.h" + +#ifdef CONFIG_USE_LETTER_SHELL +#include "shell.h" +#include "shell_port.h" +#endif + +int main(void) +{ + BaseType_t ret; + +#ifdef CONFIG_USE_LETTER_SHELL + ret = LSUserShellTask(); + if (ret != pdPASS) + { + goto FAIL_EXIT; + } +#else + ret = FPUsb2VirtualSerialExample(FUSB2_ID_VHUB_0); +#endif + vTaskStartScheduler(); /* 启动任务,开启调度 */ + while (1); /* 正常不会执行到这里 */ + +FAIL_EXIT: + printf("Failed,the ret value is 0x%x. \r\n", ret); + return 0; +} diff --git a/example/peripheral/usb/pusb2_device/makefile b/example/peripheral/usb/pusb2_device/makefile new file mode 100644 index 0000000000000000000000000000000000000000..b4c61bdaf7bfaf1dfa6c14ee19b7de4ea3e1fb12 --- /dev/null +++ b/example/peripheral/usb/pusb2_device/makefile @@ -0,0 +1,29 @@ +PROJECT_DIR = $(CURDIR) +FREERTOS_SDK_DIR = $(CURDIR)/../../../.. +# # 设置启动镜像名 +BOOT_IMG_NAME ?= freertos + +USER_CSRC := main.c +USER_CSRC += $(wildcard src/*.c) + +USER_ASRC := +USER_CXXSRC := + +USER_INCLUDE := $(PROJECT_DIR) \ + $(PROJECT_DIR)/inc + + +include $(FREERTOS_SDK_DIR)/tools/makeall.mk + +ifeq ($(OS),Windows_NT) +USR_BOOT_DIR ?= D:\\tftpboot +else +USR_BOOT_DIR ?= /mnt/d/tftpboot +endif + +image: all + @cp ./$(IMAGE_OUT_NAME).elf $(USR_BOOT_DIR)/freertos.elf +ifdef CONFIG_OUTPUT_BINARY + @cp ./$(IMAGE_OUT_NAME).bin $(USR_BOOT_DIR)/freertos.bin +endif + @ls $(USR_BOOT_DIR)/$(BOOT_IMG_NAME).* -l \ No newline at end of file diff --git a/example/peripheral/usb/pusb2_device/sdkconfig b/example/peripheral/usb/pusb2_device/sdkconfig new file mode 100644 index 0000000000000000000000000000000000000000..f5edb30e906a8c987eeaa054f5d74992d9d99e9c --- /dev/null +++ b/example/peripheral/usb/pusb2_device/sdkconfig @@ -0,0 +1,359 @@ +CONFIG_USE_FREERTOS=y + +# +# Arch configuration +# +CONFIG_TARGET_ARMv8=y +CONFIG_ARCH_NAME="armv8" + +# +# Arm architecture configuration +# +CONFIG_ARCH_ARMV8_AARCH64=y +# CONFIG_ARCH_ARMV8_AARCH32 is not set + +# +# Compiler configuration +# +CONFIG_ARM_GCC_SELECT=y +# CONFIG_ARM_CLANG_SELECT is not set +CONFIG_TOOLCHAIN_NAME="gcc" +CONFIG_TARGET_ARMV8_AARCH64=y +CONFIG_ARCH_EXECUTION_STATE="aarch64" +CONFIG_ARM_NEON=y +CONFIG_ARM_CRC=y +CONFIG_ARM_CRYPTO=y +CONFIG_ARM_FLOAT_POINT=y +# CONFIG_GCC_CODE_MODEL_TINY is not set +CONFIG_GCC_CODE_MODEL_SMALL=y +# CONFIG_GCC_CODE_MODEL_LARGE is not set +# end of Compiler configuration + +CONFIG_BOOT_WITH_FLUSH_CACHE=y +# CONFIG_MMU_DEBUG_PRINTS is not set +# end of Arm architecture configuration + +CONFIG_MMU_PAGE_SIZE=0x1000 +CONFIG_MAX_XLAT_TABLES=256 +# end of Arch configuration + +# +# Soc configuration +# +# CONFIG_TARGET_PHYTIUMPI is not set +CONFIG_TARGET_E2000Q=y +# CONFIG_TARGET_E2000D is not set +# CONFIG_TARGET_E2000S is not set +# CONFIG_TARGET_FT2004 is not set +# CONFIG_TARGET_D2000 is not set +# CONFIG_TARGET_PD2308 is not set +CONFIG_SOC_NAME="e2000" +CONFIG_TARGET_TYPE_NAME="q" +CONFIG_SOC_CORE_NUM=4 +CONFIG_F32BIT_MEMORY_ADDRESS=0x80000000 +CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 +CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 +CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 +CONFIG_TARGET_E2000=y +CONFIG_DEFAULT_DEBUG_PRINT_UART1=y +# CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set +# CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set +# end of Soc configuration + +# +# Board Configuration +# +CONFIG_BOARD_NAME="demo" +# CONFIG_USE_SPI_IOPAD is not set +# CONFIG_USE_GPIO_IOPAD is not set +# CONFIG_USE_CAN_IOPAD is not set +# CONFIG_USE_QSPI_IOPAD is not set +# CONFIG_USE_PWM_IOPAD is not set +# CONFIG_USE_MIO_IOPAD is not set +# CONFIG_USE_TACHO_IOPAD is not set +# CONFIG_USE_UART_IOPAD is not set +# CONFIG_USE_THIRD_PARTY_IOPAD is not set +CONFIG_E2000Q_DEMO_BOARD=y + +# +# IO mux configuration when board start up +# +# end of IO mux configuration when board start up + +# CONFIG_CUS_DEMO_BOARD is not set + +# +# Build project name +# +CONFIG_TARGET_NAME="pusb2" +# end of Build project name +# end of Board Configuration + +# +# Sdk common configuration +# +CONFIG_ELOG_LINE_BUF_SIZE=0x100 +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +# CONFIG_LOG_INFO is not set +# CONFIG_LOG_WARN is not set +CONFIG_LOG_ERROR=y +# CONFIG_LOG_NONE is not set +CONFIG_LOG_EXTRA_INFO=y +# CONFIG_LOG_DISPALY_CORE_NUM is not set +# CONFIG_BOOTUP_DEBUG_PRINTS is not set +CONFIG_USE_DEFAULT_INTERRUPT_CONFIG=y +CONFIG_INTERRUPT_ROLE_MASTER=y +# CONFIG_INTERRUPT_ROLE_SLAVE is not set +# end of Sdk common configuration + +# +# Drivers configuration +# +CONFIG_USE_IOMUX=y +# CONFIG_ENABLE_IOCTRL is not set +CONFIG_ENABLE_IOPAD=y +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_ETH is not set +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_MIO is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# CONFIG_USE_SATA is not set +# CONFIG_USE_ADC is not set +# CONFIG_USE_PWM is not set +# CONFIG_USE_IPC is not set +# CONFIG_USE_MEDIA is not set +# CONFIG_USE_SCMI_MHU is not set +# CONFIG_USE_I2S is not set +# CONFIG_USE_I3C is not set +# end of Drivers configuration + +# +# Build setup +# +CONFIG_CHECK_DEPS=y +CONFIG_OUTPUT_BINARY=y + +# +# Optimization options +# +CONFIG_DEBUG_NOOPT=y +# CONFIG_DEBUG_CUSTOMOPT is not set +# CONFIG_DEBUG_FULLOPT is not set +CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y +CONFIG_DEBUG_LINK_MAP=y +# CONFIG_CCACHE is not set +# CONFIG_ARCH_COVERAGE is not set +# CONFIG_LTO_FULL is not set +# end of Optimization options + +# +# Debug options +# +# CONFIG_DEBUG_ENABLE_ALL_WARNING is not set +# CONFIG_WALL_WARNING_ERROR is not set +# CONFIG_STRICT_PROTOTYPES is not set +# CONFIG_DEBUG_SYMBOLS is not set +# CONFIG_FRAME_POINTER is not set +# CONFIG_OUTPUT_ASM_DIS is not set +# CONFIG_ENABLE_WSHADOW is not set +# CONFIG_ENABLE_WUNDEF is not set +CONFIG_DOWNGRADE_DIAG_WARNING=y +# end of Debug options + +# +# Lib +# +CONFIG_USE_COMPILE_CHAIN=y +# CONFIG_USE_NEWLIB is not set +# CONFIG_USE_USER_DEFINED is not set +# end of Lib + +# CONFIG_ENABLE_CXX is not set + +# +# Linker Options +# +CONFIG_DEFAULT_LINKER_SCRIPT=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_IMAGE_LOAD_ADDRESS=0x80100000 +CONFIG_IMAGE_MAX_LENGTH=0x5000000 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Build setup + +# +# Component Configuration +# + +# +# Freertos Uart Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Uart Drivers + +# +# Freertos Pwm Drivers +# +# CONFIG_FREERTOS_USE_PWM is not set +# end of Freertos Pwm Drivers + +# +# Freertos Qspi Drivers +# +# CONFIG_FREERTOS_USE_QSPI is not set +# end of Freertos Qspi Drivers + +# +# Freertos Wdt Drivers +# +# CONFIG_FREERTOS_USE_WDT is not set +# end of Freertos Wdt Drivers + +# +# Freertos Eth Drivers +# +# CONFIG_FREERTOS_USE_XMAC is not set +# CONFIG_FREERTOS_USE_GMAC is not set +# end of Freertos Eth Drivers + +# +# Freertos Spim Drivers +# +# CONFIG_FREERTOS_USE_FSPIM is not set +# end of Freertos Spim Drivers + +# +# Freertos DMA Drivers +# +# CONFIG_FREERTOS_USE_FDDMA is not set +# CONFIG_FREERTOS_USE_FGDMA is not set +# end of Freertos DMA Drivers + +# +# Freertos Adc Drivers +# +# CONFIG_FREERTOS_USE_ADC is not set +# end of Freertos Adc Drivers + +# +# Freertos Can Drivers +# +# CONFIG_FREERTOS_USE_CAN is not set +# end of Freertos Can Drivers + +# +# Freertos I2c Drivers +# +# CONFIG_FREERTOS_USE_I2C is not set +# end of Freertos I2c Drivers + +# +# Freertos Mio Drivers +# +# CONFIG_FREERTOS_USE_MIO is not set +# end of Freertos Mio Drivers + +# +# Freertos Timer Drivers +# +# CONFIG_FREERTOS_USE_TIMER is not set +# end of Freertos Timer Drivers + +# +# Freertos Media Drivers +# +# CONFIG_FREERTOS_USE_MEDIA is not set +# end of Freertos Media Drivers + +# +# Freertos I2s Drivers +# +# CONFIG_FREERTOS_USE_I2S is not set +# end of Freertos I2s Drivers +# end of Component Configuration + +# +# Third-party configuration +# +# CONFIG_USE_LWIP is not set +CONFIG_USE_LETTER_SHELL=y + +# +# Letter Shell Configuration +# +CONFIG_LS_PL011_UART=y +CONFIG_DEFAULT_LETTER_SHELL_USE_UART1=y +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set +# end of Letter Shell Configuration + +# CONFIG_USE_AMP is not set +# CONFIG_USE_YMODEM is not set +# CONFIG_USE_SFUD is not set +CONFIG_USE_BACKTRACE=y +# CONFIG_USE_FATFS_0_1_4 is not set +CONFIG_USE_TLSF=y +# CONFIG_USE_SPIFFS is not set +# CONFIG_USE_LITTLE_FS is not set +# CONFIG_USE_LVGL is not set +# CONFIG_USE_FREEMODBUS is not set +CONFIG_USE_CHERRY_USB=y + +# +# CherryUSB Configuration +# +# CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +CONFIG_CHERRY_USB_PORT_PUSB2=y +# CONFIG_CHERRYUSB_HOST is not set +CONFIG_CHERRYUSB_DEVICE=y +CONFIG_CHERRY_USB_DEVICE_MSC=y +CONFIG_CHERRY_USB_DEVICE_CDC=y +# end of CherryUSB Configuration + +# CONFIG_USE_FSL_SDMMC is not set +# CONFIG_USE_FSL_WIFI is not set +# end of Third-party configuration + +# +# FreeRTOS Kernel Configuration +# +CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_MAX_PRIORITIES=32 +CONFIG_FREERTOS_KERNEL_INTERRUPT_PRIORITIES=13 +CONFIG_FREERTOS_MAX_API_CALL_INTERRUPT_PRIORITIES=11 +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +CONFIG_FREERTOS_MINIMAL_TASK_STACKSIZE=1024 +CONFIG_FREERTOS_MAX_TASK_NAME_LEN=32 +CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y +# CONFIG_FREERTOS_USE_TICKLESS_IDLE is not set +CONFIG_FREERTOS_TOTAL_HEAP_SIZE=10240 +CONFIG_FREERTOS_TASK_FPU_SUPPORT=1 +# CONFIG_FREERTOS_USE_POSIX is not set +# end of FreeRTOS Kernel Configuration diff --git a/example/peripheral/usb/pusb2_device/sdkconfig.h b/example/peripheral/usb/pusb2_device/sdkconfig.h new file mode 100644 index 0000000000000000000000000000000000000000..b55a5d7b5702dd456f9292cca8f9cb9930502c0f --- /dev/null +++ b/example/peripheral/usb/pusb2_device/sdkconfig.h @@ -0,0 +1,322 @@ +#ifndef SDK_CONFIG_H__ +#define SDK_CONFIG_H__ + +#define CONFIG_USE_FREERTOS + +/* Arch configuration */ + +#define CONFIG_TARGET_ARMv8 +#define CONFIG_ARCH_NAME "armv8" + +/* Arm architecture configuration */ + +#define CONFIG_ARCH_ARMV8_AARCH64 +/* CONFIG_ARCH_ARMV8_AARCH32 is not set */ + +/* Compiler configuration */ + +#define CONFIG_ARM_GCC_SELECT +/* CONFIG_ARM_CLANG_SELECT is not set */ +#define CONFIG_TOOLCHAIN_NAME "gcc" +#define CONFIG_TARGET_ARMV8_AARCH64 +#define CONFIG_ARCH_EXECUTION_STATE "aarch64" +#define CONFIG_ARM_NEON +#define CONFIG_ARM_CRC +#define CONFIG_ARM_CRYPTO +#define CONFIG_ARM_FLOAT_POINT +/* CONFIG_GCC_CODE_MODEL_TINY is not set */ +#define CONFIG_GCC_CODE_MODEL_SMALL +/* CONFIG_GCC_CODE_MODEL_LARGE is not set */ +/* end of Compiler configuration */ +#define CONFIG_BOOT_WITH_FLUSH_CACHE +/* CONFIG_MMU_DEBUG_PRINTS is not set */ +/* end of Arm architecture configuration */ +#define CONFIG_MMU_PAGE_SIZE 0x1000 +#define CONFIG_MAX_XLAT_TABLES 256 +/* end of Arch configuration */ + +/* Soc configuration */ + +/* CONFIG_TARGET_PHYTIUMPI is not set */ +#define CONFIG_TARGET_E2000Q +/* CONFIG_TARGET_E2000D is not set */ +/* CONFIG_TARGET_E2000S is not set */ +/* CONFIG_TARGET_FT2004 is not set */ +/* CONFIG_TARGET_D2000 is not set */ +/* CONFIG_TARGET_PD2308 is not set */ +#define CONFIG_SOC_NAME "e2000" +#define CONFIG_TARGET_TYPE_NAME "q" +#define CONFIG_SOC_CORE_NUM 4 +#define CONFIG_F32BIT_MEMORY_ADDRESS 0x80000000 +#define CONFIG_F32BIT_MEMORY_LENGTH 0x80000000 +#define CONFIG_F64BIT_MEMORY_ADDRESS 0x2000000000 +#define CONFIG_F64BIT_MEMORY_LENGTH 0x800000000 +#define CONFIG_TARGET_E2000 +#define CONFIG_DEFAULT_DEBUG_PRINT_UART1 +/* CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set */ +/* CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set */ +/* end of Soc configuration */ + +/* Board Configuration */ + +#define CONFIG_BOARD_NAME "demo" +/* CONFIG_USE_SPI_IOPAD is not set */ +/* CONFIG_USE_GPIO_IOPAD is not set */ +/* CONFIG_USE_CAN_IOPAD is not set */ +/* CONFIG_USE_QSPI_IOPAD is not set */ +/* CONFIG_USE_PWM_IOPAD is not set */ +/* CONFIG_USE_MIO_IOPAD is not set */ +/* CONFIG_USE_TACHO_IOPAD is not set */ +/* CONFIG_USE_UART_IOPAD is not set */ +/* CONFIG_USE_THIRD_PARTY_IOPAD is not set */ +#define CONFIG_E2000Q_DEMO_BOARD + +/* IO mux configuration when board start up */ + +/* end of IO mux configuration when board start up */ +/* CONFIG_CUS_DEMO_BOARD is not set */ + +/* Build project name */ + +#define CONFIG_TARGET_NAME "pusb2" +/* end of Build project name */ +/* end of Board Configuration */ + +/* Sdk common configuration */ + +#define CONFIG_ELOG_LINE_BUF_SIZE 0x100 +/* CONFIG_LOG_VERBOS is not set */ +/* CONFIG_LOG_DEBUG is not set */ +/* CONFIG_LOG_INFO is not set */ +/* CONFIG_LOG_WARN is not set */ +#define CONFIG_LOG_ERROR +/* CONFIG_LOG_NONE is not set */ +#define CONFIG_LOG_EXTRA_INFO +/* CONFIG_LOG_DISPALY_CORE_NUM is not set */ +/* CONFIG_BOOTUP_DEBUG_PRINTS is not set */ +#define CONFIG_USE_DEFAULT_INTERRUPT_CONFIG +#define CONFIG_INTERRUPT_ROLE_MASTER +/* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ +/* end of Sdk common configuration */ + +/* Drivers configuration */ + +#define CONFIG_USE_IOMUX +/* CONFIG_ENABLE_IOCTRL is not set */ +#define CONFIG_ENABLE_IOPAD +/* CONFIG_USE_SPI is not set */ +/* CONFIG_USE_QSPI is not set */ +#define CONFIG_USE_SERIAL + +/* Usart Configuration */ + +#define CONFIG_ENABLE_Pl011_UART +/* end of Usart Configuration */ +/* CONFIG_USE_GPIO is not set */ +/* CONFIG_USE_ETH is not set */ +/* CONFIG_USE_CAN is not set */ +/* CONFIG_USE_I2C is not set */ +/* CONFIG_USE_TIMER is not set */ +/* CONFIG_USE_MIO is not set */ +/* CONFIG_USE_SDMMC is not set */ +/* CONFIG_USE_PCIE is not set */ +/* CONFIG_USE_WDT is not set */ +/* CONFIG_USE_DMA is not set */ +/* CONFIG_USE_NAND is not set */ +/* CONFIG_USE_RTC is not set */ +/* CONFIG_USE_SATA is not set */ +/* CONFIG_USE_ADC is not set */ +/* CONFIG_USE_PWM is not set */ +/* CONFIG_USE_IPC is not set */ +/* CONFIG_USE_MEDIA is not set */ +/* CONFIG_USE_SCMI_MHU is not set */ +/* CONFIG_USE_I2S is not set */ +/* CONFIG_USE_I3C is not set */ +/* end of Drivers configuration */ + +/* Build setup */ + +#define CONFIG_CHECK_DEPS +#define CONFIG_OUTPUT_BINARY + +/* Optimization options */ + +#define CONFIG_DEBUG_NOOPT +/* CONFIG_DEBUG_CUSTOMOPT is not set */ +/* CONFIG_DEBUG_FULLOPT is not set */ +#define CONFIG_DEBUG_OPT_UNUSED_SECTIONS +#define CONFIG_DEBUG_LINK_MAP +/* CONFIG_CCACHE is not set */ +/* CONFIG_ARCH_COVERAGE is not set */ +/* CONFIG_LTO_FULL is not set */ +/* end of Optimization options */ + +/* Debug options */ + +/* CONFIG_DEBUG_ENABLE_ALL_WARNING is not set */ +/* CONFIG_WALL_WARNING_ERROR is not set */ +/* CONFIG_STRICT_PROTOTYPES is not set */ +/* CONFIG_DEBUG_SYMBOLS is not set */ +/* CONFIG_FRAME_POINTER is not set */ +/* CONFIG_OUTPUT_ASM_DIS is not set */ +/* CONFIG_ENABLE_WSHADOW is not set */ +/* CONFIG_ENABLE_WUNDEF is not set */ +#define CONFIG_DOWNGRADE_DIAG_WARNING +/* end of Debug options */ + +/* Lib */ + +#define CONFIG_USE_COMPILE_CHAIN +/* CONFIG_USE_NEWLIB is not set */ +/* CONFIG_USE_USER_DEFINED is not set */ +/* end of Lib */ +/* CONFIG_ENABLE_CXX is not set */ + +/* Linker Options */ + +#define CONFIG_DEFAULT_LINKER_SCRIPT +/* CONFIG_USER_DEFINED_LD is not set */ +#define CONFIG_IMAGE_LOAD_ADDRESS 0x80100000 +#define CONFIG_IMAGE_MAX_LENGTH 0x5000000 +#define CONFIG_HEAP_SIZE 1 +#define CONFIG_STACK_SIZE 0x400 +/* end of Linker Options */ +/* end of Build setup */ + +/* Component Configuration */ + +/* Freertos Uart Drivers */ + +#define CONFIG_FREERTOS_USE_UART +/* end of Freertos Uart Drivers */ + +/* Freertos Pwm Drivers */ + +/* CONFIG_FREERTOS_USE_PWM is not set */ +/* end of Freertos Pwm Drivers */ + +/* Freertos Qspi Drivers */ + +/* CONFIG_FREERTOS_USE_QSPI is not set */ +/* end of Freertos Qspi Drivers */ + +/* Freertos Wdt Drivers */ + +/* CONFIG_FREERTOS_USE_WDT is not set */ +/* end of Freertos Wdt Drivers */ + +/* Freertos Eth Drivers */ + +/* CONFIG_FREERTOS_USE_XMAC is not set */ +/* CONFIG_FREERTOS_USE_GMAC is not set */ +/* end of Freertos Eth Drivers */ + +/* Freertos Spim Drivers */ + +/* CONFIG_FREERTOS_USE_FSPIM is not set */ +/* end of Freertos Spim Drivers */ + +/* Freertos DMA Drivers */ + +/* CONFIG_FREERTOS_USE_FDDMA is not set */ +/* CONFIG_FREERTOS_USE_FGDMA is not set */ +/* end of Freertos DMA Drivers */ + +/* Freertos Adc Drivers */ + +/* CONFIG_FREERTOS_USE_ADC is not set */ +/* end of Freertos Adc Drivers */ + +/* Freertos Can Drivers */ + +/* CONFIG_FREERTOS_USE_CAN is not set */ +/* end of Freertos Can Drivers */ + +/* Freertos I2c Drivers */ + +/* CONFIG_FREERTOS_USE_I2C is not set */ +/* end of Freertos I2c Drivers */ + +/* Freertos Mio Drivers */ + +/* CONFIG_FREERTOS_USE_MIO is not set */ +/* end of Freertos Mio Drivers */ + +/* Freertos Timer Drivers */ + +/* CONFIG_FREERTOS_USE_TIMER is not set */ +/* end of Freertos Timer Drivers */ + +/* Freertos Media Drivers */ + +/* CONFIG_FREERTOS_USE_MEDIA is not set */ +/* end of Freertos Media Drivers */ + +/* Freertos I2s Drivers */ + +/* CONFIG_FREERTOS_USE_I2S is not set */ +/* end of Freertos I2s Drivers */ +/* end of Component Configuration */ + +/* Third-party configuration */ + +/* CONFIG_USE_LWIP is not set */ +#define CONFIG_USE_LETTER_SHELL + +/* Letter Shell Configuration */ + +#define CONFIG_LS_PL011_UART +#define CONFIG_DEFAULT_LETTER_SHELL_USE_UART1 +/* CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set */ +/* CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set */ +/* end of Letter Shell Configuration */ +/* CONFIG_USE_AMP is not set */ +/* CONFIG_USE_YMODEM is not set */ +/* CONFIG_USE_SFUD is not set */ +#define CONFIG_USE_BACKTRACE +/* CONFIG_USE_FATFS_0_1_4 is not set */ +#define CONFIG_USE_TLSF +/* CONFIG_USE_SPIFFS is not set */ +/* CONFIG_USE_LITTLE_FS is not set */ +/* CONFIG_USE_LVGL is not set */ +/* CONFIG_USE_FREEMODBUS is not set */ +#define CONFIG_USE_CHERRY_USB + +/* CherryUSB Configuration */ + +/* CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set */ +/* CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set */ +#define CONFIG_CHERRY_USB_PORT_PUSB2 +/* CONFIG_CHERRYUSB_HOST is not set */ +#define CONFIG_CHERRYUSB_DEVICE +#define CONFIG_CHERRY_USB_DEVICE_MSC +#define CONFIG_CHERRY_USB_DEVICE_CDC +/* end of CherryUSB Configuration */ +/* CONFIG_USE_FSL_SDMMC is not set */ +/* CONFIG_USE_FSL_WIFI is not set */ +/* end of Third-party configuration */ + +/* FreeRTOS Kernel Configuration */ + +#define CONFIG_FREERTOS_OPTIMIZED_SCHEDULER +#define CONFIG_FREERTOS_HZ 1000 +#define CONFIG_FREERTOS_MAX_PRIORITIES 32 +#define CONFIG_FREERTOS_KERNEL_INTERRUPT_PRIORITIES 13 +#define CONFIG_FREERTOS_MAX_API_CALL_INTERRUPT_PRIORITIES 11 +#define CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS 1 +#define CONFIG_FREERTOS_MINIMAL_TASK_STACKSIZE 1024 +#define CONFIG_FREERTOS_MAX_TASK_NAME_LEN 32 +#define CONFIG_FREERTOS_TIMER_TASK_PRIORITY 1 +#define CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH 2048 +#define CONFIG_FREERTOS_TIMER_QUEUE_LENGTH 10 +#define CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE 0 +#define CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS +#define CONFIG_FREERTOS_USE_TRACE_FACILITY +#define CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS +/* CONFIG_FREERTOS_USE_TICKLESS_IDLE is not set */ +#define CONFIG_FREERTOS_TOTAL_HEAP_SIZE 10240 +#define CONFIG_FREERTOS_TASK_FPU_SUPPORT 1 +/* CONFIG_FREERTOS_USE_POSIX is not set */ +/* end of FreeRTOS Kernel Configuration */ + +#endif diff --git a/example/peripheral/usb/pusb2_device/src/cmd_pusb2.c b/example/peripheral/usb/pusb2_device/src/cmd_pusb2.c new file mode 100644 index 0000000000000000000000000000000000000000..559763cd4150006bb5ebba72af994ce398512bde --- /dev/null +++ b/example/peripheral/usb/pusb2_device/src/cmd_pusb2.c @@ -0,0 +1,68 @@ +/* + * Copyright : (C) 2022 Phytium Information Technology, Inc. + * All Rights Reserved. + * + * This program is OPEN SOURCE software: you can redistribute it and/or modify it + * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, + * either version 1.0 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Phytium Public License for more details. + * + * + * FilePath: cmd_usb.c + * Date: 2022-09-19 14:34:44 + * LastEditTime: 2022-09-19 14:34:45 + * Description:  This file is for USB shell command. + * + * Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + * 1.0 zhugengyu 2022/9/20 init commit + */ +#include +#include +#include "strto.h" +#include "sdkconfig.h" + +#include "FreeRTOS.h" + +#include "../src/shell.h" +#include "pusb2_mass_storage_example.h" +#include "pusb2_virtual_serial_example.h" + +/* usage info function for pusb2 example */ +static void FPUsb2ExampleUsage(void) +{ + printf("Usage:\r\n"); + printf("pusb2 mass_storage\r\n"); + printf("-- run pusb2 massage storage example\r\n"); + printf("pusb2 virtual_serial\r\n"); + printf("-- run pusb2 virtual serial example\r\n"); +} + +static int USBCmdEntry(int argc, char *argv[]) +{ + int ret = 0; + u32 usb_id = 0; + const char *devname; + + if (argc < 2) + { + FPUsb2ExampleUsage(); + return -1; + } + + if (!strcmp(argv[1], "mass_storage")) + { + ret = FPUsb2MassStorageExample(usb_id); + } + else if (!strcmp(argv[1], "virtual_serial")) + { + ret = FPUsb2VirtualSerialExample(usb_id); + } + + return ret; +} +SHELL_EXPORT_CMD(SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), pusb2, USBCmdEntry, test freertos usb driver); \ No newline at end of file diff --git a/example/peripheral/usb/pusb2_device/src/pusb2_mass_storage_example.c b/example/peripheral/usb/pusb2_device/src/pusb2_mass_storage_example.c new file mode 100644 index 0000000000000000000000000000000000000000..3b102cc870a24fe35e96bf4fb6a135cd0cbcc4f1 --- /dev/null +++ b/example/peripheral/usb/pusb2_device/src/pusb2_mass_storage_example.c @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2024, sakumisu + * + * SPDX-License-Identifier: Apache-2.0 + */ +/* + * Copyright : (C) 2023 Phytium Information Technology, Inc. + * All Rights Reserved. + * + * This program is OPEN SOURCE software: you can redistribute it and/or modify it + * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, + * either version 1.0 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Phytium Public License for more details. + * + * + * FilePath: pusb2_mass_storage_example.c + * Date: 2022-02-10 14:53:42 + * LastEditTime: 2022-02-17 17:46:03 + * Description:  This file is for pusb2 cherryusb mass storage example function implmentation + * + * Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + * 1.0 zhugengyu 2023/7/18 first release + */ + +/***************************** Include Files *********************************/ +#include +#include + +#include "ftypes.h" +#include "ferror_code.h" + +#include "sdkconfig.h" +#ifndef SDK_CONFIG_H__ + #warning "Please include sdkconfig.h" +#endif + +#include "usbd_core.h" +#include "usbd_cdc.h" +#include "usbd_msc.h" + +#include "pusb2_mass_storage_example.h" +/************************** Constant Definitions *****************************/ + +/**************************** Type Definitions *******************************/ + +/************************** Variable Definitions *****************************/ + +/***************** Macros (Inline Functions) Definitions *********************/ + +/************************** Function Prototypes ******************************/ + +/************************** Function *****************************************/ + + +#define MSC_IN_EP 0x81 +#define MSC_OUT_EP 0x02 + +#define USBD_VID 0xFFFF +#define USBD_PID 0xFFFF +#define USBD_MAX_POWER 100 +#define USBD_LANGID_STRING 1033 + +#define USB_CONFIG_SIZE (9 + MSC_DESCRIPTOR_LEN) + +#ifdef CONFIG_USB_HS +#define MSC_MAX_MPS 512 +#else +#define MSC_MAX_MPS 64 +#endif + +const uint8_t msc_ram_descriptor[] = { + USB_DEVICE_DESCRIPTOR_INIT(USB_2_0, 0x00, 0x00, 0x00, USBD_VID, USBD_PID, 0x0200, 0x01), + USB_CONFIG_DESCRIPTOR_INIT(USB_CONFIG_SIZE, 0x01, 0x01, USB_CONFIG_BUS_POWERED, USBD_MAX_POWER), + MSC_DESCRIPTOR_INIT(0x00, MSC_OUT_EP, MSC_IN_EP, MSC_MAX_MPS, 0x02), + /////////////////////////////////////// + /// string0 descriptor + /////////////////////////////////////// + USB_LANGID_INIT(USBD_LANGID_STRING), + /////////////////////////////////////// + /// string1 descriptor + /////////////////////////////////////// + 0x14, /* bLength */ + USB_DESCRIPTOR_TYPE_STRING, /* bDescriptorType */ + 'C', 0x00, /* wcChar0 */ + 'h', 0x00, /* wcChar1 */ + 'e', 0x00, /* wcChar2 */ + 'r', 0x00, /* wcChar3 */ + 'r', 0x00, /* wcChar4 */ + 'y', 0x00, /* wcChar5 */ + 'U', 0x00, /* wcChar6 */ + 'S', 0x00, /* wcChar7 */ + 'B', 0x00, /* wcChar8 */ + /////////////////////////////////////// + /// string2 descriptor + /////////////////////////////////////// + 0x26, /* bLength */ + USB_DESCRIPTOR_TYPE_STRING, /* bDescriptorType */ + 'C', 0x00, /* wcChar0 */ + 'h', 0x00, /* wcChar1 */ + 'e', 0x00, /* wcChar2 */ + 'r', 0x00, /* wcChar3 */ + 'r', 0x00, /* wcChar4 */ + 'y', 0x00, /* wcChar5 */ + 'U', 0x00, /* wcChar6 */ + 'S', 0x00, /* wcChar7 */ + 'B', 0x00, /* wcChar8 */ + ' ', 0x00, /* wcChar9 */ + 'M', 0x00, /* wcChar10 */ + 'S', 0x00, /* wcChar11 */ + 'C', 0x00, /* wcChar12 */ + ' ', 0x00, /* wcChar13 */ + 'D', 0x00, /* wcChar14 */ + 'E', 0x00, /* wcChar15 */ + 'M', 0x00, /* wcChar16 */ + 'O', 0x00, /* wcChar17 */ + /////////////////////////////////////// + /// string3 descriptor + /////////////////////////////////////// + 0x16, /* bLength */ + USB_DESCRIPTOR_TYPE_STRING, /* bDescriptorType */ + '2', 0x00, /* wcChar0 */ + '0', 0x00, /* wcChar1 */ + '2', 0x00, /* wcChar2 */ + '2', 0x00, /* wcChar3 */ + '1', 0x00, /* wcChar4 */ + '2', 0x00, /* wcChar5 */ + '3', 0x00, /* wcChar6 */ + '4', 0x00, /* wcChar7 */ + '5', 0x00, /* wcChar8 */ + '6', 0x00, /* wcChar9 */ +#ifdef CONFIG_USB_HS + /////////////////////////////////////// + /// device qualifier descriptor + /////////////////////////////////////// + 0x0a, + USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER, + 0x00, + 0x02, + 0x00, + 0x00, + 0x00, + 0x40, + 0x01, + 0x00, +#endif + 0x00 +}; + +static void usbd_event_handler(uint8_t busid, uint8_t event) +{ + switch (event) { + case USBD_EVENT_RESET: + break; + case USBD_EVENT_CONNECTED: + break; + case USBD_EVENT_DISCONNECTED: + break; + case USBD_EVENT_RESUME: + break; + case USBD_EVENT_SUSPEND: + break; + case USBD_EVENT_CONFIGURED: + break; + case USBD_EVENT_SET_REMOTE_WAKEUP: + break; + case USBD_EVENT_CLR_REMOTE_WAKEUP: + break; + + default: + break; + } +} + +#define BLOCK_SIZE 512 +#define BLOCK_COUNT 100000 + +typedef struct +{ + uint8_t BlockSpace[BLOCK_SIZE]; +} BLOCK_TYPE; + +static BLOCK_TYPE mass_block[BLOCK_COUNT] = {0}; + +void usbd_msc_get_cap(uint8_t busid, uint8_t lun, uint32_t *block_num, uint32_t *block_size) +{ + *block_num = BLOCK_COUNT; //Pretend having so many buffer,not has actually. + *block_size = BLOCK_SIZE; +} +int usbd_msc_sector_read(uint8_t busid, uint8_t lun, uint32_t sector, uint8_t *buffer, uint32_t length) +{ + if (sector < BLOCK_COUNT) + memcpy(buffer, mass_block[sector].BlockSpace, length); + return 0; +} + +int usbd_msc_sector_write(uint8_t busid, uint8_t lun, uint32_t sector, uint8_t *buffer, uint32_t length) +{ + if (sector < BLOCK_COUNT) + memcpy(mass_block[sector].BlockSpace, buffer, length); + return 0; +} + +static struct usbd_interface intf0; + +int msc_ram_init(uint8_t busid, uint32_t reg_base) +{ + usbd_desc_register(busid, msc_ram_descriptor); + usbd_add_interface(busid, usbd_msc_init_intf(busid, &intf0, MSC_OUT_EP, MSC_IN_EP)); + + return usbd_initialize(busid, reg_base, usbd_event_handler); +} + +int FPUsb2MassStorageExample(u32 id) +{ + int ret = msc_ram_init(id, usb_dc_get_register_base(id)); + + if (ret == 0) + { + printf("%s@%d: PUSB2 mass storage example [success] !!! \r\n", __func__, __LINE__); + } + else + { + printf("%s@%d: PUSB2 mass storage example [failure] !!!, ret = %d \r\n", __func__, __LINE__, ret); + return -1; + } + + return 0; +} + +void FPUsb2MassStorageExampleEnd(u32 id) +{ + usbd_deinitialize(id); +} \ No newline at end of file diff --git a/example/peripheral/usb/pusb2_device/src/pusb2_virtual_serial_example.c b/example/peripheral/usb/pusb2_device/src/pusb2_virtual_serial_example.c new file mode 100644 index 0000000000000000000000000000000000000000..4554b5a49df4e2092c3b3211eec884950ff89e74 --- /dev/null +++ b/example/peripheral/usb/pusb2_device/src/pusb2_virtual_serial_example.c @@ -0,0 +1,283 @@ +/* + * Copyright (c) 2024, sakumisu + * + * SPDX-License-Identifier: Apache-2.0 + */ +/* + * Copyright : (C) 2023 Phytium Information Technology, Inc. + * All Rights Reserved. + * + * This program is OPEN SOURCE software: you can redistribute it and/or modify it + * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, + * either version 1.0 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Phytium Public License for more details. + * + * + * FilePath: pusb2_virtual_serial_example.c + * Date: 2022-02-10 14:53:42 + * LastEditTime: 2022-02-17 17:46:03 + * Description:  This file is for pusb2 cherryusb virtual serial example function implmentation + * + * Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + * 1.0 zhugengyu 2023/7/18 first release + */ + +/***************************** Include Files *********************************/ +#include +#include + +#include "ftypes.h" +#include "ferror_code.h" + +#include "sdkconfig.h" +#ifndef SDK_CONFIG_H__ + #warning "Please include sdkconfig.h" +#endif + +#include "usbd_core.h" +#include "usbd_cdc.h" + +#include "pusb2_virtual_serial_example.h" +/************************** Constant Definitions *****************************/ + +/**************************** Type Definitions *******************************/ + +/************************** Variable Definitions *****************************/ + +/***************** Macros (Inline Functions) Definitions *********************/ + +/************************** Function Prototypes ******************************/ + +/************************** Function *****************************************/ + +/*!< endpoint address */ +#define CDC_IN_EP 0x81 +#define CDC_OUT_EP 0x02 +#define CDC_INT_EP 0x83 + +#define USBD_VID 0xFFFF +#define USBD_PID 0xFFFF +#define USBD_MAX_POWER 100 +#define USBD_LANGID_STRING 1033 + +/*!< config descriptor size */ +#define USB_CONFIG_SIZE (9 + CDC_ACM_DESCRIPTOR_LEN) + +#ifdef CONFIG_USB_HS +#define CDC_MAX_MPS 512 +#else +#define CDC_MAX_MPS 64 +#endif + +/*!< global descriptor */ +static const uint8_t cdc_descriptor[] = { + USB_DEVICE_DESCRIPTOR_INIT(USB_2_0, 0xEF, 0x02, 0x01, USBD_VID, USBD_PID, 0x0100, 0x01), + USB_CONFIG_DESCRIPTOR_INIT(USB_CONFIG_SIZE, 0x02, 0x01, USB_CONFIG_BUS_POWERED, USBD_MAX_POWER), + CDC_ACM_DESCRIPTOR_INIT(0x00, CDC_INT_EP, CDC_OUT_EP, CDC_IN_EP, CDC_MAX_MPS, 0x02), + /////////////////////////////////////// + /// string0 descriptor + /////////////////////////////////////// + USB_LANGID_INIT(USBD_LANGID_STRING), + /////////////////////////////////////// + /// string1 descriptor + /////////////////////////////////////// + 0x14, /* bLength */ + USB_DESCRIPTOR_TYPE_STRING, /* bDescriptorType */ + 'C', 0x00, /* wcChar0 */ + 'h', 0x00, /* wcChar1 */ + 'e', 0x00, /* wcChar2 */ + 'r', 0x00, /* wcChar3 */ + 'r', 0x00, /* wcChar4 */ + 'y', 0x00, /* wcChar5 */ + 'U', 0x00, /* wcChar6 */ + 'S', 0x00, /* wcChar7 */ + 'B', 0x00, /* wcChar8 */ + /////////////////////////////////////// + /// string2 descriptor + /////////////////////////////////////// + 0x26, /* bLength */ + USB_DESCRIPTOR_TYPE_STRING, /* bDescriptorType */ + 'C', 0x00, /* wcChar0 */ + 'h', 0x00, /* wcChar1 */ + 'e', 0x00, /* wcChar2 */ + 'r', 0x00, /* wcChar3 */ + 'r', 0x00, /* wcChar4 */ + 'y', 0x00, /* wcChar5 */ + 'U', 0x00, /* wcChar6 */ + 'S', 0x00, /* wcChar7 */ + 'B', 0x00, /* wcChar8 */ + ' ', 0x00, /* wcChar9 */ + 'C', 0x00, /* wcChar10 */ + 'D', 0x00, /* wcChar11 */ + 'C', 0x00, /* wcChar12 */ + ' ', 0x00, /* wcChar13 */ + 'D', 0x00, /* wcChar14 */ + 'E', 0x00, /* wcChar15 */ + 'M', 0x00, /* wcChar16 */ + 'O', 0x00, /* wcChar17 */ + /////////////////////////////////////// + /// string3 descriptor + /////////////////////////////////////// + 0x16, /* bLength */ + USB_DESCRIPTOR_TYPE_STRING, /* bDescriptorType */ + '2', 0x00, /* wcChar0 */ + '0', 0x00, /* wcChar1 */ + '2', 0x00, /* wcChar2 */ + '2', 0x00, /* wcChar3 */ + '1', 0x00, /* wcChar4 */ + '2', 0x00, /* wcChar5 */ + '3', 0x00, /* wcChar6 */ + '4', 0x00, /* wcChar7 */ + '5', 0x00, /* wcChar8 */ + '6', 0x00, /* wcChar9 */ +#ifdef CONFIG_USB_HS + /////////////////////////////////////// + /// device qualifier descriptor + /////////////////////////////////////// + 0x0a, + USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER, + 0x00, + 0x02, + 0x02, + 0x02, + 0x01, + 0x40, + 0x01, + 0x00, +#endif + 0x00 +}; + +static USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t read_buffer[2048]; /* 2048 is only for test speed , please use CDC_MAX_MPS for common*/ +static USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t write_buffer[2048]; + +static volatile bool ep_tx_busy_flag = false; + +static void usbd_event_handler(uint8_t busid, uint8_t event) +{ + switch (event) { + case USBD_EVENT_RESET: + break; + case USBD_EVENT_CONNECTED: + break; + case USBD_EVENT_DISCONNECTED: + break; + case USBD_EVENT_RESUME: + break; + case USBD_EVENT_SUSPEND: + break; + case USBD_EVENT_CONFIGURED: + ep_tx_busy_flag = false; + /* setup first out ep read transfer */ + usbd_ep_start_read(busid, CDC_OUT_EP, read_buffer, 2048); + break; + case USBD_EVENT_SET_REMOTE_WAKEUP: + break; + case USBD_EVENT_CLR_REMOTE_WAKEUP: + break; + + default: + break; + } +} + +static void usbd_cdc_acm_bulk_out(uint8_t busid, uint8_t ep, uint32_t nbytes) +{ + USB_LOG_INFO("actual out len:%d\r\n", nbytes); + /* setup next out ep read transfer */ + if (0 == usbd_ep_start_read(busid, CDC_OUT_EP, read_buffer, 2048)) + { + read_buffer[nbytes] = '\0'; + /* printout received characters */ + printf("%s", read_buffer); + fflush(stdout); + } +} + +static void usbd_cdc_acm_bulk_in(uint8_t busid, uint8_t ep, uint32_t nbytes) +{ + USB_LOG_INFO("actual in len:%d\r\n", nbytes); + if ((nbytes % usbd_get_ep_mps(busid, ep)) == 0 && nbytes) { + /* send zlp */ + usbd_ep_start_write(busid, CDC_IN_EP, NULL, 0); + } else { + ep_tx_busy_flag = false; + } +} + +/*!< endpoint call back */ +static struct usbd_endpoint cdc_out_ep = { + .ep_addr = CDC_OUT_EP, + .ep_cb = usbd_cdc_acm_bulk_out +}; + +static struct usbd_endpoint cdc_in_ep = { + .ep_addr = CDC_IN_EP, + .ep_cb = usbd_cdc_acm_bulk_in +}; + +static struct usbd_interface intf0; +static struct usbd_interface intf1; + +static int cdc_acm_init(uint8_t busid, uint32_t reg_base) +{ + const uint8_t data[10] = { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30 }; + + memcpy(&write_buffer[0], data, 10); + memset(&write_buffer[10], 'a', 2038); + + usbd_desc_register(busid, cdc_descriptor); + usbd_add_interface(busid, usbd_cdc_acm_init_intf(busid, &intf0)); + usbd_add_interface(busid, usbd_cdc_acm_init_intf(busid, &intf1)); + usbd_add_endpoint(busid, &cdc_out_ep); + usbd_add_endpoint(busid, &cdc_in_ep); + return usbd_initialize(busid, reg_base, usbd_event_handler); +} + +static volatile uint8_t dtr_enable = 0; + +void usbd_cdc_acm_set_dtr(uint8_t busid, uint8_t intf, bool dtr) +{ + if (dtr) { + dtr_enable = 1; + } else { + dtr_enable = 0; + } +} + +void cdc_acm_data_send_with_dtr_test(uint8_t busid) +{ + if (dtr_enable) { + ep_tx_busy_flag = true; + usbd_ep_start_write(busid, CDC_IN_EP, write_buffer, 2048); + while (ep_tx_busy_flag) { + } + } +} + +int FPUsb2VirtualSerialExample(u32 id) +{ + int ret = cdc_acm_init(id, usb_dc_get_register_base(id)); + + if (ret == 0) + { + printf("%s@%d: PUSB2 virtual serial example [success] !!! \r\n", __func__, __LINE__); + } + else + { + printf("%s@%d: PUSB2 virtual serial example [failure] !!!, ret = %d \r\n", __func__, __LINE__, ret); + return -1; + } + + return 0; +} + +void FPUsb2VirtualSerialExampleEnd(u32 id) +{ + usbd_deinitialize(id); +} \ No newline at end of file diff --git a/example/peripheral/usb/pusb2_host/Kconfig b/example/peripheral/usb/pusb2_host/Kconfig new file mode 100644 index 0000000000000000000000000000000000000000..10607d02dfd337248346ab3ec2d90e0aed77f733 --- /dev/null +++ b/example/peripheral/usb/pusb2_host/Kconfig @@ -0,0 +1,8 @@ +# +# For a description of the syntax of this configuration file, +# see tools/kconfiglib/kconfig-language.txt. +# + + +source "$(SDK_DIR)/../freertos.kconfig" + diff --git a/example/peripheral/usb/pusb2_host/README.md b/example/peripheral/usb/pusb2_host/README.md new file mode 100644 index 0000000000000000000000000000000000000000..4072f0882de9d0cacd11aeb62c0d7598643f182a --- /dev/null +++ b/example/peripheral/usb/pusb2_host/README.md @@ -0,0 +1,137 @@ + +# PUSB2 Host 模式测试 + +## 1. 例程介绍 + +>介绍例程的用途,使用场景,相关基本概念,描述用户可以使用例程完成哪些工作
+ +CherryUSB 是一个用于嵌入式系统 USB 协议栈,支持运行在 Host 模式和 Device 模式,本例程演示了开发板 USB 运行在 Host 模式下,可以识别外接的 U 盘和鼠标,并完成基本功能 + +## 2. 如何使用例程 + +>描述开发平台准备,使用例程配置,构建和下载镜像的过程
+ +### 2.1 硬件配置方法 + +>哪些硬件平台是支持的,需要哪些外设,例程与开发板哪些IO口相关等(建议附录开发板照片,展示哪些IO口被引出)
+ +本例程在 E2000 平台测试通过,您可以参考以下方法配置本例程所需要的硬件和软件环境, +- E2000开发板 +- 本例程基于E2000 Demo 开发板,使用logitech键盘、Dell鼠标和Sandisk盘完成测试 + +### 2.2 SDK配置方法 + +>依赖哪些驱动、库和第三方组件,如何完成配置(列出需要使能的关键配置项)
+ +本例程需要的配置包括, +- Letter Shell组件,依赖 USE_LETTER_SHELL + +本例子已经提供好具体的编译指令,以下进行介绍: +- make 将目录下的工程进行编译 +- make clean 将目录下的工程进行清理 +- make boot 将目录下的工程进行编译,并将生成的elf 复制到目标地址 +- make load_e2000d_aarch64 将预设64bit e2000d 下的配置加载至工程中 +- make load_e2000d_aarch32 将预设32bit e2000d 下的配置加载至工程中 +- make load_e2000q_aarch64 将预设64bit e2000q 下的配置加载至工程中 +- make load_e2000q_aarch32 将预设32bit e2000q 下的配置加载至工程中 +- make menuconfig 配置目录下的参数变量 +- make backup_kconfig 将目录下的sdkconfig 备份到./configs下 + +- 具体使用方法为: + - 在当前目录下 + - 执行以上指令 + +### 2.3 构建和下载 + +>描述构建、烧录下载镜像的过程,列出相关的命令
+ +使用例程的一般过程为 + +- 选择目标平台和例程需要的配置 +``` +make load_e2000d_aarch64 +``` + +- 进行编译 +``` +make +``` + +- 将编译出的镜像放置到tftp目录下 +``` +make boot +``` + +- host侧设置重启host侧tftp服务器 +``` +sudo service tftpd-hpa restart +``` + +- 开发板侧使用bootelf命令跳转 +``` +setenv ipaddr 192.168.4.20 +setenv serverip 192.168.4.30 +setenv gatewayip 192.168.4.1 +tftpboot 0x90100000 freertos.elf +bootelf -p 0x90100000 +``` + +### 2.4 输出与实验现象 + +>描述输入输出情况,列出存在哪些输出,对应的输出是什么(建议附录相关现象图片)
+ + +#### 2.4.1 读写 U 盘 + +- 将 U 盘插在 USB-0 口,初始化 USB 0号控制器后,查看 U 盘设备是否枚举成功,然后通过枚举成功后返回的设备路径`/usb0/sda`读写 U 盘 + +![usb_disk](./figs/usb_disk.jpeg) + +- 输入下列命令,启动任务开始识别 U 盘 + +``` +usb init 0 +usb lsusb 0 -t +usb disk /usb0/sda +``` + +![find_usb_disk](./figs/find_usb_disk.png) + +#### 2.4.2 获取键盘和鼠标输入 + +- 将键盘/鼠标插在 USB-0 口,初始化 USB-0 控制器,查看键盘和鼠标是否枚举成功,通过枚举成功后返回的设备路径`/usb0/kbd0`以及`/usb0/mouse1`,开启键盘和鼠标输入后进行读取 + +- 输入下列命令,启动任务开始识别和使用键盘 + +``` +usb init 0 +usb lsusb 0 -t +usb kbd /usb0/kbd0 +``` + +![](./figs/find_usb_kbd.png) + +- 输入下列命令,启动任务开始识别和使用鼠标 + +``` +usb init 0 +usb lsusb 1 -t +usb mouse /usb0/mouse0 +``` + +![](./figs/find_usb_mouse.png) + +- 上图中,首先打印的是通过 USB 键盘输入的字符串,已经一系列特殊字符,然后是鼠标的输入,x和y是鼠标的平面坐标位置,w是鼠标中间滚轮的位置,<-、-> 和 C 分别是按下鼠标左、右键和中间滚轮后的返回 + +## 3. 如何解决问题 + +>主要记录使用例程中可能会遇到的问题,给出相应的解决方案
+ +## 4. 修改历史记录 + +>记录例程的重大修改记录,标明修改发生的版本号
+ +- V1.1.0 首次合入 + + + diff --git a/example/peripheral/usb/pusb2_host/configs/phytiumpi_aarch32_firefly_pusb2.config b/example/peripheral/usb/pusb2_host/configs/phytiumpi_aarch32_firefly_pusb2.config new file mode 100644 index 0000000000000000000000000000000000000000..74a776edfabaff479194513a76561f1773a1ea67 --- /dev/null +++ b/example/peripheral/usb/pusb2_host/configs/phytiumpi_aarch32_firefly_pusb2.config @@ -0,0 +1,370 @@ +CONFIG_USE_FREERTOS=y + +# +# Arch configuration +# +CONFIG_TARGET_ARMv8=y +CONFIG_ARCH_NAME="armv8" + +# +# Arm architecture configuration +# +# CONFIG_ARCH_ARMV8_AARCH64 is not set +CONFIG_ARCH_ARMV8_AARCH32=y + +# +# Compiler configuration +# +CONFIG_ARM_GCC_SELECT=y +# CONFIG_ARM_CLANG_SELECT is not set +CONFIG_TOOLCHAIN_NAME="gcc" +CONFIG_TARGET_ARMV8_AARCH32=y +CONFIG_ARCH_EXECUTION_STATE="aarch32" + +# +# Fpu configuration +# +CONFIG_CRYPTO_NEON_FP_ARMV8=y +# CONFIG_VFPV4 is not set +# CONFIG_VFPV4_D16 is not set +# CONFIG_VFPV3 is not set +# CONFIG_VFPV3_D16 is not set +CONFIG_ARM_MFPU="crypto-neon-fp-armv8" +CONFIG_MFLOAT_ABI_HARD=y +# CONFIG_MFLOAT_ABI_SOFTFP is not set +CONFIG_ARM_MFLOAT_ABI="hard" +# end of Fpu configuration +# end of Compiler configuration + +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arm architecture configuration + +CONFIG_MMU_PAGE_SIZE=0x1000 +CONFIG_FMMU_NUM_L2_TABLES=256 +# end of Arch configuration + +# +# Soc configuration +# +CONFIG_TARGET_PHYTIUMPI=y +# CONFIG_TARGET_E2000Q is not set +# CONFIG_TARGET_E2000D is not set +# CONFIG_TARGET_E2000S is not set +# CONFIG_TARGET_FT2004 is not set +# CONFIG_TARGET_D2000 is not set +# CONFIG_TARGET_PD2308 is not set +CONFIG_SOC_NAME="phytiumpi" +CONFIG_SOC_CORE_NUM=4 +CONFIG_F32BIT_MEMORY_ADDRESS=0x80000000 +CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 +CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 +CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 +CONFIG_TARGET_E2000=y +CONFIG_DEFAULT_DEBUG_PRINT_UART1=y +# CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set +# CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set +# end of Soc configuration + +# +# Board Configuration +# +CONFIG_BOARD_NAME="firefly" +# CONFIG_USE_SPI_IOPAD is not set +# CONFIG_USE_GPIO_IOPAD is not set +# CONFIG_USE_CAN_IOPAD is not set +# CONFIG_USE_QSPI_IOPAD is not set +# CONFIG_USE_PWM_IOPAD is not set +# CONFIG_USE_MIO_IOPAD is not set +# CONFIG_USE_TACHO_IOPAD is not set +# CONFIG_USE_UART_IOPAD is not set +# CONFIG_USE_THIRD_PARTY_IOPAD is not set +CONFIG_FIREFLY_DEMO_BOARD=y + +# +# IO mux configuration when board start up +# +# end of IO mux configuration when board start up + +# CONFIG_CUS_DEMO_BOARD is not set + +# +# Build project name +# +CONFIG_TARGET_NAME="pusb2" +# end of Build project name +# end of Board Configuration + +# +# Sdk common configuration +# +CONFIG_ELOG_LINE_BUF_SIZE=0x100 +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +# CONFIG_LOG_INFO is not set +# CONFIG_LOG_WARN is not set +CONFIG_LOG_ERROR=y +# CONFIG_LOG_NONE is not set +CONFIG_LOG_EXTRA_INFO=y +# CONFIG_LOG_DISPALY_CORE_NUM is not set +# CONFIG_BOOTUP_DEBUG_PRINTS is not set +CONFIG_USE_DEFAULT_INTERRUPT_CONFIG=y +CONFIG_INTERRUPT_ROLE_MASTER=y +# CONFIG_INTERRUPT_ROLE_SLAVE is not set +# end of Sdk common configuration + +# +# Drivers configuration +# +CONFIG_USE_IOMUX=y +# CONFIG_ENABLE_IOCTRL is not set +CONFIG_ENABLE_IOPAD=y +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_ETH is not set +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_MIO is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# CONFIG_USE_SATA is not set +# CONFIG_USE_ADC is not set +# CONFIG_USE_PWM is not set +# CONFIG_USE_IPC is not set +# CONFIG_USE_MEDIA is not set +# CONFIG_USE_SCMI_MHU is not set +# CONFIG_USE_I2S is not set +# CONFIG_USE_I3C is not set +# end of Drivers configuration + +# +# Build setup +# +CONFIG_CHECK_DEPS=y +CONFIG_OUTPUT_BINARY=y + +# +# Optimization options +# +CONFIG_DEBUG_NOOPT=y +# CONFIG_DEBUG_CUSTOMOPT is not set +# CONFIG_DEBUG_FULLOPT is not set +CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y +CONFIG_DEBUG_LINK_MAP=y +# CONFIG_CCACHE is not set +# CONFIG_ARCH_COVERAGE is not set +# CONFIG_LTO_FULL is not set +# end of Optimization options + +# +# Debug options +# +# CONFIG_DEBUG_ENABLE_ALL_WARNING is not set +# CONFIG_WALL_WARNING_ERROR is not set +# CONFIG_STRICT_PROTOTYPES is not set +CONFIG_DEBUG_SYMBOLS=y +CONFIG_FRAME_POINTER=y +CONFIG_OUTPUT_ASM_DIS=y +# CONFIG_ENABLE_WSHADOW is not set +# CONFIG_ENABLE_WUNDEF is not set +CONFIG_DOWNGRADE_DIAG_WARNING=y +# end of Debug options + +# +# Lib +# +CONFIG_USE_COMPILE_CHAIN=y +# CONFIG_USE_NEWLIB is not set +# CONFIG_USE_USER_DEFINED is not set +# end of Lib + +# CONFIG_ENABLE_CXX is not set + +# +# Linker Options +# +CONFIG_DEFAULT_LINKER_SCRIPT=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_IMAGE_LOAD_ADDRESS=0x80100000 +CONFIG_IMAGE_MAX_LENGTH=0x5000000 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Build setup + +# +# Component Configuration +# + +# +# Freertos Uart Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Uart Drivers + +# +# Freertos Pwm Drivers +# +# CONFIG_FREERTOS_USE_PWM is not set +# end of Freertos Pwm Drivers + +# +# Freertos Qspi Drivers +# +# CONFIG_FREERTOS_USE_QSPI is not set +# end of Freertos Qspi Drivers + +# +# Freertos Wdt Drivers +# +# CONFIG_FREERTOS_USE_WDT is not set +# end of Freertos Wdt Drivers + +# +# Freertos Eth Drivers +# +# CONFIG_FREERTOS_USE_XMAC is not set +# CONFIG_FREERTOS_USE_GMAC is not set +# end of Freertos Eth Drivers + +# +# Freertos Spim Drivers +# +# CONFIG_FREERTOS_USE_FSPIM is not set +# end of Freertos Spim Drivers + +# +# Freertos DMA Drivers +# +# CONFIG_FREERTOS_USE_FDDMA is not set +# CONFIG_FREERTOS_USE_FGDMA is not set +# end of Freertos DMA Drivers + +# +# Freertos Adc Drivers +# +# CONFIG_FREERTOS_USE_ADC is not set +# end of Freertos Adc Drivers + +# +# Freertos Can Drivers +# +# CONFIG_FREERTOS_USE_CAN is not set +# end of Freertos Can Drivers + +# +# Freertos I2c Drivers +# +# CONFIG_FREERTOS_USE_I2C is not set +# end of Freertos I2c Drivers + +# +# Freertos Mio Drivers +# +# CONFIG_FREERTOS_USE_MIO is not set +# end of Freertos Mio Drivers + +# +# Freertos Timer Drivers +# +# CONFIG_FREERTOS_USE_TIMER is not set +# end of Freertos Timer Drivers + +# +# Freertos Media Drivers +# +# CONFIG_FREERTOS_USE_MEDIA is not set +# end of Freertos Media Drivers + +# +# Freertos I2s Drivers +# +# CONFIG_FREERTOS_USE_I2S is not set +# end of Freertos I2s Drivers +# end of Component Configuration + +# +# Third-party configuration +# +# CONFIG_USE_LWIP is not set +CONFIG_USE_LETTER_SHELL=y + +# +# Letter Shell Configuration +# +CONFIG_LS_PL011_UART=y +CONFIG_DEFAULT_LETTER_SHELL_USE_UART1=y +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set +# end of Letter Shell Configuration + +# CONFIG_USE_AMP is not set +# CONFIG_USE_YMODEM is not set +# CONFIG_USE_SFUD is not set +CONFIG_USE_BACKTRACE=y +# CONFIG_USE_FATFS_0_1_4 is not set +CONFIG_USE_TLSF=y +# CONFIG_USE_SPIFFS is not set +# CONFIG_USE_LITTLE_FS is not set +# CONFIG_USE_LVGL is not set +# CONFIG_USE_FREEMODBUS is not set +CONFIG_USE_CHERRY_USB=y + +# +# CherryUSB Configuration +# +# CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +CONFIG_CHERRY_USB_PORT_PUSB2=y +CONFIG_CHERRYUSB_HOST=y +# CONFIG_CHERRYUSB_DEVICE is not set +CONFIG_CHERRY_USB_HOST_HUB=y +CONFIG_CHERRY_USB_HOST_MSC=y +CONFIG_CHERRY_USB_HOST_HID=y +# end of CherryUSB Configuration + +# CONFIG_USE_FSL_SDMMC is not set +# CONFIG_USE_FSL_WIFI is not set +# end of Third-party configuration + +# +# FreeRTOS Kernel Configuration +# +CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_MAX_PRIORITIES=32 +CONFIG_FREERTOS_KERNEL_INTERRUPT_PRIORITIES=13 +CONFIG_FREERTOS_MAX_API_CALL_INTERRUPT_PRIORITIES=11 +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +CONFIG_FREERTOS_MINIMAL_TASK_STACKSIZE=1024 +CONFIG_FREERTOS_MAX_TASK_NAME_LEN=32 +CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y +# CONFIG_FREERTOS_USE_TICKLESS_IDLE is not set +CONFIG_FREERTOS_TOTAL_HEAP_SIZE=10240 +CONFIG_FREERTOS_TASK_FPU_SUPPORT=1 +# CONFIG_FREERTOS_USE_POSIX is not set +# end of FreeRTOS Kernel Configuration diff --git a/example/peripheral/usb/pusb2_host/configs/phytiumpi_aarch64_firefly_pusb2.config b/example/peripheral/usb/pusb2_host/configs/phytiumpi_aarch64_firefly_pusb2.config new file mode 100644 index 0000000000000000000000000000000000000000..6e284831b0a9c029b27d33b2e792049b2d352f97 --- /dev/null +++ b/example/peripheral/usb/pusb2_host/configs/phytiumpi_aarch64_firefly_pusb2.config @@ -0,0 +1,359 @@ +CONFIG_USE_FREERTOS=y + +# +# Arch configuration +# +CONFIG_TARGET_ARMv8=y +CONFIG_ARCH_NAME="armv8" + +# +# Arm architecture configuration +# +CONFIG_ARCH_ARMV8_AARCH64=y +# CONFIG_ARCH_ARMV8_AARCH32 is not set + +# +# Compiler configuration +# +CONFIG_ARM_GCC_SELECT=y +# CONFIG_ARM_CLANG_SELECT is not set +CONFIG_TOOLCHAIN_NAME="gcc" +CONFIG_TARGET_ARMV8_AARCH64=y +CONFIG_ARCH_EXECUTION_STATE="aarch64" +CONFIG_ARM_NEON=y +CONFIG_ARM_CRC=y +CONFIG_ARM_CRYPTO=y +CONFIG_ARM_FLOAT_POINT=y +# CONFIG_GCC_CODE_MODEL_TINY is not set +CONFIG_GCC_CODE_MODEL_SMALL=y +# CONFIG_GCC_CODE_MODEL_LARGE is not set +# end of Compiler configuration + +CONFIG_BOOT_WITH_FLUSH_CACHE=y +# CONFIG_MMU_DEBUG_PRINTS is not set +# end of Arm architecture configuration + +CONFIG_MMU_PAGE_SIZE=0x1000 +CONFIG_MAX_XLAT_TABLES=256 +# end of Arch configuration + +# +# Soc configuration +# +CONFIG_TARGET_PHYTIUMPI=y +# CONFIG_TARGET_E2000Q is not set +# CONFIG_TARGET_E2000D is not set +# CONFIG_TARGET_E2000S is not set +# CONFIG_TARGET_FT2004 is not set +# CONFIG_TARGET_D2000 is not set +# CONFIG_TARGET_PD2308 is not set +CONFIG_SOC_NAME="phytiumpi" +CONFIG_SOC_CORE_NUM=4 +CONFIG_F32BIT_MEMORY_ADDRESS=0x80000000 +CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 +CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 +CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 +CONFIG_TARGET_E2000=y +CONFIG_DEFAULT_DEBUG_PRINT_UART1=y +# CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set +# CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set +# end of Soc configuration + +# +# Board Configuration +# +CONFIG_BOARD_NAME="firefly" +# CONFIG_USE_SPI_IOPAD is not set +# CONFIG_USE_GPIO_IOPAD is not set +# CONFIG_USE_CAN_IOPAD is not set +# CONFIG_USE_QSPI_IOPAD is not set +# CONFIG_USE_PWM_IOPAD is not set +# CONFIG_USE_MIO_IOPAD is not set +# CONFIG_USE_TACHO_IOPAD is not set +# CONFIG_USE_UART_IOPAD is not set +# CONFIG_USE_THIRD_PARTY_IOPAD is not set +CONFIG_FIREFLY_DEMO_BOARD=y + +# +# IO mux configuration when board start up +# +# end of IO mux configuration when board start up + +# CONFIG_CUS_DEMO_BOARD is not set + +# +# Build project name +# +CONFIG_TARGET_NAME="pusb2" +# end of Build project name +# end of Board Configuration + +# +# Sdk common configuration +# +CONFIG_ELOG_LINE_BUF_SIZE=0x100 +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +# CONFIG_LOG_INFO is not set +# CONFIG_LOG_WARN is not set +CONFIG_LOG_ERROR=y +# CONFIG_LOG_NONE is not set +CONFIG_LOG_EXTRA_INFO=y +# CONFIG_LOG_DISPALY_CORE_NUM is not set +# CONFIG_BOOTUP_DEBUG_PRINTS is not set +CONFIG_USE_DEFAULT_INTERRUPT_CONFIG=y +CONFIG_INTERRUPT_ROLE_MASTER=y +# CONFIG_INTERRUPT_ROLE_SLAVE is not set +# end of Sdk common configuration + +# +# Drivers configuration +# +CONFIG_USE_IOMUX=y +# CONFIG_ENABLE_IOCTRL is not set +CONFIG_ENABLE_IOPAD=y +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_ETH is not set +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_MIO is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# CONFIG_USE_SATA is not set +# CONFIG_USE_ADC is not set +# CONFIG_USE_PWM is not set +# CONFIG_USE_IPC is not set +# CONFIG_USE_MEDIA is not set +# CONFIG_USE_SCMI_MHU is not set +# CONFIG_USE_I2S is not set +# CONFIG_USE_I3C is not set +# end of Drivers configuration + +# +# Build setup +# +CONFIG_CHECK_DEPS=y +CONFIG_OUTPUT_BINARY=y + +# +# Optimization options +# +CONFIG_DEBUG_NOOPT=y +# CONFIG_DEBUG_CUSTOMOPT is not set +# CONFIG_DEBUG_FULLOPT is not set +CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y +CONFIG_DEBUG_LINK_MAP=y +# CONFIG_CCACHE is not set +# CONFIG_ARCH_COVERAGE is not set +# CONFIG_LTO_FULL is not set +# end of Optimization options + +# +# Debug options +# +# CONFIG_DEBUG_ENABLE_ALL_WARNING is not set +# CONFIG_WALL_WARNING_ERROR is not set +# CONFIG_STRICT_PROTOTYPES is not set +CONFIG_DEBUG_SYMBOLS=y +CONFIG_FRAME_POINTER=y +CONFIG_OUTPUT_ASM_DIS=y +# CONFIG_ENABLE_WSHADOW is not set +# CONFIG_ENABLE_WUNDEF is not set +CONFIG_DOWNGRADE_DIAG_WARNING=y +# end of Debug options + +# +# Lib +# +CONFIG_USE_COMPILE_CHAIN=y +# CONFIG_USE_NEWLIB is not set +# CONFIG_USE_USER_DEFINED is not set +# end of Lib + +# CONFIG_ENABLE_CXX is not set + +# +# Linker Options +# +CONFIG_DEFAULT_LINKER_SCRIPT=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_IMAGE_LOAD_ADDRESS=0x80100000 +CONFIG_IMAGE_MAX_LENGTH=0x5000000 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Build setup + +# +# Component Configuration +# + +# +# Freertos Uart Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Uart Drivers + +# +# Freertos Pwm Drivers +# +# CONFIG_FREERTOS_USE_PWM is not set +# end of Freertos Pwm Drivers + +# +# Freertos Qspi Drivers +# +# CONFIG_FREERTOS_USE_QSPI is not set +# end of Freertos Qspi Drivers + +# +# Freertos Wdt Drivers +# +# CONFIG_FREERTOS_USE_WDT is not set +# end of Freertos Wdt Drivers + +# +# Freertos Eth Drivers +# +# CONFIG_FREERTOS_USE_XMAC is not set +# CONFIG_FREERTOS_USE_GMAC is not set +# end of Freertos Eth Drivers + +# +# Freertos Spim Drivers +# +# CONFIG_FREERTOS_USE_FSPIM is not set +# end of Freertos Spim Drivers + +# +# Freertos DMA Drivers +# +# CONFIG_FREERTOS_USE_FDDMA is not set +# CONFIG_FREERTOS_USE_FGDMA is not set +# end of Freertos DMA Drivers + +# +# Freertos Adc Drivers +# +# CONFIG_FREERTOS_USE_ADC is not set +# end of Freertos Adc Drivers + +# +# Freertos Can Drivers +# +# CONFIG_FREERTOS_USE_CAN is not set +# end of Freertos Can Drivers + +# +# Freertos I2c Drivers +# +# CONFIG_FREERTOS_USE_I2C is not set +# end of Freertos I2c Drivers + +# +# Freertos Mio Drivers +# +# CONFIG_FREERTOS_USE_MIO is not set +# end of Freertos Mio Drivers + +# +# Freertos Timer Drivers +# +# CONFIG_FREERTOS_USE_TIMER is not set +# end of Freertos Timer Drivers + +# +# Freertos Media Drivers +# +# CONFIG_FREERTOS_USE_MEDIA is not set +# end of Freertos Media Drivers + +# +# Freertos I2s Drivers +# +# CONFIG_FREERTOS_USE_I2S is not set +# end of Freertos I2s Drivers +# end of Component Configuration + +# +# Third-party configuration +# +# CONFIG_USE_LWIP is not set +CONFIG_USE_LETTER_SHELL=y + +# +# Letter Shell Configuration +# +CONFIG_LS_PL011_UART=y +CONFIG_DEFAULT_LETTER_SHELL_USE_UART1=y +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set +# end of Letter Shell Configuration + +# CONFIG_USE_AMP is not set +# CONFIG_USE_YMODEM is not set +# CONFIG_USE_SFUD is not set +CONFIG_USE_BACKTRACE=y +# CONFIG_USE_FATFS_0_1_4 is not set +CONFIG_USE_TLSF=y +# CONFIG_USE_SPIFFS is not set +# CONFIG_USE_LITTLE_FS is not set +# CONFIG_USE_LVGL is not set +# CONFIG_USE_FREEMODBUS is not set +CONFIG_USE_CHERRY_USB=y + +# +# CherryUSB Configuration +# +# CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +CONFIG_CHERRY_USB_PORT_PUSB2=y +CONFIG_CHERRYUSB_HOST=y +# CONFIG_CHERRYUSB_DEVICE is not set +CONFIG_CHERRY_USB_HOST_HUB=y +CONFIG_CHERRY_USB_HOST_MSC=y +CONFIG_CHERRY_USB_HOST_HID=y +# end of CherryUSB Configuration + +# CONFIG_USE_FSL_SDMMC is not set +# CONFIG_USE_FSL_WIFI is not set +# end of Third-party configuration + +# +# FreeRTOS Kernel Configuration +# +CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_MAX_PRIORITIES=32 +CONFIG_FREERTOS_KERNEL_INTERRUPT_PRIORITIES=13 +CONFIG_FREERTOS_MAX_API_CALL_INTERRUPT_PRIORITIES=11 +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +CONFIG_FREERTOS_MINIMAL_TASK_STACKSIZE=1024 +CONFIG_FREERTOS_MAX_TASK_NAME_LEN=32 +CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y +# CONFIG_FREERTOS_USE_TICKLESS_IDLE is not set +CONFIG_FREERTOS_TOTAL_HEAP_SIZE=10240 +CONFIG_FREERTOS_TASK_FPU_SUPPORT=1 +# CONFIG_FREERTOS_USE_POSIX is not set +# end of FreeRTOS Kernel Configuration diff --git a/example/peripheral/usb/pusb2_host/figs/find_usb_disk.png b/example/peripheral/usb/pusb2_host/figs/find_usb_disk.png new file mode 100644 index 0000000000000000000000000000000000000000..cfdcc220c03973c54cfbff1ca317aa252822a695 Binary files /dev/null and b/example/peripheral/usb/pusb2_host/figs/find_usb_disk.png differ diff --git a/example/peripheral/usb/pusb2_host/figs/find_usb_kbd.png b/example/peripheral/usb/pusb2_host/figs/find_usb_kbd.png new file mode 100644 index 0000000000000000000000000000000000000000..7fc65c7f2d966e6998852c77e9dcac6627712bea Binary files /dev/null and b/example/peripheral/usb/pusb2_host/figs/find_usb_kbd.png differ diff --git a/example/peripheral/usb/pusb2_host/figs/find_usb_mouse.png b/example/peripheral/usb/pusb2_host/figs/find_usb_mouse.png new file mode 100644 index 0000000000000000000000000000000000000000..a297e43fe0c3655da004e6c66df38974e2636512 Binary files /dev/null and b/example/peripheral/usb/pusb2_host/figs/find_usb_mouse.png differ diff --git a/example/peripheral/usb/pusb2_host/figs/usb_disk.jpeg b/example/peripheral/usb/pusb2_host/figs/usb_disk.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..d19e3f3e39124a7dc94ba2931c78d93b97cd73d8 Binary files /dev/null and b/example/peripheral/usb/pusb2_host/figs/usb_disk.jpeg differ diff --git a/example/peripheral/usb/pusb2_host/inc/pusb2_host_example.h b/example/peripheral/usb/pusb2_host/inc/pusb2_host_example.h new file mode 100644 index 0000000000000000000000000000000000000000..8336687d6534529110feb9437a896e121278ce69 --- /dev/null +++ b/example/peripheral/usb/pusb2_host/inc/pusb2_host_example.h @@ -0,0 +1,54 @@ +/* + * Copyright : (C) 2022 Phytium Information Technology, Inc. + * All Rights Reserved. + * + * This program is OPEN SOURCE software: you can redistribute it and/or modify it + * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, + * either version 1.0 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Phytium Public License for more details. + * + * + * FilePath: pusb2_host_example.h + * Date: 2022-07-19 09:26:25 + * LastEditTime: 2022-07-19 09:26:25 + * Description:  This file is for the xhci host definition. + * + * Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + * 1.0 zhugengyu 2022/9/20 init commit + * 2.0 zhugengyu 2024/7/1 support auto-run + */ +#ifndef PUSB2_HOST_EXAMPLE_H +#define PUSB2_HOST_EXAMPLE_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/***************************** Include Files *********************************/ + +/************************** Constant Definitions *****************************/ + +/************************** Variable Definitions *****************************/ + +/***************** Macros (Inline Functions) Definitions *********************/ + +/************************** Function Prototypes ******************************/ +unsigned long usb_hc_get_register_base(uint32_t id); + +/*****************************************************************************/ +BaseType_t FFreeRTOSRunPUSB2Disk(u32 id, const char *devname); +BaseType_t FFreeRTOSRunPUSB2DiskBench(u32 id, const char *devname); +BaseType_t FFreeRTOSRunPUSB2Keyboard(u32 id, const char *devname); +BaseType_t FFreeRTOSRunPUSB2Mouse(u32 id, const char *devname); + +#ifdef __cplusplus +} +#endif + +#endif \ No newline at end of file diff --git a/example/peripheral/usb/pusb2_host/main.c b/example/peripheral/usb/pusb2_host/main.c new file mode 100644 index 0000000000000000000000000000000000000000..b1c1a3a505a8ef6083af9f513d69dfbaa9fcf896 --- /dev/null +++ b/example/peripheral/usb/pusb2_host/main.c @@ -0,0 +1,45 @@ +/* + * Copyright : (C) 2022 Phytium Information Technology, Inc. + * All Rights Reserved. + * + * This program is OPEN SOURCE software: you can redistribute it and/or modify it + * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, + * either version 1.0 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Phytium Public License for more details. + * + * + * FilePath: main.c + * Date: 2022-06-17 08:17:59 + * LastEditTime: 2022-06-17 08:17:59 + * Description:  This file is for cherry-usb test main entry. + * + * Modify History: + * Ver   Who         Date         Changes + * ----- ------     --------    -------------------------------------- + * 1.0 zhugengyu 2022/10/19 init commit + */ + +#include "shell.h" +#include "shell_port.h" +#include + +int main(void) +{ + BaseType_t ret; + + ret = LSUserShellTask(); + if (ret != pdPASS) + { + goto FAIL_EXIT; + } + + vTaskStartScheduler(); /* 启动任务,开启调度 */ + while (1); /* 正常不会执行到这里 */ + +FAIL_EXIT: + printf("Failed,the ret value is 0x%x. \r\n", ret); + return 0; +} diff --git a/example/peripheral/usb/pusb2_host/makefile b/example/peripheral/usb/pusb2_host/makefile new file mode 100644 index 0000000000000000000000000000000000000000..fa6e0111b8f45c7d0ea072b3744b93d611340f03 --- /dev/null +++ b/example/peripheral/usb/pusb2_host/makefile @@ -0,0 +1,29 @@ +PROJECT_DIR = $(CURDIR) +FREERTOS_SDK_DIR = $(CURDIR)/../../../.. +# # 设置启动镜像名 +BOOT_IMG_NAME ?= freertos + +USER_CSRC := main.c +USER_CSRC += $(wildcard src/*.c) + +USER_ASRC := +USER_CXXSRC := + +USER_INCLUDE := $(PROJECT_DIR) \ + $(PROJECT_DIR)/inc \ + + +include $(FREERTOS_SDK_DIR)/tools/makeall.mk + +ifeq ($(OS),Windows_NT) +USR_BOOT_DIR ?= D:\\tftpboot +else +USR_BOOT_DIR ?= /mnt/d/tftpboot +endif + +image: all + @cp ./$(IMAGE_OUT_NAME).elf $(USR_BOOT_DIR)/freertos.elf +ifdef CONFIG_OUTPUT_BINARY + @cp ./$(IMAGE_OUT_NAME).bin $(USR_BOOT_DIR)/freertos.bin +endif + @ls $(USR_BOOT_DIR)/$(BOOT_IMG_NAME).* -l \ No newline at end of file diff --git a/example/peripheral/usb/pusb2_host/sdkconfig b/example/peripheral/usb/pusb2_host/sdkconfig new file mode 100644 index 0000000000000000000000000000000000000000..6e284831b0a9c029b27d33b2e792049b2d352f97 --- /dev/null +++ b/example/peripheral/usb/pusb2_host/sdkconfig @@ -0,0 +1,359 @@ +CONFIG_USE_FREERTOS=y + +# +# Arch configuration +# +CONFIG_TARGET_ARMv8=y +CONFIG_ARCH_NAME="armv8" + +# +# Arm architecture configuration +# +CONFIG_ARCH_ARMV8_AARCH64=y +# CONFIG_ARCH_ARMV8_AARCH32 is not set + +# +# Compiler configuration +# +CONFIG_ARM_GCC_SELECT=y +# CONFIG_ARM_CLANG_SELECT is not set +CONFIG_TOOLCHAIN_NAME="gcc" +CONFIG_TARGET_ARMV8_AARCH64=y +CONFIG_ARCH_EXECUTION_STATE="aarch64" +CONFIG_ARM_NEON=y +CONFIG_ARM_CRC=y +CONFIG_ARM_CRYPTO=y +CONFIG_ARM_FLOAT_POINT=y +# CONFIG_GCC_CODE_MODEL_TINY is not set +CONFIG_GCC_CODE_MODEL_SMALL=y +# CONFIG_GCC_CODE_MODEL_LARGE is not set +# end of Compiler configuration + +CONFIG_BOOT_WITH_FLUSH_CACHE=y +# CONFIG_MMU_DEBUG_PRINTS is not set +# end of Arm architecture configuration + +CONFIG_MMU_PAGE_SIZE=0x1000 +CONFIG_MAX_XLAT_TABLES=256 +# end of Arch configuration + +# +# Soc configuration +# +CONFIG_TARGET_PHYTIUMPI=y +# CONFIG_TARGET_E2000Q is not set +# CONFIG_TARGET_E2000D is not set +# CONFIG_TARGET_E2000S is not set +# CONFIG_TARGET_FT2004 is not set +# CONFIG_TARGET_D2000 is not set +# CONFIG_TARGET_PD2308 is not set +CONFIG_SOC_NAME="phytiumpi" +CONFIG_SOC_CORE_NUM=4 +CONFIG_F32BIT_MEMORY_ADDRESS=0x80000000 +CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 +CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 +CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 +CONFIG_TARGET_E2000=y +CONFIG_DEFAULT_DEBUG_PRINT_UART1=y +# CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set +# CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set +# end of Soc configuration + +# +# Board Configuration +# +CONFIG_BOARD_NAME="firefly" +# CONFIG_USE_SPI_IOPAD is not set +# CONFIG_USE_GPIO_IOPAD is not set +# CONFIG_USE_CAN_IOPAD is not set +# CONFIG_USE_QSPI_IOPAD is not set +# CONFIG_USE_PWM_IOPAD is not set +# CONFIG_USE_MIO_IOPAD is not set +# CONFIG_USE_TACHO_IOPAD is not set +# CONFIG_USE_UART_IOPAD is not set +# CONFIG_USE_THIRD_PARTY_IOPAD is not set +CONFIG_FIREFLY_DEMO_BOARD=y + +# +# IO mux configuration when board start up +# +# end of IO mux configuration when board start up + +# CONFIG_CUS_DEMO_BOARD is not set + +# +# Build project name +# +CONFIG_TARGET_NAME="pusb2" +# end of Build project name +# end of Board Configuration + +# +# Sdk common configuration +# +CONFIG_ELOG_LINE_BUF_SIZE=0x100 +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +# CONFIG_LOG_INFO is not set +# CONFIG_LOG_WARN is not set +CONFIG_LOG_ERROR=y +# CONFIG_LOG_NONE is not set +CONFIG_LOG_EXTRA_INFO=y +# CONFIG_LOG_DISPALY_CORE_NUM is not set +# CONFIG_BOOTUP_DEBUG_PRINTS is not set +CONFIG_USE_DEFAULT_INTERRUPT_CONFIG=y +CONFIG_INTERRUPT_ROLE_MASTER=y +# CONFIG_INTERRUPT_ROLE_SLAVE is not set +# end of Sdk common configuration + +# +# Drivers configuration +# +CONFIG_USE_IOMUX=y +# CONFIG_ENABLE_IOCTRL is not set +CONFIG_ENABLE_IOPAD=y +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_ETH is not set +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_MIO is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# CONFIG_USE_SATA is not set +# CONFIG_USE_ADC is not set +# CONFIG_USE_PWM is not set +# CONFIG_USE_IPC is not set +# CONFIG_USE_MEDIA is not set +# CONFIG_USE_SCMI_MHU is not set +# CONFIG_USE_I2S is not set +# CONFIG_USE_I3C is not set +# end of Drivers configuration + +# +# Build setup +# +CONFIG_CHECK_DEPS=y +CONFIG_OUTPUT_BINARY=y + +# +# Optimization options +# +CONFIG_DEBUG_NOOPT=y +# CONFIG_DEBUG_CUSTOMOPT is not set +# CONFIG_DEBUG_FULLOPT is not set +CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y +CONFIG_DEBUG_LINK_MAP=y +# CONFIG_CCACHE is not set +# CONFIG_ARCH_COVERAGE is not set +# CONFIG_LTO_FULL is not set +# end of Optimization options + +# +# Debug options +# +# CONFIG_DEBUG_ENABLE_ALL_WARNING is not set +# CONFIG_WALL_WARNING_ERROR is not set +# CONFIG_STRICT_PROTOTYPES is not set +CONFIG_DEBUG_SYMBOLS=y +CONFIG_FRAME_POINTER=y +CONFIG_OUTPUT_ASM_DIS=y +# CONFIG_ENABLE_WSHADOW is not set +# CONFIG_ENABLE_WUNDEF is not set +CONFIG_DOWNGRADE_DIAG_WARNING=y +# end of Debug options + +# +# Lib +# +CONFIG_USE_COMPILE_CHAIN=y +# CONFIG_USE_NEWLIB is not set +# CONFIG_USE_USER_DEFINED is not set +# end of Lib + +# CONFIG_ENABLE_CXX is not set + +# +# Linker Options +# +CONFIG_DEFAULT_LINKER_SCRIPT=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_IMAGE_LOAD_ADDRESS=0x80100000 +CONFIG_IMAGE_MAX_LENGTH=0x5000000 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Build setup + +# +# Component Configuration +# + +# +# Freertos Uart Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Uart Drivers + +# +# Freertos Pwm Drivers +# +# CONFIG_FREERTOS_USE_PWM is not set +# end of Freertos Pwm Drivers + +# +# Freertos Qspi Drivers +# +# CONFIG_FREERTOS_USE_QSPI is not set +# end of Freertos Qspi Drivers + +# +# Freertos Wdt Drivers +# +# CONFIG_FREERTOS_USE_WDT is not set +# end of Freertos Wdt Drivers + +# +# Freertos Eth Drivers +# +# CONFIG_FREERTOS_USE_XMAC is not set +# CONFIG_FREERTOS_USE_GMAC is not set +# end of Freertos Eth Drivers + +# +# Freertos Spim Drivers +# +# CONFIG_FREERTOS_USE_FSPIM is not set +# end of Freertos Spim Drivers + +# +# Freertos DMA Drivers +# +# CONFIG_FREERTOS_USE_FDDMA is not set +# CONFIG_FREERTOS_USE_FGDMA is not set +# end of Freertos DMA Drivers + +# +# Freertos Adc Drivers +# +# CONFIG_FREERTOS_USE_ADC is not set +# end of Freertos Adc Drivers + +# +# Freertos Can Drivers +# +# CONFIG_FREERTOS_USE_CAN is not set +# end of Freertos Can Drivers + +# +# Freertos I2c Drivers +# +# CONFIG_FREERTOS_USE_I2C is not set +# end of Freertos I2c Drivers + +# +# Freertos Mio Drivers +# +# CONFIG_FREERTOS_USE_MIO is not set +# end of Freertos Mio Drivers + +# +# Freertos Timer Drivers +# +# CONFIG_FREERTOS_USE_TIMER is not set +# end of Freertos Timer Drivers + +# +# Freertos Media Drivers +# +# CONFIG_FREERTOS_USE_MEDIA is not set +# end of Freertos Media Drivers + +# +# Freertos I2s Drivers +# +# CONFIG_FREERTOS_USE_I2S is not set +# end of Freertos I2s Drivers +# end of Component Configuration + +# +# Third-party configuration +# +# CONFIG_USE_LWIP is not set +CONFIG_USE_LETTER_SHELL=y + +# +# Letter Shell Configuration +# +CONFIG_LS_PL011_UART=y +CONFIG_DEFAULT_LETTER_SHELL_USE_UART1=y +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set +# end of Letter Shell Configuration + +# CONFIG_USE_AMP is not set +# CONFIG_USE_YMODEM is not set +# CONFIG_USE_SFUD is not set +CONFIG_USE_BACKTRACE=y +# CONFIG_USE_FATFS_0_1_4 is not set +CONFIG_USE_TLSF=y +# CONFIG_USE_SPIFFS is not set +# CONFIG_USE_LITTLE_FS is not set +# CONFIG_USE_LVGL is not set +# CONFIG_USE_FREEMODBUS is not set +CONFIG_USE_CHERRY_USB=y + +# +# CherryUSB Configuration +# +# CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +CONFIG_CHERRY_USB_PORT_PUSB2=y +CONFIG_CHERRYUSB_HOST=y +# CONFIG_CHERRYUSB_DEVICE is not set +CONFIG_CHERRY_USB_HOST_HUB=y +CONFIG_CHERRY_USB_HOST_MSC=y +CONFIG_CHERRY_USB_HOST_HID=y +# end of CherryUSB Configuration + +# CONFIG_USE_FSL_SDMMC is not set +# CONFIG_USE_FSL_WIFI is not set +# end of Third-party configuration + +# +# FreeRTOS Kernel Configuration +# +CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_MAX_PRIORITIES=32 +CONFIG_FREERTOS_KERNEL_INTERRUPT_PRIORITIES=13 +CONFIG_FREERTOS_MAX_API_CALL_INTERRUPT_PRIORITIES=11 +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +CONFIG_FREERTOS_MINIMAL_TASK_STACKSIZE=1024 +CONFIG_FREERTOS_MAX_TASK_NAME_LEN=32 +CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y +# CONFIG_FREERTOS_USE_TICKLESS_IDLE is not set +CONFIG_FREERTOS_TOTAL_HEAP_SIZE=10240 +CONFIG_FREERTOS_TASK_FPU_SUPPORT=1 +# CONFIG_FREERTOS_USE_POSIX is not set +# end of FreeRTOS Kernel Configuration diff --git a/example/peripheral/usb/pusb2_host/sdkconfig.h b/example/peripheral/usb/pusb2_host/sdkconfig.h new file mode 100644 index 0000000000000000000000000000000000000000..ba5931f4d31f4f9155b5bb5627ea9f7a24ef1331 --- /dev/null +++ b/example/peripheral/usb/pusb2_host/sdkconfig.h @@ -0,0 +1,322 @@ +#ifndef SDK_CONFIG_H__ +#define SDK_CONFIG_H__ + +#define CONFIG_USE_FREERTOS + +/* Arch configuration */ + +#define CONFIG_TARGET_ARMv8 +#define CONFIG_ARCH_NAME "armv8" + +/* Arm architecture configuration */ + +#define CONFIG_ARCH_ARMV8_AARCH64 +/* CONFIG_ARCH_ARMV8_AARCH32 is not set */ + +/* Compiler configuration */ + +#define CONFIG_ARM_GCC_SELECT +/* CONFIG_ARM_CLANG_SELECT is not set */ +#define CONFIG_TOOLCHAIN_NAME "gcc" +#define CONFIG_TARGET_ARMV8_AARCH64 +#define CONFIG_ARCH_EXECUTION_STATE "aarch64" +#define CONFIG_ARM_NEON +#define CONFIG_ARM_CRC +#define CONFIG_ARM_CRYPTO +#define CONFIG_ARM_FLOAT_POINT +/* CONFIG_GCC_CODE_MODEL_TINY is not set */ +#define CONFIG_GCC_CODE_MODEL_SMALL +/* CONFIG_GCC_CODE_MODEL_LARGE is not set */ +/* end of Compiler configuration */ +#define CONFIG_BOOT_WITH_FLUSH_CACHE +/* CONFIG_MMU_DEBUG_PRINTS is not set */ +/* end of Arm architecture configuration */ +#define CONFIG_MMU_PAGE_SIZE 0x1000 +#define CONFIG_MAX_XLAT_TABLES 256 +/* end of Arch configuration */ + +/* Soc configuration */ + +#define CONFIG_TARGET_PHYTIUMPI +/* CONFIG_TARGET_E2000Q is not set */ +/* CONFIG_TARGET_E2000D is not set */ +/* CONFIG_TARGET_E2000S is not set */ +/* CONFIG_TARGET_FT2004 is not set */ +/* CONFIG_TARGET_D2000 is not set */ +/* CONFIG_TARGET_PD2308 is not set */ +#define CONFIG_SOC_NAME "phytiumpi" +#define CONFIG_SOC_CORE_NUM 4 +#define CONFIG_F32BIT_MEMORY_ADDRESS 0x80000000 +#define CONFIG_F32BIT_MEMORY_LENGTH 0x80000000 +#define CONFIG_F64BIT_MEMORY_ADDRESS 0x2000000000 +#define CONFIG_F64BIT_MEMORY_LENGTH 0x800000000 +#define CONFIG_TARGET_E2000 +#define CONFIG_DEFAULT_DEBUG_PRINT_UART1 +/* CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set */ +/* CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set */ +/* end of Soc configuration */ + +/* Board Configuration */ + +#define CONFIG_BOARD_NAME "firefly" +/* CONFIG_USE_SPI_IOPAD is not set */ +/* CONFIG_USE_GPIO_IOPAD is not set */ +/* CONFIG_USE_CAN_IOPAD is not set */ +/* CONFIG_USE_QSPI_IOPAD is not set */ +/* CONFIG_USE_PWM_IOPAD is not set */ +/* CONFIG_USE_MIO_IOPAD is not set */ +/* CONFIG_USE_TACHO_IOPAD is not set */ +/* CONFIG_USE_UART_IOPAD is not set */ +/* CONFIG_USE_THIRD_PARTY_IOPAD is not set */ +#define CONFIG_FIREFLY_DEMO_BOARD + +/* IO mux configuration when board start up */ + +/* end of IO mux configuration when board start up */ +/* CONFIG_CUS_DEMO_BOARD is not set */ + +/* Build project name */ + +#define CONFIG_TARGET_NAME "pusb2" +/* end of Build project name */ +/* end of Board Configuration */ + +/* Sdk common configuration */ + +#define CONFIG_ELOG_LINE_BUF_SIZE 0x100 +/* CONFIG_LOG_VERBOS is not set */ +/* CONFIG_LOG_DEBUG is not set */ +/* CONFIG_LOG_INFO is not set */ +/* CONFIG_LOG_WARN is not set */ +#define CONFIG_LOG_ERROR +/* CONFIG_LOG_NONE is not set */ +#define CONFIG_LOG_EXTRA_INFO +/* CONFIG_LOG_DISPALY_CORE_NUM is not set */ +/* CONFIG_BOOTUP_DEBUG_PRINTS is not set */ +#define CONFIG_USE_DEFAULT_INTERRUPT_CONFIG +#define CONFIG_INTERRUPT_ROLE_MASTER +/* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ +/* end of Sdk common configuration */ + +/* Drivers configuration */ + +#define CONFIG_USE_IOMUX +/* CONFIG_ENABLE_IOCTRL is not set */ +#define CONFIG_ENABLE_IOPAD +/* CONFIG_USE_SPI is not set */ +/* CONFIG_USE_QSPI is not set */ +#define CONFIG_USE_SERIAL + +/* Usart Configuration */ + +#define CONFIG_ENABLE_Pl011_UART +/* end of Usart Configuration */ +/* CONFIG_USE_GPIO is not set */ +/* CONFIG_USE_ETH is not set */ +/* CONFIG_USE_CAN is not set */ +/* CONFIG_USE_I2C is not set */ +/* CONFIG_USE_TIMER is not set */ +/* CONFIG_USE_MIO is not set */ +/* CONFIG_USE_SDMMC is not set */ +/* CONFIG_USE_PCIE is not set */ +/* CONFIG_USE_WDT is not set */ +/* CONFIG_USE_DMA is not set */ +/* CONFIG_USE_NAND is not set */ +/* CONFIG_USE_RTC is not set */ +/* CONFIG_USE_SATA is not set */ +/* CONFIG_USE_ADC is not set */ +/* CONFIG_USE_PWM is not set */ +/* CONFIG_USE_IPC is not set */ +/* CONFIG_USE_MEDIA is not set */ +/* CONFIG_USE_SCMI_MHU is not set */ +/* CONFIG_USE_I2S is not set */ +/* CONFIG_USE_I3C is not set */ +/* end of Drivers configuration */ + +/* Build setup */ + +#define CONFIG_CHECK_DEPS +#define CONFIG_OUTPUT_BINARY + +/* Optimization options */ + +#define CONFIG_DEBUG_NOOPT +/* CONFIG_DEBUG_CUSTOMOPT is not set */ +/* CONFIG_DEBUG_FULLOPT is not set */ +#define CONFIG_DEBUG_OPT_UNUSED_SECTIONS +#define CONFIG_DEBUG_LINK_MAP +/* CONFIG_CCACHE is not set */ +/* CONFIG_ARCH_COVERAGE is not set */ +/* CONFIG_LTO_FULL is not set */ +/* end of Optimization options */ + +/* Debug options */ + +/* CONFIG_DEBUG_ENABLE_ALL_WARNING is not set */ +/* CONFIG_WALL_WARNING_ERROR is not set */ +/* CONFIG_STRICT_PROTOTYPES is not set */ +#define CONFIG_DEBUG_SYMBOLS +#define CONFIG_FRAME_POINTER +#define CONFIG_OUTPUT_ASM_DIS +/* CONFIG_ENABLE_WSHADOW is not set */ +/* CONFIG_ENABLE_WUNDEF is not set */ +#define CONFIG_DOWNGRADE_DIAG_WARNING +/* end of Debug options */ + +/* Lib */ + +#define CONFIG_USE_COMPILE_CHAIN +/* CONFIG_USE_NEWLIB is not set */ +/* CONFIG_USE_USER_DEFINED is not set */ +/* end of Lib */ +/* CONFIG_ENABLE_CXX is not set */ + +/* Linker Options */ + +#define CONFIG_DEFAULT_LINKER_SCRIPT +/* CONFIG_USER_DEFINED_LD is not set */ +#define CONFIG_IMAGE_LOAD_ADDRESS 0x80100000 +#define CONFIG_IMAGE_MAX_LENGTH 0x5000000 +#define CONFIG_HEAP_SIZE 1 +#define CONFIG_STACK_SIZE 0x400 +/* end of Linker Options */ +/* end of Build setup */ + +/* Component Configuration */ + +/* Freertos Uart Drivers */ + +#define CONFIG_FREERTOS_USE_UART +/* end of Freertos Uart Drivers */ + +/* Freertos Pwm Drivers */ + +/* CONFIG_FREERTOS_USE_PWM is not set */ +/* end of Freertos Pwm Drivers */ + +/* Freertos Qspi Drivers */ + +/* CONFIG_FREERTOS_USE_QSPI is not set */ +/* end of Freertos Qspi Drivers */ + +/* Freertos Wdt Drivers */ + +/* CONFIG_FREERTOS_USE_WDT is not set */ +/* end of Freertos Wdt Drivers */ + +/* Freertos Eth Drivers */ + +/* CONFIG_FREERTOS_USE_XMAC is not set */ +/* CONFIG_FREERTOS_USE_GMAC is not set */ +/* end of Freertos Eth Drivers */ + +/* Freertos Spim Drivers */ + +/* CONFIG_FREERTOS_USE_FSPIM is not set */ +/* end of Freertos Spim Drivers */ + +/* Freertos DMA Drivers */ + +/* CONFIG_FREERTOS_USE_FDDMA is not set */ +/* CONFIG_FREERTOS_USE_FGDMA is not set */ +/* end of Freertos DMA Drivers */ + +/* Freertos Adc Drivers */ + +/* CONFIG_FREERTOS_USE_ADC is not set */ +/* end of Freertos Adc Drivers */ + +/* Freertos Can Drivers */ + +/* CONFIG_FREERTOS_USE_CAN is not set */ +/* end of Freertos Can Drivers */ + +/* Freertos I2c Drivers */ + +/* CONFIG_FREERTOS_USE_I2C is not set */ +/* end of Freertos I2c Drivers */ + +/* Freertos Mio Drivers */ + +/* CONFIG_FREERTOS_USE_MIO is not set */ +/* end of Freertos Mio Drivers */ + +/* Freertos Timer Drivers */ + +/* CONFIG_FREERTOS_USE_TIMER is not set */ +/* end of Freertos Timer Drivers */ + +/* Freertos Media Drivers */ + +/* CONFIG_FREERTOS_USE_MEDIA is not set */ +/* end of Freertos Media Drivers */ + +/* Freertos I2s Drivers */ + +/* CONFIG_FREERTOS_USE_I2S is not set */ +/* end of Freertos I2s Drivers */ +/* end of Component Configuration */ + +/* Third-party configuration */ + +/* CONFIG_USE_LWIP is not set */ +#define CONFIG_USE_LETTER_SHELL + +/* Letter Shell Configuration */ + +#define CONFIG_LS_PL011_UART +#define CONFIG_DEFAULT_LETTER_SHELL_USE_UART1 +/* CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set */ +/* CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set */ +/* end of Letter Shell Configuration */ +/* CONFIG_USE_AMP is not set */ +/* CONFIG_USE_YMODEM is not set */ +/* CONFIG_USE_SFUD is not set */ +#define CONFIG_USE_BACKTRACE +/* CONFIG_USE_FATFS_0_1_4 is not set */ +#define CONFIG_USE_TLSF +/* CONFIG_USE_SPIFFS is not set */ +/* CONFIG_USE_LITTLE_FS is not set */ +/* CONFIG_USE_LVGL is not set */ +/* CONFIG_USE_FREEMODBUS is not set */ +#define CONFIG_USE_CHERRY_USB + +/* CherryUSB Configuration */ + +/* CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set */ +/* CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set */ +#define CONFIG_CHERRY_USB_PORT_PUSB2 +#define CONFIG_CHERRYUSB_HOST +/* CONFIG_CHERRYUSB_DEVICE is not set */ +#define CONFIG_CHERRY_USB_HOST_HUB +#define CONFIG_CHERRY_USB_HOST_MSC +#define CONFIG_CHERRY_USB_HOST_HID +/* end of CherryUSB Configuration */ +/* CONFIG_USE_FSL_SDMMC is not set */ +/* CONFIG_USE_FSL_WIFI is not set */ +/* end of Third-party configuration */ + +/* FreeRTOS Kernel Configuration */ + +#define CONFIG_FREERTOS_OPTIMIZED_SCHEDULER +#define CONFIG_FREERTOS_HZ 1000 +#define CONFIG_FREERTOS_MAX_PRIORITIES 32 +#define CONFIG_FREERTOS_KERNEL_INTERRUPT_PRIORITIES 13 +#define CONFIG_FREERTOS_MAX_API_CALL_INTERRUPT_PRIORITIES 11 +#define CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS 1 +#define CONFIG_FREERTOS_MINIMAL_TASK_STACKSIZE 1024 +#define CONFIG_FREERTOS_MAX_TASK_NAME_LEN 32 +#define CONFIG_FREERTOS_TIMER_TASK_PRIORITY 1 +#define CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH 2048 +#define CONFIG_FREERTOS_TIMER_QUEUE_LENGTH 10 +#define CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE 0 +#define CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS +#define CONFIG_FREERTOS_USE_TRACE_FACILITY +#define CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS +/* CONFIG_FREERTOS_USE_TICKLESS_IDLE is not set */ +#define CONFIG_FREERTOS_TOTAL_HEAP_SIZE 10240 +#define CONFIG_FREERTOS_TASK_FPU_SUPPORT 1 +/* CONFIG_FREERTOS_USE_POSIX is not set */ +/* end of FreeRTOS Kernel Configuration */ + +#endif diff --git a/example/peripheral/usb/pusb2_host/src/cmd_usb.c b/example/peripheral/usb/pusb2_host/src/cmd_usb.c new file mode 100644 index 0000000000000000000000000000000000000000..170231311e4080db0e1509aa59b6cbcaf7e4b7cc --- /dev/null +++ b/example/peripheral/usb/pusb2_host/src/cmd_usb.c @@ -0,0 +1,186 @@ +/* + * Copyright : (C) 2022 Phytium Information Technology, Inc. + * All Rights Reserved. + * + * This program is OPEN SOURCE software: you can redistribute it and/or modify it + * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, + * either version 1.0 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Phytium Public License for more details. + * + * + * FilePath: cmd_usb.c + * Date: 2022-09-19 14:34:44 + * LastEditTime: 2022-09-19 14:34:45 + * Description:  This file is for USB shell command. + * + * Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + * 1.0 zhugengyu 2022/9/20 init commit + */ +#include +#include +#include "strto.h" +#include "sdkconfig.h" + +#include "FreeRTOS.h" + +#include "usbh_core.h" + +#ifdef CONFIG_USE_LETTER_SHELL +#include "../src/shell.h" +#include "pusb2_host_example.h" +#endif + +#ifdef CONFIG_USE_LETTER_SHELL +static void USBCmdUsage(void) +{ + printf("Usage:\r\n"); + printf("usb start \r\n"); + printf("-- Start usb bus and enumrate devices\r\n"); + printf("usb stop \r\n"); + printf("-- Stop usb bus and deattach devices\r\n"); + printf("usb lsusb\r\n"); + printf("-- List all attached devices on usb bus\r\n"); + printf("usb disk \r\n"); + printf("-- Read and write usb disk device\r\n"); + printf("usb diskbench \r\n"); + printf("-- Bench read and write usb disk device\r\n"); + printf("usb keyboard \r\n"); + printf("-- Get usb keyboard input\r\n"); + printf("usb mouse \r\n"); + printf("-- Get usb mouse input\r\n"); +} + +static int USBCmdEntry(int argc, char *argv[]) +{ + int ret = 0; + u32 usb_id = 0; + const char *devname; + + if (!strcmp(argv[1], "start")) + { + if (argc < 2) + { + usb_id = 0; + } + else + { + usb_id = (uint8_t)simple_strtoul(argv[2], NULL, 10); + } + + ret = usbh_initialize(usb_id, usb_hc_get_register_base(usb_id)); + } + else if (!strcmp(argv[1], "stop")) + { + if (argc < 2) + { + usb_id = 0; + } + else + { + usb_id = (uint8_t)simple_strtoul(argv[2], NULL, 10); + } + + ret = usbh_deinitialize(usb_id); + } + else if (!strcmp(argv[1], "lsusb")) + { + ret = lsusb(argc - 1, &argv[1]); + } + else if (!strcmp(argv[1], "disk")) + { + if (argc < 2) + { + usb_id = 0; + } + else + { + usb_id = (uint8_t)simple_strtoul(argv[2], NULL, 10); + } + + if (argc < 3) + { + devname = "/dev/sda"; + } + else + { + devname = argv[3]; + } + + ret = FFreeRTOSRunPUSB2Disk(usb_id, devname); + } + else if (!strcmp(argv[1], "diskbench")) + { + if (argc < 2) + { + usb_id = 0; + } + else + { + usb_id = (uint8_t)simple_strtoul(argv[2], NULL, 10); + } + + if (argc < 3) + { + devname = "/dev/sda"; + } + else + { + devname = argv[3]; + } + + ret = FFreeRTOSRunPUSB2DiskBench(usb_id, devname); + } + else if (!strcmp(argv[1], "keyboard")) + { + if (argc < 2) + { + usb_id = 0; + } + else + { + usb_id = (uint8_t)simple_strtoul(argv[2], NULL, 10); + } + + if (argc < 3) + { + devname = "/dev/input0"; + } + else + { + devname = argv[3]; + } + + ret = FFreeRTOSRunPUSB2Keyboard(usb_id, devname); + } + else if (!strcmp(argv[1], "mouse")) + { + if (argc < 2) + { + usb_id = 0; + } + else + { + usb_id = (uint8_t)simple_strtoul(argv[2], NULL, 10); + } + + if (argc < 3) + { + devname = "/dev/input0"; + } + else + { + devname = argv[3]; + } + + ret = FFreeRTOSRunPUSB2Mouse(usb_id, devname); + } + + return ret; +} +SHELL_EXPORT_CMD(SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), usb, USBCmdEntry, test freertos usb driver); +#endif \ No newline at end of file diff --git a/example/peripheral/usb/pusb2_host/src/pusb2_usb_disk_bench_example.c b/example/peripheral/usb/pusb2_host/src/pusb2_usb_disk_bench_example.c new file mode 100644 index 0000000000000000000000000000000000000000..66676d3138895ae962e7f4bde7362c59f24d8b2d --- /dev/null +++ b/example/peripheral/usb/pusb2_host/src/pusb2_usb_disk_bench_example.c @@ -0,0 +1,228 @@ +/* + * Copyright : (C) 2022 Phytium Information Technology, Inc. + * All Rights Reserved. + * + * This program is OPEN SOURCE software: you can redistribute it and/or modify it + * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, + * either version 1.0 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Phytium Public License for more details. + * + * + * FilePath: pusb2_usb_disk_bench_example.c + * Date: 2022-09-23 08:24:09 + * LastEditTime: 2022-09-23 08:24:10 + * Description:  This file is for the usb disk functions. + * + * Modify History: + * Ver   Who         Date         Changes + * ----- ------     --------    -------------------------------------- + * 1.0 zhugengyu 2022/10/19 init commit + * 2.0 zhugengyu 2024/7/1 support auto-run + */ +/***************************** Include Files *********************************/ +#include +#include + +#include "FreeRTOS.h" +#include "queue.h" +#include "task.h" + +#include "fassert.h" +#include "fdebug.h" +#include "fkernel.h" + +#include "usbh_core.h" +#include "usbh_msc.h" + +#include "pusb2_host_example.h" +/************************** Constant Definitions *****************************/ +#define TIMER_OUT (0xFFFFFFFF) + +#define USB_MAX_RW_BLK 1000U +#define USB_DISK_BLK_SIZE 512U +#define USB_DISK_START_BLK 0U +#define USB_BENCH_TIMES 6U +#define USB_BENCH_SIZE (u64)(SZ_1M * 200ULL) +#define USB_BENCH_BLKS (USB_BENCH_SIZE / USB_DISK_BLK_SIZE) +/**************************** Type Definitions *******************************/ +enum +{ + PUSB2_USB_DISK_RW_SUCCESS = 0, + PUSB2_USB_DISK_RW_FAIL = 1, +}; + +/************************** Variable Definitions *****************************/ +static uint8_t rw_buf[USB_DISK_BLK_SIZE * USB_MAX_RW_BLK] = {0}; +static uintptr_t usb_id = 0; +static QueueHandle_t xQueue = NULL; + +/***************** Macros (Inline Functions) Definitions *********************/ +#define FUSB_DEBUG_TAG "PUSB2-USB-DISK" +#define FUSB_ERROR(format, ...) FT_DEBUG_PRINT_E(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_WARN(format, ...) FT_DEBUG_PRINT_W(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_INFO(format, ...) FT_DEBUG_PRINT_I(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_DEBUG(format, ...) FT_DEBUG_PRINT_D(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) + +/************************** Function Prototypes ******************************/ + +/*****************************************************************************/ +static void PUSB2UsbMscBenchTask(void *args) +{ + int ret; + u8 id = (u8)usb_id; + struct usbh_msc *msc_class; + u32 loop = 0; + const char *devname = (const char *)args; + TickType_t tick_count, tick_spend; + double time_in_seconds, rw_speed; + u64 start_blk = USB_DISK_START_BLK; + u64 bench_blk; + u64 bench_rw; + int run_times = USB_BENCH_TIMES; + + msc_class = (struct usbh_msc *)usbh_find_class_instance(devname); + if (msc_class == NULL) + { + USB_LOG_RAW("Do not find %s. \r\n", devname); + goto task_exit; + } + + while (run_times-- > 0) + { + + /* do write bench */ + { + for (u32 i = 0; i < USB_MAX_RW_BLK; i++) /* fill some none-zero value into write buffer */ + { + memset(rw_buf + i * USB_DISK_BLK_SIZE, ((USB_DISK_START_BLK + i) & 0xff), USB_DISK_BLK_SIZE); + } + + bench_blk = start_blk; + + if ((bench_blk + USB_BENCH_BLKS) > msc_class->blocknum) + { + break; + } + + printf("Writing the %ld MB data (Block %ld ~ %ld), waiting...\r\n", + USB_BENCH_SIZE / SZ_1M, bench_blk, bench_blk + USB_BENCH_BLKS); + tick_count = xTaskGetTickCount(); + + while (bench_blk < (start_blk + USB_BENCH_BLKS)) + { + /* how many blocks to be wrote this time */ + bench_rw = (bench_blk + USB_MAX_RW_BLK) <= (start_blk + USB_BENCH_BLKS) ? + USB_MAX_RW_BLK : (start_blk + USB_BENCH_BLKS - bench_blk); + + ret = usbh_msc_scsi_write10(msc_class, bench_blk, rw_buf, USB_MAX_RW_BLK); + if (ret < 0) + { + USB_LOG_ERR("Error in scsi_write10 error, ret:%d", ret); + goto task_exit; + } + + bench_blk += bench_rw; + } + + tick_spend = xTaskGetTickCount() - tick_count; + time_in_seconds = ((double)tick_spend / configTICK_RATE_HZ); + rw_speed = ((double)USB_BENCH_SIZE / SZ_1M) / time_in_seconds; + printf("Write benchmark success, total time: %.2f Sec, total size: %d MB, speed: %.2f MB/sec\r\n", + time_in_seconds, + (int)(USB_BENCH_SIZE / SZ_1M), + rw_speed); /* this forced type casting is to avoid floating-point printing error */ + } + + /* do read bench */ + { + printf("Reading the %ld MB data (%ld Blocks), waiting...\r\n", + USB_BENCH_SIZE / SZ_1M, USB_BENCH_BLKS); + tick_count = xTaskGetTickCount(); + + bench_blk = start_blk; + while (bench_blk < (start_blk + USB_BENCH_BLKS)) + { + /* how many blocks to be wrote this time */ + bench_rw = (bench_blk + USB_MAX_RW_BLK) <= (start_blk + USB_BENCH_BLKS) ? + USB_MAX_RW_BLK : (start_blk + USB_BENCH_BLKS - bench_blk); + + ret = usbh_msc_scsi_read10(msc_class, bench_blk, rw_buf, USB_MAX_RW_BLK); + if (ret < 0) + { + USB_LOG_ERR("Error in scsi_write10 error, ret:%d", ret); + goto task_exit; + } + + bench_blk += bench_rw; + } + + tick_spend = xTaskGetTickCount() - tick_count; + time_in_seconds = ((double)tick_spend / configTICK_RATE_HZ); + rw_speed = ((double)USB_BENCH_SIZE / SZ_1M) / time_in_seconds; + printf("Read benchmark success, total time: %.2f Sec, total size: %d MB, speed: %.2f MB/sec\r\n", + time_in_seconds, + (int)(USB_BENCH_SIZE / SZ_1M), + rw_speed); /* this forced type casting is to avoid floating-point printing error */ + } + + start_blk += USB_BENCH_BLKS; + } + +task_exit: + ret = (ret == 0) ? PUSB2_USB_DISK_RW_SUCCESS : PUSB2_USB_DISK_RW_FAIL; + xQueueSend(xQueue, &ret, 0); + vTaskDelete(NULL); +} + +BaseType_t FFreeRTOSRunPUSB2DiskBench(u32 id, const char *devname) +{ + BaseType_t ret = pdPASS; + int task_res = PUSB2_USB_DISK_RW_SUCCESS; + xQueue = xQueueCreate(1, sizeof(int)); + if (xQueue == NULL) + { + FUSB_ERROR("xQueue create failed.\r\n"); + goto exit; + } + + usb_id = id; + + ret = xTaskCreate((TaskFunction_t)PUSB2UsbMscBenchTask, + (const char *)"PUSB2UsbMscBenchTask", + (uint16_t)4096, + (void *)devname, + (UBaseType_t)configMAX_PRIORITIES - 1, + NULL); + if (ret != pdPASS) + { + FUSB_ERROR("xTaskCreate create failed.\r\n"); + goto exit; + } + + ret = xQueueReceive(xQueue, &task_res, TIMER_OUT); + if (ret != pdPASS) + { + FUSB_ERROR("xQueue receive timeout.\r\n"); + goto exit; + } + +exit: + if (xQueue) + { + vQueueDelete(xQueue); + } + + if (task_res != PUSB2_USB_DISK_RW_SUCCESS) + { + printf("%s@%d: PUSB2 usb disk read/write example [failure], task_res = %d\r\n", __func__, __LINE__, task_res); + return pdFAIL; + } + else + { + printf("%s@%d: PUSB2 usb disk read/write example [success].\r\n", __func__, __LINE__); + return pdTRUE; + } +} diff --git a/example/peripheral/usb/xhci_platform/src/usb_host.c b/example/peripheral/usb/pusb2_host/src/pusb2_usb_disk_read_write_example.c similarity index 32% rename from example/peripheral/usb/xhci_platform/src/usb_host.c rename to example/peripheral/usb/pusb2_host/src/pusb2_usb_disk_read_write_example.c index 424cf329bf9209d8c283279511eb1c5f8b913dff..f2489f4b8575cd54a23f8ea61d514d8d8f082a19 100644 --- a/example/peripheral/usb/xhci_platform/src/usb_host.c +++ b/example/peripheral/usb/pusb2_host/src/pusb2_usb_disk_read_write_example.c @@ -11,15 +11,16 @@ * See the Phytium Public License for more details. * * - * FilePath: usb_host.c - * Date: 2022-07-22 13:57:42 - * LastEditTime: 2022-07-22 13:57:43 - * Description:  This file is for the usb host functions. + * FilePath: pusb2_usb_disk_read_write_example.c + * Date: 2022-09-23 08:24:09 + * LastEditTime: 2022-09-23 08:24:10 + * Description:  This file is for the usb disk functions. * * Modify History: - * Ver   Who        Date         Changes + * Ver   Who         Date         Changes * ----- ------     --------    -------------------------------------- - * 1.0 zhugengyu 2022/9/20 init commit + * 1.0 zhugengyu 2022/10/19 init commit + * 2.0 zhugengyu 2024/7/1 support auto-run */ /***************************** Include Files *********************************/ #include @@ -29,167 +30,168 @@ #include "task.h" #include "fassert.h" -#include "finterrupt.h" -#include "fcpu_info.h" #include "fdebug.h" -#include "fcache.h" #include "fmemory_pool.h" #include "usbh_core.h" +#include "usbh_msc.h" + +#include "pusb2_host_example.h" /************************** Constant Definitions *****************************/ -#define FUSB_MEMP_TOTAL_SIZE SZ_1M +#define TIMER_OUT (pdMS_TO_TICKS(10000UL)) /**************************** Type Definitions *******************************/ +enum +{ + PUSB2_USB_DISK_RW_SUCCESS = 0, + PUSB2_USB_DISK_RW_FAIL = 1, +}; /************************** Variable Definitions *****************************/ -static FMemp memp; -static u8 memp_buf[FUSB_MEMP_TOTAL_SIZE]; -static struct usbh_bus usb[FUSB3_NUM]; +static uint8_t rd_table[512] = {0}; +static uint8_t wr_table[512] = {0}; +static uintptr_t usb_id = 0; +static QueueHandle_t xQueue = NULL; /***************** Macros (Inline Functions) Definitions *********************/ -#define FUSB_DEBUG_TAG "USB-HC" +#define FUSB_DEBUG_TAG "PUSB2-USB-DISK" #define FUSB_ERROR(format, ...) FT_DEBUG_PRINT_E(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) #define FUSB_WARN(format, ...) FT_DEBUG_PRINT_W(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) #define FUSB_INFO(format, ...) FT_DEBUG_PRINT_I(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) #define FUSB_DEBUG(format, ...) FT_DEBUG_PRINT_D(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) /************************** Function Prototypes ******************************/ -extern void USBH_IRQHandler(void *); - +void usb_hc_dcache_invalidate(void *addr, unsigned long len); +void usb_hc_dcache_flush(void *addr, unsigned long len); /*****************************************************************************/ -static void UsbHcInterrruptHandler(s32 vector, void *param) -{ - USBH_IRQHandler(param); -} - -static void UsbHcSetupInterrupt(u32 id) -{ - u32 cpu_id; - u32 irq_num = (id == FUSB3_ID_0) ? FUSB3_0_IRQ_NUM : FUSB3_1_IRQ_NUM; - u32 irq_priority = 13U; - - GetCpuId(&cpu_id); - InterruptSetTargetCpus(irq_num, cpu_id); - - InterruptSetPriority(irq_num, irq_priority); - - /* register intr callback */ - InterruptInstall(irq_num, - UsbHcInterrruptHandler, - &usb[id], - NULL); - - /* enable irq */ - InterruptUmask(irq_num); -} - -void UsbHcSetupMemp(void) +static void PUSB2UsbMscTask(void *args) { - if (FT_COMPONENT_IS_READY != memp.is_ready) + int ret; + u8 id = (u8)usb_id; + struct usbh_msc *msc_class; + u32 loop = 0; + uint32_t start_blk = 0; + uint32_t blk_num = 1; + const char *devname = (const char *)args; + + msc_class = (struct usbh_msc *)usbh_find_class_instance(devname); + if (msc_class == NULL) { - USB_ASSERT(FT_SUCCESS == FMempInit(&memp, &memp_buf[0], &memp_buf[0] + FUSB_MEMP_TOTAL_SIZE)); + USB_LOG_RAW("Do not find %s. \r\n", devname); + goto task_exit; } -} -/* implement cherryusb weak functions */ -void usb_hc_low_level_init(uint32_t id) -{ - UsbHcSetupMemp(); - UsbHcSetupInterrupt(id); -} + /* check msc device information */ + printf("MSC (/dev/sd%c) info:\r\n", (char)msc_class->sdchar); + printf(" USB: 0x%04x\r\n", msc_class->hport->device_desc.bcdUSB); + printf(" Class: 0x%02x\r\n", msc_class->hport->device_desc.bDeviceClass); + printf(" Subclass: 0x%02x\r\n", msc_class->hport->device_desc.bDeviceSubClass); + printf(" Protocol: 0x%02x\r\n", msc_class->hport->device_desc.bDeviceProtocol); + printf(" Block size: %d\r\n", msc_class->blocksize); + printf(" Total size: %ld GB\r\n", ((u64)msc_class->blocksize * msc_class->blocknum) / SZ_1G); + printf(" Bulk in: %d(mps)\r\n", msc_class->bulkin->wMaxPacketSize); + printf(" Bulk out: %d(mps)\r\n", msc_class->bulkout->wMaxPacketSize); -unsigned long usb_hc_get_register_base(uint32_t id) -{ - if (FUSB3_ID_0 == id) - return FUSB3_0_BASE_ADDR + FUSB3_XHCI_OFFSET; - else - return FUSB3_1_BASE_ADDR + FUSB3_XHCI_OFFSET; -} - -void *usb_hc_malloc(size_t size) -{ - return usb_hc_malloc_align(sizeof(void *), size); -} - -void *usb_hc_malloc_align(size_t align, size_t size) -{ - void *result = FMempMallocAlign(&memp, size, align); - - if (result) + while (TRUE) { - memset(result, 0U, size); + /* write partition table */ + for (uint32_t i = 0; i < 512; i++) + { + wr_table[i] ^= 0xfffff; + } + + ret = usbh_msc_scsi_write10(msc_class, start_blk, wr_table, blk_num); + if (ret < 0) + { + USB_LOG_ERR("Error in scsi_write10 error, ret:%d", ret); + goto task_exit; + } + + /* get the partition table */ + ret = usbh_msc_scsi_read10(msc_class, start_blk, rd_table, blk_num); + if (ret < 0) + { + USB_LOG_ERR("Error in scsi_read10, ret:%d", ret); + goto task_exit; + } + + /* check if read table == write table */ + if (0 != memcmp(wr_table, rd_table, sizeof(rd_table))) + { + USB_LOG_ERR("Failed to check read and write.\r\n"); + goto task_exit; + } + else + { + printf("[%d] disk read and write %d bytes successfully.\r\n", loop, sizeof(rd_table)); +#if defined(CONFIG_LOG_DEBUG) || defined(CONFIG_LOG_VERBOS) + FtDumpHexByte(rd_table, sizeof(rd_table)); +#endif + } + + loop++; + if (loop > 5) + { + break; + } + + start_blk += blk_num; + + vTaskDelay(1); } - return result; +task_exit: + ret = (ret == 0) ? PUSB2_USB_DISK_RW_SUCCESS : PUSB2_USB_DISK_RW_FAIL; + xQueueSend(xQueue, &ret, 0); + vTaskDelete(NULL); } -void usb_hc_free(void *ptr) +BaseType_t FFreeRTOSRunPUSB2Disk(u32 id, const char *devname) { - if (NULL != ptr) + BaseType_t ret = pdPASS; + int task_res = PUSB2_USB_DISK_RW_SUCCESS; + xQueue = xQueueCreate(1, sizeof(int)); + if (xQueue == NULL) { - FMempFree(&memp, ptr); + FUSB_ERROR("xQueue create failed.\r\n"); + goto exit; } -} -void usb_assert(const char *filename, int linenum) -{ - FAssert(filename, linenum, 0xff); -} + usb_id = id; -void usb_hc_dcache_invalidate(void *addr, unsigned long len) -{ - FCacheDCacheInvalidateRange((uintptr)addr, len); -} -/*****************************************/ -static void UsbInitTask(void *args) -{ - u32 id = (u32)(uintptr)args; - memset(&usb[id], 0 , sizeof(usb[id])); - - if (0 == usbh_initialize(id, &usb[id])) + ret = xTaskCreate((TaskFunction_t)PUSB2UsbMscTask, + (const char *)"PUSB2UsbMscTask", + (uint16_t)4096, + (void *)devname, + (UBaseType_t)configMAX_PRIORITIES - 1, + NULL); + if (ret != pdPASS) { - printf("Init cherryusb host successfully.put 'usb lsusb -t' to see devices.\r\n"); + FUSB_ERROR("xTaskCreate create failed.\r\n"); + goto exit; } - else + + ret = xQueueReceive(xQueue, &task_res, TIMER_OUT); + if (ret != pdPASS) { - FUSB_ERROR("Init cherryusb host failed."); + FUSB_ERROR("xQueue receive timeout.\r\n"); + goto exit; } - vTaskDelete(NULL); -} - -static void UsbMonitorTask(void *args) -{ - extern void usbh_debug_dump(void); - - while (TRUE) +exit: + if (xQueue) { - usbh_debug_dump(); - - vTaskDelay(10000); + vQueueDelete(xQueue); } -} -BaseType_t FFreeRTOSInitUsb(u32 id) -{ - BaseType_t ret = pdPASS; - - taskENTER_CRITICAL(); /* no schedule when create task */ - - ret = xTaskCreate((TaskFunction_t)UsbInitTask, - (const char *)"UsbInitTask", - (uint16_t)2048, - (void *)(uintptr)id, - (UBaseType_t)configMAX_PRIORITIES - 1, - NULL); - FASSERT_MSG(pdPASS == ret, "create task failed"); - - taskEXIT_CRITICAL(); /* allow schedule since task created */ - - return ret; + if (task_res != PUSB2_USB_DISK_RW_SUCCESS) + { + printf("%s@%d: PUSB2 usb disk read/write example [failure], task_res = %d\r\n", __func__, __LINE__, task_res); + return pdFAIL; + } + else + { + printf("%s@%d: PUSB2 usb disk read/write example [success].\r\n", __func__, __LINE__); + return pdTRUE; + } } - -BaseType_t FFreeRTOSListUsbDev(int argc, char *argv[]) -{ - return lsusb(argc, argv); -} \ No newline at end of file diff --git a/example/peripheral/usb/pusb2_host/src/pusb2_usb_keyboard_input_example.c b/example/peripheral/usb/pusb2_host/src/pusb2_usb_keyboard_input_example.c new file mode 100644 index 0000000000000000000000000000000000000000..6969ab0525415a96471a88a09bbc42acc70e0794 --- /dev/null +++ b/example/peripheral/usb/pusb2_host/src/pusb2_usb_keyboard_input_example.c @@ -0,0 +1,338 @@ +/* + * Copyright : (C) 2022 Phytium Information Technology, Inc. + * All Rights Reserved. + * + * This program is OPEN SOURCE software: you can redistribute it and/or modify it + * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, + * either version 1.0 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Phytium Public License for more details. + * + * + * FilePath: usb_input.c + * Date: 2022-07-22 13:57:42 + * LastEditTime: 2022-07-22 13:57:43 + * Description:  This file is for the usb input functions. + * + * Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + * 1.0 zhugengyu 2022/9/20 init commit + */ +/***************************** Include Files *********************************/ +#include +#include + +#include "FreeRTOS.h" +#include "task.h" +#include "queue.h" + +#include "fassert.h" +#include "fdebug.h" +#include "fkernel.h" + +#include "usbh_core.h" +#include "usbh_hid.h" + +#include "pusb2_host_example.h" +/************************** Constant Definitions *****************************/ +#define HID_KEYCODE_TO_ASCII \ + {0 , 0 }, /* 0x00 */ \ + {0 , 0 }, /* 0x01 */ \ + {0 , 0 }, /* 0x02 */ \ + {0 , 0 }, /* 0x03 */ \ + {'a' , 'A' }, /* 0x04 */ \ + {'b' , 'B' }, /* 0x05 */ \ + {'c' , 'C' }, /* 0x06 */ \ + {'d' , 'D' }, /* 0x07 */ \ + {'e' , 'E' }, /* 0x08 */ \ + {'f' , 'F' }, /* 0x09 */ \ + {'g' , 'G' }, /* 0x0a */ \ + {'h' , 'H' }, /* 0x0b */ \ + {'i' , 'I' }, /* 0x0c */ \ + {'j' , 'J' }, /* 0x0d */ \ + {'k' , 'K' }, /* 0x0e */ \ + {'l' , 'L' }, /* 0x0f */ \ + {'m' , 'M' }, /* 0x10 */ \ + {'n' , 'N' }, /* 0x11 */ \ + {'o' , 'O' }, /* 0x12 */ \ + {'p' , 'P' }, /* 0x13 */ \ + {'q' , 'Q' }, /* 0x14 */ \ + {'r' , 'R' }, /* 0x15 */ \ + {'s' , 'S' }, /* 0x16 */ \ + {'t' , 'T' }, /* 0x17 */ \ + {'u' , 'U' }, /* 0x18 */ \ + {'v' , 'V' }, /* 0x19 */ \ + {'w' , 'W' }, /* 0x1a */ \ + {'x' , 'X' }, /* 0x1b */ \ + {'y' , 'Y' }, /* 0x1c */ \ + {'z' , 'Z' }, /* 0x1d */ \ + {'1' , '!' }, /* 0x1e */ \ + {'2' , '@' }, /* 0x1f */ \ + {'3' , '#' }, /* 0x20 */ \ + {'4' , '$' }, /* 0x21 */ \ + {'5' , '%' }, /* 0x22 */ \ + {'6' , '^' }, /* 0x23 */ \ + {'7' , '&' }, /* 0x24 */ \ + {'8' , '*' }, /* 0x25 */ \ + {'9' , '(' }, /* 0x26 */ \ + {'0' , ')' }, /* 0x27 */ \ + {'\r' , '\r' }, /* 0x28 */ \ + {'\x1b', '\x1b' }, /* 0x29 */ \ + {'\b' , '\b' }, /* 0x2a */ \ + {'\t' , '\t' }, /* 0x2b */ \ + {' ' , ' ' }, /* 0x2c */ \ + {'-' , '_' }, /* 0x2d */ \ + {'=' , '+' }, /* 0x2e */ \ + {'[' , '{' }, /* 0x2f */ \ + {']' , '}' }, /* 0x30 */ \ + {'\\' , '|' }, /* 0x31 */ \ + {'#' , '~' }, /* 0x32 */ \ + {';' , ':' }, /* 0x33 */ \ + {'\'' , '\"' }, /* 0x34 */ \ + {'`' , '~' }, /* 0x35 */ \ + {',' , '<' }, /* 0x36 */ \ + {'.' , '>' }, /* 0x37 */ \ + {'/' , '?' }, /* 0x38 */ \ + \ + {0 , 0 }, /* 0x39 */ \ + {0 , 0 }, /* 0x3a */ \ + {0 , 0 }, /* 0x3b */ \ + {0 , 0 }, /* 0x3c */ \ + {0 , 0 }, /* 0x3d */ \ + {0 , 0 }, /* 0x3e */ \ + {0 , 0 }, /* 0x3f */ \ + {0 , 0 }, /* 0x40 */ \ + {0 , 0 }, /* 0x41 */ \ + {0 , 0 }, /* 0x42 */ \ + {0 , 0 }, /* 0x43 */ \ + {0 , 0 }, /* 0x44 */ \ + {0 , 0 }, /* 0x45 */ \ + {0 , 0 }, /* 0x46 */ \ + {0 , 0 }, /* 0x47 */ \ + {0 , 0 }, /* 0x48 */ \ + {0 , 0 }, /* 0x49 */ \ + {0 , 0 }, /* 0x4a */ \ + {0 , 0 }, /* 0x4b */ \ + {0 , 0 }, /* 0x4c */ \ + {0 , 0 }, /* 0x4d */ \ + {0 , 0 }, /* 0x4e */ \ + {0 , 0 }, /* 0x4f */ \ + {0 , 0 }, /* 0x50 */ \ + {0 , 0 }, /* 0x51 */ \ + {0 , 0 }, /* 0x52 */ \ + {0 , 0 }, /* 0x53 */ \ + \ + {'/' , '/' }, /* 0x54 */ \ + {'*' , '*' }, /* 0x55 */ \ + {'-' , '-' }, /* 0x56 */ \ + {'+' , '+' }, /* 0x57 */ \ + {'\r' , '\r' }, /* 0x58 */ \ + {'1' , 0 }, /* 0x59 */ \ + {'2' , 0 }, /* 0x5a */ \ + {'3' , 0 }, /* 0x5b */ \ + {'4' , 0 }, /* 0x5c */ \ + {'5' , '5' }, /* 0x5d */ \ + {'6' , 0 }, /* 0x5e */ \ + {'7' , 0 }, /* 0x5f */ \ + {'8' , 0 }, /* 0x60 */ \ + {'9' , 0 }, /* 0x61 */ \ + {'0' , 0 }, /* 0x62 */ \ + {'0' , 0 }, /* 0x63 */ \ + {'=' , '=' }, /* 0x67 */ \ + +enum +{ + PUSB2_USB_KEYBOARD_SUCCESS = 0, + PUSB2_USB_KEYBOARD_FAIL = 1, +}; + +#define PUSB2_INPUT_WAIT_TIME (pdMS_TO_TICKS(20000UL)) +#define TIMER_OUT (PUSB2_INPUT_WAIT_TIME + (pdMS_TO_TICKS(10000UL))) +/**************************** Type Definitions *******************************/ + +/************************** Variable Definitions *****************************/ +static u8 const keycode2ascii[128][2] = { HID_KEYCODE_TO_ASCII }; +static struct usbh_urb kbd_intin_urb; +static uint8_t kbd_buffer[128] __attribute__((aligned(sizeof(unsigned long)))) = {0}; +static struct usb_osal_timer *kbd_timer = NULL; +static uintptr_t usb_id = 0; +static QueueHandle_t xQueue = NULL; +/***************** Macros (Inline Functions) Definitions *********************/ +#define FUSB_DEBUG_TAG "USB-KEYBOARD" +#define FUSB_ERROR(format, ...) FT_DEBUG_PRINT_E(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_WARN(format, ...) FT_DEBUG_PRINT_W(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_INFO(format, ...) FT_DEBUG_PRINT_I(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_DEBUG(format, ...) FT_DEBUG_PRINT_D(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) + +/************************** Function Prototypes ******************************/ + + +/*****************************************************************************/ +/* look up new key in previous keys */ +static inline boolean FindKeyInPrevInput(const struct usb_hid_kbd_report *report, u8 keycode) +{ + for (u8 i = 0; i < 6; i++) + { + if (report->key[i] == keycode) + { + return TRUE; + } + } + + return FALSE; +} + +static void UsbKeyBoardHandleInput(struct usb_hid_kbd_report *input) +{ + static struct usb_hid_kbd_report prev_input = { 0, 0, {0} }; /* previous report to check key released */ + + /* ------------- example code ignore control (non-printable) key affects ------------- */ + for (u8 i = 0; i < 6; i++) + { + if (input->key[i]) + { + if (FindKeyInPrevInput(&prev_input, input->key[i])) + { + /* exist in previous report means the current key is holding */ + } + else + { + /* not existed in previous report means the current key is pressed */ + boolean is_shift = input->modifier & (HID_MODIFER_LSHIFT | HID_MODIFER_RSHIFT); + u8 ch = keycode2ascii[input->key[i]][is_shift ? 1 : 0]; + putchar(ch); + if ('\r' == ch) + { + putchar('\n'); + } + + fflush(stdout); /* flush right away, else libc will wait for newline */ + } + } + } + + prev_input = *input; +} + +static void UsbKeyboardCallback(void *arg, int nbytes) +{ + struct usbh_hid *hid_class = (struct usbh_hid *)arg; + + if (nbytes > 0) + { + UsbKeyBoardHandleInput((struct usb_hid_kbd_report *)kbd_buffer); + } + + if (kbd_timer) + { + usb_osal_timer_start(kbd_timer); + } +} + +static void UsbKeyboardTimeout(void *arg) +{ + struct usbh_hid *hid = (struct usbh_hid *)arg; + + usbh_int_urb_fill(&hid->intin_urb, hid->hport, hid->intin, kbd_buffer, hid->intin->wMaxPacketSize, 0, UsbKeyboardCallback, hid); + usbh_submit_urb(&hid->intin_urb); +} + +static void PUSB2UsbKeyboardTask(void *args) +{ + int ret; + u8 id = (u8)usb_id; + struct usbh_hid *kbd_class; + const char *devname = (const char *)args; + + kbd_class = (struct usbh_hid *)usbh_find_class_instance(devname); + if (kbd_class == NULL) + { + FUSB_ERROR("Do not find %s.", devname); + goto task_exit; + } + + kbd_timer = usb_osal_timer_create("keyboard_timer", + USBH_GET_URB_INTERVAL(kbd_class->intin->bInterval, kbd_class->hport->speed), + UsbKeyboardTimeout, + kbd_class, + false); + if (kbd_timer != NULL) + { + usb_osal_timer_start(kbd_timer); + } + + /* check hid device information */ + printf("HID (/dev/input%d) info:\r\n", (char)kbd_class->minor); + printf(" USB: 0x%04x\r\n", kbd_class->hport->device_desc.bcdUSB); + printf(" Class: 0x%02x\r\n", kbd_class->hport->device_desc.bDeviceClass); + printf(" Subclass: 0x%02x\r\n", kbd_class->hport->device_desc.bDeviceSubClass); + printf(" Protocol: 0x%02x\r\n", kbd_class->hport->device_desc.bDeviceProtocol); + printf(" Intr in: %d(mps) %d(interval)\r\n", kbd_class->intin->wMaxPacketSize, + kbd_class->intin->bInterval); + printf(" Intr out: %d(mps) %d(interval)\r\n", kbd_class->intout->wMaxPacketSize, + kbd_class->intout->bInterval); + + printf("Now you can type in some characters from keyboard \r\n"); + + vTaskDelay(PUSB2_INPUT_WAIT_TIME); /* wait user input for a while */ + + printf("Input finished, exit...\r\n"); + +task_exit: + ret = (ret == 0) ? PUSB2_USB_KEYBOARD_SUCCESS : PUSB2_USB_KEYBOARD_FAIL; + xQueueSend(xQueue, &ret, 0); + vTaskDelete(NULL); +} + +BaseType_t FFreeRTOSRunPUSB2Keyboard(u32 id, const char *devname) +{ + BaseType_t ret = pdPASS; + int task_res = PUSB2_USB_KEYBOARD_SUCCESS; + xQueue = xQueueCreate(1, sizeof(int)); + if (xQueue == NULL) + { + FUSB_ERROR("xQueue create failed.\r\n"); + goto exit; + } + + usb_id = id; + + ret = xTaskCreate((TaskFunction_t)PUSB2UsbKeyboardTask, + (const char *)"PUSB2UsbKeyboardTask", + (uint16_t)4096, + (void *)devname, + (UBaseType_t)configMAX_PRIORITIES - 1, + NULL); + if (ret != pdPASS) + { + FUSB_ERROR("xTaskCreate create failed.\r\n"); + goto exit; + } + + ret = xQueueReceive(xQueue, &task_res, TIMER_OUT); + if (ret != pdPASS) + { + FUSB_ERROR("xQueue receive timeout.\r\n"); + goto exit; + } + +exit: + if (xQueue) + { + vQueueDelete(xQueue); + } + + if (task_res != PUSB2_USB_KEYBOARD_SUCCESS) + { + printf("%s@%d: PUSB2 usb keyboard example [failure], task_res = %d\r\n", __func__, __LINE__, task_res); + return pdFAIL; + } + else + { + printf("%s@%d: PUSB2 usb keyboard example [success].\r\n", __func__, __LINE__); + return pdTRUE; + } +} \ No newline at end of file diff --git a/example/peripheral/usb/pusb2_host/src/pusb2_usb_mouse_input_example.c b/example/peripheral/usb/pusb2_host/src/pusb2_usb_mouse_input_example.c new file mode 100644 index 0000000000000000000000000000000000000000..5eef6f56cfd76958a5b2f7d4274c623b4c04ac9c --- /dev/null +++ b/example/peripheral/usb/pusb2_host/src/pusb2_usb_mouse_input_example.c @@ -0,0 +1,238 @@ +/* + * Copyright : (C) 2022 Phytium Information Technology, Inc. + * All Rights Reserved. + * + * This program is OPEN SOURCE software: you can redistribute it and/or modify it + * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, + * either version 1.0 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Phytium Public License for more details. + * + * + * FilePath: usb_input.c + * Date: 2022-07-22 13:57:42 + * LastEditTime: 2022-07-22 13:57:43 + * Description:  This file is for the usb input functions. + * + * Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + * 1.0 zhugengyu 2022/9/20 init commit + */ +/***************************** Include Files *********************************/ +#include +#include + +#include "FreeRTOS.h" +#include "task.h" +#include "queue.h" + +#include "fassert.h" +#include "fdebug.h" +#include "fkernel.h" + +#include "usbh_core.h" +#include "usbh_hid.h" + +#include "pusb2_host_example.h" +/************************** Constant Definitions *****************************/ +enum +{ + PUSB2_USB_MOUSE_SUCCESS = 0, + PUSB2_USB_MOUSE_FAIL = 1, +}; + +#define PUSB2_INPUT_WAIT_TIME (pdMS_TO_TICKS(20000UL)) +#define TIMER_OUT (PUSB2_INPUT_WAIT_TIME + (pdMS_TO_TICKS(10000UL))) +/**************************** Type Definitions *******************************/ + +/************************** Variable Definitions *****************************/ +static struct usbh_urb mouse_intin_urb; +static uint8_t mouse_buffer[128] __attribute__((aligned(sizeof(unsigned long)))) = {0}; +static struct usb_osal_timer *mouse_timer = NULL; +static uintptr_t usb_id = 0; +static QueueHandle_t xQueue = NULL; +/***************** Macros (Inline Functions) Definitions *********************/ +#define FUSB_DEBUG_TAG "USB-MOUSE" +#define FUSB_ERROR(format, ...) FT_DEBUG_PRINT_E(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_WARN(format, ...) FT_DEBUG_PRINT_W(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_INFO(format, ...) FT_DEBUG_PRINT_I(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_DEBUG(format, ...) FT_DEBUG_PRINT_D(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) + +/************************** Function Prototypes ******************************/ + + +/*****************************************************************************/ +static inline void UsbMouseLeftButtonCB(void) +{ + printf("<-\r\n"); +} + +static inline void UsbMouseRightButtonCB(void) +{ + printf("->\r\n"); +} + +static inline void UsbMouseMiddleButtonCB(void) +{ + printf("C\r\n"); +} + +static void UsbMouseHandleInput(struct usb_hid_mouse_report *input) +{ + /*------------- button state -------------*/ + if (input->buttons & HID_MOUSE_INPUT_BUTTON_LEFT) + { + UsbMouseLeftButtonCB(); + } + + if (input->buttons & HID_MOUSE_INPUT_BUTTON_MIDDLE) + { + UsbMouseMiddleButtonCB(); + } + + if (input->buttons & HID_MOUSE_INPUT_BUTTON_RIGHT) + { + UsbMouseRightButtonCB(); + } + + /*------------- cursor movement -------------*/ + printf("[x:%d y:%d w:%d]\r\n", input->xdisp, input->ydisp, input->wdisp); +} + +static void UsbMouseCallback(void *arg, int nbytes) +{ + struct usbh_hid *hid_class = (struct usbh_hid *)arg; + + if (nbytes > 0) + { + UsbMouseHandleInput((struct usb_hid_mouse_report *)mouse_buffer); + } + + if (mouse_timer) + { + usb_osal_timer_start(mouse_timer); + } +} + +static void UsbMouseTimeout(void *arg) +{ + struct usbh_hid *hid = (struct usbh_hid *)arg; + + usbh_int_urb_fill(&hid->intin_urb, hid->hport, hid->intin, mouse_buffer, hid->intin->wMaxPacketSize, 0, UsbMouseCallback, hid); + usbh_submit_urb(&hid->intin_urb); +} + +static void PUSB2UsbMouseTask(void *args) +{ + int ret; + u8 id = (u8)usb_id; + struct usbh_hid *mouse_class; + const char *devname = (const char *)args; + + mouse_class = (struct usbh_hid *)usbh_find_class_instance(devname); + if (mouse_class == NULL) + { + FUSB_ERROR("Do not find %s.", devname); + goto task_exit; + } + + mouse_timer = usb_osal_timer_create("mouse_timer", + USBH_GET_URB_INTERVAL(mouse_class->intin->bInterval, mouse_class->hport->speed), + UsbMouseTimeout, + mouse_class, + false); + if (mouse_timer != NULL) + { + usb_osal_timer_start(mouse_timer); + } + + /* check hid device information */ + printf("HID (/dev/input%d) info:\r\n", (char)mouse_class->minor); + printf(" USB: 0x%04x\r\n", mouse_class->hport->device_desc.bcdUSB); + printf(" Class: 0x%02x\r\n", mouse_class->hport->device_desc.bDeviceClass); + printf(" Subclass: 0x%02x\r\n", mouse_class->hport->device_desc.bDeviceSubClass); + printf(" Protocol: 0x%02x\r\n", mouse_class->hport->device_desc.bDeviceProtocol); + printf(" Intr in: %d(mps) %d(interval)\r\n", mouse_class->intin->wMaxPacketSize, + mouse_class->intin->bInterval); + printf(" Intr out: %d(mps) %d(interval)\r\n", mouse_class->intout->wMaxPacketSize, + mouse_class->intout->bInterval); + + printf("Now you can move and click connected mouse \r\n"); + + vTaskDelay(PUSB2_INPUT_WAIT_TIME); /* wait user input for a while */ + + printf("Input finished, exit...\r\n"); + +task_exit: + ret = (ret == 0) ? PUSB2_USB_MOUSE_SUCCESS : PUSB2_USB_MOUSE_FAIL; + xQueueSend(xQueue, &ret, 0); + vTaskDelete(NULL); +} + +void usbh_hid_run(struct usbh_hid *hid_class) +{ + struct usbh_hubport *hport = hid_class->hport; + uint8_t intf = hid_class->intf; + + if (HID_PROTOCOL_KEYBOARD == hport->config.intf[intf].altsetting[0].intf_desc.bInterfaceProtocol) + { + printf("**/dev/input%d is keyboard \r\n", hid_class->minor); + } + else if (HID_PROTOCOL_MOUSE == hport->config.intf[intf].altsetting[0].intf_desc.bInterfaceProtocol) + { + printf("**/dev/input%d is mouse \r\n", hid_class->minor); + } +} + +BaseType_t FFreeRTOSRunPUSB2Mouse(u32 id, const char *devname) +{ + BaseType_t ret = pdPASS; + int task_res = PUSB2_USB_MOUSE_SUCCESS; + xQueue = xQueueCreate(1, sizeof(int)); + if (xQueue == NULL) + { + FUSB_ERROR("xQueue create failed.\r\n"); + goto exit; + } + + usb_id = id; + + ret = xTaskCreate((TaskFunction_t)PUSB2UsbMouseTask, + (const char *)"PUSB2UsbMouseTask", + (uint16_t)4096, + (void *)devname, + (UBaseType_t)configMAX_PRIORITIES - 1, + NULL); + if (ret != pdPASS) + { + FUSB_ERROR("xTaskCreate create failed.\r\n"); + goto exit; + } + + ret = xQueueReceive(xQueue, &task_res, TIMER_OUT); + if (ret != pdPASS) + { + FUSB_ERROR("xQueue receive timeout.\r\n"); + goto exit; + } + +exit: + if (xQueue) + { + vQueueDelete(xQueue); + } + + if (task_res != PUSB2_USB_MOUSE_SUCCESS) + { + printf("%s@%d: PUSB2 usb mouse example [failure], task_res = %d\r\n", __func__, __LINE__, task_res); + return pdFAIL; + } + else + { + printf("%s@%d: PUSB2 usb mouse example [success].\r\n", __func__, __LINE__); + return pdTRUE; + } +} \ No newline at end of file diff --git a/example/peripheral/usb/xhci_pcie/README.md b/example/peripheral/usb/xhci_pcie/README.md index c8036939e762128e8b13b1bd52f1a60cf46a5015..6be649e3565c76d7e5c53002a10cb05cc1de999b 100644 --- a/example/peripheral/usb/xhci_pcie/README.md +++ b/example/peripheral/usb/xhci_pcie/README.md @@ -27,11 +27,8 @@ CherryUSB 是一个用于嵌入式系统 USB 协议栈,支持运行在 Host ![μPD720201](./figs/uPD720201.png) -> 目前 CherryUSB 只支持使用 USB 2.0 port,四路 USB 接口中有些是默认走 USB 3.0 port,还无法使用,要选择默认 USB 2.0 port 的口,如上图所示的连接方式 - -- PCIe 卡默认接在 PCIE 0 控制器上,接在其它控制器上要在例程中修改 FPCIE_INSTANCE_ID 以及 PCIE 中断号 - - 本例程基于E2000 Demo 开发板,使用logitech键盘、Dell鼠标和Sandisk盘完成测试 +- 本例程支持D200 Demo 开发板 ### 2.2 SDK配置方法 @@ -85,54 +82,74 @@ tftpboot 0x90100000 freertos.elf bootelf -p 0x90100000 ``` -### 2.4 输出与实验现象 +### 2.4 输出与实验现象 (E2000D/Q Demo 板) >描述输入输出情况,列出存在哪些输出,对应的输出是什么(建议附录相关现象图片)
+#### 2.4.1 枚举 USB 设备 + +- 将 USB 设备连接在 PCIe XHCI 卡上 -#### 2.4.1 读写 U 盘 +![USB 设备](./figs/xhci_pcie_usb_devices.png) -- 将 U 盘(USB3.0 接口U盘)插在 USB 口,初始化 XHCI 控制器后,查看 U 盘设备是否枚举成功,然后通过枚举成功后返回的设备路径`/usb0/sda`读写 U 盘 +- 输入下面的命令,开始枚举 USB 设备 ``` -usb init 0 -usb lsusb 0 -t -usb disk /usb0/sda +usb start ``` -![usb_disk](./figs/usb_disk_connection.jpg) +- 设备枚举完成后,输入命令查看枚举到的 USB 设备的拓扑结构, -- 输入`usb disk`后,启动一个任务不断读写U盘 +``` +usb lsusb -t +``` -![usb_disk_init](./figs/usb_disk.png) +![发现 USB 设备](./figs/xhci_pcie_attach_devices.png) -#### 2.4.2 获取键盘输入 +#### 2.4.2 使用 U 盘 -- 将键盘插在 USB 口,鼠标插在 USB-1 口,分别初始化 USB-0 和 USB-1 控制器,查看键盘和鼠标是否枚举成功,通过枚举成功后返回的设备路径`/usb0/kbd0`和`/usb1/mouse1`,开启键盘和鼠标输入后进行读取 +- 主要的测试方法和 [XHCI_Platform 例程](../xhci_platform/README.md) 中一致 ``` -usb init 0 -usb lsusb 0 -t -usb kbd /usb0/kbd0 +usb disk /dev/sda +usb diskbench /dev/sdb ``` -- 之后可以通过中断处理键盘输入,如下所示,`hello cherryusb in phytium` 是通过 /usb0/kbd0 设备输入的 +![USB U 盘读写速度](./figs/xhci_pcie_usb_disk_speed.png) -![Alt text](./figs/usb_kbd.png) +#### 2.4.3 使用 USB 鼠标和键盘 + +- 主要的测试方法和 [XHCI_Platform 例程](../xhci_platform/README.md) 中一致,这次枚举过程中鼠标对应设备 `/dev/input2`,具体使用时要看枚举打印信息 + +``` +usb mouse /dev/input2 +``` -#### 2.4.2 获取鼠标输入 +![USB 鼠标](./figs/xhci_pcie_usb_mouse.png) ``` -usb init 0 -usb lsusb 0 -t -usb mouse /usb0/mouse0 +usb keyboard /dev/input0 ``` -- 之后可以通过中断处理鼠标输入 +![USB 键盘](./figs/xhci_pcie_usb_keyboard.png) -![Alt text](./figs/usb_mouse.png) -- 上图中,首先打印的是通过 USB 键盘输入的字符串,以及一系列特殊字符,然后是鼠标的输入,x和y是鼠标的平面坐标位置,w是鼠标中间滚轮的位置,<-、-> 和 C 分别是按下鼠标左、右键和中间滚轮后的返回 + +#### 2.4.4 D2000 Demo 板上进行测试 + +- 在 D2000 Demo 板上可以进行测试,在开发板上有四个 USB 插槽,它们属于同一个 PCIe XHCI 控制器,对应控制器上不同的 Rootport,Rootport 中部分是 USB 3.X 协议的,另外一部分是 USB 2.X 协议的 + +![D2000 Demo 板](./figs/d2000_demo.jpg) + +![连接 USB 设备](./figs/connect_usb_devices.png) + +- 在开发板上连接若干设备后,输入 `usb start` 开始枚举设备,完成设备枚举后输入命令查看设备,键盘对应 + +``` +usb lsusb -t +``` + +![](./figs/d2000_devices.png) ## 3. 如何解决问题 @@ -144,4 +161,5 @@ usb mouse /usb0/mouse0 - V0.3.1 首次合入 - v0.1.0 支持USB 3.0 设备枚举 -- v0.7.1 区分 XHCI 平台设备和 PCIe 设备 \ No newline at end of file +- v0.7.1 区分 XHCI 平台设备和 PCIe 设备 +- v1.0.0 更新 CherryUSB,解决 Hub 遗留问题,支持 D2000 \ No newline at end of file diff --git a/example/peripheral/usb/xhci_pcie/configs/d2000_aarch32_test_cherry_usb.config b/example/peripheral/usb/xhci_pcie/configs/d2000_aarch32_test_cherry_usb.config new file mode 100644 index 0000000000000000000000000000000000000000..e3513e68f4f1944777dad4d9146e80dcd4e82943 --- /dev/null +++ b/example/peripheral/usb/xhci_pcie/configs/d2000_aarch32_test_cherry_usb.config @@ -0,0 +1,367 @@ +CONFIG_USE_FREERTOS=y + +# +# Arch configuration +# +CONFIG_TARGET_ARMv8=y +CONFIG_ARCH_NAME="armv8" + +# +# Arm architecture configuration +# +# CONFIG_ARCH_ARMV8_AARCH64 is not set +CONFIG_ARCH_ARMV8_AARCH32=y + +# +# Compiler configuration +# +CONFIG_ARM_GCC_SELECT=y +# CONFIG_ARM_CLANG_SELECT is not set +CONFIG_TOOLCHAIN_NAME="gcc" +CONFIG_TARGET_ARMV8_AARCH32=y +CONFIG_ARCH_EXECUTION_STATE="aarch32" + +# +# Fpu configuration +# +CONFIG_CRYPTO_NEON_FP_ARMV8=y +# CONFIG_VFPV4 is not set +# CONFIG_VFPV4_D16 is not set +# CONFIG_VFPV3 is not set +# CONFIG_VFPV3_D16 is not set +CONFIG_ARM_MFPU="crypto-neon-fp-armv8" +CONFIG_MFLOAT_ABI_HARD=y +# CONFIG_MFLOAT_ABI_SOFTFP is not set +CONFIG_ARM_MFLOAT_ABI="hard" +# end of Fpu configuration +# end of Compiler configuration + +# CONFIG_USE_L3CACHE is not set +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arm architecture configuration + +CONFIG_MMU_PAGE_SIZE=0x1000 +CONFIG_FMMU_NUM_L2_TABLES=256 +# end of Arch configuration + +# +# Soc configuration +# +# CONFIG_TARGET_PHYTIUMPI is not set +# CONFIG_TARGET_E2000Q is not set +# CONFIG_TARGET_E2000D is not set +# CONFIG_TARGET_E2000S is not set +# CONFIG_TARGET_FT2004 is not set +CONFIG_TARGET_D2000=y +# CONFIG_TARGET_PD2308 is not set +CONFIG_SOC_NAME="d2000" +CONFIG_SOC_CORE_NUM=8 +CONFIG_F32BIT_MEMORY_ADDRESS=0x80000000 +CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 +CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 +CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 +CONFIG_DEFAULT_DEBUG_PRINT_UART1=y +# CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set +# CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set +# end of Soc configuration + +# +# Board Configuration +# +CONFIG_BOARD_NAME="test" +CONFIG_D2000_TEST_BOARD=y + +# +# IO mux configuration when board start up +# +# CONFIG_CUS_DEMO_BOARD is not set + +# +# Build project name +# +CONFIG_TARGET_NAME="cherry_usb" +# end of Build project name +# end of Board Configuration + +# +# Sdk common configuration +# +CONFIG_ELOG_LINE_BUF_SIZE=0x100 +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +# CONFIG_LOG_INFO is not set +# CONFIG_LOG_WARN is not set +CONFIG_LOG_ERROR=y +# CONFIG_LOG_NONE is not set +CONFIG_LOG_EXTRA_INFO=y +# CONFIG_LOG_DISPALY_CORE_NUM is not set +# CONFIG_BOOTUP_DEBUG_PRINTS is not set +CONFIG_USE_DEFAULT_INTERRUPT_CONFIG=y +CONFIG_INTERRUPT_ROLE_MASTER=y +# CONFIG_INTERRUPT_ROLE_SLAVE is not set +# end of Sdk common configuration + +# +# Drivers configuration +# +CONFIG_USE_IOMUX=y +CONFIG_ENABLE_IOCTRL=y +# CONFIG_ENABLE_IOPAD is not set +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_ETH is not set +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_MIO is not set +# CONFIG_USE_SDMMC is not set +CONFIG_USE_PCIE=y + +# +# Pcie Configuration +# +CONFIG_ENABLE_FPCIE_ECAM=y +# CONFIG_ENABLE_FPCIEC is not set +# end of Pcie Configuration + +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# CONFIG_USE_SATA is not set +# CONFIG_USE_ADC is not set +# CONFIG_USE_PWM is not set +# CONFIG_USE_IPC is not set +# CONFIG_USE_MEDIA is not set +# CONFIG_USE_SCMI_MHU is not set +# CONFIG_USE_I2S is not set +# CONFIG_USE_I3C is not set +# end of Drivers configuration + +# +# Build setup +# +CONFIG_CHECK_DEPS=y +CONFIG_OUTPUT_BINARY=y + +# +# Optimization options +# +CONFIG_DEBUG_NOOPT=y +# CONFIG_DEBUG_CUSTOMOPT is not set +# CONFIG_DEBUG_FULLOPT is not set +CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y +CONFIG_DEBUG_LINK_MAP=y +# CONFIG_CCACHE is not set +# CONFIG_ARCH_COVERAGE is not set +# CONFIG_LTO_FULL is not set +# end of Optimization options + +# +# Debug options +# +# CONFIG_DEBUG_ENABLE_ALL_WARNING is not set +# CONFIG_WALL_WARNING_ERROR is not set +# CONFIG_STRICT_PROTOTYPES is not set +CONFIG_DEBUG_SYMBOLS=y +CONFIG_FRAME_POINTER=y +CONFIG_OUTPUT_ASM_DIS=y +# CONFIG_ENABLE_WSHADOW is not set +# CONFIG_ENABLE_WUNDEF is not set +CONFIG_DOWNGRADE_DIAG_WARNING=y +# end of Debug options + +# +# Lib +# +CONFIG_USE_COMPILE_CHAIN=y +# CONFIG_USE_NEWLIB is not set +# CONFIG_USE_USER_DEFINED is not set +# end of Lib + +# CONFIG_ENABLE_CXX is not set + +# +# Linker Options +# +CONFIG_DEFAULT_LINKER_SCRIPT=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_IMAGE_LOAD_ADDRESS=0x80100000 +CONFIG_IMAGE_MAX_LENGTH=0x2000000 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Build setup + +# +# Component Configuration +# + +# +# Freertos Uart Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Uart Drivers + +# +# Freertos Pwm Drivers +# +# CONFIG_FREERTOS_USE_PWM is not set +# end of Freertos Pwm Drivers + +# +# Freertos Qspi Drivers +# +# CONFIG_FREERTOS_USE_QSPI is not set +# end of Freertos Qspi Drivers + +# +# Freertos Wdt Drivers +# +# CONFIG_FREERTOS_USE_WDT is not set +# end of Freertos Wdt Drivers + +# +# Freertos Eth Drivers +# +# CONFIG_FREERTOS_USE_XMAC is not set +# CONFIG_FREERTOS_USE_GMAC is not set +# end of Freertos Eth Drivers + +# +# Freertos Spim Drivers +# +# CONFIG_FREERTOS_USE_FSPIM is not set +# end of Freertos Spim Drivers + +# +# Freertos DMA Drivers +# +# CONFIG_FREERTOS_USE_FDDMA is not set +# CONFIG_FREERTOS_USE_FGDMA is not set +# end of Freertos DMA Drivers + +# +# Freertos Adc Drivers +# +# CONFIG_FREERTOS_USE_ADC is not set +# end of Freertos Adc Drivers + +# +# Freertos Can Drivers +# +# CONFIG_FREERTOS_USE_CAN is not set +# end of Freertos Can Drivers + +# +# Freertos I2c Drivers +# +# CONFIG_FREERTOS_USE_I2C is not set +# end of Freertos I2c Drivers + +# +# Freertos Mio Drivers +# +# CONFIG_FREERTOS_USE_MIO is not set +# end of Freertos Mio Drivers + +# +# Freertos Timer Drivers +# +# CONFIG_FREERTOS_USE_TIMER is not set +# end of Freertos Timer Drivers + +# +# Freertos Media Drivers +# +# CONFIG_FREERTOS_USE_MEDIA is not set +# end of Freertos Media Drivers + +# +# Freertos I2s Drivers +# +# CONFIG_FREERTOS_USE_I2S is not set +# end of Freertos I2s Drivers +# end of Component Configuration + +# +# Third-party configuration +# +# CONFIG_USE_LWIP is not set +CONFIG_USE_LETTER_SHELL=y + +# +# Letter Shell Configuration +# +CONFIG_LS_PL011_UART=y +CONFIG_DEFAULT_LETTER_SHELL_USE_UART1=y +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set +# end of Letter Shell Configuration + +# CONFIG_USE_AMP is not set +# CONFIG_USE_YMODEM is not set +# CONFIG_USE_SFUD is not set +CONFIG_USE_BACKTRACE=y +# CONFIG_USE_FATFS_0_1_4 is not set +CONFIG_USE_TLSF=y +# CONFIG_USE_SPIFFS is not set +# CONFIG_USE_LITTLE_FS is not set +# CONFIG_USE_LVGL is not set +# CONFIG_USE_FREEMODBUS is not set +CONFIG_USE_CHERRY_USB=y + +# +# CherryUSB Configuration +# +# CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set +CONFIG_CHERRY_USB_PORT_XHCI_PCIE=y +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set +CONFIG_CHERRY_USB_PORT_XHCI=y +CONFIG_CHERRYUSB_HOST=y +CONFIG_CHERRY_USB_HOST_HUB=y +CONFIG_CHERRY_USB_HOST_MSC=y +CONFIG_CHERRY_USB_HOST_HID=y +# end of CherryUSB Configuration + +# CONFIG_USE_FSL_SDMMC is not set +# CONFIG_USE_FSL_WIFI is not set +# end of Third-party configuration + +# +# FreeRTOS Kernel Configuration +# +CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_MAX_PRIORITIES=32 +CONFIG_FREERTOS_KERNEL_INTERRUPT_PRIORITIES=13 +CONFIG_FREERTOS_MAX_API_CALL_INTERRUPT_PRIORITIES=11 +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +CONFIG_FREERTOS_MINIMAL_TASK_STACKSIZE=1024 +CONFIG_FREERTOS_MAX_TASK_NAME_LEN=32 +CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y +# CONFIG_FREERTOS_USE_TICKLESS_IDLE is not set +CONFIG_FREERTOS_TOTAL_HEAP_SIZE=10240 +CONFIG_FREERTOS_TASK_FPU_SUPPORT=1 +# CONFIG_FREERTOS_USE_POSIX is not set +# end of FreeRTOS Kernel Configuration diff --git a/example/peripheral/usb/xhci_pcie/configs/d2000_aarch64_test_cherry_usb.config b/example/peripheral/usb/xhci_pcie/configs/d2000_aarch64_test_cherry_usb.config new file mode 100644 index 0000000000000000000000000000000000000000..54b3fb8be4a7fabc7957dcb329069a75b087a5af --- /dev/null +++ b/example/peripheral/usb/xhci_pcie/configs/d2000_aarch64_test_cherry_usb.config @@ -0,0 +1,356 @@ +CONFIG_USE_FREERTOS=y + +# +# Arch configuration +# +CONFIG_TARGET_ARMv8=y +CONFIG_ARCH_NAME="armv8" + +# +# Arm architecture configuration +# +CONFIG_ARCH_ARMV8_AARCH64=y +# CONFIG_ARCH_ARMV8_AARCH32 is not set + +# +# Compiler configuration +# +CONFIG_ARM_GCC_SELECT=y +# CONFIG_ARM_CLANG_SELECT is not set +CONFIG_TOOLCHAIN_NAME="gcc" +CONFIG_TARGET_ARMV8_AARCH64=y +CONFIG_ARCH_EXECUTION_STATE="aarch64" +CONFIG_ARM_NEON=y +CONFIG_ARM_CRC=y +CONFIG_ARM_CRYPTO=y +CONFIG_ARM_FLOAT_POINT=y +# CONFIG_GCC_CODE_MODEL_TINY is not set +CONFIG_GCC_CODE_MODEL_SMALL=y +# CONFIG_GCC_CODE_MODEL_LARGE is not set +# end of Compiler configuration + +# CONFIG_USE_L3CACHE is not set +CONFIG_BOOT_WITH_FLUSH_CACHE=y +# CONFIG_MMU_DEBUG_PRINTS is not set +# end of Arm architecture configuration + +CONFIG_MMU_PAGE_SIZE=0x1000 +CONFIG_MAX_XLAT_TABLES=256 +# end of Arch configuration + +# +# Soc configuration +# +# CONFIG_TARGET_PHYTIUMPI is not set +# CONFIG_TARGET_E2000Q is not set +# CONFIG_TARGET_E2000D is not set +# CONFIG_TARGET_E2000S is not set +# CONFIG_TARGET_FT2004 is not set +CONFIG_TARGET_D2000=y +# CONFIG_TARGET_PD2308 is not set +CONFIG_SOC_NAME="d2000" +CONFIG_SOC_CORE_NUM=8 +CONFIG_F32BIT_MEMORY_ADDRESS=0x80000000 +CONFIG_F32BIT_MEMORY_LENGTH=0x80000000 +CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000 +CONFIG_F64BIT_MEMORY_LENGTH=0x800000000 +CONFIG_DEFAULT_DEBUG_PRINT_UART1=y +# CONFIG_DEFAULT_DEBUG_PRINT_UART0 is not set +# CONFIG_DEFAULT_DEBUG_PRINT_UART2 is not set +# end of Soc configuration + +# +# Board Configuration +# +CONFIG_BOARD_NAME="test" +CONFIG_D2000_TEST_BOARD=y + +# +# IO mux configuration when board start up +# +# CONFIG_CUS_DEMO_BOARD is not set + +# +# Build project name +# +CONFIG_TARGET_NAME="cherry_usb" +# end of Build project name +# end of Board Configuration + +# +# Sdk common configuration +# +CONFIG_ELOG_LINE_BUF_SIZE=0x100 +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +# CONFIG_LOG_INFO is not set +# CONFIG_LOG_WARN is not set +CONFIG_LOG_ERROR=y +# CONFIG_LOG_NONE is not set +CONFIG_LOG_EXTRA_INFO=y +# CONFIG_LOG_DISPALY_CORE_NUM is not set +# CONFIG_BOOTUP_DEBUG_PRINTS is not set +CONFIG_USE_DEFAULT_INTERRUPT_CONFIG=y +CONFIG_INTERRUPT_ROLE_MASTER=y +# CONFIG_INTERRUPT_ROLE_SLAVE is not set +# end of Sdk common configuration + +# +# Drivers configuration +# +CONFIG_USE_IOMUX=y +CONFIG_ENABLE_IOCTRL=y +# CONFIG_ENABLE_IOPAD is not set +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_ETH is not set +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_MIO is not set +# CONFIG_USE_SDMMC is not set +CONFIG_USE_PCIE=y + +# +# Pcie Configuration +# +CONFIG_ENABLE_FPCIE_ECAM=y +# CONFIG_ENABLE_FPCIEC is not set +# end of Pcie Configuration + +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# CONFIG_USE_SATA is not set +# CONFIG_USE_ADC is not set +# CONFIG_USE_PWM is not set +# CONFIG_USE_IPC is not set +# CONFIG_USE_MEDIA is not set +# CONFIG_USE_SCMI_MHU is not set +# CONFIG_USE_I2S is not set +# CONFIG_USE_I3C is not set +# end of Drivers configuration + +# +# Build setup +# +CONFIG_CHECK_DEPS=y +CONFIG_OUTPUT_BINARY=y + +# +# Optimization options +# +CONFIG_DEBUG_NOOPT=y +# CONFIG_DEBUG_CUSTOMOPT is not set +# CONFIG_DEBUG_FULLOPT is not set +CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y +CONFIG_DEBUG_LINK_MAP=y +# CONFIG_CCACHE is not set +# CONFIG_ARCH_COVERAGE is not set +# CONFIG_LTO_FULL is not set +# end of Optimization options + +# +# Debug options +# +# CONFIG_DEBUG_ENABLE_ALL_WARNING is not set +# CONFIG_WALL_WARNING_ERROR is not set +# CONFIG_STRICT_PROTOTYPES is not set +CONFIG_DEBUG_SYMBOLS=y +CONFIG_FRAME_POINTER=y +CONFIG_OUTPUT_ASM_DIS=y +# CONFIG_ENABLE_WSHADOW is not set +# CONFIG_ENABLE_WUNDEF is not set +CONFIG_DOWNGRADE_DIAG_WARNING=y +# end of Debug options + +# +# Lib +# +CONFIG_USE_COMPILE_CHAIN=y +# CONFIG_USE_NEWLIB is not set +# CONFIG_USE_USER_DEFINED is not set +# end of Lib + +# CONFIG_ENABLE_CXX is not set + +# +# Linker Options +# +CONFIG_DEFAULT_LINKER_SCRIPT=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_IMAGE_LOAD_ADDRESS=0x80100000 +CONFIG_IMAGE_MAX_LENGTH=0x2000000 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Build setup + +# +# Component Configuration +# + +# +# Freertos Uart Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Uart Drivers + +# +# Freertos Pwm Drivers +# +# CONFIG_FREERTOS_USE_PWM is not set +# end of Freertos Pwm Drivers + +# +# Freertos Qspi Drivers +# +# CONFIG_FREERTOS_USE_QSPI is not set +# end of Freertos Qspi Drivers + +# +# Freertos Wdt Drivers +# +# CONFIG_FREERTOS_USE_WDT is not set +# end of Freertos Wdt Drivers + +# +# Freertos Eth Drivers +# +# CONFIG_FREERTOS_USE_XMAC is not set +# CONFIG_FREERTOS_USE_GMAC is not set +# end of Freertos Eth Drivers + +# +# Freertos Spim Drivers +# +# CONFIG_FREERTOS_USE_FSPIM is not set +# end of Freertos Spim Drivers + +# +# Freertos DMA Drivers +# +# CONFIG_FREERTOS_USE_FDDMA is not set +# CONFIG_FREERTOS_USE_FGDMA is not set +# end of Freertos DMA Drivers + +# +# Freertos Adc Drivers +# +# CONFIG_FREERTOS_USE_ADC is not set +# end of Freertos Adc Drivers + +# +# Freertos Can Drivers +# +# CONFIG_FREERTOS_USE_CAN is not set +# end of Freertos Can Drivers + +# +# Freertos I2c Drivers +# +# CONFIG_FREERTOS_USE_I2C is not set +# end of Freertos I2c Drivers + +# +# Freertos Mio Drivers +# +# CONFIG_FREERTOS_USE_MIO is not set +# end of Freertos Mio Drivers + +# +# Freertos Timer Drivers +# +# CONFIG_FREERTOS_USE_TIMER is not set +# end of Freertos Timer Drivers + +# +# Freertos Media Drivers +# +# CONFIG_FREERTOS_USE_MEDIA is not set +# end of Freertos Media Drivers + +# +# Freertos I2s Drivers +# +# CONFIG_FREERTOS_USE_I2S is not set +# end of Freertos I2s Drivers +# end of Component Configuration + +# +# Third-party configuration +# +# CONFIG_USE_LWIP is not set +CONFIG_USE_LETTER_SHELL=y + +# +# Letter Shell Configuration +# +CONFIG_LS_PL011_UART=y +CONFIG_DEFAULT_LETTER_SHELL_USE_UART1=y +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART0 is not set +# CONFIG_DEFAULT_LETTER_SHELL_USE_UART2 is not set +# end of Letter Shell Configuration + +# CONFIG_USE_AMP is not set +# CONFIG_USE_YMODEM is not set +# CONFIG_USE_SFUD is not set +CONFIG_USE_BACKTRACE=y +# CONFIG_USE_FATFS_0_1_4 is not set +CONFIG_USE_TLSF=y +# CONFIG_USE_SPIFFS is not set +# CONFIG_USE_LITTLE_FS is not set +# CONFIG_USE_LVGL is not set +# CONFIG_USE_FREEMODBUS is not set +CONFIG_USE_CHERRY_USB=y + +# +# CherryUSB Configuration +# +# CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set +CONFIG_CHERRY_USB_PORT_XHCI_PCIE=y +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set +CONFIG_CHERRY_USB_PORT_XHCI=y +CONFIG_CHERRYUSB_HOST=y +CONFIG_CHERRY_USB_HOST_HUB=y +CONFIG_CHERRY_USB_HOST_MSC=y +CONFIG_CHERRY_USB_HOST_HID=y +# end of CherryUSB Configuration + +# CONFIG_USE_FSL_SDMMC is not set +# CONFIG_USE_FSL_WIFI is not set +# end of Third-party configuration + +# +# FreeRTOS Kernel Configuration +# +CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y +CONFIG_FREERTOS_HZ=1000 +CONFIG_FREERTOS_MAX_PRIORITIES=32 +CONFIG_FREERTOS_KERNEL_INTERRUPT_PRIORITIES=13 +CONFIG_FREERTOS_MAX_API_CALL_INTERRUPT_PRIORITIES=11 +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +CONFIG_FREERTOS_MINIMAL_TASK_STACKSIZE=1024 +CONFIG_FREERTOS_MAX_TASK_NAME_LEN=32 +CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y +CONFIG_FREERTOS_USE_TRACE_FACILITY=y +CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y +# CONFIG_FREERTOS_USE_TICKLESS_IDLE is not set +CONFIG_FREERTOS_TOTAL_HEAP_SIZE=10240 +CONFIG_FREERTOS_TASK_FPU_SUPPORT=1 +# CONFIG_FREERTOS_USE_POSIX is not set +# end of FreeRTOS Kernel Configuration diff --git a/example/peripheral/usb/xhci_pcie/configs/e2000d_aarch32_demo_cherry_usb.config b/example/peripheral/usb/xhci_pcie/configs/e2000d_aarch32_demo_cherry_usb.config index fb424396d0d44e652d109f230b192e7e548e7ea0..4b83e5410e894520e24fdc4c14f0d309ddf37aeb 100644 --- a/example/peripheral/usb/xhci_pcie/configs/e2000d_aarch32_demo_cherry_usb.config +++ b/example/peripheral/usb/xhci_pcie/configs/e2000d_aarch32_demo_cherry_usb.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -157,8 +151,6 @@ CONFIG_ENABLE_FPCIE_ECAM=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -177,9 +169,9 @@ CONFIG_OUTPUT_BINARY=y # # Optimization options # -# CONFIG_DEBUG_NOOPT is not set +CONFIG_DEBUG_NOOPT=y # CONFIG_DEBUG_CUSTOMOPT is not set -CONFIG_DEBUG_FULLOPT=y +# CONFIG_DEBUG_FULLOPT is not set CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y CONFIG_DEBUG_LINK_MAP=y # CONFIG_CCACHE is not set @@ -193,9 +185,9 @@ CONFIG_DEBUG_LINK_MAP=y # CONFIG_DEBUG_ENABLE_ALL_WARNING is not set # CONFIG_WALL_WARNING_ERROR is not set # CONFIG_STRICT_PROTOTYPES is not set -# CONFIG_DEBUG_SYMBOLS is not set -# CONFIG_FRAME_POINTER is not set -# CONFIG_OUTPUT_ASM_DIS is not set +CONFIG_DEBUG_SYMBOLS=y +CONFIG_FRAME_POINTER=y +CONFIG_OUTPUT_ASM_DIS=y # CONFIG_ENABLE_WSHADOW is not set # CONFIG_ENABLE_WUNDEF is not set CONFIG_DOWNGRADE_DIAG_WARNING=y @@ -349,16 +341,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +# CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set +CONFIG_CHERRY_USB_PORT_XHCI_PCIE=y +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/usb/xhci_pcie/configs/e2000d_aarch64_demo_cherry_usb.config b/example/peripheral/usb/xhci_pcie/configs/e2000d_aarch64_demo_cherry_usb.config index b18dd2b7d6f098dd809b25e5dbe2a25ca1f6e85f..d2c8ffd51c832748c0c8f90c6212862b2ca9c23f 100644 --- a/example/peripheral/usb/xhci_pcie/configs/e2000d_aarch64_demo_cherry_usb.config +++ b/example/peripheral/usb/xhci_pcie/configs/e2000d_aarch64_demo_cherry_usb.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -151,8 +145,6 @@ CONFIG_ENABLE_FPCIE_ECAM=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -171,9 +163,9 @@ CONFIG_OUTPUT_BINARY=y # # Optimization options # -# CONFIG_DEBUG_NOOPT is not set +CONFIG_DEBUG_NOOPT=y # CONFIG_DEBUG_CUSTOMOPT is not set -CONFIG_DEBUG_FULLOPT=y +# CONFIG_DEBUG_FULLOPT is not set CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y CONFIG_DEBUG_LINK_MAP=y # CONFIG_CCACHE is not set @@ -187,9 +179,9 @@ CONFIG_DEBUG_LINK_MAP=y # CONFIG_DEBUG_ENABLE_ALL_WARNING is not set # CONFIG_WALL_WARNING_ERROR is not set # CONFIG_STRICT_PROTOTYPES is not set -# CONFIG_DEBUG_SYMBOLS is not set -# CONFIG_FRAME_POINTER is not set -# CONFIG_OUTPUT_ASM_DIS is not set +CONFIG_DEBUG_SYMBOLS=y +CONFIG_FRAME_POINTER=y +CONFIG_OUTPUT_ASM_DIS=y # CONFIG_ENABLE_WSHADOW is not set # CONFIG_ENABLE_WUNDEF is not set CONFIG_DOWNGRADE_DIAG_WARNING=y @@ -338,16 +330,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +# CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set +CONFIG_CHERRY_USB_PORT_XHCI_PCIE=y +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/usb/xhci_pcie/configs/e2000q_aarch32_demo_cherry_usb.config b/example/peripheral/usb/xhci_pcie/configs/e2000q_aarch32_demo_cherry_usb.config index ab6096ca75719c9ce556bb038df3f4b19a137a7d..1362725a1eef556d367acf7c872449750af8f8b1 100644 --- a/example/peripheral/usb/xhci_pcie/configs/e2000q_aarch32_demo_cherry_usb.config +++ b/example/peripheral/usb/xhci_pcie/configs/e2000q_aarch32_demo_cherry_usb.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -156,8 +150,6 @@ CONFIG_ENABLE_FPCIE_ECAM=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -176,9 +168,9 @@ CONFIG_OUTPUT_BINARY=y # # Optimization options # -# CONFIG_DEBUG_NOOPT is not set +CONFIG_DEBUG_NOOPT=y # CONFIG_DEBUG_CUSTOMOPT is not set -CONFIG_DEBUG_FULLOPT=y +# CONFIG_DEBUG_FULLOPT is not set CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y CONFIG_DEBUG_LINK_MAP=y # CONFIG_CCACHE is not set @@ -192,9 +184,9 @@ CONFIG_DEBUG_LINK_MAP=y # CONFIG_DEBUG_ENABLE_ALL_WARNING is not set # CONFIG_WALL_WARNING_ERROR is not set # CONFIG_STRICT_PROTOTYPES is not set -# CONFIG_DEBUG_SYMBOLS is not set -# CONFIG_FRAME_POINTER is not set -# CONFIG_OUTPUT_ASM_DIS is not set +CONFIG_DEBUG_SYMBOLS=y +CONFIG_FRAME_POINTER=y +CONFIG_OUTPUT_ASM_DIS=y # CONFIG_ENABLE_WSHADOW is not set # CONFIG_ENABLE_WUNDEF is not set CONFIG_DOWNGRADE_DIAG_WARNING=y @@ -348,16 +340,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +# CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set +CONFIG_CHERRY_USB_PORT_XHCI_PCIE=y +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/usb/xhci_pcie/configs/e2000q_aarch64_demo_cherry_usb.config b/example/peripheral/usb/xhci_pcie/configs/e2000q_aarch64_demo_cherry_usb.config index e7b3d67554ed7f47b8a6c52d51a741544e71e303..3f570181469157b360006f350f9fd7f1f1b273b2 100644 --- a/example/peripheral/usb/xhci_pcie/configs/e2000q_aarch64_demo_cherry_usb.config +++ b/example/peripheral/usb/xhci_pcie/configs/e2000q_aarch64_demo_cherry_usb.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -150,8 +144,6 @@ CONFIG_ENABLE_FPCIE_ECAM=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -170,9 +162,9 @@ CONFIG_OUTPUT_BINARY=y # # Optimization options # -# CONFIG_DEBUG_NOOPT is not set +CONFIG_DEBUG_NOOPT=y # CONFIG_DEBUG_CUSTOMOPT is not set -CONFIG_DEBUG_FULLOPT=y +# CONFIG_DEBUG_FULLOPT is not set CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y CONFIG_DEBUG_LINK_MAP=y # CONFIG_CCACHE is not set @@ -186,9 +178,9 @@ CONFIG_DEBUG_LINK_MAP=y # CONFIG_DEBUG_ENABLE_ALL_WARNING is not set # CONFIG_WALL_WARNING_ERROR is not set # CONFIG_STRICT_PROTOTYPES is not set -# CONFIG_DEBUG_SYMBOLS is not set -# CONFIG_FRAME_POINTER is not set -# CONFIG_OUTPUT_ASM_DIS is not set +CONFIG_DEBUG_SYMBOLS=y +CONFIG_FRAME_POINTER=y +CONFIG_OUTPUT_ASM_DIS=y # CONFIG_ENABLE_WSHADOW is not set # CONFIG_ENABLE_WUNDEF is not set CONFIG_DOWNGRADE_DIAG_WARNING=y @@ -337,16 +329,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +# CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set +CONFIG_CHERRY_USB_PORT_XHCI_PCIE=y +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/usb/xhci_pcie/figs/STAR-UPCIE201-V1.0.jpg b/example/peripheral/usb/xhci_pcie/figs/STAR-UPCIE201-V1.0.jpg deleted file mode 100644 index 2c3ad4994074b6046cea697a5481036a6e2dd089..0000000000000000000000000000000000000000 Binary files a/example/peripheral/usb/xhci_pcie/figs/STAR-UPCIE201-V1.0.jpg and /dev/null differ diff --git a/example/peripheral/usb/xhci_pcie/figs/connect_usb_devices.png b/example/peripheral/usb/xhci_pcie/figs/connect_usb_devices.png new file mode 100644 index 0000000000000000000000000000000000000000..2be6e4f08be7a157591eb48b158e50466ed1f9ee Binary files /dev/null and b/example/peripheral/usb/xhci_pcie/figs/connect_usb_devices.png differ diff --git a/example/peripheral/usb/xhci_pcie/figs/d2000_demo.jpg b/example/peripheral/usb/xhci_pcie/figs/d2000_demo.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0d43e63743aa2be9a40e5ea7f5ba08132d925b6e Binary files /dev/null and b/example/peripheral/usb/xhci_pcie/figs/d2000_demo.jpg differ diff --git a/example/peripheral/usb/xhci_pcie/figs/d2000_devices.png b/example/peripheral/usb/xhci_pcie/figs/d2000_devices.png new file mode 100644 index 0000000000000000000000000000000000000000..d00648bfcdc27d33cde96a666b37e86dbc942d62 Binary files /dev/null and b/example/peripheral/usb/xhci_pcie/figs/d2000_devices.png differ diff --git a/example/peripheral/usb/xhci_pcie/figs/uPD720201.png b/example/peripheral/usb/xhci_pcie/figs/uPD720201.png deleted file mode 100644 index a9d30589c618c561f76f21ba2c49d957155c5a34..0000000000000000000000000000000000000000 Binary files a/example/peripheral/usb/xhci_pcie/figs/uPD720201.png and /dev/null differ diff --git a/example/peripheral/usb/xhci_pcie/figs/usb_disk.png b/example/peripheral/usb/xhci_pcie/figs/usb_disk.png deleted file mode 100644 index 289a0bd93bde23c26bcc429f22ce8428900bfc24..0000000000000000000000000000000000000000 Binary files a/example/peripheral/usb/xhci_pcie/figs/usb_disk.png and /dev/null differ diff --git a/example/peripheral/usb/xhci_pcie/figs/usb_disk_connection.jpg b/example/peripheral/usb/xhci_pcie/figs/usb_disk_connection.jpg deleted file mode 100644 index 7ee4ccd49734459070f98034f9df3391ff226a23..0000000000000000000000000000000000000000 Binary files a/example/peripheral/usb/xhci_pcie/figs/usb_disk_connection.jpg and /dev/null differ diff --git a/example/peripheral/usb/xhci_pcie/figs/usb_kbd.png b/example/peripheral/usb/xhci_pcie/figs/usb_kbd.png deleted file mode 100644 index 1b1954dfb9887fbb7b39bfa05bfd7e5759228b73..0000000000000000000000000000000000000000 Binary files a/example/peripheral/usb/xhci_pcie/figs/usb_kbd.png and /dev/null differ diff --git a/example/peripheral/usb/xhci_pcie/figs/usb_mouse.png b/example/peripheral/usb/xhci_pcie/figs/usb_mouse.png deleted file mode 100644 index 19812af3b4aa700ef83ebc85e0fab6c4beeefc13..0000000000000000000000000000000000000000 Binary files a/example/peripheral/usb/xhci_pcie/figs/usb_mouse.png and /dev/null differ diff --git a/example/peripheral/usb/xhci_pcie/figs/xhci_pcie_attach_devices.png b/example/peripheral/usb/xhci_pcie/figs/xhci_pcie_attach_devices.png new file mode 100644 index 0000000000000000000000000000000000000000..30aa4e367008eec9ebf5eb4ba11c5f0c4032af4d Binary files /dev/null and b/example/peripheral/usb/xhci_pcie/figs/xhci_pcie_attach_devices.png differ diff --git a/example/peripheral/usb/xhci_pcie/figs/xhci_pcie_usb_devices.png b/example/peripheral/usb/xhci_pcie/figs/xhci_pcie_usb_devices.png new file mode 100644 index 0000000000000000000000000000000000000000..a823d17f93ba3f6dc0bd16b79ce0604778eb34ce Binary files /dev/null and b/example/peripheral/usb/xhci_pcie/figs/xhci_pcie_usb_devices.png differ diff --git a/example/peripheral/usb/xhci_pcie/figs/xhci_pcie_usb_disk_speed.png b/example/peripheral/usb/xhci_pcie/figs/xhci_pcie_usb_disk_speed.png new file mode 100644 index 0000000000000000000000000000000000000000..4897a74b68e2881fb4004dfc522f84ed4f28fa86 Binary files /dev/null and b/example/peripheral/usb/xhci_pcie/figs/xhci_pcie_usb_disk_speed.png differ diff --git a/example/peripheral/usb/xhci_pcie/figs/xhci_pcie_usb_keyboard.png b/example/peripheral/usb/xhci_pcie/figs/xhci_pcie_usb_keyboard.png new file mode 100644 index 0000000000000000000000000000000000000000..aa539d3cc192d46239aca34fbd43d670274ad337 Binary files /dev/null and b/example/peripheral/usb/xhci_pcie/figs/xhci_pcie_usb_keyboard.png differ diff --git a/example/peripheral/usb/xhci_pcie/figs/xhci_pcie_usb_mouse.png b/example/peripheral/usb/xhci_pcie/figs/xhci_pcie_usb_mouse.png new file mode 100644 index 0000000000000000000000000000000000000000..e167ce0702f4cd2deb89f35e0c52989401b8f296 Binary files /dev/null and b/example/peripheral/usb/xhci_pcie/figs/xhci_pcie_usb_mouse.png differ diff --git a/example/peripheral/usb/xhci_platform/inc/usb_host.h b/example/peripheral/usb/xhci_pcie/inc/xhci_host_example.h similarity index 75% rename from example/peripheral/usb/xhci_platform/inc/usb_host.h rename to example/peripheral/usb/xhci_pcie/inc/xhci_host_example.h index d3887ad17e84493d2a5601dda1670f51663b857e..d5d5cca47f4c27fd81b92e0ec040724358bbcfdd 100644 --- a/example/peripheral/usb/xhci_platform/inc/usb_host.h +++ b/example/peripheral/usb/xhci_pcie/inc/xhci_host_example.h @@ -11,18 +11,19 @@ * See the Phytium Public License for more details. * * - * FilePath: usb_host.h + * FilePath: xhci_host_example.h * Date: 2022-07-19 09:26:25 * LastEditTime: 2022-07-19 09:26:25 - * Description:  This file is for the usb host definition. + * Description:  This file is for the xhci host definition. * * Modify History: * Ver   Who        Date         Changes * ----- ------     --------    -------------------------------------- * 1.0 zhugengyu 2022/9/20 init commit + * 2.0 zhugengyu 2024/7/1 support auto-run */ -#ifndef USB_HOST_H -#define USB_HOST_H +#ifndef XHCI_HOST_EXAMPLE_H +#define XHCI_HOST_EXAMPLE_H #ifdef __cplusplus extern "C" @@ -40,11 +41,10 @@ extern "C" /************************** Function Prototypes ******************************/ /*****************************************************************************/ -BaseType_t FFreeRTOSInitUsb(u32 id); -BaseType_t FFreeRTOSRunUsbDisk(const char *devname); -BaseType_t FFreeRTOSRunUsbKeyboard(const char *devname); -BaseType_t FFreeRTOSRunUsbMouse(const char *devname); -BaseType_t FFreeRTOSListUsbDev(int argc, char *argv[]); +BaseType_t FFreeRTOSRunXhciDisk(u32 id, const char *devname); +BaseType_t FFreeRTOSRunXhciDiskBench(u32 id, const char *devname); +BaseType_t FFreeRTOSRunXhciKeyboard(u32 id, const char *devname); +BaseType_t FFreeRTOSRunXhciMouse(u32 id, const char *devname); #ifdef __cplusplus } diff --git a/example/peripheral/usb/xhci_pcie/main.c b/example/peripheral/usb/xhci_pcie/main.c index b1c1a3a505a8ef6083af9f513d69dfbaa9fcf896..af924ab17d6cd9043ae5a52a1c784106c0d83234 100644 --- a/example/peripheral/usb/xhci_pcie/main.c +++ b/example/peripheral/usb/xhci_pcie/main.c @@ -20,26 +20,57 @@ * Ver   Who         Date         Changes * ----- ------     --------    -------------------------------------- * 1.0 zhugengyu 2022/10/19 init commit + * 2.0 zhugengyu 2024/7/1 support auto-run */ +#include +#include "FreeRTOS.h" +#include "fparameters.h" + +#ifdef CONFIG_USE_LETTER_SHELL #include "shell.h" #include "shell_port.h" -#include +#else + +#include "usbh_core.h" + +#define XHCI_EXAMPLE_TASK_PRIORITY 2U +void XhciPcieExampleTaskEntry(void) +{ + /* init xhci controller */ + + (void)usbh_initialize(0U, 0U); + + vTaskDelete(NULL); +} +#endif int main(void) { - BaseType_t ret; + BaseType_t ret = pdPASS; +#ifdef CONFIG_USE_LETTER_SHELL ret = LSUserShellTask(); if (ret != pdPASS) { goto FAIL_EXIT; } +#else + + taskENTER_CRITICAL(); + ret = xTaskCreate((TaskFunction_t)XhciPcieExampleTaskEntry, /* 任务入口函数 */ + (const char *)"XhciPcieExampleTaskEntry",/* 任务名字 */ + (uint16_t)4096, /* 任务栈大小 */ + NULL,/* 任务入口函数参数 */ + (UBaseType_t)XHCI_EXAMPLE_TASK_PRIORITY, /* 任务的优先级 */ + NULL); + taskEXIT_CRITICAL(); +#endif vTaskStartScheduler(); /* 启动任务,开启调度 */ while (1); /* 正常不会执行到这里 */ FAIL_EXIT: printf("Failed,the ret value is 0x%x. \r\n", ret); - return 0; + return ret; } diff --git a/example/peripheral/usb/xhci_pcie/makefile b/example/peripheral/usb/xhci_pcie/makefile index 7691fd58334cde9d2d6959db772fdd277c34d149..a12ccba8ec27bf8f6fbde4a1138f59f9df72b911 100644 --- a/example/peripheral/usb/xhci_pcie/makefile +++ b/example/peripheral/usb/xhci_pcie/makefile @@ -8,7 +8,6 @@ BOOT_IMG_NAME ?= freertos USER_CSRC := main.c USER_CSRC += $(wildcard src/*.c) -USER_CSRC += $(wildcard ../common/*.c) USER_ASRC := USER_CXXSRC := @@ -19,8 +18,11 @@ USER_INCLUDE := $(PROJECT_DIR) \ include $(FREERTOS_SDK_DIR)/tools/makeall.mk +ifeq ($(OS),Windows_NT) +USR_BOOT_DIR ?= D:\\tftpboot +else USR_BOOT_DIR ?= /mnt/d/tftpboot - +endif image: all @cp ./$(IMAGE_OUT_NAME).elf $(USR_BOOT_DIR)/freertos.elf diff --git a/example/peripheral/usb/xhci_pcie/sdkconfig b/example/peripheral/usb/xhci_pcie/sdkconfig index e7b3d67554ed7f47b8a6c52d51a741544e71e303..3f570181469157b360006f350f9fd7f1f1b273b2 100644 --- a/example/peripheral/usb/xhci_pcie/sdkconfig +++ b/example/peripheral/usb/xhci_pcie/sdkconfig @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -150,8 +144,6 @@ CONFIG_ENABLE_FPCIE_ECAM=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -170,9 +162,9 @@ CONFIG_OUTPUT_BINARY=y # # Optimization options # -# CONFIG_DEBUG_NOOPT is not set +CONFIG_DEBUG_NOOPT=y # CONFIG_DEBUG_CUSTOMOPT is not set -CONFIG_DEBUG_FULLOPT=y +# CONFIG_DEBUG_FULLOPT is not set CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y CONFIG_DEBUG_LINK_MAP=y # CONFIG_CCACHE is not set @@ -186,9 +178,9 @@ CONFIG_DEBUG_LINK_MAP=y # CONFIG_DEBUG_ENABLE_ALL_WARNING is not set # CONFIG_WALL_WARNING_ERROR is not set # CONFIG_STRICT_PROTOTYPES is not set -# CONFIG_DEBUG_SYMBOLS is not set -# CONFIG_FRAME_POINTER is not set -# CONFIG_OUTPUT_ASM_DIS is not set +CONFIG_DEBUG_SYMBOLS=y +CONFIG_FRAME_POINTER=y +CONFIG_OUTPUT_ASM_DIS=y # CONFIG_ENABLE_WSHADOW is not set # CONFIG_ENABLE_WUNDEF is not set CONFIG_DOWNGRADE_DIAG_WARNING=y @@ -337,16 +329,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +# CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set +CONFIG_CHERRY_USB_PORT_XHCI_PCIE=y +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/usb/xhci_pcie/sdkconfig.h b/example/peripheral/usb/xhci_pcie/sdkconfig.h index 10b93c552489c67fe763c536f99cfbb417b97c60..c86ba48fc39de2d73eecda010967efdf7c7248f4 100644 --- a/example/peripheral/usb/xhci_pcie/sdkconfig.h +++ b/example/peripheral/usb/xhci_pcie/sdkconfig.h @@ -99,11 +99,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -136,8 +131,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -#define CONFIG_USE_USB -#define CONFIG_ENABLE_USB_FXHCI /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ @@ -154,9 +147,9 @@ /* Optimization options */ -/* CONFIG_DEBUG_NOOPT is not set */ +#define CONFIG_DEBUG_NOOPT /* CONFIG_DEBUG_CUSTOMOPT is not set */ -#define CONFIG_DEBUG_FULLOPT +/* CONFIG_DEBUG_FULLOPT is not set */ #define CONFIG_DEBUG_OPT_UNUSED_SECTIONS #define CONFIG_DEBUG_LINK_MAP /* CONFIG_CCACHE is not set */ @@ -169,9 +162,9 @@ /* CONFIG_DEBUG_ENABLE_ALL_WARNING is not set */ /* CONFIG_WALL_WARNING_ERROR is not set */ /* CONFIG_STRICT_PROTOTYPES is not set */ -/* CONFIG_DEBUG_SYMBOLS is not set */ -/* CONFIG_FRAME_POINTER is not set */ -/* CONFIG_OUTPUT_ASM_DIS is not set */ +#define CONFIG_DEBUG_SYMBOLS +#define CONFIG_FRAME_POINTER +#define CONFIG_OUTPUT_ASM_DIS /* CONFIG_ENABLE_WSHADOW is not set */ /* CONFIG_ENABLE_WUNDEF is not set */ #define CONFIG_DOWNGRADE_DIAG_WARNING @@ -297,16 +290,14 @@ /* CherryUSB Configuration */ +/* CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM is not set */ +#define CONFIG_CHERRY_USB_PORT_XHCI_PCIE +/* CONFIG_CHERRY_USB_PORT_PUSB2 is not set */ #define CONFIG_CHERRY_USB_PORT_XHCI -/* CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set */ #define CONFIG_CHERRYUSB_HOST -/* CONFIG_CHERRYUSB_DEVICE is not set */ #define CONFIG_CHERRY_USB_HOST_HUB #define CONFIG_CHERRY_USB_HOST_MSC #define CONFIG_CHERRY_USB_HOST_HID -/* CONFIG_CHERRY_USB_HOST_VEDIO is not set */ -/* CONFIG_CHERRY_USB_HOST_CDC is not set */ -/* CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set */ /* end of CherryUSB Configuration */ /* CONFIG_USE_FSL_SDMMC is not set */ /* CONFIG_USE_FSL_WIFI is not set */ diff --git a/example/peripheral/usb/xhci_pcie/src/cmd_usb.c b/example/peripheral/usb/xhci_pcie/src/cmd_usb.c index 8b52d10d70601e6ca02bc6f7f3365bb150435724..e0647cd484c38a77e51597394c22b29d81d0e4ff 100644 --- a/example/peripheral/usb/xhci_pcie/src/cmd_usb.c +++ b/example/peripheral/usb/xhci_pcie/src/cmd_usb.c @@ -28,8 +28,37 @@ #include "FreeRTOS.h" +#include "usbh_core.h" + +#ifdef CONFIG_USE_LETTER_SHELL #include "../src/shell.h" -#include "usb_host.h" +#include "xhci_host_example.h" +#endif + + +#ifdef CONFIG_USE_LETTER_SHELL +BaseType_t FFreeRTOSInitPcieUsb(void); +BaseType_t FFreeRTOSDeInitPcieUsb(void); +BaseType_t FFreeRTOSListUsbDev(int argc, char *argv[]); + +static void USBCmdUsage(void) +{ + printf("Usage:\r\n"); + printf("usb start\r\n"); + printf("-- Start usb bus and enumrate devices\r\n"); + printf("usb stop\r\n"); + printf("-- Stop usb bus and deattach devices\r\n"); + printf("usb lsusb\r\n"); + printf("-- List all attached devices on usb bus\r\n"); + printf("usb disk \r\n"); + printf("-- Read and write usb disk device\r\n"); + printf("usb diskbench \r\n"); + printf("-- Bench read and write usb disk device\r\n"); + printf("usb keyboard \r\n"); + printf("-- Get usb keyboard input\r\n"); + printf("usb mouse \r\n"); + printf("-- Get usb mouse input\r\n"); +} static int USBCmdEntry(int argc, char *argv[]) { @@ -37,42 +66,72 @@ static int USBCmdEntry(int argc, char *argv[]) u32 usb_id = 0; const char *devname; - if (!strcmp(argv[1], "init")) + if (!strcmp(argv[1], "start")) + { + ret = usbh_initialize(0U, 0U); + } + else if (!strcmp(argv[1], "stop")) { - ret = FFreeRTOSInitUsb(usb_id); + ret = usbh_deinitialize(0U); } else if (!strcmp(argv[1], "lsusb")) { - ret = FFreeRTOSListUsbDev(argc - 1, &argv[1]); + ret = lsusb(argc - 1, &argv[1]); } else if (!strcmp(argv[1], "disk")) { - if (argc < 3) { - return -2; + if (argc < 2) + { + devname = "/dev/sda"; + } + else + { + devname = argv[2]; } - devname = argv[2]; /* USB Disk device name provided by CherryUSB */ - ret = FFreeRTOSRunUsbDisk(devname); + ret = FFreeRTOSRunXhciDisk(0U, devname); } - else if (!strcmp(argv[1], "kbd")) + else if (!strcmp(argv[1], "diskbench")) { - if (argc < 3) { - return -2; + if (argc < 2) + { + devname = "/dev/sda"; + } + else + { + devname = argv[2]; } - devname = argv[2]; /* USB keyboard device name provided by CherryUSB */ - ret = FFreeRTOSRunUsbKeyboard(devname); + ret = FFreeRTOSRunXhciDiskBench(0U, devname); + } + else if (!strcmp(argv[1], "keyboard")) + { + if (argc < 2) + { + devname = "/dev/input0"; + } + else + { + devname = argv[2]; + } + + ret = FFreeRTOSRunXhciKeyboard(0U, devname); } else if (!strcmp(argv[1], "mouse")) { - if (argc < 3) { - return -2; + if (argc < 2) + { + devname = "/dev/input0"; + } + else + { + devname = argv[2]; } - devname = argv[2]; /* USB mouse device name provided by CherryUSB */ - ret = FFreeRTOSRunUsbMouse(devname); + ret = FFreeRTOSRunXhciMouse(0U, devname); } return ret; } -SHELL_EXPORT_CMD(SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), usb, USBCmdEntry, test freertos usb driver); \ No newline at end of file +SHELL_EXPORT_CMD(SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), usb, USBCmdEntry, test freertos pcie usb driver); +#endif \ No newline at end of file diff --git a/example/peripheral/usb/xhci_pcie/src/usb_host_pcie.c b/example/peripheral/usb/xhci_pcie/src/usb_host_pcie.c deleted file mode 100644 index 9bd16680f9f13fb7ea688aeba6a500912e409a80..0000000000000000000000000000000000000000 --- a/example/peripheral/usb/xhci_pcie/src/usb_host_pcie.c +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright : (C) 2022 Phytium Information Technology, Inc. - * All Rights Reserved. - * - * This program is OPEN SOURCE software: you can redistribute it and/or modify it - * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, - * either version 1.0 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the Phytium Public License for more details. - * - * - * FilePath: usb_host.c - * Date: 2022-07-22 13:57:42 - * LastEditTime: 2022-07-22 13:57:43 - * Description:  This file is for the usb host functions. - * - * Modify History: - * Ver   Who        Date         Changes - * ----- ------     --------    -------------------------------------- - * 1.0 zhugengyu 2022/9/20 init commit - * 2.0 zhugengyu 2024/1/17 support pcie xhci host - */ -/***************************** Include Files *********************************/ -#include -#include - -#include "FreeRTOS.h" -#include "task.h" - -#include "fassert.h" -#include "finterrupt.h" -#include "fcpu_info.h" -#include "fdebug.h" -#include "fcache.h" -#include "fmemory_pool.h" - -#include "fpcie_ecam.h" -#include "fpcie_ecam_common.h" - -#include "usbh_core.h" -/************************** Constant Definitions *****************************/ -#define FUSB_MEMP_TOTAL_SIZE SZ_1M -#define FPCIE_INSTANCE_ID FPCIE_ECAM_INSTANCE0 - -/**************************** Type Definitions *******************************/ - -/************************** Variable Definitions *****************************/ -static FMemp memp; -static u8 memp_buf[FUSB_MEMP_TOTAL_SIZE]; -static struct usbh_bus usb; -static uintptr usb_base = 0U; -static FPcieEcam pcie_device; - -/***************** Macros (Inline Functions) Definitions *********************/ -#define FUSB_DEBUG_TAG "USB-HC" -#define FUSB_ERROR(format, ...) FT_DEBUG_PRINT_E(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) -#define FUSB_WARN(format, ...) FT_DEBUG_PRINT_W(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) -#define FUSB_INFO(format, ...) FT_DEBUG_PRINT_I(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) -#define FUSB_DEBUG(format, ...) FT_DEBUG_PRINT_D(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) - -/************************** Function Prototypes ******************************/ -extern void USBH_IRQHandler(void *); - -/*****************************************************************************/ -static void UsbHcPcieInterrruptHandler(void *param) -{ - USBH_IRQHandler(param); -} - -static void PCieIntxInit(FPcieEcam *instance_p) -{ - u32 cpu_id; - u32 irq_num = FPCIE_ECAM_INTA_IRQ_NUM; - u32 irq_priority = 13U; - - (void)GetCpuId(&cpu_id); - FUSB_DEBUG("interrupt num: %d", irq_num); - (void)InterruptSetTargetCpus(irq_num, cpu_id); - - InterruptSetPriority(irq_num, irq_priority); - - /* register intr callback */ - InterruptInstall(irq_num, - FPcieEcamIntxIrqHandler, - &pcie_device, - NULL); - - /* enable irq */ - InterruptUmask(irq_num); -} - -static FError PcieInit(FPcieEcam *pcie_device) -{ - FError ret = FT_SUCCESS; - - ret = FPcieEcamCfgInitialize(pcie_device, FPcieEcamLookupConfig(FPCIE_INSTANCE_ID), NULL); - if (FT_SUCCESS != ret) - { - return ret; - } - - FUSB_DEBUG("\n"); - FUSB_DEBUG(" PCI:\n"); - FUSB_DEBUG(" B:D:F VID:PID parent_BDF class_code\n"); - ret = FPcieEcamEnumerateBus(pcie_device, 0); - if (FT_SUCCESS != ret) - { - return ret; - } - - PCieIntxInit(pcie_device); /* register pcie_device intx handler */ -} - -static FError USBPcieIrqInstall(FPcieEcam *pcie_device, u8 bus, u8 device, u8 function) -{ - FError ret = FT_SUCCESS; - FPcieIntxFun intx_fun; - intx_fun.IntxCallBack = UsbHcPcieInterrruptHandler; - intx_fun.args = &usb; - intx_fun.bus = bus; - intx_fun.device = device; - intx_fun.function = function; - - ret = FPcieEcamIntxRegister(pcie_device, bus, device, function, &intx_fun); - if (FT_SUCCESS != ret) - { - FUSB_ERROR("FPcieIntxRegiterIrqHandler failed.\n"); - return ret; - } - - return ret; -} - -void UsbHcSetupMemp(void) -{ - if (FT_COMPONENT_IS_READY != memp.is_ready) - { - USB_ASSERT(FT_SUCCESS == FMempInit(&memp, &memp_buf[0], &memp_buf[0] + FUSB_MEMP_TOTAL_SIZE)); - } -} - -/* implement cherryusb weak functions */ -void usb_hc_low_level_init(uint32_t id) -{ - FError ret = FT_SUCCESS; - u32 instance_id = id; - s32 host; - u32 bdf; - u32 class; - u16 pci_command; - u8 bus,device,function; - u16 vid, did; - uintptr bar0_addr = 0; - uintptr bar1_addr = 0; - const u32 class_code = FPCI_CLASS_SERIAL_USB_XHCI; /* sub class and base class definition */ - u32 config_data; - - UsbHcSetupMemp(); - - ret = PcieInit(&pcie_device); - if (FT_SUCCESS != ret) - { - FUSB_ERROR("FPcieInit failed.\n"); - FASSERT(0); - return; - } - - /* find xhci host from pcie_device instance */ - for (host = 0; host < pcie_device.scans_bdf_count; host++) - { - bus = pcie_device.scans_bdf[host].bus; - device = pcie_device.scans_bdf[host].device; - function= pcie_device.scans_bdf[host].function; - - FPcieEcamReadConfigSpace(&pcie_device,bus,device,function,FPCIE_CCR_REV_CLASSID_REGS,&config_data); - class = config_data >> 8; - - if (class == class_code) - { - (void)FPcieEcamReadConfigSpace(&pcie_device,bus,device,function,FPCIE_CCR_ID_REG,&config_data); - vid = FPCIE_CCR_VENDOR_ID_MASK(config_data); - did = FPCIE_CCR_DEVICE_ID_MASK(config_data); - - FUSB_DEBUG("xHCI-PCI HOST found !!!, b.d.f = %x.%x.%x\n", bus, device, function); - FPcieEcamReadConfigSpace(&pcie_device,bus,device,function,FPCIE_CCR_BAR_ADDR0_REGS,(u32 *)&bar0_addr); - bar0_addr &= ~0xfff; - -#if defined(FAARCH64_USE) - FPcieEcamReadConfigSpace(&pcie_device,bus,device,function,FPCIE_CCR_BAR_ADDR1_REGS,(u32 *)&bar1_addr); -#endif - - FUSB_DEBUG("FSataPcieIntrInstall BarAddress %p:%p", bar1_addr, bar0_addr); - - if ((0x0 == bar0_addr) && (0x0 == bar1_addr)) - { - FUSB_ERROR("Invalid Bar address"); - FASSERT(0); - return; - } - - USBPcieIrqInstall(&pcie_device, bus, device, function); -#ifdef __aarch64__ - usb_base = (bar1_addr << 32U) | bar0_addr; -#else - usb_base = bar0_addr; -#endif - FUSB_INFO("xHCI base address: 0x%lx", usb_base); - } - } - -} - -unsigned long usb_hc_get_register_base(uint32_t id) -{ - return usb_base; -} - -void *usb_hc_malloc(size_t size) -{ - return usb_hc_malloc_align(sizeof(void *), size); -} - -void *usb_hc_malloc_align(size_t align, size_t size) -{ - void *result = FMempMallocAlign(&memp, size, align); - - if (result) - { - memset(result, 0U, size); - } - - return result; -} - -void usb_hc_free(void *ptr) -{ - if (NULL != ptr) - { - FMempFree(&memp, ptr); - } -} - -void usb_assert(const char *filename, int linenum) -{ - FAssert(filename, linenum, 0xff); -} - -void usb_hc_dcache_invalidate(void *addr, unsigned long len) -{ - FCacheDCacheInvalidateRange((uintptr)addr, len); -} -/*****************************************/ - -static void UsbInitTask(void *args) -{ - u32 id = (u32)(uintptr)args; - memset(&usb, 0 , sizeof(usb)); - - if (0 == usbh_initialize(id, &usb)) - { - printf("Init cherryusb host successfully.put 'usb lsusb -t' to see devices.\r\n"); - } - else - { - FUSB_ERROR("Init cherryusb host failed."); - } - - vTaskDelete(NULL); -} - -BaseType_t FFreeRTOSInitUsb(u32 id) -{ - BaseType_t ret = pdPASS; - - taskENTER_CRITICAL(); /* no schedule when create task */ - - ret = xTaskCreate((TaskFunction_t)UsbInitTask, - (const char *)"UsbInitTask", - (uint16_t)2048, - (void *)(uintptr)id, - (UBaseType_t)configMAX_PRIORITIES - 1, - NULL); - FASSERT_MSG(pdPASS == ret, "create task failed"); - - taskEXIT_CRITICAL(); /* allow schedule since task created */ - - return ret; -} - -BaseType_t FFreeRTOSListUsbDev(int argc, char *argv[]) -{ - return lsusb(argc, argv); -} \ No newline at end of file diff --git a/example/peripheral/usb/xhci_pcie/src/xhci_usb_disk_bench_example.c b/example/peripheral/usb/xhci_pcie/src/xhci_usb_disk_bench_example.c new file mode 100644 index 0000000000000000000000000000000000000000..ea029a1422dff24d123466e6e8346f73ce5ac3b2 --- /dev/null +++ b/example/peripheral/usb/xhci_pcie/src/xhci_usb_disk_bench_example.c @@ -0,0 +1,228 @@ +/* + * Copyright : (C) 2022 Phytium Information Technology, Inc. + * All Rights Reserved. + * + * This program is OPEN SOURCE software: you can redistribute it and/or modify it + * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, + * either version 1.0 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Phytium Public License for more details. + * + * + * FilePath: xhci_usb_disk_bench_example.c + * Date: 2022-09-23 08:24:09 + * LastEditTime: 2022-09-23 08:24:10 + * Description:  This file is for the usb disk functions. + * + * Modify History: + * Ver   Who         Date         Changes + * ----- ------     --------    -------------------------------------- + * 1.0 zhugengyu 2022/10/19 init commit + * 2.0 zhugengyu 2024/7/1 support auto-run + */ +/***************************** Include Files *********************************/ +#include +#include + +#include "FreeRTOS.h" +#include "queue.h" +#include "task.h" + +#include "fassert.h" +#include "fdebug.h" +#include "fkernel.h" + +#include "usbh_core.h" +#include "usbh_msc.h" + +#include "xhci_host_example.h" +/************************** Constant Definitions *****************************/ +#define TIMER_OUT (0xFFFFFFFF) + +#define USB_MAX_RW_BLK 1000U +#define USB_DISK_BLK_SIZE 512U +#define USB_DISK_START_BLK 0U +#define USB_BENCH_TIMES 6U +#define USB_BENCH_SIZE (u64)(SZ_1M * 200ULL) +#define USB_BENCH_BLKS (USB_BENCH_SIZE / USB_DISK_BLK_SIZE) +/**************************** Type Definitions *******************************/ +enum +{ + XHCI_USB_DISK_RW_SUCCESS = 0, + XHCI_USB_DISK_RW_FAIL = 1, +}; + +/************************** Variable Definitions *****************************/ +static uint8_t rw_buf[USB_DISK_BLK_SIZE * USB_MAX_RW_BLK] = {0}; +static uintptr_t usb_id = 0; +static QueueHandle_t xQueue = NULL; + +/***************** Macros (Inline Functions) Definitions *********************/ +#define FUSB_DEBUG_TAG "XHCI-USB-DISK" +#define FUSB_ERROR(format, ...) FT_DEBUG_PRINT_E(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_WARN(format, ...) FT_DEBUG_PRINT_W(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_INFO(format, ...) FT_DEBUG_PRINT_I(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_DEBUG(format, ...) FT_DEBUG_PRINT_D(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) + +/************************** Function Prototypes ******************************/ + +/*****************************************************************************/ +static void XhciUsbMscBenchTask(void *args) +{ + int ret; + u8 id = (u8)usb_id; + struct usbh_msc *msc_class; + u32 loop = 0; + const char *devname = (const char *)args; + TickType_t tick_count, tick_spend; + double time_in_seconds, rw_speed; + u64 start_blk = USB_DISK_START_BLK; + u64 bench_blk; + u64 bench_rw; + int run_times = USB_BENCH_TIMES; + + msc_class = (struct usbh_msc *)usbh_find_class_instance(devname); + if (msc_class == NULL) + { + USB_LOG_RAW("Do not find %s. \r\n", devname); + goto task_exit; + } + + while (run_times-- > 0) + { + + /* do write bench */ + { + for (u32 i = 0; i < USB_MAX_RW_BLK; i++) /* fill some none-zero value into write buffer */ + { + memset(rw_buf + i * USB_DISK_BLK_SIZE, ((USB_DISK_START_BLK + i) & 0xff), USB_DISK_BLK_SIZE); + } + + bench_blk = start_blk; + + if ((bench_blk + USB_BENCH_BLKS) > msc_class->blocknum) + { + break; + } + + printf("Writing the %ld MB data (Block %ld ~ %ld), waiting...\r\n", + USB_BENCH_SIZE / SZ_1M, bench_blk, bench_blk + USB_BENCH_BLKS); + tick_count = xTaskGetTickCount(); + + while (bench_blk < (start_blk + USB_BENCH_BLKS)) + { + /* how many blocks to be wrote this time */ + bench_rw = (bench_blk + USB_MAX_RW_BLK) <= (start_blk + USB_BENCH_BLKS) ? + USB_MAX_RW_BLK : (start_blk + USB_BENCH_BLKS - bench_blk); + + ret = usbh_msc_scsi_write10(msc_class, bench_blk, rw_buf, USB_MAX_RW_BLK); + if (ret < 0) + { + USB_LOG_ERR("Error in scsi_write10 error, ret:%d", ret); + goto task_exit; + } + + bench_blk += bench_rw; + } + + tick_spend = xTaskGetTickCount() - tick_count; + time_in_seconds = ((double)tick_spend / configTICK_RATE_HZ); + rw_speed = ((double)USB_BENCH_SIZE / SZ_1M) / time_in_seconds; + printf("Write benchmark success, total time: %.2f Sec, total size: %d MB, speed: %.2f MB/sec\r\n", + time_in_seconds, + (int)(USB_BENCH_SIZE / SZ_1M), + rw_speed); /* this forced type casting is to avoid floating-point printing error */ + } + + /* do read bench */ + { + printf("Reading the %ld MB data (%ld Blocks), waiting...\r\n", + USB_BENCH_SIZE / SZ_1M, USB_BENCH_BLKS); + tick_count = xTaskGetTickCount(); + + bench_blk = start_blk; + while (bench_blk < (start_blk + USB_BENCH_BLKS)) + { + /* how many blocks to be wrote this time */ + bench_rw = (bench_blk + USB_MAX_RW_BLK) <= (start_blk + USB_BENCH_BLKS) ? + USB_MAX_RW_BLK : (start_blk + USB_BENCH_BLKS - bench_blk); + + ret = usbh_msc_scsi_read10(msc_class, bench_blk, rw_buf, USB_MAX_RW_BLK); + if (ret < 0) + { + USB_LOG_ERR("Error in scsi_write10 error, ret:%d", ret); + goto task_exit; + } + + bench_blk += bench_rw; + } + + tick_spend = xTaskGetTickCount() - tick_count; + time_in_seconds = ((double)tick_spend / configTICK_RATE_HZ); + rw_speed = ((double)USB_BENCH_SIZE / SZ_1M) / time_in_seconds; + printf("Read benchmark success, total time: %.2f Sec, total size: %d MB, speed: %.2f MB/sec\r\n", + time_in_seconds, + (int)(USB_BENCH_SIZE / SZ_1M), + rw_speed); /* this forced type casting is to avoid floating-point printing error */ + } + + start_blk += USB_BENCH_BLKS; + } + +task_exit: + ret = (ret == 0) ? XHCI_USB_DISK_RW_SUCCESS : XHCI_USB_DISK_RW_FAIL; + xQueueSend(xQueue, &ret, 0); + vTaskDelete(NULL); +} + +BaseType_t FFreeRTOSRunXhciDiskBench(u32 id, const char *devname) +{ + BaseType_t ret = pdPASS; + int task_res = XHCI_USB_DISK_RW_SUCCESS; + xQueue = xQueueCreate(1, sizeof(int)); + if (xQueue == NULL) + { + FUSB_ERROR("xQueue create failed.\r\n"); + goto exit; + } + + usb_id = id; + + ret = xTaskCreate((TaskFunction_t)XhciUsbMscBenchTask, + (const char *)"XhciUsbMscBenchTask", + (uint16_t)4096, + (void *)devname, + (UBaseType_t)configMAX_PRIORITIES - 1, + NULL); + if (ret != pdPASS) + { + FUSB_ERROR("xTaskCreate create failed.\r\n"); + goto exit; + } + + ret = xQueueReceive(xQueue, &task_res, TIMER_OUT); + if (ret != pdPASS) + { + FUSB_ERROR("xQueue receive timeout.\r\n"); + goto exit; + } + +exit: + if (xQueue) + { + vQueueDelete(xQueue); + } + + if (task_res != XHCI_USB_DISK_RW_SUCCESS) + { + printf("%s@%d: XHCI usb disk read/write example [failure], task_res = %d\r\n", __func__, __LINE__, task_res); + return pdFAIL; + } + else + { + printf("%s@%d: XHCI usb disk read/write example [success].\r\n", __func__, __LINE__); + return pdTRUE; + } +} diff --git a/example/peripheral/usb/xhci_platform/src/usb_disk.c b/example/peripheral/usb/xhci_pcie/src/xhci_usb_disk_read_write_example.c similarity index 48% rename from example/peripheral/usb/xhci_platform/src/usb_disk.c rename to example/peripheral/usb/xhci_pcie/src/xhci_usb_disk_read_write_example.c index 31fd28a7e7e6b58a5ee9183ac24e080dad33d898..35aa8e9c730621e9fe846c4f999eed21957e81ed 100644 --- a/example/peripheral/usb/xhci_platform/src/usb_disk.c +++ b/example/peripheral/usb/xhci_pcie/src/xhci_usb_disk_read_write_example.c @@ -11,7 +11,7 @@ * See the Phytium Public License for more details. * * - * FilePath: usb_disk.c + * FilePath: xhci_usb_disk_read_write_example.c * Date: 2022-09-23 08:24:09 * LastEditTime: 2022-09-23 08:24:10 * Description:  This file is for the usb disk functions. @@ -20,6 +20,7 @@ * Ver   Who         Date         Changes * ----- ------     --------    -------------------------------------- * 1.0 zhugengyu 2022/10/19 init commit + * 2.0 zhugengyu 2024/7/1 support auto-run */ /***************************** Include Files *********************************/ #include @@ -29,108 +30,168 @@ #include "task.h" #include "fassert.h" -#include "finterrupt.h" -#include "fcpu_info.h" #include "fdebug.h" +#include "fmemory_pool.h" #include "usbh_core.h" #include "usbh_msc.h" + +#include "xhci_host_example.h" /************************** Constant Definitions *****************************/ +#define TIMER_OUT (pdMS_TO_TICKS(10000UL)) /**************************** Type Definitions *******************************/ +enum +{ + XHCI_USB_DISK_RW_SUCCESS = 0, + XHCI_USB_DISK_RW_FAIL = 1, +}; /************************** Variable Definitions *****************************/ +static uint8_t rd_table[512] = {0}; +static uint8_t wr_table[512] = {0}; +static uintptr_t usb_id = 0; +static QueueHandle_t xQueue = NULL; /***************** Macros (Inline Functions) Definitions *********************/ -#define FUSB_DEBUG_TAG "USB-DISK" +#define FUSB_DEBUG_TAG "XHCI-USB-DISK" #define FUSB_ERROR(format, ...) FT_DEBUG_PRINT_E(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) #define FUSB_WARN(format, ...) FT_DEBUG_PRINT_W(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) #define FUSB_INFO(format, ...) FT_DEBUG_PRINT_I(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) #define FUSB_DEBUG(format, ...) FT_DEBUG_PRINT_D(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) /************************** Function Prototypes ******************************/ - - +void usb_hc_dcache_invalidate(void *addr, unsigned long len); +void usb_hc_dcache_flush(void *addr, unsigned long len); /*****************************************************************************/ -static void UsbMscTask(void *args) +static void XhciUsbMscTask(void *args) { int ret; + u8 id = (u8)usb_id; struct usbh_msc *msc_class; - static uint8_t rd_table[512] = {0}; - static uint8_t wr_table[512] = {0}; u32 loop = 0; + uint32_t start_blk = 0; + uint32_t blk_num = 1; const char *devname = (const char *)args; msc_class = (struct usbh_msc *)usbh_find_class_instance(devname); if (msc_class == NULL) { USB_LOG_RAW("Do not find %s. \r\n", devname); - goto err_exit; + goto task_exit; } + /* check msc device information */ + printf("MSC (/dev/sd%c) info:\r\n", (char)msc_class->sdchar); + printf(" USB: 0x%04x\r\n", msc_class->hport->device_desc.bcdUSB); + printf(" Class: 0x%02x\r\n", msc_class->hport->device_desc.bDeviceClass); + printf(" Subclass: 0x%02x\r\n", msc_class->hport->device_desc.bDeviceSubClass); + printf(" Protocol: 0x%02x\r\n", msc_class->hport->device_desc.bDeviceProtocol); + printf(" Block size: %d\r\n", msc_class->blocksize); + printf(" Total size: %ld GB\r\n", ((u64)msc_class->blocksize * msc_class->blocknum) / SZ_1G); + printf(" Bulk in: %d(mps)\r\n", msc_class->bulkin->wMaxPacketSize); + printf(" Bulk out: %d(mps)\r\n", msc_class->bulkout->wMaxPacketSize); + while (TRUE) { /* write partition table */ - memcpy(wr_table, rd_table, sizeof(rd_table)); for (uint32_t i = 0; i < 512; i++) { wr_table[i] ^= 0xfffff; } - ret = usbh_msc_scsi_write10(msc_class, 0, wr_table, 1); + ret = usbh_msc_scsi_write10(msc_class, start_blk, wr_table, blk_num); if (ret < 0) { USB_LOG_ERR("Error in scsi_write10 error, ret:%d", ret); - goto err_exit; + goto task_exit; } /* get the partition table */ - ret = usbh_msc_scsi_read10(msc_class, 0, rd_table, 1); + ret = usbh_msc_scsi_read10(msc_class, start_blk, rd_table, blk_num); if (ret < 0) { - USB_LOG_RAW("Error in scsi_read10, ret:%d", ret); - goto err_exit; + USB_LOG_ERR("Error in scsi_read10, ret:%d", ret); + goto task_exit; } /* check if read table == write table */ if (0 != memcmp(wr_table, rd_table, sizeof(rd_table))) { USB_LOG_ERR("Failed to check read and write.\r\n"); - goto err_exit; + goto task_exit; } else { - printf("[%d] disk read and write successfully.\r\n", loop); + printf("[%d] disk read and write %d bytes successfully.\r\n", loop, sizeof(rd_table)); +#if defined(CONFIG_LOG_DEBUG) || defined(CONFIG_LOG_VERBOS) + FtDumpHexByte(rd_table, sizeof(rd_table)); +#endif } loop++; - if (loop > 10) + if (loop > 5) { break; } - vTaskDelay(100); + start_blk += blk_num; + + vTaskDelay(1); } -err_exit: +task_exit: + ret = (ret == 0) ? XHCI_USB_DISK_RW_SUCCESS : XHCI_USB_DISK_RW_FAIL; + xQueueSend(xQueue, &ret, 0); vTaskDelete(NULL); } -BaseType_t FFreeRTOSRunUsbDisk(const char *devname) +BaseType_t FFreeRTOSRunXhciDisk(u32 id, const char *devname) { BaseType_t ret = pdPASS; + int task_res = XHCI_USB_DISK_RW_SUCCESS; + xQueue = xQueueCreate(1, sizeof(int)); + if (xQueue == NULL) + { + FUSB_ERROR("xQueue create failed.\r\n"); + goto exit; + } - taskENTER_CRITICAL(); /* no schedule when create task */ + usb_id = id; - ret = xTaskCreate((TaskFunction_t)UsbMscTask, - (const char *)"UsbMscTask", - (uint16_t)2048, + ret = xTaskCreate((TaskFunction_t)XhciUsbMscTask, + (const char *)"XhciUsbMscTask", + (uint16_t)4096, (void *)devname, (UBaseType_t)configMAX_PRIORITIES - 1, NULL); - FASSERT_MSG(pdPASS == ret, "create task failed"); + if (ret != pdPASS) + { + FUSB_ERROR("xTaskCreate create failed.\r\n"); + goto exit; + } - taskEXIT_CRITICAL(); /* allow schedule since task created */ + ret = xQueueReceive(xQueue, &task_res, TIMER_OUT); + if (ret != pdPASS) + { + FUSB_ERROR("xQueue receive timeout.\r\n"); + goto exit; + } + +exit: + if (xQueue) + { + vQueueDelete(xQueue); + } - return ret; + if (task_res != XHCI_USB_DISK_RW_SUCCESS) + { + printf("%s@%d: XHCI usb disk read/write example [failure], task_res = %d\r\n", __func__, __LINE__, task_res); + return pdFAIL; + } + else + { + printf("%s@%d: XHCI usb disk read/write example [success].\r\n", __func__, __LINE__); + return pdTRUE; + } } diff --git a/example/peripheral/usb/xhci_pcie/src/usb_input.c b/example/peripheral/usb/xhci_pcie/src/xhci_usb_keyboard_input_example.c similarity index 62% rename from example/peripheral/usb/xhci_pcie/src/usb_input.c rename to example/peripheral/usb/xhci_pcie/src/xhci_usb_keyboard_input_example.c index 513b3a2a8ae2040fb7535e4b2c59ea09a71a4a9d..795be83c01614a77fe2911300e067850752ece2a 100644 --- a/example/peripheral/usb/xhci_pcie/src/usb_input.c +++ b/example/peripheral/usb/xhci_pcie/src/xhci_usb_keyboard_input_example.c @@ -27,14 +27,16 @@ #include "FreeRTOS.h" #include "task.h" +#include "queue.h" #include "fassert.h" -#include "finterrupt.h" -#include "fcpu_info.h" #include "fdebug.h" +#include "fkernel.h" #include "usbh_core.h" #include "usbh_hid.h" + +#include "xhci_host_example.h" /************************** Constant Definitions *****************************/ #define HID_KEYCODE_TO_ASCII \ {0 , 0 }, /* 0x00 */ \ @@ -141,17 +143,25 @@ {'0' , 0 }, /* 0x63 */ \ {'=' , '=' }, /* 0x67 */ \ +enum +{ + XHCI_USB_KEYBOARD_SUCCESS = 0, + XHCI_USB_KEYBOARD_FAIL = 1, +}; + +#define XHCI_INPUT_WAIT_TIME (pdMS_TO_TICKS(20000UL)) +#define TIMER_OUT (XHCI_INPUT_WAIT_TIME + (pdMS_TO_TICKS(10000UL))) /**************************** Type Definitions *******************************/ /************************** Variable Definitions *****************************/ static u8 const keycode2ascii[128][2] = { HID_KEYCODE_TO_ASCII }; static struct usbh_urb kbd_intin_urb; -static struct usbh_urb mouse_intin_urb; static uint8_t kbd_buffer[128] __attribute__((aligned(sizeof(unsigned long)))) = {0}; -static uint8_t mouse_buffer[128] __attribute__((aligned(sizeof(unsigned long)))) = {0}; - +static struct usb_osal_timer *kbd_timer = NULL; +static uintptr_t usb_id = 0; +static QueueHandle_t xQueue = NULL; /***************** Macros (Inline Functions) Definitions *********************/ -#define FUSB_DEBUG_TAG "USB-INPUT" +#define FUSB_DEBUG_TAG "USB-KEYBOARD" #define FUSB_ERROR(format, ...) FT_DEBUG_PRINT_E(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) #define FUSB_WARN(format, ...) FT_DEBUG_PRINT_W(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) #define FUSB_INFO(format, ...) FT_DEBUG_PRINT_I(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) @@ -161,43 +171,6 @@ static uint8_t mouse_buffer[128] __attribute__((aligned(sizeof(unsigned long)))) /*****************************************************************************/ -static inline void UsbMouseLeftButtonCB(void) -{ - printf("<-\r\n"); -} - -static inline void UsbMouseRightButtonCB(void) -{ - printf("->\r\n"); -} - -static inline void UsbMouseMiddleButtonCB(void) -{ - printf("C\r\n"); -} - -static void UsbMouseHandleInput(struct usb_hid_mouse_report *input) -{ - /*------------- button state -------------*/ - if (input->buttons & HID_MOUSE_INPUT_BUTTON_LEFT) - { - UsbMouseLeftButtonCB(); - } - - if (input->buttons & HID_MOUSE_INPUT_BUTTON_MIDDLE) - { - UsbMouseMiddleButtonCB(); - } - - if (input->buttons & HID_MOUSE_INPUT_BUTTON_RIGHT) - { - UsbMouseRightButtonCB(); - } - - /*------------- cursor movement -------------*/ - printf("[x:%d y:%d w:%d]\r\n", input->xdisp, input->ydisp, input->wdisp); -} - /* look up new key in previous keys */ static inline boolean FindKeyInPrevInput(const struct usb_hid_kbd_report *report, u8 keycode) { @@ -244,153 +217,122 @@ static void UsbKeyBoardHandleInput(struct usb_hid_kbd_report *input) prev_input = *input; } -static u8 UsbInputGetInterfaceProtocol(struct usbh_hid *hid_class) -{ - struct usbh_hubport *hport = hid_class->hport; - u8 intf = hid_class->intf; - const struct usb_interface_descriptor *intf_desc = &hport->config.intf->altsetting[intf].intf_desc; - - return intf_desc->bInterfaceProtocol; -} - static void UsbKeyboardCallback(void *arg, int nbytes) { - u8 intf_protocol; - struct usbh_hid *kbd_class = (struct usbh_hid *)arg; - intf_protocol = UsbInputGetInterfaceProtocol(kbd_class); + struct usbh_hid *hid_class = (struct usbh_hid *)arg; - if (HID_PROTOCOL_KEYBOARD == intf_protocol) /* handle input from keyboard */ + if (nbytes > 0) { - if (nbytes < (int)sizeof(struct usb_hid_kbd_report)) - { - FUSB_ERROR("nbytes = %d", nbytes); - } - else - { - UsbKeyBoardHandleInput((struct usb_hid_kbd_report *)kbd_buffer); - } + UsbKeyBoardHandleInput((struct usb_hid_kbd_report *)kbd_buffer); } - else + + if (kbd_timer) { - FUSB_ERROR("mismatch callback for protocol-%d", intf_protocol); - return; + usb_osal_timer_start(kbd_timer); } - - usbh_submit_urb(&kbd_intin_urb); /* ask for next inputs */ } -static void UsbMouseCallback(void *arg, int nbytes) +static void UsbKeyboardTimeout(void *arg) { - u8 intf_protocol; - struct usbh_hid *mouse_class = (struct usbh_hid *)arg; - intf_protocol = UsbInputGetInterfaceProtocol(mouse_class); + struct usbh_hid *hid = (struct usbh_hid *)arg; - if (HID_PROTOCOL_MOUSE == intf_protocol) /* handle input from mouse */ - { - if (nbytes < (int)sizeof(struct usb_hid_mouse_report)) - { - FUSB_ERROR("nbytes = %d", nbytes); - } - else - { - UsbMouseHandleInput((struct usb_hid_mouse_report *)mouse_buffer); - } - } - else - { - FUSB_ERROR("mismatch callback for protocol-%d", intf_protocol); - return; - } - - usbh_submit_urb(&mouse_intin_urb); /* ask for next inputs */ + usbh_int_urb_fill(&hid->intin_urb, hid->hport, hid->intin, kbd_buffer, hid->intin->wMaxPacketSize, 0, UsbKeyboardCallback, hid); + usbh_submit_urb(&hid->intin_urb); } -static void UsbKeyboardTask(void *args) +static void XhciUsbKeyboardTask(void *args) { int ret; + u8 id = (u8)usb_id; struct usbh_hid *kbd_class; - u8 intf_protocol; - const char *dev_name = (const char *)args; - - kbd_class = (struct usbh_hid *)usbh_find_class_instance(dev_name); + const char *devname = (const char *)args; + + kbd_class = (struct usbh_hid *)usbh_find_class_instance(devname); if (kbd_class == NULL) { - FUSB_ERROR("Do not find %s.", dev_name); - goto err_exit; + FUSB_ERROR("Do not find %s.", devname); + goto task_exit; } - while (TRUE) + kbd_timer = usb_osal_timer_create("keyboard_timer", + USBH_GET_URB_INTERVAL(kbd_class->intin->bInterval, kbd_class->hport->speed), + UsbKeyboardTimeout, + kbd_class, + false); + if (kbd_timer != NULL) { - usbh_int_urb_fill(&kbd_intin_urb, kbd_class->intin, kbd_buffer, 8, 0, UsbKeyboardCallback, kbd_class); - ret = usbh_submit_urb(&kbd_intin_urb); - - vTaskDelay(1); - } - -err_exit: - vTaskDelete(NULL); + usb_osal_timer_start(kbd_timer); + } + + /* check hid device information */ + printf("HID (/dev/input%d) info:\r\n", (char)kbd_class->minor); + printf(" USB: 0x%04x\r\n", kbd_class->hport->device_desc.bcdUSB); + printf(" Class: 0x%02x\r\n", kbd_class->hport->device_desc.bDeviceClass); + printf(" Subclass: 0x%02x\r\n", kbd_class->hport->device_desc.bDeviceSubClass); + printf(" Protocol: 0x%02x\r\n", kbd_class->hport->device_desc.bDeviceProtocol); + printf(" Intr in: %d(mps) %d(interval)\r\n", kbd_class->intin->wMaxPacketSize, + kbd_class->intin->bInterval); + printf(" Intr out: %d(mps) %d(interval)\r\n", kbd_class->intout->wMaxPacketSize, + kbd_class->intout->bInterval); + + printf("Now you can type in some characters from keyboard \r\n"); + + vTaskDelay(XHCI_INPUT_WAIT_TIME); /* wait user input for a while */ + + printf("Input finished, exit...\r\n"); + +task_exit: + ret = (ret == 0) ? XHCI_USB_KEYBOARD_SUCCESS : XHCI_USB_KEYBOARD_FAIL; + xQueueSend(xQueue, &ret, 0); + vTaskDelete(NULL); } -static void UsbMouseTask(void *args) +BaseType_t FFreeRTOSRunXhciKeyboard(u32 id, const char *devname) { - int ret; - struct usbh_hid *mouse_class; - u8 intf_protocol; - const char *dev_name = (const char *)args; - - mouse_class = (struct usbh_hid *)usbh_find_class_instance(dev_name); - if (mouse_class == NULL) - { - FUSB_ERROR("Do not find %s.", dev_name); - goto err_exit; - } - - while (TRUE) + BaseType_t ret = pdPASS; + int task_res = XHCI_USB_KEYBOARD_SUCCESS; + xQueue = xQueueCreate(1, sizeof(int)); + if (xQueue == NULL) { - usbh_int_urb_fill(&mouse_intin_urb, mouse_class->intin, mouse_buffer, 8, 0, UsbMouseCallback, mouse_class); - ret = usbh_submit_urb(&mouse_intin_urb); - - vTaskDelay(1); + FUSB_ERROR("xQueue create failed.\r\n"); + goto exit; } -err_exit: - vTaskDelete(NULL); -} - -BaseType_t FFreeRTOSRunUsbKeyboard(const char *devname) -{ - BaseType_t ret = pdPASS; + usb_id = id; - taskENTER_CRITICAL(); /* no schedule when create task */ - - ret = xTaskCreate((TaskFunction_t)UsbKeyboardTask, - (const char *)"UsbKeyboardTask", - (uint16_t)2048, + ret = xTaskCreate((TaskFunction_t)XhciUsbKeyboardTask, + (const char *)"XhciUsbKeyboardTask", + (uint16_t)4096, (void *)devname, (UBaseType_t)configMAX_PRIORITIES - 1, NULL); - FASSERT_MSG(pdPASS == ret, "create task failed"); - - taskEXIT_CRITICAL(); /* allow schedule since task created */ - - return ret; -} - -BaseType_t FFreeRTOSRunUsbMouse(const char *devname) -{ - BaseType_t ret = pdPASS; - - taskENTER_CRITICAL(); /* no schedule when create task */ + if (ret != pdPASS) + { + FUSB_ERROR("xTaskCreate create failed.\r\n"); + goto exit; + } - ret = xTaskCreate((TaskFunction_t)UsbMouseTask, - (const char *)"UsbMouseTask", - (uint16_t)2048, - (void *)devname, - (UBaseType_t)configMAX_PRIORITIES - 1, - NULL); - FASSERT_MSG(pdPASS == ret, "create task failed"); + ret = xQueueReceive(xQueue, &task_res, TIMER_OUT); + if (ret != pdPASS) + { + FUSB_ERROR("xQueue receive timeout.\r\n"); + goto exit; + } - taskEXIT_CRITICAL(); /* allow schedule since task created */ +exit: + if (xQueue) + { + vQueueDelete(xQueue); + } - return ret; + if (task_res != XHCI_USB_KEYBOARD_SUCCESS) + { + printf("%s@%d: XHCI usb keyboard example [failure], task_res = %d\r\n", __func__, __LINE__, task_res); + return pdFAIL; + } + else + { + printf("%s@%d: XHCI usb keyboard example [success].\r\n", __func__, __LINE__); + return pdTRUE; + } } \ No newline at end of file diff --git a/example/peripheral/usb/xhci_pcie/src/xhci_usb_mouse_input_example.c b/example/peripheral/usb/xhci_pcie/src/xhci_usb_mouse_input_example.c new file mode 100644 index 0000000000000000000000000000000000000000..143d1bc1f56600c6cd251bd8eaa8e5a50759e03e --- /dev/null +++ b/example/peripheral/usb/xhci_pcie/src/xhci_usb_mouse_input_example.c @@ -0,0 +1,223 @@ +/* + * Copyright : (C) 2022 Phytium Information Technology, Inc. + * All Rights Reserved. + * + * This program is OPEN SOURCE software: you can redistribute it and/or modify it + * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, + * either version 1.0 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Phytium Public License for more details. + * + * + * FilePath: usb_input.c + * Date: 2022-07-22 13:57:42 + * LastEditTime: 2022-07-22 13:57:43 + * Description:  This file is for the usb input functions. + * + * Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + * 1.0 zhugengyu 2022/9/20 init commit + */ +/***************************** Include Files *********************************/ +#include +#include + +#include "FreeRTOS.h" +#include "task.h" +#include "queue.h" + +#include "fassert.h" +#include "fdebug.h" +#include "fkernel.h" + +#include "usbh_core.h" +#include "usbh_hid.h" + +#include "xhci_host_example.h" +/************************** Constant Definitions *****************************/ +enum +{ + XHCI_USB_MOUSE_SUCCESS = 0, + XHCI_USB_MOUSE_FAIL = 1, +}; + +#define XHCI_INPUT_WAIT_TIME (pdMS_TO_TICKS(20000UL)) +#define TIMER_OUT (XHCI_INPUT_WAIT_TIME + (pdMS_TO_TICKS(10000UL))) +/**************************** Type Definitions *******************************/ + +/************************** Variable Definitions *****************************/ +static struct usbh_urb mouse_intin_urb; +static uint8_t mouse_buffer[128] __attribute__((aligned(sizeof(unsigned long)))) = {0}; +static struct usb_osal_timer *mouse_timer = NULL; +static uintptr_t usb_id = 0; +static QueueHandle_t xQueue = NULL; +/***************** Macros (Inline Functions) Definitions *********************/ +#define FUSB_DEBUG_TAG "USB-MOUSE" +#define FUSB_ERROR(format, ...) FT_DEBUG_PRINT_E(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_WARN(format, ...) FT_DEBUG_PRINT_W(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_INFO(format, ...) FT_DEBUG_PRINT_I(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_DEBUG(format, ...) FT_DEBUG_PRINT_D(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) + +/************************** Function Prototypes ******************************/ + + +/*****************************************************************************/ +static inline void UsbMouseLeftButtonCB(void) +{ + printf("<-\r\n"); +} + +static inline void UsbMouseRightButtonCB(void) +{ + printf("->\r\n"); +} + +static inline void UsbMouseMiddleButtonCB(void) +{ + printf("C\r\n"); +} + +static void UsbMouseHandleInput(struct usb_hid_mouse_report *input) +{ + /*------------- button state -------------*/ + if (input->buttons & HID_MOUSE_INPUT_BUTTON_LEFT) + { + UsbMouseLeftButtonCB(); + } + + if (input->buttons & HID_MOUSE_INPUT_BUTTON_MIDDLE) + { + UsbMouseMiddleButtonCB(); + } + + if (input->buttons & HID_MOUSE_INPUT_BUTTON_RIGHT) + { + UsbMouseRightButtonCB(); + } + + /*------------- cursor movement -------------*/ + printf("[x:%d y:%d w:%d]\r\n", input->xdisp, input->ydisp, input->wdisp); +} + +static void UsbMouseCallback(void *arg, int nbytes) +{ + struct usbh_hid *hid_class = (struct usbh_hid *)arg; + + if (nbytes > 0) + { + UsbMouseHandleInput((struct usb_hid_mouse_report *)mouse_buffer); + } + + if (mouse_timer) + { + usb_osal_timer_start(mouse_timer); + } +} + +static void UsbMouseTimeout(void *arg) +{ + struct usbh_hid *hid = (struct usbh_hid *)arg; + + usbh_int_urb_fill(&hid->intin_urb, hid->hport, hid->intin, mouse_buffer, hid->intin->wMaxPacketSize, 0, UsbMouseCallback, hid); + usbh_submit_urb(&hid->intin_urb); +} + +static void XhciUsbMouseTask(void *args) +{ + int ret; + u8 id = (u8)usb_id; + struct usbh_hid *mouse_class; + const char *devname = (const char *)args; + + mouse_class = (struct usbh_hid *)usbh_find_class_instance(devname); + if (mouse_class == NULL) + { + FUSB_ERROR("Do not find %s.", devname); + goto task_exit; + } + + mouse_timer = usb_osal_timer_create("mouse_timer", + USBH_GET_URB_INTERVAL(mouse_class->intin->bInterval, mouse_class->hport->speed), + UsbMouseTimeout, + mouse_class, + false); + if (mouse_timer != NULL) + { + usb_osal_timer_start(mouse_timer); + } + + /* check hid device information */ + printf("HID (/dev/input%d) info:\r\n", (char)mouse_class->minor); + printf(" USB: 0x%04x\r\n", mouse_class->hport->device_desc.bcdUSB); + printf(" Class: 0x%02x\r\n", mouse_class->hport->device_desc.bDeviceClass); + printf(" Subclass: 0x%02x\r\n", mouse_class->hport->device_desc.bDeviceSubClass); + printf(" Protocol: 0x%02x\r\n", mouse_class->hport->device_desc.bDeviceProtocol); + printf(" Intr in: %d(mps) %d(interval)\r\n", mouse_class->intin->wMaxPacketSize, + mouse_class->intin->bInterval); + printf(" Intr out: %d(mps) %d(interval)\r\n", mouse_class->intout->wMaxPacketSize, + mouse_class->intout->bInterval); + + printf("Now you can move and click connected mouse \r\n"); + + vTaskDelay(XHCI_INPUT_WAIT_TIME); /* wait user input for a while */ + + printf("Input finished, exit...\r\n"); + +task_exit: + ret = (ret == 0) ? XHCI_USB_MOUSE_SUCCESS : XHCI_USB_MOUSE_FAIL; + xQueueSend(xQueue, &ret, 0); + vTaskDelete(NULL); +} + +BaseType_t FFreeRTOSRunXhciMouse(u32 id, const char *devname) +{ + BaseType_t ret = pdPASS; + int task_res = XHCI_USB_MOUSE_SUCCESS; + xQueue = xQueueCreate(1, sizeof(int)); + if (xQueue == NULL) + { + FUSB_ERROR("xQueue create failed.\r\n"); + goto exit; + } + + usb_id = id; + + ret = xTaskCreate((TaskFunction_t)XhciUsbMouseTask, + (const char *)"XhciUsbMouseTask", + (uint16_t)4096, + (void *)devname, + (UBaseType_t)configMAX_PRIORITIES - 1, + NULL); + if (ret != pdPASS) + { + FUSB_ERROR("xTaskCreate create failed.\r\n"); + goto exit; + } + + ret = xQueueReceive(xQueue, &task_res, TIMER_OUT); + if (ret != pdPASS) + { + FUSB_ERROR("xQueue receive timeout.\r\n"); + goto exit; + } + +exit: + if (xQueue) + { + vQueueDelete(xQueue); + } + + if (task_res != XHCI_USB_MOUSE_SUCCESS) + { + printf("%s@%d: XHCI usb mouse example [failure], task_res = %d\r\n", __func__, __LINE__, task_res); + return pdFAIL; + } + else + { + printf("%s@%d: XHCI usb mouse example [success].\r\n", __func__, __LINE__); + return pdTRUE; + } +} \ No newline at end of file diff --git a/example/peripheral/usb/xhci_platform/README.md b/example/peripheral/usb/xhci_platform/README.md index 2bcd359ea4b12d97a95ea653d10f2e39907e02bd..0e36f5e7f3ef19d4a8a63eb792ca9fee0d03a99b 100644 --- a/example/peripheral/usb/xhci_platform/README.md +++ b/example/peripheral/usb/xhci_platform/README.md @@ -1,4 +1,3 @@ - # XHCI Host 测试 (平台设备) ## 1. 例程介绍 @@ -21,7 +20,7 @@ CherryUSB 是一个用于嵌入式系统 USB 协议栈,支持运行在Host模 本例程在 E2000 平台测试通过,您可以参考以下方法配置本例程所需要的硬件和软件环境, - E2000 开发板/飞腾派 -- 本例程基于E2000 Demo 开发板,使用logitech键盘、Dell鼠标和Sandisk盘完成测试 +- 本例程基于E2000 Demo 开发板,使用logitech键盘、Dell鼠标和 Kingston U盘完成测试 ### 2.2 SDK配置方法 @@ -43,6 +42,7 @@ CherryUSB 是一个用于嵌入式系统 USB 协议栈,支持运行在Host模 - 在当前目录下 - 执行以上指令 + ### 2.3 构建和下载 >描述构建、烧录下载镜像的过程,列出相关的命令
@@ -72,69 +72,149 @@ sudo service tftpd-hpa restart - 开发板侧使用bootelf命令跳转 ``` setenv ipaddr 192.168.4.20 -setenv serverip 192.168.4.50 +setenv serverip 192.168.4.30 setenv gatewayip 192.168.4.1 tftpboot 0x90100000 freertos.elf bootelf -p 0x90100000 ``` -### 2.4 输出与实验现象 +### 2.4 输出与实验现象(E2000 D/Q Demo 板) >描述输入输出情况,列出存在哪些输出,对应的输出是什么(建议附录相关现象图片)
+#### 2.4.1 枚举 USB 设备 + +- 将 USB 设备通过 USB Hub 连接到 XHCI 0 上 + +![USB 设备](./figs/xhci_0_usb_devices.png) + +- 输入下面的命令,开始枚举 USB 设备 + +``` +usb start 0 +``` + +- 设备枚举完成后,输入命令查看枚举到的 USB 设备的拓扑结构,其中,USB 3 Hub 会枚举出 High-speed 和 Super-speed 两个 Hub 设备,后续 USB 3 设备挂在 Super-speed Hub 上,USB 2 (Low/Full/High speed)设备挂在 High-speed Hub 上面,XHCI 控制器也至少提供两个 Roothub port,分别支持 USB 2 设备和 USB 3 设备 + +``` +usb lsusb -t 0 +``` + +![发现 USB 设备](./figs/xhci_0_attach_devices.png) + +![USB 3 Hub 结构](./figs/usb3_hub_arch.png) + +- 在 CherryUSB 中,后面通过注册的设备号,如 `/dev/sda`、`/dev/input0` 来获取 USB 设备实例访问设备功能 + +#### 2.4.2 使用 U 盘 + +- 输入下面的命令,对 XHCI 0 上刚刚枚举出来的 U 盘进行读写,可以看到标量 256GB 的 U 盘可以访问的空间大小为 230GB,U 盘的读写功能由两个 Bulk 端点提供 + +``` +usb disk 0 /dev/sda +``` + +![读写 U 盘](./figs/xhci_0_rw_usb_disk.png) + +- 输入下面的命令,对 U 盘进行读写,每次读写 200MB 的内容,计算读写速度,具体的读写速度和 测试 U 盘的性能有关 + +``` +usb diskbench 0 /dev/sda +``` + +![USB 3 U 盘读写速度](./figs/xhci_0_usb3_disk_speed.png) + +- /dev/sdb 是一个 High-speed 设备,可以看到读写速度会比 /dev/sda 对应的 Super-speed U 盘慢很多 + +![USB 2 U 盘读写速度](./figs/xhci_0_usb2_disk_speed.png) +#### 2.4.3 使用 USB 鼠标 -#### 2.4.1 读写 U 盘 +- 枚举打印信息中显示 `/dev/input0` 是一个鼠标,输入下面的命令接收鼠标的输入,随后移动鼠标或者按键后打印相应的鼠标坐标信息和按键信息,输入会持续一段时间后自动退出 -- 将 U 盘(USB3.0 接口U盘)插在 USB-0 口,初始化 USB-0 控制器后,查看 U 盘设备是否枚举成功,然后通过枚举成功后返回的设备路径`/usb0/sda`读写 U 盘 +``` +usb mouse 0 /dev/input0 +``` + +![USB 鼠标](./figs/xhci_0_usb_mouse.png) + +#### 2.4.4 使用 USB 键盘 + +- 枚举打印信息中显示 `/dev/input1` 是一个键盘,输入下面的命令接收键盘的输入,随后通过键盘输入的字符会打印在控制台上,输入会持续一段时间后自动退出 ``` -usb init 0 -usb lsusb 0 -t -usb disk /usb0/sda +usb keyboard 0 /dev/input1 ``` -![usb_disk](./figs/usb_disk_connection.jpg) +![USB 键盘](./figs/xhci_0_usb_keyboard.png) + +#### 2.4.5 热插拔 USB 设备 + +- 使用过程中可以拔下当前不在工作的 USB 设备,插入新的设备,如下所示,先拔出 USB 2 U 盘,然后插入一个 USB 2 Hub -- 输入`usb disk`后,启动一个任务不断读写U盘 +![USB 设备热插拔](./figs/xhci_0_hotpluginout.png) -![usb_disk_init](./figs/usb_disk_init.png) +#### 2.4.6 级联 USB HUB + +- Hub 上可以通过新 Hub 扩展连接端口,2.4.5 中新加入的 USB 2 Hub 后,再新 Hub 上可以继续连接设备,如下图 + +> 一般来说,Hub 不宜级联多级,一方面,USB 协议中有最多级联 5 级的限制,另一方面,Hub 本身供电不足,级联接入的设备可能不能正常工作 + +![USB Hub 级联](./figs/xhci_0_usb_hub_ext.png) + +### 2.5 输出与实验现象 (飞腾派) + +- 加载飞腾派配置,然后编译镜像 + +``` +make load_kconfig LOAD_CONFIG_NAME=phytiumpi_aarch64_firefly_cherry_usb +``` -- 关于 U 盘的进一步使用,可以参考 storage/fatfs 中使用 U 盘文件系统 +- 连接 USB 设备到 XHCI 0,注意不要连错,只有靠板子正面一侧的蓝色插槽对应的是 XHCI 控制器 -#### 2.4.2 获取键盘和鼠标输入 +![飞腾派 USB 设备](./figs/phytiumpi_usb_devices.png) -- 将键盘插在 USB-0 口,鼠标插在 USB-1 口,分别初始化 USB-0 和 USB-1 控制器,查看键盘和鼠标是否枚举成功,通过枚举成功后返回的设备路径`/usb0/kbd0`和`/usb1/mouse1`,开启键盘和鼠标输入后进行读取 +- 输入下列命令,枚举完成后查看 USB 设备信息 ``` -usb init 0 -usb init 1 -usb lsusb 0 -t -usb lsusb 1 -t -usb kbd /usb0/kbd0 -usb mouse /usb1/mouse1 +usb start 0 +usb lsusb -t 0 ``` -![usb_keyboard_mouse](./figs/usb_keyboard_mouse.jpg) +![飞腾派 USB 枚举设备](./figs/phytiumpi_attached_usb_devices.png) + +- 其它设备的使用方法和 2.4 中描述的一致 + +![飞腾派 U 盘读写](./figs/phytiumpi_usb_speed.png) + +### 2.6 输出与实验现象 (E2000 D/Q Demo 板,同时使用 XHCI 0 和 XHCI 1) + +- USB 协议栈中支持同时使用多路同类的 USB 控制器(如果 USB 控制器依赖的驱动不同现在是不支持的) +> 在 E2000 D/Q Demo 板中,XHCI 1 最多只能支持 High-speed 速率 + +- 如下图所示连接 USB 设备 + +![XHCI 0 和 1](./figs/xhci_0_1.png) -![usb_keyboard_mouse](./figs/usb_keyboard_mouse_connect.jpg) +- 输入下面的命令,开始枚举 USB 设备 -- 输入`usb input`后,可以通过中断处理键盘输入 +``` +usb start 0 +usb start 1 +``` -![usb_keyboard_mouse_init](./figs/usb_keyboard_input.png) +``` +usb lsusb -t +``` -![usb_mouse_input](./figs/usb_mouse_input.png) +![XHCI 0 和 1 同时使用](./figs/xhci_0_1_devices.png) -- 上图中,首先打印的是通过 USB 键盘输入的字符串,以及一系列特殊字符,然后是鼠标的输入,x和y是鼠标的平面坐标位置,w是鼠标中间滚轮的位置,<-、-> 和 C 分别是按下鼠标左、右键和中间滚轮后的返回 +- 具体的设备使用方法和 2.4 中的描述一致 ## 3. 如何解决问题 >主要记录使用例程中可能会遇到的问题,给出相应的解决方案
-- 目前 USB 外接 HUB 功能支持未完成,建议 USB 设备直连 Roothub -1. 通过USB HUB 连接键盘鼠标等低速设备可能会有问题 -2. 当前phytiumpi板卡仅有一个usb3.0接口,因此同一时刻仅支持一个外设,可将鼠标或者键盘接入usb3.0。 - ## 4. 修改历史记录 >记录例程的重大修改记录,标明修改发生的版本号
@@ -142,5 +222,4 @@ usb mouse /usb1/mouse1 - V0.3.1 首次合入 - v0.1.0 支持USB 3.0 设备枚举 - v0.7.1 区分 XHCI 平台设备和 PCIe 设备 - - +- v1.0.0 更新 CherryUSB,解决 Hub 遗留问题 \ No newline at end of file diff --git a/example/peripheral/usb/xhci_platform/configs/e2000d_aarch32_demo_cherry_usb.config b/example/peripheral/usb/xhci_platform/configs/e2000d_aarch32_demo_cherry_usb.config index a9ac962e9d6f1821f1f80c3341cc20afe5aff329..a03c1c8c240c7b5f1da8f3a0f139760787d31425 100644 --- a/example/peripheral/usb/xhci_platform/configs/e2000d_aarch32_demo_cherry_usb.config +++ b/example/peripheral/usb/xhci_platform/configs/e2000d_aarch32_demo_cherry_usb.config @@ -30,9 +30,9 @@ CONFIG_CRYPTO_NEON_FP_ARMV8=y # CONFIG_VFPV3 is not set # CONFIG_VFPV3_D16 is not set CONFIG_ARM_MFPU="crypto-neon-fp-armv8" -CONFIG_MFLOAT_ABI_HARD=y -# CONFIG_MFLOAT_ABI_SOFTFP is not set -CONFIG_ARM_MFLOAT_ABI="hard" +# CONFIG_MFLOAT_ABI_HARD is not set +CONFIG_MFLOAT_ABI_SOFTFP=y +CONFIG_ARM_MFLOAT_ABI="softfp" # end of Fpu configuration # end of Compiler configuration @@ -101,10 +101,10 @@ CONFIG_TARGET_NAME="cherry_usb" # CONFIG_ELOG_LINE_BUF_SIZE=0x100 # CONFIG_LOG_VERBOS is not set -CONFIG_LOG_DEBUG=y +# CONFIG_LOG_DEBUG is not set # CONFIG_LOG_INFO is not set # CONFIG_LOG_WARN is not set -# CONFIG_LOG_ERROR is not set +CONFIG_LOG_ERROR=y # CONFIG_LOG_NONE is not set CONFIG_LOG_EXTRA_INFO=y # CONFIG_LOG_DISPALY_CORE_NUM is not set @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,8 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -169,9 +161,9 @@ CONFIG_OUTPUT_BINARY=y # # Optimization options # -# CONFIG_DEBUG_NOOPT is not set +CONFIG_DEBUG_NOOPT=y # CONFIG_DEBUG_CUSTOMOPT is not set -CONFIG_DEBUG_FULLOPT=y +# CONFIG_DEBUG_FULLOPT is not set CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y CONFIG_DEBUG_LINK_MAP=y # CONFIG_CCACHE is not set @@ -341,16 +333,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/usb/xhci_platform/configs/e2000d_aarch64_demo_cherry_usb.config b/example/peripheral/usb/xhci_platform/configs/e2000d_aarch64_demo_cherry_usb.config index 8966b62fea6093c917802af688753839fadc3c69..4200f4eea58363e387ee0b298d29bee1c698797d 100644 --- a/example/peripheral/usb/xhci_platform/configs/e2000d_aarch64_demo_cherry_usb.config +++ b/example/peripheral/usb/xhci_platform/configs/e2000d_aarch64_demo_cherry_usb.config @@ -29,7 +29,7 @@ CONFIG_GCC_CODE_MODEL_SMALL=y # CONFIG_GCC_CODE_MODEL_LARGE is not set # end of Compiler configuration -# CONFIG_BOOT_WITH_FLUSH_CACHE is not set +CONFIG_BOOT_WITH_FLUSH_CACHE=y # CONFIG_MMU_DEBUG_PRINTS is not set # end of Arm architecture configuration @@ -95,10 +95,10 @@ CONFIG_TARGET_NAME="cherry_usb" # CONFIG_ELOG_LINE_BUF_SIZE=0x100 # CONFIG_LOG_VERBOS is not set -CONFIG_LOG_DEBUG=y +# CONFIG_LOG_DEBUG is not set # CONFIG_LOG_INFO is not set # CONFIG_LOG_WARN is not set -# CONFIG_LOG_ERROR is not set +CONFIG_LOG_ERROR=y # CONFIG_LOG_NONE is not set CONFIG_LOG_EXTRA_INFO=y # CONFIG_LOG_DISPALY_CORE_NUM is not set @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,8 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -163,9 +155,9 @@ CONFIG_OUTPUT_BINARY=y # # Optimization options # -# CONFIG_DEBUG_NOOPT is not set +CONFIG_DEBUG_NOOPT=y # CONFIG_DEBUG_CUSTOMOPT is not set -CONFIG_DEBUG_FULLOPT=y +# CONFIG_DEBUG_FULLOPT is not set CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y CONFIG_DEBUG_LINK_MAP=y # CONFIG_CCACHE is not set @@ -330,16 +322,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/usb/xhci_platform/configs/e2000q_aarch32_demo_cherry_usb.config b/example/peripheral/usb/xhci_platform/configs/e2000q_aarch32_demo_cherry_usb.config index 94c38afe2df709625ab3bbc5c134674d1bd503f5..0e2a1ff6a185355fa10a5d52cd0eb4904893625e 100644 --- a/example/peripheral/usb/xhci_platform/configs/e2000q_aarch32_demo_cherry_usb.config +++ b/example/peripheral/usb/xhci_platform/configs/e2000q_aarch32_demo_cherry_usb.config @@ -100,10 +100,10 @@ CONFIG_TARGET_NAME="cherry_usb" # CONFIG_ELOG_LINE_BUF_SIZE=0x100 # CONFIG_LOG_VERBOS is not set -CONFIG_LOG_DEBUG=y +# CONFIG_LOG_DEBUG is not set # CONFIG_LOG_INFO is not set # CONFIG_LOG_WARN is not set -# CONFIG_LOG_ERROR is not set +CONFIG_LOG_ERROR=y # CONFIG_LOG_NONE is not set CONFIG_LOG_EXTRA_INFO=y # CONFIG_LOG_DISPALY_CORE_NUM is not set @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,8 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -168,9 +160,9 @@ CONFIG_OUTPUT_BINARY=y # # Optimization options # -# CONFIG_DEBUG_NOOPT is not set +CONFIG_DEBUG_NOOPT=y # CONFIG_DEBUG_CUSTOMOPT is not set -CONFIG_DEBUG_FULLOPT=y +# CONFIG_DEBUG_FULLOPT is not set CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y CONFIG_DEBUG_LINK_MAP=y # CONFIG_CCACHE is not set @@ -340,16 +332,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/usb/xhci_platform/configs/e2000q_aarch64_demo_cherry_usb.config b/example/peripheral/usb/xhci_platform/configs/e2000q_aarch64_demo_cherry_usb.config index 6550cd3c3e5af5705060102ecd6eb1d03d821cd1..f9fc25ef110d46471d45baa08ae1e55e1cf55c1b 100644 --- a/example/peripheral/usb/xhci_platform/configs/e2000q_aarch64_demo_cherry_usb.config +++ b/example/peripheral/usb/xhci_platform/configs/e2000q_aarch64_demo_cherry_usb.config @@ -29,7 +29,7 @@ CONFIG_GCC_CODE_MODEL_SMALL=y # CONFIG_GCC_CODE_MODEL_LARGE is not set # end of Compiler configuration -# CONFIG_BOOT_WITH_FLUSH_CACHE is not set +CONFIG_BOOT_WITH_FLUSH_CACHE=y # CONFIG_MMU_DEBUG_PRINTS is not set # end of Arm architecture configuration @@ -94,10 +94,10 @@ CONFIG_TARGET_NAME="cherry_usb" # CONFIG_ELOG_LINE_BUF_SIZE=0x100 # CONFIG_LOG_VERBOS is not set -CONFIG_LOG_DEBUG=y +# CONFIG_LOG_DEBUG is not set # CONFIG_LOG_INFO is not set # CONFIG_LOG_WARN is not set -# CONFIG_LOG_ERROR is not set +CONFIG_LOG_ERROR=y # CONFIG_LOG_NONE is not set CONFIG_LOG_EXTRA_INFO=y # CONFIG_LOG_DISPALY_CORE_NUM is not set @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,8 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -162,9 +154,9 @@ CONFIG_OUTPUT_BINARY=y # # Optimization options # -# CONFIG_DEBUG_NOOPT is not set +CONFIG_DEBUG_NOOPT=y # CONFIG_DEBUG_CUSTOMOPT is not set -CONFIG_DEBUG_FULLOPT=y +# CONFIG_DEBUG_FULLOPT is not set CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y CONFIG_DEBUG_LINK_MAP=y # CONFIG_CCACHE is not set @@ -329,16 +321,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/usb/xhci_platform/configs/phytiumpi_aarch32_firefly_cherry_usb.config b/example/peripheral/usb/xhci_platform/configs/phytiumpi_aarch32_firefly_cherry_usb.config index 03affbd2e11673cec58be192beb7e503922d8232..2e4121b27e28c34b19895431e9740c9ee721545f 100644 --- a/example/peripheral/usb/xhci_platform/configs/phytiumpi_aarch32_firefly_cherry_usb.config +++ b/example/peripheral/usb/xhci_platform/configs/phytiumpi_aarch32_firefly_cherry_usb.config @@ -99,10 +99,10 @@ CONFIG_TARGET_NAME="cherry_usb" # CONFIG_ELOG_LINE_BUF_SIZE=0x100 # CONFIG_LOG_VERBOS is not set -CONFIG_LOG_DEBUG=y +# CONFIG_LOG_DEBUG is not set # CONFIG_LOG_INFO is not set # CONFIG_LOG_WARN is not set -# CONFIG_LOG_ERROR is not set +CONFIG_LOG_ERROR=y # CONFIG_LOG_NONE is not set CONFIG_LOG_EXTRA_INFO=y # CONFIG_LOG_DISPALY_CORE_NUM is not set @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,8 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -167,9 +159,9 @@ CONFIG_OUTPUT_BINARY=y # # Optimization options # -# CONFIG_DEBUG_NOOPT is not set +CONFIG_DEBUG_NOOPT=y # CONFIG_DEBUG_CUSTOMOPT is not set -CONFIG_DEBUG_FULLOPT=y +# CONFIG_DEBUG_FULLOPT is not set CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y CONFIG_DEBUG_LINK_MAP=y # CONFIG_CCACHE is not set @@ -339,16 +331,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/usb/xhci_platform/configs/phytiumpi_aarch64_firefly_cherry_usb.config b/example/peripheral/usb/xhci_platform/configs/phytiumpi_aarch64_firefly_cherry_usb.config index 37be78771febf03fe965cc918400df4a20f8b59f..06ba4afdcf8446ead86fc3e8241ff4791ac11053 100644 --- a/example/peripheral/usb/xhci_platform/configs/phytiumpi_aarch64_firefly_cherry_usb.config +++ b/example/peripheral/usb/xhci_platform/configs/phytiumpi_aarch64_firefly_cherry_usb.config @@ -29,7 +29,7 @@ CONFIG_GCC_CODE_MODEL_SMALL=y # CONFIG_GCC_CODE_MODEL_LARGE is not set # end of Compiler configuration -# CONFIG_BOOT_WITH_FLUSH_CACHE is not set +CONFIG_BOOT_WITH_FLUSH_CACHE=y # CONFIG_MMU_DEBUG_PRINTS is not set # end of Arm architecture configuration @@ -93,10 +93,10 @@ CONFIG_TARGET_NAME="cherry_usb" # CONFIG_ELOG_LINE_BUF_SIZE=0x100 # CONFIG_LOG_VERBOS is not set -CONFIG_LOG_DEBUG=y +# CONFIG_LOG_DEBUG is not set # CONFIG_LOG_INFO is not set # CONFIG_LOG_WARN is not set -# CONFIG_LOG_ERROR is not set +CONFIG_LOG_ERROR=y # CONFIG_LOG_NONE is not set CONFIG_LOG_EXTRA_INFO=y # CONFIG_LOG_DISPALY_CORE_NUM is not set @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,8 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -161,9 +153,9 @@ CONFIG_OUTPUT_BINARY=y # # Optimization options # -# CONFIG_DEBUG_NOOPT is not set +CONFIG_DEBUG_NOOPT=y # CONFIG_DEBUG_CUSTOMOPT is not set -CONFIG_DEBUG_FULLOPT=y +# CONFIG_DEBUG_FULLOPT is not set CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y CONFIG_DEBUG_LINK_MAP=y # CONFIG_CCACHE is not set @@ -328,16 +320,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/usb/xhci_platform/figs/phytiumpi_attached_usb_devices.png b/example/peripheral/usb/xhci_platform/figs/phytiumpi_attached_usb_devices.png new file mode 100644 index 0000000000000000000000000000000000000000..7c155abef04f7efe6817d80ad799e92fbdfdb3ac Binary files /dev/null and b/example/peripheral/usb/xhci_platform/figs/phytiumpi_attached_usb_devices.png differ diff --git a/example/peripheral/usb/xhci_platform/figs/phytiumpi_usb_devices.png b/example/peripheral/usb/xhci_platform/figs/phytiumpi_usb_devices.png new file mode 100644 index 0000000000000000000000000000000000000000..8dcc181601a23bd43172a2d1e34e9b2416242b63 Binary files /dev/null and b/example/peripheral/usb/xhci_platform/figs/phytiumpi_usb_devices.png differ diff --git a/example/peripheral/usb/xhci_platform/figs/phytiumpi_usb_speed.png b/example/peripheral/usb/xhci_platform/figs/phytiumpi_usb_speed.png new file mode 100644 index 0000000000000000000000000000000000000000..acbc3c09d63b62eba2c3b409238dba0e4daa272f Binary files /dev/null and b/example/peripheral/usb/xhci_platform/figs/phytiumpi_usb_speed.png differ diff --git a/example/peripheral/usb/xhci_platform/figs/usb3_hub_arch.png b/example/peripheral/usb/xhci_platform/figs/usb3_hub_arch.png new file mode 100644 index 0000000000000000000000000000000000000000..1efd6fd20750567507388744658d60dfdfa6a417 Binary files /dev/null and b/example/peripheral/usb/xhci_platform/figs/usb3_hub_arch.png differ diff --git a/example/peripheral/usb/xhci_platform/figs/usb_disk_connection.jpg b/example/peripheral/usb/xhci_platform/figs/usb_disk_connection.jpg deleted file mode 100644 index 72482bdfa1da66beef8c85bd989c707440514bc2..0000000000000000000000000000000000000000 Binary files a/example/peripheral/usb/xhci_platform/figs/usb_disk_connection.jpg and /dev/null differ diff --git a/example/peripheral/usb/xhci_platform/figs/usb_disk_init.png b/example/peripheral/usb/xhci_platform/figs/usb_disk_init.png deleted file mode 100644 index 06e9831ad843239adcac0ff5410574d69f5aa342..0000000000000000000000000000000000000000 Binary files a/example/peripheral/usb/xhci_platform/figs/usb_disk_init.png and /dev/null differ diff --git a/example/peripheral/usb/xhci_platform/figs/usb_keyboard_input.png b/example/peripheral/usb/xhci_platform/figs/usb_keyboard_input.png deleted file mode 100644 index 930ff62d461791dac946e34c5592227416636dcb..0000000000000000000000000000000000000000 Binary files a/example/peripheral/usb/xhci_platform/figs/usb_keyboard_input.png and /dev/null differ diff --git a/example/peripheral/usb/xhci_platform/figs/usb_keyboard_mouse.jpg b/example/peripheral/usb/xhci_platform/figs/usb_keyboard_mouse.jpg deleted file mode 100644 index f963506419c886df8d8e1503adf57e46bb9167d5..0000000000000000000000000000000000000000 Binary files a/example/peripheral/usb/xhci_platform/figs/usb_keyboard_mouse.jpg and /dev/null differ diff --git a/example/peripheral/usb/xhci_platform/figs/usb_keyboard_mouse_connect.jpg b/example/peripheral/usb/xhci_platform/figs/usb_keyboard_mouse_connect.jpg deleted file mode 100644 index 1542210c8a0c1a26ced0483c90b7f07068d02dd7..0000000000000000000000000000000000000000 Binary files a/example/peripheral/usb/xhci_platform/figs/usb_keyboard_mouse_connect.jpg and /dev/null differ diff --git a/example/peripheral/usb/xhci_platform/figs/usb_mouse_input.png b/example/peripheral/usb/xhci_platform/figs/usb_mouse_input.png deleted file mode 100644 index bf30b0703d770abb602b4d90d2cdf19360935a30..0000000000000000000000000000000000000000 Binary files a/example/peripheral/usb/xhci_platform/figs/usb_mouse_input.png and /dev/null differ diff --git a/example/peripheral/usb/xhci_platform/figs/xhci_0_1.png b/example/peripheral/usb/xhci_platform/figs/xhci_0_1.png new file mode 100644 index 0000000000000000000000000000000000000000..237c3cc7c62efa3bba281749ac4a1e8d7da34855 Binary files /dev/null and b/example/peripheral/usb/xhci_platform/figs/xhci_0_1.png differ diff --git a/example/peripheral/usb/xhci_platform/figs/xhci_0_1_devices.png b/example/peripheral/usb/xhci_platform/figs/xhci_0_1_devices.png new file mode 100644 index 0000000000000000000000000000000000000000..1357bb7d88fb59c118e908f1fb38b162172306f4 Binary files /dev/null and b/example/peripheral/usb/xhci_platform/figs/xhci_0_1_devices.png differ diff --git a/example/peripheral/usb/xhci_platform/figs/xhci_0_attach_devices.png b/example/peripheral/usb/xhci_platform/figs/xhci_0_attach_devices.png new file mode 100644 index 0000000000000000000000000000000000000000..33687b3b387a72cbc434f50798f5330d250337ad Binary files /dev/null and b/example/peripheral/usb/xhci_platform/figs/xhci_0_attach_devices.png differ diff --git a/example/peripheral/usb/xhci_platform/figs/xhci_0_hotpluginout.png b/example/peripheral/usb/xhci_platform/figs/xhci_0_hotpluginout.png new file mode 100644 index 0000000000000000000000000000000000000000..56fb50ec4ce29585f42068ce8ecef8cd1da6f8f8 Binary files /dev/null and b/example/peripheral/usb/xhci_platform/figs/xhci_0_hotpluginout.png differ diff --git a/example/peripheral/usb/xhci_platform/figs/xhci_0_rw_usb_disk.png b/example/peripheral/usb/xhci_platform/figs/xhci_0_rw_usb_disk.png new file mode 100644 index 0000000000000000000000000000000000000000..04ec28ef5693c42dc4e0e46a8a25992a6358db58 Binary files /dev/null and b/example/peripheral/usb/xhci_platform/figs/xhci_0_rw_usb_disk.png differ diff --git a/example/peripheral/usb/xhci_platform/figs/xhci_0_usb2_disk_speed.png b/example/peripheral/usb/xhci_platform/figs/xhci_0_usb2_disk_speed.png new file mode 100644 index 0000000000000000000000000000000000000000..da791dd1946e8c59e80f4f09c730093a50e5bf5e Binary files /dev/null and b/example/peripheral/usb/xhci_platform/figs/xhci_0_usb2_disk_speed.png differ diff --git a/example/peripheral/usb/xhci_platform/figs/xhci_0_usb3_disk_speed.png b/example/peripheral/usb/xhci_platform/figs/xhci_0_usb3_disk_speed.png new file mode 100644 index 0000000000000000000000000000000000000000..6f8555464abde9b95e46705050b350ce3197f364 Binary files /dev/null and b/example/peripheral/usb/xhci_platform/figs/xhci_0_usb3_disk_speed.png differ diff --git a/example/peripheral/usb/xhci_platform/figs/xhci_0_usb_devices.png b/example/peripheral/usb/xhci_platform/figs/xhci_0_usb_devices.png new file mode 100644 index 0000000000000000000000000000000000000000..849d6ef287f8426c408b89fe12124def6ba54bc5 Binary files /dev/null and b/example/peripheral/usb/xhci_platform/figs/xhci_0_usb_devices.png differ diff --git a/example/peripheral/usb/xhci_platform/figs/xhci_0_usb_hub_ext.png b/example/peripheral/usb/xhci_platform/figs/xhci_0_usb_hub_ext.png new file mode 100644 index 0000000000000000000000000000000000000000..094d633b87a298e2d2603d7508e6f546bb89f28a Binary files /dev/null and b/example/peripheral/usb/xhci_platform/figs/xhci_0_usb_hub_ext.png differ diff --git a/example/peripheral/usb/xhci_platform/figs/xhci_0_usb_keyboard.png b/example/peripheral/usb/xhci_platform/figs/xhci_0_usb_keyboard.png new file mode 100644 index 0000000000000000000000000000000000000000..ca90f279c966e4acc338b10657db153c5739c7a8 Binary files /dev/null and b/example/peripheral/usb/xhci_platform/figs/xhci_0_usb_keyboard.png differ diff --git a/example/peripheral/usb/xhci_platform/figs/xhci_0_usb_mouse.png b/example/peripheral/usb/xhci_platform/figs/xhci_0_usb_mouse.png new file mode 100644 index 0000000000000000000000000000000000000000..113daf722d9d84d4762c101c58554932ca377774 Binary files /dev/null and b/example/peripheral/usb/xhci_platform/figs/xhci_0_usb_mouse.png differ diff --git a/example/peripheral/usb/xhci_pcie/inc/usb_host.h b/example/peripheral/usb/xhci_platform/inc/xhci_host_example.h similarity index 73% rename from example/peripheral/usb/xhci_pcie/inc/usb_host.h rename to example/peripheral/usb/xhci_platform/inc/xhci_host_example.h index d3887ad17e84493d2a5601dda1670f51663b857e..3e5ebb66bc591028f0d35ae7f776c2b4df72d409 100644 --- a/example/peripheral/usb/xhci_pcie/inc/usb_host.h +++ b/example/peripheral/usb/xhci_platform/inc/xhci_host_example.h @@ -11,18 +11,19 @@ * See the Phytium Public License for more details. * * - * FilePath: usb_host.h + * FilePath: xhci_host_example.h * Date: 2022-07-19 09:26:25 * LastEditTime: 2022-07-19 09:26:25 - * Description:  This file is for the usb host definition. + * Description:  This file is for the xhci host definition. * * Modify History: * Ver   Who        Date         Changes * ----- ------     --------    -------------------------------------- * 1.0 zhugengyu 2022/9/20 init commit + * 2.0 zhugengyu 2024/7/1 support auto-run */ -#ifndef USB_HOST_H -#define USB_HOST_H +#ifndef XHCI_HOST_EXAMPLE_H +#define XHCI_HOST_EXAMPLE_H #ifdef __cplusplus extern "C" @@ -38,13 +39,13 @@ extern "C" /***************** Macros (Inline Functions) Definitions *********************/ /************************** Function Prototypes ******************************/ +unsigned long usb_hc_get_register_base(uint32_t id); /*****************************************************************************/ -BaseType_t FFreeRTOSInitUsb(u32 id); -BaseType_t FFreeRTOSRunUsbDisk(const char *devname); -BaseType_t FFreeRTOSRunUsbKeyboard(const char *devname); -BaseType_t FFreeRTOSRunUsbMouse(const char *devname); -BaseType_t FFreeRTOSListUsbDev(int argc, char *argv[]); +BaseType_t FFreeRTOSRunXhciDisk(u32 id, const char *devname); +BaseType_t FFreeRTOSRunXhciDiskBench(u32 id, const char *devname); +BaseType_t FFreeRTOSRunXhciKeyboard(u32 id, const char *devname); +BaseType_t FFreeRTOSRunXhciMouse(u32 id, const char *devname); #ifdef __cplusplus } diff --git a/example/peripheral/usb/xhci_platform/main.c b/example/peripheral/usb/xhci_platform/main.c index b1c1a3a505a8ef6083af9f513d69dfbaa9fcf896..c1624975e82f5db1807f2b8cd5ef605a118d48c2 100644 --- a/example/peripheral/usb/xhci_platform/main.c +++ b/example/peripheral/usb/xhci_platform/main.c @@ -20,26 +20,57 @@ * Ver   Who         Date         Changes * ----- ------     --------    -------------------------------------- * 1.0 zhugengyu 2022/10/19 init commit + * 2.0 zhugengyu 2024/7/1 support auto-run */ +#include +#include "FreeRTOS.h" +#include "fparameters.h" + +#ifdef CONFIG_USE_LETTER_SHELL #include "shell.h" #include "shell_port.h" -#include +#else + +#include "usbh_core.h" + +#define XHCI_EXAMPLE_TASK_PRIORITY 2U +void XhciPlatformExampleTaskEntry(void) +{ + /* init xhci controller */ + + (void)usbh_initialize(0U, 0U); + + vTaskDelete(NULL); +} +#endif int main(void) { - BaseType_t ret; + BaseType_t ret = pdPASS; +#ifdef CONFIG_USE_LETTER_SHELL ret = LSUserShellTask(); if (ret != pdPASS) { goto FAIL_EXIT; } +#else + + taskENTER_CRITICAL(); + ret = xTaskCreate((TaskFunction_t)XhciPlatformExampleTaskEntry, /* 任务入口函数 */ + (const char *)"XhciPlatformExampleTaskEntry",/* 任务名字 */ + (uint16_t)4096, /* 任务栈大小 */ + NULL,/* 任务入口函数参数 */ + (UBaseType_t)XHCI_EXAMPLE_TASK_PRIORITY, /* 任务的优先级 */ + NULL); + taskEXIT_CRITICAL(); +#endif vTaskStartScheduler(); /* 启动任务,开启调度 */ while (1); /* 正常不会执行到这里 */ FAIL_EXIT: printf("Failed,the ret value is 0x%x. \r\n", ret); - return 0; + return ret; } diff --git a/example/peripheral/usb/xhci_platform/makefile b/example/peripheral/usb/xhci_platform/makefile index 7691fd58334cde9d2d6959db772fdd277c34d149..a12ccba8ec27bf8f6fbde4a1138f59f9df72b911 100644 --- a/example/peripheral/usb/xhci_platform/makefile +++ b/example/peripheral/usb/xhci_platform/makefile @@ -8,7 +8,6 @@ BOOT_IMG_NAME ?= freertos USER_CSRC := main.c USER_CSRC += $(wildcard src/*.c) -USER_CSRC += $(wildcard ../common/*.c) USER_ASRC := USER_CXXSRC := @@ -19,8 +18,11 @@ USER_INCLUDE := $(PROJECT_DIR) \ include $(FREERTOS_SDK_DIR)/tools/makeall.mk +ifeq ($(OS),Windows_NT) +USR_BOOT_DIR ?= D:\\tftpboot +else USR_BOOT_DIR ?= /mnt/d/tftpboot - +endif image: all @cp ./$(IMAGE_OUT_NAME).elf $(USR_BOOT_DIR)/freertos.elf diff --git a/example/peripheral/usb/xhci_platform/sdkconfig b/example/peripheral/usb/xhci_platform/sdkconfig index 37be78771febf03fe965cc918400df4a20f8b59f..06ba4afdcf8446ead86fc3e8241ff4791ac11053 100644 --- a/example/peripheral/usb/xhci_platform/sdkconfig +++ b/example/peripheral/usb/xhci_platform/sdkconfig @@ -29,7 +29,7 @@ CONFIG_GCC_CODE_MODEL_SMALL=y # CONFIG_GCC_CODE_MODEL_LARGE is not set # end of Compiler configuration -# CONFIG_BOOT_WITH_FLUSH_CACHE is not set +CONFIG_BOOT_WITH_FLUSH_CACHE=y # CONFIG_MMU_DEBUG_PRINTS is not set # end of Arm architecture configuration @@ -93,10 +93,10 @@ CONFIG_TARGET_NAME="cherry_usb" # CONFIG_ELOG_LINE_BUF_SIZE=0x100 # CONFIG_LOG_VERBOS is not set -CONFIG_LOG_DEBUG=y +# CONFIG_LOG_DEBUG is not set # CONFIG_LOG_INFO is not set # CONFIG_LOG_WARN is not set -# CONFIG_LOG_ERROR is not set +CONFIG_LOG_ERROR=y # CONFIG_LOG_NONE is not set CONFIG_LOG_EXTRA_INFO=y # CONFIG_LOG_DISPALY_CORE_NUM is not set @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,8 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -CONFIG_USE_USB=y -CONFIG_ENABLE_USB_FXHCI=y # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -161,9 +153,9 @@ CONFIG_OUTPUT_BINARY=y # # Optimization options # -# CONFIG_DEBUG_NOOPT is not set +CONFIG_DEBUG_NOOPT=y # CONFIG_DEBUG_CUSTOMOPT is not set -CONFIG_DEBUG_FULLOPT=y +# CONFIG_DEBUG_FULLOPT is not set CONFIG_DEBUG_OPT_UNUSED_SECTIONS=y CONFIG_DEBUG_LINK_MAP=y # CONFIG_CCACHE is not set @@ -328,16 +320,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y CONFIG_CHERRY_USB_HOST_HID=y -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration # CONFIG_USE_FSL_SDMMC is not set diff --git a/example/peripheral/usb/xhci_platform/sdkconfig.h b/example/peripheral/usb/xhci_platform/sdkconfig.h index f877757930c2754953df7f7cc83115bd84a17c72..c669dea51951badfdccade21ed1d281f1c38fe69 100644 --- a/example/peripheral/usb/xhci_platform/sdkconfig.h +++ b/example/peripheral/usb/xhci_platform/sdkconfig.h @@ -28,7 +28,7 @@ #define CONFIG_GCC_CODE_MODEL_SMALL /* CONFIG_GCC_CODE_MODEL_LARGE is not set */ /* end of Compiler configuration */ -/* CONFIG_BOOT_WITH_FLUSH_CACHE is not set */ +#define CONFIG_BOOT_WITH_FLUSH_CACHE /* CONFIG_MMU_DEBUG_PRINTS is not set */ /* end of Arm architecture configuration */ #define CONFIG_MMU_PAGE_SIZE 0x1000 @@ -85,10 +85,10 @@ #define CONFIG_ELOG_LINE_BUF_SIZE 0x100 /* CONFIG_LOG_VERBOS is not set */ -#define CONFIG_LOG_DEBUG +/* CONFIG_LOG_DEBUG is not set */ /* CONFIG_LOG_INFO is not set */ /* CONFIG_LOG_WARN is not set */ -/* CONFIG_LOG_ERROR is not set */ +#define CONFIG_LOG_ERROR /* CONFIG_LOG_NONE is not set */ #define CONFIG_LOG_EXTRA_INFO /* CONFIG_LOG_DISPALY_CORE_NUM is not set */ @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,8 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -#define CONFIG_USE_USB -#define CONFIG_ENABLE_USB_FXHCI /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ @@ -147,9 +140,9 @@ /* Optimization options */ -/* CONFIG_DEBUG_NOOPT is not set */ +#define CONFIG_DEBUG_NOOPT /* CONFIG_DEBUG_CUSTOMOPT is not set */ -#define CONFIG_DEBUG_FULLOPT +/* CONFIG_DEBUG_FULLOPT is not set */ #define CONFIG_DEBUG_OPT_UNUSED_SECTIONS #define CONFIG_DEBUG_LINK_MAP /* CONFIG_CCACHE is not set */ @@ -290,16 +283,14 @@ /* CherryUSB Configuration */ +#define CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM +/* CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set */ +/* CONFIG_CHERRY_USB_PORT_PUSB2 is not set */ #define CONFIG_CHERRY_USB_PORT_XHCI -/* CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set */ #define CONFIG_CHERRYUSB_HOST -/* CONFIG_CHERRYUSB_DEVICE is not set */ #define CONFIG_CHERRY_USB_HOST_HUB #define CONFIG_CHERRY_USB_HOST_MSC #define CONFIG_CHERRY_USB_HOST_HID -/* CONFIG_CHERRY_USB_HOST_VEDIO is not set */ -/* CONFIG_CHERRY_USB_HOST_CDC is not set */ -/* CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set */ /* end of CherryUSB Configuration */ /* CONFIG_USE_FSL_SDMMC is not set */ /* CONFIG_USE_FSL_WIFI is not set */ diff --git a/example/peripheral/usb/xhci_platform/src/cmd_usb.c b/example/peripheral/usb/xhci_platform/src/cmd_usb.c index 8881c48161a33e4888e386154c76afbf36f7ef1d..97bc146ab92f07ba562aa80376ef2b3ba6d313db 100644 --- a/example/peripheral/usb/xhci_platform/src/cmd_usb.c +++ b/example/peripheral/usb/xhci_platform/src/cmd_usb.c @@ -28,8 +28,36 @@ #include "FreeRTOS.h" +#include "usbh_core.h" + +#ifdef CONFIG_USE_LETTER_SHELL #include "../src/shell.h" -#include "usb_host.h" +#include "xhci_host_example.h" +#endif + +#ifdef CONFIG_USE_LETTER_SHELL +BaseType_t FFreeRTOSInitUsb(u32 id); +BaseType_t FFreeRTOSDeInitUsb(u32 id); +BaseType_t FFreeRTOSListUsbDev(int argc, char *argv[]); + +static void USBCmdUsage(void) +{ + printf("Usage:\r\n"); + printf("usb start \r\n"); + printf("-- Start usb bus and enumrate devices\r\n"); + printf("usb stop \r\n"); + printf("-- Stop usb bus and deattach devices\r\n"); + printf("usb lsusb\r\n"); + printf("-- List all attached devices on usb bus\r\n"); + printf("usb disk \r\n"); + printf("-- Read and write usb disk device\r\n"); + printf("usb diskbench \r\n"); + printf("-- Bench read and write usb disk device\r\n"); + printf("usb keyboard \r\n"); + printf("-- Get usb keyboard input\r\n"); + printf("usb mouse \r\n"); + printf("-- Get usb mouse input\r\n"); +} static int USBCmdEntry(int argc, char *argv[]) { @@ -37,47 +65,126 @@ static int USBCmdEntry(int argc, char *argv[]) u32 usb_id = 0; const char *devname; - if (!strcmp(argv[1], "init")) + if (!strcmp(argv[1], "start")) + { + if (argc < 2) + { + usb_id = 0; + } + else + { + usb_id = (uint8_t)simple_strtoul(argv[2], NULL, 10); + } + + ret = usbh_initialize(usb_id, usb_hc_get_register_base(usb_id)); + } + else if (!strcmp(argv[1], "stop")) { - if (argc < 3) { - return -2; + if (argc < 2) + { + usb_id = 0; + } + else + { + usb_id = (uint8_t)simple_strtoul(argv[2], NULL, 10); } - usb_id = (uint8_t)simple_strtoul(argv[2], NULL, 10); - ret = FFreeRTOSInitUsb(usb_id); + ret = usbh_deinitialize(usb_id); } else if (!strcmp(argv[1], "lsusb")) { - ret = FFreeRTOSListUsbDev(argc - 1, &argv[1]); + ret = lsusb(argc - 1, &argv[1]); } else if (!strcmp(argv[1], "disk")) { - if (argc < 3) { - return -2; + if (argc < 2) + { + usb_id = 0; + } + else + { + usb_id = (uint8_t)simple_strtoul(argv[2], NULL, 10); + } + + if (argc < 3) + { + devname = "/dev/sda"; + } + else + { + devname = argv[3]; } - devname = argv[2]; - ret = FFreeRTOSRunUsbDisk(devname); + ret = FFreeRTOSRunXhciDisk(usb_id, devname); } - else if (!strcmp(argv[1], "kbd")) + else if (!strcmp(argv[1], "diskbench")) { - if (argc < 3) { - return -2; + if (argc < 2) + { + usb_id = 0; + } + else + { + usb_id = (uint8_t)simple_strtoul(argv[2], NULL, 10); + } + + if (argc < 3) + { + devname = "/dev/sda"; + } + else + { + devname = argv[3]; } - devname = argv[2]; - ret = FFreeRTOSRunUsbKeyboard(devname); + ret = FFreeRTOSRunXhciDiskBench(usb_id, devname); + } + else if (!strcmp(argv[1], "keyboard")) + { + if (argc < 2) + { + usb_id = 0; + } + else + { + usb_id = (uint8_t)simple_strtoul(argv[2], NULL, 10); + } + + if (argc < 3) + { + devname = "/dev/input0"; + } + else + { + devname = argv[3]; + } + + ret = FFreeRTOSRunXhciKeyboard(usb_id, devname); } else if (!strcmp(argv[1], "mouse")) { - if (argc < 3) { - return -2; + if (argc < 2) + { + usb_id = 0; + } + else + { + usb_id = (uint8_t)simple_strtoul(argv[2], NULL, 10); + } + + if (argc < 3) + { + devname = "/dev/input0"; + } + else + { + devname = argv[3]; } - devname = argv[2]; - ret = FFreeRTOSRunUsbMouse(devname); + ret = FFreeRTOSRunXhciMouse(usb_id, devname); } return ret; } -SHELL_EXPORT_CMD(SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), usb, USBCmdEntry, test freertos usb driver); \ No newline at end of file +SHELL_EXPORT_CMD(SHELL_CMD_TYPE(SHELL_TYPE_CMD_MAIN), usb, USBCmdEntry, test freertos usb driver); +#endif \ No newline at end of file diff --git a/example/peripheral/usb/xhci_platform/src/xhci_usb_disk_bench_example.c b/example/peripheral/usb/xhci_platform/src/xhci_usb_disk_bench_example.c new file mode 100644 index 0000000000000000000000000000000000000000..ea029a1422dff24d123466e6e8346f73ce5ac3b2 --- /dev/null +++ b/example/peripheral/usb/xhci_platform/src/xhci_usb_disk_bench_example.c @@ -0,0 +1,228 @@ +/* + * Copyright : (C) 2022 Phytium Information Technology, Inc. + * All Rights Reserved. + * + * This program is OPEN SOURCE software: you can redistribute it and/or modify it + * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, + * either version 1.0 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Phytium Public License for more details. + * + * + * FilePath: xhci_usb_disk_bench_example.c + * Date: 2022-09-23 08:24:09 + * LastEditTime: 2022-09-23 08:24:10 + * Description:  This file is for the usb disk functions. + * + * Modify History: + * Ver   Who         Date         Changes + * ----- ------     --------    -------------------------------------- + * 1.0 zhugengyu 2022/10/19 init commit + * 2.0 zhugengyu 2024/7/1 support auto-run + */ +/***************************** Include Files *********************************/ +#include +#include + +#include "FreeRTOS.h" +#include "queue.h" +#include "task.h" + +#include "fassert.h" +#include "fdebug.h" +#include "fkernel.h" + +#include "usbh_core.h" +#include "usbh_msc.h" + +#include "xhci_host_example.h" +/************************** Constant Definitions *****************************/ +#define TIMER_OUT (0xFFFFFFFF) + +#define USB_MAX_RW_BLK 1000U +#define USB_DISK_BLK_SIZE 512U +#define USB_DISK_START_BLK 0U +#define USB_BENCH_TIMES 6U +#define USB_BENCH_SIZE (u64)(SZ_1M * 200ULL) +#define USB_BENCH_BLKS (USB_BENCH_SIZE / USB_DISK_BLK_SIZE) +/**************************** Type Definitions *******************************/ +enum +{ + XHCI_USB_DISK_RW_SUCCESS = 0, + XHCI_USB_DISK_RW_FAIL = 1, +}; + +/************************** Variable Definitions *****************************/ +static uint8_t rw_buf[USB_DISK_BLK_SIZE * USB_MAX_RW_BLK] = {0}; +static uintptr_t usb_id = 0; +static QueueHandle_t xQueue = NULL; + +/***************** Macros (Inline Functions) Definitions *********************/ +#define FUSB_DEBUG_TAG "XHCI-USB-DISK" +#define FUSB_ERROR(format, ...) FT_DEBUG_PRINT_E(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_WARN(format, ...) FT_DEBUG_PRINT_W(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_INFO(format, ...) FT_DEBUG_PRINT_I(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_DEBUG(format, ...) FT_DEBUG_PRINT_D(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) + +/************************** Function Prototypes ******************************/ + +/*****************************************************************************/ +static void XhciUsbMscBenchTask(void *args) +{ + int ret; + u8 id = (u8)usb_id; + struct usbh_msc *msc_class; + u32 loop = 0; + const char *devname = (const char *)args; + TickType_t tick_count, tick_spend; + double time_in_seconds, rw_speed; + u64 start_blk = USB_DISK_START_BLK; + u64 bench_blk; + u64 bench_rw; + int run_times = USB_BENCH_TIMES; + + msc_class = (struct usbh_msc *)usbh_find_class_instance(devname); + if (msc_class == NULL) + { + USB_LOG_RAW("Do not find %s. \r\n", devname); + goto task_exit; + } + + while (run_times-- > 0) + { + + /* do write bench */ + { + for (u32 i = 0; i < USB_MAX_RW_BLK; i++) /* fill some none-zero value into write buffer */ + { + memset(rw_buf + i * USB_DISK_BLK_SIZE, ((USB_DISK_START_BLK + i) & 0xff), USB_DISK_BLK_SIZE); + } + + bench_blk = start_blk; + + if ((bench_blk + USB_BENCH_BLKS) > msc_class->blocknum) + { + break; + } + + printf("Writing the %ld MB data (Block %ld ~ %ld), waiting...\r\n", + USB_BENCH_SIZE / SZ_1M, bench_blk, bench_blk + USB_BENCH_BLKS); + tick_count = xTaskGetTickCount(); + + while (bench_blk < (start_blk + USB_BENCH_BLKS)) + { + /* how many blocks to be wrote this time */ + bench_rw = (bench_blk + USB_MAX_RW_BLK) <= (start_blk + USB_BENCH_BLKS) ? + USB_MAX_RW_BLK : (start_blk + USB_BENCH_BLKS - bench_blk); + + ret = usbh_msc_scsi_write10(msc_class, bench_blk, rw_buf, USB_MAX_RW_BLK); + if (ret < 0) + { + USB_LOG_ERR("Error in scsi_write10 error, ret:%d", ret); + goto task_exit; + } + + bench_blk += bench_rw; + } + + tick_spend = xTaskGetTickCount() - tick_count; + time_in_seconds = ((double)tick_spend / configTICK_RATE_HZ); + rw_speed = ((double)USB_BENCH_SIZE / SZ_1M) / time_in_seconds; + printf("Write benchmark success, total time: %.2f Sec, total size: %d MB, speed: %.2f MB/sec\r\n", + time_in_seconds, + (int)(USB_BENCH_SIZE / SZ_1M), + rw_speed); /* this forced type casting is to avoid floating-point printing error */ + } + + /* do read bench */ + { + printf("Reading the %ld MB data (%ld Blocks), waiting...\r\n", + USB_BENCH_SIZE / SZ_1M, USB_BENCH_BLKS); + tick_count = xTaskGetTickCount(); + + bench_blk = start_blk; + while (bench_blk < (start_blk + USB_BENCH_BLKS)) + { + /* how many blocks to be wrote this time */ + bench_rw = (bench_blk + USB_MAX_RW_BLK) <= (start_blk + USB_BENCH_BLKS) ? + USB_MAX_RW_BLK : (start_blk + USB_BENCH_BLKS - bench_blk); + + ret = usbh_msc_scsi_read10(msc_class, bench_blk, rw_buf, USB_MAX_RW_BLK); + if (ret < 0) + { + USB_LOG_ERR("Error in scsi_write10 error, ret:%d", ret); + goto task_exit; + } + + bench_blk += bench_rw; + } + + tick_spend = xTaskGetTickCount() - tick_count; + time_in_seconds = ((double)tick_spend / configTICK_RATE_HZ); + rw_speed = ((double)USB_BENCH_SIZE / SZ_1M) / time_in_seconds; + printf("Read benchmark success, total time: %.2f Sec, total size: %d MB, speed: %.2f MB/sec\r\n", + time_in_seconds, + (int)(USB_BENCH_SIZE / SZ_1M), + rw_speed); /* this forced type casting is to avoid floating-point printing error */ + } + + start_blk += USB_BENCH_BLKS; + } + +task_exit: + ret = (ret == 0) ? XHCI_USB_DISK_RW_SUCCESS : XHCI_USB_DISK_RW_FAIL; + xQueueSend(xQueue, &ret, 0); + vTaskDelete(NULL); +} + +BaseType_t FFreeRTOSRunXhciDiskBench(u32 id, const char *devname) +{ + BaseType_t ret = pdPASS; + int task_res = XHCI_USB_DISK_RW_SUCCESS; + xQueue = xQueueCreate(1, sizeof(int)); + if (xQueue == NULL) + { + FUSB_ERROR("xQueue create failed.\r\n"); + goto exit; + } + + usb_id = id; + + ret = xTaskCreate((TaskFunction_t)XhciUsbMscBenchTask, + (const char *)"XhciUsbMscBenchTask", + (uint16_t)4096, + (void *)devname, + (UBaseType_t)configMAX_PRIORITIES - 1, + NULL); + if (ret != pdPASS) + { + FUSB_ERROR("xTaskCreate create failed.\r\n"); + goto exit; + } + + ret = xQueueReceive(xQueue, &task_res, TIMER_OUT); + if (ret != pdPASS) + { + FUSB_ERROR("xQueue receive timeout.\r\n"); + goto exit; + } + +exit: + if (xQueue) + { + vQueueDelete(xQueue); + } + + if (task_res != XHCI_USB_DISK_RW_SUCCESS) + { + printf("%s@%d: XHCI usb disk read/write example [failure], task_res = %d\r\n", __func__, __LINE__, task_res); + return pdFAIL; + } + else + { + printf("%s@%d: XHCI usb disk read/write example [success].\r\n", __func__, __LINE__); + return pdTRUE; + } +} diff --git a/example/peripheral/usb/xhci_pcie/src/usb_disk.c b/example/peripheral/usb/xhci_platform/src/xhci_usb_disk_read_write_example.c similarity index 48% rename from example/peripheral/usb/xhci_pcie/src/usb_disk.c rename to example/peripheral/usb/xhci_platform/src/xhci_usb_disk_read_write_example.c index 31fd28a7e7e6b58a5ee9183ac24e080dad33d898..35aa8e9c730621e9fe846c4f999eed21957e81ed 100644 --- a/example/peripheral/usb/xhci_pcie/src/usb_disk.c +++ b/example/peripheral/usb/xhci_platform/src/xhci_usb_disk_read_write_example.c @@ -11,7 +11,7 @@ * See the Phytium Public License for more details. * * - * FilePath: usb_disk.c + * FilePath: xhci_usb_disk_read_write_example.c * Date: 2022-09-23 08:24:09 * LastEditTime: 2022-09-23 08:24:10 * Description:  This file is for the usb disk functions. @@ -20,6 +20,7 @@ * Ver   Who         Date         Changes * ----- ------     --------    -------------------------------------- * 1.0 zhugengyu 2022/10/19 init commit + * 2.0 zhugengyu 2024/7/1 support auto-run */ /***************************** Include Files *********************************/ #include @@ -29,108 +30,168 @@ #include "task.h" #include "fassert.h" -#include "finterrupt.h" -#include "fcpu_info.h" #include "fdebug.h" +#include "fmemory_pool.h" #include "usbh_core.h" #include "usbh_msc.h" + +#include "xhci_host_example.h" /************************** Constant Definitions *****************************/ +#define TIMER_OUT (pdMS_TO_TICKS(10000UL)) /**************************** Type Definitions *******************************/ +enum +{ + XHCI_USB_DISK_RW_SUCCESS = 0, + XHCI_USB_DISK_RW_FAIL = 1, +}; /************************** Variable Definitions *****************************/ +static uint8_t rd_table[512] = {0}; +static uint8_t wr_table[512] = {0}; +static uintptr_t usb_id = 0; +static QueueHandle_t xQueue = NULL; /***************** Macros (Inline Functions) Definitions *********************/ -#define FUSB_DEBUG_TAG "USB-DISK" +#define FUSB_DEBUG_TAG "XHCI-USB-DISK" #define FUSB_ERROR(format, ...) FT_DEBUG_PRINT_E(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) #define FUSB_WARN(format, ...) FT_DEBUG_PRINT_W(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) #define FUSB_INFO(format, ...) FT_DEBUG_PRINT_I(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) #define FUSB_DEBUG(format, ...) FT_DEBUG_PRINT_D(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) /************************** Function Prototypes ******************************/ - - +void usb_hc_dcache_invalidate(void *addr, unsigned long len); +void usb_hc_dcache_flush(void *addr, unsigned long len); /*****************************************************************************/ -static void UsbMscTask(void *args) +static void XhciUsbMscTask(void *args) { int ret; + u8 id = (u8)usb_id; struct usbh_msc *msc_class; - static uint8_t rd_table[512] = {0}; - static uint8_t wr_table[512] = {0}; u32 loop = 0; + uint32_t start_blk = 0; + uint32_t blk_num = 1; const char *devname = (const char *)args; msc_class = (struct usbh_msc *)usbh_find_class_instance(devname); if (msc_class == NULL) { USB_LOG_RAW("Do not find %s. \r\n", devname); - goto err_exit; + goto task_exit; } + /* check msc device information */ + printf("MSC (/dev/sd%c) info:\r\n", (char)msc_class->sdchar); + printf(" USB: 0x%04x\r\n", msc_class->hport->device_desc.bcdUSB); + printf(" Class: 0x%02x\r\n", msc_class->hport->device_desc.bDeviceClass); + printf(" Subclass: 0x%02x\r\n", msc_class->hport->device_desc.bDeviceSubClass); + printf(" Protocol: 0x%02x\r\n", msc_class->hport->device_desc.bDeviceProtocol); + printf(" Block size: %d\r\n", msc_class->blocksize); + printf(" Total size: %ld GB\r\n", ((u64)msc_class->blocksize * msc_class->blocknum) / SZ_1G); + printf(" Bulk in: %d(mps)\r\n", msc_class->bulkin->wMaxPacketSize); + printf(" Bulk out: %d(mps)\r\n", msc_class->bulkout->wMaxPacketSize); + while (TRUE) { /* write partition table */ - memcpy(wr_table, rd_table, sizeof(rd_table)); for (uint32_t i = 0; i < 512; i++) { wr_table[i] ^= 0xfffff; } - ret = usbh_msc_scsi_write10(msc_class, 0, wr_table, 1); + ret = usbh_msc_scsi_write10(msc_class, start_blk, wr_table, blk_num); if (ret < 0) { USB_LOG_ERR("Error in scsi_write10 error, ret:%d", ret); - goto err_exit; + goto task_exit; } /* get the partition table */ - ret = usbh_msc_scsi_read10(msc_class, 0, rd_table, 1); + ret = usbh_msc_scsi_read10(msc_class, start_blk, rd_table, blk_num); if (ret < 0) { - USB_LOG_RAW("Error in scsi_read10, ret:%d", ret); - goto err_exit; + USB_LOG_ERR("Error in scsi_read10, ret:%d", ret); + goto task_exit; } /* check if read table == write table */ if (0 != memcmp(wr_table, rd_table, sizeof(rd_table))) { USB_LOG_ERR("Failed to check read and write.\r\n"); - goto err_exit; + goto task_exit; } else { - printf("[%d] disk read and write successfully.\r\n", loop); + printf("[%d] disk read and write %d bytes successfully.\r\n", loop, sizeof(rd_table)); +#if defined(CONFIG_LOG_DEBUG) || defined(CONFIG_LOG_VERBOS) + FtDumpHexByte(rd_table, sizeof(rd_table)); +#endif } loop++; - if (loop > 10) + if (loop > 5) { break; } - vTaskDelay(100); + start_blk += blk_num; + + vTaskDelay(1); } -err_exit: +task_exit: + ret = (ret == 0) ? XHCI_USB_DISK_RW_SUCCESS : XHCI_USB_DISK_RW_FAIL; + xQueueSend(xQueue, &ret, 0); vTaskDelete(NULL); } -BaseType_t FFreeRTOSRunUsbDisk(const char *devname) +BaseType_t FFreeRTOSRunXhciDisk(u32 id, const char *devname) { BaseType_t ret = pdPASS; + int task_res = XHCI_USB_DISK_RW_SUCCESS; + xQueue = xQueueCreate(1, sizeof(int)); + if (xQueue == NULL) + { + FUSB_ERROR("xQueue create failed.\r\n"); + goto exit; + } - taskENTER_CRITICAL(); /* no schedule when create task */ + usb_id = id; - ret = xTaskCreate((TaskFunction_t)UsbMscTask, - (const char *)"UsbMscTask", - (uint16_t)2048, + ret = xTaskCreate((TaskFunction_t)XhciUsbMscTask, + (const char *)"XhciUsbMscTask", + (uint16_t)4096, (void *)devname, (UBaseType_t)configMAX_PRIORITIES - 1, NULL); - FASSERT_MSG(pdPASS == ret, "create task failed"); + if (ret != pdPASS) + { + FUSB_ERROR("xTaskCreate create failed.\r\n"); + goto exit; + } - taskEXIT_CRITICAL(); /* allow schedule since task created */ + ret = xQueueReceive(xQueue, &task_res, TIMER_OUT); + if (ret != pdPASS) + { + FUSB_ERROR("xQueue receive timeout.\r\n"); + goto exit; + } + +exit: + if (xQueue) + { + vQueueDelete(xQueue); + } - return ret; + if (task_res != XHCI_USB_DISK_RW_SUCCESS) + { + printf("%s@%d: XHCI usb disk read/write example [failure], task_res = %d\r\n", __func__, __LINE__, task_res); + return pdFAIL; + } + else + { + printf("%s@%d: XHCI usb disk read/write example [success].\r\n", __func__, __LINE__); + return pdTRUE; + } } diff --git a/example/peripheral/usb/xhci_platform/src/usb_input.c b/example/peripheral/usb/xhci_platform/src/xhci_usb_keyboard_input_example.c similarity index 62% rename from example/peripheral/usb/xhci_platform/src/usb_input.c rename to example/peripheral/usb/xhci_platform/src/xhci_usb_keyboard_input_example.c index 513b3a2a8ae2040fb7535e4b2c59ea09a71a4a9d..795be83c01614a77fe2911300e067850752ece2a 100644 --- a/example/peripheral/usb/xhci_platform/src/usb_input.c +++ b/example/peripheral/usb/xhci_platform/src/xhci_usb_keyboard_input_example.c @@ -27,14 +27,16 @@ #include "FreeRTOS.h" #include "task.h" +#include "queue.h" #include "fassert.h" -#include "finterrupt.h" -#include "fcpu_info.h" #include "fdebug.h" +#include "fkernel.h" #include "usbh_core.h" #include "usbh_hid.h" + +#include "xhci_host_example.h" /************************** Constant Definitions *****************************/ #define HID_KEYCODE_TO_ASCII \ {0 , 0 }, /* 0x00 */ \ @@ -141,17 +143,25 @@ {'0' , 0 }, /* 0x63 */ \ {'=' , '=' }, /* 0x67 */ \ +enum +{ + XHCI_USB_KEYBOARD_SUCCESS = 0, + XHCI_USB_KEYBOARD_FAIL = 1, +}; + +#define XHCI_INPUT_WAIT_TIME (pdMS_TO_TICKS(20000UL)) +#define TIMER_OUT (XHCI_INPUT_WAIT_TIME + (pdMS_TO_TICKS(10000UL))) /**************************** Type Definitions *******************************/ /************************** Variable Definitions *****************************/ static u8 const keycode2ascii[128][2] = { HID_KEYCODE_TO_ASCII }; static struct usbh_urb kbd_intin_urb; -static struct usbh_urb mouse_intin_urb; static uint8_t kbd_buffer[128] __attribute__((aligned(sizeof(unsigned long)))) = {0}; -static uint8_t mouse_buffer[128] __attribute__((aligned(sizeof(unsigned long)))) = {0}; - +static struct usb_osal_timer *kbd_timer = NULL; +static uintptr_t usb_id = 0; +static QueueHandle_t xQueue = NULL; /***************** Macros (Inline Functions) Definitions *********************/ -#define FUSB_DEBUG_TAG "USB-INPUT" +#define FUSB_DEBUG_TAG "USB-KEYBOARD" #define FUSB_ERROR(format, ...) FT_DEBUG_PRINT_E(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) #define FUSB_WARN(format, ...) FT_DEBUG_PRINT_W(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) #define FUSB_INFO(format, ...) FT_DEBUG_PRINT_I(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) @@ -161,43 +171,6 @@ static uint8_t mouse_buffer[128] __attribute__((aligned(sizeof(unsigned long)))) /*****************************************************************************/ -static inline void UsbMouseLeftButtonCB(void) -{ - printf("<-\r\n"); -} - -static inline void UsbMouseRightButtonCB(void) -{ - printf("->\r\n"); -} - -static inline void UsbMouseMiddleButtonCB(void) -{ - printf("C\r\n"); -} - -static void UsbMouseHandleInput(struct usb_hid_mouse_report *input) -{ - /*------------- button state -------------*/ - if (input->buttons & HID_MOUSE_INPUT_BUTTON_LEFT) - { - UsbMouseLeftButtonCB(); - } - - if (input->buttons & HID_MOUSE_INPUT_BUTTON_MIDDLE) - { - UsbMouseMiddleButtonCB(); - } - - if (input->buttons & HID_MOUSE_INPUT_BUTTON_RIGHT) - { - UsbMouseRightButtonCB(); - } - - /*------------- cursor movement -------------*/ - printf("[x:%d y:%d w:%d]\r\n", input->xdisp, input->ydisp, input->wdisp); -} - /* look up new key in previous keys */ static inline boolean FindKeyInPrevInput(const struct usb_hid_kbd_report *report, u8 keycode) { @@ -244,153 +217,122 @@ static void UsbKeyBoardHandleInput(struct usb_hid_kbd_report *input) prev_input = *input; } -static u8 UsbInputGetInterfaceProtocol(struct usbh_hid *hid_class) -{ - struct usbh_hubport *hport = hid_class->hport; - u8 intf = hid_class->intf; - const struct usb_interface_descriptor *intf_desc = &hport->config.intf->altsetting[intf].intf_desc; - - return intf_desc->bInterfaceProtocol; -} - static void UsbKeyboardCallback(void *arg, int nbytes) { - u8 intf_protocol; - struct usbh_hid *kbd_class = (struct usbh_hid *)arg; - intf_protocol = UsbInputGetInterfaceProtocol(kbd_class); + struct usbh_hid *hid_class = (struct usbh_hid *)arg; - if (HID_PROTOCOL_KEYBOARD == intf_protocol) /* handle input from keyboard */ + if (nbytes > 0) { - if (nbytes < (int)sizeof(struct usb_hid_kbd_report)) - { - FUSB_ERROR("nbytes = %d", nbytes); - } - else - { - UsbKeyBoardHandleInput((struct usb_hid_kbd_report *)kbd_buffer); - } + UsbKeyBoardHandleInput((struct usb_hid_kbd_report *)kbd_buffer); } - else + + if (kbd_timer) { - FUSB_ERROR("mismatch callback for protocol-%d", intf_protocol); - return; + usb_osal_timer_start(kbd_timer); } - - usbh_submit_urb(&kbd_intin_urb); /* ask for next inputs */ } -static void UsbMouseCallback(void *arg, int nbytes) +static void UsbKeyboardTimeout(void *arg) { - u8 intf_protocol; - struct usbh_hid *mouse_class = (struct usbh_hid *)arg; - intf_protocol = UsbInputGetInterfaceProtocol(mouse_class); + struct usbh_hid *hid = (struct usbh_hid *)arg; - if (HID_PROTOCOL_MOUSE == intf_protocol) /* handle input from mouse */ - { - if (nbytes < (int)sizeof(struct usb_hid_mouse_report)) - { - FUSB_ERROR("nbytes = %d", nbytes); - } - else - { - UsbMouseHandleInput((struct usb_hid_mouse_report *)mouse_buffer); - } - } - else - { - FUSB_ERROR("mismatch callback for protocol-%d", intf_protocol); - return; - } - - usbh_submit_urb(&mouse_intin_urb); /* ask for next inputs */ + usbh_int_urb_fill(&hid->intin_urb, hid->hport, hid->intin, kbd_buffer, hid->intin->wMaxPacketSize, 0, UsbKeyboardCallback, hid); + usbh_submit_urb(&hid->intin_urb); } -static void UsbKeyboardTask(void *args) +static void XhciUsbKeyboardTask(void *args) { int ret; + u8 id = (u8)usb_id; struct usbh_hid *kbd_class; - u8 intf_protocol; - const char *dev_name = (const char *)args; - - kbd_class = (struct usbh_hid *)usbh_find_class_instance(dev_name); + const char *devname = (const char *)args; + + kbd_class = (struct usbh_hid *)usbh_find_class_instance(devname); if (kbd_class == NULL) { - FUSB_ERROR("Do not find %s.", dev_name); - goto err_exit; + FUSB_ERROR("Do not find %s.", devname); + goto task_exit; } - while (TRUE) + kbd_timer = usb_osal_timer_create("keyboard_timer", + USBH_GET_URB_INTERVAL(kbd_class->intin->bInterval, kbd_class->hport->speed), + UsbKeyboardTimeout, + kbd_class, + false); + if (kbd_timer != NULL) { - usbh_int_urb_fill(&kbd_intin_urb, kbd_class->intin, kbd_buffer, 8, 0, UsbKeyboardCallback, kbd_class); - ret = usbh_submit_urb(&kbd_intin_urb); - - vTaskDelay(1); - } - -err_exit: - vTaskDelete(NULL); + usb_osal_timer_start(kbd_timer); + } + + /* check hid device information */ + printf("HID (/dev/input%d) info:\r\n", (char)kbd_class->minor); + printf(" USB: 0x%04x\r\n", kbd_class->hport->device_desc.bcdUSB); + printf(" Class: 0x%02x\r\n", kbd_class->hport->device_desc.bDeviceClass); + printf(" Subclass: 0x%02x\r\n", kbd_class->hport->device_desc.bDeviceSubClass); + printf(" Protocol: 0x%02x\r\n", kbd_class->hport->device_desc.bDeviceProtocol); + printf(" Intr in: %d(mps) %d(interval)\r\n", kbd_class->intin->wMaxPacketSize, + kbd_class->intin->bInterval); + printf(" Intr out: %d(mps) %d(interval)\r\n", kbd_class->intout->wMaxPacketSize, + kbd_class->intout->bInterval); + + printf("Now you can type in some characters from keyboard \r\n"); + + vTaskDelay(XHCI_INPUT_WAIT_TIME); /* wait user input for a while */ + + printf("Input finished, exit...\r\n"); + +task_exit: + ret = (ret == 0) ? XHCI_USB_KEYBOARD_SUCCESS : XHCI_USB_KEYBOARD_FAIL; + xQueueSend(xQueue, &ret, 0); + vTaskDelete(NULL); } -static void UsbMouseTask(void *args) +BaseType_t FFreeRTOSRunXhciKeyboard(u32 id, const char *devname) { - int ret; - struct usbh_hid *mouse_class; - u8 intf_protocol; - const char *dev_name = (const char *)args; - - mouse_class = (struct usbh_hid *)usbh_find_class_instance(dev_name); - if (mouse_class == NULL) - { - FUSB_ERROR("Do not find %s.", dev_name); - goto err_exit; - } - - while (TRUE) + BaseType_t ret = pdPASS; + int task_res = XHCI_USB_KEYBOARD_SUCCESS; + xQueue = xQueueCreate(1, sizeof(int)); + if (xQueue == NULL) { - usbh_int_urb_fill(&mouse_intin_urb, mouse_class->intin, mouse_buffer, 8, 0, UsbMouseCallback, mouse_class); - ret = usbh_submit_urb(&mouse_intin_urb); - - vTaskDelay(1); + FUSB_ERROR("xQueue create failed.\r\n"); + goto exit; } -err_exit: - vTaskDelete(NULL); -} - -BaseType_t FFreeRTOSRunUsbKeyboard(const char *devname) -{ - BaseType_t ret = pdPASS; + usb_id = id; - taskENTER_CRITICAL(); /* no schedule when create task */ - - ret = xTaskCreate((TaskFunction_t)UsbKeyboardTask, - (const char *)"UsbKeyboardTask", - (uint16_t)2048, + ret = xTaskCreate((TaskFunction_t)XhciUsbKeyboardTask, + (const char *)"XhciUsbKeyboardTask", + (uint16_t)4096, (void *)devname, (UBaseType_t)configMAX_PRIORITIES - 1, NULL); - FASSERT_MSG(pdPASS == ret, "create task failed"); - - taskEXIT_CRITICAL(); /* allow schedule since task created */ - - return ret; -} - -BaseType_t FFreeRTOSRunUsbMouse(const char *devname) -{ - BaseType_t ret = pdPASS; - - taskENTER_CRITICAL(); /* no schedule when create task */ + if (ret != pdPASS) + { + FUSB_ERROR("xTaskCreate create failed.\r\n"); + goto exit; + } - ret = xTaskCreate((TaskFunction_t)UsbMouseTask, - (const char *)"UsbMouseTask", - (uint16_t)2048, - (void *)devname, - (UBaseType_t)configMAX_PRIORITIES - 1, - NULL); - FASSERT_MSG(pdPASS == ret, "create task failed"); + ret = xQueueReceive(xQueue, &task_res, TIMER_OUT); + if (ret != pdPASS) + { + FUSB_ERROR("xQueue receive timeout.\r\n"); + goto exit; + } - taskEXIT_CRITICAL(); /* allow schedule since task created */ +exit: + if (xQueue) + { + vQueueDelete(xQueue); + } - return ret; + if (task_res != XHCI_USB_KEYBOARD_SUCCESS) + { + printf("%s@%d: XHCI usb keyboard example [failure], task_res = %d\r\n", __func__, __LINE__, task_res); + return pdFAIL; + } + else + { + printf("%s@%d: XHCI usb keyboard example [success].\r\n", __func__, __LINE__); + return pdTRUE; + } } \ No newline at end of file diff --git a/example/peripheral/usb/xhci_platform/src/xhci_usb_mouse_input_example.c b/example/peripheral/usb/xhci_platform/src/xhci_usb_mouse_input_example.c new file mode 100644 index 0000000000000000000000000000000000000000..5ab5d4bfed812474b4c412cd598a5b83ca407497 --- /dev/null +++ b/example/peripheral/usb/xhci_platform/src/xhci_usb_mouse_input_example.c @@ -0,0 +1,238 @@ +/* + * Copyright : (C) 2022 Phytium Information Technology, Inc. + * All Rights Reserved. + * + * This program is OPEN SOURCE software: you can redistribute it and/or modify it + * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, + * either version 1.0 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Phytium Public License for more details. + * + * + * FilePath: usb_input.c + * Date: 2022-07-22 13:57:42 + * LastEditTime: 2022-07-22 13:57:43 + * Description:  This file is for the usb input functions. + * + * Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + * 1.0 zhugengyu 2022/9/20 init commit + */ +/***************************** Include Files *********************************/ +#include +#include + +#include "FreeRTOS.h" +#include "task.h" +#include "queue.h" + +#include "fassert.h" +#include "fdebug.h" +#include "fkernel.h" + +#include "usbh_core.h" +#include "usbh_hid.h" + +#include "xhci_host_example.h" +/************************** Constant Definitions *****************************/ +enum +{ + XHCI_USB_MOUSE_SUCCESS = 0, + XHCI_USB_MOUSE_FAIL = 1, +}; + +#define XHCI_INPUT_WAIT_TIME (pdMS_TO_TICKS(20000UL)) +#define TIMER_OUT (XHCI_INPUT_WAIT_TIME + (pdMS_TO_TICKS(10000UL))) +/**************************** Type Definitions *******************************/ + +/************************** Variable Definitions *****************************/ +static struct usbh_urb mouse_intin_urb; +static uint8_t mouse_buffer[128] __attribute__((aligned(sizeof(unsigned long)))) = {0}; +static struct usb_osal_timer *mouse_timer = NULL; +static uintptr_t usb_id = 0; +static QueueHandle_t xQueue = NULL; +/***************** Macros (Inline Functions) Definitions *********************/ +#define FUSB_DEBUG_TAG "USB-MOUSE" +#define FUSB_ERROR(format, ...) FT_DEBUG_PRINT_E(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_WARN(format, ...) FT_DEBUG_PRINT_W(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_INFO(format, ...) FT_DEBUG_PRINT_I(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) +#define FUSB_DEBUG(format, ...) FT_DEBUG_PRINT_D(FUSB_DEBUG_TAG, format, ##__VA_ARGS__) + +/************************** Function Prototypes ******************************/ + + +/*****************************************************************************/ +static inline void UsbMouseLeftButtonCB(void) +{ + printf("<-\r\n"); +} + +static inline void UsbMouseRightButtonCB(void) +{ + printf("->\r\n"); +} + +static inline void UsbMouseMiddleButtonCB(void) +{ + printf("C\r\n"); +} + +static void UsbMouseHandleInput(struct usb_hid_mouse_report *input) +{ + /*------------- button state -------------*/ + if (input->buttons & HID_MOUSE_INPUT_BUTTON_LEFT) + { + UsbMouseLeftButtonCB(); + } + + if (input->buttons & HID_MOUSE_INPUT_BUTTON_MIDDLE) + { + UsbMouseMiddleButtonCB(); + } + + if (input->buttons & HID_MOUSE_INPUT_BUTTON_RIGHT) + { + UsbMouseRightButtonCB(); + } + + /*------------- cursor movement -------------*/ + printf("[x:%d y:%d w:%d]\r\n", input->xdisp, input->ydisp, input->wdisp); +} + +static void UsbMouseCallback(void *arg, int nbytes) +{ + struct usbh_hid *hid_class = (struct usbh_hid *)arg; + + if (nbytes > 0) + { + UsbMouseHandleInput((struct usb_hid_mouse_report *)mouse_buffer); + } + + if (mouse_timer) + { + usb_osal_timer_start(mouse_timer); + } +} + +static void UsbMouseTimeout(void *arg) +{ + struct usbh_hid *hid = (struct usbh_hid *)arg; + + usbh_int_urb_fill(&hid->intin_urb, hid->hport, hid->intin, mouse_buffer, hid->intin->wMaxPacketSize, 0, UsbMouseCallback, hid); + usbh_submit_urb(&hid->intin_urb); +} + +static void XhciUsbMouseTask(void *args) +{ + int ret; + u8 id = (u8)usb_id; + struct usbh_hid *mouse_class; + const char *devname = (const char *)args; + + mouse_class = (struct usbh_hid *)usbh_find_class_instance(devname); + if (mouse_class == NULL) + { + FUSB_ERROR("Do not find %s.", devname); + goto task_exit; + } + + mouse_timer = usb_osal_timer_create("mouse_timer", + USBH_GET_URB_INTERVAL(mouse_class->intin->bInterval, mouse_class->hport->speed), + UsbMouseTimeout, + mouse_class, + false); + if (mouse_timer != NULL) + { + usb_osal_timer_start(mouse_timer); + } + + /* check hid device information */ + printf("HID (/dev/input%d) info:\r\n", (char)mouse_class->minor); + printf(" USB: 0x%04x\r\n", mouse_class->hport->device_desc.bcdUSB); + printf(" Class: 0x%02x\r\n", mouse_class->hport->device_desc.bDeviceClass); + printf(" Subclass: 0x%02x\r\n", mouse_class->hport->device_desc.bDeviceSubClass); + printf(" Protocol: 0x%02x\r\n", mouse_class->hport->device_desc.bDeviceProtocol); + printf(" Intr in: %d(mps) %d(interval)\r\n", mouse_class->intin->wMaxPacketSize, + mouse_class->intin->bInterval); + printf(" Intr out: %d(mps) %d(interval)\r\n", mouse_class->intout->wMaxPacketSize, + mouse_class->intout->bInterval); + + printf("Now you can move and click connected mouse \r\n"); + + vTaskDelay(XHCI_INPUT_WAIT_TIME); /* wait user input for a while */ + + printf("Input finished, exit...\r\n"); + +task_exit: + ret = (ret == 0) ? XHCI_USB_MOUSE_SUCCESS : XHCI_USB_MOUSE_FAIL; + xQueueSend(xQueue, &ret, 0); + vTaskDelete(NULL); +} + +void usbh_hid_run(struct usbh_hid *hid_class) +{ + struct usbh_hubport *hport = hid_class->hport; + uint8_t intf = hid_class->intf; + + if (HID_PROTOCOL_KEYBOARD == hport->config.intf[intf].altsetting[0].intf_desc.bInterfaceProtocol) + { + printf("**/dev/input%d is keyboard \r\n", hid_class->minor); + } + else if (HID_PROTOCOL_MOUSE == hport->config.intf[intf].altsetting[0].intf_desc.bInterfaceProtocol) + { + printf("**/dev/input%d is mouse \r\n", hid_class->minor); + } +} + +BaseType_t FFreeRTOSRunXhciMouse(u32 id, const char *devname) +{ + BaseType_t ret = pdPASS; + int task_res = XHCI_USB_MOUSE_SUCCESS; + xQueue = xQueueCreate(1, sizeof(int)); + if (xQueue == NULL) + { + FUSB_ERROR("xQueue create failed.\r\n"); + goto exit; + } + + usb_id = id; + + ret = xTaskCreate((TaskFunction_t)XhciUsbMouseTask, + (const char *)"XhciUsbMouseTask", + (uint16_t)4096, + (void *)devname, + (UBaseType_t)configMAX_PRIORITIES - 1, + NULL); + if (ret != pdPASS) + { + FUSB_ERROR("xTaskCreate create failed.\r\n"); + goto exit; + } + + ret = xQueueReceive(xQueue, &task_res, TIMER_OUT); + if (ret != pdPASS) + { + FUSB_ERROR("xQueue receive timeout.\r\n"); + goto exit; + } + +exit: + if (xQueue) + { + vQueueDelete(xQueue); + } + + if (task_res != XHCI_USB_MOUSE_SUCCESS) + { + printf("%s@%d: XHCI usb mouse example [failure], task_res = %d\r\n", __func__, __LINE__, task_res); + return pdFAIL; + } + else + { + printf("%s@%d: XHCI usb mouse example [success].\r\n", __func__, __LINE__); + return pdTRUE; + } +} \ No newline at end of file diff --git a/example/peripheral/wdt/configs/d2000_aarch32_test_wdt.config b/example/peripheral/wdt/configs/d2000_aarch32_test_wdt.config index 126b335403cdefe0d92e2678ae04ad0b659819d0..7122b7d8839a59de4edddd3b456d47edeed1c80d 100644 --- a/example/peripheral/wdt/configs/d2000_aarch32_test_wdt.config +++ b/example/peripheral/wdt/configs/d2000_aarch32_test_wdt.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_USE_FWDT=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/wdt/configs/d2000_aarch64_test_wdt.config b/example/peripheral/wdt/configs/d2000_aarch64_test_wdt.config index 2038746990bf4c1c3cce69bc1a122209c140c029..18be75e1fc41853d87a6637b4764670ddfda542f 100644 --- a/example/peripheral/wdt/configs/d2000_aarch64_test_wdt.config +++ b/example/peripheral/wdt/configs/d2000_aarch64_test_wdt.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -137,7 +131,6 @@ CONFIG_USE_FWDT=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/wdt/configs/e2000d_aarch32_demo_wdt.config b/example/peripheral/wdt/configs/e2000d_aarch32_demo_wdt.config index c3b16024b16f2b6ea5541e548ef8e5765d8f7c87..dda19905ed988f2095d68eb06806205d587bcb88 100644 --- a/example/peripheral/wdt/configs/e2000d_aarch32_demo_wdt.config +++ b/example/peripheral/wdt/configs/e2000d_aarch32_demo_wdt.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -156,7 +150,6 @@ CONFIG_USE_FWDT=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/wdt/configs/e2000d_aarch64_demo_wdt.config b/example/peripheral/wdt/configs/e2000d_aarch64_demo_wdt.config index 2f2579de5e49c673cce2696f092a1f77a665a961..4da8e3927bbeb0494a9eff560ccc85983be7cf45 100644 --- a/example/peripheral/wdt/configs/e2000d_aarch64_demo_wdt.config +++ b/example/peripheral/wdt/configs/e2000d_aarch64_demo_wdt.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -150,7 +144,6 @@ CONFIG_USE_FWDT=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/wdt/configs/e2000q_aarch32_demo_wdt.config b/example/peripheral/wdt/configs/e2000q_aarch32_demo_wdt.config index ee9eb259a1235765eb889bedf2be45576be46d7a..8d657e2af795fa72d2d42079a2e0b2f398e32109 100644 --- a/example/peripheral/wdt/configs/e2000q_aarch32_demo_wdt.config +++ b/example/peripheral/wdt/configs/e2000q_aarch32_demo_wdt.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -155,7 +149,6 @@ CONFIG_USE_FWDT=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/wdt/configs/e2000q_aarch64_demo_wdt.config b/example/peripheral/wdt/configs/e2000q_aarch64_demo_wdt.config index 0a534f2ea85e614058be86ec72bcde2ec8a3ede2..833feaef42b485e58ecc3250eabdaf5f93a059f9 100644 --- a/example/peripheral/wdt/configs/e2000q_aarch64_demo_wdt.config +++ b/example/peripheral/wdt/configs/e2000q_aarch64_demo_wdt.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_USE_FWDT=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/wdt/configs/ft2004_aarch32_dsk_wdt.config b/example/peripheral/wdt/configs/ft2004_aarch32_dsk_wdt.config index 28e3e74921e768bef8056356c2337b642bcb4e7b..89a3d8c1755df7e6f4edfc3fd0ebb9ad8532a026 100644 --- a/example/peripheral/wdt/configs/ft2004_aarch32_dsk_wdt.config +++ b/example/peripheral/wdt/configs/ft2004_aarch32_dsk_wdt.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_USE_FWDT=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/wdt/configs/ft2004_aarch64_dsk_wdt.config b/example/peripheral/wdt/configs/ft2004_aarch64_dsk_wdt.config index 7fabfd7cc66cfa60d7c8689b076e88003fc87c1d..d02eaf72d94ce8d47cb32d287d97a2ba931381fe 100644 --- a/example/peripheral/wdt/configs/ft2004_aarch64_dsk_wdt.config +++ b/example/peripheral/wdt/configs/ft2004_aarch64_dsk_wdt.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -137,7 +131,6 @@ CONFIG_USE_FWDT=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/wdt/configs/phytiumpi_aarch32_firefly_wdt.config b/example/peripheral/wdt/configs/phytiumpi_aarch32_firefly_wdt.config index 43ce0206feee3a368712d753f994ae6cc5846e88..78b319f60ef8d87c1d916cb8bace6e0b60f145d5 100644 --- a/example/peripheral/wdt/configs/phytiumpi_aarch32_firefly_wdt.config +++ b/example/peripheral/wdt/configs/phytiumpi_aarch32_firefly_wdt.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -154,7 +148,6 @@ CONFIG_USE_FWDT=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/wdt/configs/phytiumpi_aarch64_firefly_wdt.config b/example/peripheral/wdt/configs/phytiumpi_aarch64_firefly_wdt.config index 0ddee7e76887e9c06a22cc4814279ad0f4d4ba04..d5682f4d75b5f35aad7285b1d4e673eba4b9bd9f 100644 --- a/example/peripheral/wdt/configs/phytiumpi_aarch64_firefly_wdt.config +++ b/example/peripheral/wdt/configs/phytiumpi_aarch64_firefly_wdt.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_USE_FWDT=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/wdt/main.c b/example/peripheral/wdt/main.c index 181cf17b120fe33c3678cabf9498ba97ada84a50..2965fb33131a0a7562c1e816fa480f8e53a2118a 100644 --- a/example/peripheral/wdt/main.c +++ b/example/peripheral/wdt/main.c @@ -56,7 +56,7 @@ int main(void) /* used in no-letter-shell mode */ ret = xTaskCreate((TaskFunction_t)WdtExampleTaskEntry, /* 任务入口函数 */ (const char *)"WdtExampleTaskEntry", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)WDT_EXAMPLE_TASK_PRIORITY, /* 任务优先级 */ NULL); diff --git a/example/peripheral/wdt/sdkconfig b/example/peripheral/wdt/sdkconfig index 0ddee7e76887e9c06a22cc4814279ad0f4d4ba04..d5682f4d75b5f35aad7285b1d4e673eba4b9bd9f 100644 --- a/example/peripheral/wdt/sdkconfig +++ b/example/peripheral/wdt/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_USE_FWDT=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/peripheral/wdt/sdkconfig.h b/example/peripheral/wdt/sdkconfig.h index c40539b861a379456e1c992925c2e88736d77ac6..63e89b5d86379b91b128cdb6cef2ead0853324ac 100644 --- a/example/peripheral/wdt/sdkconfig.h +++ b/example/peripheral/wdt/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -134,7 +129,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/peripheral/wdt/src/wdt_example.c b/example/peripheral/wdt/src/wdt_example.c index 167d1bb226416194b5a0cdfcf7f7487cc5fbf2ff..0b7f5d6a60d74cf413549b6eb908bf13a16a3943 100644 --- a/example/peripheral/wdt/src/wdt_example.c +++ b/example/peripheral/wdt/src/wdt_example.c @@ -212,7 +212,7 @@ int FFreeRTOSWdtCreate(void) xReturn = xTaskCreate((TaskFunction_t)WdtExampleTask, /* 任务入口函数 */ (const char *)"WdtExampleTask", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)WDT_FEED_TASK_PRIORITY, /* 任务优先级 */ NULL); /* 任务句柄 */ diff --git a/example/storage/fatfs/configs/e2000d_aarch32_demo_fatfs.config b/example/storage/fatfs/configs/e2000d_aarch32_demo_fatfs.config index d37d225ade08f2ee5a1ba2b89f3af778f422d3e2..81e5fc2a586262a0aa5d6a47eb8b0211688aca80 100644 --- a/example/storage/fatfs/configs/e2000d_aarch32_demo_fatfs.config +++ b/example/storage/fatfs/configs/e2000d_aarch32_demo_fatfs.config @@ -123,12 +123,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -160,7 +154,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -392,16 +385,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y # CONFIG_CHERRY_USB_HOST_HID is not set -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration CONFIG_USE_FSL_SDMMC=y diff --git a/example/storage/fatfs/configs/e2000d_aarch64_demo_fatfs.config b/example/storage/fatfs/configs/e2000d_aarch64_demo_fatfs.config index 5e1d6b3948cb67dde906e233edd0619bd0d517f9..2c9bea66b059c4d1085abcc0cbfa37a40542eb13 100644 --- a/example/storage/fatfs/configs/e2000d_aarch64_demo_fatfs.config +++ b/example/storage/fatfs/configs/e2000d_aarch64_demo_fatfs.config @@ -117,12 +117,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -154,7 +148,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -381,16 +374,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y # CONFIG_CHERRY_USB_HOST_HID is not set -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration CONFIG_USE_FSL_SDMMC=y diff --git a/example/storage/fatfs/configs/e2000q_aarch32_demo_fatfs.config b/example/storage/fatfs/configs/e2000q_aarch32_demo_fatfs.config index 2ee6b6ee9126715d24887b350c953a5f737443da..5f105952457f96e0f34210c9dedf102dfb16fb33 100644 --- a/example/storage/fatfs/configs/e2000q_aarch32_demo_fatfs.config +++ b/example/storage/fatfs/configs/e2000q_aarch32_demo_fatfs.config @@ -122,12 +122,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -159,7 +153,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -391,16 +384,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y # CONFIG_CHERRY_USB_HOST_HID is not set -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration CONFIG_USE_FSL_SDMMC=y diff --git a/example/storage/fatfs/configs/e2000q_aarch64_demo_fatfs.config b/example/storage/fatfs/configs/e2000q_aarch64_demo_fatfs.config index 21120fa194e8759d9461db39e65f79f73a97f67f..5eed3665f29fc7f69a1ebf007077e8b8c8cfd8e7 100644 --- a/example/storage/fatfs/configs/e2000q_aarch64_demo_fatfs.config +++ b/example/storage/fatfs/configs/e2000q_aarch64_demo_fatfs.config @@ -116,12 +116,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -153,7 +147,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set @@ -380,16 +373,14 @@ CONFIG_USE_CHERRY_USB=y # # CherryUSB Configuration # +CONFIG_CHERRY_USB_PORT_XHCI_PLATFROM=y +# CONFIG_CHERRY_USB_PORT_XHCI_PCIE is not set +# CONFIG_CHERRY_USB_PORT_PUSB2 is not set CONFIG_CHERRY_USB_PORT_XHCI=y -# CONFIG_CHERRY_USB_PORT_PHYTIUM_OTG is not set CONFIG_CHERRYUSB_HOST=y -# CONFIG_CHERRYUSB_DEVICE is not set CONFIG_CHERRY_USB_HOST_HUB=y CONFIG_CHERRY_USB_HOST_MSC=y # CONFIG_CHERRY_USB_HOST_HID is not set -# CONFIG_CHERRY_USB_HOST_VEDIO is not set -# CONFIG_CHERRY_USB_HOST_CDC is not set -# CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS is not set # end of CherryUSB Configuration CONFIG_USE_FSL_SDMMC=y diff --git a/example/storage/fatfs/configs/phytiumpi_aarch32_firefly_fatfs.config b/example/storage/fatfs/configs/phytiumpi_aarch32_firefly_fatfs.config index 1eb970a5071dae58cbdd9ac771dd5e9a4daff2d3..2933f9b377c67b84ccb658c11586fa580192288f 100644 --- a/example/storage/fatfs/configs/phytiumpi_aarch32_firefly_fatfs.config +++ b/example/storage/fatfs/configs/phytiumpi_aarch32_firefly_fatfs.config @@ -121,12 +121,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -158,7 +152,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/fatfs/configs/phytiumpi_aarch64_firefly_fatfs.config b/example/storage/fatfs/configs/phytiumpi_aarch64_firefly_fatfs.config index 519217c34ddcf237900182d4d987a49f24432415..e3c9e75b73aa3f82e33a0c99e7d2c3b821505634 100644 --- a/example/storage/fatfs/configs/phytiumpi_aarch64_firefly_fatfs.config +++ b/example/storage/fatfs/configs/phytiumpi_aarch64_firefly_fatfs.config @@ -115,12 +115,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -152,7 +146,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/fatfs/main.c b/example/storage/fatfs/main.c index 8989ea3bf25ac1b7758541f8c5d9354c4226414a..24924d01cf3114aa8e80f764527c8c179a5c1d28 100755 --- a/example/storage/fatfs/main.c +++ b/example/storage/fatfs/main.c @@ -55,7 +55,7 @@ int main(void) #else ret = xTaskCreate((TaskFunction_t)FatfsExampleEntry, (const char *)"FatfsExampleEntry", - (uint16_t)4096, + 4096, NULL, (UBaseType_t)2, NULL); diff --git a/example/storage/fatfs/sdkconfig b/example/storage/fatfs/sdkconfig index 519217c34ddcf237900182d4d987a49f24432415..e3c9e75b73aa3f82e33a0c99e7d2c3b821505634 100644 --- a/example/storage/fatfs/sdkconfig +++ b/example/storage/fatfs/sdkconfig @@ -115,12 +115,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -152,7 +146,6 @@ CONFIG_ENABLE_FSDIF=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/fatfs/sdkconfig.h b/example/storage/fatfs/sdkconfig.h index a386ad4a995e0adb5e6efdbedeeb7e3a4cdccaee..1c6a14c88f3d736ca85ff3b3b4cb159ceaa18799 100644 --- a/example/storage/fatfs/sdkconfig.h +++ b/example/storage/fatfs/sdkconfig.h @@ -104,11 +104,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -137,7 +132,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/storage/fatfs/src/fatfs_examples.c b/example/storage/fatfs/src/fatfs_examples.c index 4f758406302ea53f5ba77964444301bf2d230d37..1dd0beb907decf195102d02cfb21d6a86cf2fddc 100755 --- a/example/storage/fatfs/src/fatfs_examples.c +++ b/example/storage/fatfs/src/fatfs_examples.c @@ -336,7 +336,7 @@ BaseType_t FFreeRTOSFatfsTest(void) ret = xTaskCreate((TaskFunction_t)FatfsRunTask, (const char *)"FatfsRunTask", - (uint16_t)2048, + 2048, NULL, (UBaseType_t)configMAX_PRIORITIES - 1, NULL); diff --git a/example/storage/qspi_spiffs/configs/d2000_aarch32_test_qspi_spiffs.config b/example/storage/qspi_spiffs/configs/d2000_aarch32_test_qspi_spiffs.config index c23b7baf8a3132197aabb88c3dbd7c949af65777..4da5f8767ccec4f981d5bb67e152966ac0228a5a 100644 --- a/example/storage/qspi_spiffs/configs/d2000_aarch32_test_qspi_spiffs.config +++ b/example/storage/qspi_spiffs/configs/d2000_aarch32_test_qspi_spiffs.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/qspi_spiffs/configs/d2000_aarch64_test_qspi_spiffs.config b/example/storage/qspi_spiffs/configs/d2000_aarch64_test_qspi_spiffs.config index da9ef9c48dff7f276a90f8dd552cad67629115d4..41ec7b2572d6a1f5d45e75fde4e6a3753803702a 100644 --- a/example/storage/qspi_spiffs/configs/d2000_aarch64_test_qspi_spiffs.config +++ b/example/storage/qspi_spiffs/configs/d2000_aarch64_test_qspi_spiffs.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -137,7 +131,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/qspi_spiffs/configs/e2000d_aarch32_demo_qspi_spiffs.config b/example/storage/qspi_spiffs/configs/e2000d_aarch32_demo_qspi_spiffs.config index 7236e37c1825129a3ccfe690c2d57be340d77e99..3aa97215204efffb00a9990bf0238e0866bb0aa8 100644 --- a/example/storage/qspi_spiffs/configs/e2000d_aarch32_demo_qspi_spiffs.config +++ b/example/storage/qspi_spiffs/configs/e2000d_aarch32_demo_qspi_spiffs.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -156,7 +150,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/qspi_spiffs/configs/e2000d_aarch64_demo_qspi_spiffs.config b/example/storage/qspi_spiffs/configs/e2000d_aarch64_demo_qspi_spiffs.config index 09ef1a8cca918b836bbfef7088776d9926d17997..fda5d31c9ce7f950ae719ccfd8db682821fe80fd 100644 --- a/example/storage/qspi_spiffs/configs/e2000d_aarch64_demo_qspi_spiffs.config +++ b/example/storage/qspi_spiffs/configs/e2000d_aarch64_demo_qspi_spiffs.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -150,7 +144,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/qspi_spiffs/configs/e2000q_aarch32_demo_qspi_spiffs.config b/example/storage/qspi_spiffs/configs/e2000q_aarch32_demo_qspi_spiffs.config index 22897b49ba0f1bac658d818cacfaf0ef03a0637d..9ead099f4c9bffc588b00116ec39513e32f73743 100644 --- a/example/storage/qspi_spiffs/configs/e2000q_aarch32_demo_qspi_spiffs.config +++ b/example/storage/qspi_spiffs/configs/e2000q_aarch32_demo_qspi_spiffs.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -155,7 +149,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/qspi_spiffs/configs/e2000q_aarch64_demo_qspi_spiffs.config b/example/storage/qspi_spiffs/configs/e2000q_aarch64_demo_qspi_spiffs.config index a79d6a1f43b1606501321019164dcbd540aefcb4..5df333ea07a46dc8bc72b5ed7a88b371ce4f5f2b 100644 --- a/example/storage/qspi_spiffs/configs/e2000q_aarch64_demo_qspi_spiffs.config +++ b/example/storage/qspi_spiffs/configs/e2000q_aarch64_demo_qspi_spiffs.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/qspi_spiffs/configs/ft2004_aarch32_dsk_qspi_spiffs.config b/example/storage/qspi_spiffs/configs/ft2004_aarch32_dsk_qspi_spiffs.config index ab1ab7426820d052f9f8705ad1cb3045df75a39f..ead46055ad4cb8eff5b122a3a78e677d3ba526d4 100644 --- a/example/storage/qspi_spiffs/configs/ft2004_aarch32_dsk_qspi_spiffs.config +++ b/example/storage/qspi_spiffs/configs/ft2004_aarch32_dsk_qspi_spiffs.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/qspi_spiffs/configs/ft2004_aarch64_dsk_qspi_spiffs.config b/example/storage/qspi_spiffs/configs/ft2004_aarch64_dsk_qspi_spiffs.config index 5d354ebf236996b603aa5b63cda687e478f7f309..f4520b952a55cf5e12a7f6c52bfef18ad3e233d1 100644 --- a/example/storage/qspi_spiffs/configs/ft2004_aarch64_dsk_qspi_spiffs.config +++ b/example/storage/qspi_spiffs/configs/ft2004_aarch64_dsk_qspi_spiffs.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -137,7 +131,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/qspi_spiffs/configs/phytiumpi_aarch32_firefly_qspi_spiffs.config b/example/storage/qspi_spiffs/configs/phytiumpi_aarch32_firefly_qspi_spiffs.config index bea6060705a3fccb3eb487209819e872acd50b47..67abc49b6becc42d1f783e5b6347a2baaf92832b 100644 --- a/example/storage/qspi_spiffs/configs/phytiumpi_aarch32_firefly_qspi_spiffs.config +++ b/example/storage/qspi_spiffs/configs/phytiumpi_aarch32_firefly_qspi_spiffs.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -154,7 +148,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/qspi_spiffs/configs/phytiumpi_aarch64_firefly_qspi_spiffs.config b/example/storage/qspi_spiffs/configs/phytiumpi_aarch64_firefly_qspi_spiffs.config index 3fa64b592af7ad4efd0083d11476e6c3c6cacca8..74a59d0f1976359a64e640200404c9a0dff4eed8 100644 --- a/example/storage/qspi_spiffs/configs/phytiumpi_aarch64_firefly_qspi_spiffs.config +++ b/example/storage/qspi_spiffs/configs/phytiumpi_aarch64_firefly_qspi_spiffs.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/qspi_spiffs/main.c b/example/storage/qspi_spiffs/main.c index a5dde0f5a5a246f22103ce63e96c664b0a042483..17def46059fb4a40ce6e56a14756ef8c3568d542 100644 --- a/example/storage/qspi_spiffs/main.c +++ b/example/storage/qspi_spiffs/main.c @@ -56,7 +56,7 @@ int main(void) /* used in no-letter-shell mode */ ret = xTaskCreate((TaskFunction_t)QspiSpiffsExampleTaskEntry, /* 任务入口函数 */ (const char *)"QspiSpiffsExampleTaskEntry",/* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL,/* 任务入口函数参数 */ (UBaseType_t)QSPI_SPIFFS_EXAMPLE_TASK_PRIORITY, /* 任务的优先级 */ NULL); diff --git a/example/storage/qspi_spiffs/sdkconfig b/example/storage/qspi_spiffs/sdkconfig index 3fa64b592af7ad4efd0083d11476e6c3c6cacca8..74a59d0f1976359a64e640200404c9a0dff4eed8 100644 --- a/example/storage/qspi_spiffs/sdkconfig +++ b/example/storage/qspi_spiffs/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/qspi_spiffs/sdkconfig.h b/example/storage/qspi_spiffs/sdkconfig.h index b0a06635bbfe8ae67df651f694ed2ed004a80239..508af19407b044cd78067083d12341e2cb52a4f1 100644 --- a/example/storage/qspi_spiffs/sdkconfig.h +++ b/example/storage/qspi_spiffs/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -134,7 +129,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/storage/qspi_spiffs/src/qspi_spiffs_example.c b/example/storage/qspi_spiffs/src/qspi_spiffs_example.c index 4ae790d69b368cfa5e4205c5a1213381e5ea0e15..82de9dd9fce483eba1d45ab7553d4b2328ee13d0 100644 --- a/example/storage/qspi_spiffs/src/qspi_spiffs_example.c +++ b/example/storage/qspi_spiffs/src/qspi_spiffs_example.c @@ -497,7 +497,7 @@ int FFreeRTOSQspiSpiffsCreate(void) xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSQspiSpiffsWriteThenReadTask, /* 任务入口函数 */ (const char *)"FFreeRTOSQspiSpiffsWriteThenReadTask",/* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL,/* 任务入口函数参数 */ (UBaseType_t)QSPI_SPIFFS_WRITE_READ_TASK_PRIORITY, /* 任务的优先级 */ NULL); /* 任务控制 */ diff --git a/example/storage/spim_spiffs/configs/e2000d_aarch32_demo_spi_spiffs.config b/example/storage/spim_spiffs/configs/e2000d_aarch32_demo_spi_spiffs.config index 2dd24fbac7cd1a736c1dd8a35a790f9fb2a034c1..194dfe274e21afbe609c58804041d01bf4ec5304 100644 --- a/example/storage/spim_spiffs/configs/e2000d_aarch32_demo_spi_spiffs.config +++ b/example/storage/spim_spiffs/configs/e2000d_aarch32_demo_spi_spiffs.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -150,7 +144,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/spim_spiffs/configs/e2000d_aarch64_demo_spi_spiffs.config b/example/storage/spim_spiffs/configs/e2000d_aarch64_demo_spi_spiffs.config index 3769c0f6040e73afe953f7959798ad769441a53d..42ae0689620c27b3674ebd611830018c0270a56f 100644 --- a/example/storage/spim_spiffs/configs/e2000d_aarch64_demo_spi_spiffs.config +++ b/example/storage/spim_spiffs/configs/e2000d_aarch64_demo_spi_spiffs.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -144,7 +138,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/spim_spiffs/configs/e2000q_aarch32_demo_spi_spiffs.config b/example/storage/spim_spiffs/configs/e2000q_aarch32_demo_spi_spiffs.config index 31beea23e609401f1040203b9386712519c575b3..d34a196ffc75fc28fdba86ca6eb3fae7935a1b2f 100644 --- a/example/storage/spim_spiffs/configs/e2000q_aarch32_demo_spi_spiffs.config +++ b/example/storage/spim_spiffs/configs/e2000q_aarch32_demo_spi_spiffs.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/spim_spiffs/configs/e2000q_aarch64_demo_spi_spiffs.config b/example/storage/spim_spiffs/configs/e2000q_aarch64_demo_spi_spiffs.config index a351ac84d8a0f2d6754a6012fd8fd47bd619fa6c..96b2f1204fd7510c7acbe37cd4a72d48410c56cb 100644 --- a/example/storage/spim_spiffs/configs/e2000q_aarch64_demo_spi_spiffs.config +++ b/example/storage/spim_spiffs/configs/e2000q_aarch64_demo_spi_spiffs.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/spim_spiffs/configs/phytiumpi_aarch32_firefly_spi_spiffs.config b/example/storage/spim_spiffs/configs/phytiumpi_aarch32_firefly_spi_spiffs.config index b5fee412b3d4828b1bbccee5e579510fc22f2da8..214c1c4757dace4f6d03a8b89151da4f326191e2 100644 --- a/example/storage/spim_spiffs/configs/phytiumpi_aarch32_firefly_spi_spiffs.config +++ b/example/storage/spim_spiffs/configs/phytiumpi_aarch32_firefly_spi_spiffs.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/spim_spiffs/configs/phytiumpi_aarch64_firefly_spi_spiffs.config b/example/storage/spim_spiffs/configs/phytiumpi_aarch64_firefly_spi_spiffs.config index 8ff6f18bd8f9b46ba93457149bf885b5aca6f02c..1a65b1027e059e271e50fd1e623118bb3ceef8f3 100644 --- a/example/storage/spim_spiffs/configs/phytiumpi_aarch64_firefly_spi_spiffs.config +++ b/example/storage/spim_spiffs/configs/phytiumpi_aarch64_firefly_spi_spiffs.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/spim_spiffs/main.c b/example/storage/spim_spiffs/main.c index 3e7ff2a53ab5ba31177921c88fadeab59c2ca76a..de002f06c406dbdff8d0eefca33f673156626d43 100755 --- a/example/storage/spim_spiffs/main.c +++ b/example/storage/spim_spiffs/main.c @@ -45,7 +45,7 @@ int main(void) ret = xTaskCreate((TaskFunction_t)SpimSpiffsExampleEntry, (const char *)"SpimSpiffsExampleEntry", - (uint16_t)4096, + 4096, NULL, (UBaseType_t)2, NULL); diff --git a/example/storage/spim_spiffs/sdkconfig b/example/storage/spim_spiffs/sdkconfig index 8ff6f18bd8f9b46ba93457149bf885b5aca6f02c..1a65b1027e059e271e50fd1e623118bb3ceef8f3 100644 --- a/example/storage/spim_spiffs/sdkconfig +++ b/example/storage/spim_spiffs/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/storage/spim_spiffs/sdkconfig.h b/example/storage/spim_spiffs/sdkconfig.h index 3f3e24afb03351e0a0d2e12e33f4339fd9968008..5359a0be00a7e12677b93f7b4c32e985080024db 100644 --- a/example/storage/spim_spiffs/sdkconfig.h +++ b/example/storage/spim_spiffs/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -130,7 +125,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/system/amp/openamp/device_core/configs/d2000_aarch32_test_openamp_device_core.config b/example/system/amp/openamp/device_core/configs/d2000_aarch32_test_openamp_device_core.config index 2c1ee11ea2a15c7a7c5bde0d6964e72795b60220..35211e2fa102b4a0e4bcc762b13f111c292c1445 100644 --- a/example/system/amp/openamp/device_core/configs/d2000_aarch32_test_openamp_device_core.config +++ b/example/system/amp/openamp/device_core/configs/d2000_aarch32_test_openamp_device_core.config @@ -130,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/device_core/configs/d2000_aarch64_test_openamp_device_core.config b/example/system/amp/openamp/device_core/configs/d2000_aarch64_test_openamp_device_core.config index 0f0b2fbd0594d532ac2a2cc5c6916b37ff64e834..18bab938305403adc681817839b88ffa2ccab2c7 100644 --- a/example/system/amp/openamp/device_core/configs/d2000_aarch64_test_openamp_device_core.config +++ b/example/system/amp/openamp/device_core/configs/d2000_aarch64_test_openamp_device_core.config @@ -124,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/device_core/configs/e2000d_aarch32_demo_openamp_device_core.config b/example/system/amp/openamp/device_core/configs/e2000d_aarch32_demo_openamp_device_core.config index 24bb819cd98bea3ba41ed2029077a5077005acb0..e4a498fa17e12a1ce0195ce12c03ad7b7a89f985 100644 --- a/example/system/amp/openamp/device_core/configs/e2000d_aarch32_demo_openamp_device_core.config +++ b/example/system/amp/openamp/device_core/configs/e2000d_aarch32_demo_openamp_device_core.config @@ -143,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/device_core/configs/e2000d_aarch64_demo_openamp_device_core.config b/example/system/amp/openamp/device_core/configs/e2000d_aarch64_demo_openamp_device_core.config index 1b726a00ae71d5ba9052507fe4152bbb552aedc2..6c5a55b2bb44145a3554c97b7a56457e692733ac 100644 --- a/example/system/amp/openamp/device_core/configs/e2000d_aarch64_demo_openamp_device_core.config +++ b/example/system/amp/openamp/device_core/configs/e2000d_aarch64_demo_openamp_device_core.config @@ -137,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/device_core/configs/e2000q_aarch32_demo_openamp_device_core.config b/example/system/amp/openamp/device_core/configs/e2000q_aarch32_demo_openamp_device_core.config index 30481f99d968a8bf0ab525149a1d6bf1cca72c7e..716d4b1b1f66c9956679df05220a7e9a9da2f843 100644 --- a/example/system/amp/openamp/device_core/configs/e2000q_aarch32_demo_openamp_device_core.config +++ b/example/system/amp/openamp/device_core/configs/e2000q_aarch32_demo_openamp_device_core.config @@ -142,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/device_core/configs/e2000q_aarch64_demo_openamp_device_core.config b/example/system/amp/openamp/device_core/configs/e2000q_aarch64_demo_openamp_device_core.config index aa9b0e71317569abbca3c36737e420eead5e6394..e4d4da2af5b70f5e7ef0fb3e94ac5901103eac09 100644 --- a/example/system/amp/openamp/device_core/configs/e2000q_aarch64_demo_openamp_device_core.config +++ b/example/system/amp/openamp/device_core/configs/e2000q_aarch64_demo_openamp_device_core.config @@ -136,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/device_core/configs/phytiumpi_aarch32_firefly_openamp_device_core.config b/example/system/amp/openamp/device_core/configs/phytiumpi_aarch32_firefly_openamp_device_core.config index 1561e4e1f54b7d43f41a5cc884564591a9fcfafe..d3c441bf1a6542de10fa2a137d176459fe1e3109 100644 --- a/example/system/amp/openamp/device_core/configs/phytiumpi_aarch32_firefly_openamp_device_core.config +++ b/example/system/amp/openamp/device_core/configs/phytiumpi_aarch32_firefly_openamp_device_core.config @@ -141,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/device_core/configs/phytiumpi_aarch64_firefly_openamp_device_core.config b/example/system/amp/openamp/device_core/configs/phytiumpi_aarch64_firefly_openamp_device_core.config index 473dcd80208f0031eca4f4a0585f5d5ba6be59f9..3c397fe8bf7034b06f679ccfe8b457d02baf1c7b 100644 --- a/example/system/amp/openamp/device_core/configs/phytiumpi_aarch64_firefly_openamp_device_core.config +++ b/example/system/amp/openamp/device_core/configs/phytiumpi_aarch64_firefly_openamp_device_core.config @@ -135,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/device_core/sdkconfig b/example/system/amp/openamp/device_core/sdkconfig index 473dcd80208f0031eca4f4a0585f5d5ba6be59f9..3c397fe8bf7034b06f679ccfe8b457d02baf1c7b 100644 --- a/example/system/amp/openamp/device_core/sdkconfig +++ b/example/system/amp/openamp/device_core/sdkconfig @@ -135,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/device_core/sdkconfig.h b/example/system/amp/openamp/device_core/sdkconfig.h index 29929dae70ef4c8a534e080e8e4296cd599d19b8..582b2ba4adbec453edcb0cb5fe3ffa87836fcc4f 100644 --- a/example/system/amp/openamp/device_core/sdkconfig.h +++ b/example/system/amp/openamp/device_core/sdkconfig.h @@ -124,7 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/system/amp/openamp/driver_core/configs/d2000_aarch32_test_openamp_driver_core.config b/example/system/amp/openamp/driver_core/configs/d2000_aarch32_test_openamp_driver_core.config index e047321a7642787ff444ae7a10de6e3279f8f5d0..38ec6567ae85887a4043a00d24d7241925b9bca3 100644 --- a/example/system/amp/openamp/driver_core/configs/d2000_aarch32_test_openamp_driver_core.config +++ b/example/system/amp/openamp/driver_core/configs/d2000_aarch32_test_openamp_driver_core.config @@ -130,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/driver_core/configs/d2000_aarch64_test_openamp_driver_core.config b/example/system/amp/openamp/driver_core/configs/d2000_aarch64_test_openamp_driver_core.config index a5688373f4eb29c7491ec51b40c67646544d42a0..cab1b7c6efe60671e2536d59afc9ba2454964f06 100644 --- a/example/system/amp/openamp/driver_core/configs/d2000_aarch64_test_openamp_driver_core.config +++ b/example/system/amp/openamp/driver_core/configs/d2000_aarch64_test_openamp_driver_core.config @@ -124,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/driver_core/configs/e2000d_aarch32_demo_openamp_driver_core.config b/example/system/amp/openamp/driver_core/configs/e2000d_aarch32_demo_openamp_driver_core.config index cda3ee86e68bc828bc1841ffcd6cbffd56b999a7..d7ef0d31204cbea87e0234518bfa81e250ca44ce 100644 --- a/example/system/amp/openamp/driver_core/configs/e2000d_aarch32_demo_openamp_driver_core.config +++ b/example/system/amp/openamp/driver_core/configs/e2000d_aarch32_demo_openamp_driver_core.config @@ -143,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/driver_core/configs/e2000d_aarch64_demo_openamp_driver_core.config b/example/system/amp/openamp/driver_core/configs/e2000d_aarch64_demo_openamp_driver_core.config index e47d20e155284329e6fe9715aa43cf80a2e1bace..cb7802c6c10f4595e39e106fe93357b93a022053 100644 --- a/example/system/amp/openamp/driver_core/configs/e2000d_aarch64_demo_openamp_driver_core.config +++ b/example/system/amp/openamp/driver_core/configs/e2000d_aarch64_demo_openamp_driver_core.config @@ -137,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/driver_core/configs/e2000q_aarch32_demo_openamp_driver_core.config b/example/system/amp/openamp/driver_core/configs/e2000q_aarch32_demo_openamp_driver_core.config index c97cf00ec9629e6b47b9b1a60eb73b9db154f440..9ac578fb1e064b50c7fa71b1185014365b6f2cf9 100644 --- a/example/system/amp/openamp/driver_core/configs/e2000q_aarch32_demo_openamp_driver_core.config +++ b/example/system/amp/openamp/driver_core/configs/e2000q_aarch32_demo_openamp_driver_core.config @@ -142,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/driver_core/configs/e2000q_aarch64_demo_openamp_driver_core.config b/example/system/amp/openamp/driver_core/configs/e2000q_aarch64_demo_openamp_driver_core.config index ad8e9e31fecc234648796e7e9ccdb58c2b0a408a..65b4dad018589b71251e9a82769a705ea1f3e560 100644 --- a/example/system/amp/openamp/driver_core/configs/e2000q_aarch64_demo_openamp_driver_core.config +++ b/example/system/amp/openamp/driver_core/configs/e2000q_aarch64_demo_openamp_driver_core.config @@ -136,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/driver_core/configs/phytiumpi_aarch32_firefly_openamp_driver_core.config b/example/system/amp/openamp/driver_core/configs/phytiumpi_aarch32_firefly_openamp_driver_core.config index ac25d0a3c422d9b1402c3b0ac959b049203c4e7c..9997670f21c11185a6a671a9ba4a4b72ee23099e 100644 --- a/example/system/amp/openamp/driver_core/configs/phytiumpi_aarch32_firefly_openamp_driver_core.config +++ b/example/system/amp/openamp/driver_core/configs/phytiumpi_aarch32_firefly_openamp_driver_core.config @@ -141,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/driver_core/configs/phytiumpi_aarch64_firefly_openamp_driver_core.config b/example/system/amp/openamp/driver_core/configs/phytiumpi_aarch64_firefly_openamp_driver_core.config index 5efd3bade64695b37180a822f898d4603a008df0..7424a2d73491c5465203419cc240a1f8fc4e199f 100644 --- a/example/system/amp/openamp/driver_core/configs/phytiumpi_aarch64_firefly_openamp_driver_core.config +++ b/example/system/amp/openamp/driver_core/configs/phytiumpi_aarch64_firefly_openamp_driver_core.config @@ -135,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/driver_core/main.c b/example/system/amp/openamp/driver_core/main.c index 8bc8e775e03d022b8f43ad073fb8b3441ce2635f..d70f2c344f0c0d138ac09d26633886be7c9eb9f8 100644 --- a/example/system/amp/openamp/driver_core/main.c +++ b/example/system/amp/openamp/driver_core/main.c @@ -58,7 +58,7 @@ int main(void) taskENTER_CRITICAL(); /* no schedule when create task */ ret = xTaskCreate((TaskFunction_t )OpenampExampleTaskEntry, /* 任务入口函数 */ (const char* )"OpenampExampleTaskEntry",/* 任务名字 */ - (uint16_t )(4096*2), /* 任务栈大小 */ + (4096*2), /* 任务栈大小 */ (void* )NULL,/* 任务入口函数参数 */ (UBaseType_t )4, /* 任务的优先级 */ NULL); /* 任务控制块指针 */ diff --git a/example/system/amp/openamp/driver_core/sdkconfig b/example/system/amp/openamp/driver_core/sdkconfig index 5efd3bade64695b37180a822f898d4603a008df0..7424a2d73491c5465203419cc240a1f8fc4e199f 100644 --- a/example/system/amp/openamp/driver_core/sdkconfig +++ b/example/system/amp/openamp/driver_core/sdkconfig @@ -135,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp/driver_core/sdkconfig.h b/example/system/amp/openamp/driver_core/sdkconfig.h index 0a34d7f2ac1bc48395cb4fa661f368bb8b467d35..f42d8a10ecad7d085f66656e72172d15cfc1fc15 100644 --- a/example/system/amp/openamp/driver_core/sdkconfig.h +++ b/example/system/amp/openamp/driver_core/sdkconfig.h @@ -124,7 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/system/amp/openamp/driver_core/src/rpmsg-demo-manager_cmd.c b/example/system/amp/openamp/driver_core/src/rpmsg-demo-manager_cmd.c index e8f9f78903205586fe1ba8d8789c804633157f4c..a543a19f6170e84af938c2857d6b3b7aad2a5a47 100644 --- a/example/system/amp/openamp/driver_core/src/rpmsg-demo-manager_cmd.c +++ b/example/system/amp/openamp/driver_core/src/rpmsg-demo-manager_cmd.c @@ -429,7 +429,7 @@ BaseType_t FFreeRTOSOpenampExample(void) xReturn = xTaskCreate((TaskFunction_t )RpmsgEchoTask, /* 任务入口函数 */ (const char* )"RpmsgEchoTask",/* 任务名字 */ - (uint16_t )(4096*2), /* 任务栈大小 */ + (4096*2), /* 任务栈大小 */ (void* )NULL,/* 任务入口函数参数 */ (UBaseType_t )4, /* 任务的优先级 */ NULL); /* 任务控制块指针 */ diff --git a/example/system/amp/openamp_for_linux/configs/d2000_aarch32_test_openamp_for_linux.config b/example/system/amp/openamp_for_linux/configs/d2000_aarch32_test_openamp_for_linux.config index 3051a328090f569c1e13dbd18465e7a0fa92a3a9..728eb5815fd58f9e247ba99ec5cba29fdfe932f9 100644 --- a/example/system/amp/openamp_for_linux/configs/d2000_aarch32_test_openamp_for_linux.config +++ b/example/system/amp/openamp_for_linux/configs/d2000_aarch32_test_openamp_for_linux.config @@ -141,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp_for_linux/configs/d2000_aarch64_test_openamp_for_linux.config b/example/system/amp/openamp_for_linux/configs/d2000_aarch64_test_openamp_for_linux.config index 5a088ecf0780e543f50aec13085e80817402db7f..6d35a91a40faa131db416ccd3c1ae1f224b20107 100644 --- a/example/system/amp/openamp_for_linux/configs/d2000_aarch64_test_openamp_for_linux.config +++ b/example/system/amp/openamp_for_linux/configs/d2000_aarch64_test_openamp_for_linux.config @@ -135,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp_for_linux/configs/e2000d_aarch32_demo_openamp_for_linux.config b/example/system/amp/openamp_for_linux/configs/e2000d_aarch32_demo_openamp_for_linux.config index c3b16b6827564adb1d50ad5035b85e0638b39884..76ddadfe441c145e2f29b0ac3df818654d7308ce 100644 --- a/example/system/amp/openamp_for_linux/configs/e2000d_aarch32_demo_openamp_for_linux.config +++ b/example/system/amp/openamp_for_linux/configs/e2000d_aarch32_demo_openamp_for_linux.config @@ -154,7 +154,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp_for_linux/configs/e2000d_aarch64_demo_openamp_for_linux.config b/example/system/amp/openamp_for_linux/configs/e2000d_aarch64_demo_openamp_for_linux.config index 9a1387b6c2625e551b4bf2d838b6d088c1f9f1e1..7e36a4fd81ca4db56812a5d05ce9a57357dc7d56 100644 --- a/example/system/amp/openamp_for_linux/configs/e2000d_aarch64_demo_openamp_for_linux.config +++ b/example/system/amp/openamp_for_linux/configs/e2000d_aarch64_demo_openamp_for_linux.config @@ -148,7 +148,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp_for_linux/configs/e2000q_aarch32_demo_openamp_for_linux.config b/example/system/amp/openamp_for_linux/configs/e2000q_aarch32_demo_openamp_for_linux.config index fb7cd7855904eb03d238be308ccc5c82b2ffc242..74a3be1e6b02bbe806ff3956eb7ef2f37e401d50 100644 --- a/example/system/amp/openamp_for_linux/configs/e2000q_aarch32_demo_openamp_for_linux.config +++ b/example/system/amp/openamp_for_linux/configs/e2000q_aarch32_demo_openamp_for_linux.config @@ -153,7 +153,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp_for_linux/configs/e2000q_aarch64_demo_openamp_for_linux.config b/example/system/amp/openamp_for_linux/configs/e2000q_aarch64_demo_openamp_for_linux.config index c3cf49452a0e667f9d2162d1151c9421c2c30f40..fc3a1cd41b0cb760588fc765be5ad5295aa9c6d3 100644 --- a/example/system/amp/openamp_for_linux/configs/e2000q_aarch64_demo_openamp_for_linux.config +++ b/example/system/amp/openamp_for_linux/configs/e2000q_aarch64_demo_openamp_for_linux.config @@ -147,7 +147,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp_for_linux/configs/phytiumpi_aarch32_firefly_openamp_for_linux.config b/example/system/amp/openamp_for_linux/configs/phytiumpi_aarch32_firefly_openamp_for_linux.config index e5ac3f54e33613fa1a243b1fd37ce7d959a36619..b313b29b70fe8fc0187b501916123c34297e6307 100644 --- a/example/system/amp/openamp_for_linux/configs/phytiumpi_aarch32_firefly_openamp_for_linux.config +++ b/example/system/amp/openamp_for_linux/configs/phytiumpi_aarch32_firefly_openamp_for_linux.config @@ -152,7 +152,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp_for_linux/configs/phytiumpi_aarch64_firefly_openamp_for_linux.config b/example/system/amp/openamp_for_linux/configs/phytiumpi_aarch64_firefly_openamp_for_linux.config index 129b09a8ff29e3858180e88981f6439cae82e382..c0a9827f3ea8b23b30dc023fcfba03568e976d6f 100644 --- a/example/system/amp/openamp_for_linux/configs/phytiumpi_aarch64_firefly_openamp_for_linux.config +++ b/example/system/amp/openamp_for_linux/configs/phytiumpi_aarch64_firefly_openamp_for_linux.config @@ -146,7 +146,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp_for_linux/sdkconfig b/example/system/amp/openamp_for_linux/sdkconfig index 129b09a8ff29e3858180e88981f6439cae82e382..c0a9827f3ea8b23b30dc023fcfba03568e976d6f 100644 --- a/example/system/amp/openamp_for_linux/sdkconfig +++ b/example/system/amp/openamp_for_linux/sdkconfig @@ -146,7 +146,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/amp/openamp_for_linux/sdkconfig.h b/example/system/amp/openamp_for_linux/sdkconfig.h index afb0048d66674fad48174c4ea8ec503bb1aacc32..920019b6c8188d34eddf5e49530234d67cd45eab 100644 --- a/example/system/amp/openamp_for_linux/sdkconfig.h +++ b/example/system/amp/openamp_for_linux/sdkconfig.h @@ -130,7 +130,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/system/amp/openamp_for_linux/src/rpmsg-echo_os.c b/example/system/amp/openamp_for_linux/src/rpmsg-echo_os.c index 71ab630dd7efbbc6d015726d4c5d7ccfa9d5cd26..2688a1d4e08baa34fdabb400f9ee38fc6e43db6b 100644 --- a/example/system/amp/openamp_for_linux/src/rpmsg-echo_os.c +++ b/example/system/amp/openamp_for_linux/src/rpmsg-echo_os.c @@ -278,7 +278,7 @@ int rpmsg_echo_task(void) ret = xTaskCreate((TaskFunction_t )RpmsgEchoTask, /* 任务入口函数 */ (const char* )"RpmsgEchoTask",/* 任务名字 */ - (uint16_t )(4096*2), /* 任务栈大小 */ + (4096*2), /* 任务栈大小 */ (void* )NULL,/* 任务入口函数参数 */ (UBaseType_t )4, /* 任务的优先级 */ NULL); /* 任务控制块指针 */ diff --git a/example/system/atomic/configs/d2000_aarch32_test_atomic.config b/example/system/atomic/configs/d2000_aarch32_test_atomic.config index 5b449186b23d3672c904caffd8c4dd8b938a5890..b332984cf04b37354ad9acf2c764a7891d006e19 100644 --- a/example/system/atomic/configs/d2000_aarch32_test_atomic.config +++ b/example/system/atomic/configs/d2000_aarch32_test_atomic.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/atomic/configs/d2000_aarch64_test_atomic.config b/example/system/atomic/configs/d2000_aarch64_test_atomic.config index 3dbb7173a032eef20aeb1ae93fefc41dac45858f..ef039282d67acf396fbc5ed5b4689caaaa1e2b03 100644 --- a/example/system/atomic/configs/d2000_aarch64_test_atomic.config +++ b/example/system/atomic/configs/d2000_aarch64_test_atomic.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/atomic/configs/e2000d_aarch32_demo_atomic.config b/example/system/atomic/configs/e2000d_aarch32_demo_atomic.config index c68f09e136c447d45c9bd9899844e3d6ad5aacc5..91add3d983c9a2683c1e8927075308755c489bb7 100644 --- a/example/system/atomic/configs/e2000d_aarch32_demo_atomic.config +++ b/example/system/atomic/configs/e2000d_aarch32_demo_atomic.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/atomic/configs/e2000d_aarch64_demo_atomic.config b/example/system/atomic/configs/e2000d_aarch64_demo_atomic.config index 7a3be0f978390401252eddd1b5dcb9e878312882..47fa205cfe771769b9a6f57b707e2f856cab65b7 100644 --- a/example/system/atomic/configs/e2000d_aarch64_demo_atomic.config +++ b/example/system/atomic/configs/e2000d_aarch64_demo_atomic.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/atomic/configs/e2000q_aarch32_demo_atomic.config b/example/system/atomic/configs/e2000q_aarch32_demo_atomic.config index 4c0be1b69277628b6fb7dddcb35a123f2c176e5d..5b178f1556a190dde99ec085385ff65e52e0053f 100644 --- a/example/system/atomic/configs/e2000q_aarch32_demo_atomic.config +++ b/example/system/atomic/configs/e2000q_aarch32_demo_atomic.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/atomic/configs/e2000q_aarch64_demo_atomic.config b/example/system/atomic/configs/e2000q_aarch64_demo_atomic.config index 6fb3121eeef74af24f20447fc76d48a0674b708f..20e15e13030e8b5527570120bdabbc826e43ec65 100644 --- a/example/system/atomic/configs/e2000q_aarch64_demo_atomic.config +++ b/example/system/atomic/configs/e2000q_aarch64_demo_atomic.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/atomic/configs/ft2004_aarch32_dsk_atomic.config b/example/system/atomic/configs/ft2004_aarch32_dsk_atomic.config index 965f7198bac32e0a403ec70919f0d415b56be352..7ab3be54cac92607175d96f72e79e3174dadaddd 100644 --- a/example/system/atomic/configs/ft2004_aarch32_dsk_atomic.config +++ b/example/system/atomic/configs/ft2004_aarch32_dsk_atomic.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/atomic/configs/ft2004_aarch64_dsk_atomic.config b/example/system/atomic/configs/ft2004_aarch64_dsk_atomic.config index c36ddbc3bb5e5f80d86d8a10b0a39f5fc5ccbc37..90313de412fed9320db0605d8346f07c74997a46 100644 --- a/example/system/atomic/configs/ft2004_aarch64_dsk_atomic.config +++ b/example/system/atomic/configs/ft2004_aarch64_dsk_atomic.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/atomic/configs/phytiumpi_aarch32_firefly_atomic.config b/example/system/atomic/configs/phytiumpi_aarch32_firefly_atomic.config index cb9bcf246a19c5de894ea721e3d18bf7825536ee..4699d7e36ae2c5bc9e51a9cb82b810b2c3dfa647 100644 --- a/example/system/atomic/configs/phytiumpi_aarch32_firefly_atomic.config +++ b/example/system/atomic/configs/phytiumpi_aarch32_firefly_atomic.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/atomic/configs/phytiumpi_aarch64_firefly_atomic.config b/example/system/atomic/configs/phytiumpi_aarch64_firefly_atomic.config index 9c5bd94037a43c40353287dd788de58b6668d8e0..3a8bb2a0313c28c1f7a7ff473392f1160794bc5a 100644 --- a/example/system/atomic/configs/phytiumpi_aarch64_firefly_atomic.config +++ b/example/system/atomic/configs/phytiumpi_aarch64_firefly_atomic.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/atomic/main.c b/example/system/atomic/main.c index 507bd133cfb859594640e6056f371b046577e2f9..5aabbe5c51e735a35e8103c37181aeb21426f394 100644 --- a/example/system/atomic/main.c +++ b/example/system/atomic/main.c @@ -52,7 +52,7 @@ int main() #else xReturn = xTaskCreate((TaskFunction_t)AtomicExampleTaskEntry, /* 任务入口函数 */ (const char *)"AtomicExampleTaskEntry", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)ATOMIC_EXAMPLE_TASK_PRIORITY, /* 任务的优先级 */ NULL); diff --git a/example/system/atomic/sdkconfig b/example/system/atomic/sdkconfig index 9c5bd94037a43c40353287dd788de58b6668d8e0..3a8bb2a0313c28c1f7a7ff473392f1160794bc5a 100644 --- a/example/system/atomic/sdkconfig +++ b/example/system/atomic/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/atomic/sdkconfig.h b/example/system/atomic/sdkconfig.h index 4718e1a8cd44183bbe695f979a57cfdd5ecdd4d8..055a9d68b30f05663271059d2d8d53f58882e1a9 100644 --- a/example/system/atomic/sdkconfig.h +++ b/example/system/atomic/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,7 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/system/atomic/src/atomic_example.c b/example/system/atomic/src/atomic_example.c index 331a61eda09e595bb332b6c7c5f16224c34f6239..b99f703155395b4c84322900d6e79ef40ee86110 100644 --- a/example/system/atomic/src/atomic_example.c +++ b/example/system/atomic/src/atomic_example.c @@ -176,7 +176,7 @@ BaseType_t FFreeRTOSAtomicTaskCreate(void) xReturn = xTaskCreate((TaskFunction_t)FAtomicExampleTask, /* 任务入口函数 */ (const char *)"FAtomicExampleTask", /* 任务名字 */ - (uint16_t)TASK_STACK_SIZE, /* 任务栈大小 */ + TASK_STACK_SIZE, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)ATOMIC_TEST_TASK_PRIORITY, /* 任务的优先级 */ NULL); diff --git a/example/system/exception_debug/configs/d2000_aarch32_test_exception.config b/example/system/exception_debug/configs/d2000_aarch32_test_exception.config index 0bcf7838c40c445f7df331ef61fd6b057e706984..08fbfb185d17894500a5abf8ccdc10f505610d93 100644 --- a/example/system/exception_debug/configs/d2000_aarch32_test_exception.config +++ b/example/system/exception_debug/configs/d2000_aarch32_test_exception.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/exception_debug/configs/d2000_aarch64_test_exception.config b/example/system/exception_debug/configs/d2000_aarch64_test_exception.config index f4bea0e3c27cb74f5e6a89a16836002e1347211a..05fb1021995cee45185b5a8b59159554c0bc1ceb 100644 --- a/example/system/exception_debug/configs/d2000_aarch64_test_exception.config +++ b/example/system/exception_debug/configs/d2000_aarch64_test_exception.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/exception_debug/configs/e2000d_aarch32_demo_exception.config b/example/system/exception_debug/configs/e2000d_aarch32_demo_exception.config index b6b827cf431e7a80418cf7027c956e19efefd929..7d9a484098051b96afc0297049118f6cef650b61 100644 --- a/example/system/exception_debug/configs/e2000d_aarch32_demo_exception.config +++ b/example/system/exception_debug/configs/e2000d_aarch32_demo_exception.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/exception_debug/configs/e2000d_aarch64_demo_exception.config b/example/system/exception_debug/configs/e2000d_aarch64_demo_exception.config index 154359831e9dfeb3d7f9272e5746de1c7c0850ef..698b25cd6718523c3be34ab8fc555f1fa4435bf4 100644 --- a/example/system/exception_debug/configs/e2000d_aarch64_demo_exception.config +++ b/example/system/exception_debug/configs/e2000d_aarch64_demo_exception.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/exception_debug/configs/e2000q_aarch32_demo_exception.config b/example/system/exception_debug/configs/e2000q_aarch32_demo_exception.config index c2d03d472bed424b4a8e365bd9acd406da687a01..4287be332ddd93cf68586cf77dc719db4e5a20e6 100644 --- a/example/system/exception_debug/configs/e2000q_aarch32_demo_exception.config +++ b/example/system/exception_debug/configs/e2000q_aarch32_demo_exception.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/exception_debug/configs/e2000q_aarch64_demo_exception.config b/example/system/exception_debug/configs/e2000q_aarch64_demo_exception.config index 0cc3e0255bb7c086235627481110141e0c32a022..8c39c708e9331579dfd37f7917d8f61f6f20e385 100644 --- a/example/system/exception_debug/configs/e2000q_aarch64_demo_exception.config +++ b/example/system/exception_debug/configs/e2000q_aarch64_demo_exception.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/exception_debug/configs/ft2004_aarch32_dsk_exception.config b/example/system/exception_debug/configs/ft2004_aarch32_dsk_exception.config index 6deeb0289376cf1583f52a113a4f4ce6122c1b5a..a7b2027ecf0155ffdcc2529678c6e13c831293c3 100644 --- a/example/system/exception_debug/configs/ft2004_aarch32_dsk_exception.config +++ b/example/system/exception_debug/configs/ft2004_aarch32_dsk_exception.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/exception_debug/configs/ft2004_aarch64_dsk_exception.config b/example/system/exception_debug/configs/ft2004_aarch64_dsk_exception.config index 2572fa29c385fe01c2d5da15dc555ff3ee95bdea..5cd69a2c02dbdea2da301ad2e20ab512bb45698d 100644 --- a/example/system/exception_debug/configs/ft2004_aarch64_dsk_exception.config +++ b/example/system/exception_debug/configs/ft2004_aarch64_dsk_exception.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/exception_debug/configs/phytiumpi_aarch32_firefly_exception.config b/example/system/exception_debug/configs/phytiumpi_aarch32_firefly_exception.config index b1a6f823aaffad4744489f1fdac4abc8509a078c..29d26718070f0d90ac812e4765d7d44c067673c9 100644 --- a/example/system/exception_debug/configs/phytiumpi_aarch32_firefly_exception.config +++ b/example/system/exception_debug/configs/phytiumpi_aarch32_firefly_exception.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/exception_debug/configs/phytiumpi_aarch64_firefly_exception.config b/example/system/exception_debug/configs/phytiumpi_aarch64_firefly_exception.config index d05cf9231fd3cd3da4064997bfc413fb1b6d9f06..fec85a7d3e995e3d9766681d66bc0c792066d457 100644 --- a/example/system/exception_debug/configs/phytiumpi_aarch64_firefly_exception.config +++ b/example/system/exception_debug/configs/phytiumpi_aarch64_firefly_exception.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/exception_debug/sdkconfig b/example/system/exception_debug/sdkconfig index d05cf9231fd3cd3da4064997bfc413fb1b6d9f06..fec85a7d3e995e3d9766681d66bc0c792066d457 100644 --- a/example/system/exception_debug/sdkconfig +++ b/example/system/exception_debug/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/exception_debug/sdkconfig.h b/example/system/exception_debug/sdkconfig.h index c3c147d2cd452f3c827b4b2c7fce9c2a535c2e98..bbdb95a34a8218ba4f098bc56c8010e16d28b723 100644 --- a/example/system/exception_debug/sdkconfig.h +++ b/example/system/exception_debug/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,7 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/system/nested_interrupt/configs/d2000_aarch32_test_nested_interrupt.config b/example/system/nested_interrupt/configs/d2000_aarch32_test_nested_interrupt.config index c77d4d200cb77330c82ed99fb19fcfe70dd043f8..8e74d092d196a931e9b406ec7f951ab8ddce3d8f 100644 --- a/example/system/nested_interrupt/configs/d2000_aarch32_test_nested_interrupt.config +++ b/example/system/nested_interrupt/configs/d2000_aarch32_test_nested_interrupt.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/nested_interrupt/configs/d2000_aarch64_test_nested_interrupt.config b/example/system/nested_interrupt/configs/d2000_aarch64_test_nested_interrupt.config index 1c8e25e81056c50a7f2c8f8190b87eb6fd1e19ab..7d2ebfd4504dc1f343f5e9bd1b36dffafa96371e 100644 --- a/example/system/nested_interrupt/configs/d2000_aarch64_test_nested_interrupt.config +++ b/example/system/nested_interrupt/configs/d2000_aarch64_test_nested_interrupt.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/nested_interrupt/configs/e2000d_aarch32_demo_nested_interrupt.config b/example/system/nested_interrupt/configs/e2000d_aarch32_demo_nested_interrupt.config index 99c124127229e10f02ff58c714e416117634f04f..0d9c870f4b4ec85be40823c0ba5835540c6a79d1 100644 --- a/example/system/nested_interrupt/configs/e2000d_aarch32_demo_nested_interrupt.config +++ b/example/system/nested_interrupt/configs/e2000d_aarch32_demo_nested_interrupt.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/nested_interrupt/configs/e2000d_aarch64_demo_nested_interrupt.config b/example/system/nested_interrupt/configs/e2000d_aarch64_demo_nested_interrupt.config index ae3ce80318ac19db8335a65fe00cd640dfea6efd..842ea2d381c1b810bc8492d744a948ca12e174c3 100644 --- a/example/system/nested_interrupt/configs/e2000d_aarch64_demo_nested_interrupt.config +++ b/example/system/nested_interrupt/configs/e2000d_aarch64_demo_nested_interrupt.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/nested_interrupt/configs/e2000q_aarch32_demo_nested_interrupt.config b/example/system/nested_interrupt/configs/e2000q_aarch32_demo_nested_interrupt.config index 020bc62b7b20062b1eee4ffac7a26a6efe220bb6..d29de0918928764d7f2108c4c6ba9e7c8240b154 100644 --- a/example/system/nested_interrupt/configs/e2000q_aarch32_demo_nested_interrupt.config +++ b/example/system/nested_interrupt/configs/e2000q_aarch32_demo_nested_interrupt.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/nested_interrupt/configs/e2000q_aarch64_demo_nested_interrupt.config b/example/system/nested_interrupt/configs/e2000q_aarch64_demo_nested_interrupt.config index 9936f64492669e8ae4b125378e95f797af8e179c..aae5a4c3caf82d70cf25348cb36a8cd1a2d49842 100644 --- a/example/system/nested_interrupt/configs/e2000q_aarch64_demo_nested_interrupt.config +++ b/example/system/nested_interrupt/configs/e2000q_aarch64_demo_nested_interrupt.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/nested_interrupt/configs/ft2004_aarch32_dsk_nested_interrupt.config b/example/system/nested_interrupt/configs/ft2004_aarch32_dsk_nested_interrupt.config index 6ad297586ed78cebb1b9000fa7cdf8a949803546..13b42c874bab1235573bb92ea82f258fe3f87c18 100644 --- a/example/system/nested_interrupt/configs/ft2004_aarch32_dsk_nested_interrupt.config +++ b/example/system/nested_interrupt/configs/ft2004_aarch32_dsk_nested_interrupt.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/nested_interrupt/configs/ft2004_aarch64_dsk_nested_interrupt.config b/example/system/nested_interrupt/configs/ft2004_aarch64_dsk_nested_interrupt.config index 7bfa2811c706017b17a2f28d6f194b60f8432ed1..9cbc14aec6cb2b32b8fb860853cdcb44ac8b1a81 100644 --- a/example/system/nested_interrupt/configs/ft2004_aarch64_dsk_nested_interrupt.config +++ b/example/system/nested_interrupt/configs/ft2004_aarch64_dsk_nested_interrupt.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/nested_interrupt/configs/phytiumpi_aarch32_firefly_nested_interrupt.config b/example/system/nested_interrupt/configs/phytiumpi_aarch32_firefly_nested_interrupt.config index d89e85a270e606d506853bc0d9053781ed3120ec..3bb78fa2cac46a9205be28ffa86d40324f40b948 100644 --- a/example/system/nested_interrupt/configs/phytiumpi_aarch32_firefly_nested_interrupt.config +++ b/example/system/nested_interrupt/configs/phytiumpi_aarch32_firefly_nested_interrupt.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/nested_interrupt/configs/phytiumpi_aarch64_firefly_nested_interrupt.config b/example/system/nested_interrupt/configs/phytiumpi_aarch64_firefly_nested_interrupt.config index 68ab721e543e4b75a17f1223350aec3e4ab887a1..122b27562c2516a3ab44a2e1bf680ade19d5107f 100644 --- a/example/system/nested_interrupt/configs/phytiumpi_aarch64_firefly_nested_interrupt.config +++ b/example/system/nested_interrupt/configs/phytiumpi_aarch64_firefly_nested_interrupt.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/nested_interrupt/main.c b/example/system/nested_interrupt/main.c index 4043d48880249f106951bb7bb7a3e3cb057af445..ea4e3942734512ca618f2c6005d566c0b0a69734 100644 --- a/example/system/nested_interrupt/main.c +++ b/example/system/nested_interrupt/main.c @@ -55,7 +55,7 @@ int main() #else xReturn = xTaskCreate((TaskFunction_t)NestedExampleTaskEntry, /* 任务入口函数 */ (const char *)"NestedExampleTaskEntry", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)NESTED_EXAMPLE_TASK_PRIORITY, /* 任务的优先级 */ NULL); diff --git a/example/system/nested_interrupt/sdkconfig b/example/system/nested_interrupt/sdkconfig index 68ab721e543e4b75a17f1223350aec3e4ab887a1..122b27562c2516a3ab44a2e1bf680ade19d5107f 100644 --- a/example/system/nested_interrupt/sdkconfig +++ b/example/system/nested_interrupt/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/nested_interrupt/sdkconfig.h b/example/system/nested_interrupt/sdkconfig.h index 63ce45f95c18ca4373139d7a013b3f772d76299a..be79bfc62db866ad5e9a99e75495974fde2a0bfc 100644 --- a/example/system/nested_interrupt/sdkconfig.h +++ b/example/system/nested_interrupt/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,7 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/system/nested_interrupt/src/nested_interrupt.c b/example/system/nested_interrupt/src/nested_interrupt.c index 019d6f9b57b3ab8b0e76fad0f428d460da15740e..d74a0ee6fd1a631e84ddaa903e546a24cafc5fe1 100644 --- a/example/system/nested_interrupt/src/nested_interrupt.c +++ b/example/system/nested_interrupt/src/nested_interrupt.c @@ -191,7 +191,7 @@ BaseType_t FFreeRTOSNestedIntrTaskCreate(void) xReturn = xTaskCreate((TaskFunction_t)NestedIntrTask, /* 任务入口函数 */ (const char *)"NestedIntrTask", /* 任务名字 */ - (uint16_t)TASK_STACK_SIZE, /* 任务栈大小 */ + TASK_STACK_SIZE, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)NESTED_INTR_TEST_TASK_PRIORITY, /* 任务的优先级 */ NULL); diff --git a/example/system/posix/configs/d2000_aarch32_test_posix.config b/example/system/posix/configs/d2000_aarch32_test_posix.config index fd65e242d55e4f6a35e4062863c3bd3fb2641b1f..5dc3b9afd7fab7b144a759fd22dc7b25ba0ffa29 100644 --- a/example/system/posix/configs/d2000_aarch32_test_posix.config +++ b/example/system/posix/configs/d2000_aarch32_test_posix.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/posix/configs/d2000_aarch64_test_posix.config b/example/system/posix/configs/d2000_aarch64_test_posix.config index d780d8b8745d47038692f292d86d53c9b8ce6bc8..b435d242cae3995e641ed2896a48e45fb0417362 100644 --- a/example/system/posix/configs/d2000_aarch64_test_posix.config +++ b/example/system/posix/configs/d2000_aarch64_test_posix.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/posix/configs/e2000d_aarch32_demo_posix.config b/example/system/posix/configs/e2000d_aarch32_demo_posix.config index f4ae278254a659b3c949308974c256f4c8e460a7..2bf97f675cecbd41f5c2dbe9c3bc009e3a751665 100644 --- a/example/system/posix/configs/e2000d_aarch32_demo_posix.config +++ b/example/system/posix/configs/e2000d_aarch32_demo_posix.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/posix/configs/e2000d_aarch64_demo_posix.config b/example/system/posix/configs/e2000d_aarch64_demo_posix.config index 8e1148ee9da9b0ecfbc8820d426f4a686b6bac37..202e764c6853df8c6da816b85e49efba5760e86c 100644 --- a/example/system/posix/configs/e2000d_aarch64_demo_posix.config +++ b/example/system/posix/configs/e2000d_aarch64_demo_posix.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/posix/configs/e2000q_aarch32_demo_posix.config b/example/system/posix/configs/e2000q_aarch32_demo_posix.config index 6886cbedcfdcd718384d9eec61e9e0b9dbf1fb68..89873c71158dc4b1964539a2dccb7d82f67d05dc 100644 --- a/example/system/posix/configs/e2000q_aarch32_demo_posix.config +++ b/example/system/posix/configs/e2000q_aarch32_demo_posix.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/posix/configs/e2000q_aarch64_demo_posix.config b/example/system/posix/configs/e2000q_aarch64_demo_posix.config index 3570206df1053960d6f2a7845417669af5dd65e2..975b13fe6f248ae2c571d13cbceabd735b9778e6 100644 --- a/example/system/posix/configs/e2000q_aarch64_demo_posix.config +++ b/example/system/posix/configs/e2000q_aarch64_demo_posix.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/posix/configs/ft2004_aarch32_dsk_posix.config b/example/system/posix/configs/ft2004_aarch32_dsk_posix.config index 6321540e7ba2b516f62e50b7b3ae0f980e4f2216..df473e0ada0711e7cb9772fa3aea0e272e5dfa78 100644 --- a/example/system/posix/configs/ft2004_aarch32_dsk_posix.config +++ b/example/system/posix/configs/ft2004_aarch32_dsk_posix.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/posix/configs/ft2004_aarch64_dsk_posix.config b/example/system/posix/configs/ft2004_aarch64_dsk_posix.config index 854fefd7c3b55c48674dea3da1c79a4592c682d7..1617e7b44c96a1bb6eafd7d2dc953668aa86df9d 100644 --- a/example/system/posix/configs/ft2004_aarch64_dsk_posix.config +++ b/example/system/posix/configs/ft2004_aarch64_dsk_posix.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/posix/configs/phytiumpi_aarch32_firefly_posix.config b/example/system/posix/configs/phytiumpi_aarch32_firefly_posix.config index bb8470626e9577e6f64e1b79a8aedbbaa0adc824..1ca1fe1b003461306945e0720b75e750c31992da 100644 --- a/example/system/posix/configs/phytiumpi_aarch32_firefly_posix.config +++ b/example/system/posix/configs/phytiumpi_aarch32_firefly_posix.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/posix/configs/phytiumpi_aarch64_firefly_posix.config b/example/system/posix/configs/phytiumpi_aarch64_firefly_posix.config index 95f60a7bc3e31c5a0a9f6a33f8be68855eef95ba..991065f0cd376fdfc9469e01452776f8eaeb968c 100644 --- a/example/system/posix/configs/phytiumpi_aarch64_firefly_posix.config +++ b/example/system/posix/configs/phytiumpi_aarch64_firefly_posix.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/posix/main.c b/example/system/posix/main.c index 3e893bb61fe0cf51244a04e1af91714de8f5c447..e114c2bc900a095873c3f20b183776fe0da97beb 100644 --- a/example/system/posix/main.c +++ b/example/system/posix/main.c @@ -52,7 +52,7 @@ int main() #else xReturn = xTaskCreate((TaskFunction_t)FFreeRTOSPosixExampleTaskEntry, /* 任务入口函数 */ (const char *)"FFreeRTOSPosixExampleTaskEntry", /* 任务名字 */ - (uint16_t)4096, /* 任务栈大小 */ + 4096, /* 任务栈大小 */ NULL, /* 任务入口函数参数 */ (UBaseType_t)FREERTOS_POSIX_EXAMPLE_TASK_PRIORITY, /* 任务的优先级 */ NULL); diff --git a/example/system/posix/sdkconfig b/example/system/posix/sdkconfig index 95f60a7bc3e31c5a0a9f6a33f8be68855eef95ba..991065f0cd376fdfc9469e01452776f8eaeb968c 100644 --- a/example/system/posix/sdkconfig +++ b/example/system/posix/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/system/posix/sdkconfig.h b/example/system/posix/sdkconfig.h index 426e3569367c8a1b3c972ba8392268840721b7f3..7e83fee2c2591c977485b9d94ae366170fc75c96 100644 --- a/example/system/posix/sdkconfig.h +++ b/example/system/posix/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,7 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/example/system/posix/src/posix_example.c b/example/system/posix/src/posix_example.c index 2a6f516d33876b9741453728375c8344f4d6975d..a31ed59cce1b4226734a023268c51b8bc7ef1175 100644 --- a/example/system/posix/src/posix_example.c +++ b/example/system/posix/src/posix_example.c @@ -391,7 +391,7 @@ BaseType_t CreatePOSIXDemoTasks(void) xReturn = xTaskCreate((TaskFunction_t)POSIXDemoTask, /* 任务入口函数 */ (const char *)"POSIXDemoTask", /* 任务名字 */ - (uint16_t)TASK_STACK_SIZE, /* 任务栈大小 */ + TASK_STACK_SIZE, /* 任务栈大小 */ (void *)NULL, /* 任务入口函数参数 */ (UBaseType_t)POSIX_DEMO__TASK_PRIORITY, /* 任务的优先级 */ &xtask_handle); /* 任务控制 */ diff --git a/example/template/configs/d2000_aarch32_test_eg.config b/example/template/configs/d2000_aarch32_test_eg.config index 7a84ca97ecd3e25af30dd6aaf4cc1ac5e0d60f87..4c5ef7a996f267876da8f9c5a133debba3af168f 100644 --- a/example/template/configs/d2000_aarch32_test_eg.config +++ b/example/template/configs/d2000_aarch32_test_eg.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/template/configs/d2000_aarch64_test_eg.config b/example/template/configs/d2000_aarch64_test_eg.config index 5b4a73c599e2166b3a539bfd14c6afc696b77d53..054043295ace4e4d954c9e159f75c6c8fb548cbd 100644 --- a/example/template/configs/d2000_aarch64_test_eg.config +++ b/example/template/configs/d2000_aarch64_test_eg.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/template/configs/e2000d_aarch32_demo_eg.config b/example/template/configs/e2000d_aarch32_demo_eg.config index 962543c59f2dc6246c0e21157a55750bd61dd1bf..70831ce9f1adce39a4329b65715d00015afb77bf 100644 --- a/example/template/configs/e2000d_aarch32_demo_eg.config +++ b/example/template/configs/e2000d_aarch32_demo_eg.config @@ -114,12 +114,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -149,7 +143,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/template/configs/e2000d_aarch64_demo_eg.config b/example/template/configs/e2000d_aarch64_demo_eg.config index 0cef892cf315b94d3579a3a0ff9989499d859734..c6b3a2332719a09d5d5d6d5c24e3acb878f04c89 100644 --- a/example/template/configs/e2000d_aarch64_demo_eg.config +++ b/example/template/configs/e2000d_aarch64_demo_eg.config @@ -108,12 +108,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -143,7 +137,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/template/configs/e2000q_aarch32_demo_eg.config b/example/template/configs/e2000q_aarch32_demo_eg.config index 615b5ae888397be4b7d91f0d383e245c777b4df4..b42aeeed4c78e366d1c8a64f0a0f331ffd2609c0 100644 --- a/example/template/configs/e2000q_aarch32_demo_eg.config +++ b/example/template/configs/e2000q_aarch32_demo_eg.config @@ -113,12 +113,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -148,7 +142,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/template/configs/e2000q_aarch64_demo_eg.config b/example/template/configs/e2000q_aarch64_demo_eg.config index 3e73a1f9c08d99bf42ee882e5ea40820b5fb3536..96bcba6efece7710864a5d42d75463a36c0f5fe3 100644 --- a/example/template/configs/e2000q_aarch64_demo_eg.config +++ b/example/template/configs/e2000q_aarch64_demo_eg.config @@ -107,12 +107,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -142,7 +136,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/template/configs/ft2004_aarch32_dsk_eg.config b/example/template/configs/ft2004_aarch32_dsk_eg.config index b00b5302c7978a5daf33ba031c369835ef77ff24..e57bf0a3cd8c0033585dfc8dd34c0b58553415e1 100644 --- a/example/template/configs/ft2004_aarch32_dsk_eg.config +++ b/example/template/configs/ft2004_aarch32_dsk_eg.config @@ -101,12 +101,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -136,7 +130,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/template/configs/ft2004_aarch64_dsk_eg.config b/example/template/configs/ft2004_aarch64_dsk_eg.config index a6226b74da2aeccbca9b7f565e826e6674ce153e..b86d6286107c7a330491f9f9526fa59acf1ad4bc 100644 --- a/example/template/configs/ft2004_aarch64_dsk_eg.config +++ b/example/template/configs/ft2004_aarch64_dsk_eg.config @@ -95,12 +95,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -130,7 +124,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/template/configs/phytiumpi_aarch32_firefly_eg.config b/example/template/configs/phytiumpi_aarch32_firefly_eg.config index 82ed04fa40449fcda645f3af92c1ed6f46d8ba4a..f8ccbfb90f76cc8790d67204d5fd55422a1219a3 100644 --- a/example/template/configs/phytiumpi_aarch32_firefly_eg.config +++ b/example/template/configs/phytiumpi_aarch32_firefly_eg.config @@ -112,12 +112,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -147,7 +141,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/template/configs/phytiumpi_aarch64_firefly_eg.config b/example/template/configs/phytiumpi_aarch64_firefly_eg.config index 4b906a8fc5acb9f58a29051c14e8c06f5869f0fc..0cc866a63720ba6ad2a5222c7b8b7e7513bd9cc3 100644 --- a/example/template/configs/phytiumpi_aarch64_firefly_eg.config +++ b/example/template/configs/phytiumpi_aarch64_firefly_eg.config @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/template/sdkconfig b/example/template/sdkconfig index 4b906a8fc5acb9f58a29051c14e8c06f5869f0fc..0cc866a63720ba6ad2a5222c7b8b7e7513bd9cc3 100644 --- a/example/template/sdkconfig +++ b/example/template/sdkconfig @@ -106,12 +106,6 @@ CONFIG_INTERRUPT_ROLE_MASTER=y # CONFIG_INTERRUPT_ROLE_SLAVE is not set # end of Sdk common configuration -# -# Image information configuration -# -# CONFIG_IMAGE_INFO is not set -# end of Image information configuration - # # Drivers configuration # @@ -141,7 +135,6 @@ CONFIG_ENABLE_Pl011_UART=y # CONFIG_USE_NAND is not set # CONFIG_USE_RTC is not set # CONFIG_USE_SATA is not set -# CONFIG_USE_USB is not set # CONFIG_USE_ADC is not set # CONFIG_USE_PWM is not set # CONFIG_USE_IPC is not set diff --git a/example/template/sdkconfig.h b/example/template/sdkconfig.h index 0f12753ebcfc5cdd80292e074d7c457ad74f8428..a23c61727d63ba08d2f95631bd87d92398e7fb94 100644 --- a/example/template/sdkconfig.h +++ b/example/template/sdkconfig.h @@ -98,11 +98,6 @@ /* CONFIG_INTERRUPT_ROLE_SLAVE is not set */ /* end of Sdk common configuration */ -/* Image information configuration */ - -/* CONFIG_IMAGE_INFO is not set */ -/* end of Image information configuration */ - /* Drivers configuration */ #define CONFIG_USE_IOMUX @@ -129,7 +124,6 @@ /* CONFIG_USE_NAND is not set */ /* CONFIG_USE_RTC is not set */ /* CONFIG_USE_SATA is not set */ -/* CONFIG_USE_USB is not set */ /* CONFIG_USE_ADC is not set */ /* CONFIG_USE_PWM is not set */ /* CONFIG_USE_IPC is not set */ diff --git a/install.py b/install.py index cd9546c92a7369d58a370610d6c6c95cd7a38faa..50b7d8938a2b83820340da7a6766551f0a126182 100755 --- a/install.py +++ b/install.py @@ -36,7 +36,7 @@ freertos_sdk_path = install_path print("Standalone SDK at {}".format(freertos_sdk_path)) # Add standalone sdk -standalone_sdk_v="3174e23d3c319a5685910febb17ca87237ca7ceb" +standalone_sdk_v="2ff7883c95cd312c636c9f35903b46ae74f8749d" if (install_platform == windows_x64): standalone_path=freertos_sdk_path + '\\standalone' else: diff --git a/third-party/cherryusb/Kconfig b/third-party/cherryusb/Kconfig deleted file mode 100644 index 52451502e84a55005f38c29e8e64d3be182ec8fd..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/Kconfig +++ /dev/null @@ -1,97 +0,0 @@ -menu "CherryUSB Configuration" - choice CHERRY_USB_PORT_TYPE - prompt "Select Cherry USB Port Type" - default CHERRY_USB_PORT_XHCI - help - Select Port Type for CherryUSB - - config CHERRY_USB_PORT_XHCI - bool "XHCI" - - config CHERRY_USB_PORT_PHYTIUM_OTG - bool "OTG(Phytium)" - - endchoice # CHERRY_USB_PORT_TYPE - - choice CHERRY_USB_WORK_MODE - prompt "Select Cherry USB Work Mode" - help - Select Work Mode for CherryUSB - - config CHERRYUSB_HOST - bool "Host(Hc)" - - config CHERRYUSB_DEVICE - bool "Device(Dc)" - - endchoice #CHERRY_USB_WORK_MODE - -if CHERRYUSB_HOST - config CHERRY_USB_HOST_HUB - bool "HUB(Hc)" - default y - - config CHERRY_USB_HOST_MSC - bool "MSC(Hc)" - default n - - config CHERRY_USB_HOST_HID - bool "HID(Hc)" - default n - - config CHERRY_USB_HOST_VEDIO - bool "VEDIO(Hc)" - default n - - config CHERRY_USB_HOST_CDC - bool "CDC(Hc)" - default n - - config CHERRY_USB_HOST_RNDIS_WIRELESS - bool "RndisWireless(Hc)" - default n - -endif #CHERRYUSB_HOST - -if CHERRYUSB_DEVICE - - choice CHERRY_USB_DEVICE_TYPE - prompt "Select Cherry USB Device Type" - help - Select Device Type that Cherry USB Work as - - config CHERRY_USB_DEVICE_HUB - bool "HUB(Dc)" - - config CHERRY_USB_DEVICE_MSC - bool "MSC(Dc)" - - config CHERRY_USB_DEVICE_HID - bool "HID(Dc)" - - config CHERRY_USB_DEVICE_AUDIO - bool "Audio(Dc)" - - config CHERRY_USB_DEVICE_CDC - bool "Cdc(Dc)" - - config CHERRY_USB_DEVICE_DFU - bool "DFU(Dc)" - - config CHERRY_USB_DEVICE_MTP - bool "MTP(Dc)" - - config CHERRY_USB_DEVICE_PRINTER - bool "Printer(Dc)" - - config CHERRY_USB_DEVICE_VEDIO - bool "Vedio(Dc)" - - config CHERRY_USB_DEVICE_RNDIS_WIRELESS - bool "RndisWireless(Dc)" - - endchoice #CHERRY_USB_DEVICE_TYPE - -endif #CHERRYUSB_DEVICE - -endmenu \ No newline at end of file diff --git a/third-party/cherryusb/LICENSE b/third-party/cherryusb/LICENSE deleted file mode 100644 index 261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/third-party/cherryusb/README.md b/third-party/cherryusb/README.md deleted file mode 100644 index e051ebf88ff0281b761fae9592d91f096f9e59d1..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/README.md +++ /dev/null @@ -1,156 +0,0 @@ -# CherryUSB - -[中文版](./README_zh.md) - -CherryUSB is a tiny, beautiful and portable USB host and device stack for embedded system with USB ip. - -![CherryUSB](./docs/assets/usb_outline.png) - -## Why choose - -- Streamlined code with small memory usage which also can be further trimmed -- Comprehensive class drivers and all master and slave class drivers are templated,making it easy for users to add new class drivers and find patterns when learning -- The APIs available to the users are very few and clearly categorised. Device: initialisation + registration apis, command callback apis, data sending and receiving apis; Host: initialisation + lookup apis, data sending and receiving apis -- Tree-based programming with a hierarchy of code that makes it easy for the user to sort out function call relationships, enumerations and class-driven loading processes -- Standardised porting interface, no need to rewrite the driver for the same ip, and porting drivers are templated to make it easier for users to add new ports -- The use of the device or host transceiver apis are equivalent to the use of the uart tx/rx dma, and there is no limit to the length -- Capable of achieving theoretical USB hardware bandwidth - -## Directoy Structure - -``` -. -├── class -├── common -├── core -├── demo -├── docs -├── osal -├── packet capture -└── port -└── tools - -``` - -| Directory | Description | -|:-------------:|:---------------------------:| -|class | usb class driver | -|common | usb spec macros and utils | -|core | usb core implementation | -|demo | different chips demo | -|osal | os wrapper | -|docs | doc for guiding | -|packet capture | packet capture file | -|port | usb dcd and hcd porting | -|tools | tool used url | - -## Device Stack Overview - -CherryUSB Device Stack provides a unified framework of functions for standard device requests, CLASS requests, VENDOR requests and custom special requests. The object-oriented and chained approach allows the user to quickly get started with composite devices without having to worry about the underlying logic. At the same time, a standard dcd porting interface has been standardised for adapting different USB IPs to achieve ip-oriented programming. - -CherryUSB Device Stack has the following functions: - -- Support USB2.0 full and high speed -- Support endpoint irq callback register by users, let users do whatever they wants in endpoint irq callback. -- Support Composite Device -- Support Communication Device Class (CDC) -- Support Human Interface Device (HID) -- Support Mass Storage Class (MSC) -- Support USB VIDEO CLASS (UVC1.0、UVC1.5) -- Support USB AUDIO CLASS (UAC1.0、UAC2.0) -- Support Device Firmware Upgrade CLASS (DFU) -- Support USB MIDI CLASS (MIDI) -- Support Remote NDIS (RNDIS) -- Support WINUSB1.0、WINUSB2.0(with BOS) -- Support Vendor class - -CherryUSB Device Stack resource usage (GCC 10.2 with -O2): - -| file | FLASH (Byte) | No Cache RAM (Byte) | RAM (Byte) | Heap (Byte) | -|:-------------:|:--------------:|:-------------------------:|:-------------:|:----------------:| -|usbd_core.c | 3263 | 384 | 17 | 0 | -|usbd_cdc.c | 490 | 0 | 0 | 0 | -|usbd_msc.c | 2772 | 128 + 512(default) | 16 | 0 | -|usbd_hid.c | 501 | 0 | 0 | 0 | -|usbd_audio.c | 1208 | 0 | 4 | 0 | -|usbd_video.c | 2272 | 0 | 82 | 0 | - -## Host Stack Overview - -The CherryUSB Host Stack has a standard enumeration implementation for devices mounted on roothubs and external hubs, and a standard interface for different Classes to indicate what the Class driver needs to do after enumeration and after disconnection. A standard hcd porting interface has also been standardised for adapting different USB IPs for IP-oriented programming. Finally, the host stack is managed using os, and provides osal to make a adaptation for different os. - -CherryUSB Host Stack has the following functions: - -- Automatic loading of supported Class drivers -- Support blocking transfers and asynchronous transfers -- Support Composite Device -- Multi-level HUB support, expandable up to 7 levels -- Support Communication Device Class (CDC) -- Support Human Interface Device (HID) -- Support Mass Storage Class (MSC) -- Support USB Video CLASS -- Support USB Audio CLASS -- Support Remote NDIS (RNDIS) -- Support Vendor class - -The CherryUSB Host stack also provides the lsusb function, which allows you to view information about all mounted devices, including those on external hubs, with the help of a shell plugin. - -CherryUSB Host Stack resource usage (GCC 10.2 with -O2): - -| file | FLASH (Byte) | No Cache RAM (Byte) | RAM (Byte) | Heap (Byte) | -|:-------------:|:--------------:|:-------------------------------:|:---------------------------:|:-------------------------------:| -|usbh_core.c | 4417 | 512 | 28 | sizeof(struct usbh_urb) | -|usbh_hub.c | 4895 | 32 + 1* (1+n) | 16 + sizeof(struct usbh_hub) * (1+n) | 0 | -|usbh_cdc_acm.c | 1064 | 7 | 4 | sizeof(struct usbh_cdc_acm) * x | -|usbh_msc.c | 1776 | 32 | 4 | sizeof(struct usbh_msc) * x | -|usbh_hid.c | 922 | 128 | 4 | sizeof(struct usbh_hid) * x | -|usbh_video.c | 3592 | 128 | 4 | sizeof(struct usbh_video) * x | -|usbh_audio.c | 3230 | 128 | 4 | sizeof(struct usbh_audio) * x | - -Among them, `sizeof(struct usbh_hub)` and `sizeof(struct usbh_hubport)` are affected by the following macros: - -``` -#define CONFIG_USBHOST_MAX_EXTHUBS 1 -#define CONFIG_USBHOST_MAX_EHPORTS 4 -#define CONFIG_USBHOST_MAX_INTERFACES 6 -#define CONFIG_USBHOST_MAX_INTF_ALTSETTINGS 1 -#define CONFIG_USBHOST_MAX_ENDPOINTS 4 -``` - -## Documentation Tutorial - -Quickly start, USB basic concepts, API manual, Class basic concepts and examples, see [CherryUSB Documentation Tutorial](https://cherryusb.readthedocs.io/) - -## Video Tutorial - -USB basic concepts and how the CherryUSB Device stack is implemented, see [CherryUSB Device Stack Tutorial](https://www.bilibili.com/video/BV1Ef4y1t73d). - -## Graphical Config Tool - -[chryusb_configurator](https://github.com/Egahp/chryusb_configurator) is written in **electron + vite2 + ts** framework,currently used to automate the generation of descriptor arrays, with additional functionality to be added later. - -## Demo Repo - -Note: After version 0.4.1, the dcd drivers have been refactored and some repositories are not maintained for a long time, so if you use a higher version, you need to update it yourself. - -| Manufacturer | CHIP or Series | USB IP| Repo Url |Corresponds to master version| -|:--------------------:|:------------------:|:-----:|:--------:|:---------------------------:| -|Bouffalolab | BL702/BL616/BL808 | bouffalolab/ehci|[bl_mcu_sdk](https://github.com/CherryUSB/cherryusb_bouffalolab)| latest | -|ST | STM32F103C8T6 | fsdev |[stm32f103_repo](https://github.com/sakumisu/CherryUSB/tree/master/demo/stm32/usb_device/stm32f103c8t6)|latest | -|ST | STM32F4 | dwc2 |[stm32f429_device_repo](https://github.com/sakumisu/CherryUSB/tree/master/demo/stm32/usb_device/stm32f429igt6) [stm32f429_host_repo](https://github.com/sakumisu/CherryUSB/tree/master/demo/stm32/usb_host/stm32f429igt6)|latest | -|ST | STM32H7 | dwc2 |[stm32h743_device_repo](https://github.com/sakumisu/CherryUSB/tree/master/demo/stm32/usb_device/stm32h743vbt6) [stm32h743_host_repo](https://github.com/sakumisu/CherryUSB/tree/master/demo/stm32/usb_host/stm32h743xih6)|latest | -|HPMicro | HPM6750 | hpm/ehci |[hpm_repo](https://github.com/CherryUSB/cherryusb_hpmicro)|v0.6.0 | -|Essemi | ES32F36xx | musb |[es32f369_repo](https://github.com/sakumisu/CherryUSB/tree/master/demo/es32)|latest | -|AllwinnerTech | F1C100S | musb |[cherryusb_rtt_f1c100s](https://github.com/CherryUSB/cherryusb_rtt_f1c100s)|latest | -|Phytium | e2000 | xhci |[phytium _repo](https://gitee.com/phytium_embedded/phytium-standalone-sdk)|latest | -|Raspberry pi | rp2040 | rp2040 |[rp2040_repo](https://github.com/sakumisu/CherryUSB/tree/master/demo/rp2040)|latest | -|WCH | CH32V307/ch58x | ch32_usbfs/ch32_usbhs/ch58x |[wch_repo](https://github.com/CherryUSB/cherryusb_wch)|latest | -|Nordicsemi | Nrf52840 | nrf5x |[nrf5x_repo](https://github.com/CherryUSB/cherryusb_nrf5x)|latest | -|Nuvoton | Nuc442 | nuvoton |[nuc442_repo](https://github.com/CherryUSB/cherryusb_nuc442)|v0.4.1 | -|Geehy | APM32E10x APM32F0xx| fsdev |[apm32_repo](https://github.com/CherryUSB/cherryusb_apm32)|v0.4.1 | -|Espressif | esp32 | dwc2 |[esp32_repo](https://github.com/CherryUSB/cherryusb_esp32)|v0.4.1 | -|Mindmotion | MM32L3xx | mm32 |[mm32_repo](https://github.com/CherryUSB/cherryusb_mm32)|v0.4.1 | - -## Contact - -QQ group: 642693751 \ No newline at end of file diff --git a/third-party/cherryusb/README_zh.md b/third-party/cherryusb/README_zh.md deleted file mode 100644 index 2441589c55f00e3eaa0adeb35cbaccff5f8eea99..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/README_zh.md +++ /dev/null @@ -1,155 +0,0 @@ -# CherryUSB - -[English](./README.md) - -CherryUSB 是一个小而美的、可移植性高的、用于嵌入式系统(带 USB ip)的 USB 主从协议栈。 - -![CherryUSB](./docs/assets/usb_outline.png) - -## 为什么选择 - -- 代码精简,并且内存占用极小,详细参考下面表格,而且还可进一步的裁剪 -- 全面的 class 驱动,并且主从 class 驱动全部模板化,方便用户增加新的 class 驱动以及学习的时候查找规律 -- 可供用户使用的 API 非常少,并且分类清晰。从机:初始化 + 注册类、命令回调类、数据收发类;主机:初始化 + 查找类、数据收发类 -- 树状化编程,代码层层递进,方便用户理清函数调用关系、枚举和 class 驱动加载过程 -- 标准化的 porting 接口,相同 ip 无需重写驱动,并且 porting 驱动也进行了模板化,方便用户新增 porting。 -- 主从收发接口的使用等价于 uart tx/rx dma 的使用,长度也没有限制 -- 能够达到 USB 硬件理论带宽 - -## 目录结构 - -``` -. -├── class -├── common -├── core -├── demo -├── docs -├── osal -├── packet capture -└── port -└── tools -``` - -| 目录名 | 描述 | -|:-------------:|:------------------------------:| -|class | usb class 类主从驱动 | -|common | usb spec 定义、常用宏、标准接口定义 | -|core | usb 主从协议栈核心实现 | -|demo | 示例 | -|docs | 文档 | -|osal | os 封装层 | -|packet capture | 抓包文件(需要使用力科软件打开)| -|port | usb 主从需要实现的 porting 接口 | -|tools | 工具链接 | - -## Device 协议栈简介 - -CherryUSB Device 协议栈对标准设备请求、CLASS 请求、VENDOR 请求以及 custom 特殊请求规范了一套统一的函数框架,采用面向对象和链表的方式,能够使得用户快速上手复合设备,不用管底层的逻辑。同时,规范了一套标准的 dcd porting 接口,用于适配不同的 USB IP,达到面向 ip 编程。 - -CherryUSB Device 协议栈当前实现以下功能: - -- 支持 USB2.0 全速和高速设备 -- 支持端点中断注册功能,porting 给用户自己处理中断里的数据 -- 支持复合设备 -- 支持 Communication Device Class (CDC) -- 支持 Human Interface Device (HID) -- 支持 Mass Storage Class (MSC) -- 支持 USB VIDEO CLASS (UVC1.0、UVC1.5) -- 支持 USB AUDIO CLASS (UAC1.0、UAC2.0) -- 支持 Device Firmware Upgrade CLASS (DFU) -- 支持 USB MIDI CLASS (MIDI) -- 支持 Remote NDIS (RNDIS) -- 支持 WINUSB1.0、WINUSB2.0(带 BOS ) -- 支持 Vendor 类 class - -CherryUSB Device 协议栈资源占用说明(GCC 10.2 with -O2): - -| file | FLASH (Byte) | No Cache RAM (Byte) | RAM (Byte) | Heap (Byte) | -|:-------------:|:--------------:|:-------------------------:|:-------------:|:----------------:| -|usbd_core.c | 3263 | 384 | 17 | 0 | -|usbd_cdc.c | 490 | 0 | 0 | 0 | -|usbd_msc.c | 2772 | 128 + 512(default) | 16 | 0 | -|usbd_hid.c | 501 | 0 | 0 | 0 | -|usbd_audio.c | 1208 | 0 | 4 | 0 | -|usbd_video.c | 2272 | 0 | 82 | 0 | - -## Host 协议栈简介 - -CherryUSB Host 协议栈对挂载在 roothub、外部 hub 上的设备规范了一套标准的枚举实现,对不同的 Class 类也规范了一套标准接口,用来指示在枚举后和断开连接后该 Class 驱动需要做的事情。同时,规范了一套标准的 hcd porting 接口,用于适配不同的 USB IP,达到面向 IP 编程。最后,协议栈使用 OS 管理,并提供了 osal 用来适配不同的 os。 - -CherryUSB Host 协议栈当前实现以下功能: - -- 自动加载支持的Class 驱动 -- 支持阻塞式传输和异步传输 -- 支持复合设备 -- 支持多级 HUB,最高可拓展到 7 级 -- 支持 Communication Device Class (CDC) -- 支持 Human Interface Device (HID) -- 支持 Mass Storage Class (MSC) -- Support USB Video CLASS -- Support USB Audio CLASS -- 支持 Remote NDIS (RNDIS) -- 支持 Vendor 类 class - -同时,CherryUSB Host 协议栈还提供了 lsusb 的功能,借助 shell 插件可以查看所有挂载设备的信息,包括外部 hub 上的设备的信息。 - -CherryUSB Host 协议栈资源占用说明(GCC 10.2 with -O2): - -| file | FLASH (Byte) | No Cache RAM (Byte) | RAM (Byte) | Heap (Byte) | -|:-------------:|:--------------:|:-------------------------------:|:---------------------------:|:-------------------------------:| -|usbh_core.c | 4417 | 512 | 28 | sizeof(struct usbh_urb) | -|usbh_hub.c | 4895 | 32 + 1* (1+n) | 16 + sizeof(struct usbh_hub) * (1+n) | 0 | -|usbh_cdc_acm.c | 1064 | 7 | 4 | sizeof(struct usbh_cdc_acm) * x | -|usbh_msc.c | 1776 | 32 | 4 | sizeof(struct usbh_msc) * x | -|usbh_hid.c | 922 | 128 | 4 | sizeof(struct usbh_hid) * x | -|usbh_video.c | 3592 | 128 | 4 | sizeof(struct usbh_video) * x | -|usbh_audio.c | 3230 | 128 | 4 | sizeof(struct usbh_audio) * x | - -其中,`sizeof(struct usbh_hub)` 和 `sizeof(struct usbh_hubport)` 受以下宏影响: - -``` -#define CONFIG_USBHOST_MAX_EXTHUBS 1 -#define CONFIG_USBHOST_MAX_EHPORTS 4 -#define CONFIG_USBHOST_MAX_INTERFACES 6 -#define CONFIG_USBHOST_MAX_INTF_ALTSETTINGS 1 -#define CONFIG_USBHOST_MAX_ENDPOINTS 4 -``` - -## 文档教程 - -CherryUSB 快速入门、USB 基本概念,API 手册,Class 基本概念和例程,参考 [CherryUSB 文档教程](https://cherryusb.readthedocs.io/) - -## 视频教程 - -USB 基本知识点与 CherryUSB Device 协议栈是如何编写的,参考 [CherryUSB Device 协议栈教程](https://www.bilibili.com/video/BV1Ef4y1t73d). - -## 图形化界面配置工具 - -[chryusb_configurator](https://github.com/Egahp/chryusb_configurator) 采用 **electron + vite2 + ts** 框架编写,当前用于自动化生成描述符数组,后续会增加其他功能。 - -## 示例仓库 - -注意:0.4.1 版本以后 dcd 驱动进行了重构,部分仓库不做长期维护,所以如果使用高版本需要自行更新 - -| 厂商 | 芯片或者系列 | USB IP| 仓库链接 | 对应 master 版本 | -|:--------------------:|:------------------:|:-----:|:--------:|:---------------------------:| -|Bouffalolab | BL702/BL616/BL808 | bouffalolab/ehci|[bl_mcu_sdk](https://github.com/CherryUSB/cherryusb_bouffalolab)| latest | -|ST | STM32F103C8T6 | fsdev |[stm32f103_repo](https://github.com/sakumisu/CherryUSB/tree/master/demo/stm32/usb_device/stm32f103c8t6)|latest | -|ST | STM32F4 | dwc2 |[stm32f429_device_repo](https://github.com/sakumisu/CherryUSB/tree/master/demo/stm32/usb_device/stm32f429igt6) [stm32f429_host_repo](https://github.com/sakumisu/CherryUSB/tree/master/demo/stm32/usb_host/stm32f429igt6)|latest | -|ST | STM32H7 | dwc2 |[stm32h743_device_repo](https://github.com/sakumisu/CherryUSB/tree/master/demo/stm32/usb_device/stm32h743vbt6) [stm32h743_host_repo](https://github.com/sakumisu/CherryUSB/tree/master/demo/stm32/usb_host/stm32h743xih6)|latest | -|HPMicro | HPM6750 | hpm/ehci |[hpm_repo](https://github.com/CherryUSB/cherryusb_hpmicro)|v0.6.0 | -|Essemi | ES32F36xx | musb |[es32f369_repo](https://github.com/sakumisu/CherryUSB/tree/master/demo/es32)|latest | -|AllwinnerTech | F1C100S | musb |[cherryusb_rtt_f1c100s](https://github.com/CherryUSB/cherryusb_rtt_f1c100s)|latest | -|Phytium | e2000 | xhci |[phytium _repo](https://gitee.com/phytium_embedded/phytium-standalone-sdk)|latest | -|Raspberry pi | rp2040 | rp2040 |[rp2040_repo](https://github.com/sakumisu/CherryUSB/tree/master/demo/rp2040)|latest | -|WCH | CH32V307/ch58x | ch32_usbfs/ch32_usbhs/ch58x |[wch_repo](https://github.com/CherryUSB/cherryusb_wch)|latest | -|Nordicsemi | Nrf52840 | nrf5x |[nrf5x_repo](https://github.com/CherryUSB/cherryusb_nrf5x)|latest | -|Nuvoton | Nuc442 | nuvoton |[nuc442_repo](https://github.com/CherryUSB/cherryusb_nuc442)|v0.4.1 | -|Geehy | APM32E10x APM32F0xx| fsdev |[apm32_repo](https://github.com/CherryUSB/cherryusb_apm32)|v0.4.1 | -|Espressif | esp32 | dwc2 |[esp32_repo](https://github.com/CherryUSB/cherryusb_esp32)|v0.4.1 | -|Mindmotion | MM32L3xx | mm32 |[mm32_repo](https://github.com/CherryUSB/cherryusb_mm32)|v0.4.1 | - -## Contact - -QQ 群:642693751 \ No newline at end of file diff --git a/third-party/cherryusb/class/audio/usb_audio.h b/third-party/cherryusb/class/audio/usb_audio.h deleted file mode 100644 index cdb0bd988900c39d295461bb1b279757d808d355..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/audio/usb_audio.h +++ /dev/null @@ -1,1095 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_AUDIO_H -#define USB_AUDIO_H - -/** Audio Interface Subclass Codes - * Refer to Table A-2 from audio10.pdf - */ -#define AUDIO_SUBCLASS_UNDEFINED 0x00 -#define AUDIO_SUBCLASS_AUDIOCONTROL 0x01 -#define AUDIO_SUBCLASS_AUDIOSTREAMING 0x02 -#define AUDIO_SUBCLASS_MIDISTREAMING 0x03 - -#define AUDIO_PROTOCOL_UNDEFINED 0x00 -#define AUDIO_PROTOCOLv20 0x20 /* IP version 2.0 */ - -/** Audio Class-Specific Request Codes - * Refer to Table A-9 from audio10.pdf - */ -#define AUDIO_REQUEST_UNDEFINED 0x00 -#define AUDIO_REQUEST_SET_CUR 0x01 -#define AUDIO_REQUEST_GET_CUR 0x81 -#define AUDIO_REQUEST_SET_MIN 0x02 -#define AUDIO_REQUEST_GET_MIN 0x82 -#define AUDIO_REQUEST_SET_MAX 0x03 -#define AUDIO_REQUEST_GET_MAX 0x83 -#define AUDIO_REQUEST_SET_RES 0x04 -#define AUDIO_REQUEST_GET_RES 0x84 -#define AUDIO_REQUEST_SET_MEM 0x05 -#define AUDIO_REQUEST_GET_MEM 0x85 -#define AUDIO_REQUEST_GET_STAT 0xFF - -/** Audio Class-Specific Request Codes - * Refer from audio20_final.pdf - */ -#define AUDIO_REQUEST_CUR 0x01 -#define AUDIO_REQUEST_RANGE 0x02 -/** Audio Class-Specific Control Interface Descriptor Subtypes - * Refer to Table A-5 from audio10.pdf - */ -#define AUDIO_CONTROL_UNDEF 0x01U -#define AUDIO_CONTROL_HEADER 0x01U -#define AUDIO_CONTROL_INPUT_TERMINAL 0x02U -#define AUDIO_CONTROL_OUTPUT_TERMINAL 0x03U -#define AUDIO_CONTROL_MIXER_UNIT 0x04U -#define AUDIO_CONTROL_SELECTOR_UNIT 0x05U -#define AUDIO_CONTROL_FEATURE_UNIT 0x06U -#define AUDIO_CONTROL_EFFECT_UNIT 0x07U -#define AUDIO_CONTROL_PROCESSING_UNIT 0x08U -#define AUDIO_CONTROL_EXTENSION_UNIT 0x09U -#define AUDIO_CONTROL_CLOCK_SOURCE 0x0aU -#define AUDIO_CONTROL_CLOCK_SELECTOR 0x0bU -#define AUDIO_CONTROL_CLOCK_MULTIPLIER 0x0cU -#define AUDIO_CONTROL_SAMPLERATE_CONVERTER 0x0dU - -/** Audio Class-Specific AS Interface Descriptor Subtypes - * Refer to Table A-6 from audio10.pdf - */ -#define AUDIO_STREAMING_UNDEFINED 0x00U -#define AUDIO_STREAMING_GENERAL 0x01U -#define AUDIO_STREAMING_FORMAT_TYPE 0x02U -#define AUDIO_STREAMING_ENCODER 0x03U -#define AUDIO_STREAMING_DECODER 0x04U - -/* Clock Source Descriptor Clock Types */ -#define AUDIO_CLKSRC_EXTERNAL 0x00 /* External clock */ -#define AUDIO_CLKSRC_INTERNAL_FIXED 0x01 /* Internal fixed clock */ -#define AUDIO_CLKSRC_INTERNAL_VAR 0x02 /* Internal variable clock */ -#define AUDIO_CLKSRC_INTERNAL_PROG 0x03 /* Internal programmable clock */ - -/* Effect Unit Effect Types */ -#define AUDIO_EFFECT_UNDEF 0x00 -#define AUDIO_EFFECT_PARAM_EQ_SECTION 0x01 -#define AUDIO_EFFECT_REVERBERATION 0x02 -#define AUDIO_EFFECT_MOD_DELAY 0x03 -#define AUDIO_EFFECT_DYN_RANGE_COMP 0x04 - -/* Processing Unit Process Types */ -#define AUDIO_PROCESS_UNDEFINED 0x00 -#define AUDIO_PROCESS_UPDOWNMIX 0x01 -#define AUDIO_PROCESS_DOLBY_PROLOGIC 0x02 -#define AUDIO_PROCESS_STEREO_EXTENDER 0x03 - -/* Audio Class-Specific Endpoint Descriptor Subtypes */ -#define AUDIO_ENDPOINT_UNDEFINED 0x00U -#define AUDIO_ENDPOINT_GENERAL 0x01U - -/* Feature Unit Control Bits */ -#define AUDIO_CONTROL_MUTE 0x0001 -#define AUDIO_CONTROL_VOLUME 0x0002 -#define AUDIO_CONTROL_BASS 0x0004 -#define AUDIO_CONTROL_MID 0x0008 -#define AUDIO_CONTROL_TREBLE 0x0010 -#define AUDIO_CONTROL_GRAPHIC_EQUALIZER 0x0020 -#define AUDIO_CONTROL_AUTOMATIC_GAIN 0x0040 -#define AUDIO_CONTROL_DEALY 0x0080 -#define AUDIO_CONTROL_BASS_BOOST 0x0100 -#define AUDIO_CONTROL_LOUDNESS 0x0200 - -/* Encoder Type Codes */ -#define AUDIO_ENCODER_UNDEF 0x00 -#define AUDIO_ENCODER_OTHER 0x01 -#define AUDIO_ENCODER_MPEG 0x02 -#define AUDIO_ENCODER_AC3 0x03 -#define AUDIO_ENCODER_WMA 0x04 -#define AUDIO_ENCODER_DTS 0x05 - -/* Decoder Type Codes */ -#define AUDIO_DECODER_UNDEF 0x00 -#define AUDIO_DECODER_OTHER 0x01 -#define AUDIO_DECODER_MPEG 0x02 -#define AUDIO_DECODER_AC3 0x03 -#define AUDIO_DECODER_WMA 0x04 -#define AUDIO_DECODER_DTS 0x05 - -/* Audio Descriptor Types */ -#define AUDIO_UNDEFINED_DESCRIPTOR_TYPE 0x20 -#define AUDIO_DEVICE_DESCRIPTOR_TYPE 0x21 -#define AUDIO_CONFIGURATION_DESCRIPTOR_TYPE 0x22 -#define AUDIO_STRING_DESCRIPTOR_TYPE 0x23 -#define AUDIO_INTERFACE_DESCRIPTOR_TYPE 0x24 -#define AUDIO_ENDPOINT_DESCRIPTOR_TYPE 0x25 - -/* Audio Data Format Type I Codes */ -#define AUDIO_FORMAT_TYPE_I_UNDEFINED 0x0000 -#define AUDIO_FORMAT_PCM 0x0001 -#define AUDIO_FORMAT_PCM8 0x0002 -#define AUDIO_FORMAT_IEEE_FLOAT 0x0003 -#define AUDIO_FORMAT_ALAW 0x0004 -#define AUDIO_FORMAT_MULAW 0x0005 - -#define AUDIO_V2_FORMAT_PCM 0x00000001 -#define AUDIO_V2_FORMAT_PCM8 0x00000002 -#define AUDIO_V2_FORMAT_IEEE_FLOAT 0x00000004 -#define AUDIO_V2_FORMAT_ALAW 0x00000008 -#define AUDIO_V2_FORMAT_MULAW 0x00000010 - -/* bmChannelConfig: a bitmap field that indicates which spatial locations - * are occupied by the channels present in the cluster. The bit allocations - * are as follows: - */ -#define AUDIO_CHANNEL_M 0 /* Mono */ -#define AUDIO_CHANNEL_FL (1 << 0) /* Front Left */ -#define AUDIO_CHANNEL_FR (1 << 1) /* Front Right */ -#define AUDIO_CHANNEL_FC (1 << 2) /* Front Center */ -#define AUDIO_CHANNEL_LFE (1 << 3) /* Low Frequency Effects */ -#define AUDIO_CHANNEL_BL (1 << 4) /* Back Left */ -#define AUDIO_CHANNEL_BR (1 << 5) /* Back Right */ -#define AUDIO_CHANNEL_FLC (1 << 6) /* Front Left of Center */ -#define AUDIO_CHANNEL_FRC (1 << 7) /* Front Right of Center */ -#define AUDIO_CHANNEL_BC (1 << 8) /* Back Center */ -#define AUDIO_CHANNEL_SL (1 << 9) /* Side Left */ -#define AUDIO_CHANNEL_SR (1 << 10) /* Side Right */ -#define AUDIO_CHANNEL_TC (1 << 11) /* Top Center */ -#define AUDIO_CHANNEL_TFL (1 << 12) /* Top Front Left */ -#define AUDIO_CHANNEL_TFC (1 << 13) /* Top Front Center */ -#define AUDIO_CHANNEL_TFR (1 << 14) /* Top Front Right */ -#define AUDIO_CHANNEL_TBL (1 << 15) /* Top Back Left */ -#define AUDIO_CHANNEL_TBC (1 << 16) /* Top Back Center */ -#define AUDIO_CHANNEL_TBR (1 << 17) /* Top Back Right */ -#define AUDIO_CHANNEL_TFLC (1 << 18) /* Top Front Left of Center */ -#define AUDIO_CHANNEL_TFRC (1 << 19) /* Top Front Right of Center */ -#define AUDIO_CHANNEL_LLFE (1 << 20) /* Left Low Frequency Effects */ -#define AUDIO_CHANNEL_RLFE (1 << 21) /* Right Low Frequency Effects */ -#define AUDIO_CHANNEL_TSL (1 << 22) /* Top Side Left */ -#define AUDIO_CHANNEL_TSR (1 << 23) /* Top Side Right */ -#define AUDIO_CHANNEL_BOC (1 << 24) /* Bottom Center */ -#define AUDIO_CHANNEL_BLC (1 << 25) /* Back Left of Center */ -#define AUDIO_CHANNEL_BRC (1 << 26) /* Back Right of Center */ - /* Bits 27-30: Reserved */ -#define AUDIO_CHANNEL_RD (1 << 31) /* Raw Data */ - -/* Audio Function Category Codes */ -#define AUDIO_CATEGORY_UNDEF 0x00 /* Undefined */ -#define AUDIO_CATEGORY_SPEAKER 0x01 /* Desktop speaker */ -#define AUDIO_CATEGORY_THEATER 0x02 /* Home theater */ -#define AUDIO_CATEGORY_MICROPHONE 0x03 /* Microphone */ -#define AUDIO_CATEGORY_HEADSET 0x04 /* Headset */ -#define AUDIO_CATEGORY_TELEPHONE 0x05 /* Telephone */ -#define AUDIO_CATEGORY_CONVERTER 0x06 /* Converter */ -#define AUDIO_CATEGORY_RECORDER 0x07 /* Voice/Sound recorder */ -#define AUDIO_CATEGORY_IO_BOX 0x08 /* I/O box */ -#define AUDIO_CATEGORY_INSTRUMENT 0x09 /* Musical instrument */ -#define AUDIO_CATEGORY_PROAUDIO 0x0a /* Pro-audio */ -#define AUDIO_CATEGORY_AV 0x0b /* Audio/video */ -#define AUDIO_CATEGORY_CONTROL 0x0c /* Control panel */ -#define AUDIO_CATEGORY_OTHER 0xff - -/* Clock Source Control Selectors */ -#define AUDIO_CS_CONTROL_UNDEF 0x00 -#define AUDIO_CS_CONTROL_SAM_FREQ 0x01 -#define AUDIO_CS_CONTROL_CLOCK_VALID 0x02 - -/* Clock Selector Control Selectors */ -#define AUDIO_CX_CONTROL_UNDEF 0x00 -#define AUDIO_CX_CONTROL_CLOCKSEL 0x01 - -/* Clock Multiplier Control Selectors */ -#define AUDIO_CM_CONTROL_UNDEF 0x00 -#define AUDIO_CM_CONTROL_NUMERATOR 0x01 -#define AUDIO_CM_CONTROL_DENOMINATOR 0x02 - -/* Terminal Control Selectors */ -#define AUDIO_TE_CONTROL_UNDEF 0x00 -#define AUDIO_TE_CONTROL_COPY_PROTECT 0x01 -#define AUDIO_TE_CONTROL_CONNECTOR 0x02 -#define AUDIO_TE_CONTROL_OVERLOAD 0x03 -#define AUDIO_TE_CONTROL_CLUSTER 0x04 -#define AUDIO_TE_CONTROL_UNDERFLOW 0x05 -#define AUDIO_TE_CONTROL_OVERFLOW 0x06 -#define AUDIO_TE_CONTROL_LATENCY 0x07 - -/* Mixer Control Selectors */ -#define AUDIO_MU_CONTROL_UNDEF 0x00 -#define AUDIO_MU_CONTROL_MIXER 0x01 -#define AUDIO_MU_CONTROL_CLUSTER 0x02 -#define AUDIO_MU_CONTROL_UNDERFLOW 0x03 -#define AUDIO_MU_CONTROL_OVERFLOW 0x04 -#define AUDIO_MU_CONTROL_LATENCY 0x05 - -/* Selector Control Selectors */ -#define AUDIO_SU_CONTROL_UNDEFINE 0x00 -#define AUDIO_SU_CONTROL_SELECTOR 0x01 -#define AUDIO_SU_CONTROL_LATENCY 0x02 - -/* Feature Unit Control Selectors */ -#define AUDIO_FU_CONTROL_UNDEF 0x00 -#define AUDIO_FU_CONTROL_MUTE 0x01 -#define AUDIO_FU_CONTROL_VOLUME 0x02 -#define AUDIO_FU_CONTROL_BASS 0x03 -#define AUDIO_FU_CONTROL_MID 0x04 -#define AUDIO_FU_CONTROL_TREBLE 0x05 -#define AUDIO_FU_CONTROL_EQUALIZER 0x06 -#define AUDIO_FU_CONTROL_AGC 0x07 -#define AUDIO_FU_CONTROL_DELAY 0x08 -#define AUDIO_FU_CONTROL_BASS_BOOST 0x09 -#define AUDIO_FU_CONTROL_LOUDNESS 0x0a -#define AUDIO_FU_CONTROL_INP_GAIN 0x0b -#define AUDIO_FU_CONTROL_INP_GAIN_PAD 0x0c -#define AUDIO_FU_CONTROL_PHASE_INVERT 0x0d -#define AUDIO_FU_CONTROL_UNDERFLOW 0x0e -#define AUDIO_FU_CONTROL_OVERFLOW 0x0f -#define AUDIO_FU_CONTROL_LATENCY 0x10 - -#define AUDIO_V2_FU_CONTROL_UNDEF 0x00 -#define AUDIO_V2_FU_CONTROL_MUTE (0x03 << 0) -#define AUDIO_V2_FU_CONTROL_VOLUME (0x03 << 2) -#define AUDIO_V2_FU_CONTROL_BASS (0x03 << 4) -#define AUDIO_V2_FU_CONTROL_MID (0x03 << 6) -#define AUDIO_V2_FU_CONTROL_TREBLE (0x03 << 8) -#define AUDIO_V2_FU_CONTROL_EQUALIZER (0x03 << 10) -#define AUDIO_V2_FU_CONTROL_AGC (0x03 << 12) -#define AUDIO_V2_FU_CONTROL_DELAY (0x03 << 14) -#define AUDIO_V2_FU_CONTROL_BASS_BOOST (0x03 << 16) -#define AUDIO_V2_FU_CONTROL_LOUDNESS (0x03 << 18) -#define AUDIO_V2_FU_CONTROL_INP_GAIN (0x03 << 20) -#define AUDIO_V2_FU_CONTROL_INP_GAIN_PAD (0x03 << 22) -#define AUDIO_V2_FU_CONTROL_PHASE_INVERT (0x03 << 24) -#define AUDIO_V2_FU_CONTROL_UNDERFLOW (0x03 << 26) -#define AUDIO_V2_FU_CONTROL_OVERFLOW (0x03 << 28) - -/* Parametric Equalizer Section Effect Unit Control Selectors */ -#define AUDIO_PE_CONTROL_UNDEF 0x00 -#define AUDIO_PE_CONTROL_ENABLE 0x01 -#define AUDIO_PE_CONTROL_CENTERFREQ 0x02 -#define AUDIO_PE_CONTROL_QFACTOR 0x03 -#define AUDIO_PE_CONTROL_GAIN 0x04 -#define AUDIO_PE_CONTROL_UNDERFLOW 0x05 -#define AUDIO_PE_CONTROL_OVERFLOW 0x06 -#define AUDIO_PE_CONTROL_LATENCY 0x07 - -/* Reverberation Effect Unit Control Selectors */ -#define AUDIO_RV_CONTROL_UNDEF 0x00 -#define AUDIO_RV_CONTROL_ENABLE 0x01 -#define AUDIO_RV_CONTROL_TYPE 0x02 -#define AUDIO_RV_CONTROL_LEVEL 0x03 -#define AUDIO_RV_CONTROL_TIME 0x04 -#define AUDIO_RV_CONTROL_FEEDBACK 0x05 -#define AUDIO_RV_CONTROL_PREDELAY 0x06 -#define AUDIO_RV_CONTROL_DENSITY 0x07 -#define AUDIO_RV_CONTROL_HF_ROLLOFF 0x08 -#define AUDIO_RV_CONTROL_UNDERFLOW 0x09 -#define AUDIO_RV_CONTROL_OVERFLOW 0x0a -#define AUDIO_RV_CONTROL_LATENCY 0x0b - -/* Modulation Delay Effect Unit Control Selectors */ -#define AUDIO_MD_CONTROL_UNDEF 0x00 -#define AUDIO_MD_CONTROL_ENABLE 0x01 -#define AUDIO_MD_CONTROL_BALANCE 0x02 -#define AUDIO_MD_CONTROL_RATE 0x03 -#define AUDIO_MD_CONTROL_DEPTH 0x04 -#define AUDIO_MD_CONTROL_TIME 0x05 -#define AUDIO_MD_CONTROL_FEEDBACK 0x06 -#define AUDIO_MD_CONTROL_UNDERFLOW 0x07 -#define AUDIO_MD_CONTROL_OVERFLOW 0x08 -#define AUDIO_MD_CONTROL_LATENCY 0x09 - -/* Dynamic Range Compressor Effect Unit Control Selectors */ -#define AUDIO_DR_CONTROL_UNDEF 0x00 -#define AUDIO_DR_CONTROL_ENABLE 0x01 -#define AUDIO_DR_CONTROL_COMP_RATE 0x02 -#define AUDIO_DR_CONTROL_MAXAMPL 0x03 -#define AUDIO_DR_CONTROL_THRESHOLD 0x04 -#define AUDIO_DR_CONTROL_ATTACK_TIME 0x05 -#define AUDIO_DR_CONTROL_RELEASE_TIME 0x06 -#define AUDIO_DR_CONTROL_UNDERFLOW 0x07 -#define AUDIO_DR_CONTROL_OVERFLOW 0x08 -#define AUDIO_DR_CONTROL_LATENCY 0x09 - -/* Up/Down-mix Processing Unit Control Selectors */ -#define AUDIO_UD_CONTROL_UNDEF 0x00 -#define AUDIO_UD_CONTROL_ENABLE 0x01 -#define AUDIO_UD_CONTROL_MODE_SELECT 0x02 -#define AUDIO_UD_CONTROL_CLUSTER 0x03 -#define AUDIO_UD_CONTROL_UNDERFLOW 0x04 -#define AUDIO_UD_CONTROL_OVERFLOW 0x05 -#define AUDIO_UD_CONTROL_LATENCY 0x06 - -/* Dolby Prologic?Processing Unit Control Selectors */ -#define AUDIO_DP_CONTROL_UNDEF 0x00 -#define AUDIO_DP_CONTROL_ENABLE 0x01 -#define AUDIO_DP_CONTROL_MODE_SELECT 0x02 -#define AUDIO_DP_CONTROL_CLUSTER 0x03 -#define AUDIO_DP_CONTROL_UNDERFLOW 0x04 -#define AUDIO_DP_CONTROL_OVERFLOW 0x05 -#define AUDIO_DP_CONTROL_LATENCY 0x06 - -/* Stereo Extender Processing Unit Control Selectors */ -#define AUDIO_STEXT_CONTROL_UNDEF 0x00 -#define AUDIO_STEXT_CONTROL_ENABLE 0x01 -#define AUDIO_STEXT_CONTROL_WIDTH 0x02 -#define AUDIO_STEXT_CONTROL_UNDERFLOW 0x03 -#define AUDIO_STEXT_CONTROL_OVERFLOW 0x04 -#define AUDIO_STEXT_CONTROL_LATENCY 0x05 - -/* Extension Unit Control Selectors */ - -#define AUDIO_XU_CONTROL_UNDEF 0x00 -#define AUDIO_XU_CONTROL_ENABLE 0x01 -#define AUDIO_XU_CONTROL_CLUSTER 0x02 -#define AUDIO_XU_CONTROL_UNDERFLOW 0x03 -#define AUDIO_XU_CONTROL_OVERFLOW 0x04 -#define AUDIO_XU_CONTROL_LATENCY 0x05 - -/* AudioStreaming Interface Control Selectors */ - -#define AUDIO_AS_CONTROL_UNDEF 0x00 -#define AUDIO_AS_CONTROL_ACT_ALT 0x01 -#define AUDIO_AS_CONTROL_VAL_ALT 0x02 -#define AUDIO_AS_CONTROL_AUDIO_FORMAT 0x03 - -/* Encoder Control Selectors */ - -#define AUDIO_EN_CONTROL_UNDEF 0x00 -#define AUDIO_EN_CONTROL_BIT_RATE 0x01 -#define AUDIO_EN_CONTROL_QUALITY 0x02 -#define AUDIO_EN_CONTROL_VBR 0x03 -#define AUDIO_EN_CONTROL_TYPE 0x04 -#define AUDIO_EN_CONTROL_UNDERFLOW 0x05 -#define AUDIO_EN_CONTROL_OVERFLOW 0x06 -#define AUDIO_EN_CONTROL_ENCODER_ERR 0x07 -#define AUDIO_EN_CONTROL_PARAM1 0x08 -#define AUDIO_EN_CONTROL_PARAM2 0x09 -#define AUDIO_EN_CONTROL_PARAM3 0x0a -#define AUDIO_EN_CONTROL_PARAM4 0x0b -#define AUDIO_EN_CONTROL_PARAM5 0x0c -#define AUDIO_EN_CONTROL_PARAM6 0x0d -#define AUDIO_EN_CONTROL_PARAM7 0x0e -#define AUDIO_EN_CONTROL_PARAM8 0x0f - -/* MPEG Decoder Control Selectors */ - -#define AUDIO_MPGD_CONTROL_UNDEF 0x00 -#define AUDIO_MPGD_CONTROL_DUAL_CHAN 0x01 -#define AUDIO_MPGD_CONTROL_2ND_STEREO 0x02 -#define AUDIO_MPGD_CONTROL_MULTILING 0x03 -#define AUDIO_MPGD_CONTROL_DYN_RANGE 0x04 -#define AUDIO_MPGD_CONTROL_SCALING 0x05 -#define AUDIO_MPGD_CONTROL_HILO_SCALE 0x06 -#define AUDIO_MPGD_CONTROL_UNDERFLOW 0x07 -#define AUDIO_MPGD_CONTROL_OVERFLOW 0x08 -#define AUDIO_MPGD_CONTROL_DECODE_ERR 0x09 - -/* AC-3 Decoder Control Selectors */ - -#define AUDIO_AC3D_CONTROL_UNDEF 0x00 -#define AUDIO_AC3D_CONTROL_MODE 0x01 -#define AUDIO_AC3D_CONTROL_DYN_RANGE 0x02 -#define AUDIO_AC3D_CONTROL_SCALING 0x03 -#define AUDIO_AC3D_CONTROL_HILO_SCALE 0x04 -#define AUDIO_AC3D_CONTROL_UNDERFLOW 0x05 -#define AUDIO_AC3D_CONTROL_OVERFLOW 0x06 -#define AUDIO_AC3D_CONTROL_DECODE_ERR 0x07 - -/* WMA Decoder Control Selectors */ - -#define AUDIO_WMAD_CONTROL_UNDEF 0x00 -#define AUDIO_WMAD_CONTROL_UNDERFLOW 0x01 -#define AUDIO_WMAD_CONTROL_OVERFLOW 0x02 -#define AUDIO_WMAD_CONTROL_DECODE_ERR 0x03 - -/* DTS Decoder Control Selectors */ - -#define AUDIO_DTSD_CONTROL_UNDEF 0x00 -#define AUDIO_DTSD_CONTROL_UNDERFLOW 0x01 -#define AUDIO_DTSD_CONTROL_OVERFLOW 0x02 -#define AUDIO_DTSD_CONTROL_DECODE_ERR 0x03 - -/* Endpoint Control Selectors */ -#define AUDIO_EP_CONTROL_UNDEF 0x00 -#define AUDIO_EP_CONTROL_SAMPLING_FEQ 0x01 -#define AUDIO_EP_CONTROL_PITCH 0x02 - -/* Encoder Error Codes */ - -/* <0: Reserved for vendor extensions */ - -#define AUDIO_ENCODER_SUCCESS 0 /* No Error */ -#define AUDIO_ENCODER_ERROR_NOMEM 1 /* Out of Memory */ -#define AUDIO_ENCODER_ERROR_BW 2 /* Out of Bandwidth */ -#define AUDIO_ENCODER_ERROR_CYCLE 3 /* Out of Processing Cycles */ -#define AUDIO_ENCODER_ERROR_FRAME 4 /* General Format Frame Error */ -#define AUDIO_ENCODER_ERROR_TOOSMALL 5 /* Format Frame Too Small */ -#define AUDIO_ENCODER_ERROR_TOOBIG 6 /* Format Frame Too Large */ -#define AUDIO_ENCODER_ERROR_BADFORMAT 7 /* Bad Data Format */ -#define AUDIO_ENCODER_ERROR_NCHAN 8 /* Incorrect Number of Channels */ -#define AUDIO_ENCODER_ERROR_RATE 9 /* Incorrect Sampling Rate */ -#define AUDIO_ENCODER_ERROR_BITRATE 10 /* Unable to Meet Target Bitrate */ -#define AUDIO_ENCODER_ERROR_PARMS 11 /* Inconsistent Set of Parameters */ -#define AUDIO_ENCODER_ERROR_NOTREADY 12 /* Not Ready */ -#define AUDIO_ENCODER_ERROR_BUSY 13 /* Busy */ - /* >13: Reserved */ - -/* Format Type Codes */ - -#define AUDIO_FORMAT_TYPE_UNDEF 0x00 -#define AUDIO_FORMAT_TYPEI 0x01 -#define AUDIO_FORMAT_TYPEII 0x02 -#define AUDIO_FORMAT_TYPEIII 0x03 -#define AUDIO_FORMAT_TYPEIV 0x04 -#define AUDIO_FORMAT_EXT_TYPEI 0x81 -#define AUDIO_FORMAT_EXT_TYPEII 0x82 -#define AUDIO_FORMAT_EXT_TYPEIII 0x83 - -/* Audio Data Format Type I Bit Allocations */ - -#define AUDIO_FORMAT_TYPEI_PCM (1 << 0) -#define AUDIO_FORMAT_TYPEI_PCM8 (1 << 1) -#define AUDIO_FORMAT_TYPEI_IEEEFLOAT (1 << 2) -#define AUDIO_FORMAT_TYPEI_ALAW (1 << 3) -#define AUDIO_FORMAT_TYPEI_MULAW (1 << 4) -#define AUDIO_FORMAT_TYPEI_RAWDATA (1 << 31) - -/* Audio Data Format Type II Bit Allocations */ - -#define AUDIO_FORMAT_TYPEII_MPEG (1 << 0) -#define AUDIO_FORMAT_TYPEII_AC3 (1 << 1) -#define AUDIO_FORMAT_TYPEII_WMA (1 << 2) -#define AUDIO_FORMAT_TYPEII_DTS (1 << 3) -#define AUDIO_FORMAT_TYPEII_RAWDATA (1 << 31) - -/* Audio Data Format Type III Bit Allocations */ - -#define AUDIO_FORMAT_TYPEIII_IEC61937_AC3 (1 << 0) -#define AUDIO_FORMAT_TYPEIII_IEC61937_MPEG1_L1 (1 << 1) -#define AUDIO_FORMAT_TYPEIII_IEC61937_MPEG1_L2_3 (1 << 1) -#define AUDIO_FORMAT_TYPEIII_IEC61937_MPEG2_NOEXT (1 << 2) -#define AUDIO_FORMAT_TYPEIII_IEC61937_MPEG2_EXT (1 << 3) -#define AUDIO_FORMAT_TYPEIII_IEC61937_MPEG2_AAC_ADTS (1 << 4) -#define AUDIO_FORMAT_TYPEIII_IEC61937_MPEG2_L1_LS (1 << 5) -#define AUDIO_FORMAT_TYPEIII_IEC61937_MPEG2_L2_3_LS (1 << 6) -#define AUDIO_FORMAT_TYPEIII_IEC61937_DTS_I (1 << 7) -#define AUDIO_FORMAT_TYPEIII_IEC61937_DTS_II (1 << 8) -#define AUDIO_FORMAT_TYPEIII_IEC61937_DTS_III (1 << 9) -#define AUDIO_FORMAT_TYPEIII_IEC61937_ATRAC (1 << 10) -#define AUDIO_FORMAT_TYPEIII_IEC61937_ATRAC2_3 (1 << 11) -#define AUDIO_FORMAT_TYPEIII_WMA (1 << 12) - -/* Audio Data Format Type IV Bit Allocations */ - -#define AUDIO_FORMAT_TYPEIV_PCM (1 << 0) -#define AUDIO_FORMAT_TYPEIV_PCM8 (1 << 1) -#define AUDIO_FORMAT_TYPEIV_IEEE_FLOAT (1 << 2) -#define AUDIO_FORMAT_TYPEIV_ALAW (1 << 3) -#define AUDIO_FORMAT_TYPEIV_MULAW (1 << 4) -#define AUDIO_FORMAT_TYPEIV_MPEG (1 << 5) -#define AUDIO_FORMAT_TYPEIV_AC3 (1 << 6) -#define AUDIO_FORMAT_TYPEIV_WMA (1 << 7) -#define AUDIO_FORMAT_TYPEIV_IEC61937_AC3 (1 << 8) -#define AUDIO_FORMAT_TYPEIV_IEC61937_MPEG1_L1 (1 << 9) -#define AUDIO_FORMAT_TYPEIV_IEC61937_MPEG1_L2_3 (1 << 10) -#define AUDIO_FORMAT_TYPEIV_IEC61937_MPEG2_NOEXT (1 << 10) -#define AUDIO_FORMAT_TYPEIV_IEC61937_MPEG2_EXT (1 << 11) -#define AUDIO_FORMAT_TYPEIV_IEC61937_MPEG2_AAC_ADTS (1 << 12) -#define AUDIO_FORMAT_TYPEIV_IEC61937_MPEG2_L1_LS (1 << 13) -#define AUDIO_FORMAT_TYPEIV_IEC61937_MPEG2_L2_3_LS (1 << 14) -#define AUDIO_FORMAT_TYPEIV_IEC61937_DTS_I (1 << 15) -#define AUDIO_FORMAT_TYPEIV_IEC61937_DTS_II (1 << 16) -#define AUDIO_FORMAT_TYPEIV_IEC61937_DTS_III (1 << 17) -#define AUDIO_FORMAT_TYPEIV_IEC61937_ATRAC (1 << 18) -#define AUDIO_FORMAT_TYPEIV_IEC61937_ATRAC2_3 (1 << 19) -#define AUDIO_FORMAT_TYPEIV_TYPE_III_WMA (1 << 20) -#define AUDIO_FORMAT_TYPEIV_IEC60958_PCM (1 << 21) - -/* Side Band Protocol Codes */ -#define AUDIO_SIDEBAND_PROTOCOL_UNDEF 0x00 -#define AUDIO_PRES_TIMESTAMP_PROTOCOL 0x01 - -/** USB Terminal Types - * Refer to Table 2-1 - Table 2-4 from termt10.pdf - */ - -/* USB Terminal Types */ -#define AUDIO_TERMINAL_UNDEF 0x0100 -#define AUDIO_TERMINAL_STREAMING 0x0101 -#define AUDIO_TERMINAL_VENDOR 0x01ff - -/* Input Terminal Types */ -#define AUDIO_INTERM_UNDEF 0x0200 /* Undefined Type */ -#define AUDIO_INTERM_MIC 0x0201 /* A generic microhpone */ -#define AUDIO_INTERM_DESKTOP_MIC 0x0202 /* A desktop microphone */ -#define AUDIO_INTERM_PERSONAL_MIC 0x0203 /* Head-mounted or clip-on microphone */ -#define AUDIO_INTERM_OMNI_MIC 0x0204 /* Omni-directional microphone */ -#define AUDIO_INTERM_MIC_ARRAY 0x0205 /* Microphone array */ -#define AUDIO_INTERM_PROC_MIC_ARRAY 0x0206 /* Microphone array with signal processor */ - -/* Output Terminal Types */ -#define AUDIO_OUTTERM_UNDEF 0x0300 /* Undefined Type */ -#define AUDIO_OUTTERM_SPEAKER 0x0301 /* Generic speakers */ -#define AUDIO_OUTTERM_HEADPHONES 0x0302 /* A head-mounted audio output device */ -#define AUDIO_OUTTERM_HEADDISPLAY 0x0303 /* Head Mounted Display Audio */ -#define AUDIO_OUTTERM_DESKTOP 0x0304 /* Desktop speaker */ -#define AUDIO_OUTTERM_ROOM 0x0305 /* Room speaker */ -#define AUDIO_OUTTERM_COMMS 0x0306 /* Communication speaker */ -#define AUDIO_OUTTERM_LOFREQ 0x0307 /* Low frequency effects speaker */ - -/* Bi-directional Terminal Types */ -#define AUDIO_BIDITERM_UNDEF 0x0400 /* Undefined Type */ -#define AUDIO_BIDITERM_HANDSET 0x0401 /* Hand-held bi-directional audio device */ -#define AUDIO_BIDITERM_HEADSET 0x0402 /* Head-mounted bi-directional audio device */ -#define AUDIO_BIDITERM_SPEAKERPHONE 0x0403 /* Speakerphone, no echo reduction */ -#define AUDIO_BIDITERM_ECHOSUPPRESS 0x0404 /* Echo-suppressing speakerphone */ -#define AUDIO_BIDITERM_ECHOCANCEL 0x0405 /* Echo-canceling speakerphone */ - -/* Telephony Terminal Types */ -#define AUDIO_TELETERM_UNDEF 0x0500 /* Undefined Type */ -#define AUDIO_TELETERM_PHONELINE 0x0501 /* Analog telephone line jack, an ISDN line, - * a proprietary PBX interface, or a wireless link */ -#define AUDIO_TELETERM_TELEPHONE 0x0502 /* Device can be used as a telephone */ -#define AUDIO_TELETERM_DOWNLINE 0x0503 /* Down Line Phone */ - -/* External Terminal Types */ -#define AUDIO_EXTTERM_UNDEF 0x0600 /* Undefined Type */ -#define AUDIO_EXTTERM_ANALOG 0x0601 /* Generic analog connector */ -#define AUDIO_EXTTERM_DIGITAL 0x0602 /* Generic digital audio interface */ -#define AUDIO_EXTTERM_LINE 0x0603 /* Analog connector at standard line levels */ -#define AUDIO_EXTTERM_LEGACY 0x0604 /* Legacy audio line out connector */ -#define AUDIO_EXTTERM_SPDIF 0x0605 /* SPDIF interface */ -#define AUDIO_EXTTERM_1394DA 0x0606 /* 1394 DA stream */ -#define AUDIO_EXTTERM_1394DV 0x0607 /* 1394 DV stream soundtrack */ -#define AUDIO_EXTTERM_ADAT 0x0608 /* ADAT Lightpipe */ -#define AUDIO_EXTTERM_TDIF 0x0609 /* TDIF - Tascam Digital Interface */ -#define AUDIO_EXTTERM_MADI 0x060a /* MADI - Multi-channel Audio Digital Interface (AES) */ - -/* Embedded Function Terminal Types */ -#define AUDIO_EMBEDTERM_UNDEF 0x0700 /* Undefined Type */ -#define AUDIO_EMBEDTERM_CALIBRATION 0x0701 /* Level Calibration Noise Source */ -#define AUDIO_EMBEDTERM_EQUALIZATION 0x0702 /* Equalization Noise */ -#define AUDIO_EMBEDTERM_CD 0x0703 /* CD player */ -#define AUDIO_EMBEDTERM_DAT 0x0704 /* Digital Audio Tape */ -#define AUDIO_EMBEDTERM_DCC 0x0705 /* Digital Compact Cassette */ -#define AUDIO_EMBEDTERM_COMPRESSED 0x0706 /* Compressed Audio Player */ -#define AUDIO_EMBEDTERM_TAPE 0x0707 /* Analog Audio Tape */ -#define AUDIO_EMBEDTERM_PHONOGRAPH 0x0708 /* Analog vinyl record player */ -#define AUDIO_EMBEDTERM_VCR 0x0709 /* Audio track of VCR */ -#define AUDIO_EMBEDTERM_VIDDISC 0x070a /* Audio track of VideoDisc player */ -#define AUDIO_EMBEDTERM_DVD 0x070b /* Audio track of DVD player */ -#define AUDIO_EMBEDTERM_TVTUNER 0x070c /* Audio track of TV tuner */ -#define AUDIO_EMBEDTERM_SATELLITE 0x070d /* Audio track of satellite receiver */ -#define AUDIO_EMBEDTERM_CABLETUNER 0x070e /* Audio track of cable tuner */ -#define AUDIO_EMBEDTERM_DSS 0x070f /* Audio track of DSS receiver */ -#define AUDIO_EMBEDTERM_RADIO 0x0710 /* AM/FM radio receiver */ -#define AUDIO_EMBEDTERM_TRANSMITTER 0x0711 /* AM/FM radio transmitter */ -#define AUDIO_EMBEDTERM_MULTITRACK 0x0712 /* A multi-track recording system */ -#define AUDIO_EMBEDTERM_SYNTHESIZER 0x0713 /* Synthesizer */ -#define AUDIO_EMBEDTERM_PIANO 0x0714 /* Piano */ -#define AUDIO_EMBEDTERM_GUITAR 0x0715 /* Guitar */ -#define AUDIO_EMBEDTERM_PERCUSSON 0x0716 /* Percussion Instrument */ -#define AUDIO_EMBEDTERM_INSTRUMENT 0x0717 /* Other Musical Instrument */ - -#define AUDIO_FORMAT_TYPE_I 0x01 -#define AUDIO_FORMAT_TYPE_II 0x02 -#define AUDIO_FORMAT_TYPE_III 0x03 - -struct audio_cs_if_ac_header_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint16_t bcdADC; - uint16_t wTotalLength; - uint8_t bInCollection; - uint8_t baInterfaceNr[]; -} __PACKED; - -#define AUDIO_SIZEOF_AC_HEADER_DESC(n) (8 + n) - -struct audio_cs_if_ac_input_terminal_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bTerminalID; - uint16_t wTerminalType; - uint8_t bAssocTerminal; - uint8_t bNrChannels; - uint16_t wChannelConfig; - uint8_t iChannelNames; - uint8_t iTerminal; -} __PACKED; - -#define AUDIO_SIZEOF_AC_INPUT_TERMINAL_DESC (12) - -struct audio_cs_if_ac_output_terminal_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bTerminalID; - uint16_t wTerminalType; - uint8_t bAssocTerminal; - uint8_t bSourceID; - uint8_t iTerminal; -} __PACKED; - -#define AUDIO_SIZEOF_AC_OUTPUT_TERMINAL_DESC (9) - -struct audio_cs_if_ac_feature_unit_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bUnitID; - uint8_t bSourceID; - uint8_t bControlSize; - uint8_t bmaControls[1]; - uint8_t iFeature; -} __PACKED; - -#define AUDIO_SIZEOF_AC_FEATURE_UNIT_DESC(ch, n) (7 + (ch + 1) * n) - -struct audio_cs_if_as_general_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bTerminalLink; - uint8_t bDelay; - uint16_t wFormatTag; -} __PACKED; - -#define AUDIO_SIZEOF_AS_GENERAL_DESC (7) - -struct audio_cs_if_as_format_type_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bFormatType; - uint8_t bNrChannels; - uint8_t bSubframeSize; - uint8_t bBitResolution; - uint8_t bSamFreqType; - uint8_t tSamFreq[3]; -} __PACKED; - -#define AUDIO_SIZEOF_FORMAT_TYPE_DESC(n) (8 + 3 * n) - -struct audio_ep_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bEndpointAddress; - uint8_t bmAttributes; - uint16_t wMaxPacketSize; - uint8_t bInterval; - uint8_t bRefresh; - uint8_t bSynchAddress; -} __PACKED; - -#define AUDIO_SIZEOF_EP_DESC (9) - -struct audio_cs_ep_ep_general_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bmAttributes; - uint8_t bLockDelayUnits; - uint16_t wLockDelay; -} __PACKED; - -#define AUDIO_SIZEOF_CS_EP_GENERAL_DESC (7) - -// clang-format off -#define AUDIO_AC_DESCRIPTOR_INIT(bFirstInterface, bInterfaceCount, wTotalLength, stridx, ...) \ - /* Interface Association Descriptor */ \ - 0x08, \ - USB_DESCRIPTOR_TYPE_INTERFACE_ASSOCIATION, \ - bFirstInterface, \ - bInterfaceCount, \ - USB_DEVICE_CLASS_AUDIO, \ - AUDIO_SUBCLASS_AUDIOCONTROL, \ - AUDIO_PROTOCOL_UNDEFINED, \ - 0x00, \ - /* ------------------ AudioControl Interface ------------------ */\ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - bFirstInterface, /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x00, /* bNumEndpoints */ \ - USB_DEVICE_CLASS_AUDIO, /* bInterfaceClass */ \ - AUDIO_SUBCLASS_AUDIOCONTROL, /* bInterfaceSubClass */ \ - AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */ \ - stridx, /* iInterface */ \ - 0x08 + PP_NARG(__VA_ARGS__), /* bLength */ \ - AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \ - AUDIO_CONTROL_HEADER, /* bDescriptorSubtype */ \ - WBVAL(0x0100), /* bcdADC */ \ - WBVAL(wTotalLength), /* wTotalLength */ \ - PP_NARG(__VA_ARGS__), /* bInCollection */ \ - __VA_ARGS__ /* baInterfaceNr */ - -#define AUDIO_AC_DESCRIPTOR_INIT_LEN(n) (0x08 + 0x09 + 0x08 + n) - -#define AUDIO_AC_INPUT_TERMINAL_DESCRIPTOR_INIT(bTerminalID, wTerminalType, bNrChannels, wChannelConfig) \ - 0x0C, /* bLength */ \ - AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \ - AUDIO_CONTROL_INPUT_TERMINAL, /* bDescriptorSubtype */ \ - bTerminalID, /* bTerminalID */ \ - WBVAL(wTerminalType), /* wTerminalType : Microphone 0x0201 */ \ - 0x00, /* bAssocTerminal */ \ - bNrChannels, /* bNrChannels */ \ - WBVAL(wChannelConfig), /* wChannelConfig : Mono sets no position bits */ \ - 0x00, /* iChannelNames */ \ - 0x00 /* iTerminal */ - -#define AUDIO_AC_OUTPUT_TERMINAL_DESCRIPTOR_INIT(bTerminalID, wTerminalType, bSourceID) \ - 0x09, /* bLength */ \ - AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \ - AUDIO_CONTROL_OUTPUT_TERMINAL, /* bDescriptorSubtype */ \ - bTerminalID, /* bTerminalID */ \ - WBVAL(wTerminalType), /* wTerminalType : USB Streaming */ \ - 0x00, /* bAssocTerminal */ \ - bSourceID, /* bSourceID */ \ - 0x00 /* iTerminal */ - -#define AUDIO_AC_FEATURE_UNIT_DESCRIPTOR_INIT(bUnitID, bSourceID, bControlSize, ...) \ - 0x07 + PP_NARG(__VA_ARGS__), /* bLength */ \ - AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \ - AUDIO_CONTROL_FEATURE_UNIT, /* bDescriptorSubtype */ \ - bUnitID, /* bUnitID */ \ - bSourceID, /* bSourceID */ \ - bControlSize, /* bControlSize */ \ - __VA_ARGS__, /* bmaControls(0) Mute */ \ - 0x00 /* iTerminal */ - -#define AUDIO_AS_DESCRIPTOR_INIT(bInterfaceNumber, bTerminalLink, bNrChannels, bSubFrameSize, bBitResolution, bEndpointAddress, wMaxPacketSize, bInterval, ...) \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - bInterfaceNumber, /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x00, /* bNumEndpoints */ \ - USB_DEVICE_CLASS_AUDIO, /* bInterfaceClass */ \ - AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubClass */ \ - AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */ \ - 0x00, /* iInterface */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - bInterfaceNumber, /* bInterfaceNumber */ \ - 0x01, /* bAlternateSetting */ \ - 0x01, /* bNumEndpoints */ \ - USB_DEVICE_CLASS_AUDIO, /* bInterfaceClass */ \ - AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubClass */ \ - AUDIO_PROTOCOL_UNDEFINED, /* bInterfaceProtocol */ \ - 0x00, /* iInterface */ \ - 0x07, /* bLength */ \ - AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \ - AUDIO_STREAMING_GENERAL, /* bDescriptorSubtype */ \ - bTerminalLink, /* bTerminalLink : Unit ID of the Output Terminal*/ \ - 0x01, /* bDelay */ \ - WBVAL(AUDIO_FORMAT_PCM), /* wFormatTag : AUDIO_FORMAT_PCM */ \ - 0x08 + PP_NARG(__VA_ARGS__), /* bLength */ \ - AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \ - AUDIO_STREAMING_FORMAT_TYPE, /* bDescriptorSubtype */ \ - AUDIO_FORMAT_TYPE_I, /* bFormatType */ \ - bNrChannels, /* bNrChannels */ \ - bSubFrameSize, /* bSubFrameSize : Bytes per audio subframe */ \ - bBitResolution, /* bBitResolution : bits per sample */ \ - (PP_NARG(__VA_ARGS__)/3), /* bSamFreqType : only one frequency supported */ \ - __VA_ARGS__, /* tSamFreq : Audio sampling frequency coded on 3 bytes */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - bEndpointAddress, /* bEndpointAddress : IN endpoint 1 */ \ - 0x01, /* bmAttributes */ \ - WBVAL(wMaxPacketSize), /* wMaxPacketSize */ \ - bInterval, /* bInterval : one packet per frame */ \ - 0x00, /* bRefresh */ \ - 0x00, /* bSynchAddress */ \ - 0x07, /* bLength */ \ - AUDIO_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \ - AUDIO_ENDPOINT_GENERAL, /* bDescriptor */ \ - AUDIO_EP_CONTROL_SAMPLING_FEQ, /* bmAttributes AUDIO_SAMPLING_FREQ_CONTROL */ \ - 0x00, /* bLockDelayUnits */ \ - 0x00, /* wLockDelay */ \ - 0x00 - -#define AUDIO_AS_DESCRIPTOR_INIT_LEN(n) (0x09 + 0x09 + 0x07 + 0x08 + 3 * n + 0x09 + 0x07) - -struct audio_v2_channel_cluster_descriptor { - uint8_t bNrChannels; - uint32_t bmChannelConfig; - uint8_t iChannelNames; -} __PACKED; - -#define AUDIO_V2_SIZEOF_CHANNEL_CLUSTER_DESC (6) - -struct audio_v2_cs_if_ac_header_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint16_t bcdADC; - uint8_t bCategory; - uint16_t wTotalLength; - uint8_t bmControls; -} __PACKED; - -#define AUDIO_V2_SIZEOF_AC_HEADER_DESC (9) - -struct audio_v2_cs_if_ac_clock_source_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bClockID; - uint8_t bmAttributes; - uint8_t bmControls; - uint8_t bAssocTerminal; - uint8_t iClockSource; -} __PACKED; - -#define AUDIO_V2_SIZEOF_AC_CLOCK_SOURCE_DESC (8) - -struct audio_v2_cs_if_ac_clock_selector_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bClockID; - uint8_t bNrInPins; - uint8_t baCSourceID[1]; - uint8_t iClockSelector; -} __PACKED; - -#define AUDIO_SIZEOF_AC_CLOCK_SELECTOR_DESC(n) (7 + n) - -struct audio_v2_cs_if_ac_clock_multiplier_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bClockID; - uint8_t bCSourceID; - uint8_t bmControls; - uint8_t iClockMultiplier; -} __PACKED; - -#define AUDIO_SIZEOF_AC_CLOCK_MULTIPLIER_DESC() (7) - -struct audio_v2_cs_if_ac_input_terminal_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bTerminalID; - uint16_t wTerminalType; - uint8_t bAssocTerminal; - uint8_t bCSourceID; - uint8_t bNrChannels; - uint32_t wChannelConfig; - uint8_t iChannelNames; - uint16_t bmControls; - uint8_t iTerminal; -} __PACKED; - -#define AUDIO_V2_SIZEOF_AC_INPUT_TERMINAL_DESC (17) - -struct audio_v2_cs_if_ac_output_terminal_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bTerminalID; - uint16_t wTerminalType; - uint8_t bAssocTerminal; - uint8_t bSourceID; - uint8_t bCSourceID; - uint16_t bmControls; - uint8_t iTerminal; -} __PACKED; - -#define AUDIO_V2_SIZEOF_AC_OUTPUT_TERMINAL_DESC (12) - -struct audio_v2_cs_if_ac_feature_unit_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bUnitID; - uint8_t bSourceID; - uint32_t bmaControls[1]; - uint8_t iFeature; -} __PACKED; - -#define AUDIO_V2_SIZEOF_AC_FEATURE_UNIT_DESC(ch) (6 + (ch + 1) * 4) - -struct audio_v2_cs_if_as_general_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bTerminalLink; - uint8_t bmControls; - uint8_t bFormatType; - uint32_t bmFormats; - uint8_t bNrChannels; - uint32_t bmChannelConfig; - uint8_t iChannelNames; -} __PACKED; - -#define AUDIO_V2_SIZEOF_AS_GENERAL_DESC (16) - -struct audio_v2_control_range1_param_block { - uint16_t wNumSubRanges; - struct - { - uint8_t bMin; - uint8_t bMax; - uint8_t bRes; - }subrange[]; -} __PACKED; - -struct audio_v2_control_range2_param_block { - uint16_t wNumSubRanges; - struct - { - uint16_t wMin; - uint16_t wMax; - uint16_t wRes; - }subrange[]; -} __PACKED; - -struct audio_v2_control_range3_param_block { - uint16_t wNumSubRanges; - struct - { - uint32_t dMin; - uint32_t dMax; - uint32_t dRes; - }subrange[]; -} __PACKED; - -#define AUDIO_V2_AC_DESCRIPTOR_INIT(bFirstInterface, bInterfaceCount, wTotalLength, bCategory, bmControls, stridx) \ - /* Interface Association Descriptor */ \ - 0x08, \ - USB_DESCRIPTOR_TYPE_INTERFACE_ASSOCIATION, \ - bFirstInterface, \ - bInterfaceCount, \ - USB_DEVICE_CLASS_AUDIO, \ - AUDIO_SUBCLASS_UNDEFINED, \ - AUDIO_PROTOCOLv20, \ - 0x00, \ - /* ------------------ AudioControl Interface ------------------ */\ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - bFirstInterface, /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x00, /* bNumEndpoints */ \ - USB_DEVICE_CLASS_AUDIO, /* bInterfaceClass */ \ - AUDIO_SUBCLASS_AUDIOCONTROL, /* bInterfaceSubClass */ \ - AUDIO_PROTOCOLv20, /* bInterfaceProtocol */ \ - stridx, /* iInterface */ \ - 0x09, /* bLength */ \ - AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \ - AUDIO_CONTROL_HEADER, /* bDescriptorSubtype */ \ - WBVAL(0x0200), /* bcdADC */ \ - bCategory, /* bCategory */ \ - WBVAL(wTotalLength), /* wTotalLength */ \ - bmControls /* bmControls */ \ - -#define AUDIO_V2_AC_DESCRIPTOR_INIT_LEN (0x08 + 0x09 + 0x09) - -#define AUDIO_V2_AC_CLOCK_SOURCE_DESCRIPTOR_INIT(bClockID, bmAttributes, bmControls) \ - 0x08, /* bLength */ \ - AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \ - AUDIO_CONTROL_CLOCK_SOURCE, /* bDescriptorSubtype */ \ - bClockID, /* bClockID */ \ - bmAttributes, /* bmAttributes */ \ - bmControls, /* bmControls */ \ - 0x00, /* bAssocTerminal */ \ - 0x00 /* iClockSource */ - -#define AUDIO_V2_AC_INPUT_TERMINAL_DESCRIPTOR_INIT(bTerminalID, wTerminalType, bCSourceID, bNrChannels, wChannelConfig, bmControls) \ - 0x11, /* bLength */ \ - AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \ - AUDIO_CONTROL_INPUT_TERMINAL, /* bDescriptorSubtype */ \ - bTerminalID, /* bTerminalID */ \ - WBVAL(wTerminalType), /* wTerminalType : Microphone 0x0201 */ \ - 0x00, /* bAssocTerminal */ \ - bCSourceID, /* bCSourceID */ \ - bNrChannels, /* bNrChannels */ \ - DBVAL(wChannelConfig), /* wChannelConfig : Mono sets no position bits */ \ - 0x00, /* iChannelNames */ \ - WBVAL(bmControls), /* bmControls */ \ - 0x00 /* iTerminal */ - -#define AUDIO_V2_AC_OUTPUT_TERMINAL_DESCRIPTOR_INIT(bTerminalID, wTerminalType, bSourceID, bCSourceID, bmControls) \ - 0x0c, /* bLength */ \ - AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \ - AUDIO_CONTROL_OUTPUT_TERMINAL, /* bDescriptorSubtype */ \ - bTerminalID, /* bTerminalID */ \ - WBVAL(wTerminalType), /* wTerminalType : USB Streaming */ \ - 0x00, /* bAssocTerminal */ \ - bSourceID, /* bSourceID */ \ - bCSourceID, /* bCSourceID */ \ - WBVAL(bmControls), /* bmControls */ \ - 0x00 /* iTerminal */ - -#define AUDIO_V2_AC_FEATURE_UNIT_DESCRIPTOR_INIT(bUnitID, bSourceID, ...) \ - 0x06 + (PP_NARG(__VA_ARGS__)), /* bLength */ \ - AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \ - AUDIO_CONTROL_FEATURE_UNIT, /* bDescriptorSubtype */ \ - bUnitID, /* bUnitID */ \ - bSourceID, /* bSourceID */ \ - __VA_ARGS__, /* bmaControls(0) Mute */ \ - 0x00 /* iTerminal */ - -#define AUDIO_V2_AS_DESCRIPTOR_INIT(bInterfaceNumber, bTerminalLink, bNrChannels, bmChannelConfig, bSubslotSize, bBitResolution, bEndpointAddress, wMaxPacketSize, bInterval) \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - bInterfaceNumber, /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x00, /* bNumEndpoints */ \ - USB_DEVICE_CLASS_AUDIO, /* bInterfaceClass */ \ - AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubClass */ \ - AUDIO_PROTOCOLv20, /* bInterfaceProtocol */ \ - 0x00, /* iInterface */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - bInterfaceNumber, /* bInterfaceNumber */ \ - 0x01, /* bAlternateSetting */ \ - 0x01, /* bNumEndpoints */ \ - USB_DEVICE_CLASS_AUDIO, /* bInterfaceClass */ \ - AUDIO_SUBCLASS_AUDIOSTREAMING, /* bInterfaceSubClass */ \ - AUDIO_PROTOCOLv20, /* bInterfaceProtocol */ \ - 0x00, /* iInterface */ \ - 0x10, /* bLength */ \ - AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \ - AUDIO_STREAMING_GENERAL, /* bDescriptorSubtype */ \ - bTerminalLink, /* bTerminalLink : Unit ID of the Output or Input Terminal*/ \ - 0x00, /* bmControls */ \ - AUDIO_FORMAT_TYPE_I, /* bFormatType : AUDIO_FORMAT_TYPE_I */ \ - DBVAL(AUDIO_V2_FORMAT_PCM), /* bmFormats PCM */ \ - bNrChannels, /* bNrChannels */ \ - DBVAL(bmChannelConfig), /* bmChannelConfig */ \ - 0x00, /* iChannelNames */ \ - 0x06, /* bLength */ \ - AUDIO_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ \ - AUDIO_STREAMING_FORMAT_TYPE, /* bDescriptorSubtype */ \ - AUDIO_FORMAT_TYPE_I, /* bFormatType */ \ - bSubslotSize, /* bSubslotSize */ \ - bBitResolution, /* bBitResolution */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - bEndpointAddress, /* bEndpointAddress 3 out endpoint for Audio */ \ - 0x01, /* bmAttributes */ \ - WBVAL(wMaxPacketSize), /* XXXX wMaxPacketSize in Bytes (SampleRate * SlotByteSize * NumChannels) */ \ - bInterval, /* bInterval */ \ - 0x08, /* bLength */ \ - AUDIO_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ \ - AUDIO_ENDPOINT_GENERAL, /* bDescriptor */ \ - 0x00, /* bmAttributes */ \ - 0x00, /* bmControls */ \ - 0x00, /* bLockDelayUnits */ \ - 0x00, /* wLockDelay */ \ - 0x00 - -// clang-format on - -#define AUDIO_V2_AS_DESCRIPTOR_INIT_LEN (0x09 + 0x09 + 0x10 + 0x06 + 0x07 + 0x08) - -#define AUDIO_SAMPLE_FREQ_NUM(num) (uint8_t)(num), (uint8_t)((num >> 8)) -#define AUDIO_SAMPLE_FREQ_3B(frq) (uint8_t)(frq), (uint8_t)((frq >> 8)), (uint8_t)((frq >> 16)) -#define AUDIO_SAMPLE_FREQ_4B(frq) (uint8_t)(frq), (uint8_t)((frq >> 8)), \ - (uint8_t)((frq >> 16)), (uint8_t)((frq >> 24)) - -#endif /* USB_AUDIO_H */ diff --git a/third-party/cherryusb/class/audio/usbd_audio.c b/third-party/cherryusb/class/audio/usbd_audio.c deleted file mode 100644 index b6b3d274f312cfbe924ee30dae9493d295504e84..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/audio/usbd_audio.c +++ /dev/null @@ -1,432 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbd_core.h" -#include "usbd_audio.h" - -#if CONFIG_USBDEV_AUDIO_VERSION < 0x0200 -struct usbd_audio_volume_info { - uint16_t vol_min; - uint16_t vol_max; - uint16_t vol_res; - uint16_t vol_current; -}; - -struct usbd_audio_attribute_control { - struct usbd_audio_volume_info volume[CONFIG_USBDEV_AUDIO_MAX_CHANNEL]; - uint8_t mute[CONFIG_USBDEV_AUDIO_MAX_CHANNEL]; - uint8_t automatic_gain[CONFIG_USBDEV_AUDIO_MAX_CHANNEL]; -}; -#else -struct audio_v2_control_range2_param_block_default { - uint16_t wNumSubRanges; - struct - { - uint16_t wMin; - uint16_t wMax; - uint16_t wRes; - } subrange[CONFIG_USBDEV_AUDIO_MAX_CHANNEL]; -} __PACKED; - -struct usbd_audio_attribute_control { - uint32_t volume_bCUR; - uint32_t mute_bCUR; - struct audio_v2_control_range2_param_block_default volume; - uint8_t mute[CONFIG_USBDEV_AUDIO_MAX_CHANNEL]; -}; -#endif -struct audio_entity_info { - usb_slist_t list; - uint8_t bDescriptorSubtype; - uint8_t bEntityId; - void *priv[2]; -}; - -static usb_slist_t usbd_audio_entity_info_head = USB_SLIST_OBJECT_INIT(usbd_audio_entity_info_head); - -#if CONFIG_USBDEV_AUDIO_VERSION < 0x0200 -static int audio_class_endpoint_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - uint8_t control_selector; - uint32_t sampling_freq = 0; - uint8_t pitch_enable; - uint8_t ep; - - if ((setup->bmRequestType & USB_REQUEST_RECIPIENT_MASK) == USB_REQUEST_RECIPIENT_ENDPOINT) { - control_selector = HI_BYTE(setup->wValue); - ep = LO_BYTE(setup->wIndex); - - switch (setup->bRequest) { - case AUDIO_REQUEST_SET_CUR: - switch (control_selector) { - case AUDIO_EP_CONTROL_SAMPLING_FEQ: - memcpy((uint8_t *)&sampling_freq, *data, *len); - USB_LOG_DBG("Set ep:%02x %d Hz\r\n", ep, (int)sampling_freq); - usbd_audio_set_sampling_freq(0, ep, sampling_freq); - break; - case AUDIO_EP_CONTROL_PITCH: - pitch_enable = (*data)[0]; - usbd_audio_set_pitch(ep, pitch_enable); - break; - default: - USB_LOG_WRN("Unhandled Audio Class control selector 0x%02x\r\n", control_selector); - return -1; - } - break; - case AUDIO_REQUEST_GET_CUR: - sampling_freq = 16000; - memcpy(*data, &sampling_freq, 4); - *len = 4; - USB_LOG_DBG("Get ep:%02x %d Hz\r\n", ep, (int)sampling_freq); - break; - default: - USB_LOG_WRN("Unhandled Audio Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - } else { - return -1; - } - return 0; -} -#endif - -static int audio_class_interface_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - USB_LOG_DBG("AUDIO Class request: " - "bRequest 0x%02x\r\n", - setup->bRequest); - - struct audio_entity_info *current_entity_info = NULL; - struct usbd_audio_attribute_control *current_feature_control = NULL; -#if CONFIG_USBDEV_AUDIO_VERSION >= 0x0200 - uint32_t *sampling_freq; -#endif - usb_slist_t *i; - uint8_t entity_id; - uint8_t control_selector; - uint8_t ch; - uint8_t mute; - uint16_t volume; - const char *mute_string[2] = { "off", "on" }; - - entity_id = HI_BYTE(setup->wIndex); - control_selector = HI_BYTE(setup->wValue); - ch = LO_BYTE(setup->wValue); - - ARG_UNUSED(mute_string); - if (ch > (CONFIG_USBDEV_AUDIO_MAX_CHANNEL - 1)) { - return -2; - } - - usb_slist_for_each(i, &usbd_audio_entity_info_head) - { - struct audio_entity_info *tmp_entity_info = usb_slist_entry(i, struct audio_entity_info, list); - if (tmp_entity_info->bEntityId == entity_id) { - current_entity_info = tmp_entity_info; - break; - } - } - - if (current_entity_info == NULL) { - return -2; - } - - current_feature_control = (struct usbd_audio_attribute_control *)current_entity_info->priv[0]; -#if CONFIG_USBDEV_AUDIO_VERSION >= 0x0200 - sampling_freq = (uint32_t *)current_entity_info->priv[1]; -#endif - if (current_entity_info->bDescriptorSubtype == AUDIO_CONTROL_FEATURE_UNIT) { -#if CONFIG_USBDEV_AUDIO_VERSION < 0x0200 - float volume2db = 0.0; - - switch (control_selector) { - case AUDIO_FU_CONTROL_MUTE: - switch (setup->bRequest) { - case AUDIO_REQUEST_SET_CUR: - mute = (*data)[0]; - current_feature_control->mute[ch] = mute; - USB_LOG_DBG("Set UnitId:%d ch[%d] mute %s\r\n", entity_id, ch, mute_string[mute]); - usbd_audio_set_mute(entity_id, ch, mute); - break; - case AUDIO_REQUEST_GET_CUR: - (*data)[0] = current_feature_control->mute[ch]; - break; - default: - USB_LOG_WRN("Unhandled Audio Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - - break; - case AUDIO_FU_CONTROL_VOLUME: - switch (setup->bRequest) { - case AUDIO_REQUEST_SET_CUR: - volume = (((uint16_t)(*data)[1] << 8) | ((uint16_t)(*data)[0])); - current_feature_control->volume[ch].vol_current = volume; - - if (volume < 0x8000) { - volume2db = 0.00390625 * volume; - } else if (volume > 0x8000) { - volume2db = -0.00390625 * (0xffff - volume + 1); - } - - USB_LOG_DBG("Set UnitId:%d ch[%d] %0.4f dB\r\n", entity_id, ch, volume2db); - usbd_audio_set_volume(entity_id, ch, volume2db); - break; - case AUDIO_REQUEST_GET_CUR: - memcpy(*data, ¤t_feature_control->volume[ch].vol_current, 2); - *len = 2; - break; - - case AUDIO_REQUEST_GET_MIN: - memcpy(*data, ¤t_feature_control->volume[ch].vol_min, 2); - *len = 2; - break; - - case AUDIO_REQUEST_GET_MAX: - memcpy(*data, ¤t_feature_control->volume[ch].vol_max, 2); - *len = 2; - break; - - case AUDIO_REQUEST_GET_RES: - memcpy(*data, ¤t_feature_control->volume[ch].vol_res, 2); - *len = 2; - break; - - case AUDIO_REQUEST_SET_RES: - memcpy(¤t_feature_control->volume[ch].vol_res, *data, 2); - *len = 2; - break; - default: - USB_LOG_WRN("Unhandled Audio Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - default: - USB_LOG_WRN("Unhandled Audio Class control selector 0x%02x\r\n", control_selector); - return -1; - } -#else - switch (setup->bRequest) { - case AUDIO_REQUEST_CUR: - switch (control_selector) { - case AUDIO_FU_CONTROL_MUTE: - if (setup->bmRequestType & USB_REQUEST_DIR_MASK) { - (*data)[0] = current_feature_control->mute_bCUR; - *len = 1; - } else { - mute = (*data)[0]; - current_feature_control->mute_bCUR = mute; - USB_LOG_DBG("Set UnitId:%d ch[%d] mute %s\r\n", entity_id, ch, mute_string[mute]); - usbd_audio_set_mute(entity_id, ch, mute); - } - break; - case AUDIO_FU_CONTROL_VOLUME: - if (setup->bmRequestType & USB_REQUEST_DIR_MASK) { - (*data)[0] = current_feature_control->volume_bCUR & 0XFF; - (*data)[1] = (current_feature_control->volume_bCUR >> 8) & 0xff; - *len = 2; - } else { - volume = (((uint16_t)(*data)[1] << 8) | ((uint16_t)(*data)[0])); - current_feature_control->volume_bCUR = volume; - USB_LOG_DBG("Set UnitId:%d ch[%d] %d dB\r\n", entity_id, ch, volume); - usbd_audio_set_volume(entity_id, ch, volume); - } - break; - default: - USB_LOG_WRN("Unhandled Audio Class control selector 0x%02x\r\n", control_selector); - return -1; - } - break; - case AUDIO_REQUEST_RANGE: - switch (control_selector) { - case AUDIO_FU_CONTROL_VOLUME: - if (setup->bmRequestType & USB_REQUEST_DIR_MASK) { - *((uint16_t *)(*data + 0)) = current_feature_control->volume.wNumSubRanges; - *((uint16_t *)(*data + 2)) = current_feature_control->volume.subrange[ch].wMin; - *((uint16_t *)(*data + 4)) = current_feature_control->volume.subrange[ch].wMax; - *((uint16_t *)(*data + 6)) = current_feature_control->volume.subrange[ch].wRes; - *len = 8; - } else { - } - break; - default: - USB_LOG_WRN("Unhandled Audio Class control selector 0x%02x\r\n", control_selector); - return -1; - } - - break; - default: - USB_LOG_WRN("Unhandled Audio Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } -#endif - } -#if CONFIG_USBDEV_AUDIO_VERSION >= 0x0200 - else if (current_entity_info->bDescriptorSubtype == AUDIO_CONTROL_CLOCK_SOURCE) { - switch (setup->bRequest) { - case AUDIO_REQUEST_CUR: - switch (control_selector) { - case AUDIO_CS_CONTROL_SAM_FREQ: - if (setup->bmRequestType & USB_REQUEST_DIR_MASK) { - memcpy(*data, &sampling_freq[ch], sizeof(uint32_t)); - USB_LOG_DBG("Get ClockId:%d ch[%d] %d Hz\r\n", entity_id, ch, (int)sampling_freq[ch]); - *len = 4; - } else { - memcpy(&sampling_freq[ch], *data, setup->wLength); - USB_LOG_DBG("Set ClockId:%d ch[%d] %d Hz\r\n", entity_id, ch, (int)sampling_freq[ch]); - usbd_audio_set_sampling_freq(entity_id, ch, sampling_freq[ch]); - } - break; - case AUDIO_CS_CONTROL_CLOCK_VALID: - if (setup->bmRequestType & USB_REQUEST_DIR_MASK) { - (*data)[0] = 1; - *len = 1; - } else { - } - break; - default: - USB_LOG_WRN("Unhandled Audio Class control selector 0x%02x\r\n", control_selector); - return -1; - } - break; - case AUDIO_REQUEST_RANGE: - switch (control_selector) { - case AUDIO_CS_CONTROL_SAM_FREQ: - if (setup->bmRequestType & USB_REQUEST_DIR_MASK) { - uint8_t *sampling_freq_table = NULL; - uint16_t num; - - usbd_audio_get_sampling_freq_table(entity_id, &sampling_freq_table); - num = (uint16_t)((uint16_t)(sampling_freq_table[1] << 8) | ((uint16_t)sampling_freq_table[0])); - memcpy(*data, sampling_freq_table, (12 * num + 2)); - *len = (12 * num + 2); - USB_LOG_DBG("Get sampling_freq_table entity_id:%d ch[%d] addr:%x\r\n", entity_id, ch, (uint32_t)sampling_freq_table); - } else { - } - break; - default: - USB_LOG_WRN("Unhandled Audio Class control selector 0x%02x\r\n", control_selector); - return -1; - } - - break; - default: - USB_LOG_WRN("Unhandled Audio Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - } -#endif - else { - return -1; - } - return 0; -} - -static void audio_notify_handler(uint8_t event, void *arg) -{ - switch (event) { - case USBD_EVENT_RESET: - - break; - - case USBD_EVENT_SET_INTERFACE: { - struct usb_interface_descriptor *intf = (struct usb_interface_descriptor *)arg; - if (intf->bAlternateSetting == 1) { - usbd_audio_open(intf->bInterfaceNumber); - } else { - usbd_audio_close(intf->bInterfaceNumber); - } - } - - break; - - default: - break; - } -} - -struct usbd_interface *usbd_audio_init_intf(struct usbd_interface *intf) -{ - intf->class_interface_handler = audio_class_interface_request_handler; -#if CONFIG_USBDEV_AUDIO_VERSION < 0x0200 - intf->class_endpoint_handler = audio_class_endpoint_request_handler; -#else - intf->class_endpoint_handler = NULL; -#endif - intf->vendor_handler = NULL; - intf->notify_handler = audio_notify_handler; - - return intf; -} - -void usbd_audio_add_entity(uint8_t entity_id, uint16_t bDescriptorSubtype) -{ - struct audio_entity_info *entity_info = usb_malloc(sizeof(struct audio_entity_info)); - memset(entity_info, 0, sizeof(struct audio_entity_info)); - entity_info->bEntityId = entity_id; - entity_info->bDescriptorSubtype = bDescriptorSubtype; - - if (bDescriptorSubtype == AUDIO_CONTROL_FEATURE_UNIT) { -#if CONFIG_USBDEV_AUDIO_VERSION < 0x0200 - struct usbd_audio_attribute_control *control = usb_malloc(sizeof(struct usbd_audio_attribute_control)); - memset(control, 0, sizeof(struct usbd_audio_attribute_control)); - for (uint8_t ch = 0; ch < CONFIG_USBDEV_AUDIO_MAX_CHANNEL; ch++) { - control->volume[ch].vol_min = 0xdb00; - control->volume[ch].vol_max = 0x0000; - control->volume[ch].vol_res = 0x0100; - control->volume[ch].vol_current = 0xf600; - control->mute[ch] = 0; - control->automatic_gain[ch] = 0; - } -#else - struct usbd_audio_attribute_control *control = usb_malloc(sizeof(struct usbd_audio_attribute_control)); - memset(control, 0, sizeof(struct usbd_audio_attribute_control)); - for (uint8_t ch = 0; ch < CONFIG_USBDEV_AUDIO_MAX_CHANNEL; ch++) { - control->volume.wNumSubRanges = 1; - control->volume.subrange[ch].wMin = 0; - control->volume.subrange[ch].wMax = 100; - control->volume.subrange[ch].wRes = 1; - control->mute[ch] = 0; - control->volume_bCUR = 0; - control->mute_bCUR = 0; - } -#endif - entity_info->priv[0] = control; - } else if (bDescriptorSubtype == AUDIO_CONTROL_CLOCK_SOURCE) { -#if CONFIG_USBDEV_AUDIO_VERSION >= 0x0200 - uint32_t *sampling_freq = usb_malloc(sizeof(uint32_t) * CONFIG_USBDEV_AUDIO_MAX_CHANNEL); - for (size_t ch = 0; ch < CONFIG_USBDEV_AUDIO_MAX_CHANNEL; ch++) { - sampling_freq[ch] = 16000; - } - entity_info->priv[1] = sampling_freq; -#else - entity_info->priv[1] = NULL; -#endif - } - - usb_slist_add_tail(&usbd_audio_entity_info_head, &entity_info->list); -} - -__WEAK void usbd_audio_set_volume(uint8_t entity_id, uint8_t ch, float dB) -{ -} - -__WEAK void usbd_audio_set_mute(uint8_t entity_id, uint8_t ch, uint8_t enable) -{ -} - -__WEAK void usbd_audio_set_sampling_freq(uint8_t entity_id, uint8_t ep_ch, uint32_t sampling_freq) -{ -} - -#if CONFIG_USBDEV_AUDIO_VERSION >= 0x0200 -__WEAK void usbd_audio_get_sampling_freq_table(uint8_t entity_id, uint8_t **sampling_freq_table) -{ -} -#endif - -__WEAK void usbd_audio_set_pitch(uint8_t ep, bool enable) -{ -} \ No newline at end of file diff --git a/third-party/cherryusb/class/audio/usbd_audio.h b/third-party/cherryusb/class/audio/usbd_audio.h deleted file mode 100644 index 420e88cedcee6b7645ee6f0378c52f72be545f81..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/audio/usbd_audio.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBD_AUDIO_H -#define USBD_AUDIO_H - -#include "usb_audio.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Init audio interface driver */ -struct usbd_interface *usbd_audio_init_intf(struct usbd_interface *intf); - -void usbd_audio_open(uint8_t intf); -void usbd_audio_close(uint8_t intf); -void usbd_audio_add_entity(uint8_t entity_id, uint16_t bDescriptorSubtype); -void usbd_audio_set_volume(uint8_t entity_id, uint8_t ch, float dB); -void usbd_audio_set_mute(uint8_t entity_id, uint8_t ch, uint8_t enable); -void usbd_audio_set_sampling_freq(uint8_t entity_id, uint8_t ep_ch, uint32_t sampling_freq); -void usbd_audio_get_sampling_freq_table(uint8_t entity_id, uint8_t **sampling_freq_table); -void usbd_audio_set_pitch(uint8_t ep, bool enable); - -#ifdef __cplusplus -} -#endif - -#endif /* USBD_AUDIO_H */ diff --git a/third-party/cherryusb/class/audio/usbh_audio.c b/third-party/cherryusb/class/audio/usbh_audio.c deleted file mode 100644 index 6e7d94e88b700b82b2ab46b30973468cd4e12f37..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/audio/usbh_audio.c +++ /dev/null @@ -1,484 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbh_core.h" -#include "usbh_audio.h" - -#define DEV_FORMAT "/dev/audio%d" - -/* general descriptor field offsets */ -#define DESC_bLength 0 /** Length offset */ -#define DESC_bDescriptorType 1 /** Descriptor type offset */ -#define DESC_bDescriptorSubType 2 /** Descriptor subtype offset */ - -/* interface descriptor field offsets */ -#define INTF_DESC_bInterfaceNumber 2 /** Interface number offset */ -#define INTF_DESC_bAlternateSetting 3 /** Alternate setting offset */ - -static uint32_t g_devinuse = 0; - -USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_audio_buf[128]; - -static int usbh_audio_devno_alloc(struct usbh_audio *audio_class) -{ - int devno; - - for (devno = 0; devno < 32; devno++) { - uint32_t bitno = 1 << devno; - if ((g_devinuse & bitno) == 0) { - g_devinuse |= bitno; - audio_class->minor = devno; - return 0; - } - } - - return -EMFILE; -} - -static void usbh_audio_devno_free(struct usbh_audio *audio_class) -{ - int devno = audio_class->minor; - - if (devno >= 0 && devno < 32) { - g_devinuse &= ~(1 << devno); - } -} - -int usbh_audio_open(struct usbh_audio *audio_class, const char *name, uint32_t samp_freq) -{ - struct usb_setup_packet *setup = audio_class->hport->setup; - struct usb_endpoint_descriptor *ep_desc; - uint8_t mult; - uint16_t mps; - int ret; - uint8_t intf = 0xff; - uint8_t altsetting = 1; - - if (audio_class->is_opened) { - return -EMFILE; - } - - for (uint8_t i = 0; i < audio_class->module_num; i++) { - if (strcmp(name, audio_class->module[i].name) == 0) { - for (uint8_t j = 0; j < audio_class->num_of_intf_altsettings; j++) { - for (uint8_t k = 0; k < audio_class->module[i].altsetting[j].sampfreq_num; k++) { - if (audio_class->module[i].altsetting[j].sampfreq[k] == samp_freq) { - intf = audio_class->module[i].data_intf; - altsetting = j; - goto freq_found; - } - } - } - } - } - - return -ENODEV; - -freq_found: - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_STANDARD | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = USB_REQUEST_SET_INTERFACE; - setup->wValue = altsetting; - setup->wIndex = intf; - setup->wLength = 0; - - ret = usbh_control_transfer(audio_class->hport->ep0, setup, NULL); - if (ret < 0) { - return ret; - } - - ep_desc = &audio_class->hport->config.intf[intf].altsetting[altsetting].ep[0].ep_desc; - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_ENDPOINT; - setup->bRequest = AUDIO_REQUEST_SET_CUR; - setup->wValue = (AUDIO_EP_CONTROL_SAMPLING_FEQ << 8) | 0x00; - setup->wIndex = ep_desc->bEndpointAddress; - setup->wLength = 3; - - memcpy(g_audio_buf, &samp_freq, 3); - ret = usbh_control_transfer(audio_class->hport->ep0, setup, g_audio_buf); - if (ret < 0) { - return ret; - } - - mult = (ep_desc->wMaxPacketSize & USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_MASK) >> USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_SHIFT; - mps = ep_desc->wMaxPacketSize & USB_MAXPACKETSIZE_MASK; - if (ep_desc->bEndpointAddress & 0x80) { - audio_class->isoin_mps = mps * (mult + 1); - usbh_hport_activate_epx(&audio_class->isoin, audio_class->hport, ep_desc); - } else { - audio_class->isoout_mps = mps * (mult + 1); - usbh_hport_activate_epx(&audio_class->isoout, audio_class->hport, ep_desc); - } - - USB_LOG_INFO("Open audio module :%s, altsetting: %u\r\n", name, altsetting); - audio_class->is_opened = true; - return ret; -} - -int usbh_audio_close(struct usbh_audio *audio_class, const char *name) -{ - struct usb_setup_packet *setup = audio_class->hport->setup; - struct usb_endpoint_descriptor *ep_desc; - int ret; - uint8_t intf = 0xff; - uint8_t altsetting = 1; - - for (size_t i = 0; i < audio_class->module_num; i++) { - if (strcmp(name, audio_class->module[i].name) == 0) { - intf = audio_class->module[i].data_intf; - } - } - - if (intf == 0xff) { - return -ENODEV; - } - - USB_LOG_INFO("Close audio module :%s\r\n", name); - audio_class->is_opened = false; - - ep_desc = &audio_class->hport->config.intf[intf].altsetting[altsetting].ep[0].ep_desc; - if (ep_desc->bEndpointAddress & 0x80) { - if (audio_class->isoin) { - usbh_pipe_free(audio_class->isoin); - audio_class->isoin = NULL; - } - } else { - if (audio_class->isoout) { - usbh_pipe_free(audio_class->isoout); - audio_class->isoout = NULL; - } - } - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_STANDARD | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = USB_REQUEST_SET_INTERFACE; - setup->wValue = 0; - setup->wIndex = intf; - setup->wLength = 0; - - ret = usbh_control_transfer(audio_class->hport->ep0, setup, NULL); - - return ret; -} - -int usbh_audio_set_volume(struct usbh_audio *audio_class, const char *name, uint8_t ch, uint8_t volume) -{ - struct usb_setup_packet *setup = audio_class->hport->setup; - int ret; - uint8_t intf = 0xff; - uint8_t feature_id = 0xff; - uint16_t volume_hex; - - for (size_t i = 0; i < audio_class->module_num; i++) { - if (strcmp(name, audio_class->module[i].name) == 0) { - intf = audio_class->ctrl_intf; - feature_id = audio_class->module[i].feature_unit_id; - } - } - - if (intf == 0xff) { - return -ENODEV; - } - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = AUDIO_REQUEST_SET_CUR; - setup->wValue = (AUDIO_FU_CONTROL_VOLUME << 8) | ch; - setup->wIndex = (feature_id << 8) | intf; - setup->wLength = 2; - - volume_hex = -0xDB00 / 100 * volume + 0xdb00; - - memcpy(g_audio_buf, &volume_hex, 2); - ret = usbh_control_transfer(audio_class->hport->ep0, setup, NULL); - - return ret; -} - -int usbh_audio_set_mute(struct usbh_audio *audio_class, const char *name, uint8_t ch, bool mute) -{ - struct usb_setup_packet *setup = audio_class->hport->setup; - int ret; - uint8_t intf = 0xff; - uint8_t feature_id = 0xff; - - for (size_t i = 0; i < audio_class->module_num; i++) { - if (strcmp(name, audio_class->module[i].name) == 0) { - intf = audio_class->ctrl_intf; - feature_id = audio_class->module[i].feature_unit_id; - } - } - - if (intf == 0xff) { - return -ENODEV; - } - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = AUDIO_REQUEST_SET_CUR; - setup->wValue = (AUDIO_FU_CONTROL_MUTE << 8) | ch; - setup->wIndex = (feature_id << 8) | intf; - setup->wLength = 1; - - memcpy(g_audio_buf, &mute, 1); - ret = usbh_control_transfer(audio_class->hport->ep0, setup, g_audio_buf); - - return ret; -} - -void usbh_audio_list_module(struct usbh_audio *audio_class) -{ - USB_LOG_INFO("============= Audio module information ===================\r\n"); - USB_LOG_INFO("bcdADC :%04x\r\n", audio_class->bcdADC); - USB_LOG_INFO("Num of modules :%u\r\n", audio_class->module_num); - USB_LOG_INFO("Num of altsettings:%u\r\n", audio_class->num_of_intf_altsettings); - - for (uint8_t i = 0; i < audio_class->module_num; i++) { - USB_LOG_INFO(" module name :%s\r\n", audio_class->module[i].name); - USB_LOG_INFO(" module feature unit id :%d\r\n", audio_class->module[i].feature_unit_id); - - for (uint8_t j = 0; j < audio_class->num_of_intf_altsettings; j++) { - if (j == 0) { - USB_LOG_INFO(" Ingore altsetting 0\r\n"); - continue; - } - USB_LOG_INFO(" Altsetting %u\r\n", j); - USB_LOG_INFO(" module channels :%u\r\n", audio_class->module[i].altsetting[j].channels); - //USB_LOG_INFO(" module format_type :%u\r\n",audio_class->module[i].altsetting[j].format_type); - USB_LOG_INFO(" module bitresolution :%u\r\n", audio_class->module[i].altsetting[j].bitresolution); - USB_LOG_INFO(" module sampfreq num :%u\r\n", audio_class->module[i].altsetting[j].sampfreq_num); - - for (uint8_t k = 0; k < audio_class->module[i].altsetting[j].sampfreq_num; k++) { - USB_LOG_INFO(" module sampfreq :%d hz\r\n", audio_class->module[i].altsetting[j].sampfreq[k]); - } - } - } - - USB_LOG_INFO("============= Audio module information ===================\r\n"); -} - -static int usbh_audio_ctrl_connect(struct usbh_hubport *hport, uint8_t intf) -{ - int ret; - uint8_t cur_iface = 0xff; - uint8_t cur_iface_count = 0xff; - uint8_t cur_alt_setting = 0xff; - uint8_t input_offset = 0; - uint8_t output_offset = 0; - uint8_t feature_unit_offset = 0; - uint8_t format_offset = 0; - uint8_t *p; - - struct usbh_audio *audio_class = usb_malloc(sizeof(struct usbh_audio)); - if (audio_class == NULL) { - USB_LOG_ERR("Fail to alloc audio_class\r\n"); - return -ENOMEM; - } - - memset(audio_class, 0, sizeof(struct usbh_audio)); - usbh_audio_devno_alloc(audio_class); - audio_class->hport = hport; - audio_class->ctrl_intf = intf; - audio_class->num_of_intf_altsettings = hport->config.intf[intf + 1].altsetting_num; - - hport->config.intf[intf].priv = audio_class; - - p = hport->raw_config_desc; - while (p[DESC_bLength]) { - switch (p[DESC_bDescriptorType]) { - case USB_DESCRIPTOR_TYPE_INTERFACE_ASSOCIATION: - cur_iface_count = p[3]; - break; - case USB_DESCRIPTOR_TYPE_INTERFACE: - cur_iface = p[INTF_DESC_bInterfaceNumber]; - cur_alt_setting = p[INTF_DESC_bAlternateSetting]; - break; - case USB_DESCRIPTOR_TYPE_ENDPOINT: - break; - case AUDIO_INTERFACE_DESCRIPTOR_TYPE: - if (cur_iface == audio_class->ctrl_intf) { - switch (p[DESC_bDescriptorSubType]) { - case AUDIO_CONTROL_HEADER: { - struct audio_cs_if_ac_header_descriptor *desc = (struct audio_cs_if_ac_header_descriptor *)p; - audio_class->bcdADC = desc->bcdADC; - audio_class->bInCollection = desc->bInCollection; - } break; - case AUDIO_CONTROL_INPUT_TERMINAL: { - struct audio_cs_if_ac_input_terminal_descriptor *desc = (struct audio_cs_if_ac_input_terminal_descriptor *)p; - - audio_class->module[input_offset].input_terminal_id = desc->bTerminalID; - audio_class->module[input_offset].input_terminal_type = desc->wTerminalType; - audio_class->module[input_offset].input_channel_config = desc->wChannelConfig; - - if (desc->wTerminalType == AUDIO_TERMINAL_STREAMING) { - audio_class->module[input_offset].terminal_link_id = desc->bTerminalID; - } - if (desc->wTerminalType == AUDIO_INTERM_MIC) { - audio_class->module[input_offset].name = "mic"; - } - input_offset++; - } break; - break; - case AUDIO_CONTROL_OUTPUT_TERMINAL: { - struct audio_cs_if_ac_output_terminal_descriptor *desc = (struct audio_cs_if_ac_output_terminal_descriptor *)p; - audio_class->module[output_offset].output_terminal_id = desc->bTerminalID; - audio_class->module[output_offset].output_terminal_type = desc->wTerminalType; - if (desc->wTerminalType == AUDIO_TERMINAL_STREAMING) { - audio_class->module[output_offset].terminal_link_id = desc->bTerminalID; - } - if (desc->wTerminalType == AUDIO_OUTTERM_SPEAKER) { - audio_class->module[output_offset].name = "speaker"; - } - output_offset++; - } break; - case AUDIO_CONTROL_FEATURE_UNIT: { - struct audio_cs_if_ac_feature_unit_descriptor *desc = (struct audio_cs_if_ac_feature_unit_descriptor *)p; - audio_class->module[feature_unit_offset].feature_unit_id = desc->bUnitID; - audio_class->module[feature_unit_offset].feature_unit_controlsize = desc->bControlSize; - - for (uint8_t j = 0; j < desc->bControlSize; j++) { - audio_class->module[feature_unit_offset].feature_unit_controls[j] = p[6 + j]; - } - feature_unit_offset++; - } break; - case AUDIO_CONTROL_PROCESSING_UNIT: - - break; - default: - break; - } - } else if ((cur_iface < (audio_class->ctrl_intf + cur_iface_count)) && (cur_iface > audio_class->ctrl_intf)) { - switch (p[DESC_bDescriptorSubType]) { - case AUDIO_STREAMING_GENERAL: - - break; - case AUDIO_STREAMING_FORMAT_TYPE: { - struct audio_cs_if_as_format_type_descriptor *desc = (struct audio_cs_if_as_format_type_descriptor *)p; - - audio_class->module[format_offset].data_intf = cur_iface; - audio_class->module[format_offset].altsetting[cur_alt_setting].channels = desc->bNrChannels; - audio_class->module[format_offset].altsetting[cur_alt_setting].format_type = desc->bFormatType; - audio_class->module[format_offset].altsetting[cur_alt_setting].bitresolution = desc->bBitResolution; - audio_class->module[format_offset].altsetting[cur_alt_setting].sampfreq_num = desc->bSamFreqType; - - for (uint8_t j = 0; j < desc->bSamFreqType; j++) { - audio_class->module[format_offset].altsetting[cur_alt_setting].sampfreq[j] = (uint32_t)(p[10 + j] << 16) | - (uint32_t)(p[9 + j] << 8) | - (uint32_t)(p[8 + j] << 0); - } - if (cur_alt_setting == (hport->config.intf[intf + 1].altsetting_num - 1)) { - format_offset++; - } - } break; - default: - break; - } - } - break; - default: - break; - } - /* skip to next descriptor */ - p += p[DESC_bLength]; - } - - if ((input_offset != output_offset) && (input_offset != feature_unit_offset) && (input_offset != format_offset)) { - return -EINVAL; - } - - audio_class->module_num = input_offset; - - for (size_t i = 0; i < audio_class->module_num; i++) { - ret = usbh_audio_close(audio_class, audio_class->module[i].name); - if (ret < 0) { - USB_LOG_ERR("Fail to close audio module :%s\r\n", audio_class->module[i].name); - return ret; - } - } - - usbh_audio_list_module(audio_class); - - snprintf(hport->config.intf[intf].devname, CONFIG_USBHOST_DEV_NAMELEN, DEV_FORMAT, audio_class->minor); - USB_LOG_INFO("Register Audio Class:%s\r\n", hport->config.intf[intf].devname); - - usbh_audio_run(audio_class); - return 0; -} - -static int usbh_audio_ctrl_disconnect(struct usbh_hubport *hport, uint8_t intf) -{ - int ret = 0; - - struct usbh_audio *audio_class = (struct usbh_audio *)hport->config.intf[intf].priv; - - if (audio_class) { - usbh_audio_devno_free(audio_class); - - if (audio_class->isoin) { - usbh_pipe_free(audio_class->isoin); - } - - if (audio_class->isoout) { - usbh_pipe_free(audio_class->isoout); - } - - usbh_audio_stop(audio_class); - memset(audio_class, 0, sizeof(struct usbh_audio)); - usb_free(audio_class); - - if (hport->config.intf[intf].devname[0] != '\0') - USB_LOG_INFO("Unregister Audio Class:%s\r\n", hport->config.intf[intf].devname); - } - - return ret; -} - -static int usbh_audio_data_connect(struct usbh_hubport *hport, uint8_t intf) -{ - return 0; -} - -static int usbh_audio_data_disconnect(struct usbh_hubport *hport, uint8_t intf) -{ - return 0; -} - -__WEAK void usbh_audio_run(struct usbh_audio *audio_class) -{ -} - -__WEAK void usbh_audio_stop(struct usbh_audio *audio_class) -{ -} - -const struct usbh_class_driver audio_ctrl_class_driver = { - .driver_name = "audio_ctrl", - .connect = usbh_audio_ctrl_connect, - .disconnect = usbh_audio_ctrl_disconnect -}; - -const struct usbh_class_driver audio_streaming_class_driver = { - .driver_name = "audio_streaming", - .connect = usbh_audio_data_connect, - .disconnect = usbh_audio_data_disconnect -}; - -CLASS_INFO_DEFINE const struct usbh_class_info audio_ctrl_intf_class_info = { - .match_flags = USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS, - .class = USB_DEVICE_CLASS_AUDIO, - .subclass = AUDIO_SUBCLASS_AUDIOCONTROL, - .protocol = 0x00, - .vid = 0x00, - .pid = 0x00, - .class_driver = &audio_ctrl_class_driver -}; - -CLASS_INFO_DEFINE const struct usbh_class_info audio_streaming_intf_class_info = { - .match_flags = USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS, - .class = USB_DEVICE_CLASS_AUDIO, - .subclass = AUDIO_SUBCLASS_AUDIOSTREAMING, - .protocol = 0x00, - .vid = 0x00, - .pid = 0x00, - .class_driver = &audio_streaming_class_driver -}; diff --git a/third-party/cherryusb/class/audio/usbh_audio.h b/third-party/cherryusb/class/audio/usbh_audio.h deleted file mode 100644 index dcfed604e73a7930ca3c630262d69033e5de7ae1..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/audio/usbh_audio.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBH_AUDIO_H -#define USBH_AUDIO_H - -#include "usb_audio.h" - -struct usbh_audio_format_type { - uint8_t channels; - uint8_t format_type; - uint8_t bitresolution; - uint8_t sampfreq_num; - uint32_t sampfreq[3]; -}; - -/** - * bSourceID in feature_unit = input_terminal_id - * bSourceID in output_terminal = feature_unit_id - * terminal_link_id = input_terminal_id or output_terminal_id (if input_terminal_type or output_terminal_type is 0x0101) - * - * -*/ -struct usbh_audio_module { - const char *name; - uint8_t data_intf; - uint8_t input_terminal_id; - uint16_t input_terminal_type; - uint16_t input_channel_config; - uint8_t output_terminal_id; - uint16_t output_terminal_type; - uint8_t feature_unit_id; - uint8_t feature_unit_controlsize; - uint8_t feature_unit_controls[8]; - uint8_t terminal_link_id; - struct usbh_audio_format_type altsetting[CONFIG_USBHOST_MAX_INTF_ALTSETTINGS]; -}; - -struct usbh_audio { - struct usbh_hubport *hport; - - uint8_t ctrl_intf; /* interface number */ - uint8_t minor; - usbh_pipe_t isoin; /* ISO IN endpoint */ - usbh_pipe_t isoout; /* ISO OUT endpoint */ - uint16_t isoin_mps; - uint16_t isoout_mps; - bool is_opened; - uint16_t bcdADC; - uint8_t bInCollection; - uint8_t num_of_intf_altsettings; - struct usbh_audio_module module[2]; - uint8_t module_num; -}; - -#ifdef __cplusplus -extern "C" { -#endif - -int usbh_audio_open(struct usbh_audio *audio_class, const char *name, uint32_t samp_freq); -int usbh_audio_close(struct usbh_audio *audio_class, const char *name); -int usbh_audio_set_volume(struct usbh_audio *audio_class, const char *name, uint8_t ch, uint8_t volume); -int usbh_audio_set_mute(struct usbh_audio *audio_class, const char *name, uint8_t ch, bool mute); - -void usbh_audio_run(struct usbh_audio *audio_class); -void usbh_audio_stop(struct usbh_audio *audio_class); - -#ifdef __cplusplus -} -#endif - -#endif /* USBH_AUDIO_H */ diff --git a/third-party/cherryusb/class/cdc/usb_cdc.h b/third-party/cherryusb/class/cdc/usb_cdc.h deleted file mode 100644 index ed8184ebbf10350d801678de98002d16638c5beb..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/cdc/usb_cdc.h +++ /dev/null @@ -1,574 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_CDC_H -#define USB_CDC_H - -/*------------------------------------------------------------------------------ - * Definitions based on usbcdc11.pdf (www.usb.org) - *----------------------------------------------------------------------------*/ -/* Communication device class specification version 1.10 */ -#define CDC_V1_10 0x0110U -// Communication device class specification version 1.2 -#define CDC_V1_2_0 0x0120U - -/* Communication interface class code */ -/* (usbcdc11.pdf, 4.2, Table 15) */ -#define CDC_COMMUNICATION_INTERFACE_CLASS 0x02U - -/* Communication interface class subclass codes */ -/* (usbcdc11.pdf, 4.3, Table 16) */ -#define CDC_SUBCLASS_NONE 0x00 /* Reserved */ -#define CDC_SUBCLASS_DLC 0x01 /* Direct Line Control Model */ -#define CDC_SUBCLASS_ACM 0x02 /* Abstract Control Model */ -#define CDC_SUBCLASS_TCM 0x03 /* Telephone Control Model */ -#define CDC_SUBCLASS_MCM 0x04 /* Multi-Channel Control Model */ -#define CDC_SUBCLASS_CAPI 0x05 /* CAPI Control Model */ -#define CDC_SUBCLASS_ECM 0x06 /* Ethernet Networking Control Model */ -#define CDC_SUBCLASS_ATM 0x07 /* ATM Networking Control Model */ - /* 0x08-0x0d Reserved (future use) */ -#define CDC_SUBCLASS_MBIM 0x0e /* MBIM Control Model */ - /* 0x0f-0x7f Reserved (future use) */ - /* 0x80-0xfe Reserved (vendor specific) */ - -#define CDC_DIRECT_LINE_CONTROL_MODEL 0x01U -#define CDC_ABSTRACT_CONTROL_MODEL 0x02U -#define CDC_TELEPHONE_CONTROL_MODEL 0x03U -#define CDC_MULTI_CHANNEL_CONTROL_MODEL 0x04U -#define CDC_CAPI_CONTROL_MODEL 0x05U -#define CDC_ETHERNET_NETWORKING_CONTROL_MODEL 0x06U -#define CDC_ATM_NETWORKING_CONTROL_MODEL 0x07U -#define CDC_WIRELESS_HANDSET_CONTROL_MODEL 0x08U -#define CDC_DEVICE_MANAGEMENT 0x09U -#define CDC_MOBILE_DIRECT_LINE_MODEL 0x0AU -#define CDC_OBEX 0x0BU -#define CDC_ETHERNET_EMULATION_MODEL 0x0CU -#define CDC_NETWORK_CONTROL_MODEL 0x0DU - -/* Communication interface class control protocol codes */ -/* (usbcdc11.pdf, 4.4, Table 17) */ -#define CDC_COMMON_PROTOCOL_NONE 0x00U -#define CDC_COMMON_PROTOCOL_AT_COMMANDS 0x01U -#define CDC_COMMON_PROTOCOL_AT_COMMANDS_PCCA_101 0x02U -#define CDC_COMMON_PROTOCOL_AT_COMMANDS_PCCA_101_AND_ANNEXO 0x03U -#define CDC_COMMON_PROTOCOL_AT_COMMANDS_GSM_707 0x04U -#define CDC_COMMON_PROTOCOL_AT_COMMANDS_3GPP_27007 0x05U -#define CDC_COMMON_PROTOCOL_AT_COMMANDS_CDMA 0x06U -#define CDC_COMMON_PROTOCOL_ETHERNET_EMULATION_MODEL 0x07U -// NCM Communication Interface Protocol Codes -// (usbncm10.pdf, 4.2, Table 4-2) -#define CDC_NCM_PROTOCOL_NONE 0x00U -#define CDC_NCM_PROTOCOL_OEM 0xFEU - -/* Data interface class code */ -/* (usbcdc11.pdf, 4.5, Table 18) */ -#define CDC_DATA_INTERFACE_CLASS 0x0A - -/* Data Interface Sub-Class Codes ********************************************/ -#define CDC_DATA_SUBCLASS_NONE 0x00 - -/* Data interface class protocol codes */ -/* (usbcdc11.pdf, 4.7, Table 19) */ -#define CDC_DATA_PROTOCOL_ISDN_BRI 0x30 -#define CDC_DATA_PROTOCOL_HDLC 0x31 -#define CDC_DATA_PROTOCOL_TRANSPARENT 0x32 -#define CDC_DATA_PROTOCOL_Q921_MANAGEMENT 0x50 -#define CDC_DATA_PROTOCOL_Q921_DATA_LINK 0x51 -#define CDC_DATA_PROTOCOL_Q921_MULTIPLEXOR 0x52 -#define CDC_DATA_PROTOCOL_V42 0x90 -#define CDC_DATA_PROTOCOL_EURO_ISDN 0x91 -#define CDC_DATA_PROTOCOL_V24_RATE_ADAPTATION 0x92 -#define CDC_DATA_PROTOCOL_CAPI 0x93 -#define CDC_DATA_PROTOCOL_HOST_BASED_DRIVER 0xFD -#define CDC_DATA_PROTOCOL_DESCRIBED_IN_PUFD 0xFE - -/* Type values for bDescriptorType field of functional descriptors */ -/* (usbcdc11.pdf, 5.2.3, Table 24) */ -#define CDC_CS_INTERFACE 0x24 -#define CDC_CS_ENDPOINT 0x25 - -/* Type values for bDescriptorSubtype field of functional descriptors */ -/* (usbcdc11.pdf, 5.2.3, Table 25) */ -#define CDC_FUNC_DESC_HEADER 0x00 -#define CDC_FUNC_DESC_CALL_MANAGEMENT 0x01 -#define CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT 0x02 -#define CDC_FUNC_DESC_DIRECT_LINE_MANAGEMENT 0x03 -#define CDC_FUNC_DESC_TELEPHONE_RINGER 0x04 -#define CDC_FUNC_DESC_REPORTING_CAPABILITIES 0x05 -#define CDC_FUNC_DESC_UNION 0x06 -#define CDC_FUNC_DESC_COUNTRY_SELECTION 0x07 -#define CDC_FUNC_DESC_TELEPHONE_OPERATIONAL_MODES 0x08 -#define CDC_FUNC_DESC_USB_TERMINAL 0x09 -#define CDC_FUNC_DESC_NETWORK_CHANNEL 0x0A -#define CDC_FUNC_DESC_PROTOCOL_UNIT 0x0B -#define CDC_FUNC_DESC_EXTENSION_UNIT 0x0C -#define CDC_FUNC_DESC_MULTI_CHANNEL_MANAGEMENT 0x0D -#define CDC_FUNC_DESC_CAPI_CONTROL_MANAGEMENT 0x0E -#define CDC_FUNC_DESC_ETHERNET_NETWORKING 0x0F -#define CDC_FUNC_DESC_ATM_NETWORKING 0x10 -#define CDC_FUNC_DESC_WIRELESS_HANDSET_CONTROL_MODEL 0x11 -#define CDC_FUNC_DESC_MOBILE_DIRECT_LINE_MODEL 0x12 -#define CDC_FUNC_DESC_MOBILE_DIRECT_LINE_MODEL_DETAIL 0x13 -#define CDC_FUNC_DESC_DEVICE_MANAGEMENT_MODEL 0x14 -#define CDC_FUNC_DESC_OBEX 0x15 -#define CDC_FUNC_DESC_COMMAND_SET 0x16 -#define CDC_FUNC_DESC_COMMAND_SET_DETAIL 0x17 -#define CDC_FUNC_DESC_TELEPHONE_CONTROL_MODEL 0x18 -#define CDC_FUNC_DESC_OBEX_SERVICE_IDENTIFIER 0x19 - -/* CDC class-specific request codes */ -/* (usbcdc11.pdf, 6.2, Table 46) */ -/* see Table 45 for info about the specific requests. */ -#define CDC_REQUEST_SEND_ENCAPSULATED_COMMAND 0x00 -#define CDC_REQUEST_GET_ENCAPSULATED_RESPONSE 0x01 -#define CDC_REQUEST_SET_COMM_FEATURE 0x02 -#define CDC_REQUEST_GET_COMM_FEATURE 0x03 -#define CDC_REQUEST_CLEAR_COMM_FEATURE 0x04 -#define CDC_REQUEST_SET_AUX_LINE_STATE 0x10 -#define CDC_REQUEST_SET_HOOK_STATE 0x11 -#define CDC_REQUEST_PULSE_SETUP 0x12 -#define CDC_REQUEST_SEND_PULSE 0x13 -#define CDC_REQUEST_SET_PULSE_TIME 0x14 -#define CDC_REQUEST_RING_AUX_JACK 0x15 -#define CDC_REQUEST_SET_LINE_CODING 0x20 -#define CDC_REQUEST_GET_LINE_CODING 0x21 -#define CDC_REQUEST_SET_CONTROL_LINE_STATE 0x22 -#define CDC_REQUEST_SEND_BREAK 0x23 -#define CDC_REQUEST_SET_RINGER_PARMS 0x30 -#define CDC_REQUEST_GET_RINGER_PARMS 0x31 -#define CDC_REQUEST_SET_OPERATION_PARMS 0x32 -#define CDC_REQUEST_GET_OPERATION_PARMS 0x33 -#define CDC_REQUEST_SET_LINE_PARMS 0x34 -#define CDC_REQUEST_GET_LINE_PARMS 0x35 -#define CDC_REQUEST_DIAL_DIGITS 0x36 -#define CDC_REQUEST_SET_UNIT_PARAMETER 0x37 -#define CDC_REQUEST_GET_UNIT_PARAMETER 0x38 -#define CDC_REQUEST_CLEAR_UNIT_PARAMETER 0x39 -#define CDC_REQUEST_GET_PROFILE 0x3A -#define CDC_REQUEST_SET_ETHERNET_MULTICAST_FILTERS 0x40 -#define CDC_REQUEST_SET_ETHERNET_PMP_FILTER 0x41 -#define CDC_REQUEST_GET_ETHERNET_PMP_FILTER 0x42 -#define CDC_REQUEST_SET_ETHERNET_PACKET_FILTER 0x43 -#define CDC_REQUEST_GET_ETHERNET_STATISTIC 0x44 -#define CDC_REQUEST_SET_ATM_DATA_FORMAT 0x50 -#define CDC_REQUEST_GET_ATM_DEVICE_STATISTICS 0x51 -#define CDC_REQUEST_SET_ATM_DEFAULT_VC 0x52 -#define CDC_REQUEST_GET_ATM_VC_STATISTICS 0x53 - -/* Communication feature selector codes */ -/* (usbcdc11.pdf, 6.2.2..6.2.4, Table 47) */ -#define CDC_ABSTRACT_STATE 0x01 -#define CDC_COUNTRY_SETTING 0x02 - -/** Control Signal Bitmap Values for SetControlLineState */ -#define SET_CONTROL_LINE_STATE_RTS 0x02 -#define SET_CONTROL_LINE_STATE_DTR 0x01 - -/* Feature Status returned for ABSTRACT_STATE Selector */ -/* (usbcdc11.pdf, 6.2.3, Table 48) */ -#define CDC_IDLE_SETTING (1 << 0) -#define CDC_DATA_MULTPLEXED_STATE (1 << 1) - -/* Control signal bitmap values for the SetControlLineState request */ -/* (usbcdc11.pdf, 6.2.14, Table 51) */ -#define CDC_DTE_PRESENT (1 << 0) -#define CDC_ACTIVATE_CARRIER (1 << 1) - -/* CDC class-specific notification codes */ -/* (usbcdc11.pdf, 6.3, Table 68) */ -/* see Table 67 for Info about class-specific notifications */ -#define CDC_NOTIFICATION_NETWORK_CONNECTION 0x00 -#define CDC_RESPONSE_AVAILABLE 0x01 -#define CDC_AUX_JACK_HOOK_STATE 0x08 -#define CDC_RING_DETECT 0x09 -#define CDC_NOTIFICATION_SERIAL_STATE 0x20 -#define CDC_CALL_STATE_CHANGE 0x28 -#define CDC_LINE_STATE_CHANGE 0x29 -#define CDC_CONNECTION_SPEED_CHANGE 0x2A - -/* UART state bitmap values (Serial state notification). */ -/* (usbcdc11.pdf, 6.3.5, Table 69) */ -#define CDC_SERIAL_STATE_OVERRUN (1 << 6) /* receive data overrun error has occurred */ -#define CDC_SERIAL_STATE_OVERRUN_Pos (6) -#define CDC_SERIAL_STATE_OVERRUN_Msk (1 << CDC_SERIAL_STATE_OVERRUN_Pos) -#define CDC_SERIAL_STATE_PARITY (1 << 5) /* parity error has occurred */ -#define CDC_SERIAL_STATE_PARITY_Pos (5) -#define CDC_SERIAL_STATE_PARITY_Msk (1 << CDC_SERIAL_STATE_PARITY_Pos) -#define CDC_SERIAL_STATE_FRAMING (1 << 4) /* framing error has occurred */ -#define CDC_SERIAL_STATE_FRAMING_Pos (4) -#define CDC_SERIAL_STATE_FRAMING_Msk (1 << CDC_SERIAL_STATE_FRAMING_Pos) -#define CDC_SERIAL_STATE_RING (1 << 3) /* state of ring signal detection */ -#define CDC_SERIAL_STATE_RING_Pos (3) -#define CDC_SERIAL_STATE_RING_Msk (1 << CDC_SERIAL_STATE_RING_Pos) -#define CDC_SERIAL_STATE_BREAK (1 << 2) /* state of break detection */ -#define CDC_SERIAL_STATE_BREAK_Pos (2) -#define CDC_SERIAL_STATE_BREAK_Msk (1 << CDC_SERIAL_STATE_BREAK_Pos) -#define CDC_SERIAL_STATE_TX_CARRIER (1 << 1) /* state of transmission carrier */ -#define CDC_SERIAL_STATE_TX_CARRIER_Pos (1) -#define CDC_SERIAL_STATE_TX_CARRIER_Msk (1 << CDC_SERIAL_STATE_TX_CARRIER_Pos) -#define CDC_SERIAL_STATE_RX_CARRIER (1 << 0) /* state of receiver carrier */ -#define CDC_SERIAL_STATE_RX_CARRIER_Pos (0) -#define CDC_SERIAL_STATE_RX_CARRIER_Msk (1 << CDC_SERIAL_STATE_RX_CARRIER_Pos) - -/*------------------------------------------------------------------------------ - * Structures based on usbcdc11.pdf (www.usb.org) - *----------------------------------------------------------------------------*/ - -/* Header functional descriptor */ -/* (usbcdc11.pdf, 5.2.3.1) */ -/* This header must precede any list of class-specific descriptors. */ -struct cdc_header_descriptor { - uint8_t bFunctionLength; /* size of this descriptor in bytes */ - uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */ - uint8_t bDescriptorSubtype; /* Header functional descriptor subtype */ - uint16_t bcdCDC; /* USB CDC specification release version */ -} __PACKED; - -/* Call management functional descriptor */ -/* (usbcdc11.pdf, 5.2.3.2) */ -/* Describes the processing of calls for the communication class interface. */ -struct cdc_call_management_descriptor { - uint8_t bFunctionLength; /* size of this descriptor in bytes */ - uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */ - uint8_t bDescriptorSubtype; /* call management functional descriptor subtype */ - uint8_t bmCapabilities; /* capabilities that this configuration supports */ - uint8_t bDataInterface; /* interface number of the data class interface used for call management (optional) */ -} __PACKED; - -/* Abstract control management functional descriptor */ -/* (usbcdc11.pdf, 5.2.3.3) */ -/* Describes the command supported by the communication interface class with the Abstract Control Model subclass code. */ -struct cdc_abstract_control_management_descriptor { - uint8_t bFunctionLength; /* size of this descriptor in bytes */ - uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */ - uint8_t bDescriptorSubtype; /* abstract control management functional descriptor subtype */ - uint8_t bmCapabilities; /* capabilities supported by this configuration */ -} __PACKED; - -/* Union functional descriptors */ -/* (usbcdc11.pdf, 5.2.3.8) */ -/* Describes the relationship between a group of interfaces that can be considered to form a functional unit. */ -struct cdc_union_descriptor { - uint8_t bFunctionLength; /* size of this descriptor in bytes */ - uint8_t bDescriptorType; /* CS_INTERFACE descriptor type */ - uint8_t bDescriptorSubtype; /* union functional descriptor subtype */ - uint8_t bMasterInterface; /* interface number designated as master */ -} __PACKED; - -/* Union functional descriptors with one slave interface */ -/* (usbcdc11.pdf, 5.2.3.8) */ -struct cdc_union_1slave_descriptor { - uint8_t bFunctionLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t bControlInterface; - uint8_t bSubordinateInterface0; -} __PACKED; - -/* Line coding structure for GET_LINE_CODING / SET_LINE_CODING class requests*/ -/* Format of the data returned when a GetLineCoding request is received */ -/* (usbcdc11.pdf, 6.2.13) */ -struct cdc_line_coding { - uint32_t dwDTERate; /* Data terminal rate in bits per second */ - uint8_t bCharFormat; /* Number of stop bits */ - uint8_t bParityType; /* Parity bit type */ - uint8_t bDataBits; /* Number of data bits */ -} __PACKED; - -/** Data structure for the notification about SerialState */ -struct cdc_acm_notification { - uint8_t bmRequestType; - uint8_t bNotificationType; - uint16_t wValue; - uint16_t wIndex; - uint16_t wLength; - uint16_t data; -} __PACKED; - -/** Ethernet Networking Functional Descriptor */ -struct cdc_ecm_descriptor { - uint8_t bFunctionLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubtype; - uint8_t iMACAddress; - uint32_t bmEthernetStatistics; - uint16_t wMaxSegmentSize; - uint16_t wNumberMCFilters; - uint8_t bNumberPowerFilters; -} __PACKED; - -/*Length of template descriptor: 66 bytes*/ -#define CDC_ACM_DESCRIPTOR_LEN (8 + 9 + 5 + 5 + 4 + 5 + 7 + 9 + 7 + 7) -// clang-format off -#ifndef CONFIG_USB_HS -#define CDC_ACM_DESCRIPTOR_INIT(bFirstInterface, int_ep, out_ep, in_ep, str_idx) \ - /* Interface Associate */ \ - 0x08, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE_ASSOCIATION, /* bDescriptorType */ \ - bFirstInterface, /* bFirstInterface */ \ - 0x02, /* bInterfaceCount */ \ - USB_DEVICE_CLASS_CDC, /* bFunctionClass */ \ - CDC_ABSTRACT_CONTROL_MODEL, /* bFunctionSubClass */ \ - CDC_COMMON_PROTOCOL_AT_COMMANDS, /* bFunctionProtocol */ \ - 0x00, /* iFunction */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - bFirstInterface, /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x01, /* bNumEndpoints */ \ - USB_DEVICE_CLASS_CDC, /* bInterfaceClass */ \ - CDC_ABSTRACT_CONTROL_MODEL, /* bInterfaceSubClass */ \ - CDC_COMMON_PROTOCOL_AT_COMMANDS, /* bInterfaceProtocol */ \ - str_idx, /* iInterface */ \ - 0x05, /* bLength */ \ - CDC_CS_INTERFACE, /* bDescriptorType */ \ - CDC_FUNC_DESC_HEADER, /* bDescriptorSubtype */ \ - WBVAL(CDC_V1_10), /* bcdCDC */ \ - 0x05, /* bLength */ \ - CDC_CS_INTERFACE, /* bDescriptorType */ \ - CDC_FUNC_DESC_CALL_MANAGEMENT, /* bDescriptorSubtype */ \ - 0x00, /* bmCapabilities */ \ - (uint8_t)(bFirstInterface + 1), /* bDataInterface */ \ - 0x04, /* bLength */ \ - CDC_CS_INTERFACE, /* bDescriptorType */ \ - CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, /* bDescriptorSubtype */ \ - 0x02, /* bmCapabilities */ \ - 0x05, /* bLength */ \ - CDC_CS_INTERFACE, /* bDescriptorType */ \ - CDC_FUNC_DESC_UNION, /* bDescriptorSubtype */ \ - bFirstInterface, /* bMasterInterface */ \ - (uint8_t)(bFirstInterface + 1), /* bSlaveInterface0 */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - int_ep, /* bEndpointAddress */ \ - 0x03, /* bmAttributes */ \ - 0x08, 0x00, /* wMaxPacketSize */ \ - 0x0a, /* bInterval */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - (uint8_t)(bFirstInterface + 1), /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x02, /* bNumEndpoints */ \ - CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass */ \ - 0x00, /* bInterfaceSubClass */ \ - 0x00, /* bInterfaceProtocol */ \ - 0x00, /* iInterface */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - out_ep, /* bEndpointAddress */ \ - 0x02, /* bmAttributes */ \ - 0x40, 0x00, /* wMaxPacketSize */ \ - 0x00, /* bInterval */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - in_ep, /* bEndpointAddress */ \ - 0x02, /* bmAttributes */ \ - 0x40, 0x00, /* wMaxPacketSize */ \ - 0x00 /* bInterval */ -#else -#define CDC_ACM_DESCRIPTOR_INIT(bFirstInterface, int_ep, out_ep, in_ep, str_idx) \ - /* Interface Associate */ \ - 0x08, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE_ASSOCIATION, /* bDescriptorType */ \ - bFirstInterface, /* bFirstInterface */ \ - 0x02, /* bInterfaceCount */ \ - USB_DEVICE_CLASS_CDC, /* bFunctionClass */ \ - CDC_ABSTRACT_CONTROL_MODEL, /* bFunctionSubClass */ \ - CDC_COMMON_PROTOCOL_AT_COMMANDS, /* bFunctionProtocol */ \ - 0x00, /* iFunction */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - bFirstInterface, /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x01, /* bNumEndpoints */ \ - USB_DEVICE_CLASS_CDC, /* bInterfaceClass */ \ - CDC_ABSTRACT_CONTROL_MODEL, /* bInterfaceSubClass */ \ - CDC_COMMON_PROTOCOL_AT_COMMANDS, /* bInterfaceProtocol */ \ - str_idx, /* iInterface */ \ - 0x05, /* bLength */ \ - CDC_CS_INTERFACE, /* bDescriptorType */ \ - CDC_FUNC_DESC_HEADER, /* bDescriptorSubtype */ \ - WBVAL(CDC_V1_10), /* bcdCDC */ \ - 0x05, /* bLength */ \ - CDC_CS_INTERFACE, /* bDescriptorType */ \ - CDC_FUNC_DESC_CALL_MANAGEMENT, /* bDescriptorSubtype */ \ - 0x00, /* bmCapabilities */ \ - (uint8_t)(bFirstInterface + 1), /* bDataInterface */ \ - 0x04, /* bLength */ \ - CDC_CS_INTERFACE, /* bDescriptorType */ \ - CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, /* bDescriptorSubtype */ \ - 0x02, /* bmCapabilities */ \ - 0x05, /* bLength */ \ - CDC_CS_INTERFACE, /* bDescriptorType */ \ - CDC_FUNC_DESC_UNION, /* bDescriptorSubtype */ \ - bFirstInterface, /* bMasterInterface */ \ - (uint8_t)(bFirstInterface + 1), /* bSlaveInterface0 */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - int_ep, /* bEndpointAddress */ \ - 0x03, /* bmAttributes */ \ - 0x08, 0x00, /* wMaxPacketSize */ \ - 0x10, /* bInterval */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - (uint8_t)(bFirstInterface + 1), /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x02, /* bNumEndpoints */ \ - CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass */ \ - 0x00, /* bInterfaceSubClass */ \ - 0x00, /* bInterfaceProtocol */ \ - 0x00, /* iInterface */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - out_ep, /* bEndpointAddress */ \ - 0x02, /* bmAttributes */ \ - 0x00, 0x02, /* wMaxPacketSize */ \ - 0x00, /* bInterval */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - in_ep, /* bEndpointAddress */ \ - 0x02, /* bmAttributes */ \ - 0x00, 0x02, /* wMaxPacketSize */ \ - 0x00 /* bInterval */ -#endif -// clang-format on - -/*Length of template descriptor: 66 bytes*/ -#define CDC_RNDIS_DESCRIPTOR_LEN (8 + 9 + 5 + 5 + 4 + 5 + 7 + 9 + 7 + 7) -// clang-format off -#ifndef CONFIG_USB_HS -#define CDC_RNDIS_DESCRIPTOR_INIT(bFirstInterface, int_ep, out_ep, in_ep, str_idx) \ - /* Interface Associate */ \ - 0x08, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE_ASSOCIATION, /* bDescriptorType */ \ - bFirstInterface, /* bFirstInterface */ \ - 0x02, /* bInterfaceCount */ \ - USB_DEVICE_CLASS_WIRELESS, /* bFunctionClass */ \ - CDC_DIRECT_LINE_CONTROL_MODEL, /* bFunctionSubClass */ \ - CDC_COMMON_PROTOCOL_AT_COMMANDS_PCCA_101_AND_ANNEXO, /* bFunctionProtocol */ \ - 0x00, /* iFunction */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - bFirstInterface, /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x01, /* bNumEndpoints */ \ - USB_DEVICE_CLASS_WIRELESS, /* bInterfaceClass */ \ - CDC_DIRECT_LINE_CONTROL_MODEL, /* bInterfaceSubClass */ \ - CDC_COMMON_PROTOCOL_AT_COMMANDS_PCCA_101_AND_ANNEXO, /* bInterfaceProtocol */ \ - str_idx, /* iInterface */ \ - 0x05, /* bLength */ \ - CDC_CS_INTERFACE, /* bDescriptorType */ \ - CDC_FUNC_DESC_HEADER, /* bDescriptorSubtype */ \ - WBVAL(CDC_V1_10), /* bcdCDC */ \ - 0x05, /* bLength */ \ - CDC_CS_INTERFACE, /* bDescriptorType */ \ - CDC_FUNC_DESC_CALL_MANAGEMENT, /* bDescriptorSubtype */ \ - 0x00, /* bmCapabilities */ \ - (uint8_t)(bFirstInterface + 1), /* bDataInterface */ \ - 0x04, /* bLength */ \ - CDC_CS_INTERFACE, /* bDescriptorType */ \ - CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, /* bDescriptorSubtype */ \ - 0x00, /* bmCapabilities */ \ - 0x05, /* bLength */ \ - CDC_CS_INTERFACE, /* bDescriptorType */ \ - CDC_FUNC_DESC_UNION, /* bDescriptorSubtype */ \ - bFirstInterface, /* bMasterInterface */ \ - (uint8_t)(bFirstInterface + 1), /* bSlaveInterface0 */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - int_ep, /* bEndpointAddress */ \ - 0x03, /* bmAttributes */ \ - 0x08, 0x00, /* wMaxPacketSize */ \ - 0x10, /* bInterval */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - (uint8_t)(bFirstInterface + 1), /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x02, /* bNumEndpoints */ \ - CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass */ \ - 0x00, /* bInterfaceSubClass */ \ - 0x00, /* bInterfaceProtocol */ \ - 0x00, /* iInterface */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - out_ep, /* bEndpointAddress */ \ - 0x02, /* bmAttributes */ \ - 0x40, 0x00, /* wMaxPacketSize */ \ - 0x00, /* bInterval */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - in_ep, /* bEndpointAddress */ \ - 0x02, /* bmAttributes */ \ - 0x40, 0x00, /* wMaxPacketSize */ \ - 0x00 /* bInterval */ -#else -#define CDC_RNDIS_DESCRIPTOR_INIT(bFirstInterface, int_ep, out_ep, in_ep, str_idx) \ - /* Interface Associate */ \ - 0x08, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE_ASSOCIATION, /* bDescriptorType */ \ - bFirstInterface, /* bFirstInterface */ \ - 0x02, /* bInterfaceCount */ \ - USB_DEVICE_CLASS_WIRELESS, /* bFunctionClass */ \ - CDC_DIRECT_LINE_CONTROL_MODEL, /* bFunctionSubClass */ \ - CDC_COMMON_PROTOCOL_AT_COMMANDS_PCCA_101_AND_ANNEXO, /* bFunctionProtocol */ \ - 0x00, /* iFunction */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - bFirstInterface, /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x01, /* bNumEndpoints */ \ - USB_DEVICE_CLASS_WIRELESS, /* bInterfaceClass */ \ - CDC_DIRECT_LINE_CONTROL_MODEL, /* bInterfaceSubClass */ \ - CDC_COMMON_PROTOCOL_AT_COMMANDS_PCCA_101_AND_ANNEXO, /* bInterfaceProtocol */ \ - str_idx, /* iInterface */ \ - 0x05, /* bLength */ \ - CDC_CS_INTERFACE, /* bDescriptorType */ \ - CDC_FUNC_DESC_HEADER, /* bDescriptorSubtype */ \ - WBVAL(CDC_V1_10), /* bcdCDC */ \ - 0x05, /* bLength */ \ - CDC_CS_INTERFACE, /* bDescriptorType */ \ - CDC_FUNC_DESC_CALL_MANAGEMENT, /* bDescriptorSubtype */ \ - 0x00, /* bmCapabilities */ \ - (uint8_t)(bFirstInterface + 1), /* bDataInterface */ \ - 0x04, /* bLength */ \ - CDC_CS_INTERFACE, /* bDescriptorType */ \ - CDC_FUNC_DESC_ABSTRACT_CONTROL_MANAGEMENT, /* bDescriptorSubtype */ \ - 0x00, /* bmCapabilities */ \ - 0x05, /* bLength */ \ - CDC_CS_INTERFACE, /* bDescriptorType */ \ - CDC_FUNC_DESC_UNION, /* bDescriptorSubtype */ \ - bFirstInterface, /* bMasterInterface */ \ - (uint8_t)(bFirstInterface + 1), /* bSlaveInterface0 */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - int_ep, /* bEndpointAddress */ \ - 0x03, /* bmAttributes */ \ - 0x08, 0x00, /* wMaxPacketSize */ \ - 0x10, /* bInterval */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - (uint8_t)(bFirstInterface + 1), /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x02, /* bNumEndpoints */ \ - CDC_DATA_INTERFACE_CLASS, /* bInterfaceClass */ \ - 0x00, /* bInterfaceSubClass */ \ - 0x00, /* bInterfaceProtocol */ \ - 0x00, /* iInterface */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - out_ep, /* bEndpointAddress */ \ - 0x02, /* bmAttributes */ \ - 0x00, 0x02, /* wMaxPacketSize */ \ - 0x00, /* bInterval */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - in_ep, /* bEndpointAddress */ \ - 0x02, /* bmAttributes */ \ - 0x00, 0x02, /* wMaxPacketSize */ \ - 0x00 /* bInterval */ -#endif -// clang-format on - -#endif /* USB_CDC_H */ diff --git a/third-party/cherryusb/class/cdc/usbd_cdc.c b/third-party/cherryusb/class/cdc/usbd_cdc.c deleted file mode 100644 index 1820037eb6af78d32c2237a880fdd605a7f8d4af..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/cdc/usbd_cdc.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbd_core.h" -#include "usbd_cdc.h" - -const char *stop_name[] = { "1", "1.5", "2" }; -const char *parity_name[] = { "N", "O", "E", "M", "S" }; - -static int cdc_acm_class_interface_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - USB_LOG_DBG("CDC Class request: " - "bRequest 0x%02x\r\n", - setup->bRequest); - - struct cdc_line_coding line_coding; - bool dtr, rts; - uint8_t intf_num = LO_BYTE(setup->wIndex); - - switch (setup->bRequest) { - case CDC_REQUEST_SET_LINE_CODING: - - /*******************************************************************************/ - /* Line Coding Structure */ - /*-----------------------------------------------------------------------------*/ - /* Offset | Field | Size | Value | Description */ - /* 0 | dwDTERate | 4 | Number |Data terminal rate, in bits per second*/ - /* 4 | bCharFormat | 1 | Number | Stop bits */ - /* 0 - 1 Stop bit */ - /* 1 - 1.5 Stop bits */ - /* 2 - 2 Stop bits */ - /* 5 | bParityType | 1 | Number | Parity */ - /* 0 - None */ - /* 1 - Odd */ - /* 2 - Even */ - /* 3 - Mark */ - /* 4 - Space */ - /* 6 | bDataBits | 1 | Number Data bits (5, 6, 7, 8 or 16). */ - /*******************************************************************************/ - memcpy(&line_coding, *data, setup->wLength); - USB_LOG_DBG("Set intf:%d linecoding <%d %d %s %s>\r\n", - intf_num, - line_coding.dwDTERate, - line_coding.bDataBits, - parity_name[line_coding.bParityType], - stop_name[line_coding.bCharFormat]); - usbd_cdc_acm_set_line_coding(intf_num, &line_coding); - break; - - case CDC_REQUEST_SET_CONTROL_LINE_STATE: { - dtr = (setup->wValue & 0x0001); - rts = (setup->wValue & 0x0002); - USB_LOG_DBG("Set intf:%d DTR 0x%x,RTS 0x%x\r\n", - intf_num, - dtr, - rts); - usbd_cdc_acm_set_dtr(intf_num, dtr); - usbd_cdc_acm_set_rts(intf_num, rts); - } break; - - case CDC_REQUEST_GET_LINE_CODING: - usbd_cdc_acm_get_line_coding(intf_num, &line_coding); - memcpy(*data, &line_coding, 7); - *len = 7; - USB_LOG_DBG("Get intf:%d linecoding %d %d %d %d\r\n", - intf_num, - line_coding.dwDTERate, - line_coding.bCharFormat, - line_coding.bParityType, - line_coding.bDataBits); - break; - - default: - USB_LOG_WRN("Unhandled CDC Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - - return 0; -} - -struct usbd_interface *usbd_cdc_acm_init_intf(struct usbd_interface *intf) -{ - intf->class_interface_handler = cdc_acm_class_interface_request_handler; - intf->class_endpoint_handler = NULL; - intf->vendor_handler = NULL; - intf->notify_handler = NULL; - - return intf; -} - -__WEAK void usbd_cdc_acm_set_line_coding(uint8_t intf, struct cdc_line_coding *line_coding) -{ -} - -__WEAK void usbd_cdc_acm_get_line_coding(uint8_t intf, struct cdc_line_coding *line_coding) -{ - line_coding->dwDTERate = 2000000; - line_coding->bDataBits = 8; - line_coding->bParityType = 0; - line_coding->bCharFormat = 0; -} - -__WEAK void usbd_cdc_acm_set_dtr(uint8_t intf, bool dtr) -{ -} - -__WEAK void usbd_cdc_acm_set_rts(uint8_t intf, bool rts) -{ -} \ No newline at end of file diff --git a/third-party/cherryusb/class/cdc/usbd_cdc.h b/third-party/cherryusb/class/cdc/usbd_cdc.h deleted file mode 100644 index b4f5d9939366808b8cdd185a8a470e8e88756ada..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/cdc/usbd_cdc.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBD_CDC_H -#define USBD_CDC_H - -#include "usb_cdc.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Init cdc acm interface driver */ -struct usbd_interface *usbd_cdc_acm_init_intf(struct usbd_interface *intf); - -/* Setup request command callback api */ -void usbd_cdc_acm_set_line_coding(uint8_t intf, struct cdc_line_coding *line_coding); -void usbd_cdc_acm_get_line_coding(uint8_t intf, struct cdc_line_coding *line_coding); -void usbd_cdc_acm_set_dtr(uint8_t intf, bool dtr); -void usbd_cdc_acm_set_rts(uint8_t intf, bool rts); - -#ifdef __cplusplus -} -#endif - -#endif /* USBD_CDC_H */ diff --git a/third-party/cherryusb/class/cdc/usbh_cdc_acm.c b/third-party/cherryusb/class/cdc/usbh_cdc_acm.c deleted file mode 100644 index bf1babb82a7275b0374fbd90bef0504fe423cf8e..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/cdc/usbh_cdc_acm.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbh_core.h" -#include "usbh_cdc_acm.h" - -#define DEV_FORMAT "/dev/ttyACM%d" - -static uint32_t g_devinuse = 0; - -USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX struct cdc_line_coding g_cdc_line_coding; - -static int usbh_cdc_acm_devno_alloc(struct usbh_cdc_acm *cdc_acm_class) -{ - int devno; - - for (devno = 0; devno < 32; devno++) { - uint32_t bitno = 1 << devno; - if ((g_devinuse & bitno) == 0) { - g_devinuse |= bitno; - cdc_acm_class->minor = devno; - return 0; - } - } - return -EMFILE; -} - -static void usbh_cdc_acm_devno_free(struct usbh_cdc_acm *cdc_acm_class) -{ - int devno = cdc_acm_class->minor; - - if (devno >= 0 && devno < 32) { - g_devinuse &= ~(1 << devno); - } -} - -int usbh_cdc_acm_set_line_coding(struct usbh_cdc_acm *cdc_acm_class, struct cdc_line_coding *line_coding) -{ - struct usb_setup_packet *setup = cdc_acm_class->hport->setup; - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = CDC_REQUEST_SET_LINE_CODING; - setup->wValue = 0; - setup->wIndex = cdc_acm_class->ctrl_intf; - setup->wLength = 7; - - memcpy((uint8_t *)&g_cdc_line_coding, line_coding, sizeof(struct cdc_line_coding)); - - return usbh_control_transfer(cdc_acm_class->hport->ep0, setup, (uint8_t *)&g_cdc_line_coding); -} - -int usbh_cdc_acm_get_line_coding(struct usbh_cdc_acm *cdc_acm_class, struct cdc_line_coding *line_coding) -{ - struct usb_setup_packet *setup = cdc_acm_class->hport->setup; - int ret; - - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = CDC_REQUEST_GET_LINE_CODING; - setup->wValue = 0; - setup->wIndex = cdc_acm_class->ctrl_intf; - setup->wLength = 7; - - ret = usbh_control_transfer(cdc_acm_class->hport->ep0, setup, (uint8_t *)&g_cdc_line_coding); - if (ret < 0) { - return ret; - } - memcpy(line_coding, (uint8_t *)&g_cdc_line_coding, sizeof(struct cdc_line_coding)); - return ret; -} - -int usbh_cdc_acm_set_line_state(struct usbh_cdc_acm *cdc_acm_class, bool dtr, bool rts) -{ - struct usb_setup_packet *setup = cdc_acm_class->hport->setup; - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = CDC_REQUEST_SET_CONTROL_LINE_STATE; - setup->wValue = (dtr << 0) | (rts << 1); - setup->wIndex = cdc_acm_class->ctrl_intf; - setup->wLength = 0; - - cdc_acm_class->dtr = dtr; - cdc_acm_class->rts = rts; - - return usbh_control_transfer(cdc_acm_class->hport->ep0, setup, NULL); -} - -static int usbh_cdc_acm_connect(struct usbh_hubport *hport, uint8_t intf) -{ - struct usb_endpoint_descriptor *ep_desc; - int ret; - - struct usbh_cdc_acm *cdc_acm_class = usb_malloc(sizeof(struct usbh_cdc_acm)); - if (cdc_acm_class == NULL) { - USB_LOG_ERR("Fail to alloc cdc_acm_class\r\n"); - return -ENOMEM; - } - - memset(cdc_acm_class, 0, sizeof(struct usbh_cdc_acm)); - usbh_cdc_acm_devno_alloc(cdc_acm_class); - cdc_acm_class->hport = hport; - cdc_acm_class->ctrl_intf = intf; - cdc_acm_class->data_intf = intf + 1; - - hport->config.intf[intf].priv = cdc_acm_class; - hport->config.intf[intf + 1].priv = NULL; - - cdc_acm_class->linecoding.dwDTERate = 115200; - cdc_acm_class->linecoding.bDataBits = 8; - cdc_acm_class->linecoding.bParityType = 0; - cdc_acm_class->linecoding.bCharFormat = 0; - ret = usbh_cdc_acm_set_line_coding(cdc_acm_class, &cdc_acm_class->linecoding); - if (ret < 0) { - USB_LOG_ERR("Fail to set linecoding\r\n"); - return ret; - } - - ret = usbh_cdc_acm_set_line_state(cdc_acm_class, true, true); - if (ret < 0) { - USB_LOG_ERR("Fail to set line state\r\n"); - return ret; - } - -#ifdef CONFIG_USBHOST_CDC_ACM_NOTIFY - ep_desc = &hport->config.intf[intf].altsetting[0].ep[0].ep_desc; - ep_cfg.ep_addr = ep_desc->bEndpointAddress; - ep_cfg.ep_type = ep_desc->bmAttributes & USB_ENDPOINT_TYPE_MASK; - ep_cfg.ep_mps = ep_desc->wMaxPacketSize; - ep_cfg.ep_interval = ep_desc->bInterval; - ep_cfg.hport = hport; - usbh_pipe_alloc(&cdc_acm_class->intin, &ep_cfg); - -#endif - for (uint8_t i = 0; i < hport->config.intf[intf + 1].altsetting[0].intf_desc.bNumEndpoints; i++) { - ep_desc = &hport->config.intf[intf + 1].altsetting[0].ep[i].ep_desc; - - if (ep_desc->bEndpointAddress & 0x80) { - usbh_hport_activate_epx(&cdc_acm_class->bulkin, hport, ep_desc); - } else { - usbh_hport_activate_epx(&cdc_acm_class->bulkout, hport, ep_desc); - } - } - - snprintf(hport->config.intf[intf].devname, CONFIG_USBHOST_DEV_NAMELEN, DEV_FORMAT, cdc_acm_class->minor); - - USB_LOG_INFO("Register CDC ACM Class:%s\r\n", hport->config.intf[intf].devname); - - usbh_cdc_acm_run(cdc_acm_class); - return ret; -} - -static int usbh_cdc_acm_disconnect(struct usbh_hubport *hport, uint8_t intf) -{ - int ret = 0; - - struct usbh_cdc_acm *cdc_acm_class = (struct usbh_cdc_acm *)hport->config.intf[intf].priv; - - if (cdc_acm_class) { - usbh_cdc_acm_devno_free(cdc_acm_class); - - if (cdc_acm_class->bulkin) { - usbh_pipe_free(cdc_acm_class->bulkin); - } - - if (cdc_acm_class->bulkout) { - usbh_pipe_free(cdc_acm_class->bulkout); - } - - usbh_cdc_acm_stop(cdc_acm_class); - memset(cdc_acm_class, 0, sizeof(struct usbh_cdc_acm)); - usb_free(cdc_acm_class); - - if (hport->config.intf[intf].devname[0] != '\0') - USB_LOG_INFO("Unregister CDC ACM Class:%s\r\n", hport->config.intf[intf].devname); - } - - return ret; -} - -static int usbh_cdc_data_connect(struct usbh_hubport *hport, uint8_t intf) -{ - return 0; -} - -static int usbh_cdc_data_disconnect(struct usbh_hubport *hport, uint8_t intf) -{ - return 0; -} - -__WEAK void usbh_cdc_acm_run(struct usbh_cdc_acm *cdc_acm_class) -{ - -} - -__WEAK void usbh_cdc_acm_stop(struct usbh_cdc_acm *cdc_acm_class) -{ - -} - -const struct usbh_class_driver cdc_acm_class_driver = { - .driver_name = "cdc_acm", - .connect = usbh_cdc_acm_connect, - .disconnect = usbh_cdc_acm_disconnect -}; - -const struct usbh_class_driver cdc_data_class_driver = { - .driver_name = "cdc_data", - .connect = usbh_cdc_data_connect, - .disconnect = usbh_cdc_data_disconnect -}; - -CLASS_INFO_DEFINE const struct usbh_class_info cdc_acm_class_info = { - .match_flags = USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS | USB_CLASS_MATCH_INTF_PROTOCOL, - .class = USB_DEVICE_CLASS_CDC, - .subclass = CDC_ABSTRACT_CONTROL_MODEL, - .protocol = CDC_COMMON_PROTOCOL_AT_COMMANDS, - .vid = 0x00, - .pid = 0x00, - .class_driver = &cdc_acm_class_driver -}; - -CLASS_INFO_DEFINE const struct usbh_class_info cdc_data_class_info = { - .match_flags = USB_CLASS_MATCH_INTF_CLASS, - .class = USB_DEVICE_CLASS_CDC_DATA, - .subclass = 0x00, - .protocol = 0x00, - .vid = 0x00, - .pid = 0x00, - .class_driver = &cdc_data_class_driver -}; diff --git a/third-party/cherryusb/class/cdc/usbh_cdc_acm.h b/third-party/cherryusb/class/cdc/usbh_cdc_acm.h deleted file mode 100644 index 3ffa64d0f8f8d2d6691d7f1ed4b0d3db52b73299..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/cdc/usbh_cdc_acm.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBH_CDC_ACM_H -#define USBH_CDC_ACM_H - -#include "usb_cdc.h" - -struct usbh_cdc_acm { - struct usbh_hubport *hport; - - struct cdc_line_coding linecoding; - uint8_t ctrl_intf; /* Control interface number */ - uint8_t data_intf; /* Data interface number */ - bool dtr; - bool rts; - uint8_t minor; - usbh_pipe_t bulkin; /* Bulk IN endpoint */ - usbh_pipe_t bulkout; /* Bulk OUT endpoint */ -#ifdef CONFIG_USBHOST_CDC_ACM_NOTIFY - usbh_pipe_t intin; /* Interrupt IN endpoint (optional) */ -#endif -}; - -#ifdef __cplusplus -extern "C" { -#endif - -int usbh_cdc_acm_set_line_coding(struct usbh_cdc_acm *cdc_acm_class, struct cdc_line_coding *line_coding); -int usbh_cdc_acm_get_line_coding(struct usbh_cdc_acm *cdc_acm_class, struct cdc_line_coding *line_coding); -int usbh_cdc_acm_set_line_state(struct usbh_cdc_acm *cdc_acm_class, bool dtr, bool rts); - -void usbh_cdc_acm_run(struct usbh_cdc_acm *cdc_acm_class); -void usbh_cdc_acm_stop(struct usbh_cdc_acm *cdc_acm_class); - -#ifdef __cplusplus -} -#endif - -#endif /* USBH_CDC_ACM_H */ diff --git a/third-party/cherryusb/class/dfu/usb_dfu.h b/third-party/cherryusb/class/dfu/usb_dfu.h deleted file mode 100644 index f1ccba88cfbd902c376e8b17c6383db331fda6f3..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/dfu/usb_dfu.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_DFU_H -#define USB_DFU_H - -/**\addtogroup USB_MODULE_DFU USB DFU class - * \brief This module contains USB Device Firmware Upgrade class definitions. - * \details This module based on - * + [USB Device Firmware Upgrade Specification, Revision 1.1] - * (https://www.usb.org/sites/default/files/DFU_1.1.pdf) - * @{ */ - -/** DFU Specification release */ -#define DFU_VERSION 0x0110 - -/** DFU Class Subclass */ -#define DFU_SUBCLASS_DFU 0x01 - -/** DFU Class runtime Protocol */ -#define DFU_PROTOCOL_RUNTIME 0x01 - -/** DFU Class DFU mode Protocol */ -#define DFU_PROTOCOL_MODE 0x02 - -/** - * @brief DFU Class Specific Requests - */ -#define DFU_REQUEST_DETACH 0x00 -#define DFU_REQUEST_DNLOAD 0x01 -#define DFU_REQUEST_UPLOAD 0x02 -#define DFU_REQUEST_GETSTATUS 0x03 -#define DFU_REQUEST_CLRSTATUS 0x04 -#define DFU_REQUEST_GETSTATE 0x05 -#define DFU_REQUEST_ABORT 0x06 - -/** DFU FUNCTIONAL descriptor type */ -#define DFU_FUNC_DESC 0x21 - -/** DFU attributes DFU Functional Descriptor */ -#define DFU_ATTR_WILL_DETACH 0x08 -#define DFU_ATTR_MANIFESTATION_TOLERANT 0x04 -#define DFU_ATTR_CAN_UPLOAD 0x02 -#define DFU_ATTR_CAN_DNLOAD 0x01 - -/** bStatus values for the DFU_GETSTATUS response */ -#define DFU_STATUS_OK 0x00U -#define DFU_STATUS_ERR_TARGET 0x01U -#define DFU_STATUS_ERR_FILE 0x02U -#define DFU_STATUS_ERR_WRITE 0x03U -#define DFU_STATUS_ERR_ERASE 0x04U -#define DFU_STATUS_ERR_CHECK_ERASED 0x05U -#define DFU_STATUS_ERR_PROG 0x06U -#define DFU_STATUS_ERR_VERIFY 0x07U -#define DFU_STATUS_ERR_ADDRESS 0x08U -#define DFU_STATUS_ERR_NOTDONE 0x09U -#define DFU_STATUS_ERR_FIRMWARE 0x0AU -#define DFU_STATUS_ERR_VENDOR 0x0BU -#define DFU_STATUS_ERR_USB 0x0CU -#define DFU_STATUS_ERR_POR 0x0DU -#define DFU_STATUS_ERR_UNKNOWN 0x0EU -#define DFU_STATUS_ERR_STALLEDPKT 0x0FU - -/** bState values for the DFU_GETSTATUS response */ -#define DFU_STATE_APP_IDLE 0U -#define DFU_STATE_APP_DETACH 1U -#define DFU_STATE_DFU_IDLE 2U -#define DFU_STATE_DFU_DNLOAD_SYNC 3U -#define DFU_STATE_DFU_DNLOAD_BUSY 4U -#define DFU_STATE_DFU_DNLOAD_IDLE 5U -#define DFU_STATE_DFU_MANIFEST_SYNC 6U -#define DFU_STATE_DFU_MANIFEST 7U -#define DFU_STATE_DFU_MANIFEST_WAIT_RESET 8U -#define DFU_STATE_DFU_UPLOAD_IDLE 9U -#define DFU_STATE_DFU_ERROR 10U - -/** DFU Manifestation State */ -#define DFU_MANIFEST_COMPLETE 0U -#define DFU_MANIFEST_IN_PROGRESS 1U - -/** Special Commands with Download Request */ -#define DFU_CMD_GETCOMMANDS 0U -#define DFU_CMD_SETADDRESSPOINTER 0x21U -#define DFU_CMD_ERASE 0x41U -#define DFU_MEDIA_ERASE 0x00U -#define DFU_MEDIA_PROGRAM 0x01U - -/** Other defines */ -/* Bit Detach capable = bit 3 in bmAttributes field */ -#define DFU_DETACH_MASK (1U << 3) -#define DFU_MANIFEST_MASK (1U << 2) - -/** Run-Time Functional Descriptor */ -struct dfu_runtime_descriptor { - uint8_t bLength; /**<\brief Descriptor length in bytes.*/ - uint8_t bDescriptorType; /**<\brief DFU functional descriptor type.*/ - uint8_t bmAttributes; /**<\brief USB DFU capabilities \ref USB_DFU_CAPAB*/ - uint16_t wDetachTimeout; /**<\brief USB DFU detach timeout in ms.*/ - uint16_t wTransferSize; /**<\brief USB DFU maximum transfer block size in bytes.*/ - uint16_t bcdDFUVersion; /**<\brief USB DFU version \ref VERSION_BCD utility macro.*/ -} __PACKED; - -/**\brief Payload packet to response in DFU_GETSTATUS request */ -struct dfu_info { - uint8_t bStatus; /**<\brief An indication of the status resulting from the - * execution of the most recent request.*/ - uint8_t bPollTimeout; /**<\brief Minimum time (LSB) in ms, that the host should wait - * before sending a subsequent DFU_GETSTATUS request.*/ - uint16_t wPollTimeout; /**<\brief Minimum time (MSB) in ms, that the host should wait - * before sending a subsequent DFU_GETSTATUS request.*/ - uint8_t bState; /**<\brief An indication of the state that the device is going - * to enter immediately following transmission of this response.*/ - uint8_t iString; /**<\brief Index of the status string descriptor.*/ -}; - -// clang-format off -#define DFU_DESCRIPTOR_INIT() \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - 0x00, /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x00, /* bNumEndpoints Default Control Pipe only */ \ - USB_DEVICE_CLASS_APP_SPECIFIC, /* bInterfaceClass */ \ - 0x01, /* bInterfaceSubClass Device Firmware Upgrade */ \ - 0x02, /* bInterfaceProtocol DFU mode */ \ - 0x04, /* iInterface */ /*!< Device Firmware Update Functional Descriptor */ \ - 0x09, /* bLength */ \ - 0x21, /* DFU Functional Descriptor */ \ - 0x0B, /* bmAttributes */ \ - WBVAL(0x00ff), /* wDetachTimeOut */ \ - WBVAL(USBD_DFU_XFER_SIZE), /* wTransferSize */ \ - WBVAL(0x011a) /* bcdDFUVersion */ -// clang-format on - -#endif /* USB_DFU_H */ diff --git a/third-party/cherryusb/class/dfu/usbd_dfu.c b/third-party/cherryusb/class/dfu/usbd_dfu.c deleted file mode 100644 index e22dfcaf84911f1aa5d7d6b27b4c203a3f31739c..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/dfu/usbd_dfu.c +++ /dev/null @@ -1,505 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbd_core.h" -#include "usbd_dfu.h" - -/** Modify the following three parameters according to different platforms */ -#ifndef USBD_DFU_XFER_SIZE -#define USBD_DFU_XFER_SIZE 1024 -#endif - -#ifndef USBD_DFU_APP_DEFAULT_ADD -#define USBD_DFU_APP_DEFAULT_ADD 0x8004000 -#endif - -#ifndef FLASH_PROGRAM_TIME -#define FLASH_PROGRAM_TIME 50 -#endif - -#ifndef FLASH_ERASE_TIME -#define FLASH_ERASE_TIME 50 -#endif - -struct dfu_cfg_priv { - struct dfu_info info; - union { - uint32_t d32[USBD_DFU_XFER_SIZE / 4U]; - uint8_t d8[USBD_DFU_XFER_SIZE]; - } buffer; - - uint32_t wblock_num; - uint32_t wlength; - uint32_t data_ptr; - uint32_t alt_setting; - - uint8_t dev_status[6]; - uint8_t ReservedForAlign[2]; - uint8_t dev_state; - uint8_t manif_state; - uint8_t firmwar_flag; -} usbd_dfu_cfg; - -static void dfu_reset(void) -{ - memset(&usbd_dfu_cfg, 0, sizeof(usbd_dfu_cfg)); - - usbd_dfu_cfg.alt_setting = 0U; - usbd_dfu_cfg.data_ptr = USBD_DFU_APP_DEFAULT_ADD; - usbd_dfu_cfg.wblock_num = 0U; - usbd_dfu_cfg.wlength = 0U; - - usbd_dfu_cfg.manif_state = DFU_MANIFEST_COMPLETE; - usbd_dfu_cfg.dev_state = DFU_STATE_DFU_IDLE; - - usbd_dfu_cfg.dev_status[0] = DFU_STATUS_OK; - usbd_dfu_cfg.dev_status[1] = 0U; - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; - usbd_dfu_cfg.dev_status[4] = DFU_STATE_DFU_IDLE; - usbd_dfu_cfg.dev_status[5] = 0U; -} - -static uint16_t dfu_getstatus(uint32_t add, uint8_t cmd, uint8_t *buffer) -{ - switch (cmd) { - case DFU_MEDIA_PROGRAM: - buffer[1] = (uint8_t)FLASH_PROGRAM_TIME; - buffer[2] = (uint8_t)(FLASH_PROGRAM_TIME << 8); - buffer[3] = 0; - break; - - case DFU_MEDIA_ERASE: - buffer[1] = (uint8_t)FLASH_ERASE_TIME; - buffer[2] = (uint8_t)(FLASH_ERASE_TIME << 8); - buffer[3] = 0; - default: - - break; - } - return (0); -} - -static void dfu_request_detach(void) -{ - if ((usbd_dfu_cfg.dev_state == DFU_STATE_DFU_IDLE) || - (usbd_dfu_cfg.dev_state == DFU_STATE_DFU_DNLOAD_SYNC) || - (usbd_dfu_cfg.dev_state == DFU_STATE_DFU_DNLOAD_IDLE) || - (usbd_dfu_cfg.dev_state == DFU_STATE_DFU_MANIFEST_SYNC) || - (usbd_dfu_cfg.dev_state == DFU_STATE_DFU_UPLOAD_IDLE)) { - /* Update the state machine */ - usbd_dfu_cfg.dev_state = DFU_STATE_DFU_IDLE; - usbd_dfu_cfg.dev_status[0] = DFU_STATUS_OK; - usbd_dfu_cfg.dev_status[1] = 0U; - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; /*bwPollTimeout=0ms*/ - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; - usbd_dfu_cfg.dev_status[5] = 0U; /*iString*/ - usbd_dfu_cfg.wblock_num = 0U; - usbd_dfu_cfg.wlength = 0U; - } -} - -static void dfu_request_upload(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - struct usb_setup_packet *req = setup; - uint32_t addr; - uint8_t *phaddr; - /* Data setup request */ - if (req->wLength > 0U) { - if ((usbd_dfu_cfg.dev_state == DFU_STATE_DFU_IDLE) || (usbd_dfu_cfg.dev_state == DFU_STATE_DFU_UPLOAD_IDLE)) { - /* Update the global length and block number */ - usbd_dfu_cfg.wblock_num = req->wValue; - usbd_dfu_cfg.wlength = MIN(req->wLength, USBD_DFU_XFER_SIZE); - - /* DFU Get Command */ - if (usbd_dfu_cfg.wblock_num == 0U) { - /* Update the state machine */ - usbd_dfu_cfg.dev_state = (usbd_dfu_cfg.wlength > 3U) ? DFU_STATE_DFU_IDLE : DFU_STATE_DFU_UPLOAD_IDLE; - - usbd_dfu_cfg.dev_status[1] = 0U; - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; - - /* Store the values of all supported commands */ - usbd_dfu_cfg.buffer.d8[0] = DFU_CMD_GETCOMMANDS; - usbd_dfu_cfg.buffer.d8[1] = DFU_CMD_SETADDRESSPOINTER; - usbd_dfu_cfg.buffer.d8[2] = DFU_CMD_ERASE; - - /* Send the status data over EP0 */ - memcpy(*data, usbd_dfu_cfg.buffer.d8, 3); - *len = 3; - } else if (usbd_dfu_cfg.wblock_num > 1U) { - usbd_dfu_cfg.dev_state = DFU_STATE_DFU_UPLOAD_IDLE; - - usbd_dfu_cfg.dev_status[1] = 0U; - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; - - addr = ((usbd_dfu_cfg.wblock_num - 2U) * USBD_DFU_XFER_SIZE) + usbd_dfu_cfg.data_ptr; - - /* Return the physical address where data are stored */ - phaddr = dfu_read_flash((uint8_t *)addr, usbd_dfu_cfg.buffer.d8, usbd_dfu_cfg.wlength); - - /* Send the status data over EP0 */ - memcpy(*data, usbd_dfu_cfg.buffer.d8, usbd_dfu_cfg.wlength); - *len = usbd_dfu_cfg.wlength; - } else /* unsupported usbd_dfu_cfg.wblock_num */ - { - usbd_dfu_cfg.dev_state = DFU_STATUS_ERR_STALLEDPKT; - - usbd_dfu_cfg.dev_status[1] = 0U; - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; - - /* Call the error management function (command will be NAKed */ - USB_LOG_ERR("Dfu_request_upload unsupported usbd_dfu_cfg.wblock_num\r\n"); - } - } - /* Unsupported state */ - else { - usbd_dfu_cfg.wlength = 0U; - usbd_dfu_cfg.wblock_num = 0U; - - /* Call the error management function (command will be NAKed */ - USB_LOG_ERR("Dfu_request_upload unsupported state\r\n"); - } - } - /* No Data setup request */ - else { - usbd_dfu_cfg.dev_state = DFU_STATE_DFU_IDLE; - - usbd_dfu_cfg.dev_status[1] = 0U; - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; - } -} - -static void dfu_request_dnload(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - /* Data setup request */ - struct usb_setup_packet *req = setup; - if (req->wLength > 0U) { - if ((usbd_dfu_cfg.dev_state == DFU_STATE_DFU_IDLE) || (usbd_dfu_cfg.dev_state == DFU_STATE_DFU_DNLOAD_IDLE)) { - /* Update the global length and block number */ - usbd_dfu_cfg.wblock_num = req->wValue; - usbd_dfu_cfg.wlength = MIN(req->wLength, USBD_DFU_XFER_SIZE); - - /* Update the state machine */ - usbd_dfu_cfg.dev_state = DFU_STATE_DFU_DNLOAD_SYNC; - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; - - /*!< Data has received complete */ - memcpy((uint8_t *)usbd_dfu_cfg.buffer.d8, (uint8_t *)*data, usbd_dfu_cfg.wlength); - /*!< Set flag = 1 Write the firmware to the flash in the next dfu_request_getstatus */ - usbd_dfu_cfg.firmwar_flag = 1; - } - /* Unsupported state */ - else { - USB_LOG_ERR("Dfu_request_dnload unsupported state\r\n"); - } - } - /* 0 Data DNLOAD request */ - else { - /* End of DNLOAD operation*/ - if ((usbd_dfu_cfg.dev_state == DFU_STATE_DFU_DNLOAD_IDLE) || (usbd_dfu_cfg.dev_state == DFU_STATE_DFU_IDLE)) { - usbd_dfu_cfg.manif_state = DFU_MANIFEST_IN_PROGRESS; - usbd_dfu_cfg.dev_state = DFU_STATE_DFU_MANIFEST_SYNC; - usbd_dfu_cfg.dev_status[1] = 0U; - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; - } else { - /* Call the error management function (command will be NAKed */ - USB_LOG_ERR("Dfu_request_dnload End of DNLOAD operation but dev_state %02x \r\n", usbd_dfu_cfg.dev_state); - } - } -} - -static int8_t dfu_getstatus_special_handler(void) -{ - uint32_t addr; - if (usbd_dfu_cfg.dev_state == DFU_STATE_DFU_DNLOAD_BUSY) { - /* Decode the Special Command */ - if (usbd_dfu_cfg.wblock_num == 0U) { - if (usbd_dfu_cfg.wlength == 1U) { - if (usbd_dfu_cfg.buffer.d8[0] == DFU_CMD_GETCOMMANDS) { - /* Nothing to do */ - } - } else if (usbd_dfu_cfg.wlength == 5U) { - if (usbd_dfu_cfg.buffer.d8[0] == DFU_CMD_SETADDRESSPOINTER) { - usbd_dfu_cfg.data_ptr = usbd_dfu_cfg.buffer.d8[1]; - usbd_dfu_cfg.data_ptr += (uint32_t)usbd_dfu_cfg.buffer.d8[2] << 8; - usbd_dfu_cfg.data_ptr += (uint32_t)usbd_dfu_cfg.buffer.d8[3] << 16; - usbd_dfu_cfg.data_ptr += (uint32_t)usbd_dfu_cfg.buffer.d8[4] << 24; - } else if (usbd_dfu_cfg.buffer.d8[0] == DFU_CMD_ERASE) { - usbd_dfu_cfg.data_ptr = usbd_dfu_cfg.buffer.d8[1]; - usbd_dfu_cfg.data_ptr += (uint32_t)usbd_dfu_cfg.buffer.d8[2] << 8; - usbd_dfu_cfg.data_ptr += (uint32_t)usbd_dfu_cfg.buffer.d8[3] << 16; - usbd_dfu_cfg.data_ptr += (uint32_t)usbd_dfu_cfg.buffer.d8[4] << 24; - - USB_LOG_DBG("Erase start add %08x \r\n", usbd_dfu_cfg.data_ptr); - /*!< Erase */ - dfu_erase_flash(usbd_dfu_cfg.data_ptr); - } else { - return -1; - } - } else { - /* Reset the global length and block number */ - usbd_dfu_cfg.wlength = 0U; - usbd_dfu_cfg.wblock_num = 0U; - /* Call the error management function (command will be NAKed) */ - USB_LOG_ERR("Reset the global length and block number\r\n"); - } - } - /* Regular Download Command */ - else { - if (usbd_dfu_cfg.wblock_num > 1U) { - /* Decode the required address */ - addr = ((usbd_dfu_cfg.wblock_num - 2U) * USBD_DFU_XFER_SIZE) + usbd_dfu_cfg.data_ptr; - - /* Perform the write operation */ - /* Write flash */ - USB_LOG_DBG("Write start add %08x length %d\r\n", addr, usbd_dfu_cfg.wlength); - dfu_write_flash(usbd_dfu_cfg.buffer.d8, (uint8_t *)addr, usbd_dfu_cfg.wlength); - } - } - - /* Reset the global length and block number */ - usbd_dfu_cfg.wlength = 0U; - usbd_dfu_cfg.wblock_num = 0U; - - /* Update the state machine */ - usbd_dfu_cfg.dev_state = DFU_STATE_DFU_DNLOAD_SYNC; - - usbd_dfu_cfg.dev_status[1] = 0U; - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; - } - return 0; -} - -static void dfu_request_getstatus(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - /*!< Determine whether to leave DFU mode */ - if (usbd_dfu_cfg.manif_state == DFU_MANIFEST_IN_PROGRESS && - usbd_dfu_cfg.dev_state == DFU_STATE_DFU_MANIFEST_SYNC && - usbd_dfu_cfg.dev_status[1] == 0U && - usbd_dfu_cfg.dev_status[2] == 0U && - usbd_dfu_cfg.dev_status[3] == 0U && - usbd_dfu_cfg.dev_status[4] == usbd_dfu_cfg.dev_state) { - usbd_dfu_cfg.manif_state = DFU_MANIFEST_COMPLETE; - - if ((0x0B & DFU_MANIFEST_MASK) != 0U) { - usbd_dfu_cfg.dev_state = DFU_STATE_DFU_MANIFEST_SYNC; - - usbd_dfu_cfg.dev_status[1] = 0U; - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; - return; - } else { - usbd_dfu_cfg.dev_state = DFU_STATE_DFU_MANIFEST_WAIT_RESET; - - usbd_dfu_cfg.dev_status[1] = 0U; - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; - /* Generate system reset to allow jumping to the user code */ - dfu_leave(); - } - } - - switch (usbd_dfu_cfg.dev_state) { - case DFU_STATE_DFU_DNLOAD_SYNC: - if (usbd_dfu_cfg.wlength != 0U) { - usbd_dfu_cfg.dev_state = DFU_STATE_DFU_DNLOAD_BUSY; - - usbd_dfu_cfg.dev_status[1] = 0U; - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; - - if ((usbd_dfu_cfg.wblock_num == 0U) && (usbd_dfu_cfg.buffer.d8[0] == DFU_CMD_ERASE)) { - dfu_getstatus(usbd_dfu_cfg.data_ptr, DFU_MEDIA_ERASE, usbd_dfu_cfg.dev_status); - } else { - dfu_getstatus(usbd_dfu_cfg.data_ptr, DFU_MEDIA_PROGRAM, usbd_dfu_cfg.dev_status); - } - } else /* (usbd_dfu_cfg.wlength==0)*/ - { - usbd_dfu_cfg.dev_state = DFU_STATE_DFU_DNLOAD_IDLE; - - usbd_dfu_cfg.dev_status[1] = 0U; - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; - } - break; - - case DFU_STATE_DFU_MANIFEST_SYNC: - if (usbd_dfu_cfg.manif_state == DFU_MANIFEST_IN_PROGRESS) { - usbd_dfu_cfg.dev_state = DFU_STATE_DFU_MANIFEST; - - usbd_dfu_cfg.dev_status[1] = 1U; /*bwPollTimeout = 1ms*/ - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; - } else { - if ((usbd_dfu_cfg.manif_state == DFU_MANIFEST_COMPLETE) && - ((0x0B & DFU_MANIFEST_MASK) != 0U)) { - usbd_dfu_cfg.dev_state = DFU_STATE_DFU_IDLE; - - usbd_dfu_cfg.dev_status[1] = 0U; - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; - } - } - break; - - default: - break; - } - - /* Send the status data over EP0 */ - memcpy(*data, usbd_dfu_cfg.dev_status, 6); - *len = 6; - - if (usbd_dfu_cfg.firmwar_flag == 1) { - if (dfu_getstatus_special_handler() != 0) { - USB_LOG_ERR("dfu_getstatus_special_handler error \r\n"); - } - usbd_dfu_cfg.firmwar_flag = 0; - } -} - -static void dfu_request_clrstatus(void) -{ - if (usbd_dfu_cfg.dev_state == DFU_STATE_DFU_ERROR) { - usbd_dfu_cfg.dev_state = DFU_STATE_DFU_IDLE; - usbd_dfu_cfg.dev_status[0] = DFU_STATUS_OK; /* bStatus */ - usbd_dfu_cfg.dev_status[1] = 0U; - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; /* bwPollTimeout=0ms */ - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; /* bState */ - usbd_dfu_cfg.dev_status[5] = 0U; /* iString */ - } else { - /* State Error */ - usbd_dfu_cfg.dev_state = DFU_STATE_DFU_ERROR; - usbd_dfu_cfg.dev_status[0] = DFU_STATUS_ERR_UNKNOWN; /* bStatus */ - usbd_dfu_cfg.dev_status[1] = 0U; - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; /* bwPollTimeout=0ms */ - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; /* bState */ - usbd_dfu_cfg.dev_status[5] = 0U; /* iString */ - } -} - -static void dfu_request_getstate(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - /* Return the current state of the DFU interface */ - (*data)[0] = usbd_dfu_cfg.dev_state; - *len = 1; -} - -void dfu_request_abort(void) -{ - if ((usbd_dfu_cfg.dev_state == DFU_STATE_DFU_IDLE) || - (usbd_dfu_cfg.dev_state == DFU_STATE_DFU_DNLOAD_SYNC) || - (usbd_dfu_cfg.dev_state == DFU_STATE_DFU_DNLOAD_IDLE) || - (usbd_dfu_cfg.dev_state == DFU_STATE_DFU_MANIFEST_SYNC) || - (usbd_dfu_cfg.dev_state == DFU_STATE_DFU_UPLOAD_IDLE)) { - usbd_dfu_cfg.dev_state = DFU_STATE_DFU_IDLE; - usbd_dfu_cfg.dev_status[0] = DFU_STATUS_OK; - usbd_dfu_cfg.dev_status[1] = 0U; - usbd_dfu_cfg.dev_status[2] = 0U; - usbd_dfu_cfg.dev_status[3] = 0U; /* bwPollTimeout=0ms */ - usbd_dfu_cfg.dev_status[4] = usbd_dfu_cfg.dev_state; - usbd_dfu_cfg.dev_status[5] = 0U; /* iString */ - usbd_dfu_cfg.wblock_num = 0U; - usbd_dfu_cfg.wlength = 0U; - } -} - -static int dfu_class_interface_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - USB_LOG_DBG("DFU Class request: " - "bRequest 0x%02x\r\n", - setup->bRequest); - - switch (setup->bRequest) { - case DFU_REQUEST_DETACH: - dfu_request_detach(); - break; - case DFU_REQUEST_DNLOAD: - dfu_request_dnload(setup, data, len); - break; - case DFU_REQUEST_UPLOAD: - dfu_request_upload(setup, data, len); - break; - case DFU_REQUEST_GETSTATUS: - dfu_request_getstatus(setup, data, len); - break; - case DFU_REQUEST_CLRSTATUS: - dfu_request_clrstatus(); - break; - case DFU_REQUEST_GETSTATE: - dfu_request_getstate(setup, data, len); - break; - case DFU_REQUEST_ABORT: - dfu_request_abort(); - break; - default: - USB_LOG_WRN("Unhandled DFU Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - - return 0; -} - -static void dfu_notify_handler(uint8_t event, void *arg) -{ - switch (event) { - case USBD_EVENT_RESET: - dfu_reset(); - break; - default: - break; - } -} - -struct usbd_interface *usbd_dfu_init_intf(struct usbd_interface *intf) -{ - intf->class_interface_handler = dfu_class_interface_request_handler; - intf->class_endpoint_handler = NULL; - intf->vendor_handler = NULL; - intf->notify_handler = dfu_notify_handler; - - return intf; -} - -__WEAK uint8_t *dfu_read_flash(uint8_t *src, uint8_t *dest, uint32_t len) -{ - return dest; -} - -__WEAK uint16_t dfu_write_flash(uint8_t *src, uint8_t *dest, uint32_t len) -{ - return 0; -} - -__WEAK uint16_t dfu_erase_flash(uint32_t add) -{ - return 0; -} - -__WEAK void dfu_leave(void) -{ -} diff --git a/third-party/cherryusb/class/dfu/usbd_dfu.h b/third-party/cherryusb/class/dfu/usbd_dfu.h deleted file mode 100644 index 9081d0dda1cc9d5ca7e7ede1da23740a714864b7..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/dfu/usbd_dfu.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBD_DFU_H -#define USBD_DFU_H - -#include "usb_dfu.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Init dfu interface driver */ -struct usbd_interface *usbd_dfu_init_intf(struct usbd_interface *intf); - -/* Interface functions that need to be implemented by the user */ -uint8_t *dfu_read_flash(uint8_t *src, uint8_t *dest, uint32_t len); -uint16_t dfu_write_flash(uint8_t *src, uint8_t *dest, uint32_t len); -uint16_t dfu_erase_flash(uint32_t add); -void dfu_leave(void); -#ifdef __cplusplus -} -#endif - -#endif /* USBD_DFU_H */ diff --git a/third-party/cherryusb/class/hid/usb_hid.h b/third-party/cherryusb/class/hid/usb_hid.h deleted file mode 100644 index 65913fb3abf478628c58269414a39e366a105809..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/hid/usb_hid.h +++ /dev/null @@ -1,585 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_HID_H -#define USB_HID_H - -/* Subclass codes (HID 4.2) */ -#define HID_SUBCLASS_NONE 0 /* No subclass */ -#define HID_SUBCLASS_BOOTIF 1 /* Boot Interface Subclass */ - -/* HID Protocol Codes (HID 4.3) */ -#define HID_PROTOCOL_NONE 0x00 -#define HID_PROTOCOL_BOOT 0x00 -#define HID_PROTOCOL_KEYBOARD 0x01 -#define HID_PROTOCOL_REPORT 0x01 -#define HID_PROTOCOL_MOUSE 0x02 - -/* HID Class Descriptor Types (HID 7.1) */ -#define HID_DESCRIPTOR_TYPE_HID 0x21 -#define HID_DESCRIPTOR_TYPE_HID_REPORT 0x22 -#define HID_DESCRIPTOR_TYPE_HID_PHYSICAL 0x23 - -/* HID Class Specific Requests (HID 7.2) */ -#define HID_REQUEST_GET_REPORT 0x01 -#define HID_REQUEST_GET_IDLE 0x02 -#define HID_REQUEST_GET_PROTOCOL 0x03 -#define HID_REQUEST_SET_REPORT 0x09 -#define HID_REQUEST_SET_IDLE 0x0A -#define HID_REQUEST_SET_PROTOCOL 0x0B - -/* Report Type (MS byte of wValue for GET_REPORT) (HID 7.2.1) */ -#define HID_REPORT_INPUT 0x01 -#define HID_REPORT_OUTPUT 0x02 -#define HID_REPORT_FEATURE 0x03 - -/* HID Descriptor ***********************************************************/ - -#define HID_COUNTRY_NONE 0x00 /* Not Supported */ -#define HID_COUNTRY_ARABIC 0x01 /* Arabic */ -#define HID_COUNTRY_BELGIAN 0x02 /* Belgian */ -#define HID_COUNTRY_CANADA 0x03 /* Canadian-Bilingual */ -#define HID_COUNTRY_CANADRFR 0x04 /* Canadian-French */ -#define HID_COUNTRY_CZECH 0x05 /* Czech Republic */ -#define HID_COUNTRY_DANISH 0x06 /* Danish */ -#define HID_COUNTRY_FINNISH 0x07 /* Finnish */ -#define HID_COUNTRY_FRENCH 0x08 /* French */ -#define HID_COUNTRY_GERMAN 0x09 /* German */ -#define HID_COUNTRY_GREEK 0x10 /* Greek */ -#define HID_COUNTRY_HEBREW 0x11 /* Hebrew */ -#define HID_COUNTRY_HUNGARY 0x12 /* Hungary */ -#define HID_COUNTRY_ISO 0x13 /* International (ISO) */ -#define HID_COUNTRY_ITALIAN 0x14 /* Italian */ -#define HID_COUNTRY_JAPAN 0x15 /* Japan (Katakana) */ -#define HID_COUNTRY_KOREAN 0x16 /* Korean */ -#define HID_COUNTRY_LATINAM 0x17 /* Latin American */ -#define HID_COUNTRY_DUTCH 0x18 /* Netherlands/Dutch */ -#define HID_COUNTRY_NORWEGIAN 0x19 /* Norwegian */ -#define HID_COUNTRY_PERSIAN 0x20 /* Persian (Farsi) */ -#define HID_COUNTRY_POLAND 0x21 /* Poland */ -#define HID_COUNTRY_PORTUGUESE 0x22 /* Portuguese */ -#define HID_COUNTRY_RUSSIA 0x23 /* Russia */ -#define HID_COUNTRY_SLOVAKIA 0x24 /* Slovakia */ -#define HID_COUNTRY_SPANISH 0x25 /* Spanish */ -#define HID_COUNTRY_SWEDISH 0x26 /* Swedish */ -#define HID_COUNTRY_SWISSFR 0x27 /* Swiss/French */ -#define HID_COUNTRY_SWISSGR 0x28 /* Swiss/German */ -#define HID_COUNTRY_SWITZERLAND 0x29 /* Switzerland */ -#define HID_COUNTRY_TAIWAN 0x30 /* Taiwan */ -#define HID_COUNTRY_TURKISHQ 0x31 /* Turkish-Q */ -#define HID_COUNTRY_UK 0x32 /* UK */ -#define HID_COUNTRY_US 0x33 /* US */ -#define HID_COUNTRY_YUGOSLAVIA 0x34 /* Yugoslavia */ -#define HID_COUNTRY_TURKISHF 0x35 /* Turkish-F */ - -/* HID report items */ -#define HID_REPORT_ITEM_SIZE_MASK 0x03 -#define HID_REPORT_ITEM_SIZE_0 0x00 /* No data follows */ -#define HID_REPORT_ITEM_SIZE_1 0x01 /* 1 byte of data follows */ -#define HID_REPORT_ITEM_SIZE_2 0x02 /* 2 bytes of data follow */ -#define HID_REPORT_ITEM_SIZE_4 0x03 /* 4 bytes of data follow */ -#define HID_REPORT_ITEM_TYPE_MASK 0x0c -#define HID_REPORT_ITEM_TYPE_MAIN 0x00 -#define HID_REPORT_ITEM_TYPE_GLOBAL 0x04 -#define HID_REPORT_ITEM_TYPE_LOCAL 0x08 -#define HID_REPORT_ITEM_TAG_MASK 0xf0 - -/* Main Items (HID 6.2.2.4) */ -#define HID_MAIN_ITEM_CONSTANT (1 << 0) /* Constant(1) vs Data(0) */ -#define HID_MAIN_ITEM_VARIABLE (1 << 1) /* Variable(1) vs Array(0) */ -#define HID_MAIN_ITEM_RELATIVE (1 << 2) /* Relative(1) vs Absolute(0) */ -#define HID_MAIN_ITEM_WRAP (1 << 3) /* Wrap(1) vs No Wrap(0) */ -#define HID_MAIN_ITEM_NONLINEAR (1 << 4) /* Non Linear(1) vs Linear(0) */ -#define HID_MAIN_ITEM_NOPREFERRED (1 << 5) /* No Preferred (1) vs Preferred State(0) */ -#define HID_MAIN_ITEM_NULLSTATE (1 << 6) /* Null state(1) vs No Null position(0) */ -#define HID_MAIN_ITEM_VOLATILE (1 << 7) /* Volatile(1) vs Non volatile(0) */ -#define HID_MAIN_ITEM_BUFFEREDBYTES (1 << 8) /* Buffered Bytes(1) vs Bit Field(0) */ - -#define HID_MAIN_ITEM_SIZE(pfx) ((pfx)&HID_REPORT_ITEM_SIZE_MASK) -#define HID_MAIN_ITEM_INPUT_PREFIX 0x80 -#define HID_MAIN_ITEM_INPUT_CONSTANT HID_MAIN_ITEM_CONSTANT -#define HID_MAIN_ITEM_INPUT_VARIABLE HID_MAIN_ITEM_VARIABLE -#define HID_MAIN_ITEM_INPUT_RELATIVE HID_MAIN_ITEM_RELATIVE -#define HID_MAIN_ITEM_INPUT_WRAP HID_MAIN_ITEM_WRAP -#define HID_MAIN_ITEM_INPUT_NONLINEAR HID_MAIN_ITEM_NONLINEAR -#define HID_MAIN_ITEM_INPUT_NOPREFERRED HID_MAIN_ITEM_NOPREFERRED -#define HID_MAIN_ITEM_INPUT_NULLSTATE HID_MAIN_ITEM_NULLSTATE -#define HID_MAIN_ITEM_INPUT_BUFFEREDBYTES HID_MAIN_ITEM_BUFFEREDBYTES - -#define HID_MAIN_ITEM_OUTPUT_PREFIX 0x90 -#define HID_MAIN_ITEM_OUTPUT_CONSTANT HID_MAIN_ITEM_CONSTANT -#define HID_MAIN_ITEM_OUTPUT_VARIABLE HID_MAIN_ITEM_VARIABLE -#define HID_MAIN_ITEM_OUTPUT_RELATIVE HID_MAIN_ITEM_RELATIVE -#define HID_MAIN_ITEM_OUTPUT_WRAP HID_MAIN_ITEM_WRAP -#define HID_MAIN_ITEM_OUTPUT_NONLINEAR HID_MAIN_ITEM_NONLINEAR -#define HID_MAIN_ITEM_OUTPUT_NOPREFERRED HID_MAIN_ITEM_NOPREFERRED -#define HID_MAIN_ITEM_OUTPUT_NULLSTATE HID_MAIN_ITEM_NULLSTATE -#define HID_MAIN_ITEM_OUTPUT_VOLATILE HID_MAIN_ITEM_VOLATILE -#define HID_MAIN_ITEM_OUTPUT_BUFFEREDBYTES HID_MAIN_ITEM_BUFFEREDBYTES - -#define HID_MAIN_ITEM_FEATURE_PREFIX 0xb0 -#define HID_MAIN_ITEM_FEATURE_CONSTANT HID_MAIN_ITEM_CONSTANT -#define HID_MAIN_ITEM_FEATURE_VARIABLE HID_MAIN_ITEM_VARIABLE -#define HID_MAIN_ITEM_FEATURE_RELATIVE HID_MAIN_ITEM_RELATIVE -#define HID_MAIN_ITEM_FEATURE_WRAP HID_MAIN_ITEM_WRAP -#define HID_MAIN_ITEM_FEATURE_NONLINEAR HID_MAIN_ITEM_NONLINEAR -#define HID_MAIN_ITEM_FEATURE_NOPREFERRED HID_MAIN_ITEM_NOPREFERRED -#define HID_MAIN_ITEM_FEATURE_NULLSTATE HID_MAIN_ITEM_NULLSTATE -#define HID_MAIN_ITEM_FEATURE_VOLATILE HID_MAIN_ITEM_VOLATILE -#define HID_MAIN_ITEM_FEATURE_BUFFEREDBYTES HID_MAIN_ITEM_BUFFEREDBYTES - -#define HID_MAIN_ITEM_COLLECTION_PREFIX 0xa0 -#define HID_MAIN_ITEM_COLLECTION_PHYSICAL 0x00 /* Physical (group of axes) */ -#define HID_MAIN_ITEM_COLLECTION_APPL 0x01 /* Application (mouse, keyboard) */ -#define HID_MAIN_ITEM_COLLECTION_LOGICAL 0x02 /* Logical (interrelated data) */ -#define HID_MAIN_ITEM_COLLECTION_REPORT 0x03 /* Report */ -#define HID_MAIN_ITEM_COLLECTION_ARRAY 0x04 /* Named Array */ -#define HID_MAIN_ITEM_COLLECTION_SWITCH 0x05 /* Usage Switch */ -#define HID_MAIN_ITEM_COLLECTION_MODIFIER 0x06 /* Usage Modifier */ -#define HID_MAIN_ITEM_ENDCOLLECTION_PREFIX 0xc0 - -/* Global Items (HID 6.2.2.7) */ -#define HID_GLOBAL_ITEM_SIZE(pfx) ((pfx)&HID_REPORT_ITEM_SIZE_MASK) -#define HID_GLOBAL_ITEM_USAGEPAGE_PREFIX 0x04 /* Usage Page */ -#define HID_GLOBAL_ITEM_LOGICALMIN_PREFIX 0x14 /* Logical Minimum */ -#define HID_GLOBAL_ITEM_LOGICALMAX_PREFIX 0x24 /* Logical Maximum */ -#define HID_GLOBAL_ITEM_PHYSICALMIN_PREFIX 0x34 /* Physical Minimum */ -#define HID_GLOBAL_ITEM_PHYSMICALAX_PREFIX 0x44 /* Physical Maximum */ -#define HID_GLOBAL_ITEM_UNITEXP_PREFIX 0x54 /* Unit Exponent */ -#define HID_GLOBAL_ITEM_UNIT_PREFIX 0x64 /* Unit */ -#define HID_GLOBAL_ITEM_REPORTSIZE_PREFIX 0x74 /* Report Size */ -#define HID_GLOBAL_ITEM_REPORTID_PREFIX 0x84 /* Report ID */ -#define HID_GLOBAL_ITEM_REPORTCOUNT_PREFIX 0x94 /* Report Count */ -#define HID_GLOBAL_ITEM_PUSH_PREFIX 0xa4 /* Push */ -#define HID_GLOBAL_ITEM_POP_PREFIX 0xb4 /* Pop */ - -/* Local Items (HID 6.2.2.8) */ -#define HID_LOCAL_ITEM_SIZE(pfx) ((pfx)&HID_REPORT_ITEM_SIZE_MASK) -#define HID_LOCAL_ITEM_USAGE_PREFIX 0x08 /* Usage */ -#define HID_LOCAL_ITEM_USAGEMIN_PREFIX 0x18 /* Usage Minimum */ -#define HID_LOCAL_ITEM_USAGEMAX_PREFIX 0x28 /* Usage Maximum */ -#define HID_LOCAL_ITEM_DESIGNATORIDX_PREFIX 0x38 /* Designator Index */ -#define HID_LOCAL_ITEM_DESIGNATORMIN_PREFIX 0x48 /* Designator Minimum */ -#define HID_LOCAL_ITEM_DESIGNATORMAX_PREFIX 0x58 /* Designator Maximum */ -#define HID_LOCAL_ITEM_STRINGIDX_PREFIX 0x78 /* String Index */ -#define HID_LOCAL_ITEM_STRINGMIN_PREFIX 0x88 /* String Minimum */ -#define HID_LOCAL_ITEM_STRINGMAX_PREFIX 0x98 /* xx */ -#define HID_LOCAL_ITEM_DELIMITER_PREFIX 0xa8 /* Delimiter */ - -/* Modifier Keys (HID 8.3) */ -#define HID_MODIFER_LCTRL (1 << 0) /* Left Ctrl */ -#define HID_MODIFER_LSHIFT (1 << 1) /* Left Shift */ -#define HID_MODIFER_LALT (1 << 2) /* Left Alt */ -#define HID_MODIFER_LGUI (1 << 3) /* Left GUI */ -#define HID_MODIFER_RCTRL (1 << 4) /* Right Ctrl */ -#define HID_MODIFER_RSHIFT (1 << 5) /* Right Shift */ -#define HID_MODIFER_RALT (1 << 6) /* Right Alt */ -#define HID_MODIFER_RGUI (1 << 7) /* Right GUI */ - -/* Keyboard output report (1 byte) (HID B.1) */ -#define HID_KBD_OUTPUT_REPORT_NUMLOCK (1 << 0) -#define HID_KBD_OUTPUT_REPORT_CAPSLOCK (1 << 1) -#define HID_KBD_OUTPUT_REPORT_SCROLLLOCK (1 << 2) -#define HID_KBD_OUTPUT_REPORT_COMPOSE (1 << 3) -#define HID_KBD_OUTPUT_REPORT_KANA (1 << 4) - -/* Mouse input report (HID B.2) */ -#define HID_MOUSE_INPUT_REPORT_BUTTON1 (1 << 0) -#define HID_MOUSE_INPUT_REPORT_BUTTON2 (1 << 1) -#define HID_MOUSE_INPUT_REPORT_BUTTON3 (1 << 2) -#define HID_MOUSE_INPUT_REPORT_BUTTON_MASK (7) - -#define HID_MOUSE_INPUT_BUTTON_LEFT (1 << 0) -#define HID_MOUSE_INPUT_BUTTON_RIGHT (1 << 1) -#define HID_MOUSE_INPUT_BUTTON_MIDDLE (1 << 2) -#define HID_MOUSE_INPUT_BUTTON_BACKWARD (1 << 3) -#define HID_MOUSE_INPUT_BUTTON_FORWARD (1 << 4) - -/* Joystick input report (4 bytes) (HID D.1) */ -#define HID_JS_INPUT_REPORT_HATSWITCH_SHIFT (0) -#define HID_JS_INPUT_REPORT_HATSWITCH_MASK (15 << HID_JSIN_HATSWITCH_SHIFT) -#define HID_JS_INPUT_REPORT_BUTTON1 (1 << 4) -#define HID_JS_INPUT_REPORT_BUTTON2 (1 << 5) -#define HID_JS_INPUT_REPORT_BUTTON3 (1 << 6) -#define HID_JS_INPUT_REPORT_BUTTON4 (1 << 7) - -/* Usage pages (HuT 3) */ -#define HID_USAGE_PAGE_UNDEFINED 0x00 /* Undefined */ -#define HID_USAGE_PAGE_GENERIC_DCTRL 0x01 /* Generic Desktop Controls */ -#define HID_USAGE_PAGE_SIMCTRL 0x02 /* Simulation Controls */ -#define HID_USAGE_PAGE_VRCTRL 0x03 /* VR Controls */ -#define HID_USAGE_PAGE_SPORTCTRL 0x04 /* Sport Controls */ -#define HID_USAGE_PAGE_GAMECTRL 0x05 /* Game Controls */ -#define HID_USAGE_PAGE_GENERIC_DEVCTRL 0x06 /* Generic Device Controls */ -#define HID_USAGE_PAGE_KBD 0x07 /* Keyboard/Keypad */ -#define HID_USAGE_PAGE_LEDS 0x08 /* LEDs */ -#define HID_USAGE_PAGE_BUTTON 0x09 /* Button */ -#define HID_USAGE_PAGE_ORDINAL 0x0a /* Ordinal */ -#define HID_USAGE_PAGE_TELEPHONY 0x0b /* Telephony */ -#define HID_USAGE_PAGE_CONSUMER 0x0c /* Consumer */ -#define HID_USAGE_PAGE_DIGITIZER 0x0d /* Digitizer */ - /* 0x0e Reserved */ -#define HID_USAGE_PAGE_PIDPAGE 0x0f /* PID Page Physical Interface Device */ -#define HID_USAGE_PAGE_UNICODE 0x10 /* Unicode */ - /* 0x11-13 Reserved */ -#define HID_USAGE_PAGE_ALPHA_DISPLAY 0x14 /* Alphanumeric Display */ - /* 0x15-3f Reserved */ -#define HID_USAGE_PAGE_MEDICAL 0x40 /* Medical Instruments */ - /* 0x41-7f Reserved */ - /* 0x80-83 Monitor Devices */ - /* 0x84-87 Power Devices */ - /* 0x88-8b Reserved */ -#define HID_USAGE_PAGE_BARCODE_SCANNER 0x8c /* Bar Code Scanner page */ -#define HID_USAGE_PAGE_SCALE 0x8d /* Scale page */ -#define HID_USAGE_PAGE_MSR 0x8e /* Magnetic Stripe Reading (MSR) Devices */ -#define HID_USAGE_PAGE_POS 0x8f /* Point of Sale devices */ -#define HID_USAGE_PAGE_CAMERA_CTRL 0x90 /* Camera Control Page */ - -/* Generic Desktop Page Usage IDs (HuT 4) */ -#define HID_DESKTOP_USAGE_UNDEFINED 0x00 /* Undefined */ -#define HID_DESKTOP_USAGE_POINTER 0x01 /* Pointer */ -#define HID_DESKTOP_USAGE_MOUSE 0x02 /* Mouse */ - /* 0x03 Reserved */ -#define HID_DESKTOP_USAGE_JOYSTICK 0x04 /* Joystick */ -#define HID_DESKTOP_USAGE_GAMEPAD 0x05 /* Game Pad */ -#define HID_DESKTOP_USAGE_KEYBOARD 0x06 /* Keyboard */ -#define HID_DESKTOP_USAGE_KEYPAD 0x07 /* Keypad */ -#define HID_DESKTOP_USAGE_MULTIAXIS 0x08 /* Multi-axis Controller */ -#define HID_DESKTOP_USAGE_TABLET 0x09 /* Tablet PC System Controls */ - /* 0x0a-2f Reserved */ -#define HID_DESKTOP_USAGE_X 0x30 /* X */ -#define HID_DESKTOP_USAGE_Y 0x31 /* Y */ -#define HID_DESKTOP_USAGE_Z 0x32 /* Z */ -#define HID_DESKTOP_USAGE_RX 0x33 /* Rx */ -#define HID_DESKTOP_USAGE_RY 0x34 /* Ry */ -#define HID_DESKTOP_USAGE_RZ 0x35 /* Rz */ -#define HID_DESKTOP_USAGE_SLIDER 0x36 /* Slider */ -#define HID_DESKTOP_USAGE_DIAL 0x37 /* Dial */ -#define HID_DESKTOP_USAGE_WHEEL 0x38 /* Wheel */ -#define HID_DESKTOP_USAGE_HATSWITCH 0x39 /* Hat switch */ -#define HID_DESKTOP_USAGE_COUNTED 0x3a /* Counted Buffer */ -#define HID_DESKTOP_USAGE_BYTECOUNT 0x3b /* Byte Count */ -#define HID_DESKTOP_USAGE_MOTION 0x3c /* Motion Wakeup */ -#define HID_DESKTOP_USAGE_START 0x3d /* Start */ -#define HID_DESKTOP_USAGE_SELECT 0x3e /* Select */ - /* 0x3f Reserved */ -#define HID_DESKTOP_USAGE_VX 0x40 /* Vx */ -#define HID_DESKTOP_USAGE_VY 0x41 /* Vy */ -#define HID_DESKTOP_USAGE_VZ 0x42 /* Vz */ -#define HID_DESKTOP_USAGE_VBRX 0x43 /* Vbrx */ -#define HID_DESKTOP_USAGE_VBRY 0x44 /* Vbry */ -#define HID_DESKTOP_USAGE_VBRZ 0x45 /* Vbrz */ -#define HID_DESKTOP_USAGE_VNO 0x46 /* Vno */ -#define HID_DESKTOP_USAGE_FEATURE 0x47 /* Feature Notification */ -#define HID_DESKTOP_USAGE_RESOLUTION 0x48 /* Resolution Multiplier */ - /* 0x49-7f Reserved */ -#define HID_DESKTOP_USAGE_CONTROL 0x80 /* System Control */ -#define HID_DESKTOP_USAGE_POWERDOWN 0x81 /* System Power Down */ -#define HID_DESKTOP_USAGE_SLEEP 0x82 /* System Sleep */ -#define HID_DESKTOP_USAGE_WAKEUP 0x83 /* System Wake Up */ -#define HID_DESKTOP_USAGE_CONTEXT_MENU 0x84 /* System Context Menu */ -#define HID_DESKTOP_USAGE_MAIN_MENU 0x85 /* System Main Menu */ -#define HID_DESKTOP_USAGE_APP_MENU 0x86 /* System App Menu */ -#define HID_DESKTOP_USAGE_MENU_HELP 0x87 /* System Menu Help */ -#define HID_DESKTOP_USAGE_MENU_EXIT 0x88 /* System Menu Exit */ -#define HID_DESKTOP_USAGE_MENU_SELECT 0x89 /* System Menu Select */ -#define HID_DESKTOP_USAGE_MENU_RIGHT 0x8a /* System Menu Right */ -#define HID_DESKTOP_USAGE_MENU_LEFT 0x8b /* System Menu Left */ -#define HID_DESKTOP_USAGE_MENU_UP 0x8c /* System Menu Up */ -#define HID_DESKTOP_USAGE_MENU_DOWN 0x8d /* System Menu Down */ -#define HID_DESKTOP_USAGE_COLD_RESTART 0x8e /* System Cold Restart */ -#define HID_DESKTOP_USAGE_WARM_RESTART 0x8f /* System Warm Restart */ -#define HID_DESKTOP_USAGE_DPAD_UP 0x90 /* D-pad Up */ -#define HID_DESKTOP_USAGE_DPAD_DOWN 0x91 /* D-pad Down */ -#define HID_DESKTOP_USAGE_DPAD_RIGHT 0x92 /* D-pad Right */ -#define HID_DESKTOP_USAGE_DPAD_LEFT 0x93 /* D-pad Left */ - /* 0x94-9f Reserved */ -#define HID_DESKTOP_USAGE_DOCK 0xa0 /* System Dock */ -#define HID_DESKTOP_USAGE_UNDOCK 0xa1 /* System Undock */ -#define HID_DESKTOP_USAGE_SETUP 0xa2 /* System Setup */ -#define HID_DESKTOP_USAGE_BREAK 0xa3 /* System Break */ -#define HID_DESKTOP_USAGE_DEBUG_BREAK 0xa4 /* System Debugger Break */ -#define HID_DESKTOP_USAGE_APP_BREAK 0xa5 /* Application Break */ -#define HID_DESKTOP_USAGE_APP_DEBUG_BREAK 0xa6 /* Application Debugger Break */ -#define HID_DESKTOP_USAGE_MUTE 0xa7 /* System Speaker Mute */ -#define HID_DESKTOP_USAGE_HIBERNATE 0xa8 /* System Hibernate */ - /* 0xa9-af Reserved */ -#define HID_DESKTOP_USAGE_DISPLAY_INVERT 0xb0 /* System Display Invert */ -#define HID_DESKTOP_USAGE_DISPALY_INTERNAL 0xb1 /* System Display Internal */ -#define HID_DESKTOP_USAGE_DISPLAY_EXTERNAL 0xb2 /* System Display External */ -#define HID_DESKTOP_USAGE_DISPLAY_BOTH 0xb3 /* System Display Both */ -#define HID_DESKTOP_USAGE_DISPLAY_DUAL 0xb4 /* System Display Dual */ -#define HID_DESKTOP_USAGE_DISPLAY_TOGGLE 0xb5 /* System Display Toggle Int/Ext */ -#define HID_DESKTOP_USAGE_DISPLAY_SWAP 0xb6 /* System Display Swap */ -#define HID_DESKTOP_USAGE_ 0xb7 /* System Display LCD Autoscale */ - /* 0xb8-ffff Reserved */ - -/* Keyboard usage IDs (HuT 10) */ -#define HID_KBD_USAGE_NONE 0x00 /* Reserved (no event indicated) */ -#define HID_KBD_USAGE_ERRORROLLOVER 0x01 /* Keyboard ErrorRollOver */ -#define HID_KBD_USAGE_POSTFAIL 0x02 /* Keyboard POSTFail */ -#define HID_KBD_USAGE_ERRUNDEF 0x03 /* Keyboard ErrorUndefined */ -#define HID_KBD_USAGE_A 0x04 /* Keyboard a or A (B-Z follow) */ -#define HID_KBD_USAGE_1 0x1e /* Keyboard 1 (2-9 follow) */ -#define HID_KBD_USAGE_EXCLAM 0x1e /* Keyboard 1 and ! */ -#define HID_KBD_USAGE_AT 0x1f /* Keyboard 2 and @ */ -#define HID_KBD_USAGE_POUND 0x20 /* Keyboard 3 and # */ -#define HID_KBD_USAGE_DOLLAR 0x21 /* Keyboard 4 and $ */ -#define HID_KBD_USAGE_PERCENT 0x22 /* Keyboard 5 and % */ -#define HID_KBD_USAGE_CARAT 0x23 /* Keyboard 6 and ^ */ -#define HID_KBD_USAGE_AMPERSAND 0x24 /* Keyboard 7 and & */ -#define HID_KBD_USAGE_ASTERISK 0x25 /* Keyboard 8 and * */ -#define HID_KBD_USAGE_LPAREN 0x26 /* Keyboard 9 and ( */ -#define HID_KBD_USAGE_0 0x27 /* Keyboard 0 and ) */ -#define HID_KBD_USAGE_RPAREN 0x27 /* Keyboard 0 and ) */ -#define HID_KBD_USAGE_ENTER 0x28 /* Keyboard Return (ENTER) */ -#define HID_KBD_USAGE_ESCAPE 0x29 /* Keyboard ESCAPE */ -#define HID_KBD_USAGE_DELETE 0x2a /* Keyboard DELETE (Backspace) */ -#define HID_KBD_USAGE_TAB 0x2b /* Keyboard Tab */ -#define HID_KBD_USAGE_SPACE 0x2c /* Keyboard Spacebar */ -#define HID_KBD_USAGE_HYPHEN 0x2d /* Keyboard - and (underscore) */ -#define HID_KBD_USAGE_UNDERSCORE 0x2d /* Keyboard - and (underscore) */ -#define HID_KBD_USAGE_EQUAL 0x2e /* Keyboard = and + */ -#define HID_KBD_USAGE_PLUS 0x2e /* Keyboard = and + */ -#define HID_KBD_USAGE_LBRACKET 0x2f /* Keyboard [ and { */ -#define HID_KBD_USAGE_LBRACE 0x2f /* Keyboard [ and { */ -#define HID_KBD_USAGE_RBRACKET 0x30 /* Keyboard ] and } */ -#define HID_KBD_USAGE_RBRACE 0x30 /* Keyboard ] and } */ -#define HID_KBD_USAGE_BSLASH 0x31 /* Keyboard \ and | */ -#define HID_KBD_USAGE_VERTBAR 0x31 /* Keyboard \ and | */ -#define HID_KBD_USAGE_NONUSPOUND 0x32 /* Keyboard Non-US # and ~ */ -#define HID_KBD_USAGE_TILDE 0x32 /* Keyboard Non-US # and ~ */ -#define HID_KBD_USAGE_SEMICOLON 0x33 /* Keyboard ; and : */ -#define HID_KBD_USAGE_COLON 0x33 /* Keyboard ; and : */ -#define HID_KBD_USAGE_SQUOTE 0x34 /* Keyboard ' and " */ -#define HID_KBD_USAGE_DQUOUTE 0x34 /* Keyboard ' and " */ -#define HID_KBD_USAGE_GACCENT 0x35 /* Keyboard Grave Accent and Tilde */ -#define HID_KBD_USAGE_GTILDE 0x35 /* Keyboard Grave Accent and Tilde */ -#define HID_KBD_USAGE_COMMON 0x36 /* Keyboard , and < */ -#define HID_KBD_USAGE_LT 0x36 /* Keyboard , and < */ -#define HID_KBD_USAGE_PERIOD 0x37 /* Keyboard . and > */ -#define HID_KBD_USAGE_GT 0x37 /* Keyboard . and > */ -#define HID_KBD_USAGE_DIV 0x38 /* Keyboard / and ? */ -#define HID_KBD_USAGE_QUESTION 0x38 /* Keyboard / and ? */ -#define HID_KBD_USAGE_CAPSLOCK 0x39 /* Keyboard Caps Lock */ -#define HID_KBD_USAGE_F1 0x3a /* Keyboard F1 */ -#define HID_KBD_USAGE_F2 0x3b /* Keyboard F2 */ -#define HID_KBD_USAGE_F3 0x3c /* Keyboard F3 */ -#define HID_KBD_USAGE_F4 0x3d /* Keyboard F4 */ -#define HID_KBD_USAGE_F5 0x3e /* Keyboard F5 */ -#define HID_KBD_USAGE_F6 0x3f /* Keyboard F6 */ -#define HID_KBD_USAGE_F7 0x40 /* Keyboard F7 */ -#define HID_KBD_USAGE_F8 0x41 /* Keyboard F8 */ -#define HID_KBD_USAGE_F9 0x42 /* Keyboard F9 */ -#define HID_KBD_USAGE_F10 0x43 /* Keyboard F10 */ -#define HID_KBD_USAGE_F11 0x44 /* Keyboard F11 */ -#define HID_KBD_USAGE_F12 0x45 /* Keyboard F12 */ -#define HID_KBD_USAGE_PRINTSCN 0x46 /* Keyboard PrintScreen */ -#define HID_KBD_USAGE_SCROLLLOCK 0x47 /* Keyboard Scroll Lock */ -#define HID_KBD_USAGE_PAUSE 0x48 /* Keyboard Pause */ -#define HID_KBD_USAGE_INSERT 0x49 /* Keyboard Insert */ -#define HID_KBD_USAGE_HOME 0x4a /* Keyboard Home */ -#define HID_KBD_USAGE_PAGEUP 0x4b /* Keyboard PageUp */ -#define HID_KBD_USAGE_DELFWD 0x4c /* Keyboard Delete Forward */ -#define HID_KBD_USAGE_END 0x4d /* Keyboard End */ -#define HID_KBD_USAGE_PAGEDOWN 0x4e /* Keyboard PageDown */ -#define HID_KBD_USAGE_RIGHT 0x4f /* eyboard RightArrow */ -#define HID_KBD_USAGE_LEFT 0x50 /* Keyboard LeftArrow */ -#define HID_KBD_USAGE_DOWN 0x51 /* Keyboard DownArrow */ -#define HID_KBD_USAGE_UP 0x52 /* Keyboard UpArrow */ -#define HID_KBD_USAGE_KPDNUMLOCK 0x53 /* Keypad Num Lock and Clear */ -#define HID_KBD_USAGE_KPDNUMLOCKCLEAR 0x53 /* Keypad Num Lock and Clear */ -#define HID_KBD_USAGE_KPDDIV 0x54 /* Keypad / */ -#define HID_KBD_USAGE_KPDMUL 0x55 /* Keypad * */ -#define HID_KBD_USAGE_KPDHMINUS 0x56 /* Keypad - */ -#define HID_KBD_USAGE_KPDPLUS 0x57 /* Keypad + */ -#define HID_KBD_USAGE_KPDEMTER 0x58 /* Keypad ENTER */ -#define HID_KBD_USAGE_KPD1 0x59 /* Keypad 1 (2-9 follow) */ -#define HID_KBD_USAGE_KPDEND 0x59 /* Keypad 1 and End */ -#define HID_KBD_USAGE_KPDDOWN 0x5a /* Keypad 2 and Down Arrow */ -#define HID_KBD_USAGE_KPDPAGEDN 0x5b /* Keypad 3 and PageDn */ -#define HID_KBD_USAGE_KPDLEFT 0x5c /* Keypad 4 and Left Arrow */ -#define HID_KBD_USAGE_KPDRIGHT 0x5e /* Keypad 6 and Right Arrow */ -#define HID_KBD_USAGE_KPDHOME 0x5f /* Keypad 7 and Home */ -#define HID_KBD_USAGE_KPDUP 0x60 /* Keypad 8 and Up Arrow */ -#define HID_KBD_USAGE_KPDPAGEUP 0x61 /* Keypad 9 and PageUp */ -#define HID_KBD_USAGE_KPD0 0x62 /* Keypad 0 and Insert */ -#define HID_KBD_USAGE_KPDINSERT 0x62 /* Keypad 0 and Insert */ -#define HID_KBD_USAGE_KPDDECIMALPT 0x63 /* Keypad . and Delete */ -#define HID_KBD_USAGE_KPDDELETE 0x63 /* Keypad . and Delete */ -#define HID_KBD_USAGE_NONSLASH 0x64 /* Keyboard Non-US \ and | */ -#define HID_KBD_USAGE_NONUSVERT 0x64 /* Keyboard Non-US \ and | */ -#define HID_KBD_USAGE_APPLICATION 0x65 /* Keyboard Application */ -#define HID_KBD_USAGE_POWER 0x66 /* Keyboard Power */ -#define HID_KBD_USAGE_KPDEQUAL 0x67 /* Keypad = */ -#define HID_KBD_USAGE_F13 0x68 /* Keyboard F13 */ -#define HID_KBD_USAGE_F14 0x69 /* Keyboard F14 */ -#define HID_KBD_USAGE_F15 0x6a /* Keyboard F15 */ -#define HID_KBD_USAGE_F16 0x6b /* Keyboard F16 */ -#define HID_KBD_USAGE_F17 0x6c /* Keyboard F17 */ -#define HID_KBD_USAGE_F18 0x6d /* Keyboard F18 */ -#define HID_KBD_USAGE_F19 0x6e /* Keyboard F19 */ -#define HID_KBD_USAGE_F20 0x6f /* Keyboard F20 */ -#define HID_KBD_USAGE_F21 0x70 /* Keyboard F21 */ -#define HID_KBD_USAGE_F22 0x71 /* Keyboard F22 */ -#define HID_KBD_USAGE_F23 0x72 /* Keyboard F23 */ -#define HID_KBD_USAGE_F24 0x73 /* Keyboard F24 */ -#define HID_KBD_USAGE_EXECUTE 0x74 /* Keyboard Execute */ -#define HID_KBD_USAGE_HELP 0x75 /* Keyboard Help */ -#define HID_KBD_USAGE_MENU 0x76 /* Keyboard Menu */ -#define HID_KBD_USAGE_SELECT 0x77 /* Keyboard Select */ -#define HID_KBD_USAGE_STOP 0x78 /* Keyboard Stop */ -#define HID_KBD_USAGE_AGAIN 0x79 /* Keyboard Again */ -#define HID_KBD_USAGE_UNDO 0x7a /* Keyboard Undo */ -#define HID_KBD_USAGE_CUT 0x7b /* Keyboard Cut */ -#define HID_KBD_USAGE_COPY 0x7c /* Keyboard Copy */ -#define HID_KBD_USAGE_PASTE 0x7d /* Keyboard Paste */ -#define HID_KBD_USAGE_FIND 0x7e /* Keyboard Find */ -#define HID_KBD_USAGE_MUTE 0x7f /* Keyboard Mute */ -#define HID_KBD_USAGE_VOLUP 0x80 /* Keyboard Volume Up */ -#define HID_KBD_USAGE_VOLDOWN 0x81 /* Keyboard Volume Down */ -#define HID_KBD_USAGE_LCAPSLOCK 0x82 /* Keyboard Locking Caps Lock */ -#define HID_KBD_USAGE_LNUMLOCK 0x83 /* Keyboard Locking Num Lock */ -#define HID_KBD_USAGE_LSCROLLLOCK 0x84 /* Keyboard Locking Scroll Lock */ -#define HID_KBD_USAGE_KPDCOMMA 0x85 /* Keypad Comma */ -#define HID_KBD_USAGE_KPDEQUALSIGN 0x86 /* Keypad Equal Sign */ -#define HID_KBD_USAGE_INTERNATIONAL1 0x87 /* Keyboard International 1 */ -#define HID_KBD_USAGE_INTERNATIONAL2 0x88 /* Keyboard International 2 */ -#define HID_KBD_USAGE_INTERNATIONAL3 0x89 /* Keyboard International 3 */ -#define HID_KBD_USAGE_INTERNATIONAL4 0x8a /* Keyboard International 4 */ -#define HID_KBD_USAGE_INTERNATIONAL5 0x8b /* Keyboard International 5 */ -#define HID_KBD_USAGE_INTERNATIONAL6 0x8c /* Keyboard International 6 */ -#define HID_KBD_USAGE_INTERNATIONAL7 0x8d /* Keyboard International 7 */ -#define HID_KBD_USAGE_INTERNATIONAL8 0x8e /* Keyboard International 8 */ -#define HID_KBD_USAGE_INTERNATIONAL9 0x8f /* Keyboard International 9 */ -#define HID_KBD_USAGE_LANG1 0x90 /* Keyboard LANG1 */ -#define HID_KBD_USAGE_LANG2 0x91 /* Keyboard LANG2 */ -#define HID_KBD_USAGE_LANG3 0x92 /* Keyboard LANG3 */ -#define HID_KBD_USAGE_LANG4 0x93 /* Keyboard LANG4 */ -#define HID_KBD_USAGE_LANG5 0x94 /* Keyboard LANG5 */ -#define HID_KBD_USAGE_LANG6 0x95 /* Keyboard LANG6 */ -#define HID_KBD_USAGE_LANG7 0x96 /* Keyboard LANG7 */ -#define HID_KBD_USAGE_LANG8 0x97 /* Keyboard LANG8 */ -#define HID_KBD_USAGE_LANG9 0x98 /* Keyboard LANG9 */ -#define HID_KBD_USAGE_ALTERASE 0x99 /* Keyboard Alternate Erase */ -#define HID_KBD_USAGE_SYSREQ 0x9a /* Keyboard SysReq/Attention */ -#define HID_KBD_USAGE_CANCEL 0x9b /* Keyboard Cancel */ -#define HID_KBD_USAGE_CLEAR 0x9c /* Keyboard Clear */ -#define HID_KBD_USAGE_PRIOR 0x9d /* Keyboard Prior */ -#define HID_KBD_USAGE_RETURN 0x9e /* Keyboard Return */ -#define HID_KBD_USAGE_SEPARATOR 0x9f /* Keyboard Separator */ -#define HID_KBD_USAGE_OUT 0xa0 /* Keyboard Out */ -#define HID_KBD_USAGE_OPER 0xa1 /* Keyboard Oper */ -#define HID_KBD_USAGE_CLEARAGAIN 0xa2 /* Keyboard Clear/Again */ -#define HID_KBD_USAGE_CLRSEL 0xa3 /* Keyboard CrSel/Props */ -#define HID_KBD_USAGE_EXSEL 0xa4 /* Keyboard ExSel */ -#define HID_KBD_USAGE_KPD00 0xb0 /* Keypad 00 */ -#define HID_KBD_USAGE_KPD000 0xb1 /* Keypad 000 */ -#define HID_KBD_USAGE_THOUSEPARATOR 0xb2 /* Thousands Separator */ -#define HID_KBD_USAGE_DECSEPARATOR 0xb3 /* Decimal Separator */ -#define HID_KBD_USAGE_CURRUNIT 0xb4 /* Currency Unit */ -#define HID_KBD_USAGE_CURRSUBUNIT 0xb5 /* Currency Sub-unit */ -#define HID_KBD_USAGE_KPDLPAREN 0xb6 /* Keypad ( */ -#define HID_KBD_USAGE_KPDRPAREN 0xb7 /* Keypad ) */ -#define HID_KBD_USAGE_KPDLBRACE 0xb8 /* Keypad { */ -#define HID_KBD_USAGE_KPDRBRACE 0xb9 /* Keypad } */ -#define HID_KBD_USAGE_KPDTAB 0xba /* Keypad Tab */ -#define HID_KBD_USAGE_KPDBACKSPACE 0xbb /* Keypad Backspace */ -#define HID_KBD_USAGE_KPDA 0xbc /* Keypad A (B-F follow) */ -#define HID_KBD_USAGE_KPDXOR 0xc2 /* Keypad XOR */ -#define HID_KBD_USAGE_KPDEXP 0xc3 /* Keypad ^ */ -#define HID_KBD_USAGE_KPDPERCENT 0xc4 /* Keypad % */ -#define HID_KBD_USAGE_KPDLT 0xc5 /* Keypad < */ -#define HID_KBD_USAGE_KPDGT 0xc6 /* Keypad > */ -#define HID_KBD_USAGE_KPDAMPERSAND 0xc7 /* Keypad & */ -#define HID_KBD_USAGE_KPDAND 0xc8 /* Keypad && */ -#define HID_KBD_USAGE_KPDVERT 0xc9 /* Keypad | */ -#define HID_KBD_USAGE_KPDOR 0xca /* Keypad || */ -#define HID_KBD_USAGE_KPDCOLON 0xcb /* Keypad : */ -#define HID_KBD_USAGE_KPDPOUND 0xcc /* Keypad # */ -#define HID_KBD_USAGE_KPDSPACE 0xcd /* Keypad Space */ -#define HID_KBD_USAGE_KPDAT 0xce /* Keypad @ */ -#define HID_KBD_USAGE_KPDEXCLAM 0xcf /* Keypad ! */ -#define HID_KBD_USAGE_KPDMEMSTORE 0xd0 /* Keypad Memory Store */ -#define HID_KBD_USAGE_KPDMEMRECALL 0xd1 /* Keypad Memory Recall */ -#define HID_KBD_USAGE_KPDMEMCLEAR 0xd2 /* Keypad Memory Clear */ -#define HID_KBD_USAGE_KPDMEMADD 0xd3 /* Keypad Memory Add */ -#define HID_KBD_USAGE_KPDMEMSUB 0xd4 /* Keypad Memory Subtract */ -#define HID_KBD_USAGE_KPDMEMMULT 0xd5 /* Keypad Memory Multiply */ -#define HID_KBD_USAGE_KPDMEMDIV 0xd6 /* Keypad Memory Divide */ -#define HID_KBD_USAGE_KPDPLUSMINUS 0xd7 /* Keypad +/- */ -#define HID_KBD_USAGE_KPDCLEAR 0xd8 /* Keypad Clear */ -#define HID_KBD_USAGE_KPDCLEARENTRY 0xd9 /* Keypad Clear Entry */ -#define HID_KBD_USAGE_KPDBINARY 0xda /* Keypad Binary */ -#define HID_KBD_USAGE_KPDOCTAL 0xdb /* Keypad Octal */ -#define HID_KBD_USAGE_KPDDECIMAL 0xdc /* Keypad Decimal */ -#define HID_KBD_USAGE_KPDHEXADECIMAL 0xdd /* Keypad Hexadecimal */ -#define HID_KBD_USAGE_LCTRL 0xe0 /* Keyboard LeftControl */ -#define HID_KBD_USAGE_LSHIFT 0xe1 /* Keyboard LeftShift */ -#define HID_KBD_USAGE_LALT 0xe2 /* Keyboard LeftAlt */ -#define HID_KBD_USAGE_LGUI 0xe3 /* Keyboard Left GUI */ -#define HID_KBD_USAGE_RCTRL 0xe4 /* Keyboard RightControl */ -#define HID_KBD_USAGE_RSHIFT 0xe5 /* Keyboard RightShift */ -#define HID_KBD_USAGE_RALT 0xe6 /* Keyboard RightAlt */ -#define HID_KBD_USAGE_RGUI 0xe7 /* Keyboard Right GUI */ - -#define HID_KBD_USAGE_MAX 0xe7 - -/* HID Report Definitions */ -struct usb_hid_class_subdescriptor { - uint8_t bDescriptorType;/* Class descriptor type (See 7.1) */ - uint16_t wDescriptorLength;/* Size of the report descriptor */ -} __PACKED; - -struct usb_hid_descriptor { - uint8_t bLength; /* Size of the HID descriptor */ - uint8_t bDescriptorType;/* HID descriptor type */ - uint16_t bcdHID;/* HID class specification release */ - uint8_t bCountryCode;/* Country code */ - uint8_t bNumDescriptors;/* Number of descriptors (>=1) */ - - /* - * Specification says at least one Class Descriptor needs to - * be present (Report Descriptor). - */ - struct usb_hid_class_subdescriptor subdesc[1]; -} __PACKED; - -/* Standard Reports *********************************************************/ - -/* Keyboard input report (8 bytes) (HID B.1) */ -struct usb_hid_kbd_report -{ - uint8_t modifier; /* Modifier keys. See HID_MODIFER_* definitions */ - uint8_t reserved; - uint8_t key[6]; /* Keycode 1-6 */ -}; - -/* Keyboard output report (1 byte) (HID B.1), - * see USBHID_KBDOUT_* definitions - */ - -/* Mouse input report (HID B.2) */ -struct usb_hid_mouse_report -{ - uint8_t buttons; /* See HID_MOUSE_INPUT_BUTTON_* definitions */ - int8_t xdisp; /* X displacement */ - int8_t ydisp; /* y displacement */ - /* Device specific additional bytes may follow */ -#ifdef CONFIG_INPUT_MOUSE_WHEEL - uint8_t wdisp; /* Wheel displacement */ -#endif -}; - -/* Joystick input report (1 bytes) (HID D.1) */ -struct usb_hid_js_report -{ - uint8_t xpos; /* X position */ - uint8_t ypos; /* X position */ - uint8_t buttons; /* See USBHID_JSIN_* definitions */ - uint8_t throttle; /* Throttle */ -}; - -#endif /* USB_HID_H */ diff --git a/third-party/cherryusb/class/hid/usbd_hid.c b/third-party/cherryusb/class/hid/usbd_hid.c deleted file mode 100644 index b2659bdf9640bf1ad044dc76cf4799b2f38636b5..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/hid/usbd_hid.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbd_core.h" -#include "usbd_hid.h" - -static int hid_class_interface_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - USB_LOG_DBG("HID Class request: " - "bRequest 0x%02x\r\n", - setup->bRequest); - - uint8_t intf_num = LO_BYTE(setup->wIndex); - - switch (setup->bRequest) { - case HID_REQUEST_GET_REPORT: - /* report id ,report type */ - (*data)[0] = usbh_hid_get_report(intf_num, LO_BYTE(setup->wValue), HI_BYTE(setup->wValue)); - *len = 1; - break; - case HID_REQUEST_GET_IDLE: - (*data)[0] = usbh_hid_get_idle(intf_num, LO_BYTE(setup->wValue)); - *len = 1; - break; - case HID_REQUEST_GET_PROTOCOL: - (*data)[0] = usbh_hid_get_protocol(intf_num); - *len = 1; - break; - case HID_REQUEST_SET_REPORT: - /* report id ,report type, report, report len */ - usbh_hid_set_report(intf_num, LO_BYTE(setup->wValue), HI_BYTE(setup->wValue), *data, *len); - break; - case HID_REQUEST_SET_IDLE: - /* report id, duration */ - usbh_hid_set_idle(intf_num, LO_BYTE(setup->wValue), HI_BYTE(setup->wValue)); - break; - case HID_REQUEST_SET_PROTOCOL: - /* protocol */ - usbh_hid_set_protocol(intf_num, LO_BYTE(setup->wValue)); - break; - - default: - USB_LOG_WRN("Unhandled HID Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - - return 0; -} - -struct usbd_interface *usbd_hid_init_intf(struct usbd_interface *intf, const uint8_t *desc, uint32_t desc_len) -{ - intf->class_interface_handler = hid_class_interface_request_handler; - intf->class_endpoint_handler = NULL; - intf->vendor_handler = NULL; - intf->notify_handler = NULL; - - intf->hid_report_descriptor = desc; - intf->hid_report_descriptor_len = desc_len; - return intf; -} - -__WEAK uint8_t usbh_hid_get_report(uint8_t intf, uint8_t report_id, uint8_t report_type) -{ - return 0; -} - -__WEAK uint8_t usbh_hid_get_idle(uint8_t intf, uint8_t report_id) -{ - return 0; -} - -__WEAK uint8_t usbh_hid_get_protocol(uint8_t intf) -{ - return 0; -} - -__WEAK void usbh_hid_set_report(uint8_t intf, uint8_t report_id, uint8_t report_type, uint8_t *report, uint8_t report_len) -{ -} - -__WEAK void usbh_hid_set_idle(uint8_t intf, uint8_t report_id, uint8_t duration) -{ -} - -__WEAK void usbh_hid_set_protocol(uint8_t intf, uint8_t protocol) -{ -} \ No newline at end of file diff --git a/third-party/cherryusb/class/hid/usbd_hid.h b/third-party/cherryusb/class/hid/usbd_hid.h deleted file mode 100644 index 9c1be36271a73f01d55ccd6c16883a28e4daebae..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/hid/usbd_hid.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBD_HID_H -#define USBD_HID_H - -#include "usb_hid.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Init hid interface driver */ -struct usbd_interface *usbd_hid_init_intf(struct usbd_interface *intf, const uint8_t *desc, uint32_t desc_len); - -/* Register desc api */ -void usbd_hid_descriptor_register(uint8_t intf_num, const uint8_t *desc); -void usbd_hid_report_descriptor_register(uint8_t intf_num, const uint8_t *desc, uint32_t desc_len); - -/* Setup request command callback api */ -uint8_t usbh_hid_get_report(uint8_t intf, uint8_t report_id, uint8_t report_type); -uint8_t usbh_hid_get_idle(uint8_t intf, uint8_t report_id); -uint8_t usbh_hid_get_protocol(uint8_t intf); -void usbh_hid_set_report(uint8_t intf, uint8_t report_id, uint8_t report_type, uint8_t *report, uint8_t report_len); -void usbh_hid_set_idle(uint8_t intf, uint8_t report_id, uint8_t duration); -void usbh_hid_set_protocol(uint8_t intf, uint8_t protocol); - -#ifdef __cplusplus -} -#endif - -#endif /* USBD_HID_H */ diff --git a/third-party/cherryusb/class/hid/usbh_hid.c b/third-party/cherryusb/class/hid/usbh_hid.c deleted file mode 100644 index 7a7bee78c39a8f099f109e65aaf26a56ae40d18b..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/hid/usbh_hid.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbh_core.h" -#include "usbh_hid.h" - -#define DEV_FORMAT "/usb%d/input%d" -#define KBD_FORMAT "/usb%d/kbd%d" -#define MOUSE_FORMAT "/usb%d/mouse%d" - -static uint32_t g_devinuse = 0; - -USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_hid_buf[128]; - -static int usbh_hid_devno_alloc(struct usbh_hid *hid_class) -{ - int devno; - - for (devno = 0; devno < 32; devno++) { - uint32_t bitno = 1 << devno; - if ((g_devinuse & bitno) == 0) { - g_devinuse |= bitno; - hid_class->minor = devno; - return 0; - } - } - - return -EMFILE; -} - -static void usbh_hid_devno_free(struct usbh_hid *hid_class) -{ - int devno = hid_class->minor; - - if (devno >= 0 && devno < 32) { - g_devinuse &= ~(1 << devno); - } -} - -static int usbh_hid_get_report_descriptor(struct usbh_hid *hid_class, uint8_t *buffer) -{ - struct usb_setup_packet *setup = hid_class->hport->setup; - int ret; - - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_STANDARD | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = USB_REQUEST_GET_DESCRIPTOR; - setup->wValue = HID_DESCRIPTOR_TYPE_HID_REPORT << 8; - setup->wIndex = hid_class->intf; - setup->wLength = 128; - - ret = usbh_control_transfer(hid_class->hport->ep0, setup, g_hid_buf); - if (ret < 0) { - return ret; - } - memcpy(buffer, g_hid_buf, ret - 8); - return ret; -} - -int usbh_hid_set_idle(struct usbh_hid *hid_class, uint8_t report_id, uint8_t duration) -{ - struct usb_setup_packet *setup = hid_class->hport->setup; - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = HID_REQUEST_SET_IDLE; - setup->wValue = (duration << 8) | report_id; - setup->wIndex = hid_class->intf; - setup->wLength = 0; - - return usbh_control_transfer(hid_class->hport->ep0, setup, NULL); -} - -int usbh_hid_get_idle(struct usbh_hid *hid_class, uint8_t *buffer) -{ - struct usb_setup_packet *setup = hid_class->hport->setup; - int ret; - - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = HID_REQUEST_GET_IDLE; - setup->wValue = 0; - setup->wIndex = hid_class->intf; - setup->wLength = 1; - - ret = usbh_control_transfer(hid_class->hport->ep0, setup, g_hid_buf); - if (ret < 0) { - return ret; - } - memcpy(buffer, g_hid_buf, 1); - return ret; -} - -int usbh_hid_set_protocol(struct usbh_hid *hid_class, uint8_t protocol) -{ - struct usb_setup_packet *setup = hid_class->hport->setup; - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = HID_REQUEST_SET_PROTOCOL; - setup->wValue = protocol; - setup->wIndex = 0; - setup->wLength = 0; - - return usbh_control_transfer(hid_class->hport->ep0, setup, NULL); -} - -int usbh_hid_connect(struct usbh_hubport *hport, uint8_t intf) -{ - struct usb_endpoint_descriptor *ep_desc; - struct usbh_bus *usb = usbh_get_bus_of_port(hport); - int ret; - - struct usbh_hid *hid_class = usb_malloc(sizeof(struct usbh_hid)); - if (hid_class == NULL) { - USB_LOG_ERR("Fail to alloc hid_class\r\n"); - return -ENOMEM; - } - - memset(hid_class, 0, sizeof(struct usbh_hid)); - usbh_hid_devno_alloc(hid_class); - hid_class->hport = hport; - hid_class->intf = intf; - - hport->config.intf[intf].priv = hid_class; - - // /* 0x0 = boot protocol, 0x1 = report protocol */ - // ret = usbh_hid_set_protocol(hid_class, 0x1); - // if (ret < 0) { - // return ret; - // } - - ret = usbh_hid_set_idle(hid_class, 0, 0); - if (ret < 0) { - USB_LOG_WRN("Do not support set idle\r\n"); - } - - ret = usbh_hid_get_report_descriptor(hid_class, hid_class->report_desc); - if (ret < 0) { - return ret; - } - - for (uint8_t i = 0; i < hport->config.intf[intf].altsetting[0].intf_desc.bNumEndpoints; i++) { - ep_desc = &hport->config.intf[intf].altsetting[0].ep[i].ep_desc; - if (ep_desc->bEndpointAddress & 0x80) { - usbh_hport_activate_epx(&hid_class->intin, hport, ep_desc); - } else { - usbh_hport_activate_epx(&hid_class->intout, hport, ep_desc); - } - } - - /* register hid device with different name */ - if (HID_PROTOCOL_KEYBOARD == hport->config.intf[intf].altsetting[0].intf_desc.bInterfaceProtocol) - snprintf(hport->config.intf[intf].devname, CONFIG_USBHOST_DEV_NAMELEN, KBD_FORMAT, usb->id, hid_class->minor); - else if (HID_PROTOCOL_MOUSE == hport->config.intf[intf].altsetting[0].intf_desc.bInterfaceProtocol) - snprintf(hport->config.intf[intf].devname, CONFIG_USBHOST_DEV_NAMELEN, MOUSE_FORMAT, usb->id, hid_class->minor); - else - snprintf(hport->config.intf[intf].devname, CONFIG_USBHOST_DEV_NAMELEN, DEV_FORMAT, usb->id, hid_class->minor); - - USB_LOG_RAW("Register HID Class:%s for USB-%d\r\n", hport->config.intf[intf].devname, usb->id); - - usbh_hid_run(hid_class); - return ret; -} - -int usbh_hid_disconnect(struct usbh_hubport *hport, uint8_t intf) -{ - int ret = 0; - - struct usbh_hid *hid_class = (struct usbh_hid *)hport->config.intf[intf].priv; - - if (hid_class) { - usbh_hid_devno_free(hid_class); - - if (hid_class->intin) { - usbh_pipe_free(hid_class->intin); - } - - if (hid_class->intout) { - usbh_pipe_free(hid_class->intout); - } - - usbh_hid_stop(hid_class); - memset(hid_class, 0, sizeof(struct usbh_hid)); - usb_free(hid_class); - - if (hport->config.intf[intf].devname[0] != '\0') - USB_LOG_RAW("Unregister HID Class:%s\r\n", hport->config.intf[intf].devname); - } - - return ret; -} - -__WEAK void usbh_hid_run(struct usbh_hid *hid_class) -{ - -} - -__WEAK void usbh_hid_stop(struct usbh_hid *hid_class) -{ - -} - -const struct usbh_class_driver hid_class_driver = { - .driver_name = "hid", - .connect = usbh_hid_connect, - .disconnect = usbh_hid_disconnect -}; - -CLASS_INFO_DEFINE const struct usbh_class_info hid_custom_class_info = { - .match_flags = USB_CLASS_MATCH_INTF_CLASS, - .class = USB_DEVICE_CLASS_HID, - .subclass = 0x00, - .protocol = 0x00, - .vid = 0x00, - .pid = 0x00, - .class_driver = &hid_class_driver -}; diff --git a/third-party/cherryusb/class/hid/usbh_hid.h b/third-party/cherryusb/class/hid/usbh_hid.h deleted file mode 100644 index 9faf2023ba4880cec8fe65a09d80670fdd70c9b2..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/hid/usbh_hid.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBH_HID_H -#define USBH_HID_H - -#include "usb_hid.h" - -struct usbh_hid { - struct usbh_hubport *hport; - - uint8_t report_desc[128]; - uint8_t intf; /* interface number */ - uint8_t minor; - usbh_pipe_t intin; /* INTR IN endpoint */ - usbh_pipe_t intout; /* INTR OUT endpoint */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -int usbh_hid_set_idle(struct usbh_hid *hid_class, uint8_t report_id, uint8_t duration); -int usbh_hid_get_idle(struct usbh_hid *hid_class, uint8_t *buffer); - -void usbh_hid_run(struct usbh_hid *hid_class); -void usbh_hid_stop(struct usbh_hid *hid_class); - -#ifdef __cplusplus -} -#endif - -#endif /* USBH_HID_H */ diff --git a/third-party/cherryusb/class/hub/usb_hub.h b/third-party/cherryusb/class/hub/usb_hub.h deleted file mode 100644 index 5ffa84726ea7a070739de7a343c7436e88fee378..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/hub/usb_hub.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_HUB_H -#define USB_HUB_H - -/* HUB Class Descriptor Types */ -#define HUB_DESCRIPTOR_TYPE_HUB 0x29 -#define HUB_DESCRIPTOR_TYPE_HUB3 0x2a - -/* Hub class requests */ -#define HUB_REQUEST_GET_STATUS USB_REQUEST_GET_STATUS -#define HUB_REQUEST_CLEAR_FEATURE USB_REQUEST_CLEAR_FEATURE -#define HUB_REQUEST_SET_FEATURE USB_REQUEST_SET_FEATURE -#define HUB_REQUEST_GET_DESCRIPTOR USB_REQUEST_GET_DESCRIPTOR -#define HUB_REQUEST_SET_DESCRIPTOR USB_REQUEST_SET_DESCRIPTOR -#define HUB_REQUEST_CLEAR_TT_BUFFER (0x08) -#define HUB_REQUEST_RESET_TT (0x09) -#define HUB_REQUEST_GET_TT_STATE (0x0a) -#define HUB_REQUEST_STOP_TT (0x0b) -#define HUB_REQUEST_SET_HUB_DEPTH (0x0C) - -/* Hub class features */ -#define HUB_FEATURE_HUB_C_LOCALPOWER (0x0) -#define HUB_FEATURE_HUB_C_OVERCURRENT (0x1) - -/* Port features */ -#define HUB_PORT_FEATURE_CONNECTION (0x00) -#define HUB_PORT_FEATURE_ENABLE (0x01) -#define HUB_PORT_FEATURE_SUSPEND (0x02) -#define HUB_PORT_FEATURE_OVERCURRENT (0x03) -#define HUB_PORT_FEATURE_RESET (0x04) -#define HUB_PORT_FEATURE_L1 (0x05) -#define HUB_PORT_FEATURE_POWER (0x08) -#define HUB_PORT_FEATURE_LOWSPEED (0x09) -#define HUB_PORT_FEATURE_HIGHSPEED (0x0a) -#define HUB_PORT_FEATURE_C_CONNECTION (0x10) -#define HUB_PORT_FEATURE_C_ENABLE (0x11) -#define HUB_PORT_FEATURE_C_SUSPEND (0x12) -#define HUB_PORT_FEATURE_C_OVER_CURREN (0x13) -#define HUB_PORT_FEATURE_C_RESET (0x14) -#define HUB_PORT_FEATURE_TEST (0x15) -#define HUB_PORT_FEATURE_INDICATOR (0x16) -#define HUB_PORT_FEATURE_C_PORTL1 (0x17) - -/* Hub status */ -#define HUB_STATUS_LOCALPOWER (1 << 0) -#define HUB_STATUS_OVERCURRENT (1 << 1) - -/* Hub status change */ -#define HUB_STATUS_C_LOCALPOWER (1 << 0) -#define HUB_STATUS_C_OVERCURRENT (1 << 1) - -/* Hub port status */ -#define HUB_PORT_STATUS_CONNECTION (1 << 0) -#define HUB_PORT_STATUS_ENABLE (1 << 1) -#define HUB_PORT_STATUS_SUSPEND (1 << 2) -#define HUB_PORT_STATUS_OVERCURRENT (1 << 3) -#define HUB_PORT_STATUS_RESET (1 << 4) -#define HUB_PORT_STATUS_L1 (1 << 5) -#define HUB_PORT_STATUS_POWER (1 << 8) -#define HUB_PORT_STATUS_LOW_SPEED (1 << 9) -#define HUB_PORT_STATUS_HIGH_SPEED (1 << 10) -#define HUB_PORT_STATUS_TEST (1 << 11) -#define HUB_PORT_STATUS_INDICATOR (1 << 12) - -/* Hub port status change */ -#define HUB_PORT_STATUS_C_CONNECTION (1 << 0) -#define HUB_PORT_STATUS_C_ENABLE (1 << 1) -#define HUB_PORT_STATUS_C_SUSPEND (1 << 2) -#define HUB_PORT_STATUS_C_OVERCURRENT (1 << 3) -#define HUB_PORT_STATUS_C_RESET (1 << 4) -#define HUB_PORT_STATUS_C_L1 (1 << 5) - -/* Hub characteristics */ -#define HUB_CHAR_LPSM_SHIFT (0) /* Bits 0-1: Logical Power Switching Mode */ -#define HUB_CHAR_LPSM_MASK (3 << HUB_CHAR_LPSM_SHIFT) -#define HUB_CHAR_LPSM_GANGED (0 << HUB_CHAR_LPSM_SHIFT) -#define HUB_CHAR_LPSM_INDIVIDUAL (1 << HUB_CHAR_LPSM_SHIFT) -#define HUB_CHAR_COMPOUND (1 << 2) /* Bit 2: Compound device */ -#define HUB_CHAR_OCPM_SHIFT (3) /* Bits 3-4: Over-current Protection Mode */ -#define HUB_CHAR_OCPM_MASK (3 << HUB_CHAR_OCPM_SHIFT) -#define HUB_CHAR_OCPM_GLOBAL (0 << HUB_CHAR_OCPM_SHIFT) -#define HUB_CHAR_OCPM_INDIVIDUAL (1 << HUB_CHAR_OCPM_SHIFT) -#define HUB_CHAR_TTTT_SHIFT (5) /* Bits 5-6: TT Think Time */ -#define HUB_CHAR_TTTT_MASK (3 << HUB_CHAR_TTTT_SHIFT) -#define HUB_CHAR_TTTT_8_BITS (0 << HUB_CHAR_TTTT_SHIFT) -#define HUB_CHAR_TTTT_16_BITS (1 << HUB_CHAR_TTTT_SHIFT) -#define HUB_CHAR_TTTT_24_BITS (2 << HUB_CHAR_TTTT_SHIFT) -#define HUB_CHAR_TTTT_32_BITS (3 << HUB_CHAR_TTTT_SHIFT) -#define HUB_CHAR_PORTIND (1 << 7) /* Bit 7: Port Indicators Supported */ - -/* Hub descriptor */ -struct usb_hub_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bNbrPorts; - uint16_t wHubCharacteristics; - uint8_t bPwrOn2PwrGood; - uint8_t bHubContrCurrent; - uint8_t DeviceRemovable; - uint8_t PortPwrCtrlMask; -} __PACKED; - -#define USB_SIZEOF_HUB_DESC 9 - -/* Hub status */ -struct hub_status { - uint16_t wPortStatus; - uint16_t wPortChange; -}; - -/* Hub port status */ -struct hub_port_status { - uint16_t wPortStatus; - uint16_t wPortChange; -}; - -#endif /* USB_HUB_H */ diff --git a/third-party/cherryusb/class/hub/usbh_hub.c b/third-party/cherryusb/class/hub/usbh_hub.c deleted file mode 100644 index f1a320898f272c0657308c498fee0992c77868da..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/hub/usbh_hub.c +++ /dev/null @@ -1,740 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbh_hub.h" - -#define DEV_FORMAT "/usb%d/hub%d" - -#define HUB_DEBOUNCE_TIMEOUT 1500 -#define HUB_DEBOUNCE_STEP 25 -#define HUB_DEBOUNCE_STABLE 100 -#define DELAY_TIME_AFTER_RESET 200 - -#define EXTHUB_FIRST_INDEX 2 - -#if CONFIG_USBHOST_MAX_EXTHUBS > 0 -static uint32_t g_devinuse = 0; -#endif - -extern int usbh_hport_activate_ep0(struct usbh_hubport *hport); -extern int usbh_hport_deactivate_ep0(struct usbh_hubport *hport); -extern int usbh_enumerate(struct usbh_hubport *hport); -static void usbh_hub_thread_wakeup(struct usbh_hub *hub); - -static const char *speed_table[] = { "error-speed", "low-speed", "full-speed", "high-speed", "wireless-speed", "super-speed", "superplus-speed" }; - -struct usbh_hubport *usbh_get_roothub_port (struct usbh_bus *bus, unsigned int address) -{ - return &(bus->roothub.child[ address - 1 ]); -} - -#if CONFIG_USBHOST_MAX_EXTHUBS > 0 -static int usbh_hub_devno_alloc(void) -{ - int devno; - - for (devno = EXTHUB_FIRST_INDEX; devno < 32; devno++) { - uint32_t bitno = 1 << devno; - if ((g_devinuse & bitno) == 0) { - g_devinuse |= bitno; - return devno; - } - } - - return -EMFILE; -} - -static void usbh_hub_devno_free(uint8_t devno) -{ - if (devno >= EXTHUB_FIRST_INDEX && devno < 32) { - g_devinuse &= ~(1 << devno); - } -} -#endif - -static void usbh_hub_register(struct usbh_hub *hub) -{ - struct usbh_bus *usb = hub->usb; - usb_slist_add_tail(&usb->hub_class_head, &hub->list); -} - -#if CONFIG_USBHOST_MAX_EXTHUBS > 0 -static void usbh_hub_unregister(struct usbh_hub *hub) -{ - struct usbh_bus *usb = hub->usb; - usb_slist_remove(&usb->hub_class_head, &hub->list); -} - -static int _usbh_hub_get_hub_descriptor(struct usbh_hub *hub, uint8_t *buffer) -{ - struct usb_setup_packet *setup; - int ret; - - setup = hub->parent->setup; - - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_DEVICE; - setup->bRequest = USB_REQUEST_GET_DESCRIPTOR; - - /* TODO: hub descriptor has some difference between USB 2.0 and USB 3.x, - and we havn't handle the difference here */ - if ((hub->parent->speed == USB_SPEED_SUPER) || - (hub->parent->speed == USB_SPEED_SUPER_PLUS)) { - setup->wValue = HUB_DESCRIPTOR_TYPE_HUB3 << 8; - } else { - setup->wValue = HUB_DESCRIPTOR_TYPE_HUB << 8; - } - - setup->wIndex = 0; - setup->wLength = USB_SIZEOF_HUB_DESC; - - ret = usbh_control_transfer(hub->parent->ep0, setup, hub->g_hub_buf); - if (ret < 0) { - return ret; - } - memcpy(buffer, hub->g_hub_buf, USB_SIZEOF_HUB_DESC); - return ret; -} - -static int _usbh_hub_get_status(struct usbh_hub *hub, uint8_t *buffer) -{ - struct usb_setup_packet *setup; - int ret; - - setup = hub->parent->setup; - - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_DEVICE; - setup->bRequest = HUB_REQUEST_GET_STATUS; - setup->wValue = 0; - setup->wIndex = 0; - setup->wLength = 2; - - ret = usbh_control_transfer(hub->parent->ep0, setup, hub->g_hub_buf); - if (ret < 0) { - return ret; - } - memcpy(buffer, hub->g_hub_buf, 2); - return ret; -} -#endif - -static int _usbh_hub_get_portstatus(struct usbh_hub *hub, uint8_t port, struct hub_port_status *port_status) -{ - struct usb_setup_packet *setup; - int ret; - - setup = hub->parent->setup; - - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_OTHER; - setup->bRequest = HUB_REQUEST_GET_STATUS; - setup->wValue = 0; - setup->wIndex = port; - setup->wLength = 4; - - ret = usbh_control_transfer(hub->parent->ep0, setup, hub->g_hub_buf); - if (ret < 0) { - return ret; - } - memcpy(port_status, hub->g_hub_buf, 4); - return ret; -} - -static int _usbh_hub_set_feature(struct usbh_hub *hub, uint8_t port, uint8_t feature) -{ - struct usb_setup_packet *setup; - - setup = hub->parent->setup; - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_OTHER; - setup->bRequest = HUB_REQUEST_SET_FEATURE; - setup->wValue = feature; - setup->wIndex = port; - setup->wLength = 0; - - return usbh_control_transfer(hub->parent->ep0, setup, NULL); -} - -static int _usbh_hub_clear_feature(struct usbh_hub *hub, uint8_t port, uint8_t feature) -{ - struct usb_setup_packet *setup; - - setup = hub->parent->setup; - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_OTHER; - setup->bRequest = HUB_REQUEST_CLEAR_FEATURE; - setup->wValue = feature; - setup->wIndex = port; - setup->wLength = 0; - - return usbh_control_transfer(hub->parent->ep0, setup, NULL); -} - -static int _usbh_hub_set_depth(struct usbh_hub *hub, uint16_t depth) -{ - struct usb_setup_packet *setup; - - setup = hub->parent->setup; - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_DEVICE; - setup->bRequest = HUB_REQUEST_SET_HUB_DEPTH; - setup->wValue = depth; - setup->wIndex = 0; - setup->wLength = 0; - - return usbh_control_transfer(hub->parent->ep0, setup, NULL); -} - -#if CONFIG_USBHOST_MAX_EXTHUBS > 0 -static int parse_hub_descriptor(struct usb_hub_descriptor *desc, uint16_t length) -{ - if (desc->bLength != USB_SIZEOF_HUB_DESC) { - USB_LOG_ERR("invalid device bLength 0x%02x\r\n", desc->bLength); - return -1; - } else if (desc->bDescriptorType != HUB_DESCRIPTOR_TYPE_HUB) { - USB_LOG_ERR("unexpected descriptor 0x%02x\r\n", desc->bDescriptorType); - return -2; - } else { - USB_LOG_RAW("Hub Descriptor:\r\n"); - USB_LOG_RAW("bLength: 0x%02x \r\n", desc->bLength); - USB_LOG_RAW("bDescriptorType: 0x%02x \r\n", desc->bDescriptorType); - USB_LOG_RAW("bNbrPorts: 0x%02x \r\n", desc->bNbrPorts); - USB_LOG_RAW("wHubCharacteristics: 0x%04x \r\n", desc->wHubCharacteristics); - USB_LOG_RAW("bPwrOn2PwrGood: 0x%02x \r\n", desc->bPwrOn2PwrGood); - USB_LOG_RAW("bHubContrCurrent: 0x%02x \r\n", desc->bHubContrCurrent); - USB_LOG_RAW("DeviceRemovable: 0x%02x \r\n", desc->DeviceRemovable); - USB_LOG_RAW("PortPwrCtrlMask: 0x%02x \r\n", desc->PortPwrCtrlMask); - } - return 0; -} -#endif - -static int usbh_hub_get_portstatus(struct usbh_hub *hub, uint8_t port, struct hub_port_status *port_status) -{ - struct usb_setup_packet roothub_setup; - struct usb_setup_packet *setup; - - if (hub->is_roothub) { - setup = &roothub_setup; - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_OTHER; - setup->bRequest = HUB_REQUEST_GET_STATUS; - setup->wValue = 0; - setup->wIndex = port; - setup->wLength = 4; - return usbh_roothub_control(hub->usb, &roothub_setup, (uint8_t *)port_status); - } else { - return _usbh_hub_get_portstatus(hub, port, port_status); - } -} - -static int usbh_hub_set_feature(struct usbh_hub *hub, uint8_t port, uint8_t feature) -{ - struct usb_setup_packet roothub_setup; - struct usb_setup_packet *setup; - - if (hub->is_roothub) { - setup = &roothub_setup; - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_OTHER; - setup->bRequest = HUB_REQUEST_SET_FEATURE; - setup->wValue = feature; - setup->wIndex = port; - setup->wLength = 0; - return usbh_roothub_control(hub->usb, setup, NULL); - } else { - return _usbh_hub_set_feature(hub, port, feature); - } -} - -static int usbh_hub_clear_feature(struct usbh_hub *hub, uint8_t port, uint8_t feature) -{ - struct usb_setup_packet roothub_setup; - struct usb_setup_packet *setup; - - if (hub->is_roothub) { - setup = &roothub_setup; - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_OTHER; - setup->bRequest = HUB_REQUEST_CLEAR_FEATURE; - setup->wValue = feature; - setup->wIndex = port; - setup->wLength = 0; - return usbh_roothub_control(hub->usb, setup, NULL); - } else { - return _usbh_hub_clear_feature(hub, port, feature); - } -} - -static int usbh_hub_set_depth(struct usbh_hub *hub, uint16_t depth) -{ - struct usb_setup_packet roothub_setup; - struct usb_setup_packet *setup; - - if (hub->is_roothub) { - setup = &roothub_setup; - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_DEVICE; - setup->bRequest = HUB_REQUEST_SET_HUB_DEPTH; - setup->wValue = depth; - setup->wIndex = 0; - setup->wLength = 0; - return usbh_roothub_control(hub->usb, setup, NULL); - } else { - return _usbh_hub_set_depth(hub, depth); - } -} - -#if CONFIG_USBHOST_MAX_EXTHUBS > 0 -static void hub_int_complete_callback(void *arg, int nbytes) -{ - struct usbh_hub *hub = (struct usbh_hub *)arg; - - if (nbytes > 0) { - usbh_hub_thread_wakeup(hub); - } -} - -static int usbh_hub_connect(struct usbh_hubport *hport, uint8_t intf) -{ - struct usb_endpoint_descriptor *ep_desc; - struct hub_port_status port_status; - struct usbh_bus *usb = usbh_get_bus_of_port(hport); - int ret; - int index; - - index = usbh_hub_devno_alloc(); - if (index > (CONFIG_USBHOST_MAX_EXTHUBS + EXTHUB_FIRST_INDEX - 1)) { - USB_LOG_ERR("No memory to alloc hub class\r\n"); - usbh_hub_devno_free(index); - return -ENOMEM; - } - - struct usbh_hub *hub = &(usb->exthub[index - EXTHUB_FIRST_INDEX]); - - memset(hub, 0, sizeof(struct usbh_hub)); - hub->hub_addr = hport->dev_addr; - hub->parent = hport; - hub->index = index; - - hport->config.intf[intf].priv = hub; - - ret = _usbh_hub_get_hub_descriptor(hub, (uint8_t *)&hub->hub_desc); - if (ret < 0) { - return ret; - } - - parse_hub_descriptor(&hub->hub_desc, USB_SIZEOF_HUB_DESC); - - for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) { - hub->child[port].port = port + 1; - hub->child[port].parent = hub; - } - - ep_desc = &hport->config.intf[intf].altsetting[0].ep[0].ep_desc; - if (ep_desc->bEndpointAddress & 0x80) { - usbh_hport_activate_epx(&hub->intin, hport, ep_desc); - } else { - return -1; - } - - if (hport->speed == USB_SPEED_SUPER) { - uint16_t depth = 0; - struct usbh_hubport *parent = hport->parent->parent; - while (parent) { - depth++; - parent = parent->parent->parent; - } - - ret = usbh_hub_set_depth(hub, depth); - if (ret < 0) { - return ret; - } - } - - for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) { - ret = usbh_hub_set_feature(hub, port + 1, HUB_PORT_FEATURE_POWER); - if (ret < 0) { - return ret; - } - } - - for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) { - ret = usbh_hub_get_portstatus(hub, port + 1, &port_status); - USB_LOG_INFO("port %u, status:0x%02x, change:0x%02x\r\n", port + 1, port_status.wPortStatus, port_status.wPortChange); - if (ret < 0) { - return ret; - } - } - - hub->ports = hub->hub_desc.bNbrPorts; - hub->connected = true; - hub->usb = usb; - snprintf(hport->config.intf[intf].devname, CONFIG_USBHOST_DEV_NAMELEN, DEV_FORMAT, usb->id, hub->index); - usbh_hub_register(hub); - USB_LOG_RAW("Register HUB Class:%s for USB-%d\r\n", hport->config.intf[intf].devname, usb->id); - - hub->int_buffer = hub->g_hub_intbuf[hub->index - 1]; - usbh_int_urb_fill(&hub->intin_urb, hub->intin, hub->int_buffer, 1, 0, hub_int_complete_callback, hub); - usbh_submit_urb(&hub->intin_urb); - return 0; -} - -static int usbh_hub_disconnect(struct usbh_hubport *hport, uint8_t intf) -{ - struct usbh_hubport *child; - int ret = 0; - - struct usbh_hub *hub = (struct usbh_hub *)hport->config.intf[intf].priv; - - if (hub) { - usbh_hub_devno_free(hub->index); - - if (hub->intin) { - usbh_pipe_free(hub->intin); - } - - for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) { - child = &hub->child[port]; - usbh_hport_deactivate_ep0(child); - for (uint8_t i = 0; i < child->config.config_desc.bNumInterfaces; i++) { - if (child->config.intf[i].class_driver && child->config.intf[i].class_driver->disconnect) { - CLASS_DISCONNECT(child, i); - } - } - - child->config.config_desc.bNumInterfaces = 0; - child->parent = NULL; - } - - usbh_hub_unregister(hub); - memset(hub, 0, sizeof(struct usbh_hub)); - - if (hport->config.intf[intf].devname[0] != '\0') - USB_LOG_RAW("Unregister HUB Class:%s\r\n", hport->config.intf[intf].devname); - } - return ret; -} -#endif - -static void usbh_hubport_release(struct usbh_hubport *child) -{ - if (child->connected) { - child->connected = false; - usbh_hport_deactivate_ep0(child); - for (uint8_t i = 0; i < child->config.config_desc.bNumInterfaces; i++) { - if (child->config.intf[i].class_driver && child->config.intf[i].class_driver->disconnect) { - CLASS_DISCONNECT(child, i); - } - } - child->config.config_desc.bNumInterfaces = 0; - } -} - -static void usbh_hub_dump_status(struct usbh_hub *hub, uint8_t port, uint16_t portstatus, uint16_t portchange) -{ - USB_LOG_DBG("===================== \r\n"); - USB_LOG_DBG("hub-%d port-%d status 0x%x\r\n", hub->hub_addr, port, portstatus); - USB_LOG_DBG(" connection: %d\r\n", !!(portstatus & HUB_PORT_STATUS_CONNECTION)); - USB_LOG_DBG(" enable: %d\r\n", !!(portstatus & HUB_PORT_STATUS_ENABLE)); - USB_LOG_DBG(" suspend: %d\r\n", !!(portstatus & HUB_PORT_STATUS_SUSPEND)); - USB_LOG_DBG(" overcurrent: %d\r\n", !!(portstatus & HUB_PORT_STATUS_OVERCURRENT)); - USB_LOG_DBG(" reseting: %d\r\n", !!(portstatus & HUB_PORT_STATUS_RESET)); - USB_LOG_DBG(" power: %d\r\n", !!(portstatus & HUB_PORT_STATUS_POWER)); - if (portstatus & HUB_PORT_STATUS_LOW_SPEED) { - USB_LOG_DBG(" low-speed\r\n"); - } else if (portstatus & HUB_PORT_STATUS_HIGH_SPEED) { - USB_LOG_DBG(" high-speed\r\n"); - } else { - USB_LOG_DBG(" full-speed\r\n"); - } - USB_LOG_DBG(" test: %d\r\n", !!(portstatus & HUB_PORT_STATUS_TEST)); - USB_LOG_DBG(" indicator: %d\r\n", !!(portstatus & HUB_PORT_STATUS_INDICATOR)); - USB_LOG_DBG("hub-%d port-%d change 0x%x\r\n", hub->hub_addr, port, portchange); - USB_LOG_DBG(" connection change: %d\r\n", !!(portchange & HUB_PORT_STATUS_C_CONNECTION)); - USB_LOG_DBG(" enable change: %d\r\n", !!(portchange & HUB_PORT_STATUS_C_ENABLE)); - USB_LOG_DBG(" suspend change: %d\r\n", !!(portchange & HUB_PORT_STATUS_C_SUSPEND)); - USB_LOG_DBG(" overcurrent change: %d\r\n", !!(portchange & HUB_PORT_STATUS_C_OVERCURRENT)); - USB_LOG_DBG(" reset change: %d\r\n", !!(portchange & HUB_PORT_STATUS_C_RESET)); - USB_LOG_DBG("=====================\r\n"); -} - -static void usbh_hub_events(struct usbh_hub *hub) -{ - struct usbh_hubport *child; - struct hub_port_status port_status; - uint8_t portchange_index; - uint16_t portstatus; - uint16_t portchange; - uint16_t mask; - uint16_t feat; - uint8_t speed; - int ret; - - if (!hub->connected) { - return; - } - - for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) { - portchange_index = hub->int_buffer[0]; - - USB_LOG_DBG("Port change:0x%02x, Port:%u\r\n", portchange_index, port + 1); - - if (!(portchange_index & (1 << (port + 1)))) { - continue; - } - portchange_index &= ~(1 << (port + 1)); - USB_LOG_DBG("Port %d change\r\n", port + 1); - - /* Read hub port status */ - ret = usbh_hub_get_portstatus(hub, port + 1, &port_status); - if (ret < 0) { - USB_LOG_ERR("Failed to read port %u status, errorcode: %d\r\n", port + 1, ret); - continue; - } - - portstatus = port_status.wPortStatus; - portchange = port_status.wPortChange; - - usbh_hub_dump_status(hub, port + 1, portstatus, portchange); - - /* First, clear all change bits */ - mask = 1; - feat = HUB_PORT_FEATURE_C_CONNECTION; - while (portchange) { - if (portchange & mask) { - ret = usbh_hub_clear_feature(hub, port + 1, feat); - if (ret < 0) { - USB_LOG_ERR("Failed to clear port %u, change mask:%04x, errorcode:%d\r\n", port + 1, mask, ret); - continue; - } - portchange &= (~mask); - } - mask <<= 1; - feat++; - } - - portchange = port_status.wPortChange; - - /* Second, if port changes, debounces first */ - if (portchange & HUB_PORT_STATUS_C_CONNECTION) { - uint16_t connection = 0; - uint16_t debouncestable = 0; - for (uint32_t debouncetime = 0; debouncetime < HUB_DEBOUNCE_TIMEOUT; debouncetime += HUB_DEBOUNCE_STEP) { - /* Read hub port status */ - ret = usbh_hub_get_portstatus(hub, port + 1, &port_status); - if (ret < 0) { - USB_LOG_ERR("Failed to read port %u status, errorcode: %d\r\n", port + 1, ret); - continue; - } - - portstatus = port_status.wPortStatus; - portchange = port_status.wPortChange; - - USB_LOG_DBG("Port %u, status:0x%02x, change:0x%02x\r\n", port + 1, portstatus, portchange); - - if (!(portchange & HUB_PORT_STATUS_C_CONNECTION) && - ((portstatus & HUB_PORT_STATUS_CONNECTION) == connection)) { - debouncestable += HUB_DEBOUNCE_STEP; - if (debouncestable >= HUB_DEBOUNCE_STABLE) { - break; - } - } else { - debouncestable = 0; - connection = portstatus & HUB_PORT_STATUS_CONNECTION; - } - - if (portchange & HUB_PORT_STATUS_C_CONNECTION) { - usbh_hub_clear_feature(hub, port + 1, HUB_PORT_FEATURE_C_CONNECTION); - } - - usb_osal_msleep(HUB_DEBOUNCE_STEP); - } - - /** check if debounce ok */ - if (debouncestable < HUB_DEBOUNCE_STABLE) { - USB_LOG_ERR("Failed to debounce port %u\r\n", port + 1); - break; - } - - /* Last, check connect status */ - if (portstatus & HUB_PORT_STATUS_CONNECTION) { - ret = usbh_hub_set_feature(hub, port + 1, HUB_PORT_FEATURE_RESET); - if (ret < 0) { - USB_LOG_ERR("Failed to reset port %u,errorcode:%d\r\n", port + 1, ret); - continue; - } - - usb_osal_msleep(DELAY_TIME_AFTER_RESET); - /* Read hub port status */ - ret = usbh_hub_get_portstatus(hub, port + 1, &port_status); - if (ret < 0) { - USB_LOG_ERR("Failed to read port %u status, errorcode: %d\r\n", port + 1, ret); - continue; - } - - portstatus = port_status.wPortStatus; - portchange = port_status.wPortChange; - USB_LOG_DBG("Reset: %d, Enable: %d \r\n", - !!(portstatus & HUB_PORT_STATUS_RESET), - !!(portstatus & HUB_PORT_STATUS_ENABLE)); - if (!(portstatus & HUB_PORT_STATUS_RESET) && (portstatus & HUB_PORT_STATUS_ENABLE)) { - if (portchange & HUB_PORT_STATUS_C_RESET) { - ret = usbh_hub_clear_feature(hub, port + 1, HUB_PORT_FEATURE_C_RESET); - if (ret < 0) { - USB_LOG_ERR("Failed to clear port %u reset change, errorcode: %d\r\n", port + 1, ret); - } - } - - if (portstatus & HUB_PORT_STATUS_HIGH_SPEED) { - speed = USB_SPEED_HIGH; - } else if (portstatus & HUB_PORT_STATUS_LOW_SPEED) { - speed = USB_SPEED_LOW; - } -#ifdef CONFIG_USBHOST_XHCI - /* USB3.0 speed cannot get from portstatus, checkout port speed instead */ - else { - extern uint8_t usbh_get_port_speed(struct usbh_hub *hub, const uint8_t port); - - uint8_t port_speed = usbh_get_port_speed(hub, port + 1); - if (port_speed >= USB_SPEED_SUPER) { - /* assert that when using USB 3.0 ports, attached device must also be USB 3.0 speed */ - speed = port_speed; - } else { - speed = USB_SPEED_FULL; - } - } -#else - else { - speed = USB_SPEED_FULL; - } -#endif - - child = &hub->child[port]; - /** release child sources first */ - usbh_hubport_release(child); - - memset(child, 0, sizeof(struct usbh_hubport)); - child->parent = hub; - child->connected = true; - child->port = port + 1; - child->speed = speed; - - USB_LOG_RAW("New %s device on Hub %u, Port %u connected\r\n", speed_table[speed], hub->index, port + 1); - - /* Configure EP0 with the default maximum packet size */ - usbh_hport_activate_ep0(child); - - if (usbh_enumerate(child) < 0) { - /** release child sources */ - usbh_hubport_release(child); - USB_LOG_ERR("Port %u enumerate fail\r\n", port + 1); - } - } else { - child = &hub->child[port]; - /** release child sources */ - usbh_hubport_release(child); - - /** some USB 3.0 ip may failed to enable USB 2.0 port for USB 3.0 device */ - USB_LOG_WRN("Failed to enable port %u\r\n", port + 1); - - continue; - } - } else { - child = &hub->child[port]; - /** release child sources */ - usbh_hubport_release(child); - USB_LOG_INFO("Device on Hub %u, Port %u disconnected\r\n", hub->index, port + 1); - } - } - } - - hub->int_buffer[0] = 0; - /* Start next hub int transfer */ - if (!hub->is_roothub && hub->connected) { - usbh_submit_urb(&hub->intin_urb); - } -} - -static void usbh_hub_thread(void *argument) -{ - struct usbh_hub *hub; - int ret = 0; - struct usbh_bus *usb = (struct usbh_bus *)argument; - - usb_hc_init(usb->id); - while (1) { - USB_LOG_DBG("wait event of mq@%p \r\n", usb->hub_mq); - ret = usb_osal_mq_recv(usb->hub_mq, (void *)&hub, 0xffffffff); - if (ret < 0) { - continue; - } - USB_LOG_DBG("handle event of hub@%p \r\n", hub); - usbh_hub_events(hub); - } -} - -static void usbh_roothub_register(struct usbh_bus *usb) -{ - struct usbh_hub* roothub = &(usb->roothub); - memset(roothub, 0, sizeof(struct usbh_hub)); - - roothub->connected = true; - roothub->index = 1; - roothub->is_roothub = true; - roothub->parent = NULL; - roothub->hub_addr = 1; - roothub->hub_desc.bNbrPorts = CONFIG_USBHOST_MAX_RHPORTS; - roothub->usb = usb; - usbh_hub_register(roothub); -} - -static void usbh_hub_thread_wakeup(struct usbh_hub *hub) -{ - USB_LOG_DBG("try to wakeup hub0x%x \r\n", hub); - struct usbh_bus *usb = hub->usb; - usb_osal_mq_send(usb->hub_mq, (uintptr_t)hub); -} - -void usbh_roothub_thread_wakeup(uint32_t usb_id, uint8_t port) -{ - struct usbh_bus* usb = usbh_get_bus_of_index(usb_id); - struct usbh_hub* roothub = &(usb->roothub); - - roothub->int_buffer = roothub->g_hub_intbuf[roothub->index - 1]; - roothub->int_buffer[0] |= (1 << port); - USB_LOG_DBG("port-%u wakeup roothub@%p \r\n", port, roothub); - usbh_hub_thread_wakeup(roothub); -} - -int usbh_hub_initialize(struct usbh_bus *usb) -{ - usbh_roothub_register(usb); - - usb->hub_mq = usb_osal_mq_create(7); - if (usb->hub_mq == NULL) { - return -1; - } - - char thread_name[12]; - snprintf(thread_name, 12, "usb%d_hub", usb->id); - usb->hub_thread = usb_osal_thread_create(thread_name, CONFIG_USBHOST_PSC_STACKSIZE, CONFIG_USBHOST_PSC_PRIO, usbh_hub_thread, usb); - if (usb->hub_thread == NULL) { - return -1; - } - - return 0; -} -#if CONFIG_USBHOST_MAX_EXTHUBS > 0 -const struct usbh_class_driver hub_class_driver = { - .driver_name = "hub", - .connect = usbh_hub_connect, - .disconnect = usbh_hub_disconnect -}; - -CLASS_INFO_DEFINE const struct usbh_class_info hub_class_info = { - .match_flags = USB_CLASS_MATCH_INTF_CLASS, - .class = USB_DEVICE_CLASS_HUB, - .subclass = 0, - .protocol = 0, - .vid = 0x00, - .pid = 0x00, - .class_driver = &hub_class_driver -}; -#endif diff --git a/third-party/cherryusb/class/hub/usbh_hub.h b/third-party/cherryusb/class/hub/usbh_hub.h deleted file mode 100644 index f0142068d7ad79074c46bf357de824151410e79b..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/hub/usbh_hub.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBH_HUB_H -#define USBH_HUB_H - -#include "usbh_core.h" -#include "usb_hub.h" - -#define USBH_HUB_MAX_PORTS 4 -/* Maximum size of an interrupt IN transfer */ -#define USBH_HUB_INTIN_BUFSIZE ((USBH_HUB_MAX_PORTS + 8) >> 3) - -#ifdef __cplusplus -extern "C" { -#endif - -void usbh_roothub_thread_wakeup(uint32_t usb_id, uint8_t port); -int usbh_hub_initialize(struct usbh_bus *usb); -struct usbh_hubport *usbh_get_roothub_port (struct usbh_bus *bus, unsigned int port); - -#ifdef __cplusplus -} -#endif - -#endif /* USBH_HUB_H */ diff --git a/third-party/cherryusb/class/midi/usb_midi.h b/third-party/cherryusb/class/midi/usb_midi.h deleted file mode 100644 index 01f4035bac9e7ded24f3342fa686ba520811d1dc..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/midi/usb_midi.h +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_MIDI_H -#define USB_MIDI_H - -/* bDescriptorSubType */ -#define MIDI_VC_HEADER_DESCRIPTOR_SUBTYPE 0x01U -#define MIDI_MS_HEADER_DESCRIPTOR_SUBTYPE 0x01U -#define MIDI_MS_GENERAL_DESCRIPTOR_SUBTYPE 0x01U -#define MIDI_MIDI_IN_JACK_DESCRIPTOR_SUBTYPE 0x02U -#define MIDI_MIDI_OUT_JACK_DESCRIPTOR_SUBTYPE 0x03U - -/* bJackType */ -#define MIDI_JACK_TYPE_EMBEDDED 0x01 -#define MIDI_JACK_TYPE_EXTERNAL 0x02 - -#define MIDI_CHANNEL_OMNI 0 -#define MIDI_CHANNEL_OFF 17 - -#define MIDI_PITCHBEND_MIN -8192 -#define MIDI_PITCHBEND_MAX 8191 - -/*! Enumeration of MIDI types */ -enum MidiType { - InvalidType = 0x00, ///< For notifying errors - NoteOff = 0x80, ///< Note Off - NoteOn = 0x90, ///< Note On - AfterTouchPoly = 0xA0, ///< Polyphonic AfterTouch - ControlChange = 0xB0, ///< Control Change / Channel Mode - ProgramChange = 0xC0, ///< Program Change - AfterTouchChannel = 0xD0, ///< Channel (monophonic) AfterTouch - PitchBend = 0xE0, ///< Pitch Bend - SystemExclusive = 0xF0, ///< System Exclusive - TimeCodeQuarterFrame = 0xF1, ///< System Common - MIDI Time Code Quarter Frame - SongPosition = 0xF2, ///< System Common - Song Position Pointer - SongSelect = 0xF3, ///< System Common - Song Select - TuneRequest = 0xF6, ///< System Common - Tune Request - Clock = 0xF8, ///< System Real Time - Timing Clock - Start = 0xFA, ///< System Real Time - Start - Continue = 0xFB, ///< System Real Time - Continue - Stop = 0xFC, ///< System Real Time - Stop - ActiveSensing = 0xFE, ///< System Real Time - Active Sensing - SystemReset = 0xFF, ///< System Real Time - System Reset -}; - -/*! Enumeration of Thru filter modes */ -enum MidiFilterMode { - Off = 0, ///< Thru disabled (nothing passes through). - Full = 1, ///< Fully enabled Thru (every incoming message is sent back). - SameChannel = 2, ///< Only the messages on the Input Channel will be sent back. - DifferentChannel = 3, ///< All the messages but the ones on the Input Channel will be sent back. -}; - -/*! \brief Enumeration of Control Change command numbers. - See the detailed controllers numbers & description here: - http://www.somascape.org/midi/tech/spec.html#ctrlnums - */ -enum MidiControlChangeNumber { - // High resolution Continuous Controllers MSB (+32 for LSB) ---------------- - BankSelect = 0, - ModulationWheel = 1, - BreathController = 2, - // CC3 undefined - FootController = 4, - PortamentoTime = 5, - DataEntry = 6, - ChannelVolume = 7, - Balance = 8, - // CC9 undefined - Pan = 10, - ExpressionController = 11, - EffectControl1 = 12, - EffectControl2 = 13, - // CC14 undefined - // CC15 undefined - GeneralPurposeController1 = 16, - GeneralPurposeController2 = 17, - GeneralPurposeController3 = 18, - GeneralPurposeController4 = 19, - - // Switches ---------------------------------------------------------------- - Sustain = 64, - Portamento = 65, - Sostenuto = 66, - SoftPedal = 67, - Legato = 68, - Hold = 69, - - // Low resolution continuous controllers ----------------------------------- - SoundController1 = 70, ///< Synth: Sound Variation FX: Exciter On/Off - SoundController2 = 71, ///< Synth: Harmonic Content FX: Compressor On/Off - SoundController3 = 72, ///< Synth: Release Time FX: Distortion On/Off - SoundController4 = 73, ///< Synth: Attack Time FX: EQ On/Off - SoundController5 = 74, ///< Synth: Brightness FX: Expander On/Off - SoundController6 = 75, ///< Synth: Decay Time FX: Reverb On/Off - SoundController7 = 76, ///< Synth: Vibrato Rate FX: Delay On/Off - SoundController8 = 77, ///< Synth: Vibrato Depth FX: Pitch Transpose On/Off - SoundController9 = 78, ///< Synth: Vibrato Delay FX: Flange/Chorus On/Off - SoundController10 = 79, ///< Synth: Undefined FX: Special Effects On/Off - GeneralPurposeController5 = 80, - GeneralPurposeController6 = 81, - GeneralPurposeController7 = 82, - GeneralPurposeController8 = 83, - PortamentoControl = 84, - // CC85 to CC90 undefined - Effects1 = 91, ///< Reverb send level - Effects2 = 92, ///< Tremolo depth - Effects3 = 93, ///< Chorus send level - Effects4 = 94, ///< Celeste depth - Effects5 = 95, ///< Phaser depth - - // Channel Mode messages --------------------------------------------------- - AllSoundOff = 120, - ResetAllControllers = 121, - LocalControl = 122, - AllNotesOff = 123, - OmniModeOff = 124, - OmniModeOn = 125, - MonoModeOn = 126, - PolyModeOn = 127 -}; - -struct midi_cs_if_ac_header_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubType; - uint16_t bcdADC; - uint16_t wTotalLength; - uint8_t bInCollection; - uint8_t baInterfaceNr[]; -} __PACKED; - -#define MIDI_SIZEOF_AC_HEADER_DESC(n) (8 + n) - -struct midi_cs_if_ms_header_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubType; - uint16_t bcdMSC; - uint16_t wTotalLength; -} __PACKED; - -#define MIDI_SIZEOF_MS_HEADER_DESC (7) - -struct midi_cs_if_in_jack_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubType; - uint8_t bJackType; - uint8_t bJackId; - uint8_t iJack; -} __PACKED; - -#define MIDI_SIZEOF_IN_JACK_DESC (6) - -struct midi_cs_if_out_jack_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubType; - uint8_t bJackType; - uint8_t bJackId; - uint8_t bNrInputPins; - uint8_t baSourceId; - uint8_t baSourcePin; - uint8_t iJack; -} __PACKED; - -#define MIDI_SIZEOF_OUT_JACK_DESC (9) - -struct midi_cs_ep_ms_general_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubType; - uint8_t bNumEmbMIDIJack; - uint8_t baAssocJackID[]; -} __PACKED; - -#define MIDI_SIZEOF_MS_GENERAL_DESC(n) (4 + n) - -// clang-format off -#define MIDI_IN_JACK_DESCRIPTOR_INIT(bJackType, bJackID) \ - 0x06, \ - 0x24, \ - MIDI_MIDI_IN_JACK_DESCRIPTOR_SUBTYPE, \ - bJackType, \ - bJackID, \ - 0x00 - -#define MIDI_OUT_JACK_DESCRIPTOR_INIT(bJackType, bJackID, baSourceID) \ - 0x09, \ - 0x24, \ - MIDI_MIDI_OUT_JACK_DESCRIPTOR_SUBTYPE, \ - bJackType, \ - bJackID, \ - 0x01, \ - baSourceID, \ - 0x01, \ - 0x00 - -#define MIDI_JACK_DESCRIPTOR_INIT(bJackFirstID) \ - MIDI_IN_JACK_DESCRIPTOR_INIT(MIDI_JACK_TYPE_EMBEDDED, bJackFirstID), \ - MIDI_IN_JACK_DESCRIPTOR_INIT(MIDI_JACK_TYPE_EXTERNAL, (bJackFirstID + 1)), \ - MIDI_OUT_JACK_DESCRIPTOR_INIT(MIDI_JACK_TYPE_EMBEDDED, (bJackFirstID + 2), (bJackFirstID + 1)), \ - MIDI_OUT_JACK_DESCRIPTOR_INIT(MIDI_JACK_TYPE_EXTERNAL, (bJackFirstID + 3), (bJackFirstID)) - -#define MIDI_SIZEOF_JACK_DESC (6 + 6 + 9 + 9) - -// clang-format on - -#endif /* USB_MIDI_H */ diff --git a/third-party/cherryusb/class/msc/usb_msc.h b/third-party/cherryusb/class/msc/usb_msc.h deleted file mode 100644 index 1e7634a049ea6939c2af9eb22f6eeb90dd0dedce..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/msc/usb_msc.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_MSC_H -#define USB_MSC_H - -/* MSC Subclass Codes */ -#define MSC_SUBCLASS_RBC 0x01 /* Reduced block commands (e.g., flash devices) */ -#define MSC_SUBCLASS_SFF8020I_MMC2 0x02 /* SFF-8020i/MMC-2 (ATAPI) (e.g., C/DVD) */ -#define MSC_SUBCLASS_QIC157 0x03 /* QIC-157 (e.g., tape device) */ -#define MSC_SUBCLASS_UFI 0x04 /* e.g. floppy device */ -#define MSC_SUBCLASS_SFF8070I 0x05 /* SFF-8070i (e.g. floppy disk) */ -#define MSC_SUBCLASS_SCSI 0x06 /* SCSI transparent */ - -/* MSC Protocol Codes */ -#define MSC_PROTOCOL_CBI_INT 0x00 /* CBI transport with command completion interrupt */ -#define MSC_PROTOCOL_CBI_NOINT 0x01 /* CBI transport without command completion interrupt */ -#define MSC_PROTOCOL_BULK_ONLY 0x50 /* Bulk only transport */ - -/* MSC Request Codes */ -#define MSC_REQUEST_RESET 0xFF -#define MSC_REQUEST_GET_MAX_LUN 0xFE - -/** MSC Command Block Wrapper (CBW) Signature */ -#define MSC_CBW_Signature 0x43425355 -/** Bulk-only Command Status Wrapper (CSW) Signature */ -#define MSC_CSW_Signature 0x53425355 - -/** MSC Command Block Status Values */ -#define CSW_STATUS_CMD_PASSED 0x00 -#define CSW_STATUS_CMD_FAILED 0x01 -#define CSW_STATUS_PHASE_ERROR 0x02 - -#define MSC_MAX_CDB_LEN (16) /* Max length of SCSI Command Data Block */ - -/** MSC Bulk-Only Command Block Wrapper (CBW) */ -struct CBW { - uint32_t dSignature; /* 'USBC' = 0x43425355 */ - uint32_t dTag; /* Depends on command id */ - uint32_t dDataLength; /* Number of bytes that host expects to transfer */ - uint8_t bmFlags; /* Bit 7: Direction=IN (other obsolete or reserved) */ - uint8_t bLUN; /* LUN (normally 0) */ - uint8_t bCBLength; /* len of cdb[] */ - uint8_t CB[MSC_MAX_CDB_LEN]; /* Command Data Block */ -} __PACKED; - -#define USB_SIZEOF_MSC_CBW 31 - -/** MSC Bulk-Only Command Status Wrapper (CSW) */ -struct CSW { - uint32_t dSignature; /* 'USBS' = 0x53425355 */ - uint32_t dTag; /* Same tag as original command */ - uint32_t dDataResidue; /* Amount not transferred */ - uint8_t bStatus; /* Status of transfer */ -} __PACKED; - -#define USB_SIZEOF_MSC_CSW 13 - -/*Length of template descriptor: 23 bytes*/ -#define MSC_DESCRIPTOR_LEN (9 + 7 + 7) -// clang-format off -#ifndef CONFIG_USB_HS -#define MSC_DESCRIPTOR_INIT(bFirstInterface, out_ep, in_ep,str_idx) \ - /* Interface */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - bFirstInterface, /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x02, /* bNumEndpoints */ \ - USB_DEVICE_CLASS_MASS_STORAGE, /* bInterfaceClass */ \ - MSC_SUBCLASS_SCSI, /* bInterfaceSubClass */ \ - MSC_PROTOCOL_BULK_ONLY, /* bInterfaceProtocol */ \ - str_idx, /* iInterface */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - out_ep, /* bEndpointAddress */ \ - 0x02, /* bmAttributes */ \ - 0x40, 0x00, /* wMaxPacketSize */ \ - 0x00, /* bInterval */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - in_ep, /* bEndpointAddress */ \ - 0x02, /* bmAttributes */ \ - 0x40, 0x00, /* wMaxPacketSize */ \ - 0x00 /* bInterval */ -#else -#define MSC_DESCRIPTOR_INIT(bFirstInterface, out_ep, in_ep,str_idx) \ - /* Interface */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - bFirstInterface, /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x02, /* bNumEndpoints */ \ - USB_DEVICE_CLASS_MASS_STORAGE, /* bInterfaceClass */ \ - MSC_SUBCLASS_SCSI, /* bInterfaceSubClass */ \ - MSC_PROTOCOL_BULK_ONLY, /* bInterfaceProtocol */ \ - str_idx, /* iInterface */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - out_ep, /* bEndpointAddress */ \ - 0x02, /* bmAttributes */ \ - 0x00, 0x02, /* wMaxPacketSize */ \ - 0x00, /* bInterval */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - in_ep, /* bEndpointAddress */ \ - 0x02, /* bmAttributes */ \ - 0x00, 0x02, /* wMaxPacketSize */ \ - 0x00 /* bInterval */ -#endif -// clang-format on - -#endif /* USB_MSC_H */ diff --git a/third-party/cherryusb/class/msc/usb_scsi.h b/third-party/cherryusb/class/msc/usb_scsi.h deleted file mode 100644 index 7eeb50a72ca1f3a7fd5b8458d40d8188a0648c79..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/msc/usb_scsi.h +++ /dev/null @@ -1,972 +0,0 @@ -/* - * Apache NuttX - * Copyright 2020 The Apache Software Foundation - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef __INCLUDE_NUTTX_SCSI_H -#define __INCLUDE_NUTTX_SCSI_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* SCSI commands ************************************************************/ - -#define SCSI_CMD_TESTUNITREADY 0x00 -#define SCSI_CMD_REZEROUNIT 0x01 -#define SCSI_CMD_REQUESTSENSE 0x03 -#define SCSI_CMD_FORMAT_UNIT 0x04 -#define SCSI_CMD_REASSIGNBLOCKS 0x07 -#define SCSI_CMD_READ6 0x08 -#define SCSI_CMD_WRITE6 0x0a -#define SCSI_CMD_SEEK6 0x0b -#define SCSI_CMD_SPACE6 0x11 -#define SCSI_CMD_INQUIRY 0x12 -#define SCSI_CMD_MODESELECT6 0x15 -#define SCSI_CMD_RESERVE6 0x16 -#define SCSI_CMD_RELEASE6 0x17 -#define SCSI_CMD_COPY 0x18 -#define SCSI_CMD_MODESENSE6 0x1a -#define SCSI_CMD_STARTSTOPUNIT 0x1b -#define SCSI_CMD_RECEIVEDIAGNOSTICRESULTS 0x1c -#define SCSI_CMD_SENDDIAGNOSTIC 0x1d -#define SCSI_CMD_PREVENTMEDIAREMOVAL 0x1e -#define SCSI_CMD_READFORMATCAPACITIES 0x23 -#define SCSI_CMD_READCAPACITY10 0x25 -#define SCSI_CMD_READ10 0x28 -#define SCSI_CMD_WRITE10 0x2a -#define SCSI_CMD_SEEK10 0x2b -#define SCSI_CMD_WRITEANDVERIFY 0x2e -#define SCSI_CMD_VERIFY10 0x2f -#define SCSI_CMD_SEARCHDATAHIGH 0x30 -#define SCSI_CMD_SEARCHDATAEQUAL 0x31 -#define SCSI_CMD_SEARCHDATALOW 0x32 -#define SCSI_CMD_SETLIMITS10 0x33 -#define SCSI_CMD_PREFETCH10 0x34 -#define SCSI_CMD_SYNCHCACHE10 0x35 -#define SCSI_CMD_LOCKCACHE 0x36 -#define SCSI_CMD_READDEFECTDATA10 0x37 -#define SCSI_CMD_COMPARE 0x39 -#define SCSI_CMD_COPYANDVERIFY 0x3a -#define SCSI_CMD_WRITEBUFFER 0x3b -#define SCSI_CMD_READBUFFER 0x3c -#define SCSI_CMD_READLONG10 0x3e -#define SCSI_CMD_WRITELONG10 0x3f -#define SCSI_CMD_CHANGEDEFINITION 0x40 -#define SCSI_CMD_WRITESAME10 0x41 -#define SCSI_CMD_LOGSELECT 0x4c -#define SCSI_CMD_LOGSENSE 0x4d -#define SCSI_CMD_XDWRITE10 0x50 -#define SCSI_CMD_XPWRITE10 0x51 -#define SCSI_CMD_XDREAD10 0x52 -#define SCSI_CMD_MODESELECT10 0x55 -#define SCSI_CMD_RESERVE10 0x56 -#define SCSI_CMD_RELEASE10 0x57 -#define SCSI_CMD_MODESENSE10 0x5a -#define SCSI_CMD_PERSISTENTRESERVEIN 0x5e -#define SCSI_CMD_PERSISTENTRESERVEOUT 0x5f -#define SCSI_CMD_32 0x7f -#define SCSI_CMD_XDWRITEEXTENDED 0x80 -#define SCSI_CMD_REBUILD 0x82 -#define SCSI_CMD_REGENERATE 0x82 -#define SCSI_CMD_EXTENDEDCOPY 0x83 -#define SCSI_CMD_COPYRESULTS 0x84 -#define SCSI_CMD_ACCESSCONTROLIN 0x86 -#define SCSI_CMD_ACCESSCONTROLOUT 0x87 -#define SCSI_CMD_READ16 0x88 -#define SCSI_CMD_WRITE16 0x8a -#define SCSI_CMD_READATTRIBUTE 0x8c -#define SCSI_CMD_WRITEATTRIBUTE 0x8d -#define SCSI_CMD_WRITEANDVERIFY16 0x8e -#define SCSI_CMD_PREFETCH16 0x90 -#define SCSI_CMD_SYNCHCACHE16 0x91 -#define SCSI_CMD_LOCKUNLOCKACACHE 0x92 -#define SCSI_CMD_WRITESAME16 0x93 -#define SCSI_CMD_READCAPACITY16 0x9e -#define SCSI_CMD_READLONG16 0x9e -#define SCSI_CMD_WRITELONG106 0x9f -#define SCSI_CMD_REPORTLUNS 0xa0 -#define SCSI_CMD_MAINTENANCEIN 0xa3 -#define SCSI_CMD_MAINTENANCEOUT 0xa4 -#define SCSI_CMD_MOVEMEDIUM 0xa5 -#define SCSI_CMD_MOVEMEDIUMATTACHED 0xa7 -#define SCSI_CMD_READ12 0xa8 -#define SCSI_CMD_WRITE12 0xaa -#define SCSI_CMD_READMEDIASERIALNUMBER 0xab -#define SCSI_CMD_WRITEANDVERIFY12 0xae -#define SCSI_CMD_VERIFY12 0xaf -#define SCSI_CMD_SETLIMITS12 0xb3 -#define SCSI_CMD_READELEMENTSTATUS 0xb4 -#define SCSI_CMD_READDEFECTDATA12 0xb7 -#define SCSI_CMD_REDUNDANCYGROUPIN 0xba -#define SCSI_CMD_REDUNDANCYGROUPOUT 0xbb -#define SCSI_CMD_SPAREIN 0xbc -#define SCSI_CMD_SPAREOUT 0xbd -#define SCSI_CMD_VOLUMESETIN 0xbe -#define SCSI_CMD_VOLUMESETOUT 0xbf - -/* Common SCSI KCQ values (sense Key/additional sense Code/ASC Qualifier) *** - * - * 0xnn0386 Write Fault Data Corruption - * 0xnn0500 Illegal request - * 0xnn0600 Unit attention - * 0xnn0700 Data protect - * 0xnn0800 LUN communication failure - * 0xnn0801 LUN communication timeout - * 0xnn0802 LUN communication parity error - * 0xnn0803 LUN communication CRC error - * 0xnn0900 vendor specific sense key - * 0xnn0901 servo fault - * 0xnn0904 head select fault - * 0xnn0a00 error log overflow - * 0xnn0b00 aborted command - * 0xnn0c00 write error - * 0xnn0c02 write error - auto-realloc failed - * 0xnn0e00 data miscompare - * 0xnn1200 address mark not founf for ID field - * 0xnn1400 logical block not found - * 0xnn1500 random positioning error - * 0xnn1501 mechanical positioning error - * 0xnn1502 positioning error detected by read of medium - * 0xnn2700 write protected - * 0xnn2900 POR or bus reset occurred - * 0xnn3101 format failed - * 0xnn3191 format corrupted - * 0xnn3201 defect list update error - * 0xnn3202 no spares available - * 0xnn3501 unspecified enclosure services failure - * 0xnn3700 parameter rounded - * 0xnn3d00 invalid bits in identify message - * 0xnn3e00 LUN not self-configured yet - * 0xnn4001 DRAM parity error - * 0xnn4002 DRAM parity error - * 0xnn4200 power-on or self-test failure - * 0xnn4c00 LUN failed self-configuration - * 0xnn5c00 RPL status change - * 0xnn5c01 spindles synchronized - * 0xnn5c02 spindles not synchronized - * 0xnn6500 voltage fault - * 0xnn8000 general firmware error - */ - -/* No sense KCQ values */ - -#define SCSI_KCQ_NOSENSE 0x000000 /* No error */ -#define SCSI_KCQ_PFATHRESHOLDREACHED 0x005c00 /* No sense - PFA threshold reached */ - -/* Soft error KCQ values */ - -#define SCSI_KCQSE_RWENOINDEX 0x010100 /* Recovered Write error - no index */ -#define SCSI_KCQSE_RECOVEREDNOSEEKCOMPLETION 0x010200 /* Recovered no seek completion */ -#define SCSI_KCQSE_RWEWRITEFAULT 0x010300 /* Recovered Write error - write fault */ -#define SCSI_KCQSE_TRACKFOLLOWINGERROR 0x010900 /* Track following error */ -#define SCSI_KCQSE_TEMPERATUREWARNING 0x010b01 /* Temperature warning */ -#define SCSI_KCQSE_RWEWARREALLOCATED 0x010c01 /* Recovered Write error with auto-realloc - reallocated */ -#define SCSI_KCQSE_RWERECOMMENDREASSIGN 0x010c03 /* Recovered Write error - recommend reassign */ -#define SCSI_KCQSE_RDWOEUSINGPREVLBI 0x011201 /* Recovered data without ECC using prev logical block ID */ -#define SCSI_KCQSE_RDWEUSINGPREVLBI 0x011202 /* Recovered data with ECC using prev logical block ID */ -#define SCSI_KCQSE_RECOVEREDRECORDNOTFOUND 0x011401 /* Recovered Record Not Found */ -#define SCSI_KCQSE_RWEDSME 0x011600 /* Recovered Write error - Data Sync Mark Error */ -#define SCSI_KCQSE_RWEDSEDATAREWRITTEN 0x011601 /* Recovered Write error - Data Sync Error - data rewritten */ -#define SCSI_KCQSE_RWEDSERECOMMENDREWRITE 0x011602 /* Recovered Write error - Data Sync Error - recommend rewrite */ -#define SCSI_KCQSE_RWEDSEDATAAUTOREALLOCATED 0x011603 /* Recovered Write error - Data Sync Error - data auto-reallocated */ -#define SCSI_KCQSE_RWEDSERECOMMENDREASSIGNMENT 0x011604 /* Recovered Write error - Data Sync Error - recommend reassignment */ -#define SCSI_KCQSE_RDWNECORRECTIONAPPLIED 0x011700 /* Recovered data with no error correction applied */ -#define SCSI_KCQSE_RREWITHRETRIES 0x011701 /* Recovered Read error - with retries */ -#define SCSI_KCQSE_RDUSINGPOSITIVEOFFSET 0x011702 /* Recovered data using positive offset */ -#define SCSI_KCQSE_RDUSINGNEGATIVEOFFSET 0x011703 /* Recovered data using negative offset */ -#define SCSI_KCQSE_RDUSINGPREVIOUSLBI 0x011705 /* Recovered data using previous logical block ID */ -#define SCSI_KCQSE_RREWOEAUTOREALLOCATED 0x011706 /* Recovered Read error - without ECC, auto reallocated */ -#define SCSI_KCQSE_RREWOERECOMMENDREASSIGN 0x011707 /* Recovered Read error - without ECC, recommend reassign */ -#define SCSI_KCQSE_RREWOERECOMMENDREWRITE 0x011708 /* Recovered Read error - without ECC, recommend rewrite */ -#define SCSI_KCQSE_RREWOEDATAREWRITTEN 0x011709 /* Recovered Read error - without ECC, data rewritten */ -#define SCSI_KCQSE_RREWE 0x011800 /* Recovered Read error - with ECC */ -#define SCSI_KCQSE_RDWEANDRETRIES 0x011801 /* Recovered data with ECC and retries */ -#define SCSI_KCQSE_RREWEAUTOREALLOCATED 0x011802 /* Recovered Read error - with ECC, auto reallocated */ -#define SCSI_KCQSE_RREWERECOMMENDREASSIGN 0x011805 /* Recovered Read error - with ECC, recommend reassign */ -#define SCSI_KCQSE_RDUSINGECCANDOFFSETS 0x011806 /* Recovered data using ECC and offsets */ -#define SCSI_KCQSE_RREWEDATAREWRITTEN 0x011807 /* Recovered Read error - with ECC, data rewritten */ -#define SCSI_KCQSE_DLNOTFOUND 0x011c00 /* Defect List not found */ -#define SCSI_KCQSE_PRIMARYDLNOTFOUND 0x011c01 /* Primary defect list not found */ -#define SCSI_KCQSE_GROWNDLNOTFOUND 0x011c02 /* Grown defect list not found */ -#define SCSI_KCQSE_PARTIALDLTRANSFERRED 0x011f00 /* Partial defect list transferred */ -#define SCSI_KCQSE_INTERNALTARGETFAILURE 0x014400 /* Internal target failure */ -#define SCSI_KCQSE_PFATHRESHOLDREACHED 0x015d00 /* PFA threshold reached */ -#define SCSI_KCQSE_PFATESTWARNING 0x015dff /* PFA test warning */ -#define SCSI_KCQSE_INTERNALLOGICFAILURE 0x018100 /* Internal logic failure */ - -/* Not Ready / Diagnostic Failure KCQ values */ - -#define SCSI_KCQNR_CAUSENOTREPORTABLE 0x020400 /* Not Ready - Cause not reportable. */ -#define SCSI_KCQNR_BECOMINGREADY 0x020401 /* Not Ready - becoming ready */ -#define SCSI_KCQNR_NEEDINITIALIZECOMMAND 0x020402 /* Not Ready - need initialize command (start unit) */ -#define SCSI_KCQNR_MANUALINTERVENTIONREQUIRED 0x020403 /* Not Ready - manual intervention required */ -#define SCSI_KCQNR_FORMATINPROGRESS 0x020404 /* Not Ready - format in progress */ -#define SCSI_KCQNR_SELFTESTINPROGRESS 0x020409 /* Not Ready - self-test in progress */ -#define SCSI_KCQNR_MEDIUMFORMATCORRUPTED 0x023100 /* Not Ready - medium format corrupted */ -#define SCSI_KCQNR_FORMATCOMMANDFAILED 0x023101 /* Not Ready - format command failed */ -#define SCSI_KCQNR_ESUNAVAILABLE 0x023502 /* Not Ready - enclosure services unavailable */ -#define SCSI_KCQNR_MEDIANOTPRESENT 0x023a00 /* Not Ready - media not present */ -#define SCSI_KCQDF_BRINGUPFAILORDEGRADEDMODE 0x024080 /* Diagnostic Failure - bring-up fail or degraded mode */ -#define SCSI_KCQDF_HARDDISKCONTROLLER 0x024081 /* Diagnostic Failure - Hard Disk Controller */ -#define SCSI_KCQDF_RAMMICROCODENOTLOADED 0x024085 /* Diagnostic Failure - RAM microcode not loaded */ -#define SCSI_KCQDF_RROCALIBRATION 0x024090 /* Diagnostic Failure - RRO Calibration */ -#define SCSI_KCQDF_CHANNELCALIBRATION 0x024091 /* Diagnostic Failure - Channel Calibration */ -#define SCSI_KCQDF_HEADLOAD 0x024092 /* Diagnostic Failure - Head Load */ -#define SCSI_KCQDF_WRITEAE 0x024093 /* Diagnostic Failure - Write AE */ -#define SCSI_KCQDF_12VOVERCURRENT 0x024094 /* Diagnostic Failure - 12V over current */ -#define SCSI_KCQDF_OTHERSPINDLEFAILURE 0x024095 /* Diagnostic Failure - Other spindle failure */ -#define SCSI_KCQDF_SELFRESET 0x0240b0 /* Diagnostic Failure - self-reset */ -#define SCSI_KCQDF_CONFIGNOTLOADED 0x024c00 /* Diagnostic Failure - config not loaded */ - -/* Medium error KCQ values */ - -#define SCSI_KCQME_WRITEFAULT 0x030300 /* Medium Error - write fault */ -#define SCSI_KCQME_WRITEFAULTAUTOREALLOCFAILED 0x030c02 /* Medium Error - write error - auto-realloc failed */ -#define SCSI_KCQME_WRITERTLIMITEXCEEDED 0x030cbb /* Medium Error - write recovery time limit exceeded */ -#define SCSI_KCQME_IDCRCERROR 0x031000 /* Medium Error - ID CRC error */ -#define SCSI_KCQME_UNRRE1 0x031100 /* Medium Error - unrecovered read error */ -#define SCSI_KCQME_READRETRIESEXHAUSTED 0x031101 /* Medium Error - read retries exhausted */ -#define SCSI_KCQME_ERRORTOOLONGTOCORRECT 0x031102 /* Medium Error - error too long to correct */ -#define SCSI_KCQME_UREAUTOREALLOCFAILED 0x031104 /* Medium Error - unrecovered read error - auto re-alloc failed */ -#define SCSI_KCQME_URERECOMMENDREASSIGN 0x03110b /* Medium Error - unrecovered read error - recommend reassign */ -#define SCSI_KCQME_READRTLIMITEXCEEDED 0x0311ff /* Medium Error - read recovery time limit exceeded */ -#define SCSI_KCQME_RECORDNOTFOUND 0x031401 /* Medium Error - record not found */ -#define SCSI_KCQME_DSME 0x031600 /* Medium Error - Data Sync Mark error */ -#define SCSI_KCQME_DSERECOMMENDREASSIGN 0x031604 /* Medium Error - Data Sync Error - recommend reassign */ -#define SCSI_KCQME_DLE 0x031900 /* Medium Error - defect list error */ -#define SCSI_KCQME_DLNOTAVAILABLE 0x031901 /* Medium Error - defect list not available */ -#define SCSI_KCQME_DLEINPRIMARYLIST 0x031902 /* Medium Error - defect list error in primary list */ -#define SCSI_KCQME_DLEINGROWNLIST 0x031903 /* Medium Error - defect list error in grown list */ -#define SCSI_KCQME_FEWERTHAN50PCTDLCOPIES 0x03190e /* Medium Error - fewer than 50% defect list copies */ -#define SCSI_KCQME_MEDIUMFORMATCORRUPTED 0x033100 /* Medium Error - medium format corrupted */ -#define SCSI_KCQME_FORMATCOMMANDFAILED 0x033101 /* Medium Error - format command failed */ -#define SCSI_KCQME_DATAAUTOREALLOCATED 0x038000 /* Medium Error - data auto-reallocated */ - -/* Hardware Error KCQ values */ - -#define SCSI_KCQHE_NOINDEXORSECTOR 0x040100 /* Hardware Error - no index or sector */ -#define SCSI_KCQHE_NOSEEKCOMPLETE 0x040200 /* Hardware Error - no seek complete */ -#define SCSI_KCQHE_WRITEFAULT 0x040300 /* Hardware Error - write fault */ -#define SCSI_KCQHE_COMMUNICATIONFAILURE 0x040800 /* Hardware Error - communication failure */ -#define SCSI_KCQHE_TRACKFOLLOWINGERROR 0x040900 /* Hardware Error - track following error */ -#define SCSI_KCQHE_UREINRESERVEDAREA 0x041100 /* Hardware Error - unrecovered read error in reserved area */ -#define SCSI_KCQHE_DSMEINRESERVEDAREA 0x041600 /* Hardware Error - Data Sync Mark error in reserved area */ -#define SCSI_KCQHE_DLE 0x041900 /* Hardware Error - defect list error */ -#define SCSI_KCQHE_DLEINPRIMARYLIST 0x041902 /* Hardware Error - defect list error in Primary List */ -#define SCSI_KCQHE_DLEINGROWNLIST 0x041903 /* Hardware Error - defect list error in Grown List */ -#define SCSI_KCQHE_REASSIGNFAILED 0x043100 /* Hardware Error - reassign failed */ -#define SCSI_KCQHE_NODEFECTSPAREAVAILABLE 0x043200 /* Hardware Error - no defect spare available */ -#define SCSI_KCQHE_UNSUPPORTEDENCLOSUREFUNCTION 0x043501 /* Hardware Error - unsupported enclosure function */ -#define SCSI_KCQHE_ESUNAVAILABLE 0x043502 /* Hardware Error - enclosure services unavailable */ -#define SCSI_KCQHE_ESTRANSFERFAILURE 0x043503 /* Hardware Error - enclosure services transfer failure */ -#define SCSI_KCQHE_ESREFUSED 0x043504 /* Hardware Error - enclosure services refused */ -#define SCSI_KCQHE_SELFTESTFAILED 0x043e03 /* Hardware Error - self-test failed */ -#define SCSI_KCQHE_UNABLETOUPDATESELFTEST 0x043e04 /* Hardware Error - unable to update self-test */ -#define SCSI_KCQHE_DMDIAGNOSTICFAIL 0x044080 /* Hardware Error - Degrade Mode. Diagnostic Fail */ -#define SCSI_KCQHE_DMHWERROR 0x044081 /* Hardware Error - Degrade Mode. H/W Error */ -#define SCSI_KCQHE_DMRAMMICROCODENOTLOADED 0x044085 /* Hardware Error - Degrade Mode. RAM microcode not loaded */ -#define SCSI_KCQHE_SEEKTESTFAILURE 0x044090 /* Hardware Error - seek test failure */ -#define SCSI_KCQHE_READWRITETESTFAILURE 0x0440a0 /* Hardware Error - read/write test failure */ -#define SCSI_KCQHE_DEVICESELFRESET 0x0440b0 /* Hardware Error - device self-reset */ -#define SCSI_KCQHE_COMPONENTMISMATCH 0x0440d0 /* Hardware Error - component mismatch */ -#define SCSI_KCQHE_INTERNALTARGETFAILURE 0x044400 /* Hardware Error - internal target failure */ -#define SCSI_KCQHE_INTERNALLOGICERROR 0x048100 /* Hardware Error - internal logic error */ -#define SCSI_KCQHE_COMMANDTIMEOUT 0x048200 /* Hardware Error - command timeout */ - -/* Illegal Request KCQ values */ - -#define SCSI_KCQIR_PARMLISTLENGTHERROR 0x051a00 /* Illegal Request - parm list length error */ -#define SCSI_KCQIR_INVALIDCOMMAND 0x052000 /* Illegal Request - invalid/unsupported command code */ -#define SCSI_KCQIR_LBAOUTOFRANGE 0x052100 /* Illegal Request - LBA out of range */ -#define SCSI_KCQIR_INVALIDFIELDINCBA 0x052400 /* Illegal Request - invalid field in CDB (Command Descriptor Block) */ -#define SCSI_KCQIR_INVALIDLUN 0x052500 /* Illegal Request - invalid LUN */ -#define SCSI_KCQIR_INVALIDFIELDSINPARMLIST 0x052600 /* Illegal Request - invalid fields in parm list */ -#define SCSI_KCQIR_PARAMETERNOTSUPPORTED 0x052601 /* Illegal Request - parameter not supported */ -#define SCSI_KCQIR_INVALIDPARMVALUE 0x052602 /* Illegal Request - invalid parm value */ -#define SCSI_KCQIR_IFPTHRESHOLDPARAMETER 0x052603 /* Illegal Request - invalid field parameter - threshold parameter */ -#define SCSI_KCQIR_INVALIDRELEASEOFPR 0x052604 /* Illegal Request - invalid release of persistent reservation */ -#define SCSI_KCQIR_IFPTMSFIRMWARETAG 0x052697 /* Illegal Request - invalid field parameter - TMS firmware tag */ -#define SCSI_KCQIR_IFPCHECKSUM 0x052698 /* Illegal Request - invalid field parameter - check sum */ -#define SCSI_KCQIR_IFPFIRMWARETAG 0x052699 /* Illegal Request - invalid field parameter - firmware tag */ -#define SCSI_KCQIR_COMMANDSEQUENCEERROR 0x052c00 /* Illegal Request - command sequence error */ -#define SCSI_KCQIR_UNSUPPORTEDENCLOSUREFUNCTION 0x053501 /* Illegal Request - unsupported enclosure function */ -#define SCSI_KCQIR_SAVINGPARMSNOTSUPPORTED 0x053900 /* Illegal Request - Saving parameters not supported */ -#define SCSI_KCQIR_INVALIDMESSAGE 0x054900 /* Illegal Request - invalid message */ -#define SCSI_KCQIR_MEDIALOADOREJECTFAILED 0x055300 /* Illegal Request - media load or eject failed */ -#define SCSI_KCQIR_UNLOADTAPEFAILURE 0x055301 /* Illegal Request - unload tape failure */ -#define SCSI_KCQIR_MEDIUMREMOVALPREVENTED 0x055302 /* Illegal Request - medium removal prevented */ -#define SCSI_KCQIR_SYSTEMRESOURCEFAILURE 0x055500 /* Illegal Request - system resource failure */ -#define SCSI_KCQIR_SYSTEMBUFFERFULL 0x055501 /* Illegal Request - system buffer full */ -#define SCSI_KCQIR_INSUFFICIENTRR 0x055504 /* Illegal Request - Insufficient Registration Resources */ - -/* Unit Attention KCQ values */ - -#define SCSI_KCQUA_NOTREADYTOTRANSITION 0x062800 /* Unit Attention - not-ready to ready transition (format complete) */ -#define SCSI_KCQUA_DEVICERESETOCCURRED 0x062900 /* Unit Attention - POR or device reset occurred */ -#define SCSI_KCQUA_POROCCURRED 0x062901 /* Unit Attention - POR occurred */ -#define SCSI_KCQUA_SCSIBUSRESETOCCURRED 0x062902 /* Unit Attention - SCSI bus reset occurred */ -#define SCSI_KCQUA_TARGETRESETOCCURRED 0x062903 /* Unit Attention - TARGET RESET occurred */ -#define SCSI_KCQUA_SELFINITIATEDRESETOCCURRED 0x062904 /* Unit Attention - self-initiated-reset occurred */ -#define SCSI_KCQUA_TRANSCEIVERMODECHANGETOSE 0x062905 /* Unit Attention - transceiver mode change to SE */ -#define SCSI_KCQUA_TRANSCEIVERMODECHANGETOLVD 0x062906 /* Unit Attention - transceiver mode change to LVD */ -#define SCSI_KCQUA_PARAMETERSCHANGED 0x062a00 /* Unit Attention - parameters changed */ -#define SCSI_KCQUA_MODEPARAMETERSCHANGED 0x062a01 /* Unit Attention - mode parameters changed */ -#define SCSI_KCQUA_LOGSELECTPARMSCHANGED 0x062a02 /* Unit Attention - log select parms changed */ -#define SCSI_KCQUA_RESERVATIONSPREEMPTED 0x062a03 /* Unit Attention - Reservations pre-empted */ -#define SCSI_KCQUA_RESERVATIONSRELEASED 0x062a04 /* Unit Attention - Reservations released */ -#define SCSI_KCQUA_REGISTRATIONSPREEMPTED 0x062a05 /* Unit Attention - Registrations pre-empted */ -#define SCSI_KCQUA_COMMANDSCLEARED 0x062f00 /* Unit Attention - commands cleared by another initiator */ -#define SCSI_KCQUA_OPERATINGCONDITIONSCHANGED 0x063f00 /* Unit Attention - target operating conditions have changed */ -#define SCSI_KCQUA_MICROCODECHANGED 0x063f01 /* Unit Attention - microcode changed */ -#define SCSI_KCQUA_CHANGEDOPERATINGDEFINITION 0x063f02 /* Unit Attention - changed operating definition */ -#define SCSI_KCQUA_INQUIRYPARAMETERSCHANGED 0x063f03 /* Unit Attention - inquiry parameters changed */ -#define SCSI_KCQUA_DEVICEIDENTIFIERCHANGED 0x063f05 /* Unit Attention - device identifier changed */ -#define SCSI_KCQUA_INVALIDAPMPARAMETERS 0x063f90 /* Unit Attention - invalid APM parameters */ -#define SCSI_KCQUA_WORLDWIDENAMEMISMATCH 0x063f91 /* Unit Attention - world-wide name mismatch */ -#define SCSI_KCQUA_PFATHRESHOLDREACHED 0x065d00 /* Unit Attention - PFA threshold reached */ -#define SCSI_KCQUA_PFATHRESHOLDEXCEEDED 0x065dff /* Unit Attention - PFA threshold exceeded */ - -/* Write Protect KCQ values */ - -#define SCSI_KCQWP_COMMANDNOTALLOWED 0x072700 /* Write Protect - command not allowed */ - -/* Aborted Command KCQ values */ - -#define SCSI_KCQAC_NOADDITIONALSENSECODE 0x0b0000 /* Aborted Command - no additional sense code */ -#define SCSI_KCQAC_SYNCDATATRANSFERERROR 0x0b1b00 /* Aborted Command - sync data transfer error (extra ACK) */ -#define SCSI_KCQAC_UNSUPPORTEDLUN 0x0b2500 /* Aborted Command - unsupported LUN */ -#define SCSI_KCQAC_ECHOBUFFEROVERWRITTEN 0x0b3f0f /* Aborted Command - echo buffer overwritten */ -#define SCSI_KCQAC_MESSAGEREJECTERROR 0x0b4300 /* Aborted Command - message reject error */ -#define SCSI_KCQAC_INTERNALTARGETFAILURE 0x0b4400 /* Aborted Command - internal target failure */ -#define SCSI_KCQAC_SELECTIONFAILURE 0x0b4500 /* Aborted Command - Selection/Reselection failure */ -#define SCSI_KCQAC_SCSIPARITYERROR 0x0b4700 /* Aborted Command - SCSI parity error */ -#define SCSI_KCQAC_INITIATORDETECTEDERRORECEIVED 0x0b4800 /* Aborted Command - initiator-detected error message received */ -#define SCSI_KCQAC_ILLEGALMESSAGE 0x0b4900 /* Aborted Command - inappropriate/illegal message */ -#define SCSI_KCQAC_DATAPHASEERROR 0x0b4b00 /* Aborted Command - data phase error */ -#define SCSI_KCQAC_OVERLAPPEDCOMMANDSATTEMPTED 0x0b4e00 /* Aborted Command - overlapped commands attempted */ -#define SCSI_KCQAC_LOOPINITIALIZATION 0x0b4f00 /* Aborted Command - due to loop initialization */ - -/* Other KCQ values: */ - -#define SCSO_KCQOTHER_MISCOMPARE 0x0e1d00 /* Miscompare - during verify byte check operation */ - -/* SSCSI Status Codes *******************************************************/ - -#define SCSI_STATUS_OK 0x00 /* OK */ -#define SCSI_STATUS_CHECKCONDITION 0x02 /* Check condition */ -#define SCSI_STATUS_CONDITIONMET 0x04 /* Condition met */ -#define SCSI_STATUS_BUSY 0x08 /* Busy */ -#define SCSI_STATUS_INTERMEDIATE 0x10 /* Intermediate */ -#define SCSI_STATUS_DATAOVERUNDERRUN 0x12 /* Data Under/Over Run? */ -#define SCSI_STATUS_INTERMEDIATECONDITIONMET 0x14 /* Intermediate - Condition met */ -#define SCSI_STATUS_RESERVATIONCONFLICT 0x18 /* Reservation conflict */ -#define SCSI_STATUS_COMMANDTERMINATED 0x22 /* Command terminated */ -#define SCSI_STATUS_QUEUEFULL 0x28 /* Queue (task set) full */ -#define SCSI_STATUS_ACAACTIVE 0x30 /* ACA active */ -#define SCSI_STATUS_TASKABORTED 0x40 /* Task aborted */ - -/* Definitions for selected SCSI commands ***********************************/ - -/* Inquiry */ - -#define SCSICMD_INQUIRYFLAGS_EVPD 0x01 /* Bit 0: EVPD */ - /* Bits 5-7: Peripheral Qualifier */ -#define SCSIRESP_INQUIRYPQ_CONNECTED 0x00 /* 000: Device is connected */ -#define SCSIRESP_INQUIRYPQ_NOTCONNECTED 0x20 /* 001: Device is NOT connected */ -#define SCSIRESP_INQUIRYPQ_NOTCAPABLE 0x60 /* 011: LUN not supported */ - /* Bits 0-4: Peripheral Device */ -#define SCSIRESP_INQUIRYPD_DIRECTACCESS 0x00 /* Direct-access block device */ -#define SCSIRESP_INQUIRYPD_SEQUENTIALACCESS 0x01 /* Sequential-access block device */ -#define SCSIRESP_INQUIRYPD_PRINTER 0x02 /* Printer device */ -#define SCSIRESP_INQUIRYPD_PROCESSOR 0x03 /* Processor device */ -#define SCSIRESP_INQUIRYPD_WRONCE 0x04 /* Write once device */ -#define SCSIRESP_INQUIRYPD_CDDVD 0x05 /* CD/DVD device */ -#define SCSIRESP_INQUIRYPD_SCANNER 0x06 /* Scanner device (obsolete) */ -#define SCSIRESP_INQUIRYPD_OPTICAL 0x07 /* Optical memory device */ -#define SCSIRESP_INQUIRYPD_MEDIUMCHANGER 0x08 /* Medium changer device (Jukebox) */ -#define SCSIRESP_INQUIRYPD_COMMUNICATIONS 0x09 /* Communications device (obsolete) */ -#define SCSIRESP_INQUIRYPD_STORAGEARRAY 0x0c /* Storage array controller device */ -#define SCSIRESP_INQUIRYPD_ENCLOSURESERVICES 0x0d /* Enclosure services device */ -#define SCSIRESP_INQUIRYPD_RBC 0x0e /* Simplified direct-access device */ -#define SCSIRESP_INQUIRYPD_OCRW 0x0f /* Optical reader/writer device */ -#define SCSIRESP_INQUIRYPD_BCC 0x10 /* Bridge controller commands */ -#define SCSIRESP_INQUIRYPD_OSD 0x11 /* Object-based storage device */ -#define SCSIRESP_INQUIRYPD_ADC 0x12 /* Automation/drive interface */ -#define SCSIRESP_INQUIRYPD_WKLU 0x1e /* Well-known logical unit */ -#define SCSIRESP_INQUIRYPD_UNKNOWN 0x1f /* Direct-access block device */ - -#define SCSIRESP_INQUIRYFLAGS1_RMB 0x80 /* Bit 7: RMB */ -#define SCSIRESP_INQUIRYFLAGS2_NORMACA 0x20 /* Bit 5: NormACA */ -#define SCSIRESP_INQUIRYFLAGS2_HISUP 0x10 /* Bit 4: HiSup */ -#define SCSIRESP_INQUIRYFLAGS2_FMTMASK 0x0f /* Bits 0-3: Response data format */ - -#define SCSIRESP_INQUIRYFLAGS3_SCCS 0x80 /* Bit 8: SCCS */ -#define SCSIRESP_INQUIRYFLAGS3_ACC 0x40 /* Bit 7: ACC */ -#define SCSIRESP_INQUIRYFLAGS3_TPGSMASK 0x30 /* Bits 4-5: TPGS */ -#define SCSIRESP_INQUIRYFLAGS3_3PC 0x08 /* Bit 3: 3PC */ -#define SCSIRESP_INQUIRYFLAGS3_PROTECT 0x01 /* Bit 0: Protect */ - -#define SCSIRESP_INQUIRYFLAGS4_BQUE 0x80 /* Bit 7: BQue */ -#define SCSIRESP_INQUIRYFLAGS4_ENCSERV 0x40 /* Bit 6: EncServ */ -#define SCSIRESP_INQUIRYFLAGS4_VS 0x20 /* Bit 5: VS */ -#define SCSIRESP_INQUIRYFLAGS4_MULTIP 0x10 /* Bit 4: MultIP */ -#define SCSIRESP_INQUIRYFLAGS4_MCHNGR 0x08 /* Bit 3: MChngr */ -#define SCSIRESP_INQUIRYFLAGS4_ADDR16 0x01 /* Bit 0: Addr16 */ - -#define SCSIRESP_INQUIRYFLAGS5_WBUS16 0x20 /* Bit 5: WBus16 */ -#define SCSIRESP_INQUIRYFLAGS5_SYNC 0x10 /* Bit 4: SYNC */ -#define SCSIRESP_INQUIRYFLAGS5_LINKED 0x08 /* Bit 3: LINKED */ -#define SCSIRESP_INQUIRYFLAGS5_CMDQUEUE 0x02 /* Bit 1: CmdQue */ -#define SCSIRESP_INQUIRYFLAGS5_VS 0x01 /* Bit 0: VS */ - -#define SCSIRESP_INQUIRYFLAGS6_CLOCKINGMASK 0xc0 /* Bits 2-3: Clocking */ -#define SCSIRESP_INQUIRYFLAGS6_QAS 0x02 /* Bit 1: QAS */ -#define SCSIRESP_INQUIRYFLAGS6_IUS 0x01 /* Bit 0: IUS */ - -/* Sense data */ - -/* Sense data response codes */ - -#define SCSIRESP_SENSEDATA_CURRENTFIXED 0x70 /* Byte 1 is always the response code */ -#define SCSIRESP_SENSEDATA_DEFERREDFIXED 0x71 -#define SCSIRESP_SENSEDATA_CURRENTDESC 0x72 -#define SCSIRESP_SENSEDATA_DEFERREDDESC 0x73 - -#define SCSIRESP_SENSEDATA_RESPVALID 0x80 - -/* Fixed sense data flags */ - -#define SCSIRESP_SENSEDATA_FILEMARK 0x80 /* Bit 7: FileMark */ -#define SCSIRESP_SENSEDATA_EOM 0x40 /* Bit 6: EOM */ -#define SCSIRESP_SENSEDATA_ILI 0x20 /* Bit 5: ILI */ -#define SCSIRESP_SENSEDATA_SENSEKEYMASK 0x0f /* Bits 0-3: Sense key */ -#define SCSIRESP_SENSEDATA_NOSENSE 0x00 /* Nothing to be reported */ -#define SCSIRESP_SENSEDATA_RECOVEREDERROR 0x01 /* Successful after recovery action */ -#define SCSIRESP_SENSEDATA_NOTREADY 0x02 /* Logical unit is not accessible */ -#define SCSIRESP_SENSEDATA_MEDIUMERROR 0x03 /* Error possibly caused by flaw in medium */ -#define SCSIRESP_SENSEDATA_HARDWAREERROR 0x04 /* Non-recoverable hardware error */ -#define SCSIRESP_SENSEDATA_ILLEGALREQUEST 0x05 /* Error in received request */ -#define SCSIRESP_SENSEDATA_UNITATTENTION 0x06 /* Unit attention condition */ -#define SCSIRESP_SENSEDATA_DATAPROTECT 0x07 /* Action failed, medium protected */ -#define SCSIRESP_SENSEDATA_BLANKCHECK 0x08 /* Encountered blank media */ -#define SCSIRESP_SENSEDATA_VENDORSPECIFIC 0x09 /* Vendor specific condition */ -#define SCSIRESP_SENSEDATA_ABORTEDCOMMAND 0x0b /* Command was aborted */ - -#define SCSIRESP_SENSEDATA_KEYVALID 0x80 /* Sense-specific data valid */ - -/* Mode Select 6 */ - -#define SCSICMD_MODESELECT6_PF 0x10 /* Bit 4: PF */ -#define SCSICMD_MODESELECT6_SP 0x01 /* Bit 0: SP */ - -/* Mode Sense 6 */ - -#define SCSICMD_MODESENSE6_DBD 0x08 /* Bit 3: PF */ - -#define SCSICMD_MODESENSE_PCMASK 0xc0 /* Bits 6-7: Page control (PC) */ -#define SCSICMD_MODESENSE_PCCURRENT 0x00 /* Current values */ -#define SCSICMD_MODESENSE_PCCHANGEABLE 0x40 /* Changeable values */ -#define SCSICMD_MODESENSE_PCDEFAULT 0x80 /* Default values */ -#define SCSICMD_MODESENSE_PCSAVED 0xc0 /* Saved values */ -#define SCSICMD_MODESENSE_PGCODEMASK 0x3f /* Bits 0-5: Page code */ - -#define SCSICMD_MODESENSE6_PCDEFAULT 0x80 /* Default values */ - /* Direct-access device page codes */ -#define SCSIRESP_MODESENSE_PGCCODE_VENDOR 0x00 /* Vendor-specific */ -#define SCSIRESP_MODESENSE_PGCCODE_RWERROR 0x01 /* Read/Write error recovery mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_RECONNECT 0x02 /* Disconnect-reconnect mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_FORMATDEV 0x03 /* Format device mode page (obsolete) */ -#define SCSIRESP_MODESENSE_PGCCODE_RIGID 0x04 /* Rigid disk geometry mode page (obsolete) */ -#define SCSIRESP_MODESENSE_PGCCODE_FLEXIBLE 0x05 /* Flexible disk geometry mode page (obsolete) */ -#define SCSIRESP_MODESENSE_PGCCODE_VERIFY 0x07 /* Verify error recovery mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_CACHING 0x08 /* Caching mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_CONTROL 0x0a /* Control mode page (0x0a/0x00) */ -#define SCSIRESP_MODESENSE_PGCCODE_CONTROLEXT 0x0a /* Control extension mode page (0x0a/0x01) */ -#define SCSIRESP_MODESENSE_PGCCODE_MEDIUMTYPES 0x0b /* Medum types supported mode page (obsolete) */ -#define SCSIRESP_MODESENSE_PGCCODE_NP 0x0c /* Notch and partition mode page (obsolete) */ -#define SCSIRESP_MODESENSE_PGCCODE_XOR 0x10 /* XOR control mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_ES 0x14 /* Enclosure services mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_PSLUN 0x18 /* Protocol-specific LUN mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_PSPORT 0x19 /* Protocol-specific port mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_POWER 0x1a /* Power condition mode page */ -#define SCSIRESP_MODESENSE_PGCCODE_IE 0x1c /* Informational exceptions control mode page (0x1c/0x00) */ -#define SCSIRESP_MODESENSE_PGCCODE_BC 0x1c /* Background control mode page (0x1c/0x01) */ -#define SCSIRESP_MODESENSE_PGCCODE_RETURNALL 0x3f /* Return all mode pages */ - /* Direct-access caching mode page */ -#define SCSIRESP_CACHINGMODEPG_PS 0x80 /* Byte 0, Bit 7: PS */ -#define SCSIRESP_CACHINGMODEPG_SPF 0x60 /* Byte 0, Bit 6: SPF */ -#define SCSIRESP_CACHINGMODEPG_IC 0x80 /* Byte 2, Bit 7: IC */ -#define SCSIRESP_CACHINGMODEPG_ABPF 0x40 /* Byte 2, Bit 6: ABPF */ -#define SCSIRESP_CACHINGMODEPG_CAP 0x20 /* Byte 2, Bit 5: CAP */ -#define SCSIRESP_CACHINGMODEPG_DISC 0x10 /* Byte 2, Bit 4: DISC */ -#define SCSIRESP_CACHINGMODEPG_SIZE 0x08 /* Byte 2, Bit 3: SIZE */ -#define SCSIRESP_CACHINGMODEPG_WCE 0x04 /* Byte 2, Bit 2: Write cache enable (WCE) */ -#define SCSIRESP_CACHINGMODEPG_MF 0x02 /* Byte 2, Bit 1: MF */ -#define SCSIRESP_CACHINGMODEPG_RCD 0x01 /* Byte 2, Bit 0: Read cache disable (RCD) */ - -#define SCSIRESP_MODEPARMHDR_DAPARM_WP 0x80 /* Bit 7: WP (Direct-access block devices only) */ -#define SCSIRESP_MODEPARMHDR_DAPARM_DBPFUA 0x10 /* Bit 4: DBOFUA (Direct-access block devices only) */ - -#define SCSIRESP_PAGEFMT_PS 0x80 /* Bit 7: PS */ -#define SCSIRESP_PAGEFMT_SPF 0x40 /* Bit 6: SPF */ -#define SCSIRESP_PAGEFMT_PGCODEMASK 0x3f /* Bits 0-5: Page code */ - -/* Prevent / Allow Medium Removal */ - -#define SCSICMD_PREVENTMEDIUMREMOVAL_TRANSPORT 0x01 /* Removal prohibited from data transport */ -#define SCSICMD_PREVENTMEDIUMREMOVAL_MCHANGER 0x02 /* Removal prohibited from medium changer */ - -/* Read format capacities */ - -#define SCIRESP_RDFMTCAPACITIES_UNFORMATED 0x01 /* Unformatted media */ -#define SCIRESP_RDFMTCAPACITIES_FORMATED 0x02 /* Formatted media */ -#define SCIRESP_RDFMTCAPACITIES_NOMEDIA 0x03 /* No media */ - -/* Read 6 */ - -#define SCSICMD_READ6_MSLBAMASK 0x1f - -/* Write 6 */ - -#define SCSICMD_WRITE6_MSLBAMASK 0x1f - -/* Mode Select 10 */ - -#define SCSICMD_MODESELECT10_PF 0x10 /* Bit 4: PF */ -#define SCSICMD_MODESELECT10_SP 0x01 /* Bit 0: SP */ - -/* Mode Sense 10 */ - -#define SCSICMD_MODESENSE10_LLBAA 0x10 /* Bit 4: LLBAA */ -#define SCSICMD_MODESENSE10_DBD 0x08 /* Bit 3: PF */ - -/* Read 10 */ - -#define SCSICMD_READ10FLAGS_RDPROTECTMASK 0xe0 -#define SCSICMD_READ10FLAGS_DPO 0x10 /* Disable Page Out */ -#define SCSICMD_READ10FLAGS_FUA 0x08 -#define SCSICMD_READ10FLAGS_FUANV 0x02 - -/* Write 10 */ - -#define SCSICMD_WRITE10FLAGS_WRPROTECTMASK 0xe0 -#define SCSICMD_WRITE10FLAGS_DPO 0x10 /* Disable Page Out */ -#define SCSICMD_WRITE10FLAGS_FUA 0x08 -#define SCSICMD_WRITE10FLAGS_FUANV 0x02 - -/* Verify 10 */ - -#define SCSICMD_VERIFY10_VRPROTECTMASK 0xe0 /* Byte 1: Bits 5-7: VRPROTECT */ -#define SCSICMD_VERIFY10_DPO 0x10 /* Byte 1: Bit 4: Disable Page Out (DPO) */ -#define SCSICMD_VERIFY10_BYTCHK 0x02 /* Byte 1: Bit 2: BytChk */ - -/* Read 12 */ - -#define SCSICMD_READ12FLAGS_RDPROTECTMASK 0xe0 -#define SCSICMD_READ12FLAGS_DPO 0x10 /* Disable Page Out */ -#define SCSICMD_READ12FLAGS_FUA 0x08 -#define SCSICMD_READ12FLAGS_FUANV 0x02 - -/* Write 12 */ - -#define SCSICMD_WRITE12FLAGS_WRPROTECTMASK 0xe0 -#define SCSICMD_WRITE12FLAGS_DPO 0x10 /* Disable Page Out */ -#define SCSICMD_WRITE12FLAGS_FUA 0x08 -#define SCSICMD_WRITE12FLAGS_FUANV 0x02 - -/* Verify 12 */ - -#define SCSICMD_VERIFY12_VRPROTECTMASK 0xe0 /* Byte 1: Bits 5-7: VRPROTECT */ -#define SCSICMD_VERIFY12_DPO 0x10 /* Byte 1: Bit 4: Disable Page Out (DPO) */ -#define SCSICMD_VERIFY12_BYTCHK 0x02 /* Byte 1: Bit 2: BytChk */ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* Format structures for selected SCSI primary commands */ - -#define SCSICMD_TESTUNITREADY_SIZEOF 6 - -struct scsicmd_requestsense_s -{ - uint8_t opcode; /* 0: 0x03 */ - uint8_t flags; /* 1: See SCSICMD_REQUESTSENSE_FLAGS_* */ - uint8_t reserved[2]; /* 2-3: Reserved */ - uint8_t alloclen; /* 4: Allocation length */ - uint8_t control; /* 5: Control */ -}; -#define SCSICMD_REQUESTSENSE_SIZEOF 6 -#define SCSICMD_REQUESTSENSE_MSSIZEOF 12 /* MS-Windows REQUEST SENSE with cbw->cdblen == 12 */ - -struct scsiresp_fixedsensedata_s -{ - uint8_t code; /* 0: Response code See SCSIRESP_SENSEDATA_*FIXED defns */ - uint8_t obsolete; /* 1: */ - uint8_t flags; /* 2: See SCSIRESP_SENSEDATA_* definitions */ - uint8_t info[4]; /* 3-6: Information */ - uint8_t len; /* 7: Additional length */ - uint8_t cmdinfo[4]; /* 8-11: Command-specific information */ - uint8_t code2; /* 12: Additional sense code */ - uint8_t qual2; /* 13: Additional sense code qualifier */ - uint8_t fru; /* 14: Field replacement unit code */ - uint8_t key[3]; /* 15-17: Sense key specific */ - /* 18-: Additional bytes may follow */ -}; -#define SCSIRESP_FIXEDSENSEDATA_SIZEOF 18 /* Minimum size */ - -struct scscicmd_inquiry_s -{ - uint8_t opcode; /* 0: 0x12 */ - uint8_t flags; /* 1: See SCSICMD_INQUIRY_FLAGS_* */ - uint8_t pagecode; /* 2: Page code */ - uint8_t alloclen[2]; /* 3-4: Allocation length */ - uint8_t control; /* 5: Control */ -}; -#define SCSICMD_INQUIRY_SIZEOF 6 - -struct scsiresp_inquiry_s -{ - /* Mandatory */ - - uint8_t qualtype; /* 0: Bits 5-7: Peripheral qualifier; Bits 0-4: Peripheral device type */ - uint8_t flags1; /* 1: See SCSIRESP_INQUIRY_FLAGS1_* */ - uint8_t version; /* 2: Version */ - uint8_t flags2; /* 3: See SCSIRESP_INQUIRY_FLAGS2_* */ - uint8_t len; /* 4: Additional length */ - uint8_t flags3; /* 5: See SCSIRESP_INQUIRY_FLAGS3_* */ - uint8_t flags4; /* 6: See SCSIRESP_INQUIRY_FLAGS4_* */ - uint8_t flags5; /* 7: See SCSIRESP_INQUIRY_FLAGS5_* */ - uint8_t vendorid[8]; /* 8-15: T10 Vendor Identification */ - uint8_t productid[16]; /* 16-31: Product Identification */ - uint8_t revision[4]; /* 32-35: Product Revision Level */ - - /* Optional */ - - uint8_t vendor[20]; /* 36-55: Vendor specific */ - uint8_t flags6; /* 56: See SCSIRESP_INQUIRY_FLAGS6_* */ - uint8_t reserved1; /* 57: Reserved */ - uint8_t version1[2]; /* 58-59: Version Descriptor 1 */ - uint8_t version2[2]; /* 60-61: Version Descriptor 2 */ - uint8_t version3[2]; /* 62-63: Version Descriptor 3 */ - uint8_t version4[2]; /* 64-65: Version Descriptor 4 */ - uint8_t version5[2]; /* 66-67: Version Descriptor 5 */ - uint8_t version6[2]; /* 68-69: Version Descriptor 6 */ - uint8_t version7[2]; /* 70-71: Version Descriptor 7 */ - uint8_t version8[2]; /* 72-73: Version Descriptor 8 */ - uint8_t reserved2[22]; /* 74-95: Reserved */ - /* 96-: Vendor-specific parameters may follow */ -}; -#define SCSIRESP_INQUIRY_SIZEOF 36 /* Minimum size */ - -struct scsicmd_modeselect6_s -{ - uint8_t opcode; /* 0x15 */ - uint8_t flags; /* 1: See SCSICMD_MODESELECT6_FLAGS_* */ - uint8_t reserved[2]; /* 2-3: Reserved */ - uint8_t plen; /* 4: Parameter list length */ - uint8_t control; /* 5: Control */ -}; -#define SCSICMD_MODESELECT6_SIZEOF 6 - -struct scsicmd_modesense6_s -{ - uint8_t opcode; /* 0x1a */ - uint8_t flags; /* 1: See SCSICMD_MODESENSE6_FLAGS_* */ - uint8_t pcpgcode; /* 2: Bits 6-7: PC, bits 0-5: page code */ - uint8_t subpgcode; /* 3: subpage code */ - uint8_t alloclen; /* 4: Allocation length */ - uint8_t control; /* 5: Control */ -}; -#define SCSICMD_MODESENSE6_SIZEOF 6 - -struct scsiresp_modeparameterhdr6_s -{ - uint8_t mdlen; /* 0: Mode data length */ - uint8_t type; /* 1: Medium type */ - uint8_t param; /* 2: Device-specific parameter */ - uint8_t bdlen; /* 3: Block descriptor length */ -}; -#define SCSIRESP_MODEPARAMETERHDR6_SIZEOF 4 - -struct scsiresp_blockdesc_s -{ - uint8_t density; /* 0: density code */ - uint8_t nblocks[3]; /* 1-3: Number of blocks */ - uint8_t reserved; /* 4: reserved */ - uint8_t blklen[3]; /* 5-7: Block len */ -}; -#define SCSIRESP_BLOCKDESC_SIZEOF 8 - -struct scsiresp_pageformat_s -{ - uint8_t pgcode; /* 0: See SCSIRESP_PAGEFMT_* definitions */ - uint8_t pglen; /* 1: Page length (n-1) */ - uint8_t parms[1]; /* 2-n: Mode parameters */ -}; - -struct scsiresp_subpageformat_s -{ - uint8_t pgcode; /* 0: See SCSIRESP_PAGEFMT_* definitions */ - uint8_t subpgcode; /* 1: sub-page code */ - uint8_t pglen[2]; /* 2-3: Page length (n-3) */ - uint8_t parms[1]; /* 4-n: Mode parameters */ -}; - -struct scsiresp_cachingmodepage_s -{ - uint8_t pgcode; /* 0: Bit 7: PS; Bit 6: SPF, Bits 0-5: page code == 8 */ - uint8_t len; /* 1: Page length (18) */ - uint8_t flags1; /* 2: See SCSIRESP_CACHINGMODEPG_* definitions */ - uint8_t priority; /* 3: Bits 4-7: Demand read retention priority; Bits 0-3: Write retention priority */ - uint8_t dpflen[2]; /* 4-5: Disable prefetch transfer length */ - uint8_t minpf[2]; /* 6-7: Minimum pre-fetch */ - uint8_t maxpf[2]; /* 8-9: Maximum pre-fetch */ - uint8_t maxpfc[2]; /* 10-11: Maximum pref-fetch ceiling */ - uint8_t flags2; /* 12: See SCSIRESP_CACHINGMODEPG_* definitions */ - uint8_t nsegments; /* 13: Number of cache segments */ - uint8_t segsize[2]; /* 14-15: Cache segment size */ - uint8_t reserved; /* 16: Reserved */ - uint8_t obsolete[3]; /* 17-19: Obsolete */ -}; - -/* Format structures for selected SCSI block commands */ - -struct scsicmd_read6_s -{ - uint8_t opcode; /* 0: 0x08 */ - uint8_t mslba; /* 1: Bits 5-7: reserved; Bits 0-6: MS Logical Block Address (LBA) */ - uint8_t lslba[2]; /* 2-3: LS Logical Block Address (LBA) */ - uint8_t xfrlen; /* 4: Transfer length (in contiguous logical blocks) */ - uint8_t control; /* 5: Control */ -}; -#define SCSICMD_READ6_SIZEOF 6 - -struct scsicmd_write6_s -{ - uint8_t opcode; /* 0: 0x0a */ - uint8_t mslba; /* 1: Bits 5-7: reserved; Bits 0-6: MS Logical Block Address (LBA) */ - uint8_t lslba[2]; /* 2-3: LS Logical Block Address (LBA) */ - uint8_t xfrlen; /* 4: Transfer length (in contiguous logical blocks) */ - uint8_t control; /* 5: Control */ -}; -#define SCSICMD_WRITE6_SIZEOF 6 - -struct scsicmd_startstopunit_s -{ - uint8_t opcode; /* 0: 0x1b */ - uint8_t immed; /* 1: Bits 2-7: Reserved, Bit 0: Immed */ - uint8_t reserved; /* 2: reserved */ - uint8_t pcm; /* 3: Bits 4-7: Reserved, Bits 0-3: Power condition modifier */ - uint8_t pc; /* 4: Bits 4-7: Power condition, Bit 2: NO_FLUSH, Bit 1: LOEJ, Bit 0: START */ - uint8_t control; /* 5: Control */ -}; -#define SCSICMD_STARTSTOPUNIT_SIZEOF 6 - -struct scsicmd_preventmediumremoval_s -{ - uint8_t opcode; /* 0: 0x1e */ - uint8_t reserved[3]; /* 1-3: Reserved */ - uint8_t prevent; /* 4: Bits 2-7: Reserved, Bits 0:1: prevent */ - uint8_t control; /* 5: Control */ -}; -#define SCSICMD_PREVENTMEDIUMREMOVAL_SIZEOF 6 - -struct scsicmd_readformatcapcacities_s -{ - uint8_t opcode; /* 0: 0x23 */ - uint8_t reserved[6]; /* 1-6: Reserved */ - uint8_t alloclen[2]; /* 7-8: Allocation length */ - uint8_t control; /* 9: Control */ -}; -#define SCSICMD_READFORMATCAPACITIES_SIZEOF 10 - -struct scsiresp_readformatcapacities_s -{ - /* Current capacity header */ - - uint8_t reserved[3]; /* 0-2: Reserved */ - uint8_t listlen; /* 3: Capacity list length */ - - /* Current/Maximum Capacity Descriptor (actually a separate structure) */ - - uint8_t nblocks[4]; /* 4-7: Number of blocks */ - uint8_t type; /* 8: Bits 2-7: Reserved, Bits 0-1: Descriptor type */ - uint8_t blocklen[3]; /* 9-11: Block length */ -}; -#define SCSIRESP_READFORMATCAPACITIES_SIZEOF 12 -#define SCSIRESP_CURRCAPACITYDESC_SIZEOF 8 - -struct scsiresp_formattedcapacitydesc_s -{ - uint8_t nblocks[4]; /* 0-3: Number of blocks */ - uint8_t type; /* 4: Bits 2-7: Type, bits 0-1, reserved */ - uint8_t param[3]; /* 5-7: Type dependent parameter */ -}; -#define SCSIRESP_FORMATTEDCAPACITYDESC_SIZEOF 8 - -struct scsicmd_readcapacity10_s -{ - uint8_t opcode; /* 0: 0x25 */ - uint8_t reserved1; /* 1: Bits 1-7: Reserved, Bit 0: Obsolete */ - uint8_t lba[4]; /* 2-5: Logical block address (LBA) */ - uint8_t reserved2[2]; /* 6-7: Reserved */ - uint8_t pmi; /* 8: Bits 1-7 Reserved; Bit 0: PMI */ - uint8_t control; /* 9: Control */ -}; -#define SCSICMD_READCAPACITY10_SIZEOF 10 - -struct scsiresp_readcapacity10_s -{ - uint8_t lba[4]; /* 0-3: Returned logical block address (LBA) */ - uint8_t blklen[4]; /* 4-7: Logical block length (in bytes) */ -}; -#define SCSIRESP_READCAPACITY10_SIZEOF 8 - -struct scsicmd_read10_s -{ - uint8_t opcode; /* 0: 0x28 */ - uint8_t flags; /* 1: See SCSICMD_READ10FLAGS_* */ - uint8_t lba[4]; /* 2-5: Logical Block Address (LBA) */ - uint8_t groupno; /* 6: Bits 5-7: reserved; Bits 0-6: group number */ - uint8_t xfrlen[2]; /* 7-8: Transfer length (in contiguous logical blocks) */ - uint8_t control; /* 9: Control */ -}; -#define SCSICMD_READ10_SIZEOF 10 - -struct scsicmd_write10_s -{ - uint8_t opcode; /* 0: 0x2a */ - uint8_t flags; /* 1: See SCSICMD_WRITE10FLAGS_* */ - uint8_t lba[4]; /* 2-5: Logical Block Address (LBA) */ - uint8_t groupno; /* 6: Bits 5-7: reserved; Bits 0-6: group number */ - uint8_t xfrlen[2]; /* 7-8: Transfer length (in contiguous logical blocks) */ - uint8_t control; /* 9: Control */ -}; -#define SCSICMD_WRITE10_SIZEOF 10 - -struct scsicmd_verify10_s -{ - uint8_t opcode; /* 0: 0x2f */ - uint8_t flags; /* 1: See SCSICMD_VERIFY10_* definitions */ - uint8_t lba[4]; /* 2-5: Logical block address (LBA) */ - uint8_t groupno; /* 6: Bit 7: restricted; Bits 5-6: Reserved, Bits 0-4: Group number */ - uint8_t len[2]; /* 7-8: Verification length (in blocks) */ - uint8_t control; /* 9: Control */ -}; -#define SCSICMD_VERIFY10_SIZEOF 10 - -struct scsicmd_synchronizecache10_s -{ - uint8_t opcode; /* 0: 0x35 */ - uint8_t flags; /* 1: See SCSICMD_SYNCHRONIZECACHE10_* definitions */ - uint8_t lba[4]; /* 2-5: Logical block address (LBA) */ - uint8_t groupno; /* 6: Bit 7: restricted; Bits 5-6: Reserved, Bits 0-4: Group number */ - uint8_t len[2]; /* 7-8: Number of logical blocks */ - uint8_t control; /* 9: Control */ -}; -#define SCSICMD_SYNCHRONIZECACHE10_SIZEOF 10 - -struct scsicmd_modeselect10_s -{ - uint8_t opcode; /* 0: 0x55 */ - uint8_t flags; /* 1: See SCSICMD_MODESELECT10_FLAGS_* */ - uint8_t reserved[5]; /* 2-6: Reserved */ - uint8_t parmlen[2]; /* 7-8: Parameter list length */ - uint8_t control; /* 9: Control */ -}; -#define SCSICMD_MODESELECT10_SIZEOF 10 - -struct scsiresp_modeparameterhdr10_s -{ - uint8_t mdlen[2]; /* 0-1: Mode data length */ - uint8_t type; /* 2: Medium type */ - uint8_t param; /* 3: Device-specific parameter */ - uint8_t reserved[2]; /* 4-5: reserved */ - uint8_t bdlen[2]; /* 6-7: Block descriptor length */ -}; -#define SCSIRESP_MODEPARAMETERHDR10_SIZEOF 8 - -struct scsicmd_modesense10_s -{ - uint8_t opcode; /* O: 0x5a */ - uint8_t flags; /* 1: See SCSICMD_MODESENSE10_FLAGS_* */ - uint8_t pcpgcode; /* 2: Bits 6-7: PC, bits 0-5: page code */ - uint8_t subpgcode; /* 3: subpage code */ - uint8_t reserved[3]; /* 4-6: reserved */ - uint8_t alloclen[2]; /* 7-8: Allocation length */ - uint8_t control; /* 9: Control */ -}; -#define SCSICMD_MODESENSE10_SIZEOF 10 - -struct scsicmd_readcapacity16_s -{ - uint8_t opcode; /* 0: 0x9e */ - uint8_t action; /* 1: Bits 5-7: Reserved, Bits 0-4: Service action */ - uint8_t lba[8]; /* 2-9: Logical block address (LBA) */ - uint8_t len[4]; /* 10-13: Allocation length */ - uint8_t reserved; /* 14: Reserved */ - uint8_t control; /* 15: Control */ -}; -#define SCSICMD_READCAPACITY16_SIZEOF 16 - -struct scsicmd_read12_s -{ - uint8_t opcode; /* 0: 0xa8 */ - uint8_t flags; /* 1: See SCSICMD_READ12FLAGS_* */ - uint8_t lba[4]; /* 2-5: Logical Block Address (LBA) */ - uint8_t xfrlen[4]; /* 6-9: Transfer length (in contiguous logical blocks) */ - uint8_t groupno; /* 10: Bit 7: restricted; Bits 5-6: reserved; Bits 0-6: group number */ - uint8_t control; /* 11: Control */ -}; -#define SCSICMD_READ12_SIZEOF 12 - -struct scsicmd_write12_s -{ - uint8_t opcode; /* 0: 0xaa */ - uint8_t flags; /* 1: See SCSICMD_WRITE12FLAGS_* */ - uint8_t lba[4]; /* 2-5: Logical Block Address (LBA) */ - uint8_t xfrlen[4]; /* 6-9: Transfer length (in contiguous logical blocks) */ - uint8_t groupno; /* 10: Bit 7: restricted; Bits 5-6: reserved; Bits 0-6: group number */ - uint8_t control; /* 11: Control */ -}; -#define SCSICMD_WRITE12_SIZEOF 12 - -struct scsicmd_verify12_s -{ - uint8_t opcode; /* 0: 0xaf */ - uint8_t flags; /* 1: See SCSICMD_VERIFY12_* definitions */ - uint8_t lba[4]; /* 2-5: Logical block address (LBA) */ - uint8_t len[4]; /* 6-9: Verification length */ - uint8_t groupno; /* 10: Bit 7: restricted; Bits 5-6: Reserved, Bits 0-4: Group number */ - uint8_t control; /* 11: Control */ -}; -#define SCSICMD_VERIFY12_SIZEOF 12 - -/**************************************************************************** - * Public Functions Definitions - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_SCSI_H */ diff --git a/third-party/cherryusb/class/msc/usbd_msc.c b/third-party/cherryusb/class/msc/usbd_msc.c deleted file mode 100644 index cf249611b3bcdf6670a78fe6915c39721b4276f4..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/msc/usbd_msc.c +++ /dev/null @@ -1,841 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbd_core.h" -#include "usbd_msc.h" -#include "usb_scsi.h" - -#define MSD_OUT_EP_IDX 0 -#define MSD_IN_EP_IDX 1 - -/* Describe EndPoints configuration */ -static struct usbd_endpoint mass_ep_data[2]; - -/* MSC Bulk-only Stage */ -enum Stage { - MSC_READ_CBW = 0, /* Command Block Wrapper */ - MSC_DATA_OUT = 1, /* Data Out Phase */ - MSC_DATA_IN = 2, /* Data In Phase */ - MSC_SEND_CSW = 3, /* Command Status Wrapper */ - MSC_WAIT_CSW = 4, /* Command Status Wrapper */ -}; - -/* Device data structure */ -USB_NOCACHE_RAM_SECTION struct usbd_msc_cfg_priv { - /* state of the bulk-only state machine */ - enum Stage stage; - USB_MEM_ALIGNX struct CBW cbw; - USB_MEM_ALIGNX struct CSW csw; - - bool readonly; - uint8_t sKey; /* Sense key */ - uint8_t ASC; /* Additional Sense Code */ - uint8_t ASQ; /* Additional Sense Qualifier */ - uint8_t max_lun; - uint32_t start_sector; - uint32_t nsectors; - uint16_t scsi_blk_size; - uint32_t scsi_blk_nbr; - - uint8_t block_buffer[CONFIG_USBDEV_MSC_BLOCK_SIZE]; -} usbd_msc_cfg; - -static void usbd_msc_reset(void) -{ - usbd_msc_cfg.stage = MSC_READ_CBW; - usbd_msc_cfg.readonly = false; -} - -static int msc_storage_class_interface_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - USB_LOG_DBG("MSC Class request: " - "bRequest 0x%02x\r\n", - setup->bRequest); - - switch (setup->bRequest) { - case MSC_REQUEST_RESET: - usbd_msc_reset(); - break; - - case MSC_REQUEST_GET_MAX_LUN: - (*data)[0] = usbd_msc_cfg.max_lun; - *len = 1; - break; - - default: - USB_LOG_WRN("Unhandled MSC Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - - return 0; -} - -void msc_storage_notify_handler(uint8_t event, void *arg) -{ - switch (event) { - case USBD_EVENT_RESET: - usbd_msc_reset(); - break; - case USBD_EVENT_CONFIGURED: - USB_LOG_DBG("Start reading cbw\r\n"); - usbd_ep_start_read(mass_ep_data[MSD_OUT_EP_IDX].ep_addr, (uint8_t *)&usbd_msc_cfg.cbw, USB_SIZEOF_MSC_CBW); - break; - - default: - break; - } -} - -static void usbd_msc_bot_abort(void) -{ - if ((usbd_msc_cfg.cbw.bmFlags == 0) && (usbd_msc_cfg.cbw.dDataLength != 0)) { - usbd_ep_set_stall(mass_ep_data[MSD_OUT_EP_IDX].ep_addr); - } - usbd_ep_set_stall(mass_ep_data[MSD_IN_EP_IDX].ep_addr); - usbd_ep_start_read(mass_ep_data[0].ep_addr, (uint8_t *)&usbd_msc_cfg.cbw, USB_SIZEOF_MSC_CBW); -} - -static void usbd_msc_send_csw(uint8_t CSW_Status) -{ - usbd_msc_cfg.csw.dSignature = MSC_CSW_Signature; - usbd_msc_cfg.csw.bStatus = CSW_Status; - - /* updating the State Machine , so that we wait CSW when this - * transfer is complete, ie when we get a bulk in callback - */ - usbd_msc_cfg.stage = MSC_WAIT_CSW; - - USB_LOG_DBG("Send csw\r\n"); - usbd_ep_start_write(mass_ep_data[MSD_IN_EP_IDX].ep_addr, (uint8_t *)&usbd_msc_cfg.csw, sizeof(struct CSW)); -} - -static void usbd_msc_send_info(uint8_t *buffer, uint8_t size) -{ - size = MIN(size, usbd_msc_cfg.cbw.dDataLength); - - /* updating the State Machine , so that we send CSW when this - * transfer is complete, ie when we get a bulk in callback - */ - usbd_msc_cfg.stage = MSC_SEND_CSW; - - usbd_ep_start_write(mass_ep_data[MSD_IN_EP_IDX].ep_addr, buffer, size); - - usbd_msc_cfg.csw.dDataResidue -= size; - usbd_msc_cfg.csw.bStatus = CSW_STATUS_CMD_PASSED; -} - -static bool SCSI_processWrite(uint32_t nbytes); -static bool SCSI_processRead(void); - -/** -* @brief SCSI_SetSenseData -* Load the last error code in the error list -* @param sKey: Sense Key -* @param ASC: Additional Sense Code -* @retval none - -*/ -static void SCSI_SetSenseData(uint32_t KCQ) -{ - usbd_msc_cfg.sKey = (uint8_t)(KCQ >> 16); - usbd_msc_cfg.ASC = (uint8_t)(KCQ >> 8); - usbd_msc_cfg.ASQ = (uint8_t)(KCQ); -} - -/** - * @brief SCSI Command list - * - */ - -static bool SCSI_testUnitReady(uint8_t **data, uint32_t *len) -{ - if (usbd_msc_cfg.cbw.dDataLength != 0U) { - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - return false; - } - *data = NULL; - *len = 0; - return true; -} - -static bool SCSI_requestSense(uint8_t **data, uint32_t *len) -{ - uint8_t data_len = SCSIRESP_FIXEDSENSEDATA_SIZEOF; - if (usbd_msc_cfg.cbw.dDataLength == 0U) { - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - return false; - } - - if (usbd_msc_cfg.cbw.CB[4] < SCSIRESP_FIXEDSENSEDATA_SIZEOF) { - data_len = usbd_msc_cfg.cbw.CB[4]; - } - - uint8_t request_sense[SCSIRESP_FIXEDSENSEDATA_SIZEOF] = { - 0x70, - 0x00, - 0x00, /* Sense Key */ - 0x00, - 0x00, - 0x00, - 0x00, - SCSIRESP_FIXEDSENSEDATA_SIZEOF - 8, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, /* Additional Sense Code */ - 0x00, /* Additional Sense Request */ - 0x00, - 0x00, - 0x00, - 0x00, - }; - - request_sense[2] = usbd_msc_cfg.sKey; - request_sense[12] = usbd_msc_cfg.ASC; - request_sense[13] = usbd_msc_cfg.ASQ; -#if 0 - request_sense[ 2] = 0x06; /* UNIT ATTENTION */ - request_sense[12] = 0x28; /* Additional Sense Code: Not ready to ready transition */ - request_sense[13] = 0x00; /* Additional Sense Code Qualifier */ -#endif -#if 0 - request_sense[ 2] = 0x02; /* NOT READY */ - request_sense[12] = 0x3A; /* Additional Sense Code: Medium not present */ - request_sense[13] = 0x00; /* Additional Sense Code Qualifier */ -#endif -#if 0 - request_sense[ 2] = 0x05; /* ILLEGAL REQUEST */ - request_sense[12] = 0x20; /* Additional Sense Code: Invalid command */ - request_sense[13] = 0x00; /* Additional Sense Code Qualifier */ -#endif -#if 0 - request_sense[ 2] = 0x00; /* NO SENSE */ - request_sense[12] = 0x00; /* Additional Sense Code: No additional code */ - request_sense[13] = 0x00; /* Additional Sense Code Qualifier */ -#endif - - memcpy(*data, (uint8_t *)request_sense, data_len); - *len = data_len; - return true; -} - -static bool SCSI_inquiry(uint8_t **data, uint32_t *len) -{ - uint8_t data_len = SCSIRESP_INQUIRY_SIZEOF; - - uint8_t inquiry00[6] = { - 0x00, - 0x00, - 0x00, - (0x06 - 4U), - 0x00, - 0x80 - }; - - /* USB Mass storage VPD Page 0x80 Inquiry Data for Unit Serial Number */ - uint8_t inquiry80[8] = { - 0x00, - 0x80, - 0x00, - 0x08, - 0x20, /* Put Product Serial number */ - 0x20, - 0x20, - 0x20 - }; - - uint8_t inquiry[SCSIRESP_INQUIRY_SIZEOF] = { - /* 36 */ - - /* LUN 0 */ - 0x00, - 0x80, - 0x02, - 0x02, - (SCSIRESP_INQUIRY_SIZEOF - 5), - 0x00, - 0x00, - 0x00, - ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* Manufacturer : 8 bytes */ - ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', /* Product : 16 Bytes */ - ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', - ' ', ' ', ' ', ' ' /* Version : 4 Bytes */ - }; - - memcpy(&inquiry[8], CONFIG_USBDEV_MSC_MANUFACTURER_STRING, strlen(CONFIG_USBDEV_MSC_MANUFACTURER_STRING)); - memcpy(&inquiry[16], CONFIG_USBDEV_MSC_PRODUCT_STRING, strlen(CONFIG_USBDEV_MSC_PRODUCT_STRING)); - memcpy(&inquiry[32], CONFIG_USBDEV_MSC_VERSION_STRING, strlen(CONFIG_USBDEV_MSC_VERSION_STRING)); - - if (usbd_msc_cfg.cbw.dDataLength == 0U) { - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - return false; - } - - if ((usbd_msc_cfg.cbw.CB[1] & 0x01U) != 0U) { /* Evpd is set */ - if (usbd_msc_cfg.cbw.CB[2] == 0U) { /* Request for Supported Vital Product Data Pages*/ - data_len = 0x06; - memcpy(*data, (uint8_t *)inquiry00, data_len); - } else if (usbd_msc_cfg.cbw.CB[2] == 0x80U) { /* Request for VPD page 0x80 Unit Serial Number */ - data_len = 0x08; - memcpy(*data, (uint8_t *)inquiry80, data_len); - } else { /* Request Not supported */ - SCSI_SetSenseData(SCSI_KCQIR_INVALIDFIELDINCBA); - return false; - } - } else { - if (usbd_msc_cfg.cbw.CB[4] < SCSIRESP_INQUIRY_SIZEOF) { - data_len = usbd_msc_cfg.cbw.CB[4]; - } - memcpy(*data, (uint8_t *)inquiry, data_len); - } - - *len = data_len; - return true; -} - -static bool SCSI_startStopUnit(uint8_t **data, uint32_t *len) -{ - if (usbd_msc_cfg.cbw.dDataLength != 0U) { - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - return false; - } - - if ((usbd_msc_cfg.cbw.CB[4] & 0x3U) == 0x1U) /* START=1 */ - { - //SCSI_MEDIUM_UNLOCKED; - } else if ((usbd_msc_cfg.cbw.CB[4] & 0x3U) == 0x2U) /* START=0 and LOEJ Load Eject=1 */ - { - //SCSI_MEDIUM_EJECTED; - } else if ((usbd_msc_cfg.cbw.CB[4] & 0x3U) == 0x3U) /* START=1 and LOEJ Load Eject=1 */ - { - //SCSI_MEDIUM_UNLOCKED; - } else { - } - - *data = NULL; - *len = 0; - return true; -} - -static bool SCSI_preventAllowMediaRemoval(uint8_t **data, uint32_t *len) -{ - if (usbd_msc_cfg.cbw.dDataLength != 0U) { - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - return false; - } - if (usbd_msc_cfg.cbw.CB[4] == 0U) { - //SCSI_MEDIUM_UNLOCKED; - } else { - //SCSI_MEDIUM_LOCKED; - } - *data = NULL; - *len = 0; - return true; -} - -static bool SCSI_modeSense6(uint8_t **data, uint32_t *len) -{ - uint8_t data_len = 4; - if (usbd_msc_cfg.cbw.dDataLength == 0U) { - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - return false; - } - if (usbd_msc_cfg.cbw.CB[4] < SCSIRESP_MODEPARAMETERHDR6_SIZEOF) { - data_len = usbd_msc_cfg.cbw.CB[4]; - } - - uint8_t sense6[SCSIRESP_MODEPARAMETERHDR6_SIZEOF] = { 0x03, 0x00, 0x00, 0x00 }; - - if (usbd_msc_cfg.readonly) { - sense6[2] = 0x80; - } - memcpy(*data, (uint8_t *)sense6, data_len); - *len = data_len; - return true; -} - -static bool SCSI_modeSense10(uint8_t **data, uint32_t *len) -{ - uint8_t data_len = 27; - if (usbd_msc_cfg.cbw.dDataLength == 0U) { - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - return false; - } - - if (usbd_msc_cfg.cbw.CB[8] < 27) { - data_len = usbd_msc_cfg.cbw.CB[8]; - } - - uint8_t sense10[27] = { - 0x00, - 0x26, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x08, - 0x12, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00 - }; - - memcpy(*data, (uint8_t *)sense10, data_len); - *len = data_len; - return true; -} - -static bool SCSI_readFormatCapacity(uint8_t **data, uint32_t *len) -{ - if (usbd_msc_cfg.cbw.dDataLength == 0U) { - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - return false; - } - uint8_t format_capacity[SCSIRESP_READFORMATCAPACITIES_SIZEOF] = { - 0x00, - 0x00, - 0x00, - 0x08, /* Capacity List Length */ - (uint8_t)((usbd_msc_cfg.scsi_blk_nbr >> 24) & 0xff), - (uint8_t)((usbd_msc_cfg.scsi_blk_nbr >> 16) & 0xff), - (uint8_t)((usbd_msc_cfg.scsi_blk_nbr >> 8) & 0xff), - (uint8_t)((usbd_msc_cfg.scsi_blk_nbr >> 0) & 0xff), - - 0x02, /* Descriptor Code: Formatted Media */ - 0x00, - (uint8_t)((usbd_msc_cfg.scsi_blk_size >> 8) & 0xff), - (uint8_t)((usbd_msc_cfg.scsi_blk_size >> 0) & 0xff), - }; - - memcpy(*data, (uint8_t *)format_capacity, SCSIRESP_READFORMATCAPACITIES_SIZEOF); - *len = SCSIRESP_READFORMATCAPACITIES_SIZEOF; - return true; -} - -static bool SCSI_readCapacity10(uint8_t **data, uint32_t *len) -{ - if (usbd_msc_cfg.cbw.dDataLength == 0U) { - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - return false; - } - - uint8_t capacity10[SCSIRESP_READCAPACITY10_SIZEOF] = { - (uint8_t)(((usbd_msc_cfg.scsi_blk_nbr - 1) >> 24) & 0xff), - (uint8_t)(((usbd_msc_cfg.scsi_blk_nbr - 1) >> 16) & 0xff), - (uint8_t)(((usbd_msc_cfg.scsi_blk_nbr - 1) >> 8) & 0xff), - (uint8_t)(((usbd_msc_cfg.scsi_blk_nbr - 1) >> 0) & 0xff), - - (uint8_t)((usbd_msc_cfg.scsi_blk_size >> 24) & 0xff), - (uint8_t)((usbd_msc_cfg.scsi_blk_size >> 16) & 0xff), - (uint8_t)((usbd_msc_cfg.scsi_blk_size >> 8) & 0xff), - (uint8_t)((usbd_msc_cfg.scsi_blk_size >> 0) & 0xff), - }; - - memcpy(*data, (uint8_t *)capacity10, SCSIRESP_READCAPACITY10_SIZEOF); - *len = SCSIRESP_READCAPACITY10_SIZEOF; - return true; -} - -static bool SCSI_read10(uint8_t **data, uint32_t *len) -{ - if (((usbd_msc_cfg.cbw.bmFlags & 0x80U) != 0x80U) || (usbd_msc_cfg.cbw.dDataLength == 0U)) { - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - return false; - } - - usbd_msc_cfg.start_sector = GET_BE32(&usbd_msc_cfg.cbw.CB[2]); /* Logical Block Address of First Block */ - USB_LOG_DBG("lba: 0x%04x\r\n", usbd_msc_cfg.start_sector); - - usbd_msc_cfg.nsectors = GET_BE16(&usbd_msc_cfg.cbw.CB[7]); /* Number of Blocks to transfer */ - USB_LOG_DBG("nsectors: 0x%02x\r\n", usbd_msc_cfg.nsectors); - - if ((usbd_msc_cfg.start_sector + usbd_msc_cfg.nsectors) > usbd_msc_cfg.scsi_blk_nbr) { - SCSI_SetSenseData(SCSI_KCQIR_LBAOUTOFRANGE); - USB_LOG_ERR("LBA out of range\r\n"); - return false; - } - - if (usbd_msc_cfg.cbw.dDataLength != (usbd_msc_cfg.nsectors * usbd_msc_cfg.scsi_blk_size)) { - USB_LOG_ERR("scsi_blk_len does not match with dDataLength\r\n"); - return false; - } - usbd_msc_cfg.stage = MSC_DATA_IN; - return SCSI_processRead(); -} - -static bool SCSI_read12(uint8_t **data, uint32_t *len) -{ - if (((usbd_msc_cfg.cbw.bmFlags & 0x80U) != 0x80U) || (usbd_msc_cfg.cbw.dDataLength == 0U)) { - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - return false; - } - - usbd_msc_cfg.start_sector = GET_BE32(&usbd_msc_cfg.cbw.CB[2]); /* Logical Block Address of First Block */ - USB_LOG_DBG("lba: 0x%04x\r\n", usbd_msc_cfg.start_sector); - - usbd_msc_cfg.nsectors = GET_BE32(&usbd_msc_cfg.cbw.CB[6]); /* Number of Blocks to transfer */ - USB_LOG_DBG("nsectors: 0x%02x\r\n", usbd_msc_cfg.nsectors); - - if ((usbd_msc_cfg.start_sector + usbd_msc_cfg.nsectors) > usbd_msc_cfg.scsi_blk_nbr) { - SCSI_SetSenseData(SCSI_KCQIR_LBAOUTOFRANGE); - USB_LOG_ERR("LBA out of range\r\n"); - return false; - } - - if (usbd_msc_cfg.cbw.dDataLength != (usbd_msc_cfg.nsectors * usbd_msc_cfg.scsi_blk_size)) { - USB_LOG_ERR("scsi_blk_len does not match with dDataLength\r\n"); - return false; - } - usbd_msc_cfg.stage = MSC_DATA_IN; - return SCSI_processRead(); -} - -static bool SCSI_write10(uint8_t **data, uint32_t *len) -{ - uint32_t data_len = 0; - if (((usbd_msc_cfg.cbw.bmFlags & 0x80U) != 0x00U) || (usbd_msc_cfg.cbw.dDataLength == 0U)) { - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - return false; - } - - usbd_msc_cfg.start_sector = GET_BE32(&usbd_msc_cfg.cbw.CB[2]); /* Logical Block Address of First Block */ - USB_LOG_DBG("lba: 0x%04x\r\n", usbd_msc_cfg.start_sector); - - usbd_msc_cfg.nsectors = GET_BE16(&usbd_msc_cfg.cbw.CB[7]); /* Number of Blocks to transfer */ - USB_LOG_DBG("nsectors: 0x%02x\r\n", usbd_msc_cfg.nsectors); - - data_len = usbd_msc_cfg.nsectors * usbd_msc_cfg.scsi_blk_size; - if ((usbd_msc_cfg.start_sector + usbd_msc_cfg.nsectors) > usbd_msc_cfg.scsi_blk_nbr) { - USB_LOG_ERR("LBA out of range\r\n"); - return false; - } - - if (usbd_msc_cfg.cbw.dDataLength != data_len) { - return false; - } - usbd_msc_cfg.stage = MSC_DATA_OUT; - data_len = MIN(data_len, CONFIG_USBDEV_MSC_BLOCK_SIZE); - usbd_ep_start_read(mass_ep_data[MSD_OUT_EP_IDX].ep_addr, usbd_msc_cfg.block_buffer, data_len); - return true; -} - -static bool SCSI_write12(uint8_t **data, uint32_t *len) -{ - uint32_t data_len = 0; - if (((usbd_msc_cfg.cbw.bmFlags & 0x80U) != 0x00U) || (usbd_msc_cfg.cbw.dDataLength == 0U)) { - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - return false; - } - - usbd_msc_cfg.start_sector = GET_BE32(&usbd_msc_cfg.cbw.CB[2]); /* Logical Block Address of First Block */ - USB_LOG_DBG("lba: 0x%04x\r\n", usbd_msc_cfg.start_sector); - - usbd_msc_cfg.nsectors = GET_BE32(&usbd_msc_cfg.cbw.CB[6]); /* Number of Blocks to transfer */ - USB_LOG_DBG("nsectors: 0x%02x\r\n", usbd_msc_cfg.nsectors); - - data_len = usbd_msc_cfg.nsectors * usbd_msc_cfg.scsi_blk_size; - if ((usbd_msc_cfg.start_sector + usbd_msc_cfg.nsectors) > usbd_msc_cfg.scsi_blk_nbr) { - USB_LOG_ERR("LBA out of range\r\n"); - return false; - } - - if (usbd_msc_cfg.cbw.dDataLength != data_len) { - return false; - } - usbd_msc_cfg.stage = MSC_DATA_OUT; - data_len = MIN(data_len, CONFIG_USBDEV_MSC_BLOCK_SIZE); - usbd_ep_start_read(mass_ep_data[MSD_OUT_EP_IDX].ep_addr, usbd_msc_cfg.block_buffer, data_len); - return true; -} -/* do not use verify to reduce code size */ -#if 0 -static bool SCSI_verify10(uint8_t **data, uint32_t *len) -{ - /* Logical Block Address of First Block */ - uint32_t lba = 0; - uint32_t blk_num = 0; - - if ((usbd_msc_cfg.cbw.CB[1] & 0x02U) == 0x00U) { - return true; - } - - if (((usbd_msc_cfg.cbw.bmFlags & 0x80U) != 0x00U) || (usbd_msc_cfg.cbw.dDataLength == 0U)) { - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - return false; - } - - if ((usbd_msc_cfg.cbw.CB[1] & 0x02U) == 0x02U) { - SCSI_SetSenseData(SCSI_KCQIR_INVALIDFIELDINCBA); - return false; /* Error, Verify Mode Not supported*/ - } - - lba = GET_BE32(&usbd_msc_cfg.cbw.CB[2]); - USB_LOG_DBG("lba: 0x%x\r\n", lba); - - usbd_msc_cfg.scsi_blk_addr = lba * usbd_msc_cfg.scsi_blk_size; - - /* Number of Blocks to transfer */ - blk_num = GET_BE16(&usbd_msc_cfg.cbw.CB[7]); - - USB_LOG_DBG("num (block) : 0x%x\r\n", blk_num); - usbd_msc_cfg.scsi_blk_len = blk_num * usbd_msc_cfg.scsi_blk_size; - - if ((lba + blk_num) > usbd_msc_cfg.scsi_blk_nbr) { - USB_LOG_ERR("LBA out of range\r\n"); - return false; - } - - if (usbd_msc_cfg.cbw.dDataLength != usbd_msc_cfg.scsi_blk_len) { - return false; - } - - usbd_msc_cfg.stage = MSC_DATA_OUT; - return true; -} -#endif - -static bool SCSI_processRead(void) -{ - uint32_t transfer_len; - - USB_LOG_DBG("read lba:%d\r\n", usbd_msc_cfg.start_sector); - - transfer_len = MIN(usbd_msc_cfg.nsectors * usbd_msc_cfg.scsi_blk_size, CONFIG_USBDEV_MSC_BLOCK_SIZE); - - if (usbd_msc_sector_read(usbd_msc_cfg.start_sector, usbd_msc_cfg.block_buffer, transfer_len) != 0) { - SCSI_SetSenseData(SCSI_KCQHE_UREINRESERVEDAREA); - return false; - } - - usbd_ep_start_write(mass_ep_data[MSD_IN_EP_IDX].ep_addr, usbd_msc_cfg.block_buffer, transfer_len); - - usbd_msc_cfg.start_sector += (transfer_len / usbd_msc_cfg.scsi_blk_size); - usbd_msc_cfg.nsectors -= (transfer_len / usbd_msc_cfg.scsi_blk_size); - usbd_msc_cfg.csw.dDataResidue -= transfer_len; - - if (usbd_msc_cfg.nsectors == 0) { - usbd_msc_cfg.stage = MSC_SEND_CSW; - } - - return true; -} - -static bool SCSI_processWrite(uint32_t nbytes) -{ - uint32_t data_len = 0; - USB_LOG_DBG("write lba:%d\r\n", usbd_msc_cfg.start_sector); - - if (usbd_msc_sector_write(usbd_msc_cfg.start_sector, usbd_msc_cfg.block_buffer, nbytes) != 0) { - SCSI_SetSenseData(SCSI_KCQHE_WRITEFAULT); - return false; - } - - usbd_msc_cfg.start_sector += (nbytes / usbd_msc_cfg.scsi_blk_size); - usbd_msc_cfg.nsectors -= (nbytes / usbd_msc_cfg.scsi_blk_size); - usbd_msc_cfg.csw.dDataResidue -= nbytes; - - if (usbd_msc_cfg.nsectors == 0) { - usbd_msc_send_csw(CSW_STATUS_CMD_PASSED); - } else { - data_len = MIN(usbd_msc_cfg.nsectors * usbd_msc_cfg.scsi_blk_size, CONFIG_USBDEV_MSC_BLOCK_SIZE); - usbd_ep_start_read(mass_ep_data[MSD_OUT_EP_IDX].ep_addr, usbd_msc_cfg.block_buffer, data_len); - } - - return true; -} - -static bool SCSI_CBWDecode(uint32_t nbytes) -{ - uint8_t *buf2send = usbd_msc_cfg.block_buffer; - uint32_t len2send = 0; - bool ret = false; - - if (nbytes != sizeof(struct CBW)) { - USB_LOG_ERR("size != sizeof(cbw)\r\n"); - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - return false; - } - - usbd_msc_cfg.csw.dTag = usbd_msc_cfg.cbw.dTag; - usbd_msc_cfg.csw.dDataResidue = usbd_msc_cfg.cbw.dDataLength; - - if ((usbd_msc_cfg.cbw.bLUN > 1) || (usbd_msc_cfg.cbw.dSignature != MSC_CBW_Signature) || (usbd_msc_cfg.cbw.bCBLength < 1) || (usbd_msc_cfg.cbw.bCBLength > 16)) { - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - return false; - } else { - USB_LOG_DBG("Decode CB:0x%02x\r\n", usbd_msc_cfg.cbw.CB[0]); - switch (usbd_msc_cfg.cbw.CB[0]) { - case SCSI_CMD_TESTUNITREADY: - ret = SCSI_testUnitReady(&buf2send, &len2send); - break; - case SCSI_CMD_REQUESTSENSE: - ret = SCSI_requestSense(&buf2send, &len2send); - break; - case SCSI_CMD_INQUIRY: - ret = SCSI_inquiry(&buf2send, &len2send); - break; - case SCSI_CMD_STARTSTOPUNIT: - ret = SCSI_startStopUnit(&buf2send, &len2send); - break; - case SCSI_CMD_PREVENTMEDIAREMOVAL: - ret = SCSI_preventAllowMediaRemoval(&buf2send, &len2send); - break; - case SCSI_CMD_MODESENSE6: - ret = SCSI_modeSense6(&buf2send, &len2send); - break; - case SCSI_CMD_MODESENSE10: - ret = SCSI_modeSense10(&buf2send, &len2send); - break; - case SCSI_CMD_READFORMATCAPACITIES: - ret = SCSI_readFormatCapacity(&buf2send, &len2send); - break; - case SCSI_CMD_READCAPACITY10: - ret = SCSI_readCapacity10(&buf2send, &len2send); - break; - case SCSI_CMD_READ10: - ret = SCSI_read10(NULL, 0); - break; - case SCSI_CMD_READ12: - ret = SCSI_read12(NULL, 0); - break; - case SCSI_CMD_WRITE10: - ret = SCSI_write10(NULL, 0); - break; - case SCSI_CMD_WRITE12: - ret = SCSI_write12(NULL, 0); - break; - case SCSI_CMD_VERIFY10: - //ret = SCSI_verify10(NULL, 0); - ret = false; - break; - - default: - SCSI_SetSenseData(SCSI_KCQIR_INVALIDCOMMAND); - USB_LOG_WRN("unsupported cmd:0x%02x\r\n", usbd_msc_cfg.cbw.CB[0]); - ret = false; - break; - } - } - if (ret) { - if (usbd_msc_cfg.stage == MSC_READ_CBW) { - if (len2send) { - USB_LOG_DBG("Send info len:%d\r\n", len2send); - usbd_msc_send_info(buf2send, len2send); - } else { - usbd_msc_send_csw(CSW_STATUS_CMD_PASSED); - } - } - } - return ret; -} - -void mass_storage_bulk_out(uint8_t ep, uint32_t nbytes) -{ - switch (usbd_msc_cfg.stage) { - case MSC_READ_CBW: - if (SCSI_CBWDecode(nbytes) == false) { - USB_LOG_ERR("Command:0x%02x decode err\r\n", usbd_msc_cfg.cbw.CB[0]); - usbd_msc_bot_abort(); - return; - } - break; - case MSC_DATA_OUT: - switch (usbd_msc_cfg.cbw.CB[0]) { - case SCSI_CMD_WRITE10: - case SCSI_CMD_WRITE12: - if (SCSI_processWrite(nbytes) == false) { - usbd_msc_send_csw(CSW_STATUS_CMD_FAILED); /* send fail status to host,and the host will retry*/ - } - break; - default: - break; - } - break; - default: - break; - } -} - -void mass_storage_bulk_in(uint8_t ep, uint32_t nbytes) -{ - switch (usbd_msc_cfg.stage) { - case MSC_DATA_IN: - switch (usbd_msc_cfg.cbw.CB[0]) { - case SCSI_CMD_READ10: - case SCSI_CMD_READ12: - if (SCSI_processRead() == false) { - usbd_msc_send_csw(CSW_STATUS_CMD_FAILED); /* send fail status to host,and the host will retry*/ - return; - } - break; - default: - break; - } - break; - /*the device has to send a CSW*/ - case MSC_SEND_CSW: - usbd_msc_send_csw(CSW_STATUS_CMD_PASSED); - break; - - /*the host has received the CSW*/ - case MSC_WAIT_CSW: - usbd_msc_cfg.stage = MSC_READ_CBW; - USB_LOG_DBG("Start reading cbw\r\n"); - usbd_ep_start_read(mass_ep_data[MSD_OUT_EP_IDX].ep_addr, (uint8_t *)&usbd_msc_cfg.cbw, USB_SIZEOF_MSC_CBW); - break; - - default: - break; - } -} - -struct usbd_interface *usbd_msc_init_intf(struct usbd_interface *intf, const uint8_t out_ep, const uint8_t in_ep) -{ - intf->class_interface_handler = msc_storage_class_interface_request_handler; - intf->class_endpoint_handler = NULL; - intf->vendor_handler = NULL; - intf->notify_handler = msc_storage_notify_handler; - - mass_ep_data[MSD_OUT_EP_IDX].ep_addr = out_ep; - mass_ep_data[MSD_OUT_EP_IDX].ep_cb = mass_storage_bulk_out; - mass_ep_data[MSD_IN_EP_IDX].ep_addr = in_ep; - mass_ep_data[MSD_IN_EP_IDX].ep_cb = mass_storage_bulk_in; - - usbd_add_endpoint(&mass_ep_data[MSD_OUT_EP_IDX]); - usbd_add_endpoint(&mass_ep_data[MSD_IN_EP_IDX]); - - memset((uint8_t *)&usbd_msc_cfg, 0, sizeof(struct usbd_msc_cfg_priv)); - - usbd_msc_get_cap(0, &usbd_msc_cfg.scsi_blk_nbr, &usbd_msc_cfg.scsi_blk_size); - - if (usbd_msc_cfg.scsi_blk_size > CONFIG_USBDEV_MSC_BLOCK_SIZE) { - USB_LOG_ERR("msc block buffer overflow\r\n"); - return NULL; - } - - return intf; -} - -void usbd_msc_set_readonly(bool readonly) -{ - usbd_msc_cfg.readonly = readonly; -} \ No newline at end of file diff --git a/third-party/cherryusb/class/msc/usbd_msc.h b/third-party/cherryusb/class/msc/usbd_msc.h deleted file mode 100644 index 824b48442a393d859eeb77f3dce3e95095aee9a2..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/msc/usbd_msc.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBD_MSC_H -#define USBD_MSC_H - -#include "usb_msc.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Init msc interface driver */ -struct usbd_interface *usbd_msc_init_intf(struct usbd_interface *intf, - const uint8_t out_ep, - const uint8_t in_ep); - -void usbd_msc_get_cap(uint8_t lun, uint32_t *block_num, uint16_t *block_size); -int usbd_msc_sector_read(uint32_t sector, uint8_t *buffer, uint32_t length); -int usbd_msc_sector_write(uint32_t sector, uint8_t *buffer, uint32_t length); - -void usbd_msc_set_readonly(bool readonly); - -#ifdef __cplusplus -} -#endif - -#endif /* USBD_MSC_H */ diff --git a/third-party/cherryusb/class/msc/usbh_msc.c b/third-party/cherryusb/class/msc/usbh_msc.c deleted file mode 100644 index 467618fce05e607f90c4573719b53a9e9338e350..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/msc/usbh_msc.c +++ /dev/null @@ -1,394 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbh_core.h" -#include "usbh_msc.h" -#include "usb_scsi.h" - -#define DEV_FORMAT "/usb%d/sd%c" - -static uint32_t g_devinuse = 0; - -static int usbh_msc_devno_alloc(struct usbh_msc *msc_class) -{ - int devno; - - for (devno = 0; devno < 26; devno++) { - uint32_t bitno = 1 << devno; - if ((g_devinuse & bitno) == 0) { - g_devinuse |= bitno; - msc_class->sdchar = 'a' + devno; - return 0; - } - } - - return -EMFILE; -} - -static void usbh_msc_devno_free(struct usbh_msc *msc_class) -{ - int devno = msc_class->sdchar - 'a'; - - if (devno >= 0 && devno < 26) { - g_devinuse &= ~(1 << devno); - } -} - -static int usbh_msc_get_maxlun(struct usbh_msc *msc_class, uint8_t *buffer) -{ - struct usb_setup_packet *setup = msc_class->hport->setup; - - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = MSC_REQUEST_GET_MAX_LUN; - setup->wValue = 0; - setup->wIndex = msc_class->intf; - setup->wLength = 1; - - return usbh_control_transfer(msc_class->hport->ep0, setup, buffer); -} - -static void usbh_msc_cbw_dump(struct CBW *cbw) -{ - int i; - - USB_LOG_DBG("CBW:\r\n"); - USB_LOG_DBG(" signature: 0x%08x\r\n", (unsigned int)cbw->dSignature); - USB_LOG_DBG(" tag: 0x%08x\r\n", (unsigned int)cbw->dTag); - USB_LOG_DBG(" datlen: 0x%08x\r\n", (unsigned int)cbw->dDataLength); - USB_LOG_DBG(" flags: 0x%02x\r\n", cbw->bmFlags); - USB_LOG_DBG(" lun: 0x%02x\r\n", cbw->bLUN); - USB_LOG_DBG(" cblen: 0x%02x\r\n", cbw->bCBLength); - - USB_LOG_DBG("CB:\r\n"); - for (i = 0; i < cbw->bCBLength; i += 8) { - USB_LOG_DBG(" 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\r\n", - cbw->CB[i], cbw->CB[i + 1], cbw->CB[i + 2], - cbw->CB[i + 3], cbw->CB[i + 4], cbw->CB[i + 5], - cbw->CB[i + 6], cbw->CB[i + 7]); - } -} - -static void usbh_msc_csw_dump(struct CSW *csw) -{ - USB_LOG_DBG("CSW:\r\n"); - USB_LOG_DBG(" signature: 0x%08x\r\n", (unsigned int)csw->dSignature); - USB_LOG_DBG(" tag: 0x%08x\r\n", (unsigned int)csw->dTag); - USB_LOG_DBG(" residue: 0x%08x\r\n", (unsigned int)csw->dDataResidue); - USB_LOG_DBG(" status: 0x%02x\r\n", csw->bStatus); -} - -static inline int usbh_msc_bulk_in_transfer(struct usbh_msc *msc_class, uint8_t *buffer, uint32_t buflen, uint32_t timeout) -{ - int ret; - struct usbh_urb *urb = &msc_class->bulkin_urb; - memset(urb, 0, sizeof(struct usbh_urb)); - - usbh_bulk_urb_fill(urb, msc_class->bulkin, buffer, buflen, timeout, NULL, NULL); - ret = usbh_submit_urb(urb); - if (ret == 0) { - ret = urb->actual_length; - } - return ret; -} - -static inline int usbh_msc_bulk_out_transfer(struct usbh_msc *msc_class, uint8_t *buffer, uint32_t buflen, uint32_t timeout) -{ - int ret; - struct usbh_urb *urb = &msc_class->bulkout_urb; - memset(urb, 0, sizeof(struct usbh_urb)); - - usbh_bulk_urb_fill(urb, msc_class->bulkout, buffer, buflen, timeout, NULL, NULL); - ret = usbh_submit_urb(urb); - if (ret == 0) { - ret = urb->actual_length; - } - return ret; -} - -int usbh_bulk_cbw_csw_xfer(struct usbh_msc *msc_class, struct CBW *cbw, struct CSW *csw, uint8_t *buffer) -{ - int nbytes; - - usbh_msc_cbw_dump(cbw); - - /* Send the CBW */ - nbytes = usbh_msc_bulk_out_transfer(msc_class, (uint8_t *)cbw, USB_SIZEOF_MSC_CBW, CONFIG_USBHOST_MSC_TIMEOUT); - if (nbytes < 0) { - USB_LOG_ERR("cbw transfer error\r\n"); - goto __err_exit; - } - - if (cbw->dDataLength != 0) { - if (cbw->CB[0] == SCSI_CMD_WRITE10) { - nbytes = usbh_msc_bulk_out_transfer(msc_class, buffer, cbw->dDataLength, CONFIG_USBHOST_MSC_TIMEOUT); - } else if (cbw->CB[0] == SCSI_CMD_READCAPACITY10) { - nbytes = usbh_msc_bulk_in_transfer(msc_class, buffer, cbw->dDataLength, CONFIG_USBHOST_MSC_TIMEOUT); - if (nbytes >= 0) { - /* Save the capacity information */ - msc_class->blocknum = GET_BE32(&buffer[0]) + 1; - msc_class->blocksize = GET_BE32(&buffer[4]); - } - } else { - nbytes = usbh_msc_bulk_in_transfer(msc_class, buffer, cbw->dDataLength, CONFIG_USBHOST_MSC_TIMEOUT); - } - - if (nbytes < 0) { - USB_LOG_ERR("msc data transfer error\r\n"); - goto __err_exit; - } - } - - /* Receive the CSW */ - memset(csw, 0, USB_SIZEOF_MSC_CSW); - nbytes = usbh_msc_bulk_in_transfer(msc_class, (uint8_t *)csw, USB_SIZEOF_MSC_CSW, CONFIG_USBHOST_MSC_TIMEOUT); - if (nbytes < 0) { - USB_LOG_ERR("csw transfer error\r\n"); - goto __err_exit; - } - - usbh_msc_csw_dump(csw); - - /* check csw status */ - if (csw->dSignature != MSC_CSW_Signature) { - USB_LOG_ERR("csw signature error\r\n"); - return -EINVAL; - } - - if (csw->bStatus != 0) { - USB_LOG_ERR("csw bStatus %d\r\n", csw->bStatus); - return -EINVAL; - } -__err_exit: - return nbytes < 0 ? (int)nbytes : 0; -} - -static inline int usbh_msc_scsi_testunitready(struct usbh_msc *msc_class) -{ - struct CBW *cbw; - - /* Construct the CBW */ - cbw = (struct CBW *)msc_class->g_msc_buf; - memset(cbw, 0, USB_SIZEOF_MSC_CBW); - cbw->dSignature = MSC_CBW_Signature; - - cbw->bCBLength = SCSICMD_TESTUNITREADY_SIZEOF; - cbw->CB[0] = SCSI_CMD_TESTUNITREADY; - - return usbh_bulk_cbw_csw_xfer(msc_class, cbw, (struct CSW *)msc_class->g_msc_buf, NULL); -} - -static inline int usbh_msc_scsi_requestsense(struct usbh_msc *msc_class) -{ - struct CBW *cbw; - - /* Construct the CBW */ - cbw = (struct CBW *)msc_class->g_msc_buf; - memset(cbw, 0, USB_SIZEOF_MSC_CBW); - cbw->dSignature = MSC_CBW_Signature; - - cbw->bmFlags = 0x80; - cbw->bCBLength = SCSIRESP_FIXEDSENSEDATA_SIZEOF; - cbw->dDataLength = SCSICMD_REQUESTSENSE_SIZEOF; - cbw->CB[0] = SCSI_CMD_REQUESTSENSE; - cbw->CB[4] = SCSIRESP_FIXEDSENSEDATA_SIZEOF; - - return usbh_bulk_cbw_csw_xfer(msc_class, cbw, (struct CSW *)msc_class->g_msc_buf, msc_class->g_msc_buf); -} - -static inline int usbh_msc_scsi_inquiry(struct usbh_msc *msc_class) -{ - struct CBW *cbw; - - /* Construct the CBW */ - cbw = (struct CBW *)msc_class->g_msc_buf; - memset(cbw, 0, USB_SIZEOF_MSC_CBW); - cbw->dSignature = MSC_CBW_Signature; - - cbw->dDataLength = SCSIRESP_INQUIRY_SIZEOF; - cbw->bmFlags = 0x80; - cbw->bCBLength = SCSICMD_INQUIRY_SIZEOF; - cbw->CB[0] = SCSI_CMD_INQUIRY; - cbw->CB[4] = SCSIRESP_INQUIRY_SIZEOF; - - return usbh_bulk_cbw_csw_xfer(msc_class, cbw, (struct CSW *)msc_class->g_msc_buf, msc_class->g_msc_buf); -} - -static inline int usbh_msc_scsi_readcapacity10(struct usbh_msc *msc_class) -{ - struct CBW *cbw; - - /* Construct the CBW */ - cbw = (struct CBW *)msc_class->g_msc_buf; - memset(cbw, 0, USB_SIZEOF_MSC_CBW); - cbw->dSignature = MSC_CBW_Signature; - - cbw->dDataLength = SCSIRESP_READCAPACITY10_SIZEOF; - cbw->bmFlags = 0x80; - cbw->bCBLength = SCSICMD_READCAPACITY10_SIZEOF; - cbw->CB[0] = SCSI_CMD_READCAPACITY10; - - return usbh_bulk_cbw_csw_xfer(msc_class, cbw, (struct CSW *)msc_class->g_msc_buf, msc_class->g_msc_buf); -} - -int usbh_msc_scsi_write10(struct usbh_msc *msc_class, uint32_t start_sector, const uint8_t *buffer, uint32_t nsectors) -{ - struct CBW *cbw; - - /* Construct the CBW */ - cbw = (struct CBW *)msc_class->g_msc_buf; - memset(cbw, 0, USB_SIZEOF_MSC_CBW); - cbw->dSignature = MSC_CBW_Signature; - - cbw->dDataLength = (msc_class->blocksize * nsectors); - cbw->bCBLength = SCSICMD_WRITE10_SIZEOF; - cbw->CB[0] = SCSI_CMD_WRITE10; - - SET_BE32(&cbw->CB[2], start_sector); - SET_BE16(&cbw->CB[7], nsectors); - - return usbh_bulk_cbw_csw_xfer(msc_class, cbw, (struct CSW *)msc_class->g_msc_buf, (uint8_t *)buffer); -} - -int usbh_msc_scsi_read10(struct usbh_msc *msc_class, uint32_t start_sector, const uint8_t *buffer, uint32_t nsectors) -{ - struct CBW *cbw; - - /* Construct the CBW */ - cbw = (struct CBW *)msc_class->g_msc_buf; - memset(cbw, 0, USB_SIZEOF_MSC_CBW); - cbw->dSignature = MSC_CBW_Signature; - - cbw->dDataLength = (msc_class->blocksize * nsectors); - cbw->bmFlags = 0x80; - cbw->bCBLength = SCSICMD_READ10_SIZEOF; - cbw->CB[0] = SCSI_CMD_READ10; - - SET_BE32(&cbw->CB[2], start_sector); - SET_BE16(&cbw->CB[7], nsectors); - - return usbh_bulk_cbw_csw_xfer(msc_class, cbw, (struct CSW *)msc_class->g_msc_buf, (uint8_t *)buffer); -} - -static int usbh_msc_connect(struct usbh_hubport *hport, uint8_t intf) -{ - struct usb_endpoint_descriptor *ep_desc; - struct usbh_bus *usb = usbh_get_bus_of_port(hport); - int ret; - - struct usbh_msc *msc_class = usb_malloc(sizeof(struct usbh_msc)); - if (msc_class == NULL) { - USB_LOG_ERR("Fail to alloc msc_class\r\n"); - return -ENOMEM; - } - - memset(msc_class, 0, sizeof(struct usbh_msc)); - usbh_msc_devno_alloc(msc_class); - msc_class->hport = hport; - msc_class->intf = intf; - - hport->config.intf[intf].priv = msc_class; - - ret = usbh_msc_get_maxlun(msc_class, msc_class->g_msc_buf); - if (ret < 0) { - return ret; - } - - USB_LOG_INFO("Get max LUN:%u\r\n", msc_class->g_msc_buf[0] + 1); - - for (uint8_t i = 0; i < hport->config.intf[intf].altsetting[0].intf_desc.bNumEndpoints; i++) { - ep_desc = &hport->config.intf[intf].altsetting[0].ep[i].ep_desc; - if (ep_desc->bEndpointAddress & 0x80) { - usbh_hport_activate_epx(&msc_class->bulkin, hport, ep_desc); - } else { - usbh_hport_activate_epx(&msc_class->bulkout, hport, ep_desc); - } - } - - ret = usbh_msc_scsi_testunitready(msc_class); - if (ret < 0) { - ret = usbh_msc_scsi_requestsense(msc_class); - if (ret < 0) { - USB_LOG_ERR("Fail to scsi_testunitready\r\n"); - return ret; - } - } - ret = usbh_msc_scsi_inquiry(msc_class); - if (ret < 0) { - USB_LOG_ERR("Fail to scsi_inquiry\r\n"); - return ret; - } - ret = usbh_msc_scsi_readcapacity10(msc_class); - if (ret < 0) { - USB_LOG_ERR("Fail to scsi_readcapacity10\r\n"); - return ret; - } - - if (msc_class->blocksize > 0) { - USB_LOG_INFO("Capacity info:\r\n"); - USB_LOG_INFO("Block num:%d,block size:%d\r\n", (unsigned int)msc_class->blocknum, (unsigned int)msc_class->blocksize); - } else { - USB_LOG_ERR("Invalid block size\r\n"); - return -ERANGE; - } - - snprintf(hport->config.intf[intf].devname, CONFIG_USBHOST_DEV_NAMELEN, DEV_FORMAT, usb->id, msc_class->sdchar); - - USB_LOG_RAW("Register MSC Class:%s for USB-%d\r\n", hport->config.intf[intf].devname, usb->id); - - usbh_msc_run(msc_class); - return ret; -} - -static int usbh_msc_disconnect(struct usbh_hubport *hport, uint8_t intf) -{ - int ret = 0; - - struct usbh_msc *msc_class = (struct usbh_msc *)hport->config.intf[intf].priv; - - if (msc_class) { - usbh_msc_devno_free(msc_class); - - if (msc_class->bulkin) { - usbh_pipe_free(msc_class->bulkin); - } - - if (msc_class->bulkout) { - usbh_pipe_free(msc_class->bulkout); - } - - usbh_msc_stop(msc_class); - memset(msc_class, 0, sizeof(struct usbh_msc)); - usb_free(msc_class); - - if (hport->config.intf[intf].devname[0] != '\0') - USB_LOG_RAW("Unregister MSC Class:%s\r\n", hport->config.intf[intf].devname); - } - - return ret; -} - -__WEAK void usbh_msc_run(struct usbh_msc *msc_class) -{ -} - -__WEAK void usbh_msc_stop(struct usbh_msc *msc_class) -{ -} - -const struct usbh_class_driver msc_class_driver = { - .driver_name = "msc", - .connect = usbh_msc_connect, - .disconnect = usbh_msc_disconnect -}; - -CLASS_INFO_DEFINE const struct usbh_class_info msc_class_info = { - .match_flags = USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS | USB_CLASS_MATCH_INTF_PROTOCOL, - .class = USB_DEVICE_CLASS_MASS_STORAGE, - .subclass = MSC_SUBCLASS_SCSI, - .protocol = MSC_PROTOCOL_BULK_ONLY, - .vid = 0x00, - .pid = 0x00, - .class_driver = &msc_class_driver -}; diff --git a/third-party/cherryusb/class/msc/usbh_msc.h b/third-party/cherryusb/class/msc/usbh_msc.h deleted file mode 100644 index f2d253b98a54eaceecd26f0321ec2765a8995dc5..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/msc/usbh_msc.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBH_MSC_H -#define USBH_MSC_H - -#include "usb_msc.h" -#include "usb_scsi.h" - -struct usbh_msc { - struct usbh_hubport *hport; - - uint8_t intf; /* Data interface number */ - uint8_t sdchar; - usbh_pipe_t bulkin; /* Bulk IN endpoint */ - usbh_pipe_t bulkout; /* Bulk OUT endpoint */ - struct usbh_urb bulkin_urb; /* Bulk IN urb */ - struct usbh_urb bulkout_urb; /* Bulk OUT urb */ - uint32_t blocknum; /* Number of blocks on the USB mass storage device */ - uint16_t blocksize; /* Block size of USB mass storage device */ - USB_MEM_ALIGNX uint8_t g_msc_buf[32]; -}; - -int usbh_msc_scsi_write10(struct usbh_msc *msc_class, uint32_t start_sector, const uint8_t *buffer, uint32_t nsectors); -int usbh_msc_scsi_read10(struct usbh_msc *msc_class, uint32_t start_sector, const uint8_t *buffer, uint32_t nsectors); - -void usbh_msc_run(struct usbh_msc *msc_class); -void usbh_msc_stop(struct usbh_msc *msc_class); - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* USBH_MSC_H */ diff --git a/third-party/cherryusb/class/mtp/usb_mtp.h b/third-party/cherryusb/class/mtp/usb_mtp.h deleted file mode 100644 index 968c4d0eb47055d35bf748bf407c8d668828ae75..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/mtp/usb_mtp.h +++ /dev/null @@ -1,503 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_MTP_H -#define USB_MTP_H - -#define USB_MTP_CLASS 0x06 - -#define USB_MTP_SUB_CLASS 0x01U -#define USB_MTP_PROTOCOL 0x01U - -/* MTP class requests */ -#define MTP_REQUEST_CANCEL 0x64U -#define MTP_REQUEST_GET_EXT_EVENT_DATA 0x65U -#define MTP_REQUEST_RESET 0x66U -#define MTP_REQUEST_GET_DEVICE_STATUS 0x67U - -/* Container Types */ -#define MTP_CONTAINER_TYPE_UNDEFINED 0U -#define MTP_CONTAINER_TYPE_COMMAND 1U -#define MTP_CONTAINER_TYPE_DATA 2U -#define MTP_CONTAINER_TYPE_RESPONSE 3U -#define MTP_CONTAINER_TYPE_EVENT 4U - -/* - * MTP Class specification Revision 1.1 - * Appendix D. Operations - */ - -/* Operations code */ -#define MTP_OP_GET_DEVICE_INFO 0x1001U -#define MTP_OP_OPEN_SESSION 0x1002U -#define MTP_OP_CLOSE_SESSION 0x1003U -#define MTP_OP_GET_STORAGE_IDS 0x1004U -#define MTP_OP_GET_STORAGE_INFO 0x1005U -#define MTP_OP_GET_NUM_OBJECTS 0x1006U -#define MTP_OP_GET_OBJECT_HANDLES 0x1007U -#define MTP_OP_GET_OBJECT_INFO 0x1008U -#define MTP_OP_GET_OBJECT 0x1009U -#define MTP_OP_GET_THUMB 0x100AU -#define MTP_OP_DELETE_OBJECT 0x100BU -#define MTP_OP_SEND_OBJECT_INFO 0x100CU -#define MTP_OP_SEND_OBJECT 0x100DU -#define MTP_OP_FORMAT_STORE 0x100FU -#define MTP_OP_RESET_DEVICE 0x1010U -#define MTP_OP_GET_DEVICE_PROP_DESC 0x1014U -#define MTP_OP_GET_DEVICE_PROP_VALUE 0x1015U -#define MTP_OP_SET_DEVICE_PROP_VALUE 0x1016U -#define MTP_OP_RESET_DEVICE_PROP_VALUE 0x1017U -#define MTP_OP_TERMINATE_OPEN_CAPTURE 0x1018U -#define MTP_OP_MOVE_OBJECT 0x1019U -#define MTP_OP_COPY_OBJECT 0x101AU -#define MTP_OP_GET_PARTIAL_OBJECT 0x101BU -#define MTP_OP_INITIATE_OPEN_CAPTURE 0x101CU -#define MTP_OP_GET_OBJECT_PROPS_SUPPORTED 0x9801U -#define MTP_OP_GET_OBJECT_PROP_DESC 0x9802U -#define MTP_OP_GET_OBJECT_PROP_VALUE 0x9803U -#define MTP_OP_SET_OBJECT_PROP_VALUE 0x9804U -#define MTP_OP_GET_OBJECT_PROPLIST 0x9805U -#define MTP_OP_GET_OBJECT_PROP_REFERENCES 0x9810U -#define MTP_OP_GETSERVICEIDS 0x9301U -#define MTP_OP_GETSERVICEINFO 0x9302U -#define MTP_OP_GETSERVICECAPABILITIES 0x9303U -#define MTP_OP_GETSERVICEPROPDESC 0x9304U - -/* MTP response code */ -#define MTP_RESPONSE_OK 0x2001U -#define MTP_RESPONSE_GENERAL_ERROR 0x2002U -#define MTP_RESPONSE_PARAMETER_NOT_SUPPORTED 0x2006U -#define MTP_RESPONSE_INCOMPLETE_TRANSFER 0x2007U -#define MTP_RESPONSE_INVALID_STORAGE_ID 0x2008U -#define MTP_RESPONSE_INVALID_OBJECT_HANDLE 0x2009U -#define MTP_RESPONSE_DEVICEPROP_NOT_SUPPORTED 0x200AU -#define MTP_RESPONSE_STORE_FULL 0x200CU -#define MTP_RESPONSE_ACCESS_DENIED 0x200FU -#define MTP_RESPONSE_STORE_NOT_AVAILABLE 0x2013U -#define MTP_RESPONSE_SPECIFICATION_BY_FORMAT_NOT_SUPPORTED 0x2014U -#define MTP_RESPONSE_NO_VALID_OBJECT_INFO 0x2015U -#define MTP_RESPONSE_DEVICE_BUSY 0x2019U -#define MTP_RESPONSE_INVALID_PARENT_OBJECT 0x201AU -#define MTP_RESPONSE_INVALID_PARAMETER 0x201DU -#define MTP_RESPONSE_SESSION_ALREADY_OPEN 0x201EU -#define MTP_RESPONSE_TRANSACTION_CANCELLED 0x201FU -#define MTP_RESPONSE_INVALID_OBJECT_PROP_CODE 0xA801U -#define MTP_RESPONSE_SPECIFICATION_BY_GROUP_UNSUPPORTED 0xA807U -#define MTP_RESPONSE_OBJECT_PROP_NOT_SUPPORTED 0xA80AU - -/* MTP Object format codes */ -#define MTP_OBJ_FORMAT_UNDEFINED 0x3000U -#define MTP_OBJ_FORMAT_ASSOCIATION 0x3001U -#define MTP_OBJ_FORMAT_SCRIPT 0x3002U -#define MTP_OBJ_FORMAT_EXECUTABLE 0x3003U -#define MTP_OBJ_FORMAT_TEXT 0x3004U -#define MTP_OBJ_FORMAT_HTML 0x3005U -#define MTP_OBJ_FORMAT_DPOF 0x3006U -#define MTP_OBJ_FORMAT_AIFF 0x3007U -#define MTP_OBJ_FORMAT_WAV 0x3008U -#define MTP_OBJ_FORMAT_MP3 0x3009U -#define MTP_OBJ_FORMAT_AVI 0x300AU -#define MTP_OBJ_FORMAT_MPEG 0x300BU -#define MTP_OBJ_FORMAT_ASF 0x300CU -#define MTP_OBJ_FORMAT_DEFINED 0x3800U -#define MTP_OBJ_FORMAT_EXIF_JPEG 0x3801U -#define MTP_OBJ_FORMAT_TIFF_EP 0x3802U -#define MTP_OBJ_FORMAT_FLASHPIX 0x3803U -#define MTP_OBJ_FORMAT_BMP 0x3804U -#define MTP_OBJ_FORMAT_CIFF 0x3805U -#define MTP_OBJ_FORMAT_UNDEFINED_RESERVED0 0x3806U -#define MTP_OBJ_FORMAT_GIF 0x3807U -#define MTP_OBJ_FORMAT_JFIF 0x3808U -#define MTP_OBJ_FORMAT_CD 0x3809U -#define MTP_OBJ_FORMAT_PICT 0x380AU -#define MTP_OBJ_FORMAT_PNG 0x380BU -#define MTP_OBJ_FORMAT_UNDEFINED_RESERVED1 0x380CU -#define MTP_OBJ_FORMAT_TIFF 0x380DU -#define MTP_OBJ_FORMAT_TIFF_IT 0x380EU -#define MTP_OBJ_FORMAT_JP2 0x380FU -#define MTP_OBJ_FORMAT_JPX 0x3810U -#define MTP_OBJ_FORMAT_UNDEFINED_FIRMWARE 0xB802U -#define MTP_OBJ_FORMAT_WINDOWS_IMAGE_FORMAT 0xB881U -#define MTP_OBJ_FORMAT_UNDEFINED_AUDIO 0xB900U -#define MTP_OBJ_FORMAT_WMA 0xB901U -#define MTP_OBJ_FORMAT_OGG 0xB902U -#define MTP_OBJ_FORMAT_AAC 0xB903U -#define MTP_OBJ_FORMAT_AUDIBLE 0xB904U -#define MTP_OBJ_FORMAT_FLAC 0xB906U -#define MTP_OBJ_FORMAT_UNDEFINED_VIDEO 0xB980U -#define MTP_OBJ_FORMAT_WMV 0xB981U -#define MTP_OBJ_FORMAT_MP4_CONTAINER 0xB982U -#define MTP_OBJ_FORMAT_MP2 0xB983U -#define MTP_OBJ_FORMAT_3GP_CONTAINER 0xB984U - -/* MTP event codes*/ -#define MTP_EVENT_UNDEFINED 0x4000U -#define MTP_EVENT_CANCELTRANSACTION 0x4001U -#define MTP_EVENT_OBJECTADDED 0x4002U -#define MTP_EVENT_OBJECTREMOVED 0x4003U -#define MTP_EVENT_STOREADDED 0x4004U -#define MTP_EVENT_STOREREMOVED 0x4005U -#define MTP_EVENT_DEVICEPROPCHANGED 0x4006U -#define MTP_EVENT_OBJECTINFOCHANGED 0x4007U -#define MTP_EVENT_DEVICEINFOCHANGED 0x4008U -#define MTP_EVENT_REQUESTOBJECTTRANSFER 0x4009U -#define MTP_EVENT_STOREFULL 0x400AU -#define MTP_EVENT_DEVICERESET 0x400BU -#define MTP_EVENT_STORAGEINFOCHANGED 0x400CU -#define MTP_EVENT_CAPTURECOMPLETE 0x400DU -#define MTP_EVENT_UNREPORTEDSTATUS 0x400EU -#define MTP_EVENT_OBJECTPROPCHANGED 0xC801U -#define MTP_EVENT_OBJECTPROPDESCCHANGED 0xC802U -#define MTP_EVENT_OBJECTREFERENCESCHANGED 0xC803U - -/* MTP device properties code*/ -#define MTP_DEV_PROP_UNDEFINED 0x5000U -#define MTP_DEV_PROP_BATTERY_LEVEL 0x5001U -#define MTP_DEV_PROP_FUNCTIONAL_MODE 0x5002U -#define MTP_DEV_PROP_IMAGE_SIZE 0x5003U -#define MTP_DEV_PROP_COMPRESSION_SETTING 0x5004U -#define MTP_DEV_PROP_WHITE_BALANCE 0x5005U -#define MTP_DEV_PROP_RGB_GAIN 0x5006U -#define MTP_DEV_PROP_F_NUMBER 0x5007U -#define MTP_DEV_PROP_FOCAL_LENGTH 0x5008U -#define MTP_DEV_PROP_FOCUS_DISTANCE 0x5009U -#define MTP_DEV_PROP_FOCUS_MODE 0x500AU -#define MTP_DEV_PROP_EXPOSURE_METERING_MODE 0x500BU -#define MTP_DEV_PROP_FLASH_MODE 0x500CU -#define MTP_DEV_PROP_EXPOSURE_TIME 0x500DU -#define MTP_DEV_PROP_EXPOSURE_PROGRAM_MODE 0x500EU -#define MTP_DEV_PROP_EXPOSURE_INDEX 0x500FU -#define MTP_DEV_PROP_EXPOSURE_BIAS_COMPENSATION 0x5010U -#define MTP_DEV_PROP_DATETIME 0x5011U -#define MTP_DEV_PROP_CAPTURE_DELAY 0x5012U -#define MTP_DEV_PROP_STILL_CAPTURE_MODE 0x5013U -#define MTP_DEV_PROP_CONTRAST 0x5014U -#define MTP_DEV_PROP_SHARPNESS 0x5015U -#define MTP_DEV_PROP_DIGITAL_ZOOM 0x5016U -#define MTP_DEV_PROP_EFFECT_MODE 0x5017U -#define MTP_DEV_PROP_BURST_NUMBER 0x5018U -#define MTP_DEV_PROP_BURST_INTERVAL 0x5019U -#define MTP_DEV_PROP_TIMELAPSE_NUMBER 0x501AU -#define MTP_DEV_PROP_TIMELAPSE_INTERVAL 0x501BU -#define MTP_DEV_PROP_FOCUS_METERING_MODE 0x501CU -#define MTP_DEV_PROP_UPLOAD_URL 0x501DU -#define MTP_DEV_PROP_ARTIST 0x501EU -#define MTP_DEV_PROP_COPYRIGHT_INFO 0x501FU -#define MTP_DEV_PROP_SYNCHRONIZATION_PARTNER 0xD401U -#define MTP_DEV_PROP_DEVICE_FRIENDLY_NAME 0xD402U -#define MTP_DEV_PROP_VOLUME 0xD403U -#define MTP_DEV_PROP_SUPPORTEDFORMATSORDERED 0xD404U -#define MTP_DEV_PROP_DEVICEICON 0xD405U -#define MTP_DEV_PROP_PLAYBACK_RATE 0xD410U -#define MTP_DEV_PROP_PLAYBACK_OBJECT 0xD411U -#define MTP_DEV_PROP_PLAYBACK_CONTAINER 0xD412U -#define MTP_DEV_PROP_SESSION_INITIATOR_VERSION_INFO 0xD406U -#define MTP_DEV_PROP_PERCEIVED_DEVICE_TYPE 0xD407U - -/* - * MTP Class specification Revision 1.1 - * Appendix B. Object Properties - */ - -/* MTP OBJECT PROPERTIES supported*/ -#define MTP_OB_PROP_STORAGE_ID 0xDC01U -#define MTP_OB_PROP_OBJECT_FORMAT 0xDC02U -#define MTP_OB_PROP_PROTECTION_STATUS 0xDC03U -#define MTP_OB_PROP_OBJECT_SIZE 0xDC04U -#define MTP_OB_PROP_ASSOC_TYPE 0xDC05U -#define MTP_OB_PROP_ASSOC_DESC 0xDC06U -#define MTP_OB_PROP_OBJ_FILE_NAME 0xDC07U -#define MTP_OB_PROP_DATE_CREATED 0xDC08U -#define MTP_OB_PROP_DATE_MODIFIED 0xDC09U -#define MTP_OB_PROP_KEYWORDS 0xDC0AU -#define MTP_OB_PROP_PARENT_OBJECT 0xDC0BU -#define MTP_OB_PROP_ALLOWED_FOLD_CONTENTS 0xDC0CU -#define MTP_OB_PROP_HIDDEN 0xDC0DU -#define MTP_OB_PROP_SYSTEM_OBJECT 0xDC0EU -#define MTP_OB_PROP_PERS_UNIQ_OBJ_IDEN 0xDC41U -#define MTP_OB_PROP_SYNCID 0xDC42U -#define MTP_OB_PROP_PROPERTY_BAG 0xDC43U -#define MTP_OB_PROP_NAME 0xDC44U -#define MTP_OB_PROP_CREATED_BY 0xDC45U -#define MTP_OB_PROP_ARTIST 0xDC46U -#define MTP_OB_PROP_DATE_AUTHORED 0xDC47U -#define MTP_OB_PROP_DESCRIPTION 0xDC48U -#define MTP_OB_PROP_URL_REFERENCE 0xDC49U -#define MTP_OB_PROP_LANGUAGELOCALE 0xDC4AU -#define MTP_OB_PROP_COPYRIGHT_INFORMATION 0xDC4BU -#define MTP_OB_PROP_SOURCE 0xDC4CU -#define MTP_OB_PROP_ORIGIN_LOCATION 0xDC4DU -#define MTP_OB_PROP_DATE_ADDED 0xDC4EU -#define MTP_OB_PROP_NON_CONSUMABLE 0xDC4FU -#define MTP_OB_PROP_CORRUPTUNPLAYABLE 0xDC50U -#define MTP_OB_PROP_PRODUCERSERIALNUMBER 0xDC51U -#define MTP_OB_PROP_REPRESENTATIVE_SAMPLE_FORMAT 0xDC81U -#define MTP_OB_PROP_REPRESENTATIVE_SAMPLE_SIZE 0xDC82U -#define MTP_OB_PROP_REPRESENTATIVE_SAMPLE_HEIGHT 0xDC83U -#define MTP_OB_PROP_REPRESENTATIVE_SAMPLE_WIDTH 0xDC84U -#define MTP_OB_PROP_REPRESENTATIVE_SAMPLE_DURATION 0xDC85U -#define MTP_OB_PROP_REPRESENTATIVE_SAMPLE_DATA 0xDC86U -#define MTP_OB_PROP_WIDTH 0xDC87U -#define MTP_OB_PROP_HEIGHT 0xDC88U -#define MTP_OB_PROP_DURATION 0xDC89U -#define MTP_OB_PROP_RATING 0xDC8AU -#define MTP_OB_PROP_TRACK 0xDC8BU -#define MTP_OB_PROP_GENRE 0xDC8CU -#define MTP_OB_PROP_CREDITS 0xDC8DU -#define MTP_OB_PROP_LYRICS 0xDC8EU -#define MTP_OB_PROP_SUBSCRIPTION_CONTENT_ID 0xDC8FU -#define MTP_OB_PROP_PRODUCED_BY 0xDC90U -#define MTP_OB_PROP_USE_COUNT 0xDC91U -#define MTP_OB_PROP_SKIP_COUNT 0xDC92U -#define MTP_OB_PROP_LAST_ACCESSED 0xDC93U -#define MTP_OB_PROP_PARENTAL_RATING 0xDC94U -#define MTP_OB_PROP_META_GENRE 0xDC95U -#define MTP_OB_PROP_COMPOSER 0xDC96U -#define MTP_OB_PROP_EFFECTIVE_RATING 0xDC97U -#define MTP_OB_PROP_SUBTITLE 0xDC98U -#define MTP_OB_PROP_ORIGINAL_RELEASE_DATE 0xDC99U -#define MTP_OB_PROP_ALBUM_NAME 0xDC9AU -#define MTP_OB_PROP_ALBUM_ARTIST 0xDC9BU -#define MTP_OB_PROP_MOOD 0xDC9CU -#define MTP_OB_PROP_DRM_STATUS 0xDC9DU -#define MTP_OB_PROP_SUB_DESCRIPTION 0xDC9EU -#define MTP_OB_PROP_IS_CROPPED 0xDCD1U -#define MTP_OB_PROP_IS_COLOUR_CORRECTED 0xDCD2U -#define MTP_OB_PROP_IMAGE_BIT_DEPTH 0xDCD3U -#define MTP_OB_PROP_FNUMBER 0xDCD4U -#define MTP_OB_PROP_EXPOSURE_TIME 0xDCD5U -#define MTP_OB_PROP_EXPOSURE_INDEX 0xDCD6U -#define MTP_OB_PROP_TOTAL_BITRATE 0xDE91U -#define MTP_OB_PROP_BITRATE_TYPE 0xDE92U -#define MTP_OB_PROP_SAMPLE_RATE 0xDE93U -#define MTP_OB_PROP_NUMBER_OF_CHANNELS 0xDE94U -#define MTP_OB_PROP_AUDIO_BITDEPTH 0xDE95U -#define MTP_OB_PROP_SCAN_TYPE 0xDE97U -#define MTP_OB_PROP_AUDIO_WAVE_CODEC 0xDE99U -#define MTP_OB_PROP_AUDIO_BITRATE 0xDE9AU -#define MTP_OB_PROP_VIDEO_FOURCC_CODEC 0xDE9BU -#define MTP_OB_PROP_VIDEO_BITRATE 0xDE9CU -#define MTP_OB_PROP_FRAMES_PER_THOUSAND_SECONDS 0xDE9DU -#define MTP_OB_PROP_KEYFRAME_DISTANCE 0xDE9EU -#define MTP_OB_PROP_BUFFER_SIZE 0xDE9FU -#define MTP_OB_PROP_ENCODING_QUALITY 0xDEA0U -#define MTP_OB_PROP_ENCODING_PROFILE 0xDEA1U -#define MTP_OB_PROP_DISPLAY_NAME 0xDCE0U -#define MTP_OB_PROP_BODY_TEXT 0xDCE1U -#define MTP_OB_PROP_SUBJECT 0xDCE2U -#define MTP_OB_PROP_PRIORITY 0xDCE3U -#define MTP_OB_PROP_GIVEN_NAME 0xDD00U -#define MTP_OB_PROP_MIDDLE_NAMES 0xDD01U -#define MTP_OB_PROP_FAMILY_NAME 0xDD02U -#define MTP_OB_PROP_PREFIX 0xDD03U -#define MTP_OB_PROP_SUFFIX 0xDD04U -#define MTP_OB_PROP_PHONETIC_GIVEN_NAME 0xDD05U -#define MTP_OB_PROP_PHONETIC_FAMILY_NAME 0xDD06U -#define MTP_OB_PROP_EMAIL_PRIMARY 0xDD07U -#define MTP_OB_PROP_EMAIL_PERSONAL_1 0xDD08U -#define MTP_OB_PROP_EMAIL_PERSONAL_2 0xDD09U -#define MTP_OB_PROP_EMAIL_BUSINESS_1 0xDD0AU -#define MTP_OB_PROP_EMAIL_BUSINESS_2 0xDD0BU -#define MTP_OB_PROP_EMAIL_OTHERS 0xDD0CU -#define MTP_OB_PROP_PHONE_NUMBER_PRIMARY 0xDD0DU -#define MTP_OB_PROP_PHONE_NUMBER_PERSONAL 0xDD0EU -#define MTP_OB_PROP_PHONE_NUMBER_PERSONAL_2 0xDD0FU -#define MTP_OB_PROP_PHONE_NUMBER_BUSINESS 0xDD10U -#define MTP_OB_PROP_PHONE_NUMBER_BUSINESS_2 0xDD11U -#define MTP_OB_PROP_PHONE_NUMBER_MOBILE 0xDD12U -#define MTP_OB_PROP_PHONE_NUMBER_MOBILE_2 0xDD13U -#define MTP_OB_PROP_FAX_NUMBER_PRIMARY 0xDD14U -#define MTP_OB_PROP_FAX_NUMBER_PERSONAL 0xDD15U -#define MTP_OB_PROP_FAX_NUMBER_BUSINESS 0xDD16U -#define MTP_OB_PROP_PAGER_NUMBER 0xDD17U -#define MTP_OB_PROP_PHONE_NUMBER_OTHERS 0xDD18U -#define MTP_OB_PROP_PRIMARY_WEB_ADDRESS 0xDD19U -#define MTP_OB_PROP_PERSONAL_WEB_ADDRESS 0xDD1AU -#define MTP_OB_PROP_BUSINESS_WEB_ADDRESS 0xDD1BU -#define MTP_OB_PROP_INSTANT_MESSENGER_ADDRESS 0xDD1CU -#define MTP_OB_PROP_INSTANT_MESSENGER_ADDRESS_2 0xDD1DU -#define MTP_OB_PROP_INSTANT_MESSENGER_ADDRESS_3 0xDD1EU -#define MTP_OB_PROP_POSTAL_ADDRESS_PERSONAL_FULL 0xDD1FU -#define MTP_OB_PROP_POSTAL_ADDRESS_PERSONAL_LINE_1 0xDD20U -#define MTP_OB_PROP_POSTAL_ADDRESS_PERSONAL_LINE_2 0xDD21U -#define MTP_OB_PROP_POSTAL_ADDRESS_PERSONAL_CITY 0xDD22U -#define MTP_OB_PROP_POSTAL_ADDRESS_PERSONAL_REGION 0xDD23U -#define MTP_OB_PROP_POSTAL_ADDRESS_PERSONAL_POSTAL_CODE 0xDD24U -#define MTP_OB_PROP_POSTAL_ADDRESS_PERSONAL_COUNTRY 0xDD25U -#define MTP_OB_PROP_POSTAL_ADDRESS_BUSINESS_FULL 0xDD26U -#define MTP_OB_PROP_POSTAL_ADDRESS_BUSINESS_LINE_1 0xDD27U -#define MTP_OB_PROP_POSTAL_ADDRESS_BUSINESS_LINE_2 0xDD28U -#define MTP_OB_PROP_POSTAL_ADDRESS_BUSINESS_CITY 0xDD29U -#define MTP_OB_PROP_POSTAL_ADDRESS_BUSINESS_REGION 0xDD2AU -#define MTP_OB_PROP_POSTAL_ADDRESS_BUSINESS_POSTAL_CODE 0xDD2BU -#define MTP_OB_PROP_POSTAL_ADDRESS_BUSINESS_COUNTRY 0xDD2CU -#define MTP_OB_PROP_POSTAL_ADDRESS_OTHER_FULL 0xDD2DU -#define MTP_OB_PROP_POSTAL_ADDRESS_OTHER_LINE_1 0xDD2EU -#define MTP_OB_PROP_POSTAL_ADDRESS_OTHER_LINE_2 0xDD2FU -#define MTP_OB_PROP_POSTAL_ADDRESS_OTHER_CITY 0xDD30U -#define MTP_OB_PROP_POSTAL_ADDRESS_OTHER_REGION 0xDD31U -#define MTP_OB_PROP_POSTAL_ADDRESS_OTHER_POSTAL_CODE 0xDD32U -#define MTP_OB_PROP_POSTAL_ADDRESS_OTHER_COUNTRY 0xDD33U -#define MTP_OB_PROP_ORGANIZATION_NAME 0xDD34U -#define MTP_OB_PROP_PHONETIC_ORGANIZATION_NAME 0xDD35U -#define MTP_OB_PROP_ROLE 0xDD36U -#define MTP_OB_PROP_BIRTHDATE 0xDD37U -#define MTP_OB_PROP_MESSAGE_TO 0xDD40U -#define MTP_OB_PROP_MESSAGE_CC 0xDD41U -#define MTP_OB_PROP_MESSAGE_BCC 0xDD42U -#define MTP_OB_PROP_MESSAGE_READ 0xDD43U -#define MTP_OB_PROP_MESSAGE_RECEIVED_TIME 0xDD44U -#define MTP_OB_PROP_MESSAGE_SENDER 0xDD45U -#define MTP_OB_PROP_ACT_BEGIN_TIME 0xDD50U -#define MTP_OB_PROP_ACT_END_TIME 0xDD51U -#define MTP_OB_PROP_ACT_LOCATION 0xDD52U -#define MTP_OB_PROP_ACT_REQUIRED_ATTENDEES 0xDD54U -#define MTP_OB_PROP_ACT_OPTIONAL_ATTENDEES 0xDD55U -#define MTP_OB_PROP_ACT_RESOURCES 0xDD56U -#define MTP_OB_PROP_ACT_ACCEPTED 0xDD57U -#define MTP_OB_PROP_OWNER 0xDD5DU -#define MTP_OB_PROP_EDITOR 0xDD5EU -#define MTP_OB_PROP_WEBMASTER 0xDD5FU -#define MTP_OB_PROP_URL_SOURCE 0xDD60U -#define MTP_OB_PROP_URL_DESTINATION 0xDD61U -#define MTP_OB_PROP_TIME_BOOKMARK 0xDD62U -#define MTP_OB_PROP_OBJECT_BOOKMARK 0xDD63U -#define MTP_OB_PROP_BYTE_BOOKMARK 0xDD64U -#define MTP_OB_PROP_LAST_BUILD_DATE 0xDD70U -#define MTP_OB_PROP_TIME_TO_LIVE 0xDD71U -#define MTP_OB_PROP_MEDIA_GUID 0xDD72U - -/* MTP storage type */ -#define MTP_STORAGE_UNDEFINED 0U -#define MTP_STORAGE_FIXED_ROM 0x0001U -#define MTP_STORAGE_REMOVABLE_ROM 0x0002U -#define MTP_STORAGE_FIXED_RAM 0x0003U -#define MTP_STORAGE_REMOVABLE_RAM 0x0004U - -/* MTP file system type */ -#define MTP_FILESYSTEM_UNDEFINED 0U -#define MTP_FILESYSTEM_GENERIC_FLAT 0x0001U -#define MTP_FILESYSTEM_GENERIC_HIERARCH 0x0002U -#define MTP_FILESYSTEM_DCF 0x0003U - -/* MTP access capability */ -#define MTP_ACCESS_CAP_RW 0U /* read write */ -#define MTP_ACCESS_CAP_RO_WITHOUT_DEL 0x0001U -#define MTP_ACCESS_CAP_RO_WITH_DEL 0x0002U - -/* MTP standard data types supported */ -#define MTP_DATATYPE_INT8 0x0001U -#define MTP_DATATYPE_UINT8 0x0002U -#define MTP_DATATYPE_INT16 0x0003U -#define MTP_DATATYPE_UINT16 0x0004U -#define MTP_DATATYPE_INT32 0x0005U -#define MTP_DATATYPE_UINT32 0x0006U -#define MTP_DATATYPE_INT64 0x0007U -#define MTP_DATATYPE_UINT64 0x0008U -#define MTP_DATATYPE_UINT128 0x000AU -#define MTP_DATATYPE_STR 0xFFFFU - -/* MTP reading only or reading/writing */ -#define MTP_PROP_GET 0x00U -#define MTP_PROP_GET_SET 0x01U - -#define MTP_SESSION_CLOSED 0x00 -#define MTP_SESSION_OPENED 0x01 - -struct mtp_container_command { - uint32_t conlen; - uint16_t contype; - uint16_t code; - uint32_t trans_id; - uint32_t param1; - uint32_t param2; - uint32_t param3; - uint32_t param4; - uint32_t param5; -} __PACKED; - -struct mtp_container_data { - uint32_t conlen; - uint16_t contype; - uint16_t code; - uint32_t trans_id; - uint8_t data[512]; -} __PACKED; - -struct mtp_container_response { - uint32_t conlen; - uint16_t contype; - uint16_t code; - uint32_t trans_id; -} __PACKED; - -/*Length of template descriptor: 23 bytes*/ -#define MTP_DESCRIPTOR_LEN (9 + 7 + 7 + 7) - -// clang-format off -#ifndef CONFIG_USB_HS -#define MTP_DESCRIPTOR_INIT(bFirstInterface, out_ep, in_ep, int_ep, str_idx) \ - /* Interface */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - bFirstInterface, /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x03, /* bNumEndpoints */ \ - USB_DEVICE_CLASS_MASS_STORAGE, /* bInterfaceClass */ \ - USB_MTP_SUB_CLASS, /* bInterfaceSubClass */ \ - USB_MTP_PROTOCOL, /* bInterfaceProtocol */ \ - str_idx, /* iInterface */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - out_ep, /* bEndpointAddress */ \ - 0x02, /* bmAttributes */ \ - 0x40, 0x00, /* wMaxPacketSize */ \ - 0x00, /* bInterval */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - in_ep, /* bEndpointAddress */ \ - 0x02, /* bmAttributes */ \ - 0x40, 0x00, /* wMaxPacketSize */ \ - 0x00, /* bInterval */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - int_ep, /* bEndpointAddress */ \ - 0x03, /* bmAttributes */ \ - 0x1c, 0x00, /* wMaxPacketSize */ \ - 0x06 /* bInterval */ -#else -#define MTP_DESCRIPTOR_INIT(bFirstInterface, out_ep, in_ep, int_ep, str_idx) \ - /* Interface */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - bFirstInterface, /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - 0x03, /* bNumEndpoints */ \ - USB_DEVICE_CLASS_MASS_STORAGE, /* bInterfaceClass */ \ - USB_MTP_SUB_CLASS, /* bInterfaceSubClass */ \ - USB_MTP_PROTOCOL, /* bInterfaceProtocol */ \ - str_idx, /* iInterface */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - out_ep, /* bEndpointAddress */ \ - 0x02, /* bmAttributes */ \ - 0x00, 0x02, /* wMaxPacketSize */ \ - 0x00, /* bInterval */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - in_ep, /* bEndpointAddress */ \ - 0x02, /* bmAttributes */ \ - 0x00, 0x02, /* wMaxPacketSize */ \ - 0x00, /* bInterval */ \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - int_ep, /* bEndpointAddress */ \ - 0x03, /* bmAttributes */ \ - 0x1c, 0x00, /* wMaxPacketSize */ \ - 0x06 /* bInterval */ -#endif -// clang-format on - -#endif /* USB_MTP_H */ diff --git a/third-party/cherryusb/class/mtp/usbd_mtp.c b/third-party/cherryusb/class/mtp/usbd_mtp.c deleted file mode 100644 index adc3e5263e057f5fe601fdd89ccbf1d7ba0480e6..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/mtp/usbd_mtp.c +++ /dev/null @@ -1,566 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbd_core.h" -#include "usbd_mtp.h" -#include "usbd_mtp_config.h" - -/* MTP Stage */ -enum Stage { - MTP_READ_COMMAND = 0, - MTP_DATA_OUT = 1, - MTP_DATA_IN = 2, - MTP_SEND_RESPONSE = 3, - MTP_WAIT_RESPONSE = 4, -}; - -USB_NOCACHE_RAM_SECTION struct usbd_mtp { - USB_MEM_ALIGNX struct mtp_container_command con_command; - USB_MEM_ALIGNX struct mtp_container_data con_data; - USB_MEM_ALIGNX struct mtp_container_response con_response; - enum Stage stage; - uint8_t session_state; - uint32_t response_code; -} g_usbd_mtp; - -/* Max USB packet size */ -#ifndef CONFIG_USB_HS -#define MTP_BULK_EP_MPS 64 -#else -#define MTP_BULK_EP_MPS 512 -#endif - -#define MTP_OUT_EP_IDX 0 -#define MTP_IN_EP_IDX 1 -#define MTP_INT_EP_IDX 2 - -/* Describe EndPoints configuration */ -static struct usbd_endpoint mtp_ep_data[3]; - -static int mtp_class_interface_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - USB_LOG_DBG("MTP Class request: " - "bRequest 0x%02x\r\n", - setup->bRequest); - - switch (setup->bRequest) { - case MTP_REQUEST_CANCEL: - - break; - case MTP_REQUEST_GET_EXT_EVENT_DATA: - - break; - case MTP_REQUEST_RESET: - - break; - case MTP_REQUEST_GET_DEVICE_STATUS: - - break; - - default: - USB_LOG_WRN("Unhandled MTP Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - - return 0; -} - -static void usbd_mtp_send_response(uint32_t code) -{ - USB_LOG_DBG("Send response\r\n"); - - g_usbd_mtp.stage = MTP_WAIT_RESPONSE; - - g_usbd_mtp.con_response.conlen = 12; - g_usbd_mtp.con_response.contype = MTP_CONTAINER_TYPE_RESPONSE; - g_usbd_mtp.con_response.code = code; - g_usbd_mtp.con_response.trans_id = g_usbd_mtp.con_command.trans_id; - - usbd_ep_start_write(mtp_ep_data[MTP_IN_EP_IDX].ep_addr, (uint8_t *)&g_usbd_mtp.con_response, 12); -} - -static void usbd_mtp_send_info(uint8_t *data, uint32_t len) -{ - USB_LOG_DBG("Send info\r\n"); - - g_usbd_mtp.stage = MTP_SEND_RESPONSE; - - g_usbd_mtp.con_data.conlen = 12 + len; - g_usbd_mtp.con_data.contype = MTP_CONTAINER_TYPE_DATA; - g_usbd_mtp.con_data.code = MTP_RESPONSE_OK; - g_usbd_mtp.con_data.trans_id = g_usbd_mtp.con_command.trans_id; - - memcpy(g_usbd_mtp.con_data.data, data, len); - usbd_ep_start_write(mtp_ep_data[MTP_IN_EP_IDX].ep_addr, (uint8_t *)&g_usbd_mtp.con_data, 12 + len); -} - -static void usbd_mtp_get_device_info(void) -{ - struct mtp_device_info device_info; - uint16_t i; - - device_info.StandardVersion = 100; - device_info.VendorExtensionID = 0x06; - device_info.VendorExtensionVersion = 100; - device_info.VendorExtensionDesc_len = (uint8_t)CONFIG_MTP_VEND_EXT_DESC_LEN; - - for (i = 0; i < CONFIG_MTP_VEND_EXT_DESC_LEN; i++) { - device_info.VendorExtensionDesc[i] = VendExtDesc[i]; - } - - /* device supports one mode , standard mode */ - device_info.FunctionalMode = 0x0000; - - /* All supported operation */ - device_info.OperationsSupported_len = CONFIG_MTP_SUPP_OP_LEN; - for (i = 0U; i < CONFIG_MTP_SUPP_OP_LEN; i++) { - device_info.OperationsSupported[i] = SuppOP[i]; - } - - /* event that are currently generated by the device*/ - device_info.EventsSupported_len = CONFIG_MTP_SUPP_EVENTS_LEN; - - for (i = 0U; i < CONFIG_MTP_SUPP_EVENTS_LEN; i++) { - device_info.EventsSupported[i] = SuppEvents[i]; - } - - device_info.DevicePropertiesSupported_len = CONFIG_MTP_SUPP_DEVICE_PROP_LEN; - - for (i = 0U; i < CONFIG_MTP_SUPP_DEVICE_PROP_LEN; i++) { - device_info.DevicePropertiesSupported[i] = DevicePropSupp[i]; - } - - device_info.CaptureFormats_len = CONFIG_MTP_SUPP_CAPT_FORMAT_LEN; - - for (i = 0U; i < CONFIG_MTP_SUPP_CAPT_FORMAT_LEN; i++) { - device_info.CaptureFormats[i] = SuppCaptFormat[i]; - } - - device_info.ImageFormats_len = CONFIG_MTP_SUPP_IMG_FORMAT_LEN; /* number of image formats that are supported by the device*/ - for (i = 0U; i < CONFIG_MTP_SUPP_IMG_FORMAT_LEN; i++) { - device_info.ImageFormats[i] = SuppImgFormat[i]; - } - - device_info.Manufacturer_len = (uint8_t)CONFIG_MTP_MANUF_LEN; - for (i = 0U; i < CONFIG_MTP_MANUF_LEN; i++) { - device_info.Manufacturer[i] = Manuf[i]; - } - - device_info.Model_len = (uint8_t)CONFIG_MTP_MODEL_LEN; - for (i = 0U; i < CONFIG_MTP_MODEL_LEN; i++) { - device_info.Model[i] = Model[i]; - } - - device_info.DeviceVersion_len = (uint8_t)CONFIG_MTP_DEVICE_VERSION_LEN; - for (i = 0U; i < CONFIG_MTP_DEVICE_VERSION_LEN; i++) { - device_info.DeviceVersion[i] = DeviceVers[i]; - } - - device_info.SerialNumber_len = (uint8_t)CONFIG_MTP_SERIAL_NBR_LEN; - for (i = 0U; i < CONFIG_MTP_SERIAL_NBR_LEN; i++) { - device_info.SerialNumber[i] = SerialNbr[i]; - } - - usbd_mtp_send_info((uint8_t *)&device_info, sizeof(struct mtp_device_info)); -} - -static void usbd_mtp_open_session(void) -{ - usbd_mtp_send_response(MTP_RESPONSE_OK); -} - -static void usbd_mtp_get_storage_ids(void) -{ - struct mtp_storage_id storage_id; - - storage_id.StorageIDS_len = CONFIG_MTP_STORAGE_ID_LEN; - storage_id.StorageIDS[0] = MTP_STORAGE_ID; - - usbd_mtp_send_info((uint8_t *)&storage_id, sizeof(struct mtp_storage_id)); -} - -static void usbd_mtp_get_storage_info(void) -{ - struct mtp_storage_info storage_info; - - storage_info.StorageType = MTP_STORAGE_REMOVABLE_RAM; - storage_info.FilesystemType = MTP_FILESYSTEM_GENERIC_FLAT; - storage_info.AccessCapability = MTP_ACCESS_CAP_RW; - storage_info.MaxCapability = 0x0080DFA81A000000; // todo - storage_info.FreeSpaceInBytes = 0x00007EEB0D000000; // todo - storage_info.FreeSpaceInObjects = 0xFFFFFFFFU; /* not used */ - storage_info.StorageDescription = 0U; - storage_info.VolumeLabel = 0U; - - usbd_mtp_send_info((uint8_t *)&storage_info, sizeof(struct mtp_storage_info)); -} - -static void usbd_mtp_get_object_handles(void) -{ - struct mtp_object_handle object_handle; - - // todo - - usbd_mtp_send_info((uint8_t *)&object_handle, sizeof(struct mtp_object_handle)); -} - -static void usbd_mtp_get_object_info(void) -{ - struct mtp_object_info object_info; - - object_info.Storage_id = MTP_STORAGE_ID; - object_info.ObjectFormat = 0; // todo - object_info.ObjectCompressedSize = 0; //todo - object_info.ProtectionStatus = 0U; - object_info.ThumbFormat = MTP_OBJ_FORMAT_UNDEFINED; - object_info.ThumbCompressedSize = 0U; - object_info.ThumbPixWidth = 0U; /* not supported or not an image */ - object_info.ThumbPixHeight = 0U; - object_info.ImagePixWidth = 0U; - object_info.ImagePixHeight = 0U; - object_info.ImageBitDepth = 0U; - object_info.ParentObject = 0; // todo - object_info.AssociationType = 0U; - object_info.AssociationDesc = 0U; - object_info.SequenceNumber = 0U; - - /* we have to get this value before object_info.Filename */ - object_info.Filename_len = sizeof(DefaultFileName); - memcpy(object_info.Filename, DefaultFileName, (uint32_t)object_info.Filename_len + 1U); - - object_info.CaptureDate = 0U; - object_info.ModificationDate = 0U; - object_info.Keywords = 0U; - - usbd_mtp_send_info((uint8_t *)&object_info, sizeof(struct mtp_object_info)); -} - -static void usbd_mtp_get_object_prop_desc(void) -{ - struct mtp_object_prop_desc object_prop_desc; - - uint16_t undef_format = MTP_OBJ_FORMAT_UNDEFINED; - uint32_t storageid = MTP_STORAGE_ID; - - switch (g_usbd_mtp.con_command.param1) /* switch obj prop code */ - { - case MTP_OB_PROP_OBJECT_FORMAT: - object_prop_desc.ObjectPropertyCode = (uint16_t)(g_usbd_mtp.con_command.param1); - object_prop_desc.DataType = MTP_DATATYPE_UINT16; - object_prop_desc.GetSet = MTP_PROP_GET; - object_prop_desc.DefValue = (uint8_t *)&undef_format; - object_prop_desc.GroupCode = 0U; - object_prop_desc.FormFlag = 0U; - break; - - case MTP_OB_PROP_STORAGE_ID: - object_prop_desc.ObjectPropertyCode = (uint16_t)(g_usbd_mtp.con_command.param1); - object_prop_desc.DataType = MTP_DATATYPE_UINT32; - object_prop_desc.GetSet = MTP_PROP_GET; - object_prop_desc.DefValue = (uint8_t *)&storageid; - object_prop_desc.GroupCode = 0U; - object_prop_desc.FormFlag = 0U; - break; - - case MTP_OB_PROP_OBJ_FILE_NAME: - object_prop_desc.ObjectPropertyCode = (uint16_t)(g_usbd_mtp.con_command.param1); - object_prop_desc.DataType = MTP_DATATYPE_STR; - object_prop_desc.GetSet = MTP_PROP_GET; - object_prop_desc.DefValue = 0U; - object_prop_desc.GroupCode = 0U; - object_prop_desc.FormFlag = 0U; - break; - - case MTP_OB_PROP_PARENT_OBJECT: - object_prop_desc.ObjectPropertyCode = (uint16_t)(g_usbd_mtp.con_command.param1); - object_prop_desc.DataType = MTP_DATATYPE_STR; - object_prop_desc.GetSet = MTP_PROP_GET; - object_prop_desc.DefValue = 0U; - object_prop_desc.GroupCode = 0U; - object_prop_desc.FormFlag = 0U; - break; - - case MTP_OB_PROP_OBJECT_SIZE: - object_prop_desc.ObjectPropertyCode = (uint16_t)(g_usbd_mtp.con_command.param1); - object_prop_desc.DataType = MTP_DATATYPE_UINT64; - object_prop_desc.GetSet = MTP_PROP_GET; - object_prop_desc.DefValue = 0U; - object_prop_desc.GroupCode = 0U; - object_prop_desc.FormFlag = 0U; - break; - - case MTP_OB_PROP_NAME: - object_prop_desc.ObjectPropertyCode = (uint16_t)(g_usbd_mtp.con_command.param1); - object_prop_desc.DataType = MTP_DATATYPE_STR; - object_prop_desc.GetSet = MTP_PROP_GET; - object_prop_desc.DefValue = NULL; - object_prop_desc.GroupCode = 0U; - object_prop_desc.FormFlag = 0U; - break; - - case MTP_OB_PROP_PERS_UNIQ_OBJ_IDEN: - object_prop_desc.ObjectPropertyCode = (uint16_t)(g_usbd_mtp.con_command.param1); - object_prop_desc.DataType = MTP_DATATYPE_UINT128; - object_prop_desc.GetSet = MTP_PROP_GET; - object_prop_desc.DefValue = 0U; - object_prop_desc.GroupCode = 0U; - object_prop_desc.FormFlag = 0U; - break; - - case MTP_OB_PROP_PROTECTION_STATUS: - object_prop_desc.ObjectPropertyCode = (uint16_t)(g_usbd_mtp.con_command.param1); - object_prop_desc.DataType = MTP_DATATYPE_UINT16; - object_prop_desc.GetSet = MTP_PROP_GET_SET; - object_prop_desc.DefValue = 0U; - object_prop_desc.GroupCode = 0U; - object_prop_desc.FormFlag = 0U; - break; - - default: - break; - } - // todo - usbd_mtp_send_info((uint8_t *)&object_prop_desc, sizeof(struct mtp_object_prop_desc)); -} - -static void usbd_mtp_get_object_props_supported(void) -{ - struct mtp_object_props_support object_props_support; - uint32_t i; - - object_props_support.ObjectPropCode_len = CONFIG_MTP_SUPP_OBJ_PROP_LEN; - - for (i = 0U; i < CONFIG_MTP_SUPP_OBJ_PROP_LEN; i++) { - object_props_support.ObjectPropCode[i] = ObjectPropCode[i]; - } - usbd_mtp_send_info((uint8_t *)&object_props_support, sizeof(struct mtp_object_props_support)); -} - -static void usbd_mtp_get_object_prop_list(void) -{ - struct mtp_object_prop_list object_prop_list; - - uint16_t filename[255]; - uint32_t storageid = MTP_STORAGE_ID; - uint32_t default_val = 0U; - uint32_t i; - uint16_t format; - uint64_t objsize; - uint32_t parent_proval; - - object_prop_list.Properties_len = CONFIG_MTP_SUPP_OBJ_PROP_LEN; - - for (i = 0U; i < CONFIG_MTP_SUPP_OBJ_PROP_LEN; i++) { - object_prop_list.Properties[i].ObjectHandle = g_usbd_mtp.con_command.param1; - - switch (ObjectPropCode[i]) { - case MTP_OB_PROP_STORAGE_ID: - object_prop_list.Properties[i].PropertyCode = MTP_OB_PROP_STORAGE_ID; - object_prop_list.Properties[i].Datatype = MTP_DATATYPE_UINT32; - object_prop_list.Properties[i].propval = (uint8_t *)&storageid; - break; - - case MTP_OB_PROP_OBJECT_FORMAT: - object_prop_list.Properties[i].PropertyCode = MTP_OB_PROP_OBJECT_FORMAT; - object_prop_list.Properties[i].Datatype = MTP_DATATYPE_UINT16; - object_prop_list.Properties[i].propval = (uint8_t *)&format; - break; - - case MTP_OB_PROP_OBJ_FILE_NAME: - object_prop_list.Properties[i].PropertyCode = MTP_OB_PROP_OBJ_FILE_NAME; - object_prop_list.Properties[i].Datatype = MTP_DATATYPE_STR; - object_prop_list.Properties[i].propval = NULL; - break; - - case MTP_OB_PROP_PARENT_OBJECT: - object_prop_list.Properties[i].PropertyCode = MTP_OB_PROP_PARENT_OBJECT; - object_prop_list.Properties[i].Datatype = MTP_DATATYPE_UINT32; - object_prop_list.Properties[i].propval = (uint8_t *)&parent_proval; - break; - - case MTP_OB_PROP_OBJECT_SIZE: - object_prop_list.Properties[i].PropertyCode = MTP_OB_PROP_OBJECT_SIZE; - object_prop_list.Properties[i].Datatype = MTP_DATATYPE_UINT64; - object_prop_list.Properties[i].propval = (uint8_t *)&objsize; - break; - - case MTP_OB_PROP_NAME: - object_prop_list.Properties[i].PropertyCode = MTP_OB_PROP_NAME; - object_prop_list.Properties[i].Datatype = MTP_DATATYPE_STR; - object_prop_list.Properties[i].propval = NULL; - break; - - case MTP_OB_PROP_PERS_UNIQ_OBJ_IDEN: - object_prop_list.Properties[i].PropertyCode = MTP_OB_PROP_PERS_UNIQ_OBJ_IDEN; - object_prop_list.Properties[i].Datatype = MTP_DATATYPE_UINT128; - object_prop_list.Properties[i].propval = (uint8_t *)&g_usbd_mtp.con_command.param1; - break; - - case MTP_OB_PROP_PROTECTION_STATUS: - object_prop_list.Properties[i].PropertyCode = MTP_OB_PROP_PROTECTION_STATUS; - object_prop_list.Properties[i].Datatype = MTP_DATATYPE_UINT16; - object_prop_list.Properties[i].propval = (uint8_t *)&default_val; - break; - - default: - break; - } - } - // todo - usbd_mtp_send_info((uint8_t *)&object_prop_list, sizeof(struct mtp_object_prop_list)); -} - -static void usbd_mtp_get_device_prop_desc(void) -{ - struct mtp_device_prop_desc device_prop_desc; - uint32_t i; - - device_prop_desc.DevicePropertyCode = MTP_DEV_PROP_DEVICE_FRIENDLY_NAME; - device_prop_desc.DataType = MTP_DATATYPE_STR; - device_prop_desc.GetSet = MTP_PROP_GET_SET; - device_prop_desc.DefaultValue_len = CONFIG_MTP_DEVICE_PROP_DESC_DEF_LEN; - - for (i = 0U; i < (sizeof(DevicePropDefVal) / 2U); i++) { - device_prop_desc.DefaultValue[i] = DevicePropDefVal[i]; - } - - device_prop_desc.CurrentValue_len = CONFIG_MTP_DEVICE_PROP_DESC_CUR_LEN; - - for (i = 0U; i < (sizeof(DevicePropCurDefVal) / 2U); i++) { - device_prop_desc.CurrentValue[i] = DevicePropCurDefVal[i]; - } - - device_prop_desc.FormFlag = 0U; - - usbd_mtp_send_info((uint8_t *)&device_prop_desc, sizeof(struct mtp_device_prop_desc)); -} - -static int usbd_mtp_decode_command(struct mtp_container_command *command) -{ - printf("code:%04x\r\n", command->code); - switch (command->code) { - case MTP_OP_GET_DEVICE_INFO: - usbd_mtp_get_device_info(); - break; - case MTP_OP_OPEN_SESSION: - usbd_mtp_open_session(); - break; - case MTP_OP_CLOSE_SESSION: - break; - case MTP_OP_GET_STORAGE_IDS: - usbd_mtp_get_storage_ids(); - break; - case MTP_OP_GET_STORAGE_INFO: - usbd_mtp_get_storage_info(); - break; - case MTP_OP_GET_OBJECT_HANDLES: - usbd_mtp_get_object_handles(); - break; - case MTP_OP_GET_OBJECT_INFO: - usbd_mtp_get_object_info(); - break; - case MTP_OP_GET_OBJECT_PROP_REFERENCES: - break; - case MTP_OP_GET_OBJECT_PROPS_SUPPORTED: - usbd_mtp_get_object_props_supported(); - break; - case MTP_OP_GET_OBJECT_PROP_DESC: - usbd_mtp_get_object_prop_desc(); - break; - case MTP_OP_GET_OBJECT_PROPLIST: - usbd_mtp_get_object_prop_list(); - break; - case MTP_OP_GET_OBJECT_PROP_VALUE: - break; - case MTP_OP_GET_DEVICE_PROP_DESC: - usbd_mtp_get_device_prop_desc(); - break; - case MTP_OP_GET_OBJECT: - break; - case MTP_OP_SEND_OBJECT_INFO: - break; - case MTP_OP_SEND_OBJECT: - break; - case MTP_OP_DELETE_OBJECT: - break; - - default: - break; - } - return 0; -} - -static void usbd_mtp_bulk_out(uint8_t ep, uint32_t nbytes) -{ - switch (g_usbd_mtp.stage) { - case MTP_READ_COMMAND: - usbd_mtp_decode_command(&g_usbd_mtp.con_command); - break; - case MTP_DATA_OUT: - break; - default: - break; - } -} - -static void usbd_mtp_bulk_in(uint8_t ep, uint32_t nbytes) -{ - printf("send:%d\r\n", nbytes); - switch (g_usbd_mtp.stage) { - case MTP_DATA_IN: - break; - case MTP_SEND_RESPONSE: - usbd_mtp_send_response(MTP_RESPONSE_OK); - break; - case MTP_WAIT_RESPONSE: - USB_LOG_DBG("Start reading command\r\n"); - g_usbd_mtp.stage = MTP_READ_COMMAND; - usbd_ep_start_read(mtp_ep_data[MTP_OUT_EP_IDX].ep_addr, (uint8_t *)&g_usbd_mtp.con_command, MTP_BULK_EP_MPS); - break; - - default: - break; - } -} - -static void mtp_notify_handler(uint8_t event, void *arg) -{ - switch (event) { - case USBD_EVENT_RESET: - break; - case USBD_EVENT_CONFIGURED: - USB_LOG_DBG("Start reading command\r\n"); - g_usbd_mtp.stage = MTP_READ_COMMAND; - usbd_ep_start_read(mtp_ep_data[MTP_OUT_EP_IDX].ep_addr, (uint8_t *)&g_usbd_mtp.con_command, MTP_BULK_EP_MPS); - break; - - default: - break; - } -} - -struct usbd_interface *usbd_mtp_init_intf(struct usbd_interface *intf, - const uint8_t out_ep, - const uint8_t in_ep, - const uint8_t int_ep) -{ - intf->class_interface_handler = mtp_class_interface_request_handler; - intf->class_endpoint_handler = NULL; - intf->vendor_handler = NULL; - intf->notify_handler = mtp_notify_handler; - - mtp_ep_data[MTP_OUT_EP_IDX].ep_addr = out_ep; - mtp_ep_data[MTP_OUT_EP_IDX].ep_cb = usbd_mtp_bulk_out; - mtp_ep_data[MTP_IN_EP_IDX].ep_addr = in_ep; - mtp_ep_data[MTP_IN_EP_IDX].ep_cb = usbd_mtp_bulk_in; - mtp_ep_data[MTP_INT_EP_IDX].ep_addr = int_ep; - mtp_ep_data[MTP_INT_EP_IDX].ep_cb = NULL; - - usbd_add_endpoint(&mtp_ep_data[MTP_OUT_EP_IDX]); - usbd_add_endpoint(&mtp_ep_data[MTP_IN_EP_IDX]); - usbd_add_endpoint(&mtp_ep_data[MTP_INT_EP_IDX]); - - return intf; -} \ No newline at end of file diff --git a/third-party/cherryusb/class/mtp/usbd_mtp.h b/third-party/cherryusb/class/mtp/usbd_mtp.h deleted file mode 100644 index 2e1854d2eaad39f91122a38088c7c6d0c180e205..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/mtp/usbd_mtp.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBD_MTP_H -#define USBD_MTP_H - -#include "usb_mtp.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct usbd_interface *usbd_mtp_init_intf(struct usbd_interface *intf, - const uint8_t out_ep, - const uint8_t in_ep, - const uint8_t int_ep); - -#ifdef __cplusplus -} -#endif - -#endif /* USBD_MTP_H */ diff --git a/third-party/cherryusb/class/mtp/usbd_mtp_config.h b/third-party/cherryusb/class/mtp/usbd_mtp_config.h deleted file mode 100644 index 6c5e6eaf1033b20afe95c1e9a1bb4674ee2bda7d..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/mtp/usbd_mtp_config.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_MTP_CONFIG_H -#define USB_MTP_CONFIG_H - -#include "usb_mtp.h" - -static const uint16_t VendExtDesc[] = { 'm', 'i', 'c', 'r', 'o', 's', 'o', 'f', 't', '.', 'c', 'o', 'm', ':', ' ', '1', '.', '0', ';', ' ', 0 }; /* last 2 bytes must be 0*/ - -static const uint16_t SuppOP[] = { MTP_OP_GET_DEVICE_INFO, MTP_OP_OPEN_SESSION, MTP_OP_CLOSE_SESSION, - MTP_OP_GET_STORAGE_IDS, MTP_OP_GET_STORAGE_INFO, MTP_OP_GET_NUM_OBJECTS, - MTP_OP_GET_OBJECT_HANDLES, MTP_OP_GET_OBJECT_INFO, MTP_OP_GET_OBJECT, - MTP_OP_DELETE_OBJECT, MTP_OP_SEND_OBJECT_INFO, MTP_OP_SEND_OBJECT, - MTP_OP_GET_DEVICE_PROP_DESC, MTP_OP_GET_DEVICE_PROP_VALUE, - MTP_OP_SET_OBJECT_PROP_VALUE, MTP_OP_GET_OBJECT_PROP_VALUE, - MTP_OP_GET_OBJECT_PROPS_SUPPORTED, MTP_OP_GET_OBJECT_PROPLIST, - MTP_OP_GET_OBJECT_PROP_DESC, MTP_OP_GET_OBJECT_PROP_REFERENCES }; - -static const uint16_t SuppEvents[] = { MTP_EVENT_OBJECTADDED }; - -static const uint16_t DevicePropSupp[] = { MTP_DEV_PROP_DEVICE_FRIENDLY_NAME, MTP_DEV_PROP_BATTERY_LEVEL }; - -static const uint16_t SuppCaptFormat[] = { MTP_OBJ_FORMAT_UNDEFINED, MTP_OBJ_FORMAT_ASSOCIATION, MTP_OBJ_FORMAT_TEXT }; - -static const uint16_t SuppImgFormat[] = { MTP_OBJ_FORMAT_UNDEFINED, MTP_OBJ_FORMAT_TEXT, MTP_OBJ_FORMAT_ASSOCIATION, - MTP_OBJ_FORMAT_EXECUTABLE, MTP_OBJ_FORMAT_WAV, MTP_OBJ_FORMAT_MP3, - MTP_OBJ_FORMAT_EXIF_JPEG, MTP_OBJ_FORMAT_MPEG, MTP_OBJ_FORMAT_MP4_CONTAINER, - MTP_OBJ_FORMAT_WINDOWS_IMAGE_FORMAT, MTP_OBJ_FORMAT_PNG, MTP_OBJ_FORMAT_WMA, - MTP_OBJ_FORMAT_WMV }; - -static const uint16_t Manuf[] = { 'C', 'h', 'e', 'r', 'r', 'y', 'U', 'S', 'B', 0 }; /* last 2 bytes must be 0*/ -static const uint16_t Model[] = { 'C', 'h', 'e', 'r', 'r', 'y', 'U', 'S', 'B', 0 }; /* last 2 bytes must be 0*/ -static const uint16_t DeviceVers[] = { 'V', '1', '.', '0', '0', 0 }; /* last 2 bytes must be 0*/ -/*SerialNbr shall be 32 character hexadecimal string for legacy compatibility reasons */ -static const uint16_t SerialNbr[] = { '0', '0', '0', '0', '1', '0', '0', '0', '0', '1', '0', '0', '0', '0', - '1', '0', '0', '0', '0', '1', '0', '0', '0', '0', '1', '0', '0', '0', - '0', '1', '0', '0', 0 }; /* last 2 bytes must be 0*/ - -static const uint16_t DefaultFileName[] = { 'N', 'e', 'w', ' ', 'F', 'o', 'l', 'd', 'e', 'r', 0 }; - -static const uint16_t DevicePropDefVal[] = { 'C', 'h', 'e', 'r', 'r', 'y', 'U', 'S', 'B', 0 }; /* last 2 bytes must be 0*/ -static const uint16_t DevicePropCurDefVal[] = { 'C', 'h', 'e', 'r', 'r', 'y', 'U', 'S', 'B', 0 }; - -/* required for all object format : storageID, objectFormat, ObjectCompressedSize, -persistent unique object identifier, name*/ -static const uint16_t ObjectPropCode[] = { MTP_OB_PROP_STORAGE_ID, MTP_OB_PROP_OBJECT_FORMAT, MTP_OB_PROP_OBJECT_SIZE, - MTP_OB_PROP_OBJ_FILE_NAME, MTP_OB_PROP_PARENT_OBJECT, MTP_OB_PROP_NAME, - MTP_OB_PROP_PERS_UNIQ_OBJ_IDEN, MTP_OB_PROP_PROTECTION_STATUS }; - -#define MTP_STORAGE_ID 0x00010001U /* SD card is inserted*/ - -#define CONFIG_MTP_VEND_EXT_DESC_LEN (sizeof(VendExtDesc) / 2U) -#define CONFIG_MTP_SUPP_OP_LEN (sizeof(SuppOP) / 2U) -#define CONFIG_MTP_SUPP_EVENTS_LEN (sizeof(SuppEvents) / 2U) -#define CONFIG_MTP_SUPP_DEVICE_PROP_LEN (sizeof(DevicePropSupp) / 2U) -#define CONFIG_MTP_SUPP_CAPT_FORMAT_LEN (sizeof(SuppCaptFormat) / 2U) -#define CONFIG_MTP_SUPP_IMG_FORMAT_LEN (sizeof(SuppImgFormat) / 2U) -#define CONFIG_MTP_MANUF_LEN (sizeof(Manuf) / 2U) -#define CONFIG_MTP_MODEL_LEN (sizeof(Model) / 2U) -#define CONFIG_MTP_DEVICE_VERSION_LEN (sizeof(DeviceVers) / 2U) -#define CONFIG_MTP_SERIAL_NBR_LEN (sizeof(SerialNbr) / 2U) -#define CONFIG_MTP_SUPP_OBJ_PROP_LEN (sizeof(ObjectPropCode) / 2U) -#define CONFIG_MTP_DEVICE_PROP_DESC_DEF_LEN (sizeof(DevicePropDefVal) / 2U) -#define CONFIG_MTP_DEVICE_PROP_DESC_CUR_LEN (sizeof(DevicePropCurDefVal) / 2U) -#define CONFIG_MTP_STORAGE_ID_LEN 1 -#define CONFIG_MTP_OBJECT_HANDLE_LEN 100 - -struct mtp_device_info { - uint16_t StandardVersion; - uint32_t VendorExtensionID; - uint16_t VendorExtensionVersion; - uint8_t VendorExtensionDesc_len; - uint16_t VendorExtensionDesc[CONFIG_MTP_VEND_EXT_DESC_LEN]; - uint16_t FunctionalMode; - uint32_t OperationsSupported_len; - uint16_t OperationsSupported[CONFIG_MTP_SUPP_OP_LEN]; - uint32_t EventsSupported_len; - uint16_t EventsSupported[CONFIG_MTP_SUPP_EVENTS_LEN]; - uint32_t DevicePropertiesSupported_len; - uint16_t DevicePropertiesSupported[CONFIG_MTP_SUPP_DEVICE_PROP_LEN]; - uint32_t CaptureFormats_len; - uint16_t CaptureFormats[CONFIG_MTP_SUPP_CAPT_FORMAT_LEN]; - uint32_t ImageFormats_len; - uint16_t ImageFormats[CONFIG_MTP_SUPP_IMG_FORMAT_LEN]; - uint8_t Manufacturer_len; - uint16_t Manufacturer[CONFIG_MTP_MANUF_LEN]; - uint8_t Model_len; - uint16_t Model[CONFIG_MTP_MODEL_LEN]; - uint8_t DeviceVersion_len; - uint16_t DeviceVersion[CONFIG_MTP_DEVICE_VERSION_LEN]; - uint8_t SerialNumber_len; - uint16_t SerialNumber[CONFIG_MTP_SERIAL_NBR_LEN]; -} __PACKED; - -struct mtp_object_props_support { - uint32_t ObjectPropCode_len; - uint16_t ObjectPropCode[CONFIG_MTP_SUPP_OBJ_PROP_LEN]; -} __PACKED; - -struct mtp_device_prop_desc { - uint16_t DevicePropertyCode; - uint16_t DataType; - uint8_t GetSet; - uint8_t DefaultValue_len; - uint16_t DefaultValue[CONFIG_MTP_DEVICE_PROP_DESC_DEF_LEN]; - uint8_t CurrentValue_len; - uint16_t CurrentValue[CONFIG_MTP_DEVICE_PROP_DESC_CUR_LEN]; - uint8_t FormFlag; -} __PACKED; - -struct mtp_storage_id { - uint32_t StorageIDS_len; - uint32_t StorageIDS[CONFIG_MTP_STORAGE_ID_LEN]; -} __PACKED; - -struct mtp_storage_info { - uint16_t StorageType; - uint16_t FilesystemType; - uint16_t AccessCapability; - uint64_t MaxCapability; - uint64_t FreeSpaceInBytes; - uint32_t FreeSpaceInObjects; - uint8_t StorageDescription; - uint8_t VolumeLabel; -} __PACKED; - -struct mtp_object_handle { - uint32_t ObjectHandle_len; - uint32_t ObjectHandle[CONFIG_MTP_OBJECT_HANDLE_LEN]; -} __PACKED; - -struct mtp_object_info { - uint32_t Storage_id; - uint16_t ObjectFormat; - uint16_t ProtectionStatus; - uint32_t ObjectCompressedSize; - uint16_t ThumbFormat; - uint32_t ThumbCompressedSize; - uint32_t ThumbPixWidth; - uint32_t ThumbPixHeight; - uint32_t ImagePixWidth; - uint32_t ImagePixHeight; - uint32_t ImageBitDepth; - uint32_t ParentObject; - uint16_t AssociationType; - uint32_t AssociationDesc; - uint32_t SequenceNumber; - uint8_t Filename_len; - uint16_t Filename[255]; - uint32_t CaptureDate; - uint32_t ModificationDate; - uint8_t Keywords; -} __PACKED; - -struct mtp_object_prop_desc { - uint16_t ObjectPropertyCode; - uint16_t DataType; - uint8_t GetSet; - uint8_t *DefValue; - uint32_t GroupCode; - uint8_t FormFlag; -} __PACKED; - -struct mtp_object_prop_element { - uint32_t ObjectHandle; - uint16_t PropertyCode; - uint16_t Datatype; - uint8_t *propval; -} __PACKED; - -struct mtp_object_prop_list { - uint32_t Properties_len; - struct mtp_object_prop_element Properties[CONFIG_MTP_SUPP_OBJ_PROP_LEN]; -} __PACKED; - -#endif /* USB_MTP_CONFIG_H */ \ No newline at end of file diff --git a/third-party/cherryusb/class/mtp/usbh_mtp.c b/third-party/cherryusb/class/mtp/usbh_mtp.c deleted file mode 100644 index 98c02a8b333d3aee82d811f20589fd50b2ae36e5..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/mtp/usbh_mtp.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbh_core.h" -#include "usbh_mtp.h" - -#define DEV_FORMAT "/dev/mtp" - -static int usbh_mtp_connect(struct usbh_hubport *hport, uint8_t intf) -{ - struct usbh_endpoint_cfg ep_cfg = { 0 }; - struct usb_endpoint_descriptor *ep_desc; - int ret; - - struct usbh_mtp *mtp_class = usb_malloc(sizeof(struct usbh_mtp)); - if (mtp_class == NULL) { - USB_LOG_ERR("Fail to alloc mtp_class\r\n"); - return -ENOMEM; - } - - memset(mtp_class, 0, sizeof(struct usbh_mtp)); - - mtp_class->hport = hport; - mtp_class->ctrl_intf = intf; - mtp_class->data_intf = intf + 1; - - hport->config.intf[intf].priv = mtp_class; - hport->config.intf[intf + 1].priv = NULL; - strncpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); - -#ifdef CONFIG_USBHOST_MTP_NOTIFY - ep_desc = &hport->config.intf[intf].ep[0].ep_desc; - ep_cfg.ep_addr = ep_desc->bEndpointAddress; - ep_cfg.ep_type = ep_desc->bmAttributes & USB_ENDPOINT_TYPE_MASK; - ep_cfg.ep_mps = ep_desc->wMaxPacketSize; - ep_cfg.ep_interval = ep_desc->bInterval; - ep_cfg.hport = hport; - usbh_pipe_alloc(&mtp_class->intin, &ep_cfg); - -#endif - for (uint8_t i = 0; i < hport->config.intf[intf + 1].intf_desc.bNumEndpoints; i++) { - ep_desc = &hport->config.intf[intf + 1].ep[i].ep_desc; - - ep_cfg.ep_addr = ep_desc->bEndpointAddress; - ep_cfg.ep_type = ep_desc->bmAttributes & USB_ENDPOINT_TYPE_MASK; - ep_cfg.ep_mps = ep_desc->wMaxPacketSize & USB_MAXPACKETSIZE_MASK;; - ep_cfg.ep_interval = ep_desc->bInterval; - ep_cfg.hport = hport; - if (ep_desc->bEndpointAddress & 0x80) { - usbh_pipe_alloc(&mtp_class->bulkin, &ep_cfg); - } else { - usbh_pipe_alloc(&mtp_class->bulkout, &ep_cfg); - } - } - - strncpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); - - USB_LOG_INFO("Register MTP Class:%s\r\n", hport->config.intf[intf].devname); - - return ret; -} - -static int usbh_mtp_disconnect(struct usbh_hubport *hport, uint8_t intf) -{ - int ret = 0; - - struct usbh_mtp *mtp_class = (struct usbh_mtp *)hport->config.intf[intf].priv; - - if (mtp_class) { - if (mtp_class->bulkin) { - usbh_pipe_free(mtp_class->bulkin); - } - - if (mtp_class->bulkout) { - usbh_pipe_free(mtp_class->bulkout); - } - - usb_free(mtp_class); - - if (hport->config.intf[intf].devname[0] != '\0') - USB_LOG_INFO("Unregister MTP Class:%s\r\n", hport->config.intf[intf].devname); - - memset(hport->config.intf[intf].devname, 0, CONFIG_USBHOST_DEV_NAMELEN); - hport->config.intf[intf].priv = NULL; - hport->config.intf[intf + 1].priv = NULL; - } - - return ret; -} - -static const struct usbh_class_driver mtp_class_driver = { - .driver_name = "mtp", - .connect = usbh_mtp_connect, - .disconnect = usbh_mtp_disconnect -}; - -CLASS_INFO_DEFINE const struct usbh_class_info mtp_class_info = { - .match_flags = USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS | USB_CLASS_MATCH_INTF_PROTOCOL, - .class = USB_MTP_CLASS, - .subclass = USB_MTP_SUB_CLASS, - .protocol = USB_MTP_PROTOCOL, - .vid = 0x00, - .pid = 0x00, - .class_driver = &mtp_class_driver -}; diff --git a/third-party/cherryusb/class/mtp/usbh_mtp.h b/third-party/cherryusb/class/mtp/usbh_mtp.h deleted file mode 100644 index 5fdf28c5ee693897c6860a471c7db95580eda1e4..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/mtp/usbh_mtp.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBH_MTP_H -#define USBH_MTP_H - -#include "usb_mtp.h" - -struct usbh_mtp { - struct usbh_hubport *hport; - - uint8_t intf; /* interface number */ - usbh_pipe_t bulkin; /* BULK IN endpoint */ - usbh_pipe_t bulkout; /* BULK OUT endpoint */ -#ifdef CONFIG_USBHOST_MTP_NOTIFY - usbh_pipe_t intin; /* Interrupt IN endpoint (optional) */ -#endif -}; - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* USBH_MTP_H */ diff --git a/third-party/cherryusb/class/printer/usb_printer.h b/third-party/cherryusb/class/printer/usb_printer.h deleted file mode 100644 index c8105c9fcf16a8097896e361fb2d8c67854aefee..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/printer/usb_printer.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_PRINTER_H -#define USB_PRINTER_H - -#define PRINTER_SUBCLASS 0x01U - -#define PRINTER_REQUEST_GET_DEVICE_ID 0x00U -#define PRINTER_REQUEST_GET_PORT_SATTUS 0x01U -#define PRINTER_REQUEST_SOFT_RESET 0x02U - -#define PRINTER_STATUS_NO_ERROR 0x00U -#define PRINTER_STATUS_SELECTED 0x08U -#define PRINTER_STATUS_PAPER_EMPTY 0x10U - -#endif /* USB_PRINTER_H */ diff --git a/third-party/cherryusb/class/printer/usbd_printer.c b/third-party/cherryusb/class/printer/usbd_printer.c deleted file mode 100644 index 586f69d16b801a69a04030658ce7dc7d5919999f..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/printer/usbd_printer.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbd_core.h" -#include "usbd_printer.h" - -struct printer_cfg_priv { - const uint8_t *device_id; - uint8_t device_id_len; - uint8_t port_status; -} usbd_printer_cfg; - -static int printer_class_interface_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - USB_LOG_DBG("Printer Class request: " - "bRequest 0x%02x\r\n", - setup->bRequest); - - switch (setup->bRequest) { - case PRINTER_REQUEST_GET_DEVICE_ID: - memcpy(*data, usbd_printer_cfg.device_id, usbd_printer_cfg.device_id_len); - *len = usbd_printer_cfg.device_id_len; - break; - case PRINTER_REQUEST_GET_PORT_SATTUS: - - break; - case PRINTER_REQUEST_SOFT_RESET: - - break; - default: - USB_LOG_WRN("Unhandled Printer Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - - return 0; -} - -static void printer_notify_handler(uint8_t event, void *arg) -{ - switch (event) { - case USBD_EVENT_RESET: - break; - - default: - break; - } -} - -struct usbd_interface *usbd_printer_init_intf(struct usbd_interface *intf, const uint8_t *device_id, uint8_t device_id_len) -{ - intf->class_interface_handler = printer_class_interface_request_handler; - intf->class_endpoint_handler = NULL; - intf->vendor_handler = NULL; - intf->notify_handler = printer_notify_handler; - - usbd_printer_cfg.device_id = device_id; - usbd_printer_cfg.device_id_len = device_id_len; - return intf; -} \ No newline at end of file diff --git a/third-party/cherryusb/class/printer/usbd_printer.h b/third-party/cherryusb/class/printer/usbd_printer.h deleted file mode 100644 index b2bbdf49e2a87fb4e97e55971ca5a4ea6f85219b..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/printer/usbd_printer.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBD_PRINTER_H -#define USBD_PRINTER_H - -#include "usb_printer.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Init printer interface driver */ -struct usbd_interface *usbd_printer_init_intf(struct usbd_interface *intf, const uint8_t *device_id, uint8_t device_id_len); - -#ifdef __cplusplus -} -#endif - -#endif /* USBD_PRINTER_H */ diff --git a/third-party/cherryusb/class/printer/usbh_printer.c b/third-party/cherryusb/class/printer/usbh_printer.c deleted file mode 100644 index 6b55b06819dcd320bbb598f6d7916f59392f435a..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/printer/usbh_printer.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbh_core.h" -#include "usbh_printer.h" - -#define DEV_FORMAT "/dev/printer" - -static int usbh_printer_get_device_id(struct usbh_printer *printer_class, uint8_t *buffer) -{ - struct usb_setup_packet *setup = &printer_class->hport->setup; - int ret; - - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = PRINTER_REQUEST_GET_DEVICE_ID; - setup->wValue = 0; - setup->wIndex = printer_class->intf; - setup->wLength = 256; - - return usbh_control_transfer(printer_class->hport->ep0, setup, buffer); -} - -static int usbh_printer_get_port_status(struct usbh_printer *printer_class, uint8_t *buffer) -{ - struct usb_setup_packet *setup = &printer_class->hport->setup; - int ret; - - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = PRINTER_REQUEST_GET_PORT_SATTUS; - setup->wValue = 0; - setup->wIndex = printer_class->intf; - setup->wLength = 1; - - return usbh_control_transfer(printer_class->hport->ep0, setup, buffer); -} - -static int usbh_printer_soft_reset(struct usbh_printer *printer_class) -{ - struct usb_setup_packet *setup = &printer_class->hport->setup; - int ret; - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = PRINTER_REQUEST_SOFT_RESET; - setup->wValue = 0; - setup->wIndex = printer_class->intf; - setup->wLength = 0; - - return usbh_control_transfer(printer_class->hport->ep0, setup, NULL); -} - -static int usbh_printer_connect(struct usbh_hubport *hport, uint8_t intf) -{ - struct usbh_endpoint_cfg ep_cfg = { 0 }; - struct usb_endpoint_descriptor *ep_desc; - int ret; - - struct usbh_printer *printer_class = usb_malloc(sizeof(struct usbh_printer)); - if (printer_class == NULL) { - USB_LOG_ERR("Fail to alloc printer_class\r\n"); - return -ENOMEM; - } - - memset(printer_class, 0, sizeof(struct usbh_printer)); - - printer_class->hport = hport; - printer_class->intf = intf; - - hport->config.intf[intf].priv = printer_class; - - for (uint8_t i = 0; i < hport->config.intf[intf + 1].intf_desc.bNumEndpoints; i++) { - ep_desc = &hport->config.intf[intf + 1].ep[i].ep_desc; - - ep_cfg.ep_addr = ep_desc->bEndpointAddress; - ep_cfg.ep_type = ep_desc->bmAttributes & USB_ENDPOINT_TYPE_MASK; - ep_cfg.ep_mps = ep_desc->wMaxPacketSize & USB_MAXPACKETSIZE_MASK; - ep_cfg.ep_interval = ep_desc->bInterval; - ep_cfg.hport = hport; - if (ep_desc->bEndpointAddress & 0x80) { - usbh_pipe_alloc(&printer_class->bulkin, &ep_cfg); - } else { - usbh_pipe_alloc(&printer_class->bulkout, &ep_cfg); - } - } - - // uint8_t *device_id = usb_iomalloc(256); - // ret = usbh_printer_get_device_id(printer_class, device_id); - strncpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); - - USB_LOG_INFO("Register Printer Class:%s\r\n", hport->config.intf[intf].devname); - - return ret; -} - -static int usbh_printer_disconnect(struct usbh_hubport *hport, uint8_t intf) -{ - int ret = 0; - - struct usbh_printer *printer_class = (struct usbh_printer *)hport->config.intf[intf].priv; - - if (printer_class) { - if (printer_class->bulkin) { - usbh_pipe_free(printer_class->bulkin); - } - - if (printer_class->bulkout) { - usbh_pipe_free(printer_class->bulkout); - } - - usb_free(printer_class); - - if (hport->config.intf[intf].devname[0] != '\0') - USB_LOG_INFO("Unregister Printer Class:%s\r\n", hport->config.intf[intf].devname); - - memset(hport->config.intf[intf].devname, 0, CONFIG_USBHOST_DEV_NAMELEN); - hport->config.intf[intf].priv = NULL; - } - - return ret; -} - -static const struct usbh_class_driver printer_class_driver = { - .driver_name = "printer", - .connect = usbh_printer_connect, - .disconnect = usbh_printer_disconnect -}; - -CLASS_INFO_DEFINE const struct usbh_class_info printer_class_info = { - .match_flags = USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS | USB_CLASS_MATCH_INTF_PROTOCOL, - .class = USB_DEVICE_CLASS_PRINTER, - .subclass = PRINTER_SUBCLASS, - .protocol = 0x00, - .vid = 0x00, - .pid = 0x00, - .class_driver = &printer_class_driver -}; diff --git a/third-party/cherryusb/class/printer/usbh_printer.h b/third-party/cherryusb/class/printer/usbh_printer.h deleted file mode 100644 index f9648a3fa22dee4fb8633ea5dad85312f027490e..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/printer/usbh_printer.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBH_PRINTER_H -#define USBH_PRINTER_H - -#include "usb_printer.h" - -struct usbh_printer { - struct usbh_hubport *hport; - - uint8_t intf; /* interface number */ - usbh_pipe_t bulkin; /* BULK IN endpoint */ - usbh_pipe_t bulkout; /* BULK OUT endpoint */ -}; - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* USBH_PRINTER_H */ diff --git a/third-party/cherryusb/class/template/usb_xxx.h b/third-party/cherryusb/class/template/usb_xxx.h deleted file mode 100644 index d883c8b2e23a4e1ca178828927ccca908bfb9a16..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/template/usb_xxx.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef _USB_XXX_H -#define _USB_XXX_H - -#endif \ No newline at end of file diff --git a/third-party/cherryusb/class/template/usbd_xxx.c b/third-party/cherryusb/class/template/usbd_xxx.c deleted file mode 100644 index f35911c55426506749ea5732bd403273b3c7e632..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/template/usbd_xxx.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "usbd_core.h" -#include "usbd_xxx.h" - -static int xxx_class_interface_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - USB_LOG_WRN("XXX Class request: " - "bRequest 0x%02x\r\n", - setup->bRequest); - - switch (setup->bRequest) { - default: - USB_LOG_WRN("Unhandled XXX Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - - return 0; -} - -static void xxx_notify_handler(uint8_t event, void *arg) -{ - switch (event) { - case USBD_EVENT_RESET: - - break; - - default: - break; - } -} - -void usbd_xxx_add_interface(usbd_class_t *devclass, usbd_interface_t *intf) -{ - intf->class_interface_handler = xxx_class_interface_request_handler; - intf->class_endpoint_handler = NULL; - intf->vendor_handler = NULL; - intf->notify_handler = xxx_notify_handler; - - usbd_class_add_interface(devclass, intf); -} diff --git a/third-party/cherryusb/class/template/usbd_xxx.h b/third-party/cherryusb/class/template/usbd_xxx.h deleted file mode 100644 index 26f4b279d37ca33cb53b1320d45f452f47798413..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/template/usbd_xxx.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _USBD_XXX_H_ -#define _USBD_XXX_H_ - -#include "usb_xxx.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void usbd_xxx_add_interface(usbd_class_t *devclass, usbd_interface_t *intf); - -#ifdef __cplusplus -} -#endif - -#endif /* _USBD_XXX_H_ */ diff --git a/third-party/cherryusb/class/template/usbh_xxx.c b/third-party/cherryusb/class/template/usbh_xxx.c deleted file mode 100644 index 4726a11788c7df5f3b11895ddd385d694ce1f4c3..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/template/usbh_xxx.c +++ /dev/null @@ -1,87 +0,0 @@ -#include "usbh_core.h" -#include "usbh_xxx.h" - -#define DEV_FORMAT "/dev/xxx" - -static int usbh_xxx_connect(struct usbh_hubport *hport, uint8_t intf) -{ - struct usbh_endpoint_cfg ep_cfg = { 0 }; - struct usb_endpoint_descriptor *ep_desc; - int ret; - - struct usbh_xxx *xxx_class = usb_malloc(sizeof(struct usbh_xxx)); - if (xxx_class == NULL) { - USB_LOG_ERR("Fail to alloc xxx_class\r\n"); - return -ENOMEM; - } - - memset(xxx_class, 0, sizeof(struct usbh_xxx)); - - xxx_class->hport = hport; - xxx_class->intf = intf; - - hport->config.intf[intf].priv = xxx_class; - strncpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); - - for (uint8_t i = 0; i < hport->config.intf[intf + 1].intf_desc.bNumEndpoints; i++) { - ep_desc = &hport->config.intf[intf + 1].ep[i].ep_desc; - - ep_cfg.ep_addr = ep_desc->bEndpointAddress; - ep_cfg.ep_type = ep_desc->bmAttributes & USB_ENDPOINT_TYPE_MASK; - ep_cfg.ep_mps = ep_desc->wMaxPacketSize; - ep_cfg.ep_interval = ep_desc->bInterval; - ep_cfg.hport = hport; - if (ep_desc->bEndpointAddress & 0x80) { - usbh_pipe_alloc(&rndis_class->bulkin, &ep_cfg); - } else { - usbh_pipe_alloc(&rndis_class->bulkout, &ep_cfg); - } - } - - return ret; - -} - - -static int usbh_xxx_disconnect(struct usbh_hubport *hport, uint8_t intf) -{ - int ret = 0; - - struct usbh_xxx *xxx_class = (struct usbh_xxx *)hport->config.intf[intf].priv; - - if (xxx_class) { - if (xxx_class->bulkin) { - usbh_pipe_free(xxx_class->bulkin); - } - - if (xxx_class->bulkout) { - usbh_pipe_free(xxx_class->bulkout); - } - - usb_free(xxx_class); - - USB_LOG_INFO("Unregister xxx Class:%s\r\n", hport->config.intf[intf].devname); - memset(hport->config.intf[intf].devname, 0, CONFIG_USBHOST_DEV_NAMELEN); - - hport->config.intf[intf].priv = NULL; - } - - return ret; -} - - -static const struct usbh_class_driver xxx_class_driver = { - .driver_name = "xxx", - .connect = usbh_xxx_connect, - .disconnect = usbh_xxx_disconnect -}; - -CLASS_INFO_DEFINE const struct usbh_class_info xxx_class_info = { - .match_flags = USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS | USB_CLASS_MATCH_INTF_PROTOCOL, - .class = 0, - .subclass = 0, - .protocol = 0, - .vid = 0x00, - .pid = 0x00, - .class_driver = &xxx_class_driver -}; diff --git a/third-party/cherryusb/class/template/usbh_xxx.h b/third-party/cherryusb/class/template/usbh_xxx.h deleted file mode 100644 index 3bcb6991925b7e340a9812ce2dc4af9887f3b4f5..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/template/usbh_xxx.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _USBH_XXX_H -#define _USBH_XXX_H - -#include "usb_xxx.h" - -struct usbh_xxx { - struct usbh_hubport *hport; - - uint8_t intf; /* interface number */ - usbh_pipe_t intin; /* INTR IN endpoint */ - usbh_pipe_t intout; /* INTR OUT endpoint */ -}; - -#endif \ No newline at end of file diff --git a/third-party/cherryusb/class/vendor/asix.h b/third-party/cherryusb/class/vendor/asix.h deleted file mode 100644 index 2d153b9bb65c41045343d217a408506430100875..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/vendor/asix.h +++ /dev/null @@ -1,596 +0,0 @@ -/* - * Change Logs - * Date Author Notes - * 2022-04-17 aozima the first version for CherryUSB. - */ - -#ifndef __LINUX_USBNET_ASIX_H -#define __LINUX_USBNET_ASIX_H - -// #define __BIG_ENDIAN_BITFIELD -#define __LITTLE_ENDIAN_BITFIELD -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; - -#define KERNEL_VERSION(...) (0) -#define LINUX_VERSION_CODE (1) - -/* - * Turn on this flag if the implementation of your USB host controller - * cannot handle non-double word aligned buffer. - * When turn on this flag, driver will fixup egress packet aligned on double - * word boundary before deliver to USB host controller. And will Disable the - * function "skb_reserve (skb, NET_IP_ALIGN)" to retain the buffer aligned on - * double word alignment for ingress packets. - */ -#define AX_FORCE_BUFF_ALIGN 0 - -//#define RX_SKB_COPY - -#define AX_MONITOR_MODE 0x01 -#define AX_MONITOR_LINK 0x02 -#define AX_MONITOR_MAGIC 0x04 -#define AX_MONITOR_HSFS 0x10 - -/* AX88172 Medium Status Register values */ -#define AX_MEDIUM_FULL_DUPLEX 0x02 -#define AX_MEDIUM_TX_ABORT_ALLOW 0x04 -#define AX_MEDIUM_FLOW_CONTROL_EN 0x10 -#define AX_MCAST_FILTER_SIZE 8 -#define AX_MAX_MCAST 64 - -#define AX_EEPROM_LEN 0x40 - -#define AX_SWRESET_CLEAR 0x00 -#define AX_SWRESET_RR 0x01 -#define AX_SWRESET_RT 0x02 -#define AX_SWRESET_PRTE 0x04 -#define AX_SWRESET_PRL 0x08 -#define AX_SWRESET_BZ 0x10 -#define AX_SWRESET_IPRL 0x20 -#define AX_SWRESET_IPPD 0x40 -#define AX_SWRESET_IPOSC 0x0080 -#define AX_SWRESET_IPPSL_0 0x0100 -#define AX_SWRESET_IPPSL_1 0x0200 -#define AX_SWRESET_IPCOPS 0x0400 -#define AX_SWRESET_IPCOPSC 0x0800 -#define AX_SWRESET_AUTODETACH 0x1000 -#define AX_SWRESET_WOLLP 0x8000 - -#define AX88772_IPG0_DEFAULT 0x15 -#define AX88772_IPG1_DEFAULT 0x0c -#define AX88772_IPG2_DEFAULT 0x0E - -#define AX88772A_IPG0_DEFAULT 0x15 -#define AX88772A_IPG1_DEFAULT 0x16 -#define AX88772A_IPG2_DEFAULT 0x1A - -#define AX88772_MEDIUM_FULL_DUPLEX 0x0002 -#define AX88772_MEDIUM_RESERVED 0x0004 -#define AX88772_MEDIUM_RX_FC_ENABLE 0x0010 -#define AX88772_MEDIUM_TX_FC_ENABLE 0x0020 -#define AX88772_MEDIUM_PAUSE_FORMAT 0x0080 -#define AX88772_MEDIUM_RX_ENABLE 0x0100 -#define AX88772_MEDIUM_100MB 0x0200 -#define AX88772_MEDIUM_DEFAULT \ - (AX88772_MEDIUM_FULL_DUPLEX | AX88772_MEDIUM_RX_FC_ENABLE | \ - AX88772_MEDIUM_TX_FC_ENABLE | AX88772_MEDIUM_100MB | \ - AX88772_MEDIUM_RESERVED | AX88772_MEDIUM_RX_ENABLE) - -#define AX_CMD_SET_SW_MII 0x06 -#define AX_CMD_READ_MII_REG 0x07 -#define AX_CMD_WRITE_MII_REG 0x08 -#define AX_CMD_READ_STATMNGSTS_REG 0x09 - #define AX_HOST_EN 0x01 - -#define AX_CMD_SET_HW_MII 0x0a -#define AX_CMD_READ_EEPROM 0x0b -#define AX_CMD_WRITE_EEPROM 0x0c -#define AX_CMD_WRITE_EEPROM_EN 0x0d -#define AX_CMD_WRITE_EEPROM_DIS 0x0e -#define AX_CMD_WRITE_RX_CTL 0x10 -#define AX_CMD_READ_IPG012 0x11 -#define AX_CMD_WRITE_IPG0 0x12 -#define AX_CMD_WRITE_IPG1 0x13 -#define AX_CMD_WRITE_IPG2 0x14 -#define AX_CMD_WRITE_MULTI_FILTER 0x16 -#define AX_CMD_READ_NODE_ID 0x17 -#define AX_CMD_READ_PHY_ID 0x19 -#define AX_CMD_READ_MEDIUM_MODE 0x1a -#define AX_CMD_WRITE_MEDIUM_MODE 0x1b -#define AX_CMD_READ_MONITOR_MODE 0x1c -#define AX_CMD_WRITE_MONITOR_MODE 0x1d -#define AX_CMD_WRITE_GPIOS 0x1f -#define AX_CMD_SW_RESET 0x20 -#define AX_CMD_SW_PHY_STATUS 0x21 -#define AX_CMD_SW_PHY_SELECT 0x22 - #define AX_PHYSEL_PSEL (1 << 0) - #define AX_PHYSEL_ASEL (1 << 1) - #define AX_PHYSEL_SSMII (0 << 2) - #define AX_PHYSEL_SSRMII (1 << 2) - #define AX_PHYSEL_SSRRMII (3 << 2) - #define AX_PHYSEL_SSEN (1 << 4) -#define AX88772_CMD_READ_NODE_ID 0x13 -#define AX88772_CMD_WRITE_NODE_ID 0x14 -#define AX_CMD_READ_WKFARY 0x23 -#define AX_CMD_WRITE_WKFARY 0x24 -#define AX_CMD_READ_RXCOE_CTL 0x2b -#define AX_CMD_WRITE_RXCOE_CTL 0x2c -#define AX_CMD_READ_TXCOE_CTL 0x2d -#define AX_CMD_WRITE_TXCOE_CTL 0x2e - -#define REG_LENGTH 2 -#define PHY_ID_MASK 0x1f - -#define AX_RXCOE_IPCE 0x0001 -#define AX_RXCOE_IPVE 0x0002 -#define AX_RXCOE_V6VE 0x0004 -#define AX_RXCOE_TCPE 0x0008 -#define AX_RXCOE_UDPE 0x0010 -#define AX_RXCOE_ICMP 0x0020 -#define AX_RXCOE_IGMP 0x0040 -#define AX_RXCOE_ICV6 0x0080 -#define AX_RXCOE_TCPV6 0x0100 -#define AX_RXCOE_UDPV6 0x0200 -#define AX_RXCOE_ICMV6 0x0400 -#define AX_RXCOE_IGMV6 0x0800 -#define AX_RXCOE_ICV6V6 0x1000 -#define AX_RXCOE_FOPC 0x8000 -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22) -#define AX_RXCOE_DEF_CSUM (AX_RXCOE_IPCE | AX_RXCOE_IPVE | \ - AX_RXCOE_V6VE | AX_RXCOE_TCPE | \ - AX_RXCOE_UDPE | AX_RXCOE_ICV6 | \ - AX_RXCOE_TCPV6 | AX_RXCOE_UDPV6) -#else -#define AX_RXCOE_DEF_CSUM (AX_RXCOE_IPCE | AX_RXCOE_IPVE | \ - AX_RXCOE_TCPE | AX_RXCOE_UDPE) -#endif - -#define AX_RXCOE_64TE 0x0100 -#define AX_RXCOE_PPPOE 0x0200 -#define AX_RXCOE_RPCE 0x8000 - -#define AX_TXCOE_IP 0x0001 -#define AX_TXCOE_TCP 0x0002 -#define AX_TXCOE_UDP 0x0004 -#define AX_TXCOE_ICMP 0x0008 -#define AX_TXCOE_IGMP 0x0010 -#define AX_TXCOE_ICV6 0x0020 - -#define AX_TXCOE_TCPV6 0x0100 -#define AX_TXCOE_UDPV6 0x0200 -#define AX_TXCOE_ICMV6 0x0400 -#define AX_TXCOE_IGMV6 0x0800 -#define AX_TXCOE_ICV6V6 0x1000 -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 22) -#define AX_TXCOE_DEF_CSUM (AX_TXCOE_TCP | AX_TXCOE_UDP | \ - AX_TXCOE_TCPV6 | AX_TXCOE_UDPV6) -#else -#define AX_TXCOE_DEF_CSUM (AX_TXCOE_TCP | AX_TXCOE_UDP) -#endif - -#define AX_TXCOE_64TE 0x0001 -#define AX_TXCOE_PPPE 0x0002 - -#define AX88772B_MAX_BULKIN_2K 0 -#define AX88772B_MAX_BULKIN_4K 1 -#define AX88772B_MAX_BULKIN_6K 2 -#define AX88772B_MAX_BULKIN_8K 3 -#define AX88772B_MAX_BULKIN_16K 4 -#define AX88772B_MAX_BULKIN_20K 5 -#define AX88772B_MAX_BULKIN_24K 6 -#define AX88772B_MAX_BULKIN_32K 7 -struct {unsigned short size, byte_cnt, threshold; } AX88772B_BULKIN_SIZE[] = { - /* 2k */ - {2048, 0x8000, 0x8001}, - /* 4k */ - {4096, 0x8100, 0x8147}, - /* 6k */ - {6144, 0x8200, 0x81EB}, - /* 8k */ - {8192, 0x8300, 0x83D7}, - /* 16 */ - {16384, 0x8400, 0x851E}, - /* 20k */ - {20480, 0x8500, 0x8666}, - /* 24k */ - {24576, 0x8600, 0x87AE}, - /* 32k */ - {32768, 0x8700, 0x8A3D}, -}; - - -#define AX_RX_CTL_RH1M 0x0100 /* Enable RX-Header mode 0 */ -#define AX_RX_CTL_RH2M 0x0200 /* Enable IP header in receive buffer aligned on 32-bit aligment */ -#define AX_RX_CTL_RH3M 0x0400 /* checksum value in rx header 3 */ -#define AX_RX_HEADER_DEFAULT (AX_RX_CTL_RH1M | AX_RX_CTL_RH2M) - -#define AX_RX_CTL_MFB 0x0300 /* Maximum Frame size 16384bytes */ -#define AX_RX_CTL_START 0x0080 /* Ethernet MAC start */ -#define AX_RX_CTL_AP 0x0020 /* Accept physcial address from Multicast array */ -#define AX_RX_CTL_AM 0x0010 -#define AX_RX_CTL_AB 0x0008 /* Accetp Brocadcast frames*/ -#define AX_RX_CTL_SEP 0x0004 /* Save error packets */ -#define AX_RX_CTL_AMALL 0x0002 /* Accetp all multicast frames */ -#define AX_RX_CTL_PRO 0x0001 /* Promiscuous Mode */ -#define AX_RX_CTL_STOP 0x0000 /* Stop MAC */ - -#define AX_MONITOR_MODE 0x01 -#define AX_MONITOR_LINK 0x02 -#define AX_MONITOR_MAGIC 0x04 -#define AX_MONITOR_HSFS 0x10 - -#define AX_MCAST_FILTER_SIZE 8 -#define AX_MAX_MCAST 64 -#define AX_INTERRUPT_BUFSIZE 8 - -#define AX_EEPROM_LEN 0x40 -#define AX_EEPROM_MAGIC 0xdeadbeef -#define EEPROMMASK 0x7f - -/* GPIO REGISTER */ -#define AXGPIOS_GPO0EN 0X01 /* 1 << 0 */ -#define AXGPIOS_GPO0 0X02 /* 1 << 1 */ -#define AXGPIOS_GPO1EN 0X04 /* 1 << 2 */ -#define AXGPIOS_GPO1 0X08 /* 1 << 3 */ -#define AXGPIOS_GPO2EN 0X10 /* 1 << 4 */ -#define AXGPIOS_GPO2 0X20 /* 1 << 5 */ -#define AXGPIOS_RSE 0X80 /* 1 << 7 */ - -/* TX-header format */ -#define AX_TX_HDR_CPHI 0x4000 -#define AX_TX_HDR_DICF 0x8000 - -/* GMII register definitions */ -#define GMII_PHY_CONTROL 0x00 /* control reg */ -#define GMII_PHY_STATUS 0x01 /* status reg */ -#define GMII_PHY_OUI 0x02 /* most of the OUI bits */ -#define GMII_PHY_MODEL 0x03 /* model/rev bits, and rest of OUI */ -#define GMII_PHY_ANAR 0x04 /* AN advertisement reg */ -#define GMII_PHY_ANLPAR 0x05 /* AN Link Partner */ -#define GMII_PHY_ANER 0x06 /* AN expansion reg */ -#define GMII_PHY_1000BT_CONTROL 0x09 /* control reg for 1000BT */ -#define GMII_PHY_1000BT_STATUS 0x0A /* status reg for 1000BT */ - -/* Bit definitions: GMII Control */ -#define GMII_CONTROL_RESET 0x8000 /* reset bit in control reg */ -#define GMII_CONTROL_LOOPBACK 0x4000 /* loopback bit in control reg */ -#define GMII_CONTROL_10MB 0x0000 /* 10 Mbit */ -#define GMII_CONTROL_100MB 0x2000 /* 100Mbit */ -#define GMII_CONTROL_1000MB 0x0040 /* 1000Mbit */ -#define GMII_CONTROL_SPEED_BITS 0x2040 /* speed bit mask */ -#define GMII_CONTROL_ENABLE_AUTO 0x1000 /* autonegotiate enable */ -#define GMII_CONTROL_POWER_DOWN 0x0800 -#define GMII_CONTROL_ISOLATE 0x0400 /* islolate bit */ -#define GMII_CONTROL_START_AUTO 0x0200 /* restart autonegotiate */ -#define GMII_CONTROL_FULL_DUPLEX 0x0100 - -/* Bit definitions: GMII Status */ -#define GMII_STATUS_100MB_MASK 0xE000 /* any of these indicate 100 Mbit */ -#define GMII_STATUS_10MB_MASK 0x1800 /* either of these indicate 10 Mbit */ -#define GMII_STATUS_AUTO_DONE 0x0020 /* auto negotiation complete */ -#define GMII_STATUS_AUTO 0x0008 /* auto negotiation is available */ -#define GMII_STATUS_LINK_UP 0x0004 /* link status bit */ -#define GMII_STATUS_EXTENDED 0x0001 /* extended regs exist */ -#define GMII_STATUS_100T4 0x8000 /* capable of 100BT4 */ -#define GMII_STATUS_100TXFD 0x4000 /* capable of 100BTX full duplex */ -#define GMII_STATUS_100TX 0x2000 /* capable of 100BTX */ -#define GMII_STATUS_10TFD 0x1000 /* capable of 10BT full duplex */ -#define GMII_STATUS_10T 0x0800 /* capable of 10BT */ - -/* Bit definitions: Auto-Negotiation Advertisement */ -#define GMII_ANAR_ASYM_PAUSE 0x0800 /* support asymetric pause */ -#define GMII_ANAR_PAUSE 0x0400 /* support pause packets */ -#define GMII_ANAR_100T4 0x0200 /* support 100BT4 */ -#define GMII_ANAR_100TXFD 0x0100 /* support 100BTX full duplex */ -#define GMII_ANAR_100TX 0x0080 /* support 100BTX half duplex */ -#define GMII_ANAR_10TFD 0x0040 /* support 10BT full duplex */ -#define GMII_ANAR_10T 0x0020 /* support 10BT half duplex */ -#define GMII_SELECTOR_FIELD 0x001F /* selector field. */ - -/* Bit definitions: Auto-Negotiation Link Partner Ability */ -#define GMII_ANLPAR_100T4 0x0200 /* support 100BT4 */ -#define GMII_ANLPAR_100TXFD 0x0100 /* support 100BTX full duplex */ -#define GMII_ANLPAR_100TX 0x0080 /* support 100BTX half duplex */ -#define GMII_ANLPAR_10TFD 0x0040 /* support 10BT full duplex */ -#define GMII_ANLPAR_10T 0x0020 /* support 10BT half duplex */ -#define GMII_ANLPAR_PAUSE 0x0400 /* support pause packets */ -#define GMII_ANLPAR_ASYM_PAUSE 0x0800 /* support asymetric pause */ -#define GMII_ANLPAR_ACK 0x4000 /* means LCB was successfully rx'd */ -#define GMII_SELECTOR_8023 0x0001; - -/* Bit definitions: 1000BaseT AUX Control */ -#define GMII_1000_AUX_CTRL_MASTER_SLAVE 0x1000 -#define GMII_1000_AUX_CTRL_FD_CAPABLE 0x0200 /* full duplex capable */ -#define GMII_1000_AUX_CTRL_HD_CAPABLE 0x0100 /* half duplex capable */ - -/* Bit definitions: 1000BaseT AUX Status */ -#define GMII_1000_AUX_STATUS_FD_CAPABLE 0x0800 /* full duplex capable */ -#define GMII_1000_AUX_STATUS_HD_CAPABLE 0x0400 /* half duplex capable */ - -/* Cicada MII Registers */ -#define GMII_AUX_CTRL_STATUS 0x1C -#define GMII_AUX_ANEG_CPLT 0x8000 -#define GMII_AUX_FDX 0x0020 -#define GMII_AUX_SPEED_1000 0x0010 -#define GMII_AUX_SPEED_100 0x0008 - -#ifndef ADVERTISE_PAUSE_CAP -#define ADVERTISE_PAUSE_CAP 0x0400 -#endif - -#ifndef MII_STAT1000 -#define MII_STAT1000 0x000A -#endif - -#ifndef LPA_1000FULL -#define LPA_1000FULL 0x0800 -#endif - -/* medium mode register */ -#define MEDIUM_GIGA_MODE 0x0001 -#define MEDIUM_FULL_DUPLEX_MODE 0x0002 -#define MEDIUM_TX_ABORT_MODE 0x0004 -#define MEDIUM_ENABLE_125MHZ 0x0008 -#define MEDIUM_ENABLE_RX_FLOWCTRL 0x0010 -#define MEDIUM_ENABLE_TX_FLOWCTRL 0x0020 -#define MEDIUM_ENABLE_JUMBO_FRAME 0x0040 -#define MEDIUM_CHECK_PAUSE_FRAME_MODE 0x0080 -#define MEDIUM_ENABLE_RECEIVE 0x0100 -#define MEDIUM_MII_100M_MODE 0x0200 -#define MEDIUM_ENABLE_JAM_PATTERN 0x0400 -#define MEDIUM_ENABLE_STOP_BACKPRESSURE 0x0800 -#define MEDIUM_ENABLE_SUPPER_MAC_SUPPORT 0x1000 - -/* PHY mode */ -#define PHY_MODE_MARVELL 0 -#define PHY_MODE_CICADA_FAMILY 1 -#define PHY_MODE_CICADA_V1 1 -#define PHY_MODE_AGERE_FAMILY 2 -#define PHY_MODE_AGERE_V0 2 -#define PHY_MODE_CICADA_V2 5 -#define PHY_MODE_AGERE_V0_GMII 6 -#define PHY_MODE_CICADA_V2_ASIX 9 -#define PHY_MODE_VSC8601 10 -#define PHY_MODE_RTL8211CL 12 -#define PHY_MODE_RTL8211BN 13 -#define PHY_MODE_RTL8251CL 14 -#define PHY_MODE_ATTANSIC_V0 0x40 -#define PHY_MODE_ATTANSIC_FAMILY 0x40 -#define PHY_MODE_MAC_TO_MAC_GMII 0x7C - -/* */ -#define LED_MODE_MARVELL 0 -#define LED_MODE_CAMEO 1 - -#define MARVELL_LED_CTRL 0x18 -#define MARVELL_MANUAL_LED 0x19 - -#define PHY_IDENTIFIER 0x0002 -#define PHY_AGERE_IDENTIFIER 0x0282 -#define PHY_CICADA_IDENTIFIER 0x000f -#define PHY_MARVELL_IDENTIFIER 0x0141 - -#define PHY_MARVELL_STATUS 0x001b -#define MARVELL_STATUS_HWCFG 0x0004 /* SGMII without clock */ - -#define PHY_MARVELL_CTRL 0x0014 -#define MARVELL_CTRL_RXDELAY 0x0080 -#define MARVELL_CTRL_TXDELAY 0x0002 - -#define PHY_CICADA_EXTPAGE 0x001f -#define CICADA_EXTPAGE_EN 0x0001 -#define CICADA_EXTPAGE_DIS 0x0000 - -/* External ethernet phy */ -#define EXTPHY_ID_MASK_OUI(phyid1, phyid2) ((phyid1 << 6) | ((phyid2 & 0xFC00) >> 10)) -#define EXTPHY_ID_MASK_MODEL(phyid2) ((phyid2 & 0x3F0) >> 4) - -#define EXTPHY_BROADCOM_OUI 0x2B8094 -#define EXTPHY_BCM89811_MODEL 0x02 - -struct {unsigned short value, offset; } CICADA_FAMILY_HWINIT[] = { - {0x0001, 0x001f}, {0x1c25, 0x0017}, {0x2a30, 0x001f}, {0x234c, 0x0010}, - {0x2a30, 0x001f}, {0x0212, 0x0008}, {0x52b5, 0x001f}, {0xa7fa, 0x0000}, - {0x0012, 0x0002}, {0x3002, 0x0001}, {0x87fa, 0x0000}, {0x52b5, 0x001f}, - {0xafac, 0x0000}, {0x000d, 0x0002}, {0x001c, 0x0001}, {0x8fac, 0x0000}, - {0x2a30, 0x001f}, {0x0012, 0x0008}, {0x2a30, 0x001f}, {0x0400, 0x0014}, - {0x2a30, 0x001f}, {0x0212, 0x0008}, {0x52b5, 0x001f}, {0xa760, 0x0000}, - {0x0000, 0x0002}, {0xfaff, 0x0001}, {0x8760, 0x0000}, {0x52b5, 0x001f}, - {0xa760, 0x0000}, {0x0000, 0x0002}, {0xfaff, 0x0001}, {0x8760, 0x0000}, - {0x52b5, 0x001f}, {0xafae, 0x0000}, {0x0004, 0x0002}, {0x0671, 0x0001}, - {0x8fae, 0x0000}, {0x2a30, 0x001f}, {0x0012, 0x0008}, {0x0000, 0x001f}, -}; - -struct {unsigned short value, offset; } CICADA_V2_HWINIT[] = { - {0x2a30, 0x001f}, {0x0212, 0x0008}, {0x52b5, 0x001f}, {0x000f, 0x0002}, - {0x472a, 0x0001}, {0x8fa4, 0x0000}, {0x2a30, 0x001f}, {0x0212, 0x0008}, - {0x0000, 0x001f}, -}; - -struct {unsigned short value, offset; } CICADA_V2_ASIX_HWINIT[] = { - {0x2a30, 0x001f}, {0x0212, 0x0008}, {0x52b5, 0x001f}, {0x0012, 0x0002}, - {0x3002, 0x0001}, {0x87fa, 0x0000}, {0x52b5, 0x001f}, {0x000f, 0x0002}, - {0x472a, 0x0001}, {0x8fa4, 0x0000}, {0x2a30, 0x001f}, {0x0212, 0x0008}, - {0x0000, 0x001f}, -}; - -struct {unsigned short value, offset; } AGERE_FAMILY_HWINIT[] = { - {0x0800, 0x0000}, {0x0007, 0x0012}, {0x8805, 0x0010}, {0xb03e, 0x0011}, - {0x8808, 0x0010}, {0xe110, 0x0011}, {0x8806, 0x0010}, {0xb03e, 0x0011}, - {0x8807, 0x0010}, {0xff00, 0x0011}, {0x880e, 0x0010}, {0xb4d3, 0x0011}, - {0x880f, 0x0010}, {0xb4d3, 0x0011}, {0x8810, 0x0010}, {0xb4d3, 0x0011}, - {0x8817, 0x0010}, {0x1c00, 0x0011}, {0x300d, 0x0010}, {0x0001, 0x0011}, - {0x0002, 0x0012}, -}; - -struct ax88178_data { - u16 EepromData; - u16 MediaLink; - int UseGpio0; - int UseRgmii; - u8 PhyMode; - u8 LedMode; - u8 BuffaloOld; -}; - -enum watchdog_state { - AX_NOP = 0, - CHK_LINK, /* Routine A */ - CHK_CABLE_EXIST, /* Called by A */ - CHK_CABLE_EXIST_AGAIN, /* Routine B */ - PHY_POWER_UP, /* Called by B */ - PHY_POWER_UP_BH, - PHY_POWER_DOWN, - CHK_CABLE_STATUS, /* Routine C */ - WAIT_AUTONEG_COMPLETE, - AX_SET_RX_CFG, - AX_CHK_AUTODETACH, -}; - -#if 0 -struct ax88772b_data { - struct usbnet *dev; - struct workqueue_struct *ax_work; - struct work_struct check_link; - unsigned long time_to_chk; - u16 psc; - u8 pw_enabled; - u8 Event; - u8 checksum; - u8 PhySelect:1; - u8 OperationMode:1; - u16 presvd_phy_advertise; - u16 presvd_phy_bmcr; - - u32 ext_phy_oui; - u8 ext_phy_model; -}; -#endif - -/* define for MAC or PHY mode */ -#define OPERATION_MAC_MODE 0 -#define OPERATION_PHY_MODE 1 - -#if 0 -struct ax88772a_data { - struct usbnet *dev; - struct workqueue_struct *ax_work; - struct work_struct check_link; - unsigned long autoneg_start; -#define AX88772B_WATCHDOG (6 * HZ) - u8 Event; - u8 TickToExpire; - u8 DlyIndex; - u8 DlySel; - u16 EepromData; - u16 presvd_phy_advertise; - u16 presvd_phy_bmcr; -}; - -struct ax88772_data { - struct usbnet *dev; - struct workqueue_struct *ax_work; - struct work_struct check_link; - unsigned long autoneg_start; - u8 Event; - u8 TickToExpire; - u16 presvd_phy_advertise; - u16 presvd_phy_bmcr; -}; -#endif - -#define AX_RX_CHECKSUM 1 -#define AX_TX_CHECKSUM 2 - -#if 0 -/* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */ -struct ax8817x_data { - u8 multi_filter[AX_MCAST_FILTER_SIZE]; - int (*resume) (struct usb_interface *intf); - int (*suspend) (struct usb_interface *intf, -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 10) - pm_message_t message); -#else - u32 message); -#endif -}; -#endif - -struct ax88172_int_data { - u16 res1; -#define AX_INT_PPLS_LINK (1 << 0) -#define AX_INT_SPLS_LINK (1 << 1) -#define AX_INT_CABOFF_UNPLUG (1 << 7) - u8 link; - u16 res2; - u8 status; - u16 res3; -} __attribute__ ((packed)); - -#define AX_RXHDR_L4_ERR (1 << 8) -#define AX_RXHDR_L3_ERR (1 << 9) - -#define AX_RXHDR_L4_TYPE_UDP 1 -#define AX_RXHDR_L4_TYPE_ICMP 2 -#define AX_RXHDR_L4_TYPE_IGMP 3 -#define AX_RXHDR_L4_TYPE_TCP 4 -#define AX_RXHDR_L4_TYPE_TCMPV6 5 -#define AX_RXHDR_L4_TYPE_MASK 7 - -#define AX_RXHDR_L3_TYPE_IP 1 -#define AX_RXHDR_L3_TYPE_IPV6 2 - -struct ax88772b_rx_header { -#if defined(__LITTLE_ENDIAN_BITFIELD) - u16 len:11, - res1:1, - crc:1, - mii:1, - runt:1, - mc_bc:1; - - u16 len_bar:11, - res2:5; - - u8 vlan_ind:3, - vlan_tag_striped:1, - pri:3, - res3:1; - - u8 l4_csum_err:1, - l3_csum_err:1, - l4_type:3, - l3_type:2, - ce:1; -#elif defined(__BIG_ENDIAN_BITFIELD) - u16 mc_bc:1, - runt:1, - mii:1, - crc:1, - res1:1, - len:11; - - u16 res2:5, - len_bar:11; - - u8 res3:1, - pri:3, - vlan_tag_striped:1, - vlan_ind:3; - - u8 ce:1, - l3_type:2, - l4_type:3, - l3_csum_err:1, - l4_csum_err:1; -#else -#error "Please fix " -#endif - -} __attribute__ ((packed)); - - -#endif /* __LINUX_USBNET_ASIX_H */ - diff --git a/third-party/cherryusb/class/vendor/axusbnet.c b/third-party/cherryusb/class/vendor/axusbnet.c deleted file mode 100644 index 64282e03353907e18652b8dded84e99fe3a56c34..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/vendor/axusbnet.c +++ /dev/null @@ -1,1208 +0,0 @@ -/* - * Copyright (c) 2022, aozima - * - * SPDX-License-Identifier: Apache-2.0 - */ -/* - * Change Logs - * Date Author Notes - * 2022-04-17 aozima the first version for CherryUSB. - */ - -#include - -#include "usbh_core.h" -#include "axusbnet.h" - -static const char *DEV_FORMAT = "/dev/u%d"; - -#define USE_RTTHREAD (1) -// #define RX_DUMP -// #define TX_DUMP -// #define DUMP_RAW - -#if USE_RTTHREAD -#include - -#include -#include -#endif /* USE_RTTHREAD */ - -#define MAX_ADDR_LEN 6 -#define ETH_ALEN MAX_ADDR_LEN -#define mdelay rt_thread_delay -#define msleep rt_thread_delay -#define deverr(dev, fmt, ...) USB_LOG_ERR(fmt, ##__VA_ARGS__) -#define cpu_to_le16(a) (a) -#define le32_to_cpus(a) (a) - -/* Generic MII registers. */ -#define MII_BMCR 0x00 /* Basic mode control register */ -#define MII_BMSR 0x01 /* Basic mode status register */ -#define MII_PHYSID1 0x02 /* PHYS ID 1 */ -#define MII_PHYSID2 0x03 /* PHYS ID 2 */ -#define MII_ADVERTISE 0x04 /* Advertisement control reg */ -#define MII_LPA 0x05 /* Link partner ability reg */ -#define MII_EXPANSION 0x06 /* Expansion register */ -#define MII_CTRL1000 0x09 /* 1000BASE-T control */ -#define MII_STAT1000 0x0a /* 1000BASE-T status */ -#define MII_MMD_CTRL 0x0d /* MMD Access Control Register */ -#define MII_MMD_DATA 0x0e /* MMD Access Data Register */ -#define MII_ESTATUS 0x0f /* Extended Status */ -#define MII_DCOUNTER 0x12 /* Disconnect counter */ -#define MII_FCSCOUNTER 0x13 /* False carrier counter */ -#define MII_NWAYTEST 0x14 /* N-way auto-neg test reg */ -#define MII_RERRCOUNTER 0x15 /* Receive error counter */ -#define MII_SREVISION 0x16 /* Silicon revision */ -#define MII_RESV1 0x17 /* Reserved... */ -#define MII_LBRERROR 0x18 /* Lpback, rx, bypass error */ -#define MII_PHYADDR 0x19 /* PHY address */ -#define MII_RESV2 0x1a /* Reserved... */ -#define MII_TPISTATUS 0x1b /* TPI status for 10mbps */ -#define MII_NCONFIG 0x1c /* Network interface config */ - -/* Basic mode control register. */ -#define BMCR_RESV 0x003f /* Unused... */ -#define BMCR_SPEED1000 0x0040 /* MSB of Speed (1000) */ -#define BMCR_CTST 0x0080 /* Collision test */ -#define BMCR_FULLDPLX 0x0100 /* Full duplex */ -#define BMCR_ANRESTART 0x0200 /* Auto negotiation restart */ -#define BMCR_ISOLATE 0x0400 /* Isolate data paths from MII */ -#define BMCR_PDOWN 0x0800 /* Enable low power state */ -#define BMCR_ANENABLE 0x1000 /* Enable auto negotiation */ -#define BMCR_SPEED100 0x2000 /* Select 100Mbps */ -#define BMCR_LOOPBACK 0x4000 /* TXD loopback bits */ -#define BMCR_RESET 0x8000 /* Reset to default state */ -#define BMCR_SPEED10 0x0000 /* Select 10Mbps */ - -/* Advertisement control register. */ -#define ADVERTISE_SLCT 0x001f /* Selector bits */ -#define ADVERTISE_CSMA 0x0001 /* Only selector supported */ -#define ADVERTISE_10HALF 0x0020 /* Try for 10mbps half-duplex */ -#define ADVERTISE_1000XFULL 0x0020 /* Try for 1000BASE-X full-duplex */ -#define ADVERTISE_10FULL 0x0040 /* Try for 10mbps full-duplex */ -#define ADVERTISE_1000XHALF 0x0040 /* Try for 1000BASE-X half-duplex */ -#define ADVERTISE_100HALF 0x0080 /* Try for 100mbps half-duplex */ -#define ADVERTISE_1000XPAUSE 0x0080 /* Try for 1000BASE-X pause */ -#define ADVERTISE_100FULL 0x0100 /* Try for 100mbps full-duplex */ -#define ADVERTISE_1000XPSE_ASYM 0x0100 /* Try for 1000BASE-X asym pause */ -#define ADVERTISE_100BASE4 0x0200 /* Try for 100mbps 4k packets */ -#define ADVERTISE_PAUSE_CAP 0x0400 /* Try for pause */ -#define ADVERTISE_PAUSE_ASYM 0x0800 /* Try for asymetric pause */ -#define ADVERTISE_RESV 0x1000 /* Unused... */ -#define ADVERTISE_RFAULT 0x2000 /* Say we can detect faults */ -#define ADVERTISE_LPACK 0x4000 /* Ack link partners response */ -#define ADVERTISE_NPAGE 0x8000 /* Next page bit */ - -#define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \ - ADVERTISE_CSMA) -#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \ - ADVERTISE_100HALF | ADVERTISE_100FULL) - -struct mii_if_info { - int phy_id; -}; - -struct usbnet -{ -#if USE_RTTHREAD - /* inherit from ethernet device */ - struct eth_device parent; -#endif /* USE_RTTHREAD */ - - struct usbh_axusbnet *class; - - uint8_t dev_addr[MAX_ADDR_LEN]; - - uint8_t internalphy:1; - uint8_t PhySelect:1; - uint8_t OperationMode:1; - - struct mii_if_info mii; -}; -typedef struct usbnet * usbnet_t; -static struct usbnet usbh_axusbnet_eth_device; - -#define __is_print(ch) ((unsigned int)((ch) - ' ') < 127u - ' ') -static void dump_hex(const void *ptr, uint32_t buflen) -{ - unsigned char *buf = (unsigned char*)ptr; - int i, j; - - for (i=0; itot_len); -#ifdef DUMP_RAW - const struct pbuf* q; - rt_uint32_t i,j; - rt_uint8_t *ptr; - - // rt_kprintf("%s %d byte\n", msg, p->tot_len); - - i=0; - for(q=p; q != RT_NULL; q= q->next) - { - ptr = q->payload; - - for(j=0; jlen; j++) - { - if( (i%8) == 0 ) - { - rt_kprintf(" "); - } - if( (i%16) == 0 ) - { - rt_kprintf("\r\n"); - } - rt_kprintf("%02X ", *ptr); - - i++; - ptr++; - } - } - - rt_kprintf("\n\n"); -#endif /* DUMP_RAW */ -} -#else -#define packet_dump(...) -#endif /* dump */ - -static int ax8817x_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, - u16 size, void *data) -{ - int ret = 0; - struct usbh_hubport *hport = dev->class->hport; - struct usb_setup_packet *setup = hport->setup; - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_VENDOR | USB_REQUEST_RECIPIENT_DEVICE; - setup->bRequest = cmd; - setup->wValue = value; - setup->wIndex = index; - setup->wLength = size; - - ret = usbh_control_transfer(hport->ep0, setup, (uint8_t *)data); - if (ret != 0) { - USB_LOG_ERR("%s cmd=%d ret: %d\r\n", __FUNCTION__, cmd, ret); - return ret; - } - -_exit: - - return ret; -} - -static int ax8817x_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, - u16 size, void *data) -{ - int ret = 0; - struct usbh_hubport *hport = dev->class->hport; - struct usb_setup_packet *setup = hport->setup; - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_VENDOR | USB_REQUEST_RECIPIENT_DEVICE; - setup->bRequest = cmd; - setup->wValue = value; - setup->wIndex = index; - setup->wLength = size; - - ret = usbh_control_transfer(hport->ep0, setup, (uint8_t *)data); - if (ret != 0) { - USB_LOG_ERR("%s cmd=%d ret: %d\r\n", __FUNCTION__, cmd, ret); - return ret; - } - -_exit: - - return ret; -} - -static int ax8817x_mdio_read(struct usbnet *dev, int phy_id, int loc) -{ - // struct usbnet *dev = netdev_priv(netdev); - u16 res, ret; - u8 smsr; - int i = 0; - - // res = kmalloc(2, GFP_ATOMIC); - // if (!res) - // return 0; - - do { - ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, 0, 0, 0, NULL); - - msleep(1); - - // smsr = (u8 *)&ret; - ax8817x_read_cmd(dev, AX_CMD_READ_STATMNGSTS_REG, 0, 0, 1, &smsr); - } while (!(smsr & AX_HOST_EN) && (i++ < 30)); - - ax8817x_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, (uint16_t)loc, 2, &res); - ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, NULL); - - // ret = *res & 0xffff; - // kfree(res); - - return res; -} - -/* same as above, but converts resulting value to cpu byte order */ -static int ax8817x_mdio_read_le(struct usbnet *netdev, int phy_id, int loc) -{ - return (ax8817x_mdio_read(netdev, phy_id, loc)); -} - -static void -ax8817x_mdio_write(struct usbnet *dev, int phy_id, int loc, int val) -{ - // struct usbnet *dev = netdev_priv(netdev); - u16 res; - u8 smsr; - int i = 0; - - // res = kmalloc(2, GFP_ATOMIC); - // if (!res) - // return; - // smsr = (u8 *) res; - - do { - ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, 0, 0, 0, NULL); - - msleep(1); - - ax8817x_read_cmd(dev, AX_CMD_READ_STATMNGSTS_REG, 0, 0, 1, &smsr); - } while (!(smsr & AX_HOST_EN) && (i++ < 30)); - - // *res = val; - res = val; - - ax8817x_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (uint16_t)loc, 2, &res); - ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, NULL); - - // kfree(res); -} - -static void -ax88772b_mdio_write(struct usbnet *dev, int phy_id, int loc, int val) -{ - // struct usbnet *dev = netdev_priv(netdev); - u16 res = val; - - // res = kmalloc(2, GFP_ATOMIC); - // if (!res) - // return; - // *res = val; - - ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, 0, 0, 0, NULL); - ax8817x_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (uint16_t)loc, 2, &res); - - if (loc == MII_ADVERTISE) { - res = CPU_TO_LE16(BMCR_ANENABLE | BMCR_ANRESTART); - ax8817x_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (uint16_t)MII_BMCR, 2, &res); - } - - ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, NULL); - - // kfree(res); -} - -/* same as above, but converts new value to le16 byte order before writing */ -static void -ax8817x_mdio_write_le(struct usbnet *netdev, int phy_id, int loc, int val) -{ - ax8817x_mdio_write(netdev, phy_id, loc, CPU_TO_LE16(val)); -} - -static int access_eeprom_mac(struct usbnet *dev, u8 *buf, u8 offset, bool wflag) -{ - int ret = 0, i; - u16 *tmp = (u16 *)buf; - - if (wflag) { - ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_EEPROM_EN, - 0, 0, 0, NULL); - if (ret < 0) - return ret; - - mdelay(15); - } - - for (i = 0; i < (ETH_ALEN >> 1); i++) { - if (wflag) { - // u16 wd = CPU_TO_LE16(*(tmp + i)); - u16 wd = (*(tmp + i)); - ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_EEPROM, offset + i, - wd, 0, NULL); - if (ret < 0) - break; - - mdelay(15); - } else { - ret = ax8817x_read_cmd(dev, AX_CMD_READ_EEPROM, - offset + i, 0, 2, tmp + i); - if (ret < 0) - break; - } - } - - if (!wflag) { - if (ret < 0) { -// #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) -// netdev_dbg(dev->net, "Failed to read MAC address from EEPROM: %d\n", ret); -// #else -// devdbg(dev, "Failed to read MAC address from EEPROM: %d\n", ret); -// #endif - USB_LOG_ERR("Failed to read MAC address from EEPROM: %d\n", ret); - return ret; - } - // memcpy(dev->net->dev_addr, buf, ETH_ALEN); - } else { - ax8817x_write_cmd(dev, AX_CMD_WRITE_EEPROM_DIS, - 0, 0, 0, NULL); - if (ret < 0) - return ret; - - /* reload eeprom data */ - ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_GPIOS, - AXGPIOS_RSE, 0, 0, NULL); - if (ret < 0) - return ret; - } - - return 0; -} - -static int ax88772a_phy_powerup(struct usbnet *dev) -{ - int ret; - /* set the embedded Ethernet PHY in power-down state */ - ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, - AX_SWRESET_IPPD | AX_SWRESET_IPRL, 0, 0, NULL); - if (ret < 0) { - deverr(dev, "Failed to power down PHY: %d", ret); - return ret; - } - - msleep(10); - - /* set the embedded Ethernet PHY in power-up state */ - ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_IPRL, - 0, 0, NULL); - if (ret < 0) { - deverr(dev, "Failed to reset PHY: %d", ret); - return ret; - } - - msleep(600); - - /* set the embedded Ethernet PHY in reset state */ - ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_CLEAR, - 0, 0, NULL); - if (ret < 0) { - deverr(dev, "Failed to power up PHY: %d", ret); - return ret; - } - - /* set the embedded Ethernet PHY in power-up state */ - ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_IPRL, - 0, 0, NULL); - if (ret < 0) { - deverr(dev, "Failed to reset PHY: %d", ret); - return ret; - } - - return 0; -} - -static int ax88772b_reset(struct usbnet *dev) -{ - int ret; - - ret = ax88772a_phy_powerup(dev); - if (ret < 0) - return ret; - - /* Set the MAC address */ - ret = ax8817x_write_cmd(dev, AX88772_CMD_WRITE_NODE_ID, - 0, 0, ETH_ALEN, dev->dev_addr); - if (ret < 0) { - deverr(dev, "set MAC address failed: %d", ret); - } - - /* stop MAC operation */ - ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, AX_RX_CTL_STOP, - 0, 0, NULL); - if (ret < 0){ - deverr(dev, "Reset RX_CTL failed: %d", ret); - } - - ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, - AX88772_MEDIUM_DEFAULT, 0, 0, - NULL); - if (ret < 0){ - deverr(dev, "Write medium mode register: %d", ret); - } - - return ret; -} - -static int ax8817x_get_mac(struct usbnet *dev, u8 *buf) -{ - int ret, i; - - ret = access_eeprom_mac(dev, buf, 0x04, 0); - if (ret < 0) - goto out; - - // if (ax8817x_check_ether_addr(dev)) { - // ret = access_eeprom_mac(dev, dev->net->dev_addr, 0x04, 1); - // if (ret < 0) { - // deverr(dev, "Failed to write MAC to EEPROM: %d", ret); - // goto out; - // } - - // msleep(5); - - // ret = ax8817x_read_cmd(dev, AX88772_CMD_READ_NODE_ID, - // 0, 0, ETH_ALEN, buf); - // if (ret < 0) { - // deverr(dev, "Failed to read MAC address: %d", ret); - // goto out; - // } - - // for (i = 0; i < ETH_ALEN; i++) - // if (*(dev->net->dev_addr + i) != *((u8 *)buf + i)) { - // devwarn(dev, "Found invalid EEPROM part or non-EEPROM"); - // break; - // } - // } - - // memcpy(dev->net->perm_addr, dev->net->dev_addr, ETH_ALEN); - - // /* Set the MAC address */ - // ax8817x_write_cmd(dev, AX88772_CMD_WRITE_NODE_ID, 0, 0, - // ETH_ALEN, dev->net->dev_addr); - - // if (ret < 0) { - // deverr(dev, "Failed to write MAC address: %d", ret); - // goto out; - // } - - return 0; -out: - return ret; -} - -#if USE_RTTHREAD -static rt_err_t rt_rndis_eth_init(rt_device_t dev) -{ - return RT_EOK; -} - -static rt_err_t rt_rndis_eth_open(rt_device_t dev, rt_uint16_t oflag) -{ - return RT_EOK; -} - -static rt_err_t rt_rndis_eth_close(rt_device_t dev) -{ - return RT_EOK; -} - -static rt_size_t rt_rndis_eth_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size) -{ - rt_set_errno(-RT_ENOSYS); - return 0; -} - -static rt_size_t rt_rndis_eth_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size) -{ - rt_set_errno(-RT_ENOSYS); - return 0; -} -static rt_err_t rt_rndis_eth_control(rt_device_t dev, int cmd, void *args) -{ - usbnet_t rndis_eth_dev = (usbnet_t)dev; - - USB_LOG_INFO("%s L%d\r\n", __FUNCTION__, __LINE__); - switch(cmd) - { - case NIOCTL_GADDR: - /* get mac address */ - if(args) - { - USB_LOG_INFO("%s L%d NIOCTL_GADDR\r\n", __FUNCTION__, __LINE__); - rt_memcpy(args, rndis_eth_dev->dev_addr, MAX_ADDR_LEN); - } - else - { - return -RT_ERROR; - } - break; - default : - break; - } - - return RT_EOK; -} - -/* reception packet. */ -static struct pbuf *rt_rndis_eth_rx(rt_device_t dev) -{ - struct pbuf* p = RT_NULL; - - // USB_LOG_INFO("%s L%d\r\n", __FUNCTION__, __LINE__); - - return p; -} - -/* transmit packet. */ -static rt_err_t rt_rndis_eth_tx(rt_device_t dev, struct pbuf* p) -{ - int ret = 0; - rt_err_t result = RT_EOK; - uint8_t *tmp_buf = RT_NULL; - usbnet_t rndis_eth = (usbnet_t)dev; - struct usbh_axusbnet *class = rndis_eth->class; - rt_tick_t tick_start, tick_end; - uint8_t int_notify_buf[8]; - -#ifdef TX_DUMP - packet_dump("TX", p); -#endif /* TX_DUMP */ - - tmp_buf = (uint8_t *)rt_malloc(16 + p->tot_len ); - if (!tmp_buf) { - USB_LOG_INFO("[%s L%d], no memory for pbuf, len=%d.", __FUNCTION__, __LINE__, p->tot_len); - goto _exit; - } - - uint32_t slen = p->tot_len; - - uint32_t head = slen; - head = ((head ^ 0x0000ffff) << 16) + (head); - - tmp_buf[0] = head & 0xFF; - tmp_buf[1] = (head >> 8) & 0xFF; - tmp_buf[2] = (head >> 16) & 0xFF; - tmp_buf[3] = (head >> 24) & 0xFF; - slen += 4; - - int padlen = ((p->tot_len + 4) % 512) ? 0 : 4; - if (padlen) { - tmp_buf[4 + slen + 0] = 0x00; - tmp_buf[4 + slen + 1] = 0x00; - tmp_buf[4 + slen + 2] = 0xFF; - tmp_buf[4 + slen + 3] = 0xFF; - slen += 4; - } - - pbuf_copy_partial(p, tmp_buf + 4, p->tot_len, 0); - - tick_start = rt_tick_get(); - ret = usbh_ep_bulk_transfer(class->bulkout, tmp_buf, slen, 500); - if (ret < 0) { - result = -RT_EIO; - USB_LOG_ERR("%s L%d send over ret:%d\r\n", __FUNCTION__, __LINE__, ret); - goto _exit; - } - tick_end = rt_tick_get(); - -_exit: - if(tmp_buf) - { - rt_free(tmp_buf); - } - - return result; -} - -#ifdef RT_USING_DEVICE_OPS -const static struct rt_device_ops rndis_device_ops = -{ - rt_rndis_eth_init, - rt_rndis_eth_open, - rt_rndis_eth_close, - rt_rndis_eth_read, - rt_rndis_eth_write, - rt_rndis_eth_control -} -#endif /* RT_USING_DEVICE_OPS */ -#endif /* USE_RTTHREAD */ - -static void rt_thread_axusbnet_entry(void *parameter) -{ - int ret; - struct usbh_hubport *hport; - uint8_t intf; - uint8_t buf[2+8]; - - USB_LOG_INFO("%s L%d\r\n", __FUNCTION__, __LINE__); - rt_thread_delay(200); - USB_LOG_INFO("%s L%d\r\n\r\n\r\n\r\n", __FUNCTION__, __LINE__); - - const char *dname = "/dev/u0"; - struct usbh_axusbnet *class = (struct usbh_axusbnet *)usbh_find_class_instance(dname); - if (class == NULL) { - USB_LOG_ERR("do not find %s\r\n", dname); - return; - } - USB_LOG_INFO("axusbnet=%p\r\n", dname); - - usbh_axusbnet_eth_device.class = class; - - struct usbnet *dev = &usbh_axusbnet_eth_device; - - ret = ax8817x_read_cmd(dev, AX_CMD_SW_PHY_STATUS, - 0, 0, 1, buf); - if (ret < 0) { - USB_LOG_ERR("AX_CMD_SW_PHY_STATUS ret=%d\r\n", ret); - return; - } - u8 tempphyselect = buf[0]; - if (tempphyselect == AX_PHYSEL_SSRMII) { - USB_LOG_ERR("%s L%d AX_PHYSEL_SSRMII\r\n", __FUNCTION__, __LINE__); - dev->internalphy = false; - return; - // dev->OperationMode = OPERATION_MAC_MODE; - // dev->PhySelect = 0x00; - } else if (tempphyselect == AX_PHYSEL_SSRRMII) { - USB_LOG_ERR("%s L%d AX_PHYSEL_SSRRMII\r\n", __FUNCTION__, __LINE__); - dev->internalphy = true; - return; - // dev->OperationMode = OPERATION_PHY_MODE; - // dev->PhySelect = 0x00; - } else if (tempphyselect == AX_PHYSEL_SSMII) { - USB_LOG_INFO("%s L%d internalphy AX_PHYSEL_SSMII & OPERATION_MAC_MODE\r\n", __FUNCTION__, __LINE__); - dev->internalphy = true; - dev->OperationMode = OPERATION_MAC_MODE; - dev->PhySelect = 0x01; - } else { - // deverr(dev, "Unknown MII type\n"); - USB_LOG_INFO("%s L%d Unknown MII type\r\n", __FUNCTION__, __LINE__); - return; - } - - /* reload eeprom data */ - ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_GPIOS, AXGPIOS_RSE, 0, 0, NULL); - if (ret < 0) { - USB_LOG_ERR("reload eeprom data ret=%d\r\n", ret); - return; - } - - /* Get the EEPROM data: power saving configuration*/ - ret = ax8817x_read_cmd(dev, AX_CMD_READ_EEPROM, 0x18, 0, 2, buf); - if (ret < 0) { - USB_LOG_ERR("read SROM address 18h failed: %d\r\n", ret); - goto err_out; - } - USB_LOG_INFO("reading AX88772C psc: %02x %02x\r\n", buf[0], buf[1]); - // le16_to_cpus(tmp16); - // ax772b_data->psc = *tmp16 & 0xFF00; - /* End of get EEPROM data */ - - ret = ax8817x_get_mac(dev, buf); - if (ret < 0) { - USB_LOG_ERR("Get HW address failed: %d\r\n", ret); - return; - } - dump_hex(buf, ETH_ALEN); - memcpy(dev->dev_addr, buf, ETH_ALEN); - - uint16_t chipcode = 0xFFFF; - { - uint16_t smsr; - // asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0); - ax8817x_read_cmd(dev, AX_CMD_READ_STATMNGSTS_REG, 0, 0, 1, &chipcode); - USB_LOG_ERR("AX_CMD_READ_STATMNGSTS_REG ret: %d %04X\r\n", ret, chipcode); - -// #define AX_CHIPCODE_MASK 0x70 -// #define AX_AX88772_CHIPCODE 0x00 -// #define AX_AX88772A_CHIPCODE 0x10 -// #define AX_AX88772B_CHIPCODE 0x20 -// #define AX_HOST_EN 0x01 - - chipcode &= 0x70;//AX_CHIPCODE_MASK; AX_AX88772_CHIPCODE - if(chipcode == 0x00) - { - USB_LOG_ERR("AX_CMD_READ_STATMNGSTS_REG AX_AX88772_CHIPCODE\r\n"); - } - else if(chipcode == 0x10) - { - USB_LOG_ERR("AX_CMD_READ_STATMNGSTS_REG AX_AX88772A_CHIPCODE\r\n"); - } - else if(chipcode == 0x20) - { - USB_LOG_ERR("AX_CMD_READ_STATMNGSTS_REG AX_AX88772B_CHIPCODE\r\n"); - } - } - - /* Get the PHY id: E0 10 */ - ret = ax8817x_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf); - if (ret < 0) { - USB_LOG_ERR("Error reading PHY ID: %02x\r\n", ret); - return; - } - if (dev->internalphy) { - dev->mii.phy_id = *((u8 *)buf + 1); - } else { - dev->mii.phy_id = *((u8 *)buf); - } - USB_LOG_INFO("reading %s PHY ID: %02x\r\n", dev->internalphy?"internal":"external", dev->mii.phy_id); - - ret = ax8817x_write_cmd(dev, AX_CMD_SW_PHY_SELECT, dev->PhySelect, 0, 0, NULL); - if (ret < 0) { - USB_LOG_ERR("Select PHY #1 failed: %d", ret); - return; - } - - ret = ax88772a_phy_powerup(dev); - if (ret < 0) { - USB_LOG_ERR("ax88772a_phy_powerup failed: %d", ret); - return; - } - - /* stop MAC operation */ - ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, - AX_RX_CTL_STOP, 0, 0, NULL); - if (ret < 0) { - USB_LOG_ERR("Reset RX_CTL failed: %d", ret); - goto err_out; - } - - /* make sure the driver can enable sw mii operation */ - ret = ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, 0, 0, 0, NULL); - if (ret < 0) { - USB_LOG_ERR("Enabling software MII failed: %d\r\n", ret); - goto err_out; - } - - if ((dev->OperationMode == OPERATION_MAC_MODE) && - (dev->PhySelect == 0x00)) { - USB_LOG_ERR("not support the external phy\r\n"); - goto err_out; - } - - if (dev->OperationMode == OPERATION_PHY_MODE) { - ax8817x_mdio_write_le(dev, dev->mii.phy_id, MII_BMCR, 0x3900); - } - - if (dev->mii.phy_id != 0x10) - { - USB_LOG_ERR("not support phy_id != 0x10\r\n"); - // ax8817x_mdio_write_le(dev->net, 0x10, MII_BMCR, 0x3900); - } - - if (dev->mii.phy_id == 0x10 && dev->OperationMode != OPERATION_PHY_MODE) { - u16 tmp16 = ax8817x_mdio_read_le(dev, dev->mii.phy_id, 0x12); - ax8817x_mdio_write_le(dev, dev->mii.phy_id, 0x12, ((tmp16 & 0xFF9F) | 0x0040)); - } - - ax8817x_mdio_write_le(dev, dev->mii.phy_id, MII_ADVERTISE, - ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP); - - // mii_nway_restart(&dev->mii); - { - /* if autoneg is off, it's an error */ - uint16_t bmcr = ax8817x_mdio_read_le(dev, dev->mii.phy_id, MII_BMCR); - if (bmcr & BMCR_ANENABLE) { - bmcr |= BMCR_ANRESTART; - USB_LOG_ERR("BMCR_ANENABLE ==> BMCR_ANRESTART\r\n"); - ax8817x_mdio_write_le(dev, dev->mii.phy_id, MII_BMCR, bmcr); - } else - { - USB_LOG_ERR("not BMCR_ANENABLE BMCR=%04X\r\n", bmcr); - } - } - - ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, 0, 0, 0, NULL); - if (ret < 0) { - USB_LOG_ERR("Failed to write medium mode: %d", ret); - goto err_out; - } - - ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_IPG0, - AX88772A_IPG0_DEFAULT | AX88772A_IPG1_DEFAULT << 8, - AX88772A_IPG2_DEFAULT, 0, NULL); - if (ret < 0) { - USB_LOG_ERR("Failed to write interframe gap: %d", ret); - goto err_out; - } - - memset(buf, 0, 4); - ret = ax8817x_read_cmd(dev, AX_CMD_READ_IPG012, 0, 0, 3, buf); - *((u8 *)buf + 3) = 0x00; - if (ret < 0) { - USB_LOG_ERR("Failed to read IPG,IPG1,IPG2 failed: %d", ret); - goto err_out; - } else { - uint32_t tmp32 = *((u32*)buf); - le32_to_cpus(&tmp32); - if (tmp32 != (AX88772A_IPG2_DEFAULT << 16 | - AX88772A_IPG1_DEFAULT << 8 | AX88772A_IPG0_DEFAULT)) { - USB_LOG_ERR("Non-authentic ASIX product\nASIX does not support it\n"); - // ret = -ENODEV; - goto err_out; - } - } - - // TODO: optimized for high speed. - ret = ax8817x_write_cmd(dev, 0x2A, 0x8000, 0x8001, 0, NULL); - if (ret < 0) { - USB_LOG_ERR("Reset RX_CTL failed: %d", ret); - goto err_out; - } - - ret = ax88772b_reset(dev); - if (ret < 0) { - USB_LOG_ERR("ax88772b_reset failed: %d", ret); - goto err_out; - } - - // OUT 29 0 0 0 AX_CMD_WRITE_MONITOR_MODE - ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE, 0, 0, 0, NULL); - if (ret < 0) { - deverr(dev, "AX_CMD_WRITE_MONITOR_MODE failed: %d", ret); - } - - /* Set the MAC address */ - ret = ax8817x_write_cmd(dev, AX88772_CMD_WRITE_NODE_ID, - 0, 0, ETH_ALEN, dev->dev_addr); - if (ret < 0) { - deverr(dev, "set MAC address failed: %d", ret); - } - - // update Multicast AX_CMD_WRITE_MULTI_FILTER. - const uint8_t multi_filter[] = {0x00, 0x00, 0x20, 0x80, 0x00, 0x00, 0x00, 0x40}; - ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_MULTI_FILTER, 0, 0, AX_MCAST_FILTER_SIZE, (void *)multi_filter); - if (ret < 0) { - USB_LOG_ERR("Reset RX_CTL failed: %d", ret); - goto err_out; - } - - /* Configure RX header type */ - // u16 rx_reg = (AX_RX_CTL_PRO | AX_RX_CTL_AMALL | AX_RX_CTL_START | AX_RX_CTL_AB | AX_RX_HEADER_DEFAULT); - u16 rx_reg = (AX_RX_CTL_AB | AX_RX_CTL_AM | AX_RX_CTL_START); - ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, rx_reg, 0, 0, NULL); - if (ret < 0) { - USB_LOG_ERR("Reset RX_CTL failed: %d", ret); - goto err_out; - } - - /* set the embedded Ethernet PHY in power-up state */ - // ax772b_data->psc = *tmp16 & 0xFF00; - // psc: 15 5a AX88772C psc: %02x %02x\r\n", buf[0], buf[1]); - ret = ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_IPRL | (0x5a00 & 0x7FFF), - 0, 0, NULL); - if (ret < 0) { - deverr(dev, "Failed to reset PHY: %d", ret); - // return ret; - } - - rt_thread_delay(1000); - u16 mode = AX88772_MEDIUM_DEFAULT; - ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL); - if (ret < 0) { - USB_LOG_ERR("AX_CMD_WRITE_MEDIUM_MODE failed: %d", ret); - goto err_out; - } - -#if USE_RTTHREAD -#ifdef RT_USING_DEVICE_OPS - usbh_axusbnet_eth_device.parent.parent.ops = &rndis_device_ops; -#else - usbh_axusbnet_eth_device.parent.parent.init = rt_rndis_eth_init; - usbh_axusbnet_eth_device.parent.parent.open = rt_rndis_eth_open; - usbh_axusbnet_eth_device.parent.parent.close = rt_rndis_eth_close; - usbh_axusbnet_eth_device.parent.parent.read = rt_rndis_eth_read; - usbh_axusbnet_eth_device.parent.parent.write = rt_rndis_eth_write; - usbh_axusbnet_eth_device.parent.parent.control = rt_rndis_eth_control; -#endif - usbh_axusbnet_eth_device.parent.parent.user_data = RT_NULL; - - usbh_axusbnet_eth_device.parent.eth_rx = rt_rndis_eth_rx; - usbh_axusbnet_eth_device.parent.eth_tx = rt_rndis_eth_tx; - - usbh_axusbnet_eth_device.class = class; - - eth_device_init(&usbh_axusbnet_eth_device.parent, "u0"); - eth_device_linkchange(&usbh_axusbnet_eth_device.parent, RT_FALSE); -#endif /* USE_RTTHREAD */ - // check link status. - { - u16 bmcr = ax8817x_mdio_read_le(dev, dev->mii.phy_id, MII_BMCR); - u16 mode = AX88772_MEDIUM_DEFAULT; - - USB_LOG_ERR("%s L%d MII_BMCR=%04X\r\n", __FUNCTION__, __LINE__, bmcr); - if (!(bmcr & BMCR_FULLDPLX)) - { - mode &= ~AX88772_MEDIUM_FULL_DUPLEX; - USB_LOG_ERR("%s L%d not AX88772_MEDIUM_FULL_DUPLEX\r\n", __FUNCTION__, __LINE__); - } - if (!(bmcr & BMCR_SPEED100)) - { - mode &= ~AX88772_MEDIUM_100MB; - USB_LOG_ERR("%s L%d not AX88772_MEDIUM_100MB\r\n", __FUNCTION__, __LINE__); - } - ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, mode, 0, 0, NULL); - } - - while (1) - { - // USB_LOG_INFO("%s L%d\r\n", __FUNCTION__, __LINE__); - - ret = usbh_ep_bulk_transfer(class->bulkin, class->bulkin_buf, sizeof(class->bulkin_buf), 1000); - if (ret < 0) { - if (ret != -2) { - USB_LOG_ERR("%s L%d bulk in error ret=%d\r\n", __FUNCTION__, __LINE__, ret); - } - continue; - } - - { - const uint8_t *data = class->bulkin_buf; - uint16_t len1, len2; - - len1 = data[0] | ((uint16_t)(data[1])<<8); - len2 = data[2] | ((uint16_t)(data[3])<<8); - - // USB_LOG_INFO("transfer bulkin len1:%04X, len2:%04X, len2':%04X.\r\n", len1, len2, ~len2); - - len1 &= 0x07ff; - - if (data[0] != ((uint8_t)(~data[2]))) { - USB_LOG_ERR("transfer bulkin len1:%04X, len2:%04X, len2':%04X.\r\n", len1, len2, ~len2); - - dump_hex(data, 32); - continue; - } - -#if !USE_RTTHREAD - { - static uint32_t count = 0; - USB_LOG_INFO("recv: #%d, len=%d\r\n", count, ret); - dump_hex(data+4, 32); - - if ((count % 10) == 0) { - // 192.168.89.14 ==> 255.255.255.255:7 echo hello world! - const uint8_t packet_bytes[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00, - 0x00, 0x36, 0xb0, 0xfd, 0x00, 0x00, 0x80, 0x11, - 0x00, 0x00, 0xc0, 0xa8, 0x59, 0x0e, 0xff, 0xff, - 0xff, 0xff, 0x00, 0x07, 0x00, 0x07, 0x00, 0x22, - 0x53, 0x06, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, - 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x20, 0x66, 0x72, - 0x6f, 0x6d, 0x20, 0x41, 0x58, 0x38, 0x38, 0x37, - 0x37, 0x32, 0x43, 0x2e - }; - - uint8_t *send_buf = (uint8_t *)class->bulkin_buf; - send_buf[0] = sizeof(packet_bytes); - send_buf[1] = sizeof(packet_bytes) >> 8; - send_buf[2] = ~send_buf[0]; - send_buf[3] = ~send_buf[1]; - memcpy(send_buf+4, packet_bytes, sizeof(packet_bytes)); - memcpy(send_buf+4+6, dev->dev_addr, 6);// update src mac. - - ret = usbh_ep_bulk_transfer(class->bulkout, send_buf, 4 + sizeof(packet_bytes), 500); - USB_LOG_INFO("bulkout, ret=%d\r\n", ret); - dump_hex(send_buf, 64); - } - - count++; - } -#endif /* RT-Thread */ - -#if USE_RTTHREAD - { - static uint32_t count = 0; - - if (count == 0) { - eth_device_linkchange(&usbh_axusbnet_eth_device.parent, RT_TRUE); - } - - count++; - } - - /* allocate buffer */ - struct pbuf *p = RT_NULL; - p = pbuf_alloc(PBUF_LINK, len1, PBUF_RAM); - if (p != NULL) { - pbuf_take(p, data + 4, len1); - -#ifdef RX_DUMP - packet_dump("RX", p); -#endif /* RX_DUMP */ - struct eth_device *eth_dev = &usbh_axusbnet_eth_device.parent; - if ((eth_dev->netif->input(p, eth_dev->netif)) != ERR_OK) { - USB_LOG_INFO("F:%s L:%d IP input error\r\n", __FUNCTION__, __LINE__); - pbuf_free(p); - p = RT_NULL; - } - // USB_LOG_INFO("%s L%d input OK\r\n", __FUNCTION__, __LINE__); - } else { - USB_LOG_ERR("%s L%d pbuf_alloc NULL\r\n", __FUNCTION__, __LINE__); - } -#endif /* RT-Thread */ - } - } // while (1) - -err_out: -out2: - - return; -} - -static int axusbnet_startup(void) -{ - const char *tname = "axusbnet"; - usb_osal_thread_t usb_thread; - - usb_thread = usb_osal_thread_create(tname, 1024 * 6, CONFIG_USBHOST_PSC_PRIO, rt_thread_axusbnet_entry, NULL); - if (usb_thread == NULL) { - return -1; - } - - return 0; -} - -static int usbh_axusbnet_connect(struct usbh_hubport *hport, uint8_t intf) -{ - int ret = 0; - struct usbh_endpoint_cfg ep_cfg = { 0 }; - struct usb_endpoint_descriptor *ep_desc; - - USB_LOG_INFO("%s %d\r\n", __FUNCTION__, __LINE__); - - struct usbh_axusbnet *class = usb_malloc(sizeof(struct usbh_axusbnet)); - if (class == NULL) - { - USB_LOG_ERR("Fail to alloc class\r\n"); - return -ENOMEM; - } - memset(class, 0, sizeof(struct usbh_axusbnet)); - class->hport = hport; - - class->intf = intf; - - snprintf(hport->config.intf[intf].devname, CONFIG_USBHOST_DEV_NAMELEN, DEV_FORMAT, intf); - USB_LOG_INFO("Register axusbnet Class:%s\r\n", hport->config.intf[intf].devname); - hport->config.intf[intf].priv = class; - -#if 1 - USB_LOG_INFO("hport=%p, intf=%d, intf_desc.bNumEndpoints:%d\r\n", hport, intf, hport->config.intf[intf].intf_desc.bNumEndpoints); - for (uint8_t i = 0; i < hport->config.intf[intf].intf_desc.bNumEndpoints; i++) - { - ep_desc = &hport->config.intf[intf].ep[i].ep_desc; - - USB_LOG_INFO("ep[%d] bLength=%d, type=%d\r\n", i, ep_desc->bLength, ep_desc->bDescriptorType); - USB_LOG_INFO("ep_addr=%02X, attr=%02X\r\n", ep_desc->bEndpointAddress, ep_desc->bmAttributes & USB_ENDPOINT_TYPE_MASK); - USB_LOG_INFO("wMaxPacketSize=%d, bInterval=%d\r\n\r\n", ep_desc->wMaxPacketSize, ep_desc->bInterval); - } -#endif - - for (uint8_t i = 0; i < hport->config.intf[intf].intf_desc.bNumEndpoints; i++) - { - ep_desc = &hport->config.intf[intf].ep[i].ep_desc; - - ep_cfg.ep_addr = ep_desc->bEndpointAddress; - ep_cfg.ep_type = ep_desc->bmAttributes & USB_ENDPOINT_TYPE_MASK; - ep_cfg.ep_mps = ep_desc->wMaxPacketSize; - ep_cfg.ep_interval = ep_desc->bInterval; - ep_cfg.hport = hport; - - if(ep_cfg.ep_type == USB_ENDPOINT_TYPE_BULK) - { - if (ep_desc->bEndpointAddress & 0x80) { - usbh_pipe_alloc(&class->bulkin, &ep_cfg); - } else { - usbh_pipe_alloc(&class->bulkout, &ep_cfg); - } - } - else - { - usbh_pipe_alloc(&class->int_notify, &ep_cfg); - } - } - - axusbnet_startup(); - - return ret; -} - -static int usbh_axusbnet_disconnect(struct usbh_hubport *hport, uint8_t intf) -{ - int ret = 0; - - USB_LOG_ERR("TBD: %s %d\r\n", __FUNCTION__, __LINE__); - return ret; -} - -// Class:0xff,Subclass:0xff,Protocl:0x00 -static const struct usbh_class_driver axusbnet_class_driver = { - .driver_name = "axusbnet", - .connect = usbh_axusbnet_connect, - .disconnect = usbh_axusbnet_disconnect -}; - -CLASS_INFO_DEFINE const struct usbh_class_info axusbnet_class_info = { - .match_flags = USB_CLASS_MATCH_VENDOR | USB_CLASS_MATCH_PRODUCT | USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS | USB_CLASS_MATCH_INTF_PROTOCOL, - .class = USB_DEVICE_CLASS_VEND_SPECIFIC, - .subclass = 0xff, - .protocol = 0x00, - .vid = 0x0b95, - .pid = 0x772b, - .class_driver = &axusbnet_class_driver -}; diff --git a/third-party/cherryusb/class/vendor/axusbnet.h b/third-party/cherryusb/class/vendor/axusbnet.h deleted file mode 100644 index 75badc45f1c854e198454972e9aa2545097cf8fc..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/vendor/axusbnet.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2022, aozima - * - * SPDX-License-Identifier: Apache-2.0 - */ -/* - * Change Logs - * Date Author Notes - * 2022-04-17 aozima the first version for CherryUSB. - */ - -#ifndef __USB_CLASHH_AXUSBNET_H__ -#define __USB_CLASHH_AXUSBNET_H__ - -#include "usbh_core.h" -#include "asix.h" - -struct usbh_axusbnet { - struct usbh_hubport *hport; - - uint8_t intf; /* interface number */ - - usbh_pipe_t int_notify; /* Notify endpoint */ - usbh_pipe_t bulkin; /* Bulk IN endpoint */ - usbh_pipe_t bulkout; /* Bulk OUT endpoint */ - - uint32_t bulkin_buf[2048/sizeof(uint32_t)]; -}; - -#endif /* __USB_CLASHH_AXUSBNET_H__ */ diff --git a/third-party/cherryusb/class/vendor/usbh_air724.c b/third-party/cherryusb/class/vendor/usbh_air724.c deleted file mode 100644 index 04de5646c0c8775b9e1f5439f83f1cd42ca68ced..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/vendor/usbh_air724.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbh_core.h" - -#define DEV_FORMAT "/dev/air724" - -struct usbh_cdc_custom_air724 { - struct usbh_hubport *hport; - - usbh_pipe_t bulkin; /* Bulk IN endpoint */ - usbh_pipe_t bulkout; /* Bulk OUT endpoint */ - struct usbh_urb bulkin_urb; /* Bulk IN urb */ - struct usbh_urb bulkout_urb; /* Bulk OUT urb */ -}; - -static inline int usbh_air724_bulk_out_transfer(struct usbh_cdc_custom_air724 *cdc_custom_class, uint8_t *buffer, uint32_t buflen, uint32_t timeout) -{ - int ret; - struct usbh_urb *urb = &cdc_custom_class->bulkout_urb; - memset(urb, 0, sizeof(struct usbh_urb)); - - usbh_bulk_urb_fill(urb, cdc_custom_class->bulkout, buffer, buflen, timeout, NULL, NULL); - ret = usbh_submit_urb(urb); - if (ret == 0) { - ret = urb->actual_length; - } - return ret; -} - -int usbh_air724_connect(struct usbh_hubport *hport, uint8_t intf) -{ - struct usbh_endpoint_cfg ep_cfg = { 0 }; - struct usb_endpoint_descriptor *ep_desc; - int ret; - - if (intf != 3) { - USB_LOG_WRN("ignore intf:%d\r\n", intf); - return 0; - } - struct usbh_cdc_custom_air724 *cdc_custom_class = usb_malloc(sizeof(struct usbh_cdc_custom_air724)); - if (cdc_custom_class == NULL) { - USB_LOG_ERR("Fail to alloc cdc_custom_class\r\n"); - return -ENOMEM; - } - - memset(cdc_custom_class, 0, sizeof(struct usbh_cdc_custom_air724)); - cdc_custom_class->hport = hport; - - strncpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); - - hport->config.intf[intf].priv = cdc_custom_class; - - for (uint8_t i = 0; i < hport->config.intf[intf].altsetting[0].intf_desc.bNumEndpoints; i++) { - ep_desc = &hport->config.intf[intf].altsetting[0].ep[i].ep_desc; - - if (ep_desc->bEndpointAddress & 0x80) { - usbh_hport_activate_epx(&cdc_custom_class->bulkin, hport, ep_desc); - } else { - usbh_hport_activate_epx(&cdc_custom_class->bulkout, hport, ep_desc); - } - } - - USB_LOG_INFO("Register air724 Class:%s\r\n", hport->config.intf[intf].devname); - - uint8_t cdc_buffer[32] = { 0x41, 0x54, 0x0d, 0x0a }; - ret = usbh_air724_bulk_out_transfer(cdc_custom_class->bulkout, cdc_buffer, 4, 3000); - if (ret < 0) { - USB_LOG_ERR("bulk out error,ret:%d\r\n", ret); - } else { - USB_LOG_RAW("send over:%d\r\n", ret); - } - ret = usbh_air724_bulk_out_transfer(cdc_custom_class->bulkin, cdc_buffer, 10, 3000); - if (ret < 0) { - USB_LOG_ERR("bulk in error,ret:%d\r\n", ret); - } else { - USB_LOG_RAW("recv over:%d\r\n", ret); - for (size_t i = 0; i < ret; i++) { - USB_LOG_RAW("0x%02x ", cdc_buffer[i]); - } - } - - return ret; -} - -int usbh_air724_disconnect(struct usbh_hubport *hport, uint8_t intf) -{ - return 0; -} - -const struct usbh_class_driver cdc_custom_class_driver = { - .driver_name = "cdc_acm", - .connect = usbh_air724_connect, - .disconnect = usbh_air724_disconnect -}; - -CLASS_INFO_DEFINE const struct usbh_class_info cdc_custom_class_info = { - .match_flags = USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS | USB_CLASS_MATCH_INTF_PROTOCOL, - .class = 0xff, - .subclass = 0, - .protocol = 0, - .vid = 0x1782, - .pid = 0x4e00, - .class_driver = &cdc_custom_class_driver -}; diff --git a/third-party/cherryusb/class/video/usb_video.h b/third-party/cherryusb/class/video/usb_video.h deleted file mode 100644 index 4997526baab2355d201aa756c4aac683b1247202..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/video/usb_video.h +++ /dev/null @@ -1,1198 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_VIDEO_H -#define USB_VIDEO_H - -#define USB_DEVICE_VIDEO_CLASS_VERSION_1_5 0 - -/*! @brief Video device subclass code */ -#define VIDEO_SC_UNDEFINED 0x00U -#define VIDEO_SC_VIDEOCONTROL 0x01U -#define VIDEO_SC_VIDEOSTREAMING 0x02U -#define VIDEO_SC_VIDEO_INTERFACE_COLLECTION 0x03U - -/*! @brief Video device protocol code */ -#define VIDEO_PC_PROTOCOL_UNDEFINED 0x00U -#define VIDEO_PC_PROTOCOL_15 0x01U - -/*! @brief Video device class-specific descriptor type */ -#define VIDEO_CS_UNDEFINED_DESCRIPTOR_TYPE 0x20U -#define VIDEO_CS_DEVICE_DESCRIPTOR_TYPE 0x21U -#define VIDEO_CS_CONFIGURATION_DESCRIPTOR_TYPE 0x22U -#define VIDEO_CS_STRING_DESCRIPTOR_TYPE 0x23U -#define VIDEO_CS_INTERFACE_DESCRIPTOR_TYPE 0x24U -#define VIDEO_CS_ENDPOINT_DESCRIPTOR_TYPE 0x25U - -/*! @brief Video device class-specific VC interface descriptor subtype */ -#define VIDEO_VC_DESCRIPTOR_UNDEFINED_DESCRIPTOR_SUBTYPE 0x00U -#define VIDEO_VC_HEADER_DESCRIPTOR_SUBTYPE 0x01U -#define VIDEO_VC_INPUT_TERMINAL_DESCRIPTOR_SUBTYPE 0x02U -#define VIDEO_VC_OUTPUT_TERMINAL_DESCRIPTOR_SUBTYPE 0x03U -#define VIDEO_VC_SELECTOR_UNIT_DESCRIPTOR_SUBTYPE 0x04U -#define VIDEO_VC_PROCESSING_UNIT_DESCRIPTOR_SUBTYPE 0x05U -#define VIDEO_VC_EXTENSION_UNIT_DESCRIPTOR_SUBTYPE 0x06U -#define VIDEO_VC_ENCODING_UNIT_DESCRIPTOR_SUBTYPE 0x07U - -/*! @brief Video device class-specific VS interface descriptor subtype */ -#define VIDEO_VS_UNDEFINED_DESCRIPTOR_SUBTYPE 0x00U -#define VIDEO_VS_INPUT_HEADER_DESCRIPTOR_SUBTYPE 0x01U -#define VIDEO_VS_OUTPUT_HEADER_DESCRIPTOR_SUBTYPE 0x02U -#define VIDEO_VS_STILL_IMAGE_FRAME_DESCRIPTOR_SUBTYPE 0x03U -#define VIDEO_VS_FORMAT_UNCOMPRESSED_DESCRIPTOR_SUBTYPE 0x04U -#define VIDEO_VS_FRAME_UNCOMPRESSED_DESCRIPTOR_SUBTYPE 0x05U -#define VIDEO_VS_FORMAT_MJPEG_DESCRIPTOR_SUBTYPE 0x06U -#define VIDEO_VS_FRAME_MJPEG_DESCRIPTOR_SUBTYPE 0x07U -#define VIDEO_VS_FORMAT_MPEG2TS_DESCRIPTOR_SUBTYPE 0x0AU -#define VIDEO_VS_FORMAT_DV_DESCRIPTOR_SUBTYPE 0x0CU -#define VIDEO_VS_COLORFORMAT_DESCRIPTOR_SUBTYPE 0x0DU -#define VIDEO_VS_FORMAT_FRAME_BASED_DESCRIPTOR_SUBTYPE 0x10U -#define VIDEO_VS_FRAME_FRAME_BASED_DESCRIPTOR_SUBTYPE 0x11U -#define VIDEO_VS_FORMAT_STREAM_BASED_DESCRIPTOR_SUBTYPE 0x12U -#define VIDEO_VS_FORMAT_H264_DESCRIPTOR_SUBTYPE 0x13U -#define VIDEO_VS_FRAME_H264_DESCRIPTOR_SUBTYPE 0x14U -#define VIDEO_VS_FORMAT_H264_SIMULCAST_DESCRIPTOR_SUBTYPE 0x15U -#define VIDEO_VS_FORMAT_VP8_DESCRIPTOR_SUBTYPE 0x16U -#define VIDEO_VS_FRAME_VP8_DESCRIPTOR_SUBTYPE 0x17U -#define VIDEO_VS_FORMAT_VP8_SIMULCAST_DESCRIPTOR_SUBTYPE 0x18U - -/*! @brief Video device class-specific VC endpoint descriptor subtype */ -#define VIDEO_EP_UNDEFINED_DESCRIPTOR_SUBTYPE 0x00U -#define VIDEO_EP_GENERAL_DESCRIPTOR_SUBTYPE 0x01U -#define VIDEO_EP_ENDPOINT_DESCRIPTOR_SUBTYPE 0x02U -#define VIDEO_EP_INTERRUPT_DESCRIPTOR_SUBTYPE 0x03U - -/*! @brief Video device class-specific request code */ -#define VIDEO_REQUEST_UNDEFINED 0x00U -#define VIDEO_REQUEST_SET_CUR 0x01U -#define VIDEO_REQUEST_SET_CUR_ALL 0x11U -#define VIDEO_REQUEST_GET_CUR 0x81U -#define VIDEO_REQUEST_GET_MIN 0x82U -#define VIDEO_REQUEST_GET_MAX 0x83U -#define VIDEO_REQUEST_GET_RES 0x84U -#define VIDEO_REQUEST_GET_LEN 0x85U -#define VIDEO_REQUEST_GET_INFO 0x86U -#define VIDEO_REQUEST_GET_DEF 0x87U -#define VIDEO_REQUEST_GET_CUR_ALL 0x91U -#define VIDEO_REQUEST_GET_MIN_ALL 0x92U -#define VIDEO_REQUEST_GET_MAX_ALL 0x93U -#define VIDEO_REQUEST_GET_RES_ALL 0x94U -#define VIDEO_REQUEST_GET_DEF_ALL 0x97U - -/*! @brief Video device class-specific VideoControl interface control selector */ -#define VIDEO_VC_CONTROL_UNDEFINED 0x00U -#define VIDEO_VC_VIDEO_POWER_MODE_CONTROL 0x01U -#define VIDEO_VC_REQUEST_ERROR_CODE_CONTROL 0x02U - -/*! @brief Video device class-specific Terminal control selector */ -#define VIDEO_TE_CONTROL_UNDEFINED 0x00U - -/*! @brief Video device class-specific Selector Unit control selector */ -#define VIDEO_SU_CONTROL_UNDEFINED 0x00U -#define VIDEO_SU_INPUT_SELECT_CONTROL 0x01U - -/*! @brief Video device class-specific Camera Terminal control selector */ -#define VIDEO_CT_CONTROL_UNDEFINED 0x00U -#define VIDEO_CT_SCANNING_MODE_CONTROL 0x01U -#define VIDEO_CT_AE_MODE_CONTROL 0x02U -#define VIDEO_CT_AE_PRIORITY_CONTROL 0x03U -#define VIDEO_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x04U -#define VIDEO_CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x05U -#define VIDEO_CT_FOCUS_ABSOLUTE_CONTROL 0x06U -#define VIDEO_CT_FOCUS_RELATIVE_CONTROL 0x07U -#define VIDEO_CT_FOCUS_AUTO_CONTROL 0x08U -#define VIDEO_CT_IRIS_ABSOLUTE_CONTROL 0x09U -#define VIDEO_CT_IRIS_RELATIVE_CONTROL 0x0AU -#define VIDEO_CT_ZOOM_ABSOLUTE_CONTROL 0x0BU -#define VIDEO_CT_ZOOM_RELATIVE_CONTROL 0x0CU -#define VIDEO_CT_PANTILT_ABSOLUTE_CONTROL 0x0DU -#define VIDEO_CT_PANTILT_RELATIVE_CONTROL 0x0EU -#define VIDEO_CT_ROLL_ABSOLUTE_CONTROL 0x0FU -#define VIDEO_CT_ROLL_RELATIVE_CONTROL 0x10U -#define VIDEO_CT_PRIVACY_CONTROL 0x11U -#define VIDEO_CT_FOCUS_SIMPLE_CONTROL 0x12U -#define VIDEO_CT_WINDOW_CONTROL 0x13U -#define VIDEO_CT_REGION_OF_INTEREST_CONTROL 0x14U - -/*! @brief Video device class-specific Processing Unit control selector */ -#define VIDEO_PU_CONTROL_UNDEFINED 0x00U -#define VIDEO_PU_BACKLIGHT_COMPENSATION_CONTROL 0x01U -#define VIDEO_PU_BRIGHTNESS_CONTROL 0x02U -#define VIDEO_PU_CONTRAST_CONTROL 0x03U -#define VIDEO_PU_GAIN_CONTROL 0x04U -#define VIDEO_PU_POWER_LINE_FREQUENCY_CONTROL 0x05U -#define VIDEO_PU_HUE_CONTROL 0x06U -#define VIDEO_PU_SATURATION_CONTROL 0x07U -#define VIDEO_PU_SHARPNESS_CONTROL 0x08U -#define VIDEO_PU_GAMMA_CONTROL 0x09U -#define VIDEO_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x0AU -#define VIDEO_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x0BU -#define VIDEO_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x0CU -#define VIDEO_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x0DU -#define VIDEO_PU_DIGITAL_MULTIPLIER_CONTROL 0x0EU -#define VIDEO_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x0FU -#define VIDEO_PU_HUE_AUTO_CONTROL 0x10U -#define VIDEO_PU_ANALOG_VIDEO_STANDARD_CONTROL 0x11U -#define VIDEO_PU_ANALOG_LOCK_STATUS_CONTROL 0x12U -#define VIDEO_PU_CONTRAST_AUTO_CONTROL 0x13U - -/*! @brief Video device class-specific Encoding Unit control selector */ -#define VIDEO_EU_CONTROL_UNDEFINED 0x00U -#define VIDEO_EU_SELECT_LAYER_CONTROL 0x01U -#define VIDEO_EU_PROFILE_TOOLSET_CONTROL 0x02U -#define VIDEO_EU_VIDEO_RESOLUTION_CONTROL 0x03U -#define VIDEO_EU_MIN_FRAME_INTERVAL_CONTROL 0x04U -#define VIDEO_EU_SLICE_MODE_CONTROL 0x05U -#define VIDEO_EU_RATE_CONTROL_MODE_CONTROL 0x06U -#define VIDEO_EU_AVERAGE_BITRATE_CONTROL 0x07U -#define VIDEO_EU_CPB_SIZE_CONTROL 0x08U -#define VIDEO_EU_PEAK_BIT_RATE_CONTROL 0x09U -#define VIDEO_EU_QUANTIZATION_PARAMS_CONTROL 0x0AU -#define VIDEO_EU_SYNC_REF_FRAME_CONTROL 0x0BU -#define VIDEO_EU_LTR_BUFFER_CONTROL 0x0CU -#define VIDEO_EU_LTR_PICTURE_CONTROL 0x0DU -#define VIDEO_EU_LTR_VALIDATION_CONTROL 0x0EU -#define VIDEO_EU_LEVEL_IDC_LIMIT_CONTROL 0x0FU -#define VIDEO_EU_SEI_PAYLOADTYPE_CONTROL 0x10U -#define VIDEO_EU_QP_RANGE_CONTROL 0x11U -#define VIDEO_EU_PRIORITY_CONTROL 0x12U -#define VIDEO_EU_START_OR_STOP_LAYER_CONTROL 0x13U -#define VIDEO_EU_ERROR_RESILIENCY_CONTROL 0x14U - -/*! @brief Video device class-specific Extension Unit control selector */ -#define VIDEO_XU_CONTROL_UNDEFINED 0x00U - -/*! @brief Video device class-specific VideoStreaming Interface control selector */ -#define VIDEO_VS_CONTROL_UNDEFINED 0x00U -#define VIDEO_VS_PROBE_CONTROL 0x01U -#define VIDEO_VS_COMMIT_CONTROL 0x02U -#define VIDEO_VS_STILL_PROBE_CONTROL 0x03U -#define VIDEO_VS_STILL_COMMIT_CONTROL 0x04U -#define VIDEO_VS_STILL_IMAGE_TRIGGER_CONTROL 0x05U -#define VIDEO_VS_STREAM_ERROR_CODE_CONTROL 0x06U -#define VIDEO_VS_GENERATE_KEY_FRAME_CONTROL 0x07U -#define VIDEO_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08U -#define VIDEO_VS_SYNCH_DELAY_CONTROL 0x09U - -/*! @}*/ - -/*! - * @name USB Video class terminal types - * @{ - */ - -/*! @brief Video device USB terminal type */ -#define VIDEO_TT_VENDOR_SPECIFIC 0x0100U -#define VIDEO_TT_STREAMING 0x0101U - -/*! @brief Video device input terminal type */ -#define VIDEO_ITT_VENDOR_SPECIFIC 0x0200U -#define VIDEO_ITT_CAMERA 0x0201U -#define VIDEO_ITT_MEDIA_TRANSPORT_INPUT 0x0202U - -/*! @brief Video device output terminal type */ -#define VIDEO_OTT_VENDOR_SPECIFIC 0x0300U -#define VIDEO_OTT_DISPLAY 0x0301U -#define VIDEO_OTT_MEDIA_TRANSPORT_OUTPUT 0x0302U - -/*! @brief Video device external terminal type */ -#define VIDEO_ET_VENDOR_SPECIFIC 0x0400U -#define VIDEO_ET_COMPOSITE_CONNECTOR 0x0401U -#define VIDEO_ET_SVIDEO_CONNECTOR 0x0402U -#define VIDEO_ET_COMPONENT_CONNECTOR 0x0403U - -/*! @}*/ - -/*! - * @name USB Video class setup request types - * @{ - */ - -/*! @brief Video device class setup request set type */ -#define VIDEO_SET_REQUEST_INTERFACE 0x21U -#define VIDEO_SET_REQUEST_ENDPOINT 0x22U - -/*! @brief Video device class setup request get type */ -#define VIDEO_GET_REQUEST_INTERFACE 0xA1U -#define VIDEO_GET_REQUEST_ENDPOINT 0xA2U - -/*! @}*/ - -/*! @brief Video device still image trigger control */ -#define VIDEO_STILL_IMAGE_TRIGGER_NORMAL_OPERATION 0x00U -#define VIDEO_STILL_IMAGE_TRIGGER_TRANSMIT_STILL_IMAGE 0x01U -#define VIDEO_STILL_IMAGE_TRIGGER_TRANSMIT_STILL_IMAGE_VS_DEDICATED_BULK_PIPE 0x02U -#define VIDEO_STILL_IMAGE_TRIGGER_ABORT_STILL_IMAGE_TRANSMISSION 0x03U - -/*! - * @name USB Video device class-specific request commands - * @{ - */ - -/*! @brief Video device class-specific request GET CUR COMMAND */ -#define VIDEO_GET_CUR_VC_POWER_MODE_CONTROL 0x8101U -#define VIDEO_GET_CUR_VC_ERROR_CODE_CONTROL 0x8102U - -#define VIDEO_GET_CUR_PU_BACKLIGHT_COMPENSATION_CONTROL 0x8121U -#define VIDEO_GET_CUR_PU_BRIGHTNESS_CONTROL 0x8122U -#define VIDEO_GET_CUR_PU_CONTRACT_CONTROL 0x8123U -#define VIDEO_GET_CUR_PU_GAIN_CONTROL 0x8124U -#define VIDEO_GET_CUR_PU_POWER_LINE_FREQUENCY_CONTROL 0x8125U -#define VIDEO_GET_CUR_PU_HUE_CONTROL 0x8126U -#define VIDEO_GET_CUR_PU_SATURATION_CONTROL 0x8127U -#define VIDEO_GET_CUR_PU_SHARRNESS_CONTROL 0x8128U -#define VIDEO_GET_CUR_PU_GAMMA_CONTROL 0x8129U -#define VIDEO_GET_CUR_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x812AU -#define VIDEO_GET_CUR_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x812BU -#define VIDEO_GET_CUR_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x812CU -#define VIDEO_GET_CUR_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x812DU -#define VIDEO_GET_CUR_PU_DIGITAL_MULTIPLIER_CONTROL 0x812EU -#define VIDEO_GET_CUR_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x812FU -#define VIDEO_GET_CUR_PU_HUE_AUTO_CONTROL 0x8130U -#define VIDEO_GET_CUR_PU_ANALOG_VIDEO_STANDARD_CONTROL 0x8131U -#define VIDEO_GET_CUR_PU_ANALOG_LOCK_STATUS_CONTROL 0x8132U -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_GET_CUR_PU_CONTRAST_AUTO_CONTROL 0x8133U -#endif - -#define VIDEO_GET_CUR_CT_SCANNING_MODE_CONTROL 0x8141U -#define VIDEO_GET_CUR_CT_AE_MODE_CONTROL 0x8142U -#define VIDEO_GET_CUR_CT_AE_PRIORITY_CONTROL 0x8143U -#define VIDEO_GET_CUR_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x8144U -#define VIDEO_GET_CUR_CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x8145U -#define VIDEO_GET_CUR_CT_FOCUS_ABSOLUTE_CONTROL 0x8146U -#define VIDEO_GET_CUR_CT_FOCUS_RELATIVE_CONTROL 0x8147U -#define VIDEO_GET_CUR_CT_FOCUS_AUTO_CONTROL 0x8148U -#define VIDEO_GET_CUR_CT_IRIS_ABSOLUTE_CONTROL 0x8149U -#define VIDEO_GET_CUR_CT_IRIS_RELATIVE_CONTROL 0x814AU -#define VIDEO_GET_CUR_CT_ZOOM_ABSOLUTE_CONTROL 0x814BU -#define VIDEO_GET_CUR_CT_ZOOM_RELATIVE_CONTROL 0x814CU -#define VIDEO_GET_CUR_CT_PANTILT_ABSOLUTE_CONTROL 0x814DU -#define VIDEO_GET_CUR_CT_PANTILT_RELATIVE_CONTROL 0x814EU -#define VIDEO_GET_CUR_CT_ROLL_ABSOLUTE_CONTROL 0x814FU -#define VIDEO_GET_CUR_CT_ROLL_RELATIVE_CONTROL 0x8150U -#define VIDEO_GET_CUR_CT_PRIVACY_CONTROL 0x8151U -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_GET_CUR_CT_FOCUS_SIMPLE_CONTROL 0x8152U -#define VIDEO_GET_CUR_CT_DIGITAL_WINDOW_CONTROL 0x8153U -#define VIDEO_GET_CUR_CT_REGION_OF_INTEREST_CONTROL 0x8154U -#endif - -#define VIDEO_GET_CUR_VS_PROBE_CONTROL 0x8161U -#define VIDEO_GET_CUR_VS_COMMIT_CONTROL 0x8162U -#define VIDEO_GET_CUR_VS_STILL_PROBE_CONTROL 0x8163U -#define VIDEO_GET_CUR_VS_STILL_COMMIT_CONTROL 0x8164U -#define VIDEO_GET_CUR_VS_STILL_IMAGE_TRIGGER_CONTROL 0x8165U -#define VIDEO_GET_CUR_VS_STREAM_ERROR_CODE_CONTROL 0x8166U -#define VIDEO_GET_CUR_VS_GENERATE_KEY_FRAME_CONTROL 0x8167U -#define VIDEO_GET_CUR_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x8168U -#define VIDEO_GET_CUR_VS_SYNCH_DELAY_CONTROL 0x8169U - -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_GET_CUR_EU_SELECT_LAYER_CONTROL 0x8181U -#define VIDEO_GET_CUR_EU_PROFILE_TOOLSET_CONTROL 0x8182U -#define VIDEO_GET_CUR_EU_VIDEO_RESOLUTION_CONTROL 0x8183U -#define VIDEO_GET_CUR_EU_MIN_FRAME_INTERVAL_CONTROL 0x8184U -#define VIDEO_GET_CUR_EU_SLICE_MODE_CONTROL 0x8185U -#define VIDEO_GET_CUR_EU_RATE_CONTROL_MODE_CONTROL 0x8186U -#define VIDEO_GET_CUR_EU_AVERAGE_BITRATE_CONTROL 0x8187U -#define VIDEO_GET_CUR_EU_CPB_SIZE_CONTROL 0x8188U -#define VIDEO_GET_CUR_EU_PEAK_BIT_RATE_CONTROL 0x8189U -#define VIDEO_GET_CUR_EU_QUANTIZATION_PARAMS_CONTROL 0x818AU -#define VIDEO_GET_CUR_EU_SYNC_REF_FRAME_CONTROL 0x818BU -#define VIDEO_GET_CUR_EU_LTR_BUFFER_CONTROL 0x818CU -#define VIDEO_GET_CUR_EU_LTR_PICTURE_CONTROL 0x818DU -#define VIDEO_GET_CUR_EU_LTR_VALIDATION_CONTROL 0x818EU -#define VIDEO_GET_CUR_EU_LEVEL_IDC_LIMIT_CONTROL 0x818FU -#define VIDEO_GET_CUR_EU_SEI_PAYLOADTYPE_CONTROL 0x8190U -#define VIDEO_GET_CUR_EU_QP_RANGE_CONTROL 0x8191U -#define VIDEO_GET_CUR_EU_PRIORITY_CONTROL 0x8192U -#define VIDEO_GET_CUR_EU_START_OR_STOP_LAYER_CONTROL 0x8193U -#define VIDEO_GET_CUR_EU_ERROR_RESILIENCY_CONTROL 0x8194U -#endif - -/*! @brief Video device class-specific request GET MIN COMMAND */ -#define VIDEO_GET_MIN_PU_BACKLIGHT_COMPENSATION_CONTROL 0x8221U -#define VIDEO_GET_MIN_PU_BRIGHTNESS_CONTROL 0x8222U -#define VIDEO_GET_MIN_PU_CONTRACT_CONTROL 0x8223U -#define VIDEO_GET_MIN_PU_GAIN_CONTROL 0x8224U -#define VIDEO_GET_MIN_PU_HUE_CONTROL 0x8226U -#define VIDEO_GET_MIN_PU_SATURATION_CONTROL 0x8227U -#define VIDEO_GET_MIN_PU_SHARRNESS_CONTROL 0x8228U -#define VIDEO_GET_MIN_PU_GAMMA_CONTROL 0x8229U -#define VIDEO_GET_MIN_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x822AU -#define VIDEO_GET_MIN_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x822CU -#define VIDEO_GET_MIN_PU_DIGITAL_MULTIPLIER_CONTROL 0x822EU -#define VIDEO_GET_MIN_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x822FU - -#define VIDEO_GET_MIN_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x8244U -#define VIDEO_GET_MIN_CT_FOCUS_ABSOLUTE_CONTROL 0x8246U -#define VIDEO_GET_MIN_CT_FOCUS_RELATIVE_CONTROL 0x8247U -#define VIDEO_GET_MIN_CT_IRIS_ABSOLUTE_CONTROL 0x8249U -#define VIDEO_GET_MIN_CT_ZOOM_ABSOLUTE_CONTROL 0x824BU -#define VIDEO_GET_MIN_CT_ZOOM_RELATIVE_CONTROL 0x824CU -#define VIDEO_GET_MIN_CT_PANTILT_ABSOLUTE_CONTROL 0x824DU -#define VIDEO_GET_MIN_CT_PANTILT_RELATIVE_CONTROL 0x824EU -#define VIDEO_GET_MIN_CT_ROLL_ABSOLUTE_CONTROL 0x824FU -#define VIDEO_GET_MIN_CT_ROLL_RELATIVE_CONTROL 0x8250U -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_GET_MIN_CT_DIGITAL_WINDOW_CONTROL 0x8251U -#define VIDEO_GET_MIN_CT_REGION_OF_INTEREST_CONTROL 0x8252U -#endif - -#define VIDEO_GET_MIN_VS_PROBE_CONTROL 0x8261U -#define VIDEO_GET_MIN_VS_STILL_PROBE_CONTROL 0x8263U -#define VIDEO_GET_MIN_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x8268U -#define VIDEO_GET_MIN_VS_SYNCH_DELAY_CONTROL 0x8269U - -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_GET_MIN_EU_VIDEO_RESOLUTION_CONTROL 0x8283U -#define VIDEO_GET_MIN_EU_MIN_FRAME_INTERVAL_CONTROL 0x8284U -#define VIDEO_GET_MIN_EU_SLICE_MODE_CONTROL 0x8285U -#define VIDEO_GET_MIN_EU_AVERAGE_BITRATE_CONTROL 0x8287U -#define VIDEO_GET_MIN_EU_CPB_SIZE_CONTROL 0x8288U -#define VIDEO_GET_MIN_EU_PEAK_BIT_RATE_CONTROL 0x8289U -#define VIDEO_GET_MIN_EU_QUANTIZATION_PARAMS_CONTROL 0x828AU -#define VIDEO_GET_MIN_EU_SYNC_REF_FRAME_CONTROL 0x828BU -#define VIDEO_GET_MIN_EU_LEVEL_IDC_LIMIT_CONTROL 0x828FU -#define VIDEO_GET_MIN_EU_SEI_PAYLOADTYPE_CONTROL 0x8290U -#define VIDEO_GET_MIN_EU_QP_RANGE_CONTROL 0x8291U -#endif - -/*! @brief Video device class-specific request GET MAX COMMAND */ -#define VIDEO_GET_MAX_PU_BACKLIGHT_COMPENSATION_CONTROL 0x8321U -#define VIDEO_GET_MAX_PU_BRIGHTNESS_CONTROL 0x8322U -#define VIDEO_GET_MAX_PU_CONTRACT_CONTROL 0x8323U -#define VIDEO_GET_MAX_PU_GAIN_CONTROL 0x8324U -#define VIDEO_GET_MAX_PU_HUE_CONTROL 0x8326U -#define VIDEO_GET_MAX_PU_SATURATION_CONTROL 0x8327U -#define VIDEO_GET_MAX_PU_SHARRNESS_CONTROL 0x8328U -#define VIDEO_GET_MAX_PU_GAMMA_CONTROL 0x8329U -#define VIDEO_GET_MAX_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x832AU -#define VIDEO_GET_MAX_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x832CU -#define VIDEO_GET_MAX_PU_DIGITAL_MULTIPLIER_CONTROL 0x832EU -#define VIDEO_GET_MAX_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x832FU - -#define VIDEO_GET_MAX_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x8344U -#define VIDEO_GET_MAX_CT_FOCUS_ABSOLUTE_CONTROL 0x8346U -#define VIDEO_GET_MAX_CT_FOCUS_RELATIVE_CONTROL 0x8347U -#define VIDEO_GET_MAX_CT_IRIS_ABSOLUTE_CONTROL 0x8349U -#define VIDEO_GET_MAX_CT_ZOOM_ABSOLUTE_CONTROL 0x834BU -#define VIDEO_GET_MAX_CT_ZOOM_RELATIVE_CONTROL 0x834CU -#define VIDEO_GET_MAX_CT_PANTILT_ABSOLUTE_CONTROL 0x834DU -#define VIDEO_GET_MAX_CT_PANTILT_RELATIVE_CONTROL 0x834EU -#define VIDEO_GET_MAX_CT_ROLL_ABSOLUTE_CONTROL 0x834FU -#define VIDEO_GET_MAX_CT_ROLL_RELATIVE_CONTROL 0x8350U -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_GET_MAX_CT_DIGITAL_WINDOW_CONTROL 0x8351U -#define VIDEO_GET_MAX_CT_REGION_OF_INTEREST_CONTROL 0x8352U -#endif - -#define VIDEO_GET_MAX_VS_PROBE_CONTROL 0x8361U -#define VIDEO_GET_MAX_VS_STILL_PROBE_CONTROL 0x8363U -#define VIDEO_GET_MAX_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x8368U -#define VIDEO_GET_MAX_VS_SYNCH_DELAY_CONTROL 0x8369U - -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_GET_MAX_EU_VIDEO_RESOLUTION_CONTROL 0x8383U -#define VIDEO_GET_MAX_EU_MIN_FRAME_INTERVAL_CONTROL 0x8384U -#define VIDEO_GET_MAX_EU_SLICE_MODE_CONTROL 0x8385U -#define VIDEO_GET_MAX_EU_AVERAGE_BITRATE_CONTROL 0x8387U -#define VIDEO_GET_MAX_EU_CPB_SIZE_CONTROL 0x8388U -#define VIDEO_GET_MAX_EU_PEAK_BIT_RATE_CONTROL 0x8389U -#define VIDEO_GET_MAX_EU_QUANTIZATION_PARAMS_CONTROL 0x838AU -#define VIDEO_GET_MAX_EU_SYNC_REF_FRAME_CONTROL 0x838BU -#define VIDEO_GET_MAX_EU_LTR_BUFFER_CONTROL 0x838CU -#define VIDEO_GET_MAX_EU_LEVEL_IDC_LIMIT_CONTROL 0x838FU -#define VIDEO_GET_MAX_EU_SEI_PAYLOADTYPE_CONTROL 0x8390U -#define VIDEO_GET_MAX_EU_QP_RANGE_CONTROL 0x8391U -#endif - -/*! @brief Video device class-specific request GET RES COMMAND */ -#define VIDEO_GET_RES_PU_BACKLIGHT_COMPENSATION_CONTROL 0x8421U -#define VIDEO_GET_RES_PU_BRIGHTNESS_CONTROL 0x8422U -#define VIDEO_GET_RES_PU_CONTRACT_CONTROL 0x8423U -#define VIDEO_GET_RES_PU_GAIN_CONTROL 0x8424U -#define VIDEO_GET_RES_PU_HUE_CONTROL 0x8426U -#define VIDEO_GET_RES_PU_SATURATION_CONTROL 0x8427U -#define VIDEO_GET_RES_PU_SHARRNESS_CONTROL 0x8428U -#define VIDEO_GET_RES_PU_GAMMA_CONTROL 0x8429U -#define VIDEO_GET_RES_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x842AU -#define VIDEO_GET_RES_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x842CU -#define VIDEO_GET_RES_PU_DIGITAL_MULTIPLIER_CONTROL 0x842EU -#define VIDEO_GET_RES_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x842FU - -#define VIDEO_GET_RES_CT_AE_MODE_CONTROL 0x8442U -#define VIDEO_GET_RES_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x8444U -#define VIDEO_GET_RES_CT_FOCUS_ABSOLUTE_CONTROL 0x8446U -#define VIDEO_GET_RES_CT_FOCUS_RELATIVE_CONTROL 0x8447U -#define VIDEO_GET_RES_CT_IRIS_ABSOLUTE_CONTROL 0x8449U -#define VIDEO_GET_RES_CT_ZOOM_ABSOLUTE_CONTROL 0x844BU -#define VIDEO_GET_RES_CT_ZOOM_RELATIVE_CONTROL 0x844CU -#define VIDEO_GET_RES_CT_PANTILT_ABSOLUTE_CONTROL 0x844DU -#define VIDEO_GET_RES_CT_PANTILT_RELATIVE_CONTROL 0x844EU -#define VIDEO_GET_RES_CT_ROLL_ABSOLUTE_CONTROL 0x844FU -#define VIDEO_GET_RES_CT_ROLL_RELATIVE_CONTROL 0x8450U - -#define VIDEO_GET_RES_VS_PROBE_CONTROL 0x8461U -#define VIDEO_GET_RES_VS_STILL_PROBE_CONTROL 0x8463U -#define VIDEO_GET_RES_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x8468U -#define VIDEO_GET_RES_VS_SYNCH_DELAY_CONTROL 0x8469U - -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_GET_RES_EU_AVERAGE_BITRATE_CONTROL 0x8487U -#define VIDEO_GET_RES_EU_CPB_SIZE_CONTROL 0x8488U -#define VIDEO_GET_RES_EU_PEAK_BIT_RATE_CONTROL 0x8489U -#define VIDEO_GET_RES_EU_QUANTIZATION_PARAMS_CONTROL 0x848AU -#define VIDEO_GET_RES_EU_ERROR_RESILIENCY_CONTROL 0x8494U -#endif - -/*! @brief Video device class-specific request GET LEN COMMAND */ - -#define VIDEO_GET_LEN_VS_PROBE_CONTROL 0x8561U -#define VIDEO_GET_LEN_VS_COMMIT_CONTROL 0x8562U -#define VIDEO_GET_LEN_VS_STILL_PROBE_CONTROL 0x8563U -#define VIDEO_GET_LEN_VS_STILL_COMMIT_CONTROL 0x8564U - -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_GET_LEN_EU_SELECT_LAYER_CONTROL 0x8581U -#define VIDEO_GET_LEN_EU_PROFILE_TOOLSET_CONTROL 0x8582U -#define VIDEO_GET_LEN_EU_VIDEO_RESOLUTION_CONTROL 0x8583U -#define VIDEO_GET_LEN_EU_MIN_FRAME_INTERVAL_CONTROL 0x8584U -#define VIDEO_GET_LEN_EU_SLICE_MODE_CONTROL 0x8585U -#define VIDEO_GET_LEN_EU_RATE_CONTROL_MODE_CONTROL 0x8586U -#define VIDEO_GET_LEN_EU_AVERAGE_BITRATE_CONTROL 0x8587U -#define VIDEO_GET_LEN_EU_CPB_SIZE_CONTROL 0x8588U -#define VIDEO_GET_LEN_EU_PEAK_BIT_RATE_CONTROL 0x8589U -#define VIDEO_GET_LEN_EU_QUANTIZATION_PARAMS_CONTROL 0x858AU -#define VIDEO_GET_LEN_EU_SYNC_REF_FRAME_CONTROL 0x858BU -#define VIDEO_GET_LEN_EU_LTR_BUFFER_CONTROL 0x858CU -#define VIDEO_GET_LEN_EU_LTR_PICTURE_CONTROL 0x858DU -#define VIDEO_GET_LEN_EU_LTR_VALIDATION_CONTROL 0x858EU -#define VIDEO_GET_LEN_EU_QP_RANGE_CONTROL 0x8591U -#define VIDEO_GET_LEN_EU_PRIORITY_CONTROL 0x8592U -#define VIDEO_GET_LEN_EU_START_OR_STOP_LAYER_CONTROL 0x8593U -#endif - -/*! @brief Video device class-specific request GET INFO COMMAND */ -#define VIDEO_GET_INFO_VC_POWER_MODE_CONTROL 0x8601U -#define VIDEO_GET_INFO_VC_ERROR_CODE_CONTROL 0x8602U - -#define VIDEO_GET_INFO_PU_BACKLIGHT_COMPENSATION_CONTROL 0x8621U -#define VIDEO_GET_INFO_PU_BRIGHTNESS_CONTROL 0x8622U -#define VIDEO_GET_INFO_PU_CONTRACT_CONTROL 0x8623U -#define VIDEO_GET_INFO_PU_GAIN_CONTROL 0x8624U -#define VIDEO_GET_INFO_PU_POWER_LINE_FREQUENCY_CONTROL 0x8625U -#define VIDEO_GET_INFO_PU_HUE_CONTROL 0x8626U -#define VIDEO_GET_INFO_PU_SATURATION_CONTROL 0x8627U -#define VIDEO_GET_INFO_PU_SHARRNESS_CONTROL 0x8628U -#define VIDEO_GET_INFO_PU_GAMMA_CONTROL 0x8629U -#define VIDEO_GET_INFO_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x862AU -#define VIDEO_GET_INFO_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x862BU -#define VIDEO_GET_INFO_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x862CU -#define VIDEO_GET_INFO_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x862DU -#define VIDEO_GET_INFO_PU_DIGITAL_MULTIPLIER_CONTROL 0x862EU -#define VIDEO_GET_INFO_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x862FU -#define VIDEO_GET_INFO_PU_HUE_AUTO_CONTROL 0x8630U -#define VIDEO_GET_INFO_PU_ANALOG_VIDEO_STANDARD_CONTROL 0x8631U -#define VIDEO_GET_INFO_PU_ANALOG_LOCK_STATUS_CONTROL 0x8632U -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_GET_INFO_PU_CONTRAST_AUTO_CONTROL 0x8633U -#endif - -#define VIDEO_GET_INFO_CT_SCANNING_MODE_CONTROL 0x8641U -#define VIDEO_GET_INFO_CT_AE_MODE_CONTROL 0x8642U -#define VIDEO_GET_INFO_CT_AE_PRIORITY_CONTROL 0x8643U -#define VIDEO_GET_INFO_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x8644U -#define VIDEO_GET_INFO_CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x8645U -#define VIDEO_GET_INFO_CT_FOCUS_ABSOLUTE_CONTROL 0x8646U -#define VIDEO_GET_INFO_CT_FOCUS_RELATIVE_CONTROL 0x8647U -#define VIDEO_GET_INFO_CT_FOCUS_AUTO_CONTROL 0x8648U -#define VIDEO_GET_INFO_CT_IRIS_ABSOLUTE_CONTROL 0x8649U -#define VIDEO_GET_INFO_CT_IRIS_RELATIVE_CONTROL 0x864AU -#define VIDEO_GET_INFO_CT_ZOOM_ABSOLUTE_CONTROL 0x864BU -#define VIDEO_GET_INFO_CT_ZOOM_RELATIVE_CONTROL 0x864CU -#define VIDEO_GET_INFO_CT_PANTILT_ABSOLUTE_CONTROL 0x864DU -#define VIDEO_GET_INFO_CT_PANTILT_RELATIVE_CONTROL 0x864EU -#define VIDEO_GET_INFO_CT_ROLL_ABSOLUTE_CONTROL 0x864FU -#define VIDEO_GET_INFO_CT_ROLL_RELATIVE_CONTROL 0x8650U -#define VIDEO_GET_INFO_CT_PRIVACY_CONTROL 0x8651U -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_GET_INFO_CT_FOCUS_SIMPLE_CONTROL 0x8652U -#endif - -#define VIDEO_GET_INFO_VS_PROBE_CONTROL 0x8661U -#define VIDEO_GET_INFO_VS_COMMIT_CONTROL 0x8662U -#define VIDEO_GET_INFO_VS_STILL_PROBE_CONTROL 0x8663U -#define VIDEO_GET_INFO_VS_STILL_COMMIT_CONTROL 0x8664U -#define VIDEO_GET_INFO_VS_STILL_IMAGE_TRIGGER_CONTROL 0x8665U -#define VIDEO_GET_INFO_VS_STREAM_ERROR_CODE_CONTROL 0x8666U -#define VIDEO_GET_INFO_VS_GENERATE_KEY_FRAME_CONTROL 0x8667U -#define VIDEO_GET_INFO_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x8668U -#define VIDEO_GET_INFO_VS_SYNCH_DELAY_CONTROL 0x8669U - -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_GET_INFO_EU_SELECT_LAYER_CONTROL 0x8681U -#define VIDEO_GET_INFO_EU_PROFILE_TOOLSET_CONTROL 0x8682U -#define VIDEO_GET_INFO_EU_VIDEO_RESOLUTION_CONTROL 0x8683U -#define VIDEO_GET_INFO_EU_MIN_FRAME_INTERVAL_CONTROL 0x8684U -#define VIDEO_GET_INFO_EU_SLICE_MODE_CONTROL 0x8685U -#define VIDEO_GET_INFO_EU_RATE_CONTROL_MODE_CONTROL 0x8686U -#define VIDEO_GET_INFO_EU_AVERAGE_BITRATE_CONTROL 0x8687U -#define VIDEO_GET_INFO_EU_CPB_SIZE_CONTROL 0x8688U -#define VIDEO_GET_INFO_EU_PEAK_BIT_RATE_CONTROL 0x8689U -#define VIDEO_GET_INFO_EU_QUANTIZATION_PARAMS_CONTROL 0x868AU -#define VIDEO_GET_INFO_EU_SYNC_REF_FRAME_CONTROL 0x868BU -#define VIDEO_GET_INFO_EU_LTR_BUFFER_CONTROL 0x868CU -#define VIDEO_GET_INFO_EU_LTR_PICTURE_CONTROL 0x868DU -#define VIDEO_GET_INFO_EU_LTR_VALIDATION_CONTROL 0x868EU -#define VIDEO_GET_INFO_EU_SEI_PAYLOADTYPE_CONTROL 0x8690U -#define VIDEO_GET_INFO_EU_QP_RANGE_CONTROL 0x8691U -#define VIDEO_GET_INFO_EU_PRIORITY_CONTROL 0x8692U -#define VIDEO_GET_INFO_EU_START_OR_STOP_LAYER_CONTROL 0x8693U -#endif - -/*! @brief Video device class-specific request GET DEF COMMAND */ -#define VIDEO_GET_DEF_PU_BACKLIGHT_COMPENSATION_CONTROL 0x8721U -#define VIDEO_GET_DEF_PU_BRIGHTNESS_CONTROL 0x8722U -#define VIDEO_GET_DEF_PU_CONTRACT_CONTROL 0x8723U -#define VIDEO_GET_DEF_PU_GAIN_CONTROL 0x8724U -#define VIDEO_GET_DEF_PU_POWER_LINE_FREQUENCY_CONTROL 0x8725U -#define VIDEO_GET_DEF_PU_HUE_CONTROL 0x8726U -#define VIDEO_GET_DEF_PU_SATURATION_CONTROL 0x8727U -#define VIDEO_GET_DEF_PU_SHARRNESS_CONTROL 0x8728U -#define VIDEO_GET_DEF_PU_GAMMA_CONTROL 0x8729U -#define VIDEO_GET_DEF_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x872AU -#define VIDEO_GET_DEF_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x872BU -#define VIDEO_GET_DEF_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x872CU -#define VIDEO_GET_DEF_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x872DU -#define VIDEO_GET_DEF_PU_DIGITAL_MULTIPLIER_CONTROL 0x872EU -#define VIDEO_GET_DEF_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x872FU -#define VIDEO_GET_DEF_PU_HUE_AUTO_CONTROL 0x8730U -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_GET_DEF_PU_CONTRAST_AUTO_CONTROL 0x8731U -#endif - -#define VIDEO_GET_DEF_CT_AE_MODE_CONTROL 0x8742U -#define VIDEO_GET_DEF_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x8744U -#define VIDEO_GET_DEF_CT_FOCUS_ABSOLUTE_CONTROL 0x8746U -#define VIDEO_GET_DEF_CT_FOCUS_RELATIVE_CONTROL 0x8747U -#define VIDEO_GET_DEF_CT_FOCUS_AUTO_CONTROL 0x8748U -#define VIDEO_GET_DEF_CT_IRIS_ABSOLUTE_CONTROL 0x8749U -#define VIDEO_GET_DEF_CT_ZOOM_ABSOLUTE_CONTROL 0x874BU -#define VIDEO_GET_DEF_CT_ZOOM_RELATIVE_CONTROL 0x874CU -#define VIDEO_GET_DEF_CT_PANTILT_ABSOLUTE_CONTROL 0x874DU -#define VIDEO_GET_DEF_CT_PANTILT_RELATIVE_CONTROL 0x874EU -#define VIDEO_GET_DEF_CT_ROLL_ABSOLUTE_CONTROL 0x874FU -#define VIDEO_GET_DEF_CT_ROLL_RELATIVE_CONTROL 0x8750U -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_GET_DEF_CT_FOCUS_SIMPLE_CONTROL 0x8751U -#define VIDEO_GET_DEF_CT_DIGITAL_WINDOW_CONTROL 0x8752U -#define VIDEO_GET_DEF_CT_REGION_OF_INTEREST_CONTROL 0x8753U -#endif - -#define VIDEO_GET_DEF_VS_PROBE_CONTROL 0x8761U -#define VIDEO_GET_DEF_VS_STILL_PROBE_CONTROL 0x8763U -#define VIDEO_GET_DEF_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x8768U -#define VIDEO_GET_DEF_VS_SYNCH_DELAY_CONTROL 0x8769U - -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_GET_DEF_EU_PROFILE_TOOLSET_CONTROL 0x8782U -#define VIDEO_GET_DEF_EU_VIDEO_RESOLUTION_CONTROL 0x8783U -#define VIDEO_GET_DEF_EU_MIN_FRAME_INTERVAL_CONTROL 0x8784U -#define VIDEO_GET_DEF_EU_SLICE_MODE_CONTROL 0x8785U -#define VIDEO_GET_DEF_EU_RATE_CONTROL_MODE_CONTROL 0x8786U -#define VIDEO_GET_DEF_EU_AVERAGE_BITRATE_CONTROL 0x8787U -#define VIDEO_GET_DEF_EU_CPB_SIZE_CONTROL 0x8788U -#define VIDEO_GET_DEF_EU_PEAK_BIT_RATE_CONTROL 0x8789U -#define VIDEO_GET_DEF_EU_QUANTIZATION_PARAMS_CONTROL 0x878AU -#define VIDEO_GET_DEF_EU_LTR_BUFFER_CONTROL 0x878CU -#define VIDEO_GET_DEF_EU_LTR_PICTURE_CONTROL 0x878DU -#define VIDEO_GET_DEF_EU_LTR_VALIDATION_CONTROL 0x878EU -#define VIDEO_GET_DEF_EU_LEVEL_IDC_LIMIT_CONTROL 0x878FU -#define VIDEO_GET_DEF_EU_SEI_PAYLOADTYPE_CONTROL 0x8790U -#define VIDEO_GET_DEF_EU_QP_RANGE_CONTROL 0x8791U -#define VIDEO_GET_DEF_EU_ERROR_RESILIENCY_CONTROL 0x8794U -#endif - -/*! @brief Video device class-specific request SET CUR COMMAND */ -#define VIDEO_SET_CUR_VC_POWER_MODE_CONTROL 0x0101U - -#define VIDEO_SET_CUR_PU_BACKLIGHT_COMPENSATION_CONTROL 0x0121U -#define VIDEO_SET_CUR_PU_BRIGHTNESS_CONTROL 0x0122U -#define VIDEO_SET_CUR_PU_CONTRACT_CONTROL 0x0123U -#define VIDEO_SET_CUR_PU_GAIN_CONTROL 0x0124U -#define VIDEO_SET_CUR_PU_POWER_LINE_FREQUENCY_CONTROL 0x0125U -#define VIDEO_SET_CUR_PU_HUE_CONTROL 0x0126U -#define VIDEO_SET_CUR_PU_SATURATION_CONTROL 0x0127U -#define VIDEO_SET_CUR_PU_SHARRNESS_CONTROL 0x0128U -#define VIDEO_SET_CUR_PU_GAMMA_CONTROL 0x0129U -#define VIDEO_SET_CUR_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x012AU -#define VIDEO_SET_CUR_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x012BU -#define VIDEO_SET_CUR_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x012CU -#define VIDEO_SET_CUR_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x012DU -#define VIDEO_SET_CUR_PU_DIGITAL_MULTIPLIER_CONTROL 0x012EU -#define VIDEO_SET_CUR_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x012FU -#define VIDEO_SET_CUR_PU_HUE_AUTO_CONTROL 0x0130U -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_SET_CUR_PU_CONTRAST_AUTO_CONTROL 0x0131U -#endif - -#define VIDEO_SET_CUR_CT_SCANNING_MODE_CONTROL 0x0141U -#define VIDEO_SET_CUR_CT_AE_MODE_CONTROL 0x0142U -#define VIDEO_SET_CUR_CT_AE_PRIORITY_CONTROL 0x0143U -#define VIDEO_SET_CUR_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x0144U -#define VIDEO_SET_CUR_CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x0145U -#define VIDEO_SET_CUR_CT_FOCUS_ABSOLUTE_CONTROL 0x0146U -#define VIDEO_SET_CUR_CT_FOCUS_RELATIVE_CONTROL 0x0147U -#define VIDEO_SET_CUR_CT_FOCUS_AUTO_CONTROL 0x0148U -#define VIDEO_SET_CUR_CT_IRIS_ABSOLUTE_CONTROL 0x0149U -#define VIDEO_SET_CUR_CT_IRIS_RELATIVE_CONTROL 0x014AU -#define VIDEO_SET_CUR_CT_ZOOM_ABSOLUTE_CONTROL 0x014BU -#define VIDEO_SET_CUR_CT_ZOOM_RELATIVE_CONTROL 0x014CU -#define VIDEO_SET_CUR_CT_PANTILT_ABSOLUTE_CONTROL 0x014DU -#define VIDEO_SET_CUR_CT_PANTILT_RELATIVE_CONTROL 0x014EU -#define VIDEO_SET_CUR_CT_ROLL_ABSOLUTE_CONTROL 0x014FU -#define VIDEO_SET_CUR_CT_ROLL_RELATIVE_CONTROL 0x0150U -#define VIDEO_SET_CUR_CT_PRIVACY_CONTROL 0x0151U -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_SET_CUR_CT_FOCUS_SIMPLE_CONTROL 0x0152U -#define VIDEO_SET_CUR_CT_DIGITAL_WINDOW_CONTROL 0x0153U -#define VIDEO_SET_CUR_CT_REGION_OF_INTEREST_CONTROL 0x0154U -#endif - -#define VIDEO_SET_CUR_VS_PROBE_CONTROL 0x0161U -#define VIDEO_SET_CUR_VS_COMMIT_CONTROL 0x0162U -#define VIDEO_SET_CUR_VS_STILL_PROBE_CONTROL 0x0163U -#define VIDEO_SET_CUR_VS_STILL_COMMIT_CONTROL 0x0164U -#define VIDEO_SET_CUR_VS_STILL_IMAGE_TRIGGER_CONTROL 0x0165U -#define VIDEO_SET_CUR_VS_STREAM_ERROR_CODE_CONTROL 0x0166U -#define VIDEO_SET_CUR_VS_GENERATE_KEY_FRAME_CONTROL 0x0167U -#define VIDEO_SET_CUR_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x0168U -#define VIDEO_SET_CUR_VS_SYNCH_DELAY_CONTROL 0x0169U - -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 -#define VIDEO_SET_CUR_EU_SELECT_LAYER_CONTROL 0x0181U -#define VIDEO_SET_CUR_EU_PROFILE_TOOLSET_CONTROL 0x0182U -#define VIDEO_SET_CUR_EU_VIDEO_RESOLUTION_CONTROL 0x0183U -#define VIDEO_SET_CUR_EU_MIN_FRAME_INTERVAL_CONTROL 0x0184U -#define VIDEO_SET_CUR_EU_SLICE_MODE_CONTROL 0x0185U -#define VIDEO_SET_CUR_EU_RATE_CONTROL_MODE_CONTROL 0x0186U -#define VIDEO_SET_CUR_EU_AVERAGE_BITRATE_CONTROL 0x0187U -#define VIDEO_SET_CUR_EU_CPB_SIZE_CONTROL 0x0188U -#define VIDEO_SET_CUR_EU_PEAK_BIT_RATE_CONTROL 0x0189U -#define VIDEO_SET_CUR_EU_QUANTIZATION_PARAMS_CONTROL 0x018AU -#define VIDEO_SET_CUR_EU_SYNC_REF_FRAME_CONTROL 0x018BU -#define VIDEO_SET_CUR_EU_LTR_BUFFER_CONTROL 0x018CU -#define VIDEO_SET_CUR_EU_LTR_PICTURE_CONTROL 0x018DU -#define VIDEO_SET_CUR_EU_LTR_VALIDATION_CONTROL 0x018EU -#define VIDEO_SET_CUR_EU_LEVEL_IDC_LIMIT_CONTROL 0x018FU -#define VIDEO_SET_CUR_EU_SEI_PAYLOADTYPE_CONTROL 0x0190U -#define VIDEO_SET_CUR_EU_QP_RANGE_CONTROL 0x0191U -#define VIDEO_SET_CUR_EU_PRIORITY_CONTROL 0x0192U -#define VIDEO_SET_CUR_EU_START_OR_STOP_LAYER_CONTROL 0x0193U -#define VIDEO_SET_CUR_EU_ERROR_RESILIENCY_CONTROL 0x0194U -#endif - -/*! @brief The payload header structure. */ -struct video_payload_header { - uint8_t bHeaderLength; /*!< The payload header length. */ - union { - uint8_t bmheaderInfo; /*!< The payload header bitmap field. */ - struct - { - uint8_t frameIdentifier : 1U; /*!< Frame Identifier. This bit toggles at each frame start boundary and stays - constant for the rest of the frame.*/ - uint8_t endOfFrame : 1U; /*!< End of Frame. This bit indicates the end of a video frame and is set in the - last video sample that belongs to a frame.*/ - uint8_t - presentationTimeStamp : 1U; /*!< Presentation Time Stamp. This bit, when set, indicates the presence of - a PTS field.*/ - uint8_t sourceClockReference : 1U; /*!< Source Clock Reference. This bit, when set, indicates the presence - of a SCR field.*/ - uint8_t reserved : 1U; /*!< Reserved. Set to 0. */ - uint8_t stillImage : 1U; /*!< Still Image. This bit, when set, identifies a video sample that belongs to a - still image.*/ - uint8_t errorBit : 1U; /*!< Error Bit. This bit, when set, indicates an error in the device streaming.*/ - uint8_t endOfHeader : 1U; /*!< End of Header. This bit, when set, indicates the end of the BFH fields.*/ - } headerInfoBits; - struct - { - uint8_t FID : 1U; /*!< Frame Identifier. This bit toggles at each frame start boundary and stays constant - for the rest of the frame.*/ - uint8_t EOI : 1U; /*!< End of Frame. This bit indicates the end of a video frame and is set in the last - video sample that belongs to a frame.*/ - uint8_t PTS : 1U; /*!< Presentation Time Stamp. This bit, when set, indicates the presence of a PTS field.*/ - uint8_t SCR : 1U; /*!< Source Clock Reference. This bit, when set, indicates the presence of a SCR field.*/ - uint8_t RES : 1U; /*!< Reserved. Set to 0. */ - uint8_t STI : 1U; /*!< Still Image. This bit, when set, identifies a video sample that belongs to a still - image.*/ - uint8_t ERR : 1U; /*!< Error Bit. This bit, when set, indicates an error in the device streaming.*/ - uint8_t EOH : 1U; /*!< End of Header. This bit, when set, indicates the end of the BFH fields.*/ - } headerInfoBitmap; - } headerInfoUnion; - uint32_t dwPresentationTime; /*!< Presentation time stamp (PTS) field.*/ - uint8_t bSourceClockReference[6]; /*!< Source clock reference (SCR) field.*/ -} __PACKED; - -/*! @brief The Video probe and commit controls structure.*/ -struct video_probe_and_commit_controls { - union { - uint8_t bmHint; /*!< Bit-field control indicating to the function what fields shall be kept fixed. */ - struct - { - uint8_t dwFrameInterval : 1U; /*!< dwFrameInterval field.*/ - uint8_t wKeyFrameRate : 1U; /*!< wKeyFrameRate field.*/ - uint8_t wPFrameRate : 1U; /*!< wPFrameRate field.*/ - uint8_t wCompQuality : 1U; /*!< wCompQuality field.*/ - uint8_t wCompWindowSize : 1U; /*!< wCompWindowSize field.*/ - uint8_t reserved : 3U; /*!< Reserved field.*/ - } hintBitmap; - } hintUnion; - union { - uint8_t bmHint; /*!< Bit-field control indicating to the function what fields shall be kept fixed. */ - struct - { - uint8_t reserved : 8U; /*!< Reserved field.*/ - } hintBitmap; - } hintUnion1; - uint8_t bFormatIndex; /*!< Video format index from a format descriptor.*/ - uint8_t bFrameIndex; /*!< Video frame index from a frame descriptor.*/ - uint32_t dwFrameInterval; /*!< Frame interval in 100ns units.*/ - uint16_t wKeyFrameRate; /*!< Key frame rate in key-frame per video-frame units.*/ - uint16_t wPFrameRate; /*!< PFrame rate in PFrame/key frame units.*/ - uint16_t wCompQuality; /*!< Compression quality control in abstract units 0U (lowest) to 10000U (highest).*/ - uint16_t wCompWindowSize; /*!< Window size for average bit rate control.*/ - uint16_t wDelay; /*!< Internal video streaming interface latency in ms from video data capture to presentation on - the USB.*/ - uint32_t dwMaxVideoFrameSize; /*!< Maximum video frame or codec-specific segment size in bytes.*/ - uint32_t dwMaxPayloadTransferSize; /*!< Specifies the maximum number of bytes that the device can transmit or - receive in a single payload transfer.*/ - uint32_t dwClockFrequency; /*!< The device clock frequency in Hz for the specified format. This specifies the - units used for the time information fields in the Video Payload Headers in the data - stream.*/ - uint8_t bmFramingInfo; /*!< Bit-field control supporting the following values: D0 Frame ID, D1 EOF.*/ - uint8_t bPreferedVersion; /*!< The preferred payload format version supported by the host or device for the - specified bFormatIndex value.*/ - uint8_t bMinVersion; /*!< The minimum payload format version supported by the device for the specified bFormatIndex - value.*/ - uint8_t bMaxVersion; /*!< The maximum payload format version supported by the device for the specified bFormatIndex - value.*/ -#if defined(USB_DEVICE_VIDEO_CLASS_VERSION_1_5) && USB_DEVICE_VIDEO_CLASS_VERSION_1_5 - uint8_t bUsage; /*!< This bitmap enables features reported by the bmUsages field of the Video Frame Descriptor.*/ - uint8_t - bBitDepthLuma; /*!< Represents bit_depth_luma_minus8 + 8U, which must be the same as bit_depth_chroma_minus8 + - 8.*/ - uint8_t bmSettings; /*!< A bitmap of flags that is used to discover and control specific features of a temporally - encoded video stream.*/ - uint8_t bMaxNumberOfRefFramesPlus1; /*!< Host indicates the maximum number of frames stored for use as references.*/ - uint16_t bmRateControlModes; /*!< This field contains 4U sub-fields, each of which is a 4U bit number.*/ - uint64_t bmLayoutPerStream; /*!< This field contains 4U sub-fields, each of which is a 2U byte number.*/ -#endif -} __PACKED; - -/*! @brief The Video still probe and still commit controls structure.*/ -struct video_still_probe_and_commit_controls { - uint8_t bFormatIndex; /*!< Video format index from a format descriptor.*/ - uint8_t bFrameIndex; /*!< Video frame index from a frame descriptor.*/ - uint8_t bCompressionIndex; /*!< Compression index from a frame descriptor.*/ - uint32_t dwMaxVideoFrameSize; /*!< Maximum still image size in bytes.*/ - uint32_t dwMaxPayloadTransferSize; /*!< Specifies the maximum number of bytes that the device can transmit or - receive in a single payload transfer.*/ -} __PACKED; - -struct video_cs_if_vc_header_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint16_t bcdVDC; - uint16_t wTotalLength; - uint32_t dwClockFrequency; - uint8_t bInCollection; - uint8_t baInterfaceNr[]; -} __PACKED; - -#define VIDEO_SIZEOF_VC_HEADER_DESC(n) (11 + n) - -struct video_cs_if_vc_input_terminal_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubType; - uint8_t bTerminalID; - uint16_t wTerminalType; - uint8_t bAssocTerminal; - uint8_t iTerminal; - uint16_t wObjectiveFocalLenMin; - uint16_t wObjectiveFocalLenMax; - uint16_t wOcularFocalLength; - uint8_t bControlSize; - uint8_t bmaControls[]; -} __PACKED; - -#define VIDEO_SIZEOF_VC_INPUT_TERMINAL_DESC(n) (15 + n) - -struct video_cs_if_vc_processing_unit_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubType; - uint8_t bUnitID; - uint8_t bSourceID; - uint16_t wMaxMultiplier; - uint8_t bControlSize; - // uint8_t bmaControls[]; - uint8_t iProcessing; - uint8_t bmVideoStandards; -} __PACKED; - -#define VIDEO_SIZEOF_VC_PROCESSING_UNIT_DESC(n) (10 + n) - -struct video_cs_if_vc_output_terminal_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubType; - uint8_t bTerminalID; - uint16_t wTerminalType; - uint8_t bAssocTerminal; - uint8_t bSourceID; - uint8_t iTerminal; -} __PACKED; - -#define VIDEO_SIZEOF_VC_OUTPUT_TERMINAL_DESC 9 - -struct video_cs_ep_vc_ep_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubType; - uint16_t wMaxTransferSize; -} __PACKED; - -#define VIDEO_SIZEOF_VC_EP_DESC 5 - -struct video_cs_if_vs_input_header_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubType; - uint8_t bNumFormats; - uint16_t wTotalLength; - uint8_t bEndpointAddress; - uint8_t bmInfo; - uint8_t bTerminalLink; - uint8_t bStillCaptureMethod; - uint8_t bTriggerSupport; - uint8_t bTriggerUsage; - uint8_t bControlSize; - uint8_t bmaControls[]; -} __PACKED; - -#define VIDEO_SIZEOF_VS_INPUT_HEADER_DESC(p, n) (13 + p * n) - -struct video_cs_if_vs_output_header_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubType; - uint8_t bNumFormats; - uint16_t wTotalLength; - uint8_t bEndpointAddress; - uint8_t bTerminalLink; - uint8_t bControlSize; - uint8_t bmaControls[]; -} __PACKED; - -#define VIDEO_SIZEOF_VS_OUTPUT_TERMINAL_DESC(p, n) (9 + p * n) - -struct video_cs_if_vs_format_uncompressed_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubType; - uint8_t bFormatIndex; - uint8_t bNumFrameDescriptors; - uint8_t guidFormat[16]; - uint8_t bBitsPerPixel; - uint8_t bDefaultFrameIndex; - uint8_t bAspectRatioX; - uint8_t bAspectRatioY; - uint8_t bmInterlaceFlags; - uint8_t bCopyProtect; -} __PACKED; - -#define VIDEO_SIZEOF_VS_FORMAT_UNCOMPRESSED_DESC (27) - -struct video_cs_if_vs_frame_uncompressed_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubType; - uint8_t bFormatIndex; - uint8_t bmCapabilities; - uint16_t wWidth; - uint16_t wHeight; - uint32_t dwMinBitRate; - uint32_t dwMaxBitRate; - uint32_t dwMaxVideoFrameBufferSize; - uint32_t dwDefaultFrameInterval; - uint8_t bFrameIntervalType; - uint32_t dwFrameInterval; -} __PACKED; - -#define VIDEO_SIZEOF_VS_FRAME_UNCOMPRESSED_DESC 30 - -struct video_cs_if_vs_format_mjpeg_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubType; - uint8_t bFormatIndex; - uint8_t bNumFrameDescriptors; - uint8_t bmFlags; - uint8_t bDefaultFrameIndex; - uint8_t bAspectRatioX; - uint8_t bAspectRatioY; - uint8_t bmInterlaceFlags; - uint8_t bCopyProtect; -} __PACKED; - -#define VIDEO_SIZEOF_VS_FORMAT_MJPEG_DESC 11 - -struct video_cs_if_vs_frame_mjpeg_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubType; - uint8_t bFormatIndex; - uint8_t bmCapabilities; - uint16_t wWidth; - uint16_t wHeight; - uint32_t dwMinBitRate; - uint32_t dwMaxBitRate; - uint32_t dwMaxVideoFrameBufferSize; - uint32_t dwDefaultFrameInterval; - uint8_t bFrameIntervalType; - uint32_t dwFrameInterval1; - uint32_t dwFrameInterval2; -} __PACKED; - -#define VIDEO_SIZEOF_VS_FRAME_MJPEG_DESC(n) (26 + n) - -struct video_cs_if_vs_colorformat_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDescriptorSubType; - uint8_t bColorPrimaries; - uint8_t bXferCharacteristics; - uint8_t bMatrixCoefficients; -} __PACKED; - -#define VIDEO_SIZEOF_VS_COLORFORMAT_DESC 6 - -struct video_vc_input_terminal_bmcontrol_bitmap { - uint32_t scanning_mode : 1; - uint32_t auto_exposure_mode : 1; - uint32_t auto_exposure_priority : 1; - uint32_t exposure_time_absolute : 1; - uint32_t exposure_time_relative : 1; - uint32_t focus_absolute : 1; - uint32_t focus_relative : 1; - uint32_t iris_absolute : 1; - uint32_t iris_relative : 1; - uint32_t zoom_absolute : 1; - uint32_t zoom_relative : 1; - uint32_t pantilt_absolute : 1; - uint32_t pantilt_relative : 1; - uint32_t roll_absolute : 1; - uint32_t roll_relative : 1; - uint32_t reserved : 2; - uint32_t focus_auto : 1; - uint32_t pricvcy : 1; -}; - -struct video_vc_processing_unit_bmcontrol_bitmap { - uint16_t brightness : 1; - uint16_t contrast : 1; - uint16_t hue : 1; - uint16_t saturation : 1; - uint16_t sharpness : 1; - uint16_t gamma : 1; - uint16_t white_bal_temp : 1; - uint16_t white_bal_comp : 1; - uint16_t backlight_comp : 1; - uint16_t gain : 1; - uint16_t power_line_freq : 1; - uint16_t hue_auto : 1; - uint16_t white_bal_temp_auto : 1; - uint16_t white_bal_comp_auto : 1; - uint16_t digital_mult : 1; - uint16_t digital_mult_limit : 1; -}; - -struct video_camera_capabilities { - uint8_t support_get_request : 1; - uint8_t support_set_request : 1; - uint8_t disabled_by_automatic_mode : 1; - uint8_t auto_update_control : 1; - uint8_t async_control : 1; - uint8_t reserved : 3; -}; - -struct video_autoexposure_mode { - uint8_t manual_mode : 1; - uint8_t auto_mode : 1; - uint8_t shutter_priority_mode : 1; - uint8_t aperture_priority_mode : 1; - uint8_t reserved : 4; -}; - -#define VIDEO_GUID_YUY2 0x59, 0x55, 0x59, 0x32, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 -#define VIDEO_GUID_NV12 0x4E, 0x56, 0x31, 0x32, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 -#define VIDEO_GUID_M420 0x4D, 0x34, 0x32, 0x30, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 -#define VIDEO_GUID_I420 0x49, 0x34, 0x32, 0x30, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 - -// clang-format off -#define VIDEO_VC_DESCRIPTOR_INIT(bFirstInterface, bNumEndpoints, bcdUVC, wTotalLength, dwClockFrequency, stridx) \ - /* Interface Association Descriptor */ \ - 0x08, \ - USB_DESCRIPTOR_TYPE_INTERFACE_ASSOCIATION, \ - bFirstInterface, \ - 0x02, \ - USB_DEVICE_CLASS_VIDEO, \ - VIDEO_SC_VIDEO_INTERFACE_COLLECTION, \ - 0x00, \ - 0x00, \ - /* VideoControl Interface Descriptor */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - 0x00, /* bInterfaceNumber */ \ - 0x00, /* bAlternateSetting */ \ - bNumEndpoints, /* bNumEndpoints:1 endpoint (interrupt endpoint) */ \ - USB_DEVICE_CLASS_VIDEO, /* bInterfaceClass : CC_VIDEO */ \ - VIDEO_SC_VIDEOCONTROL, /* bInterfaceSubClass : SC_VIDEOCONTROL */ \ - VIDEO_PC_PROTOCOL_UNDEFINED, /* bInterfaceProtocol : PC_PROTOCOL_UNDEFINED */ \ - stridx, /* iInterface:Index to string descriptor that contains the string */ \ - /*Class-specific VideoControl Interface Descriptor */ \ - 0x0d, /* bLength */ \ - 0x24, /* bDescriptorType : CS_INTERFACE */ \ - VIDEO_VC_HEADER_DESCRIPTOR_SUBTYPE, /* bDescriptorSubType : VC_HEADER subtype */ \ - WBVAL(bcdUVC), /* bcdUVC : Revision of class specification that this device is based upon.*/ \ - WBVAL(wTotalLength), /* wTotalLength */ \ - DBVAL(dwClockFrequency), /* dwClockFrequency : 0x005b8d80 -> 6,000,000 == 6MHz*/ \ - 0x01, /* bInCollection : Number of streaming interfaces. */ \ - (uint8_t)(bFirstInterface + 1), /* baInterfaceNr(0) : VideoStreaming interface 1 belongs to this VideoControl interface.*/ \ - /* Input Terminal 1 -> Processing Unit 2 -> Output Terminal 3 */ \ - 0x12, \ - 0x24, \ - VIDEO_VC_INPUT_TERMINAL_DESCRIPTOR_SUBTYPE, \ - 0x01, /* bTerminalID */ \ - WBVAL(VIDEO_ITT_CAMERA), /* wTerminalType : 0x0201 Camera Sensor*/ \ - 0x00, /* bAssocTerminal */ \ - 0x00, /* iTerminal */ \ - WBVAL(0x0000), /* wObjectiveFocalLengthMin */ \ - WBVAL(0x0000), /* wObjectiveFocalLengthMax */ \ - WBVAL(0x0000), /* wOcularFocalLength */ \ - 0x03, /* bControlSize */ \ - 0x00, 0x00, 0x00, /* bmControls */ \ - 0x0c, \ - 0x24, \ - VIDEO_VC_PROCESSING_UNIT_DESCRIPTOR_SUBTYPE, \ - 0x02, /* bUnitID */ \ - 0x01, /* bSourceID */ \ - 0x00, 0x00, /* wMaxMultiplier */ \ - 0x02, /* bControlSize */ \ - 0x00, 0x00, /* bmControls */ \ - 0x00, /* iProcessing */ \ - 0x00, /* bmVideoStandards */ \ - 0x09, \ - 0x24, \ - VIDEO_VC_OUTPUT_TERMINAL_DESCRIPTOR_SUBTYPE, \ - 0x03, /* bTerminalID */ \ - WBVAL(VIDEO_TT_STREAMING), \ - 0x00, /* bAssocTerminal */ \ - 0x02, /* bSourceID */ \ - 0x00 /* iTerminal */ - -#define VIDEO_VS_DESCRIPTOR_INIT(bInterfaceNumber, bAlternateSetting, bNumEndpoints) \ - /* Video Streaming (VS) Interface Descriptor */ \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType : INTERFACE */ \ - bInterfaceNumber, /* bInterfaceNumber: Index of this interface */ \ - bAlternateSetting, /* bAlternateSetting: Index of this alternate setting */ \ - bNumEndpoints, /* bNumEndpoints : 0 endpoints – no bandwidth used*/ \ - 0x0e, /* bInterfaceClass : CC_VIDEO */ \ - 0x02, /* bInterfaceSubClass : SC_VIDEOSTREAMING */ \ - 0x00, /* bInterfaceProtocol : PC_PROTOCOL_UNDEFINED */ \ - 0x00 /* iInterface : unused */ - -#define VIDEO_VS_HEADER_DESCRIPTOR_INIT(bNumFormats, wTotalLength, bEndpointAddress, ...) \ - /*Class-specific VideoStream Header Descriptor (Input) */ \ - 0x0d + PP_NARG(__VA_ARGS__), \ - 0x24, \ - VIDEO_VS_INPUT_HEADER_DESCRIPTOR_SUBTYPE, \ - bNumFormats, /* bNumFormats : One format descriptor follows. */ \ - WBVAL(wTotalLength), \ - bEndpointAddress, \ - 0x00, /* bmInfo : No dynamic format change supported. */ \ - 0x03, /* bTerminalLink : This VideoStreaming interface supplies terminal ID 2 (Output Terminal). */ \ - 0x00, /* bStillCaptureMethod : Device supports still image capture method 0. */ \ - 0x00, /* bTriggerSupport : Hardware trigger supported for still image capture */ \ - 0x00, /* bTriggerUsage : Hardware trigger should initiate a still image capture. */ \ - PP_NARG(__VA_ARGS__), /* bControlSize : Size of the bmaControls field */ \ - __VA_ARGS__ /* bmaControls : No VideoStreaming specific controls are supported.*/ - -#define VIDEO_VS_FORMAT_UNCOMPRESSED_DESCRIPTOR_INIT(bFormatIndex, bNumFrameDescriptors, GUIDFormat) \ - /*Payload Format(UNCOMPRESSED) Descriptor */ \ - 0x1b, \ - 0x24, \ - VIDEO_VS_FORMAT_UNCOMPRESSED_DESCRIPTOR_SUBTYPE, /* bDescriptorSubType : VS_FORMAT_UNCOMPRESSED subtype */ \ - bFormatIndex, /* bFormatIndex : First (and only) format descriptor */ \ - bNumFrameDescriptors, /* bNumFrameDescriptors : One frame descriptor for this format follows. */ \ - GUIDFormat, /* GUID Format YUY2 {32595559-0000-0010-8000-00AA00389B71} */ \ - 0x0c, /* bBitsPerPixel : Number of bits per pixel used to specify color in the decoded video frame - 16 for yuy2*/ \ - 0x01, /* bDefaultFrameIndex : Default frame index is 1. */ \ - 0x00, /* bAspectRatioX : Non-interlaced stream not required. */ \ - 0x00, /* bAspectRatioY : Non-interlaced stream not required. */ \ - 0x00, /* bmInterlaceFlags : Non-interlaced stream */ \ - 0x00 /* bCopyProtect : No restrictions imposed on the duplication of this video stream. */ - -#define VIDEO_VS_FRAME_UNCOMPRESSED_DESCRIPTOR_INIT(bFrameIndex, wWidth, wHeight, dwMinBitRate, dwMaxBitRate, \ - dwMaxVideoFrameBufferSize, dwDefaultFrameInterval, dwFrameInterval) \ - 0x1e, \ - 0x24, \ - VIDEO_VS_FRAME_UNCOMPRESSED_DESCRIPTOR_SUBTYPE, \ - bFrameIndex, \ - 0x00, \ - WBVAL(wWidth), \ - WBVAL(wHeight), \ - DBVAL(dwMinBitRate), \ - DBVAL(dwMaxBitRate), \ - DBVAL(dwMaxVideoFrameBufferSize), \ - DBVAL(dwDefaultFrameInterval), \ - 0x01, \ - DBVAL(dwFrameInterval) - -#define VIDEO_VS_FORMAT_MJPEG_DESCRIPTOR_INIT(bFormatIndex, bNumFrameDescriptors) \ - /*Payload Format(MJPEG) Descriptor */ \ - 0x0b, /* bLength */ \ - 0x24, /* bDescriptorType : CS_INTERFACE */ \ - 0x06, /* bDescriptorSubType : VS_FORMAT_MJPEG subtype */ \ - bFormatIndex, /* bFormatIndex : First (and only) format descriptor */ \ - bNumFrameDescriptors, /* bNumFrameDescriptors : One frame descriptor for this format follows. */ \ - 0x00, /* bmFlags : Uses fixed size samples.. */ \ - 0x01, /* bDefaultFrameIndex : Default frame index is 1. */ \ - 0x00, /* bAspectRatioX : Non-interlaced stream – not required. */ \ - 0x00, /* bAspectRatioY : Non-interlaced stream – not required. */ \ - 0x00, /* bmInterlaceFlags : Non-interlaced stream */ \ - 0x00 /* bCopyProtect : No restrictions imposed on the duplication of this video stream. */ - -#define VIDEO_VS_FRAME_MJPEG_DESCRIPTOR_INIT(bFrameIndex, wWidth, wHeight, dwMinBitRate, dwMaxBitRate, \ - dwMaxVideoFrameBufferSize, dwDefaultFrameInterval, bFrameIntervalType, ...) \ - 0x1a + PP_NARG(__VA_ARGS__), /* bLength */ \ - 0x24, /* bDescriptorType : CS_INTERFACE */ \ - VIDEO_VS_FRAME_MJPEG_DESCRIPTOR_SUBTYPE, /* bDescriptorSubType : VS_FRAME_MJPEG */ \ - bFrameIndex, /* bFrameIndex : First (and only) frame descriptor */ \ - 0x00, /* bmCapabilities : Still images using capture method 0 are supported at this frame setting.D1: Fixed frame-rate. */ \ - WBVAL(wWidth), /* wWidth (2bytes): Width of frame is 128 pixels. */ \ - WBVAL(wHeight), /* wHeight (2bytes): Height of frame is 64 pixels. */ \ - DBVAL(dwMinBitRate), /* dwMinBitRate (4bytes): Min bit rate in bits/s */ \ - DBVAL(dwMaxBitRate), /* dwMaxBitRate (4bytes): Max bit rate in bits/s */ \ - DBVAL(dwMaxVideoFrameBufferSize), /* dwMaxVideoFrameBufSize (4bytes): Maximum video or still frame size, in bytes. */ \ - dwDefaultFrameInterval, /* dwDefaultFrameInterval : 1,000,000 * 100ns -> 10 FPS */ \ - bFrameIntervalType, /* bFrameIntervalType : Indicates how the frame interval can be programmed. 0: Continuous frame interval 1..255: The number of discrete frame */ \ - __VA_ARGS__ -// clang-format on -#endif /*USB_VIDEO_H */ \ No newline at end of file diff --git a/third-party/cherryusb/class/video/usbd_video.c b/third-party/cherryusb/class/video/usbd_video.c deleted file mode 100644 index 62982d201b038ad7c39b9468dcbaf65a25c04ba7..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/video/usbd_video.c +++ /dev/null @@ -1,783 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbd_core.h" -#include "usbd_video.h" - -struct video_entity_info { - uint8_t bDescriptorSubtype; - uint8_t bEntityId; - uint16_t wTerminalType; -}; - -struct usbd_video_cfg_priv { - struct video_probe_and_commit_controls probe; - struct video_probe_and_commit_controls commit; - uint8_t power_mode; - uint8_t error_code; - struct video_entity_info info[3]; -} usbd_video_cfg = { - .info[0] = { .bDescriptorSubtype = VIDEO_VC_INPUT_TERMINAL_DESCRIPTOR_SUBTYPE, .bEntityId = 0x01, .wTerminalType = VIDEO_ITT_CAMERA }, - .info[1] = { .bDescriptorSubtype = VIDEO_VC_OUTPUT_TERMINAL_DESCRIPTOR_SUBTYPE, .bEntityId = 0x03, .wTerminalType = 0x00 }, - .info[2] = { .bDescriptorSubtype = VIDEO_VC_PROCESSING_UNIT_DESCRIPTOR_SUBTYPE, .bEntityId = 0x02, .wTerminalType = 0x00 }, -}; - -static int usbd_video_control_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - uint8_t control_selector = (uint8_t)(setup->wValue >> 8); - - switch (control_selector) { - case VIDEO_VC_VIDEO_POWER_MODE_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_SET_CUR: - break; - case VIDEO_REQUEST_GET_CUR: - break; - case VIDEO_REQUEST_GET_INFO: - break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - - break; - case VIDEO_VC_REQUEST_ERROR_CODE_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_GET_CUR: - (*data)[0] = 0x06; - *len = 1; - break; - case VIDEO_REQUEST_GET_INFO: - break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - - break; - default: - break; - } - - return 0; -} - -static int usbd_video_control_unit_terminal_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - uint8_t entity_id = (uint8_t)(setup->wIndex >> 8); - uint8_t control_selector = (uint8_t)(setup->wValue >> 8); - - for (uint8_t i = 0; i < 3; i++) { - struct video_entity_info *entity_info = &usbd_video_cfg.info[i]; - if (entity_info->bEntityId == entity_id) { - switch (entity_info->bDescriptorSubtype) { - case VIDEO_VC_HEADER_DESCRIPTOR_SUBTYPE: - break; - case VIDEO_VC_INPUT_TERMINAL_DESCRIPTOR_SUBTYPE: - if (entity_info->wTerminalType == VIDEO_ITT_CAMERA) { - switch (control_selector) { - case VIDEO_CT_AE_MODE_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_GET_CUR: - (*data)[0] = 0x08; - *len = 1; - break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - case VIDEO_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_GET_CUR: { - uint32_t dwExposureTimeAbsolute = 2500; - memcpy(*data, (uint8_t *)&dwExposureTimeAbsolute, 4); - *len = 4; - } break; - case VIDEO_REQUEST_GET_MIN: { - uint32_t dwExposureTimeAbsolute = 5; //0.0005sec - memcpy(*data, (uint8_t *)&dwExposureTimeAbsolute, 4); - *len = 4; - } break; - case VIDEO_REQUEST_GET_MAX: { - uint32_t dwExposureTimeAbsolute = 2500; //0.2500sec - memcpy(*data, (uint8_t *)&dwExposureTimeAbsolute, 4); - *len = 4; - } break; - case VIDEO_REQUEST_GET_RES: { - uint32_t dwExposureTimeAbsolute = 5; //0.0005sec - memcpy(*data, (uint8_t *)&dwExposureTimeAbsolute, 4); - *len = 4; - } break; - case VIDEO_REQUEST_GET_INFO: - (*data)[0] = 0x03; //struct video_camera_capabilities - *len = 1; - break; - case VIDEO_REQUEST_GET_DEF: { - uint32_t dwExposureTimeAbsolute = 2500; //0.2500sec - memcpy(*data, (uint8_t *)&dwExposureTimeAbsolute, 4); - *len = 4; - } break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - case VIDEO_CT_FOCUS_ABSOLUTE_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_GET_CUR: { - uint16_t wFocusAbsolute = 0x0080; - memcpy(*data, (uint8_t *)&wFocusAbsolute, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MIN: { - uint16_t wFocusAbsolute = 0; - memcpy(*data, (uint8_t *)&wFocusAbsolute, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MAX: { - uint16_t wFocusAbsolute = 0x00ff; - memcpy(*data, (uint8_t *)&wFocusAbsolute, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_RES: { - uint16_t wFocusAbsolute = 0x0001; - memcpy(*data, (uint8_t *)&wFocusAbsolute, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_INFO: - (*data)[0] = 0x03; //struct video_camera_capabilities - *len = 1; - break; - case VIDEO_REQUEST_GET_DEF: { - uint16_t wFocusAbsolute = 0x0080; - memcpy(*data, (uint8_t *)&wFocusAbsolute, 2); - *len = 2; - } break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - case VIDEO_CT_ZOOM_ABSOLUTE_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_GET_CUR: { - uint16_t wObjectiveFocalLength = 0x0064; - memcpy(*data, (uint8_t *)&wObjectiveFocalLength, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MIN: { - uint16_t wObjectiveFocalLength = 0x0064; - memcpy(*data, (uint8_t *)&wObjectiveFocalLength, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MAX: { - uint16_t wObjectiveFocalLength = 0x00c8; - memcpy(*data, (uint8_t *)&wObjectiveFocalLength, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_RES: { - uint16_t wObjectiveFocalLength = 0x0001; - memcpy(*data, (uint8_t *)&wObjectiveFocalLength, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_INFO: - (*data)[0] = 0x03; //struct video_camera_capabilities - *len = 1; - break; - case VIDEO_REQUEST_GET_DEF: { - uint16_t wObjectiveFocalLength = 0x0064; - memcpy(*data, (uint8_t *)&wObjectiveFocalLength, 2); - *len = 2; - } break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - case VIDEO_CT_ROLL_ABSOLUTE_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_GET_CUR: { - uint16_t wRollAbsolute = 0x0000; - memcpy(*data, (uint8_t *)&wRollAbsolute, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MIN: { - uint16_t wRollAbsolute = 0x0000; - memcpy(*data, (uint8_t *)&wRollAbsolute, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MAX: { - uint16_t wRollAbsolute = 0x00ff; - memcpy(*data, (uint8_t *)&wRollAbsolute, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_RES: { - uint16_t wRollAbsolute = 0x0001; - memcpy(*data, (uint8_t *)&wRollAbsolute, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_INFO: - (*data)[0] = 0x03; //struct video_camera_capabilities - *len = 1; - break; - case VIDEO_REQUEST_GET_DEF: { - uint16_t wRollAbsolute = 0x0000; - memcpy(*data, (uint8_t *)&wRollAbsolute, 2); - *len = 2; - } break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - case VIDEO_CT_FOCUS_AUTO_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_GET_CUR: { - uint16_t wFocusAuto = 0x0000; - memcpy(*data, (uint8_t *)&wFocusAuto, 2); - *len = 2; - } break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - default: - USB_LOG_WRN("Unhandled Video Class control selector 0x%02x\r\n", control_selector); - return -1; - } - } else { - USB_LOG_WRN("Unhandled Video Class wTerminalType 0x%02x\r\n", entity_info->wTerminalType); - return -2; - } - break; - case VIDEO_VC_OUTPUT_TERMINAL_DESCRIPTOR_SUBTYPE: - break; - case VIDEO_VC_SELECTOR_UNIT_DESCRIPTOR_SUBTYPE: - break; - case VIDEO_VC_PROCESSING_UNIT_DESCRIPTOR_SUBTYPE: - switch (control_selector) { - case VIDEO_PU_BACKLIGHT_COMPENSATION_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_GET_CUR: { - uint16_t wBacklightCompensation = 0x0004; - memcpy(*data, (uint8_t *)&wBacklightCompensation, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MIN: { - uint16_t wBacklightCompensation = 0; - memcpy(*data, (uint8_t *)&wBacklightCompensation, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MAX: { - uint16_t wBacklightCompensation = 8; - memcpy(*data, (uint8_t *)&wBacklightCompensation, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_RES: { - uint16_t wBacklightCompensation = 1; - memcpy(*data, (uint8_t *)&wBacklightCompensation, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_INFO: - (*data)[0] = 0x03; //struct video_camera_capabilities - *len = 1; - break; - case VIDEO_REQUEST_GET_DEF: { - uint16_t wBacklightCompensation = 4; - memcpy(*data, (uint8_t *)&wBacklightCompensation, 2); - *len = 2; - } break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - case VIDEO_PU_BRIGHTNESS_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_SET_CUR: { - uint16_t wBrightness = (uint16_t)(*data)[1] << 8 | (uint16_t)(*data)[0]; - USB_LOG_INFO("Video set brightness:%d\r\n", wBrightness); - } break; - case VIDEO_REQUEST_GET_CUR: { - uint16_t wBrightness = 0x0080; - memcpy(*data, (uint8_t *)&wBrightness, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MIN: { - uint16_t wBrightness = 0x0001; - memcpy(*data, (uint8_t *)&wBrightness, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MAX: { - uint16_t wBrightness = 0x00ff; - memcpy(*data, (uint8_t *)&wBrightness, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_RES: { - uint16_t wBrightness = 0x0001; - memcpy(*data, (uint8_t *)&wBrightness, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_INFO: - (*data)[0] = 0x03; //struct video_camera_capabilities - *len = 1; - break; - case VIDEO_REQUEST_GET_DEF: { - uint16_t wBrightness = 0x0080; - memcpy(*data, (uint8_t *)&wBrightness, 2); - *len = 2; - } break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - case VIDEO_PU_CONTRAST_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_GET_CUR: { - uint16_t wContrast = 0x0080; - memcpy(*data, (uint8_t *)&wContrast, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MIN: { - uint16_t wContrast = 0x0001; - memcpy(*data, (uint8_t *)&wContrast, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MAX: { - uint16_t wContrast = 0x00ff; - memcpy(*data, (uint8_t *)&wContrast, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_RES: { - uint16_t wContrast = 0x0001; - memcpy(*data, (uint8_t *)&wContrast, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_INFO: - (*data)[0] = 0x03; //struct video_camera_capabilities - *len = 1; - break; - case VIDEO_REQUEST_GET_DEF: { - uint16_t wContrast = 0x0080; - memcpy(*data, (uint8_t *)&wContrast, 2); - *len = 2; - } break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - case VIDEO_PU_HUE_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_GET_CUR: { - uint16_t wHue = 0x0080; - memcpy(*data, (uint8_t *)&wHue, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MIN: { - uint16_t wHue = 0x0001; - memcpy(*data, (uint8_t *)&wHue, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MAX: { - uint16_t wHue = 0x00ff; - memcpy(*data, (uint8_t *)&wHue, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_RES: { - uint16_t wHue = 0x0001; - memcpy(*data, (uint8_t *)&wHue, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_INFO: - (*data)[0] = 0x03; //struct video_camera_capabilities - *len = 1; - break; - case VIDEO_REQUEST_GET_DEF: { - uint16_t wHue = 0x0080; - memcpy(*data, (uint8_t *)&wHue, 2); - *len = 2; - } break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - case VIDEO_PU_SATURATION_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_GET_MIN: { - uint16_t wSaturation = 0x0001; - memcpy(*data, (uint8_t *)&wSaturation, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MAX: { - uint16_t wSaturation = 0x00ff; - memcpy(*data, (uint8_t *)&wSaturation, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_RES: { - uint16_t wSaturation = 0x0001; - memcpy(*data, (uint8_t *)&wSaturation, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_INFO: - (*data)[0] = 0x03; //struct video_camera_capabilities - *len = 1; - break; - case VIDEO_REQUEST_GET_DEF: { - uint16_t wSaturation = 0x0080; - memcpy(*data, (uint8_t *)&wSaturation, 2); - *len = 2; - } break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - case VIDEO_PU_SHARPNESS_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_GET_MIN: { - uint16_t wSharpness = 0x0001; - memcpy(*data, (uint8_t *)&wSharpness, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MAX: { - uint16_t wSharpness = 0x00ff; - memcpy(*data, (uint8_t *)&wSharpness, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_RES: { - uint16_t wSharpness = 0x0001; - memcpy(*data, (uint8_t *)&wSharpness, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_INFO: - (*data)[0] = 0x03; //struct video_camera_capabilities - *len = 1; - break; - case VIDEO_REQUEST_GET_DEF: { - uint16_t wSharpness = 0x0080; - memcpy(*data, (uint8_t *)&wSharpness, 2); - *len = 2; - } break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - case VIDEO_PU_GAIN_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_GET_MIN: { - uint16_t wGain = 0; - memcpy(*data, (uint8_t *)&wGain, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MAX: { - uint16_t wGain = 255; - memcpy(*data, (uint8_t *)&wGain, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_RES: { - uint16_t wGain = 1; - memcpy(*data, (uint8_t *)&wGain, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_INFO: - (*data)[0] = 0x03; //struct video_camera_capabilities - *len = 1; - break; - case VIDEO_REQUEST_GET_DEF: { - uint16_t wGain = 255; - memcpy(*data, (uint8_t *)&wGain, 2); - *len = 2; - } break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - case VIDEO_PU_WHITE_BALANCE_TEMPERATURE_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_GET_CUR: { - uint16_t wWhiteBalance_Temprature = 417; - memcpy(*data, (uint8_t *)&wWhiteBalance_Temprature, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MIN: { - uint16_t wWhiteBalance_Temprature = 300; - memcpy(*data, (uint8_t *)&wWhiteBalance_Temprature, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_MAX: { - uint16_t wWhiteBalance_Temprature = 600; - memcpy(*data, (uint8_t *)&wWhiteBalance_Temprature, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_RES: { - uint16_t wWhiteBalance_Temprature = 1; - memcpy(*data, (uint8_t *)&wWhiteBalance_Temprature, 2); - *len = 2; - } break; - case VIDEO_REQUEST_GET_INFO: - (*data)[0] = 0x03; //struct video_camera_capabilities - *len = 1; - break; - case VIDEO_REQUEST_GET_DEF: { - uint16_t wWhiteBalance_Temprature = 417; - memcpy(*data, (uint8_t *)&wWhiteBalance_Temprature, 2); - *len = 2; - } break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - case VIDEO_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_GET_CUR: { - uint16_t wWhiteBalance_Temprature_Auto = 1; - memcpy(*data, (uint8_t *)&wWhiteBalance_Temprature_Auto, 1); - *len = 1; - } break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - default: - usbd_video_cfg.error_code = 0x06; - USB_LOG_WRN("Unhandled Video Class control selector 0x%02x\r\n", control_selector); - return -1; - } - break; - case VIDEO_VC_EXTENSION_UNIT_DESCRIPTOR_SUBTYPE: - break; - case VIDEO_VC_ENCODING_UNIT_DESCRIPTOR_SUBTYPE: - break; - - default: - break; - } - } - } - return 0; -} - -static int usbd_video_stream_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - uint8_t control_selector = (uint8_t)(setup->wValue >> 8); - - switch (control_selector) { - case VIDEO_VS_PROBE_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_SET_CUR: - //memcpy((uint8_t *)&usbd_video_cfg.probe, *data, setup->wLength); - break; - case VIDEO_REQUEST_GET_CUR: - memcpy(*data, (uint8_t *)&usbd_video_cfg.probe, setup->wLength); - *len = sizeof(struct video_probe_and_commit_controls); - break; - - case VIDEO_REQUEST_GET_MIN: - case VIDEO_REQUEST_GET_MAX: - case VIDEO_REQUEST_GET_RES: - case VIDEO_REQUEST_GET_DEF: - memcpy(*data, (uint8_t *)&usbd_video_cfg.probe, setup->wLength); - *len = sizeof(struct video_probe_and_commit_controls); - break; - case VIDEO_REQUEST_GET_LEN: - (*data)[0] = sizeof(struct video_probe_and_commit_controls); - *len = 1; - break; - - case VIDEO_REQUEST_GET_INFO: - (*data)[0] = 0x03; - *len = 1; - break; - - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - case VIDEO_VS_COMMIT_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_SET_CUR: - //memcpy((uint8_t *)&usbd_video_cfg.commit, *data, setup->wLength); - break; - case VIDEO_REQUEST_GET_CUR: - memcpy(*data, (uint8_t *)&usbd_video_cfg.commit, setup->wLength); - *len = sizeof(struct video_probe_and_commit_controls); - break; - case VIDEO_REQUEST_GET_MIN: - case VIDEO_REQUEST_GET_MAX: - case VIDEO_REQUEST_GET_RES: - case VIDEO_REQUEST_GET_DEF: - memcpy(*data, (uint8_t *)&usbd_video_cfg.commit, setup->wLength); - *len = sizeof(struct video_probe_and_commit_controls); - break; - - case VIDEO_REQUEST_GET_LEN: - (*data)[0] = sizeof(struct video_probe_and_commit_controls); - *len = 1; - break; - - case VIDEO_REQUEST_GET_INFO: - (*data)[0] = 0x03; - *len = 1; - break; - - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - case VIDEO_VS_STREAM_ERROR_CODE_CONTROL: - switch (setup->bRequest) { - case VIDEO_REQUEST_GET_CUR: - (*data)[0] = usbd_video_cfg.error_code; - *len = 1; - break; - case VIDEO_REQUEST_GET_INFO: - (*data)[0] = 0x01; - *len = 1; - break; - default: - USB_LOG_WRN("Unhandled Video Class bRequest 0x%02x\r\n", setup->bRequest); - return -1; - } - break; - default: - break; - } - - return 0; -} - -static int video_class_interface_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - USB_LOG_DBG("Video Class request: " - "bRequest 0x%02x\r\n", - setup->bRequest); - - uint8_t intf_num = (uint8_t)setup->wIndex; - uint8_t entity_id = (uint8_t)(setup->wIndex >> 8); - - if (intf_num == 0) { /* Video Control Interface */ - if (entity_id == 0) { - return usbd_video_control_request_handler(setup, data, len); /* Interface Control Requests */ - } else { - return usbd_video_control_unit_terminal_request_handler(setup, data, len); /* Unit and Terminal Requests */ - } - } else if (intf_num == 1) { /* Video Stream Inteface */ - return usbd_video_stream_request_handler(setup, data, len); /* Interface Stream Requests */ - } - return -1; -} - -static void video_notify_handler(uint8_t event, void *arg) -{ - switch (event) { - case USBD_EVENT_RESET: - usbd_video_cfg.error_code = 0; - usbd_video_cfg.power_mode = 0; - break; - - case USBD_EVENT_SET_INTERFACE: { - struct usb_interface_descriptor *intf = (struct usb_interface_descriptor *)arg; - if (intf->bAlternateSetting == 1) { - usbd_video_open(intf->bInterfaceNumber); - } else { - usbd_video_close(intf->bInterfaceNumber); - } - } - - break; - default: - break; - } -} - -void usbd_video_probe_and_commit_controls_init(uint32_t dwFrameInterval, uint32_t dwMaxVideoFrameSize, uint32_t dwMaxPayloadTransferSize) -{ - usbd_video_cfg.probe.hintUnion.bmHint = 0x01; - usbd_video_cfg.probe.hintUnion1.bmHint = 0; - usbd_video_cfg.probe.bFormatIndex = 1; - usbd_video_cfg.probe.bFrameIndex = 1; - usbd_video_cfg.probe.dwFrameInterval = dwFrameInterval; - usbd_video_cfg.probe.wKeyFrameRate = 0; - usbd_video_cfg.probe.wPFrameRate = 0; - usbd_video_cfg.probe.wCompQuality = 0; - usbd_video_cfg.probe.wCompWindowSize = 0; - usbd_video_cfg.probe.wDelay = 0; - usbd_video_cfg.probe.dwMaxVideoFrameSize = dwMaxVideoFrameSize; - usbd_video_cfg.probe.dwMaxPayloadTransferSize = dwMaxPayloadTransferSize; - usbd_video_cfg.probe.dwClockFrequency = 0; - usbd_video_cfg.probe.bmFramingInfo = 0; - usbd_video_cfg.probe.bPreferedVersion = 0; - usbd_video_cfg.probe.bMinVersion = 0; - usbd_video_cfg.probe.bMaxVersion = 0; - - usbd_video_cfg.commit.hintUnion.bmHint = 0x01; - usbd_video_cfg.commit.hintUnion1.bmHint = 0; - usbd_video_cfg.commit.bFormatIndex = 1; - usbd_video_cfg.commit.bFrameIndex = 1; - usbd_video_cfg.commit.dwFrameInterval = dwFrameInterval; - usbd_video_cfg.commit.wKeyFrameRate = 0; - usbd_video_cfg.commit.wPFrameRate = 0; - usbd_video_cfg.commit.wCompQuality = 0; - usbd_video_cfg.commit.wCompWindowSize = 0; - usbd_video_cfg.commit.wDelay = 0; - usbd_video_cfg.commit.dwMaxVideoFrameSize = dwMaxVideoFrameSize; - usbd_video_cfg.commit.dwMaxPayloadTransferSize = dwMaxPayloadTransferSize; - usbd_video_cfg.commit.dwClockFrequency = 0; - usbd_video_cfg.commit.bmFramingInfo = 0; - usbd_video_cfg.commit.bPreferedVersion = 0; - usbd_video_cfg.commit.bMinVersion = 0; - usbd_video_cfg.commit.bMaxVersion = 0; -} - -struct usbd_interface *usbd_video_init_intf(struct usbd_interface *intf, - uint32_t dwFrameInterval, - uint32_t dwMaxVideoFrameSize, - uint32_t dwMaxPayloadTransferSize) -{ - intf->class_interface_handler = video_class_interface_request_handler; - intf->class_endpoint_handler = NULL; - intf->vendor_handler = NULL; - intf->notify_handler = video_notify_handler; - - usbd_video_probe_and_commit_controls_init(dwFrameInterval, dwMaxVideoFrameSize, dwMaxPayloadTransferSize); - return intf; -} - -uint32_t usbd_video_mjpeg_payload_fill(uint8_t *input, uint32_t input_len, uint8_t *output, uint32_t *out_len) -{ - uint32_t packets; - uint32_t last_packet_size; - uint32_t picture_pos = 0; - static uint8_t uvc_header[2] = { 0x02, 0x80 }; - - packets = input_len / usbd_video_cfg.probe.dwMaxPayloadTransferSize + 1; - last_packet_size = input_len - ((packets - 1) * (usbd_video_cfg.probe.dwMaxPayloadTransferSize - 2)) + 2; - - for (size_t i = 0; i < packets; i++) { - output[usbd_video_cfg.probe.dwMaxPayloadTransferSize * i] = uvc_header[0]; - output[usbd_video_cfg.probe.dwMaxPayloadTransferSize * i + 1] = uvc_header[1]; - if (i == (packets - 1)) { - memcpy(&output[2 + usbd_video_cfg.probe.dwMaxPayloadTransferSize * i], &input[picture_pos], last_packet_size - 2); - output[usbd_video_cfg.probe.dwMaxPayloadTransferSize * i + 1] |= (1 << 1); - } else { - memcpy(&output[2 + usbd_video_cfg.probe.dwMaxPayloadTransferSize * i], &input[picture_pos], usbd_video_cfg.probe.dwMaxPayloadTransferSize - 2); - picture_pos += usbd_video_cfg.probe.dwMaxPayloadTransferSize - 2; - } - } - uvc_header[1] ^= 1; - *out_len = (input_len + 2 * packets); - return packets; -} \ No newline at end of file diff --git a/third-party/cherryusb/class/video/usbd_video.h b/third-party/cherryusb/class/video/usbd_video.h deleted file mode 100644 index 75d7f9ed9adec4a03c5b5367b007f792d8657d73..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/video/usbd_video.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBD_VIDEO_H -#define USBD_VIDEO_H - -#include "usb_video.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Init video interface driver */ -struct usbd_interface *usbd_video_init_intf(struct usbd_interface *intf, - uint32_t dwFrameInterval, - uint32_t dwMaxVideoFrameSize, - uint32_t dwMaxPayloadTransferSize); - -void usbd_video_open(uint8_t intf); -void usbd_video_close(uint8_t intf); -uint32_t usbd_video_mjpeg_payload_fill(uint8_t *input, uint32_t input_len, uint8_t *output, uint32_t *out_len); - -#ifdef __cplusplus -} -#endif - -#endif /* USBD_VIDEO_H */ diff --git a/third-party/cherryusb/class/video/usbh_video.c b/third-party/cherryusb/class/video/usbh_video.c deleted file mode 100644 index c123b120f4e8b58e1a6d4acd9120f4887e16e5ea..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/video/usbh_video.c +++ /dev/null @@ -1,603 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbh_core.h" -#include "usbh_video.h" - -#define DEV_FORMAT "/dev/video%d" - -/* general descriptor field offsets */ -#define DESC_bLength 0 /** Length offset */ -#define DESC_bDescriptorType 1 /** Descriptor type offset */ -#define DESC_bDescriptorSubType 2 /** Descriptor subtype offset */ -#define DESC_bNumFormats 3 /** Descriptor numformat offset */ -#define DESC_bNumFrameDescriptors 4 /** Descriptor numframe offset */ -#define DESC_bFormatIndex 3 /** Descriptor format index offset */ -#define DESC_bFrameIndex 3 /** Descriptor frame index offset */ - -/* interface descriptor field offsets */ -#define INTF_DESC_bInterfaceNumber 2 /** Interface number offset */ -#define INTF_DESC_bAlternateSetting 3 /** Alternate setting offset */ - -static uint32_t g_devinuse = 0; - -USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_video_buf[128]; - -static const char *format_type[] = { "uncompressed", "mjpeg" }; - -static int usbh_video_devno_alloc(struct usbh_video *video_class) -{ - int devno; - - for (devno = 0; devno < 32; devno++) { - uint32_t bitno = 1 << devno; - if ((g_devinuse & bitno) == 0) { - g_devinuse |= bitno; - video_class->minor = devno; - return 0; - } - } - - return -EMFILE; -} - -static void usbh_video_devno_free(struct usbh_video *video_class) -{ - int devno = video_class->minor; - - if (devno >= 0 && devno < 32) { - g_devinuse &= ~(1 << devno); - } -} - -int usbh_video_get_cur(struct usbh_video *video_class, uint8_t intf, uint8_t entity_id, uint8_t cs, uint8_t *buf, uint16_t len) -{ - struct usb_setup_packet *setup = video_class->hport->setup; - int ret; - - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = VIDEO_REQUEST_GET_CUR; - setup->wValue = cs << 8; - setup->wIndex = (entity_id << 8) | intf; - setup->wLength = len; - - ret = usbh_control_transfer(video_class->hport->ep0, setup, g_video_buf); - if (ret < 0) { - return ret; - } - memcpy(buf, g_video_buf, len); - return ret; -} - -int usbh_video_set_cur(struct usbh_video *video_class, uint8_t intf, uint8_t entity_id, uint8_t cs, uint8_t *buf, uint16_t len) -{ - struct usb_setup_packet *setup = video_class->hport->setup; - int ret; - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = VIDEO_REQUEST_SET_CUR; - setup->wValue = cs << 8; - setup->wIndex = (entity_id << 8) | intf; - setup->wLength = len; - - memcpy(g_video_buf, buf, len); - - ret = usbh_control_transfer(video_class->hport->ep0, setup, g_video_buf); - usb_osal_msleep(5); - return ret; -} - -int usbh_videostreaming_get_cur_probe(struct usbh_video *video_class) -{ - return usbh_video_get_cur(video_class, video_class->data_intf, 0x00, VIDEO_VS_PROBE_CONTROL, (uint8_t *)&video_class->probe, 26); -} - -int usbh_videostreaming_set_cur_probe(struct usbh_video *video_class, uint8_t formatindex, uint8_t frameindex) -{ - video_class->probe.bFormatIndex = formatindex; - video_class->probe.bFrameIndex = frameindex; - video_class->probe.dwMaxPayloadTransferSize = 0; - return usbh_video_set_cur(video_class, video_class->data_intf, 0x00, VIDEO_VS_PROBE_CONTROL, (uint8_t *)&video_class->probe, 26); -} - -int usbh_videostreaming_set_cur_commit(struct usbh_video *video_class, uint8_t formatindex, uint8_t frameindex) -{ - memcpy(&video_class->commit, &video_class->probe, sizeof(struct video_probe_and_commit_controls)); - video_class->commit.bFormatIndex = formatindex; - video_class->commit.bFrameIndex = frameindex; - return usbh_video_set_cur(video_class, video_class->data_intf, 0x00, VIDEO_VS_COMMIT_CONTROL, (uint8_t *)&video_class->commit, 26); -} - -int usbh_video_open(struct usbh_video *video_class, - uint8_t format_type, - uint16_t wWidth, - uint16_t wHeight, - uint8_t altsetting) -{ - struct usb_setup_packet *setup = video_class->hport->setup; - struct usb_endpoint_descriptor *ep_desc; - uint8_t mult; - uint16_t mps; - int ret; - bool found = false; - uint8_t formatidx = 0; - uint8_t frameidx = 0; - - if (video_class->is_opened) { - return -EMFILE; - } - - for (uint8_t i = 0; i < video_class->num_of_formats; i++) { - if (format_type == video_class->format[i].format_type) { - formatidx = i + 1; - for (uint8_t j = 0; j < video_class->format[i].num_of_frames; j++) { - if ((wWidth == video_class->format[i].frame[j].wWidth) && - (wHeight == video_class->format[i].frame[j].wHeight)) { - frameidx = j + 1; - found = true; - break; - } - } - } - } - - if (found == false) { - return -ENODEV; - } - - if (altsetting > (video_class->num_of_intf_altsettings - 1)) { - return -EINVAL; - } - - ret = usbh_videostreaming_get_cur_probe(video_class); - if (ret < 0) { - return ret; - } - ret = usbh_videostreaming_set_cur_probe(video_class, formatidx, frameidx); - if (ret < 0) { - return ret; - } - ret = usbh_videostreaming_get_cur_probe(video_class); - if (ret < 0) { - return ret; - } - ret = usbh_videostreaming_set_cur_probe(video_class, formatidx, frameidx); - if (ret < 0) { - return ret; - } - ret = usbh_videostreaming_get_cur_probe(video_class); - if (ret < 0) { - return ret; - } - ret = usbh_videostreaming_set_cur_commit(video_class, formatidx, frameidx); - if (ret < 0) { - return ret; - } - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_STANDARD | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = USB_REQUEST_SET_INTERFACE; - setup->wValue = altsetting; - setup->wIndex = video_class->data_intf; - setup->wLength = 0; - - ret = usbh_control_transfer(video_class->hport->ep0, setup, NULL); - if (ret < 0) { - return ret; - } - - ep_desc = &video_class->hport->config.intf[video_class->data_intf].altsetting[altsetting].ep[0].ep_desc; - mult = (ep_desc->wMaxPacketSize & USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_MASK) >> USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_SHIFT; - mps = ep_desc->wMaxPacketSize & USB_MAXPACKETSIZE_MASK; - if (ep_desc->bEndpointAddress & 0x80) { - video_class->isoin_mps = mps * (mult + 1); - usbh_hport_activate_epx(&video_class->isoin, video_class->hport, ep_desc); - } else { - video_class->isoout_mps = mps * (mult + 1); - usbh_hport_activate_epx(&video_class->isoout, video_class->hport, ep_desc); - } - - USB_LOG_INFO("Open video and select formatidx:%u, frameidx:%u, altsetting:%u\r\n", formatidx, frameidx, altsetting); - video_class->is_opened = true; - video_class->current_format = format_type; - return ret; -} - -int usbh_video_close(struct usbh_video *video_class) -{ - struct usb_setup_packet *setup = video_class->hport->setup; - int ret = 0; - - USB_LOG_INFO("Close video device\r\n"); - - video_class->is_opened = false; - - if (video_class->isoin) { - usbh_pipe_free(video_class->isoin); - video_class->isoin = NULL; - } - - if (video_class->isoout) { - usbh_pipe_free(video_class->isoout); - video_class->isoout = NULL; - } - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_STANDARD | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = USB_REQUEST_SET_INTERFACE; - setup->wValue = 0; - setup->wIndex = video_class->data_intf; - setup->wLength = 0; - - ret = usbh_control_transfer(video_class->hport->ep0, setup, NULL); - if (ret < 0) { - return ret; - } - return ret; -} - -void usbh_video_list_info(struct usbh_video *video_class) -{ - struct usb_endpoint_descriptor *ep_desc; - uint8_t mult; - uint16_t mps; - - USB_LOG_INFO("============= Video device information ===================\r\n"); - USB_LOG_INFO("bcdVDC:%04x\r\n", video_class->bcdVDC); - USB_LOG_INFO("Num of altsettings:%u\r\n", video_class->num_of_intf_altsettings); - - for (uint8_t i = 0; i < video_class->num_of_intf_altsettings; i++) { - if (i == 0) { - USB_LOG_INFO("Ingore altsetting 0\r\n"); - continue; - } - ep_desc = &video_class->hport->config.intf[video_class->data_intf].altsetting[i].ep[0].ep_desc; - - mult = (ep_desc->wMaxPacketSize & USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_MASK) >> USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_SHIFT; - mps = ep_desc->wMaxPacketSize & USB_MAXPACKETSIZE_MASK; - - USB_LOG_INFO("Altsetting:%u, Ep=%02x Attr=%02u Mps=%d Interval=%02u Mult=%02u\r\n", - i, - ep_desc->bEndpointAddress, - ep_desc->bmAttributes, - mps, - ep_desc->bInterval, - mult); - } - - USB_LOG_INFO("bNumFormats:%u\r\n", video_class->num_of_formats); - for (uint8_t i = 0; i < video_class->num_of_formats; i++) { - USB_LOG_INFO(" FormatIndex:%u\r\n", i + 1); - USB_LOG_INFO(" FormatType:%s\r\n", format_type[video_class->format[i].format_type]); - USB_LOG_INFO(" bNumFrames:%u\r\n", video_class->format[i].num_of_frames); - USB_LOG_INFO(" Resolution:\r\n"); - for (uint8_t j = 0; j < video_class->format[i].num_of_frames; j++) { - USB_LOG_INFO(" FrameIndex:%u\r\n", j + 1); - USB_LOG_INFO(" wWidth: %d, wHeight: %d\r\n", - video_class->format[i].frame[j].wWidth, - video_class->format[i].frame[j].wHeight); - } - } - - USB_LOG_INFO("============= Video device information ===================\r\n"); -} - -static int usbh_video_ctrl_connect(struct usbh_hubport *hport, uint8_t intf) -{ - int ret; - uint8_t cur_iface = 0xff; - // uint8_t cur_alt_setting = 0xff; - uint8_t frame_index = 0xff; - uint8_t format_index = 0xff; - uint8_t num_of_frames = 0xff; - uint8_t *p; - - struct usbh_video *video_class = usb_malloc(sizeof(struct usbh_video)); - if (video_class == NULL) { - USB_LOG_ERR("Fail to alloc video_class\r\n"); - return -ENOMEM; - } - - memset(video_class, 0, sizeof(struct usbh_video)); - usbh_video_devno_alloc(video_class); - video_class->hport = hport; - video_class->ctrl_intf = intf; - video_class->data_intf = intf + 1; - video_class->num_of_intf_altsettings = hport->config.intf[intf + 1].altsetting_num; - - hport->config.intf[intf].priv = video_class; - - ret = usbh_video_close(video_class); - if (ret < 0) { - USB_LOG_ERR("Fail to close video device\r\n"); - return ret; - } - - p = hport->raw_config_desc; - while (p[DESC_bLength]) { - switch (p[DESC_bDescriptorType]) { - case USB_DESCRIPTOR_TYPE_INTERFACE: - cur_iface = p[INTF_DESC_bInterfaceNumber]; - //cur_alt_setting = p[INTF_DESC_bAlternateSetting]; - break; - case USB_DESCRIPTOR_TYPE_ENDPOINT: - //ep_desc = (struct usb_endpoint_descriptor *)p; - break; - case VIDEO_CS_INTERFACE_DESCRIPTOR_TYPE: - if (cur_iface == video_class->ctrl_intf) { - switch (p[DESC_bDescriptorSubType]) { - case VIDEO_VC_HEADER_DESCRIPTOR_SUBTYPE: - video_class->bcdVDC = ((uint16_t)p[4] << 8) | (uint16_t)p[3]; - break; - case VIDEO_VC_INPUT_TERMINAL_DESCRIPTOR_SUBTYPE: - break; - case VIDEO_VC_OUTPUT_TERMINAL_DESCRIPTOR_SUBTYPE: - break; - case VIDEO_VC_PROCESSING_UNIT_DESCRIPTOR_SUBTYPE: - break; - - default: - break; - } - } else if (cur_iface == video_class->data_intf) { - switch (p[DESC_bDescriptorSubType]) { - case VIDEO_VS_INPUT_HEADER_DESCRIPTOR_SUBTYPE: - video_class->num_of_formats = p[DESC_bNumFormats]; - break; - case VIDEO_VS_FORMAT_UNCOMPRESSED_DESCRIPTOR_SUBTYPE: - format_index = p[DESC_bFormatIndex]; - num_of_frames = p[DESC_bNumFrameDescriptors]; - - video_class->format[format_index - 1].num_of_frames = num_of_frames; - video_class->format[format_index - 1].format_type = USBH_VIDEO_FORMAT_UNCOMPRESSED; - break; - case VIDEO_VS_FORMAT_MJPEG_DESCRIPTOR_SUBTYPE: - format_index = p[DESC_bFormatIndex]; - num_of_frames = p[DESC_bNumFrameDescriptors]; - - video_class->format[format_index - 1].num_of_frames = num_of_frames; - video_class->format[format_index - 1].format_type = USBH_VIDEO_FORMAT_MJPEG; - break; - case VIDEO_VS_FRAME_UNCOMPRESSED_DESCRIPTOR_SUBTYPE: - frame_index = p[DESC_bFrameIndex]; - - video_class->format[format_index - 1].frame[frame_index - 1].wWidth = ((struct video_cs_if_vs_frame_uncompressed_descriptor *)p)->wWidth; - video_class->format[format_index - 1].frame[frame_index - 1].wHeight = ((struct video_cs_if_vs_frame_uncompressed_descriptor *)p)->wHeight; - break; - case VIDEO_VS_FRAME_MJPEG_DESCRIPTOR_SUBTYPE: - frame_index = p[DESC_bFrameIndex]; - - video_class->format[format_index - 1].frame[frame_index - 1].wWidth = ((struct video_cs_if_vs_frame_mjpeg_descriptor *)p)->wWidth; - video_class->format[format_index - 1].frame[frame_index - 1].wHeight = ((struct video_cs_if_vs_frame_mjpeg_descriptor *)p)->wHeight; - break; - default: - break; - } - } - - break; - - default: - break; - } - /* skip to next descriptor */ - p += p[DESC_bLength]; - } - - usbh_video_list_info(video_class); - - snprintf(hport->config.intf[intf].devname, CONFIG_USBHOST_DEV_NAMELEN, DEV_FORMAT, video_class->minor); - - USB_LOG_INFO("Register Video Class:%s\r\n", hport->config.intf[intf].devname); - - usbh_video_run(video_class); - return ret; -} - -static int usbh_video_ctrl_disconnect(struct usbh_hubport *hport, uint8_t intf) -{ - int ret = 0; - - struct usbh_video *video_class = (struct usbh_video *)hport->config.intf[intf].priv; - - if (video_class) { - usbh_video_devno_free(video_class); - - if (video_class->isoin) { - usbh_pipe_free(video_class->isoin); - } - - if (video_class->isoout) { - usbh_pipe_free(video_class->isoout); - } - - usbh_video_stop(video_class); - memset(video_class, 0, sizeof(struct usbh_video)); - usb_free(video_class); - - if (hport->config.intf[intf].devname[0] != '\0') - USB_LOG_INFO("Unregister Video Class:%s\r\n", hport->config.intf[intf].devname); - } - - return ret; -} - -static int usbh_video_streaming_connect(struct usbh_hubport *hport, uint8_t intf) -{ - return 0; -} - -static int usbh_video_streaming_disconnect(struct usbh_hubport *hport, uint8_t intf) -{ - return 0; -} - -#if 0 -void usbh_videostreaming_parse_mjpeg(struct usbh_urb *urb, struct usbh_videostreaming *stream) -{ - struct usbh_iso_frame_packet *iso_packet; - uint32_t num_of_iso_packets; - uint8_t data_offset; - uint32_t data_len; - uint8_t header_len = 0; - - num_of_iso_packets = urb->num_of_iso_packets; - iso_packet = urb->iso_packet; - - for (uint32_t i = 0; i < num_of_iso_packets; i++) { - /* - uint8_t frameIdentifier : 1U; - uint8_t endOfFrame : 1U; - uint8_t presentationTimeStamp : 1U; - uint8_t sourceClockReference : 1U; - uint8_t reserved : 1U; - uint8_t stillImage : 1U; - uint8_t errorBit : 1U; - uint8_t endOfHeader : 1U; - */ - if (iso_packet[i].actual_length == 0) { /* skip no data */ - continue; - } - - header_len = iso_packet[i].transfer_buffer[0]; - - if ((header_len > 12) || (header_len == 0)) { /* do not be illegal */ - while (1) { - } - } - if (iso_packet[i].transfer_buffer[1] & (1 << 6)) { /* error bit, re-receive */ - stream->bufoffset = 0; - continue; - } - - if ((stream->bufoffset == 0) && ((iso_packet[i].transfer_buffer[header_len] != 0xff) || (iso_packet[i].transfer_buffer[header_len + 1] != 0xd8))) { - stream->bufoffset = 0; - continue; - } - - data_offset = header_len; - data_len = iso_packet[i].actual_length - header_len; - - /** do something here */ - - stream->bufoffset += data_len; - - if (iso_packet[i].transfer_buffer[1] & (1 << 1)) { - if ((iso_packet[i].transfer_buffer[iso_packet[i].actual_length - 2] != 0xff) || (iso_packet[i].transfer_buffer[iso_packet[i].actual_length - 1] != 0xd9)) { - stream->bufoffset = 0; - continue; - } - - /** do something here */ - - if (stream->video_one_frame_callback) { - stream->video_one_frame_callback(stream); - } - stream->bufoffset = 0; - } - } - /** do something here */ -} - -void usbh_videostreaming_parse_yuyv2(struct usbh_urb *urb, struct usbh_videostreaming *stream) -{ - struct usbh_iso_frame_packet *iso_packet; - uint32_t num_of_iso_packets; - uint8_t data_offset; - uint32_t data_len; - uint8_t header_len = 0; - - num_of_iso_packets = urb->num_of_iso_packets; - iso_packet = urb->iso_packet; - - for (uint32_t i = 0; i < num_of_iso_packets; i++) { - /* - uint8_t frameIdentifier : 1U; - uint8_t endOfFrame : 1U; - uint8_t presentationTimeStamp : 1U; - uint8_t sourceClockReference : 1U; - uint8_t reserved : 1U; - uint8_t stillImage : 1U; - uint8_t errorBit : 1U; - uint8_t endOfHeader : 1U; - */ - - if (iso_packet[i].actual_length == 0) { /* skip no data */ - continue; - } - - header_len = iso_packet[i].transfer_buffer[0]; - - if ((header_len > 12) || (header_len == 0)) { /* do not be illegal */ - while (1) { - } - } - if (iso_packet[i].transfer_buffer[1] & (1 << 6)) { /* error bit, re-receive */ - stream->bufoffset = 0; - continue; - } - - data_offset = header_len; - data_len = iso_packet[i].actual_length - header_len; - - /** do something here */ - - stream->bufoffset += data_len; - - if (iso_packet[i].transfer_buffer[1] & (1 << 1)) { - /** do something here */ - - if (stream->video_one_frame_callback && (stream->bufoffset == stream->buflen)) { - stream->video_one_frame_callback(stream); - } - stream->bufoffset = 0; - } - } - - /** do something here */ -} -#endif - -__WEAK void usbh_video_run(struct usbh_video *video_class) -{ -} - -__WEAK void usbh_video_stop(struct usbh_video *video_class) -{ -} - -__WEAK void usbh_videostreaming_output(uint8_t *input, uint32_t input_len) -{ -} - -const struct usbh_class_driver video_ctrl_class_driver = { - .driver_name = "video_ctrl", - .connect = usbh_video_ctrl_connect, - .disconnect = usbh_video_ctrl_disconnect -}; - -const struct usbh_class_driver video_streaming_class_driver = { - .driver_name = "video_streaming", - .connect = usbh_video_streaming_connect, - .disconnect = usbh_video_streaming_disconnect -}; - -CLASS_INFO_DEFINE const struct usbh_class_info video_ctrl_class_info = { - .match_flags = USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS | USB_CLASS_MATCH_INTF_PROTOCOL, - .class = USB_DEVICE_CLASS_VIDEO, - .subclass = VIDEO_SC_VIDEOCONTROL, - .protocol = VIDEO_PC_PROTOCOL_UNDEFINED, - .vid = 0x00, - .pid = 0x00, - .class_driver = &video_ctrl_class_driver -}; - -CLASS_INFO_DEFINE const struct usbh_class_info video_streaming_class_info = { - .match_flags = USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS | USB_CLASS_MATCH_INTF_PROTOCOL, - .class = USB_DEVICE_CLASS_VIDEO, - .subclass = VIDEO_SC_VIDEOSTREAMING, - .protocol = VIDEO_PC_PROTOCOL_UNDEFINED, - .vid = 0x00, - .pid = 0x00, - .class_driver = &video_streaming_class_driver -}; diff --git a/third-party/cherryusb/class/video/usbh_video.h b/third-party/cherryusb/class/video/usbh_video.h deleted file mode 100644 index eacfbb3c859d9e2cbafcd94e1f5159dde5237681..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/video/usbh_video.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBH_VIDEO_H -#define USBH_VIDEO_H - -#include "usb_video.h" - -#define USBH_VIDEO_FORMAT_UNCOMPRESSED 0 -#define USBH_VIDEO_FORMAT_MJPEG 1 - -struct usbh_video_resolution { - uint16_t wWidth; - uint16_t wHeight; -}; - -struct usbh_video_format { - struct usbh_video_resolution frame[12]; - uint8_t format_type; - uint8_t num_of_frames; -}; - -struct usbh_videostreaming { - uint32_t bufoffset; - uint32_t buflen; - void (*video_one_frame_callback)(struct usbh_videostreaming *stream); -}; - -struct usbh_video { - struct usbh_hubport *hport; - - uint8_t ctrl_intf; /* interface number */ - uint8_t data_intf; /* interface number */ - uint8_t minor; - usbh_pipe_t isoin; /* ISO IN endpoint */ - usbh_pipe_t isoout; /* ISO OUT endpoint */ - struct video_probe_and_commit_controls probe; - struct video_probe_and_commit_controls commit; - uint16_t isoin_mps; - uint16_t isoout_mps; - bool is_opened; - uint8_t current_format; - uint16_t bcdVDC; - uint8_t num_of_intf_altsettings; - uint8_t num_of_formats; - struct usbh_video_format format[3]; -}; - -#ifdef __cplusplus -extern "C" { -#endif - -void usbh_video_inityuyv2rgb_table(void); -void usbh_video_yuyv2rgb565(void *input, void *output, uint32_t len); - -int usbh_video_get_cur(struct usbh_video *video_class, uint8_t intf, uint8_t entity_id, uint8_t cs, uint8_t *buf, uint16_t len); -int usbh_video_set_cur(struct usbh_video *video_class, uint8_t intf, uint8_t entity_id, uint8_t cs, uint8_t *buf, uint16_t len); -int usbh_videostreaming_get_cur_probe(struct usbh_video *video_class); -int usbh_videostreaming_set_cur_probe(struct usbh_video *video_class, uint8_t formatindex, uint8_t frameindex); -int usbh_videostreaming_set_cur_commit(struct usbh_video *video_class, uint8_t formatindex, uint8_t frameindex); - -int usbh_video_open(struct usbh_video *video_class, - uint8_t format_type, - uint16_t wWidth, - uint16_t wHeight, - uint8_t altsetting); -int usbh_video_close(struct usbh_video *video_class); - -void usbh_video_list_info(struct usbh_video *video_class); - -void usbh_videostreaming_parse_mjpeg(struct usbh_urb *urb, struct usbh_videostreaming *stream); -void usbh_videostreaming_parse_yuyv2(struct usbh_urb *urb, struct usbh_videostreaming *stream); -void usbh_videostreaming_output(uint8_t *input, uint32_t input_len); - -void usbh_video_run(struct usbh_video *video_class); -void usbh_video_stop(struct usbh_video *video_class); - -#ifdef __cplusplus -} -#endif - -#endif /* USBH_VIDEO_H */ diff --git a/third-party/cherryusb/class/wireless/ndis.h b/third-party/cherryusb/class/wireless/ndis.h deleted file mode 100644 index 80a6e66968f58e16f30ff9ebcc6a28ab7dfc40cf..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/wireless/ndis.h +++ /dev/null @@ -1,270 +0,0 @@ -/* This file has been prepared for Doxygen automatic documentation generation.*/ -/*! \file ndis.h *************************************************************** - * - * \brief - * This file contains the possible external configuration of the USB. - * - * \addtogroup usbstick - * - * - ******************************************************************************/ - -/** - \ingroup usbstick - \defgroup RNDIS RNDIS Support - @{ - */ - -/* - * ndis.h - * - * Modified by Colin O'Flynn - * ntddndis.h modified by Benedikt Spranger - * - * Thanks to the cygwin development team, - * espacially to Casper S. Hornstrup - * - * THIS SOFTWARE IS NOT COPYRIGHTED - * - * This source code is offered for use in the public domain. You may - * use, modify or distribute it freely. - * - * This code is distributed in the hope that it will be useful but - * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAIMED. This includes but is not limited to warranties of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - */ - -#ifndef _LINUX_NDIS_H -#define _LINUX_NDIS_H - -#define NDIS_STATUS_MULTICAST_FULL 0xC0010009 -#define NDIS_STATUS_MULTICAST_EXISTS 0xC001000A -#define NDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B - -/* from drivers/net/sk98lin/h/skgepnmi.h */ -#define OID_PNP_CAPABILITIES 0xFD010100 -#define OID_PNP_SET_POWER 0xFD010101 -#define OID_PNP_QUERY_POWER 0xFD010102 -#define OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103 -#define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104 -#define OID_PNP_ENABLE_WAKE_UP 0xFD010106 - -enum NDIS_DEVICE_POWER_STATE { - NdisDeviceStateUnspecified = 0, - NdisDeviceStateD0, - NdisDeviceStateD1, - NdisDeviceStateD2, - NdisDeviceStateD3, - NdisDeviceStateMaximum -}; - -struct NDIS_PM_WAKE_UP_CAPABILITIES { - enum NDIS_DEVICE_POWER_STATE MinMagicPacketWakeUp; - enum NDIS_DEVICE_POWER_STATE MinPatternWakeUp; - enum NDIS_DEVICE_POWER_STATE MinLinkChangeWakeUp; -}; - -/* NDIS_PNP_CAPABILITIES.Flags constants */ -#define NDIS_DEVICE_WAKE_UP_ENABLE 0x00000001 -#define NDIS_DEVICE_WAKE_ON_PATTERN_MATCH_ENABLE 0x00000002 -#define NDIS_DEVICE_WAKE_ON_MAGIC_PACKET_ENABLE 0x00000004 - -/* -struct NDIS_PNP_CAPABILITIES { - __le32 Flags; - struct NDIS_PM_WAKE_UP_CAPABILITIES WakeUpCapabilities; -}; - -struct NDIS_PM_PACKET_PATTERN { - __le32 Priority; - __le32 Reserved; - __le32 MaskSize; - __le32 PatternOffset; - __le32 PatternSize; - __le32 PatternFlags; -}; -*/ - -/* Required Object IDs (OIDs) */ -#define OID_GEN_SUPPORTED_LIST 0x00010101 -#define OID_GEN_HARDWARE_STATUS 0x00010102 -#define OID_GEN_MEDIA_SUPPORTED 0x00010103 -#define OID_GEN_MEDIA_IN_USE 0x00010104 -#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 -#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106 -#define OID_GEN_LINK_SPEED 0x00010107 -#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 -#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 -#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A -#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B -#define OID_GEN_VENDOR_ID 0x0001010C -#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D -#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E -#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F -#define OID_GEN_DRIVER_VERSION 0x00010110 -#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 -#define OID_GEN_PROTOCOL_OPTIONS 0x00010112 -#define OID_GEN_MAC_OPTIONS 0x00010113 -#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 -#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 -#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 -#define OID_GEN_SUPPORTED_GUIDS 0x00010117 -#define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118 -#define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119 -#define OID_GEN_MACHINE_NAME 0x0001021A -#define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B -#define OID_GEN_VLAN_ID 0x0001021C - -/* Optional OIDs */ -#define OID_GEN_MEDIA_CAPABILITIES 0x00010201 -#define OID_GEN_PHYSICAL_MEDIUM 0x00010202 - -/* Required statistics OIDs */ -#define OID_GEN_XMIT_OK 0x00020101 -#define OID_GEN_RCV_OK 0x00020102 -#define OID_GEN_XMIT_ERROR 0x00020103 -#define OID_GEN_RCV_ERROR 0x00020104 -#define OID_GEN_RCV_NO_BUFFER 0x00020105 - -/* Optional statistics OIDs */ -#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 -#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202 -#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 -#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204 -#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 -#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206 -#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207 -#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208 -#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209 -#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A -#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B -#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C -#define OID_GEN_RCV_CRC_ERROR 0x0002020D -#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E -#define OID_GEN_GET_TIME_CAPS 0x0002020F -#define OID_GEN_GET_NETCARD_TIME 0x00020210 -#define OID_GEN_NETCARD_LOAD 0x00020211 -#define OID_GEN_DEVICE_PROFILE 0x00020212 -#define OID_GEN_INIT_TIME_MS 0x00020213 -#define OID_GEN_RESET_COUNTS 0x00020214 -#define OID_GEN_MEDIA_SENSE_COUNTS 0x00020215 -#define OID_GEN_FRIENDLY_NAME 0x00020216 -#define OID_GEN_MINIPORT_INFO 0x00020217 -#define OID_GEN_RESET_VERIFY_PARAMETERS 0x00020218 - -/* IEEE 802.3 (Ethernet) OIDs */ -#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001 - -#define OID_802_3_PERMANENT_ADDRESS 0x01010101 -#define OID_802_3_CURRENT_ADDRESS 0x01010102 -#define OID_802_3_MULTICAST_LIST 0x01010103 -#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 -#define OID_802_3_MAC_OPTIONS 0x01010105 -#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 -#define OID_802_3_XMIT_ONE_COLLISION 0x01020102 -#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 -#define OID_802_3_XMIT_DEFERRED 0x01020201 -#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 -#define OID_802_3_RCV_OVERRUN 0x01020203 -#define OID_802_3_XMIT_UNDERRUN 0x01020204 -#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 -#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 -#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 - -/* Wireless LAN OIDs */ -/* Mandatory */ -#define OID_802_11_BSSID 0x0D010101 /* Q S */ -#define OID_802_11_SSID 0x0D010102 /* Q S */ -#define OID_802_11_NETWORK_TYPE_IN_USE 0x0D010204 /* Q S */ -#define OID_802_11_RSSI 0x0D010206 /* Q I */ -#define OID_802_11_BSSID_LIST 0x0D010217 /* Q */ -#define OID_802_11_BSSID_LIST_SCAN 0x0D01011A /* S */ -#define OID_802_11_INFRASTRUCTURE_MODE 0x0D010108 /* Q S */ -#define OID_802_11_SUPPORTED_RATES 0x0D01020E /* Q */ -#define OID_802_11_CONFIGURATION 0x0D010211 /* Q S */ -#define OID_802_11_ADD_WEP 0x0D010113 /* S */ -#define OID_802_11_WEP_STATUS 0x0D01011B /* Q S */ -#define OID_802_11_REMOVE_WEP 0x0D010114 /* S */ -#define OID_802_11_DISASSOCIATE 0x0D010115 /* S */ -#define OID_802_11_AUTHENTICATION_MODE 0x0D010118 /* Q S */ -#define OID_802_11_RELOAD_DEFAULTS 0x0D01011C /* S */ - -/* OID_GEN_MINIPORT_INFO constants */ -#define NDIS_MINIPORT_BUS_MASTER 0x00000001 -#define NDIS_MINIPORT_WDM_DRIVER 0x00000002 -#define NDIS_MINIPORT_SG_LIST 0x00000004 -#define NDIS_MINIPORT_SUPPORTS_MEDIA_QUERY 0x00000008 -#define NDIS_MINIPORT_INDICATES_PACKETS 0x00000010 -#define NDIS_MINIPORT_IGNORE_PACKET_QUEUE 0x00000020 -#define NDIS_MINIPORT_IGNORE_REQUEST_QUEUE 0x00000040 -#define NDIS_MINIPORT_IGNORE_TOKEN_RING_ERRORS 0x00000080 -#define NDIS_MINIPORT_INTERMEDIATE_DRIVER 0x00000100 -#define NDIS_MINIPORT_IS_NDIS_5 0x00000200 -#define NDIS_MINIPORT_IS_CO 0x00000400 -#define NDIS_MINIPORT_DESERIALIZE 0x00000800 -#define NDIS_MINIPORT_REQUIRES_MEDIA_POLLING 0x00001000 -#define NDIS_MINIPORT_SUPPORTS_MEDIA_SENSE 0x00002000 -#define NDIS_MINIPORT_NETBOOT_CARD 0x00004000 -#define NDIS_MINIPORT_PM_SUPPORTED 0x00008000 -#define NDIS_MINIPORT_SUPPORTS_MAC_ADDRESS_OVERWRITE 0x00010000 -#define NDIS_MINIPORT_USES_SAFE_BUFFER_APIS 0x00020000 -#define NDIS_MINIPORT_HIDDEN 0x00040000 -#define NDIS_MINIPORT_SWENUM 0x00080000 -#define NDIS_MINIPORT_SURPRISE_REMOVE_OK 0x00100000 -#define NDIS_MINIPORT_NO_HALT_ON_SUSPEND 0x00200000 -#define NDIS_MINIPORT_HARDWARE_DEVICE 0x00400000 -#define NDIS_MINIPORT_SUPPORTS_CANCEL_SEND_PACKETS 0x00800000 -#define NDIS_MINIPORT_64BITS_DMA 0x01000000 - -#define NDIS_MEDIUM_802_3 0x00000000 -#define NDIS_MEDIUM_802_5 0x00000001 -#define NDIS_MEDIUM_FDDI 0x00000002 -#define NDIS_MEDIUM_WAN 0x00000003 -#define NDIS_MEDIUM_LOCAL_TALK 0x00000004 -#define NDIS_MEDIUM_DIX 0x00000005 -#define NDIS_MEDIUM_ARCENT_RAW 0x00000006 -#define NDIS_MEDIUM_ARCENT_878_2 0x00000007 -#define NDIS_MEDIUM_ATM 0x00000008 -#define NDIS_MEDIUM_WIRELESS_LAN 0x00000009 -#define NDIS_MEDIUM_IRDA 0x0000000A -#define NDIS_MEDIUM_BPC 0x0000000B -#define NDIS_MEDIUM_CO_WAN 0x0000000C -#define NDIS_MEDIUM_1394 0x0000000D - -#define NDIS_PACKET_TYPE_DIRECTED 0x00000001 -#define NDIS_PACKET_TYPE_MULTICAST 0x00000002 -#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 -#define NDIS_PACKET_TYPE_BROADCAST 0x00000008 -#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010 -#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020 -#define NDIS_PACKET_TYPE_SMT 0x00000040 -#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080 -#define NDIS_PACKET_TYPE_GROUP 0x00000100 -#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00000200 -#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00000400 -#define NDIS_PACKET_TYPE_MAC_FRAME 0x00000800 - -#define NDIS_MEDIA_STATE_CONNECTED 0x00000000 -#define NDIS_MEDIA_STATE_DISCONNECTED 0x00000001 - -#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001 -#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002 -#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004 -#define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008 -#define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010 -#define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020 -#define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040 -#define NDIS_MAC_OPTION_RESERVED 0x80000000 - -/** Hardware status of the underlying NIC */ -#define NDIS_HW_STS_READY 0x00000000UL -#define NDIS_HW_STS_INITIALIZING 0x00000001UL -#define NDIS_HW_STS_RESET 0x00000002UL -#define NDIS_HW_STS_CLOSING 0x00000003UL -#define NDIS_HW_STS_NOT_READY 0x00000004UL - -#endif /* _LINUX_NDIS_H */ - -/** @} */ diff --git a/third-party/cherryusb/class/wireless/rndis_protocol.h b/third-party/cherryusb/class/wireless/rndis_protocol.h deleted file mode 100644 index 54b4ebf6262bef2997d95fd6fe53a1952b1f2863..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/wireless/rndis_protocol.h +++ /dev/null @@ -1,302 +0,0 @@ -/** - * \file rndis_protocol.h - * RNDIS Defines - * - * \author - * Colin O'Flynn - * - * \addtogroup usbstick - */ - -/* Copyright (c) 2008 Colin O'Flynn - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ - -#ifndef _RNDIS_H -#define _RNDIS_H - -/** - \addtogroup RNDIS - @{ - */ - -#include - -#define RNDIS_MAJOR_VERSION 1 -#define RNDIS_MINOR_VERSION 0 - -#define RNDIS_STATUS_SUCCESS 0X00000000 -#define RNDIS_STATUS_FAILURE 0XC0000001 -#define RNDIS_STATUS_INVALID_DATA 0XC0010015 -#define RNDIS_STATUS_NOT_SUPPORTED 0XC00000BB -#define RNDIS_STATUS_MEDIA_CONNECT 0X4001000B -#define RNDIS_STATUS_MEDIA_DISCONNECT 0X4001000C - -/* Message set for Connectionless (802.3) Devices */ -#define REMOTE_NDIS_PACKET_MSG 0x00000001 -#define REMOTE_NDIS_INITIALIZE_MSG 0X00000002 -#define REMOTE_NDIS_HALT_MSG 0X00000003 -#define REMOTE_NDIS_QUERY_MSG 0X00000004 -#define REMOTE_NDIS_SET_MSG 0X00000005 -#define REMOTE_NDIS_RESET_MSG 0X00000006 -#define REMOTE_NDIS_INDICATE_STATUS_MSG 0X00000007 -#define REMOTE_NDIS_KEEPALIVE_MSG 0X00000008 -#define REMOTE_NDIS_INITIALIZE_CMPLT 0X80000002 -#define REMOTE_NDIS_QUERY_CMPLT 0X80000004 -#define REMOTE_NDIS_SET_CMPLT 0X80000005 -#define REMOTE_NDIS_RESET_CMPLT 0X80000006 -#define REMOTE_NDIS_KEEPALIVE_CMPLT 0X80000008 - -typedef uint32_t rndis_MessageType_t; -typedef uint32_t rndis_MessageLength_t; -typedef uint32_t rndis_RequestId_t; -typedef uint32_t rndis_MajorVersion_t; -typedef uint32_t rndis_MinorVersion_t; -typedef uint32_t rndis_MaxTransferSize_t; -typedef uint32_t rndis_Status_t; - -/* Device Flags */ -#define RNDIS_DF_CONNECTIONLESS 0x00000001 -#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002 -typedef uint32_t rndis_DeviceFlags_t; - -/* Mediums */ -#define RNDIS_MEDIUM_802_3 0x00000000 -typedef uint32_t rndis_Medium_t; - -typedef uint32_t rndis_MaxPacketsPerTransfer_t; -typedef uint32_t rndis_PacketAlignmentFactor_t; -typedef uint32_t rndis_AfListOffset_t; -typedef uint32_t rndis_AfListSize_t; - -/*** Remote NDIS Generic Message type ***/ -typedef struct { - rndis_MessageType_t MessageType; - rndis_MessageLength_t MessageLength; -} rndis_generic_msg_t; - -/*** Remote NDIS Initialize Message ***/ -typedef struct { - rndis_MessageType_t MessageType; - rndis_MessageLength_t MessageLength; - rndis_RequestId_t RequestId; - rndis_MajorVersion_t MajorVersion; - rndis_MinorVersion_t MinorVersion; - rndis_MaxTransferSize_t MaxTransferSize; -} rndis_initialize_msg_t; - -/* Response: */ -typedef struct { - rndis_MessageType_t MessageType; - rndis_MessageLength_t MessageLength; - rndis_RequestId_t RequestId; - rndis_Status_t Status; - rndis_MajorVersion_t MajorVersion; - rndis_MinorVersion_t MinorVersion; - rndis_DeviceFlags_t DeviceFlags; - rndis_Medium_t Medium; - rndis_MaxPacketsPerTransfer_t MaxPacketsPerTransfer; - rndis_MaxTransferSize_t MaxTransferSize; - rndis_PacketAlignmentFactor_t PacketAlignmentFactor; - rndis_AfListOffset_t AfListOffset; - rndis_AfListSize_t AfListSize; -} rndis_initialize_cmplt_t; - -/*** Remote NDIS Halt Message ***/ -typedef struct { - rndis_MessageType_t MessageType; - rndis_MessageLength_t MessageLength; - rndis_RequestId_t RequestId; -} rndis_halt_msg_t; - -typedef uint32_t rndis_Oid_t; -typedef uint32_t rndis_InformationBufferLength_t; -typedef uint32_t rndis_InformationBufferOffset_t; -typedef uint32_t rndis_DeviceVcHandle_t; - -/*** Remote NDIS Query Message ***/ -typedef struct { - rndis_MessageType_t MessageType; - rndis_MessageLength_t MessageLength; - rndis_RequestId_t RequestId; - rndis_Oid_t Oid; - rndis_InformationBufferLength_t InformationBufferLength; - rndis_InformationBufferOffset_t InformationBufferOffset; - rndis_DeviceVcHandle_t DeviceVcHandle; -} rndis_query_msg_t; - -/* Response: */ - -typedef struct { - rndis_MessageType_t MessageType; - rndis_MessageLength_t MessageLength; - rndis_RequestId_t RequestId; - rndis_Status_t Status; - rndis_InformationBufferLength_t InformationBufferLength; - rndis_InformationBufferOffset_t InformationBufferOffset; -} rndis_query_cmplt_t; - -/*** Remote NDIS Set Message ***/ -typedef struct { - rndis_MessageType_t MessageType; - rndis_MessageLength_t MessageLength; - rndis_RequestId_t RequestId; - rndis_Oid_t Oid; - rndis_InformationBufferLength_t InformationBufferLength; - rndis_InformationBufferOffset_t InformationBufferOffset; - rndis_DeviceVcHandle_t DeviceVcHandle; -} rndis_set_msg_t; - -/* Response */ -typedef struct { - rndis_MessageType_t MessageType; - rndis_MessageLength_t MessageLength; - rndis_RequestId_t RequestId; - rndis_Status_t Status; -} rndis_set_cmplt_t; - -/* Information buffer layout for OID_GEN_RNDIS_CONFIG_PARAMETER */ -typedef uint32_t rndis_ParameterNameOffset_t; -typedef uint32_t rndis_ParameterNameLength_t; -typedef uint32_t rndis_ParameterType_t; -typedef uint32_t rndis_ParameterValueOffset_t; -typedef uint32_t rndis_ParameterValueLength_t; - -#define PARAMETER_TYPE_STRING 2 -#define PARAMETER_TYPE_NUMERICAL 0 - -typedef struct { - rndis_ParameterNameOffset_t ParameterNameOffset; - rndis_ParameterNameLength_t ParameterNameLength; - rndis_ParameterType_t ParameterType; - rndis_ParameterValueOffset_t ParameterValueOffset; - rndis_ParameterValueLength_t ParameterValueLength; -} rndis_config_parameter_t; - -typedef uint32_t rndis_Reserved_t; - -/*** Remote NDIS Soft Reset Message ***/ -typedef struct { - rndis_MessageType_t MessageType; - rndis_MessageLength_t MessageLength; - rndis_Reserved_t Reserved; -} rndis_reset_msg_t; - -typedef uint32_t rndis_AddressingReset_t; - -/* Response: */ -typedef struct { - rndis_MessageType_t MessageType; - rndis_MessageLength_t MessageLength; - rndis_Status_t Status; - rndis_AddressingReset_t AddressingReset; -} rndis_reset_cmplt_t; - -/*** Remote NDIS Indicate Status Message ***/ -typedef struct { - rndis_MessageType_t MessageType; - rndis_MessageLength_t MessageLength; - rndis_Status_t Status; - rndis_Status_t StatusBufferLength; - rndis_Status_t StatusBufferOffset; -} rndis_indicate_status_t; - -typedef uint32_t rndis_DiagStatus_t; -typedef uint32_t rndis_ErrorOffset_t; - -typedef struct { - rndis_DiagStatus_t DiagStatus; - rndis_ErrorOffset_t ErrorOffset; -} rndis_diagnostic_info_t; - -/*** Remote NDIS Keepalive Message */ -typedef struct { - rndis_MessageType_t MessageType; - rndis_MessageLength_t MessageLength; - rndis_RequestId_t RequestId; -} rndis_keepalive_msg_t; - -/* Response: */ -typedef struct { - rndis_MessageType_t MessageType; - rndis_MessageLength_t MessageLength; - rndis_RequestId_t RequestId; - rndis_Status_t Status; -} rndis_keepalive_cmplt_t; - -/*** Remote NDIS Data Packet ***/ - -typedef uint32_t rndis_DataOffset_t; -typedef uint32_t rndis_DataLength_t; -typedef uint32_t rndis_OOBDataOffset_t; -typedef uint32_t rndis_OOBDataLength_t; -typedef uint32_t rndis_NumOOBDataElements_t; -typedef uint32_t rndis_PerPacketInfoOffset_t; -typedef uint32_t rndis_PerPacketInfoLength_t; - -typedef struct { - rndis_MessageType_t MessageType; - rndis_MessageLength_t MessageLength; - rndis_DataOffset_t DataOffset; - rndis_DataLength_t DataLength; - rndis_OOBDataOffset_t OOBDataOffset; - rndis_OOBDataLength_t OOBDataLength; - rndis_NumOOBDataElements_t NumOOBDataElements; - rndis_PerPacketInfoOffset_t PerPacketInfoOffset; - rndis_PerPacketInfoLength_t PerPacketInfoLength; - rndis_DeviceVcHandle_t DeviceVcHandle; - rndis_Reserved_t Reserved; -} rndis_data_packet_t; - -typedef uint32_t rndis_ClassInformationOffset_t; -typedef uint32_t rndis_Size_t; -typedef uint32_t rndis_Type_t; - -typedef struct { - rndis_Size_t Size; - rndis_Type_t Type; - rndis_ClassInformationOffset_t ClassInformationType; -} rndis_OOB_packet_t; - -#include "ndis.h" - -typedef enum rnids_state_e { - rndis_uninitialized, - rndis_initialized, - rndis_data_initialized -} rndis_state_t; - -typedef struct { - uint32_t txok; - uint32_t rxok; - uint32_t txbad; - uint32_t rxbad; -} usb_eth_stat_t; - -#endif /* _RNDIS_H */ - -/** @} */ diff --git a/third-party/cherryusb/class/wireless/usbd_rndis.c b/third-party/cherryusb/class/wireless/usbd_rndis.c deleted file mode 100644 index 5d89338c4de2464d106a17f6030c984c6e2e26e3..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/wireless/usbd_rndis.c +++ /dev/null @@ -1,565 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbd_core.h" -#include "usbd_rndis.h" -#include "rndis_protocol.h" - -#define RNDIS_OUT_EP_IDX 0 -#define RNDIS_IN_EP_IDX 1 -#define RNDIS_INT_EP_IDX 2 - -/* Describe EndPoints configuration */ -static struct usbd_endpoint rndis_ep_data[3]; - -#define RNDIS_INQUIRY_PUT(src, len) (memcpy(infomation_buffer, src, len)) -#define RNDIS_INQUIRY_PUT_LE32(value) (*(uint32_t *)infomation_buffer = (value)) - -#ifdef CONFIG_USB_HS -#define RNDIS_MAX_PACKET_SIZE 512 -#else -#define RNDIS_MAX_PACKET_SIZE 64 -#endif - -#ifndef CONFIG_USB_HS -#define RNDIS_LINK_SPEED 12000000 /* Link baudrate (12Mbit/s for USB-FS) */ -#else -#define RNDIS_LINK_SPEED 480000000 /* Link baudrate (480Mbit/s for USB-HS) */ -#endif - -/* Device data structure */ -struct usbd_rndis_cfg_priv { - uint32_t drv_version; - uint32_t link_status; - uint32_t speed; - uint32_t net_filter; - usb_eth_stat_t eth_state; - rndis_state_t init_state; - uint8_t mac[6]; -} usbd_rndis_cfg = { .drv_version = 0x0001, - .link_status = NDIS_MEDIA_STATE_DISCONNECTED, - .speed = RNDIS_LINK_SPEED, - .init_state = rndis_uninitialized, - .mac = { 0x00, 0x00, 0x5E, 0x00, 0x53, 0x01 } }; - -USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_rndis_rx_buffer[CONFIG_USBDEV_RNDIS_ETH_MAX_FRAME_SIZE + 44]; -USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_rndis_tx_buffer[CONFIG_USBDEV_RNDIS_ETH_MAX_FRAME_SIZE + 44]; - -USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t rndis_encapsulated_resp_buffer[CONFIG_USBDEV_RNDIS_RESP_BUFFER_SIZE]; -USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t NOTIFY_RESPONSE_AVAILABLE[8]; - -volatile uint8_t *g_rndis_rx_data_buffer; -volatile uint32_t g_rndis_rx_data_length; -volatile uint32_t g_rndis_tx_data_length; - -/* RNDIS options list */ -const uint32_t oid_supported_list[] = { - /* General OIDs */ - OID_GEN_SUPPORTED_LIST, - OID_GEN_HARDWARE_STATUS, - OID_GEN_MEDIA_SUPPORTED, - OID_GEN_MEDIA_IN_USE, - OID_GEN_MAXIMUM_FRAME_SIZE, - OID_GEN_LINK_SPEED, - OID_GEN_TRANSMIT_BLOCK_SIZE, - OID_GEN_RECEIVE_BLOCK_SIZE, - OID_GEN_VENDOR_ID, - OID_GEN_VENDOR_DESCRIPTION, - OID_GEN_VENDOR_DRIVER_VERSION, - OID_GEN_CURRENT_PACKET_FILTER, - OID_GEN_MAXIMUM_TOTAL_SIZE, - OID_GEN_MEDIA_CONNECT_STATUS, - - OID_GEN_PHYSICAL_MEDIUM, - - /* General Statistic OIDs */ - OID_GEN_XMIT_OK, - OID_GEN_RCV_OK, - OID_GEN_XMIT_ERROR, - OID_GEN_RCV_ERROR, - OID_GEN_RCV_NO_BUFFER, - - /* Please configure us */ - OID_GEN_RNDIS_CONFIG_PARAMETER, - - /* 802.3 OIDs */ - OID_802_3_PERMANENT_ADDRESS, - OID_802_3_CURRENT_ADDRESS, - OID_802_3_MULTICAST_LIST, - OID_802_3_MAXIMUM_LIST_SIZE, - - /* 802.3 Statistic OIDs */ - OID_802_3_RCV_ERROR_ALIGNMENT, - OID_802_3_XMIT_ONE_COLLISION, - OID_802_3_XMIT_MORE_COLLISIONS, - - OID_802_3_MAC_OPTIONS, -}; - -static int rndis_encapsulated_cmd_handler(uint8_t *data, uint32_t len); - -static void rndis_notify_rsp(void) -{ - memset(NOTIFY_RESPONSE_AVAILABLE, 0, 8); - NOTIFY_RESPONSE_AVAILABLE[0] = 0x01; - usbd_ep_start_write(rndis_ep_data[RNDIS_INT_EP_IDX].ep_addr, NOTIFY_RESPONSE_AVAILABLE, 8); -} - -static int rndis_class_interface_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - switch (setup->bRequest) { - case CDC_REQUEST_SEND_ENCAPSULATED_COMMAND: - rndis_encapsulated_cmd_handler(*data, setup->wLength); - break; - case CDC_REQUEST_GET_ENCAPSULATED_RESPONSE: - *data = rndis_encapsulated_resp_buffer; - *len = ((rndis_generic_msg_t *)rndis_encapsulated_resp_buffer)->MessageLength; - break; - - default: - return -1; - } - - return 0; -} - -static int rndis_init_cmd_handler(uint8_t *data, uint32_t len); -static int rndis_halt_cmd_handler(uint8_t *data, uint32_t len); -static int rndis_query_cmd_handler(uint8_t *data, uint32_t len); -static int rndis_set_cmd_handler(uint8_t *data, uint32_t len); -static int rndis_reset_cmd_handler(uint8_t *data, uint32_t len); -static int rndis_keepalive_cmd_handler(uint8_t *data, uint32_t len); - -static int rndis_encapsulated_cmd_handler(uint8_t *data, uint32_t len) -{ - switch (((rndis_generic_msg_t *)data)->MessageType) { - case REMOTE_NDIS_INITIALIZE_MSG: - return rndis_init_cmd_handler(data, len); - case REMOTE_NDIS_HALT_MSG: - return rndis_halt_cmd_handler(data, len); - case REMOTE_NDIS_QUERY_MSG: - return rndis_query_cmd_handler(data, len); - case REMOTE_NDIS_SET_MSG: - return rndis_set_cmd_handler(data, len); - case REMOTE_NDIS_RESET_MSG: - return rndis_reset_cmd_handler(data, len); - case REMOTE_NDIS_KEEPALIVE_MSG: - return rndis_keepalive_cmd_handler(data, len); - - default: - break; - } - return -1; -} - -static int rndis_init_cmd_handler(uint8_t *data, uint32_t len) -{ - rndis_initialize_msg_t *cmd = (rndis_initialize_msg_t *)data; - rndis_initialize_cmplt_t *resp; - - resp = ((rndis_initialize_cmplt_t *)rndis_encapsulated_resp_buffer); - resp->RequestId = cmd->RequestId; - resp->MessageType = REMOTE_NDIS_INITIALIZE_CMPLT; - resp->MessageLength = sizeof(rndis_initialize_cmplt_t); - resp->MajorVersion = RNDIS_MAJOR_VERSION; - resp->MinorVersion = RNDIS_MINOR_VERSION; - resp->Status = RNDIS_STATUS_SUCCESS; - resp->DeviceFlags = RNDIS_DF_CONNECTIONLESS; - resp->Medium = RNDIS_MEDIUM_802_3; - resp->MaxPacketsPerTransfer = 1; - resp->MaxTransferSize = CONFIG_USBDEV_RNDIS_ETH_MAX_FRAME_SIZE + sizeof(rndis_data_packet_t); - resp->PacketAlignmentFactor = 0; - resp->AfListOffset = 0; - resp->AfListSize = 0; - - usbd_rndis_cfg.init_state = rndis_initialized; - - rndis_notify_rsp(); - return 0; -} - -static int rndis_halt_cmd_handler(uint8_t *data, uint32_t len) -{ - rndis_halt_msg_t *resp; - - resp = ((rndis_halt_msg_t *)rndis_encapsulated_resp_buffer); - resp->MessageLength = 0; - - usbd_rndis_cfg.init_state = rndis_uninitialized; - - return 0; -} - -static int rndis_query_cmd_handler(uint8_t *data, uint32_t len) -{ - rndis_query_msg_t *cmd = (rndis_query_msg_t *)data; - rndis_query_cmplt_t *resp; - uint8_t *infomation_buffer; - uint32_t infomation_len = 0; - - resp = ((rndis_query_cmplt_t *)rndis_encapsulated_resp_buffer); - resp->MessageType = REMOTE_NDIS_QUERY_CMPLT; - resp->RequestId = cmd->RequestId; - resp->InformationBufferOffset = sizeof(rndis_query_cmplt_t) - sizeof(rndis_generic_msg_t); - resp->Status = RNDIS_STATUS_SUCCESS; - - infomation_buffer = (uint8_t *)resp + sizeof(rndis_query_cmplt_t); - - switch (cmd->Oid) { - case OID_GEN_SUPPORTED_LIST: - RNDIS_INQUIRY_PUT(oid_supported_list, sizeof(oid_supported_list)); - infomation_len = sizeof(oid_supported_list); - break; - case OID_GEN_HARDWARE_STATUS: - RNDIS_INQUIRY_PUT_LE32(NDIS_HW_STS_READY); - infomation_len = 4; - break; - case OID_GEN_MEDIA_SUPPORTED: - case OID_GEN_MEDIA_IN_USE: - RNDIS_INQUIRY_PUT_LE32(NDIS_MEDIUM_802_3); - infomation_len = 4; - break; - case OID_GEN_MAXIMUM_FRAME_SIZE: - case OID_GEN_TRANSMIT_BLOCK_SIZE: - case OID_GEN_RECEIVE_BLOCK_SIZE: - RNDIS_INQUIRY_PUT_LE32(CONFIG_USBDEV_RNDIS_ETH_MAX_FRAME_SIZE); - infomation_len = 4; - break; - case OID_GEN_VENDOR_ID: - RNDIS_INQUIRY_PUT_LE32(CONFIG_USBDEV_RNDIS_VENDOR_ID); - infomation_len = 4; - break; - case OID_GEN_VENDOR_DRIVER_VERSION: - RNDIS_INQUIRY_PUT_LE32(0x0001); - infomation_len = 4; - break; - case OID_GEN_VENDOR_DESCRIPTION: - RNDIS_INQUIRY_PUT(CONFIG_USBDEV_RNDIS_VENDOR_DESC, strlen(CONFIG_USBDEV_RNDIS_VENDOR_DESC)); - infomation_len = (strlen(CONFIG_USBDEV_RNDIS_VENDOR_DESC) + 1); - break; - case OID_802_3_CURRENT_ADDRESS: - case OID_802_3_PERMANENT_ADDRESS: - RNDIS_INQUIRY_PUT(usbd_rndis_cfg.mac, 6); - infomation_len = 6; - break; - case OID_GEN_PHYSICAL_MEDIUM: - RNDIS_INQUIRY_PUT_LE32(NDIS_MEDIUM_802_3); - infomation_len = 4; - break; - case OID_GEN_LINK_SPEED: - RNDIS_INQUIRY_PUT_LE32(RNDIS_LINK_SPEED / 100); - infomation_len = 4; - break; - case OID_GEN_CURRENT_PACKET_FILTER: - RNDIS_INQUIRY_PUT_LE32(usbd_rndis_cfg.net_filter); - infomation_len = 4; - break; - case OID_GEN_MAXIMUM_TOTAL_SIZE: - RNDIS_INQUIRY_PUT_LE32(CONFIG_USBDEV_RNDIS_ETH_MAX_FRAME_SIZE + CONFIG_USBDEV_RNDIS_RESP_BUFFER_SIZE); - infomation_len = 4; - break; - case OID_GEN_MEDIA_CONNECT_STATUS: - RNDIS_INQUIRY_PUT_LE32(usbd_rndis_cfg.link_status); - infomation_len = 4; - break; - case OID_GEN_RNDIS_CONFIG_PARAMETER: - RNDIS_INQUIRY_PUT_LE32(0); - infomation_len = 4; - break; - case OID_802_3_MAXIMUM_LIST_SIZE: - RNDIS_INQUIRY_PUT_LE32(1); /* one address */ - infomation_len = 4; - break; - case OID_802_3_MULTICAST_LIST: - //RNDIS_INQUIRY_PUT_LE32(0xE0000000); /* 224.0.0.0 */ - resp->Status = RNDIS_STATUS_NOT_SUPPORTED; - RNDIS_INQUIRY_PUT_LE32(0); - infomation_len = 4; - break; - case OID_802_3_MAC_OPTIONS: - // infomation_len = 0; - resp->Status = RNDIS_STATUS_NOT_SUPPORTED; - RNDIS_INQUIRY_PUT_LE32(0); - infomation_len = 4; - break; - case OID_GEN_MAC_OPTIONS: - RNDIS_INQUIRY_PUT_LE32(0); - infomation_len = 4; - break; - case OID_802_3_RCV_ERROR_ALIGNMENT: - RNDIS_INQUIRY_PUT_LE32(0); - infomation_len = 4; - break; - case OID_802_3_XMIT_ONE_COLLISION: - RNDIS_INQUIRY_PUT_LE32(0); - infomation_len = 4; - break; - case OID_802_3_XMIT_MORE_COLLISIONS: - RNDIS_INQUIRY_PUT_LE32(0); - infomation_len = 4; - break; - case OID_GEN_XMIT_OK: - RNDIS_INQUIRY_PUT_LE32(usbd_rndis_cfg.eth_state.txok); - infomation_len = 4; - break; - case OID_GEN_RCV_OK: - RNDIS_INQUIRY_PUT_LE32(usbd_rndis_cfg.eth_state.rxok); - infomation_len = 4; - break; - case OID_GEN_RCV_ERROR: - RNDIS_INQUIRY_PUT_LE32(usbd_rndis_cfg.eth_state.rxbad); - infomation_len = 4; - break; - case OID_GEN_XMIT_ERROR: - RNDIS_INQUIRY_PUT_LE32(usbd_rndis_cfg.eth_state.txbad); - infomation_len = 4; - break; - case OID_GEN_RCV_NO_BUFFER: - RNDIS_INQUIRY_PUT_LE32(0); - infomation_len = 4; - break; - default: - resp->Status = RNDIS_STATUS_FAILURE; - infomation_len = 0; - USB_LOG_WRN("Unhandled query for Object ID 0x%x\r\n", cmd->Oid); - break; - } - - resp->MessageLength = sizeof(rndis_query_cmplt_t) + infomation_len; - resp->InformationBufferLength = infomation_len; - - rndis_notify_rsp(); - return 0; -} - -static int rndis_set_cmd_handler(uint8_t *data, uint32_t len) -{ - rndis_set_msg_t *cmd = (rndis_set_msg_t *)data; - rndis_set_cmplt_t *resp; - rndis_config_parameter_t *param; - - resp = ((rndis_set_cmplt_t *)rndis_encapsulated_resp_buffer); - resp->RequestId = cmd->RequestId; - resp->MessageType = REMOTE_NDIS_SET_CMPLT; - resp->MessageLength = sizeof(rndis_set_cmplt_t); - resp->Status = RNDIS_STATUS_SUCCESS; - - switch (cmd->Oid) { - case OID_GEN_RNDIS_CONFIG_PARAMETER: - param = (rndis_config_parameter_t *)((uint8_t *)&(cmd->RequestId) + cmd->InformationBufferOffset); - USB_LOG_WRN("RNDIS cfg param: NameOfs=%d, NameLen=%d, ValueOfs=%d, ValueLen=%d\r\n", - param->ParameterNameOffset, param->ParameterNameLength, - param->ParameterValueOffset, param->ParameterValueLength); - break; - case OID_GEN_CURRENT_PACKET_FILTER: - if (cmd->InformationBufferLength < sizeof(usbd_rndis_cfg.net_filter)) { - USB_LOG_WRN("PACKET_FILTER!\r\n"); - resp->Status = RNDIS_STATUS_INVALID_DATA; - } else { - uint32_t *filter; - /* Parameter starts at offset buf_offset of the req_id field */ - filter = (uint32_t *)((uint8_t *)&(cmd->RequestId) + cmd->InformationBufferOffset); - - //usbd_rndis_cfg.net_filter = param->ParameterNameOffset; - usbd_rndis_cfg.net_filter = *(uint32_t *)filter; - if (usbd_rndis_cfg.net_filter) { - usbd_rndis_cfg.init_state = rndis_data_initialized; - } else { - usbd_rndis_cfg.init_state = rndis_initialized; - } - } - break; - case OID_GEN_CURRENT_LOOKAHEAD: - break; - case OID_GEN_PROTOCOL_OPTIONS: - break; - case OID_802_3_MULTICAST_LIST: - break; - case OID_PNP_ADD_WAKE_UP_PATTERN: - case OID_PNP_REMOVE_WAKE_UP_PATTERN: - case OID_PNP_ENABLE_WAKE_UP: - default: - resp->Status = RNDIS_STATUS_FAILURE; - USB_LOG_WRN("Unhandled query for Object ID 0x%x\r\n", cmd->Oid); - break; - } - - rndis_notify_rsp(); - - return 0; -} - -static int rndis_reset_cmd_handler(uint8_t *data, uint32_t len) -{ - rndis_reset_msg_t *cmd = (rndis_reset_msg_t *)data; - rndis_reset_cmplt_t *resp; - - resp = ((rndis_reset_cmplt_t *)rndis_encapsulated_resp_buffer); - resp->MessageType = REMOTE_NDIS_RESET_CMPLT; - resp->MessageLength = sizeof(rndis_reset_cmplt_t); - resp->Status = RNDIS_STATUS_SUCCESS; - resp->AddressingReset = 1; - - usbd_rndis_cfg.init_state = rndis_uninitialized; - - rndis_notify_rsp(); - - return 0; -} - -static int rndis_keepalive_cmd_handler(uint8_t *data, uint32_t len) -{ - rndis_keepalive_msg_t *cmd = (rndis_keepalive_msg_t *)data; - rndis_keepalive_cmplt_t *resp; - - resp = ((rndis_keepalive_cmplt_t *)rndis_encapsulated_resp_buffer); - resp->RequestId = cmd->RequestId; - resp->MessageType = REMOTE_NDIS_KEEPALIVE_CMPLT; - resp->MessageLength = sizeof(rndis_keepalive_cmplt_t); - resp->Status = RNDIS_STATUS_SUCCESS; - - rndis_notify_rsp(); - - return 0; -} - -static void rndis_notify_handler(uint8_t event, void *arg) -{ - switch (event) { - case USBD_EVENT_RESET: - usbd_rndis_cfg.link_status = NDIS_MEDIA_STATE_DISCONNECTED; - break; - case USBD_EVENT_CONFIGURED: - g_rndis_rx_data_length = 0; - g_rndis_tx_data_length = 0; - usbd_rndis_cfg.link_status = NDIS_MEDIA_STATE_CONNECTED; - usbd_ep_start_read(rndis_ep_data[RNDIS_OUT_EP_IDX].ep_addr, g_rndis_rx_buffer, sizeof(g_rndis_rx_buffer)); - break; - - default: - break; - } -} - -void rndis_bulk_out(uint8_t ep, uint32_t nbytes) -{ - rndis_data_packet_t *hdr; - - hdr = (rndis_data_packet_t *)g_rndis_rx_buffer; - g_rndis_rx_data_buffer = g_rndis_rx_buffer; - if ((hdr->MessageType != NDIS_PACKET_TYPE_DIRECTED) || (nbytes != hdr->MessageLength)) { - usbd_ep_start_read(rndis_ep_data[RNDIS_OUT_EP_IDX].ep_addr, g_rndis_rx_buffer, sizeof(g_rndis_rx_buffer)); - return; - } - - /* Point to the payload and update the message length */ - g_rndis_rx_data_buffer += hdr->DataOffset + sizeof(rndis_generic_msg_t); - g_rndis_rx_data_length = hdr->DataLength; - - usbd_rndis_data_recv((uint8_t *)g_rndis_rx_data_buffer, g_rndis_rx_data_length); -} - -void rndis_bulk_in(uint8_t ep, uint32_t nbytes) -{ - if ((nbytes % RNDIS_MAX_PACKET_SIZE) == 0 && nbytes) { - /* send zlp */ - usbd_ep_start_write(ep, NULL, 0); - } else { - g_rndis_tx_data_length = 0; - } -} - -void rndis_int_in(uint8_t ep, uint32_t nbytes) -{ - //USB_LOG_DBG("len:%d\r\n", nbytes); -} - -#ifdef CONFIG_USBDEV_RNDIS_USING_LWIP -#include - -struct pbuf *usbd_rndis_eth_rx(void) -{ - struct pbuf *p; - - if (g_rndis_rx_data_length == 0) { - return NULL; - } - p = pbuf_alloc(PBUF_RAW, g_rndis_rx_data_length, PBUF_POOL); - if (p == NULL) { - return NULL; - } - memcpy(p->payload, (uint8_t *)g_rndis_rx_data_buffer, g_rndis_rx_data_length); - p->len = g_rndis_rx_data_length; - - USB_LOG_DBG("rxlen:%d\r\n", g_rndis_rx_data_length); - g_rndis_rx_data_length = 0; - usbd_ep_start_read(rndis_ep_data[RNDIS_OUT_EP_IDX].ep_addr, g_rndis_rx_buffer, sizeof(g_rndis_rx_buffer)); - - return p; -} - -int usbd_rndis_eth_tx(struct pbuf *p) -{ - struct pbuf *q; - uint8_t *buffer; - rndis_data_packet_t *hdr; - - if (usbd_rndis_cfg.link_status == NDIS_MEDIA_STATE_DISCONNECTED) { - return 0; - } - - if (g_rndis_tx_data_length > 0) { - return -EBUSY; - } - - if (p->tot_len > sizeof(g_rndis_tx_buffer)) { - p->tot_len = sizeof(g_rndis_tx_buffer); - } - - buffer = (uint8_t *)(g_rndis_tx_buffer + sizeof(rndis_data_packet_t)); - for (q = p; q != NULL; q = q->next) { - memcpy(buffer, q->payload, q->len); - buffer += q->len; - } - - hdr = (rndis_data_packet_t *)g_rndis_tx_buffer; - - memset(hdr, 0, sizeof(rndis_data_packet_t)); - hdr->MessageType = REMOTE_NDIS_PACKET_MSG; - hdr->MessageLength = sizeof(rndis_data_packet_t) + p->tot_len; - hdr->DataOffset = sizeof(rndis_data_packet_t) - sizeof(rndis_generic_msg_t); - hdr->DataLength = p->tot_len; - - g_rndis_tx_data_length = sizeof(rndis_data_packet_t) + p->tot_len; - - USB_LOG_DBG("txlen:%d\r\n", g_rndis_tx_data_length); - return usbd_ep_start_write(rndis_ep_data[RNDIS_IN_EP_IDX].ep_addr, g_rndis_tx_buffer, g_rndis_tx_data_length); -} -#endif -struct usbd_interface *usbd_rndis_init_intf(struct usbd_interface *intf, - const uint8_t out_ep, - const uint8_t in_ep, - const uint8_t int_ep, uint8_t mac[6]) -{ - memcpy(usbd_rndis_cfg.mac, mac, 6); - - rndis_ep_data[RNDIS_OUT_EP_IDX].ep_addr = out_ep; - rndis_ep_data[RNDIS_OUT_EP_IDX].ep_cb = rndis_bulk_out; - rndis_ep_data[RNDIS_IN_EP_IDX].ep_addr = in_ep; - rndis_ep_data[RNDIS_IN_EP_IDX].ep_cb = rndis_bulk_in; - rndis_ep_data[RNDIS_INT_EP_IDX].ep_addr = int_ep; - rndis_ep_data[RNDIS_INT_EP_IDX].ep_cb = rndis_int_in; - - usbd_add_endpoint(&rndis_ep_data[RNDIS_OUT_EP_IDX]); - usbd_add_endpoint(&rndis_ep_data[RNDIS_IN_EP_IDX]); - usbd_add_endpoint(&rndis_ep_data[RNDIS_INT_EP_IDX]); - - intf->class_interface_handler = rndis_class_interface_request_handler; - intf->class_endpoint_handler = NULL; - intf->vendor_handler = NULL; - intf->notify_handler = rndis_notify_handler; - - return intf; -} diff --git a/third-party/cherryusb/class/wireless/usbd_rndis.h b/third-party/cherryusb/class/wireless/usbd_rndis.h deleted file mode 100644 index d9f9f646e6fb8f2d3302715d34f0bdc08bfcdbe0..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/wireless/usbd_rndis.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBD_RNDIS_H -#define USBD_RNDIS_H - -#include "usb_cdc.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Init rndis interface driver */ -struct usbd_interface *usbd_rndis_init_intf(struct usbd_interface *intf, - const uint8_t out_ep, - const uint8_t in_ep, - const uint8_t int_ep, uint8_t mac[6]); - -#ifdef CONFIG_USBDEV_RNDIS_USING_LWIP -struct pbuf *usbd_rndis_eth_rx(void); -int usbd_rndis_eth_tx(struct pbuf *p); -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* USBD_RNDIS_H */ diff --git a/third-party/cherryusb/class/wireless/usbh_rndis.c b/third-party/cherryusb/class/wireless/usbh_rndis.c deleted file mode 100644 index 49feb49107b5462dc9557ff8d662c6c14a2eb4ee..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/wireless/usbh_rndis.c +++ /dev/null @@ -1,431 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbh_core.h" -#include "usbh_rndis.h" -#include "rndis_protocol.h" - -#define DEV_FORMAT "/dev/rndis" - -USB_NOCACHE_RAM_SECTION USB_MEM_ALIGNX uint8_t g_rndis_buf[1024]; - -static int usbh_rndis_init_msg_transfer(struct usbh_rndis *rndis_class) -{ - struct usb_setup_packet *setup = rndis_class->hport->setup; - int ret = 0; - rndis_initialize_msg_t *cmd; - rndis_initialize_cmplt_t *resp; - - cmd = (rndis_initialize_msg_t *)g_rndis_buf; - - cmd->MessageType = REMOTE_NDIS_INITIALIZE_MSG; - cmd->MessageLength = sizeof(rndis_initialize_msg_t); - cmd->RequestId = rndis_class->request_id++; - cmd->MajorVersion = 1; - cmd->MinorVersion = 0; - cmd->MaxTransferSize = 0x4000; - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = CDC_REQUEST_SEND_ENCAPSULATED_COMMAND; - setup->wValue = 0; - setup->wIndex = 0; - setup->wLength = sizeof(rndis_initialize_msg_t); - - ret = usbh_control_transfer(rndis_class->hport->ep0, setup, (uint8_t *)cmd); - if (ret < 0) { - USB_LOG_ERR("rndis_initialize_msg_t send error, ret: %d\r\n", ret); - return ret; - } - - //ret = usbh_ep_intr_transfer() - - resp = (rndis_initialize_cmplt_t *)g_rndis_buf; - - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = CDC_REQUEST_GET_ENCAPSULATED_RESPONSE; - setup->wValue = 0; - setup->wIndex = 0; - setup->wLength = 4096; - - ret = usbh_control_transfer(rndis_class->hport->ep0, setup, (uint8_t *)resp); - if (ret < 0) { - USB_LOG_ERR("rndis_initialize_cmplt_t recv error, ret: %d\r\n", ret); - return ret; - } - - return ret; -} - -int usbh_rndis_query_msg_transfer(struct usbh_rndis *rndis_class, uint32_t oid, uint32_t query_len, uint8_t *info, uint32_t *info_len) -{ - struct usb_setup_packet *setup = rndis_class->hport->setup; - int ret = 0; - rndis_query_msg_t *cmd; - rndis_query_cmplt_t *resp; - - cmd = (rndis_query_msg_t *)g_rndis_buf; - - cmd->MessageType = REMOTE_NDIS_QUERY_MSG; - cmd->MessageLength = query_len + sizeof(rndis_query_msg_t); - cmd->RequestId = rndis_class->request_id++; - cmd->Oid = oid; - cmd->InformationBufferLength = query_len; - cmd->InformationBufferOffset = 20; - cmd->DeviceVcHandle = 0; - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = CDC_REQUEST_SEND_ENCAPSULATED_COMMAND; - setup->wValue = 0; - setup->wIndex = 0; - setup->wLength = sizeof(rndis_query_msg_t); - - ret = usbh_control_transfer(rndis_class->hport->ep0, setup, (uint8_t *)&cmd); - if (ret < 0) { - USB_LOG_ERR("oid:%08x send error, ret: %d\r\n", (unsigned int)oid, ret); - return ret; - } - - //ret = usbh_ep_intr_transfer() - - resp = (rndis_query_cmplt_t *)g_rndis_buf; - - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = CDC_REQUEST_GET_ENCAPSULATED_RESPONSE; - setup->wValue = 0; - setup->wIndex = 0; - setup->wLength = 4096; - - ret = usbh_control_transfer(rndis_class->hport->ep0, setup, (uint8_t *)resp); - if (ret < 0) { - USB_LOG_ERR("oid:%08x recv error, ret: %d\r\n", (unsigned int)oid, ret); - return ret; - } - - memcpy(info, ((uint8_t *)resp + sizeof(rndis_query_cmplt_t)), resp->InformationBufferLength); - *info_len = resp->InformationBufferLength; - - return ret; -} - -static int usbh_rndis_set_msg_transfer(struct usbh_rndis *rndis_class, uint32_t oid, uint8_t *info, uint32_t info_len) -{ - struct usb_setup_packet *setup = rndis_class->hport->setup; - int ret = 0; - rndis_set_msg_t *cmd; - rndis_set_cmplt_t *resp; - - cmd = (rndis_set_msg_t *)g_rndis_buf; - - cmd->MessageType = REMOTE_NDIS_SET_MSG; - cmd->MessageLength = info_len + sizeof(rndis_set_msg_t); - cmd->RequestId = rndis_class->request_id++; - cmd->Oid = oid; - cmd->InformationBufferLength = info_len; - cmd->InformationBufferOffset = 20; - cmd->DeviceVcHandle = 0; - - memcpy(((uint8_t *)cmd + sizeof(rndis_set_msg_t)), info, info_len); - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = CDC_REQUEST_SEND_ENCAPSULATED_COMMAND; - setup->wValue = 0; - setup->wIndex = 0; - setup->wLength = sizeof(rndis_set_msg_t); - - ret = usbh_control_transfer(rndis_class->hport->ep0, setup, (uint8_t *)cmd); - if (ret < 0) { - USB_LOG_ERR("oid:%08x send error, ret: %d\r\n", (unsigned int)oid, ret); - return ret; - } - - //ret = usbh_ep_intr_transfer(rndis_class->hport->intin,buf,len,500); - - resp = (rndis_set_cmplt_t *)g_rndis_buf; - - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = CDC_REQUEST_GET_ENCAPSULATED_RESPONSE; - setup->wValue = 0; - setup->wIndex = 0; - setup->wLength = 4096; - - ret = usbh_control_transfer(rndis_class->hport->ep0, setup, (uint8_t *)resp); - if (ret < 0) { - USB_LOG_ERR("oid:%08x recv error, ret: %d\r\n", (unsigned int)oid, ret); - return ret; - } - - return ret; -} - -int usbh_rndis_bulk_out_transfer(struct usbh_rndis *rndis_class, uint8_t *buffer, uint32_t buflen, uint32_t timeout) -{ - int ret; - struct usbh_urb *urb = &rndis_class->bulkout_urb; - memset(urb, 0, sizeof(struct usbh_urb)); - - usbh_bulk_urb_fill(urb, rndis_class->bulkout, buffer, buflen, timeout, NULL, NULL); - ret = usbh_submit_urb(urb); - if (ret == 0) { - ret = urb->actual_length; - } - return ret; -} - -int usbh_rndis_bulk_in_transfer(struct usbh_rndis *rndis_class, uint8_t *buffer, uint32_t buflen, uint32_t timeout) -{ - int ret; - struct usbh_urb *urb = &rndis_class->bulkin_urb; - memset(urb, 0, sizeof(struct usbh_urb)); - - usbh_bulk_urb_fill(urb, rndis_class->bulkin, buffer, buflen, timeout, NULL, NULL); - ret = usbh_submit_urb(urb); - if (ret == 0) { - ret = urb->actual_length; - } - return ret; -} - -int usbh_rndis_keepalive(struct usbh_rndis *rndis_class) -{ - struct usb_setup_packet *setup = rndis_class->hport->setup; - int ret = 0; - rndis_keepalive_msg_t *cmd; - rndis_keepalive_cmplt_t *resp; - - cmd = (rndis_keepalive_msg_t *)g_rndis_buf; - - cmd->MessageType = REMOTE_NDIS_KEEPALIVE_MSG; - cmd->MessageLength = sizeof(rndis_keepalive_msg_t); - cmd->RequestId = rndis_class->request_id++; - - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = CDC_REQUEST_SEND_ENCAPSULATED_COMMAND; - setup->wValue = 0; - setup->wIndex = 0; - setup->wLength = sizeof(rndis_keepalive_msg_t); - - ret = usbh_control_transfer(rndis_class->hport->ep0, setup, (uint8_t *)&cmd); - if (ret < 0) { - USB_LOG_ERR("keepalive send error, ret: %d\r\n", ret); - return ret; - } - - //ret = usbh_ep_intr_transfer(rndis_class->hport->intin,buf,len,500); - - resp = (rndis_keepalive_cmplt_t *)g_rndis_buf; - - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_CLASS | USB_REQUEST_RECIPIENT_INTERFACE; - setup->bRequest = CDC_REQUEST_GET_ENCAPSULATED_RESPONSE; - setup->wValue = 0; - setup->wIndex = 0; - setup->wLength = 4096; - - ret = usbh_control_transfer(rndis_class->hport->ep0, setup, (uint8_t *)resp); - if (ret < 0) { - USB_LOG_ERR("keepalive recv error, ret: %d\r\n", ret); - return ret; - } - - return ret; -} - -static int usbh_rndis_connect(struct usbh_hubport *hport, uint8_t intf) -{ - struct usbh_endpoint_cfg ep_cfg = { 0 }; - struct usb_endpoint_descriptor *ep_desc; - int ret; - uint32_t *oid_support_list; - unsigned int oid = 0; - unsigned int oid_num = 0; - uint32_t data_len; - uint8_t tmp_buffer[512]; - uint8_t data[32]; - - struct usbh_rndis *rndis_class = usb_malloc(sizeof(struct usbh_rndis)); - if (rndis_class == NULL) { - USB_LOG_ERR("Fail to alloc rndis_class\r\n"); - return -ENOMEM; - } - - memset(rndis_class, 0, sizeof(struct usbh_rndis)); - - rndis_class->hport = hport; - rndis_class->ctrl_intf = intf; - rndis_class->data_intf = intf + 1; - - hport->config.intf[intf].priv = rndis_class; - hport->config.intf[intf + 1].priv = NULL; - -#ifdef CONFIG_USBHOST_RNDIS_NOTIFY - ep_desc = &hport->config.intf[intf].altsetting[0].ep[0].ep_desc; - ep_cfg.ep_addr = ep_desc->bEndpointAddress; - ep_cfg.ep_type = ep_desc->bmAttributes & USB_ENDPOINT_TYPE_MASK; - ep_cfg.ep_mps = ep_desc->wMaxPacketSize & USB_MAXPACKETSIZE_MASK; - - ep_cfg.ep_interval = ep_desc->bInterval; - ep_cfg.hport = hport; - usbh_pipe_alloc(&rndis_class->intin, &ep_cfg); - -#endif - for (uint8_t i = 0; i < hport->config.intf[intf + 1].altsetting[0].intf_desc.bNumEndpoints; i++) { - ep_desc = &hport->config.intf[intf + 1].altsetting[0].ep[i].ep_desc; - - if (ep_desc->bEndpointAddress & 0x80) { - usbh_hport_activate_epx(&rndis_class->bulkin, hport, ep_desc); - } else { - usbh_hport_activate_epx(&rndis_class->bulkout, hport, ep_desc); - } - } - - ret = usbh_rndis_init_msg_transfer(rndis_class); - if (ret < 0) { - return ret; - } - USB_LOG_INFO("rndis init success\r\n"); - - ret = usbh_rndis_query_msg_transfer(rndis_class, OID_GEN_SUPPORTED_LIST, 0, tmp_buffer, &data_len); - if (ret < 0) { - return ret; - } - oid_num = (data_len / 4); - USB_LOG_INFO("rndis query OID_GEN_SUPPORTED_LIST success,oid num :%d\r\n", oid_num); - - oid_support_list = (uint32_t *)tmp_buffer; - - for (uint8_t i = 0; i < oid_num; i++) { - oid = oid_support_list[i]; - switch (oid) { - case OID_GEN_PHYSICAL_MEDIUM: - ret = usbh_rndis_query_msg_transfer(rndis_class, OID_GEN_PHYSICAL_MEDIUM, 4, data, &data_len); - if (ret < 0) { - goto query_errorout; - } - break; - case OID_GEN_MAXIMUM_FRAME_SIZE: - ret = usbh_rndis_query_msg_transfer(rndis_class, OID_GEN_MAXIMUM_FRAME_SIZE, 4, data, &data_len); - if (ret < 0) { - goto query_errorout; - } - break; - case OID_GEN_LINK_SPEED: - ret = usbh_rndis_query_msg_transfer(rndis_class, OID_GEN_LINK_SPEED, 4, data, &data_len); - if (ret < 0) { - goto query_errorout; - } - - memcpy(&rndis_class->link_speed, data, 4); - break; - case OID_GEN_MEDIA_CONNECT_STATUS: - ret = usbh_rndis_query_msg_transfer(rndis_class, OID_GEN_MEDIA_CONNECT_STATUS, 4, data, &data_len); - if (ret < 0) { - goto query_errorout; - } - if (NDIS_MEDIA_STATE_CONNECTED == data[0]) { - rndis_class->link_status = true; - } else { - rndis_class->link_status = false; - } - break; - case OID_802_3_MAXIMUM_LIST_SIZE: - ret = usbh_rndis_query_msg_transfer(rndis_class, OID_802_3_MAXIMUM_LIST_SIZE, 4, data, &data_len); - if (ret < 0) { - goto query_errorout; - } - break; - case OID_802_3_CURRENT_ADDRESS: - ret = usbh_rndis_query_msg_transfer(rndis_class, OID_802_3_CURRENT_ADDRESS, 6, data, &data_len); - if (ret < 0) { - goto query_errorout; - } - - for (uint8_t j = 0; j < 6; j++) { - rndis_class->mac[j] = data[j]; - } - break; - case OID_802_3_PERMANENT_ADDRESS: - ret = usbh_rndis_query_msg_transfer(rndis_class, OID_802_3_PERMANENT_ADDRESS, 6, data, &data_len); - if (ret < 0) { - goto query_errorout; - } - break; - default: - USB_LOG_WRN("Ignore rndis query iod:%08x\r\n", oid); - continue; - } - USB_LOG_INFO("rndis query iod:%08x success\r\n", oid); - } - - uint32_t packet_filter = 0x0f; - usbh_rndis_set_msg_transfer(rndis_class, OID_GEN_CURRENT_PACKET_FILTER, (uint8_t *)&packet_filter, 4); - if (ret < 0) { - return ret; - } - USB_LOG_INFO("rndis set OID_GEN_CURRENT_PACKET_FILTER success\r\n"); - - uint8_t multicast_list[6] = { 0x01, 0x00, 0x5E, 0x00, 0x00, 0x01 }; - usbh_rndis_set_msg_transfer(rndis_class, OID_802_3_MULTICAST_LIST, multicast_list, 6); - if (ret < 0) { - return ret; - } - USB_LOG_INFO("rndis set OID_802_3_MULTICAST_LIST success\r\n"); - - strncpy(hport->config.intf[intf].devname, DEV_FORMAT, CONFIG_USBHOST_DEV_NAMELEN); - - USB_LOG_INFO("Register RNDIS Class:%s\r\n", hport->config.intf[intf].devname); - usbh_rndis_run(rndis_class); - return ret; -query_errorout: - USB_LOG_ERR("rndis query iod:%08x error\r\n", oid); - return ret; -} - -static int usbh_rndis_disconnect(struct usbh_hubport *hport, uint8_t intf) -{ - int ret = 0; - - struct usbh_rndis *rndis_class = (struct usbh_rndis *)hport->config.intf[intf].priv; - - if (rndis_class) { - if (rndis_class->bulkin) { - usbh_pipe_free(rndis_class->bulkin); - } - - if (rndis_class->bulkout) { - usbh_pipe_free(rndis_class->bulkout); - } - - usbh_rndis_stop(rndis_class); - memset(rndis_class, 0, sizeof(struct usbh_rndis)); - usb_free(rndis_class); - - if (hport->config.intf[intf].devname[0] != '\0') - USB_LOG_INFO("Unregister RNDIS Class:%s\r\n", hport->config.intf[intf].devname); - } - - return ret; -} - -__WEAK void usbh_rndis_run(struct usbh_rndis *rndis_class) -{ -} - -__WEAK void usbh_rndis_stop(struct usbh_rndis *rndis_class) -{ -} - -static const struct usbh_class_driver rndis_class_driver = { - .driver_name = "rndis", - .connect = usbh_rndis_connect, - .disconnect = usbh_rndis_disconnect -}; - -CLASS_INFO_DEFINE const struct usbh_class_info rndis_class_info = { - .match_flags = USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS | USB_CLASS_MATCH_INTF_PROTOCOL, - .class = USB_DEVICE_CLASS_WIRELESS, - .subclass = 0x01, - .protocol = 0x03, - .vid = 0x00, - .pid = 0x00, - .class_driver = &rndis_class_driver -}; diff --git a/third-party/cherryusb/class/wireless/usbh_rndis.h b/third-party/cherryusb/class/wireless/usbh_rndis.h deleted file mode 100644 index b9610b32d413773395e9de0147629f50333e5ab8..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/class/wireless/usbh_rndis.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBH_RNDIS_H -#define USBH_RNDIS_H - -#include "usb_cdc.h" - -struct usbh_rndis { - struct usbh_hubport *hport; - - uint8_t ctrl_intf; /* Control interface number */ - uint8_t data_intf; /* Data interface number */ - - usbh_pipe_t bulkin; /* Bulk IN endpoint */ - usbh_pipe_t bulkout; /* Bulk OUT endpoint */ - usbh_pipe_t intin; /* Notify endpoint */ - struct usbh_urb bulkin_urb; /* Bulk IN urb */ - struct usbh_urb bulkout_urb; /* Bulk OUT urb */ - uint32_t request_id; - - uint32_t link_speed; - bool link_status; - uint8_t mac[6]; -}; - -#ifdef __cplusplus -extern "C" { -#endif - -int usbh_rndis_bulk_out_transfer(struct usbh_rndis *rndis_class, uint8_t *buffer, uint32_t buflen, uint32_t timeout); -int usbh_rndis_bulk_in_transfer(struct usbh_rndis *rndis_class, uint8_t *buffer, uint32_t buflen, uint32_t timeout); - -int usbh_rndis_keepalive(struct usbh_rndis *rndis_class); - -void usbh_rndis_run(struct usbh_rndis *rndis_class); -void usbh_rndis_stop(struct usbh_rndis *rndis_class); - -#ifdef __cplusplus -} -#endif - -#endif /* USBH_RNDIS_H */ diff --git a/third-party/cherryusb/common/usb_dc.h b/third-party/cherryusb/common/usb_dc.h deleted file mode 100644 index a541330aa49bc79b5bd14ed03d15e80054e4ac00..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/common/usb_dc.h +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_DC_H -#define USB_DC_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief USB Endpoint Configuration. - * - * Structure containing the USB endpoint configuration. - */ -struct usbd_endpoint_cfg { - uint8_t ep_addr; /* Endpoint addr with direction */ - uint8_t ep_type; /* Endpoint type */ - uint16_t ep_mps; /* Endpoint max packet size */ - uint8_t ep_mult; /* Endpoint additional transcations in micro frame */ -}; - -/** - * @brief init device controller registers. - * @return On success will return 0, and others indicate fail. - */ -int usb_dc_init(void); - -/** - * @brief deinit device controller registers. - * @return On success will return 0, and others indicate fail. - */ -int usb_dc_deinit(void); - -/** - * @brief Set USB device address - * - * @param[in] addr Device address - * - * @return On success will return 0, and others indicate fail. - */ -int usbd_set_address(const uint8_t addr); - -/** - * @brief Get USB device speed - * - * @param[in] port port index - * - * @return port speed, USB_SPEED_LOW or USB_SPEED_FULL or USB_SPEED_HIGH - */ -uint8_t usbd_get_port_speed(const uint8_t port); - -/** - * @brief configure and enable endpoint. - * - * @param [in] ep_cfg Endpoint config. - * - * @return On success will return 0, and others indicate fail. - */ -int usbd_ep_open(const struct usbd_endpoint_cfg *ep_cfg); - -/** - * @brief Disable the selected endpoint - * - * @param[in] ep Endpoint address - * - * @return On success will return 0, and others indicate fail. - */ -int usbd_ep_close(const uint8_t ep); - -/** - * @brief Set stall condition for the selected endpoint - * - * @param[in] ep Endpoint address - * - * - * @return On success will return 0, and others indicate fail. - */ -int usbd_ep_set_stall(const uint8_t ep); - -/** - * @brief Clear stall condition for the selected endpoint - * - * @param[in] ep Endpoint address corresponding to the one - * listed in the device configuration table - * - * @return On success will return 0, and others indicate fail. - */ -int usbd_ep_clear_stall(const uint8_t ep); - -/** - * @brief Check if the selected endpoint is stalled - * - * @param[in] ep Endpoint address - * - * @param[out] stalled Endpoint stall status - * - * @return On success will return 0, and others indicate fail. - */ -int usbd_ep_is_stalled(const uint8_t ep, uint8_t *stalled); - -/** - * @brief Setup in ep transfer setting and start transfer. - * - * This function is asynchronous. - * This function is similar to uart with tx dma. - * - * This function is called to write data to the specified endpoint. The - * supplied usbd_endpoint_callback function will be called when data is transmitted - * out. - * - * @param[in] ep Endpoint address corresponding to the one - * listed in the device configuration table - * @param[in] data Pointer to data to write - * @param[in] data_len Length of the data requested to write. This may - * be zero for a zero length status packet. - * @return 0 on success, negative errno code on fail. - */ -int usbd_ep_start_write(const uint8_t ep, const uint8_t *data, uint32_t data_len); - -/** - * @brief Setup out ep transfer setting and start transfer. - * - * This function is asynchronous. - * This function is similar to uart with rx dma. - * - * This function is called to read data to the specified endpoint. The - * supplied usbd_endpoint_callback function will be called when data is received - * in. - * - * @param[in] ep Endpoint address corresponding to the one - * listed in the device configuration table - * @param[in] data Pointer to data to read - * @param[in] data_len Max length of the data requested to read. - * - * @return 0 on success, negative errno code on fail. - */ -int usbd_ep_start_read(const uint8_t ep, uint8_t *data, uint32_t data_len); - -/* usb dcd irq callback */ - -/** - * @brief Usb connect irq callback. - */ -void usbd_event_connect_handler(void); - -/** - * @brief Usb disconnect irq callback. - */ -void usbd_event_disconnect_handler(void); - -/** - * @brief Usb resume irq callback. - */ -void usbd_event_resume_handler(void); - -/** - * @brief Usb suspend irq callback. - */ -void usbd_event_suspend_handler(void); - -/** - * @brief Usb reset irq callback. - */ -void usbd_event_reset_handler(void); - -/** - * @brief Usb setup packet recv irq callback. - * @param[in] psetup setup packet. - */ -void usbd_event_ep0_setup_complete_handler(uint8_t *psetup); - -/** - * @brief In ep transfer complete irq callback. - * @param[in] ep Endpoint address corresponding to the one - * listed in the device configuration table - * @param[in] nbytes How many nbytes have transferred. - */ -void usbd_event_ep_in_complete_handler(uint8_t ep, uint32_t nbytes); - -/** - * @brief Out ep transfer complete irq callback. - * @param[in] ep Endpoint address corresponding to the one - * listed in the device configuration table - * @param[in] nbytes How many nbytes have transferred. - */ -void usbd_event_ep_out_complete_handler(uint8_t ep, uint32_t nbytes); - -#ifdef __cplusplus -} -#endif - -#endif /* USB_DC_H */ diff --git a/third-party/cherryusb/common/usb_def.h b/third-party/cherryusb/common/usb_def.h deleted file mode 100644 index be4830379ec27fd6fc0f048f18ec90b3097443fc..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/common/usb_def.h +++ /dev/null @@ -1,698 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_DEF_H -#define USB_DEF_H - -/* Useful define */ -#define USB_1_1 0x0110 -#define USB_2_0 0x0200 -/* Set USB version to 2.1 so that the host will request the BOS descriptor */ -#define USB_2_1 0x0210 -#define USB_3_0 0x0300 -#define USB_3_1 0x0310 - -/* Device speeds */ -#define USB_SPEED_UNKNOWN 0 /* Transfer rate not yet set */ -#define USB_SPEED_LOW 1 /* USB 1.1 */ -#define USB_SPEED_FULL 2 /* USB 1.1 */ -#define USB_SPEED_HIGH 3 /* USB 2.0 */ -#define USB_SPEED_WIRELESS 4 /* Wireless USB 2.5 */ -#define USB_SPEED_SUPER 5 /* USB 3.0 */ -#define USB_SPEED_SUPER_PLUS 6 /* USB 3.1 */ - -/* Maximum number of devices per controller */ -#define USB_MAX_DEVICES (127) - -/* Default USB control EP, always 0 and 0x80 */ -#define USB_CONTROL_OUT_EP0 0 -#define USB_CONTROL_IN_EP0 0x80 - -/**< maximum packet size (MPS) for EP 0 */ -#define USB_CTRL_EP_MPS 64 - -/* USB PID Types */ -#define USB_PID_OUT (0x01) /* Tokens */ -#define USB_PID_IN (0x09) -#define USB_PID_SOF (0x05) -#define USB_PID_SETUP (0x0d) - -#define USB_PID_DATA0 (0x03) /* Data */ -#define USB_PID_DATA1 (0x0b) -#define USB_PID_DATA2 (0x07) -#define USB_PID_MDATA (0x0f) - -#define USB_PID_ACK (0x02) /* Handshake */ -#define USB_PID_NAK (0x0a) -#define USB_PID_STALL (0x0e) -#define USB_PID_NYET (0x06) - -#define USB_PID_PRE (0x0c) /* Special */ -#define USB_PID_ERR (0x0c) -#define USB_PID_SPLIT (0x08) -#define USB_PID_PING (0x04) -#define USB_PID_RESERVED (0x00) - -#define USB_REQUEST_DIR_SHIFT 7U /* Bits 7: Request dir */ -#define USB_REQUEST_DIR_OUT (0U << USB_REQUEST_DIR_SHIFT) /* Bit 7=0: Host-to-device */ -#define USB_REQUEST_DIR_IN (1U << USB_REQUEST_DIR_SHIFT) /* Bit 7=1: Device-to-host */ -#define USB_REQUEST_DIR_MASK (1U << USB_REQUEST_DIR_SHIFT) /* Bit 7=1: Direction bit */ - -#define USB_REQUEST_TYPE_SHIFT 5U /* Bits 5:6: Request type */ -#define USB_REQUEST_STANDARD (0U << USB_REQUEST_TYPE_SHIFT) -#define USB_REQUEST_CLASS (1U << USB_REQUEST_TYPE_SHIFT) -#define USB_REQUEST_VENDOR (2U << USB_REQUEST_TYPE_SHIFT) -#define USB_REQUEST_RESERVED (3U << USB_REQUEST_TYPE_SHIFT) -#define USB_REQUEST_TYPE_MASK (3U << USB_REQUEST_TYPE_SHIFT) - -#define USB_REQUEST_RECIPIENT_SHIFT 0U /* Bits 0:4: Recipient */ -#define USB_REQUEST_RECIPIENT_DEVICE (0U << USB_REQUEST_RECIPIENT_SHIFT) -#define USB_REQUEST_RECIPIENT_INTERFACE (1U << USB_REQUEST_RECIPIENT_SHIFT) -#define USB_REQUEST_RECIPIENT_ENDPOINT (2U << USB_REQUEST_RECIPIENT_SHIFT) -#define USB_REQUEST_RECIPIENT_OTHER (3U << USB_REQUEST_RECIPIENT_SHIFT) -#define USB_REQUEST_RECIPIENT_MASK (3U << USB_REQUEST_RECIPIENT_SHIFT) - -/* USB Standard Request Codes */ -#define USB_REQUEST_GET_STATUS 0x00 -#define USB_REQUEST_CLEAR_FEATURE 0x01 -#define USB_REQUEST_SET_FEATURE 0x03 -#define USB_REQUEST_SET_ADDRESS 0x05 -#define USB_REQUEST_GET_DESCRIPTOR 0x06 -#define USB_REQUEST_SET_DESCRIPTOR 0x07 -#define USB_REQUEST_GET_CONFIGURATION 0x08 -#define USB_REQUEST_SET_CONFIGURATION 0x09 -#define USB_REQUEST_GET_INTERFACE 0x0A -#define USB_REQUEST_SET_INTERFACE 0x0B -#define USB_REQUEST_SYNCH_FRAME 0x0C -#define USB_REQUEST_SET_ENCRYPTION 0x0D -#define USB_REQUEST_GET_ENCRYPTION 0x0E -#define USB_REQUEST_RPIPE_ABORT 0x0E -#define USB_REQUEST_SET_HANDSHAKE 0x0F -#define USB_REQUEST_RPIPE_RESET 0x0F -#define USB_REQUEST_GET_HANDSHAKE 0x10 -#define USB_REQUEST_SET_CONNECTION 0x11 -#define USB_REQUEST_SET_SECURITY_DATA 0x12 -#define USB_REQUEST_GET_SECURITY_DATA 0x13 -#define USB_REQUEST_SET_WUSB_DATA 0x14 -#define USB_REQUEST_LOOPBACK_DATA_WRITE 0x15 -#define USB_REQUEST_LOOPBACK_DATA_READ 0x16 -#define USB_REQUEST_SET_INTERFACE_DS 0x17 - -/* USB Standard Feature selectors */ -#define USB_FEATURE_ENDPOINT_HALT 0 -#define USB_FEATURE_SELF_POWERED 0 -#define USB_FEATURE_REMOTE_WAKEUP 1 -#define USB_FEATURE_TEST_MODE 2 -#define USB_FEATURE_BATTERY 2 -#define USB_FEATURE_BHNPENABLE 3 -#define USB_FEATURE_WUSBDEVICE 3 -#define USB_FEATURE_AHNPSUPPORT 4 -#define USB_FEATURE_AALTHNPSUPPORT 5 -#define USB_FEATURE_DEBUGMODE 6 - -/* USB GET_STATUS Bit Values */ -#define USB_GETSTATUS_ENDPOINT_HALT 0x01 -#define USB_GETSTATUS_SELF_POWERED 0x01 -#define USB_GETSTATUS_REMOTE_WAKEUP 0x02 - -/* USB Descriptor Types */ -#define USB_DESCRIPTOR_TYPE_DEVICE 0x01U -#define USB_DESCRIPTOR_TYPE_CONFIGURATION 0x02U -#define USB_DESCRIPTOR_TYPE_STRING 0x03U -#define USB_DESCRIPTOR_TYPE_INTERFACE 0x04U -#define USB_DESCRIPTOR_TYPE_ENDPOINT 0x05U -#define USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER 0x06U -#define USB_DESCRIPTOR_TYPE_OTHER_SPEED 0x07U -#define USB_DESCRIPTOR_TYPE_INTERFACE_POWER 0x08U -#define USB_DESCRIPTOR_TYPE_OTG 0x09U -#define USB_DESCRIPTOR_TYPE_DEBUG 0x0AU -#define USB_DESCRIPTOR_TYPE_INTERFACE_ASSOCIATION 0x0BU -#define USB_DESCRIPTOR_TYPE_BINARY_OBJECT_STORE 0x0FU -#define USB_DESCRIPTOR_TYPE_DEVICE_CAPABILITY 0x10U -#define USB_DESCRIPTOR_TYPE_WIRELESS_ENDPOINTCOMP 0x11U - -/* Class Specific Descriptor */ -#define USB_CS_DESCRIPTOR_TYPE_DEVICE 0x21U -#define USB_CS_DESCRIPTOR_TYPE_CONFIGURATION 0x22U -#define USB_CS_DESCRIPTOR_TYPE_STRING 0x23U -#define USB_CS_DESCRIPTOR_TYPE_INTERFACE 0x24U -#define USB_CS_DESCRIPTOR_TYPE_ENDPOINT 0x25U - -#define USB_DESCRIPTOR_TYPE_SUPERSPEED_ENDPOINT_COMPANION 0x30U -#define USB_DESCRIPTOR_TYPE_SUPERSPEED_ISO_ENDPOINT_COMPANION 0x31U - -/* USB Device Classes */ -#define USB_DEVICE_CLASS_RESERVED 0x00 -#define USB_DEVICE_CLASS_AUDIO 0x01 -#define USB_DEVICE_CLASS_CDC 0x02 -#define USB_DEVICE_CLASS_HID 0x03 -#define USB_DEVICE_CLASS_MONITOR 0x04 -#define USB_DEVICE_CLASS_PHYSICAL 0x05 -#define USB_DEVICE_CLASS_IMAGE 0x06 -#define USB_DEVICE_CLASS_PRINTER 0x07 -#define USB_DEVICE_CLASS_MASS_STORAGE 0x08 -#define USB_DEVICE_CLASS_HUB 0x09 -#define USB_DEVICE_CLASS_CDC_DATA 0x0a -#define USB_DEVICE_CLASS_SMART_CARD 0x0b -#define USB_DEVICE_CLASS_SECURITY 0x0d -#define USB_DEVICE_CLASS_VIDEO 0x0e -#define USB_DEVICE_CLASS_HEALTHCARE 0x0f -#define USB_DEVICE_CLASS_DIAG_DEVICE 0xdc -#define USB_DEVICE_CLASS_WIRELESS 0xe0 -#define USB_DEVICE_CLASS_MISC 0xef -#define USB_DEVICE_CLASS_APP_SPECIFIC 0xfe -#define USB_DEVICE_CLASS_VEND_SPECIFIC 0xff - -/* usb string index define */ -#define USB_STRING_LANGID_INDEX 0x00 -#define USB_STRING_MFC_INDEX 0x01 -#define USB_STRING_PRODUCT_INDEX 0x02 -#define USB_STRING_SERIAL_INDEX 0x03 -#define USB_STRING_CONFIG_INDEX 0x04 -#define USB_STRING_INTERFACE_INDEX 0x05 -#define USB_STRING_OS_INDEX 0x06 -#define USB_STRING_MAX USB_STRING_OS_INDEX -/* - * Devices supporting Microsoft OS Descriptors store special string - * descriptor at fixed index (0xEE). It is read when a new device is - * attached to a computer for the first time. - */ -#define USB_OSDESC_STRING_DESC_INDEX 0xEE - -/* bmAttributes in Configuration Descriptor */ -#define USB_CONFIG_REMOTE_WAKEUP 0x20 -#define USB_CONFIG_POWERED_MASK 0x40 -#define USB_CONFIG_BUS_POWERED 0x80 -#define USB_CONFIG_SELF_POWERED 0xC0 - -/* bMaxPower in Configuration Descriptor */ -#define USB_CONFIG_POWER_MA(mA) ((mA) / 2) - -/* bEndpointAddress in Endpoint Descriptor */ -#define USB_ENDPOINT_DIRECTION_MASK 0x80 -#define USB_ENDPOINT_OUT(addr) ((addr) | 0x00) -#define USB_ENDPOINT_IN(addr) ((addr) | 0x80) - -/** - * USB endpoint direction and number. - */ -#define USB_EP_DIR_MASK 0x80U -#define USB_EP_DIR_IN 0x80U -#define USB_EP_DIR_OUT 0x00U - -/** Get endpoint index (number) from endpoint address */ -#define USB_EP_GET_IDX(ep) ((ep) & ~USB_EP_DIR_MASK) -/** Get direction from endpoint address */ -#define USB_EP_GET_DIR(ep) ((ep)&USB_EP_DIR_MASK) -/** Get endpoint address from endpoint index and direction */ -#define USB_EP_GET_ADDR(idx, dir) ((idx) | ((dir)&USB_EP_DIR_MASK)) -/** True if the endpoint is an IN endpoint */ -#define USB_EP_DIR_IS_IN(ep) (USB_EP_GET_DIR(ep) == USB_EP_DIR_IN) -/** True if the endpoint is an OUT endpoint */ -#define USB_EP_DIR_IS_OUT(ep) (USB_EP_GET_DIR(ep) == USB_EP_DIR_OUT) - -/* bmAttributes in Endpoint Descriptor */ -#define USB_ENDPOINT_TYPE_SHIFT 0 -#define USB_ENDPOINT_TYPE_CONTROL (0 << USB_ENDPOINT_TYPE_SHIFT) -#define USB_ENDPOINT_TYPE_ISOCHRONOUS (1 << USB_ENDPOINT_TYPE_SHIFT) -#define USB_ENDPOINT_TYPE_BULK (2 << USB_ENDPOINT_TYPE_SHIFT) -#define USB_ENDPOINT_TYPE_INTERRUPT (3 << USB_ENDPOINT_TYPE_SHIFT) -#define USB_ENDPOINT_TYPE_MASK (3 << USB_ENDPOINT_TYPE_SHIFT) - -#define USB_ENDPOINT_SYNC_SHIFT 2 -#define USB_ENDPOINT_SYNC_NO_SYNCHRONIZATION (0 << USB_ENDPOINT_SYNC_SHIFT) -#define USB_ENDPOINT_SYNC_ASYNCHRONOUS (1 << USB_ENDPOINT_SYNC_SHIFT) -#define USB_ENDPOINT_SYNC_ADAPTIVE (2 << USB_ENDPOINT_SYNC_SHIFT) -#define USB_ENDPOINT_SYNC_SYNCHRONOUS (3 << USB_ENDPOINT_SYNC_SHIFT) -#define USB_ENDPOINT_SYNC_MASK (3 << USB_ENDPOINT_SYNC_SHIFT) - -#define USB_ENDPOINT_USAGE_SHIFT 4 -#define USB_ENDPOINT_USAGE_DATA (0 << USB_ENDPOINT_USAGE_SHIFT) -#define USB_ENDPOINT_USAGE_FEEDBACK (1 << USB_ENDPOINT_USAGE_SHIFT) -#define USB_ENDPOINT_USAGE_IMPLICIT_FEEDBACK (2 << USB_ENDPOINT_USAGE_SHIFT) -#define USB_ENDPOINT_USAGE_MASK (3 << USB_ENDPOINT_USAGE_SHIFT) - -#define USB_ENDPOINT_MAX_ADJUSTABLE (1 << 7) - -/* wMaxPacketSize in Endpoint Descriptor */ -#define USB_MAXPACKETSIZE_SHIFT 0 -#define USB_MAXPACKETSIZE_MASK (0x7ff << USB_MAXPACKETSIZE_SHIFT) -#define USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_SHIFT 11 -#define USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_NONE (0 << USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_SHIFT) -#define USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_ONE (1 << USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_SHIFT) -#define USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_TWO (2 << USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_SHIFT) -#define USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_MASK (3 << USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_SHIFT) - -/* bDevCapabilityType in Device Capability Descriptor */ -#define USB_DEVICE_CAPABILITY_WIRELESS_USB 1 -#define USB_DEVICE_CAPABILITY_USB_2_0_EXTENSION 2 -#define USB_DEVICE_CAPABILITY_SUPERSPEED_USB 3 -#define USB_DEVICE_CAPABILITY_CONTAINER_ID 4 -#define USB_DEVICE_CAPABILITY_PLATFORM 5 -#define USB_DEVICE_CAPABILITY_POWER_DELIVERY_CAPABILITY 6 -#define USB_DEVICE_CAPABILITY_BATTERY_INFO_CAPABILITY 7 -#define USB_DEVICE_CAPABILITY_PD_CONSUMER_PORT_CAPABILITY 8 -#define USB_DEVICE_CAPABILITY_PD_PROVIDER_PORT_CAPABILITY 9 -#define USB_DEVICE_CAPABILITY_SUPERSPEED_PLUS 10 -#define USB_DEVICE_CAPABILITY_PRECISION_TIME_MEASUREMENT 11 -#define USB_DEVICE_CAPABILITY_WIRELESS_USB_EXT 12 - -#define USB_BOS_CAPABILITY_EXTENSION 0x02 -#define USB_BOS_CAPABILITY_PLATFORM 0x05 - -/* OTG SET FEATURE Constants */ -#define USB_OTG_FEATURE_B_HNP_ENABLE 3 /* Enable B device to perform HNP */ -#define USB_OTG_FEATURE_A_HNP_SUPPORT 4 /* A device supports HNP */ -#define USB_OTG_FEATURE_A_ALT_HNP_SUPPORT 5 /* Another port on the A device supports HNP */ - -/* WinUSB Microsoft OS 2.0 descriptor request codes */ -#define WINUSB_REQUEST_GET_DESCRIPTOR_SET 0x07 -#define WINUSB_REQUEST_SET_ALT_ENUM 0x08 - -/* WinUSB Microsoft OS 2.0 descriptor sizes */ -#define WINUSB_DESCRIPTOR_SET_HEADER_SIZE 10 -#define WINUSB_FUNCTION_SUBSET_HEADER_SIZE 8 -#define WINUSB_FEATURE_COMPATIBLE_ID_SIZE 20 - -/* WinUSB Microsoft OS 2.0 Descriptor Types */ -#define WINUSB_SET_HEADER_DESCRIPTOR_TYPE 0x00 -#define WINUSB_SUBSET_HEADER_CONFIGURATION_TYPE 0x01 -#define WINUSB_SUBSET_HEADER_FUNCTION_TYPE 0x02 -#define WINUSB_FEATURE_COMPATIBLE_ID_TYPE 0x03 -#define WINUSB_FEATURE_REG_PROPERTY_TYPE 0x04 -#define WINUSB_FEATURE_MIN_RESUME_TIME_TYPE 0x05 -#define WINUSB_FEATURE_MODEL_ID_TYPE 0x06 -#define WINUSB_FEATURE_CCGP_DEVICE_TYPE 0x07 - -#define WINUSB_PROP_DATA_TYPE_REG_SZ 0x01 -#define WINUSB_PROP_DATA_TYPE_REG_MULTI_SZ 0x07 - -/* WebUSB Descriptor Types */ -#define WEBUSB_DESCRIPTOR_SET_HEADER_TYPE 0x00 -#define WEBUSB_CONFIGURATION_SUBSET_HEADER_TYPE 0x01 -#define WEBUSB_FUNCTION_SUBSET_HEADER_TYPE 0x02 -#define WEBUSB_URL_TYPE 0x03 - -/* WebUSB Request Codes */ -#define WEBUSB_REQUEST_GET_URL 0x02 - -/* bScheme in URL descriptor */ -#define WEBUSB_URL_SCHEME_HTTP 0x00 -#define WEBUSB_URL_SCHEME_HTTPS 0x01 - -/* WebUSB Descriptor sizes */ -#define WEBUSB_DESCRIPTOR_SET_HEADER_SIZE 5 -#define WEBUSB_CONFIGURATION_SUBSET_HEADER_SIZE 4 -#define WEBUSB_FUNCTION_SUBSET_HEADER_SIZE 3 - -/* Setup packet definition used to read raw data from USB line */ -struct usb_setup_packet { - /** Request type. Bits 0:4 determine recipient, see - * \ref usb_request_recipient. Bits 5:6 determine type, see - * \ref usb_request_type. Bit 7 determines data transfer direction, see - * \ref usb_endpoint_direction. - */ - uint8_t bmRequestType; - - /** Request. If the type bits of bmRequestType are equal to - * \ref usb_request_type::LIBUSB_REQUEST_TYPE_STANDARD - * "USB_REQUEST_TYPE_STANDARD" then this field refers to - * \ref usb_standard_request. For other cases, use of this field is - * application-specific. */ - uint8_t bRequest; - - /** Value. Varies according to request */ - uint16_t wValue; - - /** Index. Varies according to request, typically used to pass an index - * or offset */ - uint16_t wIndex; - - /** Number of bytes to transfer */ - uint16_t wLength; -} __PACKED; - -#define USB_SIZEOF_SETUP_PACKET 8 - -/** Standard Device Descriptor */ -struct usb_device_descriptor { - uint8_t bLength; /* Descriptor size in bytes = 18 */ - uint8_t bDescriptorType; /* DEVICE descriptor type = 1 */ - uint16_t bcdUSB; /* USB spec in BCD, e.g. 0x0200 */ - uint8_t bDeviceClass; /* Class code, if 0 see interface */ - uint8_t bDeviceSubClass; /* Sub-Class code, 0 if class = 0 */ - uint8_t bDeviceProtocol; /* Protocol, if 0 see interface */ - uint8_t bMaxPacketSize0; /* Endpoint 0 max. size */ - uint16_t idVendor; /* Vendor ID per USB-IF */ - uint16_t idProduct; /* Product ID per manufacturer */ - uint16_t bcdDevice; /* Device release # in BCD */ - uint8_t iManufacturer; /* Index to manufacturer string */ - uint8_t iProduct; /* Index to product string */ - uint8_t iSerialNumber; /* Index to serial number string */ - uint8_t bNumConfigurations; /* Number of possible configurations */ -} __PACKED; - -#define USB_SIZEOF_DEVICE_DESC 18 - -/** Standard Configuration Descriptor */ -struct usb_configuration_descriptor { - uint8_t bLength; /* Descriptor size in bytes = 9 */ - uint8_t bDescriptorType; /* CONFIGURATION type = 2 or 7 */ - uint16_t wTotalLength; /* Length of concatenated descriptors */ - uint8_t bNumInterfaces; /* Number of interfaces, this config. */ - uint8_t bConfigurationValue; /* Value to set this config. */ - uint8_t iConfiguration; /* Index to configuration string */ - uint8_t bmAttributes; /* Config. characteristics */ - uint8_t bMaxPower; /* Max.power from bus, 2mA units */ -} __PACKED; - -#define USB_SIZEOF_CONFIG_DESC 9 - -/** Standard Interface Descriptor */ -struct usb_interface_descriptor { - uint8_t bLength; /* Descriptor size in bytes = 9 */ - uint8_t bDescriptorType; /* INTERFACE descriptor type = 4 */ - uint8_t bInterfaceNumber; /* Interface no.*/ - uint8_t bAlternateSetting; /* Value to select this IF */ - uint8_t bNumEndpoints; /* Number of endpoints excluding 0 */ - uint8_t bInterfaceClass; /* Class code, 0xFF = vendor */ - uint8_t bInterfaceSubClass; /* Sub-Class code, 0 if class = 0 */ - uint8_t bInterfaceProtocol; /* Protocol, 0xFF = vendor */ - uint8_t iInterface; /* Index to interface string */ -} __PACKED; - -#define USB_SIZEOF_INTERFACE_DESC 9 - -/** Standard Endpoint Descriptor */ -struct usb_endpoint_descriptor { - uint8_t bLength; /* Descriptor size in bytes = 7 */ - uint8_t bDescriptorType; /* ENDPOINT descriptor type = 5 */ - uint8_t bEndpointAddress; /* Endpoint # 0 - 15 | IN/OUT */ - uint8_t bmAttributes; /* Transfer type */ - uint16_t wMaxPacketSize; /* Bits 10:0 = max. packet size */ - uint8_t bInterval; /* Polling interval in (micro) frames */ -} __PACKED; - -#define USB_SIZEOF_ENDPOINT_DESC 7 - -/** Unicode (UTF16LE) String Descriptor */ -struct usb_string_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint16_t bString; -} __PACKED; - -#define USB_SIZEOF_STRING_LANGID_DESC 4 - -/* USB Interface Association Descriptor */ -struct usb_interface_association_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bFirstInterface; - uint8_t bInterfaceCount; - uint8_t bFunctionClass; - uint8_t bFunctionSubClass; - uint8_t bFunctionProtocol; - uint8_t iFunction; -} __PACKED; - -#define USB_SIZEOF_IAD_DESC 8 - -/** USB device_qualifier descriptor */ -struct usb_device_qualifier_descriptor { - uint8_t bLength; /* Descriptor size in bytes = 10 */ - uint8_t bDescriptorType; /* DEVICE QUALIFIER type = 6 */ - uint16_t bcdUSB; /* USB spec in BCD, e.g. 0x0200 */ - uint8_t bDeviceClass; /* Class code, if 0 see interface */ - uint8_t bDeviceSubClass; /* Sub-Class code, 0 if class = 0 */ - uint8_t bDeviceProtocol; /* Protocol, if 0 see interface */ - uint8_t bMaxPacketSize; /* Endpoint 0 max. size */ - uint8_t bNumConfigurations; /* Number of possible configurations */ - uint8_t bReserved; /* Reserved = 0 */ -} __PACKED; - -#define USB_SIZEOF_DEVICE_QUALIFIER_DESC 10 - -/* Microsoft OS function descriptor. - * This can be used to request a specific driver (such as WINUSB) to be - * loaded on Windows. Unlike other descriptors, it is requested by a special - * request USB_REQ_GETMSFTOSDESCRIPTOR. - * More details: - * https://msdn.microsoft.com/en-us/windows/hardware/gg463179 - * And excellent explanation: - * https://github.com/pbatard/libwdi/wiki/WCID-Devices - * - * The device will have exactly one "Extended Compat ID Feature Descriptor", - * which may contain multiple "Function Descriptors" associated with - * different interfaces. - */ - -/* MS OS 1.0 string descriptor */ -struct usb_msosv1_string_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bString[14]; - uint8_t bMS_VendorCode; /* Vendor Code, used for a control request */ - uint8_t bPad; /* Padding byte for VendorCode look as UTF16 */ -} __PACKED; - -/* MS OS 1.0 Header descriptor */ -struct usb_msosv1_compat_id_header_descriptor { - uint32_t dwLength; - uint16_t bcdVersion; - uint16_t wIndex; - uint8_t bCount; - uint8_t reserved[7]; -} __PACKED; - -/* MS OS 1.0 Function descriptor */ -struct usb_msosv1_comp_id_function_descriptor { - uint8_t bFirstInterfaceNumber; - uint8_t reserved1; - uint8_t compatibleID[8]; - uint8_t subCompatibleID[8]; - uint8_t reserved2[6]; -} __PACKED; - -#define usb_msosv1_comp_id_create(x) \ - struct usb_msosv1_comp_id { \ - struct usb_msosv1_compat_id_header_descriptor compat_id_header; \ - struct usb_msosv1_comp_id_function_descriptor compat_id_function[x]; \ - }; - -struct usb_msosv1_descriptor { - uint8_t *string; - uint8_t string_len; - uint8_t vendor_code; - uint8_t *compat_id; - uint16_t compat_id_len; - uint8_t *comp_id_property; - uint16_t comp_id_property_len; -}; - -/* MS OS 2.0 Header descriptor */ -struct usb_msosv2_header_descriptor { - uint32_t dwLength; - uint16_t bcdVersion; - uint16_t wIndex; - uint8_t bCount; -} __PACKED; - -/*Microsoft OS 2.0 set header descriptor*/ -struct usb_msosv2_set_header_descriptor { - uint16_t wLength; - uint16_t wDescriptorType; - uint32_t dwWindowsVersion; - uint16_t wDescriptorSetTotalLength; -} __PACKED; - -/* Microsoft OS 2.0 compatibleID descriptor*/ -struct usb_msosv2_comp_id_descriptor { - uint16_t wLength; - uint16_t wDescriptorType; - uint8_t compatibleID[8]; - uint8_t subCompatibleID[8]; -} __PACKED; - -/* MS OS 2.0 property descriptor */ -struct usb_msosv2_property_descriptor { - uint16_t wLength; - uint16_t wDescriptorType; - uint32_t dwPropertyDataType; - uint16_t wPropertyNameLength; - const char *bPropertyName; - uint32_t dwPropertyDataLength; - const char *bPropertyData; -}; - -/* Microsoft OS 2.0 subset function descriptor */ -struct usb_msosv2_subset_function_descriptor { - uint16_t wLength; - uint16_t wDescriptorType; - uint8_t bFirstInterface; - uint8_t bReserved; - uint16_t wSubsetLength; -} __PACKED; - -struct usb_msosv2_descriptor { - uint8_t *compat_id; - uint16_t compat_id_len; - uint8_t vendor_code; -}; - -/* BOS header Descriptor */ -struct usb_bos_header_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint16_t wTotalLength; - uint8_t bNumDeviceCaps; -} __PACKED; - -/* BOS Capability platform Descriptor */ -struct usb_bos_capability_platform_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDevCapabilityType; - uint8_t bReserved; - uint8_t PlatformCapabilityUUID[16]; -} __PACKED; - -/* BOS Capability MS OS Descriptors version 2 */ -struct usb_bos_capability_msosv2_descriptor { - uint32_t dwWindowsVersion; - uint16_t wMSOSDescriptorSetTotalLength; - uint8_t bVendorCode; - uint8_t bAltEnumCode; -} __PACKED; - -/* BOS Capability webusb */ -struct usb_bos_capability_webusb_descriptor { - uint16_t bcdVersion; - uint8_t bVendorCode; - uint8_t iLandingPage; -} __PACKED; - -/* BOS Capability extension Descriptor*/ -struct usb_bos_capability_extension_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDevCapabilityType; - uint32_t bmAttributes; -} __PACKED; - -/* Microsoft OS 2.0 Platform Capability Descriptor -* See https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/ -* microsoft-defined-usb-descriptors -* Adapted from the source: -* https://github.com/sowbug/weblight/blob/master/firmware/webusb.c -* (BSD-2) Thanks http://janaxelson.com/files/ms_os_20_descriptors.c -*/ -struct usb_bos_capability_platform_msosv2_descriptor { - struct usb_bos_capability_platform_descriptor platform_msos; - struct usb_bos_capability_msosv2_descriptor data_msosv2; -} __PACKED; - -/* WebUSB Platform Capability Descriptor: -* https://wicg.github.io/webusb/#webusb-platform-capability-descriptor -*/ -struct usb_bos_capability_platform_webusb_descriptor { - struct usb_bos_capability_platform_descriptor platform_webusb; - struct usb_bos_capability_webusb_descriptor data_webusb; -} __PACKED; - -struct usb_webusb_url_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bScheme; - char URL[]; -} __PACKED; - -struct usb_webusb_url_ex_descriptor { - uint8_t vendor_code; - uint8_t *string; - uint32_t string_len; -} __PACKED; - -struct usb_bos_descriptor { - uint8_t *string; - uint32_t string_len; -}; - -/* USB Device Capability Descriptor */ -struct usb_device_capability_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint8_t bDevCapabilityType; -} __PACKED; - -/** USB descriptor header */ -struct usb_desc_header { - uint8_t bLength; /**< descriptor length */ - uint8_t bDescriptorType; /**< descriptor type */ -}; -// clang-format off -#define USB_DEVICE_DESCRIPTOR_INIT(bcdUSB, bDeviceClass, bDeviceSubClass, bDeviceProtocol, idVendor, idProduct, bcdDevice, bNumConfigurations) \ - 0x12, /* bLength */ \ - USB_DESCRIPTOR_TYPE_DEVICE, /* bDescriptorType */ \ - WBVAL(bcdUSB), /* bcdUSB */ \ - bDeviceClass, /* bDeviceClass */ \ - bDeviceSubClass, /* bDeviceSubClass */ \ - bDeviceProtocol, /* bDeviceProtocol */ \ - 0x40, /* bMaxPacketSize */ \ - WBVAL(idVendor), /* idVendor */ \ - WBVAL(idProduct), /* idProduct */ \ - WBVAL(bcdDevice), /* bcdDevice */ \ - USB_STRING_MFC_INDEX, /* iManufacturer */ \ - USB_STRING_PRODUCT_INDEX, /* iProduct */ \ - USB_STRING_SERIAL_INDEX, /* iSerial */ \ - bNumConfigurations /* bNumConfigurations */ - -#define USB_CONFIG_DESCRIPTOR_INIT(wTotalLength, bNumInterfaces, bConfigurationValue, bmAttributes, bMaxPower) \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_CONFIGURATION, /* bDescriptorType */ \ - WBVAL(wTotalLength), /* wTotalLength */ \ - bNumInterfaces, /* bNumInterfaces */ \ - bConfigurationValue, /* bConfigurationValue */ \ - 0x00, /* iConfiguration */ \ - bmAttributes, /* bmAttributes */ \ - USB_CONFIG_POWER_MA(bMaxPower) /* bMaxPower */ - -#define USB_INTERFACE_DESCRIPTOR_INIT(bInterfaceNumber, bAlternateSetting, bNumEndpoints, \ - bInterfaceClass, bInterfaceSubClass, bInterfaceProtocol, iInterface) \ - 0x09, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE, /* bDescriptorType */ \ - bInterfaceNumber, /* bInterfaceNumber */ \ - bAlternateSetting, /* bAlternateSetting */ \ - bNumEndpoints, /* bNumEndpoints */ \ - bInterfaceClass, /* bInterfaceClass */ \ - bInterfaceSubClass, /* bInterfaceSubClass */ \ - bInterfaceProtocol, /* bInterfaceProtocol */ \ - iInterface /* iInterface */ - -#define USB_ENDPOINT_DESCRIPTOR_INIT(bEndpointAddress, bmAttributes, wMaxPacketSize, bInterval) \ - 0x07, /* bLength */ \ - USB_DESCRIPTOR_TYPE_ENDPOINT, /* bDescriptorType */ \ - bEndpointAddress, /* bEndpointAddress */ \ - bmAttributes, /* bmAttributes */ \ - WBVAL(wMaxPacketSize), /* wMaxPacketSize */ \ - bInterval /* bInterval */ - -#define USB_IAD_INIT(bFirstInterface, bInterfaceCount, bFunctionClass, bFunctionSubClass, bFunctionProtocol) \ - 0x08, /* bLength */ \ - USB_DESCRIPTOR_TYPE_INTERFACE_ASSOCIATION, /* bDescriptorType */ \ - bFirstInterface, /* bFirstInterface */ \ - bInterfaceCount, /* bInterfaceCount */ \ - bFunctionClass, /* bFunctionClass */ \ - bFunctionSubClass, /* bFunctionSubClass */ \ - bFunctionProtocol, /* bFunctionProtocol */ \ - 0x00 /* iFunction */ - -#define USB_LANGID_INIT(id) \ - 0x04, /* bLength */ \ - USB_DESCRIPTOR_TYPE_STRING, /* bDescriptorType */ \ - WBVAL(id) /* wLangID0 */ -// clang-format on - -#endif /* USB_DEF_H */ diff --git a/third-party/cherryusb/common/usb_errno.h b/third-party/cherryusb/common/usb_errno.h deleted file mode 100644 index f43a9896fb98c880a6caae95a2e374f65c9cb449..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/common/usb_errno.h +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Apache NuttX - * Copyright 2020 The Apache Software Foundation - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef __INCLUDE_ERRNO_H -#define __INCLUDE_ERRNO_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* Convenience/compatibility definition. If the errno is accessed from the - * internal OS code, then the OS code should use the set_errno() and - * get_errno(). Currently, those are just placeholders but would be needed - * in the KERNEL mode build in order to instantiate the process address - * environment as necessary to access the TLS-based errno variable. - */ - -/* Definitions of error numbers and the string that would be - * returned by strerror(). - */ -#ifndef CONFIG_USB_ERROR_USE_SYSTEM - -#define EPERM 1 -#define EPERM_STR "Operation not permitted" -#define ENOENT 2 -#define ENOENT_STR "No such file or directory" -#define ESRCH 3 -#define ESRCH_STR "No such process" -#define EINTR 4 -#define EINTR_STR "Interrupted system call" -#define EIO 5 -#define EIO_STR "I/O error" -#define ENXIO 6 -#define ENXIO_STR "No such device or address" -#define E2BIG 7 -#define E2BIG_STR "Arg list too long" -#define ENOEXEC 8 -#define ENOEXEC_STR "Exec format error" -#define EBADF 9 -#define EBADF_STR "Bad file number" -#define ECHILD 10 -#define ECHILD_STR "No child processes" -#define EAGAIN 11 -#define EWOULDBLOCK EAGAIN -#define EAGAIN_STR "Try again" -#define ENOMEM 12 -#define ENOMEM_STR "Out of memory" -#define EACCES 13 -#define EACCES_STR "Permission denied" -#define EFAULT 14 /* Linux errno extension */ -#define EFAULT_STR "Bad address" -#define ENOTBLK 15 -#define ENOTBLK_STR "Block device required" -#define EBUSY 16 -#define EBUSY_STR "Device or resource busy" -#define EEXIST 17 -#define EEXIST_STR "File exists" -#define EXDEV 18 -#define EXDEV_STR "Cross-device link" -#define ENODEV 19 -#define ENODEV_STR "No such device" -#define ENOTDIR 20 -#define ENOTDIR_STR "Not a directory" -#define EISDIR 21 -#define EISDIR_STR "Is a directory" -#define EINVAL 22 -#define EINVAL_STR "Invalid argument" -#define ENFILE 23 -#define ENFILE_STR "File table overflow" -#define EMFILE 24 -#define EMFILE_STR "Too many open files" -#define ENOTTY 25 -#define ENOTTY_STR "Not a typewriter" -#define ETXTBSY 26 -#define ETXTBSY_STR "Text file busy" -#define EFBIG 27 -#define EFBIG_STR "File too large" -#define ENOSPC 28 -#define ENOSPC_STR "No space left on device" -#define ESPIPE 29 -#define ESPIPE_STR "Illegal seek" -#define EROFS 30 -#define EROFS_STR "Read-only file system" -#define EMLINK 31 -#define EMLINK_STR "Too many links" -#define EPIPE 32 -#define EPIPE_STR "Broken pipe" -#define EDOM 33 -#define EDOM_STR "Math argument out of domain of func" -#define ERANGE 34 -#define ERANGE_STR "Math result not representable" -#define ENOMSG 35 -#define ENOMSG_STR "No message of desired type" -#define EIDRM 36 -#define EIDRM_STR "Identifier removed" -#define ECHRNG 37 /* Linux errno extension */ -#define ECHRNG_STR "Channel number out of range" -#define EL2NSYNC 38 /* Linux errno extension */ -#define EL2NSYNC_STR "Level 2 not synchronized" -#define EL3HLT 39 /* Linux errno extension */ -#define EL3HLT_STR "Level 3 halted" -#define EL3RST 40 /* Linux errno extension */ -#define EL3RST_STR "Level 3 reset" -#define ELNRNG 41 /* Linux errno extension */ -#define ELNRNG_STR "Link number out of range" -#define EUNATCH 42 /* Linux errno extension */ -#define EUNATCH_STR "Protocol driver not attached" -#define ENOCSI 43 /* Linux errno extension */ -#define ENOCSI_STR "No CSI structure available" -#define EL2HLT 44 /* Linux errno extension */ -#define EL2HLT_STR "Level 2 halted" -#define EDEADLK 45 -#define EDEADLK_STR "Resource deadlock would occur" -#define ENOLCK 46 -#define ENOLCK_STR "No record locks available" - -#define EBADE 50 /* Linux errno extension */ -#define EBADE_STR "Invalid exchange" -#define EBADR 51 /* Linux errno extension */ -#define EBADR_STR "Invalid request descriptor" -#define EXFULL 52 /* Linux errno extension */ -#define EXFULL_STR "Exchange full" -#define ENOANO 53 /* Linux errno extension */ -#define ENOANO_STR "No anode" -#define EBADRQC 54 /* Linux errno extension */ -#define EBADRQC_STR "Invalid request code" -#define EBADSLT 55 /* Linux errno extension */ -#define EBADSLT_STR "Invalid slot" -#define EDEADLOCK 56 /* Linux errno extension */ -#define EDEADLOCK_STR "File locking deadlock error" -#define EBFONT 57 /* Linux errno extension */ -#define EBFONT_STR "Bad font file format" - -#define ENOSTR 60 -#define ENOSTR_STR "Device not a stream" -#define ENODATA 61 -#define ENODATA_STR "No data available" -#define ETIME 62 -#define ETIME_STR "Timer expired" -#define ENOSR 63 -#define ENOSR_STR "Out of streams resources" -#define ENONET 64 /* Linux errno extension */ -#define ENONET_STR "Machine is not on the network" -#define ENOPKG 65 /* Linux errno extension */ -#define ENOPKG_STR "Package not installed" -#define EREMOTE 66 /* Linux errno extension */ -#define EREMOTE_STR "Object is remote" -#define ENOLINK 67 -#define ENOLINK_STR "Link has been severed" -#define EADV 68 /* Linux errno extension */ -#define EADV_STR "Advertise error" -#define ESRMNT 69 /* Linux errno extension */ -#define ESRMNT_STR "Srmount error" -#define ECOMM 70 /* Linux errno extension */ -#define ECOMM_STR "Communication error on send" -#define EPROTO 71 -#define EPROTO_STR "Protocol error" - -#define EMULTIHOP 74 -#define EMULTIHOP_STR "Multihop attempted" -#define ELBIN 75 /* Linux errno extension */ -#define ELBIN_STR "Inode is remote" -#define EDOTDOT 76 /* Linux errno extension */ -#define EDOTDOT_STR "RFS specific error" -#define EBADMSG 77 -#define EBADMSG_STR "Not a data message" - -#define EFTYPE 79 -#define EFTYPE_STR "Inappropriate file type or format" -#define ENOTUNIQ 80 /* Linux errno extension */ -#define ENOTUNIQ_STR "Name not unique on network" -#define EBADFD 81 /* Linux errno extension */ -#define EBADFD_STR "File descriptor in bad state" -#define EREMCHG 82 /* Linux errno extension */ -#define EREMCHG_STR "Remote address changed" -#define ELIBACC 83 /* Linux errno extension */ -#define ELIBACC_STR "Can not access a needed shared library" -#define ELIBBAD 84 /* Linux errno extension */ -#define ELIBBAD_STR "Accessing a corrupted shared library" -#define ELIBSCN 85 /* Linux errno extension */ -#define ELIBSCN_STR ".lib section in a.out corrupted" -#define ELIBMAX 86 /* Linux errno extension */ -#define ELIBMAX_STR "Attempting to link in too many shared libraries" -#define ELIBEXEC 87 /* Linux errno extension */ -#define ELIBEXEC_STR "Cannot exec a shared library directly" -#define ENOSYS 88 -#define ENOSYS_STR "Function not implemented" -#define ENMFILE 89 /* Cygwin */ -#define ENMFILE_STR "No more files" -#define ENOTEMPTY 90 -#define ENOTEMPTY_STR "Directory not empty" -#define ENAMETOOLONG 91 -#define ENAMETOOLONG_STR "File name too long" -#define ELOOP 92 -#define ELOOP_STR "Too many symbolic links encountered" - -#define EOPNOTSUPP 95 -#define EOPNOTSUPP_STR "Operation not supported on transport endpoint" -#define EPFNOSUPPORT 96 -#define EPFNOSUPPORT_STR "Protocol family not supported" - -#define ECONNRESET 104 -#define ECONNRESET_STR "Connection reset by peer" -#define ENOBUFS 105 -#define ENOBUFS_STR "No buffer space available" -#define EAFNOSUPPORT 106 -#define EAFNOSUPPORT_STR "Address family not supported by protocol" -#define EPROTOTYPE 107 -#define EPROTOTYPE_STR "Protocol wrong type for socket" -#define ENOTSOCK 108 -#define ENOTSOCK_STR "Socket operation on non-socket" -#define ENOPROTOOPT 109 -#define ENOPROTOOPT_STR "Protocol not available" -#define ESHUTDOWN 110 /* Linux errno extension */ -#define ESHUTDOWN_STR "Cannot send after transport endpoint shutdown" -#define ECONNREFUSED 111 -#define ECONNREFUSED_STR "Connection refused" -#define EADDRINUSE 112 -#define EADDRINUSE_STR "Address already in use" -#define ECONNABORTED 113 -#define ECONNABORTED_STR "Software caused connection abort" -#define ENETUNREACH 114 -#define ENETUNREACH_STR "Network is unreachable" -#define ENETDOWN 115 -#define ENETDOWN_STR "Network is down" -#define ETIMEDOUT 116 -#define ETIMEDOUT_STR "Connection timed out" -#define EHOSTDOWN 117 -#define EHOSTDOWN_STR "Host is down" -#define EHOSTUNREACH 118 -#define EHOSTUNREACH_STR "No route to host" -#define EINPROGRESS 119 -#define EINPROGRESS_STR "Operation now in progress" -#define EALREADY 120 -#define EALREADY_STR "Socket already connected" -#define EDESTADDRREQ 121 -#define EDESTADDRREQ_STR "Destination address required" -#define EMSGSIZE 122 -#define EMSGSIZE_STR "Message too long" -#define EPROTONOSUPPORT 123 -#define EPROTONOSUPPORT_STR "Protocol not supported" -#define ESOCKTNOSUPPORT 124 /* Linux errno extension */ -#define ESOCKTNOSUPPORT_STR "Socket type not supported" -#define EADDRNOTAVAIL 125 -#define EADDRNOTAVAIL_STR "Cannot assign requested address" -#define ENETRESET 126 -#define ENETRESET_STR "Network dropped connection because of reset" -#define EISCONN 127 -#define EISCONN_STR "Transport endpoint is already connected" -#define ENOTCONN 128 -#define ENOTCONN_STR "Transport endpoint is not connected" -#define ETOOMANYREFS 129 -#define ETOOMANYREFS_STR "Too many references: cannot splice" -#define EPROCLIM 130 -#define EPROCLIM_STR "Limit would be exceeded by attempted fork" -#define EUSERS 131 -#define EUSERS_STR "Too many users" -#define EDQUOT 132 -#define EDQUOT_STR "Quota exceeded" -#define ESTALE 133 -#define ESTALE_STR "Stale NFS file handle" -#define ENOTSUP 134 -#define ENOTSUP_STR "Not supported" -#define ENOMEDIUM 135 /* Linux errno extension */ -#define ENOMEDIUM_STR "No medium found" -#define ENOSHARE 136 /* Cygwin */ -#define ENOSHARE_STR "No such host or network path" -#define ECASECLASH 137 /* Cygwin */ -#define ECASECLASH_STR "Filename exists with different case" -#define EILSEQ 138 -#define EILSEQ_STR "Illegal byte sequence" -#define EOVERFLOW 139 -#define EOVERFLOW_STR "Value too large for defined data type" -#define ECANCELED 140 -#define ECANCELED_STR "Operation cancelled" -#define ENOTRECOVERABLE 141 -#define ENOTRECOVERABLE_STR "State not recoverable" -#define EOWNERDEAD 142 -#define EOWNERDEAD_STR "Previous owner died" -#define ESTRPIPE 143 /* Linux errno extension */ -#define ESTRPIPE_STR "Streams pipe error" - -#define __ELASTERROR 2000 /* Users can add values starting here */ -#else -#include -#endif -/**************************************************************************** - * Public Type Definitions - ****************************************************************************/ - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -/* Return a pointer to the thread specific errno. */ - -int *__errno(void); - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_ERRNO_H */ diff --git a/third-party/cherryusb/common/usb_hc.h b/third-party/cherryusb/common/usb_hc.h deleted file mode 100644 index 4f23f33c1e6c5e2792a6868041df704c29a7c542..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/common/usb_hc.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_HC_H -#define USB_HC_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void (*usbh_complete_callback_t)(void *arg, int nbytes); -typedef void *usbh_pipe_t; - -struct usbh_bus; - -/** - * @brief USB Endpoint Configuration. - * - * Structure containing the USB endpoint configuration. - */ -struct usbh_endpoint_cfg { - struct usbh_hubport *hport; - uint8_t ep_addr; /* Endpoint addr with direction */ - uint8_t ep_type; /* Endpoint type */ - uint16_t ep_mps; /* Endpoint max packet size */ - uint8_t ep_interval; /* Endpoint interval */ - uint8_t mult; /* Endpoint additional transcation */ -}; - -/** - * @brief USB Iso Configuration. - * - * Structure containing the USB Iso configuration. - */ -struct usbh_iso_frame_packet { - uint8_t *transfer_buffer; - uint32_t transfer_buffer_length; - uint32_t actual_length; - int errorcode; -}; - -/** - * @brief USB Urb Configuration. - * - * Structure containing the USB Urb configuration. - */ -struct usbh_urb { - usbh_pipe_t pipe; - struct usb_setup_packet *setup; - uint8_t *transfer_buffer; - uint32_t transfer_buffer_length; - int transfer_flags; - uint32_t actual_length; - uint32_t timeout; - int errorcode; - uint32_t num_of_iso_packets; - uint32_t start_frame; - usbh_complete_callback_t complete; - void *arg; - struct usbh_iso_frame_packet iso_packet[0]; -}; - -/** - * @brief usb host controller hardware init. - * - * @return On success will return 0, and others indicate fail. - */ -int usb_hc_init(uint32_t id); - -/** - * @brief Get frame number. - * - * @return frame number. - */ -uint16_t usbh_get_frame_number(void); -/** - * @brief control roothub. - * - * @param usb usb bus instance - * @param setup setup request buffer. - * @param buf buf for reading response or write data. - * @return On success will return 0, and others indicate fail. - */ -int usbh_roothub_control(struct usbh_bus *usb, struct usb_setup_packet *setup, uint8_t *buf); - -/** - * @brief reconfig endpoint pipe. - * - * @param pipe A memory allocated for pipe. - * @param dev_addr device address. - * @param ep_mps endpoint max packet size. - * @param mult endpoint additional transcation - * @return On success will return 0, and others indicate fail. - */ -int usbh_ep_pipe_reconfigure(struct usbh_bus *usb, usbh_pipe_t pipe, uint8_t dev_addr, uint8_t ep_mps, uint8_t mult); - -/** - * @brief Allocate pipe for endpoint - * - * @param pipe A memory location provided by the caller in which to save the allocated pipe. - * @param ep_cfg Describes the endpoint info to be allocated. - * @return On success will return 0, and others indicate fail. - */ -int usbh_pipe_alloc(usbh_pipe_t *pipe, const struct usbh_endpoint_cfg *ep_cfg); - -/** - * @brief Free a pipe in which saves endpoint info. - * - * @param pipe A memory location provided by the caller in which to free the allocated endpoint info. - * @return On success will return 0, and others indicate fail. - */ -int usbh_pipe_free(usbh_pipe_t pipe); - -/** - * @brief Submit a usb transfer request to an endpoint. - * - * If timeout is not zero, this function will be in poll transfer mode, - * otherwise will be in async transfer mode. - * - * @param urb Usb request block. - * @return On success will return 0, and others indicate fail. - */ -int usbh_submit_urb(struct usbh_urb *urb); - -/** - * @brief Cancel a transfer request. - * - * This function will call When calls usbh_submit_urb and return -ETIMEOUT or -ESHUTDOWN. - * - * @param urb Usb request block. - * @return On success will return 0, and others indicate fail. - */ -int usbh_kill_urb(struct usbh_urb *urb); - -#ifdef __cplusplus -} -#endif - -#endif /* USB_HC_H */ diff --git a/third-party/cherryusb/common/usb_list.h b/third-party/cherryusb/common/usb_list.h deleted file mode 100644 index 3078a1f24e781e9a4a54953b0497e1004cb2d0a3..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/common/usb_list.h +++ /dev/null @@ -1,459 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_LIST_H -#define USB_LIST_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * usb_container_of - return the member address of ptr, if the type of ptr is the - * struct type. - */ -#define usb_container_of(ptr, type, member) \ - ((type *)((char *)(ptr) - (unsigned long)(&((type *)0)->member))) - -/** - * Single List structure - */ -struct usb_slist_node { - struct usb_slist_node *next; /**< point to next node. */ -}; -typedef struct usb_slist_node usb_slist_t; /**< Type for single list. */ - -/** - * @brief initialize a single list - * - * @param l the single list to be initialized - */ -static inline void usb_slist_init(usb_slist_t *l) -{ - l->next = NULL; -} - -static inline void usb_slist_add_head(usb_slist_t *l, usb_slist_t *n) -{ - n->next = l->next; - l->next = n; -} - -static inline void usb_slist_add_tail(usb_slist_t *l, usb_slist_t *n) -{ - usb_slist_t *tmp = l; - - while (tmp->next) { - tmp = tmp->next; - } - - /* append the node to the tail */ - tmp->next = n; - n->next = NULL; -} - -static inline void usb_slist_insert(usb_slist_t *l, usb_slist_t *next, usb_slist_t *n) -{ - if (!next) { - usb_slist_add_tail(next, l); - return; - } - - while (l->next) { - if (l->next == next) { - l->next = n; - n->next = next; - } - - l = l->next; - } -} - -static inline usb_slist_t *usb_slist_remove(usb_slist_t *l, usb_slist_t *n) -{ - usb_slist_t *tmp = l; - /* remove slist head */ - while (tmp->next && tmp->next != n) { - tmp = tmp->next; - } - - /* remove node */ - if (tmp->next != (usb_slist_t *)0) { - tmp->next = tmp->next->next; - } - - return l; -} - -static inline unsigned int usb_slist_len(const usb_slist_t *l) -{ - unsigned int len = 0; - const usb_slist_t *list = l->next; - - while (list != NULL) { - list = list->next; - len++; - } - - return len; -} - -static inline unsigned int usb_slist_contains(usb_slist_t *l, usb_slist_t *n) -{ - while (l->next) { - if (l->next == n) { - return 0; - } - - l = l->next; - } - - return 1; -} - -static inline usb_slist_t *usb_slist_head(usb_slist_t *l) -{ - return l->next; -} - -static inline usb_slist_t *usb_slist_tail(usb_slist_t *l) -{ - while (l->next) { - l = l->next; - } - - return l; -} - -static inline usb_slist_t *usb_slist_next(usb_slist_t *n) -{ - return n->next; -} - -static inline int usb_slist_isempty(usb_slist_t *l) -{ - return l->next == NULL; -} - -/** - * @brief initialize a slist object - */ -#define USB_SLIST_OBJECT_INIT(object) \ - { \ - NULL \ - } - -/** - * @brief initialize a slist object - */ -#define USB_SLIST_DEFINE(slist) \ - usb_slist_t slist = { NULL } - -/** - * @brief get the struct for this single list node - * @param node the entry point - * @param type the type of structure - * @param member the name of list in structure - */ -#define usb_slist_entry(node, type, member) \ - usb_container_of(node, type, member) - -/** - * usb_slist_first_entry - get the first element from a slist - * @ptr: the slist head to take the element from. - * @type: the type of the struct this is embedded in. - * @member: the name of the slist_struct within the struct. - * - * Note, that slist is expected to be not empty. - */ -#define usb_slist_first_entry(ptr, type, member) \ - usb_slist_entry((ptr)->next, type, member) - -/** - * usb_slist_tail_entry - get the tail element from a slist - * @ptr: the slist head to take the element from. - * @type: the type of the struct this is embedded in. - * @member: the name of the slist_struct within the struct. - * - * Note, that slist is expected to be not empty. - */ -#define usb_slist_tail_entry(ptr, type, member) \ - usb_slist_entry(usb_slist_tail(ptr), type, member) - -/** - * usb_slist_first_entry_or_null - get the first element from a slist - * @ptr: the slist head to take the element from. - * @type: the type of the struct this is embedded in. - * @member: the name of the slist_struct within the struct. - * - * Note, that slist is expected to be not empty. - */ -#define usb_slist_first_entry_or_null(ptr, type, member) \ - (usb_slist_isempty(ptr) ? NULL : usb_slist_first_entry(ptr, type, member)) - -/** - * usb_slist_for_each - iterate over a single list - * @pos: the usb_slist_t * to use as a loop cursor. - * @head: the head for your single list. - */ -#define usb_slist_for_each(pos, head) \ - for (pos = (head)->next; pos != NULL; pos = pos->next) - -#define usb_slist_for_each_safe(pos, next, head) \ - for (pos = (head)->next, next = pos->next; pos; \ - pos = next, next = pos->next) - -/** - * usb_slist_for_each_entry - iterate over single list of given type - * @pos: the type * to use as a loop cursor. - * @head: the head for your single list. - * @member: the name of the list_struct within the struct. - */ -#define usb_slist_for_each_entry(pos, head, member) \ - for (pos = usb_slist_entry((head)->next, typeof(*pos), member); \ - &pos->member != (NULL); \ - pos = usb_slist_entry(pos->member.next, typeof(*pos), member)) - -#define usb_slist_for_each_entry_safe(pos, n, head, member) \ - for (pos = usb_slist_entry((head)->next, typeof(*pos), member), \ - n = usb_slist_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (NULL); \ - pos = n, n = usb_slist_entry(pos->member.next, typeof(*pos), member)) - -/** - * Double List structure - */ -struct usb_dlist_node { - struct usb_dlist_node *next; /**< point to next node. */ - struct usb_dlist_node *prev; /**< point to prev node. */ -}; -typedef struct usb_dlist_node usb_dlist_t; /**< Type for lists. */ - -/** - * @brief initialize a list - * - * @param l list to be initialized - */ -static inline void usb_dlist_init(usb_dlist_t *l) -{ - l->next = l->prev = l; -} - -/** - * @brief insert a node after a list - * - * @param l list to insert it - * @param n new node to be inserted - */ -static inline void usb_dlist_insert_after(usb_dlist_t *l, usb_dlist_t *n) -{ - l->next->prev = n; - n->next = l->next; - - l->next = n; - n->prev = l; -} - -/** - * @brief insert a node before a list - * - * @param n new node to be inserted - * @param l list to insert it - */ -static inline void usb_dlist_insert_before(usb_dlist_t *l, usb_dlist_t *n) -{ - l->prev->next = n; - n->prev = l->prev; - - l->prev = n; - n->next = l; -} - -/** - * @brief remove node from list. - * @param n the node to remove from the list. - */ -static inline void usb_dlist_remove(usb_dlist_t *n) -{ - n->next->prev = n->prev; - n->prev->next = n->next; - - n->next = n->prev = n; -} - -/** - * @brief move node from list. - * @param n the node to remove from the list. - */ -static inline void usb_dlist_move_head(usb_dlist_t *l, usb_dlist_t *n) -{ - usb_dlist_remove(n); - usb_dlist_insert_after(l, n); -} - -/** - * @brief move node from list. - * @param n the node to remove from the list. - */ -static inline void usb_dlist_move_tail(usb_dlist_t *l, usb_dlist_t *n) -{ - usb_dlist_remove(n); - usb_dlist_insert_before(l, n); -} - -/** - * @brief tests whether a list is empty - * @param l the list to test. - */ -static inline int usb_dlist_isempty(const usb_dlist_t *l) -{ - return l->next == l; -} - -/** - * @brief get the list length - * @param l the list to get. - */ -static inline unsigned int usb_dlist_len(const usb_dlist_t *l) -{ - unsigned int len = 0; - const usb_dlist_t *p = l; - - while (p->next != l) { - p = p->next; - len++; - } - - return len; -} - -/** - * @brief initialize a dlist object - */ -#define USB_DLIST_OBJECT_INIT(object) \ - { \ - &(object), &(object) \ - } -/** - * @brief initialize a dlist object - */ -#define USB_DLIST_DEFINE(list) \ - usb_dlist_t list = { &(list), &(list) } - -/** - * @brief get the struct for this entry - * @param node the entry point - * @param type the type of structure - * @param member the name of list in structure - */ -#define usb_dlist_entry(node, type, member) \ - usb_container_of(node, type, member) - -/** - * dlist_first_entry - get the first element from a list - * @ptr: the list head to take the element from. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - * - * Note, that list is expected to be not empty. - */ -#define usb_dlist_first_entry(ptr, type, member) \ - usb_dlist_entry((ptr)->next, type, member) -/** - * dlist_first_entry_or_null - get the first element from a list - * @ptr: the list head to take the element from. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - * - * Note, that list is expected to be not empty. - */ -#define usb_dlist_first_entry_or_null(ptr, type, member) \ - (usb_dlist_isempty(ptr) ? NULL : usb_dlist_first_entry(ptr, type, member)) - -/** - * usb_dlist_for_each - iterate over a list - * @pos: the usb_dlist_t * to use as a loop cursor. - * @head: the head for your list. - */ -#define usb_dlist_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - -/** - * usb_dlist_for_each_prev - iterate over a list - * @pos: the dlist_t * to use as a loop cursor. - * @head: the head for your list. - */ -#define usb_dlist_for_each_prev(pos, head) \ - for (pos = (head)->prev; pos != (head); pos = pos->prev) - -/** - * usb_dlist_for_each_safe - iterate over a list safe against removal of list entry - * @pos: the dlist_t * to use as a loop cursor. - * @n: another dlist_t * to use as temporary storage - * @head: the head for your list. - */ -#define usb_dlist_for_each_safe(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, n = pos->next) - -#define usb_dlist_for_each_prev_safe(pos, n, head) \ - for (pos = (head)->prev, n = pos->prev; pos != (head); \ - pos = n, n = pos->prev) -/** - * usb_dlist_for_each_entry - iterate over list of given type - * @pos: the type * to use as a loop cursor. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define usb_dlist_for_each_entry(pos, head, member) \ - for (pos = usb_dlist_entry((head)->next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = usb_dlist_entry(pos->member.next, typeof(*pos), member)) - -/** - * usb_usb_dlist_for_each_entry_reverse - iterate over list of given type - * @pos: the type * to use as a loop cursor. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define usb_dlist_for_each_entry_reverse(pos, head, member) \ - for (pos = usb_dlist_entry((head)->prev, typeof(*pos), member); \ - &pos->member != (head); \ - pos = usb_dlist_entry(pos->member.prev, typeof(*pos), member)) - -/** - * usb_usb_dlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry - * @pos: the type * to use as a loop cursor. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define usb_dlist_for_each_entry_safe(pos, n, head, member) \ - for (pos = usb_dlist_entry((head)->next, typeof(*pos), member), \ - n = usb_dlist_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = usb_dlist_entry(n->member.next, typeof(*n), member)) - -/** - * usb_usb_dlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry - * @pos: the type * to use as a loop cursor. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define usb_dlist_for_each_entry_safe_reverse(pos, n, head, member) \ - for (pos = usb_dlist_entry((head)->prev, typeof(*pos), field), \ - n = usb_dlist_entry(pos->member.prev, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = usb_dlist_entry(pos->member.prev, typeof(*pos), member)) - -#ifdef __cplusplus -} -#endif - -#endif /* USB_LIST_H */ diff --git a/third-party/cherryusb/common/usb_log.h b/third-party/cherryusb/common/usb_log.h deleted file mode 100644 index 283c9527c1c20e901afc697ae68772ccacca3b9e..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/common/usb_log.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_LOG_H -#define USB_LOG_H - -#include - -/* DEBUG level */ -#define USB_DBG_ERROR 0 -#define USB_DBG_WARNING 1 -#define USB_DBG_INFO 2 -#define USB_DBG_LOG 3 - -#ifndef USB_DBG_TAG -#define USB_DBG_TAG "USB" -#endif -/* - * The color for terminal (foreground) - * BLACK 30 - * RED 31 - * GREEN 32 - * YELLOW 33 - * BLUE 34 - * PURPLE 35 - * CYAN 36 - * WHITE 37 - */ - -#ifdef CONFIG_USB_PRINTF_COLOR_ENABLE -#define _USB_DBG_COLOR(n) CONFIG_USB_PRINTF("\033[" #n "m") -#define _USB_DBG_LOG_HDR(lvl_name, color_n) \ - CONFIG_USB_PRINTF("\033[" #color_n "m[" lvl_name "/" USB_DBG_TAG "] ") -#define _USB_DBG_LOG_X_END \ - CONFIG_USB_PRINTF("\033[0m") -#else -#define _USB_DBG_COLOR(n) -#define _USB_DBG_LOG_HDR(lvl_name, color_n) \ - CONFIG_USB_PRINTF("[" lvl_name "/" USB_DBG_TAG "] ") -#define _USB_DBG_LOG_X_END -#endif - -#define usb_dbg_log_line(lvl, color_n, fmt, ...) \ - do { \ - _USB_DBG_LOG_HDR(lvl, color_n); \ - CONFIG_USB_PRINTF(fmt, ##__VA_ARGS__); \ - _USB_DBG_LOG_X_END; \ - } while (0) - -#if (CONFIG_USB_DBG_LEVEL >= USB_DBG_LOG) -#define USB_LOG_DBG(fmt, ...) usb_dbg_log_line("D", 0, fmt, ##__VA_ARGS__) -#else -#define USB_LOG_DBG(...) {} -#endif - -#if (CONFIG_USB_DBG_LEVEL >= USB_DBG_INFO) -#define USB_LOG_INFO(fmt, ...) usb_dbg_log_line("I", 32, fmt, ##__VA_ARGS__) -#else -#define USB_LOG_INFO(...) {} -#endif - -#if (CONFIG_USB_DBG_LEVEL >= USB_DBG_WARNING) -#define USB_LOG_WRN(fmt, ...) usb_dbg_log_line("W", 33, fmt, ##__VA_ARGS__) -#else -#define USB_LOG_WRN(...) {} -#endif - -#if (CONFIG_USB_DBG_LEVEL >= USB_DBG_ERROR) -#define USB_LOG_ERR(fmt, ...) usb_dbg_log_line("E", 31, fmt, ##__VA_ARGS__) -#else -#define USB_LOG_ERR(...) {} -#endif - -#define USB_LOG_RAW(...) CONFIG_USB_PRINTF(__VA_ARGS__) - -void usb_assert(const char *filename, int linenum); -#define USB_ASSERT(f) \ - do { \ - if (!(f)) \ - usb_assert(__FILE__, __LINE__); \ - } while (0) - -#endif /* USB_LOG_H */ \ No newline at end of file diff --git a/third-party/cherryusb/common/usb_mem.h b/third-party/cherryusb/common/usb_mem.h deleted file mode 100644 index 77a82bb8752ec988bf3df3b7e386329d97b33b5b..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/common/usb_mem.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_MEM_H -#define USB_MEM_H - -#define USB_MEM_ALIGNX __attribute__((aligned(CONFIG_USB_ALIGN_SIZE))) - -#if (CONFIG_USB_ALIGN_SIZE > 4) -static inline void *usb_iomalloc(size_t size) -{ - void *ptr; - void *align_ptr; - int uintptr_size; - size_t align_size; - uint32_t align = CONFIG_USB_ALIGN_SIZE; - - /* sizeof pointer */ - uintptr_size = sizeof(void *); - uintptr_size -= 1; - - /* align the alignment size to uintptr size byte */ - align = ((align + uintptr_size) & ~uintptr_size); - - /* get total aligned size */ - align_size = ((size + uintptr_size) & ~uintptr_size) + align; - /* allocate memory block from heap */ - ptr = usb_malloc(align_size); - if (ptr != NULL) { - /* the allocated memory block is aligned */ - if (((unsigned long)ptr & (align - 1)) == 0) { - align_ptr = (void *)((unsigned long)ptr + align); - } else { - align_ptr = (void *)(((unsigned long)ptr + (align - 1)) & ~(align - 1)); - } - - /* set the pointer before alignment pointer to the real pointer */ - *((unsigned long *)((unsigned long)align_ptr - sizeof(void *))) = (unsigned long)ptr; - - ptr = align_ptr; - } - - return ptr; -} - -static inline void usb_iofree(void *ptr) -{ - void *real_ptr; - - real_ptr = (void *)*(unsigned long *)((unsigned long)ptr - sizeof(void *)); - usb_free(real_ptr); -} -#else -#define usb_iomalloc(size) usb_malloc(size) -#define usb_iofree(ptr) usb_free(ptr) -#endif - -#endif /* USB_MEM_H */ diff --git a/third-party/cherryusb/common/usb_util.h b/third-party/cherryusb/common/usb_util.h deleted file mode 100644 index f19c507927525441626f025b5e8770173481ca31..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/common/usb_util.h +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_UTIL_H -#define USB_UTIL_H - -#if defined(__CC_ARM) -#ifndef __USED -#define __USED __attribute__((used)) -#endif -#ifndef __WEAK -#define __WEAK __attribute__((weak)) -#endif -#ifndef __PACKED -#define __PACKED __attribute__((packed)) -#endif -#ifndef __PACKED_STRUCT -#define __PACKED_STRUCT __packed struct -#endif -#ifndef __PACKED_UNION -#define __PACKED_UNION __packed union -#endif -#ifndef __ALIGNED -#define __ALIGNED(x) __attribute__((aligned(x))) -#endif -#elif defined(__GNUC__) -#ifndef __USED -#define __USED __attribute__((used)) -#endif -#ifndef __WEAK -#define __WEAK __attribute__((weak)) -#endif -#ifndef __PACKED -#define __PACKED __attribute__((packed, aligned(1))) -#endif -#ifndef __PACKED_STRUCT -#define __PACKED_STRUCT struct __attribute__((packed, aligned(1))) -#endif -#ifndef __PACKED_UNION -#define __PACKED_UNION union __attribute__((packed, aligned(1))) -#endif -#ifndef __ALIGNED -#define __ALIGNED(x) __attribute__((aligned(x))) -#endif -#elif defined(__ICCARM__) || defined(__ICCRX__) -#ifndef __USED -#if __ICCARM_V8 -#define __USED __attribute__((used)) -#else -#define __USED __root -#endif -#endif - -#ifndef __WEAK -#if __ICCARM_V8 -#define __WEAK __attribute__((weak)) -#else -#define __WEAK _Pragma("__weak") -#endif -#endif - -#ifndef __PACKED -#if __ICCARM_V8 -#define __PACKED __attribute__((packed, aligned(1))) -#else -/* Needs IAR language extensions */ -#define __PACKED __packed -#endif -#endif - -#ifndef __PACKED_STRUCT -#if __ICCARM_V8 -#define __PACKED_STRUCT struct __attribute__((packed, aligned(1))) -#else -/* Needs IAR language extensions */ -#define __PACKED_STRUCT __packed struct -#endif -#endif - -#ifndef __PACKED_UNION -#if __ICCARM_V8 -#define __PACKED_UNION union __attribute__((packed, aligned(1))) -#else -/* Needs IAR language extensions */ -#define __PACKED_UNION __packed union -#endif -#endif - -#ifndef __ALIGNED -#if __ICCARM_V8 -#define __ALIGNED(x) __attribute__((aligned(x))) -#elif (__VER__ >= 7080000) -/* Needs IAR language extensions */ -#define __ALIGNED(x) __attribute__((aligned(x))) -#else -#warning No compiler specific solution for __ALIGNED.__ALIGNED is ignored. -#define __ALIGNED(x) -#endif -#endif - -#endif - -#ifndef __ALIGN_BEGIN -#define __ALIGN_BEGIN -#endif -#ifndef __ALIGN_END -#define __ALIGN_END __attribute__((aligned(4))) -#endif - -#ifndef ARG_UNUSED -#define ARG_UNUSED(x) (void)(x) -#endif - -#ifndef LO_BYTE -#define LO_BYTE(x) ((uint8_t)(x & 0x00FF)) -#endif - -#ifndef HI_BYTE -#define HI_BYTE(x) ((uint8_t)((x & 0xFF00) >> 8)) -#endif - -#ifndef MAX -#define MAX(a, b) (((a) > (b)) ? (a) : (b)) -#endif - -#ifndef MIN -#define MIN(a, b) (((a) < (b)) ? (a) : (b)) -#endif - -#ifndef BCD -#define BCD(x) ((((x) / 10) << 4) | ((x) % 10)) -#endif - -#ifdef BIT -#undef BIT -#define BIT(n) (1UL << (n)) -#else -#define BIT(n) (1UL << (n)) -#endif - -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) \ - ((int)((sizeof(array) / sizeof((array)[0])))) -#endif - -#ifndef BSWAP16 -#define BSWAP16(u16) (__builtin_bswap16(u16)) -#endif -#ifndef BSWAP32 -#define BSWAP32(u32) (__builtin_bswap32(u32)) -#endif - -#define GET_BE16(field) \ - (((uint16_t)(field)[0] << 8) | ((uint16_t)(field)[1])) - -#define GET_BE32(field) \ - (((uint32_t)(field)[0] << 24) | ((uint32_t)(field)[1] << 16) | ((uint32_t)(field)[2] << 8) | ((uint32_t)(field)[3] << 0)) - -#define SET_BE16(field, value) \ - do { \ - (field)[0] = (uint8_t)((value) >> 8); \ - (field)[1] = (uint8_t)((value) >> 0); \ - } while (0) - -#define SET_BE24(field, value) \ - do { \ - (field)[0] = (uint8_t)((value) >> 16); \ - (field)[1] = (uint8_t)((value) >> 8); \ - (field)[2] = (uint8_t)((value) >> 0); \ - } while (0) - -#define SET_BE32(field, value) \ - do { \ - (field)[0] = (uint8_t)((value) >> 24); \ - (field)[1] = (uint8_t)((value) >> 16); \ - (field)[2] = (uint8_t)((value) >> 8); \ - (field)[3] = (uint8_t)((value) >> 0); \ - } while (0) - -#define WBVAL(x) (x & 0xFF), ((x >> 8) & 0xFF) -#define DBVAL(x) (x & 0xFF), ((x >> 8) & 0xFF), ((x >> 16) & 0xFF), ((x >> 24) & 0xFF) - -#define PP_NARG(...) \ - PP_NARG_(__VA_ARGS__, PP_RSEQ_N()) -#define PP_NARG_(...) \ - PP_ARG_N(__VA_ARGS__) -#define PP_ARG_N( \ - _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \ - _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, \ - _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, \ - _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, \ - _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, \ - _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, \ - _61, _62, _63, N, ...) N -#define PP_RSEQ_N() \ - 63, 62, 61, 60, \ - 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, \ - 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, \ - 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, \ - 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, \ - 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, \ - 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 - -#endif /* USB_UTIL_H */ diff --git a/third-party/cherryusb/core/usbd_core.c b/third-party/cherryusb/core/usbd_core.c deleted file mode 100644 index 1afd52a6cf8009e2094af24e011ae4a020e6a0ee..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/core/usbd_core.c +++ /dev/null @@ -1,1302 +0,0 @@ -/* - * Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) - * Copyright (c) 2016 Intel Corporation - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbd_core.h" -#if defined(CONFIG_USBDEV_TX_THREAD) || defined(CONFIG_USBDEV_RX_THREAD) -#include "usb_osal.h" -#endif - -/* general descriptor field offsets */ -#define DESC_bLength 0 /** Length offset */ -#define DESC_bDescriptorType 1 /** Descriptor type offset */ - -/* config descriptor field offsets */ -#define CONF_DESC_wTotalLength 2 /** Total length offset */ -#define CONF_DESC_bConfigurationValue 5 /** Configuration value offset */ -#define CONF_DESC_bmAttributes 7 /** configuration characteristics */ - -/* interface descriptor field offsets */ -#define INTF_DESC_bInterfaceNumber 2 /** Interface number offset */ -#define INTF_DESC_bAlternateSetting 3 /** Alternate setting offset */ - -#define USB_EP_OUT_NUM 8 -#define USB_EP_IN_NUM 8 - -struct usbd_tx_rx_msg { - uint8_t ep; - uint32_t nbytes; - usbd_endpoint_callback cb; -}; - -USB_NOCACHE_RAM_SECTION struct usbd_core_cfg_priv { - /** Setup packet */ - USB_MEM_ALIGNX struct usb_setup_packet setup; - /** Pointer to data buffer */ - uint8_t *ep0_data_buf; - /** Remaining bytes in buffer */ - uint32_t ep0_data_buf_residue; - /** Total length of control transfer */ - uint32_t ep0_data_buf_len; - /** Zero length packet flag of control transfer */ - bool zlp_flag; - /** Pointer to registered descriptors */ -#ifdef CONFIG_USBDEV_ADVANCE_DESC - struct usb_descriptor *descriptors; -#else - const uint8_t *descriptors; -#endif - /* Buffer used for storing standard, class and vendor request data */ - USB_MEM_ALIGNX uint8_t req_data[CONFIG_USBDEV_REQUEST_BUFFER_LEN]; - - /** Variable to check whether the usb has been configured */ - bool configured; - /** Currently selected configuration */ - uint8_t configuration; - uint8_t speed; -#ifdef CONFIG_USBDEV_TEST_MODE - bool test_mode; -#endif - uint8_t intf_offset; -} usbd_core_cfg; - -usb_slist_t usbd_intf_head = USB_SLIST_OBJECT_INIT(usbd_intf_head); - -static struct usb_msosv1_descriptor *msosv1_desc; -static struct usb_msosv2_descriptor *msosv2_desc; -static struct usb_bos_descriptor *bos_desc; - -struct usbd_tx_rx_msg tx_msg[USB_EP_IN_NUM]; -struct usbd_tx_rx_msg rx_msg[USB_EP_OUT_NUM]; - -#if defined(CONFIG_USBDEV_TX_THREAD) -usb_osal_mq_t usbd_tx_mq; -usb_osal_thread_t usbd_tx_thread; -#endif -#if defined(CONFIG_USBDEV_RX_THREAD) -usb_osal_mq_t usbd_rx_mq; -usb_osal_thread_t usbd_rx_thread; -#endif - -static void usbd_class_event_notify_handler(uint8_t event, void *arg); - -static void usbd_print_setup(struct usb_setup_packet *setup) -{ - USB_LOG_INFO("Setup: " - "bmRequestType 0x%02x, bRequest 0x%02x, wValue 0x%04x, wIndex 0x%04x, wLength 0x%04x\r\n", - setup->bmRequestType, - setup->bRequest, - setup->wValue, - setup->wIndex, - setup->wLength); -} - -static bool is_device_configured(void) -{ - return (usbd_core_cfg.configuration != 0); -} - -/** - * @brief configure and enable endpoint - * - * This function sets endpoint configuration according to one specified in USB - * endpoint descriptor and then enables it for data transfers. - * - * @param [in] ep_desc Endpoint descriptor byte array - * - * @return true if successfully configured and enabled - */ -static bool usbd_set_endpoint(const struct usb_endpoint_descriptor *ep_desc) -{ - struct usbd_endpoint_cfg ep_cfg; - - ep_cfg.ep_addr = ep_desc->bEndpointAddress; - ep_cfg.ep_mps = ep_desc->wMaxPacketSize & USB_MAXPACKETSIZE_MASK; - ep_cfg.ep_type = ep_desc->bmAttributes & USB_ENDPOINT_TYPE_MASK; - - USB_LOG_INFO("Open ep:0x%02x type:%u mps:%u\r\n", - ep_cfg.ep_addr, ep_cfg.ep_type, ep_cfg.ep_mps); - - return usbd_ep_open(&ep_cfg) == 0 ? true : false; -} -/** - * @brief Disable endpoint for transferring data - * - * This function cancels transfers that are associated with endpoint and - * disabled endpoint itself. - * - * @param [in] ep_desc Endpoint descriptor byte array - * - * @return true if successfully deconfigured and disabled - */ -static bool usbd_reset_endpoint(const struct usb_endpoint_descriptor *ep_desc) -{ - struct usbd_endpoint_cfg ep_cfg; - - ep_cfg.ep_addr = ep_desc->bEndpointAddress; - ep_cfg.ep_mps = ep_desc->wMaxPacketSize & USB_MAXPACKETSIZE_MASK; - ep_cfg.ep_type = ep_desc->bmAttributes & USB_ENDPOINT_TYPE_MASK; - - USB_LOG_INFO("Close ep:0x%02x type:%u\r\n", - ep_cfg.ep_addr, ep_cfg.ep_type); - - return usbd_ep_close(ep_cfg.ep_addr) == 0 ? true : false; -} - -/** - * @brief get specified USB descriptor - * - * This function parses the list of installed USB descriptors and attempts - * to find the specified USB descriptor. - * - * @param [in] type_index Type and index of the descriptor - * @param [out] data Descriptor data - * @param [out] len Descriptor length - * - * @return true if the descriptor was found, false otherwise - */ -#ifdef CONFIG_USBDEV_ADVANCE_DESC -static bool usbd_get_descriptor(uint16_t type_index, uint8_t **data, uint32_t *len) -{ - uint8_t type = 0U; - uint8_t index = 0U; - bool found = true; - uint8_t str_len = 0; - - type = HI_BYTE(type_index); - index = LO_BYTE(type_index); - - switch (type) { - case USB_DESCRIPTOR_TYPE_DEVICE: - *data = (uint8_t *)usbd_core_cfg.descriptors->device_descriptor; - *len = usbd_core_cfg.descriptors->device_descriptor[0]; - break; - case USB_DESCRIPTOR_TYPE_CONFIGURATION: - usbd_core_cfg.speed = usbd_get_port_speed(0); - if (usbd_core_cfg.speed == USB_SPEED_HIGH) { - if (usbd_core_cfg.descriptors->hs_config_descriptor) { - *data = (uint8_t *)usbd_core_cfg.descriptors->hs_config_descriptor; - *len = (usbd_core_cfg.descriptors->hs_config_descriptor[CONF_DESC_wTotalLength] | - (usbd_core_cfg.descriptors->hs_config_descriptor[CONF_DESC_wTotalLength + 1] << 8)); - } else { - found = false; - } - } else { - if (usbd_core_cfg.descriptors->fs_config_descriptor) { - *data = (uint8_t *)usbd_core_cfg.descriptors->fs_config_descriptor; - *len = (usbd_core_cfg.descriptors->fs_config_descriptor[CONF_DESC_wTotalLength] | - (usbd_core_cfg.descriptors->fs_config_descriptor[CONF_DESC_wTotalLength + 1] << 8)); - } else { - found = false; - } - } - - break; - case USB_DESCRIPTOR_TYPE_STRING: - if (index == USB_STRING_LANGID_INDEX) { - (*data)[0] = 0x04; - (*data)[1] = 0x03; - (*data)[2] = 0x09; - (*data)[3] = 0x04; - *len = 4; - } else if (index == USB_OSDESC_STRING_DESC_INDEX) { - if (usbd_core_cfg.descriptors->msosv1_descriptor) { - USB_LOG_INFO("read MS OS 1.0 descriptor string\r\n"); - *data = usbd_core_cfg.descriptors->msosv1_descriptor->string; - *len = usbd_core_cfg.descriptors->msosv1_descriptor->string_len; - } else { - } - } else { - if (usbd_core_cfg.descriptors->string_descriptor[index - 1]) { - str_len = strlen((const char *)usbd_core_cfg.descriptors->string_descriptor[index - 1]); - - (*data)[0] = str_len * 2 + 2; - (*data)[1] = 0x03; - for (uint16_t i = 0; i < str_len; i++) { - (*data)[i * 2 + 2] = usbd_core_cfg.descriptors->string_descriptor[index - 1][i]; - (*data)[i * 2 + 3] = 0; - } - - *len = str_len * 2 + 2; - } else { - found = false; - } - } - break; - case USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER: - if (usbd_core_cfg.descriptors->device_quality_descriptor) { - *data = (uint8_t *)usbd_core_cfg.descriptors->device_quality_descriptor; - *len = usbd_core_cfg.descriptors->device_quality_descriptor[0]; - } else { - found = false; - } - - break; - case USB_DESCRIPTOR_TYPE_OTHER_SPEED: - if (usbd_core_cfg.speed == USB_SPEED_HIGH) { - if (usbd_core_cfg.descriptors->fs_other_speed_descriptor) { - *data = (uint8_t *)usbd_core_cfg.descriptors->fs_other_speed_descriptor; - *len = (usbd_core_cfg.descriptors->fs_other_speed_descriptor[CONF_DESC_wTotalLength] | - (usbd_core_cfg.descriptors->fs_other_speed_descriptor[CONF_DESC_wTotalLength] << 8)); - } else { - found = false; - } - } else { - if (usbd_core_cfg.descriptors->hs_other_speed_descriptor) { - *data = (uint8_t *)usbd_core_cfg.descriptors->hs_other_speed_descriptor; - *len = (usbd_core_cfg.descriptors->hs_other_speed_descriptor[CONF_DESC_wTotalLength] | - (usbd_core_cfg.descriptors->hs_other_speed_descriptor[CONF_DESC_wTotalLength] << 8)); - } else { - found = false; - } - } - break; - - case USB_DESCRIPTOR_TYPE_BINARY_OBJECT_STORE: - USB_LOG_INFO("read BOS descriptor string\r\n"); - break; - - default: - found = false; - break; - } - - if (found == false) { - /* nothing found */ - USB_LOG_ERR("descriptor not found!\r\n", type, index); - } - return found; -} -#else -static bool usbd_get_descriptor(uint16_t type_index, uint8_t **data, uint32_t *len) -{ - uint8_t type = 0U; - uint8_t index = 0U; - uint8_t *p = NULL; - uint32_t cur_index = 0U; - bool found = false; - - type = HI_BYTE(type_index); - index = LO_BYTE(type_index); - - if ((type == USB_DESCRIPTOR_TYPE_STRING) && (index == USB_OSDESC_STRING_DESC_INDEX)) { - USB_LOG_INFO("read MS OS 2.0 descriptor string\r\n"); - - if (!msosv1_desc) { - return false; - } - - *data = (uint8_t *)msosv1_desc->string; - *len = msosv1_desc->string_len; - - return true; - } else if (type == USB_DESCRIPTOR_TYPE_BINARY_OBJECT_STORE) { - USB_LOG_INFO("read BOS descriptor string\r\n"); - - if (!bos_desc) { - return false; - } - - *data = bos_desc->string; - *len = bos_desc->string_len; - return true; - } - /* - * Invalid types of descriptors, - * see USB Spec. Revision 2.0, 9.4.3 Get Descriptor - */ - else if ((type == USB_DESCRIPTOR_TYPE_INTERFACE) || (type == USB_DESCRIPTOR_TYPE_ENDPOINT) || -#ifndef CONFIG_USB_HS - (type > USB_DESCRIPTOR_TYPE_ENDPOINT)) { -#else - (type > USB_DESCRIPTOR_TYPE_OTHER_SPEED)) { -#endif - return false; - } - - p = (uint8_t *)usbd_core_cfg.descriptors; - - cur_index = 0U; - - while (p[DESC_bLength] != 0U) { - if (p[DESC_bDescriptorType] == type) { - if (cur_index == index) { - found = true; - break; - } - - cur_index++; - } - - /* skip to next descriptor */ - p += p[DESC_bLength]; - } - - if (found) { - if ((type == USB_DESCRIPTOR_TYPE_CONFIGURATION) || ((type == USB_DESCRIPTOR_TYPE_OTHER_SPEED))) { - /* configuration or other speed descriptor is an - * exception, length is at offset 2 and 3 - */ - *len = (p[CONF_DESC_wTotalLength]) | - (p[CONF_DESC_wTotalLength + 1] << 8); - } else { - /* normally length is at offset 0 */ - *len = p[DESC_bLength]; - } - memcpy(*data, p, *len); - } else { - /* nothing found */ - USB_LOG_ERR("descriptor not found!\r\n", type, index); - } - - return found; -} -#endif - -/** - * @brief set USB configuration - * - * This function configures the device according to the specified configuration - * index and alternate setting by parsing the installed USB descriptor list. - * A configuration index of 0 unconfigures the device. - * - * @param [in] config_index Configuration index - * @param [in] alt_setting Alternate setting number - * - * @return true if successfully configured false if error or unconfigured - */ -static bool usbd_set_configuration(uint8_t config_index, uint8_t alt_setting) -{ - uint8_t cur_alt_setting = 0xFF; - uint8_t cur_config = 0xFF; - bool found = false; - uint8_t *p; -#ifdef CONFIG_USBDEV_ADVANCE_DESC - if (usbd_core_cfg.speed == USB_SPEED_HIGH) { - p = (uint8_t *)usbd_core_cfg.descriptors->hs_config_descriptor; - } else { - p = (uint8_t *)usbd_core_cfg.descriptors->fs_config_descriptor; - } -#else - p = (uint8_t *)usbd_core_cfg.descriptors; -#endif - /* configure endpoints for this configuration/altsetting */ - while (p[DESC_bLength] != 0U) { - switch (p[DESC_bDescriptorType]) { - case USB_DESCRIPTOR_TYPE_CONFIGURATION: - /* remember current configuration index */ - cur_config = p[CONF_DESC_bConfigurationValue]; - - if (cur_config == config_index) { - found = true; - } - - break; - - case USB_DESCRIPTOR_TYPE_INTERFACE: - /* remember current alternate setting */ - cur_alt_setting = - p[INTF_DESC_bAlternateSetting]; - break; - - case USB_DESCRIPTOR_TYPE_ENDPOINT: - if ((cur_config != config_index) || - (cur_alt_setting != alt_setting)) { - break; - } - - found = usbd_set_endpoint((struct usb_endpoint_descriptor *)p); - break; - - default: - break; - } - - /* skip to next descriptor */ - p += p[DESC_bLength]; - } - - return found; -} - -/** - * @brief set USB interface - * - * @param [in] iface Interface index - * @param [in] alt_setting Alternate setting number - * - * @return true if successfully configured false if error or unconfigured - */ -static bool usbd_set_interface(uint8_t iface, uint8_t alt_setting) -{ - const uint8_t *if_desc = NULL; - struct usb_endpoint_descriptor *ep_desc; - uint8_t cur_alt_setting = 0xFF; - uint8_t cur_iface = 0xFF; - bool ret = false; - uint8_t *p; -#ifdef CONFIG_USBDEV_ADVANCE_DESC - if (usbd_core_cfg.speed == USB_SPEED_HIGH) { - p = (uint8_t *)usbd_core_cfg.descriptors->hs_config_descriptor; - } else { - p = (uint8_t *)usbd_core_cfg.descriptors->fs_config_descriptor; - } -#else - p = (uint8_t *)usbd_core_cfg.descriptors; -#endif - USB_LOG_DBG("iface %u alt_setting %u\r\n", iface, alt_setting); - - while (p[DESC_bLength] != 0U) { - switch (p[DESC_bDescriptorType]) { - case USB_DESCRIPTOR_TYPE_INTERFACE: - /* remember current alternate setting */ - cur_alt_setting = p[INTF_DESC_bAlternateSetting]; - cur_iface = p[INTF_DESC_bInterfaceNumber]; - - if (cur_iface == iface && - cur_alt_setting == alt_setting) { - if_desc = (void *)p; - } - - USB_LOG_DBG("Current iface %u alt setting %u", - cur_iface, cur_alt_setting); - break; - - case USB_DESCRIPTOR_TYPE_ENDPOINT: - if (cur_iface == iface) { - ep_desc = (struct usb_endpoint_descriptor *)p; - - if (cur_alt_setting != alt_setting) { - ret = usbd_reset_endpoint(ep_desc); - } else { - ret = usbd_set_endpoint(ep_desc); - } - } - - break; - - default: - break; - } - - /* skip to next descriptor */ - p += p[DESC_bLength]; - } - - usbd_class_event_notify_handler(USBD_EVENT_SET_INTERFACE, (void *)if_desc); - - return ret; -} - -/** - * @brief handle a standard device request - * - * @param [in] setup The setup packet - * @param [in,out] data Data buffer - * @param [in,out] len Pointer to data length - * - * @return true if the request was handled successfully - */ -static bool usbd_std_device_req_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - uint16_t value = setup->wValue; - bool ret = true; - - switch (setup->bRequest) { - case USB_REQUEST_GET_STATUS: - /* bit 0: self-powered */ - /* bit 1: remote wakeup */ - (*data)[0] = 0x00; - (*data)[1] = 0x00; - *len = 2; - break; - - case USB_REQUEST_CLEAR_FEATURE: - case USB_REQUEST_SET_FEATURE: - if (value == USB_FEATURE_REMOTE_WAKEUP) { - } else if (value == USB_FEATURE_TEST_MODE) { -#ifdef CONFIG_USBDEV_TEST_MODE - usbd_core_cfg.test_mode = true; - usbd_execute_test_mode(setup); -#endif - } - *len = 0; - break; - - case USB_REQUEST_SET_ADDRESS: - usbd_set_address(value); - *len = 0; - break; - - case USB_REQUEST_GET_DESCRIPTOR: - ret = usbd_get_descriptor(value, data, len); - break; - - case USB_REQUEST_SET_DESCRIPTOR: - ret = false; - break; - - case USB_REQUEST_GET_CONFIGURATION: - *data = (uint8_t *)&usbd_core_cfg.configuration; - *len = 1; - break; - - case USB_REQUEST_SET_CONFIGURATION: - value &= 0xFF; - - if (!usbd_set_configuration(value, 0)) { - ret = false; - } else { - usbd_core_cfg.configuration = value; - usbd_core_cfg.configured = true; - usbd_class_event_notify_handler(USBD_EVENT_CONFIGURED, NULL); - usbd_event_handler(USBD_EVENT_CONFIGURED); - usbd_configure_done_callback(); - } - *len = 0; - break; - - case USB_REQUEST_GET_INTERFACE: - case USB_REQUEST_SET_INTERFACE: - ret = false; - break; - - default: - ret = false; - break; - } - - return ret; -} - -/** - * @brief handle a standard interface request - * - * @param [in] setup The setup packet - * @param [in,out] data Data buffer - * @param [in,out] len Pointer to data length - * - * @return true if the request was handled successfully - */ -static bool usbd_std_interface_req_handler(struct usb_setup_packet *setup, - uint8_t **data, uint32_t *len) -{ - uint8_t type = HI_BYTE(setup->wValue); - uint8_t intf_num = LO_BYTE(setup->wIndex); - bool ret = true; - - /* Only when device is configured, then interface requests can be valid. */ - if (!is_device_configured()) { - return false; - } - - switch (setup->bRequest) { - case USB_REQUEST_GET_STATUS: - (*data)[0] = 0x00; - (*data)[1] = 0x00; - *len = 2; - break; - - case USB_REQUEST_GET_DESCRIPTOR: - if (type == 0x22) { /* HID_DESCRIPTOR_TYPE_HID_REPORT */ - USB_LOG_INFO("read hid report descriptor\r\n"); - usb_slist_t *i; - - usb_slist_for_each(i, &usbd_intf_head) - { - struct usbd_interface *intf = usb_slist_entry(i, struct usbd_interface, list); - - if (intf->intf_num == intf_num) { - //*data = (uint8_t *)intf->hid_report_descriptor; - memcpy(*data, intf->hid_report_descriptor, intf->hid_report_descriptor_len); - *len = intf->hid_report_descriptor_len; - return true; - } - } - } - ret = false; - break; - case USB_REQUEST_CLEAR_FEATURE: - case USB_REQUEST_SET_FEATURE: - ret = false; - break; - case USB_REQUEST_GET_INTERFACE: - (*data)[0] = 0; - *len = 1; - break; - - case USB_REQUEST_SET_INTERFACE: - usbd_set_interface(setup->wIndex, setup->wValue); - *len = 0; - break; - - default: - ret = false; - break; - } - - return ret; -} - -/** - * @brief handle a standard endpoint request - * - * @param [in] setup The setup packet - * @param [in,out] data Data buffer - * @param [in,out] len Pointer to data length - * - * @return true if the request was handled successfully - */ -static bool usbd_std_endpoint_req_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - uint8_t ep = (uint8_t)setup->wIndex; - bool ret = true; - - /* Only when device is configured, then endpoint requests can be valid. */ - if (!is_device_configured()) { - return false; - } - - switch (setup->bRequest) { - case USB_REQUEST_GET_STATUS: - (*data)[0] = 0x00; - (*data)[1] = 0x00; - *len = 2; - break; - case USB_REQUEST_CLEAR_FEATURE: - if (setup->wValue == USB_FEATURE_ENDPOINT_HALT) { - USB_LOG_ERR("ep:%02x clear halt\r\n", ep); - - usbd_ep_clear_stall(ep); - break; - } else { - ret = false; - } - *len = 0; - break; - case USB_REQUEST_SET_FEATURE: - if (setup->wValue == USB_FEATURE_ENDPOINT_HALT) { - USB_LOG_ERR("ep:%02x set halt\r\n", ep); - - usbd_ep_set_stall(ep); - } else { - ret = false; - } - *len = 0; - break; - - case USB_REQUEST_SYNCH_FRAME: - ret = false; - break; - default: - ret = false; - break; - } - - return ret; -} - -/** - * @brief handle standard requests (list in chapter 9) - * - * @param [in] setup The setup packet - * @param [in,out] data Data buffer - * @param [in,out] len Pointer to data length - * - * @return true if the request was handled successfully - */ -static int usbd_standard_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - int rc = 0; - - switch (setup->bmRequestType & USB_REQUEST_RECIPIENT_MASK) { - case USB_REQUEST_RECIPIENT_DEVICE: - if (usbd_std_device_req_handler(setup, data, len) == false) { - rc = -1; - } - - break; - - case USB_REQUEST_RECIPIENT_INTERFACE: - if (usbd_std_interface_req_handler(setup, data, len) == false) { - rc = -1; - } - - break; - - case USB_REQUEST_RECIPIENT_ENDPOINT: - if (usbd_std_endpoint_req_handler(setup, data, len) == false) { - rc = -1; - } - - break; - - default: - rc = -1; - break; - } - - return rc; -} - -/** - * @brief handler for class requests - * - * If a custom request handler was installed, this handler is called first. - * - * @param [in] setup The setup packet - * @param [in,out] data Data buffer - * @param [in,out] len Pointer to data length - * - * @return true if the request was handled successfully - */ -static int usbd_class_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - usb_slist_t *i; - if ((setup->bmRequestType & USB_REQUEST_RECIPIENT_MASK) == USB_REQUEST_RECIPIENT_INTERFACE) { - usb_slist_for_each(i, &usbd_intf_head) - { - struct usbd_interface *intf = usb_slist_entry(i, struct usbd_interface, list); - - if (intf->class_interface_handler && (intf->intf_num == (setup->wIndex & 0xFF))) { - return intf->class_interface_handler(setup, data, len); - } - } - } else if ((setup->bmRequestType & USB_REQUEST_RECIPIENT_MASK) == USB_REQUEST_RECIPIENT_ENDPOINT) { - usb_slist_for_each(i, &usbd_intf_head) - { - struct usbd_interface *intf = usb_slist_entry(i, struct usbd_interface, list); - - if (intf->class_endpoint_handler && (intf->intf_num == ((setup->wIndex >> 8) & 0xFF))) { - return intf->class_endpoint_handler(setup, data, len); - } - } - } - return -1; -} - -/** - * @brief handler for vendor requests - * - * If a custom request handler was installed, this handler is called first. - * - * @param [in] setup The setup packet - * @param [in,out] data Data buffer - * @param [in,out] len Pointer to data length - * - * @return true if the request was handled successfully - */ -static int usbd_vendor_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ -#ifdef CONFIG_USBDEV_ADVANCE_DESC - if (usbd_core_cfg.descriptors->msosv1_descriptor) { - if (setup->bRequest == usbd_core_cfg.descriptors->msosv1_descriptor->vendor_code) { - switch (setup->wIndex) { - case 0x04: - USB_LOG_INFO("get Compat ID\r\n"); - *data = (uint8_t *)usbd_core_cfg.descriptors->msosv1_descriptor->compat_id; - *len = usbd_core_cfg.descriptors->msosv1_descriptor->compat_id_len; - return 0; - case 0x05: - USB_LOG_INFO("get Compat id properties\r\n"); - *data = (uint8_t *)usbd_core_cfg.descriptors->msosv1_descriptor->comp_id_property; - *len = usbd_core_cfg.descriptors->msosv1_descriptor->comp_id_property_len; - return 0; - default: - USB_LOG_ERR("unknown vendor code\r\n"); - return -1; - } - } - } else if (usbd_core_cfg.descriptors->msosv2_descriptor) { - if (setup->bRequest == usbd_core_cfg.descriptors->msosv2_descriptor->vendor_code) { - switch (setup->wIndex) { - case WINUSB_REQUEST_GET_DESCRIPTOR_SET: - USB_LOG_INFO("GET MS OS 2.0 Descriptor\r\n"); - *data = (uint8_t *)usbd_core_cfg.descriptors->msosv2_descriptor->compat_id; - *len = usbd_core_cfg.descriptors->msosv2_descriptor->compat_id_len; - return 0; - default: - USB_LOG_ERR("unknown vendor code\r\n"); - return -1; - } - } - } else if (usbd_core_cfg.descriptors->webusb_url_descriptor) { - if (setup->bRequest == usbd_core_cfg.descriptors->webusb_url_descriptor->vendor_code) { - switch (setup->wIndex) { - case WINUSB_REQUEST_GET_DESCRIPTOR_SET: - USB_LOG_INFO("GET Webusb url Descriptor\r\n"); - *data = (uint8_t *)usbd_core_cfg.descriptors->webusb_url_descriptor->string; - *len = usbd_core_cfg.descriptors->webusb_url_descriptor->string_len; - return 0; - default: - USB_LOG_ERR("unknown vendor code\r\n"); - return -1; - } - } - } -#else - if (msosv1_desc) { - if (setup->bRequest == msosv1_desc->vendor_code) { - switch (setup->wIndex) { - case 0x04: - USB_LOG_INFO("get Compat ID\r\n"); - //*data = (uint8_t *)msosv1_desc->compat_id; - memcpy(*data, msosv1_desc->compat_id, msosv1_desc->compat_id_len); - *len = msosv1_desc->compat_id_len; - - return 0; - case 0x05: - USB_LOG_INFO("get Compat id properties\r\n"); - //*data = (uint8_t *)msosv1_desc->comp_id_property; - memcpy(*data, msosv1_desc->comp_id_property, msosv1_desc->comp_id_property_len); - *len = msosv1_desc->comp_id_property_len; - - return 0; - default: - USB_LOG_ERR("unknown vendor code\r\n"); - return -1; - } - } - } else if (msosv2_desc) { - if (setup->bRequest == msosv2_desc->vendor_code) { - switch (setup->wIndex) { - case WINUSB_REQUEST_GET_DESCRIPTOR_SET: - USB_LOG_INFO("GET MS OS 2.0 Descriptor\r\n"); - //*data = (uint8_t *)msosv2_desc->compat_id; - memcpy(*data, msosv2_desc->compat_id, msosv2_desc->compat_id_len); - *len = msosv2_desc->compat_id_len; - return 0; - default: - USB_LOG_ERR("unknown vendor code\r\n"); - return -1; - } - } - } -#endif - usb_slist_t *i; - - usb_slist_for_each(i, &usbd_intf_head) - { - struct usbd_interface *intf = usb_slist_entry(i, struct usbd_interface, list); - - if (intf->vendor_handler && !intf->vendor_handler(setup, data, len)) { - return 0; - } - } - - return -1; -} - -/** - * @brief handle setup request( standard/class/vendor/other) - * - * @param [in] setup The setup packet - * @param [in,out] data Data buffer - * @param [in,out] len Pointer to data length - * - * @return true if the request was handles successfully - */ -static bool usbd_setup_request_handler(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len) -{ - switch (setup->bmRequestType & USB_REQUEST_TYPE_MASK) { - case USB_REQUEST_STANDARD: - if (usbd_standard_request_handler(setup, data, len) < 0) { -#ifndef CONFIG_USB_HS - if ((setup->bRequest == 0x06) && (setup->wValue == 0x0600)) { - USB_LOG_WRN("Ignore DQD in fs\r\n"); /* Device Qualifier Descriptor */ - return false; - } -#endif - USB_LOG_ERR("standard request error\r\n"); - usbd_print_setup(setup); - return false; - } - break; - case USB_REQUEST_CLASS: - if (usbd_class_request_handler(setup, data, len) < 0) { - USB_LOG_ERR("class request error\r\n"); - usbd_print_setup(setup); - return false; - } - break; - case USB_REQUEST_VENDOR: - if (usbd_vendor_request_handler(setup, data, len) < 0) { - USB_LOG_ERR("vendor request error\r\n"); - usbd_print_setup(setup); - return false; - } - break; - - default: - return false; - } - - return true; -} - -static void usbd_class_event_notify_handler(uint8_t event, void *arg) -{ - usb_slist_t *i; - usb_slist_for_each(i, &usbd_intf_head) - { - struct usbd_interface *intf = usb_slist_entry(i, struct usbd_interface, list); - - if (intf->notify_handler) { - intf->notify_handler(event, arg); - } - } -} - -void usbd_event_connect_handler(void) -{ - usbd_event_handler(USBD_EVENT_CONNECTED); -} - -void usbd_event_disconnect_handler(void) -{ - usbd_event_handler(USBD_EVENT_DISCONNECTED); -} - -void usbd_event_resume_handler(void) -{ - usbd_event_handler(USBD_EVENT_RESUME); -} - -void usbd_event_suspend_handler(void) -{ - usbd_event_handler(USBD_EVENT_SUSPEND); -} - -void usbd_event_reset_handler(void) -{ - usbd_set_address(0); - usbd_core_cfg.configured = 0; - usbd_core_cfg.configuration = 0; - -#ifdef CONFIG_USBDEV_TEST_MODE - usbd_core_cfg.test_mode = false; -#endif - struct usbd_endpoint_cfg ep0_cfg; - - ep0_cfg.ep_mps = USB_CTRL_EP_MPS; - ep0_cfg.ep_type = USB_ENDPOINT_TYPE_CONTROL; - ep0_cfg.ep_addr = USB_CONTROL_IN_EP0; - usbd_ep_open(&ep0_cfg); - - ep0_cfg.ep_addr = USB_CONTROL_OUT_EP0; - usbd_ep_open(&ep0_cfg); - - usbd_class_event_notify_handler(USBD_EVENT_RESET, NULL); - usbd_event_handler(USBD_EVENT_RESET); -} - -void usbd_event_ep0_setup_complete_handler(uint8_t *psetup) -{ - struct usb_setup_packet *setup = &usbd_core_cfg.setup; - - memcpy(setup, psetup, 8); -#ifdef CONFIG_USBDEV_SETUP_LOG_PRINT - usbd_print_setup(setup); -#endif - if (setup->wLength > CONFIG_USBDEV_REQUEST_BUFFER_LEN) { - if ((setup->bmRequestType & USB_REQUEST_DIR_MASK) == USB_REQUEST_DIR_OUT) { - USB_LOG_ERR("Request buffer too small\r\n"); - usbd_ep_set_stall(USB_CONTROL_IN_EP0); - return; - } - } - - usbd_core_cfg.ep0_data_buf = usbd_core_cfg.req_data; - usbd_core_cfg.ep0_data_buf_residue = setup->wLength; - usbd_core_cfg.ep0_data_buf_len = setup->wLength; - usbd_core_cfg.zlp_flag = false; - - /* handle class request when all the data is received */ - if (setup->wLength && ((setup->bmRequestType & USB_REQUEST_DIR_MASK) == USB_REQUEST_DIR_OUT)) { - USB_LOG_DBG("Start reading %d bytes from ep0\r\n", setup->wLength); - usbd_ep_start_read(USB_CONTROL_OUT_EP0, usbd_core_cfg.ep0_data_buf, setup->wLength); - return; - } - - /* Ask installed handler to process request */ - if (!usbd_setup_request_handler(setup, &usbd_core_cfg.ep0_data_buf, &usbd_core_cfg.ep0_data_buf_len)) { - usbd_ep_set_stall(USB_CONTROL_IN_EP0); - return; - } -#ifdef CONFIG_USBDEV_TEST_MODE - /* send status in test mode, so do not execute downward, just return */ - if (usbd_core_cfg.test_mode) { - usbd_core_cfg.test_mode = false; - return; - } -#endif - /* Send smallest of requested and offered length */ - usbd_core_cfg.ep0_data_buf_residue = MIN(usbd_core_cfg.ep0_data_buf_len, setup->wLength); - if (usbd_core_cfg.ep0_data_buf_residue > CONFIG_USBDEV_REQUEST_BUFFER_LEN) { - USB_LOG_ERR("Request buffer too small\r\n"); - return; - } - - /* Send data or status to host */ - usbd_ep_start_write(USB_CONTROL_IN_EP0, usbd_core_cfg.ep0_data_buf, usbd_core_cfg.ep0_data_buf_residue); - /* - * Set ZLP flag when host asks for a bigger length and the data size is - * multiplier of USB_CTRL_EP_MPS, to indicate the transfer done after zlp - * sent. - */ - if ((setup->wLength > usbd_core_cfg.ep0_data_buf_len) && (!(usbd_core_cfg.ep0_data_buf_len % USB_CTRL_EP_MPS))) { - usbd_core_cfg.zlp_flag = true; - USB_LOG_DBG("EP0 Set zlp\r\n"); - } -} - -void usbd_event_ep0_in_complete_handler(uint8_t ep, uint32_t nbytes) -{ - struct usb_setup_packet *setup = &usbd_core_cfg.setup; - - usbd_core_cfg.ep0_data_buf += nbytes; - usbd_core_cfg.ep0_data_buf_residue -= nbytes; - - USB_LOG_DBG("EP0 send %d bytes, %d remained\r\n", nbytes, usbd_core_cfg.ep0_data_buf_residue); - - if (usbd_core_cfg.ep0_data_buf_residue != 0) { - /* Start sending the remain data */ - usbd_ep_start_write(USB_CONTROL_IN_EP0, usbd_core_cfg.ep0_data_buf, usbd_core_cfg.ep0_data_buf_residue); - } else { - if (usbd_core_cfg.zlp_flag == true) { - usbd_core_cfg.zlp_flag = false; - /* Send zlp to host */ - USB_LOG_DBG("EP0 Send zlp\r\n"); - usbd_ep_start_write(USB_CONTROL_IN_EP0, NULL, 0); - } else { - /* Satisfying three conditions will jump here. - * 1. send status completely - * 2. send zlp completely - * 3. send last data completely. - */ - if (setup->wLength && ((setup->bmRequestType & USB_REQUEST_DIR_MASK) == USB_REQUEST_DIR_IN)) { - /* if all data has sent completely, start reading out status */ - usbd_ep_start_read(USB_CONTROL_OUT_EP0, NULL, 0); - } - } - } -} - -void usbd_event_ep0_out_complete_handler(uint8_t ep, uint32_t nbytes) -{ - struct usb_setup_packet *setup = &usbd_core_cfg.setup; - - if (nbytes > 0) { - usbd_core_cfg.ep0_data_buf += nbytes; - usbd_core_cfg.ep0_data_buf_residue -= nbytes; - - USB_LOG_DBG("EP0 recv %d bytes, %d remained\r\n", nbytes, usbd_core_cfg.ep0_data_buf_residue); - - if (usbd_core_cfg.ep0_data_buf_residue == 0) { - /* Received all, send data to handler */ - usbd_core_cfg.ep0_data_buf = usbd_core_cfg.req_data; - if (!usbd_setup_request_handler(setup, &usbd_core_cfg.ep0_data_buf, &usbd_core_cfg.ep0_data_buf_len)) { - usbd_ep_set_stall(USB_CONTROL_IN_EP0); - return; - } - - /*Send status to host*/ - usbd_ep_start_write(USB_CONTROL_IN_EP0, NULL, 0); - } else { - /* Start reading the remain data */ - usbd_ep_start_read(USB_CONTROL_OUT_EP0, usbd_core_cfg.ep0_data_buf, usbd_core_cfg.ep0_data_buf_residue); - } - } else { - /* Read out status completely, do nothing */ - USB_LOG_DBG("EP0 recv out status\r\n"); - } -} - -void usbd_event_ep_in_complete_handler(uint8_t ep, uint32_t nbytes) -{ -#ifndef CONFIG_USBDEV_TX_THREAD - if (tx_msg[ep & 0x7f].cb) { - tx_msg[ep & 0x7f].cb(ep, nbytes); - } -#else - tx_msg[ep & 0x7f].nbytes = nbytes; - usb_osal_mq_send(usbd_tx_mq, (uintptr_t)&tx_msg[ep & 0x7f]); -#endif -} - -void usbd_event_ep_out_complete_handler(uint8_t ep, uint32_t nbytes) -{ -#ifndef CONFIG_USBDEV_RX_THREAD - if (rx_msg[ep & 0x7f].cb) { - rx_msg[ep & 0x7f].cb(ep, nbytes); - } -#else - rx_msg[ep & 0x7f].nbytes = nbytes; - usb_osal_mq_send(usbd_rx_mq, (uintptr_t)&rx_msg[ep & 0x7f]); -#endif -} - -#ifdef CONFIG_USBDEV_TX_THREAD -static void usbdev_tx_thread(void *argument) -{ - struct usbd_tx_rx_msg *msg; - int ret; - - while (1) { - ret = usb_osal_mq_recv(usbd_tx_mq, (uintptr_t *)&msg, 0xffffffff); - if (ret < 0) { - continue; - } - - if (msg->cb) { - msg->cb(msg->ep, msg->nbytes); - } - } -} -#endif - -#ifdef CONFIG_USBDEV_RX_THREAD -static void usbdev_rx_thread(void *argument) -{ - struct usbd_tx_rx_msg *msg; - int ret; - - while (1) { - ret = usb_osal_mq_recv(usbd_rx_mq, (uintptr_t *)&msg, 0xffffffff); - if (ret < 0) { - continue; - } - - if (msg->cb) { - msg->cb(msg->ep, msg->nbytes); - } - } -} -#endif - -#ifdef CONFIG_USBDEV_ADVANCE_DESC -void usbd_desc_register(struct usb_descriptor *desc) -{ - memset(&usbd_core_cfg, 0, sizeof(struct usbd_core_cfg_priv)); - - usbd_core_cfg.descriptors = desc; - usbd_core_cfg.intf_offset = 0; - - tx_msg[0].ep = 0x80; - tx_msg[0].cb = usbd_event_ep0_in_complete_handler; - rx_msg[0].ep = 0x00; - rx_msg[0].cb = usbd_event_ep0_out_complete_handler; -} -#else -void usbd_desc_register(const uint8_t *desc) -{ - memset(&usbd_core_cfg, 0, sizeof(struct usbd_core_cfg_priv)); - - usbd_core_cfg.descriptors = desc; - usbd_core_cfg.intf_offset = 0; - - tx_msg[0].ep = 0x80; - tx_msg[0].cb = usbd_event_ep0_in_complete_handler; - rx_msg[0].ep = 0x00; - rx_msg[0].cb = usbd_event_ep0_out_complete_handler; -} - -/* Register MS OS Descriptors version 1 */ -void usbd_msosv1_desc_register(struct usb_msosv1_descriptor *desc) -{ - msosv1_desc = desc; -} - -/* Register MS OS Descriptors version 2 */ -void usbd_msosv2_desc_register(struct usb_msosv2_descriptor *desc) -{ - msosv2_desc = desc; -} - -void usbd_bos_desc_register(struct usb_bos_descriptor *desc) -{ - bos_desc = desc; -} -#endif - -void usbd_add_interface(struct usbd_interface *intf) -{ - intf->intf_num = usbd_core_cfg.intf_offset; - usb_slist_add_tail(&usbd_intf_head, &intf->list); - usbd_core_cfg.intf_offset++; -} - -void usbd_add_endpoint(struct usbd_endpoint *ep) -{ - if (ep->ep_addr & 0x80) { - tx_msg[ep->ep_addr & 0x7f].ep = ep->ep_addr; - tx_msg[ep->ep_addr & 0x7f].cb = ep->ep_cb; - } else { - rx_msg[ep->ep_addr & 0x7f].ep = ep->ep_addr; - rx_msg[ep->ep_addr & 0x7f].cb = ep->ep_cb; - } -} - -bool usb_device_is_configured(void) -{ - return usbd_core_cfg.configured; -} - -int usbd_initialize(void) -{ -#ifdef CONFIG_USBDEV_TX_THREAD - usbd_tx_mq = usb_osal_mq_create(16); - if (usbd_tx_mq == NULL) { - return -1; - } - usbd_tx_thread = usb_osal_thread_create("usbd_tx", CONFIG_USBDEV_TX_STACKSIZE, CONFIG_USBDEV_TX_PRIO, usbdev_tx_thread, NULL); - if (usbd_tx_thread == NULL) { - return -1; - } -#endif -#ifdef CONFIG_USBDEV_RX_THREAD - usbd_rx_mq = usb_osal_mq_create(16); - if (usbd_rx_mq == NULL) { - return -1; - } - usbd_rx_thread = usb_osal_thread_create("usbd_rx", CONFIG_USBDEV_RX_STACKSIZE, CONFIG_USBDEV_RX_PRIO, usbdev_rx_thread, NULL); - if (usbd_rx_thread == NULL) { - return -1; - } -#endif - return usb_dc_init(); -} - -int usbd_deinitialize(void) -{ - usbd_core_cfg.intf_offset = 0; - usb_slist_init(&usbd_intf_head); - usb_dc_deinit(); -#if defined(CONFIG_USBDEV_TX_THREAD) || defined(CONFIG_USBDEV_RX_THREAD) -#endif - return 0; -} - -__WEAK void usbd_event_handler(uint8_t event) -{ - switch (event) { - case USBD_EVENT_RESET: - break; - case USBD_EVENT_CONNECTED: - break; - case USBD_EVENT_DISCONNECTED: - break; - case USBD_EVENT_RESUME: - break; - case USBD_EVENT_SUSPEND: - break; - case USBD_EVENT_CONFIGURED: - break; - - default: - break; - } -} diff --git a/third-party/cherryusb/core/usbd_core.h b/third-party/cherryusb/core/usbd_core.h deleted file mode 100644 index 3273b5e3511b277f2ec3cdd542ff7949d41fd5c6..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/core/usbd_core.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBD_CORE_H -#define USBD_CORE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include - -#include "usb_config.h" -#include "usb_util.h" -#include "usb_errno.h" -#include "usb_def.h" -#include "usb_list.h" -#include "usb_mem.h" -#include "usb_log.h" -#include "usb_dc.h" - -enum usbd_event_type { - /* USB DCD IRQ */ - USBD_EVENT_ERROR, /** USB error reported by the controller */ - USBD_EVENT_RESET, /** USB reset */ - USBD_EVENT_SOF, /** Start of Frame received */ - USBD_EVENT_CONNECTED, /** USB connected*/ - USBD_EVENT_DISCONNECTED, /** USB disconnected */ - USBD_EVENT_SUSPEND, /** USB connection suspended by the HOST */ - USBD_EVENT_RESUME, /** USB connection resumed by the HOST */ - - /* USB DEVICE STATUS */ - USBD_EVENT_CONFIGURED, /** USB configuration done */ - USBD_EVENT_SET_INTERFACE, /** USB interface selected */ - USBD_EVENT_UNKNOWN -}; - -typedef int (*usbd_request_handler)(struct usb_setup_packet *setup, uint8_t **data, uint32_t *len); -typedef void (*usbd_endpoint_callback)(uint8_t ep, uint32_t nbytes); -typedef void (*usbd_notify_handler)(uint8_t event, void *arg); - -extern usb_slist_t usbd_intf_head; - -struct usbd_endpoint { - uint8_t ep_addr; - usbd_endpoint_callback ep_cb; -}; - -struct usbd_interface { - usb_slist_t list; - usbd_request_handler class_interface_handler; - usbd_request_handler class_endpoint_handler; - usbd_request_handler vendor_handler; - usbd_notify_handler notify_handler; - const uint8_t *hid_report_descriptor; - uint32_t hid_report_descriptor_len; - uint8_t intf_num; -}; - -struct usb_descriptor { - const uint8_t *device_descriptor; - const uint8_t *fs_config_descriptor; - const uint8_t *hs_config_descriptor; - const uint8_t *device_quality_descriptor; - const uint8_t *fs_other_speed_descriptor; - const uint8_t *hs_other_speed_descriptor; - const char **string_descriptor; - struct usb_msosv1_descriptor *msosv1_descriptor; - struct usb_msosv2_descriptor *msosv2_descriptor; - struct usb_webusb_url_ex_descriptor *webusb_url_descriptor; - struct usb_bos_descriptor *bos_descriptor; -}; - -#ifdef CONFIG_USBDEV_ADVANCE_DESC -void usbd_desc_register(struct usb_descriptor *desc); -#else -void usbd_desc_register(const uint8_t *desc); -void usbd_msosv1_desc_register(struct usb_msosv1_descriptor *desc); -void usbd_msosv2_desc_register(struct usb_msosv2_descriptor *desc); -void usbd_bos_desc_register(struct usb_bos_descriptor *desc); -#endif - -void usbd_add_interface(struct usbd_interface *intf); -void usbd_add_endpoint(struct usbd_endpoint *ep); - -bool usb_device_is_configured(void); -void usbd_configure_done_callback(void); -int usbd_initialize(void); -int usbd_deinitialize(void); - -void usbd_event_handler(uint8_t event); - -#ifdef __cplusplus -} -#endif - -#endif /* USBD_CORE_H */ diff --git a/third-party/cherryusb/core/usbh_core.c b/third-party/cherryusb/core/usbh_core.c deleted file mode 100644 index a1a5183e3bce6ed6f0650aaaa0adb7986c7b115e..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/core/usbh_core.c +++ /dev/null @@ -1,940 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#include "usbh_core.h" -#include "usbh_hub.h" - -struct usbh_class_info *usbh_class_info_table_begin = NULL; -struct usbh_class_info *usbh_class_info_table_end = NULL; - -static usb_slist_t usb_buses = USB_SLIST_OBJECT_INIT(usb_buses); - -/* general descriptor field offsets */ -#define DESC_bLength 0 /** Length offset */ -#define DESC_bDescriptorType 1 /** Descriptor type offset */ - -#define USB_DEV_ADDR_MAX 0x7f -#define USB_DEV_ADDR_MARK_OFFSET 5 -#define USB_DEV_ADDR_MARK_MASK 0x1f - -struct usbh_bus* usbh_get_bus_of_index(uint8_t usb) -{ - usb_slist_t *i; - struct usbh_bus* target_bus = NULL; - struct usbh_bus* bus = NULL; - size_t flags = usb_osal_enter_critical_section(); - - usb_slist_for_each(i, &usb_buses) - { - bus = usb_slist_entry(i, struct usbh_bus, list); - if (bus->id == usb) { - target_bus = bus; - break; - } - } - usb_osal_leave_critical_section(flags); - - return target_bus; -} - -struct usbh_bus* usbh_get_bus_of_devname(const char *devname) -{ - uint8_t usb_id = 0, dev_id = 0; - int matched = 0; - uint32_t name_len = strlen(devname); - - /* e.g. /usb0/hub1, return the usb-id 0 */ - for (uint32_t i = 0; i < name_len; i++) { - if (('0' <= devname[i]) && ('9' >= devname[i])) { - usb_id = usb_id * 10 + (devname[i] - '0'); - if (!matched) { - matched = 1; - } - } else { - if (matched) { - break; - } - } - } - - /* success only if all items mathched */ - if (matched) { - USB_LOG_INFO("id = %d \r\n", usb_id); - return usbh_get_bus_of_index(usb_id); - } else { - return NULL; /* not matched */ - } -} - -/** - * Get USB transaction translator - * - * @v hport Hub port of USB device - * @ret port Transaction translator port, or NULL - */ -struct usbh_hubport *usbh_transaction_translator ( struct usbh_hubport *hport ) { - struct usbh_hubport *parent; - - if (hport->parent->is_roothub) { - return NULL; - } - - /* Navigate up to root hub. If we find a low-speed or - * full-speed device with a higher-speed parent hub, then that - * device's port is the transaction translator. - */ - for (; (parent = hport->parent->parent); hport = parent) { - if ((hport->speed <= USB_SPEED_FULL) && - (parent->speed > USB_SPEED_FULL)) { - return hport; - } - } - - return NULL; -} - -/** - * Get USB route string - * - * @v hport Hub Port of USB device - * @ret route USB route string - */ -unsigned int usbh_route_string ( struct usbh_hubport *hport ) { - struct usbh_hubport *parent; - unsigned int route; - - /* Navigate up to root hub, constructing route string as we go */ - for (route = 0; (parent = hport->parent->parent); hport = parent) { - route <<= 4; - route |= ( ( hport->dev_addr > 0xf ) ? - 0xf : hport->dev_addr ); - } - - return route; -} - -/** - * Get USB root hub port - * - * @v usb USB device - * @ret port Root hub port - */ -struct usbh_hubport * usbh_root_hub_port ( struct usbh_hubport *hport ) { - struct usbh_hubport *parent; - - /* Navigate up to root hub */ - while (parent = hport->parent->parent) { - hport = parent; - } - - return hport; -} - -static int usbh_allocate_devaddr(struct usbh_devaddr_map *devgen) -{ - uint8_t startaddr = devgen->next; - uint8_t devaddr; - int index; - int bitno; - - for (;;) { - devaddr = devgen->next; - if (devgen->next >= 0x7f) { - devgen->next = 2; - } else { - devgen->next++; - } - - index = devaddr >> 5; - bitno = devaddr & 0x1f; - if ((devgen->alloctab[index] & (1 << bitno)) == 0) { - devgen->alloctab[index] |= (1 << bitno); - return (int)devaddr; - } - - if (startaddr == devaddr) { - return -ENOMEM; - } - } -} - -static int usbh_free_devaddr(struct usbh_devaddr_map *devgen, uint8_t devaddr) -{ - int index; - int bitno; - - if ((devaddr > 0) && (devaddr < USB_DEV_ADDR_MAX)) { - index = devaddr >> USB_DEV_ADDR_MARK_OFFSET; - bitno = devaddr & USB_DEV_ADDR_MARK_MASK; - - /* Free the address */ - if ((devgen->alloctab[index] |= (1 << bitno)) != 0) { - devgen->alloctab[index] &= ~(1 << bitno); - } else { - return -1; - } - - if (devaddr < devgen->next) { - devgen->next = devaddr; - } - } - - return 0; -} - -static const struct usbh_class_driver *usbh_find_class_driver(uint8_t class, uint8_t subclass, uint8_t protocol, - uint16_t vid, uint16_t pid) -{ - struct usbh_class_info *index = NULL; - - for (index = usbh_class_info_table_begin; index < usbh_class_info_table_end; index++) { - if ((index->match_flags & (USB_CLASS_MATCH_VENDOR | USB_CLASS_MATCH_PRODUCT | USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS | USB_CLASS_MATCH_INTF_PROTOCOL)) == - (USB_CLASS_MATCH_VENDOR | USB_CLASS_MATCH_PRODUCT | USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS | USB_CLASS_MATCH_INTF_PROTOCOL)) { - if (index->vid == vid && index->pid == pid && - index->class == class && index->subclass == subclass && index->protocol == protocol) { - return index->class_driver; - } - } else if ((index->match_flags & (USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS | USB_CLASS_MATCH_INTF_PROTOCOL)) == - (USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS | USB_CLASS_MATCH_INTF_PROTOCOL)) { - if (index->class == class && index->subclass == subclass && index->protocol == protocol) { - return index->class_driver; - } - } else if ((index->match_flags & (USB_CLASS_MATCH_VENDOR | USB_CLASS_MATCH_PRODUCT | USB_CLASS_MATCH_INTF_CLASS)) == - (USB_CLASS_MATCH_VENDOR | USB_CLASS_MATCH_PRODUCT | USB_CLASS_MATCH_INTF_CLASS)) { - if (index->vid == vid && index->pid == pid && index->class == class) { - return index->class_driver; - } - } else if ((index->match_flags & (USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS)) == (USB_CLASS_MATCH_INTF_CLASS | USB_CLASS_MATCH_INTF_SUBCLASS)) { - if (index->class == class && index->subclass == subclass) { - return index->class_driver; - } - } else if ((index->match_flags & (USB_CLASS_MATCH_INTF_CLASS)) == USB_CLASS_MATCH_INTF_CLASS) { - if (index->class == class) { - return index->class_driver; - } - } - } - return NULL; -} - -static int parse_device_descriptor(struct usbh_hubport *hport, struct usb_device_descriptor *desc, uint16_t length) -{ - if (desc->bLength != USB_SIZEOF_DEVICE_DESC) { - USB_LOG_ERR("invalid device bLength 0x%02x\r\n", desc->bLength); - return -EINVAL; - } else if (desc->bDescriptorType != USB_DESCRIPTOR_TYPE_DEVICE) { - USB_LOG_ERR("unexpected device descriptor 0x%02x\r\n", desc->bDescriptorType); - return -EINVAL; - } else { - if (length <= 8) { - return 0; - } -#if 0 - USB_LOG_DBG("Device Descriptor:\r\n"); - USB_LOG_DBG("bLength: 0x%02x \r\n", desc->bLength); - USB_LOG_DBG("bDescriptorType: 0x%02x \r\n", desc->bDescriptorType); - USB_LOG_DBG("bcdUSB: 0x%04x \r\n", desc->bcdUSB); - USB_LOG_DBG("bDeviceClass: 0x%02x \r\n", desc->bDeviceClass); - USB_LOG_DBG("bDeviceSubClass: 0x%02x \r\n", desc->bDeviceSubClass); - USB_LOG_DBG("bDeviceProtocol: 0x%02x \r\n", desc->bDeviceProtocol); - USB_LOG_DBG("bMaxPacketSize0: 0x%02x \r\n", desc->bMaxPacketSize0); - USB_LOG_DBG("idVendor: 0x%04x \r\n", desc->idVendor); - USB_LOG_DBG("idProduct: 0x%04x \r\n", desc->idProduct); - USB_LOG_DBG("bcdDevice: 0x%04x \r\n", desc->bcdDevice); - USB_LOG_DBG("iManufacturer: 0x%02x \r\n", desc->iManufacturer); - USB_LOG_DBG("iProduct: 0x%02x \r\n", desc->iProduct); - USB_LOG_DBG("iSerialNumber: 0x%02x \r\n", desc->iSerialNumber); - USB_LOG_DBG("bNumConfigurations: 0x%02x\r\n", desc->bNumConfigurations); -#endif - hport->device_desc.bLength = desc->bLength; - hport->device_desc.bDescriptorType = desc->bDescriptorType; - hport->device_desc.bcdUSB = desc->bcdUSB; - hport->device_desc.bDeviceClass = desc->bDeviceClass; - hport->device_desc.bDeviceSubClass = desc->bDeviceSubClass; - hport->device_desc.bDeviceProtocol = desc->bDeviceProtocol; - hport->device_desc.bMaxPacketSize0 = desc->bMaxPacketSize0; - hport->device_desc.idVendor = desc->idVendor; - hport->device_desc.idProduct = desc->idProduct; - hport->device_desc.bcdDevice = desc->bcdDevice; - hport->device_desc.iManufacturer = desc->iManufacturer; - hport->device_desc.iProduct = desc->iProduct; - hport->device_desc.iSerialNumber = desc->iSerialNumber; - hport->device_desc.bNumConfigurations = desc->bNumConfigurations; - } - return 0; -} - -static int parse_config_descriptor(struct usbh_hubport *hport, struct usb_configuration_descriptor *desc, uint16_t length) -{ - struct usb_interface_descriptor *intf_desc; - struct usb_endpoint_descriptor *ep_desc; - uint8_t cur_alt_setting = 0xff; - uint8_t cur_iface = 0xff; - uint8_t cur_ep = 0xff; - uint8_t cur_ep_num = 0xff; - uint32_t desc_len = 0; - uint8_t *p; - - if (desc->bLength != USB_SIZEOF_CONFIG_DESC) { - USB_LOG_ERR("invalid config bLength 0x%02x\r\n", desc->bLength); - return -EINVAL; - } else if (desc->bDescriptorType != USB_DESCRIPTOR_TYPE_CONFIGURATION) { - USB_LOG_ERR("unexpected config descriptor 0x%02x\r\n", desc->bDescriptorType); - return -EINVAL; - } else { - if (length <= USB_SIZEOF_CONFIG_DESC) { - return 0; - } -#if 0 - USB_LOG_DBG("Config Descriptor:\r\n"); - USB_LOG_DBG("bLength: 0x%02x \r\n", desc->bLength); - USB_LOG_DBG("bDescriptorType: 0x%02x \r\n", desc->bDescriptorType); - USB_LOG_DBG("wTotalLength: 0x%04x \r\n", desc->wTotalLength); - USB_LOG_DBG("bNumInterfaces: 0x%02x \r\n", desc->bNumInterfaces); - USB_LOG_DBG("bConfigurationValue: 0x%02x \r\n", desc->bConfigurationValue); - USB_LOG_DBG("iConfiguration: 0x%02x \r\n", desc->iConfiguration); - USB_LOG_DBG("bmAttributes: 0x%02x \r\n", desc->bmAttributes); - USB_LOG_DBG("bMaxPower: 0x%02x \r\n", desc->bMaxPower); -#endif - hport->config.config_desc.bLength = desc->bLength; - hport->config.config_desc.bDescriptorType = desc->bDescriptorType; - hport->config.config_desc.wTotalLength = desc->wTotalLength; - hport->config.config_desc.bNumInterfaces = desc->bNumInterfaces; - hport->config.config_desc.bConfigurationValue = desc->bConfigurationValue; - hport->config.config_desc.iConfiguration = desc->iConfiguration; - hport->config.config_desc.iConfiguration = desc->iConfiguration; - hport->config.config_desc.bmAttributes = desc->bmAttributes; - hport->config.config_desc.bMaxPower = desc->bMaxPower; - - p = (uint8_t *)desc; - p += USB_SIZEOF_CONFIG_DESC; - desc_len = USB_SIZEOF_CONFIG_DESC; - - memset(hport->config.intf, 0, sizeof(struct usbh_interface) * CONFIG_USBHOST_MAX_INTERFACES); - - while (p[DESC_bLength] && (desc_len <= length)) { - switch (p[DESC_bDescriptorType]) { - case USB_DESCRIPTOR_TYPE_INTERFACE: - intf_desc = (struct usb_interface_descriptor *)p; - cur_iface = intf_desc->bInterfaceNumber; - cur_alt_setting = intf_desc->bAlternateSetting; - cur_ep_num = intf_desc->bNumEndpoints; - cur_ep = 0; - if (cur_iface > (CONFIG_USBHOST_MAX_INTERFACES - 1)) { - USB_LOG_ERR("Interface num overflow\r\n"); - return -ENOMEM; - } - if (cur_alt_setting > (CONFIG_USBHOST_MAX_INTF_ALTSETTINGS - 1)) { - USB_LOG_ERR("Interface altsetting num overflow\r\n"); - return -ENOMEM; - } - if (cur_ep_num > CONFIG_USBHOST_MAX_ENDPOINTS) { - USB_LOG_ERR("Endpoint num overflow\r\n"); - return -ENOMEM; - } -#if 0 - USB_LOG_DBG("Interface Descriptor:\r\n"); - USB_LOG_DBG("bLength: 0x%02x \r\n", intf_desc->bLength); - USB_LOG_DBG("bDescriptorType: 0x%02x \r\n", intf_desc->bDescriptorType); - USB_LOG_DBG("bInterfaceNumber: 0x%02x \r\n", intf_desc->bInterfaceNumber); - USB_LOG_DBG("bAlternateSetting: 0x%02x \r\n", intf_desc->bAlternateSetting); - USB_LOG_DBG("bNumEndpoints: 0x%02x \r\n", intf_desc->bNumEndpoints); - USB_LOG_DBG("bInterfaceClass: 0x%02x \r\n", intf_desc->bInterfaceClass); - USB_LOG_DBG("bInterfaceSubClass: 0x%02x \r\n", intf_desc->bInterfaceSubClass); - USB_LOG_DBG("bInterfaceProtocol: 0x%02x \r\n", intf_desc->bInterfaceProtocol); - USB_LOG_DBG("iInterface: 0x%02x \r\n", intf_desc->iInterface); -#endif - memcpy(&hport->config.intf[cur_iface].altsetting[cur_alt_setting].intf_desc, intf_desc, 9); - hport->config.intf[cur_iface].altsetting_num = cur_alt_setting + 1; - break; - case USB_DESCRIPTOR_TYPE_ENDPOINT: - ep_desc = (struct usb_endpoint_descriptor *)p; - memcpy(&hport->config.intf[cur_iface].altsetting[cur_alt_setting].ep[cur_ep].ep_desc, ep_desc, 7); - cur_ep++; - break; - - default: - break; - } - /* skip to next descriptor */ - p += p[DESC_bLength]; - desc_len += p[DESC_bLength]; - } - } - return 0; -} - -#ifdef CONFIG_USBHOST_GET_STRING_DESC -void usbh_print_string(char *lead, uint8_t *str) -{ - uint8_t string[64 + 1] = { 0 }; - - int len, i = 2, j = 0; - - len = str[0]; - while (i < len) { - string[j] = str[i]; - i += 2; - j++; - } - USB_LOG_RAW("%s%s\r\n", lead, string); -} -#endif - -static void usbh_print_hubport_info(struct usbh_hubport *hport) -{ - USB_LOG_RAW("Device Descriptor:\r\n"); - USB_LOG_RAW("bLength: 0x%02x \r\n", hport->device_desc.bLength); - USB_LOG_RAW("bDescriptorType: 0x%02x \r\n", hport->device_desc.bDescriptorType); - USB_LOG_RAW("bcdUSB: 0x%04x \r\n", hport->device_desc.bcdUSB); - USB_LOG_RAW("bDeviceClass: 0x%02x \r\n", hport->device_desc.bDeviceClass); - USB_LOG_RAW("bDeviceSubClass: 0x%02x \r\n", hport->device_desc.bDeviceSubClass); - USB_LOG_RAW("bDeviceProtocol: 0x%02x \r\n", hport->device_desc.bDeviceProtocol); - USB_LOG_RAW("bMaxPacketSize0: 0x%02x \r\n", hport->device_desc.bMaxPacketSize0); - USB_LOG_RAW("idVendor: 0x%04x \r\n", hport->device_desc.idVendor); - USB_LOG_RAW("idProduct: 0x%04x \r\n", hport->device_desc.idProduct); - USB_LOG_RAW("bcdDevice: 0x%04x \r\n", hport->device_desc.bcdDevice); - USB_LOG_RAW("iManufacturer: 0x%02x \r\n", hport->device_desc.iManufacturer); - USB_LOG_RAW("iProduct: 0x%02x \r\n", hport->device_desc.iProduct); - USB_LOG_RAW("iSerialNumber: 0x%02x \r\n", hport->device_desc.iSerialNumber); - USB_LOG_RAW("bNumConfigurations: 0x%02x\r\n", hport->device_desc.bNumConfigurations); - - USB_LOG_RAW("Config Descriptor:\r\n"); - USB_LOG_RAW("bLength: 0x%02x \r\n", hport->config.config_desc.bLength); - USB_LOG_RAW("bDescriptorType: 0x%02x \r\n", hport->config.config_desc.bDescriptorType); - USB_LOG_RAW("wTotalLength: 0x%04x \r\n", hport->config.config_desc.wTotalLength); - USB_LOG_RAW("bNumInterfaces: 0x%02x \r\n", hport->config.config_desc.bNumInterfaces); - USB_LOG_RAW("bConfigurationValue: 0x%02x \r\n", hport->config.config_desc.bConfigurationValue); - USB_LOG_RAW("iConfiguration: 0x%02x \r\n", hport->config.config_desc.iConfiguration); - USB_LOG_RAW("bmAttributes: 0x%02x \r\n", hport->config.config_desc.bmAttributes); - USB_LOG_RAW("bMaxPower: 0x%02x \r\n", hport->config.config_desc.bMaxPower); - - for (uint8_t i = 0; i < hport->config.config_desc.bNumInterfaces; i++) { - for (uint8_t j = 0; j < hport->config.intf[i].altsetting_num; j++) { - USB_LOG_RAW("Interface Descriptor:\r\n"); - USB_LOG_RAW("bLength: 0x%02x \r\n", hport->config.intf[i].altsetting[j].intf_desc.bLength); - USB_LOG_RAW("bDescriptorType: 0x%02x \r\n", hport->config.intf[i].altsetting[j].intf_desc.bDescriptorType); - USB_LOG_RAW("bInterfaceNumber: 0x%02x \r\n", hport->config.intf[i].altsetting[j].intf_desc.bInterfaceNumber); - USB_LOG_RAW("bAlternateSetting: 0x%02x \r\n", hport->config.intf[i].altsetting[j].intf_desc.bAlternateSetting); - USB_LOG_RAW("bNumEndpoints: 0x%02x \r\n", hport->config.intf[i].altsetting[j].intf_desc.bNumEndpoints); - USB_LOG_RAW("bInterfaceClass: 0x%02x \r\n", hport->config.intf[i].altsetting[j].intf_desc.bInterfaceClass); - USB_LOG_RAW("bInterfaceSubClass: 0x%02x \r\n", hport->config.intf[i].altsetting[j].intf_desc.bInterfaceSubClass); - USB_LOG_RAW("bInterfaceProtocol: 0x%02x \r\n", hport->config.intf[i].altsetting[j].intf_desc.bInterfaceProtocol); - USB_LOG_RAW("iInterface: 0x%02x \r\n", hport->config.intf[i].altsetting[j].intf_desc.iInterface); - - for (uint8_t k = 0; k < hport->config.intf[i].altsetting[j].intf_desc.bNumEndpoints; k++) { - USB_LOG_RAW("Endpoint Descriptor:\r\n"); - USB_LOG_RAW("bLength: 0x%02x \r\n", hport->config.intf[i].altsetting[j].ep[k].ep_desc.bLength); - USB_LOG_RAW("bDescriptorType: 0x%02x \r\n", hport->config.intf[i].altsetting[j].ep[k].ep_desc.bDescriptorType); - USB_LOG_RAW("bEndpointAddress: 0x%02x \r\n", hport->config.intf[i].altsetting[j].ep[k].ep_desc.bEndpointAddress); - USB_LOG_RAW("bmAttributes: 0x%02x \r\n", hport->config.intf[i].altsetting[j].ep[k].ep_desc.bmAttributes); - USB_LOG_RAW("wMaxPacketSize: 0x%04x \r\n", hport->config.intf[i].altsetting[j].ep[k].ep_desc.wMaxPacketSize); - USB_LOG_RAW("bInterval: 0x%02x \r\n", hport->config.intf[i].altsetting[j].ep[k].ep_desc.bInterval); - } - } - } -} - -static int usbh_get_default_mps(int speed) -{ - switch (speed) { - case USB_SPEED_LOW: /* For low speed, we use 8 bytes */ - return 8; - case USB_SPEED_FULL: /* For full or high speed, we use 64 bytes */ - case USB_SPEED_HIGH: - return 64; - case USB_SPEED_SUPER: /* For super speed , we must use 512 bytes */ - case USB_SPEED_SUPER_PLUS: - return 512; - default: - return 64; - } -} - -int usbh_hport_activate_ep0(struct usbh_hubport *hport) -{ - struct usbh_endpoint_cfg ep0_cfg = { 0 }; - - ep0_cfg.ep_addr = 0x00; - ep0_cfg.ep_interval = 0x00; - ep0_cfg.ep_mps = usbh_get_default_mps(hport->speed); - ep0_cfg.ep_type = USB_ENDPOINT_TYPE_CONTROL; - ep0_cfg.hport = hport; - - usbh_pipe_alloc(&hport->ep0, &ep0_cfg); - return 0; -} - -int usbh_hport_deactivate_ep0(struct usbh_hubport *hport) -{ - struct usbh_bus *usb = usbh_get_bus_of_port(hport); - -#ifndef CONFIG_USBHOST_XHCI - if (hport->dev_addr > 0) { - usbh_free_devaddr(&(usb->g_usbh_bus.devgen), hport->dev_addr); - } -#endif - if (hport->ep0) { - usbh_pipe_free(hport->ep0); - } - - hport->ep0 = NULL; - hport->dev_addr = 0; - return 0; -} - -int usbh_hport_activate_epx(usbh_pipe_t *pipe, struct usbh_hubport *hport, struct usb_endpoint_descriptor *ep_desc) -{ - struct usbh_endpoint_cfg ep_cfg = { 0 }; - - ep_cfg.ep_addr = ep_desc->bEndpointAddress; - ep_cfg.ep_type = ep_desc->bmAttributes & USB_ENDPOINT_TYPE_MASK; - ep_cfg.ep_mps = ep_desc->wMaxPacketSize & USB_MAXPACKETSIZE_MASK; - ep_cfg.ep_interval = ep_desc->bInterval; - ep_cfg.mult = (ep_desc->wMaxPacketSize & USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_MASK) >> USB_MAXPACKETSIZE_ADDITIONAL_TRANSCATION_SHIFT; - ep_cfg.hport = hport; - - USB_LOG_INFO("Ep=%02x Attr=%02u Mps=%d Interval=%02u Mult=%02u\r\n", - ep_cfg.ep_addr, - ep_desc->bmAttributes, - ep_cfg.ep_mps, - ep_cfg.ep_interval, - ep_cfg.mult); - - return usbh_pipe_alloc(pipe, &ep_cfg); -} - -int usbh_enumerate(struct usbh_hubport *hport) -{ - struct usb_interface_descriptor *intf_desc; - struct usb_device_descriptor *dev_desc; - struct usb_setup_packet *setup; - struct usbh_bus *usb = usbh_get_bus_of_port(hport); - int dev_addr; - uint16_t ep_mps; - int ret; - - hport->setup = &usb->g_setup[hport->parent->index - 1][hport->port - 1]; - setup = hport->setup; - - /* Read the first 8 bytes of the device descriptor */ - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_STANDARD | USB_REQUEST_RECIPIENT_DEVICE; - setup->bRequest = USB_REQUEST_GET_DESCRIPTOR; - setup->wValue = (uint16_t)((USB_DESCRIPTOR_TYPE_DEVICE << 8) | 0); - setup->wIndex = 0; - setup->wLength = 8; - - dev_desc = (struct usb_device_descriptor *)usb->ep0_request_buffer; - ret = usbh_control_transfer(hport->ep0, setup, (uint8_t *)dev_desc); - if (ret < 0) { - USB_LOG_ERR("Failed to get device descriptor,errorcode:%d\r\n", ret); - goto errout; - } - - parse_device_descriptor(hport, dev_desc, 8); - - /* Extract the correct max packetsize from the device descriptor */ - if (dev_desc->bcdUSB >= USB_3_0) { - ep_mps = 1 << dev_desc->bMaxPacketSize0; - } else { - ep_mps = dev_desc->bMaxPacketSize0; - } - - USB_LOG_DBG("Device rev=%04x cls=%02x sub=%02x proto=%02x size=%d\r\n", - dev_desc->bcdUSB, dev_desc->bDeviceClass, dev_desc->bDeviceSubClass, - dev_desc->bDeviceProtocol, ep_mps); - - /* Reconfigure EP0 with the correct maximum packet size */ - usbh_ep_pipe_reconfigure(usb, hport->ep0, 0, ep_mps, 0); - -#ifdef CONFIG_USBHOST_XHCI - extern int usbh_get_xhci_devaddr(usbh_pipe_t * pipe); - - /* Assign a function address to the device connected to this port */ - dev_addr = usbh_get_xhci_devaddr(hport->ep0); - if (dev_addr < 0) { - USB_LOG_ERR("Failed to allocate devaddr,errorcode:%d\r\n", ret); - goto errout; - } -#else - /* Assign a function address to the device connected to this port */ - dev_addr = usbh_allocate_devaddr(&usb->devgen); - if (dev_addr < 0) { - USB_LOG_ERR("Failed to allocate devaddr,errorcode:%d\r\n", ret); - goto errout; - } -#endif - - /* Set the USB device address */ - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_STANDARD | USB_REQUEST_RECIPIENT_DEVICE; - setup->bRequest = USB_REQUEST_SET_ADDRESS; - setup->wValue = dev_addr; - setup->wIndex = 0; - setup->wLength = 0; - - ret = usbh_control_transfer(hport->ep0, setup, NULL); - if (ret < 0) { - USB_LOG_ERR("Failed to set devaddr,errorcode:%d\r\n", ret); - goto errout; - } - - /* Wait device set address completely */ - usb_osal_msleep(2); - - /* Assign the function address to the port */ - hport->dev_addr = dev_addr; - - /* And reconfigure EP0 with the correct address */ - usbh_ep_pipe_reconfigure(usb, hport->ep0, dev_addr, ep_mps, 0); - - /* Read the full device descriptor */ - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_STANDARD | USB_REQUEST_RECIPIENT_DEVICE; - setup->bRequest = USB_REQUEST_GET_DESCRIPTOR; - setup->wValue = (uint16_t)((USB_DESCRIPTOR_TYPE_DEVICE << 8) | 0); - setup->wIndex = 0; - setup->wLength = USB_SIZEOF_DEVICE_DESC; - - ret = usbh_control_transfer(hport->ep0, setup, usb->ep0_request_buffer); - if (ret < 0) { - USB_LOG_ERR("Failed to get full device descriptor,errorcode:%d\r\n", ret); - goto errout; - } - - parse_device_descriptor(hport, (struct usb_device_descriptor *)usb->ep0_request_buffer, USB_SIZEOF_DEVICE_DESC); - USB_LOG_INFO("New device found,idVendor:%04x,idProduct:%04x,bcdDevice:%04x\r\n", - ((struct usb_device_descriptor *)usb->ep0_request_buffer)->idVendor, - ((struct usb_device_descriptor *)usb->ep0_request_buffer)->idProduct, - ((struct usb_device_descriptor *)usb->ep0_request_buffer)->bcdDevice); - - /* Read the first 9 bytes of the config descriptor */ - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_STANDARD | USB_REQUEST_RECIPIENT_DEVICE; - setup->bRequest = USB_REQUEST_GET_DESCRIPTOR; - setup->wValue = (uint16_t)((USB_DESCRIPTOR_TYPE_CONFIGURATION << 8) | 0); - setup->wIndex = 0; - setup->wLength = USB_SIZEOF_CONFIG_DESC; - - ret = usbh_control_transfer(hport->ep0, setup, usb->ep0_request_buffer); - if (ret < 0) { - USB_LOG_ERR("Failed to get config descriptor,errorcode:%d\r\n", ret); - goto errout; - } - - parse_config_descriptor(hport, (struct usb_configuration_descriptor *)usb->ep0_request_buffer, USB_SIZEOF_CONFIG_DESC); - - /* Read the full size of the configuration data */ - uint16_t wTotalLength = ((struct usb_configuration_descriptor *)usb->ep0_request_buffer)->wTotalLength; - - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_STANDARD | USB_REQUEST_RECIPIENT_DEVICE; - setup->bRequest = USB_REQUEST_GET_DESCRIPTOR; - setup->wValue = (uint16_t)((USB_DESCRIPTOR_TYPE_CONFIGURATION << 8) | 0); - setup->wIndex = 0; - setup->wLength = wTotalLength; - - ret = usbh_control_transfer(hport->ep0, setup, usb->ep0_request_buffer); - if (ret < 0) { - USB_LOG_ERR("Failed to get full config descriptor,errorcode:%d\r\n", ret); - goto errout; - } - - ret = parse_config_descriptor(hport, (struct usb_configuration_descriptor *)usb->ep0_request_buffer, wTotalLength); - if (ret < 0) { - USB_LOG_ERR("Parse config fail\r\n"); - goto errout; - } - USB_LOG_INFO("The device has %d interfaces\r\n", ((struct usb_configuration_descriptor *)usb->ep0_request_buffer)->bNumInterfaces); - hport->raw_config_desc = usb_malloc(wTotalLength); - if (hport->raw_config_desc == NULL) { - ret = -ENOMEM; - USB_LOG_ERR("No memory to alloc for raw_config_desc\r\n"); - goto errout; - } - memcpy(hport->raw_config_desc, usb->ep0_request_buffer, wTotalLength); -#ifdef CONFIG_USBHOST_GET_STRING_DESC - /* Get Manufacturer string */ - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_STANDARD | USB_REQUEST_RECIPIENT_DEVICE; - setup->bRequest = USB_REQUEST_GET_DESCRIPTOR; - setup->wValue = (uint16_t)((USB_DESCRIPTOR_TYPE_STRING << 8) | USB_STRING_MFC_INDEX); - setup->wIndex = 0x0409; - setup->wLength = 255; - - ret = usbh_control_transfer(hport->ep0, setup, usb->ep0_request_buffer); - if (ret < 0) { - USB_LOG_ERR("Failed to get Manufacturer string,errorcode:%d\r\n", ret); - goto errout; - } - - usbh_print_string("Manufacturer: ", usb->ep0_request_buffer); - - /* Get Product string */ - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_STANDARD | USB_REQUEST_RECIPIENT_DEVICE; - setup->bRequest = USB_REQUEST_GET_DESCRIPTOR; - setup->wValue = (uint16_t)((USB_DESCRIPTOR_TYPE_STRING << 8) | USB_STRING_PRODUCT_INDEX); - setup->wIndex = 0x0409; - setup->wLength = 255; - - ret = usbh_control_transfer(hport->ep0, setup, usb->ep0_request_buffer); - if (ret < 0) { - USB_LOG_ERR("Failed to get get Product string,errorcode:%d\r\n", ret); - goto errout; - } - - usbh_print_string("Product: ", usb->ep0_request_buffer); - - /* Get SerialNumber string */ - setup->bmRequestType = USB_REQUEST_DIR_IN | USB_REQUEST_STANDARD | USB_REQUEST_RECIPIENT_DEVICE; - setup->bRequest = USB_REQUEST_GET_DESCRIPTOR; - setup->wValue = (uint16_t)((USB_DESCRIPTOR_TYPE_STRING << 8) | USB_STRING_SERIAL_INDEX); - setup->wIndex = 0x0409; - setup->wLength = 255; - - ret = usbh_control_transfer(hport->ep0, setup, usb->ep0_request_buffer); - if (ret < 0) { - USB_LOG_ERR("Failed to get get SerialNumber string,errorcode:%d\r\n", ret); - goto errout; - } - - usbh_print_string("SerialNumber: ", usb->ep0_request_buffer); -#endif - /* Select device configuration 1 */ - setup->bmRequestType = USB_REQUEST_DIR_OUT | USB_REQUEST_STANDARD | USB_REQUEST_RECIPIENT_DEVICE; - setup->bRequest = USB_REQUEST_SET_CONFIGURATION; - setup->wValue = 1; - setup->wIndex = 0; - setup->wLength = 0; - - ret = usbh_control_transfer(hport->ep0, setup, NULL); - if (ret < 0) { - USB_LOG_ERR("Failed to set configuration,errorcode:%d\r\n", ret); - goto errout; - } - - USB_LOG_INFO("Enumeration success, start loading class driver\r\n"); - -#ifdef CONFIG_USBHOST_ENUM_FIRST_INTERFACE_ONLY - USB_LOG_INFO("Support %d Interfaces, select the first one \r\n", hport->config.config_desc.bNumInterfaces); - hport->config.config_desc.bNumInterfaces = 1U; -#endif - - /*search supported class driver*/ - for (uint8_t i = 0; i < hport->config.config_desc.bNumInterfaces; i++) { - intf_desc = &hport->config.intf[i].altsetting[0].intf_desc; - - struct usbh_class_driver *class_driver = (struct usbh_class_driver *)usbh_find_class_driver(intf_desc->bInterfaceClass, intf_desc->bInterfaceSubClass, intf_desc->bInterfaceProtocol, hport->device_desc.idVendor, hport->device_desc.idProduct); - - if (class_driver == NULL) { - USB_LOG_ERR("do not support Class:0x%02x,Subclass:0x%02x,Protocl:0x%02x\r\n", - intf_desc->bInterfaceClass, - intf_desc->bInterfaceSubClass, - intf_desc->bInterfaceProtocol); - - continue; - } - hport->config.intf[i].class_driver = class_driver; - USB_LOG_INFO("Class:0x%02x,Subclass:0x%02x,Protocl:0x%02x\r\n", - intf_desc->bInterfaceClass, - intf_desc->bInterfaceSubClass, - intf_desc->bInterfaceProtocol); - USB_LOG_RAW("Loading %s class driver\r\n", class_driver->driver_name); - ret = CLASS_CONNECT(hport, i); - } - -errout: - if (hport->raw_config_desc) { - usb_free(hport->raw_config_desc); - hport->raw_config_desc = NULL; - } - return ret; -} - -struct usbh_hubport *usbh_find_hubport(uint32_t usb_id, uint8_t dev_addr) -{ - struct usbh_hubport *hport; - struct usbh_bus *usb = usbh_get_bus_of_index(usb_id); - usb_slist_t *hub_list; - usb_slist_for_each(hub_list, &usb->hub_class_head) - { - struct usbh_hub *hub = usb_slist_entry(hub_list, struct usbh_hub, list); - for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) { - hport = &hub->child[port]; - if (hport->connected) { - if (hport->dev_addr == dev_addr) { - return &hub->child[port]; - } - } - } - } - return NULL; -} - -void *usbh_find_class_instance(const char *devname) -{ - struct usbh_hubport *hport; - usb_slist_t *hub_list; - struct usbh_bus* usb = usbh_get_bus_of_devname(devname); - if (!usb) { - return NULL; - } - - usb_slist_for_each(hub_list, &usb->hub_class_head) - { - struct usbh_hub *hub = usb_slist_entry(hub_list, struct usbh_hub, list); - for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) { - hport = &hub->child[port]; - if (hport->connected) { - for (uint8_t itf = 0; itf < hport->config.config_desc.bNumInterfaces; itf++) { - if ((strncmp(hport->config.intf[itf].devname, devname, CONFIG_USBHOST_DEV_NAMELEN) == 0) && hport->config.intf[itf].priv) - return hport->config.intf[itf].priv; - } - } - } - } - return NULL; -} - -int usbh_initialize(uint32_t id, struct usbh_bus *usb) -{ - memset(usb, 0, sizeof(struct usbh_bus)); - -#ifdef __ARMCC_VERSION /* ARM C Compiler */ - extern const int usbh_class_info$$Base; - extern const int usbh_class_info$$Limit; - usbh_class_info_table_begin = (struct usbh_class_info *)&usbh_class_info$$Base; - usbh_class_info_table_end = (struct usbh_class_info *)&usbh_class_info$$Limit; -#elif defined(__GNUC__) - extern uint32_t __usbh_class_info_start__; - extern uint32_t __usbh_class_info_end__; - usbh_class_info_table_begin = (struct usbh_class_info *)&__usbh_class_info_start__; - usbh_class_info_table_end = (struct usbh_class_info *)&__usbh_class_info_end__; -#elif defined(__ICCARM__) || defined(__ICCRX__) - usbh_class_info_table_begin = (struct usbh_class_info *)__section_begin("usbh_class_info"); - usbh_class_info_table_end = (struct usbh_class_info *)__section_end("usbh_class_info"); -#endif - - /* allocate usb bus */ - usb->mtu = 65536; - - /* devaddr 1 is for roothub */ - usb->devgen.next = 2; - - usb->hub_event_head.next = NULL; - usb->hub_class_head.next = NULL; - usb->id = id; - - usb_slist_add_tail(&usb_buses, &(usb->list)); - usbh_hub_initialize(usb); - return 0; -} - -int usbh_control_transfer(usbh_pipe_t pipe, struct usb_setup_packet *setup, uint8_t *buffer) -{ - struct usbh_urb *urb; - int ret; - - urb = usb_malloc(sizeof(struct usbh_urb)); - memset(urb, 0, sizeof(struct usbh_urb)); - - usbh_control_urb_fill(urb, pipe, setup, buffer, setup->wLength, CONFIG_USBHOST_CONTROL_TRANSFER_TIMEOUT, NULL, NULL); - - ret = usbh_submit_urb(urb); - if (ret == 0) { - ret = urb->actual_length; - } - usb_free(urb); - return ret; -} - -int lsusb(int argc, char **argv) -{ - usb_slist_t *i; - struct usbh_hubport *hport; - const char *opt = NULL; - int min_argc = 3; - int max_argc = 4; - uint8_t usb_id = 0; - - if (argc < min_argc) { - USB_LOG_RAW("Usage: lsusb [options]...\r\n"); - - USB_LOG_RAW("List USB devices\r\n"); - USB_LOG_RAW(" -v, --verbose\r\n"); - USB_LOG_RAW(" Increase verbosity (show descriptors)\r\n"); - // USB_LOG_RAW(" -s [[bus]:[devnum]]\r\n"); - // USB_LOG_RAW(" Show only devices with specified device and/or bus numbers (in decimal)\r\n"); - // USB_LOG_RAW(" -d vendor:[product]\r\n"); - // USB_LOG_RAW(" Show only devices with the specified vendor and product ID numbers (in hexadecimal)\r\n"); - USB_LOG_RAW(" -t, --tree\r\n"); - USB_LOG_RAW(" Dump the physical USB device hierachy as a tree\r\n"); - USB_LOG_RAW(" -V, --version\r\n"); - USB_LOG_RAW(" Show version of program\r\n"); - USB_LOG_RAW(" -h, --help\r\n"); - USB_LOG_RAW(" Show usage and help\r\n"); - return 0; - } - - if (argc > max_argc) { - return 0; - } - - usb_id = (uint8_t)strtoul(argv[1], NULL, 10); - struct usbh_bus* usb = usbh_get_bus_of_index(usb_id); - if (NULL == usb) { - return 0; - } - - opt = argv[2]; - - if (strcmp(opt, "-t") == 0) { - usb_slist_for_each(i, &usb->hub_class_head) - { - struct usbh_hub *hub = usb_slist_entry(i, struct usbh_hub, list); - - if (hub->is_roothub) { - USB_LOG_RAW("/: Hub %02u, ports=%u, is roothub\r\n", hub->index, hub->hub_desc.bNbrPorts); - } else { - USB_LOG_RAW("/: Hub %02u, ports=%u, mounted on Hub %02u:Port %u\r\n", - hub->index, - hub->hub_desc.bNbrPorts, - hub->parent->parent->index, - hub->parent->port); - } - - for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) { - hport = &hub->child[port]; - if (hport && hport->connected) { - for (uint8_t i = 0; i < hport->config.config_desc.bNumInterfaces; i++) { - if (hport->config.intf[i].class_driver && hport->config.intf[i].class_driver->driver_name) { - USB_LOG_RAW(" |__Port %u,Port addr:0x%02x,If %u,ClassDriver=%s\r\n", - hport->port, - hport->dev_addr, - i, - hport->config.intf[i].class_driver->driver_name); - } - } - } - } - } - } - - if (strcmp(opt, "-v") == 0) { - usb_slist_for_each(i, &usb->hub_class_head) - { - struct usbh_hub *hub = usb_slist_entry(i, struct usbh_hub, list); - for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) { - hport = &hub->child[port]; - if (hport->connected) { - USB_LOG_RAW("Hub %02u,Port %u,Port addr:0x%02x,VID:PID 0x%04x:0x%04x\r\n", - hub->index, - hport->port, - hport->dev_addr, - hport->device_desc.idVendor, - hport->device_desc.idProduct); - usbh_print_hubport_info(hport); - } - } - } - } - - return 0; -} \ No newline at end of file diff --git a/third-party/cherryusb/core/usbh_core.h b/third-party/cherryusb/core/usbh_core.h deleted file mode 100644 index fd8ac72891f4b8b457a6b209509e63733aa1eaef..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/core/usbh_core.h +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USBH_CORE_H -#define USBH_CORE_H - -#include -#include -#include -#include - -#include "usb_config.h" -#include "usb_util.h" -#include "usb_errno.h" -#include "usb_def.h" -#include "usb_list.h" -#include "usb_mem.h" -#include "usb_log.h" -#include "usb_hc.h" -#include "usb_osal.h" -#include "usb_hub.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define USB_CLASS_MATCH_VENDOR 0x0001 -#define USB_CLASS_MATCH_PRODUCT 0x0002 -#define USB_CLASS_MATCH_INTF_CLASS 0x0004 -#define USB_CLASS_MATCH_INTF_SUBCLASS 0x0008 -#define USB_CLASS_MATCH_INTF_PROTOCOL 0x0010 - -#define CLASS_CONNECT(hport, i) ((hport)->config.intf[i].class_driver->connect(hport, i)) -#define CLASS_DISCONNECT(hport, i) ((hport)->config.intf[i].class_driver->disconnect(hport, i)) - -#ifdef __ARMCC_VERSION /* ARM C Compiler */ -#define CLASS_INFO_DEFINE __attribute__((section("usbh_class_info"))) __USED __ALIGNED(1) -#elif defined(__GNUC__) -#define CLASS_INFO_DEFINE __attribute__((section(".usbh_class_info"))) __USED __ALIGNED(1) -#elif defined(__ICCARM__) || defined(__ICCRX__) -#pragma section = "usbh_class_info" -#define CLASS_INFO_DEFINE __attribute__((section("usbh_class_info"))) __USED __ALIGNED(1) -#endif - -static inline void usbh_control_urb_fill(struct usbh_urb *urb, - usbh_pipe_t pipe, - struct usb_setup_packet *setup, - uint8_t *transfer_buffer, - uint32_t transfer_buffer_length, - uint32_t timeout, - usbh_complete_callback_t complete, - void *arg) -{ - urb->pipe = pipe; - urb->setup = setup; - urb->transfer_buffer = transfer_buffer; - urb->transfer_buffer_length = transfer_buffer_length; - urb->timeout = timeout; - urb->complete = complete; - urb->arg = arg; -} - -static inline void usbh_bulk_urb_fill(struct usbh_urb *urb, - usbh_pipe_t pipe, - uint8_t *transfer_buffer, - uint32_t transfer_buffer_length, - uint32_t timeout, - usbh_complete_callback_t complete, - void *arg) -{ - urb->pipe = pipe; - urb->setup = NULL; - urb->transfer_buffer = transfer_buffer; - urb->transfer_buffer_length = transfer_buffer_length; - urb->timeout = timeout; - urb->complete = complete; - urb->arg = arg; -} - -static inline void usbh_int_urb_fill(struct usbh_urb *urb, - usbh_pipe_t pipe, - uint8_t *transfer_buffer, - uint32_t transfer_buffer_length, - uint32_t timeout, - usbh_complete_callback_t complete, - void *arg) -{ - urb->pipe = pipe; - urb->setup = NULL; - urb->transfer_buffer = transfer_buffer; - urb->transfer_buffer_length = transfer_buffer_length; - urb->timeout = timeout; - urb->complete = complete; - urb->arg = arg; -} - -struct usbh_class_info { - uint8_t match_flags; /* Used for product specific matches; range is inclusive */ - uint8_t class; /* Base device class code */ - uint8_t subclass; /* Sub-class, depends on base class. Eg. */ - uint8_t protocol; /* Protocol, depends on base class. Eg. */ - uint16_t vid; /* Vendor ID (for vendor/product specific devices) */ - uint16_t pid; /* Product ID (for vendor/product specific devices) */ - const struct usbh_class_driver *class_driver; -}; - -struct usbh_hubport; -struct usbh_class_driver { - const char *driver_name; - int (*connect)(struct usbh_hubport *hport, uint8_t intf); - int (*disconnect)(struct usbh_hubport *hport, uint8_t intf); -}; - -struct usbh_endpoint { - struct usb_endpoint_descriptor ep_desc; -}; - -struct usbh_interface_altsetting { - struct usb_interface_descriptor intf_desc; - struct usbh_endpoint ep[CONFIG_USBHOST_MAX_ENDPOINTS]; -}; - -struct usbh_interface { - char devname[CONFIG_USBHOST_DEV_NAMELEN]; - struct usbh_class_driver *class_driver; - void *priv; - struct usbh_interface_altsetting altsetting[CONFIG_USBHOST_MAX_INTF_ALTSETTINGS]; - uint8_t altsetting_num; -}; - -struct usbh_configuration { - struct usb_configuration_descriptor config_desc; - struct usbh_interface intf[CONFIG_USBHOST_MAX_INTERFACES]; -}; - -struct usbh_hub; -struct usbh_hubport { - /** Name */ - char name[32]; - bool connected; /* True: device connected; false: disconnected */ - uint8_t port; /* Hub port index */ - uint8_t dev_addr; /* device address */ - uint8_t speed; /* device speed */ - usbh_pipe_t ep0; /* control ep pipe info */ - struct usb_device_descriptor device_desc; - struct usbh_configuration config; - const char *iManufacturer; - const char *iProduct; - const char *iSerialNumber; - uint8_t *raw_config_desc; - struct usb_setup_packet *setup; - struct usbh_hub *parent; -#ifdef CONFIG_USBHOST_XHCI - uint32_t protocol; /* port protocol, for xhci, some ports are USB2.0, others are USB3.0 */ -#endif -}; - - -struct usbh_bus; -struct usbh_hub { - usb_slist_t list; - bool connected; - bool is_roothub; - uint8_t index; - uint8_t hub_addr; - usbh_pipe_t intin; - uint8_t *int_buffer; - struct usbh_urb intin_urb; - struct usb_hub_descriptor hub_desc; - struct usbh_hubport child[CONFIG_USBHOST_MAX_EHPORTS]; - struct usbh_hubport *parent; - usb_slist_t hub_event_list; - struct usbh_bus *usb; - uint32_t ports; /* num of ports */ - USB_MEM_ALIGNX uint8_t g_hub_buf[32]; - USB_MEM_ALIGNX uint8_t g_hub_intbuf[CONFIG_USBHOST_MAX_EXTHUBS + 1][1]; -}; - -int usbh_hport_activate_epx(usbh_pipe_t *pipe, struct usbh_hubport *hport, struct usb_endpoint_descriptor *ep_desc); - -/** - * @brief Submit an control transfer to an endpoint. - * This is a blocking method; this method will not return until the transfer has completed. - * Default timeout is 500ms. - * - * @param pipe The control endpoint to send/receive the control request. - * @param setup Setup packet to be sent. - * @param buffer buffer used for sending the request and for returning any responses. - * @return On success will return 0, and others indicate fail. - */ -int usbh_control_transfer(usbh_pipe_t pipe, struct usb_setup_packet *setup, uint8_t *buffer); - -struct usbh_devaddr_map { - /** - * alloctab[0]:addr from 0~31 - * alloctab[1]:addr from 32~63 - * alloctab[2]:addr from 64~95 - * alloctab[3]:addr from 96~127 - * - */ - uint8_t next; /* Next device address */ - uint32_t alloctab[4]; /* Bit allocation table */ -}; - -struct usbh_bus { - usb_slist_t list; - uint8_t id; - /** Largest transfer allowed on the bus */ - size_t mtu; - struct usbh_devaddr_map devgen; - struct usbh_hub roothub; -#if CONFIG_USBHOST_MAX_EXTHUBS > 0 - struct usbh_hub exthub[CONFIG_USBHOST_MAX_EXTHUBS]; -#endif - struct usbh_hubport roothub_parent_port; - usb_slist_t hub_event_head; - usb_slist_t hub_class_head; - usb_osal_sem_t hub_event_wait; - usb_osal_thread_t hub_thread; - usb_osal_mq_t hub_mq; - void *priv; /* private data, usb host */ - int (*hub_open)(struct usbh_hub *hub); - void (*hub_close)(struct usbh_hub *hub); - int (*root_open)(struct usbh_hub *hub); - USB_MEM_ALIGNX uint8_t ep0_request_buffer[CONFIG_USBHOST_REQUEST_BUFFER_LEN]; - USB_MEM_ALIGNX struct usb_setup_packet g_setup[CONFIG_USBHOST_MAX_EXTHUBS + 1][CONFIG_USBHOST_MAX_EHPORTS]; -}; - -/** - * Get USB transaction translator - * - * @v hport Hub port of USB device - * @ret port Transaction translator port, or NULL - */ -struct usbh_hubport *usbh_transaction_translator ( struct usbh_hubport *hport ); - -/** - * Get USB route string - * - * @v hport Hub Port of USB device - * @ret route USB route string - */ -unsigned int usbh_route_string ( struct usbh_hubport *hport ); - -static inline struct usbh_bus* usbh_get_bus_of_port(struct usbh_hubport *hport) -{ - USB_ASSERT(hport && hport->parent); - return hport->parent->usb; -} - -static inline struct usbh_hub *usbh_get_roothub_of_port(struct usbh_hubport *hport) -{ - return &(usbh_get_bus_of_port(hport)->roothub); -} - -struct usbh_bus* usbh_get_bus_of_index(uint8_t usb); - -/** - * Get USB root hub port - * - * @v hport Hub port of USB device - * @ret port Root hub port - */ -struct usbh_hubport * usbh_root_hub_port ( struct usbh_hubport *hport ); - -int usbh_initialize(uint32_t id, struct usbh_bus *usb); -struct usbh_hubport *usbh_find_hubport(uint32_t id, uint8_t dev_addr); -void *usbh_find_class_instance(const char *devname); -int lsusb(int argc, char **argv); - -#ifdef __cplusplus -} -#endif - -#endif /* USBH_CORE_H */ diff --git a/third-party/cherryusb/docs/Makefile b/third-party/cherryusb/docs/Makefile deleted file mode 100644 index d0c3cbf1020d5c292abdedf27627c6abe25e2293..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line, and also -# from the environment for the first two. -SPHINXOPTS ?= -SPHINXBUILD ?= sphinx-build -SOURCEDIR = source -BUILDDIR = build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/third-party/cherryusb/docs/assets/usb_outline.png b/third-party/cherryusb/docs/assets/usb_outline.png deleted file mode 100644 index 4414d92225941c5fce5dc0d7c5d6b0f3959b02ec..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/assets/usb_outline.png and /dev/null differ diff --git a/third-party/cherryusb/docs/make.bat b/third-party/cherryusb/docs/make.bat deleted file mode 100644 index 9534b018135ed7d5caed6298980c55e8b1d2ec82..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/make.bat +++ /dev/null @@ -1,35 +0,0 @@ -@ECHO OFF - -pushd %~dp0 - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set SOURCEDIR=source -set BUILDDIR=build - -if "%1" == "" goto help - -%SPHINXBUILD% >NUL 2>NUL -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% -goto end - -:help -%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% - -:end -popd diff --git a/third-party/cherryusb/docs/requirements.txt b/third-party/cherryusb/docs/requirements.txt deleted file mode 100644 index 03cfbf106943cf2204059d7e16fd52f891e231ea..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/requirements.txt +++ /dev/null @@ -1,9 +0,0 @@ -# markdown suport -recommonmark -# markdown table suport -sphinx-markdown-tables - -# theme default rtd - -# crate-docs-theme -sphinx-rtd-theme \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/api/api_common.rst b/third-party/cherryusb/docs/source/api/api_common.rst deleted file mode 100644 index 3c4653d93c97464c4fc599ec83ef60b487c1457f..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/api/api_common.rst +++ /dev/null @@ -1,48 +0,0 @@ -其他 -========================= - -usb_malloc -"""""""""""""""""""""""""""""""""""" - -``usb_malloc`` 用来申请内存。 - -.. code-block:: C - - void *usb_malloc(size_t size); - -- **size** 要申请的内存大小 -- **return** 申请的内存地址 - -usb_free -"""""""""""""""""""""""""""""""""""" - -``usb_free`` 用来释放申请的内存。 - -.. code-block:: C - - void usb_free(void *ptr); - -- **ptr** 要释放的内存地址 - -usb_iomalloc -"""""""""""""""""""""""""""""""""""" - -``usb_iomalloc`` 用来申请内存,并按照 `CONFIG_DCACHE_LINE_SIZE` 对齐,一般使用到 dcache 和 dma 需要对齐操作的时候使用。 - -.. code-block:: C - - void *usb_iomalloc(size_t size); - -- **size** 要申请的内存大小 -- **return** 申请的内存地址 - -usb_iofree -"""""""""""""""""""""""""""""""""""" - -``usb_iofree`` 用来释放申请的内存。 - -.. code-block:: C - - void usb_iofree(void *ptr); - -- **ptr** 要释放的内存地址 diff --git a/third-party/cherryusb/docs/source/api/api_config.rst b/third-party/cherryusb/docs/source/api/api_config.rst deleted file mode 100644 index 836d3d85cb8c04234fefaf2bfa08c12436bfea66..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/api/api_config.rst +++ /dev/null @@ -1,11 +0,0 @@ -USB CONFIG 宏 -========================= - -通用 CONFIG 宏 ---------------------- - -设备相关 CONFIG 宏 ---------------------- - -主机相关 CONFIG 宏 ---------------------- diff --git a/third-party/cherryusb/docs/source/api/api_device.rst b/third-party/cherryusb/docs/source/api/api_device.rst deleted file mode 100644 index 7b5233cd88fb31cda247ca9cf1fdba25d842677d..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/api/api_device.rst +++ /dev/null @@ -1,489 +0,0 @@ -设备协议栈 -========================= - -设备协议栈主要负责枚举和驱动加载,枚举这边就不说了,驱动加载,也就是接口驱动加载,主要是依靠 `usbd_add_interface` 函数,记录传入的接口驱动保存到链表中,当主机进行类请求时就可以查找链表进行访问了。 -在调用 `usbd_desc_register` 以后需要进行接口注册和端点注册,口诀如下: - -- 有多少个接口就调用多少次 `usbd_add_interface`,参数填相关 `xxx_init_intf`, 如果没有支持的,手动创建一个填入 -- 有多少个端点就调用多少次 `usbd_add_endpoint`,当中断完成时,会调用到注册的端点回调中。 - -CORE ------------------ - -端点结构体 -"""""""""""""""""""""""""""""""""""" - -端点结构体主要用于注册不同端点地址的中断完成回调函数。 - -.. code-block:: C - - struct usbd_endpoint { - uint8_t ep_addr; - usbd_endpoint_callback ep_cb; - }; - -- **list** 端点的链表节点 -- **ep_addr** 端点地址(带方向) -- **ep_cb** 端点完成中断回调函数。 - -.. note:: 总结一句话:in 回调函数等价于 dma 发送完成中断回调函数;out 回调函数等价于 dma 接收完成中断回调函数 - -接口结构体 -"""""""""""""""""""""""""""""""""""" - -接口结构体主要用于注册不同类设备除了标准设备请求外的其他请求,包括类设备请求、厂商设备请求和自定义设备请求。以及协议栈中的相关通知回调函数。 - -.. code-block:: C - - struct usbd_interface { - usb_slist_t list; - usbd_request_handler class_interface_handler; - usbd_request_handler class_endpoint_handler; - usbd_request_handler vendor_handler; - usbd_notify_handler notify_handler; - const uint8_t *hid_report_descriptor; - uint32_t hid_report_descriptor_len; - uint8_t intf_num; - }; - -- **list** 接口的链表节点 -- **class_interface_handler** class setup 请求回调函数,接收者为接口 -- **class_endpoint_handler** class setup 请求回调函数,接收者为端点 -- **vendor_handler** vendor setup 请求回调函数 -- **notify_handler** 中断标志、协议栈相关状态回调函数 -- **hid_report_descriptor** hid 报告描述符 -- **hid_report_descriptor_len** hid 报告描述符长度 -- **intf_num** 当前接口偏移 -- **ep_list** 端点的链表节点 - -usbd_desc_register -"""""""""""""""""""""""""""""""""""" - -``usbd_desc_register`` 用来注册 USB 描述符,描述符种类包括:设备描述符、配置描述符(包含配置描述符、接口描述符、class 类描述符、端点描述符)、字符串描述符、设备限定描述符。 - -.. code-block:: C - - void usbd_desc_register(const uint8_t *desc); - -- **desc** 描述符的句柄 - -usbd_msosv1_desc_register -"""""""""""""""""""""""""""""""""""" - -``usbd_msosv1_desc_register`` 用来注册一个 WINUSB 1.0 描述符。 - -.. code-block:: C - - void usbd_msosv1_desc_register(struct usb_msosv1_descriptor *desc); - -- **desc** 描述符句柄 - -usbd_msosv2_desc_register -"""""""""""""""""""""""""""""""""""" - -``usbd_msosv2_desc_register`` 用来注册一个 WINUSB 2.0 描述符。 - -.. code-block:: C - - void usbd_msosv2_desc_register(struct usb_msosv2_descriptor *desc); - -- **desc** 描述符句柄 - -usbd_bos_desc_register -"""""""""""""""""""""""""""""""""""" - -``usbd_bos_desc_register`` 用来注册一个 BOS 描述符, USB 2.1 版本以上必须注册。 - -.. code-block:: C - - void usbd_bos_desc_register(struct usb_bos_descriptor *desc); - -- **desc** 描述符句柄 - -usbd_add_interface -"""""""""""""""""""""""""""""""""""" - -``usbd_add_interface`` 添加一个接口驱动。 - -.. code-block:: C - - void usbd_add_interface(struct usbd_interface *intf); - -- **intf** 接口驱动句柄,通常从不同 class 的 `xxx_init_intf` 函数获取 - -usbd_add_endpoint -"""""""""""""""""""""""""""""""""""" - -``usbd_add_endpoint`` 添加一个端点中断完成回调函数。 - -.. code-block:: C - - void usbd_add_endpoint(struct usbd_endpoint *ep);; - -- **ep** 端点句柄 - -usb_device_is_configured -"""""""""""""""""""""""""""""""""""" - -``usb_device_is_configured`` 用来检查 USB 设备是否被配置(枚举)。 - -.. code-block:: C - - bool usb_device_is_configured(void); - -- **return** 配置状态, 0 表示未配置, 1 表示配置成功 - -usbd_configure_done_callback -"""""""""""""""""""""""""""""""""""" - -``usbd_configure_done_callback`` 在执行 set_configuration 命令后触发,表示配置完成,用户需要实现该函数, **此函数一般用作启动第一次数据接收**,如果没有使用到 out 端点,则函数为空即可。 - -.. code-block:: C - - bool usbd_configure_done_callback(void); - -.. warning:: msc 端点不需要在该函数中手动启动,协议栈会自动启动第一次接收 - -usbd_initialize -"""""""""""""""""""""""""""""""""""" - -``usbd_initialize`` 用来初始化 usb device 寄存器配置、usb 时钟、中断等,需要注意,此函数必须在所有列出的 API 最后。 - -.. code-block:: C - - int usbd_initialize(void); - -CDC ACM ------------------ - -usbd_cdc_acm_init_intf -"""""""""""""""""""""""""""""""""""" - -``usbd_cdc_acm_init_intf`` 用来初始化 USB CDC ACM 类接口,并实现该接口相关的函数。 - -- ``cdc_acm_class_interface_request_handler`` 用来处理 USB CDC ACM 类 Setup 请求。 -- ``cdc_notify_handler`` 用来处理 USB CDC 其他中断回调函数。 - -.. code-block:: C - - struct usbd_interface *usbd_cdc_acm_init_intf(struct usbd_interface *intf); - -- **return** 接口句柄 - -usbd_cdc_acm_set_line_coding -"""""""""""""""""""""""""""""""""""" - -``usbd_cdc_acm_set_line_coding`` 用来对串口进行配置,如果仅使用 USB 而不用 串口,该接口不用用户实现,使用默认。 - -.. code-block:: C - - void usbd_cdc_acm_set_line_coding(uint8_t intf, struct cdc_line_coding *line_coding); - -- **intf** 控制接口号 -- **line_coding** 串口配置 - -usbd_cdc_acm_get_line_coding -"""""""""""""""""""""""""""""""""""" - -``usbd_cdc_acm_get_line_coding`` 用来获取串口进行配置,如果仅使用 USB 而不用 串口,该接口不用用户实现,使用默认。 - -.. code-block:: C - - void usbd_cdc_acm_get_line_coding(uint8_t intf, struct cdc_line_coding *line_coding); - -- **intf** 控制接口号 -- **line_coding** 串口配置 - -usbd_cdc_acm_set_dtr -"""""""""""""""""""""""""""""""""""" - -``usbd_cdc_acm_set_dtr`` 用来控制串口 DTR 。如果仅使用 USB 而不用 串口,该接口不用用户实现,使用默认。 - -.. code-block:: C - - void usbd_cdc_acm_set_dtr(uint8_t intf, bool dtr); - -- **intf** 控制接口号 -- **dtr** dtr 为1表示拉低电平,为0表示拉高电平 - -usbd_cdc_acm_set_rts -"""""""""""""""""""""""""""""""""""" - -``usbd_cdc_acm_set_rts`` 用来控制串口 RTS 。如果仅使用 USB 而不用 串口,该接口不用用户实现,使用默认。 - -.. code-block:: C - - void usbd_cdc_acm_set_rts(uint8_t intf, bool rts); - -- **intf** 控制接口号 -- **rts** rts 为1表示拉低电平,为0表示拉高电平 - -CDC_ACM_DESCRIPTOR_INIT -"""""""""""""""""""""""""""""""""""" - -``CDC_ACM_DESCRIPTOR_INIT`` 配置了默认的 cdc acm 需要的描述符以及参数,方便用户使用。总长度为 `CDC_ACM_DESCRIPTOR_LEN` 。 - -.. code-block:: C - - CDC_ACM_DESCRIPTOR_INIT(bFirstInterface, int_ep, out_ep, in_ep, str_idx); - -- **bFirstInterface** 表示该 cdc acm 第一个接口所在所有接口的偏移 -- **int_ep** 表示中断端点地址(带方向) -- **out_ep** 表示 bulk out 端点地址(带方向) -- **in_ep** 表示 bulk in 端点地址(带方向) -- **str_idx** 控制接口对应的字符串 id - -HID ------------------ - -usbd_hid_init_intf -"""""""""""""""""""""""""""""""""""" - -``usbd_hid_init_intf`` 用来初始化 USB HID 类接口,并实现该接口相关的函数: - -- ``hid_class_interface_request_handler`` 用来处理 USB HID 类的 Setup 请求。 -- ``hid_notify_handler`` 用来处理 USB HID 其他中断回调函数。 - -.. code-block:: C - - struct usbd_interface *usbd_hid_init_intf(struct usbd_interface *intf, const uint8_t *desc, uint32_t desc_len); - -- **desc** 报告描述符 -- **desc_len** 报告描述符长度 - -MSC ------------------ - -usbd_msc_init_intf -"""""""""""""""""""""""""""""""""""" -``usbd_msc_init_intf`` 用来初始化 MSC 类接口,并实现该接口相关函数,并且注册端点回调函数。(因为 msc bot 协议是固定的,所以不需要用于实现,因此端点回调函数自然不需要用户实现)。 - -- ``msc_storage_class_interface_request_handler`` 用于处理 USB MSC Setup 中断请求。 -- ``msc_storage_notify_handler`` 用于实现 USB MSC 其他中断回调函数。 - -- ``mass_storage_bulk_out`` 用于处理 USB MSC 端点 out 中断。 -- ``mass_storage_bulk_in`` 用于处理 USB MSC 端点 in 中断。 - -.. code-block:: C - - struct usbd_interface *usbd_msc_init_intf(struct usbd_interface *intf, const uint8_t out_ep, const uint8_t in_ep); - -- **out_ep** out 端点地址 -- **in_ep** in 端点地址 - -usbd_msc_get_cap -"""""""""""""""""""""""""""""""""""" - -``usbd_msc_get_cap`` 用来获取存储器的 lun、扇区个数和每个扇区大小。用户必须实现该函数。 - -.. code-block:: C - - void usbd_msc_get_cap(uint8_t lun, uint32_t *block_num, uint16_t *block_size); - -- **lun** 存储逻辑单元,暂时无用,默认支持一个 -- **block_num** 存储扇区个数 -- **block_size** 存储扇区大小 - -usbd_msc_sector_read -"""""""""""""""""""""""""""""""""""" - -``usbd_msc_sector_read`` 用来对存储器某个扇区开始的地址进行数据读取。用户必须实现该函数。 - -.. code-block:: C - - int usbd_msc_sector_read(uint32_t sector, uint8_t *buffer, uint32_t length); - -- **sector** 扇区偏移 -- **buffer** 存储读取的数据的指针 -- **length** 读取长度,当前为1个扇区的大小 - - -usbd_msc_sector_write -"""""""""""""""""""""""""""""""""""" - -``usbd_msc_sector_write`` 用来对存储器某个扇区开始写入数据。用户必须实现该函数。 - -.. code-block:: C - - int usbd_msc_sector_write(uint32_t sector, uint8_t *buffer, uint32_t length); - -- **sector** 扇区偏移 -- **buffer** 写入数据指针 -- **length** 写入长度,当前为1个扇区的大小 - -UAC ------------------ - -usbd_audio_init_intf -"""""""""""""""""""""""""""""""""""" -``usbd_audio_init_intf`` 用来初始化 USB Audio 类接口,并实现该接口相关的函数: - -- ``audio_class_interface_request_handler`` 用于处理 USB Audio Setup 接口接收者中断请求。 -- ``audio_class_endpoint_request_handler`` 用于处理 USB Audio Setup 端点接收者中断请求。 -- ``audio_notify_handler`` 用于实现 USB Audio 其他中断回调函数。 - -.. code-block:: C - - struct usbd_interface *usbd_audio_init_intf(struct usbd_interface *intf); - -- **class** 类的句柄 -- **intf** 接口句柄 - -usbd_audio_open -"""""""""""""""""""""""""""""""""""" - -``usbd_audio_open`` 用来开启音频数据传输。 - -.. code-block:: C - - void usbd_audio_open(uint8_t intf); - -- **intf** 开启的接口号 - -usbd_audio_close -"""""""""""""""""""""""""""""""""""" - -``usbd_audio_close`` 用来关闭音频数据传输。 - -.. code-block:: C - - void usbd_audio_close(uint8_t intf); - -- **intf** 关闭的接口号 - -usbd_audio_add_entity -"""""""""""""""""""""""""""""""""""" - -``usbd_audio_add_entity`` 用来添加 unit 相关控制,例如 feature unit、clock source。 - -.. code-block:: C - - void usbd_audio_add_entity(uint8_t entity_id, uint16_t bDescriptorSubtype); - -- **entity_id** 要添加的 unit id -- **bDescriptorSubtype** entity_id 的描述符子类型 - -usbd_audio_set_mute -"""""""""""""""""""""""""""""""""""" - -``usbd_audio_set_mute`` 用来设置静音。 - -.. code-block:: C - - void usbd_audio_set_mute(uint8_t ch, uint8_t enable); - -- **ch** 要设置静音的通道 -- **enable** 为1 表示静音,0相反 - -usbd_audio_set_volume -"""""""""""""""""""""""""""""""""""" - -``usbd_audio_set_volume`` 用来设置音量。 - -.. code-block:: C - - void usbd_audio_set_volume(uint8_t ch, float dB); - -- **ch** 要设置音量的通道 -- **dB** 要设置音量的分贝,其中 UAC1.0范围从 -127 ~ +127dB,UAC2.0 从 0 ~ 256dB - -usbd_audio_set_sampling_freq -"""""""""""""""""""""""""""""""""""" - -``usbd_audio_set_sampling_freq`` 用来设置设备上音频模块的采样率 - -.. code-block:: C - - void usbd_audio_set_sampling_freq(uint8_t ep_ch, uint32_t sampling_freq); - -- **ch** 要设置采样率的端点或者通道,UAC1.0为端点,UAC2.0 为通道 -- **dB** 要设置的采样率 - -usbd_audio_get_sampling_freq_table -"""""""""""""""""""""""""""""""""""" - -``usbd_audio_get_sampling_freq_table`` 用来获取支持的采样率列表,如果函数没有实现,则使用默认采样率列表。 - -.. code-block:: C - - void usbd_audio_get_sampling_freq_table(uint8_t **sampling_freq_table); - -- **sampling_freq_table** 采样率列表地址,格式参考默认采样率列表 - -usbd_audio_set_pitch -"""""""""""""""""""""""""""""""""""" - -``usbd_audio_set_pitch`` 用来设置音频音调,仅 UAC1.0 有这功能。 - -.. code-block:: C - - void usbd_audio_set_pitch(uint8_t ep, bool enable); - -- **ep** 要设置音调的端点 -- **enable** 开启或关闭音调 - -UVC ------------------ - -usbd_video_init_intf -"""""""""""""""""""""""""""""""""""" -``usbd_video_init_intf`` 用来初始化 USB Video 类接口,并实现该接口相关的函数: - -- ``video_class_interface_request_handler`` 用于处理 USB Video Setup 中断请求。 -- ``video_notify_handler`` 用于实现 USB Video 其他中断回调函数。 - -.. code-block:: C - - struct usbd_interface *usbd_video_init_intf(struct usbd_interface *intf, - uint32_t dwFrameInterval, - uint32_t dwMaxVideoFrameSize, - uint32_t dwMaxPayloadTransferSize); - -- **class** 类的句柄 -- **intf** 接口句柄 - -usbd_video_open -"""""""""""""""""""""""""""""""""""" - -``usbd_video_open`` 用来开启视频数据传输。 - -.. code-block:: C - - void usbd_video_open(uint8_t intf); - -- **intf** 开启的接口号 - -usbd_video_close -"""""""""""""""""""""""""""""""""""" - -``usbd_video_close`` 用来关闭视频数据传输。 - -.. code-block:: C - - void usbd_video_open(uint8_t intf); - -- **intf** 关闭的接口号 - -usbd_video_mjpeg_payload_fill -"""""""""""""""""""""""""""""""""""" - -``usbd_video_mjpeg_payload_fill`` 用来填充 mjpeg 到新的 buffer中,其中会对 mjpeg 数据按帧进行切分,切分大小由 ``dwMaxPayloadTransferSize`` 控制,并添加头部信息,当前头部字节数为 2。头部信息见 ``struct video_mjpeg_payload_header`` - -.. code-block:: C - - uint32_t usbd_video_mjpeg_payload_fill(uint8_t *input, uint32_t input_len, uint8_t *output, uint32_t *out_len); - -- **input** mjpeg 格式的数据包,从 FFD8~FFD9结束 -- **input_len** mjpeg数据包大小 -- **output** 输出缓冲区 -- **out_len** 输出实际要发送的长度大小 -- **return** 返回 usb 按照 ``dwMaxPayloadTransferSize`` 大小要发多少帧 - -DFU ------------------ - -PRINTER ------------------ - -MTP ------------------ \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/api/api_host.rst b/third-party/cherryusb/docs/source/api/api_host.rst deleted file mode 100644 index 979aaa8e91ab0abe7e28ae4447b76c2277aabb3b..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/api/api_host.rst +++ /dev/null @@ -1,155 +0,0 @@ -主机协议栈 -========================= - -关于主机协议栈中结构体的命名、分类、成员组成,参考下面这两张图: - -.. figure:: img/api_host1.png -.. figure:: img/api_host2.png - -CORE ------------------ - -CLASS 驱动信息结构体 -"""""""""""""""""""""""""""""""""""" - -.. code-block:: C - - struct usbh_class_info { - uint8_t match_flags; /* Used for product specific matches; range is inclusive */ - uint8_t class; /* Base device class code */ - uint8_t subclass; /* Sub-class, depends on base class. Eg. */ - uint8_t protocol; /* Protocol, depends on base class. Eg. */ - uint16_t vid; /* Vendor ID (for vendor/product specific devices) */ - uint16_t pid; /* Product ID (for vendor/product specific devices) */ - const struct usbh_class_driver *class_driver; - }; - -端点结构体 -"""""""""""""""""""""""""""""""""""" - -.. code-block:: C - - struct usbh_endpoint { - struct usb_endpoint_descriptor ep_desc; - }; - -接口备用结构体 -"""""""""""""""""""""""""""""""""""" - -.. code-block:: C - - struct usbh_interface_altsetting { - struct usb_interface_descriptor intf_desc; - struct usbh_endpoint ep[CONFIG_USBHOST_MAX_ENDPOINTS]; - }; - -接口结构体 -"""""""""""""""""""""""""""""""""""" - -.. code-block:: C - - struct usbh_interface { - struct usbh_interface_altsetting altsetting[CONFIG_USBHOST_MAX_INTF_ALTSETTINGS]; - uint8_t altsetting_num; - char devname[CONFIG_USBHOST_DEV_NAMELEN]; - struct usbh_class_driver *class_driver; - void *priv; - }; - -配置结构体 -"""""""""""""""""""""""""""""""""""" - -.. code-block:: C - - struct usbh_configuration { - struct usb_configuration_descriptor config_desc; - struct usbh_interface intf[CONFIG_USBHOST_MAX_INTERFACES]; - }; - -hubport 结构体 -"""""""""""""""""""""""""""""""""""" - -.. code-block:: C - - struct usbh_hubport { - bool connected; /* True: device connected; false: disconnected */ - uint8_t port; /* Hub port index */ - uint8_t dev_addr; /* device address */ - uint8_t speed; /* device speed */ - usbh_pipe_t ep0; /* control ep pipe info */ - struct usb_device_descriptor device_desc; - struct usbh_configuration config; - const char *iManufacturer; - const char *iProduct; - const char *iSerialNumber; - #if 0 - uint8_t* raw_config_desc; - #endif - USB_MEM_ALIGNX struct usb_setup_packet setup; - struct usbh_hub *parent; - }; - -hub 结构体 -"""""""""""""""""""""""""""""""""""" - -.. code-block:: C - - struct usbh_hub { - usb_slist_t list; - bool connected; - bool is_roothub; - uint8_t index; - uint8_t hub_addr; - usbh_pipe_t intin; - USB_MEM_ALIGNX uint8_t int_buffer[1]; - struct usbh_urb intin_urb; - struct usb_hub_descriptor hub_desc; - struct usbh_hubport child[CONFIG_USBHOST_MAX_EHPORTS]; - struct usbh_hubport *parent; - usb_slist_t hub_event_list; - }; - -usbh_initialize -"""""""""""""""""""""""""""""""""""" - -``usbh_initialize`` 用来初始化 usb 主机协议栈,包括:初始化 usb 主机控制器,创建 roothub 设备,创建 hub 检测线程。 - -.. code-block:: C - - int usbh_initialize(void); - -usbh_find_class_instance -"""""""""""""""""""""""""""""""""""" - -``usbh_find_class_instance`` 根据注册的 class 名称查找对应的 class 结构体句柄。 - -.. code-block:: C - - void *usbh_find_class_instance(const char *devname); - -- **devname** class 名称 -- **return** class 结构体句柄 - -lsusb -"""""""""""""""""""""""""""""""""""" - -``lsusb`` 用来查看和操作 hub 上的设备信息。需要借助 shell 插件使用。 - -.. code-block:: C - - int lsusb(int argc, char **argv); - -CDC ACM ------------------ - -HID ------------------ - -MSC ------------------ - -RNDIS ------------------ - -PRINTER ------------------ \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/api/api_port.rst b/third-party/cherryusb/docs/source/api/api_port.rst deleted file mode 100644 index 95be593d4b96e5ba675b058d695ebae8c8b62bff..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/api/api_port.rst +++ /dev/null @@ -1,281 +0,0 @@ -Porting -========================= - -device controller(dcd) -------------------------- - -usb_dc_init -"""""""""""""""""""""""""""""""""""" - -``usb_dc_init`` 用于初始化 usb device controller 寄存器,设置 usb 引脚、时钟、中断等等。 **此函数不对用户开放**。 - -.. code-block:: C - - int usb_dc_init(void); - -- **return** 返回 0 表示正确,其他表示错误 - -usb_dc_deinit -"""""""""""""""""""""""""""""""""""" - -``usb_dc_deinit`` 用于反初始化 usb device controller 寄存器。 **此函数不对用户开放**。 - -.. code-block:: C - - int usb_dc_deinit(void); - -- **return** 返回 0 表示正确,其他表示错误 - -usbd_set_address -"""""""""""""""""""""""""""""""""""" - -``usbd_set_address`` 设置设备地址。 **此函数不对用户开放**。 - -.. code-block:: C - - int usbd_set_address(const uint8_t addr); - -- **return** 返回 0 表示正确,其他表示错误 - -usbd_ep_open -"""""""""""""""""""""""""""""""""""" - -``usbd_ep_open`` 设置端点的属性,开启对应端点的中断。 **此函数不对用户开放**。 - -.. code-block:: C - - int usbd_ep_open(const struct usbd_endpoint_cfg *ep_cfg); - -- **return** 返回 0 表示正确,其他表示错误 - -usbd_ep_close -"""""""""""""""""""""""""""""""""""" - -``usbd_ep_close`` 关闭端点。 **此函数不对用户开放**。 - -.. code-block:: C - - int usbd_ep_close(const uint8_t ep); - -- **event** -- **return** 返回 0 表示正确,其他表示错误 - -usbd_ep_set_stall -"""""""""""""""""""""""""""""""""""" - -``usbd_ep_set_stall`` 将端点设置成 stall 状态并发送 stall 握手包。 **此函数对用户开放**。 - -.. code-block:: C - - int usbd_ep_set_stall(const uint8_t ep); - -- **ep** 端点地址 -- **return** 返回 0 表示正确,其他表示错误 - -usbd_ep_clear_stall -"""""""""""""""""""""""""""""""""""" - -``usbd_ep_clear_stall`` 清除端点的 stall 状态。 **此函数不对用户开放**。 - -.. code-block:: C - - int usbd_ep_clear_stall(const uint8_t ep); - -- **ep** 端点地址 -- **return** 返回 0 表示正确,其他表示错误 - -usbd_ep_is_stalled -"""""""""""""""""""""""""""""""""""" - -``usbd_ep_is_stalled`` 读取当前端点的 stall 状态。 **此函数不对用户开放**。 - -.. code-block:: C - - int usbd_ep_is_stalled(const uint8_t ep, uint8_t *stalled); - -- **ep** 端点地址 -- **return** 返回 1 表示 stalled,0 表示没有 stall - -usbd_ep_start_write -"""""""""""""""""""""""""""""""""""" - -``usbd_ep_start_write`` 启动端点发送,发送完成以后,会调用注册的 in 端点传输完成中断回调函数。该函数为异步发送。 **此函数对用户开放**。 - -.. code-block:: C - - int usbd_ep_start_write(const uint8_t ep, const uint8_t *data, uint32_t data_len); - -- **ep** in 端点地址 -- **data** 发送数据缓冲区 -- **data_len** 发送长度,原则上无限长,推荐 16K 字节以内 -- **return** 返回 0 表示正确,其他表示错误 - -usbd_ep_start_read -"""""""""""""""""""""""""""""""""""" - -``usbd_ep_start_read`` 启动端点接收,接收完成以后,会调用注册的 out 端点传输完成中断回调函数。该函数为异步接收。 **此函数对用户开放**。 - -.. code-block:: C - - int usbd_ep_start_read(const uint8_t ep, uint8_t *data, uint32_t data_len); - -- **ep** out 端点地址 -- **data** 接收数据缓冲区 -- **data_len** 接收长度,原则上无限长,推荐 16K 字节以内,并且推荐是最大包长的整数倍 -- **return** 返回 0 表示正确,其他表示错误 - -.. note:: 启动接收以后,以下两种情况,会进入传输完成中断:1、最后一包为短包;2、接收总长度等于 data_len - -host controller(hcd) ------------------------- - -usb_hc_init -"""""""""""""""""""""""""""""""""""" - -``usb_hc_init`` 用于初始化 usb host controller 寄存器,设置 usb 引脚、时钟、中断等等。 **此函数不对用户开放**。 - -.. code-block:: C - - int usb_hc_init(void); - -- **return** 返回 0 表示正确,其他表示错误 - -usbh_roothub_control -"""""""""""""""""""""""""""""""""""" - -``usbh_roothub_control`` 用来对 roothub 发起请求, **此函数不对用户开放**。 - -.. code-block:: C - - int usbh_roothub_control(struct usb_setup_packet *setup, uint8_t *buf); - -- **setup** 请求 -- **buf** 接收缓冲区 -- **return** 返回 0 表示正确,其他表示错误 - -usbh_ep0_pipe_reconfigure -"""""""""""""""""""""""""""""""""""" - -``usbh_ep0_pipe_reconfigure`` 重新设置端点 0 的 pipe 属性。 **此函数不对用户开放**。 - -.. code-block:: C - - int usbh_ep0_pipe_reconfigure(usbh_pipe_t pipe, uint8_t dev_addr, uint8_t ep_mps, uint8_t speed); - -- **pipe** pipe 句柄 -- **dev_addr** 端点所在设备地址 -- **ep_mps** 端点最大包长 -- **speed** 端点所在设备的速度 -- **return** 返回 0 表示正确,其他表示错误 - -usbh_pipe_alloc -"""""""""""""""""""""""""""""""""""" - -``usbh_pipe_alloc`` 为端点分配 pipe。 **此函数不对用户开放**。 - -.. code-block:: C - - int usbh_pipe_alloc(usbh_pipe_t *pipe, const struct usbh_endpoint_cfg *ep_cfg); - -- **pipe** pipe 句柄 -- **ep_cfg** 端点初始化需要的一些信息 -- **return** 返回 0 表示正确,其他表示错误 - -usbh_pipe_free -"""""""""""""""""""""""""""""""""""" - -``usbh_pipe_free`` 释放端点的一些属性。 **此函数不对用户开放**。 - -.. code-block:: C - - int usbh_pipe_free(usbh_pipe_t pipe); - -- **pipe** 端点信息 -- **return** 返回 0 表示正确,其他表示错误 - -usbh_submit_urb -"""""""""""""""""""""""""""""""""""" - -``usbh_submit_urb`` 对某个地址上的端点进行数据请求。 **此函数对用户开放**。 - -.. code-block:: C - - int usbh_submit_urb(struct usbh_urb *urb); - -- **urb** usb 请求块 -- **return** 返回 0 表示正确,其他表示错误 - -其中, `urb` 结构体信息如下: - -.. code-block:: C - - struct usbh_urb { - usbh_pipe_t pipe; - struct usb_setup_packet *setup; - uint8_t *transfer_buffer; - uint32_t transfer_buffer_length; - int transfer_flags; - uint32_t actual_length; - uint32_t timeout; - int errorcode; - uint32_t num_of_iso_packets; - usbh_complete_callback_t complete; - void *arg; - struct usbh_iso_frame_packet iso_packet[]; - }; - -- **pipe** 端点对应的 pipe 句柄 -- **setup** setup 请求缓冲区,端点0使用 -- **transfer_buffer** 传输的数据缓冲区 -- **transfer_buffer_length** 传输长度 -- **transfer_flags** 传输时携带的 flag -- **actual_length** 实际传输长度 -- **timeout** 传输超时时间,为 0 该函数则为非阻塞,可在中断中使用 -- **errorcode** 错误码 -- **num_of_iso_packets** iso 帧或者微帧个数 -- **complete** 传输完成回调函数 -- **arg** 传输完成时携带的参数 -- **iso_packet** iso 数据包 - -`errorcode` 可以返回以下值: - -.. list-table:: - :widths: 30 30 - :header-rows: 1 - - * - ERROR CODE - - desc - * - ENOMEM - - 内存不足 - * - ENODEV - - 设备未连接 - * - EBUSY - - 当前数据发送或者接收还未完成 - * - ETIMEDOUT - - 数据发送或者接收超时 - * - EPERM - - 主机收到 STALL 包或者 BABBLE - * - EIO - - 数据传输错误 - * - EAGAIN - - 主机一直收到 NAK 包 - * - EPIPE - - 数据溢出 - * - ESHUTDOWN - - 设备断开,传输中止 - -其中 `iso_packet` 结构体信息如下: - -.. code-block:: C - - struct usbh_iso_frame_packet { - uint8_t *transfer_buffer; - uint32_t transfer_buffer_length; - uint32_t actual_length; - int errorcode; - }; - -- **transfer_buffer** 传输的数据缓冲区 -- **transfer_buffer_length** 传输长度 -- **actual_length** 实际传输长度 -- **errorcode** 错误码 \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/api/img/api_device1.png b/third-party/cherryusb/docs/source/api/img/api_device1.png deleted file mode 100644 index ba218b65631df49e19c024cad74ded7da33bf8e7..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/api/img/api_device1.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/api/img/api_host1.png b/third-party/cherryusb/docs/source/api/img/api_host1.png deleted file mode 100644 index 82932f50caa3f69bfa0bd4ab518d9326b3fc43a0..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/api/img/api_host1.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/api/img/api_host2.png b/third-party/cherryusb/docs/source/api/img/api_host2.png deleted file mode 100644 index 7f6d60b87b1291cd0626ede7886bea4da0819d4c..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/api/img/api_host2.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/class/class_audio.rst b/third-party/cherryusb/docs/source/class/class_audio.rst deleted file mode 100644 index d1a9e2076dc4e57bf7df1239a1c0307acce5a8b8..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/class/class_audio.rst +++ /dev/null @@ -1,4 +0,0 @@ -UAC -========================= - -参考官方 audio 相关 pdf \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/class/class_cdc.rst b/third-party/cherryusb/docs/source/class/class_cdc.rst deleted file mode 100644 index d3ed560f86b98e7e23f1e787489f96c6d649a523..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/class/class_cdc.rst +++ /dev/null @@ -1,4 +0,0 @@ -CDC -========================= - -参考官方 cdc 相关 pdf \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/class/class_hid.rst b/third-party/cherryusb/docs/source/class/class_hid.rst deleted file mode 100644 index 0f9ef13dcf591aa65abd2df99d901fd1242d3501..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/class/class_hid.rst +++ /dev/null @@ -1,4 +0,0 @@ -HID -========================= - -参考官方 hid 相关 pdf \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/class/class_msc.rst b/third-party/cherryusb/docs/source/class/class_msc.rst deleted file mode 100644 index c01a359c7aab2f68542b97b603ffa6800a25b59c..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/class/class_msc.rst +++ /dev/null @@ -1,4 +0,0 @@ -MSC -========================= - -参考官方 msc 相关 pdf \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/class/class_video.rst b/third-party/cherryusb/docs/source/class/class_video.rst deleted file mode 100644 index cabe517334439745fcfbe5f40a7190fa364448d7..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/class/class_video.rst +++ /dev/null @@ -1,4 +0,0 @@ -UVC -========================= - -参考官方 video 相关 pdf \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/class/winusb.rst b/third-party/cherryusb/docs/source/class/winusb.rst deleted file mode 100644 index 8c74d3b75c60867e51c45ed924ab864627acf17f..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/class/winusb.rst +++ /dev/null @@ -1,2 +0,0 @@ -WINUSB -========================= diff --git a/third-party/cherryusb/docs/source/conf.py b/third-party/cherryusb/docs/source/conf.py deleted file mode 100644 index 7896d6e8988ae26358e24db6b0a76ac147d440ae..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/conf.py +++ /dev/null @@ -1,37 +0,0 @@ -# Configuration file for the Sphinx documentation builder. - -# -- Project information - -project = 'CherryUSB' -copyright = '2022, sakumisu' -author = 'sakumisu' - -release = '0.8' -version = '0.8.0' - -# -- General configuration - -extensions = [ - 'sphinx.ext.duration', - 'sphinx.ext.doctest', - 'sphinx.ext.autodoc', - 'sphinx.ext.autosummary', - 'sphinx.ext.intersphinx', - 'recommonmark', - 'sphinx_markdown_tables' -] - -intersphinx_mapping = { -# 'python': ('https://docs.python.org/3/', None), -# 'sphinx': ('https://www.sphinx-doc.org/en/master/', None), -} -intersphinx_disabled_domains = ['std'] - -templates_path = ['_templates'] - -# -- Options for HTML output - -html_theme = 'sphinx_rtd_theme' - -# -- Options for EPUB output -epub_show_urls = 'footnote' diff --git a/third-party/cherryusb/docs/source/demo/audio_mic_speaker.rst b/third-party/cherryusb/docs/source/demo/audio_mic_speaker.rst deleted file mode 100644 index 3c1d2ca9b3a813c63029c5c5274ce8990a27a5bb..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/demo/audio_mic_speaker.rst +++ /dev/null @@ -1,43 +0,0 @@ -USB 双通道麦克风和扬声器 -============================ - -软件实现 ------------- - -详细代码参考 `demo/audio_v1_mic_speaker_multichan_template.c` - -.. code-block:: C - - usbd_desc_register(audio_descriptor); - usbd_add_interface(usbd_audio_alloc_intf()); - usbd_add_interface(usbd_audio_alloc_intf()); - usbd_add_interface(usbd_audio_alloc_intf()); - usbd_add_endpoint(&audio_in_ep); - usbd_add_endpoint(&audio_out_ep); - - usbd_audio_add_entity(0x02, AUDIO_CONTROL_FEATURE_UNIT); - usbd_audio_add_entity(0x05, AUDIO_CONTROL_FEATURE_UNIT); - - usbd_initialize(); - -- 调用 `audio_init` 配置 audio 描述符并初始化 usb 硬件 -- 因为 麦克风+扬声器+控制需要 3 个接口,所以我们需要调用 `usbd_add_interface` 3 次 -- 默认描述符中开启了 mute 和 volume 的控制,所以需要注册对应的 entity,使用 `usbd_audio_add_entity` - -.. code-block:: C - - void usbd_audio_open(uint8_t intf) - { - } - void usbd_audio_close(uint8_t intf) - { - } - -- 当我们打开 PC 的音量图标,或者音乐播放器、麦克风界面时,会调用到这两个接口,用于启动或者停止数据传输 - -.. code-block:: C - - usbd_ep_start_write(AUDIO_IN_EP, write_buffer, 2048); - -- 由于 audio 协议中没有应用层相关的协议,传输的只有音频的原始数据,所以直接调用 `usbd_ep_start_write` 即可,发送完成会进入完成中断 -- 由于扬声器需要使用 out 端点,所以需要在 `usbd_configure_done_callback` 中启动第一次接收,当然如果没有能力接收,可以不启动,在想启动的时候启动 \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/demo/cdc_acm.rst b/third-party/cherryusb/docs/source/demo/cdc_acm.rst deleted file mode 100644 index 3f6629d2c7344bf732f643158ebdbd6ca0c30cdc..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/demo/cdc_acm.rst +++ /dev/null @@ -1,78 +0,0 @@ -USB 虚拟串口(无 UART 功能) -============================ - -USB 虚拟串口主要是借助 USB CDC ACM 类实现,将其模拟成一个 VCP 设备,当插在电脑上的时候,可以显示成一个串口设备。跟市面上的 USB2TTL模块的区别在于,虚拟串口仅仅只使用到了 USB ,没有与串口(UART外设)进行连动。 - -软件实现 ------------- - -详细代码参考 `demo/cdc_acm_template.c` - -.. code-block:: C - - usbd_desc_register(cdc_descriptor); - usbd_add_interface(usbd_cdc_acm_alloc_intf()); - usbd_add_interface(usbd_cdc_acm_alloc_intf()); - usbd_add_endpoint(&cdc_out_ep); - usbd_add_endpoint(&cdc_in_ep); - usbd_initialize(); - -- 调用 `cdc_acm_init` 配置 cdc acm 描述符并初始化 usb 硬件 -- 因为 cdc 有 2 个接口,所以我们需要调用 `usbd_add_interface` 2 次 - -.. code-block:: C - - void usbd_configure_done_callback(void) - { - /* setup first out ep read transfer */ - usbd_ep_start_read(CDC_OUT_EP, read_buffer, 2048); - } - - void usbd_cdc_acm_bulk_out(uint8_t ep, uint32_t nbytes) - { - USB_LOG_RAW("actual out len:%d\r\n", nbytes); - // for (int i = 0; i < 100; i++) { - // printf("%02x ", read_buffer[i]); - // } - // printf("\r\n"); - /* setup next out ep read transfer */ - usbd_ep_start_read(CDC_OUT_EP, read_buffer, 2048); - } - - void usbd_cdc_acm_bulk_in(uint8_t ep, uint32_t nbytes) - { - USB_LOG_RAW("actual in len:%d\r\n", nbytes); - - if ((nbytes % CDC_MAX_MPS) == 0 && nbytes) { - /* send zlp */ - usbd_ep_start_write(CDC_IN_EP, NULL, 0); - } else { - ep_tx_busy_flag = false; - } - } - - void usbd_cdc_acm_set_dtr(uint8_t intf, bool dtr) - { - if (dtr) { - dtr_enable = 1; - } else { - dtr_enable = 0; - } - } - - void cdc_acm_data_send_with_dtr_test(void) - { - if (dtr_enable) { - memset(&write_buffer[10], 'a', 2038); - ep_tx_busy_flag = true; - usbd_ep_start_write(CDC_IN_EP, write_buffer, 2048); - while (ep_tx_busy_flag) { - } - } - } - -- `usbd_cdc_acm_set_dtr` 函数是主机发送流控命令时的回调函数,这里我们使用 dtr ,当开启 dtr 时,启动发送 -- `usbd_configure_done_callback` 是枚举完成的回调函数,因为 cdc acm 有 out 端点,所以我们需要在这里启动第一次数据的接收,当然,如果你现在没有能力接收数据,可以不启动。 **数据长度需要是最大包长的整数倍**。 -- `usbd_cdc_acm_bulk_out` 是接收完成中断回调,我们在这里面启动下一次接收 -- `usbd_cdc_acm_bulk_in` 是发送完成中断回调,我们在这里检查发送长度是否是最大包长的整数,如果是,需要发送 zlp 包表示结束 -- 调用 `usbd_ep_start_write` 进行发送,需要注意,如果返回值小于0,不能执行下面的 while \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/demo/msc_ram.rst b/third-party/cherryusb/docs/source/demo/msc_ram.rst deleted file mode 100644 index 3a97238dbd5dd0ddceeb00f8a74c44c360b05f44..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/demo/msc_ram.rst +++ /dev/null @@ -1,42 +0,0 @@ -USB 模拟 U 盘 -============================ - -软件实现 ------------- - -详细代码参考 `demo/msc_ram_template.c` - -.. code-block:: C - - usbd_desc_register(msc_ram_descriptor); - usbd_add_interface(usbd_msc_alloc_intf(MSC_OUT_EP, MSC_IN_EP)); - - usbd_initialize(); - -- 调用 `msc_ram_init` 配置 msc 描述符并初始化 usb 硬件 -- 因为 msc 有1个接口,所以我们需要调用 `usbd_add_interface` 1次 -- msc 中的端点的数据流是协议栈这边管理,所以不需要用户注册端点的回调函数。同理 `usbd_configure_done_callback` 也不需要,为空即可 - -.. code-block:: C - - void usbd_msc_get_cap(uint8_t lun, uint32_t *block_num, uint16_t *block_size) - { - *block_num = 1000; //Pretend having so many buffer,not has actually. - *block_size = BLOCK_SIZE; - } - int usbd_msc_sector_read(uint32_t sector, uint8_t *buffer, uint32_t length) - { - return 0; - } - - int usbd_msc_sector_write(uint32_t sector, uint8_t *buffer, uint32_t length) - { - return 0; - } - -- 实现三个接口即可使用 msc,读写操作如果没有 os 则是在中断中 -- `CONFIG_USBDEV_MSC_BLOCK_SIZE` 可以为 512 的整数倍,更改此项,可以增加 msc 的读写速度,当然,也会消耗更多的 ram - - -.. note:: MSC 一般配合 rtos 使用,因为读写操作是阻塞的,放中断是不合适的, `CONFIG_USBDEV_MSC_THREAD` 则是使能 os 管理 - diff --git a/third-party/cherryusb/docs/source/demo/usb_video.rst b/third-party/cherryusb/docs/source/demo/usb_video.rst deleted file mode 100644 index 0e9b25eaabb938766f9c175d862fc79e090f6b26..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/demo/usb_video.rst +++ /dev/null @@ -1,2 +0,0 @@ -USB 摄像头 -============================ diff --git a/third-party/cherryusb/docs/source/index.rst b/third-party/cherryusb/docs/source/index.rst deleted file mode 100644 index 0bbb9fe8458e3030c706120abd13c23e32d3a636..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/index.rst +++ /dev/null @@ -1,96 +0,0 @@ -.. CherryUSB 使用指南 documentation master file, created by - sphinx-quickstart on Thu Nov 21 10:50:33 2019. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -CherryUSB 使用指南 -====================================================== - -CherryUSB 是一个小而美的、可移植性高的、用于嵌入式系统的 USB 主从协议栈。同时 CherryUSB 具有以下优点: - -- 代码精简,并且内存占用极小,而且还可进一步的裁剪 -- 全面的 class 驱动,并且主从 class 驱动全部模板化,方便用户增加新的 class 驱动以及学习的时候查找规律 -- 可供用户使用的 API 非常少,并且分类清晰。从机:初始化 + 注册、命令回调类、数据收发类;主机:初始化 + 查找类、数据收发类 -- 树状化编程,代码层层递进,方便用户理清函数调用关系、枚举和 class 驱动加载过程 -- 标准化的 porting 接口,相同 ip 无需重写驱动,并且 porting 驱动也进行了模板化,方便用户新增 porting。 -- 主从收发接口的使用等价于 uart tx/rx dma 的使用,长度也没有限制 -- 能够达到 USB 硬件理论带宽 - -从机协议栈整体执行流程: - -.. figure:: usbdev.svg - -主机协议栈整体执行流程: - -.. figure:: usbhost.svg - -其他相关链接: - -- **CherryUSB 大纲** https://www.bilibili.com/video/BV1st4y1H7K2 -- **从机协议栈视频教程** https://www.bilibili.com/video/BV1Ef4y1t73d -- **主机协议栈视频教程** TODO -- **github** https://github.com/sakumisu/CherryUSB - -.. toctree:: - :maxdepth: 1 - :caption: 快速上手 - - quick_start/bl702 - quick_start/stm32 - quick_start/hpm - quick_start/es32 - quick_start/rt-thread/rtthread - quick_start/other_chip - -.. toctree:: - :maxdepth: 1 - :caption: USB 基本知识点 - - usb/usb2.0_basic - usb/usb3.0_basic - usb/usb_desc - usb/usb_request - usb/usb_enum - -.. toctree:: - :maxdepth: 1 - :caption: API 手册 - - api/api_device - api/api_host - api/api_port - api/api_common - api/api_config - -.. toctree:: - :maxdepth: 1 - :caption: Class 指南 - - class/class_cdc - class/class_hid - class/class_msc - class/class_audio - class/class_video - class/winusb - -.. toctree:: - :maxdepth: 1 - :caption: 基本例程 - - demo/cdc_acm - demo/msc_ram - demo/audio_mic_speaker - demo/usb_video - -.. toctree:: - :maxdepth: 1 - :caption: Porting 说明 - - porting - porting_usbip - -.. toctree:: - :maxdepth: 1 - :caption: 工具使用 - - tools/index \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/porting.rst b/third-party/cherryusb/docs/source/porting.rst deleted file mode 100644 index 5962e2295cd1a3a254e357efb675c24df5cb37a4..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/porting.rst +++ /dev/null @@ -1,24 +0,0 @@ -Porting 如何编写 -============================== - -本节主要介绍没有支持的芯片如何做 porting。 - -从机 porting ----------------------------- - -- 首先复制一份从 `port/template` 复制一份 `usb_dc.c` 并参与编译,保证能编译过。 -- 实现 ``usb_dc_init`` 保证能进入中断 -- 在中断中判断 reset 中断并能够正常触发 reset 中断,在 reset 中断中调用 ``usbd_event_reset_handler``,如果可能,还需要启动读取 setup 包。 -- 在中断中判断 setup 中断并能够正常触发 setup 中断,然后将读取的数据传入 ``usbd_event_ep0_setup_complete_handler`` -- 实现 ``usbd_ep_start_write`` 并能够触发发送完成中断 -- 实现 ``usbd_ep_start_read`` 并能够触发接收完成中断 -- 分包处理 - -主机 porting ----------------------------- - -- 首先复制一份从 `port/template` 复制一份 `usb_hc.c` 并参与编译,保证能编译过。 -- 实现 ``usb_hc_init`` 保证能进入中断 -- 能够进入插拔中断,比如 ``connect`` 和 ``disconnect``,并调用 ``usbh_roothub_thread_wakeup`` 能够唤醒 hub 线程 -- 实现 ``usbh_roothub_control`` 并根据第三个条件,能够完成 ``usbh_hub_events`` 中 ``usbh_enumerate`` 之前的流程 -- 实现 ``usbh_submit_urb`` \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/porting_usbip.rst b/third-party/cherryusb/docs/source/porting_usbip.rst deleted file mode 100644 index 3c7b721c5418efd78c3f4086d73ae69fc239c4f9..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/porting_usbip.rst +++ /dev/null @@ -1,216 +0,0 @@ -USB IP 勘误 -============================== - -本节主要对已经支持的 USB IP 在不同厂家上的一些差别说明并进行校对。欢迎补充。 - -FSDEV --------------------------- - -FSDEV 仅支持从机。这个 ip 不同厂家基本都是基于标准的 usb 寄存器,所以用户使用时,仅需要修改 `USBD_IRQHandler` 、 `USB_BASE` 、 `USB_NUM_BIDIR_ENDPOINTS` 即可。有些芯片可能还需要配置 `PMA_ACCESS` 的值,默认为2。下表为具体芯片相关宏的修改值: - -.. list-table:: - :widths: 30 20 30 30 30 - :header-rows: 1 - - * - 芯片 - - USBD_IRQHandler - - USB_BASE - - USB_NUM_BIDIR_ENDPOINTS - - PMA_ACCESS - * - STM32F0 - - USB_IRQHandler - - 0x40005C00 - - 8 - - 1 - * - STM32F1 - - USB_LP_CAN1_RX0_IRQHandler - - 同上 - - 同上 - - 同上 - * - STM32F3 - - USB_LP_CAN_RX0_IRQHandler - - 同上 - - 同上 - - 1 or 2 - * - STM32L0 - - USB_IRQHandler - - 同上 - - 同上 - - 1 - * - STM32L1 - - USB_LP_IRQHandler - - 同上 - - 同上 - - 2 - * - STM32L4 - - USB_IRQHandler - - 同上 - - 同上 - - 1 - -MUSB --------------------------- - -MUSB IP 支持主从,并且由 **mentor** 定义了一套标准的寄存器偏移,所以如果是走的标准,则从机仅需要修改 `USBD_IRQHandler` 、 `USB_BASE` 、 `USB_NUM_BIDIR_ENDPOINTS` ,主机仅需要修改 `USBH_IRQHandler` 、 `USB_BASE` 以及 `CONIFG_USB_MUSB_EP_NUM` 即可。如果非标准,则需要实现以下宏的偏移,以标准为例: - -.. code-block:: C - - #define MUSB_FADDR_OFFSET 0x00 - #define MUSB_POWER_OFFSET 0x01 - #define MUSB_TXIS_OFFSET 0x02 - #define MUSB_RXIS_OFFSET 0x04 - #define MUSB_TXIE_OFFSET 0x06 - #define MUSB_RXIE_OFFSET 0x08 - #define MUSB_IS_OFFSET 0x0A - #define MUSB_IE_OFFSET 0x0B - - #define MUSB_EPIDX_OFFSET 0x0E - - #define MUSB_IND_TXMAP_OFFSET 0x10 - #define MUSB_IND_TXCSRL_OFFSET 0x12 - #define MUSB_IND_TXCSRH_OFFSET 0x13 - #define MUSB_IND_RXMAP_OFFSET 0x14 - #define MUSB_IND_RXCSRL_OFFSET 0x16 - #define MUSB_IND_RXCSRH_OFFSET 0x17 - #define MUSB_IND_RXCOUNT_OFFSET 0x18 - #define MUSB_IND_TXTYPE_OFFSET 0x1A - #define MUSB_IND_TXINTERVAL_OFFSET 0x1B - #define MUSB_IND_RXTYPE_OFFSET 0x1C - #define MUSB_IND_RXINTERVAL_OFFSET 0x1D - - #define MUSB_FIFO_OFFSET 0x20 - - #define MUSB_DEVCTL_OFFSET 0x60 - - #define MUSB_TXFIFOSZ_OFFSET 0x62 - #define MUSB_RXFIFOSZ_OFFSET 0x63 - #define MUSB_TXFIFOADD_OFFSET 0x64 - #define MUSB_RXFIFOADD_OFFSET 0x66 - - #define MUSB_TXFUNCADDR0_OFFSET 0x80 - #define MUSB_TXHUBADDR0_OFFSET 0x82 - #define MUSB_TXHUBPORT0_OFFSET 0x83 - #define MUSB_TXFUNCADDRx_OFFSET 0x88 - #define MUSB_TXHUBADDRx_OFFSET 0x8A - #define MUSB_TXHUBPORTx_OFFSET 0x8B - #define MUSB_RXFUNCADDRx_OFFSET 0x8C - #define MUSB_RXHUBADDRx_OFFSET 0x8E - #define MUSB_RXHUBPORTx_OFFSET 0x8F - - #define USB_TXADDR_BASE(ep_idx) (USB_BASE + MUSB_TXFUNCADDR0_OFFSET + 0x8 * ep_idx) - #define USB_TXHUBADDR_BASE(ep_idx) (USB_BASE + MUSB_TXFUNCADDR0_OFFSET + 0x8 * ep_idx + 2) - #define USB_TXHUBPORT_BASE(ep_idx) (USB_BASE + MUSB_TXFUNCADDR0_OFFSET + 0x8 * ep_idx + 3) - #define USB_RXADDR_BASE(ep_idx) (USB_BASE + MUSB_TXFUNCADDR0_OFFSET + 0x8 * ep_idx + 4) - #define USB_RXHUBADDR_BASE(ep_idx) (USB_BASE + MUSB_TXFUNCADDR0_OFFSET + 0x8 * ep_idx + 6) - #define USB_RXHUBPORT_BASE(ep_idx) (USB_BASE + MUSB_TXFUNCADDR0_OFFSET + 0x8 * ep_idx + 7) - -下表为具体芯片从机相关宏的修改值: - -.. list-table:: - :widths: 30 30 30 30 - :header-rows: 1 - - * - 芯片 - - USBD_IRQHandler - - USB_BASE - - USB_NUM_BIDIR_ENDPOINTS - * - ES32F3xx - - USB_INT_Handler - - 0x40086400 - - 5 - * - MSP432Ex - - 同上 - - 0x40050000 - - 同上 - * - F1C100S - - USB_INT_Handler - - 0x01c13000 - - 4 - -下表为具体芯片主机相关宏的修改值: - -.. list-table:: - :widths: 30 30 30 30 - :header-rows: 1 - - * - 芯片 - - USBH_IRQHandler - - USB_BASE - - CONIFG_USB_MUSB_EP_NUM - * - ES32F3xx - - USB_INT_Handler - - 0x40086400 - - 5 - * - MSP432Ex - - 同上 - - 0x40050000 - - 同上 - * - F1C100S - - USB_INT_Handler - - 0x01c13000 - - 4 - -DWC2 --------------------------- - -DWC2 IP 支持主从,并且由 **synopsys** 定义了一套标准的寄存器偏移。大部分厂家都使用标准的寄存器偏移,所以如果是从机仅需要修改 `USBD_IRQHandler` 、 `USB_BASE` 、 `USB_NUM_BIDIR_ENDPOINTS` ,主机仅需要修改 `USBH_IRQHandler` 、 `USB_BASE` 即可。 - -其次还有需要注意 VBUS SENSING 这个项,也会影响 USB 的正常枚举,如何修改参考 `GD32 dwc2驱动的GCCFG_NOVBUSSENS寄存器兼容性和stm32存在区别 `_。 - -.. caution:: 主机 port 仅支持有高速功能的 dwc2 ip, 因为他支持 dma 模式,如果厂家买的 ip 不支持 dma 模式,则无法使用。 - -下表为具体芯片从机相关宏的修改值: - -.. list-table:: - :widths: 30 30 30 30 - :header-rows: 1 - - * - 芯片 - - USBH_IRQHandler - - USB_BASE - - USB_NUM_BIDIR_ENDPOINTS - * - STM32 非 H7 - - OTG_FS_IRQHandler/OTG_HS_IRQHandler - - 0x50000000UL/0x40040000UL - - 5 - * - STM32 H7 - - 同上 - - 0x40080000UL/0x40040000UL - - 9 - -下表为具体芯片主机相关宏的修改值: - -.. list-table:: - :widths: 30 30 30 30 - :header-rows: 1 - - * - 芯片 - - USBH_IRQHandler - - USB_BASE - - CONFIG_USB_DWC2_PIPE_NUM - * - STM32 全系列 - - OTG_HS_IRQHandler - - 0x40040000UL - - 12 - -EHCI --------------------------- - -EHCI 是 intel 制定的标准主机控制器接口,任何厂家都必须实现 EHCI 中定义的寄存器以及寄存器的功能。EHCI 相关配置宏如下: - -.. code-block:: C - - //Host Controller Capability Register BASE - #define CONFIG_USB_EHCI_HCCR_BASE (0xxx) - //Host Controller Operational Register BASE - #define CONFIG_USB_EHCI_HCOR_BASE (0xxx) - //是否打印 ehci 配置信息 - #define CONFIG_USB_EHCI_INFO_ENABLE - //是否关闭保留寄存器的占位,默认保留 9 个双字的占位 - #define CONFIG_USB_ECHI_HCOR_RESERVED_DISABLE - //是否使能 configflag 寄存器中的 bit0 - #define CONFIG_USB_EHCI_CONFIGFLAG - //是否使能 port power bit - #define CONFIG_USB_EHCI_PORT_POWER - -同时由于 EHCI 只是主机控制器,一般配合一个 device 控制器+ otg 控制器,而速度的获取一般是在 otg 寄存器中,所以需要用户实现 `usbh_get_port_speed` 函数。 \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/quick_start/bl702.rst b/third-party/cherryusb/docs/source/quick_start/bl702.rst deleted file mode 100644 index 1ae1f8fa2fec001405b87b3d6b99bd6f5def1d84..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/quick_start/bl702.rst +++ /dev/null @@ -1,6 +0,0 @@ -基于 BL 系列开发指南 -========================= - -BL 系列 USB 的开发主要使用 bl_mcu_sdk,参考 `bl_mcu_sdk `_。 - -USB 的相关应用位于 `examples/usbdev` 和 `examples/usbhost` 目录下,环境搭建完成后,即可编译使用。 \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/quick_start/es32.rst b/third-party/cherryusb/docs/source/quick_start/es32.rst deleted file mode 100644 index dd1c0ab6920ce4ba40d2760ea6ad7ed19b394eeb..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/quick_start/es32.rst +++ /dev/null @@ -1,84 +0,0 @@ -基于 ES32F369 开发指南 -========================= - -ES32F3xx 系列单片机中 USB 外设使用标准的 musb ip,并且拥有 usb device 和 usb host 功能。本章主要介绍如何在东软载波的 ES32F369x 开发板中使用 CherryUSB。 - -在使用之前需要从 essemi 官网下载 `keil 芯片支持包 `_ 并安装, - - -工程样例试用 ------------------------ - -在 CherryUSB demo 目录下已经有主机跟从机的样例,在有板子的情况下,可以先跑工程样例,试用一下。 - -- 进入 MDK-ARM 目录下,双击 `example.uvprojx` 打开工程,选择好调试器后,编译烧录即可。 -- 如果是从机,默认提供的是 cdc acm 的示例,代码烧录以后,将 usb 线插到 板子的丝印为 USB-OTG 口,并接上电脑,按下复位键,电脑便会枚举出一个串口。打开串口,勾选 DTR 可以接收数据,在发送缓冲区填入数据并发送,调试器的串口便可以打印出接收的长度和数据。 -- 如果是主机,则需要一个 usb 母口转接线,并接入相关 usb 设备,就可以进行测试了。比如接上鼠标、U盘、4G 网卡等等。 - -USB Device 移植要点 ------------------------ - -针对自定义的工程移植,需要按照以下步骤: - -- 准备好可以进行调试打印的工程,并且实现 `printf`、 `malloc` 、 `free` 函数(也可以直接勾选 Use microlib 来使用)。 -- 拷贝 CherryUSB 源码到工程里 -- 添加 CherryUSB 源码和头文件路径,其中 `usbd_core.c` 和 `usb_dc_musb.c` 为必须添加项。 -- 拷贝 `cherryusb_config_template.h` 文件到自己工程目录下,命名为 `usb_config.h`,并添加相应的目录头文件路径。所以根目录下的文件仅作为参考,不要添加根目录下的头文件。 - -.. figure:: img/es322.png -.. figure:: img/es323.png - -- 实现 `usb_dc_low_level_init` 函数,该函数主要负责 USB 时钟、引脚、中断的初始化。例如 - -.. code-block:: C - - void usb_dc_low_level_init(void) - { - ald_pmu_perh_power_config(PMU_POWER_USB, ENABLE); - ald_cmu_perh_clock_config(CMU_PERH_USB, ENABLE); - ald_cmu_perh_clock_config(CMU_PERH_GPIO, ENABLE); - ald_cmu_usb_clock_config(CMU_USB_CLOCK_SEL_HOSC, CMU_USB_DIV_1); - ald_rmu_reset_periperal(RMU_PERH_USB); - ald_mcu_irq_config(USB_INT_IRQn, 2, 2, ENABLE); - ald_mcu_irq_config(USB_DMA_IRQn, 2, 2, ENABLE); - usb_pin_init(); - } - -- 描述符的注册、class的注册、接口的注册、端点中断的注册。不会的参考 demo 下的 template 。 -- 调用 `usbd_initialize` 初始化 usb 硬件。 -- 正常使用。 - - -USB Host 移植要点 ------------------------ - -针对自定义的工程移植,需要以下步骤: - -- 准备好可以进行调试打印的带 FreeRTOS 或者 RT-Thread 的工程,并且实现 `printf`、 `malloc` 、 `free` 函数(也可以直接勾选 Use microlib 来使用)。 -- 拷贝 CherryUSB 源码到工程里 -- 添加 CherryUSB 源码和头文件路径,其中 `usbh_core.c` 和 `usb_hc_musb.c` 、 osal 下的文件为必须添加项,根据不同的 os 添加对应的文件。 -- 拷贝 `cherryusb_config_template.h` 文件到自己工程目录下,命名为 `usb_config.h` ,并添加相应的目录头文件路径。所以根目录下的文件仅作为参考,不要添加根目录下的头文件。 - -.. figure:: img/es324.png -.. figure:: img/es325.png - -- 由于是作为主机,推荐添加所有的 class,功能全面。当然如果只用一个 class ,就添加一个。 -- 实现 `usb_hc_low_level_init` 函数,该函数主要负责 USB 时钟、引脚、中断的初始化。例如 - -.. code-block:: C - - void usb_hc_low_level_init(void) - { - ald_pmu_perh_power_config(PMU_POWER_USB, ENABLE); - ald_cmu_perh_clock_config(CMU_PERH_USB, ENABLE); - ald_cmu_perh_clock_config(CMU_PERH_GPIO, ENABLE); - ald_cmu_usb_clock_config(CMU_USB_CLOCK_SEL_HOSC, CMU_USB_DIV_1); - ald_rmu_reset_periperal(RMU_PERH_USB); - ald_mcu_irq_config(USB_INT_IRQn, 2, 2, ENABLE); - ald_mcu_irq_config(USB_DMA_IRQn, 2, 2, ENABLE); - usb_pin_init(); - } - -- 调用 `usbh_initialize` 初始化 usb 硬件。 -- 此时编译会报错,因为协议栈中为每个 class 都添加了测试 demo,文件在 `usb_host.c` 中,如果不想要,可以直接删除。 -- 正常使用。 \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/quick_start/hpm.rst b/third-party/cherryusb/docs/source/quick_start/hpm.rst deleted file mode 100644 index 21c41278df436243a2b6f468d1c33ea2020d8454..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/quick_start/hpm.rst +++ /dev/null @@ -1,6 +0,0 @@ -基于 HPM 系列开发指南 -========================= - -HPM 系列 USB 的开发主要使用 hpm_sdk ,参考 `hpm sdk `_。 - -USB 的相关应用位于 `samples/cherryusb` 目录下,环境搭建完成后,即可编译使用。 \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/quick_start/img/es322.png b/third-party/cherryusb/docs/source/quick_start/img/es322.png deleted file mode 100644 index 09095b524dc9c413bfb2cfe581f55393a946bcd0..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/es322.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/es323.png b/third-party/cherryusb/docs/source/quick_start/img/es323.png deleted file mode 100644 index 2712dc503154fc0bf693d5682c294f07b083c2db..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/es323.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/es324.png b/third-party/cherryusb/docs/source/quick_start/img/es324.png deleted file mode 100644 index 59cfcaeca107172199c0be382a07fa267c7ca7d1..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/es324.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/es325.png b/third-party/cherryusb/docs/source/quick_start/img/es325.png deleted file mode 100644 index b3fc9ed866c950f2b8396f3875ffb3ef437e01bd..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/es325.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_1.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_1.png deleted file mode 100644 index b91044a561dd4f5ed66925a467f1cacda2f299cc..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_1.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_10.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_10.png deleted file mode 100644 index d55b38e78160cc95ff8a100e40c54bf0cd74485b..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_10.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_11.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_11.png deleted file mode 100644 index 3ad5b074a9670f11018f68ce0a9f7547356a38a6..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_11.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_12.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_12.png deleted file mode 100644 index 84aaffe8a3f1bf975254bb963571c3f75b95520e..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_12.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_13.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_13.png deleted file mode 100644 index d350a7762375da05915e5d3a0c825df8655dbdb7..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_13.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_14.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_14.png deleted file mode 100644 index e5aa5b1990c3dee2bfd1efb7b1e4430314817096..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_14.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_15.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_15.png deleted file mode 100644 index 037bfbdf468e1f246e78d9150b5f0dc9083ba3c3..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_15.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_16.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_16.png deleted file mode 100644 index 70f2e63c0574c676b1028f9e30ce004cf2c7b2e3..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_16.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_18.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_18.png deleted file mode 100644 index 4a780b569fc6cce43fb3b7156f5c6071266d48fe..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_18.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_19.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_19.png deleted file mode 100644 index b779f7f77ee097201ad357d9864ed597596cef6e..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_19.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_2.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_2.png deleted file mode 100644 index 671b1b82ad6e994491a56177df10eafcc8bc7f0a..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_2.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_20.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_20.png deleted file mode 100644 index 96736d01dc99cbb30d7102cdd6354db82d5602a7..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_20.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_21.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_21.png deleted file mode 100644 index 977bda825da8f937616037de19610bde5e07cb72..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_21.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_3.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_3.png deleted file mode 100644 index 492d67391bc3fa19f865304ebbc89d922f54be74..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_3.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_3_1.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_3_1.png deleted file mode 100644 index 9e42196dfb7153779fbb2f97492dd3d88f727c27..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_3_1.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_4.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_4.png deleted file mode 100644 index dd90f5b86df67f59942da7219fd140ee7fe41d06..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_4.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_4_1.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_4_1.png deleted file mode 100644 index e81437bcd927037822a83a1f77f792d16269cd50..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_4_1.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_5.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_5.png deleted file mode 100644 index 5bec9878b37ad822bedfabffed42525dadb29b29..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_5.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_6.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_6.png deleted file mode 100644 index f0ad9a0b63a228e854f7765ba823cb25a3d34c28..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_6.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_7.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_7.png deleted file mode 100644 index 8aef0bfa8b5860df180d9c9fbeb0261e645e622f..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_7.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_8.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_8.png deleted file mode 100644 index 08d2e724ff5f0d0f232f8bcb6b23a546f4af758f..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_8.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/img/stm32_9.png b/third-party/cherryusb/docs/source/quick_start/img/stm32_9.png deleted file mode 100644 index 57971d267bbe3c860af952c9494ceb5ea3acff12..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/img/stm32_9.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/other_chip.rst b/third-party/cherryusb/docs/source/quick_start/other_chip.rst deleted file mode 100644 index 79075c85eeb90ab814d2aeb3b1b37bae679eef86..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/quick_start/other_chip.rst +++ /dev/null @@ -1,95 +0,0 @@ -芯片通用移植指南 -========================= - -本节主要介绍所有带 USB IP 的芯片,移植 CherryUSB 主从协议栈时的通用步骤和注意事项。在往下看之前,需要 **你准备好一个可以打印 helloworld 的基本工程** ,并且实现了 `printf` 、 `malloc`、 `free`。如果是主机,需要 **准备好可以打印 helloworld 的带 OS 的工程**。 - -USB Device 移植要点 ------------------------ - -- 拷贝 CherryUSB 源码到工程目录下,并按需添加源文件和头文件路径,其中 `usbd_core.c` 和 `usb_dc_xxx.c` 为必须添加项。而 `usb_dc_xxx.c` 是芯片所对应的 USB IP dcd 部分驱动,如果不知道自己芯片属于那个 USB IP,参考 **port** 目录下的不同 USB IP 的 readme。如果使用的 USB IP 没有支持,只能自己实现了 -- 添加 `USBD_IRQHandler=xxxx` 、 `USB_NUM_BIDIR_ENDPOINTS=x` 以及 `USB_BASE=0xxxxx` 三个 cflag 编译选项,如果没有添加则使用 `usb_dc_xxx.c` 中默认配置 -- 拷贝 `cherryusb_config_template.h` 文件到自己工程目录下,命名为 `usb_config.h`,并添加相应的目录头文件路径。 -- 实现 `usb_dc_low_level_init` 函数(该函数主要负责 USB 时钟、引脚、中断的初始化)。该函数可以放在你想要放的任何参与编译的 c 文件中。如何进行 USB 的时钟、引脚、中断等初始化,请自行根据你使用的芯片原厂提供的源码中进行添加。 -- 描述符的注册、class的注册、接口的注册、端点中断的注册。不会的参考 demo 下的 template -- 调用 `usbd_initialize` 初始化 usb 硬件 -- 编译使用。各个 class 如何使用,参考 demo 下的 template - -.. note:: device 移植要点其实就三个,实现 `usb_dc_low_level_init` ;改 `USBD_IRQHandler=xxxx` 、`USB_BASE=0xxxxx` 、 `USB_NUM_BIDIR_ENDPOINTS=x`;改 `usb_config.h` 中的内容。其中前面说到的3个宏也可以在 `usb_config.h` 添加 - -USB Host 移植要点 ------------------------ - -- 拷贝 CherryUSB 源码到工程目录下,并按需添加源文件和头文件路径,其中 `usbh_core.c` 、 `usb_hc_xxx.c` 以及 **osal** 目录下源文件(根据不同的 os 选择对应的源文件)为必须添加项。而 `usb_hc_xxx.c` 是芯片所对应的 USB IP dcd 部分驱动,如果不知道自己芯片属于那个 USB IP,参考 **port** 目录下的不同 USB IP 的 readme。如果使用的 USB IP 没有支持,只能自己实现了 -- 添加 `USBH_IRQHandler=xxxx` 以及 `USB_BASE=0xxxxx` 两个 cflag 编译选项,如果没有添加则使用 `usb_hc_xxx.c` 中默认配置 -- 拷贝 `cherryusb_config_template.h` 文件到自己工程目录下,命名为 `usb_config.h`,并添加相应的目录头文件路径。 -- 实现 `usb_hc_low_level_init` 函数(该函数主要负责 USB 时钟、引脚、中断的初始化)。该函数可以放在你想要放的任何参与编译的 c 文件中。如何进行 USB 的时钟、引脚、中断等初始化,请自行根据你使用的芯片原厂提供的源码中进行添加。 -- 调用 `usbh_initialize` 初始化 usb 硬件 -- 如果使用的是 GCC ,需要在链接脚本(ld)中添加如下代码: - -.. code-block:: C - - /* section information for usbh class */ - . = ALIGN(4); - __usbh_class_info_start__ = .; - KEEP(*(.usbh_class_info)) - __usbh_class_info_end__ = .; - -- 如果使用的是 Segger Embedded Studio ,需要在链接脚本(icf)中添加如下代码: - -.. code-block:: C - - define block cherryusb_usbh_class_info { section .usbh_class_info }; - - define exported symbol __usbh_class_info_start__ = start of block cherryusb_usbh_class_info; - define exported symbol __usbh_class_info_end__ = end of block cherryusb_usbh_class_info + 1; - - place in AXI_SRAM { block cherryusb_usbh_class_info }; - keep { section .usbh_class_info}; - -- 编译使用。各个 class 如何使用,参考 demo 下的 `usb_host.c` 文件 - -.. caution:: 如果主从 ip 共用一个中断,设置 `USBD_IRQHandler=USBD_IRQHandler` 、 `USBH_IRQHandler=USBH_IRQHandler` ,然后由真正的中断函数根据主从模式调用这两个函数。 - -带 cache 功能的芯片使用注意 -------------------------------- - -协议栈以及 port 中不会对 cache 区域的 ram 进行 clean 或者 invalid,所以需要使用一块非 cache 区域的 ram 来维护。 `USB_NOCACHE_RAM_SECTION` 宏表示将变量指定到非 cache ram上, -因此,用户需要在对应的链接脚本中添加 no cache ram 的 section。默认 `USB_NOCACHE_RAM_SECTION` 定义为 `__attribute__((section(".noncacheable")))`。 - -GCC: - -.. code-block:: C - - // 放在 no cache ram 的 region 中 - .no_cache_ram_region : AT (__no_cache_ram_addr) - { - . = ALIGN(4); - *(.noncacheable) - . = ALIGN(4); - } > no_cache_ram - -SCT: - -.. code-block:: C - - LR_IROM1 0x08000000 0x00200000 { ; load region size_region - ER_IROM1 0x08000000 0x00200000 { ; load address = execution address - *.o (RESET, +First) - *(InRoot$$Sections) - .ANY (+RO) - .ANY (+XO) - } - RW_IRAM2 0x24000000 0x00070000 { ; RW data - .ANY (+RW +ZI) - } - USB_NOCACHERAM 0x24070000 0x00010000 { ; RW data - *(.noncacheable) - } - } - -ICF: - -.. code-block:: C - - define region NONCACHEABLE_RAM = [from 0x1140000 size 256K]; - place in NONCACHEABLE_RAM { section .noncacheable, section .noncacheable.init, section .noncacheable.bss }; // Noncacheable diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/config_file.png b/third-party/cherryusb/docs/source/quick_start/rt-thread/img/config_file.png deleted file mode 100644 index e2982b28d4b7644725518d855812f09086ab7a15..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/config_file.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env0.png b/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env0.png deleted file mode 100644 index bb9e8e19057ca80e3af7dd10a2d2cc24181ec7e9..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env0.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env1.png b/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env1.png deleted file mode 100644 index d232a408db374af33a57c6056b0fb036c2525584..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env1.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env2.png b/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env2.png deleted file mode 100644 index 4865741327477694ae2e138d1c8b16b778184cb4..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env2.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env3.png b/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env3.png deleted file mode 100644 index ed55056bb5a5bcde03a082b7bb646e4895a68eac..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env3.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env4.png b/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env4.png deleted file mode 100644 index 36c4e53c3494ba1ebd3856ee9851d1495b717ab5..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env4.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env5.png b/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env5.png deleted file mode 100644 index 85de879a5f7d7aa61c4794217f1b6b0eb3ad3c29..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env5.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env6.png b/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env6.png deleted file mode 100644 index 20a57d07300d00536db2302a6e388d7cfb335be5..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env6.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env7.png b/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env7.png deleted file mode 100644 index dc63bebdf406639b4d66d3ef59e6061e5347b3ab..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env7.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env8.png b/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env8.png deleted file mode 100644 index c2e31f9a1029c4a41446f91e04982af32c340db6..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/env8.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32_init.png b/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32_init.png deleted file mode 100644 index 3ce572018d589f0ae2aeb195df078e9e64b12b6e..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32_init.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32_init2.png b/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32_init2.png deleted file mode 100644 index eae3c0260cf48b9d89e9fbe05449dc7bc2cb20eb..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32_init2.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32cubemx0.png b/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32cubemx0.png deleted file mode 100644 index 1ea33e04c98829877c16b197a214c5187126f045..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32cubemx0.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32cubemx1.png b/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32cubemx1.png deleted file mode 100644 index a6ca5078552726c4434f70c99a6fea4439f5e238..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32cubemx1.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32cubemx2.png b/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32cubemx2.png deleted file mode 100644 index e29254bbe7858304636f719c0c0f64b5de6d7550..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32cubemx2.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32cubemx_clk.png b/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32cubemx_clk.png deleted file mode 100644 index 41a7aae8752efa9655b85777a61d9ceed1699468..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/quick_start/rt-thread/img/stm32cubemx_clk.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/quick_start/rt-thread/rtthread.rst b/third-party/cherryusb/docs/source/quick_start/rt-thread/rtthread.rst deleted file mode 100644 index cf0546e05376e403ec5f13cce552c56cbd5d938c..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/quick_start/rt-thread/rtthread.rst +++ /dev/null @@ -1,87 +0,0 @@ -基于 RT-Thread 软件包开发指南 -=============================== - -本节主要介绍使用 RT-Thread 提供的软件包管理器来配置工程,以 env 作为演示。本节操作不同芯片都一样,后续不再重复讲解。打开 env 以后使用 menuconfig 进入包管理器,并在如图所示路径中选择 CherryUSB。 - -.. figure:: img/env0.png - -从机配置 --------------------------- - -* 选择 Enable usb device mode 并敲回车进入。 - -.. figure:: img/env1.png -.. figure:: img/env2.png - -* 首先第一个配置是配置 USB 的速度,分为 **FS、HS**,表示使用全速还是高速功能。 - -.. figure:: img/env3.png - -* 其次第二个配置则是选择 USB device ip,不清楚自己芯片是哪个 ip 的可以参考 **port** 目录下对应的 readme。 - -.. figure:: img/env4.png - -* 选择好 USB device ip 以后,还需要选择是哪款芯片,第三个配置则是用来选择芯片,选择以后会帮忙配置相对应的 ip 的一些信息,比如 `USB_BASE` 、 `USBD_Handler` 以及特殊的一些配置等等,如果没找到自己的芯片,可以手动在 `usb_dc_xxx.c` 中修改。 - -.. figure:: img/env5.png - -* 接下来是 class 的选择,用哪个 class 勾选哪个就可以了,使能 class 以后,双击进入可以选择一个 demo 的模板参与编译,当然也可以不选,自己写。 - -.. figure:: img/env6.png - -* 最后退出保存即可。 -* 退出以后不急着编译,需要在代码中实现 `usb_dc_low_level_init` 函数。 -* 复制一份 `usb_config.h` 到自己的目录中,并实现以下内容: - -.. figure:: img/config_file.png - -* 使用 `scons --target=mdk` 或者 `scons` 进行编译 - -主机配置 --------------------------- - -* 选择 Enable usb host mode 并敲回车进入。 - -.. figure:: img/env7.png - -* 选择 USB host ip,不清楚自己芯片是哪个 ip 的可以参考 **port** 目录下对应的 readme。选择好 USB host ip 以后,还需要选择是哪款芯片,第二个箭头则是用来选择芯片,选择以后会帮忙配置相对应的 ip 的一些信息,比如 `USB_BASE` 、 `USBH_Handler` 以及特殊的一些配置等等,如果没找到自己的芯片,可以手动在 `usb_hc_xxx.c` 中修改。 - -.. figure:: img/env8.png - -* 默认使能除了 hub 之外的所有 class 驱动。 -* 设置 psc 线程的线程栈以及线程优先级。 -* 最后退出保存即可。 -* 退出以后不急着编译,需要在代码中实现 `usb_hc_low_level_init` 函数。 -* 复制一份 `usb_config.h` 到自己的目录中,并实现以下内容: - -.. figure:: img/config_file.png - -* 使用 `scons --target=mdk` 或者 `scons` 进行编译 -* 如果使用的是 GCC ,需要在链接脚本(ld)中添加如下代码: - -.. code-block:: C - - /* section information for usbh class */ - . = ALIGN(4); - __usbh_class_info_start__ = .; - KEEP(*(.usbh_class_info)) - __usbh_class_info_end__ = .; - - -借助 STM32CubeMX 生成 USB 初始化 ----------------------------------- - -使用 STM32CubeMX 主要是用来生成 usb 时钟、引脚、中断的配置。我们需要点击如图所示文件,并配置好 USB 的时钟、中断,点击 `Generate Code`。生成的时钟配置在 `main.c` 中的 `SystemClock_Config` 文件,将其拷贝到 `board.c` 中。 - -.. figure:: img/stm32cubemx0.png -.. figure:: img/stm32cubemx1.png -.. figure:: img/stm32cubemx2.png -.. figure:: img/stm32cubemx_clk.png - -然后将 `stm32xxxx_hal_msp.c` 中的 `HAL_PCD_MspInit` 或者是 `HAL_HCD_MspInit` 中的内容复制到 `usb_dc_low_level_init` 和 `usb_hc_low_level_init` 函数中,举例如下: - -.. figure:: img/stm32_init.png - -其次将 `main.c` 中的 `SystemClock_Config` 替换掉 `board.c` 中的配置 - -.. figure:: img/stm32_init2.png \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/quick_start/stm32.rst b/third-party/cherryusb/docs/source/quick_start/stm32.rst deleted file mode 100644 index 906a1374cab795e63875354831ab900bf1e8e1e8..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/quick_start/stm32.rst +++ /dev/null @@ -1,132 +0,0 @@ -基于 STM32F1/F4/H7 开发指南 -============================= - -本节是基于 STM32 三个系列芯片的使用,涵盖 F1/F4/H7,其余芯片基本类似,不再赘述,具体区别有: - -- usb ip 区别:F1使用 fsdev,F4/H7使用 dwc2 -- dwc2 ip 区别: fs port(引脚是 PA11/PA12) 和 hs port(引脚是 PB14/PB15), 其中 hs port 默认全速,可以接外部PHY 形成高速主机,并且带 dma 功能 -- F4 与 H7 cache 区别、USB BASE 区别 - - -如果是 STM32F7/STM32H7 这种带 cache 功能,需要将 usb 使用到的 ram 定位到 no cache ram 区域。举例如下 - -.. code-block:: C - - cpu_mpu_config(0, MPU_Normal_NonCache, 0x24070000, MPU_REGION_SIZE_64KB); - -对应 keil 中的 sct 脚本修改: - -.. code-block:: C - - LR_IROM1 0x08000000 0x00200000 { ; load region size_region - ER_IROM1 0x08000000 0x00200000 { ; load address = execution address - *.o (RESET, +First) - *(InRoot$$Sections) - .ANY (+RO) - .ANY (+XO) - } - RW_IRAM2 0x24000000 0x00070000 { ; RW data - .ANY (+RW +ZI) - } - USB_NOCACHERAM 0x24070000 0x00010000 { ; RW data - *(.noncacheable) - } - } - - -.. caution :: 如果使用 STM32F7 或者 STM32H7, 请在 CFLAG 中添加 STM32F7 或者 STM32H7 宏定义,否则无法枚举 - -工程样例试用 ------------------------ - -默认提供以下 demo 工程: - -- F103 使用 fsdev ip -- F429 主从使用 hs port,并且均用 dma 模式 -- H7 设备使用 fs port,主机使用 hs port,并且主机带 cache 支持 - - -默认删除 Drivers ,所以需要使用 stm32cubemx 生成一下 Drivers 目录下的文件,demo 底下提供了 **stm32xxx.ioc** 文件,双击打开,点击 **Generate Code** 即可。 - -.. caution:: 生成完以后,请使用 git reset 功能将被覆盖的 `main.c` 和 `stm32xxx_it.c` 文件撤回,禁止被 cubemx 覆盖。 - -USB Device 移植要点 ------------------------ - -- 使用 **stm32cubemx** 创建工程,配置基本的 RCC、UART (作为log使用) - -.. figure:: img/stm32_1.png -.. figure:: img/stm32_2.png - -- 如果使用 fsdev ip,勾选 **USB** 。如果使用 dwc2 ip,勾选 **USB_OTG_FS** 或者勾选 **USB_OTG_HS**。开启 USB 中断,其他配置对我们没用,代码中不会使用任何 st 的 usb 库。 - -.. figure:: img/stm32_3_1.png -.. figure:: img/stm32_3.png - -- 配置 usb clock 为 48M - -.. figure:: img/stm32_4_1.png -.. figure:: img/stm32_4.png - -- 选择好工程,这里我们选择 keil,设置好 stack 和 heap,如果使用 msc 可以推荐设置大点,然后点击 **Generate Code**。 - -.. figure:: img/stm32_5.png - -- 添加 CherryUSB 必须要的源码( **usbd_core.c** 、 **usb_dc_dwc2.c** 或者是 **usb_dc_fsdev.c** ),以及想要使用的 class 驱动,可以将对应的 class template 添加方便测试。 - -.. figure:: img/stm32_6.png - -- 头文件该加的加 - -.. figure:: img/stm32_7.png - -- 复制一份 **cherryusb_config_template.h**,放到 `Core/Inc` 目录下,并命名为 `usb_config.h` - -.. figure:: img/stm32_8.png - -- 如果使用 dwc2 ip,编译选项中需要添加 `CONFIG_USB_DWC2_PORT=xxx`,使用 PA11/PA12 则 **xxx=FS_PORT**,使用 PB14/PB15 则 **xxx=HS_PORT** - -.. figure:: img/stm32_9.png - -- 编译器推荐使用 **AC6**。勾选 **Microlib**,并实现 **printf** ,方便后续查看 log。 - -.. figure:: img/stm32_10.png -.. figure:: img/stm32_11.png - -- 拷贝 **xxx_msp.c** 中的 **HAL_PCD_MspInit** 函数中的内容到 **usb_dc_low_level_init** 函数中,屏蔽 st 生成的 usb 中断函数和 usb 初始化 - -.. figure:: img/stm32_12.png -.. figure:: img/stm32_13.png -.. figure:: img/stm32_14.png - -- 调用 template 的内容初始化,就可以使用了 - -.. figure:: img/stm32_15.png - -USB Host 移植要点 ------------------------ - -前面 7 步与 Device 一样。需要注意,host 驱动只支持带 dma 的 hs port (引脚是 PB14/PB15),所以 fs port (引脚是 PA11/PA12)不做支持(没有 dma 你玩什么主机)。 - -- 添加 CherryUSB 必须要的源码( **usbh_core.c** 、 **usbh_hub.c** 、 **usb_hc_dwc2.c** 、以及 **osal** 目录下的适配层文件),以及想要使用的 class 驱动,并且可以将对应的 **usb host.c** 添加方便测试。 - -.. figure:: img/stm32_16.png - -- 编译器推荐使用 **AC6**。勾选 **Microlib**,并实现 **printf** ,方便后续查看 log。 - -.. figure:: img/stm32_10.png -.. figure:: img/stm32_11.png - -- 拷贝 **xxx_msp.c** 中的 **HAL_HCD_MspInit** 函数中的内容到 **usb_hc_low_level_init** 函数中,屏蔽 st 生成的 usb 中断函数和 usb 初始化 - -.. figure:: img/stm32_18.png -.. figure:: img/stm32_13.png -.. figure:: img/stm32_19.png - -- 调用 **usbh_initialize** 以及 os 需要的启动线程的函数即可使用 - -.. figure:: img/stm32_20.png - -- 如果使用 **msc**,并且带文件系统,需要自行添加文件系统文件了,对应的 porting 编写参考 **fatfs_usbh.c** 文件。 - -.. figure:: img/stm32_21.png \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/tools/img/chrytool1.png b/third-party/cherryusb/docs/source/tools/img/chrytool1.png deleted file mode 100644 index 8717316a4b7014d7dfa53cb29d7cb90036ccf7af..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/tools/img/chrytool1.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/tools/img/chrytool2.png b/third-party/cherryusb/docs/source/tools/img/chrytool2.png deleted file mode 100644 index a0eb419284261eb0bd7cdedab6f9245fbec61d6d..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/tools/img/chrytool2.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/tools/img/chrytool3.png b/third-party/cherryusb/docs/source/tools/img/chrytool3.png deleted file mode 100644 index 52a3556b84c9a096d31098662e25e3b52c81ac92..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/tools/img/chrytool3.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/tools/img/chrytool4.png b/third-party/cherryusb/docs/source/tools/img/chrytool4.png deleted file mode 100644 index 8ad68400a6611cb7aca65285b0752b95dad485d9..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/tools/img/chrytool4.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/tools/img/chrytool5.png b/third-party/cherryusb/docs/source/tools/img/chrytool5.png deleted file mode 100644 index 1784932403a3198baf28d649bc35633f0ab73834..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/tools/img/chrytool5.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/tools/img/chrytool6.png b/third-party/cherryusb/docs/source/tools/img/chrytool6.png deleted file mode 100644 index 931ccad818271092a1612f836cd8ff1b3d0acba9..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/tools/img/chrytool6.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/tools/img/chrytool7.png b/third-party/cherryusb/docs/source/tools/img/chrytool7.png deleted file mode 100644 index 283a7fc930e42f7d894c66f8a823a0ce69635ca2..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/tools/img/chrytool7.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/tools/index.rst b/third-party/cherryusb/docs/source/tools/index.rst deleted file mode 100644 index 0ebfb31d24631b51daf34f22b188ada3a4255158..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/tools/index.rst +++ /dev/null @@ -1,50 +0,0 @@ -chryusb_configurator --------------------------- - -`chryusb_configurator `_ 主要服务在使用设备协议栈时,生成描述符数组,从而调用 `usbd_desc_register` 进行注册。 - -- 首先我们从 github 下载 chryusb_configurator.exe,然后一路安装就可以了。然后双击打开,点击 `工程`,并点击 `新建工程` - -.. figure:: img/chrytool1.png - -- 新建完成以后,会生成默认的描述符配置,包含 **设备描述符**、 **配置描述符**、 **字符串描述符**,并且 **字符串描述符** 默认支持三个 - -.. figure:: img/chrytool2.png - -- 然后我们可以根据需要修改相关描述符的信息,比如 **设备描述符** 中的 vid、pid,class 参数, **配置描述符** 中的 **Power** 等等 - -- 然后是 class 的添加,需要点击 `文件`,并点击 `新建文件` - -.. figure:: img/chrytool3.png - -- 然后右侧提供了一些 class 的描述符模板,选择一个进行初始化 - -.. figure:: img/chrytool4.png - -- 如果是多个 class ,则上述两步重复操作就可以了 - -- 然后我们根据需要修改相关端点的参数,比如方向、地址、size、interval - -.. figure:: img/chrytool5.png - -- 最后点击 `文件` 并保存文件,后缀为 `.chry` -- 切换到工程文件,后缀是 `.chrybase`, 然后点击 `添加分组配置` 导入刚刚配置好的 class 文件 - -.. figure:: img/chrytool6.png - -- 点击 `工程` 并点击 `保存工程` -- 点击 `编译`,生成描述符数组 - -.. figure:: img/chrytool7.png - -- 复制编译后的文件到自己的工程中使用即可 - - -力科 USB Protocol Suite --------------------------- - -Wireshark --------------------------- - -Audacity --------------------------- diff --git a/third-party/cherryusb/docs/source/usb/img/1.png b/third-party/cherryusb/docs/source/usb/img/1.png deleted file mode 100644 index e85ddf7af2fc7f5116faee5b45b22cff533e4ff7..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/1.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/10.png b/third-party/cherryusb/docs/source/usb/img/10.png deleted file mode 100644 index bb57645ecedbe9910192896faa37e35a9cb76beb..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/10.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/11.png b/third-party/cherryusb/docs/source/usb/img/11.png deleted file mode 100644 index 11056e33ce0fe3f690a98bbe5eff5a88e1858e03..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/11.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/12.png b/third-party/cherryusb/docs/source/usb/img/12.png deleted file mode 100644 index 4149d81efe2faa0e376633fc8f9601aad5457d34..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/12.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/13.png b/third-party/cherryusb/docs/source/usb/img/13.png deleted file mode 100644 index 29a544b2fbe6c0b665285d4b0bf16c1f73c7e91f..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/13.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/14.png b/third-party/cherryusb/docs/source/usb/img/14.png deleted file mode 100644 index 8ca094a40d1c1ce385e502881af138f5100be880..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/14.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/15.png b/third-party/cherryusb/docs/source/usb/img/15.png deleted file mode 100644 index eba7b89b966fa7563dcc5de36b119546c408d816..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/15.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/16.png b/third-party/cherryusb/docs/source/usb/img/16.png deleted file mode 100644 index 259336cafd359d6442d20f76f5ed73c619b6d3fa..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/16.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/17.png b/third-party/cherryusb/docs/source/usb/img/17.png deleted file mode 100644 index c42de3905e3277a3eb3360a86362eddced523fd0..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/17.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/18.png b/third-party/cherryusb/docs/source/usb/img/18.png deleted file mode 100644 index f08b63543963f4a6e7548ddb484e57180b09e8e0..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/18.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/19.png b/third-party/cherryusb/docs/source/usb/img/19.png deleted file mode 100644 index 2e6eb9ce78d4e25d3891056a66255d402d0d5c7f..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/19.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/2.png b/third-party/cherryusb/docs/source/usb/img/2.png deleted file mode 100644 index 5b4f5f20da62ca4a2b41c89dbc102831cf867ce6..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/2.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/20.png b/third-party/cherryusb/docs/source/usb/img/20.png deleted file mode 100644 index a44898a8c82c2bf6d178ae1a53b665781490acc2..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/20.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/21.png b/third-party/cherryusb/docs/source/usb/img/21.png deleted file mode 100644 index 7aa81e955a3efbcd67e01a371654de8a57c8c2a9..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/21.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/22.png b/third-party/cherryusb/docs/source/usb/img/22.png deleted file mode 100644 index 370d39f9988ab1316ad37f22e18de3c33631604e..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/22.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/23.png b/third-party/cherryusb/docs/source/usb/img/23.png deleted file mode 100644 index e08db16e179cad25fd039eed91b3e9aa94a4ce92..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/23.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/24.png b/third-party/cherryusb/docs/source/usb/img/24.png deleted file mode 100644 index fec98d49a0b124d4bd9ddc6dd7bf0459a710afd4..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/24.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/25.png b/third-party/cherryusb/docs/source/usb/img/25.png deleted file mode 100644 index 9bcaf151d8c184d306f2756d02e206bd16a0ecb3..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/25.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/26.png b/third-party/cherryusb/docs/source/usb/img/26.png deleted file mode 100644 index d439b7c48b54d83b94f9908d7c5ebebfcd20fc3e..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/26.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/27.png b/third-party/cherryusb/docs/source/usb/img/27.png deleted file mode 100644 index 1047da1b03cfd05d271a1c0876dc3de99ed730e3..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/27.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/28.png b/third-party/cherryusb/docs/source/usb/img/28.png deleted file mode 100644 index 95b760c5fb16b041c78eba4ba5f97ec54e759ffa..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/28.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/29.png b/third-party/cherryusb/docs/source/usb/img/29.png deleted file mode 100644 index 09538d161c0c3a4efc26a6373177d4ca0b78e5ff..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/29.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/3.png b/third-party/cherryusb/docs/source/usb/img/3.png deleted file mode 100644 index b8ef08230c1896cc630513f771eb8a3684c90779..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/3.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/30.png b/third-party/cherryusb/docs/source/usb/img/30.png deleted file mode 100644 index d3014f95386849cd3e5717e18b0b8839d71c653d..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/30.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/4.png b/third-party/cherryusb/docs/source/usb/img/4.png deleted file mode 100644 index f80c536674e64fbd116a105e844289da2cc8091c..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/4.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/5.png b/third-party/cherryusb/docs/source/usb/img/5.png deleted file mode 100644 index ec6a4ba20df159e76eb42d3f390ac86a8a1c77fa..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/5.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/6.png b/third-party/cherryusb/docs/source/usb/img/6.png deleted file mode 100644 index 2d280398a5c7f506af1eb33b6f06bfbcad6e4a49..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/6.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/7.png b/third-party/cherryusb/docs/source/usb/img/7.png deleted file mode 100644 index e7562f1183c5346cb52cc5674bf910f6a07a272c..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/7.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/8.png b/third-party/cherryusb/docs/source/usb/img/8.png deleted file mode 100644 index a4ac6ad4c9c34e439f57759d93abfb8685cba6ea..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/8.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/9.png b/third-party/cherryusb/docs/source/usb/img/9.png deleted file mode 100644 index a8b5b2a3b63a45c449f5f4a12be868d26e906d51..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/9.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/overview1.png b/third-party/cherryusb/docs/source/usb/img/overview1.png deleted file mode 100644 index fbaf5a193261f8c06a6c9377de29d92f24b83555..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/overview1.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/overview2.png b/third-party/cherryusb/docs/source/usb/img/overview2.png deleted file mode 100644 index c8b3b779b472956d5ff5dd59942325effec96e7a..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/overview2.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/usb_enum.png b/third-party/cherryusb/docs/source/usb/img/usb_enum.png deleted file mode 100644 index 01c67c1564c3c6ff2b9c13a58b4d78ae36650f41..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/usb_enum.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/img/usb_request.png b/third-party/cherryusb/docs/source/usb/img/usb_request.png deleted file mode 100644 index bb9f2637832fa533ee47ea73260ed53b0f6d7242..0000000000000000000000000000000000000000 Binary files a/third-party/cherryusb/docs/source/usb/img/usb_request.png and /dev/null differ diff --git a/third-party/cherryusb/docs/source/usb/usb2.0_basic.rst b/third-party/cherryusb/docs/source/usb/usb2.0_basic.rst deleted file mode 100644 index 4faa19ddae58531567591f3a829d3405250f31df..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/usb/usb2.0_basic.rst +++ /dev/null @@ -1,292 +0,0 @@ -USB 基本概念(2.0 为主) -=========================== - -本文主要对 USB 官方手册 `usb2.0.pdf `_ 中提供的第五章、第七章、第八章、第九章进行讲解。 -如果是初学 usb 的同学,推荐先不要看本节,而是将示例 demo 能够跑通了,熟悉了使用,再来看。 - -简介 ---------- - -USB 是什么?干什么用的?有什么优点?这些大家可以百度,我就不提了。主要先说 USB 的接口和速度根据不同的 USB 版本的分类,如图所示: - -.. figure:: img/overview1.png - -其次是 USB 需要满足的电平标准,有了电平标准后,下面说的信号状态就可以进行分类了。USB2.0 和 USB3.0 支持的电压范围和最大电流如下: - -.. figure:: img/overview2.png - -USB 信号状态 ------------------ - -首先我们需要了解的是 USB 的电气特性中的 Signaling Level,也就是信号状态。USB 主要是靠 D+ 和 D- 来实现不同的信号状态,然后进行通信。官方手册 7.1.7 中列举出了低速、全速和高速时的信号状态对应的 D+ 和 D- 需要满足的要求。 - -.. figure:: img/1.png -.. figure:: img/2.png -.. figure:: img/3.png - -- **差分 0 和差分 1**: 这两个状态用于通过 USB 进行的通用数据通信。当 D+线为高电平、 D-线为低电平时,该状态为差分 1。当 D+线为低电平、 D-线为高电平时,该状态为差分 0。 -- **J 状态和 K 状态**: 除了差分信号外, USB 规范还定义了其他两个差分状态: J 状态和 K 状态。它们的定义由设备速度决定。在全速和高速设备上, J 状态为差分 1 而 K 状态是差分 0。在低速设备上,该情况则相反。 -- **单端 0( SE0)**: 在 D+和 D-均为低电平时所发生的状态。该状态表示一个复位、断连或数据包的结束。 -- **单端 1( SE1)**: 在 D+和 D-均为高电平时发生的状态。不会故意生成该状态,并且不能在 USB 设计中出现。 -- **闲置**: 必须在发送一个数据包的前后发生的状态。如果一个数据线为低电平,而另一个数据线为高电平,则表示闲置状态。高电平和低电平的定义由设备的速度决定。在全速设备上,闲置状态是指 D+为高电平、 D-为低电平。在低速设备上,该情况则相反。 -- **恢复**: 用于使设备从挂起状态唤醒。通过发送一个 K 状态实现该操作。 -- **数据包的开始( SOP)**: 当 D+和 D-线从闲置状态转换到 K 状态时,将在开始低速或全速数据包前发生。 -- **数据包的结束( EOP)**: 在低速或全速数据包结束时发生。当 SE0 状态持续两位时间(后面的内容将介绍位时间)以及 J 状态持续 1 位时间时,将发生 EOP。 -- **复位**: 在 SE0 状态持续 10 ms 时发生。在 SE0 至少持续 2.5 ms 后,该设备会复位,并开始进入复位状态。 -- **保持活动( Keep Alive)**: 在低速设备中使用的信号。低速设备缺少了一个帧起始数据包(用于防止挂起状态)。每次经过 1 ms,它们都会使用一个 EOP 来防止设备进入挂起状态。 - -.. note::这里需要注意的一点就是, J K状态和差分0/1,对于低速来说,和全速/高速是相反的。 - -下面我们通过一个波形,来区分这些信号状态: - -.. figure:: img/4.png - -- 第一个红框,可以看出是一个数据包的开始,并且假设这是一个全速设备,那么D+ 为高,D- 为低,是一个闲置状态。 -- 第二个红框,D+为低,D- 为高,说明是一个 K 状态,由 闲置转 K 状态说明他是一个 SOP。 -- 第三个红框开始表示数据,表示 JKJKJKJKJK。 -- 第四个红框表示 SE0 ,因为D+和 D-均为低电平。 -- 第五个红框,而 SE0 持续了一段时间后,变成了 D+高,D- 低,说明他是一个 J 状态,从 SE0 切换成 J 状态,说明他是一个 EOP。 - -USB 速度识别 ---------------------- - -USB 的速度是如何判定的? 这个见手册 7.1.5.1。USB 的速度检测主要是靠 D+ 和 D-线上拉 1.5K决定,如果 D+上拉1.5k,则该设备为全速设备,如果 D-上拉1.5k,则为低速设备。而高速设备初始是以一个全速设备的身份出现,和全速设备一样,D+线上有一个1.5k的上拉电阻。USB2.0的hub把它当作一个全速设备,之后,hub 和设备通过一系列握手信号确认双方的身份,最终判定该设备为高速设备。 - -.. figure:: img/5.png - -USB 连接与断开检测 ---------------------- - -那么 当我们的设备插上 USB 主机时,主机是如何知道有设备插入或者拔出呢?手册 7.1.7.3 给出了答案,如图所示: - -.. figure:: img/6.png -.. figure:: img/7.png - -首先是连接检测,主机检测到某一个数据线电平拉高保持了一段时间,就认为有设备连接上来了。低速设备连接时,主机会检测到D-线被拉高,全速/高速设备连接时,主机会检测到D+线被拉高。 -而断开检测,则是主机端D+、D-数据线上的下拉电阻起作用,断开后使得二者都在低电平;当低电平持续 TDDIS 时间就会被主机认为是断开状态。上图中,TDDIS在2到2.5us之间。 - -USB 电源 ---------------------- - -作为 USB 电源时, USB 设备可被划分为两种设备类型:总线供电和自供电。 - -- 总线供电是 USB 设计的一个优势。由于设备通过总线供电,因此不需要使用笨重的内部或外部电源,它仍能够维持自身操作。总线可由主机或集线器供电。使用某个总线供电的设备时,用户将设备配置为某种状态前必须考虑其功耗。 -- 自供电设备通过使用外部电源(如直流电源适配器或电池)为自己供电。自供电设备在进行设计的过程中需要考虑到一些注意事项。 USB 规范要求自供电设备一直监控自己的 VBUS 线。 VBUS 不存在的时间内,设备必须断开提供给 D+/D-线上的上拉电阻的电源,从而防止向主机或集线器供电。 否则,会导致 USB 合规性测试发生失败。但是自供电集线器能够从总线获得最多 100 mA 的电流。 - -USB 设备状态 ---------------------- - -在 USB 插上主机的那一刻, USB 设备本身的设备状态是会变化的。而这个设备状态,后面如果学习到枚举过程,可以知道,其实这段变化描述的就是枚举过程。这部分见手册 9.1.1。 - -.. figure:: img/9.png - -- 连接状态: 当将某个设备插入到主机/集线器,但主机/集线器不给 VBUS 线供电时,会出现这种状态。它通常在集线器检测到一个过流事件时出现。虽然仍连接着设备,但主机移除了供给它的电源。 -- 供电: 某个设备被连接到 USB 上并得到供电,但仍未接收到一个复位请求。 -- 默认: 某个设备被连接到 USB 上、得到供电,并且由主机进行了复位。这时,设备没有任何设备地址。 设备会响应地址 0。 -- 地址: 某个设备被连接到 USB、得到供电、被复位,并且有一个唯一的地址。但是设备仍未得到配置。 -- 配置: 设备已经连接到 USB、得到供电、被复位、具有唯一的地址、得到配置,但尚未进入挂起状态。此时,总线供电设备能够消耗超过 100 mA 的电流。 -- 挂起: 如上面所述,设备已经建立好了连接,并且得到配置,但在 3 ms 时间内不会进行任意总线操作。 - -翻译成中文图就是: - -.. figure:: img/10.png - -USB 编码与位填充 ---------------------- - -首先,USB 的数据是串行发送的,就像 UART、I2C、SPI 等等,连续的01 信号只通过一根数据线发送给接受者。但是因为发送者和接收者运行的频率不一样,信号的同步就是个问题,比如,接受者接收到了一个持续一段时间的低电平,无法得知这究竟是代表了 5 个 0 还是 1000 个 0。一个解决办法,就是在传输数据信号的同时,附加一个时钟信号,用来同步两端的传输,接受者在时钟信号的辅助下对数据信号采样,就可以正确解析出发送的数据了,比如 I2C 就是这样做的,SDA 来传输数据,SCL 来传输同步时钟: - -.. figure:: img/11.png - -虽然这样解决了问题,但是却需要附加一根时钟信号线来传输时钟。因为USB没有时钟信号,有没有不需要附加的时钟信号,也能保持两端的同步呢? -有的,这就是 RZ 编码(Return-to-zero Code),也叫做归零编码。 - -RZ 编码(Return-to-zero Code) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -RZ 编码(Return-to-zero Code),也叫做归零编码。在 RZ 编码中,正电平代表逻辑 1,负电平代表逻辑 0,并且,每传输完一位数据,信号返回到零电平,也就是说,信号线上会出现 3 种电平:正电平、负电平、零电平。 - -.. figure:: img/12.png - -从图上就可以看出来,因为每位传输之后都要归零,所以接受者只要在信号归零后采样即可,这样就不在需要单独的时钟信号。实际上, RZ 编码就是相当于把时钟信号用归零编码在了数据之内。这样的信号也叫做自同步(self-clocking)信号。 -这样虽然省了时钟数据线,但是还是有缺点的,因为在 RZ 编码中,大部分的数据带宽,都用来传输“归零”而浪费掉了。 - -NRZ 编码(Non-return-to-zero Code) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -去掉这个归零步骤,NRZ 编码(Non-return-to-zero Code)就出现了,和 RZ 的区别就是 NRZ 是不需要归零的。 - -.. figure:: img/13.png - -NRZI 编码(Non-Return-to-Zero Inverted Code) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -NRZI 编码(Non-Return-to-Zero Inverted Code)和 NRZ 的区别就是 NRZI 用信号的翻转代表一个逻辑,信号保持不变代表另外一个逻辑。这个见手册 7.1.8。 - -.. figure:: img/14.png - -如图所示,可以得出一个简单的记忆方式:遇到 0 的边沿电平就翻转,遇到 1 的边沿则不变。 - -位填充(bit-stuffing) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -但是,这样还是会有一个问题,就是虽然接受者可以主动和发送者的频率匹配,但是两者之间总会有误差。假如数据信号是 1000 个逻辑 1,经过 USB 的 NRZI 编码之后,就是很长一段没有变化的电平,在这种情况下,即使接受者的频率和发送者相差千分之一,就会造成把数据采样成 1001 个或者 999 个 1了。 -USB 对这个问题的解决办法,就是强制插 0,也就是(位填充)bit-stuffing,如果要传输的数据中有 6个连续的 1,发送前就会在第 6 个 1 后面强制插入一个 0,让发送的信号强制出现翻转,从而强制接受者进行频率调整。 -接受者只要删除 6 个连续 1 之后的 0,就可以恢复原始的数据了。这部分见手册 7.1.9。 - -.. figure:: img/15.png -.. figure:: img/16.png -.. figure:: img/17.png - -在数据被NRZI编码之前,在数据流中每六个连续的1之后插入一个0,以强制NRZI数据流中的过渡,这使接收器逻辑至少每七位有一次数据转换,以保证数据和时钟的锁定。比特填充是从同步模式开始启用。结束同步模式的数据 "一 "被算作是序列中的第一个 "一"。序列中的第一个。除了高速EOP期间,发射器的位填充总是被强制执行。如果需要按照 -位填充规则的要求,零位将被插入,即使它是数据包结束(EOP)信号前的最后一位。接收器必须对NRZI数据进行解码,识别填充位,并将其丢弃。 - -USB 字段(域) ---------------------- - -USB 字段构成了 USB 通信中最基本也是最小的单元,后面的包、事务,最根本都是由字段构成,而字段又是由比特构成。字段部分见手册 8.1。 - -.. note:: USB 的比特先行模式是按照 LSB 先行原则。 - -同步字段 -^^^^^^^^^^^^^^^^^^^^^^^^ - -在 USB 系统中,主机和设备不是共享一个时钟,这使得接收方没办法准确知道发送方什么时候发送数据,尽管能检测到SOP,但是远远不够,所有这个时候就需要同步字段,使得接收方和发送方收发过程中保持同步,所以任何一个包都要以同步字段开始。同步字段0x01,经过编码以后就是01010100B。 - -.. figure:: img/18.png - -包标识符字段 -^^^^^^^^^^^^^^^^^^^^^^^^ - -PID 由一个四位数据包类型字段和一个四位校验字段组成,占用 8 个bit,如图所示。 PID指示数据包的类型,并通过推断,数据包的格式和应用于数据包的错误检测类型包。 PID的四位校验字段是通过执行分组类型字段的一个补码来生成,从而确保PID的可靠解码,以便正确解释分组的其余部分,如果四个PID校验位不是它们各自的分组标识符位的补码,则存在PID错误。 - -.. figure:: img/19.png - -既然是 4个比特,说明了 PID 类型可以分为16种,从16种中,又细分成4类:令牌 PID,数据 PID,握手 PID 和特殊 PID。 - -.. figure:: img/20.png - -地址字段 -^^^^^^^^^^^^^^^^^^^^^^^^ - -地址字段又分为设备地址字段和端点地址字段,其中设备地址字段占用 7 个bit,除去0 地址,主机可以分配的地址有 127个。 - -.. figure:: img/21.png - -端点地址字段占用 4个 bit,总共可以提供 16 个端点。 - -.. figure:: img/22.png - -帧号字段 -^^^^^^^^^^^^^^^^^^^^^^^^ - -帧号字段占用 11 个bit,主机每发出一个帧,帧号都会加1,如图所示。而高速设备中,帧中又包含微帧,1帧=8微帧,微帧则是加0.1。关于帧和微帧的概念,后续补充。 - -.. figure:: img/23.png - -数据字段 -^^^^^^^^^^^^^^^^^^^^^^^^ - -根据传输类型不同,数据字段中的数据长度也是不定的,从 0-1024不等。 - -.. figure:: img/24.png - -CRC 字段 -^^^^^^^^^^^^^^^^^^^^^^^^ - -循环冗余校验(CRC)用于保护令牌和数据包中的所有非PID字段。PID不包含在包含CRC的分组的CRC校验中。 在执行比特填充之前,在发送器中的各个字段上生成所有CRC。 类似地,在去除填充位之后,在接收器中对CRC进行解码。令牌和数据包CRC为所有单比特和双比特错误提供100%的覆盖。 CRC失败被认为表示一个或多个受保护字段已损坏并导致接收器忽略这些字段,并且在大多数情况下,忽略整个数据包。 - -.. figure:: img/24.png - -- 令牌CRC - -为令牌提供五位CRC字段,并覆盖IN,SETUP和OUT令牌的ADDR和ENDP字段或SOF令牌的时间戳字段。 PING和SPLIT特殊令牌还包括一个五位CRC字段。 - -生成多项式为: G(X)= X^5 + X^2 + 1 -表示该多项式的二进制位模式是00101B。 如果接收到所有令牌位而没有错误,则接收器处的五位校验和将为01100B。 - -- 数据CRC - -数据CRC是应用于数据分组的数据字段的16位多项式。 - -生成多项式是:G(X)= X^16 + X^15 + X^2 + 1 -表示该多项式的二进制位模式是1000000000000101B。 如果没有错误地接收到所有数据和CRC位,则16位校验和将为1000000000001101B。 - -USB 包 ---------------------- - -包由字段组成,根据 PID 类型,包分为四大类:令牌包、数据包、握手包、特殊包。此节内容见官方 8.4.1。 - -.. figure:: img/25.png - -算上 SOP,则如图,组成一个完整的包。 - -.. figure:: img/26.png - -令牌包 -^^^^^^^^^^^^^^^^^^^^^^^^ - -令牌包分为:SETUP、IN、OUT、SOF,其中 SETUP、IN、OUT的字段组成一样,如图: - -.. figure:: img/27.png - -- PID 字段:定义了数据传输方向为USB主机到USB设备。 -- ADDR 字段:指明了USB设备地址。 -- ENDP 字段:指明了接收数据的端点号。 -- CRC 字段:用于ADDR字段和ENDP字段进行循环冗余校验。 - -SOF 包的字段组成,如图: - -.. figure:: img/28.png - -- PID 字段:定义了数据传输方向为USB主机到USB设备。 -- 帧号 字段:指明了USB传输的帧号,其11位。 -- CRC 字段:用于ADDR字段和ENDP字段进行循环冗余校验。 - -数据包 -^^^^^^^^^^^^^^^^^^^^^^^^ - -.. figure:: img/29.png - -- PID 字段:用于指明不同的数据包类型。支持 4 种数据包,分别为: DATAO 、 DATA1 、DATA2 和MDATA。 -- 数据 字段:其中包含了传输的数据。其数据的大小根据数据传输类吧和川户需要而定。根据 USB 协议的规定,对于低速 USB 数据传输, 最大长度为8字节对于全速SB 数据传输,其最大长度为 1023 字节;对于高速 USB 数据传输,数据最大长度为 1024 。 -- CRC 字段:这里使用 16 位的循环冗余校验来对数据字段进行保护。 - -握手包 -^^^^^^^^^^^^^^^^^^^^^^^^ - -握手包由8位的PID构成,用于数据传输的末位报告本次数据传输的状成。握手包之后使是整个事务处理的结束信号EOP. - -.. figure:: img/30.png - -特殊包 -^^^^^^^^^^^^^^^^^^^^^^^^ - -USB 事务 ---------------------- - -USB 常用事务共有三种:SETUP、IN、OUT,除了控制传输使用三个事务,其他传输都使用两个事务。特殊事务则是不携带数据的事务。 - -SETUP 事务 -^^^^^^^^^^^^^^^^^^^^^^^^ - -IN 事务 -^^^^^^^^^^^^^^^^^^^^^^^^ - -OUT 事务 -^^^^^^^^^^^^^^^^^^^^^^^^ - -特殊事务 -^^^^^^^^^^^^^^^^^^^^^^^^ - -USB 传输 ---------------------- - -控制传输 -^^^^^^^^^^^^^^^^^^^^^^^^ - -批量传输 -^^^^^^^^^^^^^^^^^^^^^^^^ - -中断传输 -^^^^^^^^^^^^^^^^^^^^^^^^ - -同步传输 -^^^^^^^^^^^^^^^^^^^^^^^^ \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/usb/usb3.0_basic.rst b/third-party/cherryusb/docs/source/usb/usb3.0_basic.rst deleted file mode 100644 index 1dbbd8152a8d90e08c4ee9243fcbc2c568890ae0..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/usb/usb3.0_basic.rst +++ /dev/null @@ -1,33 +0,0 @@ -USB 基本概念(3.0 为主) -=========================== - - -简介 ------------- - - - -与 USB 2.0 相同和不同点 --------------------------- - - -Link Layer --------------------- - -LCW -^^^^^^^^^^ - -Protocol Layer --------------------- - -LMP -^^^^^^^^^^^^^^^^^^^^^^^^ - -TP -^^^^^^^^^^^^^^^^^^^^^^^^ - -DP -^^^^^^^^^^^^^^^^^^^^^^^^ - -ITP -^^^^^^^^^^^^^^^^^^^^^^^^ \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/usb/usb_desc.rst b/third-party/cherryusb/docs/source/usb/usb_desc.rst deleted file mode 100644 index f0bcc7fec441341663cac3b55a8ecbb7ea5e4f6a..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/usb/usb_desc.rst +++ /dev/null @@ -1,37 +0,0 @@ -USB 描述符 -=========================== - -本节参考官方 usb2.0 pdf 9.5 节即可。 - -设备描述符 ---------------------- - -配置描述符 ---------------------- - -接口描述符 ---------------------- - -端点描述符 ---------------------- - -字符串描述符 ---------------------- - -接口关联描述符 ---------------------- - -设备限定描述符 ---------------------- - -其他速度描述符 ---------------------- - -BOS 描述符 ---------------------- - -超高速端点伴随描述符 ---------------------- - -增加型超高速同步端点伴随描述符 -------------------------------- diff --git a/third-party/cherryusb/docs/source/usb/usb_enum.rst b/third-party/cherryusb/docs/source/usb/usb_enum.rst deleted file mode 100644 index 1434424f5f46b054127ced1522234b3eb07ac7b7..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/usb/usb_enum.rst +++ /dev/null @@ -1,22 +0,0 @@ -USB 枚举 -=========================== - -当我们了解了 usb 设备请求以后,就可以来学习下 USB 设备的整个枚举过程了,看看是如何枚举出一个串口、鼠标、u盘等设备了。枚举过程中主机会发送设备请求来获取相关信息(也就是描述符),具体发送哪些,参考下图。 - -.. figure:: img/usb_enum.png - -- 首先设备接上 USB 线,然后插上电脑 -- 设备插上以后上电,处于供电状态 -- 主机通过 D+/D- 识别到设备插入 -- 对设备进行复位 -- 主机发送 **获取设备描述符请求** -- 可选的复位操作 -- 主机发送 **设置设备地址请求** -- 主机发送 **获取配置描述符请求**,可能会获取多次,无所谓 -- 主机发送 **获取字符串描述符请求**,正常会获取3个字符串,如果后面的描述符中指定了字符串,则继续获取指定的字符串 -- 主机发送 **获取设备限定描述符请求**,用来获取在设备工作在其他速度上的请求,如果设备只能工作在全速模式,则必须回复 stall,并且协议栈中一定会打印该请求告诉你此命令设备不支持。 -- 主机发送 **设置配置请求**,对设备的端点进行配置,通常是根据端点描述符中的配置进行设置。 -- 到此标准的设备请求结束 -- 主机根据接口描述符加载对应支持的 class 驱动,如果主机不支持,则会提示该设备找不到驱动 -- 加载完成以后,开始执行该 class 相关的请求 -- 最终进行 class 的数据流传输 \ No newline at end of file diff --git a/third-party/cherryusb/docs/source/usb/usb_request.rst b/third-party/cherryusb/docs/source/usb/usb_request.rst deleted file mode 100644 index 8e42565d3bd1b8d341b3349e60df25c921891ef2..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/usb/usb_request.rst +++ /dev/null @@ -1,6 +0,0 @@ -USB 设备请求 -=========================== - -本节参考官方 usb2.0 pdf 9.3、9.4 节即可。 - -.. figure:: img/usb_request.png diff --git a/third-party/cherryusb/docs/source/usbdev.svg b/third-party/cherryusb/docs/source/usbdev.svg deleted file mode 100644 index d9fa9549a2d3c2fc149a07e6f125aa54d0e8be68..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/usbdev.svg +++ /dev/null @@ -1,21 +0,0 @@ -
usbd_desc_register
usbd_desc_register -
usbd_add_interface
usbd_add_interface -
usbd_initialize
usbd_initialize -
usbd_add_endpoint
usbd_add_endpoint -
Listclass_interface_handlerclass_endpoint_handlervendor_handlernotify_handlerhid_report_descriptorhid_report_descriptor_lenintf_numusbd_intf_head
append into list
append into list
in_ep_cb[8]

out_ep_cb[8]
in_ep_cb[8]...
fill ep callback
fill ep callback
usb_dc_init
usb_dc_init -
USBD_IRQHandler
USBD_IRQHandler -
SETUP complete intstatus
SETUP complete intstatus
IN complete intstatus
IN complete intstatus -
OUT complete intstatus
OUT complete intstatus -
usbd_event_reset_handler
usbd_event_reset_handler -
RESET complete intstatus
RESET complete intstatus
usbd_event_ep0_setup_complete_handler
usbd_event_ep0_setup_complete_handler -
usbd_event_ep_in_complete_handler
usbd_event_ep_in_complete_handler -
usbd_event_ep_out_complete_handler
usbd_event_ep_out_complete_handler -
enable ep0

start reading setup
enable ep0...
usbd_setup_request_handler
usbd_setup_request_handler -
usbd_standard_request_handler
usbd_standard_request_handler -
usbd_class_request_handler
usbd_class_request_handler -
usbd_vendor_request_handler
usbd_vendor_request_handler -
usbd_class_interface_request_handler
usbd_class_interface_request_handler -
usbd_class_endpoint_request_handler
usbd_class_endpoint_request_handler -
if ep != 0x80
if ep != 0x80
if ep != 0x00
if ep != 0x00
in_ep_cb[ep & 0x7f]
in_ep_cb[ep & 0x7f] -
out_ep_cb[ep & 0x7f]
out_ep_cb[ep & 0x7f] -
NULL
NULL
Listclass_interface_handlerclass_endpoint_handlervendor_handlernotify_handlerhid_report_descriptorhid_report_descriptor_lenintf_num
Viewer does not support full SVG 1.1
\ No newline at end of file diff --git a/third-party/cherryusb/docs/source/usbhost.svg b/third-party/cherryusb/docs/source/usbhost.svg deleted file mode 100644 index b7d537b56108f38a1181445c2b655a7ea4a50111..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/docs/source/usbhost.svg +++ /dev/null @@ -1,9 +0,0 @@ -
usbh_initialize
usbh_initialize
usbh_hub_initialize
usbh_hub_initialize
usbh_roothub_register
usbh_roothub_register
create usbh_hub_thread
create usbh_hub_thread
usb_hc_init
usb_hc_init
usbh_roothub_thread_wakeup
usbh_roothub_thread_wakeup -
hub_int_complete_callback
hub_int_complete_callback -
wakeup
wakeup
wakeup
wakeup
usbh_enumerate
usbh_enumerate -
search all ports
search all ports
usbh_hub_events
usbh_hub_events -
CLASS_CONNECT
CLASS_CONNECT -
search all interface drivers
search all interface drivers
usbh_find_class_driver
usbh_find_class_driver -
if hub class?
if hub class?
usbh_int_urb_fill


usbh_submit_urb
usbh_int_urb_fill...
Class Register
Class Register -
USBH_IRQHandler
USBH_IRQHandler -
Viewer does not support full SVG 1.1
\ No newline at end of file diff --git a/third-party/cherryusb/include.mk b/third-party/cherryusb/include.mk deleted file mode 100644 index e570428583dc94300d36370563544d2f7fb043f3..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/include.mk +++ /dev/null @@ -1,38 +0,0 @@ -ifdef CONFIG_USE_CHERRY_USB - -BUILD_INC_PATH_DIR += $(FREERTOS_SDK_DIR)/third-party/cherryusb/core \ - $(FREERTOS_SDK_DIR)/third-party/cherryusb/common \ - $(FREERTOS_SDK_DIR)/third-party/cherryusb/osal -ifdef CONFIG_CHERRY_USB_PORT_XHCI - BUILD_INC_PATH_DIR += $(FREERTOS_SDK_DIR)/third-party/cherryusb/port/xhci -endif #CONFIG_CHERRY_USB_PORT_XHCI - -ifdef CONFIG_CHERRYUSB_HOST - - ifdef CONFIG_CHERRY_USB_HOST_HUB - BUILD_INC_PATH_DIR += $(FREERTOS_SDK_DIR)/third-party/cherryusb/class/hub - endif #CONFIG_CHERRY_USB_HOST_HUB - - ifdef CONFIG_CHERRY_USB_HOST_MSC - BUILD_INC_PATH_DIR += $(FREERTOS_SDK_DIR)/third-party/cherryusb/class/msc - endif #CONFIG_CHERRY_USB_HOST_MSC - - ifdef CONFIG_CHERRY_USB_HOST_HID - BUILD_INC_PATH_DIR += $(FREERTOS_SDK_DIR)/third-party/cherryusb/class/hid - endif #CONFIG_CHERRY_USB_HOST_HID - - ifdef CONFIG_CHERRY_USB_HOST_VEDIO - BUILD_INC_PATH_DIR += $(FREERTOS_SDK_DIR)/third-party/cherryusb/class/vedio - endif #CONFIG_CHERRY_USB_HOST_VEDIO - - ifdef CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS - BUILD_INC_PATH_DIR += $(FREERTOS_SDK_DIR)/third-party/cherryusb/class/wireless - endif #CONFIG_CHERRY_USB_HOST_RNDIS_WIRELESS - - ifdef CONFIG_CHERRY_USB_HOST_CDC - BUILD_INC_PATH_DIR += $(FREERTOS_SDK_DIR)/third-party/cherryusb/class/cdc - endif #CONFIG_CHERRY_USB_HOST_CDC - -endif #CONFIG_CHERRYUSB_HOST - -endif \ No newline at end of file diff --git a/third-party/cherryusb/makefile b/third-party/cherryusb/makefile deleted file mode 100644 index 55144bc3906a418317d4ca44926c5c923dec8914..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/makefile +++ /dev/null @@ -1,8 +0,0 @@ - - - -include $(PROJECT_DIR)/sdkconfig - -include src.mk - -include $(SDK_DIR)/tools/build/compiler.mk \ No newline at end of file diff --git a/third-party/cherryusb/osal/usb_config.h b/third-party/cherryusb/osal/usb_config.h deleted file mode 100644 index 69d0e5e74778d5839043cff9de432abd6a73e744..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/osal/usb_config.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright : (C) 2022 Phytium Information Technology, Inc. - * All Rights Reserved. - * - * This program is OPEN SOURCE software: you can redistribute it and/or modify it - * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, - * either version 1.0 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the Phytium Public License for more details. - * - * - * FilePath: usb_config.h - * Date: 2022-09-19 17:28:44 - * LastEditTime: 2022-09-19 17:28:45 - * Description:  This file is for usb hc xhci configuration. - * - * Modify History: - * Ver   Who        Date         Changes - * ----- ------     --------    -------------------------------------- - * 1.0 zhugengyu 2022/9/19 init commit - * 1.1 liqiaozhong 2023/2/10 update to v0.7.0 - */ - -#ifndef USB_CONFIG_H -#define USB_CONFIG_H - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* ================ USB common Configuration ================ */ -void *usb_hc_malloc(size_t size); -void usb_hc_free(); -void *usb_hc_malloc_align(size_t align, size_t size); - -#define usb_malloc(size) usb_hc_malloc(size) -#define usb_free(ptr) usb_hc_free(ptr) -#define usb_align(align, size) usb_hc_malloc_align(align, size) - -#ifndef CONFIG_USB_DBG_LEVEL - #define CONFIG_USB_DBG_LEVEL USB_DBG_ERROR -#endif - -#ifndef CONFIG_USB_PRINTF - #define CONFIG_USB_PRINTF printf -#endif - -/* Enable print with color */ -#define CONFIG_USB_PRINTF_COLOR_ENABLE - -/* data align size when use dma */ -#ifndef CONFIG_USB_ALIGN_SIZE - #define CONFIG_USB_ALIGN_SIZE 4 -#endif - -/* attribute data into no cache ram */ -#define USB_NOCACHE_RAM_SECTION __attribute__((section(".noncacheable"))) - -/* ================= USB Device Stack Configuration ================ */ - -/* Ep0 max transfer buffer, specially for receiving data from ep0 out */ -#define CONFIG_USBDEV_REQUEST_BUFFER_LEN 256 - - -#ifndef CONFIG_USBDEV_MSC_BLOCK_SIZE - #define CONFIG_USBDEV_MSC_BLOCK_SIZE 512 -#endif - -#ifndef CONFIG_USBDEV_MSC_MANUFACTURER_STRING - #define CONFIG_USBDEV_MSC_MANUFACTURER_STRING "" -#endif - -#ifndef CONFIG_USBDEV_MSC_PRODUCT_STRING - #define CONFIG_USBDEV_MSC_PRODUCT_STRING "" -#endif - -#ifndef CONFIG_USBDEV_MSC_VERSION_STRING - #define CONFIG_USBDEV_MSC_VERSION_STRING "0.01" -#endif - -// #define CONFIG_USBHOST_GET_STRING_DESC -#define CONFIG_USBHOST_GET_DEVICE_DESC - -// #define CONFIG_USBDEV_MSC_THREAD -#define CONFIG_INPUT_MOUSE_WHEEL - -#ifdef CONFIG_USBDEV_MSC_THREAD - #ifndef CONFIG_USBDEV_MSC_STACKSIZE - #define CONFIG_USBDEV_MSC_STACKSIZE 2048 - #endif - - #ifndef CONFIG_USBDEV_MSC_PRIO - #define CONFIG_USBDEV_MSC_PRIO 4 - #endif -#endif - -#ifndef CONFIG_USBDEV_AUDIO_VERSION - #define CONFIG_USBDEV_AUDIO_VERSION 0x0100 -#endif - -#ifndef CONFIG_USBDEV_AUDIO_MAX_CHANNEL - #define CONFIG_USBDEV_AUDIO_MAX_CHANNEL 8 -#endif - -/* ================ USB HOST Stack Configuration ================== */ - -#define CONFIG_USBHOST_MAX_RHPORTS 8 -#define CONFIG_USBHOST_MAX_EXTHUBS 2 -#define CONFIG_USBHOST_MAX_EHPORTS 4 -#define CONFIG_USBHOST_MAX_INTERFACES 6 -#define CONFIG_USBHOST_MAX_INTF_ALTSETTINGS 1 -#define CONFIG_USBHOST_MAX_ENDPOINTS 4 - -#define CONFIG_USBHOST_DEV_NAMELEN 16 - -#ifndef CONFIG_USBHOST_PSC_PRIO - #define CONFIG_USBHOST_PSC_PRIO 4 -#endif -#ifndef CONFIG_USBHOST_PSC_STACKSIZE - #define CONFIG_USBHOST_PSC_STACKSIZE 4096 -#endif - -/* Ep0 max transfer buffer */ -#define CONFIG_USBHOST_REQUEST_BUFFER_LEN 512 - -#ifndef CONFIG_USBHOST_CONTROL_TRANSFER_TIMEOUT - #define CONFIG_USBHOST_CONTROL_TRANSFER_TIMEOUT 500 -#endif - -#ifndef CONFIG_USBHOST_MSC_TIMEOUT - #define CONFIG_USBHOST_MSC_TIMEOUT 5000 -#endif - -/* do not try to enumrate one interface */ -#ifndef CONFIG_USBHOST_ENUM_FIRST_INTERFACE_ONLY - #define CONFIG_USBHOST_ENUM_FIRST_INTERFACE_ONLY -#endif - -/* ================ USB Device Port Configuration ================*/ - -#define CONFIG_XHCI_PAGE_SIZE 4096U -#define CONFIG_XHCI_PAGE_SHIFT 12U - -/* ================ USB Host Port Configuration ==================*/ - -#define CONFIG_USBHOST_PIPE_NUM 10 - -/* ================ XHCI Configuration ================ */ -#define CONFIG_USBHOST_XHCI -#define CONFIG_USBHOST_XHCI_NUM 2 - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/third-party/cherryusb/osal/usb_osal.h b/third-party/cherryusb/osal/usb_osal.h deleted file mode 100644 index 7f72355974a5ef7ef01327de9b0043ce0ae9ba49..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/osal/usb_osal.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ -#ifndef USB_OSAL_H -#define USB_OSAL_H - -#include -#include - -typedef void *usb_osal_thread_t; -typedef void *usb_osal_sem_t; -typedef void *usb_osal_mutex_t; -typedef void *usb_osal_mq_t; -typedef void (*usb_thread_entry_t)(void *argument); - -usb_osal_thread_t usb_osal_thread_create(const char *name, uint32_t stack_size, uint32_t prio, usb_thread_entry_t entry, void *args); - -usb_osal_sem_t usb_osal_sem_create(uint32_t initial_count); -void usb_osal_sem_delete(usb_osal_sem_t sem); -int usb_osal_sem_take(usb_osal_sem_t sem, uint32_t timeout); -int usb_osal_sem_give(usb_osal_sem_t sem); - -usb_osal_mutex_t usb_osal_mutex_create(void); -void usb_osal_mutex_delete(usb_osal_mutex_t mutex); -int usb_osal_mutex_take(usb_osal_mutex_t mutex); -int usb_osal_mutex_give(usb_osal_mutex_t mutex); - -usb_osal_mq_t usb_osal_mq_create(uint32_t max_msgs); -int usb_osal_mq_send(usb_osal_mq_t mq, uintptr_t addr); -int usb_osal_mq_recv(usb_osal_mq_t mq, uintptr_t *addr, uint32_t timeout); - -size_t usb_osal_enter_critical_section(void); -void usb_osal_leave_critical_section(size_t flag); - -void usb_osal_msleep(uint32_t delay); - -#endif /* USB_OSAL_H */ diff --git a/third-party/cherryusb/osal/usb_osal_freertos.c b/third-party/cherryusb/osal/usb_osal_freertos.c deleted file mode 100644 index 7a055aba6c8cfc41a7f13637e7864559568ed25c..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/osal/usb_osal_freertos.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2022, sakumisu - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "faarch.h" - -#include "usb_osal.h" -#include "usb_errno.h" -#include -#include "semphr.h" -#include "timers.h" -#include "event_groups.h" - -usb_osal_thread_t usb_osal_thread_create(const char *name, uint32_t stack_size, uint32_t prio, usb_thread_entry_t entry, void *args) -{ - TaskHandle_t htask = NULL; - stack_size /= sizeof(StackType_t); - xTaskCreate(entry, name, stack_size, args, prio, &htask); - return (usb_osal_thread_t)htask; -} - -usb_osal_sem_t usb_osal_sem_create(uint32_t initial_count) -{ - return (usb_osal_sem_t)xSemaphoreCreateCounting(1, initial_count); -} - -void usb_osal_sem_delete(usb_osal_sem_t sem) -{ - vSemaphoreDelete((SemaphoreHandle_t)sem); -} - -int usb_osal_sem_take(usb_osal_sem_t sem, uint32_t timeout) -{ - return (xSemaphoreTake((SemaphoreHandle_t)sem, pdMS_TO_TICKS(timeout)) == pdPASS) ? 0 : -ETIMEDOUT; -} - -int usb_osal_sem_give(usb_osal_sem_t sem) -{ - BaseType_t xHigherPriorityTaskWoken = pdFALSE; - int ret; - - /* TODO: consider poll usb event */ - ret = xSemaphoreGiveFromISR((SemaphoreHandle_t)sem, &xHigherPriorityTaskWoken); - if (ret == pdPASS) { - portYIELD_FROM_ISR(xHigherPriorityTaskWoken); - } - - return (ret == pdPASS) ? 0 : -ETIMEDOUT; -} - -usb_osal_mutex_t usb_osal_mutex_create(void) -{ - return (usb_osal_mutex_t)xSemaphoreCreateMutex(); -} - -void usb_osal_mutex_delete(usb_osal_mutex_t mutex) -{ - vSemaphoreDelete((SemaphoreHandle_t)mutex); -} - -int usb_osal_mutex_take(usb_osal_mutex_t mutex) -{ - return (xSemaphoreTake((SemaphoreHandle_t)mutex, portMAX_DELAY) == pdPASS) ? 0 : -ETIMEDOUT; -} - -int usb_osal_mutex_give(usb_osal_mutex_t mutex) -{ - return (xSemaphoreGive((SemaphoreHandle_t)mutex) == pdPASS) ? 0 : -ETIMEDOUT; -} - -usb_osal_mq_t usb_osal_mq_create(uint32_t max_msgs) -{ - return (usb_osal_mq_t)xQueueCreate(max_msgs, sizeof(void *)); -} - -int usb_osal_mq_send(usb_osal_mq_t mq, uintptr_t addr) -{ - BaseType_t xHigherPriorityTaskWoken = pdFALSE; - int ret; - - ret = xQueueSendFromISR((usb_osal_mq_t)mq, &addr, &xHigherPriorityTaskWoken); - if (ret == pdPASS) { - portYIELD_FROM_ISR(xHigherPriorityTaskWoken); - } - - return (ret == pdPASS) ? 0 : -ETIMEDOUT; -} - -int usb_osal_mq_recv(usb_osal_mq_t mq, uintptr_t *addr, uint32_t timeout) -{ - return (xQueueReceive((usb_osal_mq_t)mq, addr, timeout) == pdPASS) ? 0 : -ETIMEDOUT; -} - -size_t usb_osal_enter_critical_section(void) -{ - /* - taskDISABLE_INTERRUPTS(); - return 1; - */ - uint32_t cur; - - cur = MFCPSR(); - MTCPSR(cur | 0xC0); - return cur; -} - -void usb_osal_leave_critical_section(size_t flag) -{ - /* taskENABLE_INTERRUPTS();*/ - MTCPSR(flag); -} - -void usb_osal_msleep(uint32_t delay) -{ - vTaskDelay(pdMS_TO_TICKS(delay)); -} diff --git a/third-party/cherryusb/port/xhci/usb_hc_xhci.c b/third-party/cherryusb/port/xhci/usb_hc_xhci.c deleted file mode 100644 index 70761733b7146877639ef5189cc1f3e651eb8cbe..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/port/xhci/usb_hc_xhci.c +++ /dev/null @@ -1,510 +0,0 @@ -/* - * Copyright : (C) 2022 Phytium Information Technology, Inc. - * All Rights Reserved. - * - * This program is OPEN SOURCE software: you can redistribute it and/or modify it - * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, - * either version 1.0 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the Phytium Public License for more details. - * - * - * FilePath: usb_hc_xhci.c - * Date: 2022-09-19 17:24:36 - * LastEditTime: 2022-09-19 17:24:36 - * Description:  This file is for xhci function implementation. - * - * Modify History: - * Ver   Who        Date         Changes - * ----- ------     --------    -------------------------------------- - * 1.0 zhugengyu 2022/9/19 init commit - * 1.1 zhugengyu 2022/10/9 add dumpers and fix command abort - * 2.0 zhugengyu 2023/3/29 support usb3.0 device attached at roothub - */ - -/***************************** Include Files *********************************/ -#include "usbh_hub.h" - -#include "xhci.h" - -/************************** Constant Definitions *****************************/ - -/************************** Variable Definitions *****************************/ - -/***************** Macros (Inline Functions) Definitions *********************/ - -/************************** Function Prototypes ******************************/ - -/*****************************************************************************/ -__WEAK void usb_hc_low_level_init(uint32_t id) -{ -} - -__WEAK void *usb_hc_malloc(size_t size) -{ - return NULL; -} - -__WEAK void *usb_hc_malloc_align(size_t align, size_t size) -{ - return NULL; -} - -__WEAK void usb_hc_free() -{ -} - -/* one may get xhci register base address by PCIe bus emuration */ -__WEAK unsigned long usb_hc_get_register_base(uint32_t id) -{ - return 0U; -} - -static inline struct xhci_host* xhci_get_inst_of_port(struct usbh_hubport *hport) { - USB_ASSERT(hport && hport->parent); - struct usbh_bus *usb = hport->parent->usb; - return (struct xhci_host*)usb->priv; -} - -static struct xhci_host xhci_host[CONFIG_USBHOST_XHCI_NUM]; - -/* xhci hardware init */ -int usb_hc_init(uint32_t id) -{ - USB_ASSERT(id < CONFIG_USBHOST_XHCI_NUM); - int rc = 0; - struct usbh_bus *bus = usbh_get_bus_of_index(id); - USB_ASSERT(bus); - struct xhci_host *xhci = &(xhci_host[id]); - - size_t flag = usb_osal_enter_critical_section(); /* no interrupt when init hc */ - - usb_hc_low_level_init(id); /* set gic and memp */ - - memset(xhci, 0, sizeof(*xhci)); - xhci->bus = bus; - bus->priv = xhci; - if (rc = xhci_probe(xhci, usb_hc_get_register_base(id)) != 0) { - goto err_open; - } - - if (rc = xhci_open(xhci) != 0 ) { - goto err_open; - } - - err_open: - usb_osal_leave_critical_section(flag); - return rc; -} - -int usbh_roothub_control(struct usbh_bus *usb, struct usb_setup_packet *setup, uint8_t *buf) -{ - uint8_t nports; - uint8_t port; - uint32_t portsc; - uint32_t status; - int ret = 0; - struct xhci_host *xhci = usb->priv; - nports = CONFIG_USBHOST_MAX_RHPORTS; - - port = setup->wIndex; - - /* - bmRequestType bit[4:0], define whether the request is directed to the device (0000b), - specific interface (00001b), endpoint (00010b), or other element (00011b) - bRequest, identifies the request - wValue, pass the request-specific info to the device - */ - if (setup->bmRequestType & USB_REQUEST_RECIPIENT_DEVICE) /* request is directed to device */ - { - switch (setup->bRequest) - { - case HUB_REQUEST_CLEAR_FEATURE: /* disable the feature */ - switch (setup->wValue) - { - case HUB_FEATURE_HUB_C_LOCALPOWER: - USB_LOG_ERR("HUB_FEATURE_HUB_C_LOCALPOWER not implmented.\n"); - break; - case HUB_FEATURE_HUB_C_OVERCURRENT: - USB_LOG_ERR("HUB_FEATURE_HUB_C_OVERCURRENT not implmented.\n"); - break; - default: - return -EPIPE; - } - break; - case HUB_REQUEST_SET_FEATURE: /* set a value reported in the hub status */ - switch (setup->wValue) - { - case HUB_FEATURE_HUB_C_LOCALPOWER: - USB_LOG_ERR("HUB_FEATURE_HUB_C_LOCALPOWER not implmented.\n"); - break; - case HUB_FEATURE_HUB_C_OVERCURRENT: - USB_LOG_ERR("HUB_FEATURE_HUB_C_OVERCURRENT not implmented.\n"); - break; - default: - return -EPIPE; - } - break; - case HUB_REQUEST_GET_DESCRIPTOR: - USB_LOG_ERR("HUB_REQUEST_GET_DESCRIPTOR not implmented.\n"); - break; - case HUB_REQUEST_GET_STATUS: - USB_ASSERT(buf); - memset(buf, 0, 4); - break; - default: - break; - } - } - else if (setup->bmRequestType & USB_REQUEST_RECIPIENT_OTHER) - { - switch (setup->bRequest) - { - case HUB_REQUEST_CLEAR_FEATURE: - if (!port || port > nports) - { - return -EPIPE; - } - - portsc = readl ( xhci->op + XHCI_OP_PORTSC ( port ) ); - switch (setup->wValue) - { - case HUB_PORT_FEATURE_ENABLE: - break; - case HUB_PORT_FEATURE_SUSPEND: - case HUB_PORT_FEATURE_C_SUSPEND: - break; - case HUB_PORT_FEATURE_POWER: - break; - case HUB_PORT_FEATURE_C_CONNECTION: - portsc |= XHCI_PORTSC_CSC; - break; - case HUB_PORT_FEATURE_C_ENABLE: - portsc |= XHCI_PORTSC_PEC; - break; - case HUB_PORT_FEATURE_C_OVER_CURREN: - break; - case HUB_PORT_FEATURE_C_RESET: - break; - default: - return -EPIPE; - } - - uint32_t pclear = portsc & XHCI_PORTSC_RW_MASK; - /* clear port status */ - writel(pclear, xhci->op + XHCI_OP_PORTSC ( port )); - - break; - case HUB_REQUEST_SET_FEATURE: - if (!port || port > nports) - { - return -EPIPE; - } - - switch (setup->wValue) - { - case HUB_PORT_FEATURE_SUSPEND: - break; - case HUB_PORT_FEATURE_POWER: - break; - case HUB_PORT_FEATURE_RESET: - ret = xhci_port_enable(xhci, port); - break; - default: - return -EPIPE; - } - break; - case HUB_REQUEST_GET_STATUS: - if (!port || port > nports) - { - return -EPIPE; - } - - portsc = readl ( xhci->op + XHCI_OP_PORTSC ( port ) ); - status = 0; - - if (portsc & XHCI_PORTSC_CSC) - { - /* Port connection status changed */ - status |= (1 << HUB_PORT_FEATURE_C_CONNECTION); - - /* always clear all the status change bits */ - uint32_t temp = portsc & ( XHCI_PORTSC_PRESERVE | XHCI_PORTSC_CHANGE ); - writel ( temp, xhci->op + XHCI_OP_PORTSC ( port ) ); - } - - if (portsc & XHCI_PORTSC_PEC) - { - /* Port enabled status changed */ - status |= (1 << HUB_PORT_FEATURE_C_ENABLE); - } - - if (portsc & XHCI_PORTSC_OCC) - { - /* Port status changed due to over-current */ - status |= (1 << HUB_PORT_FEATURE_C_OVER_CURREN); - } - - if (portsc & XHCI_PORTSC_CCS) - { - /* Port connected */ - status |= (1 << HUB_PORT_FEATURE_CONNECTION); - } - - if (portsc & XHCI_PORTSC_PED) - { - /* Port enabled */ - status |= (1 << HUB_PORT_FEATURE_ENABLE); - - const unsigned int speed = xhci_root_speed(xhci, port); - USB_LOG_DBG("Port-%d speed = %d \r\n", port, speed); - if (speed == USB_SPEED_LOW) - { - status |= (1 << HUB_PORT_FEATURE_LOWSPEED); - } - else if (speed == USB_SPEED_HIGH) - { - status |= (1 << HUB_PORT_FEATURE_HIGHSPEED); - } - /* else is full-speed */ - } - - if (portsc & XHCI_PORTSC_OCA) - { - /* Over-current condition */ - status |= (1 << HUB_PORT_FEATURE_OVERCURRENT); - } - - if (portsc & XHCI_PORTSC_PR) - { - /* Reset is in progress */ - status |= (1 << HUB_PORT_FEATURE_RESET); - } - - if (portsc & XHCI_PORTSC_PP) - { - /* Port is not power off */ - status |= (1 << HUB_PORT_FEATURE_POWER); - } - memcpy(buf, &status, 4); - break; - default: - break; - } - } - - return 0; -} - -uint8_t usbh_get_port_speed(struct usbh_hub *hub, const uint8_t port) -{ - USB_ASSERT(hub); - struct usbh_bus *usb = hub->usb; - USB_ASSERT(usb && usb->priv); - struct xhci_host *xhci = usb->priv; - - if (hub->is_roothub) { - return xhci_root_speed(xhci, port); - } else { - struct usbh_hubport *roothub_port = usbh_root_hub_port(&(hub->child[port])); - /* TODO, hanlde TT for low-speed device on high-speed hub, but it doesn't matter, since - we haven't well handle hub yet */ - USB_ASSERT(roothub_port); - return xhci_root_speed(xhci, roothub_port->port); - } -} - -int usbh_ep_pipe_reconfigure(struct usbh_bus *usb, usbh_pipe_t pipe, uint8_t dev_addr, uint8_t mtu, uint8_t speed) -{ - struct xhci_endpoint *ppipe = (struct xhci_endpoint *)pipe; - size_t old_mtu = ppipe->mtu; - int rc = 0; - - if (mtu != old_mtu) { - ppipe->mtu = mtu; - rc = xhci_endpoint_mtu(ppipe); - } - - return rc; -} - -int usbh_pipe_alloc(usbh_pipe_t *pipe, const struct usbh_endpoint_cfg *ep_cfg) -{ - int rc = 0; - int slot_id = 0; - struct xhci_host *xhci = xhci_get_inst_of_port(ep_cfg->hport); - struct usbh_hubport *hport = ep_cfg->hport; - struct xhci_endpoint *ppipe = usb_align(XHCI_RING_SIZE, sizeof(struct xhci_endpoint)); - struct xhci_slot *slot; - - if (NULL == ppipe) { - return -ENOMEM; - } - - memset(ppipe, 0, sizeof(struct xhci_endpoint)); - - ppipe->waitsem = usb_osal_sem_create(0); - ppipe->waiter = false; - ppipe->urb = NULL; - ppipe->hport = hport; - - ppipe->address = ep_cfg->ep_addr; - ppipe->mtu = ep_cfg->ep_mps; - ppipe->interval = ep_cfg->ep_interval; - ppipe->ep_type = ep_cfg->ep_type; - ppipe->burst = 0U; - - if (ppipe->address == 0) { /* if try to allocate ctrl ep, open device first */ - USB_LOG_DBG("allocate device for port-%d \r\n", hport->port); - rc = xhci_device_open(xhci, ppipe, &slot_id); - if (rc) { - goto failed; - } - - slot = xhci->slot[slot_id]; - USB_ASSERT(slot); - rc = xhci_ctrl_endpoint_open(xhci, slot, ppipe); - if (rc) { - goto failed; - } - - rc = xhci_device_address(xhci, slot, ppipe); - if (rc) { - goto failed; - } - } else { - slot_id = hport->dev_addr; - slot = xhci->slot[slot_id]; - - rc = xhci_work_endpoint_open(xhci, slot, ppipe); - if (rc) { - goto failed; - } - } - - *pipe = (usbh_pipe_t)ppipe; - return rc; -failed: - usb_free(ppipe); - *pipe = NULL; - return rc; -} - -int usbh_get_xhci_devaddr(usbh_pipe_t *pipe) -{ - struct xhci_endpoint *ppipe = (struct xhci_endpoint *)pipe; - USB_ASSERT(ppipe && (ppipe->slot)); - return ppipe->slot->id; -} - -int usbh_pipe_free(usbh_pipe_t pipe) -{ - int ret = 0; - struct xhci_endpoint *ppipe = (struct xhci_endpoint *)pipe; - - if (!ppipe) { - return -EINVAL; - } - - struct usbh_urb *urb = ppipe->urb; - if (urb) { - usbh_kill_urb(urb); - } - - size_t flags = usb_osal_enter_critical_section(); - xhci_endpoint_close(ppipe); - usb_osal_leave_critical_section(flags); - return 0; -} - -int usbh_submit_urb(struct usbh_urb *urb) -{ - int ret = 0; - if (!urb || !urb->pipe) { - return -EINVAL; - } - - struct xhci_endpoint *ppipe = (struct xhci_endpoint *)urb->pipe; - struct xhci_host *xhci = ppipe->xhci; - struct usb_setup_packet *setup = urb->setup; - size_t flags = usb_osal_enter_critical_section(); - - urb->errorcode = -EBUSY; - urb->actual_length = 0U; - - ppipe->urb = urb; - ppipe->timeout = urb->timeout; - if (ppipe->timeout > 0) { - ppipe->waiter = true; - } else { - ppipe->waiter = false; - } - - usb_osal_leave_critical_section(flags); - switch (ppipe->ep_type) { - case USB_ENDPOINT_TYPE_CONTROL: - USB_ASSERT(setup); - if (setup->bRequest == USB_REQUEST_SET_ADDRESS) { - /* Set address command sent during xhci_alloc_pipe. */ - goto skip_req; - } - - USB_LOG_DBG("%s request-%d.\n", __func__, setup->bRequest); - xhci_endpoint_message(ppipe, setup, urb->transfer_buffer, urb->transfer_buffer_length); - break; - case USB_ENDPOINT_TYPE_INTERRUPT: - case USB_ENDPOINT_TYPE_BULK: - xhci_endpoint_stream(ppipe, urb->transfer_buffer, urb->transfer_buffer_length); - break; - default: - USB_ASSERT(0U); - break; - } - - /* wait all ring handled by xHc */ - int cc = xhci_event_wait(xhci, ppipe, &ppipe->reqs); - if ((cc != XHCI_CMPLT_SUCCESS) && - !((cc == XHCI_CMPLT_TIMEOUT) && (ppipe->ep_type == USB_ENDPOINT_TYPE_INTERRUPT))) - { - /* ignore transfer timeout for interrupt type */ - USB_LOG_ERR("%s: xfer failed (cc %d).\n", __func__, cc); - ret = -1; - urb->errorcode = cc; - goto errout_timeout; - } - -skip_req: -errout_timeout: - /* Timeout will run here */ - usbh_kill_urb(urb); - return ret; -} - -int usbh_kill_urb(struct usbh_urb *urb) -{ - return 0; -} - -void USBH_IRQHandler(void *param) -{ - USB_ASSERT(param); - struct usbh_bus *bus = (struct usbh_bus *)param; - struct xhci_host *xhci = bus->priv; - USB_ASSERT(xhci); - uint32_t usbsts; - uint32_t runtime; - - /* clear interrupt status */ - usbsts = readl ( xhci->op + XHCI_OP_USBSTS ); - usbsts |= XHCI_USBSTS_EINT; - writel(usbsts, xhci->op + XHCI_OP_USBSTS); - - /* ack interrupt */ - runtime = readl(xhci->run + XHCI_RUN_IR_IMAN ( 0 )); - runtime |= XHCI_RUN_IR_IMAN_IP; - writel (runtime, xhci->run + XHCI_RUN_IR_IMAN ( 0 )); - - (void)xhci_event_process(xhci); -} \ No newline at end of file diff --git a/third-party/cherryusb/port/xhci/xhci.c b/third-party/cherryusb/port/xhci/xhci.c deleted file mode 100644 index ed574db75a9cdc38d9ef1709a28f9c26805ea86d..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/port/xhci/xhci.c +++ /dev/null @@ -1,2564 +0,0 @@ -/* - * Copyright : (C) 2022 Phytium Information Technology, Inc. - * All Rights Reserved. - * - * This program is OPEN SOURCE software: you can redistribute it and/or modify it - * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, - * either version 1.0 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the Phytium Public License for more details. - * - * - * FilePath: xhci.c - * Date: 2022-07-19 09:26:25 - * LastEditTime: 2022-07-19 09:26:25 - * Description:  This file is for xhci functions implmentation. - * - * Modify History: - * Ver   Who        Date         Changes - * ----- ------     --------    -------------------------------------- - * 1.0 zhugengyu 2022/9/19 init commit - * 2.0 zhugengyu 2023/3/29 support usb3.0 device attached at roothub - */ - -#include "usbh_core.h" -#include "usbh_hub.h" - -#include "xhci_reg.h" -#include "xhci.h" - - -/** @file - * - * USB eXtensible Host Controller Interface (xHCI) driver - * - */ - -#define XHCI_DUMP 1 - -/** Define a XHCI speed in PSI - * - * @v mantissa Mantissa - * @v exponent Exponent (in engineering terms: 1=k, 2=M, 3=G) - * @ret speed USB speed - */ -#define XCHI_PSI( mantissa, exponent ) ( (exponent << 16) | (mantissa) ) - -/** USB device speeds */ -enum { - /** Not connected */ - XCHI_PSI_NONE = 0, - /** Low speed (1.5Mbps) */ - XCHI_PSI_LOW = XCHI_PSI ( 1500, 1 ), - /** Full speed (12Mbps) */ - XCHI_PSI_FULL = XCHI_PSI ( 12, 2 ), - /** High speed (480Mbps) */ - XCHI_PSI_HIGH = XCHI_PSI ( 480, 2 ), - /** Super speed (5Gbps) */ - XCHI_PSI_SUPER = XCHI_PSI ( 5, 3 ), -}; - - -/** - * Calculate buffer alignment - * - * @v len Length - * @ret align Buffer alignment - * - * Determine alignment required for a buffer which must be aligned to - * at least XHCI_MIN_ALIGN and which must not cross a page boundary. - */ -static inline size_t xhci_align ( size_t len ) { - size_t align; - - /* Align to own length (rounded up to a power of two) */ - align = ( 1 << fls ( len - 1 ) ); - - /* Round up to XHCI_MIN_ALIGN if needed */ - if ( align < XHCI_MIN_ALIGN ) - align = XHCI_MIN_ALIGN; - - return align; -} - -/** - * Write potentially 64-bit register - * - * @v xhci xHCI device - * @v value Value - * @v reg Register address - * @ret rc Return status code - */ -static inline int xhci_writeq ( struct xhci_host *xhci, uintptr_t value, void *reg ) { - - /* If this is a 32-bit build, then this can never fail - * (allowing the compiler to optimise out the error path). - */ - if ( sizeof ( value ) <= sizeof ( uint32_t ) ) { - writel ( value, reg ); - writel ( 0, ( reg + sizeof ( uint32_t ) ) ); - return 0; - } - - /* If the device does not support 64-bit addresses and this - * address is outside the 32-bit address space, then fail. - */ - if ( ( value & ~0xffffffffULL ) && ! xhci->addr64 ) { - USB_LOG_DBG("XHCI %s cannot access address %lx\n", - xhci->name, value ); - return -ENOTSUP; - } - - /* If this is a 64-bit build, then writeq() is available */ - writeq ( value, reg ); - return 0; -} - -/** - * Initialise device - * - * @v xhci xHCI device - * @v regs MMIO registers - */ -static void xhci_init ( struct xhci_host *xhci, void *regs ) { - uint32_t hcsparams1; - uint32_t hcsparams2; - uint32_t hccparams1; - uint32_t pagesize; - size_t caplength; - size_t rtsoff; - size_t dboff; - - /* Locate capability, operational, runtime, and doorbell registers */ - xhci->cap = regs; - caplength = readb ( xhci->cap + XHCI_CAP_CAPLENGTH ); - rtsoff = readl ( xhci->cap + XHCI_CAP_RTSOFF ); - dboff = readl ( xhci->cap + XHCI_CAP_DBOFF ); - xhci->op = ( xhci->cap + caplength ); - xhci->run = ( xhci->cap + rtsoff ); - xhci->db = ( xhci->cap + dboff ); - - /* avoid access XHCI_REG_CAP_HCIVERSION = 0x2, unaligned memory */ - xhci->version = ((readl ( xhci->cap + XHCI_CAP_CAPLENGTH ) >> 16) & 0xffff); - - USB_LOG_DBG("XHCI %s version %x cap %08lx op %08lx run %08lx db %08lx\n", - xhci->name, xhci->version, ( xhci->cap ), - ( xhci->op ), ( xhci->run ), - ( xhci->db ) ); - - if (xhci->version < 0x96 || xhci->version > 0x120) { - USB_LOG_WRN("XHCI %s not support.\n", xhci->name); - } - - /* Read structural parameters 1 */ - hcsparams1 = readl ( xhci->cap + XHCI_CAP_HCSPARAMS1 ); - xhci->slots = XHCI_HCSPARAMS1_SLOTS ( hcsparams1 ); - xhci->intrs = XHCI_HCSPARAMS1_INTRS ( hcsparams1 ); - xhci->ports = XHCI_HCSPARAMS1_PORTS ( hcsparams1 ); - USB_LOG_DBG("XHCI %s has %d slots %d intrs %d ports\n", - xhci->name, xhci->slots, xhci->intrs, xhci->ports ); - - /* Read structural parameters 2 */ - hcsparams2 = readl ( xhci->cap + XHCI_CAP_HCSPARAMS2 ); - xhci->scratch.count = XHCI_HCSPARAMS2_SCRATCHPADS ( hcsparams2 ); - USB_LOG_DBG("XHCI %s needs %d scratchpads\n", - xhci->name, xhci->scratch.count ); - - /* Read capability parameters 1 */ - hccparams1 = readl ( xhci->cap + XHCI_CAP_HCCPARAMS1 ); - xhci->addr64 = XHCI_HCCPARAMS1_ADDR64 ( hccparams1 ); - xhci->csz_shift = XHCI_HCCPARAMS1_CSZ_SHIFT ( hccparams1 ); - xhci->xecp = (XHCI_HCCPARAMS1_XECP ( hccparams1 )); - USB_LOG_DBG("XHCI %s context %d bit\n", - xhci->name, (xhci->addr64 ? 64 : 32) ); - - /* Read page size */ - pagesize = readl ( xhci->op + XHCI_OP_PAGESIZE ); - xhci->pagesize = XHCI_PAGESIZE ( pagesize ); - USB_ASSERT ( xhci->pagesize != 0 ); - USB_ASSERT ( ( ( xhci->pagesize ) & ( xhci->pagesize - 1 ) ) == 0 ); - USB_LOG_DBG("XHCI %s page size %zd bytes\n", - xhci->name, xhci->pagesize ); -} - -/** - * Find extended capability - * - * @v xhci xHCI device - * @v id Capability ID - * @v offset Offset to previous extended capability instance, or zero - * @ret offset Offset to extended capability, or zero if not found - */ -static unsigned int xhci_extended_capability ( struct xhci_host *xhci, - unsigned int id, - unsigned int offset ) { - uint32_t xecp; - unsigned int next; - - /* Locate the extended capability */ - while ( 1 ) { - - /* Locate first or next capability as applicable */ - if ( offset ) { - xecp = readl ( xhci->cap + offset ); - next = XHCI_XECP_NEXT ( xecp ); - } else { - next = xhci->xecp; - } - if ( ! next ) - return 0; - offset += next; - - /* Check if this is the requested capability */ - xecp = readl ( xhci->cap + offset ); - if ( XHCI_XECP_ID ( xecp ) == id ) - return offset; - } -} - -/** - * Initialise USB legacy support - * - * @v xhci xHCI device - */ -static void xhci_legacy_init ( struct xhci_host *xhci ) { - unsigned int legacy; - uint8_t bios; - - /* Locate USB legacy support capability (if present) */ - legacy = xhci_extended_capability ( xhci, XHCI_XECP_ID_LEGACY, 0 ); - if ( ! legacy ) { - /* Not an error; capability may not be present */ - USB_LOG_DBG("XHCI %s has no USB legacy support capability\n", - xhci->name ); - return; - } - - /* Check if legacy USB support is enabled */ - USB_LOG_DBG("XHCI %s bios offset 0x%x\n", xhci->name, (xhci->cap + legacy + XHCI_USBLEGSUP_BIOS)); - /* bios = readb ( xhci->cap + legacy + XHCI_USBLEGSUP_BIOS ); cannot access offset 0x2, work around */ - bios = readl ( xhci->cap + legacy ); - bios = (bios >> 16) & 0xffff; - if ( ! ( bios & XHCI_USBLEGSUP_BIOS_OWNED ) ) { - /* Not an error; already owned by OS */ - USB_LOG_DBG("XHCI %s USB legacy support already disabled\n", - xhci->name ); - return; - } - - /* Record presence of USB legacy support capability */ - xhci->legacy = legacy; -} - -/** - * Claim ownership from BIOS - * - * @v xhci xHCI device - */ -static void xhci_legacy_claim ( struct xhci_host *xhci ) { - uint32_t ctlsts; - uint8_t bios; - unsigned int i; - - /* Do nothing unless legacy support capability is present */ - if ( ! xhci->legacy ) - return; - - /* Claim ownership */ - writeb ( XHCI_USBLEGSUP_OS_OWNED, - xhci->cap + xhci->legacy + XHCI_USBLEGSUP_OS ); - - /* Wait for BIOS to release ownership */ - for ( i = 0 ; i < XHCI_USBLEGSUP_MAX_WAIT_MS ; i++ ) { - - /* Check if BIOS has released ownership */ - bios = readb ( xhci->cap + xhci->legacy + XHCI_USBLEGSUP_BIOS ); - if ( ! ( bios & XHCI_USBLEGSUP_BIOS_OWNED ) ) { - USB_LOG_DBG("XHCI %s claimed ownership from BIOS\n", - xhci->name ); - ctlsts = readl ( xhci->cap + xhci->legacy + - XHCI_USBLEGSUP_CTLSTS ); - if ( ctlsts ) { - USB_LOG_DBG("XHCI %s warning: BIOS retained " - "SMIs: %08x\n", xhci->name, ctlsts ); - } - return; - } - - /* Delay */ - usb_osal_msleep ( 1 ); - } - - /* BIOS did not release ownership. Claim it forcibly by - * disabling all SMIs. - */ - USB_LOG_DBG("XHCI %s could not claim ownership from BIOS: forcibly " - "disabling SMIs\n", xhci->name ); - writel ( 0, xhci->cap + xhci->legacy + XHCI_USBLEGSUP_CTLSTS ); -} - -/** Prevent the release of ownership back to BIOS */ -static int xhci_legacy_prevent_release; - -/** - * Release ownership back to BIOS - * - * @v xhci xHCI device - */ -static void xhci_legacy_release ( struct xhci_host *xhci ) { - - /* Do nothing unless legacy support capability is present */ - if ( ! xhci->legacy ) - return; - - /* Do nothing if releasing ownership is prevented */ - if ( xhci_legacy_prevent_release ) { - USB_LOG_DBG("XHCI %s not releasing ownership to BIOS\n", - xhci->name ); - return; - } - - /* Release ownership */ - writeb ( 0, xhci->cap + xhci->legacy + XHCI_USBLEGSUP_OS ); - USB_LOG_DBG("XHCI %s released ownership to BIOS\n", xhci->name ); -} - -/** - * Stop xHCI device - * - * @v xhci xHCI device - * @ret rc Return status code - */ -static int xhci_stop ( struct xhci_host *xhci ) { - uint32_t usbcmd; - uint32_t usbsts; - unsigned int i; - - /* Clear run/stop bit */ - usbcmd = readl ( xhci->op + XHCI_OP_USBCMD ); - usbcmd &= ~XHCI_USBCMD_RUN; - writel ( usbcmd, xhci->op + XHCI_OP_USBCMD ); - - /* Wait for device to stop */ - for ( i = 0 ; i < XHCI_STOP_MAX_WAIT_MS ; i++ ) { - - /* Check if device is stopped */ - usbsts = readl ( xhci->op + XHCI_OP_USBSTS ); - if ( usbsts & XHCI_USBSTS_HCH ) - return 0; - - /* Delay */ - usb_osal_msleep ( 1 ); - } - - USB_LOG_DBG("XHCI %s timed out waiting for stop\n", xhci->name ); - return -ETIMEDOUT; -} - -/** - * Reset xHCI device - * - * @v xhci xHCI device - * @ret rc Return status code - */ -static int xhci_reset ( struct xhci_host *xhci ) { - uint32_t usbcmd; - unsigned int i; - int rc; - - /* The xHCI specification states that resetting a running - * device may result in undefined behaviour, so try stopping - * it first. - */ - if ( ( rc = xhci_stop ( xhci ) ) != 0 ) { - /* Ignore errors and attempt to reset the device anyway */ - } - - /* Reset device */ - writel ( XHCI_USBCMD_HCRST, xhci->op + XHCI_OP_USBCMD ); - - /* Wait for reset to complete */ - for ( i = 0 ; i < XHCI_RESET_MAX_WAIT_MS ; i++ ) { - - /* Check if reset is complete */ - usbcmd = readl ( xhci->op + XHCI_OP_USBCMD ); - if ( ! ( usbcmd & XHCI_USBCMD_HCRST ) ) - return 0; - - /* Delay */ - usb_osal_msleep ( 1 ); - } - - USB_LOG_DBG("XHCI %s timed out waiting for reset\n", xhci->name ); - return -ETIMEDOUT; -} - - -/** - * Find supported protocol extended capability for a port - * - * @v xhci xHCI device - * @v port Port number - * @ret supported Offset to extended capability, or zero if not found - */ -static unsigned int xhci_supported_protocol ( struct xhci_host *xhci, - unsigned int port ) { - unsigned int supported = 0; - unsigned int offset; - unsigned int count; - uint32_t ports; - - /* Iterate over all supported protocol structures */ - while ( ( supported = xhci_extended_capability ( xhci, - XHCI_XECP_ID_SUPPORTED, - supported ) ) ) { - - /* Determine port range */ - ports = readl ( xhci->cap + supported + XHCI_SUPPORTED_PORTS ); - offset = XHCI_SUPPORTED_PORTS_OFFSET ( ports ); - count = XHCI_SUPPORTED_PORTS_COUNT ( ports ); - - /* Check if port lies within this range */ - if ( ( port - offset ) < count ) - return supported; - } - - USB_LOG_DBG("XHCI %s Port-%d has no supported protocol\n", - xhci->name, port ); - return 0; -} - -/** - * Transcribe port speed (for debugging) - * - * @v psi Protocol speed ID - * @ret speed Transcribed speed - */ -static inline const char * xhci_speed_name ( uint32_t psi ) { - static const char *exponents[4] = { "", "k", "M", "G" }; - static char buf[ 10 /* "xxxxxXbps" + NUL */ ]; - unsigned int mantissa; - unsigned int exponent; - - /* Extract mantissa and exponent */ - mantissa = XHCI_SUPPORTED_PSI_MANTISSA ( psi ); - exponent = XHCI_SUPPORTED_PSI_EXPONENT ( psi ); - - /* Transcribe speed */ - snprintf ( buf, sizeof ( buf ), "%d%sbps", - mantissa, exponents[exponent] ); - return buf; -} - -/** - * Find port protocol - * - * @v xhci xHCI device - * @v port Port number - * @ret protocol USB protocol, or zero if not found - */ -static unsigned int xhci_port_protocol ( struct xhci_host *xhci, - unsigned int port ) { - unsigned int supported = xhci_supported_protocol ( xhci, port ); - union { - uint32_t raw; - char text[5]; - } name; - unsigned int protocol; - unsigned int type; - unsigned int psic; - unsigned int psiv; - unsigned int i; - uint32_t revision; - uint32_t ports; - uint32_t slot; - uint32_t psi; - - /* Fail if there is no supported protocol */ - if ( ! supported ) - return 0; - - /* Determine protocol version */ - revision = readl ( xhci->cap + supported + XHCI_SUPPORTED_REVISION ); - protocol = XHCI_SUPPORTED_REVISION_VER ( revision ); - - /* Describe port protocol */ -#if XHCI_DUMP - { - name.raw = CPU_TO_LE32 ( readl ( xhci->cap + supported + - XHCI_SUPPORTED_NAME ) ); - name.text[4] = '\0'; - slot = readl ( xhci->cap + supported + XHCI_SUPPORTED_SLOT ); - type = XHCI_SUPPORTED_SLOT_TYPE ( slot ); - USB_LOG_DBG("XHCI %s-%d %sv%04x type %d \r\n", - xhci->name, port, name.text, protocol, type ); - ports = readl ( xhci->cap + supported + XHCI_SUPPORTED_PORTS ); - psic = XHCI_SUPPORTED_PORTS_PSIC ( ports ); - if ( psic ) { - USB_LOG_DBG(" speeds \r\n" ); - for ( i = 0 ; i < psic ; i++ ) { - psi = readl ( xhci->cap + supported + - XHCI_SUPPORTED_PSI ( i ) ); - psiv = XHCI_SUPPORTED_PSI_VALUE ( psi ); - USB_LOG_DBG(" %d:%s \r\n", psiv, xhci_speed_name ( psi ) ); - } - } - } -#endif - - return protocol; -} - -/** - * Probe XCHI device - * - * @v xhci XCHI device - * @v baseaddr XHCI device register base address - * @ret rc Return status code - */ -int xhci_probe ( struct xhci_host *xhci, unsigned long baseaddr ) { - USB_ASSERT(xhci && (xhci->bus)); - int error = 0; - struct usbh_hubport *port; - unsigned int i; - - xhci->base = (void *)baseaddr; - xhci->name[0] = '0' + xhci->bus->id; - xhci->name[1] = '\0'; - - /* Initialise xHCI device */ - xhci_init ( xhci, xhci->base ); - - /* Initialise USB legacy support and claim ownership */ - xhci_legacy_init ( xhci ); - xhci_legacy_claim ( xhci ); - - /* Reset device */ - if ( ( error = xhci_reset ( xhci ) ) != 0 ) - goto err_reset; - - /* Set port protocols */ - for ( i = 1 ; i <= xhci->ports ; i++ ) { - port = usbh_get_roothub_port ( xhci->bus, i ); - port->protocol = xhci_port_protocol ( xhci, i ); - } - - return error; - -err_reset: - xhci_legacy_release ( xhci ); - return -1; -} - -/*********************************************************************/ - -/** - * Allocate device context base address array - * - * @v xhci xHCI device - * @ret rc Return status code - */ -static int xhci_dcbaa_alloc ( struct xhci_host *xhci ) { - size_t len; - uintptr_t dcbaap; - int rc; - - /* Allocate and initialise structure. Must be at least - * 64-byte aligned and must not cross a page boundary, so - * align on its own size (rounded up to a power of two and - * with a minimum of 64 bytes). - */ - len = ( ( xhci->slots + 1 ) * sizeof ( xhci->dcbaa.context[0] ) ); - xhci->dcbaa.context = usb_align(xhci_align ( len ), len); - if ( ! xhci->dcbaa.context ) { - USB_LOG_ERR("XHCI %s could not allocate DCBAA\n", xhci->name ); - rc = -ENOMEM; - goto err_alloc; - } - memset ( xhci->dcbaa.context, 0, len ); - - /* Program DCBAA pointer */ - dcbaap = (uintptr_t)( xhci->dcbaa.context ); - if ( ( rc = xhci_writeq ( xhci, dcbaap, - xhci->op + XHCI_OP_DCBAAP ) ) != 0 ) - goto err_writeq; - - USB_LOG_DBG("XHCI %s DCBAA at [%08lx,%08lx)\n", xhci->name, - ( xhci->dcbaa.context ), - ( ( xhci->dcbaa.context ) + len ) ); - return 0; - - err_writeq: - usb_free ( xhci->dcbaa.context ); - err_alloc: - return rc; -} - - -/** - * Allocate scratchpad buffers - * - * @v xhci xHCI device - * @ret rc Return status code - */ -static int xhci_scratchpad_alloc ( struct xhci_host *xhci ) { - struct xhci_scratchpad *scratch = &xhci->scratch; - size_t buffer_len; - size_t array_len; - uintptr_t addr; - unsigned int i; - int rc; - - /* Do nothing if no scratchpad buffers are used */ - if ( ! scratch->count ) { - USB_LOG_INFO("XHCI %s no need to allocate scratchpad buffers\n", - xhci->name ); - return 0; - } - - /* Allocate scratchpad buffers */ - buffer_len = ( scratch->count * xhci->pagesize ); - scratch->buffer = (uintptr_t)usb_align ( xhci->pagesize, buffer_len ); - if ( ! scratch->buffer ) { - USB_LOG_ERR("XHCI %s could not allocate scratchpad buffers\n", - xhci->name ); - rc = -ENOMEM; - goto err_alloc; - } - memset ( (void *)scratch->buffer, 0, buffer_len ); - - /* Allocate scratchpad array */ - array_len = ( scratch->count * sizeof ( scratch->array[0] ) ); - scratch->array = usb_align(xhci_align ( array_len ), array_len); - if ( ! scratch->array ) { - USB_LOG_ERR("XHCI %s could not allocate scratchpad buffer " - "array\n", xhci->name ); - rc = -ENOMEM; - goto err_alloc_array; - } - - /* Populate scratchpad array */ - addr = ( scratch->buffer + 0 ); - for ( i = 0 ; i < scratch->count ; i++ ) { - scratch->array[i] = CPU_TO_LE64 ( (uintptr_t)addr ); - addr += xhci->pagesize; - } - - /* Set scratchpad array pointer */ - USB_ASSERT ( xhci->dcbaa.context != NULL ); - xhci->dcbaa.context[0] = CPU_TO_LE64 ( ( (uintptr_t)scratch->array ) ); - - USB_LOG_DBG("XHCI %s scratchpad [%08lx,%08lx) array [%08lx,%08lx)\n", - xhci->name, ( scratch->buffer, 0 ), - ( scratch->buffer, buffer_len ), - ( scratch->array ), - ( ( scratch->array ) + array_len ) ); - return 0; - - usb_free ( scratch->array ); - err_alloc_array: - usb_free ( scratch->buffer ); - err_alloc: - return rc; -} - -/** - * Allocate command ring - * - * @v xhci xHCI device - * @ret rc Return status code - */ -static int xhci_command_alloc ( struct xhci_host *xhci ) { - uintptr_t crp; - int rc; - - /* Allocate TRB ring */ - xhci->cmds = usb_align(XHCI_RING_SIZE, sizeof(*xhci->cmds)); /* command ring */ - if (! xhci->cmds) - goto err_ring_alloc; - - memset(xhci->cmds, 0U, sizeof(*xhci->cmds)); - - xhci->cmds->lock = usb_osal_mutex_create(); - USB_ASSERT(xhci->cmds->lock); - - xhci->cmds->cs = 1; /* cycle state = 1 */ - - /* Program command ring control register */ - crp = (uintptr_t)( xhci->cmds ); - if ( ( rc = xhci_writeq ( xhci, ( crp | XHCI_CRCR_RCS ), - xhci->op + XHCI_OP_CRCR ) ) != 0 ) - goto err_writeq; - - USB_LOG_DBG("XHCI %s CRCR at [%08lx,%08lx)\n", xhci->name, - ( xhci->cmds->ring ), - ( ( xhci->cmds->ring ) + sizeof(xhci->cmds->ring) ) ); - return 0; - - err_writeq: - usb_free(xhci->cmds);; - err_ring_alloc: - return rc; -} - -/** - * Allocate event ring - * - * @v xhci xHCI device - * @ret rc Return status code - */ -static int xhci_event_alloc ( struct xhci_host *xhci ) { - unsigned int count; - size_t len; - int rc; - - /* Allocate event ring */ - xhci->evts = usb_align(XHCI_RING_SIZE, sizeof(*xhci->evts)); /* event ring */ - if ( ! xhci->evts ) { - rc = -ENOMEM; - goto err_alloc_trb; - } - - memset(xhci->evts, 0U, sizeof(*xhci->evts)); - - /* Allocate event ring segment table */ - xhci->eseg = usb_align(XHCI_ALIGMENT, sizeof(*xhci->eseg)); /* event segment */ - if ( ! xhci->eseg ) { - rc = -ENOMEM; - goto err_alloc_segment; - } - memset(xhci->eseg, 0U, sizeof(*xhci->eseg)); - xhci->eseg->base = CPU_TO_LE64 ( ( (uintptr_t)xhci->evts ) ); - xhci->eseg->count = XHCI_RING_ITEMS; /* items of event ring TRB */ - - /* Program event ring registers */ - writel ( 1, xhci->run + XHCI_RUN_ERSTSZ ( 0 ) ); /* bit[15:0] event ring segment table size */ - if ( ( rc = xhci_writeq ( xhci, (uintptr_t)( xhci->evts ), - xhci->run + XHCI_RUN_ERDP ( 0 ) ) ) != 0 ) /* bit[63:4] event ring dequeue pointer */ - goto err_writeq_erdp; - if ( ( rc = xhci_writeq ( xhci, (uintptr_t)( xhci->eseg ), - xhci->run + XHCI_RUN_ERSTBA ( 0 ) ) ) != 0 ) /* bit[63:6] event ring segment table base addr */ - goto err_writeq_erstba; - - xhci->evts->cs = 1; /* cycle state = 1 */ - USB_LOG_DBG("XHCI %s event ring [%08lx,%08lx) table [%08lx,%08lx)\n", - xhci->name, ( xhci->evts->ring ), - ( ( xhci->evts->ring ) + sizeof(xhci->evts->ring) ), - ( xhci->eseg ), - ( ( xhci->eseg ) + - sizeof ( xhci->eseg[0] ) ) ); - return 0; - - xhci_writeq ( xhci, 0, xhci->run + XHCI_RUN_ERSTBA ( 0 ) ); - err_writeq_erstba: - xhci_writeq ( xhci, 0, xhci->run + XHCI_RUN_ERDP ( 0 ) ); - err_writeq_erdp: - usb_free ( xhci->eseg ); - err_alloc_segment: - usb_free ( xhci->evts ); - err_alloc_trb: - return rc; -} - -/** - * Start xHCI device - * - * @v xhci xHCI device - */ -static void xhci_run ( struct xhci_host *xhci ) { - uint32_t config; - uint32_t usbcmd; - uint32_t runtime; - - /* Configure number of device slots */ - config = readl ( xhci->op + XHCI_OP_CONFIG ); - config &= ~XHCI_CONFIG_MAX_SLOTS_EN_MASK; - config |= XHCI_CONFIG_MAX_SLOTS_EN ( xhci->slots ); - writel ( config, xhci->op + XHCI_OP_CONFIG ); - - /* Enable port interrupt */ - writel ( 500U, xhci->run + XHCI_RUN_IR_IMOD ( 0 ) ); - runtime = readl(xhci->run + XHCI_RUN_IR_IMAN ( 0 )); - runtime |= XHCI_RUN_IR_IMAN_IE; - writel (runtime, xhci->run + XHCI_RUN_IR_IMAN ( 0 )); - - /* Set run/stop bit and enable interrupt */ - usbcmd = readl ( xhci->op + XHCI_OP_USBCMD ); - usbcmd |= XHCI_USBCMD_RUN | XHCI_USBCMD_INTE; - writel ( usbcmd, xhci->op + XHCI_OP_USBCMD ); - - USB_LOG_DBG("XHCI %s start running\n", xhci->name ); -} - -/** - * Free event ring - * - * @v xhci xHCI device - */ -static void xhci_event_free ( struct xhci_host *xhci ) { - - /* Clear event ring registers */ - writel ( 0, xhci->run + XHCI_RUN_ERSTSZ ( 0 ) ); - xhci_writeq ( xhci, 0, xhci->run + XHCI_RUN_ERSTBA ( 0 ) ); - xhci_writeq ( xhci, 0, xhci->run + XHCI_RUN_ERDP ( 0 ) ); - - /* Free event ring segment table */ - usb_free ( xhci->eseg ); - - /* Free event ring */ - usb_free ( xhci->evts ); -} - -/** - * Free command ring - * - * @v xhci xHCI device - */ -static void xhci_command_free ( struct xhci_host *xhci ) { - - /* Sanity check */ - USB_ASSERT ( ( readl ( xhci->op + XHCI_OP_CRCR ) & XHCI_CRCR_CRR ) == 0 ); - - /* Clear command ring control register */ - xhci_writeq ( xhci, 0, xhci->op + XHCI_OP_CRCR ); - - /* Free TRB ring */ - usb_free ( xhci->cmds ); -} - -/** - * Free scratchpad buffers - * - * @v xhci xHCI device - */ -static void xhci_scratchpad_free ( struct xhci_host *xhci ) { - struct xhci_scratchpad *scratch = &xhci->scratch; - size_t array_len; - size_t buffer_len; - - /* Do nothing if no scratchpad buffers are used */ - if ( ! scratch->count ) - return; - - /* Clear scratchpad array pointer */ - USB_ASSERT ( xhci->dcbaa.context != NULL ); - xhci->dcbaa.context[0] = 0; - - /* Free scratchpad array */ - array_len = ( scratch->count * sizeof ( scratch->array[0] ) ); - usb_free ( scratch->array ); - - /* Free scratchpad buffers */ - buffer_len = ( scratch->count * xhci->pagesize ); - usb_free ( scratch->buffer ); -} - -/** - * Free device context base address array - * - * @v xhci xHCI device - */ -static void xhci_dcbaa_free ( struct xhci_host *xhci ) { - size_t len; - unsigned int i; - - /* Sanity check */ - for ( i = 0 ; i <= xhci->slots ; i++ ) - USB_ASSERT ( xhci->dcbaa.context[i] == 0 ); - - /* Clear DCBAA pointer */ - xhci_writeq ( xhci, 0, xhci->op + XHCI_OP_DCBAAP ); - - /* Free DCBAA */ - len = ( ( xhci->slots + 1 ) * sizeof ( xhci->dcbaa.context[0] ) ); - usb_free ( xhci->dcbaa.context ); -} - -/** - * Open XHCI device - * - * @v xhci XHCI device - * @ret rc Return status code - */ -int xhci_open ( struct xhci_host *xhci ) { - int rc; - - /* Allocate device slot array */ - xhci->slot = usb_malloc ( ( xhci->slots + 1 ) * sizeof ( xhci->slot[0] ) ); - if ( ! xhci->slot ) { - rc = -ENOMEM; - goto err_slot_alloc; - } - - /* Allocate device context base address array */ - if ( ( rc = xhci_dcbaa_alloc ( xhci ) ) != 0 ) - goto err_dcbaa_alloc; - - /* Allocate scratchpad buffers */ - if ( ( rc = xhci_scratchpad_alloc ( xhci ) ) != 0 ) - goto err_scratchpad_alloc; - - /* Allocate command ring */ - if ( ( rc = xhci_command_alloc ( xhci ) ) != 0 ) - goto err_command_alloc; - - /* Allocate event ring */ - if ( ( rc = xhci_event_alloc ( xhci ) ) != 0 ) - goto err_event_alloc; - - /* Start controller */ - xhci_run ( xhci ); - - return 0; - - xhci_stop ( xhci ); - xhci_event_free ( xhci ); - err_event_alloc: - xhci_command_free ( xhci ); - err_command_alloc: - xhci_scratchpad_free ( xhci ); - err_scratchpad_alloc: - xhci_dcbaa_free ( xhci ); - err_dcbaa_alloc: - usb_free ( xhci->slot ); - err_slot_alloc: - return rc; - -} - -/** - * Close XHCI device - * - * @v xhci XHCI Device - */ -void xhci_close ( struct xhci_host *xhci ) { - unsigned int i; - - /* Sanity checks */ - USB_ASSERT ( xhci->slot != NULL ); - for ( i = 0 ; i <= xhci->slots ; i++ ) - USB_ASSERT ( xhci->slot[i] == NULL ); - - xhci_stop ( xhci ); - usb_free (xhci->evts); - usb_free (xhci->eseg); - usb_free (xhci->cmds); - xhci_scratchpad_free ( xhci ); - xhci_dcbaa_free ( xhci ); - usb_free ( xhci->slot ); -} - -/** - * Remove XHCI device - * - * @v xhci XHCI device - */ -void xhci_remove ( struct xhci_host *xhci ) { - xhci_reset ( xhci ); - xhci_legacy_release ( xhci ); - usb_free ( xhci ); - - /* If we are shutting down to boot an OS, then prevent the - * release of ownership back to BIOS. - */ - xhci_legacy_prevent_release = 0; -} - -/*********************************************************************/ - -/** - * Enable port - * - * @v xhci XHCI device - * @v port Port number - * @ret rc Return status code - */ -int xhci_port_enable(struct xhci_host *xhci, uint32_t port) { - uint32_t portsc = readl ( xhci->op + XHCI_OP_PORTSC ( port ) ); - - /* double check if connected */ - if (!(portsc & XHCI_PORTSC_CCS)) { - USB_LOG_ERR("device connectiong lost !!! \r\n"); - return -ENOENT; - } - - switch ( portsc & XHCI_PORTSC_PLS_MASK ) - { - case XHCI_PORTSC_PLS_U0: - /* A USB3 port - controller automatically performs reset */ - break; - case XHCI_PORTSC_PLS_POLLING: - /* A USB2 port - perform device reset */ - xhci_dump_port_status(port, portsc); - writel ((portsc | XHCI_PORTSC_PR), (xhci->op + XHCI_OP_PORTSC ( port ))); /* reset port */ - break; - default: - USB_LOG_ERR("PLS: %d \r\n", (portsc & XHCI_PORTSC_PLS_MASK)); - return -ENOENT; - } - - /* Wait for device to complete reset and be enabled */ - uint32_t end = 1000U, start = 0U; - for (;;) { - portsc = readl ( xhci->op + XHCI_OP_PORTSC ( port ) ); - if (!(portsc & XHCI_PORTSC_CCS)) { - /* USB 2.0 port would be disconnected after reset */ - USB_LOG_INFO("USB 2.0 port disconnected during reset, need rescan \r\n"); - return 0; - } - - if (portsc & XHCI_PORTSC_PED) { /* check if port enabled */ - /* Reset complete */ - break; - } - - if (++start > end) { - USB_LOG_ERR("Wait timeout, portsc=0x%x !!!\n", portsc); - return -ENXIO; - } - - usb_osal_msleep(1); - } - - xhci_dump_port_status(port, portsc); - return 0; -} - -/** - * Convert USB Speed to PSI - * - * @v speed USB speed - * @ret psi USB speed in PSI - */ -static unsigned int xhci_speed_to_psi(int speed) { - unsigned int psi = USB_SPEED_UNKNOWN; - - switch (speed) { - case USB_SPEED_LOW: - psi = XCHI_PSI_LOW; - break; - case USB_SPEED_FULL: - psi = XCHI_PSI_FULL; - break; - case USB_SPEED_HIGH: - psi = XCHI_PSI_HIGH; - break; - case USB_SPEED_SUPER: - psi = XCHI_PSI_SUPER; - break; - } - - return psi; -} - -/** - * Convert USB PSI to Speed - * - * @v psi USB speed in PSI - * @ret speed USB speed - */ -static int xhci_psi_to_speed(int psi) { - int speed = USB_SPEED_UNKNOWN; - - switch (psi) { - case XCHI_PSI_LOW: - speed = USB_SPEED_LOW; - break; - case XCHI_PSI_FULL: - speed = USB_SPEED_FULL; - break; - case XCHI_PSI_HIGH: - speed = USB_SPEED_HIGH; - break; - case XCHI_PSI_SUPER: - speed = USB_SPEED_SUPER; - break; - } - - return speed; -} - -/** - * Find port speed - * - * @v xhci xHCI device - * @v port Port number - * @v psiv Protocol speed ID value - * @ret speed Port speed, or negative error - */ -static int xhci_port_speed ( struct xhci_host *xhci, unsigned int port, - unsigned int psiv ) { - unsigned int supported = xhci_supported_protocol ( xhci, port ); - unsigned int psic; - unsigned int mantissa; - unsigned int exponent; - unsigned int speed; - unsigned int i; - uint32_t ports; - uint32_t psi; - - /* Fail if there is no supported protocol */ - if ( ! supported ) - return -ENOTSUP; - - /* Get protocol speed ID count */ - ports = readl ( xhci->cap + supported + XHCI_SUPPORTED_PORTS ); - psic = XHCI_SUPPORTED_PORTS_PSIC ( ports ); - - /* Use protocol speed ID table unless device is known to be faulty */ - /* Iterate over PSI dwords looking for a match */ - for ( i = 0 ; i < psic ; i++ ) { - psi = readl ( xhci->cap + supported + - XHCI_SUPPORTED_PSI ( i ) ); - if ( psiv == XHCI_SUPPORTED_PSI_VALUE ( psi ) ) { - mantissa = XHCI_SUPPORTED_PSI_MANTISSA ( psi ); - exponent = XHCI_SUPPORTED_PSI_EXPONENT ( psi ); - return xhci_psi_to_speed(XCHI_PSI ( mantissa, exponent )); - } - } - - /* Record device as faulty if no match is found */ - if ( psic != 0 ) { - USB_LOG_ERR("XHCI %s-%d spurious PSI value %d: " - "assuming PSI table is invalid\n", - xhci->name, port, psiv ); - } - - /* Use the default mappings */ - switch ( psiv ) { - case XHCI_SPEED_LOW : return USB_SPEED_LOW; - case XHCI_SPEED_FULL : return USB_SPEED_FULL; - case XHCI_SPEED_HIGH : return USB_SPEED_HIGH; - case XHCI_SPEED_SUPER : return USB_SPEED_SUPER; - default: - USB_LOG_ERR("XHCI %s-%d unrecognised PSI value %d\n", - xhci->name, port, psiv ); - return -ENOTSUP; - } -} - -/** - * Find protocol speed ID value - * - * @v xhci xHCI device - * @v port Port number - * @v speed USB speed - * @ret psiv Protocol speed ID value, or negative error - */ -static int xhci_port_psiv ( struct xhci_host *xhci, unsigned int port, - unsigned int speed ) { - unsigned int supported = xhci_supported_protocol ( xhci, port ); - unsigned int psic; - unsigned int mantissa; - unsigned int exponent; - unsigned int psiv; - unsigned int i; - uint32_t ports; - uint32_t psi; - - /* Fail if there is no supported protocol */ - if ( ! supported ) - return -ENOTSUP; - - /* Get protocol speed ID count */ - ports = readl ( xhci->cap + supported + XHCI_SUPPORTED_PORTS ); - psic = XHCI_SUPPORTED_PORTS_PSIC ( ports ); - - /* Use the default mappings if applicable */ - if ( psic == 0 ) { - switch ( speed ) { - case USB_SPEED_LOW : return XHCI_SPEED_LOW; - case USB_SPEED_FULL : return XHCI_SPEED_FULL; - case USB_SPEED_HIGH : return XHCI_SPEED_HIGH; - case USB_SPEED_SUPER : return XHCI_SPEED_SUPER; - default: - USB_LOG_DBG("XHCI %s-%d non-standard speed %d\n", - xhci->name, port, speed ); - return -ENOTSUP; - } - } - - /* Iterate over PSI dwords looking for a match */ - for ( i = 0 ; i < psic ; i++ ) { - psi = readl ( xhci->cap + supported + XHCI_SUPPORTED_PSI ( i )); - mantissa = XHCI_SUPPORTED_PSI_MANTISSA ( psi ); - exponent = XHCI_SUPPORTED_PSI_EXPONENT ( psi ); - if ( xhci_speed_to_psi(speed) == XCHI_PSI ( mantissa, exponent ) ) { - psiv = XHCI_SUPPORTED_PSI_VALUE ( psi ); - return psiv; - } - } - - USB_LOG_DBG("XHCI %s-%d unrepresentable speed %#x\n", - xhci->name, port, speed ); - return -ENOENT; -} - -/** - * Update root hub port speed - * - * @v xhci XHCI device - * @v port Port number - * @ret rc Return status code (speed) - */ -uint32_t xhci_root_speed ( struct xhci_host *xhci, uint8_t port ) { - uint32_t portsc; - unsigned int psiv; - int ccs; - int ped; - int csc; - int speed; - unsigned int protocol = xhci_port_protocol(xhci, port); - - /* Read port status */ - portsc = readl ( xhci->op + XHCI_OP_PORTSC ( port ) ); - USB_LOG_DBG("XHCI %s-%d status is 0x%08x, protocol 0x%x\n", - xhci->name, port, portsc, protocol ); - ccs = ( portsc & XHCI_PORTSC_CCS ); - ped = ( portsc & XHCI_PORTSC_PED ); - csc = ( portsc & XHCI_PORTSC_CSC ); - psiv = XHCI_PORTSC_PSIV ( portsc ); - - USB_LOG_DBG("XHCI %s port-%d ccs: %d, ped: %d, csc: %d, psiv: 0x%x\n", - xhci->name, port, !!ccs, !!ped, !!csc, psiv); - - /* Port speed is not valid unless port is connected */ - if ( ! ccs ) { - speed = USB_SPEED_UNKNOWN; - USB_LOG_ERR("XHCI %s port-%d speed unkown\n", xhci->name, port); - return speed; - } - - /* For USB2 ports, the PSIV field is not valid until the port - * completes reset and becomes enabled. - */ - if ( ( protocol < USB_3_0 ) && ! ped ) { - speed = USB_SPEED_FULL; - return speed; - } - - /* Get port speed and map to generic USB speed */ - speed = xhci_port_speed ( xhci, port, psiv ); - if ( speed < 0 ) { - return speed; - } - - return speed; -} - -/*********************************************************************/ -/** - * Add a TRB to the given ring - * - * @v ring XHCI TRB ring - * @v trb TRB content to be added - */ -static inline void xhci_trb_fill(struct xhci_ring *ring, union xhci_trb *trb) { - union xhci_trb *dst = &ring->ring[ring->nidx]; - memcpy((void *)dst, (void *)trb, sizeof(*trb)); - dst->template.control |= (ring->cs ? XHCI_TRB_C : 0); - xhci_dump_trbs(dst, 1); -} - -/** - * Queue a TRB onto a ring, wrapping ring as needed - * - * @v ring XHCI TRB ring - * @v trb TRB content to be added - */ -static void xhci_trb_queue(struct xhci_ring *ring, union xhci_trb *trb) { - - if (ring->nidx >= XHCI_RING_ITEMS - 1) { - /* if it is the last trb in the list, put a link trb in the end */ - union xhci_trb link_trb; - link_trb.link.type = XHCI_TRB_LINK; - link_trb.link.flags = XHCI_TRB_TC; - link_trb.link.next = CPU_TO_LE64(((uintptr_t)ring->ring)); - - xhci_trb_fill(ring, &link_trb); - - ring->nidx = 0; /* adjust dequeue index to 0 */ - ring->cs ^= 1; /* toggle cycle interpretation of sw */ - } - - xhci_trb_fill(ring, trb); - ring->nidx++; /* ahead dequeue index */ -} - -/** - * Wait for a ring to empty (all TRBs processed by hardware) - * - * @v xhci XHCI Device - * @v ep Owner Endpoint of current TRB ring - * @ ring XHCI TRB ring - */ -int xhci_event_wait(struct xhci_host *xhci, - struct xhci_endpoint *ep, - struct xhci_ring *ring) { - int cc = XHCI_CMPLT_SUCCESS; - - if (ep->timeout > 0) - { - if (usb_osal_sem_take(ep->waitsem, ep->timeout) < 0) - { - cc = XHCI_CMPLT_TIMEOUT; - } - else - { - cc = ring->evt.complete.code; /* bit[31:24] completion code */ - } - } - - return cc; -} - -/** - * Ring doorbell register - * - * @v xhci XHCI device - * @v slotid Slot id to ring - * @v value Value send to doorbell - */ -static inline void xhci_doorbell ( struct xhci_host *xhci, uint32_t slotid, uint32_t value ) { - - DSB(); - writel ( value, xhci->db + slotid * XHCI_REG_DB_SIZE ); /* bit[7:0] db target, is ep_id */ -} - -/** - * Abort command - * - * @v xhci xHCI device - */ -static void xhci_abort ( struct xhci_host *xhci ) { - uintptr_t crp; - - /* Abort the command */ - USB_LOG_WRN("XHCI %s aborting command\n", xhci->name ); - xhci_writeq ( xhci, XHCI_CRCR_CA, xhci->op + XHCI_OP_CRCR ); - - /* Allow time for command to abort */ - usb_osal_msleep ( XHCI_COMMAND_ABORT_DELAY_MS ); - - /* Sanity check */ - USB_ASSERT ( ( readl ( xhci->op + XHCI_OP_CRCR ) & XHCI_CRCR_CRR ) == 0 ); - - /* Consume (and ignore) any final command status */ - int cc = xhci_event_wait(xhci, xhci->cur_cmd_pipe, xhci->cmds); - if (XHCI_CMPLT_SUCCESS != cc) { - USB_LOG_ERR("XHCI %s abort command failed, cc %d\n", xhci->name, cc); - } - - /* Reset the command ring control register */ - memset(xhci->cmds->ring, 0U, XHCI_RING_ITEMS * sizeof(union xhci_trb)); - xhci_writeq ( xhci, ( (uint64_t)(uintptr_t)xhci->cmds | xhci->cmds->cs ), xhci->op + XHCI_OP_CRCR ); -} - -/** - * Submit a command to the xhci controller ring - * - * @v xhci XHCI Device - * @v ep Owner Endpoint of current TRB ring - * @ trb Command TRB to be sent - */ -static int xhci_cmd_submit(struct xhci_host *xhci, struct xhci_endpoint *ep, union xhci_trb *trb) { - - int rc = 0; - usb_osal_mutex_take(xhci->cmds->lock); /* handle command one by one */ - - ep->timeout = 5000; - ep->waiter = true; - xhci->cur_cmd_pipe = ep; - - xhci_trb_queue(xhci->cmds, trb); - - /* pass command trb to hardware */ - DSB(); - - xhci_doorbell(xhci, 0, 0); /* 0 = db host controller, 0 = db targe hc command */ - int cc = xhci_event_wait(xhci, ep, xhci->cmds); - if (XHCI_CMPLT_SUCCESS != cc) { - USB_LOG_ERR("XHCI %s cmd failed, cc %d\n", xhci->name, cc); - xhci_abort(xhci); /* Abort command */ - rc = -ENOTSUP; - } - - usb_osal_mutex_give(xhci->cmds->lock); - xhci->cur_cmd_pipe = NULL; - return rc; -} - -/** - * Issue NOP and wait for completion - * - * @v xhci xHCI device - * @v ep Command Endpoint - * @ret rc Return status code - */ -static int xhci_nop ( struct xhci_host *xhci, struct xhci_endpoint *ep ) { - union xhci_trb trb; - struct xhci_trb_common *nop = &trb.common; - int rc; - - /* Construct command */ - memset ( nop, 0, sizeof ( *nop ) ); - nop->flags = XHCI_TRB_IOC; - nop->type = XHCI_TRB_NOP_CMD; - - /* Issue command and wait for completion */ - if ( ( rc = xhci_cmd_submit(xhci, ep, &trb ) ) != 0 ) - return rc; - - return 0; -} - -/** - * Issue Enable slot and wait for completion - * - * @v xhci xHCI device - * @v ep Command Endpoint - * @v type Type of Slot to be enabled - * @ret rc Return status code - */ -static int xhci_enable_slot(struct xhci_host *xhci, struct xhci_endpoint *ep, unsigned int type) { - union xhci_trb trb; - struct xhci_trb_enable_slot *enable = &trb.enable; - struct xhci_trb_complete *enabled; - unsigned int slot; - int rc; - - /* Construct command */ - memset ( enable, 0, sizeof ( *enable ) ); - enable->slot = type; - enable->type = XHCI_TRB_ENABLE_SLOT; - - /* Issue command and Wait for completion */ - if ( ( rc = xhci_cmd_submit(xhci, ep, &trb) ) != 0 ) { - USB_LOG_ERR("XHCI %s could not enable new slot, type %d\n", - xhci->name, type ); - return rc; - } - - /* Extract slot number */ - enabled = &(xhci->cmds->evt.complete); - slot = enabled->slot; - - USB_LOG_DBG("XHCI %s slot %d enabled\n", xhci->name, slot ); - return slot; -} - -/** - * Disable slot - * - * @v xhci xHCI device - * @v ep Command Endpoint - * @v slot Device slot - * @ret rc Return status code - */ -static int xhci_disable_slot ( struct xhci_host *xhci, struct xhci_endpoint *ep, - unsigned int slot ) { - union xhci_trb trb; - struct xhci_trb_disable_slot *disable = &trb.disable; - int rc; - - /* Construct command */ - memset ( disable, 0, sizeof ( *disable ) ); - disable->type = XHCI_TRB_DISABLE_SLOT; - disable->slot = slot; - - /* Issue command and wait for completion */ - if ( ( rc = xhci_cmd_submit ( xhci, ep, &trb ) ) != 0 ) { - USB_LOG_DBG("XHCI %s could not disable slot %d: %s\n", - xhci->name, slot, strerror ( rc ) ); - return rc; - } - - USB_LOG_DBG("XHCI %s slot %d disabled\n", xhci->name, slot ); - return 0; -} - -/** - * Issue context-based command and wait for completion - * - * @v xhci xHCI device - * @v slot Device slot - * @v endpoint Endpoint - * @v type TRB type - * @v populate Input context populater - * @ret rc Return status code - */ -static int xhci_context ( struct xhci_host *xhci, struct xhci_slot *slot, - struct xhci_endpoint *ep, unsigned int type, - void ( * populate ) ( struct xhci_host *xhci, - struct xhci_slot *slot, - struct xhci_endpoint *ep, - void *input ) ) { - union xhci_trb trb; - struct xhci_trb_context *context = &trb.context; - size_t len; - void *input; - int rc; - - /* Allocate an input context */ - len = xhci_input_context_offset ( xhci, XHCI_CTX_END ); - input = usb_align(xhci_align ( len ), len); - if ( ! input ) { - rc = -ENOMEM; - goto err_alloc; - } - memset ( input, 0, len ); - - /* Populate input context */ - populate ( xhci, slot, ep, input ); - - /* Construct command */ - memset ( context, 0, sizeof ( *context ) ); - context->type = type; - context->input = CPU_TO_LE64 ( ( (uintptr_t)input ) ); - context->slot = slot->id; - - /* Issue command and wait for completion */ - if ( ( rc = xhci_cmd_submit ( xhci, ep, &trb ) ) != 0 ) { - xhci_dump_input_ctx(xhci, ep, input); - goto err_command; - } - - err_command: - usb_free ( input ); - err_alloc: - return rc; -} - -/** - * Populate address device input context - * - * @v xhci xHCI device - * @v slot Device slot - * @v endpoint Endpoint - * @v input Input context - */ -static void xhci_address_device_input ( struct xhci_host *xhci, - struct xhci_slot *slot, - struct xhci_endpoint *endpoint, - void *input ) { - struct xhci_control_context *control_ctx; - struct xhci_slot_context *slot_ctx; - struct xhci_endpoint_context *ep_ctx; - - /* Sanity checks */ - USB_ASSERT ( endpoint->ctx == XHCI_CTX_EP0 ); - - /* Populate control context, add slot context and ep context */ - control_ctx = input; - control_ctx->add = CPU_TO_LE32 ( ( 1 << XHCI_CTX_SLOT ) | - ( 1 << XHCI_CTX_EP0 ) ); - - /* Populate slot context */ - slot_ctx = ( input + xhci_input_context_offset ( xhci, XHCI_CTX_SLOT )); - slot_ctx->info = CPU_TO_LE32 ( XHCI_SLOT_INFO ( 1, 0, slot->psiv, - slot->route ) ); - slot_ctx->port = slot->port; - slot_ctx->tt_id = slot->tt_id; - slot_ctx->tt_port = slot->tt_port; - - /* Populate control endpoint context */ - ep_ctx = ( input + xhci_input_context_offset ( xhci, XHCI_CTX_EP0 ) ); - ep_ctx->type = XHCI_EP_TYPE_CONTROL; /* bit[5:3] endpoint type */ - ep_ctx->burst = endpoint->burst; /* bit[16:8] max burst size */ - ep_ctx->mtu = CPU_TO_LE16 ( endpoint->mtu ); /* bit[31:16] max packet size */ - - /* - bit[63:4] tr dequeue pointer - bit[0] dequeue cycle state - */ - ep_ctx->dequeue = CPU_TO_LE64 ( (uint64_t)( (uintptr_t)&endpoint->reqs.ring[0] ) | XHCI_EP_DCS ); - ep_ctx->trb_len = CPU_TO_LE16 ( XHCI_EP0_TRB_LEN ); /* bit[15:0] average trb length */ -} - -/** - * Address device - * - * @v xhci xHCI device - * @v endpoint Endpoint - * @v slot Device slot - * @ret rc Return status code - */ -static inline int xhci_address_device ( struct xhci_host *xhci, - struct xhci_endpoint *ep, - struct xhci_slot *slot ) { - struct xhci_slot_context *slot_ctx; - int rc; - - /* Assign device address */ - if ( ( rc = xhci_context ( xhci, slot, slot->endpoint[XHCI_CTX_EP0], - XHCI_TRB_ADDRESS_DEVICE, - xhci_address_device_input ) ) != 0 ) - - USB_LOG_DBG("XHCI %s slot ctx 0x%x\n", xhci->name, slot->context); - - /* Get assigned address for check */ - slot_ctx = ( slot->context + - xhci_device_context_offset ( xhci, XHCI_CTX_SLOT ) ); - USB_LOG_DBG("XHCI %s slot ctx 0x%x assigned address 0x%x\n", - xhci->name, slot_ctx, slot_ctx->address ); - - return rc; -} - -/** - * Reset endpoint - * - * @v xhci xHCI device - * @v slot Device slot - * @v endpoint Endpoint - * @ret rc Return status code - */ -int xhci_reset_endpoint ( struct xhci_host *xhci, - struct xhci_slot *slot, - struct xhci_endpoint *endpoint ) { - union xhci_trb trb; - struct xhci_trb_reset_endpoint *reset = &trb.reset; - int rc; - - /* Construct command */ - memset ( reset, 0, sizeof ( *reset ) ); - reset->slot = slot->id; - reset->endpoint = endpoint->ctx; - reset->type = XHCI_TRB_RESET_ENDPOINT; - - /* Issue command and wait for completion */ - if ( ( rc = xhci_cmd_submit ( xhci, endpoint, &trb ) ) != 0 ) { - USB_LOG_DBG("XHCI %s slot %d ctx %d could not reset endpoint " - "in state %d: %s\n", xhci->name, slot->id, endpoint->ctx, - endpoint->context->state, strerror ( rc ) ); - return rc; - } - - return 0; -} - -/** - * Stop endpoint - * - * @v xhci xHCI device - * @v slot Device slot - * @v endpoint Endpoint - * @ret rc Return status code - */ -static inline int xhci_stop_endpoint ( struct xhci_host *xhci, - struct xhci_slot *slot, - struct xhci_endpoint *endpoint ) { - union xhci_trb trb; - struct xhci_trb_stop_endpoint *stop = &trb.stop; - int rc; - - /* Construct command */ - memset ( stop, 0, sizeof ( *stop ) ); - stop->slot = slot->id; - stop->endpoint = endpoint->ctx; - stop->type = XHCI_TRB_STOP_ENDPOINT; - - /* Issue command and wait for completion */ - if ( ( rc = xhci_cmd_submit ( xhci, endpoint, &trb ) ) != 0 ) { - USB_LOG_DBG("XHCI %s slot %d ctx %d could not stop endpoint " - "in state %d: %s\n", xhci->name, slot->id, endpoint->ctx, - endpoint->context->state, strerror ( rc ) ); - return rc; - } - - return 0; -} - -/*********************************************************************/ - -/** - * Find port slot type - * - * @v xhci xHCI device - * @v port Port number - * @ret type Slot type, or negative error - */ -static int xhci_port_slot_type ( struct xhci_host *xhci, unsigned int port ) { - unsigned int supported = xhci_supported_protocol ( xhci, port ); - unsigned int type; - uint32_t slot; - - /* Fail if there is no supported protocol */ - if ( ! supported ) - return -ENOTSUP; - - /* Get slot type */ - slot = readl ( xhci->cap + supported + XHCI_SUPPORTED_SLOT ); - type = XHCI_SUPPORTED_SLOT_TYPE ( slot ); - - return type; -} - -/** - * Open device - * - * @v xhci XHCI device - * @v ep Endpoint - * @ret slot_id Return device slot id - * @ret rc Return status code - */ -int xhci_device_open ( struct xhci_host *xhci, struct xhci_endpoint *ep, int *slot_id ) { - struct usbh_hubport *hport = ep->hport; - struct usbh_hubport *tt = usbh_transaction_translator(hport); - struct xhci_slot *slot; - struct xhci_slot *tt_slot; - int type; - int rc; - int id; - size_t len; - - /* Determine applicable slot type */ - type = xhci_port_slot_type ( xhci, hport->port ); - if ( type < 0 ) { - rc = type; - USB_LOG_ERR("XHCI %s-%d has no slot type\n", - xhci->name, hport->port ); - goto err_type; - } - - /* Allocate a device slot number */ - id = xhci_enable_slot ( xhci, ep, type ); - if ( id < 0 ) { - rc = id; - goto err_enable_slot; - } - - USB_ASSERT ( ( id > 0 ) && ( ( unsigned int ) id <= xhci->slots ) ); - USB_ASSERT ( xhci->slot[id] == NULL ); - - /* Allocate and initialise structure */ - slot = usb_malloc ( sizeof ( *slot ) ); - if ( ! slot ) { - rc = -ENOMEM; - goto err_alloc; - } - slot->id = id; - xhci->slot[id] = slot; - slot->xhci = xhci; - if ( tt ) { - tt_slot = xhci->slot[tt->dev_addr]; - slot->tt_id = tt_slot->id; - slot->tt_port = tt->port; - } - - /* Allocate a device context */ - len = xhci_device_context_offset ( xhci, XHCI_CTX_END ); - slot->context = usb_align(xhci_align ( len ), len); - if ( ! slot->context ) { - rc = -ENOMEM; - goto err_alloc_context; - } - memset ( slot->context, 0, len ); - - /* Set device context base address */ - USB_ASSERT ( xhci->dcbaa.context[id] == 0 ); - xhci->dcbaa.context[id] = CPU_TO_LE64 ( ( (uintptr_t)slot->context ) ); - - USB_LOG_DBG("XHCI %s slot %d device context [%08lx,%08lx)\n", - xhci->name, slot->id, ( slot->context ), - ( ( slot->context ) + len ) ); - *slot_id = id; - return 0; - - xhci->dcbaa.context[id] = 0; - usb_free ( slot->context ); - -err_alloc_context: - xhci->slot[id] = NULL; - usb_free ( slot ); -err_alloc: - xhci_disable_slot ( xhci, ep, id ); -err_enable_slot: -err_type: - return rc; -} - -/*********************************************************************/ - -/** - * Assign device address - * - * @v xhci XHCI device - * @v slot Slot - * @v ep Endpoint - * @ret rc Return status code - */ -int xhci_device_address ( struct xhci_host *xhci, struct xhci_slot *slot, struct xhci_endpoint *ep ) { - USB_ASSERT((slot->xhci) && (ep->hport)); - struct usbh_hubport *hport = ep->hport; - int psiv; - int rc; - - /* Calculate route string */ - slot->route = usbh_route_string (hport); - - /* Calculate root hub port number */ - struct usbh_hubport *root_port = usbh_root_hub_port (hport); - slot->port = root_port->port; - - /* Calculate protocol speed ID */ - psiv = xhci_port_psiv ( xhci, slot->port, hport->speed ); - if ( psiv < 0 ) { - rc = psiv; - return rc; - } - slot->psiv = psiv; - - /* Address device */ - if ( ( rc = xhci_address_device ( xhci, ep, slot ) ) != 0 ) - return rc; - - return 0; -} - - -/** - * Close device - * - * @v slot Slot - */ -void xhci_device_close ( struct xhci_slot *slot ) { - struct xhci_host *xhci = slot->xhci; - size_t len = xhci_device_context_offset ( xhci, XHCI_CTX_END ); - unsigned int id = slot->id; - int rc; - - /* Disable slot */ - if ( ( rc = xhci_disable_slot ( xhci, slot->endpoint[0], id ) ) != 0 ) { - /* Slot is still enabled. Leak the slot context, - * since the controller may still write to this - * memory, and leave the DCBAA entry intact. - * - * If the controller later reports that this same slot - * has been re-enabled, then some assertions will be - * triggered. - */ - USB_LOG_DBG("XHCI %s slot %d leaking context memory\n", - xhci->name, slot->id ); - slot->context = NULL; - } - - /* Free slot */ - if ( slot->context ) { - usb_free ( slot->context ); - xhci->dcbaa.context[id] = 0; - } - xhci->slot[id] = NULL; - usb_free ( slot ); -} - - -/** - * Populate configure endpoint input context - * - * @v xhci xHCI device - * @v slot Device slot - * @v endpoint Endpoint - * @v input Input context - */ -static void xhci_configure_endpoint_input ( struct xhci_host *xhci, - struct xhci_slot *slot, - struct xhci_endpoint *endpoint, - void *input ) { - struct xhci_control_context *control_ctx; - struct xhci_slot_context *slot_ctx; - struct xhci_endpoint_context *ep_ctx; - - xhci_dump_endpoint(endpoint); - - /* Populate control context */ - control_ctx = input; - control_ctx->add = CPU_TO_LE32 (( 1 << XHCI_CTX_SLOT ) | ( 1 << endpoint->ctx ) ); - control_ctx->drop = CPU_TO_LE32 (( 1 << XHCI_CTX_SLOT ) | ( 1 << endpoint->ctx ) ); - - /* Populate slot context */ - slot_ctx = ( input + xhci_input_context_offset ( xhci, XHCI_CTX_SLOT )); - slot_ctx->info = CPU_TO_LE32 ( XHCI_SLOT_INFO ( ( XHCI_CTX_END - 1 ), - ( slot->ports ? 1 : 0 ), - slot->psiv, 0 ) ); - slot_ctx->ports = slot->ports; - - /* Populate endpoint context */ - ep_ctx = ( input + xhci_input_context_offset ( xhci, endpoint->ctx ) ); - ep_ctx->interval = endpoint->interval; /* bit[23:16] for interrupt ep, set interval to control interrupt period */ - /* - Value Endpoint Type Direction - 0 Not Valid N/A - 1 Isoch Out - 2 Bulk Out - 3 Interrupt Out - 4 Control Bidirectional - 5 Isoch In - 6 Bulk In - 7 Interrupt In - */ - ep_ctx->type = endpoint->ctx_type; - ep_ctx->burst = endpoint->burst; - ep_ctx->mtu = CPU_TO_LE16 ( endpoint->mtu ); /* bit[31:16] max packet size */ - ep_ctx->dequeue = CPU_TO_LE64 ( (uint64_t)( (uintptr_t)&(endpoint->reqs.ring[0]) ) | XHCI_EP_DCS ); - - /* TODO: endpoint attached on hub may need different setting here */ - if (endpoint->ep_type == USB_ENDPOINT_TYPE_BULK) { - ep_ctx->trb_len = CPU_TO_LE16 ( 256U ); /* bit[15:0] average trb length */ - } else if (endpoint->ep_type == USB_ENDPOINT_TYPE_INTERRUPT) { - ep_ctx->trb_len = CPU_TO_LE16 (16U); - ep_ctx->esit_low = CPU_TO_LE16 ( endpoint->mtu ); /* bit[31:16] max ESIT payload */ - } - - xhci_dump_input_ctx(xhci, endpoint, input); -} - -/** - * Configure endpoint - * - * @v xhci xHCI device - * @v slot Device slot - * @v endpoint Endpoint - * @ret rc Return status code - */ -static inline int xhci_configure_endpoint ( struct xhci_host *xhci, - struct xhci_slot *slot, - struct xhci_endpoint *endpoint ){ - int rc; - - /* Configure endpoint */ - if ( ( rc = xhci_context ( xhci, slot, endpoint, - XHCI_TRB_CONFIGURE_ENDPOINT, - xhci_configure_endpoint_input ) ) != 0 ){ - USB_LOG_ERR("XHCI %s slot %d ctx %d configure failed, error %d !!!\n", - xhci->name, slot->id, endpoint->ctx, rc ); - return rc; - } - - /* Sanity check */ - if ( ( endpoint->context->state & XHCI_ENDPOINT_STATE_MASK ) - != XHCI_ENDPOINT_RUNNING ){ - xhci_dump_slot_ctx(endpoint->slot->context); - xhci_dump_ep_ctx(endpoint->context); - USB_LOG_ERR("XHCI %s slot %d ctx %d configure failed !!!\n", - xhci->name, slot->id, endpoint->ctx ); - return -1; - } - - USB_LOG_DBG("XHCI %s slot %d ctx %d configured\n", - xhci->name, slot->id, endpoint->ctx ); - return 0; -} - -/** - * Populate deconfigure endpoint input context - * - * @v xhci xHCI device - * @v slot Device slot - * @v endpoint Endpoint - * @v input Input context - */ -static void -xhci_deconfigure_endpoint_input ( struct xhci_host *xhci __unused, - struct xhci_slot *slot __unused, - struct xhci_endpoint *endpoint, - void *input ) { - struct xhci_control_context *control_ctx; - struct xhci_slot_context *slot_ctx; - - /* Populate control context */ - control_ctx = input; - control_ctx->add = CPU_TO_LE32 ( 1 << XHCI_CTX_SLOT ); - control_ctx->drop = CPU_TO_LE32 ( 1 << endpoint->ctx ); - - /* Populate slot context */ - slot_ctx = ( input + xhci_input_context_offset ( xhci, XHCI_CTX_SLOT )); - slot_ctx->info = CPU_TO_LE32 ( XHCI_SLOT_INFO ( ( XHCI_CTX_END - 1 ), - 0, 0, 0 ) ); -} - -/** - * Deconfigure endpoint - * - * @v xhci xHCI device - * @v slot Device slot - * @v endpoint Endpoint - * @ret rc Return status code - */ -static inline int xhci_deconfigure_endpoint ( struct xhci_host *xhci, - struct xhci_slot *slot, - struct xhci_endpoint *endpoint ) { - int rc; - - /* Deconfigure endpoint */ - if ( ( rc = xhci_context ( xhci, slot, endpoint, - XHCI_TRB_CONFIGURE_ENDPOINT, - xhci_deconfigure_endpoint_input ) ) != 0 ) - return rc; - - USB_LOG_DBG("XHCI %s slot %d ctx %d deconfigured\n", - xhci->name, slot->id, endpoint->ctx ); - return 0; -} - -/*********************************************************************/ - -/** - * Open control endpoint - * - * @v xhci XHCI device - * @v slot Slot - * @v ep Endpoint - * @ret rc Return status code - */ -int xhci_ctrl_endpoint_open ( struct xhci_host *xhci, struct xhci_slot *slot, struct xhci_endpoint *ep ) { - unsigned int ctx; - - /* Calculate context index */ - ctx = XHCI_CTX ( ep->address ); - USB_ASSERT ( slot->endpoint[ctx] == NULL ); - - if (USB_ENDPOINT_TYPE_CONTROL != ep->ep_type) { - return -EINVAL; - } - - /* initialise structure */ - slot->endpoint[ctx] = ep; - ep->xhci = xhci; - ep->slot = slot; - ep->ctx = ctx; - ep->ctx_type = XHCI_EP_TYPE_CONTROL; - ep->context = ( ( ( void * ) slot->context ) + - xhci_device_context_offset ( xhci, ctx ) ); - ep->reqs.cs = 1; /* cycle state = 1 */ - - USB_LOG_DBG("XHCI %s slot %d endpoint 0x%x ep type %d xhci ep type 0x%x\n", - xhci->name, slot->id, ep->address, ep->ep_type, - (ep->ctx_type >> 3) ); - - USB_LOG_DBG("XHCI %s slot %d ctx %d ring [%08lx,%08lx)\n", - xhci->name, slot->id, ctx, ( ep->reqs.ring ), - ( ( ep->reqs.ring ) + sizeof(ep->reqs.ring) ) ); - - return 0; -} - -/*********************************************************************/ - -/** - * Open work endpoint - * - * @v xhci XHCI device - * @v slot Slot - * @v ep USB endpoint - * @ret rc Return status code - */ -int xhci_work_endpoint_open ( struct xhci_host *xhci, struct xhci_slot *slot, struct xhci_endpoint *ep ) { - unsigned int ctx; - unsigned int interval; - unsigned int ctx_type; - int rc; - - /* Calculate context index */ - ctx = XHCI_CTX ( ep->address ); - USB_ASSERT ( slot->endpoint[ctx] == NULL ); - - if (USB_ENDPOINT_TYPE_CONTROL == ep->ep_type) { - return -EINVAL; - } - - /* Calculate endpoint type */ - /* - Value Endpoint Type Direction, bit[5:3] - 0 Not Valid N/A - 1 Isoch Out - 2 Bulk Out - 3 Interrupt Out - 4 Control Bidirectional - 5 Isoch In - 6 Bulk In - 7 Interrupt In - */ - ctx_type = XHCI_EP_TYPE ( ep->ep_type ); - if ( ep->address & USB_EP_DIR_IN ) - ctx_type |= XHCI_EP_TYPE_IN; - - /* initialise structure */ - slot->endpoint[ctx] = ep; - ep->xhci = xhci; - ep->slot = slot; - ep->ctx = ctx; - - /* Calculate interval */ - if ( ctx_type & XHCI_EP_TYPE_PERIODIC ) { - ep->interval = ( fls ( ep->interval ) - 1 ); - } - - ep->ctx_type = ctx_type; - ep->context = ( ( ( void * ) slot->context ) + - xhci_device_context_offset ( xhci, ctx ) ); - ep->reqs.cs = 1; /* cycle state = 1 */ - - USB_LOG_DBG("XHCI %s slot %d endpoint 0x%x ep type %d xhci ep type 0x%x\n", - xhci->name, slot->id, ep->address, ep->ep_type, - (ep->ctx_type >> 3) ); - - /* Configure endpoint */ - if (( rc = xhci_configure_endpoint ( xhci, slot, ep ) ) != 0) { - goto err_configure_endpoint; - } - - USB_LOG_DBG("XHCI %s slot %d ctx %d ring [%08lx,%08lx)\n", - xhci->name, slot->id, ctx, ( ep->reqs.ring ), - ( ( ep->reqs.ring ) + sizeof(ep->reqs.ring) ) ); - - return 0; - err_configure_endpoint: - (void)xhci_deconfigure_endpoint ( xhci, slot, ep ); - slot->endpoint[ctx] = NULL; - return rc; -} - -/** - * Close endpoint - * - * @v ep USB endpoint - */ -void xhci_endpoint_close ( struct xhci_endpoint *ep ) { - struct xhci_slot *slot = ep->slot; - struct xhci_host *xhci = slot->xhci; - unsigned int ctx = ep->ctx; - - /* Deconfigure endpoint, if applicable */ - if ( ctx != XHCI_CTX_EP0 ) - (void)xhci_deconfigure_endpoint ( xhci, slot, ep ); - - slot->endpoint[ctx] = NULL; - usb_free(ep); -} - -/*********************************************************************/ - -/** - * Enqueue message transfer - * - * @v ep USB endpoint - * @v packet Setup packet buffer - * @v data_buff Data buffer - * @v datalen Data length - * @ret rc Return status code - */ -void xhci_endpoint_message ( struct xhci_endpoint *ep, - struct usb_setup_packet *packet, - void *data_buff, - int datalen ) { - struct xhci_host *xhci = ep->xhci; - struct xhci_slot *slot = ep->slot; - union xhci_trb trb; - struct xhci_trb_setup *setup; - struct xhci_trb_data *data; - struct xhci_trb_status *status; - unsigned int input; - - /* Construct setup stage TRB */ - setup = &(trb.setup); - memset ( setup, 0, sizeof ( *setup ) ); - - memcpy ( &setup->packet, packet, sizeof ( setup->packet ) ); - setup->len = CPU_TO_LE32 ( sizeof ( *packet ) ); /* bit[16:0] trb transfer length, always 8 */ - setup->flags = XHCI_TRB_IDT; /* bit[6] Immediate Data (IDT), parameters take effect */ - setup->type = XHCI_TRB_SETUP; /* bit[15:10] trb type */ - input = ( packet->bmRequestType & CPU_TO_LE16 ( USB_REQUEST_DIR_IN ) ); - if (datalen > 0) { - /* bit[17:16] Transfer type, 2 = OUT Data, 3 = IN Data */ - setup->direction = ( input ? XHCI_SETUP_IN : XHCI_SETUP_OUT ); - } - - xhci_trb_queue(&(ep->reqs), &trb); - - /* Construct data stage TRB, if applicable */ - if (datalen > 0) { - data = &(trb.data); - memset ( data, 0, sizeof ( *data ) ); - - data->data = CPU_TO_LE64 ( (uintptr_t)data_buff ); - data->len = CPU_TO_LE32 ( datalen ); - data->type = XHCI_TRB_DATA; /* bit[15:10] trb type */ - data->direction = ( input ? XHCI_DATA_IN : XHCI_DATA_OUT ); /* bit[16] Direction, 0 = OUT, 1 = IN */ - - xhci_trb_queue(&(ep->reqs), &trb); - } - - status = &(trb.status); - memset ( status, 0, sizeof ( *status ) ); - status->flags = XHCI_TRB_IOC; - status->type = XHCI_TRB_STATUS; - status->direction = - ( ( datalen && input ) ? XHCI_STATUS_OUT : XHCI_STATUS_IN ); - - xhci_trb_queue(&(ep->reqs), &trb); - - /* pass command trb to hardware */ - DSB(); - - USB_LOG_DBG("ring doorbell slot-%d ep-%d \r\n", slot->id, ep->ctx); - xhci_doorbell(xhci, slot->id, ep->ctx); /* 0 = db host controller, 0 = db targe hc command */ - - return; -} - -/*********************************************************************/ - -/** - * Enqueue stream transfer - * - * @v ep USB endpoint - * @v data_buff Data buffer - * @v datalen Data length - * @ret rc Return status code - */ -void xhci_endpoint_stream ( struct xhci_endpoint *ep, - void *data_buff, - int datalen ) { - struct xhci_host *xhci = ep->xhci; - struct xhci_slot *slot = ep->slot; - union xhci_trb trbs; - union xhci_trb *trb = &trbs; - struct xhci_trb_normal *normal; - int trb_len; - - /* Calculate TRB length */ - trb_len = XHCI_MTU; - if ( trb_len > datalen ) { - trb_len = datalen; - } else { - USB_LOG_ERR("transfer length %d exceed MTU %d \r\n", datalen, trb_len); - goto err_enqueue; - } - - /* Construct normal TRBs */ - normal = &trb->normal; - memset ( normal, 0, sizeof ( *normal ) ); - normal->data = CPU_TO_LE64 ( (uintptr_t)data_buff ); - normal->len = CPU_TO_LE32 ( trb_len ); - normal->type = XHCI_TRB_NORMAL; - normal->flags = XHCI_TRB_IOC; - - xhci_trb_queue(&(ep->reqs), trb); - - /* pass command trb to hardware */ - DSB(); - - xhci_doorbell(xhci, slot->id, ep->ctx); - -err_enqueue: - return; -} - -/*********************************************************************/ - -/** - * Populate evaluate context input context - * - * @v xhci xHCI device - * @v slot Device slot - * @v endpoint Endpoint - * @v input Input context - */ -static void xhci_evaluate_context_input ( struct xhci_host *xhci, - struct xhci_slot *slot __unused, - struct xhci_endpoint *endpoint, - void *input ) { - struct xhci_control_context *control_ctx; - struct xhci_slot_context *slot_ctx; - struct xhci_endpoint_context *ep_ctx; - - /* Populate control context */ - control_ctx = input; - control_ctx->add = CPU_TO_LE32 ( ( 1 << XHCI_CTX_SLOT ) /*| - ( 1 << endpoint->ctx )*/ ); - control_ctx->drop = CPU_TO_LE32 ( ( 1 << XHCI_CTX_SLOT ) /* | - ( 1 << endpoint->ctx )*/ ); - - /* Populate slot context */ - slot_ctx = ( input + xhci_input_context_offset ( xhci, XHCI_CTX_SLOT )); - slot_ctx->info = CPU_TO_LE32 ( XHCI_SLOT_INFO ( ( XHCI_CTX_END - 1 ), - 0, 0, 0 ) ); - - /* Populate endpoint context */ - ep_ctx = ( input + xhci_input_context_offset ( xhci, endpoint->ctx ) ); - ep_ctx->mtu = CPU_TO_LE16 ( endpoint->mtu ); -} - -/** - * Evaluate context - * - * @v xhci xHCI device - * @v slot Device slot - * @v endpoint Endpoint - * @ret rc Return status code - */ -static inline int xhci_evaluate_context ( struct xhci_host *xhci, - struct xhci_slot *slot, - struct xhci_endpoint *endpoint ) { - int rc; - - /* Configure endpoint */ - if ( ( rc = xhci_context ( xhci, slot, endpoint, - XHCI_TRB_EVALUATE_CONTEXT, - xhci_evaluate_context_input ) ) != 0 ) - return rc; - - USB_LOG_DBG("XHCI %s slot %d ctx %d (re-)evaluated\n", - xhci->name, slot->id, endpoint->ctx ); - return 0; -} - -/** - * Update MTU - * - * @v ep USB endpoint - * @ret rc Return status code - */ -int xhci_endpoint_mtu ( struct xhci_endpoint *ep ) { - struct xhci_endpoint *endpoint = ( ep ); - struct xhci_slot *slot = endpoint->slot; - struct xhci_host *xhci = slot->xhci; - int rc; - - /* Evalulate context */ - if ( ( rc = xhci_evaluate_context ( xhci, slot, endpoint ) ) != 0 ) - return rc; - - return 0; -} - -/*********************************************************************/ - -/** - * Handle port status event - * - * @v xhci xHCI device - * @v trb Port status event - */ -static void xhci_port_status ( struct xhci_host *xhci, - struct xhci_trb_port_status *trb ) { - struct usbh_bus *bus = xhci->bus; - USB_ASSERT(bus); - - uint32_t portsc; - - /* Sanity check */ - USB_ASSERT ( ( trb->port > 0 ) && ( trb->port <= xhci->ports ) ); - - /* Record disconnections, changes flag will be cleared later */ - portsc = readl ( xhci->op + XHCI_OP_PORTSC ( trb->port ) ); - xhci_dump_port_status(trb->port, portsc); - - if (portsc & XHCI_PORTSC_CSC) { - /* Report port status change */ - usbh_roothub_thread_wakeup ( bus->id, trb->port ); - } -} - -/** - * Handle transfer event - * - * @v xhci xHCI device - * @v trb Transfer event TRB - */ -static void xhci_transfer ( struct xhci_host *xhci, - struct xhci_trb_transfer *trb ) { - struct xhci_slot *slot; - struct xhci_endpoint *endpoint; - union xhci_trb *trans_trb = (void *)(uintptr_t)(trb->transfer); - struct xhci_ring *trans_ring = XHCI_RING(trans_trb); /* to align addr is ring base */ - union xhci_trb *pending = &trans_ring->evt; /* preserve event trb pending to handle */ - uint32_t eidx = trans_trb - trans_ring->ring + 1; /* calculate current evt trb index */ - int rc; - - /* Identify slot */ - if ( ( trb->slot > xhci->slots ) || - ( ( slot = xhci->slot[trb->slot] ) == NULL ) ) { - USB_LOG_DBG("XHCI %s transfer event invalid slot %d:\n", - xhci->name, trb->slot ); - return; - } - - /* Identify endpoint */ - if ( ( trb->endpoint >= XHCI_CTX_END ) || - ( ( endpoint = slot->endpoint[trb->endpoint] ) == NULL ) ) { - USB_LOG_DBG("XHCI %s slot %d transfer event invalid epid " - "%d:\n", xhci->name, slot->id, trb->endpoint ); - return; - } - - /* Record completion */ - memcpy(pending, trb, sizeof(*trb)); /* copy current trb to cmd/transfer ring */ - trans_ring->eidx = eidx; - - /* Check for errors */ - if ( ! ( ( trb->code == XHCI_CMPLT_SUCCESS ) || - ( trb->code == XHCI_CMPLT_SHORT ) ) ) { - USB_LOG_ERR("XHCI %s slot %d ctx %d failed (code %d)\n", - xhci->name, slot->id, endpoint->ctx, trb->code); - - /* Sanity check */ - USB_ASSERT ( ( endpoint->context->state & XHCI_ENDPOINT_STATE_MASK ) - != XHCI_ENDPOINT_RUNNING ); - - xhci_dump_ep_ctx(endpoint->context); - return; - } - - if (endpoint->waiter) { - endpoint->waiter = false; - usb_osal_sem_give(endpoint->waitsem); - } - - if (endpoint->urb) { - struct usbh_urb *cur_urb = endpoint->urb; - cur_urb->errorcode = trb->code; - /* bit [23:0] TRB Transfer length, residual number of bytes not transferred - for OUT, is the value of (len of trb) - (data bytes transmitted), '0' means successful - for IN, is the value of (len of trb) - (data bytes received), - if cc is Short Packet, value is the diff between expected trans size and actual recv bytes - if cc is other error, value is the diff between expected trans size and actual recv bytes */ - cur_urb->actual_length += cur_urb->transfer_buffer_length - trb->residual; /* bit [23:0] */ - - if (cur_urb->complete) { - if (cur_urb->errorcode < 0) { - cur_urb->complete(cur_urb->arg, cur_urb->errorcode); - } else { - cur_urb->complete(cur_urb->arg, cur_urb->actual_length); - } - } - } - - return; -} - -/** - * Handle command completion event - * - * @v xhci xHCI device - * @v trb Command completion event - */ -static void xhci_complete ( struct xhci_host *xhci, - struct xhci_trb_complete *trb ) { - int rc; - union xhci_trb *cmd_trb = (void *)(uintptr_t)(trb->command); - struct xhci_ring *cmd_ring = XHCI_RING(cmd_trb); /* to align addr is ring base */ - union xhci_trb *pending = &cmd_ring->evt; /* preserve event trb pending to handle */ - uint32_t eidx = cmd_trb - cmd_ring->ring + 1; /* calculate current evt trb index */ - struct xhci_endpoint *work_pipe = xhci->cur_cmd_pipe; - - /* Ignore "command ring stopped" notifications */ - if ( trb->code == XHCI_CMPLT_CMD_STOPPED ) { - USB_LOG_DBG("XHCI %s command ring stopped\n", xhci->name ); - return; - } - - /* Record completion */ - USB_LOG_DBG("command-0x%x completed !!! \r\n", pending); - memcpy(pending, trb, sizeof(*trb)); /* copy current trb to cmd/transfer ring */ - cmd_ring->eidx = eidx; - - USB_ASSERT(work_pipe); - if (work_pipe->waiter) - { - work_pipe->waiter = false; - usb_osal_sem_give(work_pipe->waitsem); - } -} - -/** - * Handle host controller event - * - * @v xhci xHCI device - * @v trb Host controller event - */ -static void xhci_host_controller ( struct xhci_host *xhci, - struct xhci_trb_host_controller *trb ) { - int rc; - - /* Construct error */ - rc = -( trb->code ); - USB_LOG_ERR("XHCI %s host controller event (code %d)\n", - xhci->name, trb->code ); -} - -/** - * Process event ring in interrupt - * - * @v xhci xHCI device - */ -void xhci_event_process(struct xhci_host *xhci) { - struct xhci_ring *evts = xhci->evts; - unsigned int evt_type; - uint32_t nidx; - uint32_t cs; - union xhci_trb *trb; - uint32_t control; - uint64_t erdp; - - /* check and ack event */ - for (;;) { - /* Stop if we reach an empty TRB */ - DSB(); - - nidx = evts->nidx; /* index of dequeue trb */ - cs = evts->cs; /* cycle state toggle by xHc */ - trb = evts->ring + nidx; /* current trb */ - control = trb->common.flags; /* trb control field */ - - if ((control & XHCI_TRB_C) != (cs ? 1 : 0)) { /* if cycle state not toggle, no events need to handle */ - break; - } - - /* Handle TRB */ - evt_type = ( trb->common.type & XHCI_TRB_TYPE_MASK ); - switch ( evt_type ) { - - case XHCI_TRB_TRANSFER : - xhci_transfer ( xhci, &trb->transfer ); - break; - - case XHCI_TRB_COMPLETE : - xhci_complete ( xhci, &trb->complete ); - break; - - case XHCI_TRB_PORT_STATUS: - xhci_port_status ( xhci, &trb->port ); - break; - - case XHCI_TRB_HOST_CONTROLLER: - xhci_host_controller ( xhci, &trb->host ); - break; - - default: - USB_LOG_DBG("XHCI %s unrecognised event type %d\n:", - xhci->name, ( evt_type ) ); - break; - } - - /* move ring index, notify xhci */ - nidx++; /* head to next trb */ - if (nidx == XHCI_RING_ITEMS) - { - nidx = 0; /* roll-back if reach end of list */ - cs = cs ? 0 : 1; - evts->cs = cs; /* sw toggle cycle state */ - } - evts->nidx = nidx; - - /* Update dequeue pointer if applicable */ - erdp = (uint64_t)(unsigned long)(evts->ring + nidx); - xhci_writeq ( xhci, (uintptr_t)( erdp ) | XHCI_RUN_ERDP_EHB, - xhci->run + XHCI_RUN_ERDP ( 0 ) ); - } - - return; -} \ No newline at end of file diff --git a/third-party/cherryusb/port/xhci/xhci.h b/third-party/cherryusb/port/xhci/xhci.h deleted file mode 100644 index eb94ee14dd1f9f5b098eca2b88b949ba266b2abf..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/port/xhci/xhci.h +++ /dev/null @@ -1,940 +0,0 @@ -/* - * Copyright : (C) 2022 Phytium Information Technology, Inc. - * All Rights Reserved. - * - * This program is OPEN SOURCE software: you can redistribute it and/or modify it - * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, - * either version 1.0 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the Phytium Public License for more details. - * - * - * FilePath: xhci.h - * Date: 2022-07-19 09:26:25 - * LastEditTime: 2022-07-19 09:26:25 - * Description:  This file is for xhci register definition. - * - * Modify History: - * Ver   Who        Date         Changes - * ----- ------     --------    -------------------------------------- - * 1.0 zhugengyu 2022/9/19 init commit - * 2.0 zhugengyu 2023/3/29 support usb3.0 device attached at roothub - */ -#ifndef XHCI_H -#define XHCI_H - -#include "xhci_reg.h" - -#include "usbh_core.h" - -/** @file - * - * USB eXtensible Host Controller Interface (xHCI) driver - * - */ - -#define XHCI_RING_ITEMS 16U -#define XHCI_ALIGMENT 64U -#define XHCI_RING_SIZE (XHCI_RING_ITEMS * sizeof(union xhci_trb)) - -/* - * xhci_ring structs are allocated with XHCI_RING_SIZE alignment, - * then we can get it from a trb pointer (provided by evt ring). - */ -#define XHCI_RING(_trb) \ - ((struct xhci_ring*)((unsigned long)(_trb) & ~(XHCI_RING_SIZE-1))) - -/** Device context base address array */ -struct xhci_dcbaa { - /** Context base addresses */ - uint64_t *context; -}; - -/** Scratchpad buffer */ -struct xhci_scratchpad { - /** Number of page-sized scratchpad buffers */ - unsigned int count; - /** Scratchpad buffer area */ - uintptr_t buffer; - /** Scratchpad array */ - uint64_t *array; -}; - -/** An input control context */ -struct xhci_control_context { - /** Drop context flags */ - uint32_t drop; - /** Add context flags */ - uint32_t add; - /** Reserved */ - uint32_t reserved_a[5]; - /** Configuration value */ - uint8_t config; - /** Interface number */ - uint8_t intf; - /** Alternate setting */ - uint8_t alt; - /** Reserved */ - uint8_t reserved_b; -} __attribute__ (( packed )); - -/** A slot context */ -struct xhci_slot_context { - /** Device info 03-00h */ - uint32_t info; - /** Maximum exit latency */ - uint16_t latency; - /** Root hub port number */ - uint8_t port; - /** Number of downstream ports 07-04h */ - uint8_t ports; - /** TT hub slot ID */ - uint8_t tt_id; - /** TT port number */ - uint8_t tt_port; - /** Interrupter target 0b-08h */ - uint16_t intr; - /** USB address */ - uint8_t address; - /** Reserved */ - uint16_t reserved_a; - /** Slot state 0f-0ch */ - uint8_t state; - /** Reserved */ - uint32_t reserved_b[4]; -} __attribute__ (( packed )); - -/** Construct slot context device info */ -#define XHCI_SLOT_INFO( entries, hub, speed, route ) \ - ( ( (entries) << 27 ) | ( (hub) << 26 ) | ( (speed) << 20 ) | (route) ) - -/** An endpoint context */ -struct xhci_endpoint_context { - /** Endpoint state 03-00h*/ - uint8_t state; - /** Stream configuration */ - uint8_t stream; -#define XHCI_EPCTX_MULT_GET(stream) XHCI32_GET_BITS(stream, 1, 0) -#define XHCI_EPCTX_STREAM_GET(stream) XHCI32_GET_BITS(stream, 6, 2) -#define XHCI_EPCTX_LSA BIT(7) - /** Polling interval */ - uint8_t interval; - /** Max ESIT payload high */ - uint8_t esit_high; - /** Endpoint type 04-04h */ - uint8_t type; -#define XHCI_EPCTX_CERR_GET(type) XHCI32_GET_BITS(type, 2, 1) -#define XHCI_EPCTX_TYPE_GET(type) XHCI32_GET_BITS(type, 5, 3) -#define XHCI_EPCTX_HID BIT(7) - /** Maximum burst size */ - uint8_t burst; - /** Maximum packet size */ - uint16_t mtu; - /** Transfer ring dequeue pointer 0f-08h */ - uint64_t dequeue; -#define XHCI_EPCTX_DCS BIT(0) - /** Average TRB length 13-10h */ - uint16_t trb_len; - /** Max ESIT payload low */ - uint16_t esit_low; - /** Reserved */ - uint32_t reserved[3]; -} __attribute__ (( packed )); - -/** Endpoint states */ -enum { - /** Endpoint is disabled */ - XHCI_ENDPOINT_DISABLED = 0, - /** Endpoint is running */ - XHCI_ENDPOINT_RUNNING = 1, - /** Endpoint is halted due to a USB Halt condition */ - XHCI_ENDPOINT_HALTED = 2, - /** Endpoint is stopped */ - XHCI_ENDPOINT_STOPPED = 3, - /** Endpoint is halted due to a TRB error */ - XHCI_ENDPOINT_ERROR = 4, -}; - -/** Endpoint state mask */ -#define XHCI_ENDPOINT_STATE_MASK 0x07 - -/** Endpoint type */ -#define XHCI_EP_TYPE(type) ( (type) << 3 ) - -/** Control endpoint type */ -#define XHCI_EP_TYPE_CONTROL XHCI_EP_TYPE ( 4 ) - -/** Input endpoint type */ -#define XHCI_EP_TYPE_IN XHCI_EP_TYPE ( 4 ) - -/** Periodic endpoint type */ -#define XHCI_EP_TYPE_PERIODIC XHCI_EP_TYPE ( 1 ) - -/** Endpoint dequeue cycle state */ -#define XHCI_EP_DCS 0x00000001UL - -/** Control endpoint average TRB length */ -#define XHCI_EP0_TRB_LEN 8 - -/** - * Calculate doorbell register value - * - * @v target Doorbell target - * @v stream Doorbell stream ID - * @ret dbval Doorbell register value - */ -#define XHCI_DBVAL( target, stream ) ( (target) | ( (stream) << 16 ) ) - - -/** Slot context index */ -#define XHCI_CTX_SLOT 0 - -/** Calculate context index from USB endpoint address */ -/* refer to spec. Figure 4-4: Endpoint Context Addressing - ep0 = 1, ep1-out = 2, ep1-in = 3, ... ep15-out = 30, ep15-in = 31 */ -#define XHCI_CTX(address) \ - ( (address) ? ( ( ( (address) & 0x0f ) << 1 ) | \ - ( ( (address) & 0x80 ) >> 7 ) ) : 1 ) - -/** Endpoint zero context index */ -#define XHCI_CTX_EP0 XHCI_CTX ( 0x00 ) - -/** End of contexts */ -#define XHCI_CTX_END 32 - -/** Device context index */ -#define XHCI_DCI(ctx) ( (ctx) + 0 ) - -/** Input context index */ -#define XHCI_ICI(ctx) ( (ctx) + 1 ) - -/** Number of TRBs (excluding Link TRB) in the command ring - * - * This is a policy decision. - */ -#define XHCI_CMD_TRBS_LOG2 2 - -/** Number of TRBs in the event ring - * - * This is a policy decision. - */ -#define XHCI_EVENT_TRBS_LOG2 6 - -/** Number of TRBs in a transfer ring - * - * This is a policy decision. - */ -#define XHCI_TRANSFER_TRBS_LOG2 6 - -/** Maximum time to wait for BIOS to release ownership - * - * This is a policy decision. - */ -#define XHCI_USBLEGSUP_MAX_WAIT_MS 100 - -/** Maximum time to wait for host controller to stop - * - * This is a policy decision. - */ -#define XHCI_STOP_MAX_WAIT_MS 100 - -/** Maximum time to wait for reset to complete - * - * This is a policy decision. - */ -#define XHCI_RESET_MAX_WAIT_MS 500 - -/** Maximum time to wait for a command to complete - * - * The "address device" command involves waiting for a response to a - * USB control transaction, and so we must wait for up to the 5000ms - * that USB allows for devices to respond to control transactions. - */ -#define XHCI_COMMAND_MAX_WAIT_MS 5000 - -/** Time to delay after aborting a command - * - * This is a policy decision - */ -#define XHCI_COMMAND_ABORT_DELAY_MS 500 - -/** Maximum time to wait for a port reset to complete - * - * This is a policy decision. - */ -#define XHCI_PORT_RESET_MAX_WAIT_MS 500 - -/** A transfer request block template */ -struct xhci_trb_template { - /** Parameter */ - uint64_t parameter; - /** Status */ - uint32_t status; - /** Control */ - uint32_t control; -}; - -/** A transfer request block */ -struct xhci_trb_common { - /** Reserved */ - uint64_t reserved_a; - /** Reserved */ - uint32_t reserved_b; - /** Flags */ - uint8_t flags; - /** Type */ - uint8_t type; - /** Reserved */ - uint16_t reserved_c; -} __attribute__ (( packed )); - -/** Transfer request block cycle bit flag */ -#define XHCI_TRB_C 0x01 - -/** Transfer request block toggle cycle bit flag */ -#define XHCI_TRB_TC 0x02 - -/** Transfer request block chain flag */ -#define XHCI_TRB_CH 0x10 - -/** Transfer request block interrupt on completion flag */ -#define XHCI_TRB_IOC 0x20 - -/** Transfer request block immediate data flag */ -#define XHCI_TRB_IDT 0x40 - -/** Transfer request block type */ -#define XHCI_TRB_TYPE(type) ( (type) << 2 ) - -/** Transfer request block type mask */ -#define XHCI_TRB_TYPE_MASK XHCI_TRB_TYPE ( 0x3f ) - -/** A normal transfer request block */ -struct xhci_trb_normal { - /** Data buffer */ - uint64_t data; - /** Length */ - uint32_t len; - /** Flags */ - uint8_t flags; - /** Type */ - uint8_t type; - /** Reserved */ - uint16_t reserved; -} __attribute__ (( packed )); - -/** A normal transfer request block */ -#define XHCI_TRB_NORMAL XHCI_TRB_TYPE ( 1 ) - -/** Construct TD size field */ -#define XHCI_TD_SIZE(remaining) \ - ( ( ( (remaining) <= 0xf ) ? remaining : 0xf ) << 17 ) - -/** A setup stage transfer request block */ -struct xhci_trb_setup { - /** Setup packet, 04-00h sw will copy request content to this field */ - struct usb_setup_packet packet; - /** Length 08h */ - uint32_t len; - /** Flags 0ch */ - uint8_t flags; - /** Type */ - uint8_t type; - /** Transfer direction */ - uint8_t direction; - /** Reserved */ - uint8_t reserved; -} __attribute__ (( packed )); - -/** A setup stage transfer request block */ -#define XHCI_TRB_SETUP XHCI_TRB_TYPE ( 2 ) - -/** Setup stage input data direction */ -#define XHCI_SETUP_IN 3 - -/** Setup stage output data direction */ -#define XHCI_SETUP_OUT 2 - -/** A data stage transfer request block */ -struct xhci_trb_data { - /** Data buffer */ - uint64_t data; - /** Length */ - uint32_t len; - /** Flags */ - uint8_t flags; - /** Type */ - uint8_t type; - /** Transfer direction */ - uint8_t direction; - /** Reserved */ - uint8_t reserved; -} __attribute__ (( packed )); - -/** A data stage transfer request block */ -#define XHCI_TRB_DATA XHCI_TRB_TYPE ( 3 ) - -/** Input data direction */ -#define XHCI_DATA_IN 0x01 - -/** Output data direction */ -#define XHCI_DATA_OUT 0x00 - -/** A status stage transfer request block */ -struct xhci_trb_status { - /** Reserved */ - uint64_t reserved_a; - /** Reserved */ - uint32_t reserved_b; - /** Flags */ - uint8_t flags; - /** Type */ - uint8_t type; - /** Direction */ - uint8_t direction; - /** Reserved */ - uint8_t reserved_c; -} __attribute__ (( packed )); - -/** A status stage transfer request block */ -#define XHCI_TRB_STATUS XHCI_TRB_TYPE ( 4 ) - -/** Input status direction */ -#define XHCI_STATUS_IN 0x01 - -/** Output status direction */ -#define XHCI_STATUS_OUT 0x00 - -/** A link transfer request block */ -struct xhci_trb_link { - /** Next ring segment */ - uint64_t next; - /** Reserved */ - uint32_t reserved_a; - /** Flags */ - uint8_t flags; - /** Type */ - uint8_t type; - /** Reserved */ - uint16_t reserved_c; -} __attribute__ (( packed )); - -/** A link transfer request block */ -#define XHCI_TRB_LINK XHCI_TRB_TYPE ( 6 ) - -/** A no-op transfer request block */ -#define XHCI_TRB_NOP XHCI_TRB_TYPE ( 8 ) - -/** An enable slot transfer request block */ -struct xhci_trb_enable_slot { - /** Reserved */ - uint64_t reserved_a; - /** Reserved */ - uint32_t reserved_b; - /** Flags */ - uint8_t flags; - /** Type */ - uint8_t type; - /** Slot type */ - uint8_t slot; - /** Reserved */ - uint8_t reserved_c; -} __attribute__ (( packed )); - -/** An enable slot transfer request block */ -#define XHCI_TRB_ENABLE_SLOT XHCI_TRB_TYPE ( 9 ) - -/** A disable slot transfer request block */ -struct xhci_trb_disable_slot { - /** Reserved */ - uint64_t reserved_a; - /** Reserved */ - uint32_t reserved_b; - /** Flags */ - uint8_t flags; - /** Type */ - uint8_t type; - /** Reserved */ - uint8_t reserved_c; - /** Slot ID */ - uint8_t slot; -} __attribute__ (( packed )); - -/** A disable slot transfer request block */ -#define XHCI_TRB_DISABLE_SLOT XHCI_TRB_TYPE ( 10 ) - -/** A context transfer request block */ -struct xhci_trb_context { - /** Input context */ - uint64_t input; - /** Reserved */ - uint32_t reserved_a; - /** Flags */ - uint8_t flags; - /** Type */ - uint8_t type; - /** Reserved */ - uint8_t reserved_b; - /** Slot ID */ - uint8_t slot; -} __attribute__ (( packed )); - -/** An address device transfer request block */ -#define XHCI_TRB_ADDRESS_DEVICE XHCI_TRB_TYPE ( 11 ) - -/** A configure endpoint transfer request block */ -#define XHCI_TRB_CONFIGURE_ENDPOINT XHCI_TRB_TYPE ( 12 ) - -/** An evaluate context transfer request block */ -#define XHCI_TRB_EVALUATE_CONTEXT XHCI_TRB_TYPE ( 13 ) - -/** A reset endpoint transfer request block */ -struct xhci_trb_reset_endpoint { - /** Reserved */ - uint64_t reserved_a; - /** Reserved */ - uint32_t reserved_b; - /** Flags */ - uint8_t flags; - /** Type */ - uint8_t type; - /** Endpoint ID */ - uint8_t endpoint; - /** Slot ID */ - uint8_t slot; -} __attribute__ (( packed )); - -/** A reset endpoint transfer request block */ -#define XHCI_TRB_RESET_ENDPOINT XHCI_TRB_TYPE ( 14 ) - -/** A stop endpoint transfer request block */ -struct xhci_trb_stop_endpoint { - /** Reserved */ - uint64_t reserved_a; - /** Reserved */ - uint32_t reserved_b; - /** Flags */ - uint8_t flags; - /** Type */ - uint8_t type; - /** Endpoint ID */ - uint8_t endpoint; - /** Slot ID */ - uint8_t slot; -} __attribute__ (( packed )); - -/** A stop endpoint transfer request block */ -#define XHCI_TRB_STOP_ENDPOINT XHCI_TRB_TYPE ( 15 ) - -/** A set transfer ring dequeue pointer transfer request block */ -struct xhci_trb_set_tr_dequeue_pointer { - /** Dequeue pointer */ - uint64_t dequeue; - /** Reserved */ - uint32_t reserved; - /** Flags */ - uint8_t flags; - /** Type */ - uint8_t type; - /** Endpoint ID */ - uint8_t endpoint; - /** Slot ID */ - uint8_t slot; -} __attribute__ (( packed )); - -/** A set transfer ring dequeue pointer transfer request block */ -#define XHCI_TRB_SET_TR_DEQUEUE_POINTER XHCI_TRB_TYPE ( 16 ) - -/** A no-op command transfer request block */ -#define XHCI_TRB_NOP_CMD XHCI_TRB_TYPE ( 23 ) - -/** A transfer event transfer request block */ -struct xhci_trb_transfer { - /** Transfer TRB pointer */ - uint64_t transfer; - /** Residual transfer length */ - uint16_t residual; - /** Reserved */ - uint8_t reserved; - /** Completion code */ - uint8_t code; - /** Flags */ - uint8_t flags; - /** Type */ - uint8_t type; - /** Endpoint ID */ - uint8_t endpoint; - /** Slot ID */ - uint8_t slot; -} __attribute__ (( packed )); - -/** A transfer event transfer request block */ -#define XHCI_TRB_TRANSFER XHCI_TRB_TYPE ( 32 ) - -/** A command completion event transfer request block */ -struct xhci_trb_complete { - /** Command TRB pointer */ - uint64_t command; - /** Parameter */ - uint8_t parameter[3]; - /** Completion code */ - uint8_t code; - /** Flags */ - uint8_t flags; - /** Type */ - uint8_t type; - /** Virtual function ID */ - uint8_t vf; - /** Slot ID */ - uint8_t slot; -} __attribute__ (( packed )); - -/** A command completion event transfer request block */ -#define XHCI_TRB_COMPLETE XHCI_TRB_TYPE ( 33 ) - -/** xHCI completion codes */ -enum xhci_completion_code { - /** Timeout */ - XHCI_CMPLT_TIMEOUT = -1, - /** Success */ - XHCI_CMPLT_SUCCESS = 1, - /** Stall Error */ - XHCI_CMPLT_STALL = 6, - /** Bandwidth Error */ - XHCI_CMPLT_BANDWIDTH = 8, - /** Endpoint Not Enabled Error */ - XHCI_CMPLT_ENDPOINT_NOT_ENABLED = 12, - /** Short packet */ - XHCI_CMPLT_SHORT = 13, - /** Parameter Error */ - XHCI_CMPLT_PARAMETER = 17, - /** Command ring stopped */ - XHCI_CMPLT_CMD_STOPPED = 24, -}; - -/** A port status change transfer request block */ -struct xhci_trb_port_status { - /** Reserved */ - uint8_t reserved_a[3]; - /** Port ID */ - uint8_t port; - /** Reserved */ - uint8_t reserved_b[7]; - /** Completion code */ - uint8_t code; - /** Flags */ - uint8_t flags; - /** Type */ - uint8_t type; - /** Reserved */ - uint16_t reserved_c; -} __attribute__ (( packed )); - -/** A port status change transfer request block */ -#define XHCI_TRB_PORT_STATUS XHCI_TRB_TYPE ( 34 ) - -/** A port status change transfer request block */ -struct xhci_trb_host_controller { - /** Reserved */ - uint64_t reserved_a; - /** Reserved */ - uint8_t reserved_b[3]; - /** Completion code */ - uint8_t code; - /** Flags */ - uint8_t flags; - /** Type */ - uint8_t type; - /** Reserved */ - uint16_t reserved_c; -} __attribute__ (( packed )); - -/** A port status change transfer request block */ -#define XHCI_TRB_HOST_CONTROLLER XHCI_TRB_TYPE ( 37 ) - -/** A transfer request block */ -union xhci_trb { - /** Template */ - struct xhci_trb_template template; - /** Common fields */ - struct xhci_trb_common common; - /** Normal TRB */ - struct xhci_trb_normal normal; - /** Setup stage TRB */ - struct xhci_trb_setup setup; - /** Data stage TRB */ - struct xhci_trb_data data; - /** Status stage TRB */ - struct xhci_trb_status status; - /** Link TRB */ - struct xhci_trb_link link; - /** Enable slot TRB */ - struct xhci_trb_enable_slot enable; - /** Disable slot TRB */ - struct xhci_trb_disable_slot disable; - /** Input context TRB */ - struct xhci_trb_context context; - /** Reset endpoint TRB */ - struct xhci_trb_reset_endpoint reset; - /** Stop endpoint TRB */ - struct xhci_trb_stop_endpoint stop; - /** Set transfer ring dequeue pointer TRB */ - struct xhci_trb_set_tr_dequeue_pointer dequeue; - /** Transfer event */ - struct xhci_trb_transfer transfer; - /** Command completion event */ - struct xhci_trb_complete complete; - /** Port status changed event */ - struct xhci_trb_port_status port; - /** Host controller event */ - struct xhci_trb_host_controller host; -} __attribute__ (( packed )); - -struct xhci_ring { - union xhci_trb ring[XHCI_RING_ITEMS]; - union xhci_trb evt; - uint32_t eidx; - uint32_t nidx; - uint32_t cs; - usb_osal_mutex_t lock; -}; - -/** An event ring segment */ -struct xhci_er_seg { - /** Base address */ - uint64_t base; - /** Number of TRBs */ - uint32_t count; - /** Reserved */ - uint32_t reserved; -} __attribute__ (( packed )); - -/** An xHCI endpoint */ -struct xhci_endpoint { - struct xhci_ring reqs; /* DO NOT MOVE reqs from structure beg */ - /** xHCI device */ - struct xhci_host *xhci; - /** xHCI slot */ - struct xhci_slot *slot; - /** Endpoint address */ - unsigned int address; - /** Context index */ - unsigned int ctx; - /** Endpoint type in USB definition */ - unsigned int ep_type; - /** Endpoint type in XHCI Endpoint context definition */ - unsigned int ctx_type; - - /** Maximum transfer size (Maximum packet size) */ - unsigned int mtu; - /** Maximum burst size */ - unsigned int burst; - /** Endpoint interval */ - unsigned int interval; - - /** Endpoint context */ - struct xhci_endpoint_context *context; - - /* command or transfer waiter */ - int timeout; /* = 0 no need to wait */ - bool waiter; - usb_osal_sem_t waitsem; - - /* handle urb */ - struct usbh_hubport *hport; - struct usbh_urb *urb; /* NULL if no active URB */ -}; - -/** An xHCI device slot */ -struct xhci_slot { - /** xHCI device */ - struct xhci_host *xhci; - /** Slot ID */ - unsigned int id; - /** Slot context */ - struct xhci_slot_context *context; - - /** Route string */ - unsigned int route; - /** Root hub port number */ - unsigned int port; - /** Protocol speed ID */ - unsigned int psiv; - /** Number of ports (if this device is a hub) */ - unsigned int ports; - /** Transaction translator slot ID */ - unsigned int tt_id; - /** Transaction translator port */ - unsigned int tt_port; - - /** Endpoints, indexed by context ID */ - struct xhci_endpoint *endpoint[XHCI_CTX_END]; -}; - -/** An xHCI device */ -struct xhci_host { - /** USB bus */ - struct usbh_bus *bus; - /** Name */ - char name[4]; - - /* xhci registers base addr */ - /** Registers base */ - void *base; - /** Capability registers */ - void *cap; - /** Operational registers */ - void *op; - /** Runtime registers */ - void *run; - /** Doorbell registers */ - void *db; - /** extended capability */ - unsigned int xecp; - /** capability cache */ - uint32_t hcs[3]; - uint32_t hcc; - /** xhci version */ - uint16_t version; - - /** Number of device slots */ - unsigned int slots; - /** Number of interrupters */ - unsigned int intrs; - /** Number of ports */ - unsigned int ports; - - /** 64-bit addressing capability */ - int addr64; - /** Context size shift */ - unsigned int csz_shift; - /** Page size */ - size_t pagesize; - - /** USB legacy support capability (if present and enabled) */ - unsigned int legacy; - - /** Device context base address array */ - struct xhci_dcbaa dcbaa; - - /** Scratchpad buffer */ - struct xhci_scratchpad scratch; - - /** Device slots, indexed by slot ID */ - struct xhci_slot **slot; - - /** Command ring */ - struct xhci_ring *cmds; - /** Event ring */ - struct xhci_ring *evts; - struct xhci_er_seg *eseg; - - struct xhci_endpoint *cur_cmd_pipe; -}; - -/** - * Calculate input context offset - * - * @v xhci xHCI device - * @v ctx Context index - */ -static inline size_t xhci_input_context_offset ( struct xhci_host *xhci, - unsigned int ctx ) { - - return ( XHCI_ICI ( ctx ) << xhci->csz_shift ); -} - -/** - * Calculate device context offset - * - * @v xhci xHCI device - * @v ctx Context index - */ -static inline size_t xhci_device_context_offset ( struct xhci_host *xhci, - unsigned int ctx ) { - - return ( XHCI_DCI ( ctx ) << xhci->csz_shift ); -} - -/* Probe XCHI device */ -int xhci_probe ( struct xhci_host *xhci, unsigned long baseaddr ); - -/* Open XHCI device and start running */ -int xhci_open ( struct xhci_host *xhci ); - -/* Close XHCI device and stop running */ -void xhci_close ( struct xhci_host *xhci ); - -/* Remove XHCI device and free allocated memory */ -void xhci_remove ( struct xhci_host *xhci ); - -/* Enable port */ -int xhci_port_enable (struct xhci_host *xhci, uint32_t port); - -/* Get port speed */ -uint32_t xhci_root_speed ( struct xhci_host *xhci, uint8_t port ); - -/* Open and enable device */ -int xhci_device_open ( struct xhci_host *xhci, struct xhci_endpoint *pipe, int *slot_id ); - -/* Assign device address */ -int xhci_device_address ( struct xhci_host *xhci, struct xhci_slot *slot, struct xhci_endpoint *pipe ); - -/* Close device and free allocated memory */ -void xhci_device_close ( struct xhci_slot *slot ); - -/* Open control endpoint for slot */ -int xhci_ctrl_endpoint_open ( struct xhci_host *xhci, struct xhci_slot *slot, struct xhci_endpoint *pipe ); - -/* Open work endpoint for slot */ -int xhci_work_endpoint_open ( struct xhci_host *xhci, struct xhci_slot *slot, struct xhci_endpoint *pipe ); - -/* Close endpoint and free allocated memory */ -void xhci_endpoint_close ( struct xhci_endpoint *ep ); - -/* Update MTU (Max packet size) of endpoint */ -int xhci_endpoint_mtu ( struct xhci_endpoint *ep ); - -/* Enqueue message transfer, usually for control transfer */ -void xhci_endpoint_message ( struct xhci_endpoint *ep, struct usb_setup_packet *packet, - void *data_buff, int datalen ); - -/* Enqueue stream transfer, usually for bulk/interrupt transfer */ -void xhci_endpoint_stream ( struct xhci_endpoint *ep, void *data_buff, int datalen ); - -/* Process event ring in interrupt */ -void xhci_event_process(struct xhci_host *xhci); - -/* Wait for a ring to empty (all TRBs processed by hardware) */ -int xhci_event_wait(struct xhci_host *xhci, - struct xhci_endpoint *pipe, - struct xhci_ring *ring); - -/* Dump host controller registers */ -void xhci_dump(struct xhci_host *xhci); - -/* Dump port registers */ -void xhci_dump_port ( struct xhci_host *xhci, - unsigned int port ); - -/* Dump Port status */ -void xhci_dump_port_status(uint32_t port, uint32_t portsc); - -/* Dump input context */ -void xhci_dump_input_ctx( struct xhci_host *xhci, const struct xhci_endpoint *endpoint, const void *input); - -/* Dump Endpoint */ -void xhci_dump_endpoint(const struct xhci_endpoint *ep); - -/* Dump endpoint context */ -void xhci_dump_ep_ctx(const struct xhci_endpoint_context *ep); - -/* Dump TRB */ -void xhci_dump_trbs(const union xhci_trb *trbs, unsigned int count); - -/* Dump slot context */ -void xhci_dump_slot_ctx(const struct xhci_slot_context *const sc); - -#endif /* XHCI_H */ \ No newline at end of file diff --git a/third-party/cherryusb/port/xhci/xhci_dbg.c b/third-party/cherryusb/port/xhci/xhci_dbg.c deleted file mode 100644 index f8d6f370e265f884c1f570db58d5531340b7bb44..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/port/xhci/xhci_dbg.c +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright : (C) 2022 Phytium Information Technology, Inc. - * All Rights Reserved. - * - * This program is OPEN SOURCE software: you can redistribute it and/or modify it - * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, - * either version 1.0 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the Phytium Public License for more details. - * - * - * FilePath: xhci_dbg.c - * Date: 2022-07-19 09:26:25 - * LastEditTime: 2022-07-19 09:26:25 - * Description:  This file is for implment xhci debug functions - * - * Modify History: - * Ver   Who        Date         Changes - * ----- ------     --------    -------------------------------------- - * 1.0 zhugengyu 2022/9/19 init commit - * 2.0 zhugengyu 2023/3/29 support usb3.0 device attached at roothub - */ -#include -#include -#include -#include -#include - -#include "usbh_core.h" - -#include "xhci.h" - -/* macro to enable dump */ -#define XHCI_DUMP 1 -#define XHCI_DUMP_PORT 1 -#define XHCI_DUMP_TRB 0 -#define XHCI_DUMP_SLOT 0 -#define XHCI_DUMP_EP_CTX 0 -#define XHCI_DUMP_INPUT_CTX 0 -#define XHCI_DUMP_ENDPOINT 0 -#define XHCI_DUMP_PORT_STATUS 1 - -/** - * Dump host controller registers - * - * @v xhci xHCI device - */ -void xhci_dump(struct xhci_host *xhci) { -#if XHCI_DUMP - uint32_t usbcmd; - uint32_t usbsts; - uint32_t pagesize; - uint32_t dnctrl; - uint32_t config; - - /* Dump USBCMD */ - usbcmd = readl ( xhci->op + XHCI_OP_USBCMD ); - USB_LOG_DBG ( "XHCI %s USBCMD %08x%s%s\n", xhci->name, usbcmd, - ( ( usbcmd & XHCI_USBCMD_RUN ) ? " run" : "" ), - ( ( usbcmd & XHCI_USBCMD_HCRST ) ? " hcrst" : "" ) ); - - /* Dump USBSTS */ - usbsts = readl ( xhci->op + XHCI_OP_USBSTS ); - USB_LOG_DBG ( "XHCI %s USBSTS %08x%s\n", xhci->name, usbsts, - ( ( usbsts & XHCI_USBSTS_HCH ) ? " hch" : "" ) ); - - /* Dump PAGESIZE */ - pagesize = readl ( xhci->op + XHCI_OP_PAGESIZE ); - USB_LOG_DBG ( "XHCI %s PAGESIZE %08x\n", xhci->name, pagesize ); - - /* Dump DNCTRL */ - dnctrl = readl ( xhci->op + XHCI_OP_DNCTRL ); - USB_LOG_DBG ( "XHCI %s DNCTRL %08x\n", xhci->name, dnctrl ); - - /* Dump CONFIG */ - config = readl ( xhci->op + XHCI_OP_CONFIG ); - USB_LOG_DBG ( "XHCI %s CONFIG %08x\n", xhci->name, config ); -#endif -} - -/** - * Dump port registers - * - * @v xhci xHCI device - * @v port Port number - */ -void xhci_dump_port ( struct xhci_host *xhci, - unsigned int port ) { -#if XHCI_DUMP_PORT - uint32_t portsc; - uint32_t portpmsc; - uint32_t portli; - uint32_t porthlpmc; - - /* Dump PORTSC */ - portsc = readl ( xhci->op + XHCI_OP_PORTSC ( port ) ); - USB_LOG_DBG ( "XHCI %s-%d PORTSC %08x%s%s%s%s psiv=%d\n", - xhci->name, port, portsc, - ( ( portsc & XHCI_PORTSC_CCS ) ? " ccs" : "" ), - ( ( portsc & XHCI_PORTSC_PED ) ? " ped" : "" ), - ( ( portsc & XHCI_PORTSC_PR ) ? " pr" : "" ), - ( ( portsc & XHCI_PORTSC_PP ) ? " pp" : "" ), - XHCI_PORTSC_PSIV ( portsc ) ); - - /* Dump PORTPMSC */ - portpmsc = readl ( xhci->op + XHCI_OP_PORTPMSC ( port ) ); - USB_LOG_DBG ( "XHCI %s-%d PORTPMSC %08x\n", xhci->name, port, portpmsc ); - - /* Dump PORTLI */ - portli = readl ( xhci->op + XHCI_OP_PORTLI ( port ) ); - USB_LOG_DBG ( "XHCI %s-%d PORTLI %08x\n", xhci->name, port, portli ); - - /* Dump PORTHLPMC */ - porthlpmc = readl ( xhci->op + XHCI_OP_PORTHLPMC ( port ) ); - USB_LOG_DBG ( "XHCI %s-%d PORTHLPMC %08x\n", - xhci->name, port, porthlpmc ); -#endif -} - -/** - * Dump slot context - * - * @v sc Slot context - */ -void xhci_dump_slot_ctx(const struct xhci_slot_context *const sc) { -#if XHCI_DUMP_SLOT - const uint8_t *ctx = (uint8_t *)sc; - - USB_LOG_DBG("===== slot ctx ===== \r\n"); - USB_LOG_DBG("ctx[0]=0x%x\n", *((uint32_t*)ctx)); - USB_LOG_DBG(" info: 0x%x \r\n", sc->info); - USB_LOG_DBG("ctx[1]=0x%x\n", *((uint32_t*)ctx + 1)); - USB_LOG_DBG(" latency: 0x%x \r\n", sc->latency); - USB_LOG_DBG(" port: 0x%x \r\n", sc->port); - USB_LOG_DBG(" ports: 0x%x \r\n", sc->ports); - USB_LOG_DBG("ctx[2]=0x%x\n", *((uint32_t*)ctx + 2)); - USB_LOG_DBG(" tt_id: 0x%x \r\n", sc->tt_id); - USB_LOG_DBG(" tt_port: 0x%x \r\n", sc->tt_port); - USB_LOG_DBG("ctx[3]=0x%x\n", *((uint32_t*)ctx + 3)); - USB_LOG_DBG(" intr: 0x%x \r\n", sc->intr); - USB_LOG_DBG(" address: 0x%x \r\n", sc->address); - USB_LOG_DBG(" state: 0x%x \r\n", sc->state); - USB_LOG_DBG("=====+++++++++===== \r\n"); -#endif -} - -/** - * Dump endpoint context - * - * @v ep Endpoint context - */ -void xhci_dump_ep_ctx(const struct xhci_endpoint_context *ep) { -#if XHCI_DUMP_EP_CTX - const uint8_t *ctx = (uint8_t *)ep; - - USB_LOG_DBG("===== ep ctx ===== \r\n"); - USB_LOG_DBG("ctx[0]=0x%x\n", *((uint32_t*)ctx)); - USB_LOG_DBG(" ep_state: 0x%x \r\n", ep->state); - USB_LOG_DBG(" mult: 0x%x \r\n", XHCI_EPCTX_MULT_GET(ep->stream)); - USB_LOG_DBG(" stream: 0x%x \r\n", XHCI_EPCTX_STREAM_GET(ep->stream)); - USB_LOG_DBG(" lsa: 0x%x \r\n", !!(XHCI_EPCTX_LSA & (ep->stream))); - USB_LOG_DBG(" interval: 0x%x \r\n", ep->interval); - USB_LOG_DBG(" esit_high: 0x%x \r\n", ep->esit_high); - USB_LOG_DBG("ctx[1]=0x%x\n", *((uint32_t*)ctx + 1)); - USB_LOG_DBG(" cerr: 0x%x \r\n", XHCI_EPCTX_CERR_GET(ep->type)); - USB_LOG_DBG(" type: 0x%x \r\n", XHCI_EPCTX_TYPE_GET(ep->type)); - USB_LOG_DBG(" hid: 0x%x \r\n", !!(XHCI_EPCTX_HID & (ep->type))); - USB_LOG_DBG(" burst: 0x%x \r\n", ep->burst); - USB_LOG_DBG(" mtu: 0x%x \r\n", ep->mtu); - USB_LOG_DBG("ctx[2]=0x%x\n", *((uint32_t*)ctx + 2)); - USB_LOG_DBG("ctx[3]=0x%x\n", *((uint32_t*)ctx + 3)); - USB_LOG_DBG(" dequeue: 0x%lx \r\n", ep->dequeue); - USB_LOG_DBG(" dcs: 0x%lx \r\n", !!(XHCI_EPCTX_DCS & ep->dequeue)); - USB_LOG_DBG("ctx[4]=0x%x\n", *((uint32_t*)ctx + 4)); - USB_LOG_DBG(" trb_len: 0x%x \r\n", ep->trb_len); - USB_LOG_DBG(" esit_low: 0x%x \r\n", ep->esit_low); - USB_LOG_DBG("=====+++++++++===== \r\n"); -#endif -} - -/** - * Dump input context - * - * @v xhci XHCI device - * @v endpoint Endpoint - * @v input Input context - */ -void xhci_dump_input_ctx( struct xhci_host *xhci, const struct xhci_endpoint *endpoint, const void *input) { -#if XHCI_DUMP_INPUT_CTX - const struct xhci_control_context *control_ctx; - const struct xhci_slot_context *slot_ctx; - const struct xhci_endpoint_context *ep_ctx; - - control_ctx = input; - slot_ctx = ( input + xhci_input_context_offset ( xhci, XHCI_CTX_SLOT )); - ep_ctx = ( input + xhci_input_context_offset ( xhci, endpoint->ctx ) ); - - USB_LOG_DBG("===input ctx====\n"); - USB_LOG_DBG("ctrl@%p=0x%x\n", control_ctx, *control_ctx); - USB_LOG_DBG("add=0x%x\n", control_ctx->add); - USB_LOG_DBG("del=0x%x\n", control_ctx->drop); - - USB_LOG_DBG("slot@%p\n", slot_ctx); - xhci_dump_slot_ctx(slot_ctx); - - USB_LOG_DBG("ep-%d@%p\n", endpoint->ctx, ep_ctx); - xhci_dump_ep_ctx(ep_ctx); - - USB_LOG_DBG("=====+++++++++===== \r\n"); -#endif -} - -/** - * Get next TRB in ring - * - * @v trbs TRB in ring - * @v trb Next TRB - */ -static const union xhci_trb * xhci_get_next_trb(const union xhci_trb *trbs) { - const struct xhci_trb_link *link = &(trbs->link); - if (link->type == XHCI_TRB_LINK) { - return (link->next) ? (const union xhci_trb *)(uintptr_t)(link->next) : NULL; - } else { - return trbs + 1; - } -} - -/** - * Dump TRB - * - * @v trbs TRB header - * @v count Number of TRB to dump - */ -void xhci_dump_trbs(const union xhci_trb *trbs, unsigned int count) { -#if XHCI_DUMP_TRB - const union xhci_trb *cur; - const struct xhci_trb_common *comm; - const uint8_t *dword; - - USB_LOG_DBG("===trbs ====\n"); - for (unsigned int i = 0; i < count; i++) { - cur = &(trbs[i]); - dword = (const uint8_t *)cur; - - comm = &(cur->common); - USB_LOG_DBG("[0x%x-0x%x-0x%x-0x%x]\n", - *((uint32_t *)dword), *((uint32_t *)dword + 1), - *((uint32_t *)dword + 2), *((uint32_t *)dword + 3)); - if (XHCI_TRB_SETUP == comm->type) { - const struct xhci_trb_setup *setup = (const struct xhci_trb_setup *)comm; - - USB_LOG_DBG("setup trb\n"); - USB_LOG_DBG(" packet=0x%x\n", setup->packet); - USB_LOG_DBG(" bmRequestType type=0x%x\n", setup->packet.bmRequestType); - USB_LOG_DBG(" bRequest=0x%x\n", setup->packet.bRequest); - USB_LOG_DBG(" wValue=0x%x\n", setup->packet.wValue); - USB_LOG_DBG(" wIndex=0x%x\n", setup->packet.wIndex); - USB_LOG_DBG(" wLength=0x%x\n", setup->packet.wLength); - USB_LOG_DBG(" trb_trans_len=%d\n", setup->len); - USB_LOG_DBG(" flags=0x%x\n", setup->flags); - USB_LOG_DBG(" direction=%d\n", setup->direction); - } else if (XHCI_TRB_DATA == comm->type) { - const struct xhci_trb_data *data = (const struct xhci_trb_data *)comm; - - USB_LOG_DBG("data trb......\n"); - USB_LOG_DBG(" data=0x%x\n", data->data); - USB_LOG_DBG(" len=%d\n", data->len); - USB_LOG_DBG(" direction=%d\n", data->direction); - } else if (XHCI_TRB_STATUS == comm->type) { - const struct xhci_trb_status *status = (const struct xhci_trb_status *)comm; - - USB_LOG_DBG("status trb......\n"); - USB_LOG_DBG(" direction=%d\n", status->direction); - } - } - USB_LOG_DBG("=====+++++++++===== \r\n"); -#endif -} - -static const char *xhci_endpoint_xhci_type (unsigned int ep_xhci_type) { - static const char *ep_names[] = {"not_valid", "isoc_out", "bulk_out", - "intr_out", "ctrl", "isoc_in", - "bulk_in", "intr_in"}; - unsigned int index = ep_xhci_type >> 3; - if (index < sizeof(ep_names)/sizeof(ep_names[0])) { - return ep_names[index]; - } - - return "unkown"; -} - -static const char *xhci_endpoint_type (unsigned int ep_type) { - const char *ep_name = "unkown"; - - switch (ep_type) - { - case USB_ENDPOINT_TYPE_CONTROL: - ep_name = "ctrl-ep"; - break; - case USB_ENDPOINT_TYPE_ISOCHRONOUS: - ep_name = "isoc-ep"; - break; - case USB_ENDPOINT_TYPE_BULK: - ep_name = "bulk-ep"; - break; - case USB_ENDPOINT_TYPE_INTERRUPT: - ep_name = "intr-ep"; - break; - default: - break; - } - - return ep_name; -} - -/** - * Dump Endpoint - * - * @v ep Endpoint - */ -void xhci_dump_endpoint(const struct xhci_endpoint *ep) { -#if XHCI_DUMP_ENDPOINT - USB_LOG_DBG("===endpoint====\n"); - USB_LOG_DBG("xhci=0x%x\n", ep->xhci); - USB_LOG_DBG("slot=0x%x\n", ep->slot); - USB_LOG_DBG("address=0x%x\n", ep->address); - USB_LOG_DBG("mtu=0x%x\n", ep->mtu); - USB_LOG_DBG("burst=0x%x\n", ep->burst); - USB_LOG_DBG("ctx=0x%x\n", ep->ctx); - USB_LOG_DBG("ep_type=%s\n", xhci_endpoint_type(ep->ep_type)); - USB_LOG_DBG("xhci_type=%s\n", xhci_endpoint_xhci_type(ep->ctx_type)); - USB_LOG_DBG("interval=0x%x\n", ep->interval); - USB_LOG_DBG("=====+++++++++===== \r\n"); -#endif -} - -/** - * Dump Port status - * - * @v port Port number - * @v portsc Port status - */ -void xhci_dump_port_status(uint32_t port, uint32_t portsc) { -#if XHCI_DUMP_PORT_STATUS - USB_LOG_DBG("====port-%d====\n", port); - USB_LOG_DBG("changed=%d \n", !!(XHCI_PORTSC_CSC & port)); - USB_LOG_DBG("connect=%d \n", !!(XHCI_PORTSC_CCS & port)); - USB_LOG_DBG("enabled=%d \n", !!(XHCI_PORTSC_PED & port)); - USB_LOG_DBG("powered=%d \n", !!(XHCI_PORTSC_PP & port)); - USB_LOG_DBG("=====+++++++++===== \r\n"); -#endif -} \ No newline at end of file diff --git a/third-party/cherryusb/port/xhci/xhci_reg.h b/third-party/cherryusb/port/xhci/xhci_reg.h deleted file mode 100644 index a981daa672eb8b2a3f5ed4cb24b30bb69f34e0cd..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/port/xhci/xhci_reg.h +++ /dev/null @@ -1,499 +0,0 @@ -/* - * Copyright : (C) 2022 Phytium Information Technology, Inc. - * All Rights Reserved. - * - * This program is OPEN SOURCE software: you can redistribute it and/or modify it - * under the terms of the Phytium Public License as published by the Phytium Technology Co.,Ltd, - * either version 1.0 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the Phytium Public License for more details. - * - * - * FilePath: xhci_reg.h - * Date: 2022-07-19 09:26:25 - * LastEditTime: 2022-07-19 09:26:25 - * Description:  This file is for xhci register definition. - * - * Modify History: - * Ver   Who        Date         Changes - * ----- ------     --------    -------------------------------------- - * 1.0 zhugengyu 2022/9/19 init commit - * 2.0 zhugengyu 2023/3/29 support usb3.0 device attached at roothub - */ - -#ifndef XHCI_REG_H -#define XHCI_REG_H - -#if defined(__aarch64__) -#define BITS_PER_LONG 64U -#define XHCI_AARCH64 -#else -#define BITS_PER_LONG 32U -#define XHCI_AARCH32 -#endif - -#define XHCI_GENMASK(h, l) \ - (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) - -#define XHCI_GENMASK_ULL(h, l) \ - (((~0ULL) - (1ULL << (l)) + 1) & \ - (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) - -#define XHCI32_GET_BITS(x, a, b) (uint32_t)((((uint32_t)(x)) & XHCI_GENMASK(a, b)) >> b) -#define XHCI32_SET_BITS(x, a, b) (uint32_t)((((uint32_t)(x)) << b) & XHCI_GENMASK(a, b)) -#define XHCI64_GET_BITS(x, a, b) (uint64_t)((((uint64_t)(x)) & XHCI_GENMASK_ULL(a, b)) >> b) -#define XHCI64_SET_BITS(x, a, b) (uint64_t)((((uint64_t)(x)) << b) & XHCI_GENMASK_ULL(a, b)) - -/** Capability register length */ -#define XHCI_CAP_CAPLENGTH 0x00 - -/** Host controller interface version number */ -#define XHCI_CAP_HCIVERSION 0x02 - -/** Structural parameters 1 */ -#define XHCI_CAP_HCSPARAMS1 0x04 - -/** Number of device slots */ -#define XHCI_HCSPARAMS1_SLOTS(params) ( ( (params) >> 0 ) & 0xff ) - -/** Number of interrupters */ -#define XHCI_HCSPARAMS1_INTRS(params) ( ( (params) >> 8 ) & 0x3ff ) - -/** Number of ports */ -#define XHCI_HCSPARAMS1_PORTS(params) ( ( (params) >> 24 ) & 0xff ) - -/** Structural parameters 2 */ -#define XHCI_CAP_HCSPARAMS2 0x08 - -/** Number of page-sized scratchpad buffers */ -#define XHCI_HCSPARAMS2_SCRATCHPADS(params) \ - ( ( ( (params) >> 16 ) & 0x3e0 ) | ( ( (params) >> 27 ) & 0x1f ) ) - -/** Capability parameters */ -#define XHCI_CAP_HCCPARAMS1 0x10 - -/** 64-bit addressing capability */ -#define XHCI_HCCPARAMS1_ADDR64(params) ( ( (params) >> 0 ) & 0x1 ) - -/** Context size shift */ -#define XHCI_HCCPARAMS1_CSZ_SHIFT(params) ( 5 + ( ( (params) >> 2 ) & 0x1 ) ) - -/** xHCI extended capabilities pointer */ -#define XHCI_HCCPARAMS1_XECP(params) ( ( ( (params) >> 16 ) & 0xffff ) << 2 ) - -/** Doorbell offset */ -#define XHCI_CAP_DBOFF 0x14 - -/** Runtime register space offset */ -#define XHCI_CAP_RTSOFF 0x18 - -/** xHCI extended capability ID */ -#define XHCI_XECP_ID(xecp) ( ( (xecp) >> 0 ) & 0xff ) - -/** Next xHCI extended capability pointer */ -#define XHCI_XECP_NEXT(xecp) ( ( ( (xecp) >> 8 ) & 0xff ) << 2 ) - -/** USB legacy support extended capability */ -#define XHCI_XECP_ID_LEGACY 1 - -/** USB legacy support BIOS owned semaphore */ -#define XHCI_USBLEGSUP_BIOS 0x02 - -/** USB legacy support BIOS ownership flag */ -#define XHCI_USBLEGSUP_BIOS_OWNED 0x01 - -/** USB legacy support OS owned semaphore */ -#define XHCI_USBLEGSUP_OS 0x03 - -/** USB legacy support OS ownership flag */ -#define XHCI_USBLEGSUP_OS_OWNED 0x01 - -/** USB legacy support control/status */ -#define XHCI_USBLEGSUP_CTLSTS 0x04 - -/** Supported protocol extended capability */ -#define XHCI_XECP_ID_SUPPORTED 2 - -/** Supported protocol revision */ -#define XHCI_SUPPORTED_REVISION 0x00 - -/** Supported protocol minor revision */ -#define XHCI_SUPPORTED_REVISION_VER(revision) ( ( (revision) >> 16 ) & 0xffff ) - -/** Supported protocol name */ -#define XHCI_SUPPORTED_NAME 0x04 - -/** Supported protocol ports */ -#define XHCI_SUPPORTED_PORTS 0x08 - -/** Supported protocol port offset */ -#define XHCI_SUPPORTED_PORTS_OFFSET(ports) ( ( (ports) >> 0 ) & 0xff ) - -/** Supported protocol port count */ -#define XHCI_SUPPORTED_PORTS_COUNT(ports) ( ( (ports) >> 8 ) & 0xff ) - -/** Supported protocol PSI count */ -#define XHCI_SUPPORTED_PORTS_PSIC(ports) ( ( (ports) >> 28 ) & 0x0f ) - -/** Supported protocol slot */ -#define XHCI_SUPPORTED_SLOT 0x0c - -/** Supported protocol slot type */ -#define XHCI_SUPPORTED_SLOT_TYPE(slot) ( ( (slot) >> 0 ) & 0x1f ) - -/** Supported protocol PSI */ -#define XHCI_SUPPORTED_PSI(index) ( 0x10 + ( (index) * 4 ) ) - -/** Supported protocol PSI value */ -#define XHCI_SUPPORTED_PSI_VALUE(psi) ( ( (psi) >> 0 ) & 0x0f ) - -/** Supported protocol PSI mantissa */ -#define XHCI_SUPPORTED_PSI_MANTISSA(psi) ( ( (psi) >> 16 ) & 0xffff ) - -/** Supported protocol PSI exponent */ -#define XHCI_SUPPORTED_PSI_EXPONENT(psi) ( ( (psi) >> 4 ) & 0x03 ) - -/** Default PSI values */ -enum { - /** Full speed (12Mbps) */ - XHCI_SPEED_FULL = 1, - /** Low speed (1.5Mbps) */ - XHCI_SPEED_LOW = 2, - /** High speed (480Mbps) */ - XHCI_SPEED_HIGH = 3, - /** Super speed */ - XHCI_SPEED_SUPER = 4, -}; - -/** USB command register */ -#define XHCI_OP_USBCMD 0x00 - -/** Run/stop */ -#define XHCI_USBCMD_RUN 0x00000001UL - -/* Interrupter Enable (INTE) 1: enabled - RW */ -#define XHCI_USBCMD_INTE (1UL << 2) - -/** Host controller reset */ -#define XHCI_USBCMD_HCRST 0x00000002UL - -/** USB status register */ -#define XHCI_OP_USBSTS 0x04 - -/** Host controller halted */ -#define XHCI_USBSTS_HCH 0x00000001UL - -/** Interrupt Pending (IP) */ -#define XHCI_USBSTS_EINT (1UL << 3) - -/** Page size register */ -#define XHCI_OP_PAGESIZE 0x08 - -/** Page size */ -#define XHCI_PAGESIZE(pagesize) ( (pagesize) << 12 ) - -/** Device notifcation control register */ -#define XHCI_OP_DNCTRL 0x14 - -/** Command ring control register */ -#define XHCI_OP_CRCR 0x18 - -/** Command ring cycle state */ -#define XHCI_CRCR_RCS 0x00000001UL - -/** Command abort */ -#define XHCI_CRCR_CA 0x00000004UL - -/** Command ring running */ -#define XHCI_CRCR_CRR 0x00000008UL - -/** Device context base address array pointer */ -#define XHCI_OP_DCBAAP 0x30 - -/** Configure register */ -#define XHCI_OP_CONFIG 0x38 - -/** Maximum device slots enabled */ -#define XHCI_CONFIG_MAX_SLOTS_EN(slots) ( (slots) << 0 ) - -/** Maximum device slots enabled mask */ -#define XHCI_CONFIG_MAX_SLOTS_EN_MASK \ - XHCI_CONFIG_MAX_SLOTS_EN ( 0xff ) - -/** Port status and control register */ -#define XHCI_OP_PORTSC(port) ( 0x400 - 0x10 + ( (port) << 4 ) ) - -/** Current connect status */ -#define XHCI_PORTSC_CCS 0x00000001UL - -/** Port enabled */ -#define XHCI_PORTSC_PED 0x00000002UL - -#define XHCI_PORTSC_OCA (1 << 3) - -/** Port reset */ -#define XHCI_PORTSC_PR 0x00000010UL - -/** Port link state */ -#define XHCI_PORTSC_PLS(pls) ( (pls) << 5 ) - -/** U0 state */ -#define XHCI_PORTSC_PLS_U0 XHCI_PORTSC_PLS ( 0 ) - -/** Disabled port link state */ -#define XHCI_PORTSC_PLS_DISABLED XHCI_PORTSC_PLS ( 4 ) - -/** RxDetect port link state */ -#define XHCI_PORTSC_PLS_RXDETECT XHCI_PORTSC_PLS ( 5 ) - -/** Polling state */ -#define XHCI_PORTSC_PLS_POLLING XHCI_PORTSC_PLS ( 7 ) - -/** Port link state mask */ -#define XHCI_PORTSC_PLS_MASK XHCI_PORTSC_PLS ( 0xf ) - -/** Port power */ -#define XHCI_PORTSC_PP 0x00000200UL - -/** Time to delay after enabling power to a port */ -#define XHCI_PORT_POWER_DELAY_MS 20 - -/** Port speed ID value */ -#define XHCI_PORTSC_PSIV(portsc) ( ( (portsc) >> 10 ) & 0xf ) - -/** Port indicator control */ -#define XHCI_PORTSC_PIC(indicators) ( (indicators) << 14 ) - -/** Port indicator control mask */ -#define XHCI_PORTSC_PIC_MASK XHCI_PORTSC_PIC ( 3 ) - -/** Port link state write strobe */ -#define XHCI_PORTSC_LWS 0x00010000UL - -/** Time to delay after writing the port link state */ -#define XHCI_LINK_STATE_DELAY_MS 100 - -/** Connect status change */ -#define XHCI_PORTSC_CSC (1 << 17) - -/** Port enabled/disabled change */ -#define XHCI_PORTSC_PEC (1 << 18) - -/** Warm port reset change */ -#define XHCI_PORTSC_WRC (1 << 19) - -/** Over-current change */ -#define XHCI_PORTSC_OCC (1 << 20) - -/** Port reset change */ -#define XHCI_PORTSC_PRC (1 << 21) - -/** Port link state change */ -#define XHCI_PORTSC_PLC (1 << 22) - -/** Port config error change */ -#define XHCI_PORTSC_CEC (1 << 23) - -/* Cold Attach Status 1: Far-end Receiver Terminations were detected */ -#define XHCI_PORTSC_CAS (1 << 24) - -/* Wake on Connect Enable 1: enable port to be sensitive to device connects */ -#define XHCI_PORTSC_WCE (1 << 25) - -/* Wake on Disconnect Enable 1: enable port to be sensitive to device disconnects */ -#define XHCI_PORTSC_WDE (1 << 26) - -/* Wake on Over-current Enable 1: enable port to be sensitive to over-current conditions */ -#define XHCI_PORTSC_WOE (1 << 27) - -/* Device Removable, 0: Device is removable. 1: Device is non-removable */ -#define XHCI_PORTSC_DR (1 << 30) - -/* Warm Port Reset 1: follow Warm Reset sequence */ -#define XHCI_PORTSC_WPR (1 << 31) - -/** Port status change mask */ -#define XHCI_PORTSC_CHANGE \ - ( XHCI_PORTSC_CSC | XHCI_PORTSC_PEC | XHCI_PORTSC_WRC | \ - XHCI_PORTSC_OCC | XHCI_PORTSC_PRC | XHCI_PORTSC_PLC | \ - XHCI_PORTSC_CEC ) - -#define XHCI_PORTSC_RW_MASK (XHCI_PORTSC_PR | XHCI_PORTSC_PLS_MASK | XHCI_PORTSC_PP \ - | XHCI_PORTSC_PIC_MASK | XHCI_PORTSC_LWS | XHCI_PORTSC_WCE \ - | XHCI_PORTSC_WDE | XHCI_PORTSC_WOE) - -/** Port status and control bits which should be preserved - * - * The port status and control register is a horrendous mix of - * differing semantics. Some bits are written to only when a separate - * write strobe bit is set. Some bits should be preserved when - * modifying other bits. Some bits will be cleared if written back as - * a one. Most excitingly, the "port enabled" bit has the semantics - * that 1=enabled, 0=disabled, yet writing a 1 will disable the port. - */ -#define XHCI_PORTSC_PRESERVE ( XHCI_PORTSC_PP | XHCI_PORTSC_PIC_MASK ) - -/** Port power management status and control register */ -#define XHCI_OP_PORTPMSC(port) ( 0x404 - 0x10 + ( (port) << 4 ) ) - -/** Port link info register */ -#define XHCI_OP_PORTLI(port) ( 0x408 - 0x10 + ( (port) << 4 ) ) - -/** Port hardware link power management control register */ -#define XHCI_OP_PORTHLPMC(port) ( 0x40c - 0x10 + ( (port) << 4 ) ) - -/* Doorbell registers are 32 bits in length */ -#define XHCI_REG_DB_SIZE 4 - -/** Interrupter Management Register */ -#define XHCI_RUN_IR_IMAN(intr) ( 0x20 + ( (intr) << 5 ) ) - -/* Interrupt Pending, 1: an interrupt is pending for this Interrupter */ -#define XHCI_RUN_IR_IMAN_IP (1 << 0) - -/* Interrupt Enable, 1: capable of generating an interrupt. */ -#define XHCI_RUN_IR_IMAN_IE (1 << 1) - -/** Interrupter Moderation Register */ -#define XHCI_RUN_IR_IMOD(intr) ( 0x24 + ( (intr) << 5 ) ) - -/** Event ring segment table size register */ -#define XHCI_RUN_ERSTSZ(intr) ( 0x28 + ( (intr) << 5 ) ) - -/** Event ring segment table base address register */ -#define XHCI_RUN_ERSTBA(intr) ( 0x30 + ( (intr) << 5 ) ) - -/** Event ring dequeue pointer register */ -#define XHCI_RUN_ERDP(intr) ( 0x38 + ( (intr) << 5 ) ) - -/** Event Handler Busy */ -#define XHCI_RUN_ERDP_EHB (1 << 3) - -/** Minimum alignment required for data structures - * - * With the exception of the scratchpad buffer pages (which are - * page-aligned), data structures used by xHCI generally require from - * 16 to 64 byte alignment and must not cross an (xHCI) page boundary. - * We simplify this requirement by aligning each structure on its own - * size, with a minimum of a 64 byte alignment. - */ -#define XHCI_MIN_ALIGN 64 - -/** Maximum transfer size */ -#define XHCI_MTU 65536 - -/** Read/Write Data Barrier for ARM */ -#define BARRIER() __asm__ __volatile__("": : :"memory") - -#ifdef XHCI_AARCH64 -#define DSB() __asm__ __volatile__("dsb sy": : : "memory") -#else -#define DSB() __asm__ __volatile__("dsb": : : "memory") -#endif - -/** - * Read byte from memory-mapped device - * - * @v io_addr I/O address - * @ret data Value read - */ -static inline uint8_t readb(void *io_addr ) { - uint8_t val = *(volatile const uint8_t *)io_addr; - BARRIER(); - return val; -} - -/** - * Read 16-bit word from memory-mapped device - * - * @v io_addr I/O address - * @ret data Value read - */ -static inline uint16_t readw(void * io_addr ) { - uint16_t val = *(volatile const uint16_t *)io_addr; - BARRIER(); - return val; -} - -/** - * Read 32-bit dword from memory-mapped device - * - * @v io_addr I/O address - * @ret data Value read - */ -static inline uint32_t readl(void * io_addr ) { - uint32_t val = *(volatile const uint32_t *)io_addr; - BARRIER(); - return val; -} - -/** - * Read 64-bit qword from memory-mapped device - * - * @v io_addr I/O address - * @ret data Value read - */ -static inline uint64_t readq(void * io_addr ) { - uint64_t val = *(volatile const uint64_t *)io_addr; - BARRIER(); - return val; -} - -/** - * Write byte to memory-mapped device - * - * @v data Value to write - * @v io_addr I/O address - */ -static inline void writeb(uint8_t data, void * io_addr ) { - BARRIER(); - *(volatile uint8_t *)io_addr = data; -} - -/** - * Write 16-bit word to memory-mapped device - * - * @v data Value to write - * @v io_addr I/O address - */ -static inline void writew(uint16_t data, void * io_addr ) { - BARRIER(); - *(volatile uint16_t *)io_addr = data; -} - -/** - * Write 32-bit dword to memory-mapped device - * - * @v data Value to writed - * @v io_addr I/O address - */ -static inline void writel(uint32_t data, void * io_addr ) { - BARRIER(); - *(volatile uint32_t *)io_addr = data; -} - -/** - * Write 64-bit qword to memory-mapped device - * - * @v data Value to write - * @v io_addr I/O address - */ -static inline void writeq(uint64_t data, void * io_addr ) { - BARRIER(); - *(volatile uint64_t *)io_addr = data; -} - -/** - * Byte-order converter for ARM-Little-End - */ -#define CPU_TO_LE64(x) ((uint64_t)(x)) -#define LE64_to_CPU(x) ((uint64_t)(x)) -#define CPU_TO_LE32(x) ((uint32_t)(x)) -#define LE32_TO_CPU(x) ((uint32_t)(x)) -#define CPU_TO_LE16(x) ((uint16_t)(x)) -#define LE16_TO_CPU(x) ((uint16_t)(x)) - - -#endif /* XHCI_REG_H */ \ No newline at end of file diff --git a/third-party/cherryusb/src.mk b/third-party/cherryusb/src.mk deleted file mode 100644 index 98e91f81d4ffa83c277a7a09db7bd4314fd900a2..0000000000000000000000000000000000000000 --- a/third-party/cherryusb/src.mk +++ /dev/null @@ -1,28 +0,0 @@ - -ifdef CONFIG_USE_CHERRY_USB - - CSRCS_RELATIVE_FILES += $(wildcard core/*.c)\ - $(wildcard common/*.c) \ - $(wildcard osal/*.c) \ - - - ifdef CONFIG_CHERRY_USB_PORT_XHCI - CSRCS_RELATIVE_FILES += $(wildcard port/xhci/*.c) - endif #CONFIG_CHERRY_USB_PORT_XHCI - - ifdef CONFIG_CHERRYUSB_HOST - - ifdef CONFIG_CHERRY_USB_HOST_HUB - CSRCS_RELATIVE_FILES += class/hub/usbh_hub.c - endif #CONFIG_CHERRY_USB_HOST_HUB - - ifdef CONFIG_CHERRY_USB_HOST_MSC - CSRCS_RELATIVE_FILES += class/msc/usbh_msc.c - endif #CONFIG_CHERRY_USB_HOST_MSC - - ifdef CONFIG_CHERRY_USB_HOST_HID - CSRCS_RELATIVE_FILES += class/hid/usbh_hid.c - endif #CONFIG_CHERRY_USB_HOST_HID - - endif #CONFIG_CHERRYUSB_HOST -endif #CONFIG_USE_CHERRY_USB \ No newline at end of file diff --git a/third-party/fatfs-0.1.4/port/fusb/diskio_usb.c b/third-party/fatfs-0.1.4/port/fusb/diskio_usb.c index f3647cb2a48cf299f87380d57a9bcded4761d8f2..a1eeee303d9042058e14bed1d4ff364cff304991 100644 --- a/third-party/fatfs-0.1.4/port/fusb/diskio_usb.c +++ b/third-party/fatfs-0.1.4/port/fusb/diskio_usb.c @@ -32,32 +32,14 @@ #define FF_DEBUG(format, ...) FT_DEBUG_PRINT_D(FF_DEBUG_TAG, format, ##__VA_ARGS__) #define FF_WARN(format, ...) FT_DEBUG_PRINT_W(FF_DEBUG_TAG, format, ##__VA_ARGS__) -#define FUSB_MEMP_TOTAL_SIZE SZ_1M #define FUSB_FATFS_ID FUSB3_ID_0 -static FMemp memp; -static u8 memp_buf[FUSB_MEMP_TOTAL_SIZE]; -FASSERT_STATIC(FUSB_FATFS_ID < FUSB3_NUM); - -static const u32 usb_irq_num[FUSB3_NUM] = -{ - [FUSB3_ID_0] = FUSB3_0_IRQ_NUM, - [FUSB3_ID_1] = FUSB3_1_IRQ_NUM -}; - -static const uintptr xhci_base_addr[FUSB3_NUM] = -{ - [FUSB3_ID_0] = FUSB3_0_BASE_ADDR + FUSB3_XHCI_OFFSET, - [FUSB3_ID_1] = FUSB3_1_BASE_ADDR + FUSB3_XHCI_OFFSET -}; - typedef struct { DWORD id; boolean init_ok; BYTE pdrv; const TCHAR *disk_name; - struct usbh_bus usb; } ff_usb_disk; static ff_usb_disk usb_disk = @@ -65,93 +47,10 @@ static ff_usb_disk usb_disk = .id = FUSB_FATFS_ID, .pdrv = FF_DRV_NOT_USED, .init_ok = FALSE, - .disk_name = "/usb0/sda" + .disk_name = "/dev/sda" }; /*****************************************************************************/ -extern void USBH_IRQHandler(void *); - -static void UsbHcInterrruptHandler(s32 vector, void *param) -{ - USBH_IRQHandler(param); -} - -static void UsbHcSetupInterrupt(u32 id) -{ - u32 cpu_id; - u32 irq_num = usb_irq_num[id]; - u32 irq_priority = 13U; - - GetCpuId(&cpu_id); - InterruptSetTargetCpus(irq_num, cpu_id); - - InterruptSetPriority(irq_num, irq_priority); - - /* register intr callback */ - InterruptInstall(irq_num, - UsbHcInterrruptHandler, - &(usb_disk.usb), - NULL); - - /* enable irq */ - InterruptUmask(irq_num); -} - -void UsbHcSetupMemp(void) -{ - if (FT_COMPONENT_IS_READY != memp.is_ready) - { - USB_ASSERT(FT_SUCCESS == FMempInit(&memp, &memp_buf[0], &memp_buf[0] + FUSB_MEMP_TOTAL_SIZE)); - } -} - -/* implement cherryusb weak functions */ -void usb_hc_low_level_init(uint32_t id) -{ - UsbHcSetupMemp(); - UsbHcSetupInterrupt(id); -} - -unsigned long usb_hc_get_register_base(uint32_t id) -{ - return xhci_base_addr[id]; -} - -void *usb_hc_malloc(size_t size) -{ - return usb_hc_malloc_align(sizeof(void *), size); -} - -void *usb_hc_malloc_align(size_t align, size_t size) -{ - void *result = FMempMallocAlign(&memp, size, align); - - if (result) - { - memset(result, 0U, size); - } - - return result; -} - -void usb_hc_free(void *ptr) -{ - if (NULL != ptr) - { - FMempFree(&memp, ptr); - } -} - -void usb_assert(const char *filename, int linenum) -{ - FAssert(filename, linenum, 0xff); -} - -void usb_hc_dcache_invalidate(void *addr, unsigned long len) -{ - FCacheDCacheInvalidateRange((uintptr)addr, len); -} -/*****************************************/ /*-----------------------------------------------------------------------*/ /* Get Drive Status */ @@ -191,8 +90,7 @@ static DSTATUS usb_disk_initialize( if (FALSE == disk->init_ok) { - memset(&disk->usb, 0, sizeof(disk->usb)); - (void)usbh_initialize(disk->id, &disk->usb); /* start a task to emurate usb hub and attached usb disk */ + (void)usbh_initialize(disk->id, usb_hc_get_register_base(disk->id)); /* start a task to emurate usb hub and attached usb disk */ while (TRUE) { if (NULL != usbh_find_class_instance(disk->disk_name)) diff --git a/third-party/freertos/portable/GCC/ft_platform/FreeRTOSConfig.h b/third-party/freertos/portable/GCC/ft_platform/FreeRTOSConfig.h index c822aaca0fbae2a1635563b38151470d779ab735..2a35c0dedb101a302e5ac5fe3cf72c82e548bc67 100644 --- a/third-party/freertos/portable/GCC/ft_platform/FreeRTOSConfig.h +++ b/third-party/freertos/portable/GCC/ft_platform/FreeRTOSConfig.h @@ -115,6 +115,8 @@ #define configSUPPORT_STATIC_ALLOCATION 1 //use dynamic memory allocation #define configSUPPORT_DYNAMIC_ALLOCATION 1 +#define configSTACK_DEPTH_TYPE uint32_t + /* Co-routine definitions. */ #define configUSE_CO_ROUTINES 0 //disable co-routines #define configMAX_CO_ROUTINE_PRIORITIES (2) diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch32/port.c b/third-party/freertos/portable/GCC/ft_platform/aarch32/port.c index df56cadda659d0917d3164460615361300cb61a3..eca71542a7f846257f3d28cd2ea307b207563dca 100644 --- a/third-party/freertos/portable/GCC/ft_platform/aarch32/port.c +++ b/third-party/freertos/portable/GCC/ft_platform/aarch32/port.c @@ -453,8 +453,8 @@ void FreeRTOS_Tick_Handler(void) } /* unmask all interrupt priorities. */ - InterruptSetPriorityMask(portUNMASK_VALUE); - + InterruptSetPriorityMask(portUNMASK_VALUE); + /* interrupt clear. */ configCLEAR_TICK_INTERRUPT(); } @@ -566,4 +566,10 @@ static void vPortPriorityConfigCheck(void) ulMaxAPIPriorityMask = PRIORITY_TRANSLATE_SET(ulMaxAPIPriorityMask); ulPortUnmask = PRIORITY_TRANSLATE_SET(ulPortUnmask); } +} + +extern int vApplicationInIrq(void); +_WEAK int xPortIsInsideInterrupt( void ) +{ + return vApplicationInIrq(); } \ No newline at end of file diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch32/portmacro.h b/third-party/freertos/portable/GCC/ft_platform/aarch32/portmacro.h index a66f97a8d0252a8459d6e675c6ff2662d6414bff..a8782de867cc9f6b93345e41402a5e2de2ec4295 100644 --- a/third-party/freertos/portable/GCC/ft_platform/aarch32/portmacro.h +++ b/third-party/freertos/portable/GCC/ft_platform/aarch32/portmacro.h @@ -197,4 +197,6 @@ number of bits implemented by the interrupt controller. */ #define portMEMORY_BARRIER() __asm volatile("" :: \ : "memory") +int xPortIsInsideInterrupt( void ); + #endif /* PORTMACRO_H */ diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/port.c b/third-party/freertos/portable/GCC/ft_platform/aarch64/port.c index 756d6400a4ed97a9371f7e0c06edf33a97aa856c..718c3ff5fef66141f88da0117c4cd72c0953a218 100644 --- a/third-party/freertos/portable/GCC/ft_platform/aarch64/port.c +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/port.c @@ -526,3 +526,9 @@ static void vPortPriorityConfigCheck(void) ullPortUnmask = PRIORITY_TRANSLATE_SET(ullPortUnmask); } } + +extern int vApplicationInIrq(void); +_WEAK int xPortIsInsideInterrupt( void ) +{ + return vApplicationInIrq(); +} \ No newline at end of file diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/portmacro.h b/third-party/freertos/portable/GCC/ft_platform/aarch64/portmacro.h index 65b4ab8b55f32a55fe785d1688cc40fd43475d33..8b03a3227212e553e0a21312bf0f7f322d1e6c76 100644 --- a/third-party/freertos/portable/GCC/ft_platform/aarch64/portmacro.h +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/portmacro.h @@ -198,4 +198,6 @@ number of bits implemented by the interrupt controller. */ #define portICCBPR_BINARY_POINT_OFFSET (0x08) #define portICCRPR_RUNNING_PRIORITY_OFFSET (0x14) +int xPortIsInsideInterrupt( void ); + #endif /* PORTMACRO_H */ diff --git a/third-party/freertos/posix/FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_pthread.c b/third-party/freertos/posix/FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_pthread.c index f063160a5083b3c764d3f1906b3b5fdbaca817b4..67efea2a52e2d286dc187b7aca1a90a2809295c9 100644 --- a/third-party/freertos/posix/FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_pthread.c +++ b/third-party/freertos/posix/FreeRTOS-Plus-POSIX/source/FreeRTOS_POSIX_pthread.c @@ -340,7 +340,7 @@ int pthread_create( pthread_t * thread, /* Create the FreeRTOS task that will run the pthread. */ if( xTaskCreate( prvRunThread, posixconfigPTHREAD_TASK_NAME, - ( uint16_t ) ( pxThread->xAttr.usStackSize / sizeof( StackType_t ) ), + ( configSTACK_DEPTH_TYPE ) ( pxThread->xAttr.usStackSize / sizeof( StackType_t ) ), ( void * ) pxThread, xSchedParam.sched_priority, &pxThread->xTaskHandle ) != pdPASS ) diff --git a/third-party/fsl_wifi/port/os/os.c b/third-party/fsl_wifi/port/os/os.c index d053d12f0b0989b0453be14413bf587398aebd0b..2fea7858d928a256f6bec80c593c592cac50fe0b 100644 --- a/third-party/fsl_wifi/port/os/os.c +++ b/third-party/fsl_wifi/port/os/os.c @@ -79,7 +79,7 @@ int os_thread_create(os_thread_t *thandle, { int ret; - ret = xTaskCreate(main_func, name, (uint16_t)stack->size, arg, (uint32_t)prio, thandle); + ret = xTaskCreate(main_func, name, (configSTACK_DEPTH_TYPE)stack->size, arg, (uint32_t)prio, thandle); os_dprintf( " Thread Create: ret %d thandle %p" diff --git a/third-party/include.mk b/third-party/include.mk index 9ede024770d87e53638fe1e2082baa4df76cea1e..b96171e27efb724ecfddaf382a38c87cfbe99b57 100644 --- a/third-party/include.mk +++ b/third-party/include.mk @@ -35,10 +35,6 @@ ifdef CONFIG_USE_LVGL include $(FREERTOS_SDK_DIR)/third-party/lvgl-8.3/include.mk endif -ifdef CONFIG_USE_CHERRY_USB -include $(FREERTOS_SDK_DIR)/third-party/cherryusb/include.mk -endif - ifdef CONFIG_USE_LIBMETAL include $(FREERTOS_SDK_DIR)/third-party/libmetal/include.mk endif @@ -53,4 +49,8 @@ endif ifdef CONFIG_USE_FSL_WIFI include $(FREERTOS_SDK_DIR)/third-party/fsl_wifi/include.mk +endif + +ifdef CONFIG_USE_CHERRY_USB +include $(SDK_DIR)/third-party/cherryusb/include.mk endif \ No newline at end of file diff --git a/third-party/letter-shell-3.1/port/shell_port.c b/third-party/letter-shell-3.1/port/shell_port.c index 7aa5329246acfd92f7dfbe5c8e2c1f0a34a9d787..f60ab55e43cab4997bc3ed963c8f78dd6470b462 100644 --- a/third-party/letter-shell-3.1/port/shell_port.c +++ b/third-party/letter-shell-3.1/port/shell_port.c @@ -54,7 +54,7 @@ void LSUserShellTaskCreate(void *args) ret = xTaskCreate((TaskFunction_t)LSSerialWaitLoop, /* 任务入口函数 */ (const char *)"LSSerialWaitLoop",/* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)NULL,/* 任务入口函数参数 */ (UBaseType_t)2, /* 任务的优先级 */ NULL); /* 任务控制块指针 */ @@ -73,7 +73,7 @@ BaseType_t LSUserShellTask(void) { return xTaskCreate((TaskFunction_t)LSUserShellTaskCreate, /* 任务入口函数 */ (const char *)"LSUserShellTaskCreate",/* 任务名字 */ - (uint16_t)1024, /* 任务栈大小 */ + 1024, /* 任务栈大小 */ (void *)NULL,/* 任务入口函数参数 */ (UBaseType_t)2, /* 任务的优先级 */ NULL); /* 任务控制块指针 */ diff --git a/third-party/third-party.kconfig b/third-party/third-party.kconfig index dc0e20be4ddafe43060f2cab8dc357b13ce8ffac..cf55b0cc0ec67ed3b148d0464e6fc3bce4f3af30 100644 --- a/third-party/third-party.kconfig +++ b/third-party/third-party.kconfig @@ -128,12 +128,12 @@ config USE_FREEMODBUS config USE_CHERRY_USB bool default n - prompt "Use CherryUSB(0.8.0)" + prompt "Use CherryUSB" help Include CherryUSB for XHCI controller if USE_CHERRY_USB - source "$(FREERTOS_SDK_DIR)/third-party/cherryusb/Kconfig" + source "$SDK_DIR/third-party/cherryusb/cherryusb.kconfig" endif config USE_CRYPTO_PLUS_PLUS diff --git a/third-party/thirdparty.mk b/third-party/thirdparty.mk index 7dd6ff5813908f58624779f1c36fac317742469c..e879656db17c9d8da7e5dbb9345130d0503797c1 100644 --- a/third-party/thirdparty.mk +++ b/third-party/thirdparty.mk @@ -113,17 +113,6 @@ lib_openamp_info: BAREMETAL_LIBS+= $(BUILD_OUT_PATH)/lib_openamp.a endif -ifdef CONFIG_USE_CHERRY_USB -$(BUILD_OUT_PATH)/lib_cherryusb.a: lib_cherryusb.a -lib_cherryusb.a: - $(call rtos_invoke_make_in_dir,$(FREERTOS_SDK_DIR),third-party/cherryusb,makefile,all,) -lib_cherryusb_debug: - $(call rtos_invoke_make_in_dir,$(FREERTOS_SDK_DIR),third-party/cherryusb,makefile,debug,) -lib_cherryusb_info: - $(call rtos_invoke_make_in_dir,$(FREERTOS_SDK_DIR),third-party/cherryusb,makefile,compiler_info,) -BAREMETAL_LIBS+= $(BUILD_OUT_PATH)/lib_cherryusb.a -endif - # libmetal ifdef CONFIG_USE_LIBMETAL $(BUILD_OUT_PATH)/lib_libmetal.a: lib_libmetal.a @@ -158,6 +147,17 @@ libfslwifi_info: BAREMETAL_LIBS+= $(BUILD_OUT_PATH)/libfslwifi.a endif +ifdef CONFIG_USE_CHERRY_USB +$(BUILD_OUT_PATH)/libcherryusb.a: libcherryusb.a +libcherryusb.a: + $(call rtos_invoke_make_in_dir,$(SDK_DIR),third-party/cherryusb,makefile,all,) +libcherryusb_debug: + $(call rtos_invoke_make_in_dir,$(SDK_DIR),third-party/cherryusb,makefile,debug,) +libcherryusb_info: + $(call rtos_invoke_make_in_dir,$(SDK_DIR),third-party/cherryusb,makefile,compiler_info,) +BAREMETAL_LIBS+= $(BUILD_OUT_PATH)/libcherryusb.a +endif + # ifdef CONFIG_USE_SDMMC_CMD # $(BUILD_OUT_PATH)/libsdmmc.a: libsdmmc.a # libsdmmc.a: diff --git a/third-party/tlsf-3.1.0/port/fmemory_pool.c b/third-party/tlsf-3.1.0/port/fmemory_pool.c index dd6f2b187d8c10f5d6cf59ba13122cd7b014fea1..ad9ef35972aeac5095a8013a4d6ca5d596a84f7c 100644 --- a/third-party/tlsf-3.1.0/port/fmemory_pool.c +++ b/third-party/tlsf-3.1.0/port/fmemory_pool.c @@ -40,10 +40,12 @@ #define FMEMP_INFO(format, ...) FT_DEBUG_PRINT_I(FMEMP_DEBUG_TAG, format, ##__VA_ARGS__) #define FMEMP_DEBUG(format, ...) FT_DEBUG_PRINT_D(FMEMP_DEBUG_TAG, format, ##__VA_ARGS__) +extern int vApplicationInIrq(void); + static inline boolean FMempTakeSema(SemaphoreHandle_t locker) { FASSERT_MSG((NULL != locker), "Locker not exists."); - if (pdFALSE == xSemaphoreTake(locker, portMAX_DELAY)) + if ((!vApplicationInIrq()) && pdFALSE == xSemaphoreTake(locker, portMAX_DELAY)) { FMEMP_ERROR("Failed to give locker !!!"); return FALSE; @@ -55,7 +57,7 @@ static inline boolean FMempTakeSema(SemaphoreHandle_t locker) static inline void FMempGiveSema(SemaphoreHandle_t locker) { FASSERT_MSG((NULL != locker), "Locker not exists."); - if (pdFALSE == xSemaphoreGive(locker)) + if ((!vApplicationInIrq()) && (pdFALSE == xSemaphoreGive(locker))) { FMEMP_ERROR("Failed to give locker !!!"); }