VSF Documented
driver.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#if defined(__VSF_HEADER_ONLY_SHOW_ARCH_INFO__) || defined(__VSF_HAL_SHOW_VENDOR_INFO__)
19
20# include "__device.h"
21
22#else
23
24#ifndef __HAL_DRIVER_RASPBERRYPI_RP2040_H__
25#define __HAL_DRIVER_RASPBERRYPI_RP2040_H__
26
27/*============================ INCLUDES ======================================*/
28
29# include "hal/vsf_hal_cfg.h"
31# include "./device.h"
32
33// for enum clock_index
34# include "hardware/structs/clocks.h"
35
36# include "i2c/i2c.h"
37# include "uart/uart.h"
38
39/*============================ MACROFIED FUNCTIONS ===========================*/
40/*============================ TYPES =========================================*/
41/*============================ INCLUDES ======================================*/
42/*============================ TYPES =========================================*/
43/*============================ INCLUDES ======================================*/
44
45#if VSF_HAL_USE_IO == ENABLED
46//# define VSF_IO_CFG_REIMPLEMENT_TYPE_MODE ENABLED
47# include "hal/driver/common/template/vsf_template_io.h"
48
49# define VSF_IO_CFG_DEC_PREFIX vsf_hw
50# define VSF_IO_CFG_DEC_UPCASE_PREFIX VSF_HW
51# include "hal/driver/common/io/io_template.h"
52#endif
53
54#if VSF_HAL_USE_GPIO == ENABLED
55# define VSF_GPIO_USE_IO_MODE_TYPE ENABLED
57
58# define VSF_GPIO_CFG_DEC_PREFIX vsf_hw
59# define VSF_GPIO_CFG_DEC_UPCASE_PREFIX VSF_HW
61#endif
62
63#if VSF_HAL_USE_ADC == ENABLED
65
66# define VSF_ADC_CFG_DEC_PREFIX vsf_hw
67# define VSF_ADC_CFG_DEC_UPCASE_PREFIX VSF_HW
69#endif
70
71#if VSF_HAL_USE_FLASH == ENABLED
73
74# define VSF_FLASH_CFG_DEC_PREFIX vsf_hw
75# define VSF_FLASH_CFG_DEC_UPCASE_PREFIX VSF_HW
77#endif
78
79#if VSF_HAL_USE_I2C == ENABLED
81
82# define VSF_I2C_CFG_DEC_PREFIX vsf_hw
83# define VSF_I2C_CFG_DEC_UPCASE_PREFIX VSF_HW
85#endif
86
87#if VSF_HAL_USE_PWM == ENABLED
89
90# define VSF_PWM_CFG_DEC_PREFIX vsf_hw
91# define VSF_PWM_CFG_DEC_UPCASE_PREFIX VSF_HW
93#endif
94
95#if VSF_HAL_USE_RTC == ENABLED
97
98# define VSF_RTC_CFG_DEC_PREFIX vsf_hw
99# define VSF_RTC_CFG_DEC_UPCASE_PREFIX VSF_HW
101#endif
102
103#if VSF_HAL_USE_SPI == ENABLED
104//# define VSF_SPI_CFG_REIMPLEMENT_TYPE_MODE ENABLED
106
107# define VSF_SPI_CFG_DEC_PREFIX vsf_hw
108# define VSF_SPI_CFG_DEC_UPCASE_PREFIX VSF_HW
110#endif
111
112#if VSF_HAL_USE_TIMER == ENABLED
114
115# define VSF_TIMER_CFG_DEC_PREFIX vsf_hw
116# define VSF_TIMER_CFG_DEC_UPCASE_PREFIX VSF_HW
118
119# define VSF_TIMER_CFG_DEC_PREFIX vsf_hw_lp
120# define VSF_TIMER_CFG_DEC_UPCASE_PREFIX VSF_HW_LP
122#endif
123
124#if VSF_HAL_USE_RNG == ENABLED
126
127# define VSF_RNG_CFG_DEC_PREFIX vsf_hw
128# define VSF_RNG_CFG_DEC_UPCASE_PREFIX VSF_HW
130#endif
131
132#if VSF_HAL_USE_USART == ENABLED
134
135# define VSF_USART_CFG_DEC_PREFIX vsf_hw
136# define VSF_USART_CFG_DEC_UPCASE_PREFIX VSF_HW
138#endif
139
140#if VSF_HAL_USE_WDT == ENABLED
141//# define VSF_WDT_CFG_REIMPLEMENT_TYPE_MODE ENABLED
143
144# define VSF_WDT_CFG_DEC_PREFIX vsf_hw
145# define VSF_WDT_CFG_DEC_UPCASE_PREFIX VSF_HW
147#endif
148
149/*============================ MACROS ========================================*/
150/*============================ MACROFIED FUNCTIONS ===========================*/
151/*============================ TYPES =========================================*/
152/*============================ GLOBAL VARIABLES ==============================*/
153/*============================ LOCAL VARIABLES ===============================*/
154/*============================ PROTOTYPES ====================================*/
155
156extern bool clock_configure(enum clock_index clk_index, uint32_t src, uint32_t auxsrc, uint32_t src_freq, uint32_t freq);
157extern uint32_t clock_get_hz(enum clock_index clk_index);
158
159# endif // __HAL_DRIVER_RASPBERRYPI_RP2040_H__
160#endif // __VSF_HEADER_ONLY_SHOW_ARCH_INFO__
161/* EOF */
bool clock_configure(enum clock_index clk_index, uint32_t src, uint32_t auxsrc, uint32_t src_freq, uint32_t freq)
\tagclock_configure[]
Definition driver.c:260
uint32_t clock_get_hz(enum clock_index clk_index)
\endclock_configure[]
Definition driver.c:334
unsigned uint32_t
Definition stdint.h:9