1 //*****************************************************************************
\r
3 // hw_flash.h - Macros used when accessing the flash controller.
\r
5 // Copyright (c) 2005,2006 Luminary Micro, Inc. All rights reserved.
\r
7 // Software License Agreement
\r
9 // Luminary Micro, Inc. (LMI) is supplying this software for use solely and
\r
10 // exclusively on LMI's Stellaris Family of microcontroller products.
\r
12 // The software is owned by LMI and/or its suppliers, and is protected under
\r
13 // applicable copyright laws. All rights are reserved. Any use in violation
\r
14 // of the foregoing restrictions may subject the user to criminal sanctions
\r
15 // under applicable laws, as well as to civil liability for the breach of the
\r
16 // terms and conditions of this license.
\r
18 // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
\r
19 // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
\r
20 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
\r
21 // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
\r
22 // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
\r
24 // This is part of revision 635 of the Stellaris Driver Library.
\r
26 //*****************************************************************************
\r
28 #ifndef __HW_FLASH_H__
\r
29 #define __HW_FLASH_H__
\r
31 //*****************************************************************************
\r
33 // The following define the offsets of the FLASH registers.
\r
35 //*****************************************************************************
\r
36 #define FLASH_FMA 0x400FD000 // Memory address register
\r
37 #define FLASH_FMD 0x400FD004 // Memory data register
\r
38 #define FLASH_FMC 0x400FD008 // Memory control register
\r
39 #define FLASH_FCRIS 0x400FD00c // Raw interrupt status register
\r
40 #define FLASH_FCIM 0x400FD010 // Interrupt mask register
\r
41 #define FLASH_FCMISC 0x400FD014 // Interrupt status register
\r
42 #define FLASH_FMPRE 0x400FE130 // FLASH read protect register
\r
43 #define FLASH_FMPPE 0x400FE134 // FLASH program protect register
\r
44 #define FLASH_USECRL 0x400FE140 // uSec reload register
\r
46 //*****************************************************************************
\r
48 // The following define the bit fields in the FLASH_FMC register.
\r
50 //*****************************************************************************
\r
51 #define FLASH_FMC_WRKEY_MASK 0xFFFF0000 // FLASH write key mask
\r
52 #define FLASH_FMC_WRKEY 0xA4420000 // FLASH write key
\r
53 #define FLASH_FMC_COMT 0x00000008 // Commit user register
\r
54 #define FLASH_FMC_MERASE 0x00000004 // Mass erase FLASH
\r
55 #define FLASH_FMC_ERASE 0x00000002 // Erase FLASH page
\r
56 #define FLASH_FMC_WRITE 0x00000001 // Write FLASH word
\r
58 //*****************************************************************************
\r
60 // The following define the bit fields in the FLASH_FCRIS register.
\r
62 //*****************************************************************************
\r
63 #define FLASH_FCRIS_PROGRAM 0x00000002 // Programming status
\r
64 #define FLASH_FCRIS_ACCESS 0x00000001 // Invalid access status
\r
66 //*****************************************************************************
\r
68 // The following define the bit fields in the FLASH_FCIM register.
\r
70 //*****************************************************************************
\r
71 #define FLASH_FCIM_PROGRAM 0x00000002 // Programming mask
\r
72 #define FLASH_FCIM_ACCESS 0x00000001 // Invalid access mask
\r
74 //*****************************************************************************
\r
76 // The following define the bit fields in the FLASH_FMIS register.
\r
78 //*****************************************************************************
\r
79 #define FLASH_FCMISC_PROGRAM 0x00000002 // Programming status
\r
80 #define FLASH_FCMISC_ACCESS 0x00000001 // Invalid access status
\r
82 //*****************************************************************************
\r
84 // The following define the bit fields in the FLASH_FMPRE and FLASH_FMPPE
\r
87 //*****************************************************************************
\r
88 #define FLASH_FMP_BLOCK_31 0x80000000 // Enable for block 31
\r
89 #define FLASH_FMP_BLOCK_30 0x40000000 // Enable for block 30
\r
90 #define FLASH_FMP_BLOCK_29 0x20000000 // Enable for block 29
\r
91 #define FLASH_FMP_BLOCK_28 0x10000000 // Enable for block 28
\r
92 #define FLASH_FMP_BLOCK_27 0x08000000 // Enable for block 27
\r
93 #define FLASH_FMP_BLOCK_26 0x04000000 // Enable for block 26
\r
94 #define FLASH_FMP_BLOCK_25 0x02000000 // Enable for block 25
\r
95 #define FLASH_FMP_BLOCK_24 0x01000000 // Enable for block 24
\r
96 #define FLASH_FMP_BLOCK_23 0x00800000 // Enable for block 23
\r
97 #define FLASH_FMP_BLOCK_22 0x00400000 // Enable for block 22
\r
98 #define FLASH_FMP_BLOCK_21 0x00200000 // Enable for block 21
\r
99 #define FLASH_FMP_BLOCK_20 0x00100000 // Enable for block 20
\r
100 #define FLASH_FMP_BLOCK_19 0x00080000 // Enable for block 19
\r
101 #define FLASH_FMP_BLOCK_18 0x00040000 // Enable for block 18
\r
102 #define FLASH_FMP_BLOCK_17 0x00020000 // Enable for block 17
\r
103 #define FLASH_FMP_BLOCK_16 0x00010000 // Enable for block 16
\r
104 #define FLASH_FMP_BLOCK_15 0x00008000 // Enable for block 15
\r
105 #define FLASH_FMP_BLOCK_14 0x00004000 // Enable for block 14
\r
106 #define FLASH_FMP_BLOCK_13 0x00002000 // Enable for block 13
\r
107 #define FLASH_FMP_BLOCK_12 0x00001000 // Enable for block 12
\r
108 #define FLASH_FMP_BLOCK_11 0x00000800 // Enable for block 11
\r
109 #define FLASH_FMP_BLOCK_10 0x00000400 // Enable for block 10
\r
110 #define FLASH_FMP_BLOCK_9 0x00000200 // Enable for block 9
\r
111 #define FLASH_FMP_BLOCK_8 0x00000100 // Enable for block 8
\r
112 #define FLASH_FMP_BLOCK_7 0x00000080 // Enable for block 7
\r
113 #define FLASH_FMP_BLOCK_6 0x00000040 // Enable for block 6
\r
114 #define FLASH_FMP_BLOCK_5 0x00000020 // Enable for block 5
\r
115 #define FLASH_FMP_BLOCK_4 0x00000010 // Enable for block 4
\r
116 #define FLASH_FMP_BLOCK_3 0x00000008 // Enable for block 3
\r
117 #define FLASH_FMP_BLOCK_2 0x00000004 // Enable for block 2
\r
118 #define FLASH_FMP_BLOCK_1 0x00000002 // Enable for block 1
\r
119 #define FLASH_FMP_BLOCK_0 0x00000001 // Enable for block 0
\r
121 //*****************************************************************************
\r
123 // The following define the bit fields in the FLASH_USECRL register.
\r
125 //*****************************************************************************
\r
126 #define FLASH_USECRL_MASK 0x000000FF // Clock per uSec
\r
127 #define FLASH_USECRL_SHIFT 0
\r
129 //*****************************************************************************
\r
131 // The erase size is the size of the FLASH block that is erased by an erase
\r
132 // operation, and the protect size is the size of the FLASH block that is
\r
133 // protected by each protection register.
\r
135 //*****************************************************************************
\r
136 #define FLASH_ERASE_SIZE 0x00000400
\r
137 #define FLASH_PROTECT_SIZE 0x00000800
\r
139 #endif // __HW_FLASH_H__
\r