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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? nic_init.c

?? plx9054的WDM驅(qū)動(dòng)程序
?? C
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
            DebugPrint(LOUD, DBG_INIT,
                "I/O mapped CSR: (%x) Length: (%d)\n",
                resourceTrans->u.Port.Start.LowPart,
                resourceTrans->u.Port.Length);
            
            //
            // Since we know the resources are listed in the same order the as
            // BARs in the config space, this should be the second one. 
            //
            if(numberOfBARs != 2) {
                DebugPrint(ERROR, DBG_INIT, "I/O mapped CSR is not in the right order\n");                
                status = STATUS_DEVICE_CONFIGURATION_ERROR;
                goto End;                
            }
            
            //
            // The port is in memory space on this machine.
            // We shuld use READ_PORT_Xxx, and WRITE_PORT_Xxx routines
            // to read or write to the port.
            //

            FdoData->IoBaseAddress = ULongToPtr(resourceTrans->u.Port.Start.LowPart);
            FdoData->IoRange = resourceTrans->u.Port.Length;
            //
            // Since all our accesses are USHORT wide, we will create an accessor
            // table just for these two functions.  
            //
            FdoData->ReadPort = NICReadPortUShort; 
            FdoData->WritePort = NICWritePortUShort;
            
            bResPort = TRUE;
            FdoData->MappedPorts = FALSE;            
            break;

        case CmResourceTypeMemory:

            numberOfBARs++;

            if(numberOfBARs == 1) {
                DebugPrint(LOUD, DBG_INIT, "Memory mapped CSR:(%x:%x) Length:(%d)\n",
                                        resourceTrans->u.Memory.Start.LowPart, 
                                        resourceTrans->u.Memory.Start.HighPart, 
                                        resourceTrans->u.Memory.Length);
                //
                // Our CSR memory space should be 0x1000 in size.            
                //
                ASSERT(resourceTrans->u.Memory.Length == 0x1000);
                FdoData->MemPhysAddress = resourceTrans->u.Memory.Start;
                FdoData->CSRAddress = MmMapIoSpace(
                                                resourceTrans->u.Memory.Start,
                                                NIC_MAP_IOSPACE_LENGTH,
                                                MmNonCached);   
                if(FdoData->CSRAddress == NULL) {
                    DebugPrint(ERROR, DBG_INIT, "MmMapIoSpace failed\n"); 			   
                    status = STATUS_INSUFFICIENT_RESOURCES;
                    goto End;
                }
                DebugPrint(LOUD, DBG_INIT, "CSRAddress=%p\n", FdoData->CSRAddress);

                bResMemory = TRUE;
                
            } else if(numberOfBARs == 2){
            
                DebugPrint(LOUD, DBG_INIT,
                    "I/O mapped CSR in Memory Space: (%x) Length: (%d)\n",
                    resourceTrans->u.Memory.Start.LowPart,
                    resourceTrans->u.Memory.Length);
                //
                // The port is in memory space on this machine.
                // We should call MmMapIoSpace to map the physical to virtual
                // address, and also use the READ/WRITE_REGISTER_xxx function
                // to read or write to the port.
                //

                FdoData->IoBaseAddress = MmMapIoSpace(
                                                resourceTrans->u.Memory.Start,
                                                resourceTrans->u.Memory.Length,
                                                MmNonCached);
                if(FdoData->IoBaseAddress == NULL) {
                       DebugPrint(ERROR, DBG_INIT, "MmMapIoSpace failed\n");              
                       status = STATUS_INSUFFICIENT_RESOURCES;
                       goto End;
                }
                
                FdoData->ReadPort = NICReadRegisterUShort; 
                FdoData->WritePort = NICWriteRegisterUShort;                
                FdoData->MappedPorts = TRUE;
                bResPort = TRUE;
                
            } else if(numberOfBARs == 3){

                DebugPrint(LOUD, DBG_INIT, "Flash memory:(%x:%x) Length:(%d)\n",
                                        resourceTrans->u.Memory.Start.LowPart, 
                                        resourceTrans->u.Memory.Start.HighPart, 
                                        resourceTrans->u.Memory.Length);
                //
                // Our flash memory should be 1MB in size. Since we don't
                // access the memory, let us not bother mapping it.
                //
            } else {
                DebugPrint(ERROR, DBG_INIT, 
                            "Memory Resources are not in the right order\n");                
                status = STATUS_DEVICE_CONFIGURATION_ERROR;
                goto End;                            
            }
            
            break;

        case CmResourceTypeInterrupt:

            ASSERT(!bResInterrupt);
            
            bResInterrupt = TRUE;
            //
            // Save all the interrupt specific information in the device 
            // extension because we will need it to disconnect and connect the
            // interrupt later on during power suspend and resume.
            //
            FdoData->InterruptLevel = (UCHAR)resourceTrans->u.Interrupt.Level;
            FdoData->InterruptVector = resourceTrans->u.Interrupt.Vector;
            FdoData->InterruptAffinity = resourceTrans->u.Interrupt.Affinity;
            
            if (resourceTrans->Flags & CM_RESOURCE_INTERRUPT_LATCHED) {
            
                FdoData->InterruptMode = Latched;

            } else {
            
                FdoData->InterruptMode = LevelSensitive;
            }

            //
            // Because this is a PCI device, we KNOW it must be
            // a LevelSensitive Interrupt.
            //
            
            ASSERT(FdoData->InterruptMode == LevelSensitive);

            DebugPrint(LOUD, DBG_INIT, 
                "Interrupt level: 0x%0x, Vector: 0x%0x, Affinity: 0x%x\n",
                FdoData->InterruptLevel,
                FdoData->InterruptVector,
                (UINT)FdoData->InterruptAffinity); // casting is done to keep WPP happy          
            break;

        default:
            //
            // This could be device-private type added by the PCI bus driver. We
            // shouldn't filter this or change the information contained in it.
            //
            DebugPrint(LOUD, DBG_INIT, "Unhandled resource type (0x%x)\n", 
                                        resourceTrans->Type);
            break;

        }
    }

    //
    // Make sure we got all the 3 resources to work with.
    //
    if (!(bResPort && bResInterrupt && bResMemory)) {
        status = STATUS_DEVICE_CONFIGURATION_ERROR;
        goto End;
    } 
    
    //
    // Disable interrupts here which is as soon as possible
    //
    NICDisableInterrupt(FdoData);

    IoInitializeDpcRequest(FdoData->Self, (PKDEFERRED_ROUTINE)NICDpcForIsr);

    //
    // Register the interrupt
    //
    status = IoConnectInterrupt(&FdoData->Interrupt,
                              NICInterruptHandler,
                              FdoData,                   // ISR Context
                              NULL,
                              FdoData->InterruptVector,
                              FdoData->InterruptLevel,
                              FdoData->InterruptLevel,
                              FdoData->InterruptMode,
                              TRUE, // shared interrupt
                              FdoData->InterruptAffinity,
                              FALSE);   
    if (status != STATUS_SUCCESS)
    {
        DebugPrint(ERROR, DBG_INIT, "IoConnectInterrupt failed %x\n", status);
        goto End;
    }
    
    MP_SET_FLAG(FdoData, fMP_ADAPTER_INTERRUPT_IN_USE);

    //
    // Zero out the entire structure first.
    //
    RtlZeroMemory(&deviceDescription, sizeof(DEVICE_DESCRIPTION));

    // 
    // DMA_VER2 is defined when the driver is built to work on XP and
    // above. The difference between DMA_VER2 and VER0 is that VER2
    // support BuildScatterGatherList & CalculateScatterGatherList functions.
    // BuildScatterGatherList performs the same operation as 
    // GetScatterGatherList, except that it uses the buffer supplied 
    // in the ScatterGatherBuffer parameter to hold the scatter/gather 
    // list that it creates. In contrast, GetScatterGatherList 
    // dynamically allocates a buffer to hold the scatter/gather list. 
    // If insufficient memory is available to allocate the buffer, 
    // GetScatterGatherList can fail with a STATUS_INSUFFICIENT_RESOURCES
    // error. Drivers that must avoid this scenario can pre-allocate a 
    // buffer to hold the scatter/gather list, and use BuildScatterGatherList
    // instead. A driver can use the CalculateScatterGatherList routine 
    // to determine the size of buffer to allocate to hold the 
    // scatter/gather list.
    //
#if defined(DMA_VER2)
    deviceDescription.Version = DEVICE_DESCRIPTION_VERSION2;
#else
    deviceDescription.Version = DEVICE_DESCRIPTION_VERSION;
#endif

    deviceDescription.Master = TRUE;
    deviceDescription.ScatterGather = TRUE;
    deviceDescription.Dma32BitAddresses = TRUE;
    deviceDescription.Dma64BitAddresses = FALSE;
    deviceDescription.InterfaceType = PCIBus;

    //
    // Bare minimum number of map registers required to do
    // a single NIC_MAX_PACKET_SIZE transfer.
    //
    miniMapRegisters = ((NIC_MAX_PACKET_SIZE * 2 - 2) / PAGE_SIZE) + 2;

    //
    // Maximum map registers required to do simultaneous transfer
    // of all TCBs assuming each packet spanning NIC_MAX_PHYS_BUF_COUNT
    // (Each request has chained MDLs).
    //
    maxMapRegistersRequired = FdoData->NumTcb * NIC_MAX_PHYS_BUF_COUNT;

    //
    // The maximum length of buffer for maxMapRegistersRequired number of
    // map registers would be.
    //
    MaximumPhysicalMapping = (maxMapRegistersRequired-1) << PAGE_SHIFT;
    deviceDescription.MaximumLength = MaximumPhysicalMapping;
                                    
    DmaAdapterObject = IoGetDmaAdapter(FdoData->UnderlyingPDO,
                                        &deviceDescription,
                                        &MapRegisters);        
    if (DmaAdapterObject == NULL)
    {
        DebugPrint(ERROR, DBG_INIT, "IoGetDmaAdapter failed\n");                
        status = STATUS_INSUFFICIENT_RESOURCES;
        goto End;
    }

    if(MapRegisters < miniMapRegisters) {
        DebugPrint(ERROR, DBG_INIT, "Not enough map registers: Allocated %d, Required %d\n", 
                                        MapRegisters, miniMapRegisters);                
        status = STATUS_INSUFFICIENT_RESOURCES;
        goto End;
    }

    FdoData->AllocatedMapRegisters = MapRegisters;
    
    //
    // Adjust our TCB count based on the MapRegisters we got.
    //
    FdoData->NumTcb = MapRegisters/miniMapRegisters;

    //
    // Reset it NIC_MAX_TCBS if it exceeds that.
    //
    FdoData->NumTcb = min(FdoData->NumTcb, NIC_MAX_TCBS);
    
    DebugPrint(TRACE, DBG_INIT, "MapRegisters Allocated %d\n", MapRegisters);
    DebugPrint(TRACE, DBG_INIT, "Adjusted TCB count is %d\n", FdoData->NumTcb);

    FdoData->DmaAdapterObject = DmaAdapterObject;
    MP_SET_FLAG(FdoData, fMP_ADAPTER_SCATTER_GATHER);

#if defined(DMA_VER2)
    
    status = DmaAdapterObject->DmaOperations->CalculateScatterGatherList(
                                            DmaAdapterObject,
                                            NULL,
                                            0,
                                            MapRegisters * PAGE_SIZE,
                                            &ScatterGatherListSize,
                                            &SGMapRegsisters);


    ASSERT(NT_SUCCESS(status));
    ASSERT(SGMapRegsisters == MapRegisters);    
    if (!NT_SUCCESS(status))
    {
        status = STATUS_INSUFFICIENT_RESOURCES;
        goto End;
    }
    
    FdoData->ScatterGatherListSize = ScatterGatherListSize;
    
#endif

    //
    // For convenience, let us save the frequently used DMA operational
    // functions in our device context.
    //
    FdoData->AllocateCommonBuffer = 
                   *DmaAdapterObject->DmaOperations->AllocateCommonBuffer; 
    FdoData->FreeCommonBuffer = 
                   *DmaAdapterObject->DmaOperations->FreeCommonBuffer; 
End:
    //
    // If we have jumped here due to any kind of mapping or resource allocation
    // failure, we should clean up. Since we know that if we fail Start-Device,
    // the system is going to send Remove-Device request, we will defer the
    // job of cleaning to NICUnmapHWResources which is called in the Remove path.
    //
    return status;

}

NTSTATUS
NICUnmapHWResources(
    IN OUT PFDO_DATA FdoData
    )
/*++
Routine Description:

    Disconnect the interrupt and unmap all the memory and I/O resources.

Arguments:

    FdoData     Pointer to our FdoData

Return Value:

     None

--*/
{
    PDMA_ADAPTER    DmaAdapterObject = FdoData->DmaAdapterObject;

    //
    // Free hardware resources
    //    
    if (MP_TEST_FLAG(FdoData, fMP_ADAPTER_INTERRUPT_IN_USE))
    {
        IoDisconnectInterrupt(FdoData->Interrupt);
        FdoData->Interrupt = NULL;
        MP_CLEAR_FLAG(FdoData, fMP_ADAPTER_INTERRUPT_IN_USE);
    }

    if (FdoData->CSRAddress)
    {
        MmUnmapIoSpace(FdoData->CSRAddress, NIC_MAP_IOSPACE_LENGTH);        
        FdoData->CSRAddress = NULL;
    }

    if(FdoData->MappedPorts){
        MmUnmapIoSpace(FdoData->IoBaseAddress, FdoData->IoRange);
        FdoData->IoBaseAddress = NULL;
    }

    if(DmaAdapterObject && MP_TEST_FLAG(FdoData, fMP_ADAPTER_SCATTER_GATHER)){
        DmaAdapterObject->DmaOperations->PutDmaAdapter(DmaAdapterObject);
        FdoData->DmaAdapterObject = NULL;
        FdoData->AllocateCommonBuffer = NULL;
        FdoData->FreeCommonBuffer = NULL;       
        MP_CLEAR_FLAG(FdoData, fMP_ADAPTER_SCATTER_GATHER);      
    }
    
    return STATUS_SUCCESS;
    
}


NTSTATUS
NICGetDeviceInformation(
    IN PFDO_DATA FdoData
)
/*++
Routine Description:

    This function reads the PCI config space and make sure that it's our 
    device and stores the device IDs and power information in the device
    extension. Should be done in the StartDevice.
 
Arguments:

    FdoData     Pointer to our FdoData

Return Value:

     None

--*/
{
    NTSTATUS            status = STATUS_SUCCESS;
    UCHAR               buffer[NIC_PCI_E100_HDR_LENGTH ];
    PPCI_COMMON_CONFIG  pPciConfig = (PPCI_COMMON_CONFIG) buffer;
    USHORT              usPciCommand;       
    ULONG               bytesRead =0;
    
    DebugPrint(TRACE, DBG_INIT, "---> NICGetDeviceInformation\n");

    bytesRead = FdoData->BusInterface.GetBusData(
                        FdoData->BusInterface.Context,
                         PCI_WHICHSPACE_CONFIG, //READ
                         buffer,
                         FIELD_OFFSET(PCI_COMMON_CONFIG, VendorID),
                         NIC_PCI_E100_HDR_LENGTH);
    
    if (bytesRead != NIC_PCI_E100_HDR_LENGTH) {                            
        DebugPrint(ERROR, DBG_INIT, 
                        "GetBusData (NIC_PCI_E100_HDR_LENGTH) failed =%d\n",
                         bytesRead);
        return STATUS_INVALID_DEVICE_REQUEST;
    }
    
    //     
    // Is this our device?

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲大片在线观看| 国产主播一区二区三区| 亚洲美女视频一区| 国产精品嫩草影院av蜜臀| 久久久久久9999| 欧美精品一区二区三区蜜臀 | 久久九九久久九九| 精品国产免费人成电影在线观看四季| 91精品国产色综合久久久蜜香臀| 欧美日本一道本在线视频| 欧美人与性动xxxx| 欧美一区二区大片| 26uuu成人网一区二区三区| 2020国产精品| 一区视频在线播放| 日韩伦理免费电影| 亚洲一区二区三区四区在线观看| 亚洲午夜三级在线| 奇米色777欧美一区二区| 九色|91porny| 国产91丝袜在线播放九色| 麻豆freexxxx性91精品| 免费成人你懂的| 久草热8精品视频在线观看| 国产成人免费在线观看| 94色蜜桃网一区二区三区| 91视频在线看| 精品视频999| 精品国产伦一区二区三区观看方式 | 粉嫩久久99精品久久久久久夜| av电影在线观看完整版一区二区| 91精品1区2区| 欧美一级高清片在线观看| 久久久久国产精品人| 亚洲久本草在线中文字幕| 日本欧美在线观看| 国产超碰在线一区| 欧美一a一片一级一片| 欧美一级免费大片| 欧美国产亚洲另类动漫| 亚洲国产综合91精品麻豆| 日本在线不卡视频一二三区| 丁香婷婷综合激情五月色| 91福利在线看| 久久综合狠狠综合久久综合88 | 成人久久18免费网站麻豆| 欧美三级日本三级少妇99| 欧美不卡一二三| 亚洲久草在线视频| 国内精品免费**视频| 91国产福利在线| 久久精品一区蜜桃臀影院| 一卡二卡欧美日韩| 国产精品羞羞答答xxdd| 欧美体内she精高潮| 国产偷国产偷精品高清尤物 | 97精品电影院| 欧美zozo另类异族| 一区二区国产视频| 国产成人在线观看免费网站| 欧美日韩一区二区三区四区五区| 国产亚洲一二三区| 舔着乳尖日韩一区| 95精品视频在线| 久久久亚洲欧洲日产国码αv| 一区二区三区在线播| 国产成人综合亚洲网站| 欧美电影在哪看比较好| 国产精品国产三级国产专播品爱网 | 日韩午夜在线影院| 亚洲黄色尤物视频| 国产不卡在线视频| 日韩视频在线永久播放| 亚洲一区二区中文在线| 99综合电影在线视频| 精品国产亚洲在线| 日日摸夜夜添夜夜添国产精品| 95精品视频在线| 国产精品盗摄一区二区三区| 国内精品第一页| 日韩免费在线观看| 午夜视频在线观看一区二区| 色偷偷久久人人79超碰人人澡| 国产亚洲福利社区一区| 久久99精品国产麻豆不卡| 欧美日韩亚洲综合| 亚洲一区二区在线视频| 97久久精品人人爽人人爽蜜臀| 国产亲近乱来精品视频| 国产在线不卡一区| 日韩精品最新网址| 日韩和的一区二区| 欧美精品123区| 日韩在线播放一区二区| 欧美视频三区在线播放| 一区二区三区欧美久久| 色婷婷av一区| 亚洲精品第1页| 在线看一区二区| 亚洲自拍偷拍av| 欧美视频一区二区三区在线观看| 亚洲自拍偷拍欧美| 欧美日韩极品在线观看一区| 性做久久久久久| 欧美精品乱码久久久久久按摩 | 91尤物视频在线观看| 亚洲老司机在线| 在线免费观看不卡av| 亚洲一区二区在线视频| 欧美巨大另类极品videosbest | 国产精品无码永久免费888| 成人性生交大片免费看在线播放 | 亚洲色欲色欲www在线观看| 97se亚洲国产综合在线| 一区二区三区精品久久久| 色综合久久六月婷婷中文字幕| 亚洲女爱视频在线| 欧美综合视频在线观看| 亚洲电影在线免费观看| 337p亚洲精品色噜噜噜| 久久99国产精品尤物| 国产午夜精品一区二区三区四区| 成人在线视频一区二区| 亚洲欧美色图小说| 欧美日韩国产中文| 韩国av一区二区三区四区| 国产精品久久久久久福利一牛影视| aaa欧美大片| 午夜一区二区三区视频| 日韩三级在线观看| 国产不卡视频在线播放| 一区二区三区在线观看动漫| 欧美精品免费视频| 国产激情偷乱视频一区二区三区 | 国产精品99精品久久免费| 亚洲三级在线观看| 在线播放中文一区| 国产精品一线二线三线精华| 成人免费小视频| 51午夜精品国产| 高清在线不卡av| 亚洲韩国精品一区| 久久综合色天天久久综合图片| 成人国产在线观看| 亚洲第一搞黄网站| 久久久av毛片精品| 欧美在线看片a免费观看| 久久爱www久久做| 综合欧美亚洲日本| 日韩精品一区二区三区视频播放| 成人晚上爱看视频| 天堂精品中文字幕在线| 欧美激情一区二区三区四区| 在线欧美日韩国产| 国产99久久久国产精品潘金 | 精品一区二区日韩| 又紧又大又爽精品一区二区| 欧美成人bangbros| 色视频一区二区| 国产成人在线免费观看| 三级亚洲高清视频| 中文字幕亚洲在| 日韩精品中文字幕一区| 一本到不卡精品视频在线观看| 久久国产视频网| 亚洲自拍与偷拍| 国产精品的网站| 久久色.com| 欧美一区国产二区| 91精品91久久久中77777| 懂色一区二区三区免费观看| 日本大胆欧美人术艺术动态| 亚洲卡通欧美制服中文| 欧美国产亚洲另类动漫| 日韩欧美国产综合一区| 欧美午夜精品久久久| 不卡一区在线观看| 国产一区二区三区在线观看免费| 亚洲超丰满肉感bbw| 亚洲色图视频免费播放| 久久精品夜色噜噜亚洲aⅴ| 这里只有精品免费| 欧美午夜电影网| 色综合天天狠狠| www.亚洲色图| 大白屁股一区二区视频| 韩日精品视频一区| 久久99久久久久| 日韩影院在线观看| 亚洲成人精品影院| 一区二区三区精品| 亚洲老妇xxxxxx| 一区二区在线看| 亚洲日本在线a| 亚洲免费观看高清完整版在线观看| 欧美激情在线观看视频免费| 国产欧美日韩亚州综合 | 日本va欧美va瓶| 日韩电影一区二区三区四区| 亚洲成年人网站在线观看|