VSF Documented
device.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#include "hal/vsf_hal_cfg.h"
21
22/*============================ MACROS ========================================*/
23
24/*\note first define basic info for arch. */
25#if defined(__VSF_HEADER_ONLY_SHOW_ARCH_INFO__)
26
28# define VSF_ARCH_PRI_NUM 8
29# define VSF_ARCH_PRI_BIT 3
30
31// software interrupt provided by a dedicated device
32# define VSF_DEV_SWI_NUM 7
33
34#else
35
36#ifndef __HAL_DEVICE_ARM_CMSDK_CM7_H__
37#define __HAL_DEVICE_ARM_CMSDK_CM7_H__
38
39#define VSF_DEV_SWI_LIST 24,25,26,27,28,29,30
40
41/*============================ INCLUDES ======================================*/
42
43/*
44#if defined(CMSDK_CM7)
45# include "CMSDK_CM7.h"
46#elif defined(CMSDK_CM7_SP)
47# include "CMSDK_CM7_SP.h"
48#elif defined(CMSDK_CM7_DP)
49# include "CMSDK_CM7_DP.h"
50#endif
51*/
52
53/*\note this is should be the only place where __common.h is included.*/
54#include "../common/__common.h"
55
56/*============================ MACROS ========================================*/
57
58#define __def_idx(__name, __no) VSF_MCONNECT2(__name, _idx) = (__no)
59#define __def_msk(__name) VSF_MCONNECT2(__name, _msk) = BIT(VSF_MCONNECT2(__name, _idx) & 0x1F)
60
61#define GPIO_COUNT 1
62
63#define PIO_PORTA
64#define PIO_PORTA_PIN_NUM 7
65/*
66#define PIO_PORTB
67#define PIO_PORTB_PIN_NUM 16
68
69#define PIO_PORTC
70#define PIO_PORTC_PIN_NUM 16
71
72#define PIO_PORTD
73#define PIO_PORTD_PIN_NUM 16
74
75
76#define PIO_PORTE
77#define PIO_PORTF
78#define PIO_PORTG
79#define PIO_PORTH
80*/
81
82/*============================ MACROFIED FUNCTIONS ===========================*/
83
84// bit0 - bit13: clksrc bitfield
85// bit14- bit27: clkdiv bitfield
86// bit28- bit31: clkdiv_remap
87#define __def_periph_clk(__name, __bf_clksel, __bf_clkdiv, __clksel_map_idx) \
88 VSF_MCONNECT2(__name, _idx) = ((__bf_clksel) << 0) \
89 | ((__bf_clkdiv) << 14) \
90 | ((__clksel_map_idx) << 28)
91
92#define __def_sync_clk_idx(__name, __bus_idx, __bit_idx) \
93 VSF_MCONNECT2(__name, _idx) = ((__bit_idx) << 0) | ((__bus_idx) << 5)
94
95#define __def_clk_src(__name, __value) __name = (__value)
96
97/*============================ TYPES =========================================*/
98
99#if 0
103 __def_idx(POWER_DUMMY, 0),
104};
106
110 __def_msk(POWER_DUMMY),
111} ;
113
117 VSF_PM_WAIT = 0,
121} ;
123
125 ...,
126};
128
130 ...
131};
133
136enum pm_periph_async_clk_no_t{
137 ...
138};
140
143enum pm_sync_clk_no_t {
144 // NAME BUS_IDX,BIT_IDX
145 // AHB
146 __def_sync_clk_idx( SCLK_UART0, 1, 16 ),
147 __def_sync_clk_idx( SCLK_UART1, 1, 17 ),
148 __def_sync_clk_idx( SCLK_UART2, 1, 18 ),
149 __def_sync_clk_idx( SCLK_UART3, 1, 19 ),
150};
151
152enum pm_sync_clk_msk_t {
153 __def_msk(SCLK_UART0),
154 __def_msk(SCLK_UART1),
155 __def_msk(SCLK_UART2),
156 __def_msk(SCLK_UART3),
157};
159
162 ...
163};
165
166enum vsf_pm_pll_sel_t {
167 PLL0_idx,
168};
169
170struct io_wakeup_cfg_t {
172};
173typedef struct io_wakeup_cfg_t io_wakeup_cfg_t;
174
177
178declare_interface( i_pm_wakeup_t )
179def_interface( i_pm_wakeup_t )
180 struct {
183 }UseIO;
184end_def_interface( i_pm_wakeup_t )
185
186struct pm_periph_asyn_clk_cfg_t {
187 vsf_pm_clk_src_sel_t clk_src;
189};
190
193struct pm_main_clk_cfg_t {
194 vsf_pm_clk_src_sel_t clk_src;
195 uint32_t freq;
196 uint16_t core_div[1];
197 uint16_t ahb_div[1];
198 uint16_t apb_div[2];
199};
201#endif
202
203/*============================ GLOBAL VARIABLES ==============================*/
204/*============================ LOCAL VARIABLES ===============================*/
205/*============================ PROTOTYPES ====================================*/
206
207#endif // __HAL_DEVICE_ARM_CMSDK_CM7_H__
208#endif // __VSF_HEADER_ONLY_SHOW_ARCH_INFO__
209/* EOF */
vsf_err_t
Definition __type.h:42
def_interface(i_adc_t) i_peripheral_t
pm_periph_clksrc_t
Definition pm.h:93
pm_periph_clksel_t
Definition pm.h:114
vsf_io_port_no_t
Definition io.h:90
#define __def_idx(__name, __no)
Definition device.h:51
#define __def_sync_clk_idx(__name, __bus_idx, __bit_idx)
Definition device.h:85
#define __def_msk(__name)
Definition device.h:52
end_def_interface(i_pm_wakeup_t) struct vsf_pm_pclk_cfg_t
Definition device.h:249
UseIO
Definition device.h:248
unsigned short uint16_t
Definition stdint.h:7
unsigned char uint_fast8_t
Definition stdint.h:23
unsigned uint32_t
Definition stdint.h:9
unsigned int uint_fast32_t
Definition stdint.h:27
div_t div(int numer, int denom)
Definition pm.h:549
uint32_t dummy
Definition pm.h:550
void(* Enable)(void)
enable
Definition systick.h:86
bool(* Disable)(void)
disable
Definition systick.h:87
uint32_t size
Definition vsf_memfs.h:50
declare_interface(i_msg_tree_node_t) def_interface(i_msg_tree_node_t) vsf_msgt_handler_t msg_handler
vsf_pm_pll_sel_t
Definition vsf_template_pm.h:374
vsf_pm_power_cfg_msk_t
Definition vsf_template_pm.h:210
vsf_pm_power_cfg_no_t
Definition vsf_template_pm.h:204
vsf_pm_sleep_mode_t
Definition vsf_template_pm.h:222
@ VSF_PM_POWER_OFF
Definition vsf_template_pm.h:226
@ VSF_PM_DEEP_SLEEP
Definition vsf_template_pm.h:225
@ VSF_PM_WAIT
Definition vsf_template_pm.h:223
@ VSF_PM_SLEEP
Definition vsf_template_pm.h:224
vsf_pm_clk_src_sel_t
Definition vsf_template_pm.h:266