VSF Documented
sthal_def.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2024 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 __ST_HAL_DEF
19#define __ST_HAL_DEF
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/*============================ INCLUDES ======================================*/
26
27#include <stddef.h>
28#include <stdint.h>
29
30/*============================ MACROS ========================================*/
31
32#define HAL_MAX_DELAY 0xFFFFFFFFU
33
34#define VSF_STHAL_LOCK(__HANDLE__) \
35 do { \
36 if ((__HANDLE__)->Lock == HAL_LOCKED) { \
37 return HAL_BUSY; \
38 } else { \
39 (__HANDLE__)->Lock = HAL_LOCKED; \
40 } \
41 } while (0U)
42
43#define VSF_STHAL_UNLOCK(__HANDLE__) \
44 do { \
45 (__HANDLE__)->Lock = HAL_UNLOCKED; \
46 } while (0U)
47
48#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
49# ifndef VSF_STHAL_ASSERT
50# define VSF_STHAL_ASSERT(__CON) VSF_ASSERT(__CON)
51# endif
52#else
53# ifndef VSF_STHAL_ASSERT
54# define VSF_STHAL_ASSERT(...) VSF_ASSERT(__VA_ARGS__)
55# endif
56#endif
57
58/*============================ MACROFIED FUNCTIONS ===========================*/
59/*============================ TYPES =========================================*/
60
61typedef enum {
62 HAL_OK = 0x00U,
63 HAL_ERROR = 0x01U,
64 HAL_BUSY = 0x02U,
65 HAL_TIMEOUT = 0x03U,
67
68typedef enum {
69 HAL_UNLOCKED = 0x00U,
70 HAL_LOCKED = 0x01U,
72
73/*============================ GLOBAL VARIABLES ==============================*/
74/*============================ PROTOTYPES ====================================*/
75
76#ifdef __cplusplus
77}
78#endif
79
80#endif
HAL_StatusTypeDef
Definition sthal_def.h:61
@ HAL_TIMEOUT
Definition sthal_def.h:65
@ HAL_ERROR
Definition sthal_def.h:63
@ HAL_OK
Definition sthal_def.h:62
@ HAL_BUSY
Definition sthal_def.h:64
HAL_LockTypeDef
Definition sthal_def.h:68
@ HAL_LOCKED
Definition sthal_def.h:70
@ HAL_UNLOCKED
Definition sthal_def.h:69
Generated from commit: vsfteam/vsf@2b286be