diff options
| author | hathach <[email protected]> | 2024-11-21 17:49:38 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2024-11-21 17:49:38 +0700 |
| commit | dbdc5a239c42e96eeeb8759a121798fa9b3f39c3 (patch) | |
| tree | 0e5dadec079b5509ba5f9a5770092001b87f76b6 /src | |
| parent | 5d77faa835ab7faf73a9981905e57e8d79920d2d (diff) | |
- move freertos_hooks to board.c
- add device/midi_test_freertos example
- update bth/dfu/midi device for cache line size
Diffstat (limited to 'src')
| -rwxr-xr-x | src/class/bth/bth_device.c | 10 | ||||
| -rw-r--r-- | src/class/dfu/dfu_device.c | 11 | ||||
| -rw-r--r-- | src/class/dfu/dfu_rt_device.c | 5 | ||||
| -rw-r--r-- | src/class/midi/midi_device.c | 22 | ||||
| -rw-r--r-- | src/common/tusb_mcu.h | 5 | ||||
| -rw-r--r-- | src/tusb_option.h | 6 |
6 files changed, 38 insertions, 21 deletions
diff --git a/src/class/bth/bth_device.c b/src/class/bth/bth_device.c index a79908627..ea577db03 100755 --- a/src/class/bth/bth_device.c +++ b/src/class/bth/bth_device.c @@ -51,8 +51,14 @@ typedef struct uint32_t prev_xferred_bytes; // Endpoint Transfer buffer - CFG_TUSB_MEM_ALIGN bt_hci_cmd_t hci_cmd; - CFG_TUSB_MEM_ALIGN uint8_t epout_buf[CFG_TUD_BTH_DATA_EPSIZE]; + union { + CFG_TUD_MEM_ALIGN bt_hci_cmd_t hci_cmd; + TUD_DCACHE_PADDING; + }; + union { + CFG_TUD_MEM_ALIGN uint8_t epout_buf[CFG_TUD_BTH_DATA_EPSIZE]; + TUD_DCACHE_PADDING; + }; } btd_interface_t; diff --git a/src/class/dfu/dfu_device.c b/src/class/dfu/dfu_device.c index 71e7ac2b3..875bd4e09 100644 --- a/src/class/dfu/dfu_device.c +++ b/src/class/dfu/dfu_device.c @@ -47,8 +47,7 @@ //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ -typedef struct -{ +typedef struct { uint8_t attrs; uint8_t alt; @@ -59,14 +58,16 @@ typedef struct uint16_t block; uint16_t length; - CFG_TUSB_MEM_ALIGN uint8_t transfer_buf[CFG_TUD_DFU_XFER_BUFSIZE]; + union { + CFG_TUD_MEM_ALIGN uint8_t transfer_buf[CFG_TUD_DFU_XFER_BUFSIZE]; + TUD_DCACHE_PADDING; + }; } dfu_state_ctx_t; // Only a single dfu state is allowed CFG_TUD_MEM_SECTION tu_static dfu_state_ctx_t _dfu_ctx; -static void reset_state(void) -{ +static void reset_state(void) { _dfu_ctx.state = DFU_IDLE; _dfu_ctx.status = DFU_STATUS_OK; _dfu_ctx.flashing_in_progress = false; diff --git a/src/class/dfu/dfu_rt_device.c b/src/class/dfu/dfu_rt_device.c index 3b801b787..a63c23d9a 100644 --- a/src/class/dfu/dfu_rt_device.c +++ b/src/class/dfu/dfu_rt_device.c @@ -58,9 +58,8 @@ bool dfu_rtd_deinit(void) { return true; } -void dfu_rtd_reset(uint8_t rhport) -{ - (void) rhport; +void dfu_rtd_reset(uint8_t rhport) { + (void) rhport; } uint16_t dfu_rtd_open(uint8_t rhport, tusb_desc_interface_t const * itf_desc, uint16_t max_len) diff --git a/src/class/midi/midi_device.c b/src/class/midi/midi_device.c index 42905ab0d..7e30e5ea4 100644 --- a/src/class/midi/midi_device.c +++ b/src/class/midi/midi_device.c @@ -40,15 +40,13 @@ // MACRO CONSTANT TYPEDEF //--------------------------------------------------------------------+ -typedef struct -{ +typedef struct { uint8_t buffer[4]; uint8_t index; uint8_t total; -}midid_stream_t; +} midid_stream_t; -typedef struct -{ +typedef struct { uint8_t itf_num; uint8_t ep_in; uint8_t ep_out; @@ -72,9 +70,14 @@ typedef struct #endif // Endpoint Transfer buffer - CFG_TUSB_MEM_ALIGN uint8_t epout_buf[CFG_TUD_MIDI_EP_BUFSIZE]; - CFG_TUSB_MEM_ALIGN uint8_t epin_buf[CFG_TUD_MIDI_EP_BUFSIZE]; - + union { + CFG_TUD_MEM_ALIGN uint8_t epout_buf[CFG_TUD_MIDI_EP_BUFSIZE]; + TUD_DCACHE_PADDING; + }; + union { + CFG_TUD_MEM_ALIGN uint8_t epin_buf[CFG_TUD_MIDI_EP_BUFSIZE]; + TUD_DCACHE_PADDING; + }; } midid_interface_t; #define ITF_MEM_RESET_SIZE offsetof(midid_interface_t, rx_ff) @@ -84,8 +87,7 @@ typedef struct //--------------------------------------------------------------------+ CFG_TUD_MEM_SECTION midid_interface_t _midid_itf[CFG_TUD_MIDI]; -bool tud_midi_n_mounted (uint8_t itf) -{ +bool tud_midi_n_mounted (uint8_t itf) { midid_interface_t* midi = &_midid_itf[itf]; return midi->ep_in && midi->ep_out; } diff --git a/src/common/tusb_mcu.h b/src/common/tusb_mcu.h index dfa6c7151..f6f90c592 100644 --- a/src/common/tusb_mcu.h +++ b/src/common/tusb_mcu.h @@ -355,6 +355,7 @@ #define TUP_USBIP_DWC2_ESP32 #define TUP_DCD_ENDPOINT_MAX 7 // only 5 TX FIFO for endpoint IN #define CFG_TUH_DWC2_DMA_ENABLE_DEFAULT 0 // TODO currently have issue with buffer DMA with espressif + #define CFG_TUSB_OS_INC_PATH_DEFAULT freertos/ #elif TU_CHECK_MCU(OPT_MCU_ESP32P4) #define TUP_USBIP_DWC2 @@ -362,6 +363,8 @@ #define TUP_RHPORT_HIGHSPEED 1 // port0 FS, port1 HS #define TUP_DCD_ENDPOINT_MAX 16 // FS 7 ep, HS 16 ep + #define CFG_TUSB_OS_INC_PATH_DEFAULT freertos/ + #if defined(CFG_TUD_DWC2_DMA_ENABLE) && CFG_TUD_DWC2_DMA_ENABLE == 1 #define CFG_TUD_MEM_DCACHE_ENABLE_DEFAULT 1 #endif @@ -379,7 +382,9 @@ #if (CFG_TUD_ENABLED || !(defined(CFG_TUH_MAX3421) && CFG_TUH_MAX3421)) #error "MCUs are only supported with CFG_TUH_MAX3421 enabled" #endif + #define TUP_DCD_ENDPOINT_MAX 0 + #define CFG_TUSB_OS_INC_PATH_DEFAULT freertos/ //--------------------------------------------------------------------+ // Dialog diff --git a/src/tusb_option.h b/src/tusb_option.h index 1c8e8aff4..68fd90de9 100644 --- a/src/tusb_option.h +++ b/src/tusb_option.h @@ -403,7 +403,11 @@ #endif #ifndef CFG_TUSB_OS_INC_PATH - #define CFG_TUSB_OS_INC_PATH + #ifndef CFG_TUSB_OS_INC_PATH_DEFAULT + #define CFG_TUSB_OS_INC_PATH_DEFAULT + #endif + + #define CFG_TUSB_OS_INC_PATH CFG_TUSB_OS_INC_PATH_DEFAULT #endif //-------------------------------------------------------------------- |
