]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_EFM32_Gecko_Starter_Kit_Simplicity_Studio/Source/SilLabs_Code/emlib/inc/em_bitband.h
681289ff86d3de5e4070f8f7908bff9575aa2b56
[freertos] / FreeRTOS / Demo / CORTEX_EFM32_Gecko_Starter_Kit_Simplicity_Studio / Source / SilLabs_Code / emlib / inc / em_bitband.h
1 /***************************************************************************//**\r
2  * @file em_bitband.h\r
3  * @brief Bitband Peripheral API\r
4  * @version 4.2.1\r
5  *******************************************************************************\r
6  * @section License\r
7  * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>\r
8  *******************************************************************************\r
9  *\r
10  * Permission is granted to anyone to use this software for any purpose,\r
11  * including commercial applications, and to alter it and redistribute it\r
12  * freely, subject to the following restrictions:\r
13  *\r
14  * 1. The origin of this software must not be misrepresented; you must not\r
15  *    claim that you wrote the original software.\r
16  * 2. Altered source versions must be plainly marked as such, and must not be\r
17  *    misrepresented as being the original software.\r
18  * 3. This notice may not be removed or altered from any source distribution.\r
19  *\r
20  * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no\r
21  * obligation to support this Software. Silicon Labs is providing the\r
22  * Software "AS IS", with no express or implied warranties of any kind,\r
23  * including, but not limited to, any implied warranties of merchantability\r
24  * or fitness for any particular purpose or warranties against infringement\r
25  * of any proprietary rights of a third party.\r
26  *\r
27  * Silicon Labs will not be liable for any consequential, incidental, or\r
28  * special damages, or any other relief, or for any claim by any third party,\r
29  * arising from your use of this Software.\r
30  *\r
31  ******************************************************************************/\r
32 \r
33 #ifndef __SILICON_LABS_EM_BITBAND_H__\r
34 #define __SILICON_LABS_EM_BITBAND_H__\r
35 \r
36 #include "em_bus.h"\r
37 \r
38 #ifdef __cplusplus\r
39 extern "C" {\r
40 #endif\r
41 \r
42 /***************************************************************************//**\r
43  * @addtogroup EM_Library\r
44  * @{\r
45  ******************************************************************************/\r
46 \r
47 /***************************************************************************//**\r
48  * @addtogroup BITBAND\r
49  * @brief BITBAND Peripheral API (deprecated - use em_bus.h)\r
50  * @{\r
51  ******************************************************************************/\r
52 \r
53 /***************************************************************************//**\r
54  * @brief\r
55  *   Perform bit-band operation on peripheral memory location.\r
56  *\r
57  * @details\r
58  *   Bit-banding provides atomic read-modify-write cycle for single bit\r
59  *   modification. Please refer to the reference manual for further details\r
60  *   about bit-banding.\r
61  *\r
62  * @note\r
63  *   This function is only atomic on cores which fully support bitbanding.\r
64  *\r
65  * @param[in] addr Peripheral address location to modify bit in.\r
66  *\r
67  * @param[in] bit Bit position to modify, 0-31.\r
68  *\r
69  * @param[in] val Value to set bit to, 0 or 1.\r
70  ******************************************************************************/\r
71 #define BITBAND_Peripheral(addr, bit, val) BUS_RegBitWrite(addr, bit, val)\r
72 \r
73 \r
74 /***************************************************************************//**\r
75  * @brief\r
76  *   Perform a read operation on the peripheral bit-band memory location.\r
77  *\r
78  * @details\r
79  *   This function reads a single bit from the peripheral bit-band alias region.\r
80  *   Bit-banding provides atomic read-modify-write cycle for single bit\r
81  *   modification. Please refer to the reference manual for further details\r
82  *   about bit-banding.\r
83  *\r
84  * @param[in] addr   Peripheral address location to read.\r
85  *\r
86  * @param[in] bit    Bit position to read, 0-31.\r
87  *\r
88  * @return           Value of the requested bit.\r
89  ******************************************************************************/\r
90 #define BITBAND_PeripheralRead(addr, bit) BUS_RegBitRead(addr, bit)\r
91 \r
92 \r
93 /***************************************************************************//**\r
94  * @brief\r
95  *   Perform bit-band operation on SRAM memory location.\r
96  *\r
97  * @details\r
98  *   Bit-banding provides atomic read-modify-write cycle for single bit\r
99  *   modification. Please refer to the reference manual for further details\r
100  *   about bit-banding.\r
101  *\r
102  * @note\r
103  *   This function is only atomic on cores which fully support bitbanding.\r
104  *\r
105  * @param[in] addr SRAM address location to modify bit in.\r
106  *\r
107  * @param[in] bit Bit position to modify, 0-31.\r
108  *\r
109  * @param[in] val Value to set bit to, 0 or 1.\r
110  ******************************************************************************/\r
111 #define BITBAND_SRAM(addr, bit, val) BUS_RamBitWrite(addr, bit, val)\r
112 \r
113 \r
114 /***************************************************************************//**\r
115  * @brief\r
116  *   Read a single bit from the SRAM bit-band alias region.\r
117  *\r
118  * @details\r
119  *   This function reads a single bit from the SRAM bit-band alias region.\r
120  *   Bit-banding provides atomic read-modify-write cycle for single bit\r
121  *   modification. Please refer to the reference manual for further details\r
122  *   about bit-banding.\r
123  *\r
124  * @param[in] addr    SRAM address location to modify bit in.\r
125  *\r
126  * @param[in] bit     Bit position to modify, 0-31.\r
127  *\r
128  * @return            Value of the requested bit.\r
129  ******************************************************************************/\r
130 #define BITBAND_SRAMRead(addr, bit) BUS_RamBitRead(addr, bit)\r
131 \r
132 /** @} (end addtogroup BITBAND) */\r
133 /** @} (end addtogroup EM_Library) */\r
134 \r
135 #ifdef __cplusplus\r
136 }\r
137 #endif\r
138 \r
139 #endif /* __SILICON_LABS_EM_BITBAND_H__ */\r