aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2019-08-12 16:36:18 +0300
committerShlomo Hecht <shlomo@twine-s.com>2019-08-12 16:36:18 +0300
commit61954c23bc81fb1d24dd9c0a95bc27ca37371584 (patch)
tree4137444b2e8d83e754eea3aa48074af6c320bb21 /Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c
parent7cb16930bdff98a723769a69cf663108cf50d6b0 (diff)
downloadTango-61954c23bc81fb1d24dd9c0a95bc27ca37371584.tar.gz
Tango-61954c23bc81fb1d24dd9c0a95bc27ca37371584.zip
Version 1.4.3.5: prepare for dispenser filling. VOC alarms. fix alarm handling. improved IDS and other features
Diffstat (limited to 'Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c')
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c b/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c
index f2f5aefb6..99d7c0b9e 100644
--- a/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c
+++ b/Software/Embedded_SW/Embedded/Drivers/flash_ram/FlashProgram.c
@@ -10,7 +10,17 @@
#include <DataDef.h>
#include "FlashProgram.h"
+//#define FLASH_DEBUG
+#ifdef FLASH_DEBUG
+#define MAX_CONT_LOG 20
+#define READ 1
+#define DELETE 2
+uint32_t Address[MAX_CONT_LOG+1] = {0};
+uint32_t Size[MAX_CONT_LOG+1] = {0};
+uint32_t EraseWrite[MAX_CONT_LOG+1] = {0};
+byte RxIndex = 0;
+#endif
//*****************************************************************************
//
// Read the application image from the file system and program it into flash.
@@ -35,7 +45,13 @@ uint32_t ReadAppAndProgram(uint32_t ui32FlashStart,uint32_t ui32FileSize,void* b
volatile uint32_t ui32Idx;
//uint32_t ui32FlashEnd;
-
+#ifdef FLASH_DEBUG
+ Address[RxIndex] = ui32FlashStart;
+ Size[RxIndex] = ui32FileSize;
+ EraseWrite[RxIndex] = READ;
+ if (RxIndex++>=MAX_CONT_LOG)
+ RxIndex = 0;
+#endif
//
// Get the size of flash. This is the ending address of the flash.
// If reserved space is configured, then the ending address is reduced
@@ -111,6 +127,13 @@ uint32_t ReadAppAndProgram(uint32_t ui32FlashStart,uint32_t ui32FileSize,void* b
uint32_t EraseFlashSection(uint32_t ui32FlashStart,uint32_t ui32FileSize)
{
volatile uint32_t ui32Idx;
+#ifdef FLASH_DEBUG
+ Address[RxIndex] = ui32FlashStart;
+ Size[RxIndex] = ui32FileSize;
+ EraseWrite[RxIndex] = DELETE;
+ if (RxIndex++>=MAX_CONT_LOG)
+ RxIndex = 0;
+#endif
for(ui32Idx = ui32FlashStart; ui32Idx < ui32FlashStart+ui32FileSize; ui32Idx += 1024)
{
ROM_FlashErase(ui32Idx);
@@ -125,6 +148,13 @@ void FlashInit(void)
{
volatile uint32_t ui32Idx;
//FlashUsecSet(120);
+#ifdef FLASH_DEBUG
+ Address[RxIndex] = FLASH_RAM_BASE;
+ Size[RxIndex] = FLASH_SIZE;
+ EraseWrite[RxIndex] = DELETE;
+ if (RxIndex++>=MAX_CONT_LOG)
+ RxIndex = 0;
+#endif
for(ui32Idx = FLASH_RAM_BASE; ui32Idx < FLASH_RAM_BASE+FLASH_SIZE; ui32Idx += 1024)
{
ROM_FlashErase(ui32Idx);