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

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

?? hal_x86.c

?? ISP 1761 usb host driver for linux
?? C
?? 第 1 頁 / 共 3 頁
字號:
/************************************************************
 * NXP ISP176x Hardware Abstraction Layer 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: hal_x86.c
 *
 * Refering linux kernel version 2.6.9
 *
 * History:
 *
 * Date                Author                  Comments
 * ---------------------------------------------------------------------
 * Nov 29 2005        Prabhakar Kalasani      Initial Creation     
 *
 **********************************************************************
 */
#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/usb.h>
#include <linux/pci.h>
#include <linux/poll.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/system.h>
#include <asm/unaligned.h>
#include <asm/dma.h>

/*--------------------------------------------------------------*
 *               linux system include files
 *--------------------------------------------------------------*/
#include "hal_x86.h"
#include "../hal/hal_intf.h"
#include "../hal/isp1761.h"

/*--------------------------------------------------------------*
 *               Local variable Definitions
 *--------------------------------------------------------------*/
struct isp1761_dev              isp1761_loc_dev[ISP1761_LAST_DEV];
static  struct isp1761_hal      hal_data;
static  __u32             pci_io_base  = 0;
void     *iobase = 0;
int      iolength = 0;
static   __u32           pci_mem_phy0 =0;
static    __u32           pci_mem_len = 0xffff;
static  int               isp1761_pci_latency;

/*--------------------------------------------------------------*
 *               Local # Definitions
 *--------------------------------------------------------------*/
#define         PCI_ACCESS_RETRY_COUNT  20
#define         PLX_INT_CSR_REG         0x68
#define         PLX_LBRD0_REG           0x18
#define         PLX_LBRD0_WAIT_STATE_MASK       0x000000C3
#define         PLX_LBRD0_WAIT_STATES           0x00000003
#define         isp1761_driver_name     "1761-pci"

/*--------------------------------------------------------------*
 *               Local Function 
 *--------------------------------------------------------------*/

static void __devexit isp1761_pci_remove (struct pci_dev *dev);
static int __devinit isp1761_pci_probe (struct pci_dev *dev, 
        const struct pci_device_id *id);
static int isp1761_pci_suspend (struct pci_dev *dev, __u32 state);
static int isp1761_pci_resume (struct pci_dev *dev);
static irqreturn_t  isp1761_pci_isr (int irq, void *dev_id, struct pt_regs *regs);


/*--------------------------------------------------------------*
 *              ISP 1761 interrupt locking functions
 *--------------------------------------------------------------*/
int             isp1761_hw_lock = 0;
int             isp1761_hw_isr = 0;

void isp1761_disable_interrupt(void) {
    
    struct isp1761_dev  *dev;
    u32 hw_mode_buff;
    
    /* Process the Host Controller Driver */
    dev = &isp1761_loc_dev[ISP1761_HC];
    
    hw_mode_buff = isp1761_reg_read32(dev, HC_HW_MODE_REG, hw_mode_buff);

    /* Disable ISP176x global interrupt */
    hw_mode_buff &= ~(0x1);
        
    isp1761_reg_write32(dev, HC_HW_MODE_REG, hw_mode_buff);
}

void isp1761_enable_interrupt(void) {
    struct isp1761_dev  *dev;
    u32 hw_mode_buff;
    
    /* Process the Host Controller Driver */
    dev = &isp1761_loc_dev[ISP1761_HC];
    
    hw_mode_buff = isp1761_reg_read32(dev, HC_HW_MODE_REG, hw_mode_buff);

    /* Enable ISP176x global interrupt */
    hw_mode_buff |= 0x1;
    
    isp1761_reg_write32(dev, HC_HW_MODE_REG, hw_mode_buff);
}




/*--------------------------------------------------------------*
 *               ISP1761 Interrupt Service Routine
 *--------------------------------------------------------------*/
/*Interrupt Service Routine for device controller*/
irqreturn_t isp1761_pci_dc_isr(int irq, void *data, struct pt_regs *r)
{
    struct isp1761_dev *dev;
    dev = &isp1761_loc_dev[ISP1761_DC];

    hal_entry("%s: Entered\n",__FUNCTION__);
    /*not ready yet*/
    if(dev->active == 0)
    {
        printk("isp1761_pci_dc_isr: dev->active is NULL \n");
        return IRQ_NONE;
    }

    /* Get the source of interrupts for Device Controller
     * Device Controller interrupts are cleared by the driver
     * during processing
     */

    /*unblock the device interrupt*/

    isp1761_reg_write32(dev, DEV_UNLOCK_REGISTER, 0xaa37);
    dev->int_reg = isp1761_reg_read32(dev, DEV_INTERRUPT_REGISTER, dev->int_reg);
    hal_int("isp1761_pci_dc_isr:INTERRUPT_REGISTER 0x%x\n",dev->int_reg);
    /*clear the interrupt source*/
    isp1761_reg_write32(dev, 0x218, dev->int_reg);
    dev->int_reg &= 0x03fffdb9;
    if(dev->int_reg)
        dev->handler(dev, dev->isr_data,r);
    hal_entry("%s: Exit\n",__FUNCTION__);
    return IRQ_HANDLED;
}

/* Interrupt Service Routine of isp1761                                   
 * Reads the source of interrupt and calls the corresponding driver's ISR.
 * Before calling the driver's ISR clears the source of interrupt.
 * The drivers can get the source of interrupt from the dev->int_reg field
 */
irqreturn_t     isp1761_pci_isr(int irq, void *__data, struct pt_regs *r) 
{
    __u32               irq_mask = 0;
    struct isp1761_dev  *dev;
    hal_entry("%s: Entered\n",__FUNCTION__);
    isp1761_disable_interrupt();
    /* Process the Host Controller Driver */
    dev = &isp1761_loc_dev[ISP1761_HC];
    /* Get the source of interrupts for Host Controller*/
    dev->int_reg = isp1761_reg_read32(dev, HC_INTERRUPT_REG,dev->int_reg);
    isp1761_reg_write32(dev,HC_INTERRUPT_REG,dev->int_reg);
    irq_mask = isp1761_reg_read32(dev, HC_INTENABLE_REG,irq_mask);

    dev->int_reg &= irq_mask; /*shared irq ??*/
    /*call the Host Isr if any valid(minus otg)interrupt is present*/
    if(dev->int_reg & ~HC_OTG_INTERRUPT)                
        dev->handler(dev,dev->isr_data,r);
#ifdef OTG
#ifndef MSEC_INT_BASED
    mdelay(1);
#endif
    /*process otg interrupt if there is any*/
    if(dev->int_reg & HC_OTG_INTERRUPT){
        u32     otg_int;        
#ifndef MSEC_INT_BASED
        mdelay(1);
#endif
        otg_int = (dev->int_reg & HC_OTG_INTERRUPT);
        /* Process OTG controller Driver 
         * Since OTG is part of  HC interrupt register, 
         * the interrupt source will be HC interrupt Register
         * */
        dev = &isp1761_loc_dev[ISP1761_OTG];
        /* Read the source of  OTG_INT and clear the
           interrupt source */
        dev->int_reg = otg_int; 
        dev->handler(dev, dev->isr_data,r);
    }   
#endif
    dev->handler(dev, dev->isr_data,r);
    isp1761_enable_interrupt();
    hal_entry("%s: Exit\n",__FUNCTION__);
    return IRQ_HANDLED;
} /* End of isp1362_pci_isr */

/*--------------------------------------------------------------*
 *               PCI Driver Interface Functions
 *--------------------------------------------------------------*/

static const struct pci_device_id __devinitdata isp1761_pci_ids [] = {
    {
        /* handle PCI BRIDE  manufactured by PLX */
class:          ((PCI_CLASS_BRIDGE_OTHER << 8) | (0x06 << 16)),
class_mask:     ~0,
                /* no matter who makes it */
vendor:         /*0x10B5,*/PCI_ANY_ID,
device:         /*0x5406,*/PCI_ANY_ID,
subvendor:      PCI_ANY_ID,
subdevice:      PCI_ANY_ID,
    }, 
    { /* end: all zeroes */ }
};

MODULE_DEVICE_TABLE (pci, isp1761_pci_ids);

/* Pci driver interface functions */
static struct pci_driver isp1761_pci_driver = {
name:           "isp1761-hal",
id_table:       &isp1761_pci_ids[0],
probe:         isp1761_pci_probe,
remove:        isp1761_pci_remove,
};


/*--------------------------------------------------------------*
 *               ISP1761 Read write routine 
 *--------------------------------------------------------------*/

/* Write a 32 bit Register of isp1761 */
void isp1761_reg_write32(struct isp1761_dev *dev,__u16 reg,__u32 data)
{ 
    /* Write the 32bit to the register address given to us*/
    writel(data,dev->baseaddress+reg);
}


/* Read a 32 bit Register of isp1761 */
__u32 isp1761_reg_read32(struct isp1761_dev *dev,__u16 reg,__u32 data)
{ 

    data = readl(dev->baseaddress + reg);
    return data;
}


/* Read a 16 bit Register of isp1761 */
__u16 isp1761_reg_read16(struct isp1761_dev *dev,__u16 reg,__u16 data)
{ 
    data = readw(dev->baseaddress+reg);
    return data;
}

/* Write a 16 bit Register of isp1761 */
void isp1761_reg_write16(struct isp1761_dev *dev,__u16 reg,__u16 data)
{ 
    writew(data,dev->baseaddress+reg);

}

/*--------------------------------------------------------------*
 *  
 * Module dtatils: isp1761_mem_read
 *
 * Memory read using PIO method.
 *
 *  Input: struct isp1761_driver *drv  -->  Driver structure.
 *                      __u32 start_add     --> Starting address of memory 
 *              __u32 end_add     ---> End address 
 *              
 *              __u32 * buffer      --> Buffer pointer.
 *              __u32 length       ---> Length 
 *              __u16 dir          ---> Direction ( Inc or Dec)
 *                      
 *  Output     int Length  ----> Number of bytes read 
 *
 *  Called by: system function 
 * 
 * 
 *--------------------------------------------------------------*/
/* Memory read function PIO */

int     
isp1761_mem_read(struct isp1761_dev *dev, __u32 start_add, 
        __u32 end_add, __u32 * buffer, __u32 length, __u16 dir)
{
    u8 *temp_base_mem = 0;      
    u8 *one = (u8 *) buffer;
    u16 *two = (u16 *) buffer;
    int a = (int)length;
    u32 w;
    temp_base_mem= (dev->baseaddress + start_add);
    /*initialize the Register 0x33C-used to manage Multiple threads */
    writel(start_add,dev->baseaddress+0x33c);
	if(buffer == NULL)
	{
		printk("@@@@ In isp1761_mem_read The buffer is pointing to null\n");
		return 0;
	}
last:
    w = readl(temp_base_mem);
    if(a == 1){
        *one=(u8)w;
        return 0;
    }
    if(a == 2){
        *two=(u16)w;
        return 0;
    }   
    if(a == 3){
        *two=(u16)w;
        two += 1;
        w >>= 16;
        *two = (u8)(w);
        return 0;

    }

    while(a>0){
        *buffer = w;
        temp_base_mem = temp_base_mem+4;
        start_add +=4;
        a -= 4;
        if(a == 0)
            break;
        if(a < 4){
            buffer += 1;
            one = (u8 *)buffer;
            two = (u16 *)buffer;
            goto last;
        }
        buffer += 1;
        w = readl(temp_base_mem); 
    }
    return ((a < 0) || (a == 0))?0:(-1);

}

/*--------------------------------------------------------------*
 *  
 * Module dtatils: isp1761_mem_write
 *
 * Memory write using PIO method.
 *
 *  Input: struct isp1761_driver *drv  -->  Driver structure.
 *                      __u32 start_add     --> Starting address of memory 
 *              __u32 end_add     ---> End address 
 *              
 *              __u32 * buffer      --> Buffer pointer.
 *              __u32 length       ---> Length 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区四区在线| 久久久久久久久久电影| 经典一区二区三区| 亚洲色图色小说| 国产精品视频观看| 欧美日韩精品综合在线| 91在线精品秘密一区二区| 激情五月激情综合网| 午夜电影一区二区三区| 欧美国产日产图区| 久久嫩草精品久久久久| 精品国产免费久久| 欧美大片国产精品| 正在播放一区二区| 97精品国产露脸对白| 成人久久久精品乱码一区二区三区| 久久电影网电视剧免费观看| 国产精品成人在线观看| 国产精品视频看| 亚洲国产成人在线| 国产精品成人午夜| 国产精品护士白丝一区av| 国产精品天美传媒沈樵| 亚洲国产精品精华液2区45| www成人在线观看| 精品动漫一区二区三区在线观看| 日韩精品最新网址| 久久久亚洲高清| 中文av字幕一区| 日韩美女啊v在线免费观看| 精品国产亚洲一区二区三区在线观看| 欧美成人官网二区| 国产日产欧产精品推荐色| 中文乱码免费一区二区| 亚洲男女一区二区三区| 五月天亚洲婷婷| 美女国产一区二区三区| 国产精品77777| 一本久道中文字幕精品亚洲嫩| 国产精品乱码久久久久久| 91精品国产色综合久久不卡蜜臀| 日韩高清中文字幕一区| 麻豆精品视频在线观看免费 | 91视频免费看| 在线成人小视频| 亚洲一区自拍偷拍| 91福利在线导航| 亚洲精品国产一区二区精华液| 成人激情小说乱人伦| 久久免费的精品国产v∧| 久久激情五月激情| 亚洲精品一区二区三区福利| 一区二区三区四区乱视频| 99久久精品国产网站| 欧美精品一区二区三区很污很色的| 日韩不卡一区二区三区| 777xxx欧美| 免费在线观看成人| 欧美va亚洲va国产综合| 九九精品视频在线看| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 欧美视频一区在线| 亚洲曰韩产成在线| 欧美三电影在线| 亚洲成a人片在线观看中文| 56国语精品自产拍在线观看| 日一区二区三区| 欧美精品久久99| 精品在线一区二区三区| 国产欧美日韩另类视频免费观看 | 国产夜色精品一区二区av| 国产1区2区3区精品美女| 精品999在线播放| 91视频国产资源| 日本va欧美va精品| 欧美电影影音先锋| 一区二区三区四区五区视频在线观看 | 日韩欧美视频一区| 91看片淫黄大片一级在线观看| 日韩电影在线一区| 亚洲人妖av一区二区| 欧美成人精品二区三区99精品| 成人av网站在线观看免费| 日本最新不卡在线| 亚洲人成小说网站色在线| 久久综合久久综合久久| 欧美日韩情趣电影| 成人h精品动漫一区二区三区| 午夜精品久久一牛影视| 亚洲精品高清在线观看| 国产欧美一区二区精品久导航 | 91麻豆国产福利在线观看| 紧缚捆绑精品一区二区| 婷婷久久综合九色国产成人| 最新国产成人在线观看| 精品1区2区在线观看| 在线成人午夜影院| 欧美日韩午夜在线| 欧美亚洲免费在线一区| 91免费看片在线观看| 成人在线综合网| 国产精品亚洲一区二区三区妖精| 麻豆精品视频在线观看免费| 日韩精品电影一区亚洲| 亚洲午夜激情av| 亚洲一区视频在线观看视频| 国产精品国产精品国产专区不片| 久久久久高清精品| 国产日韩精品一区| 国产女人水真多18毛片18精品视频 | 久久亚洲综合色| 欧美刺激午夜性久久久久久久| 91精品国产色综合久久不卡电影| 91福利资源站| 欧美日韩精品免费| 欧美日韩视频在线观看一区二区三区| 91在线国内视频| 色88888久久久久久影院按摩| 色婷婷精品久久二区二区蜜臀av| 91色九色蝌蚪| 欧美在线免费播放| 欧美猛男男办公室激情| 欧美日韩久久久| 欧美成人在线直播| 国产日韩欧美综合一区| 国产精品美女久久久久aⅴ国产馆| 国产日产欧美一区二区三区| 国产精品私人自拍| 亚洲精品成人悠悠色影视| 性久久久久久久久久久久| 日韩av在线发布| 国产精品综合二区| 99久久精品费精品国产一区二区| 91久久精品一区二区三| 欧美精品精品一区| 精品国精品国产尤物美女| 国产亚洲精品超碰| 亚洲人成网站在线| 秋霞午夜av一区二区三区| 久草中文综合在线| 99久久99久久精品免费观看| 欧美色手机在线观看| 日韩片之四级片| 国产精品黄色在线观看| 亚洲二区视频在线| 国产伦精品一区二区三区视频青涩| av在线不卡电影| 欧美日韩三级一区| 久久精品水蜜桃av综合天堂| 一区二区三区四区av| 日本aⅴ免费视频一区二区三区 | 精品中文字幕一区二区小辣椒| 成人av手机在线观看| 欧美日韩国产精品成人| 久久久久国色av免费看影院| 亚洲成人久久影院| 高清久久久久久| 欧美日韩视频一区二区| 国产精品久久久久影院色老大 | 伊人色综合久久天天人手人婷| 日韩va欧美va亚洲va久久| 成人免费黄色大片| 欧美一区二区视频观看视频| 国产精品色哟哟网站| 蜜臀av性久久久久av蜜臀妖精 | 7777女厕盗摄久久久| 中文字幕高清一区| 热久久久久久久| 色欧美片视频在线观看在线视频| 日韩午夜激情av| 久久av老司机精品网站导航| 97aⅴ精品视频一二三区| 日韩美女天天操| 亚洲午夜在线观看视频在线| 本田岬高潮一区二区三区| 91麻豆精品国产自产在线观看一区| 国产欧美日韩不卡免费| 久久成人久久爱| 欧美日韩国产美| 一区二区三区蜜桃| aaa欧美大片| 国产精品无人区| 国产激情91久久精品导航| 欧美一区二区三区免费视频| 亚洲欧洲日韩在线| 不卡高清视频专区| 久久女同精品一区二区| 激情综合色综合久久| 日韩一级欧美一级| 免费亚洲电影在线| 日韩一区二区精品在线观看| 视频一区视频二区中文| 91福利国产精品| 亚洲一区二区三区视频在线| 在线看国产日韩| 亚洲综合在线电影| 欧美性做爰猛烈叫床潮| 亚洲电影在线免费观看| 欧美色图免费看| 视频一区二区三区在线|