VSF Documented
io.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 __HAL_DRIVER_BL61X_HW_IO_H__
19#define __HAL_DRIVER_BL61X_HW_IO_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "hal/vsf_hal_cfg.h"
24
25#if VSF_HAL_USE_IO == ENABLED
26
27#include "../../__device.h"
28#include "bflb_gpio.h"
29
30/*============================ MACROS ========================================*/
31
32#define VSF_IO_REIMPLEMENT_FEATURE ENABLED
33
34#define __BL61X_IO_IS_VAILID_PIN(__P) \
35 (((__P & VSF_HW_IO_PIN_MASK) != 0) && \
36 ((__P & ~VSF_HW_IO_PIN_MASK) == 0))
37
38#define __BL61X_IO_IS_VAILID_FEATURE(__F) \
39 ((__F & ~(uint32_t)__VSF_HW_IO_FEATURE_ALL_BITS) == 0)
40
41/*============================ MACROFIED FUNCTIONS ===========================*/
42/*============================ TYPES =========================================*/
43
44typedef enum vsf_io_mode_t {
45 VSF_IO_OPEN_DRAIN = GPIO_FLOAT,
48
49 VSF_IO_INPUT = GPIO_INPUT,
50 VSF_IO_OUTPUT = GPIO_OUTPUT,
51 VSF_IO_ANALOG = GPIO_ANALOG,
52 VSF_IO_ALERNATE = GPIO_ALTERNATE,
53
54 VSF_IO_FEATURE_ALL_BITS = GPIO_MODE_MASK | GPIO_PUPD_MASK
55 | GPIO_SMT_MASK | GPIO_DRV_MASK,
56
57 // for hw_io
60
61/*============================ PROTOTYPES ====================================*/
62/*============================ INCLUDES ======================================*/
63
64#define VSF_IO_CFG_DEC_PREFIX vsf_hw
65#define VSF_IO_CFG_DEC_UPCASE_PREFIX VSF_HW
66#include "hal/driver/common/io/io_template.h"
67
68#endif /* VSF_HAL_USE_IO */
69#endif /* __HAL_DRIVER_BL61X_HW_IO_H__ */
vsf_io_mode_t
Definition io.h:44
@ VSF_IO_OUTPUT
Definition io.h:50
@ VSF_IO_PULL_UP
Definition io.h:46
@ __VSF_HW_IO_FEATURE_ALL_BITS
Definition io.h:58
@ VSF_IO_PULL_DOWN
Definition io.h:47
@ VSF_IO_ALERNATE
Definition io.h:52
@ VSF_IO_OPEN_DRAIN
Definition io.h:45
@ VSF_IO_INPUT
Definition io.h:49
@ VSF_IO_ANALOG
Definition io.h:51
@ VSF_IO_FEATURE_ALL_BITS
Definition io.h:54
#define GPIO_PULLDOWN
Definition sthal_gpio.h:76
#define GPIO_PULLUP
Definition sthal_gpio.h:75