diff options
| author | hathach <[email protected]> | 2021-02-01 13:41:20 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2021-02-01 13:41:20 +0700 |
| commit | 0799a910730a3aa881f6292b2c7cbbc784690e7a (patch) | |
| tree | 34b85bdb2853c173a1d9c29dff9df65f2621801e /src | |
| parent | 8e954a439151822fcd415b3c611008aee423b813 (diff) | |
| parent | 78f50518a48f55fe3a4d921895c5d6c400c355b0 (diff) | |
Merge branch 'master' into rp2040-logger-enumfix
Diffstat (limited to 'src')
| -rw-r--r-- | src/class/midi/midi_device.c | 1 | ||||
| -rw-r--r-- | src/portable/raspberrypi/rp2040/dcd_rp2040.c | 16 | ||||
| -rw-r--r-- | src/portable/raspberrypi/rp2040/hcd_rp2040.c | 5 |
3 files changed, 12 insertions, 10 deletions
diff --git a/src/class/midi/midi_device.c b/src/class/midi/midi_device.c index ce4c9cafe..9fff20be2 100644 --- a/src/class/midi/midi_device.c +++ b/src/class/midi/midi_device.c @@ -192,6 +192,7 @@ uint32_t tud_midi_n_write(uint8_t itf, uint8_t jack_id, uint8_t const* buffer, u if (midi->write_buffer[0] == 0x4) { if (data == 0xf7) { midi->write_buffer[0] = 0x5; + midi->write_target_length = 2; } else { midi->write_target_length = 4; } diff --git a/src/portable/raspberrypi/rp2040/dcd_rp2040.c b/src/portable/raspberrypi/rp2040/dcd_rp2040.c index aaaa22e55..a54f579b8 100644 --- a/src/portable/raspberrypi/rp2040/dcd_rp2040.c +++ b/src/portable/raspberrypi/rp2040/dcd_rp2040.c @@ -38,8 +38,6 @@ #include "device/dcd.h" -#include "pico/stdlib.h" - /*------------------------------------------------------------------*/ /* Low level controller *------------------------------------------------------------------*/ @@ -66,11 +64,7 @@ static struct hw_endpoint *hw_endpoint_get_by_addr(uint8_t ep_addr) } static void _hw_endpoint_alloc(struct hw_endpoint *ep) { - uint size = 64; - if (ep->wMaxPacketSize > 64) - { - size = ep->wMaxPacketSize; - } + uint size = TU_MIN(64, ep->wMaxPacketSize); // Assumes single buffered for now ep->hw_data_buf = next_buffer_ptr; @@ -243,7 +237,7 @@ static void reset_ep0(void) // If we have finished this transfer on EP0 set pid back to 1 for next // setup transfer. Also clear a stall in case uint8_t addrs[] = {0x0, 0x80}; - for (uint i = 0 ; i < count_of(addrs); i++) + for (uint i = 0 ; i < TU_ARRAY_SIZE(addrs); i++) { struct hw_endpoint *ep = hw_endpoint_get_by_addr(addrs[i]); ep->next_pid = 1u; @@ -474,4 +468,10 @@ void dcd_edpt_close (uint8_t rhport, uint8_t ep_addr) } +void dcd_int_handler(uint8_t rhport) +{ + (void) rhport; + dcd_rp2040_irq(); +} + #endif diff --git a/src/portable/raspberrypi/rp2040/hcd_rp2040.c b/src/portable/raspberrypi/rp2040/hcd_rp2040.c index c74578c3c..efb2bd430 100644 --- a/src/portable/raspberrypi/rp2040/hcd_rp2040.c +++ b/src/portable/raspberrypi/rp2040/hcd_rp2040.c @@ -86,7 +86,7 @@ static void set_dev_ep(uint8_t dev_addr, uint8_t ep_addr, struct hw_endpoint *ep uint8_t num = tu_edpt_number(ep_addr); uint8_t in = (ep_addr & TUSB_DIR_IN_MASK) ? 1 : 0; uint32_t index = ep - eps; - hard_assert(index < count_of(eps)); + hard_assert(index < TU_ARRAY_SIZE(eps)); // todo revisit why dev_addr can be 0 here if (dev_addr) { dev_ep_map[dev_addr-1][num][in] = 128u | index; @@ -245,7 +245,7 @@ static void hcd_rp2040_irq(void) static struct hw_endpoint *_next_free_interrupt_ep(void) { struct hw_endpoint *ep = NULL; - for (uint i = 1; i < count_of(eps); i++) + for (uint i = 1; i < TU_ARRAY_SIZE(eps); i++) { ep = &eps[i]; if (!ep->configured) @@ -444,6 +444,7 @@ bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, uint8_t * // Get appropriate ep. Either EPX or interrupt endpoint struct hw_endpoint *ep = get_dev_ep(dev_addr, ep_addr); + assert(ep); if (ep_addr != ep->ep_addr) { |
