/** * @brief USBH_Modify_Channel * Modify a pipe * @param pdev : Selected device * @param hc_num: Host channel Number * @param dev_address: USB Device address allocated to attached device * @param speed : USB device speed (Full/Low) * @param ep_type: end point type (Bulk/int/ctl) * @param mps: max pkt size * @retval Status */ uint8_t USBH_Modify_Channel (USB_OTG_CORE_HANDLE *pdev, uint8_t hc_num, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps) { if(dev_address != 0) { pdev->host.hc[hc_num].dev_addr = dev_address; } if((pdev->host.hc[hc_num].max_packet != mps) && (mps != 0)) { pdev->host.hc[hc_num].max_packet = mps; } if((pdev->host.hc[hc_num].speed != speed ) && (speed != 0 )) { pdev->host.hc[hc_num].speed = speed; } USB_OTG_HC_Init(pdev, hc_num); return HC_OK; }
/** * @brief USBH_Open_Channel * Open a pipe * @param pdev : Selected device * @param hc_num: Host channel Number * @param dev_address: USB Device address allocated to attached device * @param speed : USB device speed (Full/Low) * @param ep_type: end point type (Bulk/int/ctl) * @param mps: max pkt size * @retval Status */ uint8_t USBH_Open_Channel (USB_OTG_CORE_HANDLE *pdev, uint8_t hc_num, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps) { pdev->host.hc[hc_num].ep_num = pdev->host.channel[hc_num]& 0x7F; pdev->host.hc[hc_num].ep_is_in = (pdev->host.channel[hc_num] & 0x80 ) == 0x80; pdev->host.hc[hc_num].dev_addr = dev_address; pdev->host.hc[hc_num].ep_type = ep_type; pdev->host.hc[hc_num].max_packet = mps; pdev->host.hc[hc_num].speed = speed; pdev->host.hc[hc_num].toggle_in = 0; pdev->host.hc[hc_num].toggle_out = 0; if(speed == HPRT0_PRTSPD_HIGH_SPEED) { pdev->host.hc[hc_num].do_ping = 1; } USB_OTG_HC_Init(pdev, hc_num) ; return HC_OK; }
/** * @brief HCD_HC_Init * This function prepare a HC and start a transfer * @param pdev: Selected device * @param hc_num: Channel number * @retval status */ uint32_t HCD_HC_Init (USB_OTG_CORE_HANDLE *pdev , uint8_t hc_num) { #ifdef USE_HOST_MODE return USB_OTG_HC_Init(pdev, hc_num); #else return 0; #endif }
/** * @brief HCD_HC_Init * This function prepare a HC and start a transfer * @param pdev: Selected device * @param hc_num: Channel number * @retval status */ uint32_t HCD_HC_Init (USB_OTG_CORE_HANDLE *pdev , uint8_t hc_num) { return USB_OTG_HC_Init(pdev, hc_num); }