サイトマップ 連絡先 トップに戻る 最初に戻る
$Date: 2018-07-07 06:49:13 +0900 (2018/07/07 (土)) $
$Revision: 1347 $

Sample KMDF Function Driver for OSR USB-FX2

DriverEntry (driver.c)

  1. IoGetActivityIdIrp のアドレス取得
  2. IoSetDeviceInterfacePropertyData のアドレス取得
  3. EventRegisterOSRUSBFX2
    1. WDF_DRIVER_CONFIG_INIT (OsrFxEvtDeviceAdd)
    2. WDF_OBJECT_ATTRIBUTES_INIT
    3. EvtCleanupCallback: OsrFxEvtDriverContextCleanup を設定
    4. WdfDriverCreate

OsrFxEvtDriverContextCleanup (driver.c)

  1. EventUnregisterOSRUSBFX2
    1. McGenEventUnregister

OsrFxEvtDeviceAdd (device.c)

    1. WDF_PNPPOWER_EVENT_CALLBACKS_INIT
    2. EvtDevicePrepareHardware: OsrFxEvtDevicePrepareHardware
    3. EvtDeviceD0Entry: OsrFxEvtDeviceD0Entry
    4. EvtDeviceD0Exit: OsrFxEvtDeviceD0Exit
    5. EvtDeviceSelfManagedIoFlush: OsrFxEvtDeviceSelfManagedIoFlush
    6. WdfDeviceInitSetPnpPowerEventCallbacks (pnpPowerCallbacks)
  1. WdfDeviceInitSetIoType
  2. WdfDeviceCreate
    1. WDF_DEVICE_PNP_CAPABILITIES_INIT (pnpCaps)
    2. pnpCaps.SurpriseRemovalOK: WdfTrue
    3. WdfDeviceSetPnpCapabilities(pnpCaps)
    1. WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE
    2. EvtIoDeviceControl: OsrFxEvtIoDeviceControl
    3. WdfIoQueueCreate
    1. WDF_IO_QUEUE_CONFIG_INIT (WdfIoQueueDispatchSequential)
    2. EvtIoRead: OsrFxEvtIoRead
    3. EvtIoStop: OsrFxEvtIoStop
    4. WdfIoQueueCreate
  3. WdfDeviceConfigureRequestDispatching (WdfRequestTypeRead)
    1. WDF_IO_QUEUE_CONFIG_INIT (WdfIoQueueDispatchSequential)li>
    2. EvtIoRead: OsrFxEvtIoRead
    3. EvtIoStop: OsrFxEvtIoStop
    4. WdfIoQueueCreate
  4. WdfDeviceConfigureRequestDispatching (WdfRequestTypeWrite)
    1. WDF_IO_QUEUE_CONFIG_INIT (WdfIoQueueDispatchManual)
    2. PowerManaged: WdfFalse
    3. WdfIoQueueCreate
  5. WdfDeviceCreateDeviceInterface (GUID_DEVINTERFACE_OSRUSBFX2)
    1. WDF_OBJECT_ATTRIBUTES_INIT
    2. ParentObject: device
    3. WdfWaitLockCreate
    4. WdfIoQueueCreate
  6. WdfStringCreate
  7. WdfDeviceRetrieveDeviceInterfaceString
  8. WdfStringGetUnicodeString
  9. IoSetDeviceInterfacePropertyData
  10. WdfObjectDelete

OsrFxEvtDriverContextCleanup (driver.c)

  1. EventUnregisterOSRUSBFX2
    1. McGenEventUnregister

OsrFxEvtIoStop (bulkrwr.c)

OsrFxEvtIoRead (bulkrwr.c)

  1. EventWriteReadStart (WdfIoQueueGetDevice)
  2. GetDeviceContext (WdfIoQueueGetDevice)
  3. WdfRequestRetrieveOutputMemory
  4. WdfUsbTargetPipeFormatRequestForRead
  5. WdfRequestSetCompletionRoutine (EvtRequestReadCompletionRoutine)
  6. WdfRequestSend (WdfUsbTargetPipeGetIoTarget)

OsrFxEvtIoWrite (bulkrwr.c)

  1. RequestToActivityId
  2. EventWriteWriteStart (WdfIoQueueGetDevice)
  3. GetDeviceContext (WdfIoQueueGetDevice)
  4. WdfRequestRetrieveInputMemory
  5. WdfUsbTargetPipeFormatRequestForWrite
  6. WdfRequestSetCompletionRoutine (EvtRequestWriteCompletionRoutine)
  7. WdfRequestSend (WdfUsbTargetPipeGetIoTarget)

OsrFxEvtDeviceD0Entry (device.c)

  1. GetDeviceContext
  2. OsrFxSetPowerPolicy
  3. WdfIoTargetStart (WdfUsbTargetPipeGetIoTarget(InterruptPipe) )

OsrFxEvtDeviceD0Exit (device.c)

  1. GetDeviceContext
  2. WdfIoTargetStop (WdfUsbTargetPipeGetIoTarget(InterruptPipe), WdfIoTargetCancelSentIo)

OsrFxEvtDevicePrepareHardware (device.c)

  1. GetDeviceContext (WdfIoQueueGetDevice)
    1. WDF_USB_DEVICE_CREATE_CONFIG_INIT (USBD_CLIENT_CONTRACT_VERSION_602)
    2. WdfUsbTargetDeviceCreateWithParameters
    1. WDF_USB_DEVICE_INFORMATION_INIT
    2. WdfUsbTargetDeviceRetrieveInformation
    3. SelectInterfaces
  2. OsrFxSetPowerPolicy
  3. OsrFxConfigContReaderForInterruptEndPoint

OsrFxSetPowerPolicy (device.c)

    1. WDF_DEVICE_POWER_POLICY_IDLE_SETTINGS_INIT (IdleUsbSelectiveSuspend)
    2. IdleTimeout: 10000
    3. WdfDeviceAssignS0IdleSettings
    1. WDF_DEVICE_POWER_POLICY_WAKE_SETTINGS_INIT
    2. WdfDeviceAssignSxWakeSettings
    1. WDF_USB_DEVICE_INFORMATION_INIT
    2. WdfUsbTargetDeviceRetrieveInformation
    3. SelectInterfaces
  1. OsrFxSetPowerPolicy
  2. OsrFxConfigContReaderForInterruptEndPoint

SelectInterfaces (device.c)

  1. GetDeviceContext (WdfIoQueueGetDevice)
    1. WDF_USB_DEVICE_SELECT_CONFIG_PARAMS_INIT_SINGLE_INTERFACE
    2. WdfUsbTargetDeviceSelectConfig
    1. DeviceToActivityId
    2. EventWriteSelectConfigFailure
    1. WDF_USB_PIPE_INFORMATION_INIT
    2. WdfUsbInterfaceGetConfiguredPipe
    3. UsbTargetPipeSetNoMaximumPacketSizeCheck

OsrFxEvtIoDeviceControl (ioctl.c)

  1. IOCTL_OSRUSBFX2_GET_CONFIG_DESCRIPTOR
    1. WdfUsbTargetDeviceRetrieveConfigDescriptor
    2. WdfRequestRetrieveOutputBuffer
    3. WdfUsbTargetDeviceRetrieveConfigDescriptor
  2. IOCTL_OSRUSBFX2_RESET_DEVICE
    1. ResetDevice
  3. IOCTL_OSRUSBFX2_REENUMERATE_DEVICE
    1. ReenumerateDevice
  4. IOCTL_OSRUSBFX2_GET_BAR_GRAPH_DISPLAY
    1. WdfRequestRetrieveOutputBuffer
    2. GetBarGraphState
  5. IOCTL_OSRUSBFX2_SET_BAR_GRAPH_DISPLAY
    1. WdfRequestRetrieveInputBuffer
    2. SetBarGraphState
  6. IOCTL_OSRUSBFX2_GET_7_SEGMENT_DISPLAY
    1. WdfRequestRetrieveOutputBuffer
    2. GetSevenSegmentState
  7. IOCTL_OSRUSBFX2_SET_7_SEGMENT_DISPLAY
    1. WdfRequestRetrieveInputBuffer
    2. SetSevenSegmentState
  8. IOCTL_OSRUSBFX2_READ_SWITCHES
    1. WdfRequestRetrieveOutputBuffer
    2. GetSwitchState
  9. IOCTL_OSRUSBFX2_GET_INTERRUPT_MESSAGE
    1. WdfRequestForwardToIoQueue

ResetPipe (ioctl.c)

    1. WdfUsbTargetPipeResetSynchronously

StopAllPipes (ioctl.c)

    1. WdfIoTargetStop (WdfUsbTargetPipeGetIoTarget(InterruptPipe) )
    2. WdfIoTargetStop (WdfUsbTargetPipeGetIoTarget(BulkReadPipe ) )
    3. WdfIoTargetStop (WdfUsbTargetPipeGetIoTarget(BulkWritePipe) )

StartAllPipes (ioctl.c)

    1. WdfIoTargetStart (WdfUsbTargetPipeGetIoTarget(InterruptPipe) )
    2. WdfIoTargetStart (WdfUsbTargetPipeGetIoTarget(BulkReadPipe ) )
    3. WdfIoTargetStart (WdfUsbTargetPipeGetIoTarget(BulkWritePipe) )

ReenumerateDevice (ioctl.c)

    1. WDF_REQUEST_SEND_OPTIONS_INIT
    2. WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT
    3. WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR
    4. WdfUsbTargetDeviceSendControlTransferSynchronously
    5. DeviceToActivityId
    6. EventWriteDeviceReenumerated

GetSevenSegmentState (ioctl.c)

    1. WDF_REQUEST_SEND_OPTIONS_INIT
    2. WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT
    3. WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR
    4. WDF_MEMORY_DESCRIPTOR_INIT_BUFFER
    5. WdfUsbTargetDeviceSendControlTransferSynchronously

SetSevenSegmentState (ioctl.c)

    1. WDF_REQUEST_SEND_OPTIONS_INIT
    2. WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT
    3. WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR
    4. WDF_MEMORY_DESCRIPTOR_INIT_BUFFER
    5. WdfUsbTargetDeviceSendControlTransferSynchronously

GetSwitchState (ioctl.c)

    1. WDF_REQUEST_SEND_OPTIONS_INIT
    2. WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT
    3. WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR
    4. WDF_MEMORY_DESCRIPTOR_INIT_BUFFER
    5. WdfUsbTargetDeviceSendControlTransferSynchronously

OsrUsbIoctlGetInterruptMessage (ioctl.c)

    1. GetDeviceContext
    2. WdfIoQueueRetrieveNextRequest
    3. WdfRequestRetrieveOutputBuffer
    4. WdfRequestCompleteWithInformation

SetBarGraphState (ioctl.c)

    1. WDF_REQUEST_SEND_OPTIONS_INIT
    2. WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT
    3. WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR
    4. WDF_MEMORY_DESCRIPTOR_INIT_BUFFER
    5. WdfUsbTargetDeviceSendControlTransferSynchronously

GetBarGraphState (ioctl.c)

    1. WDF_REQUEST_SEND_OPTIONS_INIT
    2. WDF_REQUEST_SEND_OPTIONS_SET_TIMEOUT
    3. WDF_USB_CONTROL_SETUP_PACKET_INIT_VENDOR
    4. WDF_MEMORY_DESCRIPTOR_INIT_BUFFER
    5. WdfUsbTargetDeviceSendControlTransferSynchronously

OsrFxEvtUsbInterruptPipeReadComplete (ioctl.c)

    1. WdfObjectContextGetObject
    2. WdfMemoryGetBuffer
    3. OsrUsbIoctlGetInterruptMessage

OsrFxConfigContReaderForInterruptEndPoint (ioctl.c)

    1. WDF_USB_CONTINUOUS_READER_CONFIG_INIT
    2. EvtUsbTargetPipeReadersFailed: OsrFxEvtUsbInterruptReadersFailed
    3. WdfUsbTargetPipeConfigContinuousReader

OsrFxEvtUsbInterruptReadersFailed (ioctl.c)

    1. WdfIoTargetGetDevice(WdfUsbTargetPipeGetIoTarget)
    2. GetDeviceContext
    3. OsrUsbIoctlGetInterruptMessage

OsrFxEvtUsbInterruptPipeReadComplete (ioctl.c)

    1. WdfObjectContextGetObject
    2. WdfMemoryGetBuffer
    3. OsrUsbIoctlGetInterruptMessage