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.

1612 lines
22 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. regdesc.hxx
  5. Abstract:
  6. This module contains the declarations for the following base classes:
  7. PARTIAL_DESCRIPTOR, PORT_DESCRIPTOR, INTERRUPT_DESCRIPTOR, MEMORY_DESCRIPTOR,
  8. DMA_DESCRIPTOR and DEVICE_SPECIFIC_DESCRIPTOR. The last 5 classes are derived
  9. from the first one.
  10. These classes model a CM_PARTIAL_RESOURCE_DESCRIPTOR structure, used on registry
  11. data of type REG_FULL_RESOURCE_DESCRIPTOR and REG_RESOURCE_LIST.
  12. Author:
  13. Jaime Sasson (jaimes) 01-Dec-1993
  14. Environment:
  15. ULIB, User Mode
  16. --*/
  17. #if !defined( _PARTIAL_DESCRIPTOR_ )
  18. #define _PARTIAL_DESCRIPTOR_
  19. #define _NTAPI_ULIB_
  20. // don't let ntdddisk.h (included in ulib.hxx"
  21. // redefine values
  22. #define _NTDDDISK_H_
  23. #include "ulib.hxx"
  24. DECLARE_CLASS( PARTIAL_DESCRIPTOR );
  25. class PARTIAL_DESCRIPTOR : public OBJECT {
  26. public:
  27. VIRTUAL
  28. ~PARTIAL_DESCRIPTOR(
  29. );
  30. VIRTUAL
  31. UCHAR
  32. GetShareDisposition(
  33. ) CONST;
  34. VIRTUAL
  35. USHORT
  36. GetFlags(
  37. ) CONST;
  38. VIRTUAL
  39. BOOLEAN
  40. IsDescriptorTypePort(
  41. ) CONST;
  42. VIRTUAL
  43. BOOLEAN
  44. IsDescriptorTypeInterrupt(
  45. ) CONST;
  46. VIRTUAL
  47. BOOLEAN
  48. IsDescriptorTypeMemory(
  49. ) CONST;
  50. VIRTUAL
  51. BOOLEAN
  52. IsDescriptorTypeDma(
  53. ) CONST;
  54. VIRTUAL
  55. BOOLEAN
  56. IsDescriptorTypeDeviceSpecific(
  57. ) CONST;
  58. VIRTUAL
  59. BOOLEAN
  60. IsResourceShareUndetermined(
  61. ) CONST;
  62. VIRTUAL
  63. BOOLEAN
  64. IsResourceShareDeviceExclusive(
  65. ) CONST;
  66. VIRTUAL
  67. BOOLEAN
  68. IsResourceShareDriverExclusive(
  69. ) CONST;
  70. VIRTUAL
  71. BOOLEAN
  72. IsResourceShareShared(
  73. ) CONST;
  74. protected:
  75. DECLARE_CONSTRUCTOR( PARTIAL_DESCRIPTOR );
  76. NONVIRTUAL
  77. BOOLEAN
  78. Initialize(
  79. IN UCHAR Type,
  80. IN UCHAR ShareDisposition,
  81. IN USHORT Flags
  82. );
  83. private:
  84. NONVIRTUAL
  85. VOID
  86. Construct(
  87. );
  88. UCHAR _Type;
  89. UCHAR _ShareDisposition;
  90. USHORT _Flags;
  91. };
  92. INLINE
  93. BOOLEAN
  94. PARTIAL_DESCRIPTOR::Initialize(
  95. IN UCHAR Type,
  96. IN UCHAR ShareDisposition,
  97. IN USHORT Flags
  98. )
  99. /*++
  100. Routine Description:
  101. Initializes an object of type PARTIAL_DESCRIPTOR.
  102. Arguments:
  103. Type -
  104. ShareDisposition -
  105. Flags -
  106. Return Value:
  107. Returns TRUE if the initialization succeeded, or FALSE otherwise.
  108. --*/
  109. {
  110. _Type = Type;
  111. _ShareDisposition = ShareDisposition;
  112. _Flags = Flags;
  113. return( TRUE );
  114. }
  115. INLINE
  116. UCHAR
  117. PARTIAL_DESCRIPTOR::GetShareDisposition(
  118. ) CONST
  119. /*++
  120. Routine Description:
  121. Return the device descriptor's share disposition.
  122. Arguments:
  123. None.
  124. Return Value:
  125. Returns the device descriptor's share disposition.
  126. --*/
  127. {
  128. return( _ShareDisposition );
  129. }
  130. INLINE
  131. USHORT
  132. PARTIAL_DESCRIPTOR::GetFlags(
  133. ) CONST
  134. /*++
  135. Routine Description:
  136. Return the device descriptor's flags.
  137. Arguments:
  138. None.
  139. Return Value:
  140. Returns the device descriptor's flags.
  141. --*/
  142. {
  143. return( _Flags );
  144. }
  145. INLINE
  146. BOOLEAN
  147. PARTIAL_DESCRIPTOR::IsDescriptorTypePort(
  148. ) CONST
  149. /*++
  150. Routine Description:
  151. Determine whether or not this object represents a PORT_DESCRIPTOR.
  152. Arguments:
  153. None.
  154. Return Value:
  155. Returns TRUE if the object represents a PORT_DESCRIPTOR.
  156. --*/
  157. {
  158. return( _Type == CmResourceTypePort );
  159. }
  160. INLINE
  161. BOOLEAN
  162. PARTIAL_DESCRIPTOR::IsDescriptorTypeInterrupt(
  163. ) CONST
  164. /*++
  165. Routine Description:
  166. Determine whether or not this object represents a INTERRUPT_DESCRIPTOR.
  167. Arguments:
  168. None.
  169. Return Value:
  170. Returns TRUE if the object represents a INTERRUPT_DESCRIPTOR.
  171. --*/
  172. {
  173. return( _Type == CmResourceTypeInterrupt );
  174. }
  175. INLINE
  176. BOOLEAN
  177. PARTIAL_DESCRIPTOR::IsDescriptorTypeMemory(
  178. ) CONST
  179. /*++
  180. Routine Description:
  181. Determine whether or not this object represents a MEMORY_DESCRIPTOR.
  182. Arguments:
  183. None.
  184. Return Value:
  185. Returns TRUE if the object represents a MEMORY_DESCRIPTOR.
  186. --*/
  187. {
  188. return( _Type == CmResourceTypeMemory );
  189. }
  190. INLINE
  191. BOOLEAN
  192. PARTIAL_DESCRIPTOR::IsDescriptorTypeDma(
  193. ) CONST
  194. /*++
  195. Routine Description:
  196. Determine whether or not this object represents a DMA_DESCRIPTOR.
  197. Arguments:
  198. None.
  199. Return Value:
  200. Returns TRUE if the object represents a DMA_DESCRIPTOR.
  201. --*/
  202. {
  203. return( _Type == CmResourceTypeDma );
  204. }
  205. INLINE
  206. BOOLEAN
  207. PARTIAL_DESCRIPTOR::IsDescriptorTypeDeviceSpecific(
  208. ) CONST
  209. /*++
  210. Routine Description:
  211. Determine whether or not this object represents a DEVICE_SPECIFIC_DESCRIPTOR.
  212. Arguments:
  213. None.
  214. Return Value:
  215. Returns TRUE if the object represents a DEVICE_SPECIFIC_DESCRIPTOR.
  216. --*/
  217. {
  218. return( _Type == CmResourceTypeDeviceSpecific );
  219. }
  220. INLINE
  221. BOOLEAN
  222. PARTIAL_DESCRIPTOR::IsResourceShareUndetermined(
  223. ) CONST
  224. /*++
  225. Routine Description:
  226. Determine whether or not the share of the device represented by this object
  227. is undetermined.
  228. Arguments:
  229. None.
  230. Return Value:
  231. Returns TRUE if the share is undetermined.
  232. --*/
  233. {
  234. return( _ShareDisposition == CmResourceShareUndetermined );
  235. }
  236. INLINE
  237. BOOLEAN
  238. PARTIAL_DESCRIPTOR::IsResourceShareDeviceExclusive(
  239. ) CONST
  240. /*++
  241. Routine Description:
  242. Determine whether or not the share of the device represented by this object
  243. is device exclusive.
  244. Arguments:
  245. None.
  246. Return Value:
  247. Returns TRUE if the share is device exclusive.
  248. --*/
  249. {
  250. return( _ShareDisposition == CmResourceShareDeviceExclusive );
  251. }
  252. INLINE
  253. BOOLEAN
  254. PARTIAL_DESCRIPTOR::IsResourceShareDriverExclusive(
  255. ) CONST
  256. /*++
  257. Routine Description:
  258. Determine whether or not the share of the device represented by this object
  259. is driver exclusive.
  260. Arguments:
  261. None.
  262. Return Value:
  263. Returns TRUE if the share is driver exclusive.
  264. --*/
  265. {
  266. return( _ShareDisposition == CmResourceShareDriverExclusive );
  267. }
  268. INLINE
  269. BOOLEAN
  270. PARTIAL_DESCRIPTOR::IsResourceShareShared(
  271. ) CONST
  272. /*++
  273. Routine Description:
  274. Determine whether or not the share of the device represented by this object
  275. is shared.
  276. Arguments:
  277. None.
  278. Return Value:
  279. Returns TRUE if the share is shared.
  280. --*/
  281. {
  282. return( _ShareDisposition == CmResourceShareShared );
  283. }
  284. // #endif // _PARTIAL_DESCRIPTOR_
  285. // #if !defined( _PORT_DESCRIPTOR_ )
  286. // #define _PORT_DESCRIPTOR_
  287. // #define _NTAPI_ULIB_
  288. // #include "ulib.hxx"
  289. DECLARE_CLASS( PORT_DESCRIPTOR );
  290. class PORT_DESCRIPTOR : public PARTIAL_DESCRIPTOR {
  291. public:
  292. NONVIRTUAL
  293. ~PORT_DESCRIPTOR(
  294. );
  295. DECLARE_CONSTRUCTOR( PORT_DESCRIPTOR );
  296. NONVIRTUAL
  297. BOOLEAN
  298. Initialize(
  299. IN PPHYSICAL_ADDRESS PhysicalAddress,
  300. IN ULONG Length,
  301. IN UCHAR ShareDisposition,
  302. IN USHORT Flags
  303. );
  304. NONVIRTUAL
  305. PPHYSICAL_ADDRESS
  306. GetPhysicalAddress(
  307. ); // CONST;
  308. NONVIRTUAL
  309. ULONG
  310. GetLength(
  311. ) CONST;
  312. NONVIRTUAL
  313. BOOLEAN
  314. IsPortIo(
  315. ) CONST;
  316. NONVIRTUAL
  317. BOOLEAN
  318. IsPortMemory(
  319. ) CONST;
  320. private:
  321. NONVIRTUAL
  322. VOID
  323. Construct(
  324. );
  325. PHYSICAL_ADDRESS _PhysicalAddress;
  326. ULONG _Length;
  327. };
  328. INLINE
  329. BOOLEAN
  330. PORT_DESCRIPTOR::Initialize(
  331. IN PPHYSICAL_ADDRESS PhysicalAddress,
  332. IN ULONG Length,
  333. IN UCHAR ShareDisposition,
  334. IN USHORT Flags
  335. )
  336. /*++
  337. Routine Description:
  338. Initialize a PORT_DESCRIPTOR object.
  339. Arguments:
  340. PhysicalAddress -
  341. Length -
  342. ShareDisposition -
  343. Flags -
  344. Return Value:
  345. BOOLEAN - Returns TRUE if the operation succeeeds.
  346. --*/
  347. {
  348. _PhysicalAddress = *PhysicalAddress;
  349. _Length = Length;
  350. return( PARTIAL_DESCRIPTOR::Initialize( CmResourceTypePort,
  351. ShareDisposition,
  352. Flags ) );
  353. }
  354. INLINE
  355. PPHYSICAL_ADDRESS
  356. PORT_DESCRIPTOR::GetPhysicalAddress(
  357. ) // CONST
  358. /*++
  359. Routine Description:
  360. Returns the port's physical address.
  361. Arguments:
  362. None.
  363. Return Value:
  364. PPHYSICAL_ADDRESS - Pointer to the structure that describes the port's
  365. physical address.
  366. --*/
  367. {
  368. return( &_PhysicalAddress );
  369. }
  370. INLINE
  371. ULONG
  372. PORT_DESCRIPTOR::GetLength(
  373. ) CONST
  374. /*++
  375. Routine Description:
  376. Returns the port's length.
  377. Arguments:
  378. None.
  379. Return Value:
  380. ULONG - Return the port's length.
  381. --*/
  382. {
  383. return( _Length );
  384. }
  385. INLINE
  386. BOOLEAN
  387. PORT_DESCRIPTOR::IsPortIo(
  388. ) CONST
  389. /*++
  390. Routine Description:
  391. Return whether or not the port is an I/O.
  392. Arguments:
  393. None.
  394. Return Value:
  395. BOOLEAN - Returns TRUE if the port is an I/O.
  396. Returns FALSE otherwise.
  397. --*/
  398. {
  399. return( ( PARTIAL_DESCRIPTOR::GetFlags() & CM_RESOURCE_PORT_IO ) ==
  400. CM_RESOURCE_PORT_IO );
  401. }
  402. INLINE
  403. BOOLEAN
  404. PORT_DESCRIPTOR::IsPortMemory(
  405. ) CONST
  406. /*++
  407. Routine Description:
  408. Return whether or not the port is mapped in memory.
  409. Arguments:
  410. None.
  411. Return Value:
  412. BOOLEAN - Returns TRUE if the port is mapped in memory.
  413. Returns FALSE otherwise.
  414. --*/
  415. {
  416. return( PARTIAL_DESCRIPTOR::GetFlags() == CM_RESOURCE_PORT_MEMORY );
  417. }
  418. // #endif // _PORT_DESCRIPTOR_
  419. // #if !defined( _INTERRUPT_DESCRIPTOR_ )
  420. // #define _INTERRUPT_DESCRIPTOR_
  421. // #define _NTAPI_ULIB_
  422. // #include "ulib.hxx"
  423. DECLARE_CLASS( INTERRUPT_DESCRIPTOR );
  424. class INTERRUPT_DESCRIPTOR : public PARTIAL_DESCRIPTOR {
  425. public:
  426. NONVIRTUAL
  427. ~INTERRUPT_DESCRIPTOR(
  428. );
  429. DECLARE_CONSTRUCTOR( INTERRUPT_DESCRIPTOR );
  430. NONVIRTUAL
  431. BOOLEAN
  432. Initialize(
  433. IN KAFFINITY Affinity,
  434. IN ULONG Level,
  435. IN ULONG Vector,
  436. IN UCHAR ShareDisposition,
  437. IN USHORT Flags
  438. );
  439. NONVIRTUAL
  440. KAFFINITY
  441. GetAffinity(
  442. ) CONST;
  443. NONVIRTUAL
  444. ULONG
  445. GetLevel(
  446. ) CONST;
  447. NONVIRTUAL
  448. ULONG
  449. GetVector(
  450. ) CONST;
  451. NONVIRTUAL
  452. BOOLEAN
  453. IsInterruptLevelSensitive(
  454. ) CONST;
  455. NONVIRTUAL
  456. BOOLEAN
  457. IsInterruptLatched(
  458. ) CONST;
  459. private:
  460. NONVIRTUAL
  461. VOID
  462. Construct(
  463. );
  464. KAFFINITY _Affinity;
  465. ULONG _Level;
  466. ULONG _Vector;
  467. };
  468. INLINE
  469. BOOLEAN
  470. INTERRUPT_DESCRIPTOR::Initialize(
  471. IN KAFFINITY Affinity,
  472. IN ULONG Level,
  473. IN ULONG Vector,
  474. IN UCHAR ShareDisposition,
  475. IN USHORT Flags
  476. )
  477. /*++
  478. Routine Description:
  479. Initialize an INTERRUPT_DESCRIPTOR object.
  480. Arguments:
  481. Affinity -
  482. Level -
  483. Vector -
  484. ShareDisposition -
  485. Flags -
  486. Return Value:
  487. BOOLEAN - Returns TRUE if the operation succeeeds.
  488. --*/
  489. {
  490. _Affinity = Affinity;
  491. _Level = Level;
  492. _Vector = Vector;
  493. return( PARTIAL_DESCRIPTOR::Initialize( CmResourceTypeInterrupt,
  494. ShareDisposition,
  495. Flags ) );
  496. }
  497. INLINE
  498. KAFFINITY
  499. INTERRUPT_DESCRIPTOR::GetAffinity(
  500. ) CONST
  501. /*++
  502. Routine Description:
  503. Returns the interrupt's affinity.
  504. Arguments:
  505. None.
  506. Return Value:
  507. ULONG - Interrupt's affinity.
  508. --*/
  509. {
  510. return( _Affinity );
  511. }
  512. INLINE
  513. ULONG
  514. INTERRUPT_DESCRIPTOR::GetLevel(
  515. ) CONST
  516. /*++
  517. Routine Description:
  518. Returns the interrupt's level.
  519. Arguments:
  520. None.
  521. Return Value:
  522. ULONG - Return the interrupt's level.
  523. --*/
  524. {
  525. return( _Level );
  526. }
  527. INLINE
  528. ULONG
  529. INTERRUPT_DESCRIPTOR::GetVector(
  530. ) CONST
  531. /*++
  532. Routine Description:
  533. Returns the interrupt's vector.
  534. Arguments:
  535. None.
  536. Return Value:
  537. ULONG - Return the interrupt's vector.
  538. --*/
  539. {
  540. return( _Vector );
  541. }
  542. INLINE
  543. BOOLEAN
  544. INTERRUPT_DESCRIPTOR::IsInterruptLevelSensitive(
  545. ) CONST
  546. /*++
  547. Routine Description:
  548. Return whether or not the interrupt is level sensitive.
  549. Arguments:
  550. None.
  551. Return Value:
  552. BOOLEAN - Return TRUE if the interrupt is level sensitive.
  553. --*/
  554. {
  555. return( PARTIAL_DESCRIPTOR::GetFlags() == CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE );
  556. }
  557. INLINE
  558. BOOLEAN
  559. INTERRUPT_DESCRIPTOR::IsInterruptLatched(
  560. ) CONST
  561. /*++
  562. Routine Description:
  563. Return whether or not the interrupt is latched.
  564. Arguments:
  565. None.
  566. Return Value:
  567. BOOLEAN - Return TRUE if the interrupt is latched.
  568. --*/
  569. {
  570. return( ( PARTIAL_DESCRIPTOR::GetFlags() & CM_RESOURCE_INTERRUPT_LATCHED ) ==
  571. CM_RESOURCE_INTERRUPT_LATCHED );
  572. }
  573. // #endif // _INTERRUPT_DESCRIPTOR_
  574. // #if !defined( _MEMORY_DESCRIPTOR_ )
  575. // #define _MEMORY_DESCRIPTOR_
  576. // #define _NTAPI_ULIB_
  577. // #include "ulib.hxx"
  578. DECLARE_CLASS( MEMORY_DESCRIPTOR );
  579. class MEMORY_DESCRIPTOR : public PARTIAL_DESCRIPTOR {
  580. public:
  581. NONVIRTUAL
  582. ~MEMORY_DESCRIPTOR(
  583. );
  584. DECLARE_CONSTRUCTOR( MEMORY_DESCRIPTOR );
  585. NONVIRTUAL
  586. BOOLEAN
  587. Initialize(
  588. IN PPHYSICAL_ADDRESS StartAddress,
  589. IN ULONG Length,
  590. IN UCHAR ShareDisposition,
  591. IN USHORT Flags
  592. );
  593. NONVIRTUAL
  594. PPHYSICAL_ADDRESS
  595. GetStartAddress(
  596. ); // CONST;
  597. NONVIRTUAL
  598. ULONG
  599. GetLength(
  600. ) CONST;
  601. NONVIRTUAL
  602. BOOLEAN
  603. IsMemoryReadWrite(
  604. ) CONST;
  605. NONVIRTUAL
  606. BOOLEAN
  607. IsMemoryReadOnly(
  608. ) CONST;
  609. NONVIRTUAL
  610. BOOLEAN
  611. IsMemoryWriteOnly(
  612. ) CONST;
  613. private:
  614. NONVIRTUAL
  615. VOID
  616. Construct(
  617. );
  618. PHYSICAL_ADDRESS _StartAddress;
  619. ULONG _Length;
  620. };
  621. INLINE
  622. BOOLEAN
  623. MEMORY_DESCRIPTOR::Initialize(
  624. IN PPHYSICAL_ADDRESS StartAddress,
  625. IN ULONG Length,
  626. IN UCHAR ShareDisposition,
  627. IN USHORT Flags
  628. )
  629. /*++
  630. Routine Description:
  631. Initialize a MEMORY_DESCRIPTOR object.
  632. Arguments:
  633. StartAddress -
  634. Length -
  635. ShareDisposition -
  636. Flags -
  637. Return Value:
  638. BOOLEAN - Returns TRUE if the operation succeeeds.
  639. --*/
  640. {
  641. _StartAddress = *StartAddress;
  642. _Length = Length;
  643. return( PARTIAL_DESCRIPTOR::Initialize( CmResourceTypeMemory,
  644. ShareDisposition,
  645. Flags ) );
  646. }
  647. INLINE
  648. PPHYSICAL_ADDRESS
  649. MEMORY_DESCRIPTOR::GetStartAddress(
  650. ) // CONST
  651. /*++
  652. Routine Description:
  653. Returns the memory's start address.
  654. Arguments:
  655. None.
  656. Return Value:
  657. ULONG - Memory's start address.
  658. --*/
  659. {
  660. return( &_StartAddress );
  661. }
  662. INLINE
  663. ULONG
  664. MEMORY_DESCRIPTOR::GetLength(
  665. ) CONST
  666. /*++
  667. Routine Description:
  668. Returns the memory's length.
  669. Arguments:
  670. None.
  671. Return Value:
  672. ULONG - Return the memory's length.
  673. --*/
  674. {
  675. return( _Length );
  676. }
  677. INLINE
  678. BOOLEAN
  679. MEMORY_DESCRIPTOR::IsMemoryReadWrite(
  680. ) CONST
  681. /*++
  682. Routine Description:
  683. Return whether or not the memory is Read/Write.
  684. Arguments:
  685. None.
  686. Return Value:
  687. BOOLEAN - Return TRUE if the memory is Read/Write.
  688. --*/
  689. {
  690. return( PARTIAL_DESCRIPTOR::GetFlags() == CM_RESOURCE_MEMORY_READ_WRITE );
  691. }
  692. INLINE
  693. BOOLEAN
  694. MEMORY_DESCRIPTOR::IsMemoryReadOnly(
  695. ) CONST
  696. /*++
  697. Routine Description:
  698. Return whether or not the memory is ReadOnly.
  699. Arguments:
  700. None.
  701. Return Value:
  702. BOOLEAN - Return TRUE if the memory is ReadOnly.
  703. --*/
  704. {
  705. return( ( PARTIAL_DESCRIPTOR::GetFlags() & CM_RESOURCE_MEMORY_READ_ONLY ) ==
  706. CM_RESOURCE_MEMORY_READ_ONLY );
  707. }
  708. INLINE
  709. BOOLEAN
  710. MEMORY_DESCRIPTOR::IsMemoryWriteOnly(
  711. ) CONST
  712. /*++
  713. Routine Description:
  714. Return whether or not the memory is WriteOnly.
  715. Arguments:
  716. None.
  717. Return Value:
  718. BOOLEAN - Return TRUE if the memory is WriteOnly.
  719. --*/
  720. {
  721. return( ( PARTIAL_DESCRIPTOR::GetFlags() & CM_RESOURCE_MEMORY_WRITE_ONLY ) ==
  722. CM_RESOURCE_MEMORY_WRITE_ONLY );
  723. }
  724. // #endif // _MEMORY_DESCRIPTOR_
  725. // #if !defined( _DMA_DESCRIPTOR_ )
  726. // #define _DMA_DESCRIPTOR_
  727. // #define _NTAPI_ULIB_
  728. // #include "ulib.hxx"
  729. DECLARE_CLASS( DMA_DESCRIPTOR );
  730. class DMA_DESCRIPTOR : public PARTIAL_DESCRIPTOR {
  731. public:
  732. NONVIRTUAL
  733. ~DMA_DESCRIPTOR(
  734. );
  735. DECLARE_CONSTRUCTOR( DMA_DESCRIPTOR );
  736. NONVIRTUAL
  737. BOOLEAN
  738. Initialize(
  739. IN ULONG Channel,
  740. IN ULONG Port,
  741. IN ULONG Reserved1,
  742. IN UCHAR ShareDisposition,
  743. IN USHORT Flags
  744. );
  745. NONVIRTUAL
  746. ULONG
  747. GetChannel(
  748. ) CONST;
  749. NONVIRTUAL
  750. ULONG
  751. GetPort(
  752. ) CONST;
  753. NONVIRTUAL
  754. ULONG
  755. GetReserved(
  756. ) CONST;
  757. private:
  758. NONVIRTUAL
  759. VOID
  760. Construct(
  761. );
  762. ULONG _Channel;
  763. ULONG _Port;
  764. ULONG _Reserved1;
  765. };
  766. INLINE
  767. BOOLEAN
  768. DMA_DESCRIPTOR::Initialize(
  769. IN ULONG Channel,
  770. IN ULONG Port,
  771. IN ULONG Reserved1,
  772. IN UCHAR ShareDisposition,
  773. IN USHORT Flags
  774. )
  775. /*++
  776. Routine Description:
  777. Initialize a DMA_DESCRIPTOR object.
  778. Arguments:
  779. Channel -
  780. Port -
  781. Reserved1 -
  782. ShareDisposition -
  783. Flags -
  784. Return Value:
  785. BOOLEAN - Returns TRUE if the operation succeeeds.
  786. --*/
  787. {
  788. _Channel = Channel;
  789. _Port = Port;
  790. _Reserved1 = Reserved1;
  791. return( PARTIAL_DESCRIPTOR::Initialize( CmResourceTypeDma,
  792. ShareDisposition,
  793. Flags ) );
  794. }
  795. INLINE
  796. ULONG
  797. DMA_DESCRIPTOR::GetChannel(
  798. ) CONST
  799. /*++
  800. Routine Description:
  801. Returns the DMA's channel.
  802. Arguments:
  803. None.
  804. Return Value:
  805. ULONG - DMA's channel.
  806. --*/
  807. {
  808. return( _Channel );
  809. }
  810. INLINE
  811. ULONG
  812. DMA_DESCRIPTOR::GetPort(
  813. ) CONST
  814. /*++
  815. Routine Description:
  816. Returns the DMA's port.
  817. Arguments:
  818. None.
  819. Return Value:
  820. ULONG - Return the DMA's length.
  821. --*/
  822. {
  823. return( _Port );
  824. }
  825. INLINE
  826. ULONG
  827. DMA_DESCRIPTOR::GetReserved(
  828. ) CONST
  829. /*++
  830. Routine Description:
  831. Returns the DMA's reserved data.
  832. Arguments:
  833. None.
  834. Return Value:
  835. ULONG - Return the DMA's reserved data.
  836. --*/
  837. {
  838. return( _Reserved1 );
  839. }
  840. // #endif // _DMA_DESCRIPTOR_
  841. // #if !defined( _DEVICE_SPECIFIC_DESCRIPTOR_ )
  842. // #define _DEVICE_SPECIFIC_DESCRIPTOR_
  843. // #define _NTAPI_ULIB_
  844. // #include "ulib.hxx"
  845. DECLARE_CLASS( DEVICE_SPECIFIC_DESCRIPTOR );
  846. class DEVICE_SPECIFIC_DESCRIPTOR : public PARTIAL_DESCRIPTOR {
  847. public:
  848. NONVIRTUAL
  849. ~DEVICE_SPECIFIC_DESCRIPTOR(
  850. );
  851. DECLARE_CONSTRUCTOR( DEVICE_SPECIFIC_DESCRIPTOR );
  852. NONVIRTUAL
  853. BOOLEAN
  854. Initialize(
  855. IN ULONG Reserved1,
  856. IN ULONG Reserved2,
  857. IN ULONG DataSize,
  858. IN PCBYTE Data,
  859. IN UCHAR ShareDisposition,
  860. IN USHORT Flags
  861. );
  862. NONVIRTUAL
  863. ULONG
  864. GetReserved1(
  865. ) CONST;
  866. NONVIRTUAL
  867. ULONG
  868. GetReserved2(
  869. ) CONST;
  870. NONVIRTUAL
  871. ULONG
  872. GetData(
  873. IN OUT PCBYTE* Pointer
  874. ) CONST;
  875. private:
  876. NONVIRTUAL
  877. VOID
  878. Construct(
  879. );
  880. ULONG _Reserved1;
  881. ULONG _Reserved2;
  882. PBYTE _Data;
  883. ULONG _DataSize;
  884. };
  885. INLINE
  886. BOOLEAN
  887. DEVICE_SPECIFIC_DESCRIPTOR::Initialize(
  888. IN ULONG Reserved1,
  889. IN ULONG Reserved2,
  890. IN ULONG DataSize,
  891. IN PCBYTE Data,
  892. IN UCHAR ShareDisposition,
  893. IN USHORT Flags
  894. )
  895. /*++
  896. Routine Description:
  897. Initialize a DEVICE_SPECIFIC_DESCRIPTOR object.
  898. Arguments:
  899. Reserved1 -
  900. Reserved2 -
  901. Size -
  902. Data -
  903. ShareDisposition -
  904. Flags -
  905. Return Value:
  906. BOOLEAN - Returns TRUE if the operation succeeeds.
  907. --*/
  908. {
  909. _Reserved1 = Reserved1;
  910. _Reserved2 = Reserved2;
  911. _DataSize = DataSize;
  912. if( Data != NULL ) {
  913. _Data = ( PBYTE )MALLOC( _DataSize );
  914. if( _Data == NULL ) {
  915. return( FALSE );
  916. }
  917. memcpy( _Data, Data, _DataSize );
  918. }
  919. return( PARTIAL_DESCRIPTOR::Initialize( CmResourceTypeDeviceSpecific,
  920. ShareDisposition,
  921. Flags ) );
  922. }
  923. INLINE
  924. ULONG
  925. DEVICE_SPECIFIC_DESCRIPTOR::GetReserved1(
  926. ) CONST
  927. /*++
  928. Routine Description:
  929. Returns the first reserved device specific data.
  930. Arguments:
  931. None.
  932. Return Value:
  933. ULONG - First reserved device specific data.
  934. --*/
  935. {
  936. return( _Reserved1 );
  937. }
  938. INLINE
  939. ULONG
  940. DEVICE_SPECIFIC_DESCRIPTOR::GetReserved2(
  941. ) CONST
  942. /*++
  943. Routine Description:
  944. Returns the second reserved device specific data.
  945. Arguments:
  946. None.
  947. Return Value:
  948. ULONG - Second reserved device specific data.
  949. --*/
  950. {
  951. return( _Reserved2 );
  952. }
  953. INLINE
  954. ULONG
  955. DEVICE_SPECIFIC_DESCRIPTOR::GetData(
  956. IN OUT PCBYTE* Pointer
  957. ) CONST
  958. /*++
  959. Routine Description:
  960. Returns the device specific data.
  961. Arguments:
  962. Pointer - Address of the variable that will contain the pointer to
  963. the device specific data.
  964. Return Value:
  965. ULONG - Return the number of bytes in the buffer.
  966. --*/
  967. {
  968. if( Pointer != NULL ) {
  969. *Pointer = _Data;
  970. return( _DataSize );
  971. } else {
  972. return( 0 );
  973. }
  974. }
  975. // #endif // _DEVICE_SPECIFIC_DESCRIPTOR_
  976. #endif // _PARTIAL_DESCRIPTOR_