1 /* Copyright (c) 2007 Anatoly Sokolov
2    Copyright (c) 2010 Atmel Corporation
3    All rights reserved.
4 
5    Redistribution and use in source and binary forms, with or without
6    modification, are permitted provided that the following conditions are met:
7 
8    * Redistributions of source code must retain the above copyright
9      notice, this list of conditions and the following disclaimer.
10 
11    * Redistributions in binary form must reproduce the above copyright
12      notice, this list of conditions and the following disclaimer in
13      the documentation and/or other materials provided with the
14      distribution.
15 
16    * Neither the name of the copyright holders nor the names of
17      contributors may be used to endorse or promote products derived
18      from this software without specific prior written permission.
19 
20   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   POSSIBILITY OF SUCH DAMAGE. */
31 
32 /* $Id: iousb162.h 2456 2014-11-19 09:57:29Z saaadhu $ */
33 
34 /* avr/iousb162.h - definitions for AT90USB162 */
35 
36 #ifndef _AVR_AT90USB162_H_
37 #define _AVR_AT90USB162_H_ 1
38 
39 #include <avr/iousbxx2.h>
40 
41 /* Constants */
42 #define SPM_PAGESIZE 128
43 #define RAMSTART     0x100
44 #define RAMEND       0x2FF
45 #define XRAMEND      RAMEND
46 #define E2END        0x1FF
47 #define E2PAGESIZE   4
48 #define FLASHEND     0x3FFF
49 
50 
51 /* Fuses */
52 #define FUSE_MEMORY_SIZE 3
53 
54 /* Low Fuse Byte */
55 #define FUSE_CKSEL0      (unsigned char)~_BV(0)
56 #define FUSE_CKSEL1      (unsigned char)~_BV(1)
57 #define FUSE_CKSEL2      (unsigned char)~_BV(2)
58 #define FUSE_CKSEL3      (unsigned char)~_BV(3)
59 #define FUSE_SUT0        (unsigned char)~_BV(4)
60 #define FUSE_SUT1        (unsigned char)~_BV(5)
61 #define FUSE_CKOUT       (unsigned char)~_BV(6)
62 #define FUSE_CKDIV8      (unsigned char)~_BV(7)
63 #define LFUSE_DEFAULT (FUSE_CKSEL0 & FUSE_SUT1 & FUSE_CKDIV8)
64 
65 /* High Fuse Byte */
66 #define FUSE_BOOTRST     (unsigned char)~_BV(0)
67 #define FUSE_BOOTSZ0     (unsigned char)~_BV(1)
68 #define FUSE_BOOTSZ1     (unsigned char)~_BV(2)
69 #define FUSE_EESAVE      (unsigned char)~_BV(3)
70 #define FUSE_WDTON       (unsigned char)~_BV(4)
71 #define FUSE_SPIEN       (unsigned char)~_BV(5)
72 #define FUSE_RSTDSBL     (unsigned char)~_BV(6)
73 #define FUSE_DWEN        (unsigned char)~_BV(7)
74 #define HFUSE_DEFAULT (FUSE_BOOTSZ0 & FUSE_BOOTSZ1 & FUSE_SPIEN)
75 
76 /* Extended Fuse Byte */
77 #define FUSE_BODLEVEL0   (unsigned char)~_BV(0)
78 #define FUSE_BODLEVEL1   (unsigned char)~_BV(1)
79 #define FUSE_BODLEVEL2   (unsigned char)~_BV(2)
80 #define FUSE_HWBE        (unsigned char)~_BV(3)
81 #define EFUSE_DEFAULT (FUSE_BODLEVEL0 & FUSE_BODLEVEL1 & FUSE_HWBE)
82 
83 
84 /* Lock Bits */
85 #define __LOCK_BITS_EXIST
86 #define __BOOT_LOCK_BITS_0_EXIST
87 #define __BOOT_LOCK_BITS_1_EXIST
88 
89 
90 /* Signature */
91 #define SIGNATURE_0 0x1E
92 #define SIGNATURE_1 0x94
93 #define SIGNATURE_2 0x82
94 
95 
96 #define SLEEP_MODE_IDLE (0x00<<1)
97 #define SLEEP_MODE_PWR_DOWN (0x02<<1)
98 #define SLEEP_MODE_PWR_SAVE (0x03<<1)
99 #define SLEEP_MODE_STANDBY (0x06<<1)
100 #define SLEEP_MODE_EXT_STANDBY (0x07<<1)
101 
102 
103 #endif /* _AVR_AT90USB162_H_ */
104