Question
Confused with USB FIFO Allocation
Posted on February 25, 2013 at 13:01
This is a piece of code from usb_core.c
/* set Rx FIFO size */ USB_OTG_WRITE_REG32(&pdev->regs.GREGS->GRXFSIZ, RX_FIFO_FS_SIZE); /* EP0 TX*/ nptxfifosize.b.depth = TX0_FIFO_FS_SIZE; nptxfifosize.b.startaddr = RX_FIFO_FS_SIZE; USB_OTG_WRITE_REG32( &pdev->regs.GREGS->DIEPTXF0_HNPTXFSIZ, nptxfifosize.d32 );It allocatesRX_FIFO_FS_SIZE for RX_FIFO and starts EP0 TX FIFO atnptxfifosize.b.startaddr = RX_FIFO_FS_SIZE;But according to reference manualDIEPTXF0_HNPTXFSIZ is allocated in 32-bit words. So actuallyRX_FIFO_FS_SIZE*4 were allocated and thus TX0 FIFO should start atRX_FIFO_FS_SIZE*4 address.Where a bug is? Is it in source code or in reference manual?