diff options
| author | Avi Levkovich <avi@twine-s.com> | 2018-07-25 15:43:46 +0300 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2018-07-25 15:43:46 +0300 |
| commit | caf4be8968eed6738fdaa2486fa08ba601c45be4 (patch) | |
| tree | 04c422c87b3d71e61d537014aea31fb354ce558c /Software/Embedded_SW/Embedded/Drivers/Flash_Memory | |
| parent | 81dccf50b4fa6e1da1377cf7810184a71ffc4fd8 (diff) | |
| download | Tango-caf4be8968eed6738fdaa2486fa08ba601c45be4.tar.gz Tango-caf4be8968eed6738fdaa2486fa08ba601c45be4.zip | |
ext flash : return address from write and add option to read from the user address. always send address 0 to the write function
Diffstat (limited to 'Software/Embedded_SW/Embedded/Drivers/Flash_Memory')
| -rw-r--r-- | Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c index a84166591..a0aedfd3e 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c +++ b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c @@ -777,6 +777,9 @@ uint32_t ExtFlashWriteBuf(uint32_t ui32Address,uint32_t NumOfWords, uint32_t* p uint32_t i; uint32_t No_Bytes; + uint32_t return_start_address = 0X00 + (0X100*AddressCounter);//always use address 0 and handle the add by the AddressCounter + + assert(NumOfWords <= MaxFlashWords); No_Bytes = NumOfWords *4; @@ -800,19 +803,19 @@ uint32_t ExtFlashWriteBuf(uint32_t ui32Address,uint32_t NumOfWords, uint32_t* p for(i=0;i<number;i++,AddressCounter++) { - Ext_Flash_Operation(0X00 + (0X100*AddressCounter) , TX, MaxBytesForAddress , WriteBuf+ (MaxBytesForAddress*i), NULL ); + Ext_Flash_Operation(0X00 + (0X100*AddressCounter) , TX, MaxBytesForAddress , WriteBuf+ (MaxBytesForAddress*i), NULL ); //always use address 0 and handle the add by the AddressCounter } if(Remainder) { - Ext_Flash_Operation(0X00 + (0X100*AddressCounter) , TX, Remainder , WriteBuf+ (MaxBytesForAddress*i), NULL ); + Ext_Flash_Operation(0X00 + (0X100*AddressCounter) , TX, Remainder , WriteBuf+ (MaxBytesForAddress*i), NULL );////always use address 0 and handle the add by the AddressCounter } } else { - Ext_Flash_Operation(0X00 + (0X100*AddressCounter), TX, No_Bytes , WriteBuf, NULL ); + Ext_Flash_Operation(0X00 + (0X100*AddressCounter), TX, No_Bytes , WriteBuf, NULL );////always use address 0 and handle the add by the AddressCounter } - return AddressCounter; + return return_start_address; } @@ -838,16 +841,16 @@ uint32_t* ExtFlashReadBuf(uint32_t ui32Address,uint32_t NumOfWords ) for(i=0;i<number;i++,AddressCounter++) { - Ext_Flash_Operation(0X00 + (0X100*AddressCounter), RX, MaxBytesForAddress, NULL, ReadBuf + (MaxBytesForAddress*i) ); + Ext_Flash_Operation(ui32Address + (0X100*AddressCounter), RX, MaxBytesForAddress, NULL, ReadBuf + (MaxBytesForAddress*i) ); } if(Remainder) { - Ext_Flash_Operation(0X00 + (0X100*AddressCounter), RX, Remainder, NULL, ReadBuf + (MaxBytesForAddress*i) ); + Ext_Flash_Operation(ui32Address + (0X100*AddressCounter), RX, Remainder, NULL, ReadBuf + (MaxBytesForAddress*i) ); } } else { - Ext_Flash_Operation(0X00 + (0X100*AddressCounter), RX, No_Bytes, NULL, ReadBuf ); + Ext_Flash_Operation(ui32Address + (0X100*AddressCounter), RX, No_Bytes, NULL, ReadBuf ); } for(i = 0; i < No_Bytes;i++) |
