Wi-Fi WDF class extension(WiFiCx)
WiFiCx 為Windows 11 上新的WLAN Device 的架構,可以參考: Introduction to the Wi-Fi WDF class extension (WiFiCx)
WiFiCx architecture
Driver Flow
介紹整體Driver 的流程,以及一些比較重要的Callback function
DriverEntry
– Register two functions with WDF_DRIVER_CONFIG
– EvtDriverDeviceAdd
– EvtDriverUnload
EvtDriverDeviceAdd (EVT_WDF_DRIVER_DEVICE_ADD )
– Register NetAdapter(NetDeviceInitConfig) and WiFiCx (WifiDeviceInitConfig)
– Initial and configure PnP / Power callbacks
(WDF_PNPPOWER_EVENT_CALLBACKS_INIT / WDF_PNPPOWER_EVENT_CALLBACKS)
– Initial and configure power policy
(WDF_POWER_POLICY_EVENT_CALLBACKS_INIT / WDF_POWER_POLICY_EVENT_CALLBACKS)
– Create WifiCx and set the callback function for SendCommand/CreateAdapter/CreateWifiDirectDevice
WIFI_DEVICE_CONFIG_INIT
EvtDevicePrepareHardware (EVT_WDF_DEVICE_PREPARE_HARDWARE)
– Allocate Adapter and Resource
– Register PCIe Interrupt, chip callback
EvtDeviceD0Entry
EvtInterrupEnable
EvtDeviceD0EntryPostInterruptsEnabled (D0)
– Init Fw Hw and Sw
– Set Capabilities (Wi-Fi Device, Station, Band, PhyDirect)
EvtWiFiDeviceCreateAdapter (D0)
– Set Datapath callbacks, Tx Rx @ NetAdapter
EvtWiFiDeviceSendCommand
– OID handler
EvtDeviceD0ExitPreInterruptDisabled (D3 or D3Final)
EvtInterruptDisable
EvtDeviceD0Exit
EvtDeviceReleaseHardware
– Free Adapter
EvtDeviceContextCleanup
EvtDriverUnload
EvtDeviceEvtSurpriseRemoval (supriseRemove)