aboutsummaryrefslogtreecommitdiffstats
path: root/testhal
diff options
context:
space:
mode:
authorbarthess <barthess@yandex.ru>2015-08-04 13:30:01 +0300
committerbarthess <barthess@yandex.ru>2015-08-04 13:30:01 +0300
commite7a3df6c18173ad12750faa56cb8a8f6c68874cb (patch)
treef3bcdf0ff5bca120e42cd9f534a5d1d5518eb88a /testhal
parent8c8c0a0be4dc937c36bac5c5f29a1974e5a1e0ec (diff)
downloadChibiOS-Contrib-e7a3df6c18173ad12750faa56cb8a8f6c68874cb.tar.gz
ChibiOS-Contrib-e7a3df6c18173ad12750faa56cb8a8f6c68874cb.tar.bz2
ChibiOS-Contrib-e7a3df6c18173ad12750faa56cb8a8f6c68874cb.zip
Improved FSMC.
SRAM configuration is much more flexible now.
Diffstat (limited to 'testhal')
-rw-r--r--testhal/STM32/STM32F4xx/FSMC_SDRAM/Makefile2
-rw-r--r--testhal/STM32/STM32F4xx/FSMC_SDRAM/main.c21
-rw-r--r--testhal/STM32/STM32F4xx/FSMC_SRAM/Makefile2
-rw-r--r--testhal/STM32/STM32F4xx/FSMC_SRAM/main.c25
4 files changed, 29 insertions, 21 deletions
diff --git a/testhal/STM32/STM32F4xx/FSMC_SDRAM/Makefile b/testhal/STM32/STM32F4xx/FSMC_SDRAM/Makefile
index 2cc9d5a..49c5d5e 100644
--- a/testhal/STM32/STM32F4xx/FSMC_SDRAM/Makefile
+++ b/testhal/STM32/STM32F4xx/FSMC_SDRAM/Makefile
@@ -15,7 +15,7 @@ endif
# C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),)
- USE_CPPOPT = -fno-rtti
+ USE_CPPOPT = -fno-rtti -std=c++11
endif
# Enable this if you want the linker to remove unused code and data
diff --git a/testhal/STM32/STM32F4xx/FSMC_SDRAM/main.c b/testhal/STM32/STM32F4xx/FSMC_SDRAM/main.c
index 5f93520..e07d6d3 100644
--- a/testhal/STM32/STM32F4xx/FSMC_SDRAM/main.c
+++ b/testhal/STM32/STM32F4xx/FSMC_SDRAM/main.c
@@ -25,7 +25,7 @@
#include "fsmc_sdram.h"
#include "membench.h"
-#include "memtest.hpp"
+#include "memtest.h"
/*
******************************************************************************
@@ -127,7 +127,8 @@
******************************************************************************
*/
-static void mem_error_cb(memtest_t *memp, testtype e, size_t address);
+static void mem_error_cb(memtest_t *memp, testtype type, size_t index,
+ size_t width, uint32_t got, uint32_t expect);
/*
******************************************************************************
@@ -176,9 +177,8 @@ static uint8_t int_buf[64*1024];
static memtest_t memtest_struct = {
SDRAM_START,
SDRAM_SIZE,
- MEMTEST_WIDTH_16,
- mem_error_cb,
- 42
+ MEMTEST_WIDTH_32,
+ mem_error_cb
};
/*
@@ -211,10 +211,14 @@ static membench_result_t membench_result_int2ext;
******************************************************************************
*/
-void mem_error_cb(memtest_t *memp, testtype e, size_t address) {
+static void mem_error_cb(memtest_t *memp, testtype type, size_t index,
+ size_t width, uint32_t got, uint32_t expect) {
(void)memp;
- (void)e;
- (void)address;
+ (void)type;
+ (void)index;
+ (void)width;
+ (void)got;
+ (void)expect;
osalSysHalt("Memory broken");
}
@@ -225,7 +229,6 @@ void mem_error_cb(memtest_t *memp, testtype e, size_t address) {
static void memtest(void) {
while (true) {
- memtest_struct.rand_seed = chSysGetRealtimeCounterX();
memtest_run(&memtest_struct, MEMTEST_RUN_ALL);
}
}
diff --git a/testhal/STM32/STM32F4xx/FSMC_SRAM/Makefile b/testhal/STM32/STM32F4xx/FSMC_SRAM/Makefile
index e3d83c4..48376a8 100644
--- a/testhal/STM32/STM32F4xx/FSMC_SRAM/Makefile
+++ b/testhal/STM32/STM32F4xx/FSMC_SRAM/Makefile
@@ -15,7 +15,7 @@ endif
# C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),)
- USE_CPPOPT = -fno-rtti
+ USE_CPPOPT = -fno-rtti -std=c++11
endif
# Enable this if you want the linker to remove unused code and data
diff --git a/testhal/STM32/STM32F4xx/FSMC_SRAM/main.c b/testhal/STM32/STM32F4xx/FSMC_SRAM/main.c
index 03d7f1d..604591d 100644
--- a/testhal/STM32/STM32F4xx/FSMC_SRAM/main.c
+++ b/testhal/STM32/STM32F4xx/FSMC_SRAM/main.c
@@ -19,7 +19,7 @@
#include "fsmc_sram.h"
#include "membench.h"
-#include "memtest.hpp"
+#include "memtest.h"
/*
******************************************************************************
@@ -41,7 +41,8 @@
******************************************************************************
*/
-static void mem_error_cb(memtest_t *memp, testtype e, size_t address);
+static void mem_error_cb(memtest_t *memp, testtype type, size_t index,
+ size_t width, uint32_t got, uint32_t expect);
/*
******************************************************************************
@@ -60,7 +61,9 @@ static uint8_t int_buf[64*1024];
* SRAM driver configuration structure.
*/
static const SRAMConfig sram_cfg = {
- (0 << 16) | (2 << 8) | (1 << 0)
+ .bcr = (FSMC_BCR_MWID_16 | FSMC_BCR_MTYP_SRAM | FSMC_BCR_WREN),
+ .btr = (0 << 16) | (2 << 8) | (1 << 0),
+ .bwtr = (0 << 16) | (2 << 8) | (1 << 0)
};
/*
@@ -69,9 +72,8 @@ static const SRAMConfig sram_cfg = {
static memtest_t memtest_struct = {
SRAM_START,
SRAM_SIZE,
- MEMTEST_WIDTH_16,
- mem_error_cb,
- 42
+ MEMTEST_WIDTH_32,
+ mem_error_cb
};
/*
@@ -110,10 +112,14 @@ 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);}
-void mem_error_cb(memtest_t *memp, testtype e, size_t address) {
+static void mem_error_cb(memtest_t *memp, testtype type, size_t index,
+ size_t width, uint32_t got, uint32_t expect) {
(void)memp;
- (void)e;
- (void)address;
+ (void)type;
+ (void)index;
+ (void)width;
+ (void)got;
+ (void)expect;
green_led_off();
red_led_on();
@@ -130,7 +136,6 @@ static void memtest(void) {
red_led_off();
while (true) {
- memtest_struct.rand_seed = chSysGetRealtimeCounterX();
memtest_run(&memtest_struct, MEMTEST_RUN_ALL);
green_led_toggle();
}