/***************************************************************************** ** FILE NAME : ltqhcd_queue.c ** PROJECT : Lantiq USB sub-system V3 ** MODULES : Lantiq USB sub-system Host and Device driver ** SRC VERSION : 3.2 ** DATE : 1/Jan/2011 ** AUTHOR : Chen, Howard ** DESCRIPTION : This file contains the functions to manage Queue Heads and Queue ** Transfer Descriptors. ** FUNCTIONS : ** COMPILER : gcc ** REFERENCE : Synopsys DWC-OTG Driver 2.7 ** COPYRIGHT : Copyright (c) 2010 ** LANTIQ DEUTSCHLAND GMBH, ** Am Campeon 3, 85579 Neubiberg, Germany ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** Version Control Section ** ** $Author$ ** $Date$ ** $Revisions$ ** $Log$ Revision history *****************************************************************************/ /* * This file contains code fragments from Synopsys HS OTG Linux Software Driver. * For this code the following notice is applicable: * * ========================================================================== * * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless * otherwise expressly agreed to in writing between Synopsys and you. * * The Software IS NOT an item of Licensed Software or Licensed Product under * any End User Software License Agreement or Agreement for Licensed Product * with Synopsys or any supplement thereto. You are permitted to use and * redistribute this Software in source and binary forms, with or without * modification, provided that redistributions of source code must retain this * notice. You may not view, use, disclose, copy or distribute this file or * any information contained herein except pursuant to this license grant from * Synopsys. If you do not agree with this notice, including the disclaimer * below, then you are not authorized to use the Software. * * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS 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. * ========================================================================== */ /*! \file ltqhcd_queue.c \ingroup LTQUSB_DRIVER_V3 \brief This file contains the functions to manage Queue Heads and Queue Transfer Descriptors. */ #include #include "ltqusb_version.h" #include #include #include #include #include #include #include #include #include #include "ltqusb_plat.h" #include "ltqusb_regs.h" #include "ltqusb_cif.h" #include "ltqhcd.h" #ifdef __EPQD_DESTROY_TIMEOUT__ #define epqh_self_destroy_timeout 300 static void eqph_destroy_func(unsigned long _ptr) { ltqhcd_epqh_t *epqh=(ltqhcd_epqh_t *)_ptr; if(epqh) { if(epqh->sysep) { epqh->sysep->hcpriv=NULL; } ltqhcd_epqh_free (epqh); } } #endif /*! \brief This function allocates and initializes a EPQH. \param _ltqhcd The HCD state structure for the USB Host controller. \param[in] _urb Holds the information about the device/endpoint that we need to initialize the EPQH. \return Returns pointer to the newly allocated EPQH, or NULL on error. * == AVM/VGJ 20150914 - Always called with SPIN_LOCK_IRQSAVE == */ static ltqhcd_epqh_t *ltqhcd_epqh_create (ltqhcd_hcd_t *_ltqhcd, struct urb *_urb) { ltqhcd_epqh_t *epqh; hprt0_data_t hprt0; struct usb_host_endpoint *sysep = ltqhcd_urb_to_endpoint(_urb); /* Allocate memory */ epqh=(ltqhcd_epqh_t *) kmalloc (sizeof(ltqhcd_epqh_t), GFP_ATOMIC); if(epqh == NULL) return NULL; memset (epqh, 0, sizeof (ltqhcd_epqh_t)); epqh->sysep=sysep; epqh->devno=_urb->dev->devnum; epqh->ltqhcd=_ltqhcd; epqh->phase=EPQH_IDLE; /* Initialize EPQH */ switch (usb_pipetype(_urb->pipe)) { case PIPE_CONTROL : epqh->ep_type = LTQUSB_EP_TYPE_CTRL; epqh->burst_on=0;break; case PIPE_BULK : epqh->ep_type = LTQUSB_EP_TYPE_BULK; epqh->burst_on=1;break; case PIPE_ISOCHRONOUS: epqh->ep_type = LTQUSB_EP_TYPE_ISOC; epqh->burst_on=0;break; case PIPE_INTERRUPT : epqh->ep_type = LTQUSB_EP_TYPE_INTR; epqh->burst_on=0;break; } usb_settoggle(_urb->dev, usb_pipeendpoint (_urb->pipe), !usb_pipein(_urb->pipe), LTQUSB_HC_PID_DATA0); epqh->mps = usb_maxpacket(_urb->dev, _urb->pipe, !(usb_pipein(_urb->pipe))); INIT_LIST_HEAD(&epqh->urbd_list); /* == AVM/VGJ 20151016 - release_list now belongs to ltqhcd and its init is in ltqhcd_init== */ //INIT_LIST_HEAD(&epqh->release_list); INIT_LIST_HEAD(&epqh->ql); INIT_LIST_HEAD(&epqh->ql_all); /* == AVM/VGJ 20150914 - locks substituted by general lock == */ //INIT_URBD_LIST(epqh); //INIT_URBD_RELEASE_LIST(epqh); /* FS/LS Enpoint on HS Hub * NOT virtual root hub */ epqh->need_split = 0; hprt0.d32 = ltqusb_read_hprt0 (&_ltqhcd->core_if); #ifdef __USE_XFER_STOPPER__ if (hprt0.b.prtspd == LTQUSB_HPRT0_PRTSPD_HIGH_SPEED) _ltqhcd->use_hrtimer=1; else _ltqhcd->use_hrtimer=0; #endif if (hprt0.b.prtspd == LTQUSB_HPRT0_PRTSPD_HIGH_SPEED && ((_urb->dev->speed == USB_SPEED_LOW) || (_urb->dev->speed == USB_SPEED_FULL)) && (_urb->dev->tt) && (_urb->dev->tt->hub->devnum != 1)) { LTQ_DEBUGPL(DBG_HCD, "QH init: EP %d: TT found at hub addr %d, for port %d\n", usb_pipeendpoint(_urb->pipe), _urb->dev->tt->hub->devnum, _urb->dev->ttport); epqh->need_split = 1; /* == AVM/VGJ 20151116 - Leave burst on for Full Speed split == */ //epqh->burst_on=0; } if (epqh->ep_type == LTQUSB_EP_TYPE_INTR || epqh->ep_type == LTQUSB_EP_TYPE_ISOC) { /* Compute scheduling parameters once and save them. */ epqh->interval = _urb->interval+1; if(epqh->need_split) epqh->interval *= 8; } #ifdef __EN_ISOC__ if (epqh->ep_type == LTQUSB_EP_TYPE_ISOC) _ltqhcd->isoc_ep_count++; #endif epqh->period_counter=0; #ifdef __EPQD_DESTROY_TIMEOUT__ /* Start a timer for this transfer. */ init_timer(&epqh->destroy_timer); epqh->destroy_timer.function = eqph_destroy_func; epqh->destroy_timer.data = (unsigned long)(epqh); #endif #ifdef __DEBUG__ LTQ_DEBUGPL(DBG_HCD , "LTQUSB HCD EPQH Initialized\n"); LTQ_DEBUGPL(DBG_HCDV, "LTQUSB HCD EPQH - epqh = %p\n", epqh); LTQ_DEBUGPL(DBG_HCDV, "LTQUSB HCD EPQH - Device Address = %d EP %d, %s\n", _urb->dev->devnum, usb_pipeendpoint(_urb->pipe), usb_pipein(_urb->pipe) == USB_DIR_IN ? "IN" : "OUT"); LTQ_DEBUGPL(DBG_HCDV, "LTQUSB HCD EPQH - Speed = %s\n", ({ char *speed; switch (_urb->dev->speed) { case USB_SPEED_LOW: speed = "low" ; break; case USB_SPEED_FULL: speed = "full"; break; case USB_SPEED_HIGH: speed = "high"; break; default: speed = "?"; break; }; speed;})); LTQ_DEBUGPL(DBG_HCDV, "LTQUSB HCD EPQH - Type = %s\n", ({ char *type; switch (epqh->ep_type) { case LTQUSB_EP_TYPE_ISOC: type = "isochronous"; break; case LTQUSB_EP_TYPE_INTR: type = "interrupt" ; break; case LTQUSB_EP_TYPE_CTRL: type = "control" ; break; case LTQUSB_EP_TYPE_BULK: type = "bulk" ; break; default: type = "?"; break; }; type; })); if (epqh->ep_type == LTQUSB_EP_TYPE_INTR) LTQ_DEBUGPL(DBG_HCDV, "LTQUSB HCD EPQH - interval = %d\n", epqh->interval); #endif list_add_tail(&epqh->ql_all, &_ltqhcd->epqh_list_all); /* == AVM/VGJ 20150914 - lock substituted by general lock == */ //LOCK_EPQH_LIST(_ltqhcd); switch (epqh->ep_type) { case LTQUSB_EP_TYPE_CTRL: list_add_tail(&epqh->ql, &_ltqhcd->epqh_list_ctrl); break; case LTQUSB_EP_TYPE_BULK: list_add_tail(&epqh->ql, &_ltqhcd->epqh_list_bulk); break; case LTQUSB_EP_TYPE_INTR: list_add_tail(&epqh->ql, &_ltqhcd->epqh_list_intr); break; #ifdef __EN_ISOC__ case LTQUSB_EP_TYPE_ISOC: list_add_tail(&epqh->ql, &_ltqhcd->epqh_list_isoc); break; #endif default: LTQ_ERROR("%s() unknown epqh type\n",__func__); } /* == AVM/VGJ 20150914 - lock substituted by general lock == */ //UNLOCK_EPQH_LIST(_ltqhcd); return epqh; } /*! \brief Free the EPQH. EPQH should already be removed from a list. URBD list should already be empty if called from URB Dequeue. \param[in] _epqh The EPQH to free. * == AVM/VGJ 20150914 - Always called with SPIN_LOCK_IRQSAVE == */ void ltqhcd_epqh_free (ltqhcd_epqh_t *_epqh) { /* == AVM/VGJ 20150914 - Irq saved before entering == */ //unsigned long flags; if(!_epqh) return; if(_epqh->sysep) _epqh->sysep->hcpriv=NULL; _epqh->sysep=NULL; /* == AVM/VGJ 20150914 == */ //local_irq_save (flags); /* == AVM/VGJ 20151016 - epqh can now be freed before completing the urbs == */ //if(!list_empty(&_epqh->urbd_list) || !list_empty(<qhcd->release_list)) if(!list_empty(&_epqh->urbd_list)) LTQ_ERROR("%s() %p epqh not empty\n",__func__,_epqh); else { /* == AVM/VGJ 20150914 - lock substituted by general lock == */ //LOCK_EPQH_LIST_ALL(_epqh->ltqhcd); if (!list_empty(&_epqh->ql_all)) list_del_init (&_epqh->ql_all); //UNLOCK_EPQH_LIST_ALL(_epqh->ltqhcd); /* == AVM/VGJ 20150914 - lock substituted by general lock == */ //LOCK_EPQH_LIST(_epqh->ltqhcd); // AVM/VGJ 20150903 - Spinlock taken before calling ltqhcd_epqh_free if (!list_empty(&_epqh->ql)) list_del_init (&_epqh->ql); //UNLOCK_EPQH_LIST(_epqh->ltqhcd); #ifdef __EPQD_DESTROY_TIMEOUT__ del_timer(&_epqh->destroy_timer); #endif kfree (_epqh); } /* == AVM/VGJ 20150914 == */ //local_irq_restore (flags); } /* AVM/VGJ 20150903 - Always called with general lock. * Called with SPIN_LOCK_IRQSAVE when not in yield context */ void ltqhcd_epqh_idle(ltqhcd_epqh_t *_epqh) { /* == AVM/VGJ 20150914 - lock substituted by general lock and taken before entering == */ //unsigned long flags; //local_irq_save(flags); //LOCK_URBD_LIST(_epqh); if(_epqh->phase==EPQH_DISABLING ){ }else if (list_empty(&_epqh->urbd_list)) { if(_epqh->ep_type == LTQUSB_EP_TYPE_ISOC || _epqh->ep_type == LTQUSB_EP_TYPE_INTR) _epqh->phase=EPQH_STDBY; else { _epqh->phase=EPQH_IDLE; #ifdef __EPQD_DESTROY_TIMEOUT__ del_timer(&_epqh->destroy_timer); _epqh->destroy_timer.expires = jiffies + (HZ*epqh_self_destroy_timeout); add_timer(&_epqh->destroy_timer ); #endif } } else { /* == AVM/VGJ 20161216 - Do not set endpoint queue as ready if there was an error or a dequeue == */ if(_epqh->phase!=EPQH_PAUSED) { _epqh->phase=EPQH_READY; } #ifdef __EPQD_DESTROY_TIMEOUT__ del_timer(&_epqh->destroy_timer); #endif } /* == AVM/VGJ 20150914 - lock substituted by general lock and taken before entering == */ //UNLOCK_URBD_LIST(_epqh); //local_irq_restore(flags); } /* AVM/VGJ 20150914 * Always called with general lock * Called with SPIN_LOCK_IRQSAVE when not in yield context */ void ltqhcd_epqh_idle_periodic(ltqhcd_epqh_t *_epqh) { /* == AVM/VGJ 20150914 - lock substituted by general lock and taken before entering == */ //unsigned long flags; if(_epqh->ep_type != LTQUSB_EP_TYPE_ISOC && _epqh->ep_type != LTQUSB_EP_TYPE_INTR && _epqh->phase!=EPQH_STDBY) return; /* == AVM/VGJ 20150914 == */ //local_irq_save(flags); //LOCK_URBD_LIST(_epqh); if (!list_empty(&_epqh->urbd_list)) LTQ_WARN("%s() invalid epqh state(not empty)\n",__func__); if(_epqh->phase==EPQH_DISABLING ){ }else { _epqh->phase=EPQH_IDLE; #ifdef __EPQD_DESTROY_TIMEOUT__ del_timer(&_epqh->destroy_timer); _epqh->destroy_timer.expires = jiffies + (HZ*epqh_self_destroy_timeout); add_timer(&_epqh->destroy_timer ); #endif #ifdef __EN_ISOC__ if (_epqh->ep_type == LTQUSB_EP_TYPE_ISOC) _epqh->ltqhcd->isoc_ep_count--; #endif } /* == AVM/VGJ 20150914 == */ //UNLOCK_URBD_LIST(_epqh); //local_irq_restore(flags); } static void process_unaligned( ltqhcd_urbd_t *_urbd, ltqhcd_epqh_t *_epqh, ltqusb_core_if_t *_core_if) { #if defined(__UNALIGNED_BUF_ADJ__) || defined(__UNALIGNED_BUF_CHK__) if(!_urbd->aligned_checked) { #if defined(__UNALIGNED_BUF_ADJ__) uint32_t xfer_len; if(_urbd->aligned_buf) { ltqusb_free_buf_h(_urbd->aligned_buf); _urbd->aligned_buf=NULL; } if(_urbd->aligned_setup) { ltqusb_free_buf_h(_urbd->aligned_setup); _urbd->aligned_setup=NULL; } xfer_len=_urbd->urb->transfer_buffer_length; if(_urbd->is_in && xfer_len<_epqh->mps) xfer_len = _epqh->mps; if(xfer_len > 0 && ((unsigned long)_urbd->xfer_buff) & _core_if->unaligned_mask) { _urbd->aligned_buf = ltqusb_alloc_buf_h(xfer_len, _urbd->is_in); if(!_urbd->aligned_buf) LTQ_ERROR("Unaligned buf alloc error\n"); else if(!_urbd->is_in) memcpy(_urbd->aligned_buf, _urbd->xfer_buff, xfer_len); } if(_epqh->ep_type==LTQUSB_EP_TYPE_CTRL) { if(((unsigned long)_urbd->setup_buff) & _core_if->unaligned_mask) { _urbd->aligned_setup = ltqusb_alloc_buf_h(8,0); if(!_urbd->aligned_setup) LTQ_ERROR("Unaligned setup buf alloc error\n"); else memcpy(_urbd->aligned_setup, _urbd->setup_buff, 8); } } #elif defined(__UNALIGNED_BUF_CHK__) if(_urbd->is_in) { if(_urbd->urb->transfer_buffer_length==0) LTQ_WARN("%s():%d IN xfer while length is zero \n",__func__,__LINE__); else{ if(((unsigned long)_urbd->xfer_buff) & _core_if->unaligned_mask) LTQ_WARN("%s():%d IN xfer Buffer UNALIGNED\n",__func__,__LINE__); } } else { if(_urbd->urb->transfer_buffer_length > 0 && (((unsigned long)_urbd->xfer_buff) & _core_if->unaligned_mask)) LTQ_WARN("%s():%d OUT xfer Buffer UNALIGNED\n",__func__,__LINE__); } if(_epqh->ep_type==LTQUSB_EP_TYPE_CTRL) { if(((unsigned long)_urbd->setup_buff) & _core_if->unaligned_mask) LTQ_WARN("%s():%d SETUP xfer Buffer UNALIGNED\n",__func__,__LINE__); } #endif } _urbd->aligned_checked=1; #endif } /* == AVM/VGJ 20150914 - Always called with SPIN_LOCK_IRQSAVE == */ ltqhcd_epqh_t *ltqhcd_urbd_create (ltqhcd_hcd_t *_ltqhcd,struct urb *_urb) { ltqhcd_urbd_t *urbd; struct usb_host_endpoint *sysep; ltqhcd_epqh_t *epqh=NULL; /* == AVM/VGJ 20150914 - irqs saved before entering the function == */ //unsigned long flags; int retval; /* == AVM/VGJ 20150914 - irqs saved before entering the function == */ //local_irq_save(flags); sysep = ltqhcd_urb_to_endpoint(_urb); /* == AVM/VGJ 20150914 - lock substituted by general lock == */ //LOCK_EPQH_LIST_ALL(_ltqhcd); epqh = sysep_to_epqh(_ltqhcd, sysep,1); if (!epqh) { sysep->hcpriv = NULL; epqh = ltqhcd_epqh_create (_ltqhcd, _urb); } //UNLOCK_EPQH_LIST_ALL(_ltqhcd); if (!epqh) { LTQ_ERROR("EPQH Error alloc\n"); /* == AVM/VGJ 20150914 - irqs saved before entering the function == */ //local_irq_restore (flags); return (ltqhcd_epqh_t *)NULL; } if(epqh->phase==EPQH_DISABLING) { LTQ_ERROR("EPQH Error alloc while disabling\n"); /* == AVM/VGJ 20150914 - irqs saved before entering the function == */ //local_irq_restore (flags); return (ltqhcd_epqh_t *)NULL; } sysep->hcpriv = epqh; if(_urb->hcpriv) { LTQ_WARN("%s() Previous urb->hcpriv exist %p\n",__func__,_urb->hcpriv); #if 1 /* == AVM/VGJ 20150914 - irqs saved before entering the function == */ //local_irq_restore (flags); return (ltqhcd_epqh_t *)NULL; #else urbd = _urb->hcpriv; if(urbd->epqh!=epqh) LTQ_WARN("%s() Previous urb->hcpriv exist %p and epqh not the same %p %p\n",__func__,_urb->hcpriv,urbd->epqh,epqh); #endif } else { urbd = (ltqhcd_urbd_t *) kmalloc (sizeof(ltqhcd_urbd_t), GFP_ATOMIC); if (!urbd) { LTQ_ERROR("%s(): could not allocate memory for urbd",__func__); /* == AVM/VGJ 20150914 - irqs saved before entering the function == */ //local_irq_restore (flags); return (ltqhcd_epqh_t *)NULL; } memset (urbd, 0, sizeof (ltqhcd_urbd_t)); INIT_LIST_HEAD(&urbd->ql); /*== AVM/VGJ 20150812 - usbcore needs HCD link/unlink URBs ==*/ retval = usb_hcd_link_urb_to_ep(ltqhcd_to_syshcd(_ltqhcd), _urb); if (unlikely(retval)){ switch(retval){ case -EPERM: LTQ_WARN("%s(): usb_hcd_link_urb_to_ep failed. URB is being killed",__func__); break; case -ENOENT: LTQ_WARN("%s(): usb_hcd_link_urb_to_ep failed. EP in URB is not enabled",__func__); break; case -EHOSTUNREACH: LTQ_WARN("%s(): usb_hcd_link_urb_to_ep failed. Dev in URB cannot submit ",__func__); break; case -ESHUTDOWN: LTQ_WARN("%s(): usb_hcd_link_urb_to_ep failed. Host controller not running",__func__); break; default: LTQ_WARN("%s(): usb_hcd_link_urb_to_ep failed. Reason unknown",__func__); } kfree(urbd); /* == AVM/VGJ 20150914 - irqs saved before entering the function == */ //local_irq_restore (flags); return (ltqhcd_epqh_t *)NULL; } } _urb->hcpriv = urbd; urbd->urb = _urb; urbd->epqh = epqh; urbd->status= -EINPROGRESS; urbd->is_in=usb_pipein(_urb->pipe) ? 1 : 0; #ifdef __EN_ISOC__ if(epqh->ep_type == LTQUSB_EP_TYPE_ISOC) { if((_urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) && _urb->transfer_dma && (_urb->transfer_dma &3)==0) urbd->xfer_buff = (uint8_t *) (KSEG1ADDR((uint32_t *)_urb->transfer_dma)); else urbd->isoc_xfer_buff = (uint8_t *) _urb->transfer_buffer; } else #endif { if(_urb->transfer_buffer_length>0) { /* == AVM/VGJ 20151001 - Initialize current sg pointer if there are defined sgs == */ if( _urb->num_mapped_sgs ) { urbd->sg = _urb->sg; /* == AVM/VGJ 20160125 Unaligned addresses are not accepted with SG == */ if( (sg_dma_address(urbd->sg) & 3) != 0 ) { LTQ_ERROR("%s(): ERROR! unaligned SG memory address\n", __func__); kfree(urbd); return (ltqhcd_epqh_t *)NULL; } /* == AVM/VGJ 20151001 - Always use transfer_dma if it is defined == */ //} else if((_urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP) && _urb->transfer_dma && (_urb->transfer_dma &3)==0) { } else if( _urb->transfer_dma ) { urbd->xfer_buff = (uint8_t *) (KSEG1ADDR((uint32_t *)_urb->transfer_dma)); } else { urbd->xfer_buff = (uint8_t *) _urb->transfer_buffer; /* == AVM/VGJ 20151005 - Needed when transfer_dma is not defined == */ #if 1 // cache write-back, so DMA engine can get correct content. Precaution dma_cache_wback_inv((unsigned long)urbd->xfer_buff, _urb->transfer_buffer_length); #endif } } } if(epqh->ep_type == LTQUSB_EP_TYPE_CTRL) { if(_urb->setup_dma && (_urb->setup_dma &3)==0 ) urbd->setup_buff = (uint8_t *) (KSEG1ADDR((uint32_t *)_urb->setup_dma)); else { urbd->setup_buff = (uint8_t *) _urb->setup_packet; /* == AVM/VGJ 20151005 - Needed when transfer_dma is not defined == */ #if 1 // cache write-back, so DMA engine can get correct content. Precaution dma_cache_wback_inv((unsigned long)urbd->setup_buff, 16); #endif } } /* == AVM/VGJ 20150914 - lock substituted by general lock == */ //LOCK_URBD_LIST(epqh); if (!list_empty(&urbd->ql)) list_del_init(&urbd->ql); list_add_tail(&urbd->ql, &epqh->urbd_list); /* == AVM/VGJ 20151006 - urbd_count only useful for debugging == */ #ifdef __DEBUG__ epqh->urbd_count++; #endif //UNLOCK_URBD_LIST(epqh); process_unaligned( urbd, epqh, (&_ltqhcd->core_if)); /* == AVM/VGJ 20150914 - irqs saved before entering the function == */ //local_irq_restore (flags); return epqh; } ltqhcd_epqh_t * sysep_to_epqh(ltqhcd_hcd_t *_ltqhcd, struct usb_host_endpoint *_sysep, int _skipcancel) { ltqhcd_epqh_t *epqh; list_for_each_entry( epqh, &_ltqhcd->epqh_list_all, ql_all) { if(!(_skipcancel && epqh->cancelling)) { if( epqh->sysep==_sysep) return epqh; } } return NULL; }