VSF Documented
SDL_timer.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_SDL2_TIMER_H__
19#define __VSF_SDL2_TIMER_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "../../vsf_sdl2_cfg.h"
24
25#if VSF_USE_SDL2 == ENABLED
26
27#include "SDL_stdinc.h"
28
29#include "kernel/vsf_kernel.h"
30
31#include "begin_code.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37/*============================ MACROS ========================================*/
38
39#if VSF_KERNEL_CFG_SUPPORT_CALLBACK_TIMER != ENABLED
40# error SDL_timer depends on VSF_KERNEL_CFG_SUPPORT_CALLBACK_TIMER
41#endif
42
43/*============================ MACROFIED FUNCTIONS ===========================*/
44
45#if VSF_SDL_CFG_WRAPPER == ENABLED
46#define SDL_AddTimer VSF_SDL_WRAPPER(SDL_AddTimer)
47#define SDL_RemoveTimer VSF_SDL_WRAPPER(SDL_RemoveTimer)
48#define SDL_GetTicks VSF_SDL_WRAPPER(SDL_GetTicks)
49#define SDL_GetTicks64 VSF_SDL_WRAPPER(SDL_GetTicks64)
50#define SDL_GetPerformanceCounter VSF_SDL_WRAPPER(SDL_GetPerformanceCounter)
51#define SDL_GetPerformanceFrequency VSF_SDL_WRAPPER(SDL_GetPerformanceFrequency)
52#define SDL_Delay VSF_SDL_WRAPPER(SDL_Delay)
53#endif
54
55#define SDL_TICKS_PASSED(__A, __B) ((int32_t)((__B) - (__A)) <= 0)
56
57/*============================ TYPES =========================================*/
58
60typedef uint32_t (*SDL_TimerCallback)(uint32_t interval, void *param);
61
62/*============================ GLOBAL VARIABLES ==============================*/
63/*============================ LOCAL VARIABLES ===============================*/
64/*============================ PROTOTYPES ====================================*/
65
66extern SDL_TimerID SDL_AddTimer(uint32_t interval, SDL_TimerCallback callback, void *param);
68extern uint32_t SDL_GetTicks(void);
69extern uint64_t SDL_GetTicks64(void);
72extern void SDL_Delay(uint32_t ms);
73
74#ifdef __cplusplus
75}
76#endif
77#include "close_code.h"
78
79#endif // VSF_USE_SDL2
80#endif // __VSF_SDL2_TIMER_H__
81/* EOF */
SDL_bool
Definition SDL_stdinc.h:96
uintptr_t SDL_TimerID
Definition SDL_timer.h:59
#define SDL_GetPerformanceFrequency
Definition SDL_timer.h:51
#define SDL_AddTimer
Definition SDL_timer.h:46
#define SDL_GetTicks
Definition SDL_timer.h:48
#define SDL_GetTicks64
Definition SDL_timer.h:49
#define SDL_RemoveTimer
Definition SDL_timer.h:47
#define SDL_GetPerformanceCounter
Definition SDL_timer.h:50
#define SDL_Delay
Definition SDL_timer.h:52
uint32_t(* SDL_TimerCallback)(uint32_t interval, void *param)
Definition SDL_timer.h:60
uint32_t uintptr_t
Definition stdint.h:38
unsigned uint32_t
Definition stdint.h:9
unsigned long long uint64_t
Definition stdint.h:11