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.

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