Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of HSP_RPC_GUI by
Diff: HSP/LoggingService/Logging_RPC.cpp
- Revision:
- 2:d483f896c7a9
- Parent:
- 1:9490836294ea
- Child:
- 3:8e9b9f5818aa
--- a/HSP/LoggingService/Logging_RPC.cpp Fri Apr 21 12:12:30 2017 -0500
+++ b/HSP/LoggingService/Logging_RPC.cpp Fri Apr 21 18:10:37 2017 -0500
@@ -167,55 +167,25 @@
#define PAGE_INC_4K 0x10
#define TOTAL_SECTOR_NUMBER 263
+
+#define ADDRESS_INC_4K 0x1000
+#define ADDRESS_INC_32K 0x8000
+#define ADDRESS_INC_64K 0x10000
+
+#define ADDRESS_4K_START 0x0
+#define ADDRESS_4K_END 0x8000
+
+#define ADDRESS_32K_START 0x8000
+#define ADDRESS_32k_END 0x10000
+
+#define ADDRESS_64K_START 0x10000
+#define ADDRESS_64k_END 0x2000000
+
+#define SIZE_OF_EXTERNAL_FLASH 0x2000000 // 33,554,432 Bytes
+
//******************************************************************************
int Logging_EraseWrittenSectors(char argStrs[32][32], char replyStrs[32][32]) {
- uint32_t reply[1];
- uint8_t data[512];
- uint32_t address;
- uint32_t pageNumber;
- uint32_t pageEmpty;
- uint32_t currentSector;
-
- pageNumber = PAGE_INC_4K;
- address = SECTOR_SIZE_4K;
- currentSector = 0;
- printf("Logging_EraseWrittenSectors ");
- fflush(stdout);
- printf("pageNumber %d 0x%X ", (unsigned int)pageNumber, (unsigned int)pageNumber);
- fflush(stdout);
- printf("SECTOR_SIZE_4K %d 0x%X ...", SECTOR_SIZE_4K, SECTOR_SIZE_4K);
- fflush(stdout);
- // always erase this sector... the first part is used for the mission resume
- // table
- Peripherals::s25FS512()->sectorErase_Helper(address);
- address += SECTOR_SIZE_4K;
- while (currentSector < TOTAL_SECTOR_NUMBER) {
- // sample the page
- pageNumber = address >> 8;
- Peripherals::s25FS512()->readPages_Helper(pageNumber, pageNumber, data, 0);
- pageEmpty = Peripherals::s25FS512()->isPageEmpty(data);
- if (pageEmpty == 0) {
- Peripherals::s25FS512()->sectorErase_Helper(address);
- } else {
- // stop processing... all of the sectors from here on out should be empty
- // printf("Logging_EraseWrittenSectors break "); fflush(stdout);
- // break;
- }
- currentSector++;
- if (currentSector < 8) {
- address += SECTOR_SIZE_4K;
- }
- if (currentSector == 8) {
- address = SECTOR_SIZE_256K;
- }
- if (currentSector > 8) {
- address += SECTOR_SIZE_256K;
- }
- }
- reply[0] = 0x80;
- FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
- printf("Logging_EraseWrittenSectors done. \n");
- fflush(stdout);
+ Peripherals::s25FS512()->bulkErase_Helper();
return 0;
}
