18#ifndef __VSF_TEMPLATE_COMMON_H__
19#define __VSF_TEMPLATE_COMMON_H__
31#define VSF_HAL_TEMPLATE_API_OP(__prefix_name, __return, __module__, __name, __first_args, ...) \
32 .__name = (__return (*)( VSF_MCONNECT(vsf, _, __module__, _t) *, ##__VA_ARGS__ ))& VSF_MCONNECT(__prefix_name, _, __module__, _, __name),
34#define VSF_HAL_TEMPLATE_API_FP(__prefix_name, __return, __module__, __name, __first_args, ...) \
35 __return (* __name )( __first_args, ##__VA_ARGS__ );
37#define VSF_HAL_TEMPLATE_API_EXTERN(__prefix_name, __return, __module__, __name, __first_args, ...) \
38 extern __return VSF_MCONNECT(__prefix_name, _, __module__, _, __name)( __first_args, ##__VA_ARGS__ );
40#define VSF_HAL_TEMPLATE_API_DEFINE(__prefix_name, __return, __module__, __name, __first_args, ...) \
41 __return VSF_MCONNECT(__prefix_name, _, __module__, _, __name)( __first_args, ##__VA_ARGS__ )
43#define __VSF_HAL_COUNT_TO_MASK(__CNT) \
44 ((0x1ull << (__CNT > 0x00 ? 0x00 : 0)) | \
45 (0x1ull << (__CNT > 0x01 ? 0x01 : 0)) | \
46 (0x1ull << (__CNT > 0x02 ? 0x02 : 0)) | \
47 (0x1ull << (__CNT > 0x03 ? 0x03 : 0)) | \
48 (0x1ull << (__CNT > 0x04 ? 0x04 : 0)) | \
49 (0x1ull << (__CNT > 0x05 ? 0x05 : 0)) | \
50 (0x1ull << (__CNT > 0x06 ? 0x06 : 0)) | \
51 (0x1ull << (__CNT > 0x07 ? 0x07 : 0)) | \
52 (0x1ull << (__CNT > 0x08 ? 0x08 : 0)) | \
53 (0x1ull << (__CNT > 0x09 ? 0x09 : 0)) | \
54 (0x1ull << (__CNT > 0x0A ? 0x0A : 0)) | \
55 (0x1ull << (__CNT > 0x0B ? 0x0B : 0)) | \
56 (0x1ull << (__CNT > 0x0C ? 0x0C : 0)) | \
57 (0x1ull << (__CNT > 0x0D ? 0x0D : 0)) | \
58 (0x1ull << (__CNT > 0x0E ? 0x0E : 0)) | \
59 (0x1ull << (__CNT > 0x0F ? 0x0F : 0)) | \
60 (0x1ull << (__CNT > 0x10 ? 0x10 : 0)) | \
61 (0x1ull << (__CNT > 0x11 ? 0x11 : 0)) | \
62 (0x1ull << (__CNT > 0x12 ? 0x12 : 0)) | \
63 (0x1ull << (__CNT > 0x13 ? 0x13 : 0)) | \
64 (0x1ull << (__CNT > 0x14 ? 0x14 : 0)) | \
65 (0x1ull << (__CNT > 0x15 ? 0x15 : 0)) | \
66 (0x1ull << (__CNT > 0x16 ? 0x16 : 0)) | \
67 (0x1ull << (__CNT > 0x17 ? 0x17 : 0)) | \
68 (0x1ull << (__CNT > 0x18 ? 0x18 : 0)) | \
69 (0x1ull << (__CNT > 0x19 ? 0x19 : 0)) | \
70 (0x1ull << (__CNT > 0x1A ? 0x1A : 0)) | \
71 (0x1ull << (__CNT > 0x1B ? 0x1B : 0)) | \
72 (0x1ull << (__CNT > 0x1C ? 0x1C : 0)) | \
73 (0x1ull << (__CNT > 0x1D ? 0x1D : 0)) | \
74 (0x1ull << (__CNT > 0x1E ? 0x1E : 0)) | \
75 (0x1ull << (__CNT > 0x1F ? 0x1F : 0)) | \
76 (0x1ull << (__CNT > 0x20 ? 0x20 : 0)) | \
77 (0x1ull << (__CNT > 0x21 ? 0x21 : 0)) | \
78 (0x1ull << (__CNT > 0x22 ? 0x22 : 0)) | \
79 (0x1ull << (__CNT > 0x23 ? 0x23 : 0)) | \
80 (0x1ull << (__CNT > 0x24 ? 0x24 : 0)) | \
81 (0x1ull << (__CNT > 0x25 ? 0x25 : 0)) | \
82 (0x1ull << (__CNT > 0x26 ? 0x26 : 0)) | \
83 (0x1ull << (__CNT > 0x27 ? 0x27 : 0)) | \
84 (0x1ull << (__CNT > 0x28 ? 0x28 : 0)) | \
85 (0x1ull << (__CNT > 0x29 ? 0x29 : 0)) | \
86 (0x1ull << (__CNT > 0x2A ? 0x2A : 0)) | \
87 (0x1ull << (__CNT > 0x2B ? 0x2B : 0)) | \
88 (0x1ull << (__CNT > 0x2C ? 0x2C : 0)) | \
89 (0x1ull << (__CNT > 0x2D ? 0x2D : 0)) | \
90 (0x1ull << (__CNT > 0x2E ? 0x2E : 0)) | \
91 (0x1ull << (__CNT > 0x2F ? 0x2F : 0)) | \
92 (0x1ull << (__CNT > 0x30 ? 0x30 : 0)) | \
93 (0x1ull << (__CNT > 0x31 ? 0x31 : 0)) | \
94 (0x1ull << (__CNT > 0x32 ? 0x32 : 0)) | \
95 (0x1ull << (__CNT > 0x33 ? 0x33 : 0)) | \
96 (0x1ull << (__CNT > 0x34 ? 0x34 : 0)) | \
97 (0x1ull << (__CNT > 0x35 ? 0x35 : 0)) | \
98 (0x1ull << (__CNT > 0x36 ? 0x36 : 0)) | \
99 (0x1ull << (__CNT > 0x37 ? 0x37 : 0)) | \
100 (0x1ull << (__CNT > 0x38 ? 0x38 : 0)) | \
101 (0x1ull << (__CNT > 0x39 ? 0x39 : 0)) | \
102 (0x1ull << (__CNT > 0x3A ? 0x3A : 0)) | \
103 (0x1ull << (__CNT > 0x3B ? 0x3B : 0)) | \
104 (0x1ull << (__CNT > 0x3C ? 0x3C : 0)) | \
105 (0x1ull << (__CNT > 0x3D ? 0x3D : 0)) | \
106 (0x1ull << (__CNT > 0x3E ? 0x3E : 0)) | \
107 (0x1ull << (__CNT > 0x3F ? 0x3F : 0)))
109#define VSF_HAL_COUNT_TO_MASK(__CNT) \
110 __VSF_HAL_COUNT_TO_MASK(__CNT)
112#define __VSF_HAL_MASK_TO_COUNT(__MASK) \
113 ((__MASK & (0x01ull << 0x00) ? 1 : 0) + \
114 (__MASK & (0x01ull << 0x01) ? 1 : 0) + \
115 (__MASK & (0x01ull << 0x02) ? 1 : 0) + \
116 (__MASK & (0x01ull << 0x03) ? 1 : 0) + \
117 (__MASK & (0x01ull << 0x04) ? 1 : 0) + \
118 (__MASK & (0x01ull << 0x05) ? 1 : 0) + \
119 (__MASK & (0x01ull << 0x06) ? 1 : 0) + \
120 (__MASK & (0x01ull << 0x07) ? 1 : 0) + \
121 (__MASK & (0x01ull << 0x08) ? 1 : 0) + \
122 (__MASK & (0x01ull << 0x09) ? 1 : 0) + \
123 (__MASK & (0x01ull << 0x0A) ? 1 : 0) + \
124 (__MASK & (0x01ull << 0x0B) ? 1 : 0) + \
125 (__MASK & (0x01ull << 0x0C) ? 1 : 0) + \
126 (__MASK & (0x01ull << 0x0D) ? 1 : 0) + \
127 (__MASK & (0x01ull << 0x0E) ? 1 : 0) + \
128 (__MASK & (0x01ull << 0x0F) ? 1 : 0) + \
129 (__MASK & (0x01ull << 0x10) ? 1 : 0) + \
130 (__MASK & (0x01ull << 0x11) ? 1 : 0) + \
131 (__MASK & (0x01ull << 0x12) ? 1 : 0) + \
132 (__MASK & (0x01ull << 0x13) ? 1 : 0) + \
133 (__MASK & (0x01ull << 0x14) ? 1 : 0) + \
134 (__MASK & (0x01ull << 0x15) ? 1 : 0) + \
135 (__MASK & (0x01ull << 0x16) ? 1 : 0) + \
136 (__MASK & (0x01ull << 0x17) ? 1 : 0) + \
137 (__MASK & (0x01ull << 0x18) ? 1 : 0) + \
138 (__MASK & (0x01ull << 0x19) ? 1 : 0) + \
139 (__MASK & (0x01ull << 0x1A) ? 1 : 0) + \
140 (__MASK & (0x01ull << 0x1B) ? 1 : 0) + \
141 (__MASK & (0x01ull << 0x1C) ? 1 : 0) + \
142 (__MASK & (0x01ull << 0x1D) ? 1 : 0) + \
143 (__MASK & (0x01ull << 0x1E) ? 1 : 0) + \
144 (__MASK & (0x01ull << 0x1F) ? 1 : 0) + \
145 (__MASK & (0x01ull << 0x20) ? 1 : 0) + \
146 (__MASK & (0x01ull << 0x21) ? 1 : 0) + \
147 (__MASK & (0x01ull << 0x22) ? 1 : 0) + \
148 (__MASK & (0x01ull << 0x23) ? 1 : 0) + \
149 (__MASK & (0x01ull << 0x24) ? 1 : 0) + \
150 (__MASK & (0x01ull << 0x25) ? 1 : 0) + \
151 (__MASK & (0x01ull << 0x26) ? 1 : 0) + \
152 (__MASK & (0x01ull << 0x27) ? 1 : 0) + \
153 (__MASK & (0x01ull << 0x28) ? 1 : 0) + \
154 (__MASK & (0x01ull << 0x29) ? 1 : 0) + \
155 (__MASK & (0x01ull << 0x2A) ? 1 : 0) + \
156 (__MASK & (0x01ull << 0x2B) ? 1 : 0) + \
157 (__MASK & (0x01ull << 0x2C) ? 1 : 0) + \
158 (__MASK & (0x01ull << 0x2D) ? 1 : 0) + \
159 (__MASK & (0x01ull << 0x2E) ? 1 : 0) + \
160 (__MASK & (0x01ull << 0x2F) ? 1 : 0) + \
161 (__MASK & (0x01ull << 0x30) ? 1 : 0) + \
162 (__MASK & (0x01ull << 0x31) ? 1 : 0) + \
163 (__MASK & (0x01ull << 0x32) ? 1 : 0) + \
164 (__MASK & (0x01ull << 0x33) ? 1 : 0) + \
165 (__MASK & (0x01ull << 0x34) ? 1 : 0) + \
166 (__MASK & (0x01ull << 0x35) ? 1 : 0) + \
167 (__MASK & (0x01ull << 0x36) ? 1 : 0) + \
168 (__MASK & (0x01ull << 0x37) ? 1 : 0) + \
169 (__MASK & (0x01ull << 0x38) ? 1 : 0) + \
170 (__MASK & (0x01ull << 0x39) ? 1 : 0) + \
171 (__MASK & (0x01ull << 0x3A) ? 1 : 0) + \
172 (__MASK & (0x01ull << 0x3B) ? 1 : 0) + \
173 (__MASK & (0x01ull << 0x3C) ? 1 : 0) + \
174 (__MASK & (0x01ull << 0x3D) ? 1 : 0) + \
175 (__MASK & (0x01ull << 0x3E) ? 1 : 0) + \
176 (__MASK & (0x01ull << 0x3F) ? 1 : 0))
178#define VSF_HAL_MASK_TO_COUNT(__MASK) \
179 __VSF_HAL_MASK_TO_COUNT(__MASK)
vsf_err_t
Definition __type.h:42
end_def_interface(i_pm_wakeup_t) struct vsf_pm_pclk_cfg_t
Definition device.h:249
unsigned short uint16_t
Definition lvgl.h:41
unsigned int uint32_t
Definition lvgl.h:43
unsigned char uint8_t
Definition lvgl.h:40
unsigned int uint_fast32_t
Definition stdint.h:27
int int_fast32_t
Definition stdint.h:26
Definition vsf_template_hal_driver.h:183
void * pointer
Definition vsf_template_hal_driver.h:184
char * name
Definition vsf_template_hal_driver.h:185
Definition vsf_template_hal_driver.h:203
uint16_t info
Definition vsf_template_hal_driver.h:239
union vsf_peripheral_capability_t::@539 Read
uint8_t can_write_block
Definition vsf_template_hal_driver.h:220
uint8_t can_read_byte
Definition vsf_template_hal_driver.h:206
union vsf_peripheral_capability_t::@540 Write
uint8_t can_write
Definition vsf_template_hal_driver.h:227
uint16_t u5_block_size
Definition vsf_template_hal_driver.h:236
uint8_t can_read_block
Definition vsf_template_hal_driver.h:207
uint8_t support_dma
Definition vsf_template_hal_driver.h:209
uint8_t random_access
Definition vsf_template_hal_driver.h:211
uint8_t can_write_byte
Definition vsf_template_hal_driver.h:219
uint8_t support_isr
Definition vsf_template_hal_driver.h:210
uint16_t u3_data_type_size
Definition vsf_template_hal_driver.h:233
uint8_t can_read
Definition vsf_template_hal_driver.h:214
uint8_t support_fifo
Definition vsf_template_hal_driver.h:208
union vsf_peripheral_capability_t::@541 Feature
Definition vsf_template_hal_driver.h:196
uint32_t is_busy
Definition vsf_template_hal_driver.h:197
fsm_rt_t
Definition vsf_fsm.h:315
vsf_err_t(* fn_Cancel)(void)
cancel on going communication
Definition vsf_template_hal_driver.h:274
fsm_rt_t(* fn_Open)(void)
Definition vsf_template_hal_driver.h:251
fsm_rt_t(* fn_Enable)(void)
Definition vsf_template_hal_driver.h:250
fsm_rt_t(* fn_Uninit)(void)
Definition vsf_template_hal_driver.h:248
def_interface(i_peripheral_t) vsf_peripheral_status_t(*fn_Status)(void)
vsf_peripheral_capability_t(* fn_Capability)(void)
Definition vsf_template_hal_driver.h:247
fsm_rt_t(* fn_Close)(void)
Definition vsf_template_hal_driver.h:255
fsm_rt_t(* fn_Disable)(void)
Definition vsf_template_hal_driver.h:254
int_fast32_t(* fn_GetTransferredCount)(void)
get transferred count
Definition vsf_template_hal_driver.h:277
uint_fast32_t size
Definition vsf_template_hal_driver.h:271