Win HEC Download Win HEC presentations here http

  • Slides: 46
Download presentation
�点�以下�接下� Win. HEC的演�材料 Download Win. HEC presentations here: http: //channel 9. msdn. com/Events/Win. HEC/2015

�点�以下�接下� Win. HEC的演�材料 Download Win. HEC presentations here: http: //channel 9. msdn. com/Events/Win. HEC/2015

驱动程序 (WDFDRIVER) Wdf. Request. Complete. With. Information( Request, STATUS_INVALID_DEVICE_REQUEST, (ULONG_PTR) 0 ); 设备 (WDFDEVICE)

驱动程序 (WDFDRIVER) Wdf. Request. Complete. With. Information( Request, STATUS_INVALID_DEVICE_REQUEST, (ULONG_PTR) 0 ); 设备 (WDFDEVICE) … 队列 (WDFQUEUE) …

获取硬件资源、 进行一些静态配置 (Prepare. Hardware) NTSTATUS On. Prepare. Hardware( WDFDEVICE Device, WDFCMRESLIST Resources. Raw, WDFCMRESLIST

获取硬件资源、 进行一些静态配置 (Prepare. Hardware) NTSTATUS On. Prepare. Hardware( WDFDEVICE Device, WDFCMRESLIST Resources. Raw, WDFCMRESLIST Resources. Translated ) { int Resource. Count = Wdf. Cm. Resource. List. Get. Count( Resources. Translated ); for (i=0; i < Resource. Count; i++) { 进入通电状态 (D 0 Entry) descriptor = Wdf. Cm. Resource. List. Get. Descriptor( Resources. Translated, i); switch(descriptor->Type) { case Cm. Resource. Type. Port: […] case Cm. Resource. Type. Memory: […] case Cm. Resource. Type. Interrupt: […] default: break; } 实现中断 (Interrupt. Enable) … } return STATUS_SUCCESS; }

获取硬件资源、 进行一些静态配置 (Prepare. Hardware) 进入通电状态 (D 0 Entry) NTSTATUS On. D 0 Entry( IN

获取硬件资源、 进行一些静态配置 (Prepare. Hardware) 进入通电状态 (D 0 Entry) NTSTATUS On. D 0 Entry( IN WDFDEVICE Device, IN WDF_POWER_DEVICE_STATE Recent. Power. State ){ PADXL 345 Acc. Device p. Acc. Device = nullptr p. Acc. Device = Get. Context(Device); Wdf. Wait. Lock. Acquire(p. Acc. Device->m_Wait. Lock); I 2 CSensor. Write. Register( p. Acc. Device->m_I 2 CIo. Target, MY_REGISTER, MY_VALUE, sizeof(MY_VALUE) ); 实现中断 (Interrupt. Enable) … Wdf. Wait. Lock. Release(p. Acc. Device->m_Wait. Lock); p. Acc. Device->m_Powered. On = true; return STATUS_SUCCESS; }

获取硬件资源、 进行一些静态配置 (Prepare. Hardware) NTSTATUS On. Interrupt. Enable( IN WDFINTERRUPT Interrupt, IN WDFDEVICE Device){

获取硬件资源、 进行一些静态配置 (Prepare. Hardware) NTSTATUS On. Interrupt. Enable( IN WDFINTERRUPT Interrupt, IN WDFDEVICE Device){ PDEVICE_EXTENSION ULONG reg. Ulong; PULONG int. Csr; 进入通电状态 (D 0 Entry) dev. Ext; dev. Ext = Get. Device. Context( Wdf. Interrupt. Get. Device(Interrupt) ); int. Csr = &dev. Ext->Regs->Int_Csr 实现中断 (Interrupt. Enable) reg. Ulong = READ_REGISTER_ULONG( int. Csr ); WRITE_REGISTER_ULONG( int. Csr, reg. Ulong ); … return STATUS_SUCCESS; }

Wdf. Request. Mark. Cancelable ( Request, On. Request. Cancel );

Wdf. Request. Mark. Cancelable ( Request, On. Request. Cancel );

Wdf. Io. Target. Send. Ioctl. Synchronously( io. Target, NULL, IOCTL_ACPI_ASYNC_EVAL_METHOD, &input. Buf. Desc, &output.

Wdf. Io. Target. Send. Ioctl. Synchronously( io. Target, NULL, IOCTL_ACPI_ASYNC_EVAL_METHOD, &input. Buf. Desc, &output. Buf. Desc, NULL);

WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS_INIT(&wake. Settings); Wdf. Device. Assign. Sx. Wake. Settings( device, &wake. Settings );

WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS_INIT(&wake. Settings); Wdf. Device. Assign. Sx. Wake. Settings( device, &wake. Settings );