fan.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. //*****************************************************************************
  2. //
  3. // fan.c - Driver 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. #include "inc/hw_types.h"
  25. #include "inc/hw_memmap.h"
  26. #include "inc/hw_fan.h"
  27. #include "inc/hw_ints.h"
  28. #include "driverlib/fan.h"
  29. #include "driverlib/debug.h"
  30. #include "driverlib/interrupt.h"
  31. //*****************************************************************************
  32. //
  33. //! \addtogroup fan_api
  34. //! @{
  35. //
  36. //*****************************************************************************
  37. //*****************************************************************************
  38. //
  39. //! Enables a FAN channel for operation.
  40. //!
  41. //! \param ulBase is the base address of the FAN module.
  42. //! \param ulChannel is the FAN channel to enable.
  43. //!
  44. //! This function enables the specified FAN channel for operation.
  45. //!
  46. //! \return None.
  47. //
  48. //*****************************************************************************
  49. void
  50. FanChannelEnable(unsigned long ulBase, unsigned long ulChannel)
  51. {
  52. //
  53. // Check the arguments.
  54. //
  55. ASSERT(ulBase == FAN0_BASE);
  56. ASSERT(ulChannel <= 5);
  57. //
  58. // Enable the requested channel
  59. //
  60. HWREG(ulBase + FAN_O_CTL) |= 1 << ulChannel;
  61. }
  62. //*****************************************************************************
  63. //
  64. //! Disables a FAN channel for operation.
  65. //!
  66. //! \param ulBase is the base address of the FAN module.
  67. //! \param ulChannel is the FAN channel to disable.
  68. //!
  69. //! This function disables the specified FAN channel for operation.
  70. //!
  71. //! \return None.
  72. //
  73. //*****************************************************************************
  74. void
  75. FanChannelDisable(unsigned long ulBase, unsigned long ulChannel)
  76. {
  77. //
  78. // Check the arguments.
  79. //
  80. ASSERT(ulBase == FAN0_BASE);
  81. ASSERT(ulChannel <= 5);
  82. //
  83. // Disable the requested channel
  84. //
  85. HWREG(ulBase + FAN_O_CTL) &= ~(1 << ulChannel);
  86. }
  87. //*****************************************************************************
  88. //
  89. //! Gets the status of a FAN channel.
  90. //!
  91. //! \param ulBase is the base address of the FAN module.
  92. //! \param ulChannel is the FAN channel to query for status.
  93. //!
  94. //! This function queries and returns the status of the specified channel.
  95. //! The returned value is one of:
  96. //!
  97. //! - \b FAN_STATUS_STALLED if the cooling fan is stalled
  98. //! - \b FAN_STATUS_CHANGING if the fan is changing to the commanded speed
  99. //! - \b FAN_STATUS_LOCKED if the fan is locked at the commanded speed
  100. //! - \b FAN_STATUS_NOATTAIN if the fan cannot achieve the commanded speed
  101. //!
  102. //! \return Returns the status of the specified FAN channel.
  103. //
  104. //*****************************************************************************
  105. unsigned long
  106. FanChannelStatus(unsigned long ulBase, unsigned long ulChannel)
  107. {
  108. //
  109. // Check the arguments.
  110. //
  111. ASSERT(ulBase == FAN0_BASE);
  112. ASSERT(ulChannel <= 5);
  113. //
  114. // Read and return the status for the specified fan channel
  115. //
  116. return((HWREG(ulBase + FAN_O_STS) >> (ulChannel * 2)) & FAN_STS_ST0_M);
  117. }
  118. //*****************************************************************************
  119. //
  120. //! Configures a FAN channel for manual operation.
  121. //!
  122. //! \param ulBase is the base address of the FAN module.
  123. //! \param ulChannel is the FAN channel to configure.
  124. //! \param ulConfig is the logical OR of manual configuration flags.
  125. //!
  126. //! This function configures a specific FAN channel to operate in manual
  127. //! mode. The \e ulConfig parameter is the logical OR of several choices of
  128. //! configuration flags as follows:
  129. //!
  130. //! One of the following to select the number of tachometer pulses used for
  131. //! speed averaging:
  132. //!
  133. //! - \b FAN_CONFIG_AVG_NONE to disable fan speed averaging
  134. //! - \b FAN_CONFIG_AVG_2 to select 2 pulses for speed averaging
  135. //! - \b FAN_CONFIG_AVG_4 to select 4 pulses for speed averaging
  136. //! - \b FAN_CONFIG_AVG_8 to select 8 pulses for speed averaging
  137. //!
  138. //! One of the following to select the tachometer pulses per revolution:
  139. //!
  140. //! - \b FAN_CONFIG_TACH_1 to select 1 pulse per revolution
  141. //! - \b FAN_CONFIG_TACH_2 to select 2 pulses per revolution
  142. //! - \b FAN_CONFIG_TACH_4 to select 4 pulses per revolution
  143. //! - \b FAN_CONFIG_TACH_8 to select 8 pulses per revolution
  144. //!
  145. //! \return None.
  146. //
  147. //*****************************************************************************
  148. void
  149. FanChannelConfigManual(unsigned long ulBase, unsigned long ulChannel,
  150. unsigned long ulConfig)
  151. {
  152. //
  153. // Check the arguments.
  154. //
  155. ASSERT(ulBase == FAN0_BASE);
  156. ASSERT(ulChannel <= 5);
  157. //
  158. // Program the fan channel for manual mode with parameters.
  159. //
  160. HWREG(ulBase + FAN_O_CH0 + (ulChannel * 0x10)) = FAN_CH0_MAN | ulConfig;
  161. }
  162. //*****************************************************************************
  163. //
  164. //! Configures a FAN channel for automatic operation.
  165. //!
  166. //! \param ulBase is the base address of the FAN module.
  167. //! \param ulChannel is the FAN channel to configure.
  168. //! \param ulConfig is the logical OR of configuration flags.
  169. //!
  170. //! This function configures a specific FAN channel to operate in automatic
  171. //! mode. The \e ulConfig parameter is the logical OR of several choices of
  172. //! configuration flags as follows:
  173. //!
  174. //! One of the following to select the automatic restart mode:
  175. //!
  176. //! - \b FAN_CONFIG_RESTART to enable automatic restart after stall
  177. //! - \b FAN_CONFIG_NORESTART to disable automatic restart after stall
  178. //!
  179. //! One of the following to select the acceleration rate when changing speed:
  180. //!
  181. //! - \b FAN_CONFIG_ACCEL_FAST to select fast acceleration
  182. //! - \b FAN_CONFIG_ACCEL_SLOW to select slow acceleration
  183. //!
  184. //! One of the following to select the number of tachometer pulses to use
  185. //! for the hysteresis count:
  186. //! \b FAN_CONFIG_HYST_1, \b FAN_CONFIG_HYST_2, \b FAN_CONFIG_HYST_4,
  187. //! \b FAN_CONFIG_HYST_8, \b FAN_CONFIG_HYST_16, \b FAN_CONFIG_HYST_32,
  188. //! \b FAN_CONFIG_HYST_64, or \b FAN_CONFIG_HYST_128
  189. //!
  190. //! One of the following to select the start period as the number of tachometer
  191. //! pulses. The start period is the amount of time that a starting PWM duty
  192. //! cycle is used after the FAN channel is commended to a certain speed:
  193. //! \b FAN_CONFIG_START_2, \b FAN_CONFIG_START_4, \b FAN_CONFIG_START_8,
  194. //! \b FAN_CONFIG_START_16, \b FAN_CONFIG_START_32, \b FAN_CONFIG_START_64,
  195. //! \b FAN_CONFIG_START_128, or \b FAN_CONFIG_START_256
  196. //!
  197. //! One of the following to specify the duty cycle that is used when the FAN
  198. //! channel is starting, during the starting period (above):
  199. //!
  200. //! - \b FAN_CONFIG_START_DUTY_OFF to disable the use of startup duty cycle
  201. //! - \b FAN_CONFIG_START_DUTY_50 to select 50% startup duty cycle
  202. //! - \b FAN_CONFIG_START_DUTY_75 to select 75% startup duty cycle
  203. //! - \b FAN_CONFIG_START_DUTY_100 to select 100% startup duty cycle
  204. //!
  205. //! One of the following to select the number of tachometer pulses used for
  206. //! speed averaging:
  207. //!
  208. //! - \b FAN_CONFIG_AVG_NONE to disable fan speed averaging
  209. //! - \b FAN_CONFIG_AVG_2 to select 2 pulses for speed averaging
  210. //! - \b FAN_CONFIG_AVG_4 to select 4 pulses for speed averaging
  211. //! - \b FAN_CONFIG_AVG_8 to select 8 pulses for speed averaging
  212. //!
  213. //! One of the following to select the tachometer pulses per revolution:
  214. //!
  215. //! - \b FAN_CONFIG_TACH_1 to select 1 pulse per revolution
  216. //! - \b FAN_CONFIG_TACH_2 to select 2 pulses per revolution
  217. //! - \b FAN_CONFIG_TACH_4 to select 4 pulses per revolution
  218. //! - \b FAN_CONFIG_TACH_8 to select 8 pulses per revolution
  219. //!
  220. //! \return None.
  221. //
  222. //*****************************************************************************
  223. void
  224. FanChannelConfigAuto(unsigned long ulBase, unsigned long ulChannel,
  225. unsigned long ulConfig)
  226. {
  227. //
  228. // Check the arguments.
  229. //
  230. ASSERT(ulBase == FAN0_BASE);
  231. ASSERT(ulChannel <= 5);
  232. //
  233. // Program the fan channel for automatic mode with parameters.
  234. //
  235. HWREG(ulBase + FAN_O_CH0 + (ulChannel * 0x10)) = ~FAN_CH0_MAN & ulConfig;
  236. }
  237. //*****************************************************************************
  238. //
  239. //! Sets the duty cycle of a FAN channel when in manual mode.
  240. //!
  241. //! \param ulBase is the base address of the FAN module.
  242. //! \param ulChannel is the FAN channel to program the duty cycle.
  243. //! \param ulDuty is the duty cycle in clocks from 0-511.
  244. //!
  245. //! This function sets the duty cycle of a FAN channel if the channel is
  246. //! configured for manual mode. The duty cycle is specified in clocks from
  247. //! 0-511 out of a 512 clock PWM period.
  248. //!
  249. //! \return None.
  250. //
  251. //*****************************************************************************
  252. void
  253. FanChannelDutySet(unsigned long ulBase, unsigned long ulChannel,
  254. unsigned long ulDuty)
  255. {
  256. //
  257. // Check the arguments.
  258. //
  259. ASSERT(ulBase == FAN0_BASE);
  260. ASSERT(ulChannel <= 5);
  261. ASSERT(ulDuty < 512);
  262. //
  263. // Program the specified duty cycle for the specified channel
  264. //
  265. HWREG(ulBase + FAN_O_CMD0 + (ulChannel * 0x10)) =
  266. (ulDuty << FAN_CMD0_DC_S) & FAN_CMD0_DC_M;
  267. }
  268. //*****************************************************************************
  269. //
  270. //! Reads the duty cycle of a FAN channel.
  271. //!
  272. //! \param ulBase is the base address of the FAN module.
  273. //! \param ulChannel is the FAN channel to query for duty cycle.
  274. //!
  275. //! This function gets the duty cycle of a FAN channel. If the channel is in
  276. //! manual mode, then this is the value that was programmed. If the FAN
  277. //! channel is configured for automatic mode, then this is the value that is
  278. //! calculated by the Fan Control peripheral.
  279. //!
  280. //! \return Returns the FAN channel duty cycle as a number of clocks from
  281. //! 0-511, out of a 512 clock PWM period.
  282. //
  283. //*****************************************************************************
  284. unsigned long
  285. FanChannelDutyGet(unsigned long ulBase, unsigned long ulChannel)
  286. {
  287. unsigned long ulDuty;
  288. //
  289. // Check the arguments.
  290. //
  291. ASSERT(ulBase == FAN0_BASE);
  292. ASSERT(ulChannel <= 5);
  293. //
  294. // Read the duty cycle field from the command register and shift to
  295. // lower bits for return value.
  296. //
  297. ulDuty = HWREG(ulBase + FAN_O_CMD0 + (ulChannel * 0x10)) & FAN_CMD0_DC_M;
  298. ulDuty >>= FAN_CMD0_DC_S;
  299. //
  300. // Return the duty cycle for the specified channel.
  301. //
  302. return(ulDuty);
  303. }
  304. //*****************************************************************************
  305. //
  306. //! Sets the RPM of a FAN channel when in automatic mode.
  307. //!
  308. //! \param ulBase is the base address of the FAN module.
  309. //! \param ulChannel is the FAN channel to program the RPM.
  310. //! \param ulRPM is the RPM as a value from 0-8191.
  311. //!
  312. //! This function sets the RPM of the fan channel if the fan channel is
  313. //! configured for automatic mode. If configured for manual mode, then this
  314. //! function has no effect.
  315. //!
  316. //! \return None.
  317. //
  318. //*****************************************************************************
  319. void
  320. FanChannelRPMSet(unsigned long ulBase, unsigned long ulChannel,
  321. unsigned long ulRPM)
  322. {
  323. //
  324. // Check the arguments.
  325. //
  326. ASSERT(ulBase == FAN0_BASE);
  327. ASSERT(ulChannel <= 5);
  328. ASSERT(ulRPM < 8192);
  329. //
  330. // Program the specified RPM for the specified channel
  331. //
  332. HWREG(ulBase + FAN_O_CMD0 + (ulChannel * 0x10)) = ulRPM;
  333. }
  334. //*****************************************************************************
  335. //
  336. //! Reads the RPM of a FAN channel.
  337. //!
  338. //! \param ulBase is the base address of the FAN module.
  339. //! \param ulChannel is the FAN channel to query for RPM.
  340. //!
  341. //! This function gets the RPM of a FAN channel.
  342. //!
  343. //! \return Returns the FAN channel RPM as a number from 0-4095.
  344. //
  345. //*****************************************************************************
  346. unsigned long
  347. FanChannelRPMGet(unsigned long ulBase, unsigned long ulChannel)
  348. {
  349. //
  350. // Check the arguments.
  351. //
  352. ASSERT(ulBase == FAN0_BASE);
  353. ASSERT(ulChannel <= 5);
  354. //
  355. // Read and return the RPM for the specified channel.
  356. //
  357. return(HWREG(ulBase + FAN_O_CST0 + (ulChannel * 0x10)) & FAN_CST0_RPM_M);
  358. }
  359. //*****************************************************************************
  360. //
  361. //! Enables FAN module interrupts.
  362. //!
  363. //! \param ulBase is the base address of the FAN module.
  364. //! \param ulFlags is the logical OR of all the interrupts to be enabled.
  365. //!
  366. //! This function enables one or more interrupts from the FAN module. The
  367. //! \e ulFlags parameter is the logical OR of all the possible interrupts that
  368. //! can be enabled. For each channel, the following interrupt flags are
  369. //! available:
  370. //!
  371. //! - \b FAN_CHn_INT_STALL means that a stall was detected (in either mode).
  372. //! - \b FAN_CHn_INT_AUTO_SPEED_ERROR means that in automatic mode, the cooling
  373. //! fan cannot attain the commanded speed.
  374. //! - \b FAN_CHn_INT_AUTO_SPEED_OK means that in automatic mode, the cooling
  375. //! fan has attained the commanded speed.
  376. //!
  377. //! In the above flag names, the \b CHn placeholder should be replaced with
  378. //! the actual channel number, 0-5 (for example, CH1).
  379. //!
  380. //! The interrupt flags have a different meaning if the FAN channel is
  381. //! configured for manual mode. The following alternate set of flag names is
  382. //! available for convenience to use in manual mode:
  383. //!
  384. //! - \b FAN_CHn_INT_MANUAL_SPEED_UPDATE means that in manual mode, the speed
  385. //! was calculated.
  386. //! - \b FAN_CHn_INT_MANUAL_SPEED_CHANGE means that in manual mode, the speed
  387. //! changed.
  388. //!
  389. //! Note that even though the names are different for manual mode, the values
  390. //! are the same. For example \b _AUTO_SPEED_ERROR is the same value as
  391. //! \b _MANUAL_SPEED_UPDATE. The different names are provided just to make it
  392. //! easier to associate a meaning with each interrupt flag.
  393. //!
  394. //! \return None.
  395. //
  396. //*****************************************************************************
  397. void
  398. FanIntEnable(unsigned long ulBase, unsigned long ulFlags)
  399. {
  400. //
  401. // Check the arguments.
  402. //
  403. ASSERT(ulBase == FAN0_BASE);
  404. //
  405. // Enable the requested interrupt sources.
  406. //
  407. HWREG(ulBase + FAN_O_IM) |= ulFlags;
  408. }
  409. //*****************************************************************************
  410. //
  411. //! Disables FAN module interrupts.
  412. //!
  413. //! \param ulBase is the base address of the FAN module.
  414. //! \param ulFlags is the logical OR of all the interrupts to be disabled.
  415. //!
  416. //! This function disables one or more interrupts from the FAN module. The
  417. //! \e ulFlags parameter is the logical OR of all the possible interrupts that
  418. //! can be enabled. For a list of possible interrupt flags, refer to the
  419. //! documentation for the function FanIntEnable().
  420. //!
  421. //! \return None.
  422. //
  423. //*****************************************************************************
  424. void
  425. FanIntDisable(unsigned long ulBase, unsigned long ulFlags)
  426. {
  427. //
  428. // Check the arguments.
  429. //
  430. ASSERT(ulBase == FAN0_BASE);
  431. //
  432. // Disable the requested interrupt sources.
  433. //
  434. HWREG(ulBase + FAN_O_IM) &= ~ulFlags;
  435. }
  436. //*****************************************************************************
  437. //
  438. //! Gets the FAN module interrupt status.
  439. //!
  440. //! \param ulBase is the base address of the FAN module.
  441. //! \param bMasked is set \b true to get the masked interrupt status, or
  442. //! \b false to get the raw interrupt status.
  443. //!
  444. //! This function returns the interrupt status of the FAN module. It can
  445. //! return either the raw or masked interrupt status.
  446. //!
  447. //! \return Returns the masked or raw FAN interrupt status, as a bit field
  448. //! of multiple FAN interrupt flags. For a list of all the possible interrupt
  449. //! flags, refer to the documentation for the function FanIntEnable().
  450. //
  451. //*****************************************************************************
  452. unsigned long
  453. FanIntStatus(unsigned long ulBase, tBoolean bMasked)
  454. {
  455. //
  456. // Check the arguments.
  457. //
  458. ASSERT(ulBase == FAN0_BASE);
  459. //
  460. // Return either the interrupt status or the raw interrupt status as
  461. // requested.
  462. //
  463. if(bMasked)
  464. {
  465. return(HWREG(ulBase + FAN_O_MIS));
  466. }
  467. else
  468. {
  469. return(HWREG(ulBase + FAN_O_RIS));
  470. }
  471. }
  472. //*****************************************************************************
  473. //
  474. //! Clears pending FAN module interrupts.
  475. //!
  476. //! \param ulBase is the base address of the FAN module.
  477. //! \param ulFlags is the logical OR of all the interrupts to be cleared.
  478. //!
  479. //! This function clears one or more interrupts from the FAN module. The
  480. //! \e ulFlags parameter is the logical OR of all the possible interrupts that
  481. //! can be cleared. For a list of possible interrupt flags, refer to the
  482. //! documentation for the function FanIntEnable().
  483. //!
  484. //! \return None.
  485. //
  486. //*****************************************************************************
  487. void
  488. FanIntClear(unsigned long ulBase, unsigned long ulFlags)
  489. {
  490. //
  491. // Check the arguments.
  492. //
  493. ASSERT(ulBase == FAN0_BASE);
  494. //
  495. // Clear the requested pending interrupts
  496. //
  497. HWREG(ulBase + FAN_O_IC) = ulFlags;
  498. }
  499. //*****************************************************************************
  500. //
  501. //! Registers an interrupt handler for the FAN module.
  502. //!
  503. //! \param ulBase is the base address of the FAN module.
  504. //! \param pfnHandler is a pointer to the function to be called when the
  505. //! interrupt is activated.
  506. //!
  507. //! This function sets and enables the handler to be called when the FAN module
  508. //! generates an interrupt. Specific FAN interrupts must still be enabled
  509. //! with the FanIntEnable() function.
  510. //!
  511. //! \sa IntRegister() for important information about registering interrupt
  512. //! handlers.
  513. //!
  514. //! \return None.
  515. //
  516. //*****************************************************************************
  517. void
  518. FanIntRegister(unsigned long ulBase, void (*pfnHandler)(void))
  519. {
  520. //
  521. // Check the arguments.
  522. //
  523. ASSERT(ulBase == FAN0_BASE);
  524. ASSERT(pfnHandler);
  525. //
  526. // Register the interrupt handler.
  527. //
  528. IntRegister(INT_FAN0, pfnHandler);
  529. //
  530. // Enable the FAN peripheral interrupt.
  531. //
  532. IntEnable(INT_FAN0);
  533. }
  534. //*****************************************************************************
  535. //
  536. //! Unregisters an interrupt handler for the FAN module.
  537. //!
  538. //! \param ulBase is the base address of the FAN module.
  539. //!
  540. //! This function disables and clears the handler to be called when the
  541. //! FAN module interrupt occurs.
  542. //!
  543. //! \sa IntRegister() for important information about registering interrupt
  544. //! handlers.
  545. //!
  546. //! \return None.
  547. //
  548. //*****************************************************************************
  549. void
  550. FanIntUnregister(unsigned long ulBase)
  551. {
  552. //
  553. // Check the arguments.
  554. //
  555. ASSERT(ulBase == FAN0_BASE);
  556. //
  557. // Disable the FAN peripheral interrupt.
  558. //
  559. IntDisable(INT_FAN0);
  560. //
  561. // Unregister the interrupt handler.
  562. //
  563. IntUnregister(INT_FAN0);
  564. }
  565. //*****************************************************************************
  566. //
  567. //! Gets the number of supported FAN channels.
  568. //!
  569. //! \param ulBase is the base address of the FAN module.
  570. //!
  571. //! This function gets the number of FAN channels that are supported by the
  572. //! Fan Control peripheral.
  573. //!
  574. //! \return Returns the number of FAN channels.
  575. //
  576. //*****************************************************************************
  577. unsigned long
  578. FanChannelsGet(unsigned long ulBase)
  579. {
  580. //
  581. // Check the arguments.
  582. //
  583. ASSERT(ulBase == FAN0_BASE);
  584. //
  585. // Read and return the fan channel count
  586. //
  587. return(HWREG(ulBase + FAN_O_PP) & FAN_PP_CHAN_M);
  588. }
  589. //*****************************************************************************
  590. //
  591. // Close the Doxygen group.
  592. //! @}
  593. //
  594. //*****************************************************************************