/*++
Copyright (c) Microsoft Corporation. All rights reserved.
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
PURPOSE.
Module Name:
S5933DK1.c - Driver for the S5933DK1 ISA adapter.
Abstract:
Environment:
Kernel mode
--*/
#include "common.h"
#include "public.h"
#include "S5933DK1.h"
//
// The trace message header file must be included in a source file
// before any WPP macro calls and after defining a WPP_CONTROL_GUIDS
// macro. During the compilation, WPP scans the source files for
// TraceEvents() calls and builds a .tmh file which stores a unique
// data GUID for each message, the text resource string for each message,
// and the data types of the variables passed in for each message.
// This file is automatically generated and used during post-processing.
//
#include "S5933DK1.tmh"
//
// Make sure the initialization code is removed from memory after use.
//
#ifdef ALLOC_PRAGMA
#pragma alloc_text(PAGE, AmccIsaEvtDeviceAdd)
#pragma alloc_text(PAGE, AmccIsaEvtDevicePrepareHardware)
#pragma alloc_text(PAGE, AmccIsaEvtDeviceReleaseHardware)
#pragma alloc_text(PAGE, AmccIsaFreeDeviceResources)
#pragma alloc_text(PAGE, AmccIsaEvtIoDeviceControl)
#pragma alloc_text(PAGE, AmccIsaWorker)
#pragma alloc_text(PAGE, AmccIsaResetDevice)
#endif
NTSTATUS
AmccIsaEvtDeviceAdd(
_In_ WDFDRIVER Driver,
_Inout_ PWDFDEVICE_INIT DeviceInit
)
/*++
Routine Description:
Arguments:
Return Value:
NTSTATUS
--*/
{
WDF_PNPPOWER_EVENT_CALLBACKS pnpPowerCallbacks;
NTSTATUS status = STATUS_SUCCESS;
WDF_OBJECT_ATTRIBUTES fdoAttributes;
WDFDEVICE device;
WDF_IO_QUEUE_CONFIG ioQueueConfig;
PRDK_DEVICE_EXTENSION devExt;
WDFQUEUE hQueue;
PAGED_CODE();
TraceEvents(TRACE_LEVEL_INFORMATION, AMCC_TRACE_INIT,
"AmccIsaEvtDeviceAdd: 0x%p", Driver);
//
// Zero out the pnpPowerCallbacks structure.
//
WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks);
//
// Set Callbacks for any of the functions we are interested in.
// If no callback is set, Framework will take the default action
// by itself.
//
pnpPowerCallbacks.EvtDevicePrepareHardware = AmccIsaEvtDevicePrepareHardware;
pnpPowerCallbacks.EvtDeviceReleaseHardware = AmccIsaEvtDeviceReleaseHardware;
//
// Register the Callbacks.
//
WdfDeviceInitSetPnpPowerEventCallbacks(DeviceInit, &pnpPowerCallbacks);
//
// Set various attributes & characteristics for this device
//
WdfDeviceInitSetIoType( DeviceInit, WdfDeviceIoDirect );
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&fdoAttributes, RDK_DEVICE_EXTENSION);
status = WdfDeviceCreate( &DeviceInit, &fdoAttributes, &device );
if ( !NT_SUCCESS(status)) {
TraceEvents(TRACE_LEVEL_INFORMATION, AMCC_TRACE_INIT,
"WdfDeviceInitialize failed 0x%X", status);
return status;
}
//
// Device Initialization is complete.
// Get the Device Extension and initialize it.
//
devExt = AmccIsaGetDevExt(device);
devExt->Device = device;
TraceEvents(TRACE_LEVEL_INFORMATION, AMCC_TRACE_INIT,
"PDO 0x%p, FDO 0x%p, DevExt 0x%p",
WdfDeviceWdmGetPhysicalDevice(device),
WdfDeviceWdmGetDeviceObject( device ), devExt);
//
// Register I/O callbacks.
//
// Create a sequential queue so that requests are dispatched to the
// driver one at a time. Until the driver completes a dispatched request another
// request will be not presented to the driver.
// A default queue gets all the requests that are not
// configure-fowarded using WdfDeviceConfigureRequestDispatching.
//
WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE( &ioQueueConfig,
WdfIoQueueDispatchSequential);
ioQueueConfig.EvtIoDeviceControl = AmccIsaEvtIoDeviceControl;
//
// By default, Static Driver Verifier (SDV) displays a warning if it
// doesn't find the EvtIoStop callback on a power-managed queue.
// The 'assume' below causes SDV to suppress this warning. If the driver
// has not explicitly set PowerManaged to WdfFalse, the framework creates
// power-managed queues when the device is not a filter driver. Normally
// the EvtIoStop is required for power-managed queues, but for this driver
// it is not needed b/c the driver doesn't hold on to the requests for
// long time or forward them to other drivers.
// If the EvtIoStop callback is not implemented, the framework waits for
// all driver-owned requests to be done before moving in the Dx/sleep
// states or before removing the device, which is the correct behavior
// for this type of driver. If the requests were taking an indeterminate
// amount of time to complete, or if the driver forwarded the requests
// to a lower driver/another stack, the queue should have an
// EvtIoStop/EvtIoResume.
//
__analysis_assume(ioQueueConfig.EvtIoStop != 0);
status = WdfIoQueueCreate( device,
&ioQueueConfig,
WDF_NO_OBJECT_ATTRIBUTES,
&hQueue );
__analysis_assume(ioQueueConfig.EvtIoStop == 0);
if (!NT_SUCCESS (status)) {
TraceEvents(TRACE_LEVEL_ERROR, AMCC_TRACE_INIT,
"WdfIoQueueCreate failed 0x%X\n", status);
return status;
}
//
// Register an interface so that application can find and talk to us.
// NOTE: See the note in Public.h concerning this GUID value.
//
status = WdfDeviceCreateDeviceInterface( device,
(LPGUID) &GUID_DEVINTERFACE_AMCC_ISA,
NULL );
if (!NT_SUCCESS(status)) {
TraceEvents(TRACE_LEVEL_ERROR, AMCC_TRACE_INIT,
"<-- AMCCAddDevice: WdfDeviceCreateDeviceInterface failed 0x%X", status);
return status;
}
TraceEvents(TRACE_LEVEL_INFORMATION, AMCC_TRACE_INIT,
"<--exit 0x%X", status);
return status;
}
NTSTATUS
AmccIsaEvtDevicePrepareHardware(
_In_ WDFDEVICE Device,
_In_ WDFCMRESLIST ResourcesRaw,
_In_ WDFCMRESLIST ResourcesTranslated
)
/*++
Routine Description:
EvtDevicePrepareHardware event callback performs operations that are necessary
to make the driver's device operational. The framework calls the driver's
EvtDevicePrepareHardware callback when the PnP manager sends an
IRP_MN_START_DEVICE request to the driver stack.
Arguments:
Device - Handle to a framework device object.
Resources - Handle to a collection of framework resource objects.
This collection identifies the raw (bus-relative) hardware
resources that have been assigned to the device.
ResourcesTranslated - Handle to a collection of framework resource objects.
This collection identifies the translated (system-physical)
hardware resources that have been assigned to the device.
The resources appear from the CPU's point of view.
Use this list of resources to map I/O space and
device-accessible memory into virtual address space
Return Value:
WDF status code.
Let us not worry about cleaning up the resources here if we fail start,
because the PNP manager will send a remove-request and we will free
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
AMCC5933 - PCI Device Driver Using WDF.zip (32个子文件)
description
iframedescription.css 3KB
84ada392-ed9e-43d3-9c3e-f99f948be6cbBrand.css 5KB
Galleries.css 10KB
offline.js 2KB
Combined.css 0B
d0a480a2-d1c4-4159-af59-5aa4abd59cb0Combined.css 0B
Brand.css 70KB
Layout.css 2KB
license.rtf 5KB
description.html 21KB
C++
inc
public.h 3KB
tests
rxtest
RxTest.vcxproj.Filters 831B
RxTest.c 17KB
RxTest.vcxproj 11KB
txtest
TxTest.vcxproj.Filters 831B
TxTest.c 17KB
TxTest.vcxproj 11KB
sys
amcc5933.inx 4KB
trace.h 1KB
common.h 1KB
AMCC5933.vcxproj 11KB
AMCC5933.c 18KB
S5933DK1.c 27KB
Driver.c 7KB
Transfer.c 14KB
S5933DK1.h 6KB
AMCC5933.h 3KB
Reg5933.h 4KB
AMCC5933.vcxproj.Filters 1018B
Package
package.VcxProj.Filters 1018B
package.VcxProj 7KB
amcc5933.sln 11KB
共 32 条
- 1
saloon_yuan
- 粉丝: 207
- 资源: 14
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 数据源-数据可视化(七):Pandas香港酒店数据高级分析,涉及相关系数,协方差,数据离散化,透视表等精美可视化展示
- linux常用命令大全.doc
- 格拉斯哥大学空缺职位申请详细介绍Applicant Guide.pdf
- mmexport1702953347189.mp4
- 2023NOC软件创意编程初中组C++决赛
- 2023NOC软件创意编程赛项真题-python初中决赛
- 2023NOC软件创意编程赛项真题-python小高决赛
- WA4320H-FIT-集客AP220G-FULL编程器固件
- 2023NOC软件创意编程赛项真题图形化小学高年级-决赛
- 2023NOC软件创意编程赛项真题图形化小学低年级-决赛
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
前往页