Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

190 lines
3.4 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. device.cpp
  5. Abstract:
  6. Device driver core, initialization, etc.
  7. --*/
  8. #define KSDEBUG_INIT
  9. #include "casamp.h"
  10. #include "wdmdebug.h"
  11. #ifdef ALLOC_DATA_PRAGMA
  12. #pragma const_seg("PAGECONST")
  13. #endif // ALLOC_DATA_PRAGMA
  14. #ifdef ALLOC_PRAGMA
  15. #pragma code_seg("PAGE")
  16. #endif // ALLOC_PRAGMA
  17. extern "C"
  18. NTSTATUS
  19. DriverEntry(
  20. IN PDRIVER_OBJECT DriverObject,
  21. IN PUNICODE_STRING RegistryPathName
  22. )
  23. /*++
  24. Routine Description:
  25. Sets up the driver object.
  26. Arguments:
  27. DriverObject -
  28. Driver object for this instance.
  29. RegistryPathName -
  30. Contains the registry path which was used to load this instance.
  31. Return Values:
  32. Returns STATUS_SUCCESS if the driver was initialized.
  33. --*/
  34. {
  35. NTSTATUS Status = STATUS_SUCCESS;
  36. _DbgPrintF(DEBUGLVL_VERBOSE,("DriverEntry"));
  37. // DEBUG_BREAK;
  38. Status = KsInitializeDriver( DriverObject,
  39. RegistryPathName,
  40. &DeviceDescriptor);
  41. // DEBUG_BREAK;
  42. return Status;
  43. }
  44. STDMETHODIMP_(NTSTATUS)
  45. CDevice::
  46. Create(
  47. IN PKSDEVICE Device
  48. )
  49. {
  50. NTSTATUS Status = STATUS_SUCCESS;
  51. CDevice * pDevice = NULL;
  52. // DEBUG_BREAK;
  53. _DbgPrintF(DEBUGLVL_VERBOSE,("CDevice::Create"));
  54. ASSERT(Device);
  55. // Allocate memory for the our device class.
  56. //
  57. pDevice = new(PagedPool,'IDsK') CDevice;
  58. if (pDevice)
  59. {
  60. Device->Context = pDevice;
  61. } else
  62. {
  63. Status = STATUS_INSUFFICIENT_RESOURCES;
  64. goto errExit;
  65. }
  66. // Point back to the KSDEVICE.
  67. //
  68. pDevice->m_pKSDevice = Device;
  69. errExit:
  70. return Status;
  71. }
  72. STDMETHODIMP_(NTSTATUS)
  73. CDevice::
  74. Start(
  75. IN PKSDEVICE pKSDevice,
  76. IN PIRP pIrp,
  77. IN PCM_RESOURCE_LIST pTranslatedResourceList OPTIONAL,
  78. IN PCM_RESOURCE_LIST pUntranslatedResourceList OPTIONAL
  79. )
  80. {
  81. NTSTATUS Status = STATUS_SUCCESS;
  82. CDevice * pDevice;
  83. // DEBUG_BREAK;
  84. _DbgPrintF( DEBUGLVL_VERBOSE, ("CDevice::Start"));
  85. ASSERT( pKSDevice);
  86. // DEBUG_BREAK;
  87. pDevice = reinterpret_cast<CDevice *>(pKSDevice->Context);
  88. ASSERT(pDevice);
  89. // initialize private class variables in pDevice here
  90. /*
  91. // Initialize the tuner hardware.
  92. //
  93. Status = pDevice->Initialize();
  94. if (Status != STATUS_SUCCESS)
  95. {
  96. goto errExit;
  97. }
  98. */
  99. // Create the the Tuner Filter Factory. This factory is used to
  100. // create instances of the tuner filter.
  101. //
  102. Status = BdaCreateFilterFactory( pKSDevice,
  103. &InitialTunerFilterDescriptor,
  104. &TunerBdaFilterTemplate
  105. );
  106. if (!NT_SUCCESS(Status))
  107. {
  108. goto errExit;
  109. }
  110. errExit:
  111. return Status;
  112. }
  113. NTSTATUS
  114. CDevice::
  115. AcquireResources(
  116. POUR_TUNER_RESOURCE pNewTunerResource,
  117. PULONG pulAquiredResourceID
  118. )
  119. {
  120. NTSTATUS Status = STATUS_SUCCESS;
  121. //$Review - Add resource managment code here.
  122. //this is where a new frequency defined in pNewTunerResource
  123. //needs to be set as the frequency we are tuneing to
  124. //errExit:
  125. return Status;
  126. }
  127. NTSTATUS
  128. CDevice::
  129. ReleaseResources(
  130. ULONG ulAquiredResourceID
  131. )
  132. {
  133. NTSTATUS Status = STATUS_SUCCESS;
  134. //$REVIEW - Put Resource management code here.
  135. return Status;
  136. }