1
0

pl031.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /*++
  2. Copyright (c) 2014 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. pl031.h
  9. Abstract:
  10. This header contains definitions for the ARM PrimeCell PL-031 Real Time
  11. Clock library.
  12. Author:
  13. Evan Green 7-Apr-2014
  14. --*/
  15. //
  16. // ------------------------------------------------------------------- Includes
  17. //
  18. //
  19. // ---------------------------------------------------------------- Definitions
  20. //
  21. //
  22. // ------------------------------------------------------ Data Type Definitions
  23. //
  24. /*++
  25. Structure Description:
  26. This structure defines the context for a PL031 Real Time Clock. Upon
  27. initialization, the consumer of the library is responsible for initializing
  28. some of these values.
  29. Members:
  30. Base - Stores the base address of the controller. The consumer of the
  31. library is responsible for initializing this.
  32. --*/
  33. typedef struct _PL031_CONTEXT {
  34. VOID *Base;
  35. } PL031_CONTEXT, *PPL031_CONTEXT;
  36. //
  37. // -------------------------------------------------------------------- Globals
  38. //
  39. //
  40. // -------------------------------------------------------- Function Prototypes
  41. //
  42. EFI_STATUS
  43. EfipPl031Initialize (
  44. PPL031_CONTEXT Context
  45. );
  46. /*++
  47. Routine Description:
  48. This routine initializes a PL-031 device.
  49. Arguments:
  50. Context - Supplies a pointer to the device context. The caller must have
  51. filled out the base register.
  52. Return Value:
  53. EFI_SUCCESS on success.
  54. EFI_DEVICE_ERROR if the device could not be initialized.
  55. --*/
  56. EFI_STATUS
  57. EfipPl031GetTime (
  58. PPL031_CONTEXT Context,
  59. UINT32 *CurrentTime
  60. );
  61. /*++
  62. Routine Description:
  63. This routine reads the current value from the RTC device.
  64. Arguments:
  65. Context - Supplies a pointer to the device context. The caller must have
  66. filled out the base register.
  67. CurrentTime - Supplies a pointer where the current time will be returned
  68. on success.
  69. Return Value:
  70. EFI_SUCCESS on success.
  71. EFI_DEVICE_ERROR if the device could not be initialized.
  72. --*/
  73. EFI_STATUS
  74. EfipPl031GetWakeupTime (
  75. PPL031_CONTEXT Context,
  76. BOOLEAN *Enabled,
  77. BOOLEAN *Pending,
  78. UINT32 *WakeupTime
  79. );
  80. /*++
  81. Routine Description:
  82. This routine reads the current wakeup time from the RTC device.
  83. Arguments:
  84. Context - Supplies a pointer to the device context. The caller must have
  85. filled out the base register.
  86. Enabled - Supplies a pointer where a boolean will be returned indicating
  87. whether or not the wake alarm is enabled.
  88. Pending - Supplies a pointer where a boolean will be retunred indicating
  89. whether or not the wake alarm is pending.
  90. WakeupTime - Supplies a pointer where the current wakeup time will be
  91. returned on success.
  92. Return Value:
  93. EFI_SUCCESS on success.
  94. EFI_DEVICE_ERROR if the device could not be initialized.
  95. --*/
  96. EFI_STATUS
  97. EfipPl031SetTime (
  98. PPL031_CONTEXT Context,
  99. UINT32 NewTime
  100. );
  101. /*++
  102. Routine Description:
  103. This routine reads the current value from the RTC device.
  104. Arguments:
  105. Context - Supplies a pointer to the device context. The caller must have
  106. filled out the base register.
  107. NewTime - Supplies the new time to set.
  108. Return Value:
  109. EFI_SUCCESS on success.
  110. EFI_DEVICE_ERROR if the device could not be initialized.
  111. --*/
  112. EFI_STATUS
  113. EfipPl031SetWakeupTime (
  114. PPL031_CONTEXT Context,
  115. BOOLEAN Enable,
  116. UINT32 NewWakeTime
  117. );
  118. /*++
  119. Routine Description:
  120. This routine reads the current value from the RTC device.
  121. Arguments:
  122. Context - Supplies a pointer to the device context. The caller must have
  123. filled out the base register.
  124. Enable - Supplies a boolean indicating if the wake alarm should be enabled
  125. (TRUE) or disabled (FALSE).
  126. NewWakeTime - Supplies the new time to set.
  127. Return Value:
  128. EFI_SUCCESS on success.
  129. EFI_DEVICE_ERROR if the device could not be initialized.
  130. --*/