1 //***************************************************************************** 2 // 3 // hw_flash.h - Macros used when accessing the flash controller. 4 // 5 // Copyright (c) 2005-2011 Texas Instruments Incorporated. All rights reserved. 6 // Software License Agreement 7 // 8 // Texas Instruments (TI) is supplying this software for use solely and 9 // exclusively on TI's microcontroller products. The software is owned by 10 // TI and/or its suppliers, and is protected under applicable copyright 11 // laws. You may not combine this software with "viral" open-source 12 // software in order to form a larger program. 13 // 14 // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 15 // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 16 // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 18 // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 19 // DAMAGES, FOR ANY REASON WHATSOEVER. 20 // 21 // This is part of revision 8264 of the Stellaris Firmware Development Package. 22 // 23 //***************************************************************************** 24 25 #ifndef __HW_FLASH_H__ 26 #define __HW_FLASH_H__ 27 28 //***************************************************************************** 29 // 30 // The following are defines for the FLASH register offsets. 31 // 32 //***************************************************************************** 33 #define FLASH_FMA 0x400FD000 // Flash Memory Address 34 #define FLASH_FMD 0x400FD004 // Flash Memory Data 35 #define FLASH_FMC 0x400FD008 // Flash Memory Control 36 #define FLASH_FCRIS 0x400FD00C // Flash Controller Raw Interrupt 37 // Status 38 #define FLASH_FCIM 0x400FD010 // Flash Controller Interrupt Mask 39 #define FLASH_FCMISC 0x400FD014 // Flash Controller Masked 40 // Interrupt Status and Clear 41 #define FLASH_FMC2 0x400FD020 // Flash Memory Control 2 42 #define FLASH_FWBVAL 0x400FD030 // Flash Write Buffer Valid 43 #define FLASH_FCTL 0x400FD0F8 // Flash Control 44 #define FLASH_FWBN 0x400FD100 // Flash Write Buffer n 45 #define FLASH_FSIZE 0x400FDFC0 // Flash Size 46 #define FLASH_SSIZE 0x400FDFC4 // SRAM Size 47 #define FLASH_ROMSWMAP 0x400FDFCC // ROM Software Map 48 #define FLASH_RMCTL 0x400FE0F0 // ROM Control 49 #define FLASH_FMPRE 0x400FE130 // Flash Memory Protection Read 50 // Enable 51 #define FLASH_FMPPE 0x400FE134 // Flash Memory Protection Program 52 // Enable 53 #define FLASH_USECRL 0x400FE140 // USec Reload 54 #define FLASH_USERDBG 0x400FE1D0 // User Debug 55 #define FLASH_BOOTCFG 0x400FE1D0 // Boot Configuration 56 #define FLASH_USERREG0 0x400FE1E0 // User Register 0 57 #define FLASH_USERREG1 0x400FE1E4 // User Register 1 58 #define FLASH_USERREG2 0x400FE1E8 // User Register 2 59 #define FLASH_USERREG3 0x400FE1EC // User Register 3 60 #define FLASH_FMPRE0 0x400FE200 // Flash Memory Protection Read 61 // Enable 0 62 #define FLASH_FMPRE1 0x400FE204 // Flash Memory Protection Read 63 // Enable 1 64 #define FLASH_FMPRE2 0x400FE208 // Flash Memory Protection Read 65 // Enable 2 66 #define FLASH_FMPRE3 0x400FE20C // Flash Memory Protection Read 67 // Enable 3 68 #define FLASH_FMPRE4 0x400FE210 // Flash Memory Protection Read 69 // Enable 4 70 #define FLASH_FMPRE5 0x400FE214 // Flash Memory Protection Read 71 // Enable 5 72 #define FLASH_FMPRE6 0x400FE218 // Flash Memory Protection Read 73 // Enable 6 74 #define FLASH_FMPRE7 0x400FE21C // Flash Memory Protection Read 75 // Enable 7 76 #define FLASH_FMPPE0 0x400FE400 // Flash Memory Protection Program 77 // Enable 0 78 #define FLASH_FMPPE1 0x400FE404 // Flash Memory Protection Program 79 // Enable 1 80 #define FLASH_FMPPE2 0x400FE408 // Flash Memory Protection Program 81 // Enable 2 82 #define FLASH_FMPPE3 0x400FE40C // Flash Memory Protection Program 83 // Enable 3 84 #define FLASH_FMPPE4 0x400FE410 // Flash Memory Protection Program 85 // Enable 4 86 #define FLASH_FMPPE5 0x400FE414 // Flash Memory Protection Program 87 // Enable 5 88 #define FLASH_FMPPE6 0x400FE418 // Flash Memory Protection Program 89 // Enable 6 90 #define FLASH_FMPPE7 0x400FE41C // Flash Memory Protection Program 91 // Enable 7 92 93 //***************************************************************************** 94 // 95 // The following are defines for the bit fields in the FLASH_FMA register. 96 // 97 //***************************************************************************** 98 #define FLASH_FMA_OFFSET_M 0x0007FFFF // Address Offset 99 #define FLASH_FMA_OFFSET_S 0 100 101 //***************************************************************************** 102 // 103 // The following are defines for the bit fields in the FLASH_FMD register. 104 // 105 //***************************************************************************** 106 #define FLASH_FMD_DATA_M 0xFFFFFFFF // Data Value 107 #define FLASH_FMD_DATA_S 0 108 109 //***************************************************************************** 110 // 111 // The following are defines for the bit fields in the FLASH_FMC register. 112 // 113 //***************************************************************************** 114 #define FLASH_FMC_WRKEY 0xA4420000 // FLASH write key 115 #define FLASH_FMC_COMT 0x00000008 // Commit Register Value 116 #define FLASH_FMC_MERASE 0x00000004 // Mass Erase Flash Memory 117 #define FLASH_FMC_ERASE 0x00000002 // Erase a Page of Flash Memory 118 #define FLASH_FMC_WRITE 0x00000001 // Write a Word into Flash Memory 119 120 //***************************************************************************** 121 // 122 // The following are defines for the bit fields in the FLASH_FCRIS register. 123 // 124 //***************************************************************************** 125 #define FLASH_FCRIS_PROGRIS 0x00002000 // PROGVER Raw Interrupt Status 126 #define FLASH_FCRIS_ERRIS 0x00000800 // ERVER Raw Interrupt Status 127 #define FLASH_FCRIS_INVDRIS 0x00000400 // Invalid Data Raw Interrupt 128 // Status 129 #define FLASH_FCRIS_VOLTRIS 0x00000200 // VOLTSTAT Raw Interrupt Status 130 #define FLASH_FCRIS_ERIS 0x00000004 // EEPROM Raw Interrupt Status 131 #define FLASH_FCRIS_PRIS 0x00000002 // Programming Raw Interrupt Status 132 #define FLASH_FCRIS_ARIS 0x00000001 // Access Raw Interrupt Status 133 134 //***************************************************************************** 135 // 136 // The following are defines for the bit fields in the FLASH_FCIM register. 137 // 138 //***************************************************************************** 139 #define FLASH_FCIM_PROGMASK 0x00002000 // PROGVER Interrupt Mask 140 #define FLASH_FCIM_ERMASK 0x00000800 // ERVER Interrupt Mask 141 #define FLASH_FCIM_INVDMASK 0x00000400 // Invalid Data Interrupt Mask 142 #define FLASH_FCIM_VOLTMASK 0x00000200 // VOLT Interrupt Mask 143 #define FLASH_FCIM_EMASK 0x00000004 // EEPROM Interrupt Mask 144 #define FLASH_FCIM_PMASK 0x00000002 // Programming Interrupt Mask 145 #define FLASH_FCIM_AMASK 0x00000001 // Access Interrupt Mask 146 147 //***************************************************************************** 148 // 149 // The following are defines for the bit fields in the FLASH_FCMISC register. 150 // 151 //***************************************************************************** 152 #define FLASH_FCMISC_PROGMISC 0x00002000 // PROGVER Masked Interrupt Status 153 // and Clear 154 #define FLASH_FCMISC_ERMISC 0x00000800 // ERVER Masked Interrupt Status 155 // and Clear 156 #define FLASH_FCMISC_INVDMISC 0x00000400 // Invalid Data Masked Interrupt 157 // Status and Clear 158 #define FLASH_FCMISC_VOLTMISC 0x00000200 // VOLT Masked Interrupt Status and 159 // Clear 160 #define FLASH_FCMISC_EMISC 0x00000004 // EEPROM Masked Interrupt Status 161 // and Clear 162 #define FLASH_FCMISC_PMISC 0x00000002 // Programming Masked Interrupt 163 // Status and Clear 164 #define FLASH_FCMISC_AMISC 0x00000001 // Access Masked Interrupt Status 165 // and Clear 166 167 //***************************************************************************** 168 // 169 // The following are defines for the bit fields in the FLASH_FMC2 register. 170 // 171 //***************************************************************************** 172 #define FLASH_FMC2_WRKEY 0xA4420000 // FLASH write key 173 #define FLASH_FMC2_WRBUF 0x00000001 // Buffered Flash Memory Write 174 175 //***************************************************************************** 176 // 177 // The following are defines for the bit fields in the FLASH_FWBVAL register. 178 // 179 //***************************************************************************** 180 #define FLASH_FWBVAL_FWB_M 0xFFFFFFFF // Flash Memory Write Buffer 181 182 //***************************************************************************** 183 // 184 // The following are defines for the bit fields in the FLASH_FCTL register. 185 // 186 //***************************************************************************** 187 #define FLASH_FCTL_USDACK 0x00000002 // User Shut Down Acknowledge 188 #define FLASH_FCTL_USDREQ 0x00000001 // User Shut Down Request 189 190 //***************************************************************************** 191 // 192 // The following are defines for the bit fields in the FLASH_FWBN register. 193 // 194 //***************************************************************************** 195 #define FLASH_FWBN_DATA_M 0xFFFFFFFF // Data 196 197 //***************************************************************************** 198 // 199 // The following are defines for the bit fields in the FLASH_FSIZE register. 200 // 201 //***************************************************************************** 202 #define FLASH_FSIZE_SIZE_M 0x0000FFFF // Flash Size 203 #define FLASH_FSIZE_SIZE_8KB 0x00000003 // 8 KB of Flash 204 #define FLASH_FSIZE_SIZE_16KB 0x00000007 // 16 KB of Flash 205 #define FLASH_FSIZE_SIZE_32KB 0x0000000F // 32 KB of Flash 206 #define FLASH_FSIZE_SIZE_64KB 0x0000001F // 64 KB of Flash 207 #define FLASH_FSIZE_SIZE_96KB 0x0000002F // 96 KB of Flash 208 #define FLASH_FSIZE_SIZE_128KB 0x0000003F // 128 KB of Flash 209 #define FLASH_FSIZE_SIZE_192KB 0x0000005F // 192 KB of Flash 210 #define FLASH_FSIZE_SIZE_256KB 0x0000007F // 256 KB of Flash 211 212 //***************************************************************************** 213 // 214 // The following are defines for the bit fields in the FLASH_SSIZE register. 215 // 216 //***************************************************************************** 217 #define FLASH_SSIZE_SIZE_M 0x0000FFFF // SRAM Size 218 #define FLASH_SSIZE_SIZE_2KB 0x00000007 // 2 KB of SRAM 219 #define FLASH_SSIZE_SIZE_4KB 0x0000000F // 4 KB of SRAM 220 #define FLASH_SSIZE_SIZE_6KB 0x00000017 // 6 KB of SRAM 221 #define FLASH_SSIZE_SIZE_8KB 0x0000001F // 8 KB of SRAM 222 #define FLASH_SSIZE_SIZE_12KB 0x0000002F // 12 KB of SRAM 223 #define FLASH_SSIZE_SIZE_16KB 0x0000003F // 16 KB of SRAM 224 #define FLASH_SSIZE_SIZE_20KB 0x0000004F // 20 KB of SRAM 225 #define FLASH_SSIZE_SIZE_24KB 0x0000005F // 24 KB of SRAM 226 #define FLASH_SSIZE_SIZE_32KB 0x0000007F // 32 KB of SRAM 227 228 //***************************************************************************** 229 // 230 // The following are defines for the bit fields in the FLASH_ROMSWMAP register. 231 // 232 //***************************************************************************** 233 #define FLASH_ROMSWMAP_SAFERTOS 0x00000001 // SafeRTOS Present 234 235 //***************************************************************************** 236 // 237 // The following are defines for the bit fields in the FLASH_RMCTL register. 238 // 239 //***************************************************************************** 240 #define FLASH_RMCTL_BA 0x00000001 // Boot Alias 241 242 //***************************************************************************** 243 // 244 // The following are defines for the bit fields in the FLASH_USECRL register. 245 // 246 //***************************************************************************** 247 #define FLASH_USECRL_M 0x000000FF // Microsecond Reload Value 248 #define FLASH_USECRL_S 0 249 250 //***************************************************************************** 251 // 252 // The following are defines for the bit fields in the FLASH_USERDBG register. 253 // 254 //***************************************************************************** 255 #define FLASH_USERDBG_NW 0x80000000 // User Debug Not Written 256 #define FLASH_USERDBG_DATA_M 0x7FFFFFFC // User Data 257 #define FLASH_USERDBG_DBG1 0x00000002 // Debug Control 1 258 #define FLASH_USERDBG_DBG0 0x00000001 // Debug Control 0 259 #define FLASH_USERDBG_DATA_S 2 260 261 //***************************************************************************** 262 // 263 // The following are defines for the bit fields in the FLASH_BOOTCFG register. 264 // 265 //***************************************************************************** 266 #define FLASH_BOOTCFG_NW 0x80000000 // Not Written 267 #define FLASH_BOOTCFG_PORT_M 0x0000E000 // Boot GPIO Port 268 #define FLASH_BOOTCFG_PORT_A 0x00000000 // Port A 269 #define FLASH_BOOTCFG_PORT_B 0x00002000 // Port B 270 #define FLASH_BOOTCFG_PORT_C 0x00004000 // Port C 271 #define FLASH_BOOTCFG_PORT_D 0x00006000 // Port D 272 #define FLASH_BOOTCFG_PORT_E 0x00008000 // Port E 273 #define FLASH_BOOTCFG_PORT_F 0x0000A000 // Port F 274 #define FLASH_BOOTCFG_PORT_G 0x0000C000 // Port G 275 #define FLASH_BOOTCFG_PORT_H 0x0000E000 // Port H 276 #define FLASH_BOOTCFG_PIN_M 0x00001C00 // Boot GPIO Pin 277 #define FLASH_BOOTCFG_PIN_0 0x00000000 // Pin 0 278 #define FLASH_BOOTCFG_PIN_1 0x00000400 // Pin 1 279 #define FLASH_BOOTCFG_PIN_2 0x00000800 // Pin 2 280 #define FLASH_BOOTCFG_PIN_3 0x00000C00 // Pin 3 281 #define FLASH_BOOTCFG_PIN_4 0x00001000 // Pin 4 282 #define FLASH_BOOTCFG_PIN_5 0x00001400 // Pin 5 283 #define FLASH_BOOTCFG_PIN_6 0x00001800 // Pin 6 284 #define FLASH_BOOTCFG_PIN_7 0x00001C00 // Pin 7 285 #define FLASH_BOOTCFG_POL 0x00000200 // Boot GPIO Polarity 286 #define FLASH_BOOTCFG_EN 0x00000100 // Boot GPIO Enable 287 #define FLASH_BOOTCFG_DBG1 0x00000002 // Debug Control 1 288 #define FLASH_BOOTCFG_DBG0 0x00000001 // Debug Control 0 289 290 //***************************************************************************** 291 // 292 // The following are defines for the bit fields in the FLASH_USERREG0 register. 293 // 294 //***************************************************************************** 295 #define FLASH_USERREG0_NW 0x80000000 // Not Written 296 #define FLASH_USERREG0_DATA_M 0x7FFFFFFF // User Data 297 #define FLASH_USERREG0_DATA_S 0 298 299 //***************************************************************************** 300 // 301 // The following are defines for the bit fields in the FLASH_USERREG1 register. 302 // 303 //***************************************************************************** 304 #define FLASH_USERREG1_NW 0x80000000 // Not Written 305 #define FLASH_USERREG1_DATA_M 0x7FFFFFFF // User Data 306 #define FLASH_USERREG1_DATA_S 0 307 308 //***************************************************************************** 309 // 310 // The following are defines for the bit fields in the FLASH_USERREG2 register. 311 // 312 //***************************************************************************** 313 #define FLASH_USERREG2_NW 0x80000000 // Not Written 314 #define FLASH_USERREG2_DATA_M 0x7FFFFFFF // User Data 315 #define FLASH_USERREG2_DATA_S 0 316 317 //***************************************************************************** 318 // 319 // The following are defines for the bit fields in the FLASH_USERREG3 register. 320 // 321 //***************************************************************************** 322 #define FLASH_USERREG3_NW 0x80000000 // Not Written 323 #define FLASH_USERREG3_DATA_M 0x7FFFFFFF // User Data 324 #define FLASH_USERREG3_DATA_S 0 325 326 //***************************************************************************** 327 // 328 // The following are defines for the bit fields in the FLASH_FMPRE and 329 // FLASH_FMPPE registers. 330 // 331 //***************************************************************************** 332 #define FLASH_FMP_BLOCK_31 0x80000000 // Enable for block 31 333 #define FLASH_FMP_BLOCK_30 0x40000000 // Enable for block 30 334 #define FLASH_FMP_BLOCK_29 0x20000000 // Enable for block 29 335 #define FLASH_FMP_BLOCK_28 0x10000000 // Enable for block 28 336 #define FLASH_FMP_BLOCK_27 0x08000000 // Enable for block 27 337 #define FLASH_FMP_BLOCK_26 0x04000000 // Enable for block 26 338 #define FLASH_FMP_BLOCK_25 0x02000000 // Enable for block 25 339 #define FLASH_FMP_BLOCK_24 0x01000000 // Enable for block 24 340 #define FLASH_FMP_BLOCK_23 0x00800000 // Enable for block 23 341 #define FLASH_FMP_BLOCK_22 0x00400000 // Enable for block 22 342 #define FLASH_FMP_BLOCK_21 0x00200000 // Enable for block 21 343 #define FLASH_FMP_BLOCK_20 0x00100000 // Enable for block 20 344 #define FLASH_FMP_BLOCK_19 0x00080000 // Enable for block 19 345 #define FLASH_FMP_BLOCK_18 0x00040000 // Enable for block 18 346 #define FLASH_FMP_BLOCK_17 0x00020000 // Enable for block 17 347 #define FLASH_FMP_BLOCK_16 0x00010000 // Enable for block 16 348 #define FLASH_FMP_BLOCK_15 0x00008000 // Enable for block 15 349 #define FLASH_FMP_BLOCK_14 0x00004000 // Enable for block 14 350 #define FLASH_FMP_BLOCK_13 0x00002000 // Enable for block 13 351 #define FLASH_FMP_BLOCK_12 0x00001000 // Enable for block 12 352 #define FLASH_FMP_BLOCK_11 0x00000800 // Enable for block 11 353 #define FLASH_FMP_BLOCK_10 0x00000400 // Enable for block 10 354 #define FLASH_FMP_BLOCK_9 0x00000200 // Enable for block 9 355 #define FLASH_FMP_BLOCK_8 0x00000100 // Enable for block 8 356 #define FLASH_FMP_BLOCK_7 0x00000080 // Enable for block 7 357 #define FLASH_FMP_BLOCK_6 0x00000040 // Enable for block 6 358 #define FLASH_FMP_BLOCK_5 0x00000020 // Enable for block 5 359 #define FLASH_FMP_BLOCK_4 0x00000010 // Enable for block 4 360 #define FLASH_FMP_BLOCK_3 0x00000008 // Enable for block 3 361 #define FLASH_FMP_BLOCK_2 0x00000004 // Enable for block 2 362 #define FLASH_FMP_BLOCK_1 0x00000002 // Enable for block 1 363 #define FLASH_FMP_BLOCK_0 0x00000001 // Enable for block 0 364 365 //***************************************************************************** 366 // 367 // The following are defines for the erase size of the FLASH block that is 368 // erased by an erase operation, and the protect size is the size of the FLASH 369 // block that is protected by each protection register. 370 // 371 //***************************************************************************** 372 #define FLASH_PROTECT_SIZE 0x00000800 373 #define FLASH_ERASE_SIZE 0x00000400 374 375 //***************************************************************************** 376 // 377 // The following definitions are deprecated. 378 // 379 //***************************************************************************** 380 #ifndef DEPRECATED 381 382 //***************************************************************************** 383 // 384 // The following are deprecated defines for the FLASH register offsets. 385 // 386 //***************************************************************************** 387 #define FLASH_RMVER 0x400FE0F4 // ROM Version Register 388 389 //***************************************************************************** 390 // 391 // The following are deprecated defines for the bit fields in the FLASH_FMC 392 // register. 393 // 394 //***************************************************************************** 395 #define FLASH_FMC_WRKEY_MASK 0xFFFF0000 // FLASH write key mask 396 #define FLASH_FMC_WRKEY_M 0xFFFF0000 // Flash Memory Write Key 397 #define FLASH_FMC_WRKEY_S 16 398 399 //***************************************************************************** 400 // 401 // The following are deprecated defines for the bit fields in the FLASH_FCRIS 402 // register. 403 // 404 //***************************************************************************** 405 #define FLASH_FCRIS_PROGRAM 0x00000002 // Programming status 406 #define FLASH_FCRIS_ACCESS 0x00000001 // Invalid access status 407 408 //***************************************************************************** 409 // 410 // The following are deprecated defines for the bit fields in the FLASH_FCIM 411 // register. 412 // 413 //***************************************************************************** 414 #define FLASH_FCIM_PROGRAM 0x00000002 // Programming mask 415 #define FLASH_FCIM_ACCESS 0x00000001 // Invalid access mask 416 417 //***************************************************************************** 418 // 419 // The following are deprecated defines for the bit fields in the FLASH_FCMISC 420 // register. 421 // 422 //***************************************************************************** 423 #define FLASH_FCMISC_PROGRAM 0x00000002 // Programming status 424 #define FLASH_FCMISC_ACCESS 0x00000001 // Invalid access status 425 426 //***************************************************************************** 427 // 428 // The following are deprecated defines for the bit fields in the FLASH_RMVER 429 // register. 430 // 431 //***************************************************************************** 432 #define FLASH_RMVER_CONT_M 0xFF000000 // ROM Contents 433 #define FLASH_RMVER_CONT_LM 0x00000000 // Stellaris Boot Loader & 434 // DriverLib 435 #define FLASH_RMVER_CONT_LM_AES 0x02000000 // Stellaris Boot Loader & 436 // DriverLib with AES 437 #define FLASH_RMVER_CONT_LM_AES_SAFERTOS \ 438 0x03000000 // Stellaris Boot Loader & 439 // DriverLib with AES and SAFERTOS 440 #define FLASH_RMVER_CONT_LM_AES2 \ 441 0x05000000 // Stellaris Boot Loader & 442 // DriverLib with AES 443 #define FLASH_RMVER_VER_M 0x0000FF00 // ROM Version 444 #define FLASH_RMVER_REV_M 0x000000FF // ROM Revision 445 #define FLASH_RMVER_VER_S 8 446 #define FLASH_RMVER_REV_S 0 447 448 //***************************************************************************** 449 // 450 // The following are deprecated defines for the bit fields in the FLASH_USECRL 451 // register. 452 // 453 //***************************************************************************** 454 #define FLASH_USECRL_MASK 0x000000FF // Clock per uSec 455 #define FLASH_USECRL_SHIFT 0 456 457 #endif 458 459 #endif // __HW_FLASH_H__ 460