MotorWare f2806x Driver API Documentation

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

flash.h
Go to the documentation of this file.
1 /* --COPYRIGHT--,BSD
2 * Copyright (c) 2015, Texas Instruments Incorporated
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
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its 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,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 * --/COPYRIGHT--*/
32 #ifndef _FLASH_H_
33 #define _FLASH_H_
34
40
41
42 // **************************************************************************
43 // the includes
44
45 #include "sw/modules/types/src/types.h"
46
47 #include "sw/drivers/cpu/src/32b/f28x/f2806x/cpu.h"
48
53
54
55
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59
60
61 // **************************************************************************
62 // the defines
63
64
67 #define FLASH_BASE_ADDR (0x00000A80)
68
69
72 #define FLASH_ACTIVE_WAIT_COUNT_DEFAULT (0x01FF)
73
74
77 #define FLASH_STANDBY_WAIT_COUNT_DEFAULT (0x01FF)
78
79
82 #define FLASH_FOPT_ENPIPE_BITS (1 << 0)
83
84
87 #define FLASH_FACTIVEWAIT_ACTIVEWAIT_BITS (255 << 0)
88
89
92 #define FLASH_FBANKWAIT_RANDWAIT_BITS (15 << 0)
93
96 #define FLASH_FBANKWAIT_PAGEWAIT_BITS (15 << 8)
97
98
101 #define FLASH_FOTPWAIT_OTPWAIT_BITS (31 << 0)
102
103
106 #define FLASH_FPWR_PWR_BITS (3 << 0)
107
108
111 #define FLASH_FSTATUS_PWRS_BITS (3 << 0)
112
115 #define FLASH_FSTATUS_STDBYWAITS_BITS (1 << 2)
116
119 #define FLASH_FSTATUS_ACTIVEWAITS_BITS (1 << 3)
120
123 #define FLASH_FSTATUS_3VSTAT_BITS (1 << 8)
124
125
128 #define FLASH_FSTDBYWAIT_STDBYWAIT_BITS (255 << 0)
129
130
131 // **************************************************************************
132 // the typedefs
133
134
137 typedef enum
138 {
139 FLASH_3VStatus_InRange=(0 << 8),
140 FLASH_3VStatus_OutOfRange=(1 << 8)
141 } FLASH_3VStatus_e;
142
143
146 typedef enum
147 {
148 FLASH_CounterStatus_NotCounting=0,
149 FLASH_CounterStatus_Counting
150 } FLASH_CounterStatus_e;
151
152
155 typedef enum
156 {
157 FLASH_NumOtpWaitStates_1=(1 << 0),
158 FLASH_NumOtpWaitStates_2=(2 << 0),
159 FLASH_NumOtpWaitStates_3=(3 << 0),
160 FLASH_NumOtpWaitStates_4=(4 << 0),
161 FLASH_NumOtpWaitStates_5=(5 << 0),
162 FLASH_NumOtpWaitStates_6=(6 << 0),
163 FLASH_NumOtpWaitStates_7=(7 << 0),
164 FLASH_NumOtpWaitStates_8=(8 << 0),
165 FLASH_NumOtpWaitStates_9=(9 << 0),
166 FLASH_NumOtpWaitStates_10=(10 << 0),
167 FLASH_NumOtpWaitStates_11=(11 << 0),
168 FLASH_NumOtpWaitStates_12=(12 << 0),
169 FLASH_NumOtpWaitStates_13=(13 << 0),
170 FLASH_NumOtpWaitStates_14=(14 << 0),
171 FLASH_NumOtpWaitStates_15=(15 << 0)
172 } FLASH_NumOtpWaitStates_e;
173
174
177 typedef enum
178 {
179 FLASH_NumPagedWaitStates_0=(0 << 8),
180 FLASH_NumPagedWaitStates_1=(1 << 8),
181 FLASH_NumPagedWaitStates_2=(2 << 8),
182 FLASH_NumPagedWaitStates_3=(3 << 8),
183 FLASH_NumPagedWaitStates_4=(4 << 8),
184 FLASH_NumPagedWaitStates_5=(5 << 8),
185 FLASH_NumPagedWaitStates_6=(6 << 8),
186 FLASH_NumPagedWaitStates_7=(7 << 8),
187 FLASH_NumPagedWaitStates_8=(8 << 8),
188 FLASH_NumPagedWaitStates_9=(9 << 8),
189 FLASH_NumPagedWaitStates_10=(10 << 8),
190 FLASH_NumPagedWaitStates_11=(11 << 8),
191 FLASH_NumPagedWaitStates_12=(12 << 8),
192 FLASH_NumPagedWaitStates_13=(13 << 8),
193 FLASH_NumPagedWaitStates_14=(14 << 8),
194 FLASH_NumPagedWaitStates_15=(15 << 8)
195 } FLASH_NumPagedWaitStates_e;
196
197
200 typedef enum
201 {
202 FLASH_NumRandomWaitStates_1=(1 << 0),
203 FLASH_NumRandomWaitStates_2=(2 << 0),
204 FLASH_NumRandomWaitStates_3=(3 << 0),
205 FLASH_NumRandomWaitStates_4=(4 << 0),
206 FLASH_NumRandomWaitStates_5=(5 << 0),
207 FLASH_NumRandomWaitStates_6=(6 << 0),
208 FLASH_NumRandomWaitStates_7=(7 << 0),
209 FLASH_NumRandomWaitStates_8=(8 << 0),
210 FLASH_NumRandomWaitStates_9=(9 << 0),
211 FLASH_NumRandomWaitStates_10=(10 << 0),
212 FLASH_NumRandomWaitStates_11=(11 << 0),
213 FLASH_NumRandomWaitStates_12=(12 << 0),
214 FLASH_NumRandomWaitStates_13=(13 << 0),
215 FLASH_NumRandomWaitStates_14=(14 << 0),
216 FLASH_NumRandomWaitStates_15=(15 << 0)
217 } FLASH_NumRandomWaitStates_e;
218
219
222 typedef enum
223 {
224 FLASH_PowerMode_PumpAndBankSleep=(0 << 0),
225 FLASH_PowerMode_PumpAndBankStandby=(1 << 0),
226 FLASH_PowerMode_PumpAndBankActive=(3 << 0)
227 } FLASH_PowerMode_e;
228
229
232 typedef struct _FLASH_Obj_
233 {
234 volatile uint16_t FOPT;
235 volatile uint16_t rsvd_1;
236 volatile uint16_t FPWR;
237 volatile uint16_t FSTATUS;
238 volatile uint16_t FSTDBYWAIT;
239 volatile uint16_t FACTIVEWAIT;
240 volatile uint16_t FBANKWAIT;
241 volatile uint16_t FOTPWAIT;
242 } FLASH_Obj;
243
244
247 typedef struct _FLASH_Obj_ *FLASH_Handle;
248
249
250 // **************************************************************************
251 // the globals
252
253
254 // **************************************************************************
255 // the function prototypes
256
259 extern void FLASH_clear3VStatus(FLASH_Handle flashHandle);
260
261
264 extern void FLASH_disablePipelineMode(FLASH_Handle flashHandle);
265
266
269 extern void FLASH_enablePipelineMode(FLASH_Handle flashHandle);
270
271
275 extern FLASH_3VStatus_e FLASH_get3VStatus(FLASH_Handle flashHandle);
276
277
281 extern uint16_t FLASH_getActiveWaitCount(FLASH_Handle flashHandle);
282
283
287 extern FLASH_CounterStatus_e FLASH_getActiveWaitStatus(FLASH_Handle flashHandle);
288
289
293 extern FLASH_PowerMode_e FLASH_getPowerMode(FLASH_Handle flashHandle);
294
295
299 extern uint16_t FLASH_getStandbyWaitCount(FLASH_Handle flashHandle);
300
301
305 extern FLASH_CounterStatus_e FLASH_getStandbyWaitStatus(FLASH_Handle flashHandle);
306
307
312 extern FLASH_Handle FLASH_init(void *pMemory,const size_t numBytes);
313
314
318 extern void FLASH_setActiveWaitCount(FLASH_Handle flashHandle,const uint16_t count);
319
320
324 extern void FLASH_setNumPagedReadWaitStates(FLASH_Handle flashHandle,const FLASH_NumPagedWaitStates_e numStates);
325
326
330 extern void FLASH_setNumRandomReadWaitStates(FLASH_Handle flashHandle,const FLASH_NumRandomWaitStates_e numStates);
331
332
336 extern void FLASH_setOtpWaitStates(FLASH_Handle flashHandle,const FLASH_NumOtpWaitStates_e numStates);
337
338
342 extern void FLASH_setPowerMode(FLASH_Handle flashHandle,const FLASH_PowerMode_e mode);
343
344
348 extern void FLASH_setStandbyWaitCount(FLASH_Handle flashHandle,const uint16_t count);
349
350
351 #ifdef __cplusplus
352 }
353 #endif // extern "C"
354
356 #endif // end of _FLASH_H_ definition
357
FLASH_NumPagedWaitStates_7
Denotes the number of paged read wait states is 7.
Definition: flash.h:186
FLASH_NumRandomWaitStates_9
Denotes the number of randowm read wait states is 9.
Definition: flash.h:210
FLASH_setOtpWaitStates
void FLASH_setOtpWaitStates(FLASH_Handle flashHandle, const FLASH_NumOtpWaitStates_e numStates)
Sets the number of one-time programmable (OTP) wait states.
Definition: flash.c:250
FLASH_NumOtpWaitStates_10
Denotes the number of one-time programmable (OTP) wait states is 10.
Definition: flash.h:166
FLASH_get3VStatus
FLASH_3VStatus_e FLASH_get3VStatus(FLASH_Handle flashHandle)
Gets the 3V status.
Definition: flash.c:106
FLASH_NumOtpWaitStates_2
Denotes the number of one-time programmable (OTP) wait states is 2.
Definition: flash.h:158
FLASH_NumOtpWaitStates_12
Denotes the number of one-time programmable (OTP) wait states is 12.
Definition: flash.h:168
FLASH_NumPagedWaitStates_12
Denotes the number of paged read wait states is 12.
Definition: flash.h:191
FLASH_NumRandomWaitStates_5
Denotes the number of randowm read wait states is 5.
Definition: flash.h:206
FLASH_NumOtpWaitStates_11
Denotes the number of one-time programmable (OTP) wait states is 11.
Definition: flash.h:167
FLASH_NumRandomWaitStates_13
Denotes the number of randowm read wait states is 13.
Definition: flash.h:214
FLASH_NumRandomWaitStates_14
Denotes the number of randowm read wait states is 14.
Definition: flash.h:215
FLASH_NumPagedWaitStates_6
Denotes the number of paged read wait states is 6.
Definition: flash.h:185
FLASH_setActiveWaitCount
void FLASH_setActiveWaitCount(FLASH_Handle flashHandle, const uint16_t count)
Sets the active wait count.
Definition: flash.c:194
FLASH_NumOtpWaitStates_7
Denotes the number of one-time programmable (OTP) wait states is 7.
Definition: flash.h:163
FLASH_NumRandomWaitStates_7
Denotes the number of randowm read wait states is 7.
Definition: flash.h:208
FLASH_NumOtpWaitStates_4
Denotes the number of one-time programmable (OTP) wait states is 4.
Definition: flash.h:160
FLASH_NumPagedWaitStates_2
Denotes the number of paged read wait states is 2.
Definition: flash.h:181
FLASH_PowerMode_PumpAndBankSleep
Denotes a pump and bank sleep power mode.
Definition: flash.h:224
FLASH_NumRandomWaitStates_15
Denotes the number of randowm read wait states is 15.
Definition: flash.h:216
FLASH_NumPagedWaitStates_14
Denotes the number of paged read wait states is 14.
Definition: flash.h:193
FLASH_NumRandomWaitStates_4
Denotes the number of randowm read wait states is 4.
Definition: flash.h:205
FLASH_PowerMode_PumpAndBankActive
Denotes a pump and bank active power mode.
Definition: flash.h:226
FLASH_CounterStatus_e
FLASH_CounterStatus_e
Enumeration to define the counter status.
Definition: flash.h:146
FLASH_Obj
struct _FLASH_Obj_ FLASH_Obj
Defines the flash (FLASH) object.
FLASH_3VStatus_InRange
Denotes the 3V flash voltage is in range.
Definition: flash.h:139
FLASH_NumOtpWaitStates_13
Denotes the number of one-time programmable (OTP) wait states is 13.
Definition: flash.h:169
FLASH_NumRandomWaitStates_10
Denotes the number of randowm read wait states is 10.
Definition: flash.h:211
FLASH_NumOtpWaitStates_15
Denotes the number of one-time programmable (OTP) wait states is 15.
Definition: flash.h:171
FLASH_disablePipelineMode
void FLASH_disablePipelineMode(FLASH_Handle flashHandle)
Disables the pipeline mode.
Definition: flash.c:73
_FLASH_Obj_::FSTDBYWAIT
volatile uint16_t FSTDBYWAIT
Flash Sleep To Standby Wait Register.
Definition: flash.h:238
FLASH_NumOtpWaitStates_5
Denotes the number of one-time programmable (OTP) wait states is 5.
Definition: flash.h:161
_FLASH_Obj_::FACTIVEWAIT
volatile uint16_t FACTIVEWAIT
Flash Standby to Active Wait Register.
Definition: flash.h:239
FLASH_getStandbyWaitStatus
FLASH_CounterStatus_e FLASH_getStandbyWaitStatus(FLASH_Handle flashHandle)
Gets the standby wait counter status.
Definition: flash.c:166
FLASH_CounterStatus_NotCounting
Denotes the flash counter is not counting.
Definition: flash.h:148
FLASH_NumPagedWaitStates_11
Denotes the number of paged read wait states is 11.
Definition: flash.h:190
FLASH_NumRandomWaitStates_11
Denotes the number of randowm read wait states is 11.
Definition: flash.h:212
FLASH_NumPagedWaitStates_4
Denotes the number of paged read wait states is 4.
Definition: flash.h:183
FLASH_setNumPagedReadWaitStates
void FLASH_setNumPagedReadWaitStates(FLASH_Handle flashHandle, const FLASH_NumPagedWaitStates_e numStates)
Sets the number of paged read wait states.
Definition: flash.c:210
FLASH_NumOtpWaitStates_e
FLASH_NumOtpWaitStates_e
Enumeration to define the number of one-time programmable wait states.
Definition: flash.h:155
FLASH_NumRandomWaitStates_12
Denotes the number of randowm read wait states is 12.
Definition: flash.h:213
FLASH_getActiveWaitCount
uint16_t FLASH_getActiveWaitCount(FLASH_Handle flashHandle)
Gets the active wait count.
Definition: flash.c:118
_FLASH_Obj_::FBANKWAIT
volatile uint16_t FBANKWAIT
Flash Read Access Wait State Register.
Definition: flash.h:240
FLASH_getActiveWaitStatus
FLASH_CounterStatus_e FLASH_getActiveWaitStatus(FLASH_Handle flashHandle)
Gets the active wait counter status.
Definition: flash.c:130
FLASH_NumPagedWaitStates_10
Denotes the number of paged read wait states is 10.
Definition: flash.h:189
FLASH_init
FLASH_Handle FLASH_init(void *pMemory, const size_t numBytes)
Initializes the flash (FLASH) handle.
Definition: flash.c:178
FLASH_NumOtpWaitStates_3
Denotes the number of one-time programmable (OTP) wait states is 3.
Definition: flash.h:159
FLASH_3VStatus_e
FLASH_3VStatus_e
Enumeration to define the 3V status.
Definition: flash.h:137
FLASH_NumPagedWaitStates_5
Denotes the number of paged read wait states is 5.
Definition: flash.h:184
_FLASH_Obj_::FOPT
volatile uint16_t FOPT
Flash Option Register.
Definition: flash.h:234
cpu.h
Contains public interface to various functions related to the central processing unit (CPU) object...
FLASH_setPowerMode
void FLASH_setPowerMode(FLASH_Handle flashHandle, const FLASH_PowerMode_e mode)
Sets the power mode.
Definition: flash.c:270
FLASH_enablePipelineMode
void FLASH_enablePipelineMode(FLASH_Handle flashHandle)
Enables the pipeline mode.
Definition: flash.c:90
FLASH_NumRandomWaitStates_1
Denotes the number of randowm read wait states is 1.
Definition: flash.h:202
_FLASH_Obj_::FOTPWAIT
volatile uint16_t FOTPWAIT
OTP Read Access Wait State Register.
Definition: flash.h:241
FLASH_NumOtpWaitStates_9
Denotes the number of one-time programmable (OTP) wait states is 9.
Definition: flash.h:165
FLASH_NumRandomWaitStates_3
Denotes the number of randowm read wait states is 3.
Definition: flash.h:204
_FLASH_Obj_::FSTATUS
volatile uint16_t FSTATUS
Status Register.
Definition: flash.h:237
FLASH_NumPagedWaitStates_e
FLASH_NumPagedWaitStates_e
Enumeration to define the number of paged wait states.
Definition: flash.h:177
FLASH_NumRandomWaitStates_2
Denotes the number of randowm read wait states is 2.
Definition: flash.h:203
_FLASH_Obj_::rsvd_1
volatile uint16_t rsvd_1
Reserved.
Definition: flash.h:235
_FLASH_Obj_
Defines the flash (FLASH) object.
Definition: flash.h:232
FLASH_PowerMode_PumpAndBankStandby
Denotes a pump and bank standby power mode.
Definition: flash.h:225
FLASH_NumPagedWaitStates_1
Denotes the number of paged read wait states is 1.
Definition: flash.h:180
FLASH_NumOtpWaitStates_14
Denotes the number of one-time programmable (OTP) wait states is 14.
Definition: flash.h:170
FLASH_setStandbyWaitCount
void FLASH_setStandbyWaitCount(FLASH_Handle flashHandle, const uint16_t count)
Sets the standby wait count.
Definition: flash.c:290
_FLASH_Obj_::FPWR
volatile uint16_t FPWR
Flash Power Modes Register.
Definition: flash.h:236
FLASH_NumOtpWaitStates_1
Denotes the number of one-time programmable (OTP) wait states is 1.
Definition: flash.h:157
FLASH_getStandbyWaitCount
uint16_t FLASH_getStandbyWaitCount(FLASH_Handle flashHandle)
Gets the standby wait count.
Definition: flash.c:154
FLASH_NumRandomWaitStates_e
FLASH_NumRandomWaitStates_e
Enumeration to define the number of random wait states.
Definition: flash.h:200
FLASH_NumOtpWaitStates_8
Denotes the number of one-time programmable (OTP) wait states is 8.
Definition: flash.h:164
FLASH_NumRandomWaitStates_8
Denotes the number of randowm read wait states is 8.
Definition: flash.h:209
FLASH_CounterStatus_Counting
Denotes the flash counter is counting.
Definition: flash.h:149
FLASH_NumRandomWaitStates_6
Denotes the number of randowm read wait states is 6.
Definition: flash.h:207
FLASH_NumPagedWaitStates_13
Denotes the number of paged read wait states is 13.
Definition: flash.h:192
FLASH_NumPagedWaitStates_9
Denotes the number of paged read wait states is 9.
Definition: flash.h:188
FLASH_setNumRandomReadWaitStates
void FLASH_setNumRandomReadWaitStates(FLASH_Handle flashHandle, const FLASH_NumRandomWaitStates_e numStates)
Sets the number of random read wait states.
Definition: flash.c:230
FLASH_getPowerMode
FLASH_PowerMode_e FLASH_getPowerMode(FLASH_Handle flashHandle)
Gets the power mode.
Definition: flash.c:142
FLASH_NumPagedWaitStates_15
Denotes the number of paged read wait states is 15.
Definition: flash.h:194
FLASH_NumOtpWaitStates_6
Denotes the number of one-time programmable (OTP) wait states is 6.
Definition: flash.h:162
FLASH_Handle
struct _FLASH_Obj_ * FLASH_Handle
Defines the flash (FLASH) handle.
Definition: flash.h:247
FLASH_PowerMode_e
FLASH_PowerMode_e
Enumeration to define the power modes.
Definition: flash.h:222
FLASH_3VStatus_OutOfRange
Denotes the 3V flash voltage went out of range.
Definition: flash.h:140
FLASH_NumPagedWaitStates_3
Denotes the number of paged read wait states is 3.
Definition: flash.h:182
FLASH_clear3VStatus
void FLASH_clear3VStatus(FLASH_Handle flashHandle)
Clears the 3V status.
Definition: flash.c:56
FLASH_NumPagedWaitStates_8
Denotes the number of paged read wait states is 8.
Definition: flash.h:187
FLASH_NumPagedWaitStates_0
Denotes the number of paged read wait states is 0.
Definition: flash.h:179