tao_z
2022-06-01 0ff91e66071237834a1501c78648729c8c32f67a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
 
 
#ifndef STDREGMACROS_H
#define STDREGMACROS_H
 
#ifdef __cplusplus
extern "C"{
#endif
 
 
/*==================================================================================================
*                               SOURCE FILE VERSION INFORMATION
==================================================================================================*/
#define STDREGMACROS_H_MAJOR_VERSION             1
#define STDREGMACROS_H_MINOR_VERSION             0
#define STDREGMACROS_H_PATCH_VERSION             2
 
/*==================================================================================================
*                                      FILE VERSION CHECKS
==================================================================================================*/
 
 
/*==================================================================================================
*                                           CONSTANTS
==================================================================================================*/
 
/*==================================================================================================
*                                       DEFINES AND MACROS
==================================================================================================*/
 
/**
 * write register value
 */
 
/**
* @brief 8 bits memory write macro
*/
#define REG_WRITE8(address, value)        ((address) = (value))
/**
* @brief 16 bits memory write macro.
*/
#define REG_WRITE16(address, value)       ((address) = (value))
/**
* @brief 32 bits memory write macro.
*/
#define REG_WRITE32(address, value)       ((address) = (value))
/**
 * read register value
 */
 
/**
* @brief 8 bits memory read macro.
*/
#define REG_READ8(address)                (address)
/**
* @brief 16 bits memory read macro.
*/
#define REG_READ16(address)               (address)
/**
* @brief 32 bits memory read macro.
*/
#define REG_READ32(address)               (address)
 
/**
 * clear bit value
 */
 
/**
* @brief 8 bits bits clearing macro.
*/
#define REG_BIT_CLEAR8(address, mask)     ((address)&= (~(mask)))
/**
* @brief 16 bits bits clearing macro.
*/
#define REG_BIT_CLEAR16(address, mask)    ((address)&= (~(mask)))
/**
* @brief 32 bits bits clearing macro.
*/
#define REG_BIT_CLEAR32(address, mask)    ((address)&= (~(mask)))
 
/**
 * get bit value
 */
 
/**
* @brief 8 bits bits getting macro.
*/
#define REG_BIT_GET8(address, mask)       ((address)& (mask))
/**
* @brief 16 bits bits getting macro.
*/
#define REG_BIT_GET16(address, mask)      ((address)& (mask))
/**
* @brief 32 bits bits getting macro.
*/
#define REG_BIT_GET32(address, mask)      ((address)& (mask))
 
 
/**
 * set bit value
 */
 
/**
* @brief 8 bits bits setting macro.
*/
#define REG_BIT_SET8(address, mask)       ((address)|= (mask))
/**
* @brief 16 bits bits setting macro.
*/
#define REG_BIT_SET16(address, mask)      ((address)|= (mask))
/**
* @brief 32 bits bits setting macro.
*/
#define REG_BIT_SET32(address, mask)      ((address)|= (mask))
 
 
/**
* @brief 8 bit clear bits and set with new value
*/
#define REG_RMW8(address, mask, value)    (REG_WRITE8((address), ((REG_READ8(address)& ((uint8)~(mask)))| (value))))
/**
* @brief 16 bit clear bits and set with new value
*/
#define REG_RMW16(address, mask, value)   (REG_WRITE16((address), ((REG_READ16(address)& ((uint16)~(mask)))| (value))))
/**
* @brief 32 bit clear bits and set with new value
*/
#define REG_RMW32(address, mask, value)   (REG_WRITE32((address), ((REG_READ32(address)& ((uint32)~(mask)))| (value))))
 
 
 
#ifdef __cplusplus
}
#endif
 
#endif /* #ifndef STDREGMACROS_H */
 
/** @} */