gta.S 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*++
  2. Copyright (c) 2016 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. gta.S
  5. Abstract:
  6. This module implements support for accessing ARM Generic Timer registers.
  7. Author:
  8. Chris Stevens 23-May-2016
  9. Environment:
  10. Kernel mode
  11. --*/
  12. ##
  13. ## ------------------------------------------------------------------ Includes
  14. ##
  15. #include <minoca/kernel/arm.inc>
  16. ##
  17. ## --------------------------------------------------------------- Definitions
  18. ##
  19. ##
  20. ## ---------------------------------------------------------------------- Code
  21. ##
  22. ASSEMBLY_FILE_HEADER
  23. ##
  24. ## ULONG
  25. ## HlpGtGetFrequency (
  26. ## VOID
  27. ## )
  28. ##
  29. /*++
  30. Routine Description:
  31. This routine retrieves the CNTFRQ register.
  32. Arguments:
  33. None.
  34. Return Value:
  35. Returns the value of the CNTFRQ.
  36. --*/
  37. FUNCTION HlpGtGetFrequency
  38. mrc p15, 0, %r0, %c14, %c0, 0 @ Get the CNTFRQ
  39. bx %lr @
  40. END_FUNCTION HlpGtGetFrequency
  41. ##
  42. ## VOID
  43. ## HlpGtSetVirtualTimerControl (
  44. ## ULONG Control
  45. ## )
  46. ##
  47. /*++
  48. Routine Description:
  49. This routine sets the CNTV_CTL register.
  50. Arguments:
  51. Control - Supplies the control value to set in the CNTV_CTL.
  52. Return Value:
  53. None.
  54. --*/
  55. FUNCTION HlpGtSetVirtualTimerControl
  56. mcr p15, 0, %r0, %c14, %c3, 1 @ Set the CNTV_CTL
  57. bx %lr @
  58. END_FUNCTION HlpGtSetVirtualTimerControl
  59. ##
  60. ## ULONGLONG
  61. ## HlpGtGetVirtualCount (
  62. ## VOID
  63. ## )
  64. ##
  65. /*++
  66. Routine Description:
  67. This routine retrieves the CNTVCT register.
  68. Arguments:
  69. None.
  70. Return Value:
  71. Returns the value of the CNTVCT.
  72. --*/
  73. FUNCTION HlpGtGetVirtualCount
  74. mrrc p15, 1, %r0, %r1, %c14 @ Get the CNTVCT
  75. bx %lr @
  76. END_FUNCTION HlpGtGetVirtualCount
  77. ##
  78. ## VOID
  79. ## HlpGtSetVirtualTimerCompare (
  80. ## ULONGLONG CompareValue
  81. ## )
  82. ##
  83. /*++
  84. Routine Description:
  85. This routine retrieves the CNTV_CVAL register.
  86. Arguments:
  87. CompareValue - Supplies the compare value to set in the CNTV_CVAL register.
  88. Return Value:
  89. None.
  90. --*/
  91. FUNCTION HlpGtSetVirtualTimerCompare
  92. mcrr p15, 3, %r0, %r1, %c14 @ Set the CNTV_CVAL
  93. bx %lr @
  94. END_FUNCTION HlpGtSetVirtualTimerCompare
  95. ##
  96. ## --------------------------------------------------------- Internal Functions
  97. ##