VSF Documented
__vsf_arch_interface.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 __VSF_ARCH_INTERFACE_H__
19#define __VSF_ARCH_INTERFACE_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "hal/vsf_hal_cfg.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/******************************************************************************
31 * IMPORTANT: This header file can only be included by source code files *
32 * within arch *
33 ******************************************************************************/
34
35/*============================ MACROS ========================================*/
36/*============================ MACROFIED FUNCTIONS ===========================*/
37/*============================ TYPES =========================================*/
38/*============================ GLOBAL VARIABLES ==============================*/
39/*============================ LOCAL VARIABLES ===============================*/
40/*============================ PROTOTYPES ====================================*/
41
42/*----------------------------------------------------------------------------*
43 * APIs or Interfaces each Arch must use or implement *
44 *----------------------------------------------------------------------------*/
45
51extern bool vsf_arch_low_level_init(void);
52
53
54#if VSF_SYSTIMER_CFG_IMPL_MODE != VSF_SYSTIMER_IMPL_NONE
55
56extern void vsf_systimer_prio_set(vsf_arch_prio_t priority);
57
59# if VSF_SYSTIMER_CFG_IMPL_MODE == VSF_SYSTIMER_IMPL_TICK_MODE
61# endif
62
63/*----------------------------------------------------------------------------*
64 * System Timer : Implement with Normal Timer (Count down or Count up) *
65 *----------------------------------------------------------------------------*/
66# if (VSF_SYSTIMER_CFG_IMPL_MODE == VSF_SYSTIMER_IMPL_WITH_NORMAL_TIMER) \
67 || (VSF_SYSTIMER_CFG_IMPL_MODE == VSF_SYSTIMER_IMPL_TICK_MODE)
68
69/*-------------------------------------------*
70 * APIs to be implemented by target arch *
71 *-------------------------------------------*/
72
76
89extern bool vsf_systimer_low_level_disable(void);
90
93extern void vsf_systimer_low_level_enable(void);
95extern void vsf_systimer_low_level_int_enable(void);
97extern void vsf_systimer_reset_counter_value(void);
100
101/*-------------------------------------------*
102 * APIs to be used by target arch *
103 *-------------------------------------------*/
111extern void vsf_systimer_ovf_evt_handler(void);
112
113/*----------------------------------------------------------------------------*
114 * System Timer : Implement with timer with compare match, trigger when *
115 * current_value >= compare_value *
116 *----------------------------------------------------------------------------*/
117# elif VSF_SYSTIMER_CFG_IMPL_MODE == VSF_SYSTIMER_IMPL_WITH_COMP_TIMER
118
119/*-------------------------------------------*
120 * APIs to be implemented by target arch *
121 *-------------------------------------------*/
122
126
129extern void vsf_systimer_low_level_enable(void);
130
134
139
140/*-------------------------------------------*
141 * APIs to be used by target arch *
142 *-------------------------------------------*/
146extern void vsf_systimer_match_evthandler(void);
147
148/*----------------------------------------------------------------------------*
149 * System Timer : Implement with request / response model *
150 *----------------------------------------------------------------------------*/
151# elif VSF_SYSTIMER_CFG_IMPL_MODE == VSF_SYSTIMER_IMPL_REQUEST_RESPONSE
152
153/*-------------------------------------------*
154 * APIs to be implemented by target arch *
155 *-------------------------------------------*/
156extern vsf_err_t vsf_systimer_init(void);
158
159extern vsf_err_t vsf_systimer_start(void);
160extern void vsf_systimer_set_idle(void);
161
164
169
170/*-------------------------------------------*
171 * APIs to be used by target arch *
172 *-------------------------------------------*/
176extern void vsf_systimer_timeout_evt_handler(vsf_systimer_tick_t tick);
177
178# endif
179#endif // VSF_SYSTIMER_CFG_IMPL_MODE
180
181
182#ifdef __cplusplus
183}
184#endif
185
186#endif
187/* EOF */
vsf_err_t
Definition __type.h:42
bool vsf_arch_low_level_init(void)
Definition arm9_generic.c:65
vsf_err_t vsf_systimer_low_level_init(void)
initialise systimer (current value set to 0) without enable it
Definition driver.c:59
vsf_systimer_tick_t vsf_systimer_low_level_get_current(void)
get current value of timer
Definition driver.c:74
void vsf_systimer_low_level_set_match(vsf_systimer_tick_t match)
set match value, will be triggered when current >= match, vsf_systimer_match_evthandler will be calle...
Definition driver.c:82
void vsf_systimer_set_reload_value(vsf_systimer_tick_t tick_cnt)
Definition cortex_a_generic.c:92
void vsf_systimer_clear_int_pending_bit(void)
Definition cortex_a_generic.c:55
void vsf_systimer_low_level_int_disable(void)
Definition cortex_a_generic.c:82
void vsf_systimer_low_level_int_enable(void)
Definition cortex_a_generic.c:87
vsf_systimer_tick_t vsf_systimer_get_tick_elapsed(void)
Definition cortex_a_generic.c:50
bool vsf_systimer_low_level_disable(void)
disable systimer and return over-flow flag status !
Definition cortex_a_generic.c:70
void vsf_systimer_reset_counter_value(void)
Definition cortex_a_generic.c:60
void vsf_systimer_low_level_enable(void)
only enable systimer without clearing any flags
Definition cortex_a_generic.c:77
vsf_arch_prio_t
Definition cortex_a_generic.h:88
uint64_t vsf_systimer_tick_t
Definition cortex_a_generic.h:73
void vsf_systimer_prio_set(vsf_arch_prio_t priority)
Definition cortex_m_generic.c:185
vsf_systimer_tick_t vsf_systimer_get(void)
Definition linux_generic.c:402
void vsf_systimer_set_idle(void)
Definition linux_generic.c:398
vsf_systimer_tick_t vsf_systimer_tick_to_us(vsf_systimer_tick_t tick)
Definition linux_generic.c:445
vsf_err_t vsf_systimer_init(void)
initialise SysTick to generate a system timer !
Definition linux_generic.c:365
bool vsf_systimer_is_due(vsf_systimer_tick_t due)
Definition linux_generic.c:430
vsf_systimer_tick_t vsf_systimer_ms_to_tick(uint_fast32_t time_ms)
Definition linux_generic.c:440
vsf_systimer_tick_t vsf_systimer_us_to_tick(uint_fast32_t time_us)
Definition linux_generic.c:435
vsf_systimer_tick_t vsf_systimer_tick_to_ms(vsf_systimer_tick_t tick)
Definition linux_generic.c:450
vsf_err_t vsf_systimer_start(void)
Definition linux_generic.c:390
bool vsf_systimer_set(vsf_systimer_tick_t due)
Definition linux_generic.c:409
vsf_systimer_ovf_evt_handler()
unsigned int uint_fast32_t
Definition stdint.h:27
unsigned long long uintmax_t
Definition stdint.h:32
uint_fast32_t vsf_arch_req___systimer_resolution___from_usr(void)
Definition vsf_kernel_bsp.c:199
uint32_t vsf_arch_req___systimer_freq___from_usr(void)
Definition vsf_kernel_bsp.c:189