csl_tsc.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /* ============================================================================
  2. * Copyright (c) Texas Instruments Incorporated 2008, 2009
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. *
  11. * Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the
  14. * distribution.
  15. *
  16. * Neither the name of Texas Instruments Incorporated nor the names of
  17. * its contributors may be used to endorse or promote products derived
  18. * from this software without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. *
  32. */
  33. /**
  34. * @file csl_tsc.h
  35. *
  36. * @brief
  37. * Header file for functional layer of TSC CSL
  38. *
  39. * \par
  40. * ============================================================================
  41. * @n (C) Copyright 2008, 2009, Texas Instruments, Inc.
  42. * @n Use of this software is controlled by the terms and conditions found
  43. * @n in the license agreement under which this software has been supplied.
  44. * ===========================================================================
  45. * \par
  46. */
  47. /** @defgroup CSL_TSC_API TSC
  48. *
  49. * @section Introduction
  50. *
  51. * @subsection xxx Overview
  52. *
  53. * Time Stamp Counter is a free running 64-bit CPU counter that advances each CPU
  54. * clock after counting is enabled. The counter is accessed using two 32-bit
  55. * read-only control registers, Time Stamp Counter Registers – Low (TSCL) and
  56. * Time Stamp Counter Registers – High (TSCH). The counter is enabled by writing to
  57. * TSCL. The value written is ignored. Once enabled, counting cannot be disabled under
  58. * program control. Counting is disabled in the following cases:
  59. * a. After exiting the reset state.
  60. * b. When the CPU is fully powered down.
  61. *
  62. * @subsection References
  63. * -# Joule CPU Architecture Spec
  64. *
  65. * @subsection Assumptions
  66. * The abbreviations TSC, tsc and Tsc have been used throughout this
  67. * document to refer to C64+ Time Stamp Counter
  68. */
  69. #ifndef CSL_TSC_H_
  70. #define CSL_TSC_H_
  71. #ifdef __cplusplus
  72. extern "C" {
  73. #endif
  74. #include <ti/csl/soc.h>
  75. #include <ti/csl/csl.h>
  76. /**
  77. @defgroup CSL_TSC_FUNCTION TSC Functions
  78. @ingroup CSL_TSC_API
  79. */
  80. /** @addtogroup CSL_TSC_FUNCTION
  81. @{ */
  82. /** ===========================================================================
  83. * @n@b CSL_tscEnable
  84. *
  85. * @b Description
  86. * @n This API enables the 64 bit time stamp counter. The Time Stamp Counter
  87. * (TSC) stops only upon Reset or powerdown. When time stamp counter is
  88. * enabled (following a reset or powerdown of the CPU) it will initialize
  89. * to 0 and begin incrementing once per CPU cycle. You cannot reset the
  90. * time stamp counter.
  91. *
  92. * @b Arguments
  93. * @n None
  94. *
  95. * <b> Return Value </b>
  96. * @n None
  97. *
  98. * <b> Pre Condition </b>
  99. * @n None
  100. *
  101. * <b> Post Condition </b>
  102. * @n Time Stamp Counter value starts incrementing
  103. *
  104. * @b Writes
  105. * @n TSCL=0,
  106. * TSCH=0
  107. *
  108. * @b Example
  109. * @verbatim
  110. CSL_tscEnable ();
  111. * @endverbatim
  112. * ============================================================================
  113. */
  114. extern void CSL_tscEnable(void);
  115. /** ============================================================================
  116. * @n@b CSL_tscRead
  117. *
  118. * @b Description
  119. * @n Reads the 64 bit timer stamp conter and return the 64-bit counter value.
  120. *
  121. * @b Arguments None
  122. *
  123. * <b> Return Value </b> CSL_Uint64
  124. * @li 64 Bit Time Stamp Counter value
  125. *
  126. * <b> Pre Condition </b>
  127. * @n None
  128. *
  129. * <b> Post Condition </b>
  130. * @n None
  131. *
  132. * @b Reads
  133. * TSCL,
  134. * TSCH
  135. *
  136. * @b Example
  137. * @verbatim
  138. CSL_Uint64 counterVal;
  139. ...
  140. CSL_tscStart();
  141. ...
  142. counterVal = CSL_tscRead();
  143. * @endverbatim
  144. * ============================================================================
  145. */
  146. extern CSL_Uint64 CSL_tscRead (void);
  147. /**
  148. @}
  149. */
  150. #ifdef __cplusplus
  151. }
  152. #endif
  153. #endif