1
0
Fork 0

Fix CO_storageEeprom. CO_LOCK_OD must not be used, as it is used inside SDO server already.

This commit is contained in:
Janez 2024-03-13 12:23:10 +01:00
parent 32274bef99
commit 9d2a65cda7
2 changed files with 5 additions and 8 deletions

View file

@ -257,9 +257,8 @@ typedef struct {
* not large enough. ("*returnCode" must not return 'ODR_PARTIAL', if there
* is still space in "buf".)
*
* @warning When accessing OD variables by calling the read() function, it
* may be necessary to use @ref CO_LOCK_OD() and @ref CO_UNLOCK_OD() macros.
* See @ref CO_critical_sections for more information.
* @warning Do not use @ref CO_LOCK_OD() and @ref CO_UNLOCK_OD() macros
* inside the read() function. See also @ref CO_critical_sections.
*
* @param stream Object Dictionary stream object.
* @param buf Pointer to external buffer, where to data will be copied.
@ -288,9 +287,8 @@ typedef struct {
* "write" function must always copy all available data from buf. If OD
* variable expect more data, then "*returnCode" must return 'ODR_PARTIAL'.
*
* @warning When accessing OD variables by calling the read() function, it
* may be necessary to use @ref CO_LOCK_OD() and @ref CO_UNLOCK_OD() macros.
* See @ref CO_critical_sections for more information.
* @warning Do not use @ref CO_LOCK_OD() and @ref CO_UNLOCK_OD() macros
* inside the write() function. See also @ref CO_critical_sections.
*
* @param stream Object Dictionary stream object.
* @param buf Pointer to external buffer, from where data will be copied.

View file

@ -34,14 +34,13 @@
* For more information see file CO_storage.h, CO_storage_entry_t.
*/
static ODR_t storeEeprom(CO_storage_entry_t *entry, CO_CANmodule_t *CANmodule) {
(void) CANmodule;
bool_t writeOk;
/* save data to the eeprom */
CO_LOCK_OD(CANmodule);
writeOk = CO_eeprom_writeBlock(entry->storageModule, entry->addr,
entry->eepromAddr, entry->len);
entry->crc = crc16_ccitt(entry->addr, entry->len, 0);
CO_UNLOCK_OD(CANmodule);
/* Verify, if data in eeprom are equal */
uint16_t crc_read = CO_eeprom_getCrcBlock(entry->storageModule,