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
32// software interrupt provided by a dedicated device
33# define VSF_DEV_SWI_NUM 7
34
35#else
36
37#ifndef __HAL_DEVICE_ARM_CMSDK_CM7_H__
38#define __HAL_DEVICE_ARM_CMSDK_CM7_H__
39
40#define VSF_DEV_SWI_LIST 24,25,26,27,28,29,30
41
42/*============================ INCLUDES ======================================*/
43
44/*
45#if defined(CMSDK_CM7)
46# include "CMSDK_CM7.h"
47#elif defined(CMSDK_CM7_SP)
48# include "CMSDK_CM7_SP.h"
49#elif defined(CMSDK_CM7_DP)
50# include "CMSDK_CM7_DP.h"
51#endif
52*/
53
54/*\note this is should be the only place where __common.h is included.*/
55#include "../common/__common.h"
56
57/*============================ MACROS ========================================*/
58
59#define __def_idx(__name, __no) VSF_MCONNECT2(__name, _idx) = (__no)
60#define __def_msk(__name) VSF_MCONNECT2(__name, _msk) = BIT(VSF_MCONNECT2(__name, _idx) & 0x1F)
61
62#define GPIO_COUNT 1
63
64#define PIO_PORTA
65#define PIO_PORTA_PIN_NUM 7
66/*
67#define PIO_PORTB
68#define PIO_PORTB_PIN_NUM 16
69
70#define PIO_PORTC
71#define PIO_PORTC_PIN_NUM 16
72
73#define PIO_PORTD
74#define PIO_PORTD_PIN_NUM 16
75
76
77#define PIO_PORTE
78#define PIO_PORTF
79#define PIO_PORTG
80#define PIO_PORTH
81*/
82
83/*============================ MACROFIED FUNCTIONS ===========================*/
84
85// bit0 - bit13: clksrc bitfield
86// bit14- bit27: clkdiv bitfield
87// bit28- bit31: clkdiv_remap
88#define __def_periph_clk(__name, __bf_clksel, __bf_clkdiv, __clksel_map_idx) \
89 VSF_MCONNECT2(__name, _idx) = ((__bf_clksel) << 0) \
90 | ((__bf_clkdiv) << 14) \
91 | ((__clksel_map_idx) << 28)
92
93#define __def_sync_clk_idx(__name, __bus_idx, __bit_idx) \
94 VSF_MCONNECT2(__name, _idx) = ((__bit_idx) << 0) | ((__bus_idx) << 5)
95
96#define __def_clk_src(__name, __value) __name = (__value)
97
98/*============================ TYPES =========================================*/
99
100#if 0
104 __def_idx(POWER_DUMMY, 0),
105};
107
111 __def_msk(POWER_DUMMY),
112} ;
114
118 VSF_PM_WAIT = 0,
122} ;
124
126 ...,
127};
129
131 ...
132};
134
137enum pm_periph_async_clk_no_t{
138 ...
139};
141
144enum pm_sync_clk_no_t {
145 // NAME BUS_IDX,BIT_IDX
146 // AHB
147 __def_sync_clk_idx( SCLK_UART0, 1, 16 ),
148 __def_sync_clk_idx( SCLK_UART1, 1, 17 ),
149 __def_sync_clk_idx( SCLK_UART2, 1, 18 ),
150 __def_sync_clk_idx( SCLK_UART3, 1, 19 ),
151};
152
153enum pm_sync_clk_msk_t {
154 __def_msk(SCLK_UART0),
155 __def_msk(SCLK_UART1),
156 __def_msk(SCLK_UART2),
157 __def_msk(SCLK_UART3),
158};
160
163 ...
164};
166
167enum vsf_pm_pll_sel_t {
168 PLL0_idx,
169};
170
171struct io_wakeup_cfg_t {
173};
174typedef struct io_wakeup_cfg_t io_wakeup_cfg_t;
175
178
179declare_interface( i_pm_wakeup_t )
180def_interface( i_pm_wakeup_t )
181 struct {
184 }UseIO;
185end_def_interface( i_pm_wakeup_t )
186
187struct pm_periph_asyn_clk_cfg_t {
188 vsf_pm_clk_src_sel_t clk_src;
190};
191
194struct pm_main_clk_cfg_t {
195 vsf_pm_clk_src_sel_t clk_src;
196 uint32_t freq;
197 uint16_t core_div[1];
198 uint16_t ahb_div[1];
199 uint16_t apb_div[2];
200};
202#endif
203
204/*============================ GLOBAL VARIABLES ==============================*/
205/*============================ LOCAL VARIABLES ===============================*/
206/*============================ PROTOTYPES ====================================*/
207
208#endif // __HAL_DEVICE_ARM_CMSDK_CM7_H__
209#endif // __VSF_HEADER_ONLY_SHOW_ARCH_INFO__
210/* 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