4 * This file is part of BeRTOS.
6 * Bertos is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * As a special exception, you may use this file as part of a free software
21 * library without restriction. Specifically, if other files instantiate
22 * templates or use macros or inline functions from this file, or you compile
23 * this file and link it with other files to produce an executable, this
24 * file does not by itself cause the resulting executable to be covered by
25 * the GNU General Public License. This exception does not however
26 * invalidate any other reasons why the executable file might be covered by
27 * the GNU General Public License.
29 * Copyright 2007 Develer S.r.l. (http://www.develer.com/)
34 * \author Francesco Sacchi <batt@develer.com>
36 * AT91 Memory controller.
37 * This file is based on NUT/OS implementation. See license below.
41 * Copyright (C) 2005-2006 by egnite Software GmbH. All rights reserved.
43 * Redistribution and use in source and binary forms, with or without
44 * modification, are permitted provided that the following conditions
47 * 1. Redistributions of source code must retain the above copyright
48 * notice, this list of conditions and the following disclaimer.
49 * 2. Redistributions in binary form must reproduce the above copyright
50 * notice, this list of conditions and the following disclaimer in the
51 * documentation and/or other materials provided with the distribution.
52 * 3. Neither the name of the copyright holders nor the names of
53 * contributors may be used to endorse or promote products derived
54 * from this software without specific prior written permission.
56 * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS
57 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
58 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
59 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE
60 * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
61 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
62 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
63 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
64 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
65 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
66 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
69 * For additional information see http://www.ethernut.de/
75 #define MC_RCR_OFF 0x00000000 ///< MC remap control register offset.
76 #define MC_RCR (*((reg32_t *)(MC_BASE + MC_RCR_OFF))) ///< MC remap control register address.
77 #define MC_RCB 0 ///< Remap command.
79 #define MC_ASR_OFF 0x00000004 ///< MC abort status register offset.
80 #define MC_ASR (*((reg32_t *)(MC_BASE + MC_ASR_OFF))) ///< MC abort status register address.
81 #define MC_UNDADD 0 ///< Undefined Addess Abort status.
82 #define MC_MISADD 1 ///< Misaligned Addess Abort status.
83 #define MC_ABTSZ_MASK 0x00000300 ///< Abort size status mask.
84 #define MC_ABTSZ_BYTE 0x00000000 ///< Byte size abort.
85 #define MC_ABTSZ_HWORD 0x00000100 ///< Half-word size abort.
86 #define MC_ABTSZ_WORD 0x00000200 ///< Word size abort.
87 #define MC_ABTTYP_MASK 0x00000C00 ///< Abort type status mask.
88 #define MC_ABTTYP_DATAR 0x00000000 ///< Data read abort.
89 #define MC_ABTTYP_DATAW 0x00000400 ///< Data write abort.
90 #define MC_ABTTYP_FETCH 0x00000800 ///< Code fetch abort.
91 #define MC_MST_PDC 0x00020000 ///< PDC abort source.
92 #define MC_MST_ARM 0x00040000 ///< ARM abort source.
93 #define MC_SVMST_PDC 0x02000000 ///< Saved PDC abort source.
94 #define MC_SVMST_ARM 0x04000000 ///< Saved ARM abort source.
96 #define MC_AASR_OFF 0x00000008 ///< MC abort address status register offset.
97 #define MC_AASR (*((reg32_t *)(MC_BASE + MC_AASR_OFF))) ///< MC abort address status register address.
99 #define MC_FMR_OFF 0x00000060 ///< MC flash mode register offset.
100 #define MC_FMR (*((reg32_t *)(MC_BASE + MC_FMR_OFF))) ///< MC flash mode register address.
101 #define MC_FRDY 0 ///< Flash ready.
102 #define MC_LOCKE 2 ///< Lock error.
103 #define MC_PROGE 3 ///< Programming error.
104 #define MC_NEBP 7 ///< No erase before programming.
105 #define MC_FWS_MASK 0x00000300 ///< Flash wait state mask.
106 #define MC_FWS_1R2W 0x00000000 ///< 1 cycle for read, 2 for write operations.
107 #define MC_FWS_2R3W 0x00000100 ///< 2 cycles for read, 3 for write operations.
108 #define MC_FWS_3R4W 0x00000200 ///< 3 cycles for read, 4 for write operations.
109 #define MC_FWS_4R4W 0x00000300 ///< 4 cycles for read and write operations.
110 #define MC_FMCN_MASK 0x00FF0000 ///< Flash microsecond cycle number mask.
111 #define MC_FMCN_SHIFT 16 ///< Flash microsecond cycle number shift.
113 #define MC_FCR_OFF 0x00000064 ///< MC flash command register offset.
114 #define MC_FCR (*((reg32_t *)(MC_BASE + MC_FCR_OFF))) ///< MC flash command register address.
115 #define MC_FCMD_MASK 0x0000000F ///< Flash command mask.
116 #define MC_FCMD_NOP 0x00000000 ///< No command.
117 #define MC_FCMD_WP 0x00000001 ///< Write page.
118 #define MC_FCMD_SLB 0x00000002 ///< Set lock bit.
119 #define MC_FCMD_WPL 0x00000003 ///< Write page and lock.
120 #define MC_FCMD_CLB 0x00000004 ///< Clear lock bit.
121 #define MC_FCMD_EA 0x00000008 ///< Erase all.
122 #define MC_FCMD_SGPB 0x0000000B ///< Set general purpose NVM bit.
123 #define MC_FCMD_CGPB 0x0000000D ///< Clear general purpose NVM bit.
124 #define MC_FCMD_SSB 0x0000000F ///< Set security bit.
125 #define MC_PAGEN_MASK 0x0003FF00 ///< Page number mask.
126 #define MC_KEY 0x5A000000 ///< Writing protect key.
128 #define MC_FSR_OFF 0x00000068 ///< MC flash status register offset.
129 #define MC_FSR (*((reg32_t *)(MC_BASE + MC_FSR_OFF))) ///< MC flash status register address.
130 #define MC_SECURITY 4 ///< Security bit status.
132 #define MC_GPNVM0 8 ///< General purpose NVM bit 0.
133 #define MC_GPNVM1 9 ///< General purpose NVM bit 1.
134 #define MC_GPNVM2 10 ///< General purpose NVM bit 2.
136 #define MC_LOCKS0 16 ///< Lock region 0 lock status.
137 #define MC_LOCKS1 17 ///< Lock region 1 lock status.
138 #define MC_LOCKS2 18 ///< Lock region 2 lock status.
139 #define MC_LOCKS3 19 ///< Lock region 3 lock status.
140 #define MC_LOCKS4 20 ///< Lock region 4 lock status.
141 #define MC_LOCKS5 21 ///< Lock region 5 lock status.
142 #define MC_LOCKS6 22 ///< Lock region 6 lock status.
143 #define MC_LOCKS7 23 ///< Lock region 7 lock status.
144 #define MC_LOCKS8 24 ///< Lock region 8 lock status.
145 #define MC_LOCKS9 25 ///< Lock region 9 lock status.
146 #define MC_LOCKS10 26 ///< Lock region 10 lock status.
147 #define MC_LOCKS11 27 ///< Lock region 11 lock status.
148 #define MC_LOCKS12 28 ///< Lock region 12 lock status.
149 #define MC_LOCKS13 29 ///< Lock region 13 lock status.
150 #define MC_LOCKS14 30 ///< Lock region 14 lock status.
151 #define MC_LOCKS15 31 ///< Lock region 15 lock status.
153 #endif /* AT91_MC_H */