| 1 |
610 |
jeremybenn |
//*****************************************************************************
|
| 2 |
|
|
//
|
| 3 |
|
|
// hw_flash.h - Macros used when accessing the flash controller.
|
| 4 |
|
|
//
|
| 5 |
|
|
// Copyright (c) 2005-2008 Luminary Micro, Inc. All rights reserved.
|
| 6 |
|
|
//
|
| 7 |
|
|
// Software License Agreement
|
| 8 |
|
|
//
|
| 9 |
|
|
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
|
| 10 |
|
|
// exclusively on LMI's microcontroller products.
|
| 11 |
|
|
//
|
| 12 |
|
|
// The software is owned by LMI and/or its suppliers, and is protected under
|
| 13 |
|
|
// applicable copyright laws. All rights are reserved. You may not combine
|
| 14 |
|
|
// this software with "viral" open-source software in order to form a larger
|
| 15 |
|
|
// program. Any use in violation of the foregoing restrictions may subject
|
| 16 |
|
|
// the user to criminal sanctions under applicable laws, as well as to civil
|
| 17 |
|
|
// liability for the breach of the terms and conditions of this license.
|
| 18 |
|
|
//
|
| 19 |
|
|
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
| 20 |
|
|
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
| 21 |
|
|
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
| 22 |
|
|
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
|
| 23 |
|
|
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
| 24 |
|
|
//
|
| 25 |
|
|
// This is part of revision 2523 of the Stellaris Peripheral Driver Library.
|
| 26 |
|
|
//
|
| 27 |
|
|
//*****************************************************************************
|
| 28 |
|
|
|
| 29 |
|
|
#ifndef __HW_FLASH_H__
|
| 30 |
|
|
#define __HW_FLASH_H__
|
| 31 |
|
|
|
| 32 |
|
|
//*****************************************************************************
|
| 33 |
|
|
//
|
| 34 |
|
|
// The following are defines for the FLASH register offsets.
|
| 35 |
|
|
//
|
| 36 |
|
|
//*****************************************************************************
|
| 37 |
|
|
#define FLASH_FMA 0x400FD000 // Memory address register
|
| 38 |
|
|
#define FLASH_FMD 0x400FD004 // Memory data register
|
| 39 |
|
|
#define FLASH_FMC 0x400FD008 // Memory control register
|
| 40 |
|
|
#define FLASH_FCRIS 0x400FD00C // Raw interrupt status register
|
| 41 |
|
|
#define FLASH_FCIM 0x400FD010 // Interrupt mask register
|
| 42 |
|
|
#define FLASH_FCMISC 0x400FD014 // Interrupt status register
|
| 43 |
|
|
#define FLASH_RMCTL 0x400FE0F0 // ROM Control
|
| 44 |
|
|
#define FLASH_RMVER 0x400FE0F4 // ROM Version Register
|
| 45 |
|
|
#define FLASH_FMPRE 0x400FE130 // FLASH read protect register
|
| 46 |
|
|
#define FLASH_FMPPE 0x400FE134 // FLASH program protect register
|
| 47 |
|
|
#define FLASH_USECRL 0x400FE140 // uSec reload register
|
| 48 |
|
|
#define FLASH_USERDBG 0x400FE1D0 // User Debug
|
| 49 |
|
|
#define FLASH_USERREG0 0x400FE1E0 // User Register 0
|
| 50 |
|
|
#define FLASH_USERREG1 0x400FE1E4 // User Register 1
|
| 51 |
|
|
#define FLASH_USERREG2 0x400FE1E8 // User Register 2
|
| 52 |
|
|
#define FLASH_USERREG3 0x400FE1EC // User Register 3
|
| 53 |
|
|
#define FLASH_FMPRE0 0x400FE200 // FLASH read protect register 0
|
| 54 |
|
|
#define FLASH_FMPRE1 0x400FE204 // FLASH read protect register 1
|
| 55 |
|
|
#define FLASH_FMPRE2 0x400FE208 // FLASH read protect register 2
|
| 56 |
|
|
#define FLASH_FMPRE3 0x400FE20C // FLASH read protect register 3
|
| 57 |
|
|
#define FLASH_FMPPE0 0x400FE400 // FLASH program protect register 0
|
| 58 |
|
|
#define FLASH_FMPPE1 0x400FE404 // FLASH program protect register 1
|
| 59 |
|
|
#define FLASH_FMPPE2 0x400FE408 // FLASH program protect register 2
|
| 60 |
|
|
#define FLASH_FMPPE3 0x400FE40C // FLASH program protect register 3
|
| 61 |
|
|
|
| 62 |
|
|
//*****************************************************************************
|
| 63 |
|
|
//
|
| 64 |
|
|
// The following are defines for the bit fields in the FLASH_FMC register.
|
| 65 |
|
|
//
|
| 66 |
|
|
//*****************************************************************************
|
| 67 |
|
|
#define FLASH_FMC_WRKEY_M 0xFFFF0000 // FLASH write key mask
|
| 68 |
|
|
#define FLASH_FMC_WRKEY 0xA4420000 // FLASH write key
|
| 69 |
|
|
#define FLASH_FMC_COMT 0x00000008 // Commit user register
|
| 70 |
|
|
#define FLASH_FMC_MERASE 0x00000004 // Mass erase FLASH
|
| 71 |
|
|
#define FLASH_FMC_ERASE 0x00000002 // Erase FLASH page
|
| 72 |
|
|
#define FLASH_FMC_WRITE 0x00000001 // Write FLASH word
|
| 73 |
|
|
#define FLASH_FMC_WRKEY_S 16
|
| 74 |
|
|
|
| 75 |
|
|
//*****************************************************************************
|
| 76 |
|
|
//
|
| 77 |
|
|
// The following are defines for the bit fields in the FLASH_FCRIS register.
|
| 78 |
|
|
//
|
| 79 |
|
|
//*****************************************************************************
|
| 80 |
|
|
#define FLASH_FCRIS_PRIS 0x00000002 // Programming Raw Interrupt
|
| 81 |
|
|
// Status.
|
| 82 |
|
|
#define FLASH_FCRIS_ARIS 0x00000001 // Access Raw Interrupt Status.
|
| 83 |
|
|
|
| 84 |
|
|
//*****************************************************************************
|
| 85 |
|
|
//
|
| 86 |
|
|
// The following are defines for the bit fields in the FLASH_FCIM register.
|
| 87 |
|
|
//
|
| 88 |
|
|
//*****************************************************************************
|
| 89 |
|
|
#define FLASH_FCIM_PMASK 0x00000002 // Programming Interrupt Mask.
|
| 90 |
|
|
#define FLASH_FCIM_AMASK 0x00000001 // Access Interrupt Mask.
|
| 91 |
|
|
|
| 92 |
|
|
//*****************************************************************************
|
| 93 |
|
|
//
|
| 94 |
|
|
// The following are defines for the bit fields in the FLASH_FMIS register.
|
| 95 |
|
|
//
|
| 96 |
|
|
//*****************************************************************************
|
| 97 |
|
|
#define FLASH_FCMISC_PMISC 0x00000002 // Programming Masked Interrupt
|
| 98 |
|
|
// Status and Clear.
|
| 99 |
|
|
#define FLASH_FCMISC_AMISC 0x00000001 // Access Masked Interrupt Status
|
| 100 |
|
|
// and Clear.
|
| 101 |
|
|
|
| 102 |
|
|
//*****************************************************************************
|
| 103 |
|
|
//
|
| 104 |
|
|
// The following are defines for the bit fields in the FLASH_FMPRE and
|
| 105 |
|
|
// FLASH_FMPPE registers.
|
| 106 |
|
|
//
|
| 107 |
|
|
//*****************************************************************************
|
| 108 |
|
|
#define FLASH_FMP_BLOCK_31 0x80000000 // Enable for block 31
|
| 109 |
|
|
#define FLASH_FMP_BLOCK_30 0x40000000 // Enable for block 30
|
| 110 |
|
|
#define FLASH_FMP_BLOCK_29 0x20000000 // Enable for block 29
|
| 111 |
|
|
#define FLASH_FMP_BLOCK_28 0x10000000 // Enable for block 28
|
| 112 |
|
|
#define FLASH_FMP_BLOCK_27 0x08000000 // Enable for block 27
|
| 113 |
|
|
#define FLASH_FMP_BLOCK_26 0x04000000 // Enable for block 26
|
| 114 |
|
|
#define FLASH_FMP_BLOCK_25 0x02000000 // Enable for block 25
|
| 115 |
|
|
#define FLASH_FMP_BLOCK_24 0x01000000 // Enable for block 24
|
| 116 |
|
|
#define FLASH_FMP_BLOCK_23 0x00800000 // Enable for block 23
|
| 117 |
|
|
#define FLASH_FMP_BLOCK_22 0x00400000 // Enable for block 22
|
| 118 |
|
|
#define FLASH_FMP_BLOCK_21 0x00200000 // Enable for block 21
|
| 119 |
|
|
#define FLASH_FMP_BLOCK_20 0x00100000 // Enable for block 20
|
| 120 |
|
|
#define FLASH_FMP_BLOCK_19 0x00080000 // Enable for block 19
|
| 121 |
|
|
#define FLASH_FMP_BLOCK_18 0x00040000 // Enable for block 18
|
| 122 |
|
|
#define FLASH_FMP_BLOCK_17 0x00020000 // Enable for block 17
|
| 123 |
|
|
#define FLASH_FMP_BLOCK_16 0x00010000 // Enable for block 16
|
| 124 |
|
|
#define FLASH_FMP_BLOCK_15 0x00008000 // Enable for block 15
|
| 125 |
|
|
#define FLASH_FMP_BLOCK_14 0x00004000 // Enable for block 14
|
| 126 |
|
|
#define FLASH_FMP_BLOCK_13 0x00002000 // Enable for block 13
|
| 127 |
|
|
#define FLASH_FMP_BLOCK_12 0x00001000 // Enable for block 12
|
| 128 |
|
|
#define FLASH_FMP_BLOCK_11 0x00000800 // Enable for block 11
|
| 129 |
|
|
#define FLASH_FMP_BLOCK_10 0x00000400 // Enable for block 10
|
| 130 |
|
|
#define FLASH_FMP_BLOCK_9 0x00000200 // Enable for block 9
|
| 131 |
|
|
#define FLASH_FMP_BLOCK_8 0x00000100 // Enable for block 8
|
| 132 |
|
|
#define FLASH_FMP_BLOCK_7 0x00000080 // Enable for block 7
|
| 133 |
|
|
#define FLASH_FMP_BLOCK_6 0x00000040 // Enable for block 6
|
| 134 |
|
|
#define FLASH_FMP_BLOCK_5 0x00000020 // Enable for block 5
|
| 135 |
|
|
#define FLASH_FMP_BLOCK_4 0x00000010 // Enable for block 4
|
| 136 |
|
|
#define FLASH_FMP_BLOCK_3 0x00000008 // Enable for block 3
|
| 137 |
|
|
#define FLASH_FMP_BLOCK_2 0x00000004 // Enable for block 2
|
| 138 |
|
|
#define FLASH_FMP_BLOCK_1 0x00000002 // Enable for block 1
|
| 139 |
|
|
#define FLASH_FMP_BLOCK_0 0x00000001 // Enable for block 0
|
| 140 |
|
|
|
| 141 |
|
|
//*****************************************************************************
|
| 142 |
|
|
//
|
| 143 |
|
|
// The following are defines for the bit fields in the FLASH_USECRL register.
|
| 144 |
|
|
//
|
| 145 |
|
|
//*****************************************************************************
|
| 146 |
|
|
#define FLASH_USECRL_M 0x000000FF // Microsecond Reload Value.
|
| 147 |
|
|
#define FLASH_USECRL_S 0
|
| 148 |
|
|
|
| 149 |
|
|
//*****************************************************************************
|
| 150 |
|
|
//
|
| 151 |
|
|
// The following are defines for the erase size of the FLASH block that is
|
| 152 |
|
|
// erased by an erase operation, and the protect size is the size of the FLASH
|
| 153 |
|
|
// block that is protected by each protection register.
|
| 154 |
|
|
//
|
| 155 |
|
|
//*****************************************************************************
|
| 156 |
|
|
#define FLASH_PROTECT_SIZE 0x00000800
|
| 157 |
|
|
#define FLASH_ERASE_SIZE 0x00000400
|
| 158 |
|
|
|
| 159 |
|
|
//*****************************************************************************
|
| 160 |
|
|
//
|
| 161 |
|
|
// The following are defines for the bit fields in the FLASH_FMA register.
|
| 162 |
|
|
//
|
| 163 |
|
|
//*****************************************************************************
|
| 164 |
|
|
#define FLASH_FMA_OFFSET_M 0x0003FFFF // Address Offset.
|
| 165 |
|
|
#define FLASH_FMA_OFFSET_S 0
|
| 166 |
|
|
|
| 167 |
|
|
//*****************************************************************************
|
| 168 |
|
|
//
|
| 169 |
|
|
// The following are defines for the bit fields in the FLASH_FMD register.
|
| 170 |
|
|
//
|
| 171 |
|
|
//*****************************************************************************
|
| 172 |
|
|
#define FLASH_FMD_DATA_M 0xFFFFFFFF // Data Value.
|
| 173 |
|
|
#define FLASH_FMD_DATA_S 0
|
| 174 |
|
|
|
| 175 |
|
|
//*****************************************************************************
|
| 176 |
|
|
//
|
| 177 |
|
|
// The following are defines for the bit fields in the FLASH_USERDBG register.
|
| 178 |
|
|
//
|
| 179 |
|
|
//*****************************************************************************
|
| 180 |
|
|
#define FLASH_USERDBG_NW 0x80000000 // User Debug Not Written.
|
| 181 |
|
|
#define FLASH_USERDBG_DATA_M 0x7FFFFFFC // User Data.
|
| 182 |
|
|
#define FLASH_USERDBG_DBG1 0x00000002 // Debug Control 1.
|
| 183 |
|
|
#define FLASH_USERDBG_DBG0 0x00000001 // Debug Control 0.
|
| 184 |
|
|
#define FLASH_USERDBG_DATA_S 2
|
| 185 |
|
|
|
| 186 |
|
|
//*****************************************************************************
|
| 187 |
|
|
//
|
| 188 |
|
|
// The following are defines for the bit fields in the FLASH_USERREG0 register.
|
| 189 |
|
|
//
|
| 190 |
|
|
//*****************************************************************************
|
| 191 |
|
|
#define FLASH_USERREG0_NW 0x80000000 // Not Written.
|
| 192 |
|
|
#define FLASH_USERREG0_DATA_M 0x7FFFFFFF // User Data.
|
| 193 |
|
|
#define FLASH_USERREG0_DATA_S 0
|
| 194 |
|
|
|
| 195 |
|
|
//*****************************************************************************
|
| 196 |
|
|
//
|
| 197 |
|
|
// The following are defines for the bit fields in the FLASH_USERREG1 register.
|
| 198 |
|
|
//
|
| 199 |
|
|
//*****************************************************************************
|
| 200 |
|
|
#define FLASH_USERREG1_NW 0x80000000 // Not Written.
|
| 201 |
|
|
#define FLASH_USERREG1_DATA_M 0x7FFFFFFF // User Data.
|
| 202 |
|
|
#define FLASH_USERREG1_DATA_S 0
|
| 203 |
|
|
|
| 204 |
|
|
//*****************************************************************************
|
| 205 |
|
|
//
|
| 206 |
|
|
// The following are defines for the bit fields in the FLASH_RMCTL register.
|
| 207 |
|
|
//
|
| 208 |
|
|
//*****************************************************************************
|
| 209 |
|
|
#define FLASH_RMCTL_BA 0x00000001 // Boot Alias.
|
| 210 |
|
|
|
| 211 |
|
|
//*****************************************************************************
|
| 212 |
|
|
//
|
| 213 |
|
|
// The following are defines for the bit fields in the FLASH_RMVER register.
|
| 214 |
|
|
//
|
| 215 |
|
|
//*****************************************************************************
|
| 216 |
|
|
#define FLASH_RMVER_CONT_M 0xFF000000 // ROM Contents.
|
| 217 |
|
|
#define FLASH_RMVER_CONT_LM 0x00000000 // Boot Loader & DriverLib
|
| 218 |
|
|
#define FLASH_RMVER_SIZE_M 0x00FF0000 // ROM Size.
|
| 219 |
|
|
#define FLASH_RMVER_SIZE_11K 0x00000000 // 11KB Size
|
| 220 |
|
|
#define FLASH_RMVER_VER_M 0x0000FF00 // ROM Version.
|
| 221 |
|
|
#define FLASH_RMVER_REV_M 0x000000FF // ROM Revision.
|
| 222 |
|
|
#define FLASH_RMVER_VER_S 8
|
| 223 |
|
|
#define FLASH_RMVER_REV_S 0
|
| 224 |
|
|
|
| 225 |
|
|
//*****************************************************************************
|
| 226 |
|
|
//
|
| 227 |
|
|
// The following are defines for the bit fields in the FLASH_USERREG2 register.
|
| 228 |
|
|
//
|
| 229 |
|
|
//*****************************************************************************
|
| 230 |
|
|
#define FLASH_USERREG2_NW 0x80000000 // Not Written.
|
| 231 |
|
|
#define FLASH_USERREG2_DATA_M 0x7FFFFFFF // User Data.
|
| 232 |
|
|
#define FLASH_USERREG2_DATA_S 0
|
| 233 |
|
|
|
| 234 |
|
|
//*****************************************************************************
|
| 235 |
|
|
//
|
| 236 |
|
|
// The following are defines for the bit fields in the FLASH_USERREG3 register.
|
| 237 |
|
|
//
|
| 238 |
|
|
//*****************************************************************************
|
| 239 |
|
|
#define FLASH_USERREG3_NW 0x80000000 // Not Written.
|
| 240 |
|
|
#define FLASH_USERREG3_DATA_M 0x7FFFFFFF // User Data.
|
| 241 |
|
|
#define FLASH_USERREG3_DATA_S 0
|
| 242 |
|
|
|
| 243 |
|
|
//*****************************************************************************
|
| 244 |
|
|
//
|
| 245 |
|
|
// The following definitions are deprecated.
|
| 246 |
|
|
//
|
| 247 |
|
|
//*****************************************************************************
|
| 248 |
|
|
#ifndef DEPRECATED
|
| 249 |
|
|
|
| 250 |
|
|
//*****************************************************************************
|
| 251 |
|
|
//
|
| 252 |
|
|
// The following are deprecated defines for the bit fields in the FLASH_FMC
|
| 253 |
|
|
// register.
|
| 254 |
|
|
//
|
| 255 |
|
|
//*****************************************************************************
|
| 256 |
|
|
#define FLASH_FMC_WRKEY_MASK 0xFFFF0000 // FLASH write key mask
|
| 257 |
|
|
|
| 258 |
|
|
//*****************************************************************************
|
| 259 |
|
|
//
|
| 260 |
|
|
// The following are deprecated defines for the bit fields in the FLASH_FCRIS
|
| 261 |
|
|
// register.
|
| 262 |
|
|
//
|
| 263 |
|
|
//*****************************************************************************
|
| 264 |
|
|
#define FLASH_FCRIS_PROGRAM 0x00000002 // Programming status
|
| 265 |
|
|
#define FLASH_FCRIS_ACCESS 0x00000001 // Invalid access status
|
| 266 |
|
|
|
| 267 |
|
|
//*****************************************************************************
|
| 268 |
|
|
//
|
| 269 |
|
|
// The following are deprecated defines for the bit fields in the FLASH_FCIM
|
| 270 |
|
|
// register.
|
| 271 |
|
|
//
|
| 272 |
|
|
//*****************************************************************************
|
| 273 |
|
|
#define FLASH_FCIM_PROGRAM 0x00000002 // Programming mask
|
| 274 |
|
|
#define FLASH_FCIM_ACCESS 0x00000001 // Invalid access mask
|
| 275 |
|
|
|
| 276 |
|
|
//*****************************************************************************
|
| 277 |
|
|
//
|
| 278 |
|
|
// The following are deprecated defines for the bit fields in the FLASH_FMIS
|
| 279 |
|
|
// register.
|
| 280 |
|
|
//
|
| 281 |
|
|
//*****************************************************************************
|
| 282 |
|
|
#define FLASH_FCMISC_PROGRAM 0x00000002 // Programming status
|
| 283 |
|
|
#define FLASH_FCMISC_ACCESS 0x00000001 // Invalid access status
|
| 284 |
|
|
|
| 285 |
|
|
//*****************************************************************************
|
| 286 |
|
|
//
|
| 287 |
|
|
// The following are deprecated defines for the bit fields in the FLASH_USECRL
|
| 288 |
|
|
// register.
|
| 289 |
|
|
//
|
| 290 |
|
|
//*****************************************************************************
|
| 291 |
|
|
#define FLASH_USECRL_MASK 0x000000FF // Clock per uSec
|
| 292 |
|
|
#define FLASH_USECRL_SHIFT 0
|
| 293 |
|
|
|
| 294 |
|
|
#endif
|
| 295 |
|
|
|
| 296 |
|
|
#endif // __HW_FLASH_H__
|