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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? 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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品一区蜜桃臀影院| 欧美剧在线免费观看网站| 久久久精品免费网站| 国产综合久久久久久久久久久久| 欧美一区二区三区婷婷月色| 美女mm1313爽爽久久久蜜臀| 欧美不卡激情三级在线观看| 高清不卡一二三区| ...xxx性欧美| 在线不卡一区二区| 国产伦精品一区二区三区视频青涩 | 国产片一区二区三区| aaa亚洲精品| 日韩中文字幕麻豆| 2023国产精华国产精品| 97成人超碰视| 日韩和欧美一区二区三区| 久久精品人人做人人爽人人| 91视视频在线观看入口直接观看www| 亚洲国产综合视频在线观看| 国产一区 二区| 国产欧美精品一区aⅴ影院| 91麻豆文化传媒在线观看| 日日噜噜夜夜狠狠视频欧美人| 日韩欧美一区二区免费| 99re亚洲国产精品| 日韩精品免费专区| 国产欧美一区二区精品秋霞影院 | 国产精品亚洲一区二区三区妖精 | 中文字幕av一区 二区| 欧美伦理电影网| 国产精一区二区三区| 午夜国产精品影院在线观看| 亚洲国产精品高清| 91精品国产入口在线| 99国产精品久久久| 精品影视av免费| 亚洲自拍偷拍网站| 欧美激情资源网| 日韩一区二区在线观看| 色乱码一区二区三区88| 国产精品一区免费在线观看| 午夜久久久影院| 亚洲欧洲综合另类在线| 26uuu色噜噜精品一区二区| 欧美日韩精品欧美日韩精品一综合| 国产成人免费在线视频| 青青草国产成人99久久| 亚洲欧美日韩在线不卡| 国产欧美一区二区精品性色| 日韩午夜电影av| 欧美日韩国产经典色站一区二区三区| 波多野结衣在线aⅴ中文字幕不卡 波多野结衣在线一区 | 久久国产福利国产秒拍| 亚洲成人免费影院| ㊣最新国产の精品bt伙计久久| 欧美电影免费观看高清完整版在线| 欧美最猛性xxxxx直播| 91网站最新网址| 成人黄色网址在线观看| 国产伦精品一区二区三区免费迷| 日韩高清电影一区| 亚洲电影欧美电影有声小说| 亚洲黄一区二区三区| 亚洲丝袜自拍清纯另类| 欧美激情一区三区| 久久久久久久久久久99999| 久久影音资源网| 久久综合久久综合久久综合| 精品福利二区三区| 精品乱人伦一区二区三区| 日韩女优av电影| 欧美电影免费观看高清完整版在线| 欧美一级日韩免费不卡| 欧美一卡在线观看| 日韩欧美一级精品久久| 精品精品欲导航| 久久女同互慰一区二区三区| 欧美激情一区二区| 国产目拍亚洲精品99久久精品| 日本一区二区三区视频视频| 欧美激情综合在线| 亚洲天堂av老司机| 亚洲一区国产视频| 日韩av网站在线观看| 久草热8精品视频在线观看| 国产精品91xxx| 99综合电影在线视频| 欧洲精品在线观看| 欧美一级在线视频| 国产午夜亚洲精品不卡| 国产精品美女久久久久久久久久久| 日韩毛片一二三区| 亚洲综合成人在线| 麻豆成人av在线| 不卡的av在线播放| 欧美日韩国产精品自在自线| 精品国产91洋老外米糕| 国产精品久久久爽爽爽麻豆色哟哟 | 欧美成人欧美edvon| 国产日韩欧美a| 亚洲摸摸操操av| 日韩电影免费在线看| 国内久久精品视频| 色综合久久综合网97色综合| 337p亚洲精品色噜噜狠狠| 久久精品视频一区二区三区| 一区二区三区91| 久久精品国产在热久久| 99精品桃花视频在线观看| 欧美一区二视频| 中文字幕精品—区二区四季| 五月天激情综合网| 成人午夜视频福利| 777xxx欧美| 综合在线观看色| 久久91精品国产91久久小草| 色爱区综合激月婷婷| 久久一区二区三区四区| 亚洲va欧美va人人爽午夜| 国产成人av福利| 91精品国产综合久久精品图片 | 国产午夜久久久久| 亚洲国产精品天堂| 国产高清在线观看免费不卡| 欧美日韩一区 二区 三区 久久精品| 久久亚洲精华国产精华液| 亚洲成人av免费| 97精品国产97久久久久久久久久久久| 91精品国产品国语在线不卡| 亚洲人成亚洲人成在线观看图片| 激情欧美一区二区| 欧美日韩精品二区第二页| 中文字幕一区二区三区在线观看 | 亚洲自拍偷拍麻豆| 粉嫩蜜臀av国产精品网站| 日韩亚洲欧美在线| 一区二区三区国产精品| av电影在线不卡| 国产欧美一区在线| 久久国产综合精品| 69av一区二区三区| 亚洲另类春色国产| 北条麻妃国产九九精品视频| 久久精品欧美一区二区三区麻豆| 日本视频一区二区三区| 在线观看三级视频欧美| 国产精品国产三级国产三级人妇 | 色爱区综合激月婷婷| 欧美高清一级片在线观看| 国产一区二区三区av电影 | 国产精品视频免费| 国产在线日韩欧美| 日韩欧美亚洲一区二区| 日本午夜精品一区二区三区电影| 欧美日韩一区中文字幕| 亚洲资源中文字幕| 91黄色小视频| 亚洲综合精品久久| 色婷婷av一区二区三区大白胸| 日韩理论片在线| 99精品久久只有精品| 中文字幕人成不卡一区| 成人福利视频在线看| 中文字幕免费在线观看视频一区| 国产成人啪午夜精品网站男同| 国产亚洲精久久久久久| 国产精品一卡二| 日本一区二区三区四区| 粉嫩av一区二区三区| 中文字幕一区免费在线观看| 91在线精品秘密一区二区| 亚洲欧美影音先锋| 色婷婷亚洲综合| 亚洲制服丝袜av| 欧美一区国产二区| 黄色日韩网站视频| 国产精品伦一区| 色婷婷综合久久久中文一区二区 | 成人av在线一区二区| 自拍偷拍亚洲激情| 欧美性videosxxxxx| 蜜桃久久久久久久| 国产午夜精品福利| 91污在线观看| 日韩国产一区二| 久久夜色精品一区| av在线播放成人| 天天影视涩香欲综合网| 久久亚区不卡日本| 99久久99久久精品免费看蜜桃| 一区二区三区蜜桃网| 日韩一区和二区| 成人动漫一区二区三区| 一区2区3区在线看| 精品国精品国产尤物美女| 成人精品gif动图一区| 婷婷中文字幕综合| 国产日韩在线不卡| 欧美日韩精品欧美日韩精品一 |