MCPcopy Create free account
hub / github.com/CANopenNode/CANopenNode / CO_storageBlank_init

Function CO_storageBlank_init

example/CO_storageBlank.c:52–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52CO_ReturnError_t
53CO_storageBlank_init(CO_storage_t* storage, CO_CANmodule_t* CANmodule, OD_entry_t* OD_1010_StoreParameters,
54 OD_entry_t* OD_1011_RestoreDefaultParam, CO_storage_entry_t* entries, uint8_t entriesCount,
55 uint32_t* storageInitError) {
56 CO_ReturnError_t ret;
57
58 /* verify arguments */
59 if (storage == NULL || entries == NULL || entriesCount == 0 || storageInitError == NULL) {
60 return CO_ERROR_ILLEGAL_ARGUMENT;
61 }
62
63 /* initialize storage and OD extensions */
64 ret = CO_storage_init(storage, CANmodule, OD_1010_StoreParameters, OD_1011_RestoreDefaultParam, storeBlank,
65 restoreBlank, entries, entriesCount);
66 if (ret != CO_ERROR_NO) {
67 return ret;
68 }
69
70 /* initialize entries */
71 *storageInitError = 0;
72 for (uint8_t i = 0; i < entriesCount; i++) {
73 CO_storage_entry_t* entry = &entries[i];
74
75 /* verify arguments */
76 if (entry->addr == NULL || entry->len == 0 || entry->subIndexOD < 2) {
77 *storageInitError = i;
78 return CO_ERROR_ILLEGAL_ARGUMENT;
79 }
80
81 /* Open a file and read data from file to entry->addr */
82 /* file = open(entry->pathToFileOrPointerToMemory); */
83 /* read(entry->addr, entry->len, file); */
84 }
85
86 return ret;
87}
88
89#endif /* (CO_CONFIG_STORAGE) & CO_CONFIG_STORAGE_ENABLE */

Callers 1

mainFunction · 0.85

Calls 1

CO_storage_initFunction · 0.85

Tested by

no test coverage detected