WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
hal_timer_v150_regs_op.h
浏览该文件的文档.
1
9#ifndef HAL_TIMER_V150_REGS_OP_H
10#define HAL_TIMER_V150_REGS_OP_H
11
12#include <stdint.h>
13#include "errcode.h"
14#include "timer_porting.h"
16
17#ifdef __cplusplus
18#if __cplusplus
19extern "C" {
20#endif /* __cplusplus */
21#endif /* __cplusplus */
22
30extern uintptr_t g_timer_regs[CONFIG_TIMER_MAX_NUM];
31
35#define timer_regs(index) ((timer_v150_regs_t *)(g_timer_regs[index]))
36
42static inline void hal_timer_v150_control_reg_set_enable(timer_index_t index, uint32_t val)
43{
44 timer_v150_control_reg_data_t timer_control_reg;
45 timer_control_reg.d32 = timer_regs(index)->control;
46 timer_control_reg.b.enable = val;
47 timer_regs(index)->control = timer_control_reg.d32;
48}
49
55static inline uint32_t hal_timer_v150_control_reg_get_enable(timer_index_t index)
56{
57 timer_v150_control_reg_data_t timer_control_reg;
58 timer_control_reg.d32 = timer_regs(index)->control;
59 return timer_control_reg.b.enable;
60}
61
67static inline void hal_timer_v150_control_reg_set_mode(timer_index_t index, uint32_t val)
68{
69 timer_v150_control_reg_data_t timer_control_reg;
70 timer_control_reg.d32 = timer_regs(index)->control;
71 timer_control_reg.b.mode = val;
72 timer_regs(index)->control = timer_control_reg.d32;
73}
74
80static inline uint32_t hal_timer_v150_get_current_value0(timer_index_t index)
81{
82 return timer_regs(index)->current_value0;
83}
84
90static inline uint32_t hal_timer_v150_get_current_value1(timer_index_t index)
91{
92 return timer_regs(index)->current_value1;
93}
94
100static inline void hal_timer_v150_set_load_count0(timer_index_t index, uint32_t val)
101{
102 timer_regs(index)->load_count0 = val;
103}
104
110static inline void hal_timer_v150_set_load_count1(timer_index_t index, uint32_t val)
111{
112 timer_regs(index)->load_count1 = val;
113}
114
119static inline void hal_timer_v150_int_clr(timer_index_t index)
120{
121 timer_regs(index)->eoi_ren = 0x1;
122}
123
129static inline void hal_timer_v150_set_load_lock(timer_index_t index, uint32_t val)
130{
131 unused(index);
132 ((timers_v150_regs_t *)g_timer_comm_regs)->lock = val;
133}
134
139static inline void hal_timer_v150_ctrl_set_cnt_req(timer_index_t index)
140{
141 timer_v150_control_reg_data_t timer_control_reg;
142 timer_control_reg.d32 = timer_regs(index)->control;
143 timer_control_reg.b.cnt_req = 1;
144 timer_regs(index)->control = timer_control_reg.d32;
145}
146
152static inline uint32_t hal_timer_v150_ctrl_get_cnt_lock(timer_index_t index)
153{
154 timer_v150_control_reg_data_t timer_control_reg;
155 timer_control_reg.d32 = timer_regs(index)->control;
156 return timer_control_reg.b.cnt_lock;
157}
158
163#ifdef __cplusplus
164#if __cplusplus
165}
166#endif /* __cplusplus */
167#endif /* __cplusplus */
168
169#endif
#define unused(var)
Definition common_def.h:49
uintptr_t g_timer_comm_regs
Definition hal_drv_timer.c:13
#define timer_regs(index)
Reg addr associated with timer.
Definition hal_timer_v150_regs_op.h:35
uintptr_t g_timer_regs[8]
Definition hal_drv_timer.c:14
enum timer_index timer_index_t
Definiton of the index of timers.
Registers associated with common timer.
Definition hal_timer_v150_regs_def.h:76
unsigned int uintptr_t
Definition td_type.h:65
This union represents the bit fields in the Control Register. Read the register into the d32 member t...
Definition hal_timer_v150_regs_def.h:34
uint32_t cnt_req
Definition hal_timer_v150_regs_def.h:41
uint32_t cnt_lock
Definition hal_timer_v150_regs_def.h:42
struct timer_v150_control_reg_data::@33 b
uint32_t enable
Definition hal_timer_v150_regs_def.h:37
uint32_t d32
Definition hal_timer_v150_regs_def.h:35
uint32_t mode
Definition hal_timer_v150_regs_def.h:38