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

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

?? pehci.c

?? usb isp1761驅動源代碼 可編進內核。
?? C
?? 第 1 頁 / 共 5 頁
字號:
/******************************************************************************
 * Philips ISP176x Host Controller Interface code file
 *
 * (c) 2002 Koninklijke Philips Electronics N.V. All rights reserved. <usb.linux@philips.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
 * 
 ********************************************************************************
 */

#include <linux/config.h>
#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 "pehci.h"
#include "../hal/hal_intf.h"
#include "../hal/isp1761.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,
	struct usb_host_endpoint *ep,
        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 /* | HC_EOT_INT | HC_CLKREADY_INT | HC_INTL_INT | HC_ATL_INT | HC_ISO_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 [] = "Philips";
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];
    qha = &hcd->qha;
    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:
                isp1761_mem_write(hcd->dev,(u32)mem_addr->phy_addr,0,(le32_to_cpu(qtd->hw_buf[0])),length,0);
                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

/*schedule next (atl/int)tds and any pending tds*/
    static void
pehci_hcd_schedule_pending_ptds(phci_hcd *hcd,u32 donemap,u8 bufftype,u16 only)
{
    struct ehci_qtd *qtd = 0;
    struct ehci_qh  *qh = 0;
    struct list_head *qtd_list = 0;
    struct _isp1761_qha allqha;
    struct _isp1761_qha *qha = 0;
    u32 mask = 0x1, index = 0;
    u32 location  = 0;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一级搡bbbb搡bbbb| 一区二区三区四区在线免费观看| 国产丝袜欧美中文另类| 亚洲男人天堂av网| 国产精品一区二区三区乱码| 91成人免费在线视频| 久久精品视频免费观看| 日日欢夜夜爽一区| 97aⅴ精品视频一二三区| 精品久久久久一区二区国产| 亚洲青青青在线视频| 国产麻豆一精品一av一免费 | 欧美疯狂做受xxxx富婆| 欧美国产一区二区| 美女网站色91| 欧美久久久久中文字幕| 17c精品麻豆一区二区免费| 国内精品伊人久久久久av一坑| 欧美特级限制片免费在线观看| 国产精品麻豆视频| 国产精品888| 久久久亚洲综合| 久久99九九99精品| 日韩一级二级三级精品视频| 亚洲国产精品久久人人爱| 91久久精品网| 亚洲免费观看高清完整版在线观看熊| 大尺度一区二区| 久久久久久夜精品精品免费| 久久福利资源站| 精品美女一区二区三区| 久久99国产精品尤物| 欧美成人国产一区二区| 精品在线观看免费| 欧美电影免费观看高清完整版在线 | 91精品国产综合久久福利软件| 亚洲免费av高清| 色乱码一区二区三区88| 一区二区三区四区视频精品免费 | 国产高清不卡二三区| 26uuu色噜噜精品一区二区| 精品一区二区三区影院在线午夜| 日韩欧美在线1卡| 久久99精品国产麻豆婷婷| 欧美tk—视频vk| 国产成人午夜99999| 中文字幕在线不卡一区二区三区| jvid福利写真一区二区三区| 亚洲三级在线播放| 欧美日韩一区二区三区四区| 日韩中文字幕91| 精品国产污污免费网站入口| 国产一区二区网址| 国产精品超碰97尤物18| 欧美日韩一区国产| 蜜桃一区二区三区在线| 欧美激情中文字幕| 在线视频欧美精品| 美洲天堂一区二卡三卡四卡视频| 久久亚洲精品小早川怜子| 成人av影视在线观看| 亚洲国产成人tv| 精品国产乱码久久久久久老虎| av色综合久久天堂av综合| 亚洲电影一级片| 久久亚洲一区二区三区四区| 99精品国产99久久久久久白柏| 亚洲电影你懂得| 国产性做久久久久久| 欧美手机在线视频| 国产99久久久国产精品潘金网站| 一区二区三区精品在线| 日韩免费观看高清完整版| 不卡av免费在线观看| 奇米四色…亚洲| 国产精品久久久久毛片软件| 欧美日韩一区三区四区| 国产成人午夜精品5599| 天堂成人国产精品一区| 国产精品人人做人人爽人人添| 欧美日韩视频在线观看一区二区三区| 国产美女视频91| 日韩精品一级中文字幕精品视频免费观看 | 丝袜美腿亚洲一区二区图片| 国产精品三级久久久久三级| 91麻豆精品国产91久久久久| 成人视屏免费看| 全国精品久久少妇| 一区二区激情小说| 欧美国产一区二区| 日韩欧美一区电影| 欧美伦理电影网| 日本乱人伦aⅴ精品| 懂色中文一区二区在线播放| 麻豆freexxxx性91精品| 亚洲小说欧美激情另类| 亚洲欧美日韩电影| 欧美国产丝袜视频| 久久日一线二线三线suv| 欧美日韩久久一区二区| 欧洲一区二区av| 91在线看国产| 成人在线综合网| 国产成人av一区二区三区在线 | 狠狠v欧美v日韩v亚洲ⅴ| 婷婷中文字幕一区三区| 一区二区激情小说| 一区二区三区在线视频免费| **性色生活片久久毛片| 国产精品超碰97尤物18| 国产精品五月天| 欧美国产日韩精品免费观看| 久久久亚洲欧洲日产国码αv| 日韩精品中文字幕一区| 日韩一级二级三级精品视频| 欧美一区二区网站| 精品久久人人做人人爽| 久久久美女毛片| 国产精品网友自拍| 日韩码欧中文字| 亚洲精品亚洲人成人网在线播放| 日韩一区在线看| 亚洲人123区| 亚洲午夜精品17c| 天使萌一区二区三区免费观看| 婷婷丁香激情综合| 奇米777欧美一区二区| 久草中文综合在线| 国产另类ts人妖一区二区| 粉嫩一区二区三区在线看| 粉嫩一区二区三区性色av| 99精品国产视频| 欧美高清你懂得| 久久日一线二线三线suv| 国产精品久久久久婷婷| 亚洲免费观看高清完整版在线 | 亚洲人成亚洲人成在线观看图片 | 国产一区啦啦啦在线观看| 老司机免费视频一区二区| 国产精品资源在线观看| 91在线一区二区| 欧美日本一区二区三区四区| 日韩亚洲欧美高清| 国产精品电影一区二区三区| 亚洲成在人线在线播放| 国产一区在线不卡| 在线免费观看视频一区| 日韩一区二区在线观看| 中文文精品字幕一区二区| 综合久久一区二区三区| 秋霞av亚洲一区二区三| 粉嫩一区二区三区性色av| 欧美色区777第一页| 久久久天堂av| 亚洲日本青草视频在线怡红院| 亚洲成人午夜影院| 国产福利91精品| 欧美猛男超大videosgay| 久久精品亚洲乱码伦伦中文| 一区二区在线观看视频在线观看| 激情综合色综合久久| 91在线观看地址| 精品国产乱码久久久久久久久| 亚洲男同性视频| 国产一区二区三区免费在线观看| 色综合视频在线观看| 精品免费视频一区二区| 亚洲国产综合色| 成人av电影观看| 欧美精品一区二区蜜臀亚洲| 亚洲激情欧美激情| 国产不卡在线一区| 精品欧美一区二区三区精品久久| 亚洲精品国产一区二区精华液| 麻豆国产精品官网| 欧美男男青年gay1069videost| 亚洲品质自拍视频| 国产·精品毛片| 日韩天堂在线观看| 亚洲va欧美va天堂v国产综合| 风间由美一区二区三区在线观看 | 国产一区视频导航| 日韩欧美在线1卡| 五月天激情综合网| 欧美日韩专区在线| 尤物视频一区二区| 97精品视频在线观看自产线路二| 国产午夜亚洲精品不卡| 久久99精品久久久| 日韩视频一区二区在线观看| 亚洲高清不卡在线| 欧美日韩亚洲国产综合| 亚洲女爱视频在线| 色素色在线综合| 自拍偷拍亚洲欧美日韩| 99精品国产一区二区三区不卡| 国产精品私人自拍| 不卡电影一区二区三区| 国产精品美女一区二区三区 | 久久99精品久久久|