diff --git a/src/wch-ch56x-lib/USBDevice/usb20.c b/src/wch-ch56x-lib/USBDevice/usb20.c index e34c4ab..79aa35c 100644 --- a/src/wch-ch56x-lib/USBDevice/usb20.c +++ b/src/wch-ch56x-lib/USBDevice/usb20.c @@ -623,8 +623,11 @@ usb2_in_transfer_handler(uint8_t endp_num) LOG_IF(LOG_LEVEL_DEBUG, LOG_ID_USB2, "End of IN transfer for ENDP %d \r\n", endp_num); *T_Len = 0; - *usb2_get_tx_endpoint_addr_reg(endp_num) = (uint32_t)endp->buffer; - if (endp_num == 0) + if (endp_num != 0) + { + *usb2_get_tx_endpoint_addr_reg(endp_num) = (uint32_t)endp->buffer; + } + else { *usb2_get_rx_endpoint_addr_reg(0) = (uint32_t)usb2_backend_current_device->endpoints.rx[0].buffer; } diff --git a/src/wch-ch56x-lib/memory/pool.h b/src/wch-ch56x-lib/memory/pool.h index 933460f..7ec8d77 100644 --- a/src/wch-ch56x-lib/memory/pool.h +++ b/src/wch-ch56x-lib/memory/pool.h @@ -63,6 +63,9 @@ typedef struct hydra_pool_t .size = _size, \ .type_size = sizeof(_type) } +#define HYDRA_POOL_DECLR(_name) \ + extern hydra_pool_t _name + /** * @brief Get a free pool member * @param pool pointer to the pool