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:
parent
327f343924
commit
c77d124682
1 changed files with 2 additions and 7 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue