CANopen Bootloader Documentation
Version 4.10.00
Loading...
Searching...
No Matches
mc_flash.h File Reference

Detailed Description

The file defines functions to erase a flash memory and to write data to a flash memory.

+ Include dependency graph for mc_flash.h:

Enumerations

enum  FLASH_ERR_e {
  eFLASH_ERR_OK = 0x00 ,
  eFLASH_ERR_INIT = 0x01 ,
  eFLASH_ERR_ADDRESS = 0x02 ,
  eFLASH_ERR_READ = 0x04 ,
  eFLASH_ERR_WRITE = 0x08 ,
  eFLASH_ERR_ERASE = 0x10 ,
  eFLASH_ERR_CHECKSUM = 0x20 ,
  eFLASH_ERR_COLLISION = 0x40
}
 

Functions

Status_tv McFlashGetStatus (void)
 
Status_tv McFlashErase (uint32_t ulFlashAddrV, uint32_t ulSizeV)
 
Status_tv McFlashInit (void)
 
Status_tv McFlashLock (void)
 
Status_tv McFlashWrite (uint32_t ulAddressV, void *pvdDataV, uint32_t ulSizeV)
 
Status_tv McFlashUnlock (void)
 

Enumeration Type Documentation

◆ FLASH_ERR_e

Error code for flash memory access.

The following error codes are used by the flash driver. The status can be checked via the function McFlashGetStatus().

Enumerator
eFLASH_ERR_OK 

Device is operational, success of latest operation

eFLASH_ERR_INIT 

Hardware or initialisation failure of device

eFLASH_ERR_ADDRESS 

Address out of range

eFLASH_ERR_READ 

Failure of read operation

eFLASH_ERR_WRITE 

Failure of write operation

eFLASH_ERR_ERASE 

Failure of erase operation

eFLASH_ERR_CHECKSUM 

Failure of checksum operation

eFLASH_ERR_COLLISION 

Collision during read/write/erase operation

Function Documentation

◆ McFlashErase()

Status_tv McFlashErase ( uint32_t  ulFlashAddrV,
uint32_t  ulSizeV 
)

Erase page of selected address.

Parameters
[in]ulFlashAddrV- Memory start address
[in]ulSizeV- Memory size to erase
Returns
Status of flash operation

This function is used to erase ulSizeV bytes of data, starting from address ulFlashAddrV.

◆ McFlashGetStatus()

Status_tv McFlashGetStatus ( void  )
Returns
Status of the last flash operation

The function returns the status of the last flash operation

◆ McFlashInit()

Status_tv McFlashInit ( void  )

Initialise flash of MCU.

Returns
Status of flash operation

◆ McFlashLock()

Status_tv McFlashLock ( void  )

Lock the Flash memory controller.

Returns
Status of flash operation
See also
McFlashUnlock()

◆ McFlashUnlock()

Status_tv McFlashUnlock ( void  )

Unlock the Flash memory controller.

Returns
Status of flash operation
See also
McFlashLock()

◆ McFlashWrite()

Status_tv McFlashWrite ( uint32_t  ulAddressV,
void *  pvdDataV,
uint32_t  ulSizeV 
)

Write data.

Parameters
[in]ulAddressV- Flash memory address
[in]pvdDataV- Pointer to data
[in]ulSizeV- number of bytes to write
Returns
Status of flash operation

This function is used to write data to a given flash memory location ulAddressV. The function checks the address range and the address alignment. In order to write to the flash memory, it has to be unlocked by calling McFlashUnlock() in advance.