From 451ae17c42c423691db2d299220dbc4838a94e30 Mon Sep 17 00:00:00 2001 From: Riuzakiii Date: Thu, 22 Feb 2024 19:08:49 +0100 Subject: [PATCH] Small refactor, separate pool decl/def --- src/wch-ch56x-lib/USBDevice/usb20.c | 7 +++++-- src/wch-ch56x-lib/memory/pool.h | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) 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..bfe300d 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