123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612 |
- /*!
- \file usbh_int.c
- \brief USB host mode interrupt handler file
- \version 2014-12-26, V1.0.0, firmware for GD32F10x
- \version 2017-06-20, V2.0.0, firmware for GD32F10x
- \version 2018-07-31, V2.1.0, firmware for GD32F10x
- */
- /*
- Copyright (c) 2018, GigaDevice Semiconductor Inc.
- All rights reserved.
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holder nor the names of its contributors
- may be used to endorse or promote products derived from this software without
- specific prior written permission.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- OF SUCH DAMAGE.
- */
- #include "usb_core.h"
- #include "usb_defines.h"
- #include "usbh_int.h"
- static uint32_t usbh_intf_sof (usb_core_handle_struct *pudev);
- static uint32_t usbh_intf_port (usb_core_handle_struct *pudev);
- static uint32_t usbh_intf_hc (usb_core_handle_struct *pudev);
- static uint32_t usbh_intf_hc_in (usb_core_handle_struct *pudev, uint8_t channel_num);
- static uint32_t usbh_intf_hc_out (usb_core_handle_struct *pudev, uint8_t channel_num);
- static uint32_t usbh_intf_rxfifo_noempty (usb_core_handle_struct *pudev);
- static uint32_t usbh_intf_nptxfifo_empty (usb_core_handle_struct *pudev);
- static uint32_t usbh_intf_ptxfifo_empty (usb_core_handle_struct *pudev);
- static uint32_t usbh_intf_disconnect (usb_core_handle_struct *pudev);
- static uint32_t usbh_intf_iso_incomplete_xfer (usb_core_handle_struct *pudev);
- /*!
- \brief handle global host interrupt
- \param[in] pudev: pointer to usb device instance
- \param[out] none
- \retval operation status
- */
- uint32_t usbh_isr (usb_core_handle_struct *pudev)
- {
- uint32_t retval = 0U;
- __IO uint32_t int_flag = 0U;
- /* check if host mode */
- if (USB_CURRENT_MODE_GET() == HOST_MODE) {
- USB_CORE_INTR_READ(int_flag);
- if (!int_flag) {
- return 0U;
- }
- /* start of frame interrupt handle */
- if (int_flag & GINTF_SOF) {
- retval |= usbh_intf_sof (pudev);
- }
- /* rx fifo non-empty interrupt handle */
- if (int_flag & GINTF_RXFNEIF) {
- retval |= usbh_intf_rxfifo_noempty (pudev);
- }
- /* non-periodic tx fifo empty interrupt hanlde */
- if (int_flag & GINTF_NPTXFEIF) {
- retval |= usbh_intf_nptxfifo_empty (pudev);
- }
- /* periodic tx fifo empty interrupt handle */
- if (int_flag & GINTF_PTXFEIF) {
- retval |= usbh_intf_ptxfifo_empty (pudev);
- }
- /* host channels interrupt handle */
- if (int_flag & GINTF_HCIF) {
- retval |= usbh_intf_hc (pudev);
- }
- /* host port interrupt handle */
- if (int_flag & GINTF_HPIF) {
- retval |= usbh_intf_port (pudev);
- }
- /* disconnect interrupt handle */
- if (int_flag & GINTF_DISCIF) {
- retval |= usbh_intf_disconnect (pudev);
- }
- /* isochronous in transfer not complete interrupt handle */
- if (int_flag & GINTF_ISOONCIF) {
- retval |= usbh_intf_iso_incomplete_xfer (pudev);
- }
- }
- return retval;
- }
- /*!
- \brief handle the start-of-frame interrupt in host mode
- \param[in] pudev: pointer to usb device instance
- \param[out] none
- \retval operation status
- */
- static uint32_t usbh_intf_sof (usb_core_handle_struct *pudev)
- {
- usbh_hcd_int_fops->sof(pudev);
- /* clear interrupt */
- USB_GINTF = GINTF_SOF;
- return 1U;
- }
- /*!
- \brief handle all host channels interrupt in host mode
- \param[in] pudev: pointer to usb device instance
- \param[out] none
- \retval operation status
- */
- static uint32_t usbh_intf_hc (usb_core_handle_struct *pudev)
- {
- uint8_t i = 0U;
- uint32_t retval = 0U;
- for (i = 0U; i < pudev->cfg.host_channel_num; i++) {
- if ((USB_HACHINT & HACHINT_HACHINT) & ((uint32_t)1U << i)) {
- if ((USB_HCHxCTL((uint16_t)i) & HCHCTL_EPDIR) >> 15U) {
- retval |= usbh_intf_hc_in (pudev, i);
- } else {
- retval |= usbh_intf_hc_out (pudev, i);
- }
- }
- }
- return retval;
- }
- /*!
- \brief handle the disconnect interrupt
- \param[in] pudev: pointer to usb device instance
- \param[out] none
- \retval operation status
- */
- static uint32_t usbh_intf_disconnect (usb_core_handle_struct *pudev)
- {
- usbh_hcd_int_fops->device_disconnected(pudev);
- /* clear interrupt */
- USB_GINTF = GINTF_DISCIF;
- return 1U;
- }
- /*!
- \brief handle the non-periodic tx fifo empty interrupt
- \param[in] pudev: pointer to usb device instance
- \param[out] none
- \retval operation status
- */
- static uint32_t usbh_intf_nptxfifo_empty (usb_core_handle_struct *pudev)
- {
- uint8_t channel_num = 0U;
- uint32_t dword_len = 0U, len = 0U;
- usb_hostchannel_struct *puhc;
- channel_num = (uint8_t)((USB_HNPTFQSTAT & HNPTFQSTAT_CNUM) >> 27U);
- puhc = &pudev->host.host_channel[channel_num];
- dword_len = (puhc->xfer_len + 3U) / 4U;
- while (((USB_HNPTFQSTAT & HNPTFQSTAT_NPTXFS) > dword_len) && (0U != puhc->xfer_len)) {
- len = (USB_HNPTFQSTAT & HNPTFQSTAT_NPTXFS) * 4U;
- if (len > puhc->xfer_len) {
- /* last packet */
- len = (uint16_t)puhc->xfer_len;
- USB_GINTEN &= ~GINTF_NPTXFEIF;
- }
- dword_len = (puhc->xfer_len + 3U) / 4U;
- usb_fifo_write (puhc->xfer_buff, channel_num, (uint16_t)len);
- puhc->xfer_buff += len;
- puhc->xfer_len -= len;
- puhc->xfer_count += len;
- }
- return 1U;
- }
- /*!
- \brief handle the periodic tx fifo empty interrupt
- \param[in] pudev: pointer to usb device instance
- \param[out] none
- \retval operation status
- */
- static uint32_t usbh_intf_ptxfifo_empty (usb_core_handle_struct *pudev)
- {
- uint8_t channel_num = 0U;
- uint32_t dword_len = 0U, len = 0U;
- usb_hostchannel_struct *puhc;
- channel_num = (uint8_t)((USB_HPTFQSTAT & HPTFQSTAT_CNUM) >> 27U);
- puhc = &pudev->host.host_channel[channel_num];
- dword_len = (puhc->xfer_len + 3U) / 4U;
- while (((USB_HPTFQSTAT & HPTFQSTAT_PTXFS) > dword_len) && (0U != puhc->xfer_len)) {
- len = (USB_HPTFQSTAT & HPTFQSTAT_PTXFS) * 4U;
- if (len > puhc->xfer_len) {
- len = puhc->xfer_len;
- /* last packet */
- USB_GINTEN &= ~GINTF_PTXFEIF;
- }
- dword_len = (puhc->xfer_len + 3U) / 4U;
- usb_fifo_write (puhc->xfer_buff, channel_num, (uint16_t)len);
- puhc->xfer_buff += len;
- puhc->xfer_len -= len;
- puhc->xfer_count += len;
- }
- return 1U;
- }
- /*!
- \brief handle the host port interrupt
- \param[in] pudev: pointer to usb device instance
- \param[out] none
- \retval operation status
- */
- static uint32_t usbh_intf_port (usb_core_handle_struct *pudev)
- {
- uint8_t port_speed = 0U;
- uint8_t port_reset = 0U;
- uint32_t retval = 0U;
- __IO uint32_t hostportdup = USB_HPCS;
- /* clear the interrupt bits in gintsts */
- hostportdup &= ~HPCS_PE;
- hostportdup &= ~HPCS_PCD;
- hostportdup &= ~HPCS_PEDC;
- /* port connect detected */
- if (USB_HPCS & HPCS_PCD) {
- hostportdup |= HPCS_PCD;
- usbh_hcd_int_fops->device_connected(pudev);
- retval |= 1U;
- }
- /* port enable changed */
- if (USB_HPCS & HPCS_PEDC) {
- hostportdup |= HPCS_PEDC;
- if (USB_HPCS & HPCS_PE) {
- port_speed = (uint8_t)((USB_HPCS & HPCS_PS) >> 17U);
- if (HPRT_PRTSPD_LOW_SPEED == port_speed) {
- USB_HFT = 6000U;
- if (HCTLR_6_MHZ != (USB_HCTL & HCTL_CLKSEL)) {
- if (USB_CORE_EMBEDDED_PHY == pudev->cfg.phy_interface) {
- USB_FSLSCLOCK_INIT(HCTLR_6_MHZ);
- }
- port_reset = 1U;
- }
- } else if(HPRT_PRTSPD_FULL_SPEED == port_speed) {
- USB_HFT = 48000U;
- if (HCTLR_48_MHZ != (USB_HCTL & HCTL_CLKSEL)) {
- if (USB_CORE_EMBEDDED_PHY == pudev->cfg.phy_interface) {
- USB_FSLSCLOCK_INIT(HCTLR_48_MHZ);
- }
- port_reset = 1U;
- }
- } else {
- /* for high speed device and others */
- port_reset = 1U;
- }
- }
- }
- if (port_reset) {
- usb_port_reset(pudev);
- }
- /* clear port interrupts */
- USB_HPCS = hostportdup;
- return retval;
- }
- /*!
- \brief handle the out channel interrupt
- \param[in] pudev: pointer to usb device instance
- \param[in] channel_num: host channel number which is in (0..7)
- \param[out] none
- \retval operation status
- */
- static uint32_t usbh_intf_hc_out (usb_core_handle_struct *pudev, uint8_t channel_num)
- {
- uint32_t channel_intr = USB_HCHxINTF((uint16_t)channel_num);
- usb_hostchannel_struct *puhc = &pudev->host.host_channel[channel_num];
- channel_intr &= USB_HCHxINTEN((uint16_t)channel_num);
- if (channel_intr & HCHINTF_ACK) {
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_ACK;
- } else if (channel_intr & HCHINTF_REQOVR) {
- /* handle queue overrun interrupt */
- USB_HCHxINTEN((uint16_t)channel_num) |= HCHINTEN_CHIE;
- usb_hostchannel_halt(pudev, channel_num);
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_REQOVR;
- } else if (channel_intr & HCHINTF_TF) {
- /* handle transfer finished interrupt */
- puhc->err_count = 0U;
- USB_HCHxINTEN((uint16_t)channel_num) |= HCHINTEN_CHIE;
- usb_hostchannel_halt(pudev, channel_num);
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_TF;
- puhc->status = HC_XF;
- } else if (channel_intr & HCHINTF_STALL) {
- /* handle stall */
- USB_HCHxINTEN((uint16_t)channel_num) |= HCHINTEN_CHIE;
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_STALL;
- usb_hostchannel_halt(pudev, channel_num);
- puhc->status = HC_STALL;
- } else if (channel_intr & HCHINTF_NAK) {
- /* handle NAK */
- puhc->err_count = 0U;
- USB_HCHxINTEN((uint16_t)channel_num) |= HCHINTEN_CHIE;
- usb_hostchannel_halt(pudev, channel_num);
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_NAK;
- puhc->status = HC_NAK;
- } else if (channel_intr & HCHINTF_USBER) {
- /* handle USB bus error */
- USB_HCHxINTEN((uint16_t)channel_num) |= HCHINTEN_CHIE;
- usb_hostchannel_halt(pudev, channel_num);
- puhc->status = HC_TRACERR;
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_USBER;
- } else if (channel_intr & HCHINTF_NYET) {
- /* handle NYET */
- puhc->err_count = 0U;
- USB_HCHxINTEN((uint16_t)channel_num) |= HCHINTEN_CHIE;
- usb_hostchannel_halt(pudev, channel_num);
- puhc->status = HC_NYET;
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_NYET;
- } else if (channel_intr & HCHINTF_DTER) {
- /* handle data toggle error */
- USB_HCHxINTEN((uint16_t)channel_num) |= HCHINTEN_CHIE;
- usb_hostchannel_halt(pudev, channel_num);
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_NAK;
- puhc->status= HC_DTGERR;
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_DTER;
- } else if (channel_intr & HCHINTF_CH) {
- /* handle channel halted */
- USB_HCHxINTEN((uint16_t)channel_num) &= ~HCHINTEN_CHIE;
- switch (puhc->status) {
- case HC_XF:
- puhc->urb_state = URB_DONE;
- if (USB_EPTYPE_BULK == ((USB_HCHxCTL((uint16_t)channel_num) & HCHCTL_EPTYPE) >> 18U)) {
- puhc->data_tg_out ^= 1U;
- }
- break;
- case HC_NAK:
- puhc->urb_state = URB_NOTREADY;
- break;
- case HC_NYET:
- puhc->urb_state = URB_NOTREADY;
- break;
- case HC_STALL:
- puhc->urb_state = URB_STALL;
- break;
- case HC_TRACERR:
- puhc->urb_state = URB_ERROR;
- break;
- default:
- break;
- }
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_CH;
- } else {
- /* no operation */
- }
- return 1U;
- }
- /*!
- \brief handle the in channel interrupt
- \param[in] pudev: pointer to usb device instance
- \param[in] channel_num: host channel number which is in (0..7)
- \param[out] none
- \retval operation status
- */
- static uint32_t usbh_intf_hc_in (usb_core_handle_struct *pudev, uint8_t channel_num)
- {
- uint8_t endp_type = 0U;
- usb_hostchannel_struct *puhc = &pudev->host.host_channel[channel_num];
- uint32_t channle_intf = USB_HCHxINTF((uint16_t)channel_num);
- __IO uint32_t channel_ctrl = USB_HCHxCTL((uint16_t)channel_num);
- channle_intf &= USB_HCHxINTEN((uint16_t)channel_num);
- endp_type = (uint8_t)((channel_ctrl & HCHCTL_EPTYPE) >> 18U);
- if (channle_intf & HCHINTF_ACK) {
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_ACK;
- } else if (channle_intf & HCHINTF_STALL) {
- USB_HCHxINTEN((uint16_t)channel_num) |= HCHINTEN_CHIE;
- puhc->status = HC_STALL;
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_NAK;
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_STALL;
- /* NOTE: When there is a 'stall', reset also nak,
- else, the pudev->host.status = HC_STALL
- will be overwritten by 'nak' in code below */
- channle_intf &= ~HCHINTF_NAK;
- usb_hostchannel_halt(pudev, channel_num);
- } else if (channle_intf & HCHINTF_DTER) {
- USB_HCHxINTEN((uint16_t)channel_num) |= HCHINTEN_CHIE;
- usb_hostchannel_halt(pudev, channel_num);
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_NAK;
- puhc->status = HC_DTGERR;
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_DTER;
- } else {
- /* no operation */
- }
- /* handle queue overrun interrupt */
- if (channle_intf & HCHINTF_REQOVR) {
- USB_HCHxINTEN((uint16_t)channel_num) |= HCHINTEN_CHIE;
- usb_hostchannel_halt(pudev, channel_num);
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_REQOVR;
- } else if (channle_intf & HCHINTF_TF) {
- /* handle transfer finished interrupt */
- puhc->status = HC_XF;
- puhc->err_count = 0U;
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_TF;
- if ((USB_EPTYPE_CTRL == endp_type) || (USB_EPTYPE_BULK == endp_type)) {
- USB_HCHxINTEN((uint16_t)channel_num) |= HCHINTEN_CHIE;
- usb_hostchannel_halt(pudev, channel_num);
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_NAK;
- puhc->data_tg_in ^= 1U;
- } else if (USB_EPTYPE_INTR == endp_type) {
- channel_ctrl |= HCHCTL_ODDFRM;
- USB_HCHxCTL((uint16_t)channel_num) = channel_ctrl;
- puhc->urb_state = URB_DONE;
- } else {
- /* no operation */
- }
- } else if (channle_intf & HCHINTF_CH) {
- /* handle channel halted */
- USB_HCHxINTEN((uint16_t)channel_num) &= ~HCHINTEN_CHIE;
- switch (puhc->status) {
- case HC_XF:
- puhc->urb_state = URB_DONE;
- break;
- case HC_TRACERR:
- case HC_DTGERR:
- puhc->err_count = 0U;
- puhc->urb_state = URB_ERROR;
- break;
- case HC_STALL:
- puhc->urb_state = URB_STALL;
- break;
- default:
- if (USB_EPTYPE_INTR == endp_type) {
- puhc->data_tg_in ^= 1U;
- }
- break;
- }
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_CH;
- } else if (channle_intf & HCHINTF_USBER) {
- /* handle USB bus error */
- USB_HCHxINTEN((uint16_t)channel_num) |= HCHINTEN_CHIE;
- puhc->status = HC_TRACERR;
- usb_hostchannel_halt(pudev, channel_num);
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_USBER;
- } else if (channle_intf & HCHINTF_NAK) {
- /* handle NAK */
- if (USB_EPTYPE_INTR == endp_type) {
- USB_HCHxINTEN((uint16_t)channel_num) |= HCHINTEN_CHIE;
- usb_hostchannel_halt(pudev, channel_num);
- }
- puhc->status = HC_NAK;
- USB_HCHxINTF((uint16_t)channel_num) = HCHINTF_NAK;
- if ((USB_EPTYPE_CTRL == endp_type) || (USB_EPTYPE_BULK == endp_type)) {
- /* re-activate the channel */
- channel_ctrl |= HCHCTL_CEN;
- channel_ctrl &= ~HCHCTL_CDIS;
- USB_HCHxCTL((uint16_t)channel_num) = channel_ctrl;
- }
- } else {
- /* no operation */
- }
- return 1U;
- }
- /*!
- \brief handle the rx fifo non-empty interrupt
- \param[in] pudev: pointer to usb device instance
- \param[out] none
- \retval operation status
- */
- static uint32_t usbh_intf_rxfifo_noempty (usb_core_handle_struct *pudev)
- {
- uint32_t count = 0U;
- __IO uint8_t channel_num = 0U;
- __IO uint32_t rx_status = 0U;
- uint32_t usbh_ch_ctl_reg = 0U;
- usb_hostchannel_struct *puhc;
- /* disable the rx status queue level interrupt */
- USB_GINTEN &= ~GINTF_RXFNEIF;
- rx_status = USB_GRSTATP;
- channel_num = (uint8_t)(rx_status & GRSTATRP_CNUM);
- puhc = &pudev->host.host_channel[channel_num];
- switch ((rx_status & GRSTATRP_RPCKST) >> 17) {
- case GRSTATR_RPCKST_IN:
- count = (rx_status & GRSTATRP_BCOUNT) >> 4;
- /* read the data into the host buffer. */
- if ((count > 0U) && (puhc->xfer_buff != (void *)0)) {
- usb_fifo_read(puhc->xfer_buff, (uint16_t)count);
- /* manage multiple Xfer */
- puhc->xfer_buff += count;
- puhc->xfer_count += count;
- if (USB_HCHxLEN((uint16_t)channel_num) & HCHLEN_PCNT) {
- /* re-activate the channel when more packets are expected */
- usbh_ch_ctl_reg = USB_HCHxCTL((uint16_t)channel_num);
- usbh_ch_ctl_reg |= HCHCTL_CEN;
- usbh_ch_ctl_reg &= ~HCHCTL_CDIS;
- USB_HCHxCTL((uint16_t)channel_num) = usbh_ch_ctl_reg;
- }
- }
- break;
- case GRSTATR_RPCKST_IN_XFER_COMP:
- break;
- case GRSTATR_RPCKST_DATA_TOGGLE_ERR:
- count = (rx_status & GRSTATRP_BCOUNT) >> 4;
- while (count > 0) {
- rx_status = USB_GRSTATP;
- count--;
- }
- break;
- case GRSTATR_RPCKST_CH_HALTED:
- default:
- break;
- }
- /* enable the rx status queue level interrupt */
- USB_GINTEN |= GINTF_RXFNEIF;
- return 1U;
- }
- /*!
- \brief handle the incomplete periodic transfer interrupt
- \param[in] pudev: pointer to usb device instance
- \param[out] none
- \retval operation status
- */
- static uint32_t usbh_intf_iso_incomplete_xfer (usb_core_handle_struct *pudev)
- {
- __IO uint32_t gint_flag = 0U;
- gint_flag = USB_HCHxCTL(0U);
- USB_HCHxCTL(0U) = 0U;
- gint_flag = 0U;
- /* clear interrupt */
- gint_flag |= GINTF_ISOONCIF;
- USB_GINTF = gint_flag;
- return 1U;
- }
|