WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
hal_tsensor_v151_regs_op.h
浏览该文件的文档.
1
10#ifndef HAL_TSENSOR_V151_REGS_OP_H
11#define HAL_TSENSOR_V151_REGS_OP_H
12
13#include <stdint.h>
14#include "errcode.h"
16#include "tsensor_porting.h"
17
18#ifdef __cplusplus
19#if __cplusplus
20extern "C" {
21#endif /* __cplusplus */
22#endif /* __cplusplus */
23
29#define TSENSOR_ENABLE 1
30#define TSENSOR_DISABLE 0
31#define TSENSOR_CALIB_ENABLE 0
32#define TSENSOR_CALIB_DISABLE 1
33
35
36static inline tsensor_comm_regs_t *hal_tsensor_get_comm_regs(void)
37{
39}
40
41static inline tsensor_ctrl_regs_t *hal_tsensor_get_ctrl_regs(void)
42{
44}
45
46static inline void hal_tsensor_v151_reg_set_start(void)
47{
48 tsensor_start_data_t tsensor_start;
49 tsensor_start.d32 = hal_tsensor_get_ctrl_regs()->tsensor_start;
50 tsensor_start.b.tsensor_start = TSENSOR_ENABLE;
51 hal_tsensor_get_ctrl_regs()->tsensor_start = tsensor_start.d32;
52}
53
54static inline void hal_tsensor_v151_reg_set_tsensor_enable(void)
55{
56 tsensor_ctrl_data_t tsensor_ctrl;
57 tsensor_ctrl.d32 = hal_tsensor_get_ctrl_regs()->tsensor_ctrl;
58 tsensor_ctrl.b.tsensor_enable = TSENSOR_ENABLE;
59 hal_tsensor_get_ctrl_regs()->tsensor_ctrl = tsensor_ctrl.d32;
60}
61
62static inline void hal_tsensor_v151_reg_set_tsensor_disable(void)
63{
64 tsensor_ctrl_data_t tsensor_ctrl;
65 tsensor_ctrl.d32 = hal_tsensor_get_ctrl_regs()->tsensor_ctrl;
66 tsensor_ctrl.b.tsensor_enable = TSENSOR_DISABLE;
67 hal_tsensor_get_ctrl_regs()->tsensor_ctrl = tsensor_ctrl.d32;
68}
69
70static inline void hal_tsensor_v151_reg_set_tsensor_mode(uint32_t mode)
71{
72 tsensor_ctrl_data_t tsensor_ctrl;
73 tsensor_ctrl.d32 = hal_tsensor_get_ctrl_regs()->tsensor_ctrl;
74 tsensor_ctrl.b.tsensor_mode = mode;
75 hal_tsensor_get_ctrl_regs()->tsensor_ctrl = tsensor_ctrl.d32;
76}
77
78static inline uint32_t hal_tsensor_v151_reg_is_tsensor_ready(void)
79{
80 tsensor_sts_data_t tsensor_sts;
81 tsensor_sts.d32 = hal_tsensor_get_ctrl_regs()->tsensor_sts;
82 return tsensor_sts.b.tsensor_rdy;
83}
84
85static inline void hal_tsensor_v151_reg_clear_sts(void)
86{
87 tsensor_sts_data_t tsensor_sts;
88 tsensor_sts.d32 = hal_tsensor_get_ctrl_regs()->tsensor_sts;
89 tsensor_sts.b.tsensor_clr = TSENSOR_ENABLE;
90 hal_tsensor_get_ctrl_regs()->tsensor_sts = tsensor_sts.d32;
91}
92
93static inline uint16_t hal_tsensor_v151_reg_get_data(void)
94{
95 tsensor_sts_data_t tsensor_sts;
96 tsensor_sts.d32 = hal_tsensor_get_ctrl_regs()->tsensor_sts;
97 return tsensor_sts.b.tsensor_data;
98}
99
100static inline void hal_tsensor_v151_reg_set_calib_enable(void)
101{
102 tsensor_ctrl1_data_t tsensor_ctrl1;
103 tsensor_ctrl1.d32 = hal_tsensor_get_ctrl_regs()->tsensor_ctrl1;
104 tsensor_ctrl1.b.temp_calib = TSENSOR_CALIB_ENABLE;
105 hal_tsensor_get_ctrl_regs()->tsensor_ctrl1 = tsensor_ctrl1.d32;
106}
107
108static inline void hal_tsensor_v151_reg_set_calib_disable(void)
109{
110 tsensor_ctrl1_data_t tsensor_ctrl1;
111 tsensor_ctrl1.d32 = hal_tsensor_get_ctrl_regs()->tsensor_ctrl1;
112 tsensor_ctrl1.b.temp_calib = TSENSOR_CALIB_DISABLE;
113 hal_tsensor_get_ctrl_regs()->tsensor_ctrl1 = tsensor_ctrl1.d32;
114}
115
116static inline void hal_tsensor_v151_reg_set_ct_sel(uint8_t temp_ct_sel)
117{
118 tsensor_ctrl1_data_t tsensor_ctrl1;
119 tsensor_ctrl1.d32 = hal_tsensor_get_ctrl_regs()->tsensor_ctrl1;
120 tsensor_ctrl1.b.temp_ct_sel = temp_ct_sel;
121 hal_tsensor_get_ctrl_regs()->tsensor_ctrl1 = tsensor_ctrl1.d32;
122}
123
124static inline void hal_tsensor_v151_reg_set_temp_set(uint8_t temp_set)
125{
126 tsensor_ctrl1_data_t tsensor_ctrl1;
127 tsensor_ctrl1.d32 = hal_tsensor_get_ctrl_regs()->tsensor_ctrl1;
128 tsensor_ctrl1.b.temp_set = temp_set;
129 hal_tsensor_get_ctrl_regs()->tsensor_ctrl1 = tsensor_ctrl1.d32;
130}
131
132static inline void hal_tsensor_v151_reg_set_temp_scan_dft(uint8_t temp_scan_dft)
133{
134 tsensor_ctrl1_data_t tsensor_ctrl1;
135 tsensor_ctrl1.d32 = hal_tsensor_get_ctrl_regs()->tsensor_ctrl1;
136 tsensor_ctrl1.b.temp_scan_dft = temp_scan_dft;
137 hal_tsensor_get_ctrl_regs()->tsensor_ctrl1 = tsensor_ctrl1.d32;
138}
139
140static inline void hal_tsensor_v151_reg_set_temp_high_limit(uint16_t temp_code)
141{
142 tsensor_temp_high_limit_data_t tsensor_temp_high_limit;
143 tsensor_temp_high_limit.d32 = hal_tsensor_get_ctrl_regs()->tsensor_temp_high_limit;
144 tsensor_temp_high_limit.b.tsensor_temp_high_limit = temp_code;
145 hal_tsensor_get_ctrl_regs()->tsensor_temp_high_limit = tsensor_temp_high_limit.d32;
146}
147
148static inline void hal_tsensor_v151_reg_set_temp_low_limit(uint16_t temp_code)
149{
150 tsensor_temp_low_limit_data_t tsensor_temp_low_limit;
151 tsensor_temp_low_limit.d32 = hal_tsensor_get_ctrl_regs()->tsensor_temp_low_limit;
152 tsensor_temp_low_limit.b.tsensor_temp_low_limit = temp_code;
153 hal_tsensor_get_ctrl_regs()->tsensor_temp_low_limit = tsensor_temp_low_limit.d32;
154}
155
156static inline void hal_tsensor_v151_reg_set_overtemp_threshold(uint16_t temp_code)
157{
158 tsensor_over_temp_data_t tsensor_over_temp;
159 tsensor_over_temp.d32 = hal_tsensor_get_ctrl_regs()->tsensor_over_temp;
160 tsensor_over_temp.b.tsensor_overtemp_thresh = temp_code;
161 hal_tsensor_get_ctrl_regs()->tsensor_over_temp = tsensor_over_temp.d32;
162}
163
164static inline void hal_tsensor_v151_reg_set_overtemp_protect_enable(void)
165{
166 tsensor_over_temp_data_t tsensor_over_temp;
167 tsensor_over_temp.d32 = hal_tsensor_get_ctrl_regs()->tsensor_over_temp;
168 tsensor_over_temp.b.tsensor_overtemp_thresh_en = TSENSOR_ENABLE;
169 hal_tsensor_get_ctrl_regs()->tsensor_over_temp = tsensor_over_temp.d32;
170}
171
172static inline void hal_tsensor_v151_reg_set_overtemp_protect_disable(void)
173{
174 tsensor_over_temp_data_t tsensor_over_temp;
175 tsensor_over_temp.d32 = hal_tsensor_get_ctrl_regs()->tsensor_over_temp;
176 tsensor_over_temp.b.tsensor_overtemp_thresh_en = TSENSOR_DISABLE;
177 hal_tsensor_get_ctrl_regs()->tsensor_over_temp = tsensor_over_temp.d32;
178}
179
180static inline void hal_tsensor_v151_reg_set_tsensor_done_intr_enable(uint8_t value)
181{
182 tsensor_temp_int_en_data_t tsensor_temp_int_en;
183 tsensor_temp_int_en.d32 = hal_tsensor_get_ctrl_regs()->tsensor_temp_int_en;
184 tsensor_temp_int_en.b.tsensor_done_int_en = value;
185 hal_tsensor_get_ctrl_regs()->tsensor_temp_int_en = tsensor_temp_int_en.d32;
186}
187
188static inline void hal_tsensor_v151_reg_set_out_temp_threshold_intr_enable(uint8_t value)
189{
190 tsensor_temp_int_en_data_t tsensor_temp_int_en;
191 tsensor_temp_int_en.d32 = hal_tsensor_get_ctrl_regs()->tsensor_temp_int_en;
192 tsensor_temp_int_en.b.tsensor_out_thresh_int_en = value;
193 hal_tsensor_get_ctrl_regs()->tsensor_temp_int_en = tsensor_temp_int_en.d32;
194}
195
196static inline void hal_tsensor_v151_reg_set_overtemp_intr_enable(uint8_t value)
197{
198 tsensor_temp_int_en_data_t tsensor_temp_int_en;
199 tsensor_temp_int_en.d32 = hal_tsensor_get_ctrl_regs()->tsensor_temp_int_en;
200 tsensor_temp_int_en.b.tsensor_overtemp_int_en = value;
201 hal_tsensor_get_ctrl_regs()->tsensor_temp_int_en = tsensor_temp_int_en.d32;
202}
203
204static inline uint32_t hal_tsensor_v151_reg_get_temp_intr_enable_status(void)
205{
206 return hal_tsensor_get_ctrl_regs()->tsensor_temp_int_en;
207}
208
209static inline void hal_tsensor_v151_reg_clr_temp_intr(void)
210{
211 tsensor_temp_int_clr_data_t tsensor_temp_int_clr;
212 tsensor_temp_int_clr.d32 = hal_tsensor_get_ctrl_regs()->tsensor_temp_int_clr;
213 tsensor_temp_int_clr.b.tsensor_int_clr = TSENSOR_ENABLE;
214 hal_tsensor_get_ctrl_regs()->tsensor_temp_int_clr = tsensor_temp_int_clr.d32;
215}
216
217static inline uint32_t hal_tsensor_v151_reg_get_temp_intr_status(void)
218{
219 return hal_tsensor_get_ctrl_regs()->tsensor_temp_int_sts;
220}
221
222static inline void hal_tsensor_v151_reg_set_auto_refresh_period(uint32_t period)
223{
224 tsensor_auto_refresh_period_data_t tsensor_auto_refresh_period;
225 tsensor_auto_refresh_period.d32 = hal_tsensor_get_ctrl_regs()->tsensor_auto_refresh_period;
226 tsensor_auto_refresh_period.b.tsensor_auto_refresh_period = period;
227 hal_tsensor_get_ctrl_regs()->tsensor_auto_refresh_period = tsensor_auto_refresh_period.d32;
228}
229
230static inline void hal_tsensor_v151_reg_set_auto_refresh_enable(uint8_t value)
231{
232 tsensor_auto_refresh_cfg_data_t tsensor_auto_refresh_cfg;
233 tsensor_auto_refresh_cfg.d32 = hal_tsensor_get_ctrl_regs()->tsensor_auto_refresh_cfg;
234 tsensor_auto_refresh_cfg.b.tsensor_auto_refresh_enable = value;
235 hal_tsensor_get_ctrl_regs()->tsensor_auto_refresh_cfg = tsensor_auto_refresh_cfg.d32;
236}
237
242#ifdef __cplusplus
243#if __cplusplus
244}
245#endif /* __cplusplus */
246#endif /* __cplusplus */
247
248#endif
#define TSENSOR_COMM_REGS_OFFSET
Definition hal_tsensor_v151_regs_def.h:27
#define TSENSOR_CTRL_REGS_OFFSET
Definition hal_tsensor_v151_regs_def.h:28
#define TSENSOR_ENABLE
Definition hal_tsensor_v151_regs_op.h:29
uintptr_t g_hal_tsensor_regs
Definition hal_tsensor.c:13
#define TSENSOR_DISABLE
Definition hal_tsensor_v151_regs_op.h:30
#define TSENSOR_CALIB_ENABLE
Definition hal_tsensor_v151_regs_op.h:31
#define TSENSOR_CALIB_DISABLE
Definition hal_tsensor_v151_regs_op.h:32
Definition hal_tsensor_v151_regs_def.h:244
Definition hal_tsensor_v151_regs_def.h:253
volatile uint32_t tsensor_auto_refresh_cfg
Definition hal_tsensor_v151_regs_def.h:267
volatile uint32_t tsensor_sts
Definition hal_tsensor_v151_regs_def.h:256
volatile uint32_t tsensor_ctrl1
Definition hal_tsensor_v151_regs_def.h:258
volatile uint32_t tsensor_start
Definition hal_tsensor_v151_regs_def.h:254
volatile uint32_t tsensor_over_temp
Definition hal_tsensor_v151_regs_def.h:261
volatile uint32_t tsensor_temp_int_en
Definition hal_tsensor_v151_regs_def.h:262
volatile uint32_t tsensor_auto_refresh_period
Definition hal_tsensor_v151_regs_def.h:266
volatile uint32_t tsensor_ctrl
Definition hal_tsensor_v151_regs_def.h:255
volatile uint32_t tsensor_temp_int_sts
Definition hal_tsensor_v151_regs_def.h:264
volatile uint32_t tsensor_temp_int_clr
Definition hal_tsensor_v151_regs_def.h:263
volatile uint32_t tsensor_temp_high_limit
Definition hal_tsensor_v151_regs_def.h:259
volatile uint32_t tsensor_temp_low_limit
Definition hal_tsensor_v151_regs_def.h:260
unsigned int uintptr_t
Definition td_type.h:65
This union represents the bit fields in the tsensor_auto_refresh_cfg register. Read the register into...
Definition hal_tsensor_v151_regs_def.h:236
uint32_t d32
Definition hal_tsensor_v151_regs_def.h:237
uint32_t tsensor_auto_refresh_enable
Definition hal_tsensor_v151_regs_def.h:239
struct tsensor_auto_refresh_cfg_data::@340 b
This union represents the bit fields in the tsensor_auto_refresh_period register. Read the register i...
Definition hal_tsensor_v151_regs_def.h:224
uint32_t tsensor_auto_refresh_period
Definition hal_tsensor_v151_regs_def.h:227
struct tsensor_auto_refresh_period_data::@339 b
uint32_t d32
Definition hal_tsensor_v151_regs_def.h:225
This union represents the bit fields in the tsensor_ctrl1 register. Read the register into the d32 me...
Definition hal_tsensor_v151_regs_def.h:118
uint32_t temp_ct_sel
Definition hal_tsensor_v151_regs_def.h:123
uint32_t temp_scan_dft
Definition hal_tsensor_v151_regs_def.h:128
uint32_t d32
Definition hal_tsensor_v151_regs_def.h:119
uint32_t temp_set
Definition hal_tsensor_v151_regs_def.h:127
uint32_t temp_calib
Definition hal_tsensor_v151_regs_def.h:121
struct tsensor_ctrl1_data::@331 b
This union represents the bit fields in the tsensor_ctrl register. Read the register into the d32 mem...
Definition hal_tsensor_v151_regs_def.h:80
struct tsensor_ctrl_data::@326 b
uint32_t d32
Definition hal_tsensor_v151_regs_def.h:81
uint32_t tsensor_mode
Definition hal_tsensor_v151_regs_def.h:84
uint32_t tsensor_enable
Definition hal_tsensor_v151_regs_def.h:83
This union represents the bit fields in the tsensor_over_temp register. Read the register into the d3...
Definition hal_tsensor_v151_regs_def.h:163
struct tsensor_over_temp_data::@334 b
uint32_t tsensor_overtemp_thresh_en
Definition hal_tsensor_v151_regs_def.h:167
uint32_t d32
Definition hal_tsensor_v151_regs_def.h:164
uint32_t tsensor_overtemp_thresh
Definition hal_tsensor_v151_regs_def.h:166
This union represents the bit fields in the tsensor_start register. Read the register into the d32 me...
Definition hal_tsensor_v151_regs_def.h:65
struct tsensor_start_data::@325 b
uint32_t tsensor_start
Definition hal_tsensor_v151_regs_def.h:68
uint32_t d32
Definition hal_tsensor_v151_regs_def.h:66
This union represents the bit fields in the tsensor_sts register. Read the register into the d32 memb...
Definition hal_tsensor_v151_regs_def.h:95
uint32_t tsensor_rdy
Definition hal_tsensor_v151_regs_def.h:99
struct tsensor_sts_data::@328 b
uint32_t d32
Definition hal_tsensor_v151_regs_def.h:96
uint32_t tsensor_data
Definition hal_tsensor_v151_regs_def.h:102
uint32_t tsensor_clr
Definition hal_tsensor_v151_regs_def.h:98
This union represents the bit fields in the tsensor_temp_high_limit register. Read the register into ...
Definition hal_tsensor_v151_regs_def.h:139
struct tsensor_temp_high_limit_data::@332 b
uint32_t tsensor_temp_high_limit
Definition hal_tsensor_v151_regs_def.h:142
uint32_t d32
Definition hal_tsensor_v151_regs_def.h:140
This union represents the bit fields in the tsensor_temp_int_clr register. Read the register into the...
Definition hal_tsensor_v151_regs_def.h:198
struct tsensor_temp_int_clr_data::@337 b
uint32_t tsensor_int_clr
Definition hal_tsensor_v151_regs_def.h:201
uint32_t d32
Definition hal_tsensor_v151_regs_def.h:199
This union represents the bit fields in the tsensor_temp_int_en register. Read the register into the ...
Definition hal_tsensor_v151_regs_def.h:178
uint32_t tsensor_overtemp_int_en
Definition hal_tsensor_v151_regs_def.h:187
uint32_t d32
Definition hal_tsensor_v151_regs_def.h:179
struct tsensor_temp_int_en_data::@335 b
uint32_t tsensor_out_thresh_int_en
Definition hal_tsensor_v151_regs_def.h:184
uint32_t tsensor_done_int_en
Definition hal_tsensor_v151_regs_def.h:181
This union represents the bit fields in the tsensor_temp_low_limit register. Read the register into t...
Definition hal_tsensor_v151_regs_def.h:151
struct tsensor_temp_low_limit_data::@333 b
uint32_t tsensor_temp_low_limit
Definition hal_tsensor_v151_regs_def.h:154
uint32_t d32
Definition hal_tsensor_v151_regs_def.h:152