sys_pmu.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /** @file sys_pmu.h
  2. * @brief System Pmu Header File
  3. * @date 29.May.2013
  4. * @version 03.05.02
  5. *
  6. * This file contains:
  7. * - Pmu Interface Functions
  8. * .
  9. * which are relevant for the performance monitor unit driver.
  10. */
  11. /* (c) Texas Instruments 2009-2013, All rights reserved. */
  12. #ifndef __SYS_PMU_H__
  13. #define __SYS_PMU_H__
  14. #include "sys_common.h"
  15. /* USER CODE BEGIN (0) */
  16. /* USER CODE END */
  17. /** @def pmuCOUNTER0
  18. * @brief pmu event counter 0
  19. *
  20. * Alias for pmu event counter 0
  21. */
  22. #define pmuCOUNTER0 0x00000001U
  23. /** @def pmuCOUNTER1
  24. * @brief pmu event counter 1
  25. *
  26. * Alias for pmu event counter 1
  27. */
  28. #define pmuCOUNTER1 0x00000002U
  29. /** @def pmuCOUNTER2
  30. * @brief pmu event counter 2
  31. *
  32. * Alias for pmu event counter 2
  33. */
  34. #define pmuCOUNTER2 0x00000004U
  35. /** @def pmuCYCLE_COUNTER
  36. * @brief pmu cycle counter
  37. *
  38. * Alias for pmu event counter
  39. */
  40. #define pmuCYCLE_COUNTER 0x80000000U
  41. /** @enum pmuEvent
  42. * @brief pmu event
  43. *
  44. * Alias for pmu event counter increment source
  45. */
  46. enum pmuEvent
  47. {
  48. PMU_INST_CACHE_MISS = 0x01U,
  49. PMU_DATA_CACHE_MISS = 0x03U,
  50. PMU_DATA_CACHE_ACCESS = 0x04U,
  51. PMU_DATA_READ_ARCH_EXECUTED = 0x06U,
  52. PMU_DATA_WRITE_ARCH_EXECUTED = 0x07U,
  53. PMU_INST_ARCH_EXECUTED = 0x08U,
  54. PMU_EXCEPTION_TAKEN = 0x09U,
  55. PMU_EXCEPTION_RETURN_ARCH_EXECUTED = 0x0AU,
  56. PMU_CHANGE_TO_CONTEXT_ID_EXECUTED = 0x0BU,
  57. PMU_SW_CHANGE_OF_PC_ARCH_EXECUTED = 0x0CU,
  58. PMU_BRANCH_IMM_INST_ARCH_EXECUTED = 0x0DU,
  59. PMU_PROC_RETURN_ARCH_EXECUTED = 0x0EU,
  60. PMU_UNALIGNED_ACCESS_ARCH_EXECUTED = 0x0FU,
  61. PMU_BRANCH_MISSPREDICTED = 0x10U,
  62. PMU_CYCLE_COUNT = 0x11U,
  63. PMU_PREDICTABLE_BRANCHES = 0x12U,
  64. PMU_INST_BUFFER_STALL = 0x40U,
  65. PMU_DATA_DEPENDENCY_INST_STALL = 0x41U,
  66. PMU_DATA_CACHE_WRITE_BACK = 0x42U,
  67. PMU_EXT_MEMORY_REQUEST = 0x43U,
  68. PMU_LSU_BUSY_STALL = 0x44U,
  69. PMU_FORCED_DRAIN_OFSTORE_BUFFER = 0x45U,
  70. PMU_FIQ_DISABLED_CYCLE_COUNT = 0x46U,
  71. PMU_IRQ_DISABLED_CYCLE_COUNT = 0x47U,
  72. PMU_ETMEXTOUT_0 = 0x48U,
  73. PMU_ETMEXTOUT_1 = 0x49U,
  74. PMU_INST_CACHE_TAG_ECC_ERROR = 0x4AU,
  75. PMU_INST_CACHE_DATA_ECC_ERROR = 0x4BU,
  76. PMU_DATA_CACHE_TAG_ECC_ERROR = 0x4CU,
  77. PMU_DATA_CACHE_DATA_ECC_ERROR = 0x4DU,
  78. PMU_TCM_FATAL_ECC_ERROR_PREFETCH = 0x4EU,
  79. PMU_TCM_FATAL_ECC_ERROR_LOAD_STORE = 0x4FU,
  80. PMU_STORE_BUFFER_MERGE = 0x50U,
  81. PMU_LSU_STALL_STORE_BUFFER_FULL = 0x51U,
  82. PMU_LSU_STALL_STORE_QUEUE_FULL = 0x52U,
  83. PMU_INTEGER_DIV_EXECUTED = 0x53U,
  84. PMU_STALL_INTEGER_DIV = 0x54U,
  85. PMU_PLD_INST_LINE_FILL = 0x55U,
  86. PMU_PLD_INST_NO_LINE_FILL = 0x56U,
  87. PMU_NON_CACHEABLE_ACCESS_AXI_MASTER = 0x57U,
  88. PMU_INST_CACHE_ACCESS = 0x58U,
  89. PMU_DOUBLE_DATA_CACHE_ISSUE = 0x59U,
  90. PMU_DUAL_ISSUE_CASE_A = 0x5AU,
  91. PMU_DUAL_ISSUE_CASE_B1_B2_F2_F2D = 0x5BU,
  92. PMU_DUAL_ISSUE_OTHER = 0x5CU,
  93. PMU_DP_FLOAT_INST_EXCECUTED = 0x5DU,
  94. PMU_DUAL_ISSUED_PAIR_INST_ARCH_EXECUTED = 0x5EU,
  95. PMU_DATA_CACHE_DATA_FATAL_ECC_ERROR = 0x60U,
  96. PMU_DATA_CACHE_TAG_FATAL_ECC_ERROR = 0x61U,
  97. PMU_PROCESSOR_LIVE_LOCK = 0x62U,
  98. PMU_ATCM_MULTI_BIT_ECC_ERROR = 0x64U,
  99. PMU_B0TCM_MULTI_BIT_ECC_ERROR = 0x65U,
  100. PMU_B1TCM_MULTI_BIT_ECC_ERROR = 0x66U,
  101. PMU_ATCM_SINGLE_BIT_ECC_ERROR = 0x67U,
  102. PMU_B0TCM_SINGLE_BIT_ECC_ERROR = 0x68U,
  103. PMU_B1TCM_SINGLE_BIT_ECC_ERROR = 0x69U,
  104. PMU_TCM_COR_ECC_ERROR_LOAD_STORE = 0x6AU,
  105. PMU_TCM_COR_ECC_ERROR_PREFETCH = 0x6BU,
  106. PMU_TCM_FATAL_ECC_ERROR_AXI_SLAVE = 0x6CU,
  107. PMU_TCM_COR_ECC_ERROR_AXI_SLAVE = 0x6DU
  108. };
  109. /** @fn void _pmuInit_(void)
  110. * @brief Initialize Performance Monitor Unit
  111. */
  112. void _pmuInit_(void);
  113. /** @fn void _pmuEnableCountersGlobal_(void)
  114. * @brief Enable and reset cycle counter and all 3 event counters
  115. */
  116. void _pmuEnableCountersGlobal_(void);
  117. /** @fn void _pmuDisableCountersGlobal_(void)
  118. * @brief Disable cycle counter and all 3 event counters
  119. */
  120. void _pmuDisableCountersGlobal_(void);
  121. /** @fn void _pmuResetCycleCounter_(void)
  122. * @brief Reset cycle counter
  123. */
  124. void _pmuResetCycleCounter_(void);
  125. /** @fn void _pmuResetEventCounters_(void)
  126. * @brief Reset event counters 0-2
  127. */
  128. void _pmuResetEventCounters_(void);
  129. /** @fn void _pmuResetCounters_(void)
  130. * @brief Reset cycle counter and event counters 0-2
  131. */
  132. void _pmuResetCounters_(void);
  133. /** @fn void _pmuStartCounters_(uint32 counters)
  134. * @brief Starts selected counters
  135. * @param[in] counters - Counter mask
  136. */
  137. void _pmuStartCounters_(uint32 counters);
  138. /** @fn void _pmuStopCounters_(uint32 counters)
  139. * @brief Stops selected counters
  140. * @param[in] counters - Counter mask
  141. */
  142. void _pmuStopCounters_(uint32 counters);
  143. /** @fn void _pmuSetCountEvent_(uint32 counter, uint32 event)
  144. * @brief Set event counter count event
  145. * @param[in] counter - Counter select 0..2
  146. * @param[in] event - Count event
  147. */
  148. void _pmuSetCountEvent_(uint32 counter, uint32 event);
  149. /** @fn uint32 _pmuGetCycleCount_(void)
  150. * @brief Returns current cycle counter value
  151. *
  152. * @return cycle count.
  153. */
  154. uint32 _pmuGetCycleCount_(void);
  155. /** @fn uint32 _pmuGetEventCount_(uint32 counter)
  156. * @brief Returns current event counter value
  157. * @param[in] counter - Counter select 0..2
  158. *
  159. * @return event counter count.
  160. */
  161. uint32 _pmuGetEventCount_(uint32 counter);
  162. /** @fn uint32 _pmuGetOverflow_(void)
  163. * @brief Returns current overflow register and clear flags
  164. *
  165. * @return overflow flags.
  166. */
  167. uint32 _pmuGetOverflow_(void);
  168. #endif