VSF Documented
systick.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __SYS_TICK_H__
19#define __SYS_TICK_H__
20
21/*============================ INCLUDES ======================================*/
22#include "hal/vsf_hal_cfg.h"
23#include "./systick_internal.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28/*============================ MACROS ========================================*/
29/*============================ MACROFIED FUNCTIONS ===========================*/
30
42#define vsf_systick_cfg(...) \
43 do { \
44 systick_cfg_t cfg = {__VA_ARGS__}; \
45 vsf_systick_init(&cfg); \
46 } while(false)
47
48/*============================ TYPES =========================================*/
49
50/* defined in systick_internal.h
53typedef enum {
55 DISABLE_SYSTICK = 0x00,
57 ENABLE_SYSTICK = 0x01,
58
60 DISABLE_SYSTICK_INTERRUPT = 0x00,
62 ENABLE_SYSTICK_INTERRUPT = 0x02,
63
65 SYSTICK_SOURCE_REFERCLK = 0x00,
67 SYSTICK_SOURCE_SYSCLK = 0x04,
68} em_systick_cfg_mode_t;
70
73typedef struct {
74 uint8_t mode; //!< config ward
75 uint32_t reload_value; //!< Match value
76}systick_cfg_t;
78*/
79
80declare_interface(systick_t)
81
82
84def_interface(systick_t)
85 bool (*Init)(systick_cfg_t *);
86 void (*Enable)(void);
87 bool (*Disable)(void);
88 bool (*IsMatch)(void);
89 u32_property_t Counter;
90 void (*Reset)(void);
92end_def_interface(systick_t)
94/*============================ GLOBAL VARIABLES ==============================*/
96extern const systick_t SYSTICK;
97/*============================ LOCAL VARIABLES ===============================*/
98/*============================ PROTOTYPES ====================================*/
99
100#ifdef __cplusplus
101}
102#endif
103
104#endif /* end of __SYS_TICK_H__ */
def_interface(i_adc_t) i_peripheral_t
vsf_err_t(* Init)(vsf_adc_cfg_t *pCfg)
Definition adc_interface.h:38
bool
Definition type.h:60
end_def_interface(i_pm_wakeup_t) struct vsf_pm_pclk_cfg_t
Definition device.h:249
Definition systick_internal.h:56
Definition i_io_systick.h:213
void(* Enable)(void)
enable
Definition systick.h:86
void(* Reset)(void)
reset the counter
Definition systick.h:90
bool(* IsMatch)(void)
check whether a overflow happened
Definition systick.h:88
systick_reg_t *const RegPage
register page
Definition systick.h:91
u32_property_t Counter
get or set the counter
Definition systick.h:89
bool(* Disable)(void)
disable
Definition systick.h:87
declare_interface(i_msg_tree_node_t) def_interface(i_msg_tree_node_t) vsf_msgt_handler_t msg_handler