aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32/STM32F4xx/FSMC_NAND
diff options
context:
space:
mode:
Diffstat (limited to 'testhal/STM32/STM32F4xx/FSMC_NAND')
-rw-r--r--testhal/STM32/STM32F4xx/FSMC_NAND/Makefile3
-rw-r--r--testhal/STM32/STM32F4xx/FSMC_NAND/chconf.h2
-rw-r--r--testhal/STM32/STM32F4xx/FSMC_NAND/dma_storm.h16
-rw-r--r--testhal/STM32/STM32F4xx/FSMC_NAND/halconf.h7
-rw-r--r--testhal/STM32/STM32F4xx/FSMC_NAND/halconf_community.h15
-rw-r--r--testhal/STM32/STM32F4xx/FSMC_NAND/main.c39
-rw-r--r--testhal/STM32/STM32F4xx/FSMC_NAND/mcuconf_community.h11
7 files changed, 69 insertions, 24 deletions
diff --git a/testhal/STM32/STM32F4xx/FSMC_NAND/Makefile b/testhal/STM32/STM32F4xx/FSMC_NAND/Makefile
index 5474ee7..a203a21 100644
--- a/testhal/STM32/STM32F4xx/FSMC_NAND/Makefile
+++ b/testhal/STM32/STM32F4xx/FSMC_NAND/Makefile
@@ -105,6 +105,7 @@ CSRC = $(STARTUPSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
$(TESTSRC) \
+ $(CHIBIOS)/community/os/various/bitmap.c \
dma_storm_adc.c \
dma_storm_spi.c \
dma_storm_uart.c \
@@ -139,7 +140,7 @@ ASMSRC = $(STARTUPASM) $(PORTASM) $(OSALASM)
INCDIR = $(STARTUPINC) $(KERNINC) $(PORTINC) $(OSALINC) \
$(HALINC) $(PLATFORMINC) $(BOARDINC) $(TESTINC) \
- $(CHIBIOS)/os/various
+ $(CHIBIOS)/os/various $(CHIBIOS)/community/os/various
#
diff --git a/testhal/STM32/STM32F4xx/FSMC_NAND/chconf.h b/testhal/STM32/STM32F4xx/FSMC_NAND/chconf.h
index b983830..7bd9c15 100644
--- a/testhal/STM32/STM32F4xx/FSMC_NAND/chconf.h
+++ b/testhal/STM32/STM32F4xx/FSMC_NAND/chconf.h
@@ -361,7 +361,7 @@
*
* @note The default is @p FALSE.
*/
-#define CH_DBG_ENABLE_TRACE TRUE
+#define CH_DBG_ENABLE_TRACE FALSE
/**
* @brief Debug option, stack checks.
diff --git a/testhal/STM32/STM32F4xx/FSMC_NAND/dma_storm.h b/testhal/STM32/STM32F4xx/FSMC_NAND/dma_storm.h
index 0be66ba..79dc76d 100644
--- a/testhal/STM32/STM32F4xx/FSMC_NAND/dma_storm.h
+++ b/testhal/STM32/STM32F4xx/FSMC_NAND/dma_storm.h
@@ -1,3 +1,19 @@
+/*
+ ChibiOS/RT - Copyright (C) 2014 Uladzimir Pylinsky aka barthess
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
#ifndef DMA_STORM_H_
#define DMA_STORM_H_
diff --git a/testhal/STM32/STM32F4xx/FSMC_NAND/halconf.h b/testhal/STM32/STM32F4xx/FSMC_NAND/halconf.h
index b284367..b4882dc 100644
--- a/testhal/STM32/STM32F4xx/FSMC_NAND/halconf.h
+++ b/testhal/STM32/STM32F4xx/FSMC_NAND/halconf.h
@@ -45,6 +45,13 @@
#endif
/**
+ * @brief Enables the DAC subsystem.
+ */
+#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__)
+#define HAL_USE_DAC FALSE
+#endif
+
+/**
* @brief Enables the CAN subsystem.
*/
#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__)
diff --git a/testhal/STM32/STM32F4xx/FSMC_NAND/halconf_community.h b/testhal/STM32/STM32F4xx/FSMC_NAND/halconf_community.h
index fd15a4e..5c979fa 100644
--- a/testhal/STM32/STM32F4xx/FSMC_NAND/halconf_community.h
+++ b/testhal/STM32/STM32F4xx/FSMC_NAND/halconf_community.h
@@ -38,6 +38,13 @@
#define HAL_USE_ONEWIRE FALSE
#endif
+/**
+ * @brief Enables the EICU subsystem.
+ */
+#if !defined(HAL_USE_EICU) || defined(__DOXYGEN__)
+#define HAL_USE_EICU FALSE
+#endif
+
/*===========================================================================*/
/* FSMCNAND driver related settings. */
/*===========================================================================*/
@@ -50,14 +57,6 @@
#define NAND_USE_MUTUAL_EXCLUSION TRUE
#endif
-/**
- * @brief Enables internal driver map for bad blocks.
- * @note Disabling this option saves both code and data space.
- */
-#if !defined(NAND_USE_BAD_MAP) || defined(__DOXYGEN__)
-#define NAND_USE_BAD_MAP TRUE
-#endif
-
/*===========================================================================*/
/* 1-wire driver related settings. */
/*===========================================================================*/
diff --git a/testhal/STM32/STM32F4xx/FSMC_NAND/main.c b/testhal/STM32/STM32F4xx/FSMC_NAND/main.c
index bdc72e0..2379a12 100644
--- a/testhal/STM32/STM32F4xx/FSMC_NAND/main.c
+++ b/testhal/STM32/STM32F4xx/FSMC_NAND/main.c
@@ -44,6 +44,8 @@
#include "ch.h"
#include "hal.h"
+#include "bitmap.h"
+
#include "dma_storm.h"
#include "string.h"
#include "stdlib.h"
@@ -54,6 +56,8 @@
******************************************************************************
*/
+#define USE_BAD_MAP TRUE
+
#define USE_KILL_BLOCK_TEST FALSE
#define FSMCNAND_TIME_SET ((uint32_t) 2) //(8nS)
@@ -69,7 +73,7 @@
#define NAND_ROW_WRITE_CYCLES 3
#define NAND_COL_WRITE_CYCLES 2
-#define NANF_TEST_START_BLOCK 1200
+#define NAND_TEST_START_BLOCK 1200
#define NAND_TEST_END_BLOCK 1220
#if USE_KILL_BLOCK_TEST
@@ -120,23 +124,25 @@ static time_measurement_t tmu_write_data;
static time_measurement_t tmu_write_spare;
static time_measurement_t tmu_read_data;
static time_measurement_t tmu_read_spare;
-
-#if NAND_USE_BAD_MAP
-static uint32_t badblock_map[NAND_BLOCKS_COUNT / 32];
+static time_measurement_t tmu_driver_start;
+
+#if USE_BAD_MAP
+#define BAD_MAP_LEN (NAND_BLOCKS_COUNT / (sizeof(bitmap_word_t) * 8))
+static bitmap_word_t badblock_map_array[BAD_MAP_LEN];
+static bitmap_t badblock_map = {
+ badblock_map_array,
+ BAD_MAP_LEN
+};
#endif
/*
*
*/
static const NANDConfig nandcfg = {
- &FSMCD1,
NAND_BLOCKS_COUNT,
NAND_PAGE_DATA_SIZE,
NAND_PAGE_SPARE_SIZE,
NAND_PAGES_PER_BLOCK,
-#if NAND_USE_BAD_MAP
- badblock_map,
-#endif
NAND_ROW_WRITE_CYCLES,
NAND_COL_WRITE_CYCLES,
/* stm32 specific fields */
@@ -567,7 +573,14 @@ int main(void) {
#if STM32_NAND_USE_EXT_INT
extStart(&EXTD1, &extcfg);
#endif
- nandStart(&NAND, &nandcfg);
+ chTMObjectInit(&tmu_driver_start);
+ chTMStartMeasurementX(&tmu_driver_start);
+#if USE_BAD_MAP
+ nandStart(&NAND, &nandcfg, &badblock_map);
+#else
+ nandStart(&NAND, &nandcfg, NULL);
+#endif
+ chTMStopMeasurementX(&tmu_driver_start);
chThdSleepMilliseconds(4000);
@@ -586,7 +599,7 @@ int main(void) {
dma_storm_uart_start();
dma_storm_spi_start();
T = chVTGetSystemTimeX();
- general_test(&NAND, NANF_TEST_START_BLOCK, NAND_TEST_END_BLOCK, 1);
+ general_test(&NAND, NAND_TEST_START_BLOCK, NAND_TEST_END_BLOCK, 1);
T = chVTGetSystemTimeX() - T;
adc_ints = dma_storm_adc_stop();
uart_ints = dma_storm_uart_stop();
@@ -611,9 +624,9 @@ int main(void) {
* ensure that NAND code have negligible impact on other subsystems
*/
osalDbgCheck(background_cnt > (BackgroundThdCnt / 4));
- osalDbgCheck(abs(adc_ints - adc_idle_ints) < (adc_idle_ints / 20));
+ osalDbgCheck(abs(adc_ints - adc_idle_ints) < (adc_idle_ints / 20));
osalDbgCheck(abs(uart_ints - uart_idle_ints) < (uart_idle_ints / 20));
- osalDbgCheck(abs(spi_ints - spi_idle_ints) < (spi_idle_ints / 10));
+ osalDbgCheck(abs(spi_ints - spi_idle_ints) < (spi_idle_ints / 10));
/*
* perform ECC calculation test
@@ -629,7 +642,7 @@ int main(void) {
/*
* Normal main() thread activity, in this demo it does nothing.
*/
- while (TRUE) {
+ while (true) {
chThdSleepMilliseconds(500);
}
}
diff --git a/testhal/STM32/STM32F4xx/FSMC_NAND/mcuconf_community.h b/testhal/STM32/STM32F4xx/FSMC_NAND/mcuconf_community.h
index a9c0daf..f2b53d8 100644
--- a/testhal/STM32/STM32F4xx/FSMC_NAND/mcuconf_community.h
+++ b/testhal/STM32/STM32F4xx/FSMC_NAND/mcuconf_community.h
@@ -21,7 +21,8 @@
#define STM32_FSMC_FSMC1_IRQ_PRIORITY 10
#define STM32_NAND_USE_FSMC_NAND1 TRUE
-#define STM32_NAND_USE_EXT_INT TRUE
+#define STM32_NAND_USE_FSMC_NAND2 FALSE
+#define STM32_NAND_USE_EXT_INT FALSE
#define STM32_NAND_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
#define STM32_NAND_DMA_PRIORITY 0
#define STM32_NAND_DMA_ERROR_HOOK(nandp) osalSysHalt("DMA failure")
@@ -30,4 +31,12 @@
* FSMC SRAM driver system settings.
*/
#define STM32_USE_FSMC_SRAM FALSE
+#define STM32_SRAM_USE_FSMC_SRAM1 FALSE
+#define STM32_SRAM_USE_FSMC_SRAM2 FALSE
+#define STM32_SRAM_USE_FSMC_SRAM3 FALSE
#define STM32_SRAM_USE_FSMC_SRAM4 FALSE
+
+/*
+ * FSMC PC card driver system settings.
+ */
+#define STM32_USE_FSMC_PCCARD FALSE