CANopenLinux
CANopenNode on Linux devices
Loading...
Searching...
No Matches
Data storage with Linux

Data initialize, store and restore functions with Linux. More...

+ Collaboration diagram for Data storage with Linux:

Files

file  CO_storageLinux.h
 CANopen data storage object for Linux.
 

Functions

CO_ReturnError_t CO_storageLinux_init (CO_storage_t *storage, CO_CANmodule_t *CANmodule, OD_entry_t *OD_1010_StoreParameters, OD_entry_t *OD_1011_RestoreDefaultParam, CO_storage_entry_t *entries, uint8_t entriesCount, uint32_t *storageInitError)
 Initialize data storage object (Linux specific)
 
uint32_t CO_storageLinux_auto_process (CO_storage_t *storage, bool_t closeFiles)
 Automatically save data if differs from previous call.
 

Detailed Description

Data initialize, store and restore functions with Linux.

See also Data storage base.

Function Documentation

◆ CO_storageLinux_init()

CO_ReturnError_t CO_storageLinux_init ( CO_storage_t * storage,
CO_CANmodule_t * CANmodule,
OD_entry_t * OD_1010_StoreParameters,
OD_entry_t * OD_1011_RestoreDefaultParam,
CO_storage_entry_t * entries,
uint8_t entriesCount,
uint32_t * storageInitError )

Initialize data storage object (Linux specific)

This function should be called by application after the program startup, before CO_CANopenInit(). This function initializes storage object, OD extensions on objects 1010 and 1011, reads data from file, verifies them and writes data to addresses specified inside entries. This function internally calls CO_storage_init().

Parameters
storageThis object will be initialized. It must be defined by application and must exist permanently.
CANmoduleCAN device, used for CO_LOCK_OD() macro.
OD_1010_StoreParametersOD entry for 0x1010 -"Store parameters". Entry is optional, may be NULL.
OD_1011_RestoreDefaultParamOD entry for 0x1011 -"Restore default parameters". Entry is optional, may be NULL.
entriesPointer to array of storage entries, see CO_storage_init.
entriesCountCount of storage entries
[out]storageInitErrorIf function returns CO_ERROR_DATA_CORRUPT, then this variable contains a bit mask from subIndexOD values, where data was not properly initialized. If other error, then this variable contains index or erroneous entry.
Returns
CO_ERROR_NO, CO_ERROR_DATA_CORRUPT if data can not be initialized, CO_ERROR_ILLEGAL_ARGUMENT or CO_ERROR_OUT_OF_MEMORY.

◆ CO_storageLinux_auto_process()

uint32_t CO_storageLinux_auto_process ( CO_storage_t * storage,
bool_t closeFiles )

Automatically save data if differs from previous call.

Should be called cyclically by program. Each interval it verifies, if crc checksum of data differs from previous checksum. If it does, data are saved into pre-opened file.

Parameters
storageThis object
closeFilesIf true, then all files will be closed. Use on end of the program.
Returns
0 on success or bit mask from subIndexOD values, where data was not able to be saved.