aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32F4xx/FSMC_SRAM/main.c
diff options
context:
space:
mode:
authorbarthess <barthess@yandex.ru>2015-02-24 17:43:53 +0300
committerbarthess <barthess@yandex.ru>2015-02-24 17:43:53 +0300
commit900963482d2589fd752f0c7501c99b98ef4e8b82 (patch)
tree90789f6c07c6871491b26a95f1655e9ee17778a9 /testhal/STM32/STM32F4xx/FSMC_SRAM/main.c
parent33f1b2541ef3a15b4ed5875f741d71a19e773217 (diff)
downloadChibiOS-Contrib-900963482d2589fd752f0c7501c99b98ef4e8b82.tar.gz
ChibiOS-Contrib-900963482d2589fd752f0c7501c99b98ef4e8b82.tar.bz2
ChibiOS-Contrib-900963482d2589fd752f0c7501c99b98ef4e8b82.zip
Finished memtest code
Diffstat (limited to 'testhal/STM32/STM32F4xx/FSMC_SRAM/main.c')
-rw-r--r--testhal/STM32/STM32F4xx/FSMC_SRAM/main.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/testhal/STM32/STM32F4xx/FSMC_SRAM/main.c b/testhal/STM32/STM32F4xx/FSMC_SRAM/main.c
index c661d14..186450f 100644
--- a/testhal/STM32/STM32F4xx/FSMC_SRAM/main.c
+++ b/testhal/STM32/STM32F4xx/FSMC_SRAM/main.c
@@ -26,8 +26,8 @@
* DEFINES
******************************************************************************
*/
-#define SRAM_START ((void *)FSMC_Bank1_4_MAP)
#define SRAM_SIZE (512 * 1024)
+#define SRAM_START ((void *)FSMC_Bank1_4_MAP)
/*
******************************************************************************
@@ -49,11 +49,18 @@ static void mem_error_cb(memtest_t *memp, testtype_t e, size_t address);
******************************************************************************
*/
+static size_t errors = 0;
+
+/*
+ *
+ */
+static uint8_t int_buf[64*1024];
+
/*
* SRAM driver configuration structure.
*/
static const SRAMConfig sram_cfg = {
- 2 << 8
+ (0 << 16) | (2 << 8) | (1 << 0)
};
/*
@@ -78,11 +85,6 @@ static membench_t membench_ext = {
/*
*
*/
-static uint8_t int_buf[64*1024];
-
-/*
- *
- */
static membench_t membench_int = {
int_buf,
sizeof(int_buf),
@@ -108,13 +110,15 @@ static inline void green_led_on(void) {palSetPad(GPIOI, GPIOI_LED_G);}
static inline void green_led_off(void) {palClearPad(GPIOI, GPIOI_LED_G);}
static inline void green_led_toggle(void) {palTogglePad(GPIOI, GPIOI_LED_G);}
-static void mem_error_cb(memtest_t *memp, testtype_t e, size_t address) {
+void mem_error_cb(memtest_t *memp, testtype_t e, size_t address) {
(void)memp;
(void)e;
(void)address;
green_led_off();
red_led_on();
+ osalThreadSleepMilliseconds(10);
+ errors++;
osalSysHalt("Memory broken");
}
@@ -126,14 +130,8 @@ static void memtest(void) {
red_led_off();
while (true) {
- memtest_struct.width = MEMTEST_WIDTH_16;
memtest_struct.rand_seed = chSysGetRealtimeCounterX();
memtest_run(&memtest_struct, MEMTEST_RUN_ALL);
-
- memtest_struct.width = MEMTEST_WIDTH_8;
- memtest_struct.rand_seed = chSysGetRealtimeCounterX();
- memtest_run(&memtest_struct, MEMTEST_RUN_ALL);
-
green_led_toggle();
}