CANopen Slave Documentation
Version 6.16.04
|
For data access to a non-volatile memory (e.g. EEPROM) a simple API with read and write functions is provided.
Enumerations | |
enum | NVM_ERR_e { eNVM_ERR_NONE = 0x00 , eNVM_ERR_OK = 0x00 , eNVM_ERR_INIT = 0x01 , eNVM_ERR_ADDRESS = 0x02 , eNVM_ERR_READ = 0x04 , eNVM_ERR_WRITE = 0x08 , eNVM_ERR_ERASE = 0x10 , eNVM_ERR_CHECKSUM = 0x20 , eNVM_ERR_COLLISION = 0x40 } |
Functions | |
uint16_t | McNvmBuildChecksum (NvmAddr_tv tvStartAddressV, NvmSize_tv tvDataCountV) |
void | McNvmClearStatus (void) |
Status_tv | McNvmEraseDevice (void) |
Status_tv | McNvmGetStatus (void) |
NvmSize_tv | McNvmGetSize (void) |
Status_tv | McNvmInit (void) |
Status_tv | McNvmRead (NvmAddr_tv tvAddressV, uint8_t *pubDataV, NvmSize_tv tvSizeV) |
Status_tv | McNvmWriteEnable (void) |
Status_tv | McNvmWriteDisable (void) |
Status_tv | McNvmWrite (NvmAddr_tv tvAddressV, uint8_t *pubDataV, NvmSize_tv tvSizeV) |
enum NVM_ERR_e |
Error code for NVM access.
The following error codes are used by the NVM driver. The status can be checked via the function McNvmGetStatus().
uint16_t McNvmBuildChecksum | ( | NvmAddr_tv | tvStartAddressV, |
NvmSize_tv | tvDataCountV | ||
) |
Build Checksum.
tvStartAddressV | - First address for checksum algorithm |
tvDataCountV | - Number of data for checksum algorithm |
This function builds a checksum by adding the data from the memory location given by tvStartAddressV to tvStartAddressV + tvDataCountV. The value of tvDataCountV must be greater than 0.
void McNvmClearStatus | ( | void | ) |
Clear device status.
This function clears the device status / operation status.
Status_tv McNvmEraseDevice | ( | void | ) |
Erase non-volatile memory.
This function erases the complete non-volatile memory. Possible return values are defined in the enumeration NVM_ERR_e.
NvmSize_tv McNvmGetSize | ( | void | ) |
Get storage capacity.
This function returns the maximum storage capacity of the device. The return value is the number of memory locations, independent of the data storage capabilities (BYTE or WORD) of the device. The highest memory address is then McNvmGetMax() - 1.
Status_tv McNvmGetStatus | ( | void | ) |
Get device status.
This function returns the device status / operation status. Possible return values are defined in the enumeration NVM_ERR_e. The device status is cleared with the function McNvmClearStatus().
Status_tv McNvmInit | ( | void | ) |
Initialise Non-Volatile Memory.
This function is responsible for initialisation of the non-volatile memory. It has to be called prior to all other functions for non-volatile memory access.
Possible return values are defined in the enumeration NVM_ERR_e.
Status_tv McNvmRead | ( | NvmAddr_tv | tvAddressV, |
uint8_t * | pubDataV, | ||
NvmSize_tv | tvSizeV | ||
) |
Read data.
tvAddressV | - Memory read address |
pubDataV | - Pointer to data |
tvSizeV | - number of bytes to be read |
This function is used to read data from a given memory location tvAddressV. The first memory location is address 0. The address points to a byte value location.
Possible return values are defined in the enumeration NVM_ERR_e.
Status_tv McNvmWrite | ( | NvmAddr_tv | tvAddressV, |
uint8_t * | pubDataV, | ||
NvmSize_tv | tvSizeV | ||
) |
Write data.
tvAddressV | - Memory write address |
pubDataV | - Pointer to data |
tvSizeV | - number of bytes to be stored |
This function is used to write data to a given memory location tvAddressV. The first memory location is address 0.
Possible return values are defined in the enumeration NVM_ERR_e.
Status_tv McNvmWriteDisable | ( | void | ) |
Disable Write Operation.
This function disables write-operation on the non-volatile memory.
Possible return values are defined in the enumeration NVM_ERR_e.
Status_tv McNvmWriteEnable | ( | void | ) |
Enable Write Operation.
This function enables write-operation to the non-volatile memory, which are disabled by default.
Possible return values are defined in the enumeration NVM_ERR_e.