Skip to content

Commit f524a59

Browse files
committed
refactor(hal/usb): Remove usage of old USB OTG config macros
1 parent b32a735 commit f524a59

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed

components/hal/include/hal/usb_dwc_hal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ typedef struct {
191191
struct {
192192
int num_allocd; /**< Number of channels currently allocated */
193193
uint32_t chan_pend_intrs_msk; /**< Bit mask of channels with pending interrupts */
194-
usb_dwc_hal_chan_t *hdls[USB_DWC_NUM_HOST_CHAN]; /**< Handles of each channel. Set to NULL if channel has not been allocated */
194+
usb_dwc_hal_chan_t *hdls[OTG_NUM_HOST_CHAN]; /**< Handles of each channel. Set to NULL if channel has not been allocated */
195195
} channels;
196196
} usb_dwc_hal_context_t;
197197

components/hal/include/hal/usb_dwc_ll.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,6 @@ Todo: Check sizes again and express this macro in terms of DWC config options (I
102102
#define USB_DWC_FIFO_NPTX_LINES_BIASTX 16
103103
#define USB_DWC_FIFO_PTX_LINES_BIASTX 150
104104

105-
106-
/*
107-
* List of relevant DWC configurations. See DWC OTG databook Chapter 3 for more
108-
* details.
109-
*/
110-
#define USB_DWC_FSPHY_INTERFACE 1
111-
#define USB_DWC_NUM_EPS 6
112-
#define USB_DWC_NUM_IN_EPS 5 // Todo: Add check for when number of IN channels exceeds limit (IDF-8556)
113-
#define USB_DWC_NUM_HOST_CHAN 8
114-
#define USB_DWC_DFIFO_DEPTH 256
115-
#define USB_DWC_RX_DFIFO_DEPTH 256
116-
#define USB_DWC_TX_DFIFO_DEPTH 256 // Same value applies to HNPERIO, NPERIO, HPERIO, and DINEP
117-
118105
/* -----------------------------------------------------------------------------
119106
------------------------------- Global Registers -------------------------------
120107
----------------------------------------------------------------------------- */

components/hal/usb_dwc_hal.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ void usb_dwc_hal_core_soft_reset(usb_dwc_hal_context_t *hal)
188188
hal->flags.val = 0;
189189
hal->channels.num_allocd = 0;
190190
hal->channels.chan_pend_intrs_msk = 0;
191-
memset(hal->channels.hdls, 0, sizeof(usb_dwc_hal_chan_t *) * USB_DWC_NUM_HOST_CHAN);
191+
memset(hal->channels.hdls, 0, sizeof(usb_dwc_hal_chan_t *) * OTG_NUM_HOST_CHAN);
192192
}
193193

194194
void usb_dwc_hal_set_fifo_bias(usb_dwc_hal_context_t *hal, const usb_hal_fifo_bias_t fifo_bias)
@@ -210,7 +210,7 @@ void usb_dwc_hal_set_fifo_bias(usb_dwc_hal_context_t *hal, const usb_hal_fifo_bi
210210

211211
HAL_ASSERT((fifo_config->rx_fifo_lines + fifo_config->nptx_fifo_lines + fifo_config->ptx_fifo_lines) <= USB_DWC_FIFO_TOTAL_USABLE_LINES);
212212
//Check that none of the channels are active
213-
for (int i = 0; i < USB_DWC_NUM_HOST_CHAN; i++) {
213+
for (int i = 0; i < OTG_NUM_HOST_CHAN; i++) {
214214
if (hal->channels.hdls[i] != NULL) {
215215
HAL_ASSERT(!hal->channels.hdls[i]->flags.active);
216216
}
@@ -264,11 +264,11 @@ bool usb_dwc_hal_chan_alloc(usb_dwc_hal_context_t *hal, usb_dwc_hal_chan_t *chan
264264
{
265265
HAL_ASSERT(hal->flags.fifo_sizes_set); //FIFO sizes should be set befor attempting to allocate a channel
266266
//Attempt to allocate channel
267-
if (hal->channels.num_allocd == USB_DWC_NUM_HOST_CHAN) {
267+
if (hal->channels.num_allocd == OTG_NUM_HOST_CHAN) {
268268
return false; //Out of free channels
269269
}
270270
int chan_idx = -1;
271-
for (int i = 0; i < USB_DWC_NUM_HOST_CHAN; i++) {
271+
for (int i = 0; i < OTG_NUM_HOST_CHAN; i++) {
272272
if (hal->channels.hdls[i] == NULL) {
273273
hal->channels.hdls[i] = chan_obj;
274274
chan_idx = i;

0 commit comments

Comments
 (0)