@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,217 @@
|
|
|
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 <xc.h>
|
|
24
|
+
#include "../${moduleNameLowerCase}.h"
|
|
25
|
+
|
|
26
|
+
enum FLASH_PROGRAM_ERASE_ERROR_CODE getProgramEraseErrorCode(void);
|
|
27
|
+
|
|
28
|
+
enum FLASH_PROGRAM_ERASE_ERROR_CODE {
|
|
29
|
+
ERROR_INVALID_OP = 1,
|
|
30
|
+
ERROR_SECURITY_ACCESS_VIOLATION,
|
|
31
|
+
ERROR_FLASH_PANEL_CONTROL_LOGIC,
|
|
32
|
+
ERROR_ROW_OP_SYSTEM_BUS,
|
|
33
|
+
ERROR_ROW_OP_WARM_RESET
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
<#if generateNonBlockingAPI == false && generateInterfaceContent == true>
|
|
37
|
+
// Section: Driver Interface
|
|
38
|
+
const struct ${moduleNameUpperCase}_INTERFACE flash = {
|
|
39
|
+
.PageErase = FLASH_PageErase,
|
|
40
|
+
.Write = FLASH_WordWrite,
|
|
41
|
+
<#if flashHasRowProgramming == 1>
|
|
42
|
+
.RowWrite = FLASH_RowWrite,
|
|
43
|
+
<#else>
|
|
44
|
+
.RowWrite = NULL,
|
|
45
|
+
</#if>
|
|
46
|
+
.Read = FLASH_Read,
|
|
47
|
+
.PageAddressGet = FLASH_ErasePageAddressGet,
|
|
48
|
+
.PageOffsetGet = FLASH_ErasePageOffsetGet,
|
|
49
|
+
.NonBlockingPageErase = NULL,
|
|
50
|
+
.NonBlockingBulkErase = NULL,
|
|
51
|
+
.NonBlockingRead = NULL,
|
|
52
|
+
.NonBlockingWordWrite = NULL,
|
|
53
|
+
.NonBlockingRowWrite = NULL,
|
|
54
|
+
.NonBlockingPolledPageErase = NULL,
|
|
55
|
+
.NonBlockingPolledBulkErase = NULL,
|
|
56
|
+
.NonBlockingPolledRead = NULL,
|
|
57
|
+
.NonBlockingPolledWordWrite = NULL,
|
|
58
|
+
.NonBlockingPolledRowWrite = NULL,
|
|
59
|
+
};
|
|
60
|
+
</#if>
|
|
61
|
+
|
|
62
|
+
enum FLASH_RETURN_STATUS ${moduleNameUpperCase}_PageErase(flash_adr_t flashAddress, flash_key_t unlockKey)
|
|
63
|
+
{
|
|
64
|
+
enum FLASH_RETURN_STATUS flashReturnStatus = FLASH_NO_ERROR;
|
|
65
|
+
|
|
66
|
+
if(unlockKey != (flash_key_t)FLASH_UNLOCK_KEY)
|
|
67
|
+
{
|
|
68
|
+
flashReturnStatus = FLASH_INVALID_KEY;
|
|
69
|
+
}
|
|
70
|
+
else if (0U != (flashAddress & ~FLASH_ERASE_PAGE_MASK))
|
|
71
|
+
{
|
|
72
|
+
flashReturnStatus = FLASH_INVALID_ADDRESS;
|
|
73
|
+
}
|
|
74
|
+
else
|
|
75
|
+
{
|
|
76
|
+
${nvmAddressRegister} = flashAddress;
|
|
77
|
+
${nvmControlRegister} = FLASH_PAGE_ERASE_OPCODE;
|
|
78
|
+
${nvmControlRegister}bits.WR = 1U;
|
|
79
|
+
while(1U == ${nvmControlRegister}bits.WR){};
|
|
80
|
+
|
|
81
|
+
flashReturnStatus = getProgramEraseErrorCode();
|
|
82
|
+
}
|
|
83
|
+
return flashReturnStatus;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
enum FLASH_RETURN_STATUS ${moduleNameUpperCase}_WordWrite(flash_adr_t flashAddress, flash_data_t *data, flash_key_t unlockKey)
|
|
87
|
+
{
|
|
88
|
+
enum FLASH_RETURN_STATUS flashReturnStatus = FLASH_NO_ERROR;
|
|
89
|
+
if (NULL == data)
|
|
90
|
+
{
|
|
91
|
+
flashReturnStatus = FLASH_INVALID_DATA;
|
|
92
|
+
}
|
|
93
|
+
else if(unlockKey != (flash_key_t)FLASH_UNLOCK_KEY)
|
|
94
|
+
{
|
|
95
|
+
flashReturnStatus = FLASH_INVALID_KEY;
|
|
96
|
+
}
|
|
97
|
+
else if (0U != (flashAddress % FLASH_ADDRESS_MASK))
|
|
98
|
+
{
|
|
99
|
+
flashReturnStatus = FLASH_INVALID_ADDRESS;
|
|
100
|
+
}
|
|
101
|
+
else
|
|
102
|
+
{
|
|
103
|
+
${nvmDataRegister0} = *data;
|
|
104
|
+
${nvmDataRegister1} = *(data + 1U);
|
|
105
|
+
${nvmDataRegister2} = *(data + 2U);
|
|
106
|
+
${nvmDataRegister3} = *(data + 3U);
|
|
107
|
+
|
|
108
|
+
${nvmAddressRegister} = flashAddress;
|
|
109
|
+
${nvmControlRegister} = FLASH_WORD_WRITE_OPCODE;
|
|
110
|
+
|
|
111
|
+
${nvmControlRegister}bits.WR = 1U;
|
|
112
|
+
while (1U == ${nvmControlRegister}bits.WR){};
|
|
113
|
+
|
|
114
|
+
flashReturnStatus = getProgramEraseErrorCode();
|
|
115
|
+
}
|
|
116
|
+
return flashReturnStatus;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
<#if properties.FLASH_HAS_ROW_PROGRAMMING.value == "TRUE">
|
|
120
|
+
enum FLASH_RETURN_STATUS ${moduleNameUpperCase}_RowWrite(flash_adr_t flashAddress, flash_data_t *data, flash_key_t unlockKey)
|
|
121
|
+
{
|
|
122
|
+
enum FLASH_RETURN_STATUS flashReturnStatus = FLASH_NO_ERROR;
|
|
123
|
+
if (NULL == data)
|
|
124
|
+
{
|
|
125
|
+
flashReturnStatus = FLASH_INVALID_DATA;
|
|
126
|
+
}
|
|
127
|
+
else if(unlockKey != (flash_key_t)FLASH_UNLOCK_KEY)
|
|
128
|
+
{
|
|
129
|
+
flashReturnStatus = FLASH_INVALID_KEY;
|
|
130
|
+
}
|
|
131
|
+
else if (0U != (flashAddress % FLASH_ADDRESS_MASK))
|
|
132
|
+
{
|
|
133
|
+
flashReturnStatus = FLASH_INVALID_ADDRESS;
|
|
134
|
+
}
|
|
135
|
+
else
|
|
136
|
+
{
|
|
137
|
+
${nvmSrcAddressRegister} = (uint32_t)data;
|
|
138
|
+
${nvmAddressRegister} = flashAddress;
|
|
139
|
+
${nvmControlRegister} = FLASH_ROW_WRITE_OPCODE;
|
|
140
|
+
|
|
141
|
+
${nvmControlRegister}bits.WR = 1U;
|
|
142
|
+
while (1U == ${nvmControlRegister}bits.WR){};
|
|
143
|
+
|
|
144
|
+
flashReturnStatus = getProgramEraseErrorCode();
|
|
145
|
+
}
|
|
146
|
+
return flashReturnStatus;
|
|
147
|
+
}
|
|
148
|
+
</#if>
|
|
149
|
+
|
|
150
|
+
enum FLASH_RETURN_STATUS ${moduleNameUpperCase}_Read(flash_adr_t flashAddress, size_t count, flash_data_t *data)
|
|
151
|
+
{
|
|
152
|
+
flash_adr_t *flashReadAddress = (flash_adr_t *)flashAddress;
|
|
153
|
+
enum FLASH_RETURN_STATUS flashReturnStatus = FLASH_NO_ERROR;
|
|
154
|
+
|
|
155
|
+
if ((NULL == data) || (0U == count))
|
|
156
|
+
{
|
|
157
|
+
flashReturnStatus = FLASH_INVALID_DATA;
|
|
158
|
+
}
|
|
159
|
+
else if (0U != (flashAddress % FLASH_ADDRESS_MASK))
|
|
160
|
+
{
|
|
161
|
+
flashReturnStatus = FLASH_INVALID_ADDRESS;
|
|
162
|
+
}
|
|
163
|
+
else
|
|
164
|
+
{
|
|
165
|
+
uint32_t index;
|
|
166
|
+
for(index = 0; index < count ; index++)
|
|
167
|
+
{
|
|
168
|
+
*data = *(flashReadAddress+index);
|
|
169
|
+
data++;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return flashReturnStatus;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
uint16_t ${moduleNameUpperCase}_ErasePageOffsetGet(flash_adr_t address)
|
|
176
|
+
{
|
|
177
|
+
return ((~FLASH_ERASE_PAGE_MASK) & address);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
uint32_t ${moduleNameUpperCase}_ErasePageAddressGet(flash_adr_t address)
|
|
181
|
+
{
|
|
182
|
+
return (FLASH_ERASE_PAGE_MASK & address);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
enum FLASH_PROGRAM_ERASE_ERROR_CODE getProgramEraseErrorCode(void)
|
|
186
|
+
{
|
|
187
|
+
enum FLASH_RETURN_STATUS flashErrorCode = FLASH_NO_ERROR;
|
|
188
|
+
if(1U == ${nvmControlRegister}bits.WRERR)
|
|
189
|
+
{
|
|
190
|
+
flashErrorCode = FLASH_WRITE_ERROR;
|
|
191
|
+
}
|
|
192
|
+
else if(ERROR_INVALID_OP == ${nvmControlRegister}bits.WREC)
|
|
193
|
+
{
|
|
194
|
+
flashErrorCode = FLASH_INVALID_OEPRATION;
|
|
195
|
+
}
|
|
196
|
+
else if(ERROR_SECURITY_ACCESS_VIOLATION == ${nvmControlRegister}bits.WREC)
|
|
197
|
+
{
|
|
198
|
+
flashErrorCode = FLASH_SECURITY_ACCESS_CONTROL_ERROR;
|
|
199
|
+
}
|
|
200
|
+
else if(ERROR_FLASH_PANEL_CONTROL_LOGIC == ${nvmControlRegister}bits.WREC)
|
|
201
|
+
{
|
|
202
|
+
flashErrorCode = FLASH_PANEL_CONTROL_LOGIC_ERROR;
|
|
203
|
+
}
|
|
204
|
+
else if(ERROR_ROW_OP_SYSTEM_BUS == ${nvmControlRegister}bits.WREC)
|
|
205
|
+
{
|
|
206
|
+
flashErrorCode = FLASH_ROW_OP_SYSTEM_BUS_ERROR;
|
|
207
|
+
}
|
|
208
|
+
else if(ERROR_ROW_OP_WARM_RESET == ${nvmControlRegister}bits.WREC)
|
|
209
|
+
{
|
|
210
|
+
flashErrorCode = FLASH_ROW_OP_WARM_RESET_ERROR;
|
|
211
|
+
}
|
|
212
|
+
else
|
|
213
|
+
{
|
|
214
|
+
flashErrorCode = FLASH_NO_ERROR;
|
|
215
|
+
}
|
|
216
|
+
return flashErrorCode;
|
|
217
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
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_H
|
|
24
|
+
#define FLASH_H
|
|
25
|
+
|
|
26
|
+
#include <stdint.h>
|
|
27
|
+
#include <stddef.h>
|
|
28
|
+
#include <stdbool.h>
|
|
29
|
+
<#if generateInterfaceContent == true>
|
|
30
|
+
#include "${moduleNameLowerCase}_interface.h"
|
|
31
|
+
/**
|
|
32
|
+
@ingroup ${moduleNameLowerCase}driver
|
|
33
|
+
@brief Structure object of type ${moduleNameUpperCase}_INTERFACE assigned with name
|
|
34
|
+
displayed in the Melody Driver User interface. A structure pointer can be used to achieve portability
|
|
35
|
+
across the ${moduleNameUpperCase} having same interface structure.
|
|
36
|
+
*/
|
|
37
|
+
extern const struct ${moduleNameUpperCase}_INTERFACE flash;
|
|
38
|
+
</#if>
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
42
|
+
* @brief This function erases a page.
|
|
43
|
+
* @param[in] flashAddress : Flash address
|
|
44
|
+
* @param[in] unlockKey : Pointer of the data to be written
|
|
45
|
+
* @return FLASH_RETURN_STATUS: returns FLASH_NO_ERROR if operation is successful , else returns errors like FLASH_INVALID_ADDRESS, FLASH_WRITE_ERROR
|
|
46
|
+
<#if functionHeaderExample == true>
|
|
47
|
+
*
|
|
48
|
+
* @b Example:
|
|
49
|
+
* @code
|
|
50
|
+
* FLASH_RETURN_STATUS status = ${moduleNameUpperCase}_PageErase(flashAddress), unlockKey);
|
|
51
|
+
* @endcode
|
|
52
|
+
</#if>
|
|
53
|
+
*/
|
|
54
|
+
enum FLASH_RETURN_STATUS ${moduleNameUpperCase}_PageErase(flash_adr_t flashAddress, flash_key_t unlockKey);
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
59
|
+
* @brief This function writes the specified data to the specified address.
|
|
60
|
+
* @param[in] flashAddress : Flash address
|
|
61
|
+
* @param[in] data : Pointer of the data to be written.
|
|
62
|
+
<#if properties.FLASH_WORD_WRITE_SIZE_IN_INSTRUCTIONS.value == "4">
|
|
63
|
+
* This will write the 4 WORDS pointed to by the pointer.
|
|
64
|
+
</#if>
|
|
65
|
+
* @return FLASH_RETURN_STATUS: returns FLASH_NO_ERROR if operation is successful , else returns errors like FLASH_INVALID_ADDRESS, FLASH_INVALID_DATA, FLASH_WRITE_ERROR
|
|
66
|
+
<#if functionHeaderExample == true>
|
|
67
|
+
*
|
|
68
|
+
* @b Example:
|
|
69
|
+
* @code
|
|
70
|
+
* uint32_t data[10];
|
|
71
|
+
* uint32_t index = 0;
|
|
72
|
+
* for(index = 0; index < ROW_SIZE; index++)
|
|
73
|
+
* {
|
|
74
|
+
* data[index] = index;
|
|
75
|
+
* }
|
|
76
|
+
* FLASH_RETURN_STATUS status = ${moduleNameUpperCase}_WordWrite(flashAddress), &data, unlockKey);
|
|
77
|
+
* @endcode
|
|
78
|
+
</#if>
|
|
79
|
+
*/
|
|
80
|
+
enum FLASH_RETURN_STATUS ${moduleNameUpperCase}_WordWrite(flash_adr_t flashAddress, flash_data_t *data, flash_key_t unlockKey);
|
|
81
|
+
|
|
82
|
+
<#if properties.FLASH_HAS_ROW_PROGRAMMING.value == "TRUE">
|
|
83
|
+
/**
|
|
84
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
85
|
+
* @brief This function writes the specified data to the specified address.
|
|
86
|
+
* @param[in] flashAddress : Flash address
|
|
87
|
+
* @param[in] data : Pointer of the data to be written
|
|
88
|
+
* @return FLASH_RETURN_STATUS: returns FLASH_NO_ERROR if operation is successful , else returns errors like FLASH_INVALID_ADDRESS, FLASH_INVALID_DATA, FLASH_WRITE_ERROR
|
|
89
|
+
<#if functionHeaderExample == true>
|
|
90
|
+
*
|
|
91
|
+
* @b Example:
|
|
92
|
+
* @code
|
|
93
|
+
* uint32_t data[FLASH_WRITE_INSTRUCTION_COUNT];
|
|
94
|
+
* uint32_t index = 0;
|
|
95
|
+
* for(index = 0; index<ROW_SIZE; index++)
|
|
96
|
+
* {
|
|
97
|
+
* data[index] = index;
|
|
98
|
+
* }
|
|
99
|
+
* FLASH_RETURN_STATUS status = ${moduleNameUpperCase}_RowWrite(flashAddress), &data, unlockKey);
|
|
100
|
+
* @endcode
|
|
101
|
+
</#if>
|
|
102
|
+
*/
|
|
103
|
+
enum FLASH_RETURN_STATUS ${moduleNameUpperCase}_RowWrite(flash_adr_t flashAddress, flash_data_t *data, flash_key_t unlockKey);
|
|
104
|
+
</#if>
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
108
|
+
* @brief This function reads the data from the specified address.
|
|
109
|
+
* @param[in] flashAddress : Flash address
|
|
110
|
+
* @param[out] data : Pointer to read the data
|
|
111
|
+
* @return FLASH_RETURN_STATUS: returns FLASH_NO_ERROR if operation is successful , else returns errors like FLASH_INVALID_ADDRESS, FLASH_INVALID_DATA
|
|
112
|
+
<#if functionHeaderExample == true>
|
|
113
|
+
*
|
|
114
|
+
* @b Example:
|
|
115
|
+
* @code
|
|
116
|
+
* uint32_t data[2];
|
|
117
|
+
* FLASH_RETURN_STATUS status = ${moduleNameUpperCase}_Read(flashAddress, &data);
|
|
118
|
+
* @endcode
|
|
119
|
+
</#if>
|
|
120
|
+
*/
|
|
121
|
+
enum FLASH_RETURN_STATUS ${moduleNameUpperCase}_Read(flash_adr_t flashAddress, size_t count, flash_data_t *data);
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
125
|
+
* @brief This function returns the offest from page start.
|
|
126
|
+
* @param[in] flashAddress : Flash address
|
|
127
|
+
* @return FLASH_RETURN_STATUS: returns the flash offset from page start address
|
|
128
|
+
<#if functionHeaderExample == true>
|
|
129
|
+
*
|
|
130
|
+
* @b Example:
|
|
131
|
+
* @code
|
|
132
|
+
* uint16_t offset = ${moduleNameUpperCase}_ErasePageOffsetGet(flashAddress);
|
|
133
|
+
* @endcode
|
|
134
|
+
</#if>
|
|
135
|
+
*/
|
|
136
|
+
uint16_t ${moduleNameUpperCase}_ErasePageOffsetGet(flash_adr_t flashAddress);
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @ingroup ${moduleNameLowerCase}driver
|
|
141
|
+
* @brief This function returns the offest from page start.
|
|
142
|
+
* @param[in] flashAddress : Flash address
|
|
143
|
+
* @return FLASH_RETURN_STATUS: returns page start address for the given address
|
|
144
|
+
<#if functionHeaderExample == true>
|
|
145
|
+
*
|
|
146
|
+
* @b Example:
|
|
147
|
+
* @code
|
|
148
|
+
* uint32_t pageStartAddress = ${moduleNameUpperCase}_ErasePageAddressGet(flashAddress);
|
|
149
|
+
* @endcode
|
|
150
|
+
</#if>
|
|
151
|
+
*/
|
|
152
|
+
uint32_t ${moduleNameUpperCase}_ErasePageAddressGet(flash_adr_t flashAddress);
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
#endif /* FLASH_H */
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* ${moduleNameLowerCase} Generated Driver Interface Header File
|
|
4
|
+
*
|
|
5
|
+
* @file ${moduleNameLowerCase}_interface.h
|
|
6
|
+
*
|
|
7
|
+
* @defgroup ${moduleNameLowerCase}driver ${doxyDriverGroupName}
|
|
8
|
+
*
|
|
9
|
+
* @brief ${moduleNameUpperCase} Driver using dsPIC MCUs
|
|
10
|
+
*
|
|
11
|
+
* @skipline @version Firmware Driver Version 1.1.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
|
+
#ifndef ${moduleNameUpperCase}_INTERFACE_H
|
|
23
|
+
#define ${moduleNameUpperCase}_INTERFACE_H
|
|
24
|
+
|
|
25
|
+
// Section: Included Files
|
|
26
|
+
#include <stdint.h>
|
|
27
|
+
#include <stdbool.h>
|
|
28
|
+
#include <stddef.h>
|
|
29
|
+
#include "flash_types.h"
|
|
30
|
+
|
|
31
|
+
// Section: Data Type Definitions
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
@ingroup ${moduleNameLowerCase}driver
|
|
36
|
+
@struct ${moduleNameUpperCase}_INTERFACE
|
|
37
|
+
@brief Structure containing the function pointers of ${moduleNameUpperCase} driver.
|
|
38
|
+
*/
|
|
39
|
+
struct ${moduleNameUpperCase}_INTERFACE
|
|
40
|
+
{
|
|
41
|
+
enum FLASH_RETURN_STATUS (*PageErase)(flash_adr_t address, flash_key_t unlockKey);
|
|
42
|
+
///< Pointer to FLASH_PageErase e.g. \ref FLASH_PageErase
|
|
43
|
+
|
|
44
|
+
enum FLASH_RETURN_STATUS (*Write)(flash_adr_t address, flash_data_t* data, flash_key_t unlockKey);
|
|
45
|
+
///< Pointer to FLASH_WordWrite e.g. \ref FLASH_WordWrite
|
|
46
|
+
|
|
47
|
+
enum FLASH_RETURN_STATUS (*RowWrite)(flash_adr_t address, flash_data_t* data, flash_key_t unlockKey);
|
|
48
|
+
///< Pointer to FLASH_RowWrite e.g. \ref FLASH_RowWrite
|
|
49
|
+
|
|
50
|
+
enum FLASH_RETURN_STATUS (*Read)(flash_adr_t address, size_t count, uint32_t *data);
|
|
51
|
+
///< Pointer to FLASH_Read e.g. \ref FLASH_Read
|
|
52
|
+
|
|
53
|
+
uint32_t (*PageAddressGet)(flash_adr_t address);
|
|
54
|
+
///< Pointer to FLASH_ErasePageAddressGet e.g. \ref FLASH_ErasePageAddressGet
|
|
55
|
+
|
|
56
|
+
uint16_t (*PageOffsetGet)(flash_adr_t address);
|
|
57
|
+
///< Pointer to FLASH_ErasePageOffsetGet e.g. \ref FLASH_ErasePageOffsetGet
|
|
58
|
+
|
|
59
|
+
enum FLASH_RETURN_STATUS (*OperationStatusGet)(void);
|
|
60
|
+
///< Pointer to FLASH_OperationStatusGet e.g. \ref FLASH_OperationStatusGet
|
|
61
|
+
|
|
62
|
+
enum FLASH_RETURN_STATUS (*NonBlockingPageErase)(flash_adr_t address, flash_key_t unlockKey, FLASH_CALLBACK callbackHandler, void* context);
|
|
63
|
+
///< Pointer to FLASH_NonBlockingPageErase e.g. \ref FLASH_NonBlockingPageErase
|
|
64
|
+
|
|
65
|
+
enum FLASH_RETURN_STATUS (*NonBlockingBulkErase)(enum FLASH_PANEL panel, flash_key_t unlockKey, FLASH_CALLBACK callbackHandler, void* context);
|
|
66
|
+
///< Pointer to FLASH_NonBlockingBulkErase e.g. \ref FLASH_NonBlockingBulkErase
|
|
67
|
+
|
|
68
|
+
enum FLASH_RETURN_STATUS (*NonBlockingWordWrite)(flash_adr_t address, flash_data_t* data, flash_key_t unlockKey, FLASH_CALLBACK callbackHandler, void* context);
|
|
69
|
+
///< Pointer to FLASH_NonBlockingWordWrite e.g. \ref FLASH_NonBlockingWordWrite
|
|
70
|
+
|
|
71
|
+
enum FLASH_RETURN_STATUS (*NonBlockingRowWrite)(flash_adr_t address, flash_data_t* data, flash_key_t unlockKey, FLASH_CALLBACK callbackHandler, void* context);
|
|
72
|
+
///< Pointer to FLASH_NonBlockingRowWrite e.g. \ref FLASH_NonBlockingRowWrite
|
|
73
|
+
|
|
74
|
+
enum FLASH_RETURN_STATUS (*NonBlockingRead)(flash_adr_t address, size_t count, uint32_t *data);
|
|
75
|
+
///< Pointer to FLASH_NonBlockingRead e.g. \ref FLASH_NonBlockingRead
|
|
76
|
+
|
|
77
|
+
enum FLASH_RETURN_STATUS (*NonBlockingPolledPageErase)(flash_adr_t address, flash_key_t unlockKey);
|
|
78
|
+
///< Pointer to FLASH_NonBlockingPolledPageErase e.g. \ref FLASH_NonBlockingPolledPageErase
|
|
79
|
+
|
|
80
|
+
enum FLASH_RETURN_STATUS (*NonBlockingPolledBulkErase)(enum FLASH_PANEL panel, flash_key_t unlockKey);
|
|
81
|
+
///< Pointer to FLASH_NonBlockingPolledBulkErase e.g. \ref FLASH_NonBlockingPolledBulkErase
|
|
82
|
+
|
|
83
|
+
enum FLASH_RETURN_STATUS (*NonBlockingPolledWordWrite)(flash_adr_t address, flash_data_t* data, flash_key_t unlockKey);
|
|
84
|
+
///< Pointer to FLASH_NonBlockingPolledWordWrite e.g. \ref FLASH_NonBlockingPolledWordWrite
|
|
85
|
+
|
|
86
|
+
enum FLASH_RETURN_STATUS (*NonBlockingPolledRowWrite)(flash_adr_t address, flash_data_t* data, flash_key_t unlockKey);
|
|
87
|
+
///< Pointer to FLASH_NonBlockingPolledRowWrite e.g. \ref FLASH_NonBlockingPolledRowWrite
|
|
88
|
+
|
|
89
|
+
enum FLASH_RETURN_STATUS (*NonBlockingPolledRead)(flash_adr_t address, size_t count, uint32_t *data);
|
|
90
|
+
///< Pointer to FLASH_NonBlockingPolledRead e.g. \ref FLASH_NonBlockingPolledRead
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
#endif //${moduleNameUpperCase}_INTERFACE_H
|