os_tick.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /**************************************************************************//**
  2. * @file os_tick.h
  3. * @brief CMSIS OS Tick header file
  4. * @version V1.0.2
  5. * @date 19. March 2021
  6. ******************************************************************************/
  7. /*
  8. * Copyright (c) 2017-2021 ARM Limited. All rights reserved.
  9. *
  10. * SPDX-License-Identifier: Apache-2.0
  11. *
  12. * Licensed under the Apache License, Version 2.0 (the License); you may
  13. * not use this file except in compliance with the License.
  14. * You may obtain a copy of the License at
  15. *
  16. * www.apache.org/licenses/LICENSE-2.0
  17. *
  18. * Unless required by applicable law or agreed to in writing, software
  19. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  20. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  21. * See the License for the specific language governing permissions and
  22. * limitations under the License.
  23. */
  24. #ifndef OS_TICK_H
  25. #define OS_TICK_H
  26. #include <stdint.h>
  27. #ifdef __cplusplus
  28. extern "C"
  29. {
  30. #endif
  31. /// IRQ Handler.
  32. #ifndef IRQHANDLER_T
  33. #define IRQHANDLER_T
  34. typedef void (*IRQHandler_t) (void);
  35. #endif
  36. /// Setup OS Tick timer to generate periodic RTOS Kernel Ticks
  37. /// \param[in] freq tick frequency in Hz
  38. /// \param[in] handler tick IRQ handler
  39. /// \return 0 on success, -1 on error.
  40. int32_t OS_Tick_Setup (uint32_t freq, IRQHandler_t handler);
  41. /// Enable OS Tick timer interrupt
  42. void OS_Tick_Enable (void);
  43. /// Disable OS Tick timer interrupt
  44. void OS_Tick_Disable (void);
  45. /// Acknowledge execution of OS Tick timer interrupt
  46. void OS_Tick_AcknowledgeIRQ (void);
  47. /// Get OS Tick timer IRQ number
  48. /// \return OS Tick IRQ number
  49. int32_t OS_Tick_GetIRQn (void);
  50. /// Get OS Tick timer clock frequency
  51. /// \return OS Tick timer clock frequency in Hz
  52. uint32_t OS_Tick_GetClock (void);
  53. /// Get OS Tick timer interval reload value
  54. /// \return OS Tick timer interval reload value
  55. uint32_t OS_Tick_GetInterval (void);
  56. /// Get OS Tick timer counter value
  57. /// \return OS Tick timer counter value
  58. uint32_t OS_Tick_GetCount (void);
  59. /// Get OS Tick timer overflow status
  60. /// \return OS Tick overflow status (1 - overflow, 0 - no overflow).
  61. uint32_t OS_Tick_GetOverflow (void);
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif /* OS_TICK_H */