implemented memory device, flashStorage and cached storage

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@268 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-10-31 07:35:17 +00:00
parent a50a10995f
commit 76783a6061
17 changed files with 1103 additions and 13 deletions

View File

@@ -47,6 +47,7 @@
#include "misc.h"
#include "stm32f10x_rcc.h"
#include "CachedStorage.h"
#include "DisplayDevice.h"
#include "KeyboardDevice.h"
#include "MAX5715.h"
@@ -56,10 +57,12 @@
#include "CathodeMCP.h"
#include "Interlock.h"
#include "internalADC.h"
#include "InternalFlash.h"
#include "gpio.h"
#include "IODevice.h"
#include "keypadMatrix.h"
#include "Logger.h"
#include "MemoryDevice.h"
#include "PCBA.h"
#include "uart.h"
#include "spi.h"
@@ -102,6 +105,7 @@ static struct HwValidationMenuItems hwTestItems;
struct HwValidationMenu* hwValidation = &_hwValidation;
static struct CachedStorage cs = {.initialized = false};
// -----------------------------------------------------------------------------
// Function declarations
@@ -125,7 +129,7 @@ int main (void)
ledTaskArguments.led = ledOrange;
ledTaskArguments.frequency = 1;
xTaskCreate(initTask, (const char* const)"initTask", 1024, NULL, 5, &initTaskHandle);
xTaskCreate(initTask, (const char* const)"initTask", 2048, NULL, 5, &initTaskHandle);
/* Start the scheduler. */
vTaskStartScheduler();
@@ -199,17 +203,17 @@ static void initTask(void* parameters)
xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 100, &ledTaskArguments, 0, &ledTaskHandle);
// Construct the displays
Displays_construct();
// Displays_construct();
// Construct the AD Converters
ADConverters_construct();
// ADConverters_construct();
// Construct the DA Converters
DAConverters_construct();
// DAConverters_construct();
hsb_generateStartScreen(mainDisplay);
// hsb_generateStartScreen(mainDisplay);
// Let start screen stay for 5 seconds
vTaskDelay(INIT_START_SCREEN_DELAY);
// vTaskDelay(INIT_START_SCREEN_DELAY);
///TODO MUST BE UPDATED
@@ -232,7 +236,35 @@ static void initTask(void* parameters)
// HwValidationMenu_construct(hwValidation, &uart1->device, &hwTestItems, 1, 1024);
// Construct the repair menu
repairMenus_construct();
// repairMenus_construct();
uint32_t buffer[128];
int i;
for (i = 0; i < 128; i++)
{
buffer[i] = i + 4;
vTaskDelay(20);
}
//
// vTaskDelay(5000);
//
CachedStorage_construct(&cs, &iFlash->memoryDevice, 127, CACHED_STORAGE_PAGESIZE);
MemoryDevice_erasePage(&iFlash->memoryDevice, 127);
CachedStorage_writeBlob(&cs, 0, buffer, sizeof(buffer));
CachedStorage_commit(&cs);
////
// vTaskDelay(1000);
//
const uint32_t* buffer2;
buffer2 = CachedStorage_readBlob(&cs, 0);
for (i = 0; i < 128; i++)
{
LOGGER_DEBUG(mainLog, "Value %d ---> %d", i, (unsigned int)buffer2[i]);
vTaskDelay(20);
}
// Create task that repeats to print out TASK information on the logger
xTaskCreate(printSystemInfoTask, (const char* const)"SysInfoTask", 512, NULL, 0, &sysTaskHandle);