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
25#ifndef OS_TICK_H
26#define OS_TICK_H
27
28#include <stdint.h>
29
30#ifdef  __cplusplus
31extern "C"
32{
33#endif
34
35/// IRQ Handler.
36#ifndef IRQHANDLER_T
37#define IRQHANDLER_T
38typedef void (*IRQHandler_t) (void);
39#endif
40
41/// Setup OS Tick timer to generate periodic RTOS Kernel Ticks
42/// \param[in]     freq         tick frequency in Hz
43/// \param[in]     handler      tick IRQ handler
44/// \return 0 on success, -1 on error.
45int32_t  OS_Tick_Setup (uint32_t freq, IRQHandler_t handler);
46
47/// Enable OS Tick timer interrupt
48void     OS_Tick_Enable (void);
49
50/// Disable OS Tick timer interrupt
51void     OS_Tick_Disable (void);
52
53/// Acknowledge execution of OS Tick timer interrupt
54void     OS_Tick_AcknowledgeIRQ (void);
55
56/// Get OS Tick timer IRQ number
57/// \return OS Tick IRQ number
58int32_t  OS_Tick_GetIRQn (void);
59
60/// Get OS Tick timer clock frequency
61/// \return OS Tick timer clock frequency in Hz
62uint32_t OS_Tick_GetClock (void);
63
64/// Get OS Tick timer interval reload value
65/// \return OS Tick timer interval reload value
66uint32_t OS_Tick_GetInterval (void);
67
68/// Get OS Tick timer counter value
69/// \return OS Tick timer counter value
70uint32_t OS_Tick_GetCount (void);
71
72/// Get OS Tick timer overflow status
73/// \return OS Tick overflow status (1 - overflow, 0 - no overflow).
74uint32_t OS_Tick_GetOverflow (void);
75
76#ifdef  __cplusplus
77}
78#endif
79
80#endif  /* OS_TICK_H */
81