]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RISC-V_IGLOO2_Creative_SoftConsole/hal/hw_reg_access.h
Backup checkin of MiFive demo running in ReNode emulator.
[freertos] / FreeRTOS / Demo / RISC-V_IGLOO2_Creative_SoftConsole / hal / hw_reg_access.h
1 /***************************************************************************//**\r
2  * (c) Copyright 2007-2018 Microsemi SoC Products Group. All rights reserved.\r
3  * \r
4  * Hardware registers access functions.\r
5  * The implementation of these function is platform and toolchain specific.\r
6  * The functions declared here are implemented using assembler as part of the \r
7  * processor/toolchain specific HAL.\r
8  * \r
9  * SVN $Revision: 9661 $\r
10  * SVN $Date: 2018-01-15 16:13:33 +0530 (Mon, 15 Jan 2018) $\r
11  */\r
12 #ifndef HW_REG_ACCESS\r
13 #define HW_REG_ACCESS\r
14 \r
15 #include "cpu_types.h"\r
16 /***************************************************************************//**\r
17  * HW_set_32bit_reg is used to write the content of a 32 bits wide peripheral\r
18  * register.\r
19  * \r
20  * @param reg_addr  Address in the processor's memory map of the register to\r
21  *                  write.\r
22  * @param value     Value to be written into the peripheral register.\r
23  */\r
24 void\r
25 HW_set_32bit_reg\r
26 (\r
27     addr_t reg_addr,\r
28     uint32_t value\r
29 );\r
30 \r
31 /***************************************************************************//**\r
32  * HW_get_32bit_reg is used to read the content of a 32 bits wide peripheral\r
33  * register.\r
34  * \r
35  * @param reg_addr  Address in the processor's memory map of the register to\r
36  *                  read.\r
37  * @return          32 bits value read from the peripheral register.\r
38  */\r
39 uint32_t\r
40 HW_get_32bit_reg\r
41 (\r
42     addr_t reg_addr\r
43 );\r
44 \r
45 /***************************************************************************//**\r
46  * HW_set_32bit_reg_field is used to set the content of a field in a 32 bits \r
47  * wide peripheral register.\r
48  * \r
49  * @param reg_addr  Address in the processor's memory map of the register to\r
50  *                  be written.\r
51  * @param shift     Bit offset of the register field to be read within the \r
52  *                  register.\r
53  * @param mask      Bit mask to be applied to the raw register value to filter\r
54  *                  out the other register fields values.\r
55  * @param value     Value to be written in the specified field.\r
56  */\r
57 void\r
58 HW_set_32bit_reg_field\r
59 (\r
60     addr_t reg_addr,\r
61     int_fast8_t shift,\r
62     uint32_t mask,\r
63     uint32_t value\r
64 );\r
65 \r
66 /***************************************************************************//**\r
67  * HW_get_32bit_reg_field is used to read the content of a field out of a \r
68  * 32 bits wide peripheral register.\r
69  * \r
70  * @param reg_addr  Address in the processor's memory map of the register to\r
71  *                  read.\r
72  * @param shift     Bit offset of the register field to be written within the \r
73  *                  register.\r
74  * @param mask      Bit mask to be applied to the raw register value to filter\r
75  *                  out the other register fields values.\r
76  *\r
77  * @return          32 bits value containing the register field value specified\r
78  *                  as parameter.\r
79  */\r
80 uint32_t \r
81 HW_get_32bit_reg_field\r
82 (\r
83     addr_t reg_addr,\r
84     int_fast8_t shift,\r
85     uint32_t mask\r
86 );\r
87 \r
88 /***************************************************************************//**\r
89  * HW_set_16bit_reg is used to write the content of a 16 bits wide peripheral\r
90  * register.\r
91  * \r
92  * @param reg_addr  Address in the processor's memory map of the register to\r
93  *                  write.\r
94  * @param value     Value to be written into the peripheral register.\r
95  */\r
96 void\r
97 HW_set_16bit_reg\r
98 (\r
99     addr_t reg_addr,\r
100     uint_fast16_t value\r
101 );\r
102 \r
103 /***************************************************************************//**\r
104  * HW_get_16bit_reg is used to read the content of a 16 bits wide peripheral\r
105  * register.\r
106  * \r
107  * @param reg_addr  Address in the processor's memory map of the register to\r
108  *                  read.\r
109  * @return          16 bits value read from the peripheral register.\r
110  */\r
111 uint16_t\r
112 HW_get_16bit_reg\r
113 (\r
114     addr_t reg_addr\r
115 );\r
116 \r
117 /***************************************************************************//**\r
118  * HW_set_16bit_reg_field is used to set the content of a field in a 16 bits \r
119  * wide peripheral register.\r
120  * \r
121  * @param reg_addr  Address in the processor's memory map of the register to\r
122  *                  be written.\r
123  * @param shift     Bit offset of the register field to be read within the \r
124  *                  register.\r
125  * @param mask      Bit mask to be applied to the raw register value to filter\r
126  *                  out the other register fields values.\r
127  * @param value     Value to be written in the specified field.\r
128  */\r
129 void HW_set_16bit_reg_field\r
130 (\r
131     addr_t reg_addr,\r
132     int_fast8_t shift,\r
133     uint_fast16_t mask,\r
134     uint_fast16_t value\r
135 );\r
136 \r
137 /***************************************************************************//**\r
138  * HW_get_16bit_reg_field is used to read the content of a field from a \r
139  * 16 bits wide peripheral register.\r
140  * \r
141  * @param reg_addr  Address in the processor's memory map of the register to\r
142  *                  read.\r
143  * @param shift     Bit offset of the register field to be written within the \r
144  *                  register.\r
145  * @param mask      Bit mask to be applied to the raw register value to filter\r
146  *                  out the other register fields values.\r
147  *\r
148  * @return          16 bits value containing the register field value specified\r
149  *                  as parameter.\r
150  */\r
151 uint16_t HW_get_16bit_reg_field\r
152 (\r
153     addr_t reg_addr,\r
154     int_fast8_t shift,\r
155     uint_fast16_t mask\r
156 );\r
157 \r
158 /***************************************************************************//**\r
159  * HW_set_8bit_reg is used to write the content of a 8 bits wide peripheral\r
160  * register.\r
161  * \r
162  * @param reg_addr  Address in the processor's memory map of the register to\r
163  *                  write.\r
164  * @param value     Value to be written into the peripheral register.\r
165  */\r
166 void\r
167 HW_set_8bit_reg\r
168 (\r
169     addr_t reg_addr,\r
170     uint_fast8_t value\r
171 );\r
172 \r
173 /***************************************************************************//**\r
174  * HW_get_8bit_reg is used to read the content of a 8 bits wide peripheral\r
175  * register.\r
176  * \r
177  * @param reg_addr  Address in the processor's memory map of the register to\r
178  *                  read.\r
179  * @return          8 bits value read from the peripheral register.\r
180  */\r
181 uint8_t\r
182 HW_get_8bit_reg\r
183 (\r
184     addr_t reg_addr\r
185 );\r
186 \r
187 /***************************************************************************//**\r
188  * HW_set_8bit_reg_field is used to set the content of a field in a 8 bits \r
189  * wide peripheral register.\r
190  * \r
191  * @param reg_addr  Address in the processor's memory map of the register to\r
192  *                  be written.\r
193  * @param shift     Bit offset of the register field to be read within the \r
194  *                  register.\r
195  * @param mask      Bit mask to be applied to the raw register value to filter\r
196  *                  out the other register fields values.\r
197  * @param value     Value to be written in the specified field.\r
198  */\r
199 void HW_set_8bit_reg_field\r
200 (\r
201     addr_t reg_addr,\r
202     int_fast8_t shift,\r
203     uint_fast8_t mask,\r
204     uint_fast8_t value\r
205 );\r
206 \r
207 /***************************************************************************//**\r
208  * HW_get_8bit_reg_field is used to read the content of a field from a \r
209  * 8 bits wide peripheral register.\r
210  * \r
211  * @param reg_addr  Address in the processor's memory map of the register to\r
212  *                  read.\r
213  * @param shift     Bit offset of the register field to be written within the \r
214  *                  register.\r
215  * @param mask      Bit mask to be applied to the raw register value to filter\r
216  *                  out the other register fields values.\r
217  *\r
218  * @return          8 bits value containing the register field value specified\r
219  *                  as parameter.\r
220  */\r
221 uint8_t HW_get_8bit_reg_field\r
222 (\r
223     addr_t reg_addr,\r
224     int_fast8_t shift,\r
225     uint_fast8_t mask\r
226 );\r
227 \r
228 #endif /* HW_REG_ACCESS */\r
229 \r