Skip to content

Commit 26f130e

Browse files
committed
clean up
Signed-off-by: HiFiPhile <[email protected]>
1 parent e520a66 commit 26f130e

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ Supported CPUs
229229
| +----+------------------------+--------+------+-----------+------------------------+-------------------+
230230
| | F2, F4, F7, H7, H7RS |||| dwc2 | |
231231
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
232-
| | C0, G0, H5 || || stm32_fsdev | |
232+
| | C0, G0, H5 || || stm32_fsdev | Tested on C0 |
233233
| +-----------------------------+--------+------+-----------+------------------------+-------------------+
234234
| | G4 |||| stm32_fsdev | |
235235
| +----+------------------------+--------+------+-----------+------------------------+-------------------+

hw/bsp/stm32c0/boards/stm32c071nucleo/stm32c071xx_flash.icf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ place in RAM_region { readwrite,
3030
block CSTACK, block HEAP };
3131

3232
export symbol __ICFEDIT_region_RAM_start__;
33-
export symbol __ICFEDIT_region_RAM_end__;
33+
export symbol __ICFEDIT_region_RAM_end__;

src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,12 +840,14 @@ void dcd_int_disable(uint8_t rhport) {
840840
fsdev_int_disable(rhport);
841841
}
842842

843+
#if defined(USB_BCDR_DPPU) || defined(SYSCFG_PMC_USB_PU)
843844
void dcd_connect(uint8_t rhport) {
844845
fsdev_connect(rhport);
845846
}
846847

847848
void dcd_disconnect(uint8_t rhport) {
848849
fsdev_disconnect(rhport);
849850
}
851+
#endif
850852

851853
#endif

src/portable/st/stm32_fsdev/fsdev_at32.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,17 @@ TU_ATTR_ALWAYS_INLINE static inline void fsdev_int_disable(uint8_t rhport) {
207207
TU_ATTR_ALWAYS_INLINE static inline void fsdev_disconnect(uint8_t rhport) {
208208
(void) rhport;
209209
/* disable usb phy */
210-
FSDEV_REG->CNTR |= USB_CNTR_PDWN;
210+
*(volatile uint32_t*)(FSDEV_REG_BASE + 0x40) |= USB_CNTR_PDWN;
211211
/* D+ 1.5k pull-up disable, USB->cfg_bit.puo = TRUE; */
212-
*(uint32_t *)(FSDEV_REG_BASE+0x60) |= (1u<<1);
212+
*(volatile uint32_t *)(FSDEV_REG_BASE+0x60) |= (1u<<1);
213213
}
214214

215215
TU_ATTR_ALWAYS_INLINE static inline void fsdev_connect(uint8_t rhport) {
216216
(void) rhport;
217217
/* enable usb phy */
218-
FSDEV_REG->CNTR &= ~USB_CNTR_PDWN;
218+
*(volatile uint32_t*)(FSDEV_REG_BASE + 0x40) &= ~USB_CNTR_PDWN;
219219
/* Dp 1.5k pull-up enable, USB->cfg_bit.puo = 0; */
220-
*(uint32_t *)(FSDEV_REG_BASE+0x60) &= ~(1u<<1);
220+
*(volatile uint32_t *)(FSDEV_REG_BASE+0x60) &= ~(1u<<1);
221221
}
222222

223223
#endif

src/portable/st/stm32_fsdev/hcd_stm32_fsdev.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
//--------------------------------------------------------------------+
5151

5252
// Debug level for FSDEV
53-
#define FSDEV_DEBUG 1
53+
#define FSDEV_DEBUG 3
5454

5555
// Max number of endpoints application can open, can be larger than FSDEV_EP_COUNT
5656
#ifndef CFG_TUH_FSDEV_ENDPOINT_MAX
@@ -314,12 +314,8 @@ static void ch_handle_error(uint8_t ch_id, uint32_t ch_reg, tusb_dir_t dir) {
314314
uint8_t ep_id = endpoint_find(daddr, ep_num | (dir == TUSB_DIR_IN ? TUSB_DIR_IN_MASK : 0));
315315
if (ep_id == TUSB_INDEX_INVALID_8) return;
316316

317-
hcd_endpoint_t* edpt = &_hcd_data.edpt[ep_id];
318317
hcd_xfer_t* xfer = &_hcd_data.xfer[ch_id];
319318

320-
TU_LOG(FSDEV_DEBUG, "ch_handle_error epreg=0x%08X ch=%u ep=0x%02X daddr=%u queued=%u/%u\r\n",
321-
ch_reg, ch_id, ep_num, daddr, xfer->queued_len[dir], edpt->buflen);
322-
323319
ch_reg &= USB_EPREG_MASK | CH_STAT_MASK(dir);
324320
ch_reg &= ~(dir == TUSB_DIR_OUT ? USB_CH_ERRTX : USB_CH_ERRRX);
325321

@@ -661,10 +657,10 @@ static void edpoint_close(uint8_t ep_id) {
661657
static uint32_t hcd_pma_alloc(uint8_t channel, tusb_dir_t dir, uint16_t len) {
662658
(void) len;
663659
// Simple static allocation as we are unlikely to handle ISO endpoints in host mode
664-
// We just give each channel a buffer of max packet size (64 bytes)
660+
// We just give each channel two buffers of max packet size (64 bytes) for IN and OUT
665661

666662
uint16_t addr = FSDEV_BTABLE_BASE + 8 * FSDEV_EP_COUNT;
667-
addr += channel * 64 * 2 + (dir == TUSB_DIR_IN ? 64 : 0);
663+
addr += channel * TUSB_EPSIZE_BULK_FS * 2 + (dir == TUSB_DIR_IN ? TUSB_EPSIZE_BULK_FS : 0);
668664

669665
TU_ASSERT(addr <= FSDEV_PMA_SIZE, 0xFFFF);
670666

0 commit comments

Comments
 (0)