Merge remote-tracking branch 'upstream/master' into h7rs
Signed-off-by: HiFiPhile <admin@hifiphile.com>
This commit is contained in:
@@ -121,6 +121,7 @@ commands:
|
||||
TOOLCHAIN_OPTION="--toolchain clang"
|
||||
elif [ << parameters.toolchain >> == arm-iar ]; then
|
||||
TOOLCHAIN_OPTION="--toolchain iar"
|
||||
echo IAR_LMS_CLOUD_URL=$IAR_LMS_CLOUD_URL
|
||||
iccarm --version
|
||||
elif [ << parameters.toolchain >> == arm-gcc ]; then
|
||||
TOOLCHAIN_OPTION="--toolchain gcc"
|
||||
|
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@@ -111,6 +111,7 @@ jobs:
|
||||
|
||||
# ---------------------------------------
|
||||
# Build IAR on HFP self-hosted
|
||||
# Since IAR Token secret is not passed to forked PR, only build on PR from the same repo
|
||||
# ---------------------------------------
|
||||
arm-iar:
|
||||
if: github.repository_owner == 'hathach' && github.event_name == 'push'
|
||||
@@ -118,6 +119,7 @@ jobs:
|
||||
runs-on: [self-hosted, Linux, X64, hifiphile]
|
||||
env:
|
||||
BUILD_ARGS: ${{ join(fromJSON(needs.set-matrix.outputs.json)['arm-iar'], ' ') }}
|
||||
IAR_LMS_CLOUD_URL: ${{ vars.IAR_LMS_CLOUD_URL }}
|
||||
IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }}
|
||||
steps:
|
||||
- name: Clean workspace
|
||||
@@ -127,7 +129,9 @@ jobs:
|
||||
mkdir -p "${{ github.workspace }}"
|
||||
|
||||
- name: Toolchain version
|
||||
run: iccarm --version
|
||||
run: |
|
||||
echo IAR_LMS_CLOUD_URL=$IAR_LMS_CLOUD_URL
|
||||
iccarm --version
|
||||
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
|
8
.github/workflows/hil_test.yml
vendored
8
.github/workflows/hil_test.yml
vendored
@@ -90,11 +90,13 @@ jobs:
|
||||
# ---------------------------------------
|
||||
# Hardware in the loop (HIL)
|
||||
# self-hosted by HFP, build with IAR toolchain, for attached hardware checkout test/hil/hfp.json
|
||||
# Since IAR Token secret is not passed to forked PR, only build on PR from the same repo
|
||||
# ---------------------------------------
|
||||
hil-hfp:
|
||||
if: github.repository_owner == 'hathach'
|
||||
if: github.repository_owner == 'hathach' && github.event.pull_request.head.repo.fork == false
|
||||
runs-on: [self-hosted, Linux, X64, hifiphile]
|
||||
env:
|
||||
IAR_LMS_CLOUD_URL: ${{ vars.IAR_LMS_CLOUD_URL }}
|
||||
IAR_LMS_BEARER_TOKEN: ${{ secrets.IAR_LMS_BEARER_TOKEN }}
|
||||
steps:
|
||||
- name: Clean workspace
|
||||
@@ -104,7 +106,9 @@ jobs:
|
||||
mkdir -p "${{ github.workspace }}"
|
||||
|
||||
- name: Toolchain version
|
||||
run: iccarm --version
|
||||
run: |
|
||||
echo IAR_LMS_CLOUD_URL=$IAR_LMS_CLOUD_URL
|
||||
iccarm --version
|
||||
|
||||
- name: Checkout TinyUSB
|
||||
uses: actions/checkout@v4
|
||||
|
16
.gitignore
vendored
16
.gitignore
vendored
@@ -15,6 +15,14 @@ latex
|
||||
*.jlink
|
||||
*.emSession
|
||||
*.ninja*
|
||||
*.eww
|
||||
*.ewp
|
||||
*.ewt
|
||||
*.ewd
|
||||
*.hex
|
||||
cmake_install.cmake
|
||||
CMakeCache.txt
|
||||
settings/
|
||||
.settings/
|
||||
.vscode/
|
||||
.gdb_history
|
||||
@@ -37,4 +45,10 @@ cmake-build-*
|
||||
sdkconfig
|
||||
.PVS-Studio
|
||||
.vscode/
|
||||
build/
|
||||
build
|
||||
CMakeFiles
|
||||
Debug
|
||||
RelWithDebInfo
|
||||
Release
|
||||
BrowseInfo
|
||||
.cmake_build
|
||||
|
8
.idea/cmake.xml
generated
8
.idea/cmake.xml
generated
@@ -12,6 +12,8 @@
|
||||
<configuration PROFILE_NAME="feather_rp2040" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pico_sdk -DPICO_BOARD=adafruit_feather_rp2040 -DLOG=1" />
|
||||
<configuration PROFILE_NAME="feather_rp2040_max3421" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_rp2040_max3421 -DLOG=1" />
|
||||
<configuration PROFILE_NAME="metro_rp2040" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pico_sdk -DPICO_BOARD=adafruit_metro_rp2040 -DLOG=1 -DMAX3421_HOST=1" />
|
||||
<configuration PROFILE_NAME="adafruit_metro_rp2350" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=adafruit_metro_rp2350 -DLOG=1" />
|
||||
<configuration PROFILE_NAME="adafruit_fruit_jam" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=adafruit_fruit_jam -DLOG=1 -DCFLAGS_CLI="-DCFG_TUH_RPI_PIO_USB=1"" />
|
||||
<configuration PROFILE_NAME="adafruit_feather_esp32_v2" ENABLED="false" TOOLCHAIN_NAME="ESP-IDF" GENERATION_OPTIONS="-DBOARD=adafruit_feather_esp32_v2 -DMAX3421_HOST=1 -DLOG=1">
|
||||
<ADDITIONAL_GENERATION_ENVIRONMENT>
|
||||
<envs>
|
||||
@@ -80,14 +82,14 @@
|
||||
<configuration PROFILE_NAME="samd11_xplained" ENABLED="false" CONFIG_NAME="MinSizeRel" GENERATION_OPTIONS="-DBOARD=samd11_xplained" />
|
||||
<configuration PROFILE_NAME="atsaml21_xpro" ENABLED="false" GENERATION_OPTIONS="-DBOARD=atsaml21_xpro" />
|
||||
<configuration PROFILE_NAME="feather_m4_express" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_m4_express -DLOG=1 -DLOGGER=RTT -DMAX3421_HOST=1" />
|
||||
<configuration PROFILE_NAME="metro_m4_express" ENABLED="true" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m4_express -DLOG=1 -DLOGGER=RTT -DMAX3421_HOST=1" />
|
||||
<configuration PROFILE_NAME="metro_m4_express" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m4_express -DLOG=1 -DLOGGER=RTT -DMAX3421_HOST=1" />
|
||||
<configuration PROFILE_NAME="feather_m4_express-zephyr" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_m4_express -DLOG=1 -DMAX3421_HOST=1 -DRTOS=zephyr" />
|
||||
<configuration PROFILE_NAME="itsybitsy_m4" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=itsybitsy_m4" />
|
||||
<configuration PROFILE_NAME="same54_xplained" ENABLED="false" GENERATION_OPTIONS="-DBOARD=same54_xplained -DLOG=1 -DLOGGER=RTT" />
|
||||
<configuration PROFILE_NAME="samg55_xplained" ENABLED="false" GENERATION_OPTIONS="-DBOARD=samg55_xplained" />
|
||||
<configuration PROFILE_NAME="feather_nrf52840_express" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_nrf52840_express -DLOG=1 -DLOGGER=RTT -DMAX3421_HOST=1" />
|
||||
<configuration PROFILE_NAME="pca10056" ENABLED="true" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pca10056 -DLOG=1 -DLOGGER=RTT -DTRACE_ETM=1" />
|
||||
<configuration PROFILE_NAME="pca10056-zephyr" ENABLED="true" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pca10056 -DLOG=1 -DTRACE_ETM=1 -DRTOS=zephyr" BUILD_OPTIONS="-v" />
|
||||
<configuration PROFILE_NAME="pca10056" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pca10056 -DLOG=1 -DLOGGER=RTT -DTRACE_ETM=1" />
|
||||
<configuration PROFILE_NAME="pca10056-zephyr" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pca10056 -DLOG=1 -DTRACE_ETM=1 -DRTOS=zephyr" BUILD_OPTIONS="-v" />
|
||||
<configuration PROFILE_NAME="pca10095" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pca10095 -DLOG=1 -DLOGGER=RTT -DTRACE_ETM=1" />
|
||||
<configuration PROFILE_NAME="metro m7 1011 sd" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m7_1011_sd -DLOG=1 -DLOGGER=RTT -DTRACE_ETM=1" />
|
||||
<configuration PROFILE_NAME="metro_m7_1011" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=metro_m7_1011 -DLOG=1 -DLOGGER=RTT" />
|
||||
|
1
.idea/vcs.xml
generated
1
.idea/vcs.xml
generated
@@ -2,5 +2,6 @@
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/hw/mcu/raspberry_pi/Pico-PIO-USB" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
6
examples/CMakePresets.json
Normal file
6
examples/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
@@ -6,7 +6,6 @@
|
||||
# Toolchain
|
||||
# Can be changed via TOOLCHAIN=gcc|iar or CC=arm-none-eabi-gcc|iccarm|clang
|
||||
#-------------------------------------------------------------
|
||||
|
||||
ifneq (,$(findstring clang,$(CC)))
|
||||
TOOLCHAIN = clang
|
||||
else ifneq (,$(findstring iccarm,$(CC)))
|
||||
@@ -65,7 +64,9 @@ BUILD := _build/$(BOARD)
|
||||
PROJECT := $(notdir $(CURDIR))
|
||||
BIN := $(TOP)/_bin/$(BOARD)/$(notdir $(CURDIR))
|
||||
|
||||
#-------------- Select the board to build for. ------------
|
||||
#-------------------------------------------------------------
|
||||
# Board / Family
|
||||
#-------------------------------------------------------------
|
||||
|
||||
# Board without family
|
||||
ifneq ($(wildcard $(TOP)/hw/bsp/$(BOARD)/board.mk),)
|
||||
@@ -93,7 +94,9 @@ else
|
||||
SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c))
|
||||
endif
|
||||
|
||||
#-------------- Source files and compiler flags --------------
|
||||
#-------------------------------------------------------------
|
||||
# Source files and compiler flags
|
||||
#-------------------------------------------------------------
|
||||
# tinyusb makefile
|
||||
include $(TOP)/src/tinyusb.mk
|
||||
SRC_C += $(TINYUSB_SRC_C)
|
||||
@@ -148,7 +151,37 @@ endif
|
||||
# toolchain specific
|
||||
include ${TOP}/examples/build_system/make/toolchain/arm_$(TOOLCHAIN).mk
|
||||
|
||||
# Handy check parameter function
|
||||
#---------------------- FreeRTOS -----------------------
|
||||
FREERTOS_SRC = lib/FreeRTOS-Kernel
|
||||
FREERTOS_PORTABLE_PATH = $(FREERTOS_SRC)/portable/$(if $(findstring iar,$(TOOLCHAIN)),IAR,GCC)
|
||||
|
||||
ifeq ($(RTOS),freertos)
|
||||
SRC_C += \
|
||||
$(FREERTOS_SRC)/list.c \
|
||||
$(FREERTOS_SRC)/queue.c \
|
||||
$(FREERTOS_SRC)/tasks.c \
|
||||
$(FREERTOS_SRC)/timers.c \
|
||||
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.c))
|
||||
|
||||
SRC_S += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.s))
|
||||
INC += \
|
||||
$(TOP)/hw/bsp/$(FAMILY)/FreeRTOSConfig \
|
||||
$(TOP)/$(FREERTOS_SRC)/include \
|
||||
$(TOP)/$(FREERTOS_PORTABLE_SRC)
|
||||
|
||||
CFLAGS += -DCFG_TUSB_OS=OPT_OS_FREERTOS
|
||||
|
||||
# Suppress FreeRTOSConfig.h warnings
|
||||
CFLAGS_GCC += -Wno-error=redundant-decls
|
||||
|
||||
# Suppress FreeRTOS source warnings
|
||||
CFLAGS_GCC += -Wno-error=cast-qual
|
||||
|
||||
# FreeRTOS (lto + Os) linker issue
|
||||
LDFLAGS_GCC += -Wl,--undefined=vTaskSwitchContext
|
||||
endif
|
||||
|
||||
#---------------- Helper ----------------
|
||||
check_defined = \
|
||||
$(strip $(foreach 1,$1, \
|
||||
$(call __check_defined,$1,$(strip $(value 2)))))
|
||||
|
6
examples/device/CMakePresets.json
Normal file
6
examples/device/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/audio_4_channel_mic/CMakePresets.json
Normal file
6
examples/device/audio_4_channel_mic/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
@@ -1,14 +1,9 @@
|
||||
RTOS = freertos
|
||||
include ../../build_system/make/make.mk
|
||||
|
||||
FREERTOS_SRC = lib/FreeRTOS-Kernel
|
||||
FREERTOS_PORTABLE_PATH = $(FREERTOS_SRC)/portable/$(if $(findstring iar,$(TOOLCHAIN)),IAR,GCC)
|
||||
|
||||
INC += \
|
||||
src \
|
||||
src/FreeRTOSConfig \
|
||||
$(TOP)/hw \
|
||||
$(TOP)/$(FREERTOS_SRC)/include \
|
||||
$(TOP)/$(FREERTOS_PORTABLE_SRC) \
|
||||
|
||||
# Example source
|
||||
EXAMPLE_SOURCE = \
|
||||
@@ -17,21 +12,4 @@ EXAMPLE_SOURCE = \
|
||||
|
||||
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
|
||||
|
||||
# FreeRTOS source, all files in port folder
|
||||
SRC_C += \
|
||||
$(FREERTOS_SRC)/list.c \
|
||||
$(FREERTOS_SRC)/queue.c \
|
||||
$(FREERTOS_SRC)/tasks.c \
|
||||
$(FREERTOS_SRC)/timers.c \
|
||||
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.c))
|
||||
|
||||
SRC_S += \
|
||||
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.s))
|
||||
|
||||
# Suppress FreeRTOS warnings
|
||||
CFLAGS += -Wno-error=cast-qual -Wno-error=redundant-decls
|
||||
|
||||
# FreeRTOS (lto + Os) linker issue
|
||||
LDFLAGS += -Wl,--undefined=vTaskSwitchContext
|
||||
|
||||
include ../../build_system/make/rules.mk
|
||||
|
@@ -1,191 +0,0 @@
|
||||
/*
|
||||
* FreeRTOS Kernel V10.0.0
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software. If you wish to use our Amazon
|
||||
* FreeRTOS name, please do so in a fair use way that does not cause confusion.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
// skip if included from IAR assembler
|
||||
#ifndef __IASMARM__
|
||||
|
||||
// Include MCU header
|
||||
#include "bsp/board_mcu.h"
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#error "ESP32-Sx should use IDF's FreeRTOSConfig.h"
|
||||
#endif
|
||||
|
||||
// TODO fix later
|
||||
#if CFG_TUSB_MCU == OPT_MCU_MM32F327X
|
||||
extern u32 SystemCoreClock;
|
||||
#else
|
||||
// FIXME cause redundant-decls warnings
|
||||
extern uint32_t SystemCoreClock;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Cortex M23/M33 port configuration. */
|
||||
#define configENABLE_MPU 0
|
||||
#define configENABLE_FPU 1
|
||||
#define configENABLE_TRUSTZONE 0
|
||||
#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
|
||||
#define configRUN_FREERTOS_SECURE_ONLY 1
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#define configCPU_CLOCK_HZ SystemCoreClock
|
||||
#define configTICK_RATE_HZ ( 1000 )
|
||||
#define configMAX_PRIORITIES ( 5 )
|
||||
#define configMINIMAL_STACK_SIZE ( 128 )
|
||||
#define configTOTAL_HEAP_SIZE ( configSUPPORT_DYNAMIC_ALLOCATION*4*1024 )
|
||||
#define configMAX_TASK_NAME_LEN 16
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 4
|
||||
#define configUSE_QUEUE_SETS 0
|
||||
#define configUSE_TIME_SLICING 0
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
|
||||
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 0
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0 // cause nested extern warning
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configCHECK_HANDLER_INSTALLATION 0
|
||||
|
||||
/* Run time and task stats gathering related definitions. */
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#define configUSE_TRACE_FACILITY 1 // legacy trace
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES 2
|
||||
|
||||
/* Software timer related definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES-2)
|
||||
#define configTIMER_QUEUE_LENGTH 32
|
||||
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
|
||||
|
||||
/* Optional functions - most linkers will remove unused functions anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 0
|
||||
#define INCLUDE_uxTaskPriorityGet 0
|
||||
#define INCLUDE_vTaskDelete 0
|
||||
#define INCLUDE_vTaskSuspend 1 // required for queue, semaphore, mutex to be blocked indefinitely with portMAX_DELAY
|
||||
#define INCLUDE_xResumeFromISR 0
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 0
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 0
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
|
||||
#define INCLUDE_pcTaskGetTaskName 0
|
||||
#define INCLUDE_eTaskGetState 0
|
||||
#define INCLUDE_xEventGroupSetBitFromISR 0
|
||||
#define INCLUDE_xTimerPendFunctionCall 0
|
||||
|
||||
#ifdef __RX__
|
||||
/* Renesas RX series */
|
||||
#define vSoftwareInterruptISR INT_Excep_ICU_SWINT
|
||||
#define vTickISR INT_Excep_CMT0_CMI0
|
||||
#define configPERIPHERAL_CLOCK_HZ (configCPU_CLOCK_HZ/2)
|
||||
#define configKERNEL_INTERRUPT_PRIORITY 1
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 4
|
||||
|
||||
#else
|
||||
|
||||
/* FreeRTOS hooks to NVIC vectors */
|
||||
#define xPortPendSVHandler PendSV_Handler
|
||||
#define xPortSysTickHandler SysTick_Handler
|
||||
#define vPortSVCHandler SVC_Handler
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Interrupt nesting behavior configuration.
|
||||
//--------------------------------------------------------------------+
|
||||
#if defined(__NVIC_PRIO_BITS)
|
||||
// For Cortex-M specific: __NVIC_PRIO_BITS is defined in core_cmx.h
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
|
||||
#elif defined(__ECLIC_INTCTLBITS)
|
||||
// RISC-V Bumblebee core from nuclei
|
||||
#define configPRIO_BITS __ECLIC_INTCTLBITS
|
||||
|
||||
#elif defined(__IASMARM__)
|
||||
// FIXME: IAR Assembler cannot include mcu header directly to get __NVIC_PRIO_BITS.
|
||||
// Therefore we will hard coded it to minimum value of 2 to get pass ci build.
|
||||
// IAR user must update this to correct value of the target MCU
|
||||
#message "configPRIO_BITS is hard coded to 2 to pass IAR build only. User should update it per MCU"
|
||||
#define configPRIO_BITS 2
|
||||
|
||||
#else
|
||||
#error "FreeRTOS configPRIO_BITS to be defined"
|
||||
#endif
|
||||
|
||||
/* The lowest interrupt priority that can be used in a call to a "set priority" function. */
|
||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1<<configPRIO_BITS) - 1)
|
||||
|
||||
/* The highest interrupt priority that can be used by any interrupt service
|
||||
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
|
||||
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
|
||||
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
|
||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __FREERTOS_CONFIG__H */
|
6
examples/device/audio_test/CMakePresets.json
Normal file
6
examples/device/audio_test/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/audio_test_freertos/CMakePresets.json
Normal file
6
examples/device/audio_test_freertos/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
@@ -1,14 +1,9 @@
|
||||
RTOS = freertos
|
||||
include ../../build_system/make/make.mk
|
||||
|
||||
FREERTOS_SRC = lib/FreeRTOS-Kernel
|
||||
FREERTOS_PORTABLE_PATH = $(FREERTOS_SRC)/portable/$(if $(findstring iar,$(TOOLCHAIN)),IAR,GCC)
|
||||
|
||||
INC += \
|
||||
src \
|
||||
src/FreeRTOSConfig \
|
||||
$(TOP)/hw \
|
||||
$(TOP)/$(FREERTOS_SRC)/include \
|
||||
$(TOP)/$(FREERTOS_PORTABLE_SRC) \
|
||||
|
||||
# Example source
|
||||
EXAMPLE_SOURCE = \
|
||||
@@ -17,21 +12,4 @@ EXAMPLE_SOURCE = \
|
||||
|
||||
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
|
||||
|
||||
# FreeRTOS source, all files in port folder
|
||||
SRC_C += \
|
||||
$(FREERTOS_SRC)/list.c \
|
||||
$(FREERTOS_SRC)/queue.c \
|
||||
$(FREERTOS_SRC)/tasks.c \
|
||||
$(FREERTOS_SRC)/timers.c \
|
||||
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.c))
|
||||
|
||||
SRC_S += \
|
||||
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.s))
|
||||
|
||||
# Suppress FreeRTOS warnings
|
||||
CFLAGS += -Wno-error=cast-qual -Wno-error=redundant-decls
|
||||
|
||||
# FreeRTOS (lto + Os) linker issue
|
||||
LDFLAGS += -Wl,--undefined=vTaskSwitchContext
|
||||
|
||||
include ../../build_system/make/rules.mk
|
||||
|
@@ -1,191 +0,0 @@
|
||||
/*
|
||||
* FreeRTOS Kernel V10.0.0
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software. If you wish to use our Amazon
|
||||
* FreeRTOS name, please do so in a fair use way that does not cause confusion.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
// skip if included from IAR assembler
|
||||
#ifndef __IASMARM__
|
||||
|
||||
// Include MCU header
|
||||
#include "bsp/board_mcu.h"
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#error "ESP32-Sx should use IDF's FreeRTOSConfig.h"
|
||||
#endif
|
||||
|
||||
// TODO fix later
|
||||
#if CFG_TUSB_MCU == OPT_MCU_MM32F327X
|
||||
extern u32 SystemCoreClock;
|
||||
#else
|
||||
// FIXME cause redundant-decls warnings
|
||||
extern uint32_t SystemCoreClock;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Cortex M23/M33 port configuration. */
|
||||
#define configENABLE_MPU 0
|
||||
#define configENABLE_FPU 1
|
||||
#define configENABLE_TRUSTZONE 0
|
||||
#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
|
||||
#define configRUN_FREERTOS_SECURE_ONLY 1
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#define configCPU_CLOCK_HZ SystemCoreClock
|
||||
#define configTICK_RATE_HZ ( 1000 )
|
||||
#define configMAX_PRIORITIES ( 5 )
|
||||
#define configMINIMAL_STACK_SIZE ( 128 )
|
||||
#define configTOTAL_HEAP_SIZE ( configSUPPORT_DYNAMIC_ALLOCATION*4*1024 )
|
||||
#define configMAX_TASK_NAME_LEN 16
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 4
|
||||
#define configUSE_QUEUE_SETS 0
|
||||
#define configUSE_TIME_SLICING 0
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
|
||||
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 0
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0 // cause nested extern warning
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configCHECK_HANDLER_INSTALLATION 0
|
||||
|
||||
/* Run time and task stats gathering related definitions. */
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#define configUSE_TRACE_FACILITY 1 // legacy trace
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES 2
|
||||
|
||||
/* Software timer related definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES-2)
|
||||
#define configTIMER_QUEUE_LENGTH 32
|
||||
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
|
||||
|
||||
/* Optional functions - most linkers will remove unused functions anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 0
|
||||
#define INCLUDE_uxTaskPriorityGet 0
|
||||
#define INCLUDE_vTaskDelete 0
|
||||
#define INCLUDE_vTaskSuspend 1 // required for queue, semaphore, mutex to be blocked indefinitely with portMAX_DELAY
|
||||
#define INCLUDE_xResumeFromISR 0
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 0
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 0
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
|
||||
#define INCLUDE_pcTaskGetTaskName 0
|
||||
#define INCLUDE_eTaskGetState 0
|
||||
#define INCLUDE_xEventGroupSetBitFromISR 0
|
||||
#define INCLUDE_xTimerPendFunctionCall 0
|
||||
|
||||
#ifdef __RX__
|
||||
/* Renesas RX series */
|
||||
#define vSoftwareInterruptISR INT_Excep_ICU_SWINT
|
||||
#define vTickISR INT_Excep_CMT0_CMI0
|
||||
#define configPERIPHERAL_CLOCK_HZ (configCPU_CLOCK_HZ/2)
|
||||
#define configKERNEL_INTERRUPT_PRIORITY 1
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 4
|
||||
|
||||
#else
|
||||
|
||||
/* FreeRTOS hooks to NVIC vectors */
|
||||
#define xPortPendSVHandler PendSV_Handler
|
||||
#define xPortSysTickHandler SysTick_Handler
|
||||
#define vPortSVCHandler SVC_Handler
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Interrupt nesting behavior configuration.
|
||||
//--------------------------------------------------------------------+
|
||||
#if defined(__NVIC_PRIO_BITS)
|
||||
// For Cortex-M specific: __NVIC_PRIO_BITS is defined in core_cmx.h
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
|
||||
#elif defined(__ECLIC_INTCTLBITS)
|
||||
// RISC-V Bumblebee core from nuclei
|
||||
#define configPRIO_BITS __ECLIC_INTCTLBITS
|
||||
|
||||
#elif defined(__IASMARM__)
|
||||
// FIXME: IAR Assembler cannot include mcu header directly to get __NVIC_PRIO_BITS.
|
||||
// Therefore we will hard coded it to minimum value of 2 to get pass ci build.
|
||||
// IAR user must update this to correct value of the target MCU
|
||||
#message "configPRIO_BITS is hard coded to 2 to pass IAR build only. User should update it per MCU"
|
||||
#define configPRIO_BITS 2
|
||||
|
||||
#else
|
||||
#error "FreeRTOS configPRIO_BITS to be defined"
|
||||
#endif
|
||||
|
||||
/* The lowest interrupt priority that can be used in a call to a "set priority" function. */
|
||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1<<configPRIO_BITS) - 1)
|
||||
|
||||
/* The highest interrupt priority that can be used by any interrupt service
|
||||
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
|
||||
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
|
||||
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
|
||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __FREERTOS_CONFIG__H */
|
6
examples/device/audio_test_multi_rate/CMakePresets.json
Normal file
6
examples/device/audio_test_multi_rate/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/board_test/CMakePresets.json
Normal file
6
examples/device/board_test/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/cdc_dual_ports/CMakePresets.json
Normal file
6
examples/device/cdc_dual_ports/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/cdc_msc/CMakePresets.json
Normal file
6
examples/device/cdc_msc/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/cdc_msc_freertos/CMakePresets.json
Normal file
6
examples/device/cdc_msc_freertos/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
@@ -1,14 +1,9 @@
|
||||
RTOS = freertos
|
||||
include ../../build_system/make/make.mk
|
||||
|
||||
FREERTOS_SRC = lib/FreeRTOS-Kernel
|
||||
FREERTOS_PORTABLE_PATH = $(FREERTOS_SRC)/portable/$(if $(findstring iar,$(TOOLCHAIN)),IAR,GCC)
|
||||
|
||||
INC += \
|
||||
src \
|
||||
src/FreeRTOSConfig \
|
||||
$(TOP)/hw \
|
||||
$(TOP)/$(FREERTOS_SRC)/include \
|
||||
$(TOP)/$(FREERTOS_PORTABLE_SRC) \
|
||||
|
||||
# Example source
|
||||
EXAMPLE_SOURCE = \
|
||||
@@ -18,28 +13,4 @@ EXAMPLE_SOURCE = \
|
||||
|
||||
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
|
||||
|
||||
# FreeRTOS source, all files in port folder
|
||||
SRC_C += \
|
||||
$(FREERTOS_SRC)/list.c \
|
||||
$(FREERTOS_SRC)/queue.c \
|
||||
$(FREERTOS_SRC)/tasks.c \
|
||||
$(FREERTOS_SRC)/timers.c \
|
||||
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.c))
|
||||
|
||||
SRC_S += \
|
||||
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.s))
|
||||
|
||||
# include heap manage if configSUPPORT_DYNAMIC_ALLOCATION = 1
|
||||
# SRC_C += $(FREERTOS_SRC)/portable/MemMang/heap_1.c
|
||||
# CFLAGS += -Wno-error=sign-compare
|
||||
|
||||
# Suppress FreeRTOSConfig.h warnings
|
||||
CFLAGS_GCC += -Wno-error=redundant-decls
|
||||
|
||||
# Suppress FreeRTOS source warnings
|
||||
CFLAGS_GCC += -Wno-error=cast-qual
|
||||
|
||||
# FreeRTOS (lto + Os) linker issue
|
||||
LDFLAGS_GCC += -Wl,--undefined=vTaskSwitchContext
|
||||
|
||||
include ../../build_system/make/rules.mk
|
||||
|
@@ -1,191 +0,0 @@
|
||||
/*
|
||||
* FreeRTOS Kernel V10.0.0
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software. If you wish to use our Amazon
|
||||
* FreeRTOS name, please do so in a fair use way that does not cause confusion.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
// skip if included from IAR assembler
|
||||
#ifndef __IASMARM__
|
||||
|
||||
// Include MCU header
|
||||
#include "bsp/board_mcu.h"
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#error "ESP32-Sx should use IDF's FreeRTOSConfig.h"
|
||||
#endif
|
||||
|
||||
// TODO fix later
|
||||
#if CFG_TUSB_MCU == OPT_MCU_MM32F327X
|
||||
extern u32 SystemCoreClock;
|
||||
#else
|
||||
// FIXME cause redundant-decls warnings
|
||||
extern uint32_t SystemCoreClock;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Cortex M23/M33 port configuration. */
|
||||
#define configENABLE_MPU 0
|
||||
#define configENABLE_FPU 1
|
||||
#define configENABLE_TRUSTZONE 0
|
||||
#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
|
||||
#define configRUN_FREERTOS_SECURE_ONLY 1
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#define configCPU_CLOCK_HZ SystemCoreClock
|
||||
#define configTICK_RATE_HZ ( 1000 )
|
||||
#define configMAX_PRIORITIES ( 5 )
|
||||
#define configMINIMAL_STACK_SIZE ( 128 )
|
||||
#define configTOTAL_HEAP_SIZE ( configSUPPORT_DYNAMIC_ALLOCATION*4*1024 )
|
||||
#define configMAX_TASK_NAME_LEN 16
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 4
|
||||
#define configUSE_QUEUE_SETS 0
|
||||
#define configUSE_TIME_SLICING 0
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
|
||||
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 0
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0 // cause nested extern warning
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configCHECK_HANDLER_INSTALLATION 0
|
||||
|
||||
/* Run time and task stats gathering related definitions. */
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#define configUSE_TRACE_FACILITY 1 // legacy trace
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES 2
|
||||
|
||||
/* Software timer related definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES-2)
|
||||
#define configTIMER_QUEUE_LENGTH 32
|
||||
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
|
||||
|
||||
/* Optional functions - most linkers will remove unused functions anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 0
|
||||
#define INCLUDE_uxTaskPriorityGet 0
|
||||
#define INCLUDE_vTaskDelete 0
|
||||
#define INCLUDE_vTaskSuspend 1 // required for queue, semaphore, mutex to be blocked indefinitely with portMAX_DELAY
|
||||
#define INCLUDE_xResumeFromISR 0
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 0
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 0
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
|
||||
#define INCLUDE_pcTaskGetTaskName 0
|
||||
#define INCLUDE_eTaskGetState 0
|
||||
#define INCLUDE_xEventGroupSetBitFromISR 0
|
||||
#define INCLUDE_xTimerPendFunctionCall 0
|
||||
|
||||
#ifdef __RX__
|
||||
/* Renesas RX series */
|
||||
#define vSoftwareInterruptISR INT_Excep_ICU_SWINT
|
||||
#define vTickISR INT_Excep_CMT0_CMI0
|
||||
#define configPERIPHERAL_CLOCK_HZ (configCPU_CLOCK_HZ/2)
|
||||
#define configKERNEL_INTERRUPT_PRIORITY 1
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 4
|
||||
|
||||
#else
|
||||
|
||||
/* FreeRTOS hooks to NVIC vectors */
|
||||
#define xPortPendSVHandler PendSV_Handler
|
||||
#define xPortSysTickHandler SysTick_Handler
|
||||
#define vPortSVCHandler SVC_Handler
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Interrupt nesting behavior configuration.
|
||||
//--------------------------------------------------------------------+
|
||||
#if defined(__NVIC_PRIO_BITS)
|
||||
// For Cortex-M specific: __NVIC_PRIO_BITS is defined in core_cmx.h
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
|
||||
#elif defined(__ECLIC_INTCTLBITS)
|
||||
// RISC-V Bumblebee core from nuclei
|
||||
#define configPRIO_BITS __ECLIC_INTCTLBITS
|
||||
|
||||
#elif defined(__IASMARM__)
|
||||
// FIXME: IAR Assembler cannot include mcu header directly to get __NVIC_PRIO_BITS.
|
||||
// Therefore we will hard coded it to minimum value of 2 to get pass ci build.
|
||||
// IAR user must update this to correct value of the target MCU
|
||||
#message "configPRIO_BITS is hard coded to 2 to pass IAR build only. User should update it per MCU"
|
||||
#define configPRIO_BITS 2
|
||||
|
||||
#else
|
||||
#error "FreeRTOS configPRIO_BITS to be defined"
|
||||
#endif
|
||||
|
||||
/* The lowest interrupt priority that can be used in a call to a "set priority" function. */
|
||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1<<configPRIO_BITS) - 1)
|
||||
|
||||
/* The highest interrupt priority that can be used by any interrupt service
|
||||
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
|
||||
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
|
||||
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
|
||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __FREERTOS_CONFIG__H */
|
6
examples/device/cdc_uac2/CMakePresets.json
Normal file
6
examples/device/cdc_uac2/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/dfu/CMakePresets.json
Normal file
6
examples/device/dfu/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/dfu_runtime/CMakePresets.json
Normal file
6
examples/device/dfu_runtime/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/dynamic_configuration/CMakePresets.json
Normal file
6
examples/device/dynamic_configuration/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/hid_boot_interface/CMakePresets.json
Normal file
6
examples/device/hid_boot_interface/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/hid_composite/CMakePresets.json
Normal file
6
examples/device/hid_composite/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
@@ -197,11 +197,43 @@ static void send_hid_report(uint8_t report_id, uint32_t btn)
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
/* use this to send stylus touch signal through USB. */
|
||||
static void send_stylus_touch(uint16_t x, uint16_t y, bool state)
|
||||
{
|
||||
// skip if hid is not ready yet
|
||||
if ( !tud_hid_ready() ) return;
|
||||
|
||||
static bool has_stylus_pen = false;
|
||||
|
||||
hid_stylus_report_t report =
|
||||
{
|
||||
.attr = 0,
|
||||
.x = 0,
|
||||
.y = 0
|
||||
};
|
||||
|
||||
report.x = x;
|
||||
report.y = y;
|
||||
|
||||
if (state)
|
||||
{
|
||||
report.attr = STYLUS_ATTR_TIP_SWITCH | STYLUS_ATTR_IN_RANGE;
|
||||
tud_hid_report(REPORT_ID_STYLUS_PEN, &report, sizeof(report));
|
||||
|
||||
has_stylus_pen = true;
|
||||
}else
|
||||
{
|
||||
report.attr = 0;
|
||||
if (has_stylus_pen) tud_hid_report(REPORT_ID_STYLUS_PEN, &report, sizeof(report));
|
||||
has_stylus_pen = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Every 10ms, we will sent 1 report for each HID profile (keyboard, mouse etc ..)
|
||||
// tud_hid_report_complete_cb() is used to send the next report after previous one is complete
|
||||
void hid_task(void)
|
||||
@@ -209,6 +241,14 @@ void hid_task(void)
|
||||
// Poll every 10ms
|
||||
const uint32_t interval_ms = 10;
|
||||
static uint32_t start_ms = 0;
|
||||
static uint32_t touch_ms = 0;
|
||||
static bool touch_state = false;
|
||||
|
||||
if (board_millis() - touch_ms < 100) {
|
||||
touch_ms = board_millis();
|
||||
send_stylus_touch(0, 0, touch_state = !touch_state);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( board_millis() - start_ms < interval_ms) return; // not enough time
|
||||
start_ms += interval_ms;
|
||||
|
@@ -79,6 +79,7 @@ uint8_t const desc_hid_report[] =
|
||||
{
|
||||
TUD_HID_REPORT_DESC_KEYBOARD( HID_REPORT_ID(REPORT_ID_KEYBOARD )),
|
||||
TUD_HID_REPORT_DESC_MOUSE ( HID_REPORT_ID(REPORT_ID_MOUSE )),
|
||||
TUD_HID_REPORT_DESC_STYLUS_PEN( HID_REPORT_ID(REPORT_ID_STYLUS_PEN )),
|
||||
TUD_HID_REPORT_DESC_CONSUMER( HID_REPORT_ID(REPORT_ID_CONSUMER_CONTROL )),
|
||||
TUD_HID_REPORT_DESC_GAMEPAD ( HID_REPORT_ID(REPORT_ID_GAMEPAD ))
|
||||
};
|
||||
|
@@ -29,6 +29,7 @@ enum
|
||||
{
|
||||
REPORT_ID_KEYBOARD = 1,
|
||||
REPORT_ID_MOUSE,
|
||||
REPORT_ID_STYLUS_PEN,
|
||||
REPORT_ID_CONSUMER_CONTROL,
|
||||
REPORT_ID_GAMEPAD,
|
||||
REPORT_ID_COUNT
|
||||
|
6
examples/device/hid_composite_freertos/CMakePresets.json
Normal file
6
examples/device/hid_composite_freertos/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
@@ -1,16 +1,9 @@
|
||||
DEPS_SUBMODULES += lib/FreeRTOS-Kernel
|
||||
|
||||
RTOS = freertos
|
||||
include ../../build_system/make/make.mk
|
||||
|
||||
FREERTOS_SRC = lib/FreeRTOS-Kernel
|
||||
FREERTOS_PORTABLE_PATH= $(FREERTOS_SRC)/portable/$(if $(findstring iar,$(TOOLCHAIN)),IAR,GCC)
|
||||
|
||||
INC += \
|
||||
src \
|
||||
src/FreeRTOSConfig \
|
||||
$(TOP)/hw \
|
||||
$(TOP)/$(FREERTOS_SRC)/include \
|
||||
$(TOP)/$(FREERTOS_PORTABLE_SRC)
|
||||
|
||||
# Example source
|
||||
EXAMPLE_SOURCE = \
|
||||
@@ -19,28 +12,4 @@ EXAMPLE_SOURCE = \
|
||||
|
||||
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
|
||||
|
||||
# FreeRTOS source, all files in port folder
|
||||
SRC_C += \
|
||||
$(FREERTOS_SRC)/list.c \
|
||||
$(FREERTOS_SRC)/queue.c \
|
||||
$(FREERTOS_SRC)/tasks.c \
|
||||
$(FREERTOS_SRC)/timers.c \
|
||||
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.c))
|
||||
|
||||
SRC_S += \
|
||||
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.s))
|
||||
|
||||
# include heap manage if configSUPPORT_DYNAMIC_ALLOCATION = 1
|
||||
# SRC_C += $(FREERTOS_SRC)/portable/MemMang/heap_1.c
|
||||
# CFLAGS += -Wno-error=sign-compare
|
||||
|
||||
# Suppress FreeRTOSConfig.h warnings
|
||||
CFLAGS_GCC += -Wno-error=redundant-decls
|
||||
|
||||
# Suppress FreeRTOS source warnings
|
||||
CFLAGS_GCC += -Wno-error=cast-qual
|
||||
|
||||
# FreeRTOS (lto + Os) linker issue
|
||||
LDFLAGS_GCC += -Wl,--undefined=vTaskSwitchContext
|
||||
|
||||
include ../../build_system/make/rules.mk
|
||||
|
@@ -1,191 +0,0 @@
|
||||
/*
|
||||
* FreeRTOS Kernel V10.0.0
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software. If you wish to use our Amazon
|
||||
* FreeRTOS name, please do so in a fair use way that does not cause confusion.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
// skip if included from IAR assembler
|
||||
#ifndef __IASMARM__
|
||||
|
||||
// Include MCU header
|
||||
#include "bsp/board_mcu.h"
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#error "ESP32-Sx should use IDF's FreeRTOSConfig.h"
|
||||
#endif
|
||||
|
||||
// TODO fix later
|
||||
#if CFG_TUSB_MCU == OPT_MCU_MM32F327X
|
||||
extern u32 SystemCoreClock;
|
||||
#else
|
||||
// FIXME cause redundant-decls warnings
|
||||
extern uint32_t SystemCoreClock;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Cortex M23/M33 port configuration. */
|
||||
#define configENABLE_MPU 0
|
||||
#define configENABLE_FPU 1
|
||||
#define configENABLE_TRUSTZONE 0
|
||||
#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
|
||||
#define configRUN_FREERTOS_SECURE_ONLY 1
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#define configCPU_CLOCK_HZ SystemCoreClock
|
||||
#define configTICK_RATE_HZ ( 1000 )
|
||||
#define configMAX_PRIORITIES ( 5 )
|
||||
#define configMINIMAL_STACK_SIZE ( 128 )
|
||||
#define configTOTAL_HEAP_SIZE ( configSUPPORT_DYNAMIC_ALLOCATION*4*1024 )
|
||||
#define configMAX_TASK_NAME_LEN 16
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 4
|
||||
#define configUSE_QUEUE_SETS 0
|
||||
#define configUSE_TIME_SLICING 0
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
|
||||
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 0
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0 // cause nested extern warning
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configCHECK_HANDLER_INSTALLATION 0
|
||||
|
||||
/* Run time and task stats gathering related definitions. */
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#define configUSE_TRACE_FACILITY 1 // legacy trace
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES 2
|
||||
|
||||
/* Software timer related definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES-2)
|
||||
#define configTIMER_QUEUE_LENGTH 32
|
||||
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
|
||||
|
||||
/* Optional functions - most linkers will remove unused functions anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 0
|
||||
#define INCLUDE_uxTaskPriorityGet 0
|
||||
#define INCLUDE_vTaskDelete 0
|
||||
#define INCLUDE_vTaskSuspend 1 // required for queue, semaphore, mutex to be blocked indefinitely with portMAX_DELAY
|
||||
#define INCLUDE_xResumeFromISR 0
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 0
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 0
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
|
||||
#define INCLUDE_pcTaskGetTaskName 0
|
||||
#define INCLUDE_eTaskGetState 0
|
||||
#define INCLUDE_xEventGroupSetBitFromISR 0
|
||||
#define INCLUDE_xTimerPendFunctionCall 0
|
||||
|
||||
#ifdef __RX__
|
||||
/* Renesas RX series */
|
||||
#define vSoftwareInterruptISR INT_Excep_ICU_SWINT
|
||||
#define vTickISR INT_Excep_CMT0_CMI0
|
||||
#define configPERIPHERAL_CLOCK_HZ (configCPU_CLOCK_HZ/2)
|
||||
#define configKERNEL_INTERRUPT_PRIORITY 1
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 4
|
||||
|
||||
#else
|
||||
|
||||
/* FreeRTOS hooks to NVIC vectors */
|
||||
#define xPortPendSVHandler PendSV_Handler
|
||||
#define xPortSysTickHandler SysTick_Handler
|
||||
#define vPortSVCHandler SVC_Handler
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Interrupt nesting behavior configuration.
|
||||
//--------------------------------------------------------------------+
|
||||
#if defined(__NVIC_PRIO_BITS)
|
||||
// For Cortex-M specific: __NVIC_PRIO_BITS is defined in core_cmx.h
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
|
||||
#elif defined(__ECLIC_INTCTLBITS)
|
||||
// RISC-V Bumblebee core from nuclei
|
||||
#define configPRIO_BITS __ECLIC_INTCTLBITS
|
||||
|
||||
#elif defined(__IASMARM__)
|
||||
// FIXME: IAR Assembler cannot include mcu header directly to get __NVIC_PRIO_BITS.
|
||||
// Therefore we will hard coded it to minimum value of 2 to get pass ci build.
|
||||
// IAR user must update this to correct value of the target MCU
|
||||
#message "configPRIO_BITS is hard coded to 2 to pass IAR build only. User should update it per MCU"
|
||||
#define configPRIO_BITS 2
|
||||
|
||||
#else
|
||||
#error "FreeRTOS configPRIO_BITS to be defined"
|
||||
#endif
|
||||
|
||||
/* The lowest interrupt priority that can be used in a call to a "set priority" function. */
|
||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1<<configPRIO_BITS) - 1)
|
||||
|
||||
/* The highest interrupt priority that can be used by any interrupt service
|
||||
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
|
||||
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
|
||||
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
|
||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __FREERTOS_CONFIG__H */
|
6
examples/device/hid_generic_inout/CMakePresets.json
Normal file
6
examples/device/hid_generic_inout/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/hid_multiple_interface/CMakePresets.json
Normal file
6
examples/device/hid_multiple_interface/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/midi_test/CMakePresets.json
Normal file
6
examples/device/midi_test/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/midi_test_freertos/CMakePresets.json
Normal file
6
examples/device/midi_test_freertos/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
@@ -1,14 +1,9 @@
|
||||
RTOS = freertos
|
||||
include ../../build_system/make/make.mk
|
||||
|
||||
FREERTOS_SRC = lib/FreeRTOS-Kernel
|
||||
FREERTOS_PORTABLE_PATH = $(FREERTOS_SRC)/portable/$(if $(findstring iar,$(TOOLCHAIN)),IAR,GCC)
|
||||
|
||||
INC += \
|
||||
src \
|
||||
$(TOP)/hw \
|
||||
${TOP}/${FAMILY_PATH}/FreeRTOSConfig \
|
||||
$(TOP)/$(FREERTOS_SRC)/include \
|
||||
$(TOP)/$(FREERTOS_PORTABLE_SRC) \
|
||||
|
||||
# Example source
|
||||
EXAMPLE_SOURCE += \
|
||||
@@ -17,24 +12,4 @@ EXAMPLE_SOURCE += \
|
||||
|
||||
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
|
||||
|
||||
# FreeRTOS source, all files in port folder
|
||||
SRC_C += \
|
||||
$(FREERTOS_SRC)/list.c \
|
||||
$(FREERTOS_SRC)/queue.c \
|
||||
$(FREERTOS_SRC)/tasks.c \
|
||||
$(FREERTOS_SRC)/timers.c \
|
||||
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.c))
|
||||
|
||||
SRC_S += \
|
||||
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.s))
|
||||
|
||||
# Suppress FreeRTOSConfig.h warnings
|
||||
CFLAGS_GCC += -Wno-error=redundant-decls
|
||||
|
||||
# Suppress FreeRTOS source warnings
|
||||
CFLAGS_GCC += -Wno-error=cast-qual
|
||||
|
||||
# FreeRTOS (lto + Os) linker issue
|
||||
LDFLAGS_GCC += -Wl,--undefined=vTaskSwitchContext
|
||||
|
||||
include ../../build_system/make/rules.mk
|
||||
|
6
examples/device/msc_dual_lun/CMakePresets.json
Normal file
6
examples/device/msc_dual_lun/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/net_lwip_webserver/CMakePresets.json
Normal file
6
examples/device/net_lwip_webserver/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/uac2_headset/CMakePresets.json
Normal file
6
examples/device/uac2_headset/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/uac2_speaker_fb/CMakePresets.json
Normal file
6
examples/device/uac2_speaker_fb/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/usbtmc/CMakePresets.json
Normal file
6
examples/device/usbtmc/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/video_capture/CMakePresets.json
Normal file
6
examples/device/video_capture/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/video_capture_2ch/CMakePresets.json
Normal file
6
examples/device/video_capture_2ch/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/device/webusb_serial/CMakePresets.json
Normal file
6
examples/device/webusb_serial/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/dual/CMakePresets.json
Normal file
6
examples/dual/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/dual/host_hid_to_device_cdc/CMakePresets.json
Normal file
6
examples/dual/host_hid_to_device_cdc/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/dual/host_info_to_device_cdc/CMakePresets.json
Normal file
6
examples/dual/host_info_to_device_cdc/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
@@ -11,4 +11,5 @@ family_add_subdirectory(cdc_msc_hid)
|
||||
family_add_subdirectory(cdc_msc_hid_freertos)
|
||||
family_add_subdirectory(device_info)
|
||||
family_add_subdirectory(hid_controller)
|
||||
family_add_subdirectory(midi_rx)
|
||||
family_add_subdirectory(msc_file_explorer)
|
||||
|
6
examples/host/CMakePresets.json
Normal file
6
examples/host/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/host/bare_api/CMakePresets.json
Normal file
6
examples/host/bare_api/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
@@ -69,9 +69,10 @@
|
||||
// Enable Host stack
|
||||
#define CFG_TUH_ENABLED 1
|
||||
|
||||
// #define CFG_TUH_MAX3421 1 // use max3421 as host controller
|
||||
|
||||
#if CFG_TUSB_MCU == OPT_MCU_RP2040
|
||||
// #define CFG_TUH_RPI_PIO_USB 1 // use pio-usb as host controller
|
||||
// #define CFG_TUH_MAX3421 1 // use max3421 as host controller
|
||||
|
||||
// host roothub port is 1 if using either pio-usb or max3421
|
||||
#if (defined(CFG_TUH_RPI_PIO_USB) && CFG_TUH_RPI_PIO_USB) || (defined(CFG_TUH_MAX3421) && CFG_TUH_MAX3421)
|
||||
|
6
examples/host/cdc_msc_hid/CMakePresets.json
Normal file
6
examples/host/cdc_msc_hid/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
@@ -39,18 +39,16 @@
|
||||
static uint8_t const keycode2ascii[128][2] = { HID_KEYCODE_TO_ASCII };
|
||||
|
||||
// Each HID instance can has multiple reports
|
||||
static struct
|
||||
{
|
||||
static struct {
|
||||
uint8_t report_count;
|
||||
tuh_hid_report_info_t report_info[MAX_REPORT];
|
||||
}hid_info[CFG_TUH_HID];
|
||||
} hid_info[CFG_TUH_HID];
|
||||
|
||||
static void process_kbd_report(hid_keyboard_report_t const *report);
|
||||
static void process_mouse_report(hid_mouse_report_t const * report);
|
||||
static void process_generic_report(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len);
|
||||
|
||||
void hid_app_task(void)
|
||||
{
|
||||
void hid_app_task(void) {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
@@ -63,53 +61,47 @@ void hid_app_task(void)
|
||||
// can be used to parse common/simple enough descriptor.
|
||||
// Note: if report descriptor length > CFG_TUH_ENUMERATION_BUFSIZE, it will be skipped
|
||||
// therefore report_desc = NULL, desc_len = 0
|
||||
void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_report, uint16_t desc_len)
|
||||
{
|
||||
void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const *desc_report, uint16_t desc_len) {
|
||||
printf("HID device address = %d, instance = %d is mounted\r\n", dev_addr, instance);
|
||||
|
||||
// Interface protocol (hid_interface_protocol_enum_t)
|
||||
const char* protocol_str[] = { "None", "Keyboard", "Mouse" };
|
||||
const char *protocol_str[] = {"None", "Keyboard", "Mouse"};
|
||||
uint8_t const itf_protocol = tuh_hid_interface_protocol(dev_addr, instance);
|
||||
|
||||
printf("HID Interface Protocol = %s\r\n", protocol_str[itf_protocol]);
|
||||
|
||||
// By default host stack will use activate boot protocol on supported interface.
|
||||
// Therefore for this simple example, we only need to parse generic report descriptor (with built-in parser)
|
||||
if ( itf_protocol == HID_ITF_PROTOCOL_NONE )
|
||||
{
|
||||
if (itf_protocol == HID_ITF_PROTOCOL_NONE) {
|
||||
hid_info[instance].report_count = tuh_hid_parse_report_descriptor(hid_info[instance].report_info, MAX_REPORT, desc_report, desc_len);
|
||||
printf("HID has %u reports \r\n", hid_info[instance].report_count);
|
||||
}
|
||||
|
||||
// request to receive report
|
||||
// tuh_hid_report_received_cb() will be invoked when report is available
|
||||
if ( !tuh_hid_receive_report(dev_addr, instance) )
|
||||
{
|
||||
if (!tuh_hid_receive_report(dev_addr, instance)) {
|
||||
printf("Error: cannot request to receive report\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
// Invoked when device with hid interface is un-mounted
|
||||
void tuh_hid_umount_cb(uint8_t dev_addr, uint8_t instance)
|
||||
{
|
||||
void tuh_hid_umount_cb(uint8_t dev_addr, uint8_t instance) {
|
||||
printf("HID device address = %d, instance = %d is unmounted\r\n", dev_addr, instance);
|
||||
}
|
||||
|
||||
// Invoked when received report from device via interrupt endpoint
|
||||
void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len)
|
||||
{
|
||||
void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t const *report, uint16_t len) {
|
||||
uint8_t const itf_protocol = tuh_hid_interface_protocol(dev_addr, instance);
|
||||
|
||||
switch (itf_protocol)
|
||||
{
|
||||
switch (itf_protocol) {
|
||||
case HID_ITF_PROTOCOL_KEYBOARD:
|
||||
TU_LOG2("HID receive boot keyboard report\r\n");
|
||||
process_kbd_report( (hid_keyboard_report_t const*) report );
|
||||
process_kbd_report((hid_keyboard_report_t const *) report);
|
||||
break;
|
||||
|
||||
case HID_ITF_PROTOCOL_MOUSE:
|
||||
TU_LOG2("HID receive boot mouse report\r\n");
|
||||
process_mouse_report( (hid_mouse_report_t const*) report );
|
||||
process_mouse_report((hid_mouse_report_t const *) report);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -119,8 +111,7 @@ void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t cons
|
||||
}
|
||||
|
||||
// continue to request to receive report
|
||||
if ( !tuh_hid_receive_report(dev_addr, instance) )
|
||||
{
|
||||
if (!tuh_hid_receive_report(dev_addr, instance)) {
|
||||
printf("Error: cannot request to receive report\r\n");
|
||||
}
|
||||
}
|
||||
@@ -231,29 +222,24 @@ static void process_mouse_report(hid_mouse_report_t const * report)
|
||||
//--------------------------------------------------------------------+
|
||||
// Generic Report
|
||||
//--------------------------------------------------------------------+
|
||||
static void process_generic_report(uint8_t dev_addr, uint8_t instance, uint8_t const* report, uint16_t len)
|
||||
{
|
||||
static void process_generic_report(uint8_t dev_addr, uint8_t instance, uint8_t const *report, uint16_t len) {
|
||||
(void) dev_addr;
|
||||
(void) len;
|
||||
|
||||
uint8_t const rpt_count = hid_info[instance].report_count;
|
||||
tuh_hid_report_info_t* rpt_info_arr = hid_info[instance].report_info;
|
||||
tuh_hid_report_info_t* rpt_info = NULL;
|
||||
tuh_hid_report_info_t *rpt_info_arr = hid_info[instance].report_info;
|
||||
tuh_hid_report_info_t *rpt_info = NULL;
|
||||
|
||||
if ( rpt_count == 1 && rpt_info_arr[0].report_id == 0)
|
||||
{
|
||||
if (rpt_count == 1 && rpt_info_arr[0].report_id == 0) {
|
||||
// Simple report without report ID as 1st byte
|
||||
rpt_info = &rpt_info_arr[0];
|
||||
}else
|
||||
{
|
||||
} else {
|
||||
// Composite report, 1st byte is report ID, data starts from 2nd byte
|
||||
uint8_t const rpt_id = report[0];
|
||||
|
||||
// Find report id in the array
|
||||
for(uint8_t i=0; i<rpt_count; i++)
|
||||
{
|
||||
if (rpt_id == rpt_info_arr[i].report_id )
|
||||
{
|
||||
for (uint8_t i = 0; i < rpt_count; i++) {
|
||||
if (rpt_id == rpt_info_arr[i].report_id) {
|
||||
rpt_info = &rpt_info_arr[i];
|
||||
break;
|
||||
}
|
||||
@@ -263,8 +249,7 @@ static void process_generic_report(uint8_t dev_addr, uint8_t instance, uint8_t c
|
||||
len--;
|
||||
}
|
||||
|
||||
if (!rpt_info)
|
||||
{
|
||||
if (!rpt_info) {
|
||||
printf("Couldn't find report info !\r\n");
|
||||
return;
|
||||
}
|
||||
@@ -276,23 +261,22 @@ static void process_generic_report(uint8_t dev_addr, uint8_t instance, uint8_t c
|
||||
// - Consumer Control (Media Key) : Consumer, Consumer Control
|
||||
// - System Control (Power key) : Desktop, System Control
|
||||
// - Generic (vendor) : 0xFFxx, xx
|
||||
if ( rpt_info->usage_page == HID_USAGE_PAGE_DESKTOP )
|
||||
{
|
||||
switch (rpt_info->usage)
|
||||
{
|
||||
if (rpt_info->usage_page == HID_USAGE_PAGE_DESKTOP) {
|
||||
switch (rpt_info->usage) {
|
||||
case HID_USAGE_DESKTOP_KEYBOARD:
|
||||
TU_LOG1("HID receive keyboard report\r\n");
|
||||
// Assume keyboard follow boot report layout
|
||||
process_kbd_report( (hid_keyboard_report_t const*) report );
|
||||
process_kbd_report((hid_keyboard_report_t const *) report);
|
||||
break;
|
||||
|
||||
case HID_USAGE_DESKTOP_MOUSE:
|
||||
TU_LOG1("HID receive mouse report\r\n");
|
||||
// Assume mouse follow boot report layout
|
||||
process_mouse_report( (hid_mouse_report_t const*) report );
|
||||
process_mouse_report((hid_mouse_report_t const *) report);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -82,12 +82,12 @@ int main(void) {
|
||||
|
||||
void tuh_mount_cb(uint8_t dev_addr) {
|
||||
// application set-up
|
||||
printf("A device with address %d is mounted\r\n", dev_addr);
|
||||
printf("A device with address %u is mounted\r\n", dev_addr);
|
||||
}
|
||||
|
||||
void tuh_umount_cb(uint8_t dev_addr) {
|
||||
// application tear-down
|
||||
printf("A device with address %d is unmounted \r\n", dev_addr);
|
||||
printf("A device with address %u is unmounted \r\n", dev_addr);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -69,9 +69,10 @@
|
||||
// Enable Host stack
|
||||
#define CFG_TUH_ENABLED 1
|
||||
|
||||
// #define CFG_TUH_MAX3421 1 // use max3421 as host controller
|
||||
|
||||
#if CFG_TUSB_MCU == OPT_MCU_RP2040
|
||||
// #define CFG_TUH_RPI_PIO_USB 1 // use pio-usb as host controller
|
||||
// #define CFG_TUH_MAX3421 1 // use max3421 as host controller
|
||||
|
||||
// host roothub port is 1 if using either pio-usb or max3421
|
||||
#if (defined(CFG_TUH_RPI_PIO_USB) && CFG_TUH_RPI_PIO_USB) || (defined(CFG_TUH_MAX3421) && CFG_TUH_MAX3421)
|
||||
|
6
examples/host/cdc_msc_hid_freertos/CMakePresets.json
Normal file
6
examples/host/cdc_msc_hid_freertos/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
@@ -1,14 +1,9 @@
|
||||
RTOS = freertos
|
||||
include ../../build_system/make/make.mk
|
||||
|
||||
FREERTOS_SRC = lib/FreeRTOS-Kernel
|
||||
FREERTOS_PORTABLE_PATH= $(FREERTOS_SRC)/portable/$(if $(findstring iar,$(TOOLCHAIN)),IAR,GCC)
|
||||
|
||||
INC += \
|
||||
src \
|
||||
src/FreeRTOSConfig \
|
||||
$(TOP)/hw \
|
||||
$(TOP)/$(FREERTOS_SRC)/include \
|
||||
$(TOP)/$(FREERTOS_PORTABLE_SRC) \
|
||||
|
||||
# Example source
|
||||
EXAMPLE_SOURCE = \
|
||||
@@ -19,15 +14,4 @@ EXAMPLE_SOURCE = \
|
||||
|
||||
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
|
||||
|
||||
# FreeRTOS source, all files in port folder
|
||||
SRC_C += \
|
||||
$(FREERTOS_SRC)/list.c \
|
||||
$(FREERTOS_SRC)/queue.c \
|
||||
$(FREERTOS_SRC)/tasks.c \
|
||||
$(FREERTOS_SRC)/timers.c \
|
||||
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.c))
|
||||
|
||||
SRC_S += \
|
||||
$(subst $(TOP)/,,$(wildcard $(TOP)/$(FREERTOS_PORTABLE_SRC)/*.s))
|
||||
|
||||
include ../../build_system/make/rules.mk
|
||||
|
@@ -1,199 +0,0 @@
|
||||
/*
|
||||
* FreeRTOS Kernel V10.0.0
|
||||
* Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software. If you wish to use our Amazon
|
||||
* FreeRTOS name, please do so in a fair use way that does not cause confusion.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
// skip if included from IAR assembler
|
||||
#ifndef __IASMARM__
|
||||
|
||||
// Include MCU header
|
||||
#include "bsp/board_mcu.h"
|
||||
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#error "ESP32-Sx should use IDF's FreeRTOSConfig.h"
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wredundant-decls"
|
||||
#endif
|
||||
|
||||
// TODO fix later
|
||||
// FIXME cause redundant-decls warnings
|
||||
#if CFG_TUSB_MCU == OPT_MCU_MM32F327X
|
||||
extern u32 SystemCoreClock;
|
||||
#else
|
||||
extern uint32_t SystemCoreClock;
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* Cortex M23/M33 port configuration. */
|
||||
#define configENABLE_MPU 0
|
||||
#define configENABLE_FPU 1
|
||||
#define configENABLE_TRUSTZONE 0
|
||||
#define configMINIMAL_SECURE_STACK_SIZE ( 1024 )
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
|
||||
#define configCPU_CLOCK_HZ SystemCoreClock
|
||||
#define configTICK_RATE_HZ ( 1000 )
|
||||
#define configMAX_PRIORITIES ( 5 )
|
||||
#define configMINIMAL_STACK_SIZE ( 128 )
|
||||
#define configTOTAL_HEAP_SIZE ( configSUPPORT_DYNAMIC_ALLOCATION*4*1024 )
|
||||
#define configMAX_TASK_NAME_LEN 16
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 4
|
||||
#define configUSE_QUEUE_SETS 0
|
||||
#define configUSE_TIME_SLICING 0
|
||||
#define configUSE_NEWLIB_REENTRANT 0
|
||||
#define configENABLE_BACKWARD_COMPATIBILITY 1
|
||||
#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
|
||||
|
||||
#define configSUPPORT_STATIC_ALLOCATION 1
|
||||
#define configSUPPORT_DYNAMIC_ALLOCATION 0
|
||||
|
||||
/* Hook function related definitions. */
|
||||
#define configUSE_IDLE_HOOK 0
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 0 // cause nested extern warning
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configCHECK_HANDLER_INSTALLATION 0
|
||||
|
||||
/* Run time and task stats gathering related definitions. */
|
||||
#define configGENERATE_RUN_TIME_STATS 0
|
||||
#define configUSE_TRACE_FACILITY 1 // legacy trace
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 0
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES 2
|
||||
|
||||
/* Software timer related definitions. */
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES-2)
|
||||
#define configTIMER_QUEUE_LENGTH 32
|
||||
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
|
||||
|
||||
/* Optional functions - most linkers will remove unused functions anyway. */
|
||||
#define INCLUDE_vTaskPrioritySet 0
|
||||
#define INCLUDE_uxTaskPriorityGet 0
|
||||
#define INCLUDE_vTaskDelete 0
|
||||
#define INCLUDE_vTaskSuspend 1 // required for queue, semaphore, mutex to be blocked indefinitely with portMAX_DELAY
|
||||
#define INCLUDE_xResumeFromISR 0
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 0
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 0
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 0
|
||||
#define INCLUDE_xTaskGetIdleTaskHandle 0
|
||||
#define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
|
||||
#define INCLUDE_pcTaskGetTaskName 0
|
||||
#define INCLUDE_eTaskGetState 0
|
||||
#define INCLUDE_xEventGroupSetBitFromISR 0
|
||||
#define INCLUDE_xTimerPendFunctionCall 0
|
||||
|
||||
#ifdef __RX__
|
||||
/* Renesas RX series */
|
||||
#define vSoftwareInterruptISR INT_Excep_ICU_SWINT
|
||||
#define vTickISR INT_Excep_CMT0_CMI0
|
||||
#define configPERIPHERAL_CLOCK_HZ (configCPU_CLOCK_HZ/2)
|
||||
#define configKERNEL_INTERRUPT_PRIORITY 1
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 4
|
||||
|
||||
#else
|
||||
|
||||
/* FreeRTOS hooks to NVIC vectors */
|
||||
#define xPortPendSVHandler PendSV_Handler
|
||||
#define xPortSysTickHandler SysTick_Handler
|
||||
#define vPortSVCHandler SVC_Handler
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Interrupt nesting behavior configuration.
|
||||
//--------------------------------------------------------------------+
|
||||
#if defined(__NVIC_PRIO_BITS)
|
||||
// For Cortex-M specific: __NVIC_PRIO_BITS is defined in core_cmx.h
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
|
||||
#elif defined(__ECLIC_INTCTLBITS)
|
||||
// RISC-V Bumblebee core from nuclei
|
||||
#define configPRIO_BITS __ECLIC_INTCTLBITS
|
||||
|
||||
#elif defined(__IASMARM__)
|
||||
// FIXME: IAR Assembler cannot include mcu header directly to get __NVIC_PRIO_BITS.
|
||||
// Therefore we will hard coded it to minimum value of 2 to get pass ci build.
|
||||
// IAR user must update this to correct value of the target MCU
|
||||
#message "configPRIO_BITS is hard coded to 2 to pass IAR build only. User should update it per MCU"
|
||||
#define configPRIO_BITS 2
|
||||
|
||||
#else
|
||||
#error "FreeRTOS configPRIO_BITS to be defined"
|
||||
#endif
|
||||
|
||||
/* The lowest interrupt priority that can be used in a call to a "set priority" function. */
|
||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY ((1<<configPRIO_BITS) - 1)
|
||||
|
||||
/* The highest interrupt priority that can be used by any interrupt service
|
||||
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
|
||||
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
|
||||
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
|
||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 2
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __FREERTOS_CONFIG__H */
|
@@ -74,9 +74,10 @@
|
||||
// Enable Host stack
|
||||
#define CFG_TUH_ENABLED 1
|
||||
|
||||
// #define CFG_TUH_MAX3421 1 // use max3421 as host controller
|
||||
|
||||
#if CFG_TUSB_MCU == OPT_MCU_RP2040
|
||||
// #define CFG_TUH_RPI_PIO_USB 1 // use pio-usb as host controller
|
||||
// #define CFG_TUH_MAX3421 1 // use max3421 as host controller
|
||||
|
||||
// host roothub port is 1 if using either pio-usb or max3421
|
||||
#if (defined(CFG_TUH_RPI_PIO_USB) && CFG_TUH_RPI_PIO_USB) || (defined(CFG_TUH_MAX3421) && CFG_TUH_MAX3421)
|
||||
|
6
examples/host/device_info/CMakePresets.json
Normal file
6
examples/host/device_info/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
@@ -74,9 +74,10 @@
|
||||
// Enable Host stack
|
||||
#define CFG_TUH_ENABLED 1
|
||||
|
||||
// #define CFG_TUH_MAX3421 1 // use max3421 as host controller
|
||||
|
||||
#if CFG_TUSB_MCU == OPT_MCU_RP2040
|
||||
// #define CFG_TUH_RPI_PIO_USB 1 // use pio-usb as host controller
|
||||
// #define CFG_TUH_MAX3421 1 // use max3421 as host controller
|
||||
|
||||
// host roothub port is 1 if using either pio-usb or max3421
|
||||
#if (defined(CFG_TUH_RPI_PIO_USB) && CFG_TUH_RPI_PIO_USB) || (defined(CFG_TUH_MAX3421) && CFG_TUH_MAX3421)
|
||||
@@ -109,8 +110,7 @@
|
||||
// only hub class is enabled
|
||||
#define CFG_TUH_HUB 1
|
||||
|
||||
// max device support (excluding hub device)
|
||||
// 1 hub typically has 4 ports
|
||||
// max device support (excluding hub device): 1 hub typically has 4 ports
|
||||
#define CFG_TUH_DEVICE_MAX (3*CFG_TUH_HUB + 1)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
6
examples/host/hid_controller/CMakePresets.json
Normal file
6
examples/host/hid_controller/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
@@ -69,9 +69,10 @@
|
||||
// Enable Host stack
|
||||
#define CFG_TUH_ENABLED 1
|
||||
|
||||
// #define CFG_TUH_MAX3421 1 // use max3421 as host controller
|
||||
|
||||
#if CFG_TUSB_MCU == OPT_MCU_RP2040
|
||||
// #define CFG_TUH_RPI_PIO_USB 1 // use pio-usb as host controller
|
||||
// #define CFG_TUH_MAX3421 1 // use max3421 as host controller
|
||||
|
||||
// host roothub port is 1 if using either pio-usb or max3421
|
||||
#if (defined(CFG_TUH_RPI_PIO_USB) && CFG_TUH_RPI_PIO_USB) || (defined(CFG_TUH_MAX3421) && CFG_TUH_MAX3421)
|
||||
|
32
examples/host/midi_rx/CMakeLists.txt
Normal file
32
examples/host/midi_rx/CMakeLists.txt
Normal file
@@ -0,0 +1,32 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../hw/bsp/family_support.cmake)
|
||||
|
||||
# gets PROJECT name for the example
|
||||
family_get_project_name(PROJECT ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
project(${PROJECT} C CXX ASM)
|
||||
|
||||
# Checks this example is valid for the family and initializes the project
|
||||
family_initialize_project(${PROJECT} ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
# Espressif has its own cmake build system
|
||||
if(FAMILY STREQUAL "espressif")
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_executable(${PROJECT})
|
||||
|
||||
# Example source
|
||||
target_sources(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
|
||||
)
|
||||
|
||||
# Example include
|
||||
target_include_directories(${PROJECT} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Configure compilation flags and libraries for the example without RTOS.
|
||||
# See the corresponding function in hw/bsp/FAMILY/family.cmake for details.
|
||||
family_configure_host_example(${PROJECT} noos)
|
13
examples/host/midi_rx/Makefile
Normal file
13
examples/host/midi_rx/Makefile
Normal file
@@ -0,0 +1,13 @@
|
||||
include ../../build_system/make/make.mk
|
||||
|
||||
INC += \
|
||||
src \
|
||||
$(TOP)/hw \
|
||||
|
||||
# Example source
|
||||
EXAMPLE_SOURCE += \
|
||||
src/main.c
|
||||
|
||||
SRC_C += $(addprefix $(CURRENT_PATH)/, $(EXAMPLE_SOURCE))
|
||||
|
||||
include ../../build_system/make/rules.mk
|
20
examples/host/midi_rx/only.txt
Normal file
20
examples/host/midi_rx/only.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
mcu:ESP32S2
|
||||
mcu:ESP32S3
|
||||
mcu:ESP32P4
|
||||
mcu:KINETIS_KL
|
||||
mcu:LPC175X_6X
|
||||
mcu:LPC177X_8X
|
||||
mcu:LPC18XX
|
||||
mcu:LPC40XX
|
||||
mcu:LPC43XX
|
||||
mcu:MAX3421
|
||||
mcu:MIMXRT1XXX
|
||||
mcu:MIMXRT10XX
|
||||
mcu:MIMXRT11XX
|
||||
mcu:MSP432E4
|
||||
mcu:RP2040
|
||||
mcu:RX65X
|
||||
mcu:RAXXX
|
||||
mcu:STM32F4
|
||||
mcu:STM32F7
|
||||
mcu:STM32H7
|
123
examples/host/midi_rx/src/main.c
Normal file
123
examples/host/midi_rx/src/main.c
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bsp/board_api.h"
|
||||
#include "tusb.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// STATIC GLOBALS DECLARATION
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF PROTOTYPES
|
||||
//--------------------------------------------------------------------+
|
||||
void led_blinking_task(void);
|
||||
void midi_host_rx_task(void);
|
||||
|
||||
/*------------- MAIN -------------*/
|
||||
int main(void) {
|
||||
board_init();
|
||||
|
||||
printf("TinyUSB Host MIDI Example\r\n");
|
||||
|
||||
// init host stack on configured roothub port
|
||||
tusb_rhport_init_t host_init = {
|
||||
.role = TUSB_ROLE_HOST,
|
||||
.speed = TUSB_SPEED_AUTO
|
||||
};
|
||||
tusb_init(BOARD_TUH_RHPORT, &host_init);
|
||||
|
||||
while (1) {
|
||||
tuh_task();
|
||||
led_blinking_task();
|
||||
midi_host_rx_task();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Blinking Task
|
||||
//--------------------------------------------------------------------+
|
||||
void led_blinking_task(void) {
|
||||
const uint32_t interval_ms = 1000;
|
||||
static uint32_t start_ms = 0;
|
||||
|
||||
static bool led_state = false;
|
||||
|
||||
// Blink every interval ms
|
||||
if (board_millis() - start_ms < interval_ms) return;// not enough time
|
||||
start_ms += interval_ms;
|
||||
|
||||
board_led_write(led_state);
|
||||
led_state = 1 - led_state;// toggle
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MIDI host receive task
|
||||
//--------------------------------------------------------------------+
|
||||
void midi_host_rx_task(void) {
|
||||
// nothing to do, we just print out received data in callback
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// TinyUSB Callbacks
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// Invoked when device with MIDI interface is mounted.
|
||||
void tuh_midi_mount_cb(uint8_t idx, const tuh_midi_mount_cb_t* mount_cb_data) {
|
||||
printf("MIDI Interface Index = %u, Address = %u, Number of RX cables = %u, Number of TX cables = %u\r\n",
|
||||
idx, mount_cb_data->daddr, mount_cb_data->rx_cable_count, mount_cb_data->tx_cable_count);
|
||||
}
|
||||
|
||||
// Invoked when device with hid interface is un-mounted
|
||||
void tuh_midi_umount_cb(uint8_t idx) {
|
||||
printf("MIDI Interface Index = %u is unmounted\r\n", idx);
|
||||
}
|
||||
|
||||
void tuh_midi_rx_cb(uint8_t idx, uint32_t xferred_bytes) {
|
||||
if (xferred_bytes == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t buffer[48];
|
||||
uint8_t cable_num = 0;
|
||||
uint32_t bytes_read = tuh_midi_stream_read(idx, &cable_num, buffer, sizeof(buffer));
|
||||
|
||||
printf("Cable %u rx: ", cable_num);
|
||||
for (uint32_t i = 0; i < bytes_read; i++) {
|
||||
printf("%02X ", buffer[i]);
|
||||
}
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
void tuh_midi_tx_cb(uint8_t idx, uint32_t xferred_bytes) {
|
||||
(void) idx;
|
||||
(void) xferred_bytes;
|
||||
}
|
118
examples/host/midi_rx/src/tusb_config.h
Normal file
118
examples/host/midi_rx/src/tusb_config.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TUSB_CONFIG_H_
|
||||
#define TUSB_CONFIG_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Common Configuration
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
// defined by compiler flags for flexibility
|
||||
#ifndef CFG_TUSB_MCU
|
||||
#error CFG_TUSB_MCU must be defined
|
||||
#endif
|
||||
|
||||
// Espressif IDF requires "freertos/" prefix in include path
|
||||
#if TUSB_MCU_VENDOR_ESPRESSIF
|
||||
#define CFG_TUSB_OS_INC_PATH freertos/
|
||||
#endif
|
||||
|
||||
#ifndef CFG_TUSB_OS
|
||||
#define CFG_TUSB_OS OPT_OS_NONE
|
||||
#endif
|
||||
|
||||
#ifndef CFG_TUSB_DEBUG
|
||||
#define CFG_TUSB_DEBUG 0
|
||||
#endif
|
||||
|
||||
/* USB DMA on some MCUs can only access a specific SRAM region with restriction on alignment.
|
||||
* Tinyusb use follows macros to declare transferring memory so that they can be put
|
||||
* into those specific section.
|
||||
* e.g
|
||||
* - CFG_TUSB_MEM SECTION : __attribute__ (( section(".usb_ram") ))
|
||||
* - CFG_TUSB_MEM_ALIGN : __attribute__ ((aligned(4)))
|
||||
*/
|
||||
#ifndef CFG_TUH_MEM_SECTION
|
||||
#define CFG_TUH_MEM_SECTION
|
||||
#endif
|
||||
|
||||
#ifndef CFG_TUH_MEM_ALIGN
|
||||
#define CFG_TUH_MEM_ALIGN __attribute__ ((aligned(4)))
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Host Configuration
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
// Enable Host stack
|
||||
#define CFG_TUH_ENABLED 1
|
||||
|
||||
#if CFG_TUSB_MCU == OPT_MCU_RP2040
|
||||
// #define CFG_TUH_RPI_PIO_USB 1 // use pio-usb as host controller
|
||||
// #define CFG_TUH_MAX3421 1 // use max3421 as host controller
|
||||
|
||||
// host roothub port is 1 if using either pio-usb or max3421
|
||||
#if (defined(CFG_TUH_RPI_PIO_USB) && CFG_TUH_RPI_PIO_USB) || (defined(CFG_TUH_MAX3421) && CFG_TUH_MAX3421)
|
||||
#define BOARD_TUH_RHPORT 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Default is max speed that hardware controller could support with on-chip PHY
|
||||
#define CFG_TUH_MAX_SPEED BOARD_TUH_MAX_SPEED
|
||||
|
||||
//------------------------- Board Specific --------------------------
|
||||
|
||||
// RHPort number used for host can be defined by board.mk, default to port 0
|
||||
#ifndef BOARD_TUH_RHPORT
|
||||
#define BOARD_TUH_RHPORT 0
|
||||
#endif
|
||||
|
||||
// RHPort max operational speed can defined by board.mk
|
||||
#ifndef BOARD_TUH_MAX_SPEED
|
||||
#define BOARD_TUH_MAX_SPEED OPT_MODE_DEFAULT_SPEED
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Driver Configuration
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
// Size of buffer to hold descriptors and other data used for enumeration
|
||||
#define CFG_TUH_ENUMERATION_BUFSIZE 256
|
||||
|
||||
#define CFG_TUH_HUB 1
|
||||
// max device support (excluding hub device): 1 hub typically has 4 ports
|
||||
#define CFG_TUH_DEVICE_MAX (3*CFG_TUH_HUB + 1)
|
||||
#define CFG_TUH_MIDI CFG_TUH_DEVICE_MAX
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
6
examples/host/msc_file_explorer/CMakePresets.json
Normal file
6
examples/host/msc_file_explorer/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
@@ -69,9 +69,10 @@
|
||||
// Enable Host stack
|
||||
#define CFG_TUH_ENABLED 1
|
||||
|
||||
// #define CFG_TUH_MAX3421 1 // use max3421 as host controller
|
||||
|
||||
#if CFG_TUSB_MCU == OPT_MCU_RP2040
|
||||
// #define CFG_TUH_RPI_PIO_USB 1 // use pio-usb as host controller
|
||||
// #define CFG_TUH_MAX3421 1 // use max3421 as host controller
|
||||
|
||||
// host roothub port is 1 if using either pio-usb or max3421
|
||||
#if (defined(CFG_TUH_RPI_PIO_USB) && CFG_TUH_RPI_PIO_USB) || (defined(CFG_TUH_MAX3421) && CFG_TUH_MAX3421)
|
||||
|
6
examples/typec/CMakePresets.json
Normal file
6
examples/typec/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
6
examples/typec/power_delivery/CMakePresets.json
Normal file
6
examples/typec/power_delivery/CMakePresets.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": 6,
|
||||
"include": [
|
||||
"../../../hw/bsp/BoardPresets.json"
|
||||
]
|
||||
}
|
4002
hw/bsp/BoardPresets.json
Normal file
4002
hw/bsp/BoardPresets.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -64,9 +64,7 @@ int sys_read(int fhdl, char *buf, size_t count) {
|
||||
#endif
|
||||
|
||||
#elif defined(LOGGER_SWO)
|
||||
// Logging with SWO for ARM Cortex
|
||||
#include "board_mcu.h"
|
||||
|
||||
// Logging with SWO for ARM Cortex-M
|
||||
int sys_write (int fhdl, const char *buf, size_t count) {
|
||||
(void) fhdl;
|
||||
uint8_t const* buf8 = (uint8_t const*) buf;
|
||||
|
@@ -1,196 +0,0 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020, Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOARD_MCU_H_
|
||||
#define BOARD_MCU_H_
|
||||
|
||||
#include "tusb_option.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Low Level MCU header include. Example should be
|
||||
// platform independent and mostly doesn't need to include this file.
|
||||
// However there are still certain situation where this file is needed:
|
||||
// - FreeRTOSConfig.h to set up correct clock and NVIC interrupts for ARM Cortex
|
||||
// - SWO logging for Cortex M with ITM_SendChar() / ITM_ReceiveChar()
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// Include order follows OPT_MCU_ number
|
||||
#if TU_CHECK_MCU(OPT_MCU_LPC11UXX, OPT_MCU_LPC13XX, OPT_MCU_LPC15XX) || \
|
||||
TU_CHECK_MCU(OPT_MCU_LPC175X_6X, OPT_MCU_LPC177X_8X, OPT_MCU_LPC18XX) || \
|
||||
TU_CHECK_MCU(OPT_MCU_LPC40XX, OPT_MCU_LPC43XX)
|
||||
#include "chip.h"
|
||||
|
||||
#elif TU_CHECK_MCU(OPT_MCU_LPC51UXX, OPT_MCU_LPC54XXX, OPT_MCU_LPC55XX, OPT_MCU_MCXN9)
|
||||
#include "fsl_device_registers.h"
|
||||
|
||||
#elif TU_CHECK_MCU(OPT_MCU_KINETIS_KL, OPT_MCU_KINETIS_K32L, OPT_MCU_KINETIS_K)
|
||||
#include "fsl_device_registers.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_NRF5X
|
||||
#include "nrf.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_SAMD11 || CFG_TUSB_MCU == OPT_MCU_SAMD21 || \
|
||||
CFG_TUSB_MCU == OPT_MCU_SAMD51 || CFG_TUSB_MCU == OPT_MCU_SAME5X || \
|
||||
CFG_TUSB_MCU == OPT_MCU_SAML22 || CFG_TUSB_MCU == OPT_MCU_SAML21
|
||||
#include "sam.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_SAMG
|
||||
#undef LITTLE_ENDIAN // hack to suppress "LITTLE_ENDIAN" redefined
|
||||
#include "sam.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32F0
|
||||
#include "stm32f0xx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32F1
|
||||
#include "stm32f1xx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32F2
|
||||
#include "stm32f2xx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32F3
|
||||
#include "stm32f3xx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32F4
|
||||
#include "stm32f4xx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32F7
|
||||
#include "stm32f7xx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32G4
|
||||
#include "stm32g4xx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32H5
|
||||
#include "stm32h5xx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32H7
|
||||
#include "stm32h7xx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32H7RS
|
||||
#include "stm32h7rsxx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32L0
|
||||
#include "stm32l0xx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32L1
|
||||
#include "stm32l1xx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32L4
|
||||
#include "stm32l4xx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32WB
|
||||
#include "stm32wbxx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32U5
|
||||
#include "stm32u5xx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32G0
|
||||
#include "stm32g0xx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32C0
|
||||
#include "stm32c0xx.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_CXD56
|
||||
// no header needed
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_MSP430x5xx
|
||||
#include "msp430.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_MSP432E4
|
||||
#include "msp.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_VALENTYUSB_EPTRI
|
||||
// no header needed
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_MIMXRT1XXX
|
||||
#include "fsl_device_registers.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_NUC120
|
||||
#include "NUC100Series.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_NUC121 || CFG_TUSB_MCU == OPT_MCU_NUC126
|
||||
#include "NuMicro.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_NUC505
|
||||
#include "NUC505Series.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_ESP32S2
|
||||
// no header needed
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_ESP32S3
|
||||
// no header needed
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_DA1469X
|
||||
#include "DA1469xAB.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_RP2040
|
||||
#include "pico.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_EFM32GG
|
||||
#include "em_device.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_RX63X || CFG_TUSB_MCU == OPT_MCU_RX65X
|
||||
// no header needed
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_RAXXX
|
||||
#include "bsp_api.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_GD32VF103
|
||||
#include "gd32vf103.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_MM32F327X
|
||||
#include "mm32_device.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_XMC4000
|
||||
#include "xmc_device.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_TM4C123
|
||||
#include "TM4C123.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_CH32F20X
|
||||
#include "ch32f20x.h"
|
||||
|
||||
#elif TU_CHECK_MCU(OPT_MCU_BCM2711, OPT_MCU_BCM2835, OPT_MCU_BCM2837)
|
||||
// no header needed
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_MAX32690
|
||||
#include "max32690.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_MAX32650
|
||||
#include "max32650.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_MAX32666
|
||||
#include "max32665.h"
|
||||
|
||||
#elif CFG_TUSB_MCU == OPT_MCU_MAX78002
|
||||
#include "max78002.h"
|
||||
|
||||
#else
|
||||
#error "Missing MCU header"
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* BOARD_MCU_H_ */
|
@@ -162,7 +162,6 @@ int board_getchar(void) {
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)
|
||||
|
||||
#include "esp_private/usb_phy.h"
|
||||
#include "soc/usb_pins.h"
|
||||
|
||||
static usb_phy_handle_t phy_hdl;
|
||||
|
||||
|
@@ -12,7 +12,7 @@ set(UF2CONV_PY ${TOP}/tools/uf2/utils/uf2conv.py)
|
||||
# RTOS
|
||||
#-------------------------------------------------------------
|
||||
if (NOT DEFINED RTOS)
|
||||
set(RTOS noos)
|
||||
set(RTOS noos CACHE STRING "RTOS")
|
||||
endif ()
|
||||
|
||||
#-------------------------------------------------------------
|
||||
@@ -399,7 +399,11 @@ endfunction()
|
||||
# Add flash jlink target
|
||||
function(family_flash_jlink TARGET)
|
||||
if (NOT DEFINED JLINKEXE)
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(JLINKEXE JLink.exe)
|
||||
else()
|
||||
set(JLINKEXE JLinkExe)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED JLINK_IF)
|
||||
@@ -472,6 +476,10 @@ function(family_flash_openocd TARGET)
|
||||
set(OPENOCD_OPTION2 "")
|
||||
endif ()
|
||||
|
||||
if (DEFINED OPENOCD_SERIAL)
|
||||
set(OPENOCD_OPTION "-c \"adapter serial ${OPENOCD_SERIAL}\" ${OPENOCD_OPTION}")
|
||||
endif ()
|
||||
|
||||
separate_arguments(OPTION_LIST UNIX_COMMAND ${OPENOCD_OPTION})
|
||||
separate_arguments(OPTION_LIST2 UNIX_COMMAND ${OPENOCD_OPTION2})
|
||||
|
||||
|
@@ -0,0 +1,2 @@
|
||||
set(PICO_PLATFORM rp2040)
|
||||
set(PICO_BOARD adafruit_feather_rp2040_usb_host)
|
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2025 Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
/* metadata:
|
||||
name: Adafruit Feather RP2040 with USB Type A Host
|
||||
url: https://www.adafruit.com/product/5723
|
||||
*/
|
||||
|
||||
#ifndef TUSB_BOARD_H
|
||||
#define TUSB_BOARD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// UART and LED are already defined in pico-sdk board
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// PIO_USB
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
#define PICO_DEFAULT_PIO_USB_DP_PIN 16
|
||||
#define PICO_DEFAULT_PIO_USB_VBUSEN_PIN 18
|
||||
#define PICO_DEFAULT_PIO_USB_VBUSEN_STATE 1
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// USB Host MAX3421E
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
#ifdef PICO_DEFAULT_SPI
|
||||
#define MAX3421_SPI PICO_DEFAULT_SPI // sdk v2
|
||||
#else
|
||||
#define MAX3421_SPI PICO_DEFAULT_SPI_INSTANCE // sdk v1
|
||||
#endif
|
||||
|
||||
#define MAX3421_SCK_PIN PICO_DEFAULT_SPI_SCK_PIN
|
||||
#define MAX3421_MOSI_PIN PICO_DEFAULT_SPI_TX_PIN
|
||||
#define MAX3421_MISO_PIN PICO_DEFAULT_SPI_RX_PIN
|
||||
#define MAX3421_CS_PIN 10
|
||||
#define MAX3421_INTR_PIN 9
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
113
hw/bsp/rp2040/boards/adafruit_fruit_jam/adafruit_fruit_jam.h
Normal file
113
hw/bsp/rp2040/boards/adafruit_fruit_jam/adafruit_fruit_jam.h
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2025 Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
#ifndef BOARDS_ADAFRUIT_FRUIT_JAM_H
|
||||
#define BOARDS_ADAFRUIT_FRUIT_JAM_H
|
||||
|
||||
// required for board that is not part of pico-sdk
|
||||
|
||||
// -----------------------------------------------------
|
||||
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
|
||||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
||||
// -----------------------------------------------------
|
||||
|
||||
// pico_cmake_set PICO_PLATFORM=rp2350
|
||||
|
||||
// On some samples, the xosc can take longer to stabilize than is usual
|
||||
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
|
||||
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
|
||||
#endif
|
||||
|
||||
// For board detection
|
||||
#define ADAFRUIT_FRUIT_JAM
|
||||
|
||||
// --- RP2350 VARIANT ---
|
||||
#define PICO_RP2350A 0
|
||||
|
||||
// --- UART ---
|
||||
#ifndef PICO_DEFAULT_UART
|
||||
#define PICO_DEFAULT_UART 1
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_UART_TX_PIN
|
||||
#define PICO_DEFAULT_UART_TX_PIN 8
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_UART_RX_PIN
|
||||
#define PICO_DEFAULT_UART_RX_PIN 9
|
||||
#endif
|
||||
|
||||
// --- LED ---
|
||||
#ifndef PICO_DEFAULT_LED_PIN
|
||||
#define PICO_DEFAULT_LED_PIN 29
|
||||
#endif
|
||||
|
||||
#ifndef PICO_DEFAULT_WS2812_PIN
|
||||
#define PICO_DEFAULT_WS2812_PIN 32
|
||||
#endif
|
||||
|
||||
// --- I2C ---
|
||||
#ifndef PICO_DEFAULT_I2C
|
||||
#define PICO_DEFAULT_I2C 0
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||
#define PICO_DEFAULT_I2C_SDA_PIN 20
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||
#define PICO_DEFAULT_I2C_SCL_PIN 21
|
||||
#endif
|
||||
|
||||
// --- SPI ---
|
||||
#ifndef PICO_DEFAULT_SPI
|
||||
#define PICO_DEFAULT_SPI 1
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_SCK_PIN
|
||||
#define PICO_DEFAULT_SPI_SCK_PIN 30
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_TX_PIN
|
||||
#define PICO_DEFAULT_SPI_TX_PIN 31
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_RX_PIN
|
||||
#define PICO_DEFAULT_SPI_RX_PIN 28
|
||||
#endif
|
||||
|
||||
// --- FLASH ---
|
||||
|
||||
// FruitJam use w25q128 but sdk does not have .s for it, use q080 instead
|
||||
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
|
||||
|
||||
#ifndef PICO_FLASH_SPI_CLKDIV
|
||||
#define PICO_FLASH_SPI_CLKDIV 2
|
||||
#endif
|
||||
|
||||
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (8 * 1024 * 1024)
|
||||
#ifndef PICO_FLASH_SIZE_BYTES
|
||||
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1
|
||||
#ifndef PICO_RP2350_A2_SUPPORTED
|
||||
#define PICO_RP2350_A2_SUPPORTED 1
|
||||
#endif
|
||||
|
||||
#endif
|
4
hw/bsp/rp2040/boards/adafruit_fruit_jam/board.cmake
Normal file
4
hw/bsp/rp2040/boards/adafruit_fruit_jam/board.cmake
Normal file
@@ -0,0 +1,4 @@
|
||||
set(PICO_PLATFORM rp2350-arm-s)
|
||||
set(PICO_BOARD adafruit_fruit_jam)
|
||||
set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR})
|
||||
#set(OPENOCD_SERIAL E6614103E78E8324)
|
57
hw/bsp/rp2040/boards/adafruit_fruit_jam/board.h
Normal file
57
hw/bsp/rp2040/boards/adafruit_fruit_jam/board.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2025 Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
/* metadata:
|
||||
name: Adafruit Fruit Jam - Mini RP2350
|
||||
url: https://www.adafruit.com/product/6200
|
||||
*/
|
||||
|
||||
#ifndef TUSB_BOARD_H
|
||||
#define TUSB_BOARD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// UART and LED are already defined in pico-sdk board
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// PIO_USB
|
||||
//--------------------------------------------------------------------+
|
||||
// default to pico brain tester
|
||||
#define PICO_DEFAULT_PIO_USB_DP_PIN 1
|
||||
#define PICO_DEFAULT_PIO_USB_VBUSEN_PIN 11
|
||||
#define PICO_DEFAULT_PIO_USB_VBUSEN_STATE 1
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// USB Host MAX3421E
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2025 Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
#ifndef BOARDS_ADAFRUIT_METRO_RP2350_H
|
||||
#define BOARDS_ADAFRUIT_METRO_RP2350_H
|
||||
|
||||
// required for board that is not part of pico-sdk
|
||||
|
||||
// -----------------------------------------------------
|
||||
// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
|
||||
// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
|
||||
// -----------------------------------------------------
|
||||
|
||||
// pico_cmake_set PICO_PLATFORM=rp2350
|
||||
|
||||
// On some samples, the xosc can take longer to stabilize than is usual
|
||||
#ifndef PICO_XOSC_STARTUP_DELAY_MULTIPLIER
|
||||
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
|
||||
#endif
|
||||
|
||||
// For board detection
|
||||
#define ADAFRUIT_METRO_RP2350
|
||||
|
||||
// --- RP2350 VARIANT ---
|
||||
#define PICO_RP2350A 0
|
||||
|
||||
// --- UART ---
|
||||
#ifndef PICO_DEFAULT_UART
|
||||
#define PICO_DEFAULT_UART 0
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_UART_TX_PIN
|
||||
#define PICO_DEFAULT_UART_TX_PIN 0
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_UART_RX_PIN
|
||||
#define PICO_DEFAULT_UART_RX_PIN 1
|
||||
#endif
|
||||
|
||||
// --- LED ---
|
||||
#ifndef PICO_DEFAULT_LED_PIN
|
||||
#define PICO_DEFAULT_LED_PIN 23
|
||||
#endif
|
||||
|
||||
#ifndef PICO_DEFAULT_WS2812_PIN
|
||||
#define PICO_DEFAULT_WS2812_PIN 25
|
||||
#endif
|
||||
|
||||
// --- I2C ---
|
||||
#ifndef PICO_DEFAULT_I2C
|
||||
#define PICO_DEFAULT_I2C 0
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SDA_PIN
|
||||
#define PICO_DEFAULT_I2C_SDA_PIN 20
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_I2C_SCL_PIN
|
||||
#define PICO_DEFAULT_I2C_SCL_PIN 21
|
||||
#endif
|
||||
|
||||
// --- SPI ---
|
||||
#ifndef PICO_DEFAULT_SPI
|
||||
#define PICO_DEFAULT_SPI 1
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_SCK_PIN
|
||||
#define PICO_DEFAULT_SPI_SCK_PIN 30
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_TX_PIN
|
||||
#define PICO_DEFAULT_SPI_TX_PIN 31
|
||||
#endif
|
||||
#ifndef PICO_DEFAULT_SPI_RX_PIN
|
||||
#define PICO_DEFAULT_SPI_RX_PIN 28
|
||||
#endif
|
||||
|
||||
// --- FLASH ---
|
||||
|
||||
// FruitJam use w25q128 but sdk does not have .s for it, use q080 instead
|
||||
#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
|
||||
|
||||
#ifndef PICO_FLASH_SPI_CLKDIV
|
||||
#define PICO_FLASH_SPI_CLKDIV 2
|
||||
#endif
|
||||
|
||||
// pico_cmake_set_default PICO_FLASH_SIZE_BYTES = (8 * 1024 * 1024)
|
||||
#ifndef PICO_FLASH_SIZE_BYTES
|
||||
#define PICO_FLASH_SIZE_BYTES (8 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
// pico_cmake_set_default PICO_RP2350_A2_SUPPORTED = 1
|
||||
#ifndef PICO_RP2350_A2_SUPPORTED
|
||||
#define PICO_RP2350_A2_SUPPORTED 1
|
||||
#endif
|
||||
|
||||
#endif
|
4
hw/bsp/rp2040/boards/adafruit_metro_rp2350/board.cmake
Normal file
4
hw/bsp/rp2040/boards/adafruit_metro_rp2350/board.cmake
Normal file
@@ -0,0 +1,4 @@
|
||||
set(PICO_PLATFORM rp2350-arm-s)
|
||||
set(PICO_BOARD adafruit_metro_rp2350)
|
||||
set(PICO_BOARD_HEADER_DIRS ${CMAKE_CURRENT_LIST_DIR})
|
||||
#set(OPENOCD_SERIAL E6614103E78E8324)
|
57
hw/bsp/rp2040/boards/adafruit_metro_rp2350/board.h
Normal file
57
hw/bsp/rp2040/boards/adafruit_metro_rp2350/board.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2025 Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
/* metadata:
|
||||
name: Adafruit Metro RP2350
|
||||
url: https://www.adafruit.com/product/6003
|
||||
*/
|
||||
|
||||
#ifndef TUSB_BOARD_H
|
||||
#define TUSB_BOARD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// UART and LED are already defined in pico-sdk board
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// PIO_USB
|
||||
//--------------------------------------------------------------------+
|
||||
// default to pico brain tester
|
||||
#define PICO_DEFAULT_PIO_USB_DP_PIN 32
|
||||
#define PICO_DEFAULT_PIO_USB_VBUSEN_PIN 29
|
||||
#define PICO_DEFAULT_PIO_USB_VBUSEN_STATE 1
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// USB Host MAX3421E
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
64
hw/bsp/rp2040/boards/feather_rp2040_max3421/board.h
Normal file
64
hw/bsp/rp2040/boards/feather_rp2040_max3421/board.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2025 Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#ifndef TUSB_BOARD_H
|
||||
#define TUSB_BOARD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// UART and LED are already defined in pico-sdk board
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// PIO_USB
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
#define PICO_DEFAULT_PIO_USB_DP_PIN 16
|
||||
#define PICO_DEFAULT_PIO_USB_VBUSEN_PIN 18
|
||||
#define PICO_DEFAULT_PIO_USB_VBUSEN_STATE 1
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// USB Host MAX3421E
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
#ifdef PICO_DEFAULT_SPI
|
||||
#define MAX3421_SPI PICO_DEFAULT_SPI // sdk v2
|
||||
#else
|
||||
#define MAX3421_SPI PICO_DEFAULT_SPI_INSTANCE // sdk v1
|
||||
#endif
|
||||
|
||||
#define MAX3421_SCK_PIN PICO_DEFAULT_SPI_SCK_PIN
|
||||
#define MAX3421_MOSI_PIN PICO_DEFAULT_SPI_TX_PIN
|
||||
#define MAX3421_MISO_PIN PICO_DEFAULT_SPI_RX_PIN
|
||||
#define MAX3421_CS_PIN 10
|
||||
#define MAX3421_INTR_PIN 9
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
40
hw/bsp/rp2040/boards/pico_sdk/board.h
Normal file
40
hw/bsp/rp2040/boards/pico_sdk/board.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2025 Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#ifndef TUSB_BOARD_H
|
||||
#define TUSB_BOARD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// UART and LED are already defined in pico-sdk board
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -1,2 +1,3 @@
|
||||
set(PICO_PLATFORM rp2040)
|
||||
set(PICO_BOARD pico)
|
||||
#set(OPENOCD_SERIAL E6614103E719612F)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2021, Ha Thach (tinyusb.org)
|
||||
* Copyright (c) 2025 Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -26,58 +26,25 @@
|
||||
|
||||
/* metadata:
|
||||
name: Pico
|
||||
url: https://www.raspberrypi.org/products/raspberry-pi-pico/
|
||||
url: https://www.raspberrypi.com/products/raspberry-pi-pico/
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H_
|
||||
#define BOARD_H_
|
||||
#ifndef TUSB_BOARD_H
|
||||
#define TUSB_BOARD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// LED
|
||||
#ifdef PICO_DEFAULT_LED_PIN
|
||||
#define LED_PIN PICO_DEFAULT_LED_PIN
|
||||
#define LED_STATE_ON (!(PICO_DEFAULT_LED_PIN_INVERTED))
|
||||
#endif
|
||||
|
||||
// Button pin is BOOTSEL which is flash CS pin
|
||||
#define BUTTON_BOOTSEL
|
||||
#define BUTTON_STATE_ACTIVE 0
|
||||
|
||||
// UART
|
||||
#if defined(PICO_DEFAULT_UART_TX_PIN) && defined(PICO_DEFAULT_UART_RX_PIN) && \
|
||||
defined(PICO_DEFAULT_UART) && defined(LIB_PICO_STDIO_UART)
|
||||
#define UART_DEV PICO_DEFAULT_UART
|
||||
#define UART_TX_PIN PICO_DEFAULT_UART_TX_PIN
|
||||
#define UART_RX_PIN PICO_DEFAULT_UART_RX_PIN
|
||||
#endif
|
||||
// UART and LED are already defined in pico-sdk board
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// PIO_USB
|
||||
// default to pin on Adafruit Feather rp2040 USB Host or Tester if defined
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// #define USE_ADAFRUIT_FEATHER_RP2040_USBHOST
|
||||
#ifdef USE_ADAFRUIT_FEATHER_RP2040_USBHOST
|
||||
#define PICO_DEFAULT_PIO_USB_DP_PIN 16
|
||||
#define PICO_DEFAULT_PIO_USB_VBUSEN_PIN 18
|
||||
#endif
|
||||
|
||||
#ifndef PICO_DEFAULT_PIO_USB_DP_PIN
|
||||
// default to pico brain tester
|
||||
#define PICO_DEFAULT_PIO_USB_DP_PIN 20
|
||||
#endif
|
||||
|
||||
// VBUS enable pin and its active state
|
||||
#ifndef PICO_DEFAULT_PIO_USB_VBUSEN_PIN
|
||||
#define PICO_DEFAULT_PIO_USB_VBUSEN_PIN 22
|
||||
#endif
|
||||
|
||||
// VBUS enable state
|
||||
#ifndef PICO_DEFAULT_PIO_USB_VBUSEN_STATE
|
||||
#define PICO_DEFAULT_PIO_USB_VBUSEN_STATE 1
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// USB Host MAX3421E
|
||||
@@ -99,4 +66,4 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BOARD_H_ */
|
||||
#endif
|
@@ -1,2 +1,3 @@
|
||||
set(PICO_PLATFORM rp2350-arm-s)
|
||||
set(PICO_BOARD pico2)
|
||||
#set(OPENOCD_SERIAL E6614103E77C5A24)
|
||||
|
69
hw/bsp/rp2040/boards/raspberry_pi_pico2/board.h
Normal file
69
hw/bsp/rp2040/boards/raspberry_pi_pico2/board.h
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2025 Ha Thach (tinyusb.org)
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
/* metadata:
|
||||
name: Pico2
|
||||
url: https://www.raspberrypi.com/products/raspberry-pi-pico-2/
|
||||
*/
|
||||
|
||||
#ifndef TUSB_BOARD_H
|
||||
#define TUSB_BOARD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// UART and LED are already defined in pico-sdk board
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// PIO_USB
|
||||
//--------------------------------------------------------------------+
|
||||
// default to pico brain tester
|
||||
#define PICO_DEFAULT_PIO_USB_DP_PIN 20
|
||||
#define PICO_DEFAULT_PIO_USB_VBUSEN_PIN 22
|
||||
#define PICO_DEFAULT_PIO_USB_VBUSEN_STATE 1
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// USB Host MAX3421E
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
#ifdef PICO_DEFAULT_SPI
|
||||
#define MAX3421_SPI PICO_DEFAULT_SPI // sdk v2
|
||||
#else
|
||||
#define MAX3421_SPI PICO_DEFAULT_SPI_INSTANCE // sdk v1
|
||||
#endif
|
||||
|
||||
#define MAX3421_SCK_PIN PICO_DEFAULT_SPI_SCK_PIN
|
||||
#define MAX3421_MOSI_PIN PICO_DEFAULT_SPI_TX_PIN
|
||||
#define MAX3421_MISO_PIN PICO_DEFAULT_SPI_RX_PIN
|
||||
#define MAX3421_CS_PIN 10
|
||||
#define MAX3421_INTR_PIN 9
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -42,10 +42,6 @@
|
||||
#include "bsp/board_api.h"
|
||||
#include "board.h"
|
||||
|
||||
#ifdef UART_DEV
|
||||
static uart_inst_t *uart_inst;
|
||||
#endif
|
||||
|
||||
#if (CFG_TUH_ENABLED && CFG_TUH_RPI_PIO_USB) || (CFG_TUD_ENABLED && CFG_TUD_RPI_PIO_USB)
|
||||
#include "pio_usb.h"
|
||||
#endif
|
||||
@@ -55,6 +51,36 @@ static uart_inst_t *uart_inst;
|
||||
static void max3421_init(void);
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
//
|
||||
//--------------------------------------------------------------------+
|
||||
// LED
|
||||
#if !defined(LED_PIN) && defined(PICO_DEFAULT_LED_PIN)
|
||||
#define LED_PIN PICO_DEFAULT_LED_PIN
|
||||
#define LED_STATE_ON (!(PICO_DEFAULT_LED_PIN_INVERTED))
|
||||
#endif
|
||||
|
||||
// Button, if not defined use BOOTSEL button
|
||||
#ifndef BUTTON_PIN
|
||||
#define BUTTON_BOOTSEL
|
||||
#define BUTTON_STATE_ACTIVE 0
|
||||
#endif
|
||||
|
||||
// UART
|
||||
#if !defined(UART_DEV) && defined(PICO_DEFAULT_UART) && defined(LIB_PICO_STDIO_UART) && \
|
||||
defined(PICO_DEFAULT_UART_TX_PIN) && defined(PICO_DEFAULT_UART_RX_PIN)
|
||||
#define UART_DEV PICO_DEFAULT_UART
|
||||
#define UART_TX_PIN PICO_DEFAULT_UART_TX_PIN
|
||||
#define UART_RX_PIN PICO_DEFAULT_UART_RX_PIN
|
||||
#endif
|
||||
|
||||
#ifdef UART_DEV
|
||||
static uart_inst_t *uart_inst;
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
//
|
||||
//--------------------------------------------------------------------+
|
||||
#ifdef BUTTON_BOOTSEL
|
||||
// This example blinks the Picoboard LED when the BOOTSEL button is pressed.
|
||||
//
|
||||
@@ -79,7 +105,7 @@ bool __no_inline_not_in_flash_func(get_bootsel_button)(void) {
|
||||
IO_QSPI_GPIO_QSPI_SS_CTRL_OEOVER_BITS);
|
||||
|
||||
// Note we can't call into any sleep functions in flash right now
|
||||
for (volatile int i = 0; i < 1000; ++i);
|
||||
for (volatile int i = 0; i < 1000; ++i) {}
|
||||
|
||||
// The HI GPIO registers in SIO can observe and control the 6 QSPI pins.
|
||||
// Note the button pulls the pin *low* when pressed.
|
||||
@@ -133,12 +159,15 @@ void stdio_rtt_init(void) {
|
||||
//--------------------------------------------------------------------+
|
||||
//
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
#if (CFG_TUH_ENABLED && CFG_TUH_RPI_PIO_USB) || (CFG_TUD_ENABLED && CFG_TUD_RPI_PIO_USB)
|
||||
// Set the system clock to a multiple of 120mhz for bitbanging USB with pico-usb
|
||||
// Set the system clock to a multiple of 12mhz for bit-banging USB with pico-usb
|
||||
set_sys_clock_khz(120000, true);
|
||||
// set_sys_clock_khz(180000, true);
|
||||
// set_sys_clock_khz(192000, true);
|
||||
// set_sys_clock_khz(240000, true);
|
||||
// set_sys_clock_khz(264000, true);
|
||||
|
||||
#ifdef PICO_DEFAULT_PIO_USB_VBUSEN_PIN
|
||||
gpio_init(PICO_DEFAULT_PIO_USB_VBUSEN_PIN);
|
||||
@@ -193,7 +222,6 @@ void board_init(void)
|
||||
//--------------------------------------------------------------------+
|
||||
// Board porting API
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
void board_led_write(bool state) {
|
||||
(void) state;
|
||||
|
||||
@@ -266,7 +294,9 @@ int board_getchar(void) {
|
||||
#if CFG_TUH_ENABLED && defined(CFG_TUH_MAX3421) && CFG_TUH_MAX3421
|
||||
|
||||
void max3421_int_handler(uint gpio, uint32_t event_mask) {
|
||||
if (!(gpio == MAX3421_INTR_PIN && event_mask & GPIO_IRQ_EDGE_FALL)) return;
|
||||
if (!(gpio == MAX3421_INTR_PIN && event_mask & GPIO_IRQ_EDGE_FALL)) {
|
||||
return;
|
||||
}
|
||||
tuh_int_handler(BOARD_TUH_RHPORT, true);
|
||||
}
|
||||
|
||||
|
@@ -31,7 +31,9 @@ elseif (PICO_PLATFORM STREQUAL "rp2350-riscv")
|
||||
set(OPENOCD_TARGET rp2350-riscv)
|
||||
endif()
|
||||
|
||||
set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -f target/${OPENOCD_TARGET}.cfg -c \"adapter speed 5000\"")
|
||||
if (NOT OPENOCD_OPTION)
|
||||
set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -f target/${OPENOCD_TARGET}.cfg -c \"adapter speed 5000\"")
|
||||
endif()
|
||||
|
||||
if (NOT PICO_TINYUSB_PATH)
|
||||
set(PICO_TINYUSB_PATH ${TOP})
|
||||
@@ -111,6 +113,7 @@ target_sources(tinyusb_host_base INTERFACE
|
||||
${TOP}/src/host/hub.c
|
||||
${TOP}/src/class/cdc/cdc_host.c
|
||||
${TOP}/src/class/hid/hid_host.c
|
||||
${TOP}/src/class/midi/midi_host.c
|
||||
${TOP}/src/class/msc/msc_host.c
|
||||
${TOP}/src/class/vendor/vendor_host.c
|
||||
)
|
||||
@@ -143,6 +146,7 @@ target_sources(tinyusb_bsp INTERFACE
|
||||
)
|
||||
target_include_directories(tinyusb_bsp INTERFACE
|
||||
${TOP}/hw
|
||||
${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}
|
||||
)
|
||||
target_link_libraries(tinyusb_bsp INTERFACE
|
||||
pico_unique_id
|
||||
|
3
hw/bsp/rp2040/rp2350-openocd.cfg
Normal file
3
hw/bsp/rp2040/rp2350-openocd.cfg
Normal file
@@ -0,0 +1,3 @@
|
||||
source [find interface/cmsis-dap.cfg]
|
||||
adapter speed 5000
|
||||
source [find target/rp2350.cfg]
|
@@ -14,6 +14,14 @@ CFLAGS += \
|
||||
# suppress following warnings from mcu driver
|
||||
CFLAGS += -Wno-error=unused-parameter -Wno-error=cast-align -Wno-error=redundant-decls
|
||||
|
||||
SPEED ?= high
|
||||
|
||||
ifeq ($(SPEED), high)
|
||||
CFLAGS += -DBOARD_TUD_MAX_SPEED=OPT_MODE_HIGH_SPEED
|
||||
else
|
||||
CFLAGS += -DBOARD_TUD_MAX_SPEED=OPT_MODE_FULL_SPEED
|
||||
endif
|
||||
|
||||
# SAM driver is flooded with -Wcast-qual which slow down complication significantly
|
||||
CFLAGS_SKIP += -Wcast-qual
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user