1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

fixed allocation order

Signed-off-by: Pascal Bauer <pascal.bauer@rwth-aachen.de>
This commit is contained in:
Pascal Bauer 2022-12-09 13:03:34 +01:00 committed by Niklas Eiling
parent 327f343924
commit c77d124682

View file

@ -113,13 +113,10 @@ EMC::flash(uint32_t offset, uint32_t length, uint8_t *data)
int ret = XST_FAILURE;
uint32_t start = offset;
uint8_t *verify_data = new uint8_t[length];
/* Reset the Flash Device. This clears the ret registers and puts
* the device in Read mode. */
ret = XFlash_Reset(&xflash);
if (ret != XST_SUCCESS){
delete[] verify_data;
return false;
}
@ -131,26 +128,24 @@ EMC::flash(uint32_t offset, uint32_t length, uint8_t *data)
(xflash.CommandSet == XFL_CMDSET_INTEL_G18)) {
ret = XFlash_Unlock(&xflash, offset, 0);
if(ret != XST_SUCCESS){
delete[] verify_data;
return false;
}
}
// Perform the Erase operation.
ret = XFlash_Erase(&xflash, start, length);
if (ret != XST_SUCCESS){
delete[] verify_data;
if (ret != XST_SUCCESS){;
return false;
}
// Perform the Write operation.
ret = XFlash_Write(&xflash, start, length, data);
if (ret != XST_SUCCESS){
delete[] verify_data;
return false;
}
// Perform the read operation.
uint8_t *verify_data = new uint8_t[length];
ret = XFlash_Read(&xflash, start, length, verify_data);
if(ret != XST_SUCCESS) {
delete[] verify_data;