OSAL_Timers.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /**************************************************************************************************
  2. Filename: OSAL_Timers.h
  3. Revised: $Date: 2009-11-09 22:40:34 -0800 (Mon, 09 Nov 2009) $
  4. Revision: $Revision: 21112 $
  5. Description: This file contains the OSAL Timer definition and manipulation functions.
  6. Copyright 2004-2009 Texas Instruments Incorporated. All rights reserved.
  7. IMPORTANT: Your use of this Software is limited to those specific rights
  8. granted under the terms of a software license agreement between the user
  9. who downloaded the software, his/her employer (which must be your employer)
  10. and Texas Instruments Incorporated (the "License"). You may not use this
  11. Software unless you agree to abide by the terms of the License. The License
  12. limits your use, and you acknowledge, that the Software may not be modified,
  13. copied or distributed unless embedded on a Texas Instruments microcontroller
  14. or used solely and exclusively in conjunction with a Texas Instruments radio
  15. frequency transceiver, which is integrated into your product. Other than for
  16. the foregoing purpose, you may not use, reproduce, copy, prepare derivative
  17. works of, modify, distribute, perform, display or sell this Software and/or
  18. its documentation for any purpose.
  19. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  20. PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  21. INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  22. NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  23. TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
  24. NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  25. LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  26. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  27. OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  28. OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  29. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
  30. Should you have any questions regarding your right to use this Software,
  31. contact Texas Instruments Incorporated at www.TI.com.
  32. **************************************************************************************************/
  33. #ifndef OSAL_TIMERS_H
  34. #define OSAL_TIMERS_H
  35. #ifdef __cplusplus
  36. extern "C"
  37. {
  38. #endif
  39. /*********************************************************************
  40. * INCLUDES
  41. */
  42. /*********************************************************************
  43. * MACROS
  44. */
  45. /*********************************************************************
  46. * CONSTANTS
  47. */
  48. #define OSAL_TIMERS_MAX_TIMEOUT 0xFFFF
  49. /*********************************************************************
  50. * TYPEDEFS
  51. */
  52. /*********************************************************************
  53. * GLOBAL VARIABLES
  54. */
  55. /*********************************************************************
  56. * FUNCTIONS
  57. */
  58. /*
  59. * Initialization for the OSAL Timer System.
  60. */
  61. extern void osalTimerInit( void );
  62. /*
  63. * Set a Timer
  64. */
  65. extern uint8 osal_start_timerEx( uint8 task_id, uint16 event_id, uint16 timeout_value );
  66. /*
  67. * Set a timer that reloads itself.
  68. */
  69. extern uint8 osal_start_reload_timer( uint8 taskID, uint16 event_id, uint16 timeout_value );
  70. /*
  71. * Stop a Timer
  72. */
  73. extern uint8 osal_stop_timerEx( uint8 task_id, uint16 event_id );
  74. /*
  75. * Get the tick count of a Timer.
  76. */
  77. extern uint16 osal_get_timeoutEx( uint8 task_id, uint16 event_id );
  78. /*
  79. * Simulated Timer Interrupt Service Routine
  80. */
  81. extern void osal_timer_ISR( void );
  82. /*
  83. * Adjust timer tables
  84. */
  85. extern void osal_adjust_timers( void );
  86. /*
  87. * Update timer tables
  88. */
  89. extern void osalTimerUpdate( uint16 updateTime );
  90. /*
  91. * Count active timers
  92. */
  93. extern uint8 osal_timer_num_active( void );
  94. /*
  95. * Set the hardware timer interrupts for sleep mode.
  96. * These functions should only be called in OSAL_PwrMgr.c
  97. */
  98. extern void osal_sleep_timers( void );
  99. extern void osal_unsleep_timers( void );
  100. /*
  101. * Read the system clock - returns milliseconds
  102. */
  103. extern uint32 osal_GetSystemClock( void );
  104. /*
  105. * Get the next OSAL timer expiration.
  106. * This function should only be called in OSAL_PwrMgr.c
  107. */
  108. extern uint16 osal_next_timeout( void );
  109. /*********************************************************************
  110. *********************************************************************/
  111. #ifdef __cplusplus
  112. }
  113. #endif
  114. #endif /* OSAL_TIMERS_H */