VSF Documented
vsf_hal.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/*============================ INCLUDES ======================================*/
19
20#ifdef __VSF_HEADER_ONLY_SHOW_ARCH_INFO__
21
22# include "./driver/driver.h"
23# undef __VSF_HEADER_ONLY_SHOW_ARCH_INFO__
24
25#else
26
27# ifndef __VSF_HAL_H__
28# define __VSF_HAL_H__
29
30# include "hal/vsf_hal_cfg.h"
31# include "./arch/vsf_arch.h"
32# include "./driver/driver.h"
33// DO NOT INCLUDE COMMON.h, so that use can use their own hal API standard
34//# include "./driver/common/common.h"
35
39
40# if VSF_HAL_USE_I2C == ENABLED
42# endif
43
44# ifdef __cplusplus
45extern "C" {
46# endif
47
48/*============================ MACROS ========================================*/
49/*============================ MACROFIED FUNCTIONS ===========================*/
50
51#define VSF_HAL_IRQ(__IRQHANDLER, ...) \
52 void __IRQHANDLER(void) \
53 { \
54 uintptr_t ctx = vsf_hal_irq_enter(); \
55 do { \
56 __VA_ARGS__ \
57 } while (0); \
58 vsf_hal_irq_leave(ctx); \
59 }
60
61/*============================ TYPES =========================================*/
62/*============================ GLOBAL VARIABLES ==============================*/
63/*============================ LOCAL VARIABLES ===============================*/
64/*============================ PROTOTYPES ====================================*/
65
71extern bool vsf_hal_init(void);
72
73extern uintptr_t vsf_hal_irq_enter(void);
74
75extern void vsf_hal_irq_leave(uintptr_t ctx);
76
82extern bool vsf_osa_hal_init(void);
83
84# ifdef __cplusplus
85}
86# endif
87
88#endif // __VSF_HAL_H__
89#endif // __VSF_HEADER_ONLY_SHOW_ARCH_INFO__
90/* EOF */
uint32_t uintptr_t
Definition stdint.h:38
bool vsf_osa_hal_init(void)
void vsf_hal_irq_leave(uintptr_t ctx)
Definition vsf_hal.c:70
uintptr_t vsf_hal_irq_enter(void)
Definition vsf_hal.c:59
bool vsf_hal_init(void)
Definition vsf_hal.c:84