pl031.h 3.8 KB

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