fan.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. //*****************************************************************************
  2. //
  3. // fan.h - Prototypes and macros for the Fan controller.
  4. //
  5. // Copyright (c) 2010-2011 Texas Instruments Incorporated. All rights reserved.
  6. // Software License Agreement
  7. //
  8. // Texas Instruments (TI) is supplying this software for use solely and
  9. // exclusively on TI's microcontroller products. The software is owned by
  10. // TI and/or its suppliers, and is protected under applicable copyright
  11. // laws. You may not combine this software with "viral" open-source
  12. // software in order to form a larger program.
  13. //
  14. // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
  15. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
  16. // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
  18. // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
  19. // DAMAGES, FOR ANY REASON WHATSOEVER.
  20. //
  21. // This is part of revision 8264 of the Stellaris Peripheral Driver Library.
  22. //
  23. //*****************************************************************************
  24. #ifndef __FAN_H__
  25. #define __FAN_H__
  26. //*****************************************************************************
  27. //
  28. // If building with a C++ compiler, make all of the definitions in this header
  29. // have a C binding.
  30. //
  31. //*****************************************************************************
  32. #ifdef __cplusplus
  33. extern "C"
  34. {
  35. #endif
  36. //*****************************************************************************
  37. //
  38. // Fan status values that can be returned from the FanChannelStatus() function.
  39. //
  40. //*****************************************************************************
  41. #define FAN_STATUS_STALLED 0
  42. #define FAN_STATUS_CHANGING 1
  43. #define FAN_STATUS_LOCKED 2
  44. #define FAN_STATUS_NOATTAIN 3
  45. //*****************************************************************************
  46. //
  47. // Configuration flags to be used with FanChannelConfigManual() and
  48. // FanChannelConfigAuto().
  49. //
  50. //*****************************************************************************
  51. #define FAN_CONFIG_RESTART (1 << 15)
  52. #define FAN_CONFIG_NORESTART (0 << 15)
  53. #define FAN_CONFIG_ACCEL_FAST (1 << 14)
  54. #define FAN_CONFIG_ACCEL_SLOW (0 << 14)
  55. #define FAN_CONFIG_HYST_1 (0 << 11)
  56. #define FAN_CONFIG_HYST_2 (1 << 11)
  57. #define FAN_CONFIG_HYST_4 (2 << 11)
  58. #define FAN_CONFIG_HYST_8 (3 << 11)
  59. #define FAN_CONFIG_HYST_16 (4 << 11)
  60. #define FAN_CONFIG_HYST_32 (5 << 11)
  61. #define FAN_CONFIG_HYST_64 (6 << 11)
  62. #define FAN_CONFIG_HYST_128 (7 << 11)
  63. #define FAN_CONFIG_START_2 (0 << 8)
  64. #define FAN_CONFIG_START_4 (1 << 8)
  65. #define FAN_CONFIG_START_8 (2 << 8)
  66. #define FAN_CONFIG_START_16 (3 << 8)
  67. #define FAN_CONFIG_START_32 (4 << 8)
  68. #define FAN_CONFIG_START_64 (5 << 8)
  69. #define FAN_CONFIG_START_128 (6 << 8)
  70. #define FAN_CONFIG_START_256 (7 << 8)
  71. #define FAN_CONFIG_START_DUTY_OFF (0 << 6)
  72. #define FAN_CONFIG_START_DUTY_50 (1 << 6)
  73. #define FAN_CONFIG_START_DUTY_75 (2 << 6)
  74. #define FAN_CONFIG_START_DUTY_100 (3 << 6)
  75. #define FAN_CONFIG_AVG_NONE (0 << 4)
  76. #define FAN_CONFIG_AVG_2 (1 << 4)
  77. #define FAN_CONFIG_AVG_4 (2 << 4)
  78. #define FAN_CONFIG_AVG_8 (3 << 4)
  79. #define FAN_CONFIG_TACH_1 (0 << 2)
  80. #define FAN_CONFIG_TACH_2 (1 << 2)
  81. #define FAN_CONFIG_TACH_4 (2 << 2)
  82. #define FAN_CONFIG_TACH_8 (3 << 2)
  83. //*****************************************************************************
  84. //
  85. // Interrupt configuration/status flags to be used with the following
  86. // functions: FanIntEnable(), FanIntDisable(), FanIntStatus(), FanIntClear().
  87. //
  88. //*****************************************************************************
  89. #define FAN_CH5_INT_AUTO_SPEED_OK (1 << 22)
  90. #define FAN_CH5_INT_MANUAL_SPEED_CHANGE (1 << 22)
  91. #define FAN_CH5_INT_AUTO_SPEED_ERROR (1 << 21)
  92. #define FAN_CH5_INT_MANUAL_SPEED_UPDATE (1 << 21)
  93. #define FAN_CH5_INT_STALL (1 << 20)
  94. #define FAN_CH4_INT_AUTO_SPEED_OK (1 << 18)
  95. #define FAN_CH4_INT_MANUAL_SPEED_CHANGE (1 << 18)
  96. #define FAN_CH4_INT_AUTO_SPEED_ERROR (1 << 17)
  97. #define FAN_CH4_INT_MANUAL_SPEED_UPDATE (1 << 17)
  98. #define FAN_CH4_INT_STALL (1 << 16)
  99. #define FAN_CH3_INT_AUTO_SPEED_OK (1 << 14)
  100. #define FAN_CH3_INT_MANUAL_SPEED_CHANGE (1 << 14)
  101. #define FAN_CH3_INT_AUTO_SPEED_ERROR (1 << 13)
  102. #define FAN_CH3_INT_MANUAL_SPEED_UPDATE (1 << 13)
  103. #define FAN_CH3_INT_STALL (1 << 12)
  104. #define FAN_CH2_INT_AUTO_SPEED_OK (1 << 10)
  105. #define FAN_CH2_INT_MANUAL_SPEED_CHANGE (1 << 10)
  106. #define FAN_CH2_INT_AUTO_SPEED_ERROR (1 << 9)
  107. #define FAN_CH2_INT_MANUAL_SPEED_UPDATE (1 << 9)
  108. #define FAN_CH2_INT_STALL (1 << 8)
  109. #define FAN_CH1_INT_AUTO_SPEED_OK (1 << 6)
  110. #define FAN_CH1_INT_MANUAL_SPEED_CHANGE (1 << 6)
  111. #define FAN_CH1_INT_AUTO_SPEED_ERROR (1 << 5)
  112. #define FAN_CH1_INT_MANUAL_SPEED_UPDATE (1 << 5)
  113. #define FAN_CH1_INT_STALL (1 << 4)
  114. #define FAN_CH0_INT_AUTO_SPEED_OK (1 << 2)
  115. #define FAN_CH0_INT_MANUAL_SPEED_CHANGE (1 << 2)
  116. #define FAN_CH0_INT_AUTO_SPEED_ERROR (1 << 1)
  117. #define FAN_CH0_INT_MANUAL_SPEED_UPDATE (1 << 1)
  118. #define FAN_CH0_INT_STALL (1 << 0)
  119. #define FAN_CHx_INT_AUTO_SPEED_OK(x) (1 << (((x) * 4) + 2))
  120. #define FAN_CHx_INT_MANUAL_SPEED_CHANGE(x) (1 << (((x) * 4) + 2))
  121. #define FAN_CHx_INT_AUTO_SPEED_ERROR(x) (1 << (((x) * 4) + 1))
  122. #define FAN_CHx_INT_MANUAL_SPEED_UPDATE(x) (1 << (((x) * 4) + 1))
  123. #define FAN_CHx_INT_STALL(x) (1 << ((x) * 4))
  124. //*****************************************************************************
  125. //
  126. // API Function prototypes
  127. //
  128. //*****************************************************************************
  129. extern void FanChannelEnable(unsigned long ulBase, unsigned long ulChannel);
  130. extern void FanChannelDisable(unsigned long ulBase, unsigned long ulChannel);
  131. extern unsigned long FanChannelStatus(unsigned long ulBase,
  132. unsigned long ulChannel);
  133. extern void FanChannelConfigManual(unsigned long ulBase, unsigned long ulChannel,
  134. unsigned long ulConfig);
  135. extern void FanChannelConfigAuto(unsigned long ulBase, unsigned long ulChannel,
  136. unsigned long ulConfig);
  137. extern void FanChannelDutySet(unsigned long ulBase, unsigned long ulChannel,
  138. unsigned long ulDuty);
  139. extern unsigned long FanChannelDutyGet(unsigned long ulBase,
  140. unsigned long ulChannel);
  141. extern void FanChannelRPMSet(unsigned long ulBase, unsigned long ulChannel,
  142. unsigned long ulRPM);
  143. extern unsigned long FanChannelRPMGet(unsigned long ulBase,
  144. unsigned long ulChannel);
  145. extern void FanIntEnable(unsigned long ulBase, unsigned long ulFlags);
  146. extern void FanIntDisable(unsigned long ulBase, unsigned long ulFlags);
  147. extern unsigned long FanIntStatus(unsigned long ulBase, tBoolean bMasked);
  148. extern void FanIntClear(unsigned long ulBase, unsigned long ulFlags);
  149. extern void FanIntRegister(unsigned long ulBase, void (*pfnHandler)(void));
  150. extern void FanIntUnregister(unsigned long ulBase);
  151. extern unsigned long FanChannelsGet(unsigned long ulBase);
  152. //*****************************************************************************
  153. //
  154. // Mark the end of the C bindings section for C++ compilers.
  155. //
  156. //*****************************************************************************
  157. #ifdef __cplusplus
  158. }
  159. #endif
  160. #endif // __FAN_H__