@mchp-mcc/dspic33a-flash 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +7 -0
- package/LICENSE.txt +21 -0
- package/Readme.md +11 -0
- package/lib/generated_module/src/index.js +11 -0
- package/output/autoCreator.js +4378 -0
- package/output/autoCreator.js.map +1 -0
- package/output/autoProcessor.js +4380 -0
- package/output/autoProcessor.js.map +1 -0
- package/output/creator.js +10498 -0
- package/output/creator.js.map +1 -0
- package/output/flash-a-core-ftl/flash.c.ftl +217 -0
- package/output/flash-a-core-ftl/flash.h.ftl +155 -0
- package/output/flash-a-core-ftl/flash_interface.h.ftl +93 -0
- package/output/flash-a-core-ftl/flash_nonblocking.c.ftl +367 -0
- package/output/flash-a-core-ftl/flash_nonblocking.h.ftl +342 -0
- package/output/flash-a-core-ftl/flash_types.h.ftl +101 -0
- package/output/nullPrototype.json +43 -0
- package/output/processor.js +10498 -0
- package/output/processor.js.map +1 -0
- package/package.json +156 -0
- package/src/CreatorFunctions.ts +17 -0
- package/src/DerivedData.ts +975 -0
- package/src/GeneratorModel.ts +138 -0
- package/src/catalog.json +25 -0
- package/src/moduleConfig.json +677 -0
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
<#assign headerFiles = interfaceApi.interfaceApi.headerFiles>
|
|
2
|
+
/**
|
|
3
|
+
* ${moduleNameUpperCase} Generated Driver Source File
|
|
4
|
+
*
|
|
5
|
+
* @file ${moduleNameLowerCase}.c
|
|
6
|
+
*
|
|
7
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
8
|
+
*
|
|
9
|
+
* @brief This is the generated driver source file for ${moduleNameUpperCase} driver
|
|
10
|
+
*
|
|
11
|
+
* @skipline @version Firmware Driver Version 1.0.0
|
|
12
|
+
<#if generatePLIBVersion == true>
|
|
13
|
+
*
|
|
14
|
+
* @skipline @version PLIB Version ${PLIBVersion}
|
|
15
|
+
</#if>
|
|
16
|
+
*
|
|
17
|
+
* @skipline Device : ${selectedDevice}
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
${disclaimer}
|
|
21
|
+
|
|
22
|
+
#include <stddef.h>
|
|
23
|
+
#include "../flash_nonblocking.h"
|
|
24
|
+
|
|
25
|
+
enum FLASH_PROGRAM_ERASE_ERROR_CODE {
|
|
26
|
+
ERROR_INVALID_OP = 1,
|
|
27
|
+
ERROR_SECURITY_ACCESS_VIOLATION,
|
|
28
|
+
ERROR_FLASH_PANEL_CONTROL_LOGIC,
|
|
29
|
+
ERROR_ROW_OP_SYSTEM_BUS,
|
|
30
|
+
ERROR_ROW_OP_WARM_RESET
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
<#if interruptDriven == true>
|
|
34
|
+
// User callback and context handles.
|
|
35
|
+
static void (*userCallbackHandler)(void *) = NULL;
|
|
36
|
+
static void *userContext = NULL;
|
|
37
|
+
</#if>
|
|
38
|
+
static bool lock = false;
|
|
39
|
+
|
|
40
|
+
<#if generateInterfaceContent == true>
|
|
41
|
+
|
|
42
|
+
// Section: Driver Interface
|
|
43
|
+
const struct ${moduleNameUpperCase}_INTERFACE flash = {
|
|
44
|
+
<#if generateBlockingAPI == true>
|
|
45
|
+
.PageErase = FLASH_PageErase,
|
|
46
|
+
.Read = FLASH_Read,
|
|
47
|
+
.Write = FLASH_WordWrite,
|
|
48
|
+
<#if flashHasRowProgramming == 1>
|
|
49
|
+
.RowWrite = FLASH_RowWrite,
|
|
50
|
+
<#else>
|
|
51
|
+
.RowWrite = NULL,
|
|
52
|
+
</#if>
|
|
53
|
+
</#if>
|
|
54
|
+
.PageAddressGet = FLASH_ErasePageAddressGet,
|
|
55
|
+
.PageOffsetGet = FLASH_ErasePageOffsetGet,
|
|
56
|
+
<#if interruptDriven == true>
|
|
57
|
+
.NonBlockingPageErase = FLASH_NonBlockingPageErase,
|
|
58
|
+
.NonBlockingBulkErase = NULL,
|
|
59
|
+
.NonBlockingRead = FLASH_NonBlockingRead,
|
|
60
|
+
.NonBlockingWordWrite = FLASH_NonBlockingWordWrite,
|
|
61
|
+
<#if flashHasRowProgramming == 1>
|
|
62
|
+
.NonBlockingRowWrite = FLASH_NonBlockingRowWrite,
|
|
63
|
+
<#else>
|
|
64
|
+
.NonBlockingRowWrite = NULL,
|
|
65
|
+
</#if>
|
|
66
|
+
.NonBlockingPolledPageErase = NULL,
|
|
67
|
+
.NonBlockingPolledBulkErase = NULL,
|
|
68
|
+
.NonBlockingPolledRead = NULL,
|
|
69
|
+
.NonBlockingPolledWordWrite = NULL,
|
|
70
|
+
.NonBlockingPolledRowWrite = NULL,
|
|
71
|
+
<#else>
|
|
72
|
+
.NonBlockingPageErase = NULL,
|
|
73
|
+
.NonBlockingBulkErase = NULL,
|
|
74
|
+
.NonBlockingRead = NULL,
|
|
75
|
+
.NonBlockingWordWrite = NULL,
|
|
76
|
+
.NonBlockingRowWrite = NULL,
|
|
77
|
+
.NonBlockingPolledPageErase = FLASH_NonBlockingPolledPageErase,
|
|
78
|
+
.NonBlockingPolledBulkErase = NULL,
|
|
79
|
+
.NonBlockingPolledRead = FLASH_NonBlockingPolledRead,
|
|
80
|
+
.NonBlockingPolledWordWrite = FLASH_NonBlockingPolledWordWrite,
|
|
81
|
+
<#if flashHasRowProgramming == 1>
|
|
82
|
+
.NonBlockingPolledRowWrite = FLASH_NonBlockingPolledRowWrite,
|
|
83
|
+
<#else>
|
|
84
|
+
.NonBlockingPolledRowWrite = NULL,
|
|
85
|
+
</#if>
|
|
86
|
+
</#if>
|
|
87
|
+
.OperationStatusGet = FLASH_OperationStatusGet
|
|
88
|
+
|
|
89
|
+
};
|
|
90
|
+
</#if>
|
|
91
|
+
|
|
92
|
+
<#if interruptDriven == true>
|
|
93
|
+
void FLASH_Initialize(void)
|
|
94
|
+
{
|
|
95
|
+
// Flash Interrupt
|
|
96
|
+
${flashInterruptFlag} = 0U;
|
|
97
|
+
${flashInterruptEnable} = 1U;
|
|
98
|
+
}
|
|
99
|
+
</#if>
|
|
100
|
+
|
|
101
|
+
<#if interruptDriven == true>
|
|
102
|
+
<#if isFlashContextSupported>
|
|
103
|
+
void __attribute__ ( ( interrupt, no_auto_psv, context ) ) ${flashIsrHandlerName}(void)
|
|
104
|
+
<#else>
|
|
105
|
+
void __attribute__ ( ( interrupt, no_auto_psv ) ) ${flashIsrHandlerName}(void)
|
|
106
|
+
</#if>
|
|
107
|
+
{
|
|
108
|
+
${flashInterruptFlag} = 0U;
|
|
109
|
+
|
|
110
|
+
//Interrupt means operation completion, release the lock
|
|
111
|
+
lock = false;
|
|
112
|
+
|
|
113
|
+
if (NULL != userCallbackHandler) {
|
|
114
|
+
(*userCallbackHandler)(userContext);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
</#if>
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
enum FLASH_RETURN_STATUS FLASH_OperationStatusGet(void)
|
|
121
|
+
{
|
|
122
|
+
enum FLASH_RETURN_STATUS flashReturnStatus = FLASH_NO_ERROR;
|
|
123
|
+
if(1U == ${nvmControlRegister}bits.WR)
|
|
124
|
+
{
|
|
125
|
+
flashReturnStatus = FLASH_OP_BUSY;
|
|
126
|
+
}
|
|
127
|
+
else
|
|
128
|
+
{
|
|
129
|
+
if(1U == ${nvmControlRegister}bits.WRERR)
|
|
130
|
+
{
|
|
131
|
+
flashReturnStatus = FLASH_WRITE_ERROR;
|
|
132
|
+
}
|
|
133
|
+
else if(ERROR_INVALID_OP == ${nvmControlRegister}bits.WREC)
|
|
134
|
+
{
|
|
135
|
+
flashReturnStatus = FLASH_INVALID_OEPRATION;
|
|
136
|
+
}
|
|
137
|
+
else if(ERROR_SECURITY_ACCESS_VIOLATION == ${nvmControlRegister}bits.WREC)
|
|
138
|
+
{
|
|
139
|
+
flashReturnStatus = FLASH_SECURITY_ACCESS_CONTROL_ERROR;
|
|
140
|
+
}
|
|
141
|
+
else if(ERROR_FLASH_PANEL_CONTROL_LOGIC == ${nvmControlRegister}bits.WREC)
|
|
142
|
+
{
|
|
143
|
+
flashReturnStatus = FLASH_PANEL_CONTROL_LOGIC_ERROR;
|
|
144
|
+
}
|
|
145
|
+
else if(ERROR_ROW_OP_SYSTEM_BUS == ${nvmControlRegister}bits.WREC)
|
|
146
|
+
{
|
|
147
|
+
flashReturnStatus = FLASH_ROW_OP_SYSTEM_BUS_ERROR;
|
|
148
|
+
}
|
|
149
|
+
else if(ERROR_ROW_OP_WARM_RESET == ${nvmControlRegister}bits.WREC)
|
|
150
|
+
{
|
|
151
|
+
flashReturnStatus = FLASH_ROW_OP_WARM_RESET_ERROR;
|
|
152
|
+
}
|
|
153
|
+
else
|
|
154
|
+
{
|
|
155
|
+
flashReturnStatus = FLASH_NO_ERROR;
|
|
156
|
+
}
|
|
157
|
+
lock = false;
|
|
158
|
+
}
|
|
159
|
+
return flashReturnStatus;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
<#if interruptDriven == true>
|
|
164
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingPageErase(flash_adr_t flashAddress, flash_key_t unlockKey, FLASH_CALLBACK callbackHandler, void* context)
|
|
165
|
+
<#else>
|
|
166
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingPolledPageErase(flash_adr_t flashAddress, flash_key_t unlockKey)
|
|
167
|
+
</#if>
|
|
168
|
+
{
|
|
169
|
+
enum FLASH_RETURN_STATUS flashReturnStatus = FLASH_OP_IN_PROGRESS;
|
|
170
|
+
if(false == lock)
|
|
171
|
+
{
|
|
172
|
+
if(unlockKey != (flash_key_t)FLASH_UNLOCK_KEY)
|
|
173
|
+
{
|
|
174
|
+
flashReturnStatus = FLASH_INVALID_KEY;
|
|
175
|
+
}
|
|
176
|
+
if (0U != (flashAddress & ~FLASH_ERASE_PAGE_MASK))
|
|
177
|
+
{
|
|
178
|
+
flashReturnStatus = FLASH_INVALID_ADDRESS;
|
|
179
|
+
}
|
|
180
|
+
<#if interruptDriven == true>
|
|
181
|
+
else if(NULL == callbackHandler)
|
|
182
|
+
{
|
|
183
|
+
flashReturnStatus = FLASH_INVALID_CALLBACK_HANDLER;
|
|
184
|
+
}
|
|
185
|
+
</#if>
|
|
186
|
+
else if(0U != ${nvmControlRegister}bits.WR)
|
|
187
|
+
{
|
|
188
|
+
flashReturnStatus = FLASH_OP_BUSY;
|
|
189
|
+
}
|
|
190
|
+
else
|
|
191
|
+
{
|
|
192
|
+
<#if interruptDriven == true>
|
|
193
|
+
userCallbackHandler = callbackHandler;
|
|
194
|
+
userContext = context;
|
|
195
|
+
</#if>
|
|
196
|
+
lock = true;
|
|
197
|
+
${nvmAddressRegister} = flashAddress;
|
|
198
|
+
${nvmControlRegister} = FLASH_PAGE_ERASE_OPCODE;
|
|
199
|
+
${nvmControlRegister}bits.WR = 1U;
|
|
200
|
+
lock = false;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return flashReturnStatus;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
<#if interruptDriven == true>
|
|
208
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingWordWrite(flash_adr_t flashAddress, flash_data_t *data, flash_key_t unlockKey, FLASH_CALLBACK callbackHandler, void* context)
|
|
209
|
+
<#else>
|
|
210
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingPolledWordWrite(flash_adr_t flashAddress, flash_data_t *data, flash_key_t unlockKey)
|
|
211
|
+
</#if>
|
|
212
|
+
{
|
|
213
|
+
enum FLASH_RETURN_STATUS flashReturnStatus = FLASH_OP_IN_PROGRESS;
|
|
214
|
+
if(false == lock)
|
|
215
|
+
{
|
|
216
|
+
if (NULL == data)
|
|
217
|
+
{
|
|
218
|
+
flashReturnStatus = FLASH_INVALID_DATA;
|
|
219
|
+
}
|
|
220
|
+
else if(unlockKey != (flash_key_t)FLASH_UNLOCK_KEY)
|
|
221
|
+
{
|
|
222
|
+
flashReturnStatus = FLASH_INVALID_KEY;
|
|
223
|
+
}
|
|
224
|
+
else if (0U != (flashAddress % FLASH_ADDRESS_MASK))
|
|
225
|
+
{
|
|
226
|
+
flashReturnStatus = FLASH_INVALID_ADDRESS;
|
|
227
|
+
}
|
|
228
|
+
<#if interruptDriven == true>
|
|
229
|
+
else if(NULL == callbackHandler)
|
|
230
|
+
{
|
|
231
|
+
flashReturnStatus = FLASH_INVALID_CALLBACK_HANDLER;
|
|
232
|
+
}
|
|
233
|
+
</#if>
|
|
234
|
+
else if(0U != ${nvmControlRegister}bits.WR)
|
|
235
|
+
{
|
|
236
|
+
flashReturnStatus = FLASH_OP_BUSY;
|
|
237
|
+
}
|
|
238
|
+
else
|
|
239
|
+
{
|
|
240
|
+
<#if interruptDriven == true>
|
|
241
|
+
// Save the handler and context to call for completion of this operation.
|
|
242
|
+
userCallbackHandler = callbackHandler;
|
|
243
|
+
userContext = context;
|
|
244
|
+
</#if>
|
|
245
|
+
lock = true;
|
|
246
|
+
${nvmDataRegister0} = *data;
|
|
247
|
+
${nvmDataRegister1} = *(data + 1U);
|
|
248
|
+
${nvmDataRegister2} = *(data + 2U);
|
|
249
|
+
${nvmDataRegister3} = *(data + 3U);
|
|
250
|
+
|
|
251
|
+
${nvmAddressRegister} = flashAddress;
|
|
252
|
+
${nvmControlRegister} = FLASH_WORD_WRITE_OPCODE;
|
|
253
|
+
|
|
254
|
+
${nvmControlRegister}bits.WR = 1U;
|
|
255
|
+
lock = false;
|
|
256
|
+
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return flashReturnStatus;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
<#if properties.FLASH_HAS_ROW_PROGRAMMING.value == "TRUE">
|
|
263
|
+
<#if interruptDriven == true>
|
|
264
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingRowWrite(flash_adr_t flashAddress, flash_data_t *data, flash_key_t unlockKey, FLASH_CALLBACK callbackHandler, void* context)
|
|
265
|
+
<#else>
|
|
266
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingPolledRowWrite(flash_adr_t flashAddress, flash_data_t *data, flash_key_t unlockKey)
|
|
267
|
+
</#if>
|
|
268
|
+
{
|
|
269
|
+
enum FLASH_RETURN_STATUS flashReturnStatus = FLASH_OP_IN_PROGRESS;
|
|
270
|
+
if(false == lock)
|
|
271
|
+
{
|
|
272
|
+
if (NULL == data)
|
|
273
|
+
{
|
|
274
|
+
flashReturnStatus = FLASH_INVALID_DATA;
|
|
275
|
+
}
|
|
276
|
+
else if(unlockKey != (flash_key_t)FLASH_UNLOCK_KEY)
|
|
277
|
+
{
|
|
278
|
+
flashReturnStatus = FLASH_INVALID_KEY;
|
|
279
|
+
}
|
|
280
|
+
else if (0U != (flashAddress % FLASH_ADDRESS_MASK))
|
|
281
|
+
{
|
|
282
|
+
flashReturnStatus = FLASH_INVALID_ADDRESS;
|
|
283
|
+
}
|
|
284
|
+
<#if interruptDriven == true>
|
|
285
|
+
else if(NULL == callbackHandler)
|
|
286
|
+
{
|
|
287
|
+
flashReturnStatus = FLASH_INVALID_CALLBACK_HANDLER;
|
|
288
|
+
}
|
|
289
|
+
</#if>
|
|
290
|
+
else if(0U != ${nvmControlRegister}bits.WR)
|
|
291
|
+
{
|
|
292
|
+
flashReturnStatus = FLASH_OP_BUSY;
|
|
293
|
+
}
|
|
294
|
+
else
|
|
295
|
+
{
|
|
296
|
+
<#if interruptDriven == true>
|
|
297
|
+
// Save the handler and context to call for completion of this operation.
|
|
298
|
+
userCallbackHandler = callbackHandler;
|
|
299
|
+
userContext = context;
|
|
300
|
+
</#if>
|
|
301
|
+
lock = true;
|
|
302
|
+
${nvmSrcAddressRegister} = (uint32_t)data;
|
|
303
|
+
${nvmAddressRegister} = flashAddress;
|
|
304
|
+
${nvmControlRegister} = FLASH_ROW_WRITE_OPCODE;
|
|
305
|
+
|
|
306
|
+
${nvmControlRegister}bits.WR = 1U;
|
|
307
|
+
lock = false;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return flashReturnStatus;
|
|
311
|
+
}
|
|
312
|
+
</#if>
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
<#if interruptDriven == true>
|
|
316
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingRead(flash_adr_t flashAddress, size_t count, flash_data_t *data)
|
|
317
|
+
<#else>
|
|
318
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingPolledRead(flash_adr_t flashAddress, size_t count, flash_data_t *data)
|
|
319
|
+
</#if>
|
|
320
|
+
{
|
|
321
|
+
flash_adr_t *flashReadAddress = (flash_adr_t *)flashAddress;
|
|
322
|
+
enum FLASH_RETURN_STATUS flashReturnStatus = FLASH_OP_BUSY;
|
|
323
|
+
|
|
324
|
+
if(false == lock)
|
|
325
|
+
{
|
|
326
|
+
if ((NULL == data) || (0U == count))
|
|
327
|
+
{
|
|
328
|
+
flashReturnStatus = FLASH_INVALID_DATA;
|
|
329
|
+
}
|
|
330
|
+
else if (0U != (flashAddress % FLASH_ADDRESS_MASK))
|
|
331
|
+
{
|
|
332
|
+
flashReturnStatus = FLASH_INVALID_ADDRESS;
|
|
333
|
+
}
|
|
334
|
+
else if(0U != ${nvmControlRegister}bits.WR)
|
|
335
|
+
{
|
|
336
|
+
flashReturnStatus = FLASH_OP_BUSY;
|
|
337
|
+
}
|
|
338
|
+
else
|
|
339
|
+
{
|
|
340
|
+
uint32_t index;
|
|
341
|
+
lock = true;
|
|
342
|
+
for(index = 0; index < count ; index++)
|
|
343
|
+
{
|
|
344
|
+
*data = *(flashReadAddress+index);
|
|
345
|
+
data++;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
flashReturnStatus = FLASH_NO_ERROR;
|
|
349
|
+
|
|
350
|
+
// Now that the read is done, the lock can be cleared.
|
|
351
|
+
lock = false;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return flashReturnStatus;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
<#if generateBlockingAPI == false>
|
|
358
|
+
uint16_t ${moduleNameUpperCase}_ErasePageOffsetGet(flash_adr_t address)
|
|
359
|
+
{
|
|
360
|
+
return ((~FLASH_ERASE_PAGE_MASK) & address);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
uint32_t ${moduleNameUpperCase}_ErasePageAddressGet(flash_adr_t address)
|
|
364
|
+
{
|
|
365
|
+
return (FLASH_ERASE_PAGE_MASK & address);
|
|
366
|
+
}
|
|
367
|
+
</#if>
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
<#assign functionHeaderExample = false>
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ${moduleNameUpperCase} Generated Driver Header File
|
|
5
|
+
*
|
|
6
|
+
* @file ${moduleNameLowerCase}.h
|
|
7
|
+
*
|
|
8
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
9
|
+
*
|
|
10
|
+
* @brief ${moduleNameUpperCase} driver using dsPIC MCUs
|
|
11
|
+
*
|
|
12
|
+
* @skipline @version Firmware Driver Version 1.0.0
|
|
13
|
+
<#if generatePLIBVersion == true>
|
|
14
|
+
*
|
|
15
|
+
* @skipline @version PLIB Version ${PLIBVersion}
|
|
16
|
+
</#if>
|
|
17
|
+
*
|
|
18
|
+
* @skipline Device : ${selectedDevice}
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
${disclaimer}
|
|
22
|
+
|
|
23
|
+
#ifndef FLASH_NONBLOCKING_H
|
|
24
|
+
#define FLASH_NONBLOCKING_H
|
|
25
|
+
|
|
26
|
+
#include <stdint.h>
|
|
27
|
+
#include <stddef.h>
|
|
28
|
+
#include <stdbool.h>
|
|
29
|
+
#include "xc.h"
|
|
30
|
+
<#if generateBlockingAPI == true>
|
|
31
|
+
#include "../flash/flash.h"
|
|
32
|
+
</#if>
|
|
33
|
+
|
|
34
|
+
<#if generateBlockingAPI == false && generateInterfaceContent == true>
|
|
35
|
+
#include "${moduleNameLowerCase}_interface.h"
|
|
36
|
+
|
|
37
|
+
// Section: Data Type Definitions
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
@ingroup ${moduleNameLowerCase}driver
|
|
41
|
+
@brief Structure object of type ${moduleNameUpperCase}_INTERFACE assigned with name
|
|
42
|
+
displayed in the Melody Driver User interface. A structure pointer can be used to achieve portability
|
|
43
|
+
across the ${moduleNameUpperCase} having same interface structure.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
extern const struct ${moduleNameUpperCase}_INTERFACE flash;
|
|
47
|
+
</#if>
|
|
48
|
+
|
|
49
|
+
// Section: Data Type Definitions
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @ingroup flashdriver
|
|
53
|
+
* @brief This function initializes the nvm controller.
|
|
54
|
+
* @return void
|
|
55
|
+
*/
|
|
56
|
+
void FLASH_Initialize(void);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @ingroup flashdriver
|
|
60
|
+
* @brief This function gets the status of nvm controller.
|
|
61
|
+
* @return returns the status of the previous operation.
|
|
62
|
+
*/
|
|
63
|
+
enum FLASH_RETURN_STATUS FLASH_OperationStatusGet(void);
|
|
64
|
+
|
|
65
|
+
<#if interruptDriven == true>
|
|
66
|
+
/**
|
|
67
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
68
|
+
* @brief This function erases a page.
|
|
69
|
+
* @param[in] flashAddress : Flash address
|
|
70
|
+
* @param[in] unlockKey : Flash unlock key
|
|
71
|
+
* @param[in] callbackHandler : Pointer to call back handler
|
|
72
|
+
* @param[in] context : Optional pointer to context to handle user contexts
|
|
73
|
+
* @return FLASH_RETURN_STATUS: returns FLASH_NO_ERROR if operation is successful, if the operation is in progress then it returns FLASH_OP_IN_PROGRESS,
|
|
74
|
+
* if there is a previous operation in progress then it returns FLASH_OP_BUSY , in case of any unsuccessful operation it returns errors like
|
|
75
|
+
* FLASH_INVALID_ADDRESS, FLASH_INVALID_CALLBACK_HANDLER, FLASH_WRITE_ERROR
|
|
76
|
+
<#if functionHeaderExample == true>
|
|
77
|
+
*
|
|
78
|
+
* @b Example:
|
|
79
|
+
* @code
|
|
80
|
+
* FLASH_RETURN_STATUS status = FLASH_NonBlockingPageErase(flashAddress, unlockKey, callbackHandler, context);
|
|
81
|
+
* @endcode
|
|
82
|
+
</#if>
|
|
83
|
+
*/
|
|
84
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingPageErase(flash_adr_t flashAddress, flash_key_t unlockKey, FLASH_CALLBACK callbackHandler, void* context);
|
|
85
|
+
<#else>
|
|
86
|
+
/**
|
|
87
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
88
|
+
* @brief This function erases a page.
|
|
89
|
+
* @param[in] flashAddress : Flash address
|
|
90
|
+
* @param[in] unlockKey : Flash unlock key
|
|
91
|
+
* @return FLASH_RETURN_STATUS : returns FLASH_NO_ERROR if operation is successful, if the operation is in progress then it returns FLASH_OP_IN_PROGRESS,
|
|
92
|
+
* if there is a previous operation in progress then it returns FLASH_OP_BUSY , in case of any unsuccessful operation it returns errors like
|
|
93
|
+
* FLASH_INVALID_ADDRESS, FLASH_WRITE_ERROR
|
|
94
|
+
* This function locks flash operations to prevent multiple access. Make sure to call FLASH_OperationStatusGet() after calling FLASH_NonBlockingPolledPageErase() to release the lock.
|
|
95
|
+
<#if functionHeaderExample == true>
|
|
96
|
+
*
|
|
97
|
+
* @b Example:
|
|
98
|
+
* @code
|
|
99
|
+
* FLASH_RETURN_STATUS status = FLASH_NonBlockingPolledPageErase(flashAddress, unlockKey);
|
|
100
|
+
while (FLASH_OperationStatusGet() == FLASH_OP_BUSY);
|
|
101
|
+
* @endcode
|
|
102
|
+
</#if>
|
|
103
|
+
*/
|
|
104
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingPolledPageErase(flash_adr_t flashAddress, flash_key_t unlockKey);
|
|
105
|
+
</#if>
|
|
106
|
+
|
|
107
|
+
<#if interruptDriven == true>
|
|
108
|
+
/**
|
|
109
|
+
* @ingroup flashdriver
|
|
110
|
+
* @brief This function erases a panel.
|
|
111
|
+
* @param[in] panel : Flash panel to erase
|
|
112
|
+
* @param[in] unlockKey : Flash unlock key
|
|
113
|
+
* @return * @return returns FLASH_NO_ERROR if operation is successful, if the operation is in progress then it returns FLASH_OP_IN_PROGRESS,
|
|
114
|
+
* if there is a previous operation in progress then it returns FLASH_OP_BUSY , in case of any unsuccessful operation it returns errors like
|
|
115
|
+
* FLASH_INVALID_ADDRESS, FLASH_INVALID_CALLBACK_HANDLER, FLASH_WRITE_ERROR
|
|
116
|
+
<#if functionHeaderExample == true>
|
|
117
|
+
*
|
|
118
|
+
* @b Example:
|
|
119
|
+
* @code
|
|
120
|
+
* FLASH_RETURN_STATUS status = FLASH_NonBlockingBulkErase(panel, unlockKey, callbackHandler, context);
|
|
121
|
+
* @endcode
|
|
122
|
+
</#if>
|
|
123
|
+
*/
|
|
124
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingBulkErase(enum FLASH_PANEL panel, flash_key_t unlockKey, FLASH_CALLBACK callbackHandler, void* context);
|
|
125
|
+
<#else>
|
|
126
|
+
/**
|
|
127
|
+
* @ingroup flashdriver
|
|
128
|
+
* @brief This function erases a panel.
|
|
129
|
+
* @param[in] panel : Flash panel to erase
|
|
130
|
+
* @param[in] unlockKey : Flash unlock key
|
|
131
|
+
* @return * @return returns FLASH_NO_ERROR if operation is successful, if the operation is in progress then it returns FLASH_OP_IN_PROGRESS,
|
|
132
|
+
* if there is a previous operation in progress then it returns FLASH_OP_BUSY , in case of any unsuccessful operation it returns errors like
|
|
133
|
+
* FLASH_INVALID_ADDRESS, FLASH_WRITE_ERROR
|
|
134
|
+
* This function locks flash operations to prevent multiple access. This function locks flash operations to prevent multiple access. Make sure to call FLASH_OperationStatusGet() after calling FLASH_NonBlockingPolledPageErase() to release the lock.
|
|
135
|
+
<#if functionHeaderExample == true>
|
|
136
|
+
*
|
|
137
|
+
* @b Example:
|
|
138
|
+
* @code
|
|
139
|
+
* FLASH_RETURN_STATUS status = FLASH_NonBlockingPolledBulkErase(panel, unlockKey);
|
|
140
|
+
* @endcode
|
|
141
|
+
</#if>
|
|
142
|
+
*/
|
|
143
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingPolledBulkErase(enum FLASH_PANEL panel, flash_key_t unlockKey);
|
|
144
|
+
</#if>
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
<#if interruptDriven == true>
|
|
148
|
+
/**
|
|
149
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
150
|
+
* @brief This function writes the specified data to the specified address.
|
|
151
|
+
* @param[in] flashAddress : Flash address
|
|
152
|
+
* @param[in] data : Pointer of the data to be written.
|
|
153
|
+
* @param[in] unlockKey : Flash unlock Key.
|
|
154
|
+
* @param[in] callbackHandler : pointer to call back handler
|
|
155
|
+
* @param[in] context : Optional pointer to context to handle user contexts
|
|
156
|
+
<#if properties.FLASH_WORD_WRITE_SIZE_IN_INSTRUCTIONS.value == "2">
|
|
157
|
+
* This will write the TWO WORDS pointed to by the pointer.
|
|
158
|
+
</#if>
|
|
159
|
+
* @return FLASH_RETURN_STATUS: returns FLASH_NO_ERROR if operation is successful, if the operation is in progress then it returns FLASH_OP_IN_PROGRESS,
|
|
160
|
+
* if there is a previous operation in progress then it returns FLASH_OP_BUSY , in case of any unsuccessful operation it returns errors like
|
|
161
|
+
* FLASH_INVALID_ADDRESS, FLASH_INVALID_CALLBACK_HANDLER, FLASH_WRITE_ERROR
|
|
162
|
+
<#if functionHeaderExample == true>
|
|
163
|
+
*
|
|
164
|
+
* @b Example:
|
|
165
|
+
* @code
|
|
166
|
+
* uint32_t data[10];
|
|
167
|
+
* uint32_t index = 0;
|
|
168
|
+
* for(index = 0; index < ROW_SIZE; index++)
|
|
169
|
+
* {
|
|
170
|
+
* data[index] = index;
|
|
171
|
+
* }
|
|
172
|
+
* FLASH_RETURN_STATUS status = FLASH_NonBlockingWordWrite(flashAddress, &data, unlockKey, callbackHandler, context);
|
|
173
|
+
* @endcode
|
|
174
|
+
</#if>
|
|
175
|
+
*/
|
|
176
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingWordWrite(flash_adr_t flashAddress, flash_data_t *data, flash_key_t unlockKey, FLASH_CALLBACK callbackHandler, void* context);
|
|
177
|
+
<#else>
|
|
178
|
+
/**
|
|
179
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
180
|
+
* @brief This function writes the specified data to the specified address.
|
|
181
|
+
* @param[in] flashAddress : Flash address
|
|
182
|
+
* @param[in] data : Pointer of the data to be written.
|
|
183
|
+
* @param[in] unlockKey : Flash unlock Key.
|
|
184
|
+
* This function locks flash operations to prevent multiple access. Make sure to call FLASH_OperationStatusGet() after calling FLASH_NonBlockingPolledWordWrite() to release the lock.
|
|
185
|
+
<#if properties.FLASH_WORD_WRITE_SIZE_IN_INSTRUCTIONS.value == "2">
|
|
186
|
+
* This will write the TWO WORDS pointed to by the pointer.
|
|
187
|
+
</#if>
|
|
188
|
+
* @return FLASH_RETURN_STATUS: returns FLASH_NO_ERROR if operation is successful, if the operation is in progress then it returns FLASH_OP_IN_PROGRESS,
|
|
189
|
+
* if there is a previous operation in progress then it returns FLASH_OP_BUSY , in case of any unsuccessful operation it returns errors like
|
|
190
|
+
* FLASH_INVALID_ADDRESS, FLASH_INVALID_DATA
|
|
191
|
+
<#if functionHeaderExample == true>
|
|
192
|
+
*
|
|
193
|
+
* @b Example:
|
|
194
|
+
* @code
|
|
195
|
+
* uint32_t data[10];
|
|
196
|
+
* uint32_t index = 0;
|
|
197
|
+
* for(index = 0; index < ROW_SIZE; index++)
|
|
198
|
+
* {
|
|
199
|
+
* data[index] = index;
|
|
200
|
+
* }
|
|
201
|
+
* FLASH_RETURN_STATUS status = FLASH_NonBlockingPolledWordWrite(flashAddress, &data, unlockKey);
|
|
202
|
+
while (FLASH_OperationStatusGet() == FLASH_OP_BUSY);
|
|
203
|
+
* @endcode
|
|
204
|
+
</#if>
|
|
205
|
+
*/
|
|
206
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingPolledWordWrite(flash_adr_t flashAddress, flash_data_t *data, flash_key_t unlockKey);
|
|
207
|
+
</#if>
|
|
208
|
+
|
|
209
|
+
<#if properties.FLASH_HAS_ROW_PROGRAMMING.value == "TRUE">
|
|
210
|
+
<#if interruptDriven == true>
|
|
211
|
+
/**
|
|
212
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
213
|
+
* @brief This function writes the specified data to the specified address.
|
|
214
|
+
* @param[in] flashAddress : Flash address
|
|
215
|
+
* @param[in] data : Pointer of the data to be written
|
|
216
|
+
* @param[in] unlockKey : Flash unlock Key.
|
|
217
|
+
* @param[in] callbackHandler : Pointer to call back handler
|
|
218
|
+
* @param[in] context : Optional pointer to context to handle user contexts
|
|
219
|
+
* @return FLASH_RETURN_STATUS: returns FLASH_NO_ERROR if operation is successful, if the operation is in progress then it returns FLASH_OP_IN_PROGRESS,
|
|
220
|
+
* if there is a previous operation in progress then it returns FLASH_OP_BUSY , in case of any unsuccessful operation it returns errors like
|
|
221
|
+
* FLASH_INVALID_ADDRESS, FLASH_INVALID_CALLBACK_HANDLER, FLASH_WRITE_ERROR
|
|
222
|
+
<#if functionHeaderExample == true>
|
|
223
|
+
*
|
|
224
|
+
* @b Example:
|
|
225
|
+
* @code
|
|
226
|
+
* uint32_t data[FLASH_WRITE_INSTRUCTION_COUNT];
|
|
227
|
+
* uint32_t index = 0;
|
|
228
|
+
* for(index = 0; index < ROW_SIZE ;index++)
|
|
229
|
+
* {
|
|
230
|
+
* data[index] = index;
|
|
231
|
+
* }
|
|
232
|
+
* FLASH_RETURN_STATUS status = FLASH_NonBlockingRowWrite(flashAddress, &data, unlockKey, callback, context);
|
|
233
|
+
* @endcode
|
|
234
|
+
</#if>
|
|
235
|
+
*/
|
|
236
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingRowWrite(flash_adr_t flashAddress, flash_data_t *data, flash_key_t unlockKey, FLASH_CALLBACK callback, void* context);
|
|
237
|
+
<#else>
|
|
238
|
+
/**
|
|
239
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
240
|
+
* @brief This function writes the specified data to the specified address.
|
|
241
|
+
* @param[in] flashAddress : Flash address
|
|
242
|
+
* @param[in] data : Pointer of the data to be written
|
|
243
|
+
* @param[in] unlockKey : Flash unlock Key.
|
|
244
|
+
* @return FLASH_RETURN_STATUS: returns FLASH_NO_ERROR if operation is successful, if the operation is in progress then it returns FLASH_OP_IN_PROGRESS,
|
|
245
|
+
* if there is a previous operation in progress then it returns FLASH_OP_BUSY , in case of any unsuccessful operation it returns errors like
|
|
246
|
+
* FLASH_INVALID_ADDRESS, FLASH_INVALID_DATA
|
|
247
|
+
* This function locks flash operations to prevent multiple access. Make sure to call FLASH_OperationStatusGet() after calling FLASH_NonBlockingPolledRowWrite() to release the lock.
|
|
248
|
+
<#if functionHeaderExample == true>
|
|
249
|
+
*
|
|
250
|
+
* @b Example:
|
|
251
|
+
* @code
|
|
252
|
+
* uint32_t data[FLASH_WRITE_INSTRUCTION_COUNT];
|
|
253
|
+
* uint32_t index = 0;
|
|
254
|
+
* for(index = 0; index < ROW_SIZE; index++)
|
|
255
|
+
* {
|
|
256
|
+
* data[index] = index;
|
|
257
|
+
* }
|
|
258
|
+
* FLASH_RETURN_STATUS status = FLASH_NonBlockingPolledRowWrite(flashAddress, &data, unlockKey);
|
|
259
|
+
while (FLASH_OperationStatusGet() == FLASH_OP_BUSY);
|
|
260
|
+
* @endcode
|
|
261
|
+
</#if>
|
|
262
|
+
*/
|
|
263
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingPolledRowWrite(flash_adr_t flashAddress, flash_data_t *data, flash_key_t unlockKey);
|
|
264
|
+
</#if>
|
|
265
|
+
</#if>
|
|
266
|
+
|
|
267
|
+
<#if interruptDriven == true>
|
|
268
|
+
/**
|
|
269
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
270
|
+
* @brief This function reads the data from the specified address.
|
|
271
|
+
* @param[in] flashAddress : Flash address of
|
|
272
|
+
* @param[out] data : Pointer to read the data
|
|
273
|
+
* @return FLASH_RETURN_STATUS: returns FLASH_NO_ERROR if operation is successful, if the operation is in progress then it returns FLASH_OP_IN_PROGRESS,
|
|
274
|
+
* if there is a previous operation in progress then it returns FLASH_OP_BUSY , in case of any unsuccessful operation it returns errors like
|
|
275
|
+
* FLASH_INVALID_ADDRESS, FLASH_INVALID_DATA
|
|
276
|
+
<#if functionHeaderExample == true>
|
|
277
|
+
*
|
|
278
|
+
* @b Example:
|
|
279
|
+
* @code
|
|
280
|
+
* uint32_t data[2];
|
|
281
|
+
* uint32_t count = 2;
|
|
282
|
+
* FLASH_RETURN_STATUS status = FLASH_NonBlockingRead(flashAddress, count, &data);
|
|
283
|
+
* @endcode
|
|
284
|
+
</#if>
|
|
285
|
+
*/
|
|
286
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingRead(flash_adr_t flashAddress, size_t count, flash_data_t *data);
|
|
287
|
+
<#else>
|
|
288
|
+
/**
|
|
289
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
290
|
+
* @brief This function reads the data from the specified address.
|
|
291
|
+
* @param[in] flashAddress : Flash address of
|
|
292
|
+
* @param[out] data : Pointer to read the data
|
|
293
|
+
* @return FLASH_RETURN_STATUS: returns FLASH_NO_ERROR if operation is successful, if the operation is in progress then it returns FLASH_OP_IN_PROGRESS,
|
|
294
|
+
* if there is a previous operation in progress then it returns FLASH_OP_BUSY , in case of any unsuccessful operation it returns errors like
|
|
295
|
+
* FLASH_INVALID_ADDRESS, FLASH_INVALID_DATA
|
|
296
|
+
<#if functionHeaderExample == true>
|
|
297
|
+
*
|
|
298
|
+
* @b Example:
|
|
299
|
+
* @code
|
|
300
|
+
* uint32_t data[2];
|
|
301
|
+
* uint32_t count = 2;
|
|
302
|
+
* FLASH_RETURN_STATUS status = FLASH_NonBlockingPolledRead(flashAddress, count, &data);
|
|
303
|
+
* @endcode
|
|
304
|
+
</#if>
|
|
305
|
+
*/
|
|
306
|
+
enum FLASH_RETURN_STATUS FLASH_NonBlockingPolledRead(flash_adr_t flashAddress, size_t count, flash_data_t *data);
|
|
307
|
+
</#if>
|
|
308
|
+
|
|
309
|
+
<#if generateBlockingAPI == false>
|
|
310
|
+
/**
|
|
311
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
312
|
+
* @brief This function returns the offest from page start.
|
|
313
|
+
* @param[in] flashAddress : Flash address
|
|
314
|
+
* @return FLASH_RETURN_STATUS: returns the flash offset from page start address
|
|
315
|
+
<#if functionHeaderExample == true>
|
|
316
|
+
*
|
|
317
|
+
* @b Example:
|
|
318
|
+
* @code
|
|
319
|
+
* uint16_t offset = ${moduleNameUpperCase}_ErasePageOffsetGet(flashAddress);
|
|
320
|
+
* @endcode
|
|
321
|
+
</#if>
|
|
322
|
+
*/
|
|
323
|
+
uint16_t ${moduleNameUpperCase}_ErasePageOffsetGet(flash_adr_t flashAddress);
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
328
|
+
* @brief This function returns the offest from page start.
|
|
329
|
+
* @param[in] flashAddress : Flash address
|
|
330
|
+
* @return FLASH_RETURN_STATUS: returns page start address for the given address
|
|
331
|
+
<#if functionHeaderExample == true>
|
|
332
|
+
*
|
|
333
|
+
* @b Example:
|
|
334
|
+
* @code
|
|
335
|
+
* uint32_t pageStartAddress = ${moduleNameUpperCase}_ErasePageAddressGet(flashAddress);
|
|
336
|
+
* @endcode
|
|
337
|
+
</#if>
|
|
338
|
+
*/
|
|
339
|
+
uint32_t ${moduleNameUpperCase}_ErasePageAddressGet(flash_adr_t flashAddress);
|
|
340
|
+
</#if>
|
|
341
|
+
|
|
342
|
+
#endif /* FLASH_NONBLOCKING_H */
|