sys_ctrl.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /******************************************************************************
  2. * Filename: sys_ctrl.h
  3. * Revised: $Date: 2013-03-20 14:59:13 +0100 (Wed, 20 Mar 2013) $
  4. * Revision: $Revision: 9491 $
  5. *
  6. * Description: Prototypes for the system control driver.
  7. *
  8. * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
  9. *
  10. *
  11. * Redistribution and use in source and binary forms, with or without
  12. * modification, are permitted provided that the following conditions
  13. * are met:
  14. *
  15. * Redistributions of source code must retain the above copyright
  16. * notice, this list of conditions and the following disclaimer.
  17. *
  18. * Redistributions in binary form must reproduce the above copyright
  19. * notice, this list of conditions and the following disclaimer in the
  20. * documentation and/or other materials provided with the distribution.
  21. *
  22. * Neither the name of Texas Instruments Incorporated nor the names of
  23. * its contributors may be used to endorse or promote products derived
  24. * from this software without specific prior written permission.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  27. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  28. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  29. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  30. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  31. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  32. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  33. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  34. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  35. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  36. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  37. *
  38. ******************************************************************************/
  39. #ifndef __SYS_CTRL_H__
  40. #define __SYS_CTRL_H__
  41. //*****************************************************************************
  42. //
  43. // If building with a C++ compiler, make all of the definitions in this header
  44. // have a C binding.
  45. //
  46. //*****************************************************************************
  47. #ifdef __cplusplus
  48. extern "C"
  49. {
  50. #endif
  51. #include "hw_types.h"
  52. //*****************************************************************************
  53. //
  54. // General constants
  55. //
  56. //*****************************************************************************
  57. #define SYS_CTRL_TIMEOUT 0x0000ffff // Time out value for polling
  58. #define SYS_CTRL_32MHZ 32000000
  59. #define SYS_CTRL_16MHZ 16000000
  60. #define SYS_CTRL_8MHZ 8000000
  61. #define SYS_CTRL_4MHZ 4000000
  62. #define SYS_CTRL_2MHZ 2000000
  63. #define SYS_CTRL_1MHZ 1000000
  64. #define SYS_CTRL_500KHZ 500000
  65. #define SYS_CTRL_250KHZ 250000
  66. #define SYS_CTRL_62500HZ 62500
  67. //*****************************************************************************
  68. //
  69. // The following are values that can be passed to the
  70. // SysCtrlPeripheralReset(), SysCtrlPeripheralEnable(),
  71. // SysCtrlPeripheralDisable(), SysCtrlPeripheralSleepEnable(),
  72. // SysCtrlPeripheralSleepDisable(), SysCtrlPeripheralDeepSleepEnable() and
  73. // SysCtrlPeripheralDeepSleepDisable() APIs as the ui32Peripheral parameter.
  74. //
  75. //*****************************************************************************
  76. #define SYS_CTRL_PERIPH_GPT0 0x00000000 // General Purpose Timer 0
  77. #define SYS_CTRL_PERIPH_GPT1 0x00000001 // General Purpose Timer 1
  78. #define SYS_CTRL_PERIPH_GPT2 0x00000002 // General Purpose Timer 2
  79. #define SYS_CTRL_PERIPH_GPT3 0x00000003 // General Purpose Timer 3
  80. #define SYS_CTRL_PERIPH_SSI0 0x00000100 // SSI 0
  81. #define SYS_CTRL_PERIPH_SSI1 0x00000101 // SSI 1
  82. #define SYS_CTRL_PERIPH_UART0 0x00000200 // UART 0
  83. #define SYS_CTRL_PERIPH_UART1 0x00000201 // UART 1
  84. #define SYS_CTRL_PERIPH_I2C 0x00000300 // I2C0
  85. #define SYS_CTRL_PERIPH_PKA 0x00000400 // PKA
  86. #define SYS_CTRL_PERIPH_AES 0x00000401 // AES
  87. #define SYS_CTRL_PERIPH_RFC 0x00000500 // RF Core
  88. //*****************************************************************************
  89. //
  90. // The following are values that can be passed to the SysCtrlClockSet() API as
  91. // the ui32Config parameter.
  92. //
  93. //*****************************************************************************
  94. #define SYS_CTRL_SYSDIV_32MHZ 0x00000000 // Sys_div for sysclk 32MHz
  95. #define SYS_CTRL_SYSDIV_16MHZ 0x00000001 // Sys_div for sysclk 16MHz
  96. #define SYS_CTRL_SYSDIV_8MHZ 0x00000002 // Sys_div for sysclk 8MHz
  97. #define SYS_CTRL_SYSDIV_4MHZ 0x00000003 // Sys_div for sysclk 4MHz
  98. #define SYS_CTRL_SYSDIV_2MHZ 0x00000004 // Sys_div for sysclk 2MHz
  99. #define SYS_CTRL_SYSDIV_1MHZ 0x00000005 // Sys_div for sysclk 1MHz
  100. #define SYS_CTRL_SYSDIV_500KHZ 0x00000006 // Sys_div for sysclk 0.50MHz
  101. #define SYS_CTRL_SYSDIV_250KHZ 0x00000007 // Sys_div for sysclk 0.25MHz
  102. //*****************************************************************************
  103. //
  104. // The following are values that can be passed to the SysCtrlPowerModeSet()
  105. // API as the ui32PowerMode parameter.
  106. //
  107. //*****************************************************************************
  108. #define SYS_CTRL_PM_NOACTION 0x00000000 // No action
  109. #define SYS_CTRL_PM_1 0x00000001 // Power Mode 1
  110. #define SYS_CTRL_PM_2 0x00000002 // Power Mode 2
  111. #define SYS_CTRL_PM_3 0x00000003 // Power Mode 3
  112. //*****************************************************************************
  113. //
  114. // Prototypes for the APIs.
  115. //
  116. //*****************************************************************************
  117. extern void SysCtrlClockSet(bool bOsc32k, bool bInternalOsc,
  118. uint32_t ui32SysDiv);
  119. extern uint32_t SysCtrlClockGet(void);
  120. extern void SysCtrlIOClockSet(uint32_t ui32IODiv);
  121. extern uint32_t SysCtrlIOClockGet(void);
  122. extern void SysCtrlDelay(uint32_t ui32Count);
  123. extern void SysCtrlReset(void);
  124. extern void SysCtrlSleep(void);
  125. extern void SysCtrlDeepSleep(void);
  126. extern bool SysCtrlPeripheralPresent(uint32_t ui32Peripheral);
  127. extern void SysCtrlPeripheralReset(uint32_t ui32Peripheral);
  128. extern void SysCtrlPeripheralEnable(uint32_t ui32Peripheral);
  129. extern void SysCtrlPeripheralDisable(uint32_t ui32Peripheral);
  130. extern void SysCtrlPeripheralSleepEnable(uint32_t ui32Peripheral);
  131. extern void SysCtrlPeripheralSleepDisable(uint32_t ui32Peripheral);
  132. extern void SysCtrlPeripheralDeepSleepEnable(uint32_t ui32Peripheral);
  133. extern void SysCtrlPeripheralDeepSleepDisable(uint32_t ui32Peripheral);
  134. extern void SysCtrlPowerModeSet(uint32_t ui32PowerMode);
  135. extern uint32_t SysCtrlPowerModeGet(void);
  136. extern void SysCtrlClockLossDetectEnable(void);
  137. //*****************************************************************************
  138. //
  139. // Mark the end of the C bindings section for C++ compilers.
  140. //
  141. //*****************************************************************************
  142. #ifdef __cplusplus
  143. }
  144. #endif
  145. #endif // __SYS_CTRL_H__