USB库函数里有些地方判断CID寄存器的bit8位,1或0执行不同操作,请问这位代表什么意思?参考手册上没有介绍
- 1、
- if ((USBx->CID & (0x1U << 8)) != 0U)
- {
- if (cfg.speed == USBH_FSLS_SPEED)
- {
- /* Force Device Enumeration to FS/LS mode only */
- USBx_HOST->HCFG |= USB_OTG_HCFG_FSLSS;
- }
- else
- {
- /* Set default Max speed support */
- USBx_HOST->HCFG &= ~(USB_OTG_HCFG_FSLSS);
- }
- }
- else
- {
- /* Set default Max speed support */
- USBx_HOST->HCFG &= ~(USB_OTG_HCFG_FSLSS);
- }
- 2、
- if ((USBx->CID & (0x1U << 8)) != 0U)
- {
- /* set Rx FIFO size */
- USBx->GRXFSIZ = 0x200U;
- USBx->DIEPTXF0_HNPTXFSIZ = (uint32_t)(((0x100U << 16) & USB_OTG_NPTXFD) | 0x200U);
- USBx->HPTXFSIZ = (uint32_t)(((0xE0U << 16) & USB_OTG_HPTXFSIZ_PTXFD) | 0x300U);
- }
- else
- {
- /* set Rx FIFO size */
- USBx->GRXFSIZ = 0x80U;
- USBx->DIEPTXF0_HNPTXFSIZ = (uint32_t)(((0x60U << 16) & USB_OTG_NPTXFD) | 0x80U);
- USBx->HPTXFSIZ = (uint32_t)(((0x40U << 16)& USB_OTG_HPTXFSIZ_PTXFD) | 0xE0U);
- }
- 3、
- if ((USBx->CID & (0x1U << 8)) != 0U)
- {
- USBx_HC((uint32_t)ch_num)->HCINTMSK |= USB_OTG_HCINTMSK_NYET |
- USB_OTG_HCINTMSK_ACKM;
- }
- 4、
- if (((USBx->CID & (0x1U << 8)) != 0U) && (hc->speed == USBH_HS_SPEED))//CID bit8 host
- {
- /* in DMA mode host Core automatically issues ping in case of NYET/NAK */
- if ((dma == 1U) && ((hc->ep_type == EP_TYPE_CTRL) || (hc->ep_type == EP_TYPE_BULK)))
- {
- USBx_HC((uint32_t)ch_num)->HCINTMSK &= ~(USB_OTG_HCINTMSK_NYET |
- USB_OTG_HCINTMSK_ACKM |
- USB_OTG_HCINTMSK_NAKM);
- }
- if ((dma == 0U) && (hc->do_ping == 1U))
- {
- (void)USB_DoPing(USBx, hc->ch_num);
- return HAL_OK;
- }
- }
复制代码
|