MotorWare f2806x Driver API Documentation
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 
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 {
142 
143 
146 typedef enum
147 {
151 
152 
155 typedef enum
156 {
173 
174 
177 typedef enum
178 {
196 
197 
200 typedef enum
201 {
218 
219 
222 typedef enum
223 {
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 
Denotes the number of paged read wait states is 7.
Definition: flash.h:186
Denotes the number of randowm read wait states is 9.
Definition: flash.h:210
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
Denotes the number of one-time programmable (OTP) wait states is 10.
Definition: flash.h:166
FLASH_3VStatus_e FLASH_get3VStatus(FLASH_Handle flashHandle)
Gets the 3V status.
Definition: flash.c:106
Denotes the number of one-time programmable (OTP) wait states is 2.
Definition: flash.h:158
Denotes the number of one-time programmable (OTP) wait states is 12.
Definition: flash.h:168
Denotes the number of paged read wait states is 12.
Definition: flash.h:191
Denotes the number of randowm read wait states is 5.
Definition: flash.h:206
Denotes the number of one-time programmable (OTP) wait states is 11.
Definition: flash.h:167
Denotes the number of randowm read wait states is 13.
Definition: flash.h:214
Denotes the number of randowm read wait states is 14.
Definition: flash.h:215
Denotes the number of paged read wait states is 6.
Definition: flash.h:185
void FLASH_setActiveWaitCount(FLASH_Handle flashHandle, const uint16_t count)
Sets the active wait count.
Definition: flash.c:194
Denotes the number of one-time programmable (OTP) wait states is 7.
Definition: flash.h:163
Denotes the number of randowm read wait states is 7.
Definition: flash.h:208
Denotes the number of one-time programmable (OTP) wait states is 4.
Definition: flash.h:160
Denotes the number of paged read wait states is 2.
Definition: flash.h:181
Denotes a pump and bank sleep power mode.
Definition: flash.h:224
Denotes the number of randowm read wait states is 15.
Definition: flash.h:216
Denotes the number of paged read wait states is 14.
Definition: flash.h:193
Denotes the number of randowm read wait states is 4.
Definition: flash.h:205
Denotes a pump and bank active power mode.
Definition: flash.h:226
FLASH_CounterStatus_e
Enumeration to define the counter status.
Definition: flash.h:146
struct _FLASH_Obj_ FLASH_Obj
Defines the flash (FLASH) object.
Denotes the 3V flash voltage is in range.
Definition: flash.h:139
Denotes the number of one-time programmable (OTP) wait states is 13.
Definition: flash.h:169
Denotes the number of randowm read wait states is 10.
Definition: flash.h:211
Denotes the number of one-time programmable (OTP) wait states is 15.
Definition: flash.h:171
void FLASH_disablePipelineMode(FLASH_Handle flashHandle)
Disables the pipeline mode.
Definition: flash.c:73
volatile uint16_t FSTDBYWAIT
Flash Sleep To Standby Wait Register.
Definition: flash.h:238
Denotes the number of one-time programmable (OTP) wait states is 5.
Definition: flash.h:161
volatile uint16_t FACTIVEWAIT
Flash Standby to Active Wait Register.
Definition: flash.h:239
FLASH_CounterStatus_e FLASH_getStandbyWaitStatus(FLASH_Handle flashHandle)
Gets the standby wait counter status.
Definition: flash.c:166
Denotes the flash counter is not counting.
Definition: flash.h:148
Denotes the number of paged read wait states is 11.
Definition: flash.h:190
Denotes the number of randowm read wait states is 11.
Definition: flash.h:212
Denotes the number of paged read wait states is 4.
Definition: flash.h:183
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
Enumeration to define the number of one-time programmable wait states.
Definition: flash.h:155
Denotes the number of randowm read wait states is 12.
Definition: flash.h:213
uint16_t FLASH_getActiveWaitCount(FLASH_Handle flashHandle)
Gets the active wait count.
Definition: flash.c:118
volatile uint16_t FBANKWAIT
Flash Read Access Wait State Register.
Definition: flash.h:240
FLASH_CounterStatus_e FLASH_getActiveWaitStatus(FLASH_Handle flashHandle)
Gets the active wait counter status.
Definition: flash.c:130
Denotes the number of paged read wait states is 10.
Definition: flash.h:189
FLASH_Handle FLASH_init(void *pMemory, const size_t numBytes)
Initializes the flash (FLASH) handle.
Definition: flash.c:178
Denotes the number of one-time programmable (OTP) wait states is 3.
Definition: flash.h:159
FLASH_3VStatus_e
Enumeration to define the 3V status.
Definition: flash.h:137
Denotes the number of paged read wait states is 5.
Definition: flash.h:184
volatile uint16_t FOPT
Flash Option Register.
Definition: flash.h:234
Contains public interface to various functions related to the central processing unit (CPU) object...
void FLASH_setPowerMode(FLASH_Handle flashHandle, const FLASH_PowerMode_e mode)
Sets the power mode.
Definition: flash.c:270
void FLASH_enablePipelineMode(FLASH_Handle flashHandle)
Enables the pipeline mode.
Definition: flash.c:90
Denotes the number of randowm read wait states is 1.
Definition: flash.h:202
volatile uint16_t FOTPWAIT
OTP Read Access Wait State Register.
Definition: flash.h:241
Denotes the number of one-time programmable (OTP) wait states is 9.
Definition: flash.h:165
Denotes the number of randowm read wait states is 3.
Definition: flash.h:204
volatile uint16_t FSTATUS
Status Register.
Definition: flash.h:237
FLASH_NumPagedWaitStates_e
Enumeration to define the number of paged wait states.
Definition: flash.h:177
Denotes the number of randowm read wait states is 2.
Definition: flash.h:203
volatile uint16_t rsvd_1
Reserved.
Definition: flash.h:235
Defines the flash (FLASH) object.
Definition: flash.h:232
Denotes a pump and bank standby power mode.
Definition: flash.h:225
Denotes the number of paged read wait states is 1.
Definition: flash.h:180
Denotes the number of one-time programmable (OTP) wait states is 14.
Definition: flash.h:170
void FLASH_setStandbyWaitCount(FLASH_Handle flashHandle, const uint16_t count)
Sets the standby wait count.
Definition: flash.c:290
volatile uint16_t FPWR
Flash Power Modes Register.
Definition: flash.h:236
Denotes the number of one-time programmable (OTP) wait states is 1.
Definition: flash.h:157
uint16_t FLASH_getStandbyWaitCount(FLASH_Handle flashHandle)
Gets the standby wait count.
Definition: flash.c:154
FLASH_NumRandomWaitStates_e
Enumeration to define the number of random wait states.
Definition: flash.h:200
Denotes the number of one-time programmable (OTP) wait states is 8.
Definition: flash.h:164
Denotes the number of randowm read wait states is 8.
Definition: flash.h:209
Denotes the flash counter is counting.
Definition: flash.h:149
Denotes the number of randowm read wait states is 6.
Definition: flash.h:207
Denotes the number of paged read wait states is 13.
Definition: flash.h:192
Denotes the number of paged read wait states is 9.
Definition: flash.h:188
void FLASH_setNumRandomReadWaitStates(FLASH_Handle flashHandle, const FLASH_NumRandomWaitStates_e numStates)
Sets the number of random read wait states.
Definition: flash.c:230
FLASH_PowerMode_e FLASH_getPowerMode(FLASH_Handle flashHandle)
Gets the power mode.
Definition: flash.c:142
Denotes the number of paged read wait states is 15.
Definition: flash.h:194
Denotes the number of one-time programmable (OTP) wait states is 6.
Definition: flash.h:162
struct _FLASH_Obj_ * FLASH_Handle
Defines the flash (FLASH) handle.
Definition: flash.h:247
FLASH_PowerMode_e
Enumeration to define the power modes.
Definition: flash.h:222
Denotes the 3V flash voltage went out of range.
Definition: flash.h:140
Denotes the number of paged read wait states is 3.
Definition: flash.h:182
void FLASH_clear3VStatus(FLASH_Handle flashHandle)
Clears the 3V status.
Definition: flash.c:56
Denotes the number of paged read wait states is 8.
Definition: flash.h:187
Denotes the number of paged read wait states is 0.
Definition: flash.h:179