RTEMS CPU Kit with SuperCore  4.11.3
lock.h
Go to the documentation of this file.
1 
148 /*
149  * Copyright (c) 2007, Atmel Corporation
150  * All rights reserved.
151  *
152  * Redistribution and use in source and binary forms, with or without
153  * modification, are permitted provided that the following conditions are met:
154  *
155  * * Redistributions of source code must retain the above copyright
156  * notice, this list of conditions and the following disclaimer.
157  *
158  * * Redistributions in binary form must reproduce the above copyright
159  * notice, this list of conditions and the following disclaimer in
160  * the documentation and/or other materials provided with the
161  * distribution.
162  *
163  * * Neither the name of the copyright holders nor the names of
164  * contributors may be used to endorse or promote products derived
165  * from this software without specific prior written permission.
166  *
167  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
168  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
169  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
170  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
171  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
172  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
173  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
174  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
175  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
176  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
177  * POSSIBILITY OF SUCH DAMAGE.
178  */
179 
180 #ifndef _AVR_LOCK_H_
181 #define _AVR_LOCK_H_ 1
182 
190 #ifndef __ASSEMBLER__
191 
192 #ifndef LOCKMEM
193 #define LOCKMEM __attribute__((section (".lock")))
194 #endif
195 
196 #ifndef LOCKBITS
197 #define LOCKBITS unsigned char __lock LOCKMEM
198 #endif
199 
200 #endif /* !__ASSEMBLER */
201 
202 
203 /* Lock Bit Modes */
204 #if defined(__LOCK_BITS_EXIST)
205 #define LB_MODE_1 (0xFF)
206 #define LB_MODE_2 (0xFE)
207 #define LB_MODE_3 (0xFC)
208 #endif
209 
210 #if defined(__BOOT_LOCK_BITS_0_EXIST)
211 #define BLB0_MODE_1 (0xFF)
212 #define BLB0_MODE_2 (0xFB)
213 #define BLB0_MODE_3 (0xF3)
214 #define BLB0_MODE_4 (0xF7)
215 #endif
216 
217 #if defined(__BOOT_LOCK_BITS_1_EXIST)
218 #define BLB1_MODE_1 (0xFF)
219 #define BLB1_MODE_2 (0xEF)
220 #define BLB1_MODE_3 (0xCF)
221 #define BLB1_MODE_4 (0xDF)
222 #endif
223 
224 #if defined(__BOOT_LOCK_APPLICATION_TABLE_BITS_EXIST)
225 #define BLBAT0 ~_BV(2)
226 #define BLBAT1 ~_BV(3)
227 #endif
228 
229 #if defined(__BOOT_LOCK_APPLICATION_BITS_EXIST)
230 #define BLBA0 ~_BV(4)
231 #define BLBA1 ~_BV(5)
232 #endif
233 
234 #if defined(__BOOT_LOCK_BOOT_BITS_EXIST)
235 #define BLBB0 ~_BV(6)
236 #define BLBB1 ~_BV(7)
237 #endif
238 
239 
240 #define LOCKBITS_DEFAULT (0xFF)
241 
243 #endif /* _AVR_LOCK_H_ */