aboutsummaryrefslogtreecommitdiffstats
path: root/os/various/memtest.h
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 /os/various/memtest.h
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 'os/various/memtest.h')
-rw-r--r--os/various/memtest.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/os/various/memtest.h b/os/various/memtest.h
new file mode 100644
index 0000000..721b36b
--- /dev/null
+++ b/os/various/memtest.h
@@ -0,0 +1,88 @@
+/*
+ ChibiOS/RT - Copyright (C) 2013-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 MEMTEST_H_
+#define MEMTEST_H_
+
+#define MEMTEST_WALKING_ONE (1 << 0)
+#define MEMTEST_WALKING_ZERO (1 << 1)
+#define MEMTEST_OWN_ADDRESS (1 << 2)
+#define MEMTEST_MOVING_INVERSION_ZERO (1 << 3)
+#define MEMTEST_MOVING_INVERSION_55AA (1 << 4)
+#define MEMTEST_MOVING_INVERSION_RAND (1 << 5)
+
+#define MEMTEST_RUN_ALL (MEMTEST_WALKING_ONE | \
+ MEMTEST_WALKING_ZERO | \
+ MEMTEST_OWN_ADDRESS | \
+ MEMTEST_MOVING_INVERSION_ZERO | \
+ MEMTEST_MOVING_INVERSION_55AA | \
+ MEMTEST_MOVING_INVERSION_RAND)
+
+typedef struct memtest_t memtest_t;
+typedef uint32_t testtype;
+
+/*
+ * Error call back.
+ */
+typedef void (*memtestecb_t)(memtest_t *testp, testtype type, size_t index,
+ size_t current_width, uint32_t got, uint32_t expect);
+
+/*
+ *
+ */
+typedef enum {
+ MEMTEST_WIDTH_8,
+ MEMTEST_WIDTH_16,
+ MEMTEST_WIDTH_32,
+} memtest_bus_width_t;
+
+/*
+ *
+ */
+struct memtest_t {
+ /*
+ * Pointer to the test area start. Must be word aligned.
+ */
+ void *start;
+ /*
+ * Test area size in bytes.
+ */
+ size_t size;
+ /*
+ * Maximum width of transactions.
+ * Note: it implies all narrower tests.
+ * Note: width my be wider then your memory interface because AHB is
+ * smart enough to split big transactions to smaller ones.
+ */
+ memtest_bus_width_t width;
+ /*
+ * Error callback pointer. Set to NULL if unused.
+ */
+ memtestecb_t errcb;
+};
+
+/*
+ *
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void memtest_run(memtest_t *testp, uint32_t testmask);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MEMTEST_H_ */