1 /***************************************************************************//**
\r
2 * (c) Copyright 2007-2018 Microsemi SoC Products Group. All rights reserved.
\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
9 * SVN $Revision: 9661 $
\r
10 * SVN $Date: 2018-01-15 16:13:33 +0530 (Mon, 15 Jan 2018) $
\r
12 #ifndef HW_REG_ACCESS
\r
13 #define HW_REG_ACCESS
\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
20 * @param reg_addr Address in the processor's memory map of the register to
\r
22 * @param value Value to be written into the peripheral register.
\r
31 /***************************************************************************//**
\r
32 * HW_get_32bit_reg is used to read the content of a 32 bits wide peripheral
\r
35 * @param reg_addr Address in the processor's memory map of the register to
\r
37 * @return 32 bits value read from the peripheral register.
\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
49 * @param reg_addr Address in the processor's memory map of the register to
\r
51 * @param shift Bit offset of the register field to be read within the
\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
58 HW_set_32bit_reg_field
\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
70 * @param reg_addr Address in the processor's memory map of the register to
\r
72 * @param shift Bit offset of the register field to be written within the
\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
77 * @return 32 bits value containing the register field value specified
\r
81 HW_get_32bit_reg_field
\r
88 /***************************************************************************//**
\r
89 * HW_set_16bit_reg is used to write the content of a 16 bits wide peripheral
\r
92 * @param reg_addr Address in the processor's memory map of the register to
\r
94 * @param value Value to be written into the peripheral register.
\r
100 uint_fast16_t value
\r
103 /***************************************************************************//**
\r
104 * HW_get_16bit_reg is used to read the content of a 16 bits wide peripheral
\r
107 * @param reg_addr Address in the processor's memory map of the register to
\r
109 * @return 16 bits value read from the peripheral register.
\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
121 * @param reg_addr Address in the processor's memory map of the register to
\r
123 * @param shift Bit offset of the register field to be read within the
\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
129 void HW_set_16bit_reg_field
\r
133 uint_fast16_t mask,
\r
134 uint_fast16_t value
\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
141 * @param reg_addr Address in the processor's memory map of the register to
\r
143 * @param shift Bit offset of the register field to be written within the
\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
148 * @return 16 bits value containing the register field value specified
\r
151 uint16_t HW_get_16bit_reg_field
\r
158 /***************************************************************************//**
\r
159 * HW_set_8bit_reg is used to write the content of a 8 bits wide peripheral
\r
162 * @param reg_addr Address in the processor's memory map of the register to
\r
164 * @param value Value to be written into the peripheral register.
\r
173 /***************************************************************************//**
\r
174 * HW_get_8bit_reg is used to read the content of a 8 bits wide peripheral
\r
177 * @param reg_addr Address in the processor's memory map of the register to
\r
179 * @return 8 bits value read from the peripheral register.
\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
191 * @param reg_addr Address in the processor's memory map of the register to
\r
193 * @param shift Bit offset of the register field to be read within the
\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
199 void HW_set_8bit_reg_field
\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
211 * @param reg_addr Address in the processor's memory map of the register to
\r
213 * @param shift Bit offset of the register field to be written within the
\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
218 * @return 8 bits value containing the register field value specified
\r
221 uint8_t HW_get_8bit_reg_field
\r
228 #endif /* HW_REG_ACCESS */
\r