亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pehci.c

?? ISP 1761 usb host driver for linux
?? C
?? 第 1 頁 / 共 5 頁
字號:
/******************************************************************************************************
 * NXP ISP176x Host Controller Interface code file
 *
 * (c) 2006 NXP B.V., All rights reserved. <usb.linux@nxp.com>
 * 
 * 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.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 * 
 * File Name: pehci.c
 * 
 * Refering linux kernel version 2.6.9
 *
 * History:     
 *
 * Date                  Author                  Comments
 * ------------------------------------------------------------------------------------------------------
 * June 21, 2005         krishan                  Initial version
 * July 4, 2005          krishan                  Handling unprotected urbs
 * Feb 6, 2006           Grant H.                 Added ISO support
 * April 21, 2006        Grant H.                 Added bug fixes
 * May 02 2007		 Prabhakar		  ported to 2.6.20 with backward compatibility with 2.6.9  
 *********************************************************************************************************
 */
#ifdef LINUX_269
#include <linux/config.h>
#endif
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/smp_lock.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/timer.h>
#include <linux/list.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/usb.h>
#include <linux/version.h>
#include <stdarg.h>
#include <asm/byteorder.h>
#include <asm/io.h>
#include <asm/dma.h>
#include <asm/irq.h>
#include <asm/system.h>
#include <asm/unaligned.h>

#include "../hal/hal_intf.h"
#include "../hal/isp1761.h"
#include "pehci.h"

#define EHCI_TUNE_CERR          3
#define URB_NO_INTERRUPT        0x0080
#define EHCI_TUNE_RL_TT         0
#define EHCI_TUNE_MULT_TT       1
#define EHCI_TUNE_RL_HS         0
#define EHCI_TUNE_MULT_HS       1

#ifdef CONFIG_ISO_SUPPORT

#define FALSE 0
#define TRUE (!FALSE)

extern void * phcd_iso_itd_to_ptd( phci_hcd *hcd,
        struct ehci_itd *itd,
        struct urb *urb,
        void  * ptd
        );

extern  unsigned long phcd_submit_iso( phci_hcd *hcd,
#ifdef LINUX_269
#else
	struct usb_host_endpoint *ep,
#endif
        struct urb *urb,
        unsigned long *status
        );
#endif /* CONFIG_ISO_SUPPORT */

#ifdef OTG
#include "otg.c"
#endif

/*Enable all other interrupt.*/
#ifdef MSEC_INT_BASED
#define INTR_ENABLE_MASK (HC_MSEC_INT)
#else
#define INTR_ENABLE_MASK (/*HC_MSEC_INT |*/ HC_INTL_INT | HC_ATL_INT | HC_EOT_INT /*| HC_ISO_INT*/)
#endif

/*---------------------------------------------------
 *    Globals for EHCI 
 -----------------------------------------------------*/

/* used when updating hcd data */
static spinlock_t hcd_data_lock = SPIN_LOCK_UNLOCKED;

static const char       hcd_name [] = "ISP1761HCD";
static td_ptd_map_buff_t td_ptd_map_buff[TD_PTD_TOTAL_BUFF_TYPES];      /* td-ptd map buffer for all 1362 buffers */

static __u8             td_ptd_pipe_x_buff_type[TD_PTD_TOTAL_BUFF_TYPES] = {    
    TD_PTD_BUFF_TYPE_ATL,                                       
    TD_PTD_BUFF_TYPE_INTL,                                      
    TD_PTD_BUFF_TYPE_ISTL                                       
};

/*global memory blocks*/
isp1761_mem_addr_t memalloc[BLK_TOTAL];
#include "mem.c"
#include "qtdptd.c"

#ifdef CONFIG_ISO_SUPPORT 
#include "itdptd.c"
#endif /* CONFIG_ISO_SUPPORT */

static int
pehci_rh_control (struct usb_hcd *usb_hcd,u16  typeReq,
        u16 wValue,u16 wIndex,char *buf,u16 wLength);

/*----------------------------------------------------*/
    static void 
pehci_complete_device_removal(phci_hcd *hcd,struct ehci_qh *qh)
{
    td_ptd_map_t *td_ptd_map;
    td_ptd_map_buff_t *td_ptd_buff;

    if(qh->type == TD_PTD_BUFF_TYPE_ISTL){
        return;
    }

    td_ptd_buff = &td_ptd_map_buff[qh->type];
    td_ptd_map = &td_ptd_buff->map_list[qh->qtd_ptd_index];

    /*this flag should only be set when device is going*/
    td_ptd_map->state = TD_PTD_REMOVE;
    /*if nothing there*/
    if(list_empty(&qh->qtd_list)){
        if(td_ptd_map->state != TD_PTD_NEW){
            phci_hcd_release_td_ptd_index(qh);
        }
        qha_free(qha_cache, qh);
        qh = 0;
        return;
    }
    /*MUST not come down below this*/
    err("Never Error: Should not come to this portion of code\n");    

    return;
}

/*functions looks for the values in register
  specified in ptr, if register values masked
  with the mask and result is equal to done,
  operation is successful else fails with timeout*/
    static int
pehci_hcd_handshake (phci_hcd *hcd,u32 ptr,u32 mask,u32 done,int usec)
{
    u32 result = 0;
    do {
        result = isp1761_reg_read32(hcd->dev,ptr,result);
        if (result == ~(u32)0)          /* card removed */
            return -ENODEV;
        result &= mask;
        if (result == done)
            return 0;
        udelay (1);
        usec--;
    } while (usec > 0);
    return -ETIMEDOUT;
}

#ifndef MSEC_INT_BASED
/*schedule atl and interrupt tds,
  only when we are not running on sof interrupt
 */
    static void
pehci_hcd_td_ptd_submit_urb(phci_hcd *hcd,struct ehci_qh *qh,u8 bufftype)
{
    unsigned long flags;
    struct ehci_qtd *qtd = 0;
    struct urb *urb = 0;
    struct _isp1761_qha *qha = 0;
    u32 location  = 0;
    u32 skipmap = 0;
    u32 buffstatus = 0;
    u32 ormask = 0;
    u32 intormask = 0;
    u32 length = 0;
    struct list_head *head;

    td_ptd_map_t        *td_ptd_map;
    td_ptd_map_buff_t *ptd_map_buff;
    struct isp1761_mem_addr *mem_addr = 0;

    pehci_entry("++ %s: Entered\n",__FUNCTION__);
    pehci_print("Buuffer type %d\n",bufftype);

    spin_lock_irqsave(&hcd->lock, flags);
    ptd_map_buff = &td_ptd_map_buff[bufftype];
#ifdef LINUX_269    
    qha = hcd->qha;
#else
    qha = &hcd->qha;
#endif
    switch(bufftype){
        case TD_PTD_BUFF_TYPE_ATL:
            skipmap = isp1761_reg_read32(hcd->dev, hcd->regs.atltdskipmap, skipmap);
            ormask = isp1761_reg_read32(hcd->dev, hcd->regs.atl_irq_mask_or, ormask);
            break;
        case TD_PTD_BUFF_TYPE_INTL:
            skipmap = isp1761_reg_read32(hcd->dev, hcd->regs.inttdskipmap, skipmap);
            intormask = isp1761_reg_read32(hcd->dev, hcd->regs.int_irq_mask_or,intormask);
            break;
        default:
            skipmap = isp1761_reg_read32(hcd->dev, hcd->regs.isotdskipmap, skipmap);
            break;

    }

    buffstatus = isp1761_reg_read32(hcd->dev,hcd->regs.buffer_status,buffstatus);

    /*header, qtd, and urb of current transfer*/
    location = qh->qtd_ptd_index;
    td_ptd_map = &ptd_map_buff->map_list[location];

    if(!(qh->qh_state & QH_STATE_TAKE_NEXT)){
        pehci_check("qh will schdule from interrupt routine,map %x\n",td_ptd_map->ptd_bitmap);
        spin_unlock_irqrestore(&hcd->lock, flags);
        return;
    }
    head = &qh->qtd_list;
    qtd = list_entry(head->next, struct ehci_qtd, qtd_list);

    /*already scheduled??????, may be from interrupt*/
    if(!(qtd->state & QTD_STATE_NEW)){
        pehci_check("qtd already in, state %x\n",qtd->state);
        spin_unlock_irqrestore(&hcd->lock, flags);
        return;
    }

    qtd->state &= ~QTD_STATE_NEW;
    qtd->state |= QTD_STATE_SCHEDULED;

    qh->qh_state &= ~QH_STATE_TAKE_NEXT;
    /*take the first td*/
    td_ptd_map->qtd = qtd;
    /*take the urb*/
    urb = qtd->urb;
    ptd_map_buff->active_ptds++;

    /*trust the atl worker, at this location there wont be any td*/
    /*if this td is the last one*/
    if(qtd->state & QTD_STATE_LAST){
        qh->hw_current = cpu_to_le32(0);
        /*else update the hw_next of qh to the next td*/
    }else{
        qh->hw_current = qtd->hw_next;
    }
    memset(qha, 0, sizeof( isp1761_qha));

    pehci_check("td being scheduled : length: %d, device: %d, map: %x\n", qtd->length,urb->dev->devnum, td_ptd_map->ptd_bitmap);
    /*NEW, now need to get the memory for this transfer*/
    length = qtd->length;
    mem_addr = &qtd->mem_addr;
    phci_hcd_mem_alloc(length,mem_addr,0);
    if(length && ((mem_addr->phy_addr == 0 )
                || (mem_addr->virt_addr == 0))){
        err("Never Error: Can not allocate memory for the current td,length %d\n",length);
        /*should not happen*/
        /*can happen only when we exceed the limit of devices we support
          MAX 4 mass storage at a time*/        
    }   
    phci_hcd_qha_from_qtd(hcd,qtd,qtd->urb, (void *)qha,
            td_ptd_map->ptd_ram_data_addr,
            qh
            /*td_ptd_map->datatoggle*/);
    if(qh->type == TD_PTD_BUFF_TYPE_INTL){
        phci_hcd_qhint_schedule(hcd, qh,qtd,(isp1761_qhint *)qha,qtd->urb);
    }
    /*write qha into the header of the host controller*/
    isp1761_mem_write(hcd->dev, td_ptd_map->ptd_header_addr,0,(u32 *)(qha),PHCI_QHA_LENGTH,0);

    /*if this is SETUP/OUT token , then need to write into the buffer*/
    /*length should be valid and supported by the ptd*/
    if(qtd->length && (qtd->length <= HC_ATL_PL_SIZE))
        switch(PTD_PID(qha->td_info2)){
            case OUT_PID:
            case SETUP_PID:
#ifdef LINUX_269            	
                isp1761_mem_write(hcd->dev,(u32)mem_addr->phy_addr,0,(le32_to_cpu(qtd->hw_buf[0])),length,0);
#else
                isp1761_mem_write(hcd->dev,(u32)mem_addr->phy_addr,0,(void*)(le32_to_cpu(qtd->hw_buf[0])),length,0);
#endif
                break;
        }

    /*unskip the tds at this location*/
    switch(bufftype){
        case TD_PTD_BUFF_TYPE_ATL:
            skipmap &= ~td_ptd_map->ptd_bitmap;
            /*enable atl interrupts on donemap*/
            ormask |=  td_ptd_map->ptd_bitmap;
            isp1761_reg_write32(hcd->dev, hcd->regs.atl_irq_mask_or, ormask);
            break;

        case TD_PTD_BUFF_TYPE_INTL:
            skipmap &= ~td_ptd_map->ptd_bitmap;
            intormask |= td_ptd_map->ptd_bitmap;
            isp1761_reg_write32(hcd->dev, hcd->regs.int_irq_mask_or, intormask);
            break;

        case TD_PTD_BUFF_TYPE_ISTL:
            skipmap &= ~td_ptd_map->ptd_bitmap;
            isp1761_reg_write32(hcd->dev, hcd->regs.isotdskipmap, skipmap);
            break;
    }

    /*if any new schedule, enable the atl buffer*/
    switch(bufftype){
        case TD_PTD_BUFF_TYPE_ATL:
            isp1761_reg_write32(hcd->dev, hcd->regs.buffer_status, buffstatus | ATL_BUFFER);
            isp1761_reg_write32(hcd->dev, hcd->regs.atltdskipmap, skipmap);
            buffstatus |= ATL_BUFFER;
            break;
        case TD_PTD_BUFF_TYPE_INTL:
            isp1761_reg_write32(hcd->dev, hcd->regs.buffer_status, buffstatus | INT_BUFFER);
            isp1761_reg_write32(hcd->dev, hcd->regs.inttdskipmap, skipmap);
            break;
        case TD_PTD_BUFF_TYPE_ISTL:
            /*not supposed to be seen here*/
            isp1761_reg_write32(hcd->dev, hcd->regs.buffer_status, buffstatus | ISO_BUFFER);
            break;
    }
    spin_unlock_irqrestore(&hcd->lock, flags);
    pehci_entry("-- %s: Exit\n",__FUNCTION__);
    return;

}
#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产女人aaa级久久久级| 色视频一区二区| 久久久五月婷婷| 国产精品自拍一区| 中文字幕高清不卡| 91丨九色porny丨蝌蚪| 亚洲最快最全在线视频| 在线播放欧美女士性生活| 男女男精品视频| 久久久www成人免费毛片麻豆| 成人一级黄色片| 亚洲乱码中文字幕| 欧美一区二区精品在线| 国产精品一区三区| 亚洲免费大片在线观看| 91精品国产欧美一区二区| 国产一区二区免费看| 国产精品福利在线播放| 欧美吞精做爰啪啪高潮| 九一久久久久久| 亚洲天堂2016| 制服视频三区第一页精品| 国产成人激情av| 亚洲午夜免费电影| 久久久激情视频| 欧美性三三影院| 国产精品99久久久久久有的能看 | 日韩一区二区三区电影| 国产综合成人久久大片91| 亚洲欧美国产77777| 日韩欧美高清在线| 色综合天天在线| 精品一区二区三区av| 亚洲码国产岛国毛片在线| 日韩欧美精品三级| 日本精品裸体写真集在线观看| 蜜桃av一区二区| 亚洲免费在线看| 久久久久久久免费视频了| 欧美日韩一二三区| 成人h动漫精品一区二| 老司机精品视频一区二区三区| 亚洲人成网站色在线观看| 2023国产精品视频| 欧美精品成人一区二区三区四区| 国产成人免费高清| 另类小说综合欧美亚洲| 亚洲一级二级三级| 中文字幕一区二区视频| 精品美女在线观看| 欧美日韩国产中文| 色综合久久综合中文综合网| 国产99精品国产| 紧缚捆绑精品一区二区| 日日摸夜夜添夜夜添国产精品| 亚洲欧美偷拍三级| 国产精品国产三级国产aⅴ中文| 日韩精品一区二| 91精品国产美女浴室洗澡无遮挡| 在线观看一区不卡| 97久久人人超碰| 成人黄色在线视频| 成人午夜在线播放| 国产精品羞羞答答xxdd| 国内外成人在线| 激情五月婷婷综合网| 蜜臀精品一区二区三区在线观看 | 日韩精品一区二区三区swag| 欧美欧美午夜aⅴ在线观看| 91精品办公室少妇高潮对白| 99国产精品视频免费观看| 成人综合激情网| 欧美三级视频在线播放| 在线视频亚洲一区| 欧美在线三级电影| 欧美天堂一区二区三区| 在线精品亚洲一区二区不卡| 91国在线观看| 欧美日韩免费在线视频| 欧美三级在线看| 欧美老年两性高潮| 91精品欧美一区二区三区综合在 | 久久精品久久精品| 久久电影网电视剧免费观看| 精油按摩中文字幕久久| 精品一区二区三区欧美| 国产黄色精品视频| 国产成人av自拍| 成人精品亚洲人成在线| 91网页版在线| 欧美午夜精品一区二区蜜桃| 欧美三日本三级三级在线播放| 欧美精品在欧美一区二区少妇| 91麻豆精品国产91久久久资源速度| 欧美一级黄色片| 精品蜜桃在线看| 欧美国产激情二区三区| 亚洲欧美日韩在线| 午夜日韩在线电影| 精品亚洲成av人在线观看| 国产成人午夜视频| 91激情在线视频| 91精品国产aⅴ一区二区| 精品国产乱码久久久久久久久| 久久精品一区蜜桃臀影院| 成人免费一区二区三区视频| 亚洲成人手机在线| 久久国产人妖系列| 国产成人精品午夜视频免费| 国产日韩综合av| 亚洲免费观看高清完整版在线| 亚洲国产成人av好男人在线观看| 亚洲小说欧美激情另类| 国产自产高清不卡| 99精品欧美一区二区三区小说 | 精品国产污网站| 欧美mv日韩mv| 亚洲视频精选在线| 日韩电影在线观看电影| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 99riav久久精品riav| 91精品久久久久久蜜臀| 国产精品美女久久久久av爽李琼 | 日本成人中文字幕在线视频| 国产91精品一区二区麻豆网站 | 亚洲二区视频在线| 国产精品一区专区| 欧美日韩精品电影| 国产精品国产三级国产aⅴ入口| 丝瓜av网站精品一区二区| 成人h精品动漫一区二区三区| 91麻豆精品国产91久久久久久久久| 国产精品私人影院| 免费成人av在线播放| 日本乱码高清不卡字幕| 国产视频一区在线观看| 日韩在线一区二区| 91日韩在线专区| 欧美国产亚洲另类动漫| 蜜臀av一区二区| 欧美日韩电影在线| 一区二区在线观看av| 国产成人一区二区精品非洲| 日韩欧美国产三级| 亚洲高清免费视频| 色偷偷成人一区二区三区91| 国产拍欧美日韩视频二区| 麻豆国产欧美日韩综合精品二区| 在线观看欧美精品| 亚洲色图欧洲色图婷婷| 高清国产午夜精品久久久久久| 欧美mv日韩mv国产| 美国三级日本三级久久99| 欧美亚洲国产bt| 亚洲制服丝袜av| 在线观看欧美日本| 一区二区在线观看不卡| 色综合色狠狠综合色| 国产精品欧美一区喷水| 丁香婷婷综合色啪| 国产农村妇女精品| 国产成人在线视频网站| 久久婷婷色综合| 国内一区二区在线| 久久久99久久| 国产成人综合自拍| 国产日本欧洲亚洲| 成人一区二区视频| 中文字幕在线观看不卡| 99视频精品在线| 亚洲精品高清在线观看| 色哟哟亚洲精品| 樱花影视一区二区| 欧美日韩在线综合| 日韩av午夜在线观看| 欧美一区二区三区爱爱| 久久国产精品区| 久久综合999| 成人福利视频网站| 亚洲精品中文在线观看| 欧美日韩一区久久| 男男gaygay亚洲| 久久综合九色综合欧美就去吻| 国产很黄免费观看久久| 国产精品午夜久久| 在线观看一区二区视频| 日韩精品视频网| 久久综合国产精品| av激情综合网| 亚洲成人一区二区| 精品少妇一区二区三区视频免付费| 国产美女视频一区| 专区另类欧美日韩| 欧美精品日韩精品| 激情小说欧美图片| 亚洲女与黑人做爰| 欧美一区二区三区思思人| 国产成人在线视频网站| 一区二区三区波多野结衣在线观看| 欧美日韩欧美一区二区|