/** @file stm32f4xx_ll_usb.c * @author MCD Application Team * @version V1.1.0 * @date 19-June-2014 * @brief USB Low Layer HAL module driver. */
/** * @brief USB_ReadPacket : read a packet from the Tx FIFO associated * with the EP/channel * @param USBx : Selected device * @param src : source pointer * @param ch_ep_num : endpoint or host channel number * @param len : Noumber of bytes to read * @param dma: USB dma enabled or disabled * This parameter can be one of the these values: * 0 : DMA feature not used * 1 : DMA feature used * @retval pointer to desctination buffer */ void *USB_ReadPacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *dest, uint16_t len) { uint32_t i=0; uint32_t count32b = (len + 3) / 4; for ( i = 0; i < count32b; i++, dest += 4 ) { *(__packed uint32_t *)dest = USBx_DFIFO(0); // dest buffer overflow if (len != n*4) } return ((void *)dest); }
转载于:https://www.cnblogs.com/shangdawei/archive/2012/09/01/2667125.html
相关资源:数据结构—成绩单生成器