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#if (USE_RTOS == 1U)
35# error "USE_RTOS should be 0 in the current HAL release"
36#else
37# define __HAL_LOCK(__HANDLE__) \
38 do { \
39 if ((__HANDLE__)->Lock == HAL_LOCKED) { \
40 return HAL_BUSY; \
41 } else { \
42 (__HANDLE__)->Lock = HAL_LOCKED; \
43 } \
44 } while (0U)
45
46# define __HAL_UNLOCK(__HANDLE__) \
47 do { \
48 (__HANDLE__)->Lock = HAL_UNLOCKED; \
49 } while (0U)
50#endif
51
52#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
53# ifndef VSF_STHAL_ASSERT
54# define VSF_STHAL_ASSERT(__CON) VSF_ASSERT(__CON)
55# endif
56#else
57# ifndef VSF_STHAL_ASSERT
58# define VSF_STHAL_ASSERT(...) VSF_ASSERT(__VA_ARGS__)
59# endif
60#endif
61
62/*============================ MACROFIED FUNCTIONS ===========================*/
63/*============================ TYPES =========================================*/
64
65typedef enum {
66 HAL_OK = 0x00U,
67 HAL_ERROR = 0x01U,
68 HAL_BUSY = 0x02U,
69 HAL_TIMEOUT = 0x03U,
71
72typedef enum {
73 HAL_UNLOCKED = 0x00U,
74 HAL_LOCKED = 0x01U,
76
77/*============================ GLOBAL VARIABLES ==============================*/
78/*============================ PROTOTYPES ====================================*/
79
80#ifdef __cplusplus
81}
82#endif
83
84#endif
HAL_StatusTypeDef
Definition sthal_def.h:65
@ HAL_TIMEOUT
Definition sthal_def.h:69
@ HAL_ERROR
Definition sthal_def.h:67
@ HAL_OK
Definition sthal_def.h:66
@ HAL_BUSY
Definition sthal_def.h:68
HAL_LockTypeDef
Definition sthal_def.h:72
@ HAL_LOCKED
Definition sthal_def.h:74
@ HAL_UNLOCKED
Definition sthal_def.h:73