From ccbfd6ecc058ba55899bcaa9b360887a0330c1a5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 25 Apr 2011 12:41:47 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2901 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/SDIO/main.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 testhal/STM32/SDIO/main.c (limited to 'testhal/STM32/SDIO/main.c') diff --git a/testhal/STM32/SDIO/main.c b/testhal/STM32/SDIO/main.c new file mode 100644 index 000000000..3e7971f49 --- /dev/null +++ b/testhal/STM32/SDIO/main.c @@ -0,0 +1,57 @@ +/* + ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010, + 2011 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "ch.h" +#include "hal.h" + +/* + * SDIO configuration. + */ +static const SDCConfig sdccfg = { +}; + +/* + * Application entry point. + */ +int main(void) { + + /* + * System initializations. + * - HAL initialization, this also initializes the configured device drivers + * and performs the board-specific initializations. + * - Kernel initialization, the main() function becomes a thread and the + * RTOS is active. + */ + halInit(); + chSysInit(); + + /* + * Initializes the SDIO drivers. + */ + sdcStart(&SDCD1, &sdccfg); + + /* + * Normal main() thread activity. + */ + while (TRUE) { + chThdSleepMilliseconds(500); + } + return 0; +} -- cgit v1.2.3 From fc8ea30f6e774ab92b2a44c4eb5e40ae2a9d9d1f Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 30 Apr 2011 10:14:07 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2906 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/SDIO/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testhal/STM32/SDIO/main.c') diff --git a/testhal/STM32/SDIO/main.c b/testhal/STM32/SDIO/main.c index 3e7971f49..3194921f4 100644 --- a/testhal/STM32/SDIO/main.c +++ b/testhal/STM32/SDIO/main.c @@ -25,6 +25,7 @@ * SDIO configuration. */ static const SDCConfig sdccfg = { + 0 }; /* @@ -53,5 +54,4 @@ int main(void) { while (TRUE) { chThdSleepMilliseconds(500); } - return 0; } -- cgit v1.2.3 From dd9cac5ffa29031b1175bb750e587a20362f5276 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 30 Apr 2011 18:46:09 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2907 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/SDIO/main.c | 1 + 1 file changed, 1 insertion(+) (limited to 'testhal/STM32/SDIO/main.c') diff --git a/testhal/STM32/SDIO/main.c b/testhal/STM32/SDIO/main.c index 3194921f4..44a294655 100644 --- a/testhal/STM32/SDIO/main.c +++ b/testhal/STM32/SDIO/main.c @@ -47,6 +47,7 @@ int main(void) { * Initializes the SDIO drivers. */ sdcStart(&SDCD1, &sdccfg); + sdcConnect(&SDCD1); /* * Normal main() thread activity. -- cgit v1.2.3 From 6dc70a8453a1a2b5953330dcd688f2121ad62732 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 7 May 2011 16:16:14 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2924 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/SDIO/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'testhal/STM32/SDIO/main.c') diff --git a/testhal/STM32/SDIO/main.c b/testhal/STM32/SDIO/main.c index 44a294655..09fe82a9c 100644 --- a/testhal/STM32/SDIO/main.c +++ b/testhal/STM32/SDIO/main.c @@ -28,6 +28,8 @@ static const SDCConfig sdccfg = { 0 }; +static uint8_t buf[SDC_BLOCK_SIZE]; + /* * Application entry point. */ @@ -47,7 +49,9 @@ int main(void) { * Initializes the SDIO drivers. */ sdcStart(&SDCD1, &sdccfg); - sdcConnect(&SDCD1); + if (!sdcConnect(&SDCD1)) { + sdcRead(&SDCD1, 0, buf, 1); + } /* * Normal main() thread activity. -- cgit v1.2.3 From a02604be122fa2ebbe65a513fbb03abd2fdc8d78 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 May 2011 09:08:46 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2931 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/SDIO/main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'testhal/STM32/SDIO/main.c') diff --git a/testhal/STM32/SDIO/main.c b/testhal/STM32/SDIO/main.c index 09fe82a9c..30859f6be 100644 --- a/testhal/STM32/SDIO/main.c +++ b/testhal/STM32/SDIO/main.c @@ -28,7 +28,7 @@ static const SDCConfig sdccfg = { 0 }; -static uint8_t buf[SDC_BLOCK_SIZE]; +static uint8_t buf[SDC_BLOCK_SIZE * 16]; /* * Application entry point. @@ -50,7 +50,10 @@ int main(void) { */ sdcStart(&SDCD1, &sdccfg); if (!sdcConnect(&SDCD1)) { - sdcRead(&SDCD1, 0, buf, 1); + int i; + for (i = 0; i < 1000; i++) + if (sdcRead(&SDCD1, 0, buf, 16)) + chSysHalt(); } /* -- cgit v1.2.3 From 5287718f21e95e2718a7f459118dbcdc797b4bca Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 May 2011 10:04:30 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2936 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/SDIO/main.c | 1 + 1 file changed, 1 insertion(+) (limited to 'testhal/STM32/SDIO/main.c') diff --git a/testhal/STM32/SDIO/main.c b/testhal/STM32/SDIO/main.c index 30859f6be..bd5375910 100644 --- a/testhal/STM32/SDIO/main.c +++ b/testhal/STM32/SDIO/main.c @@ -51,6 +51,7 @@ int main(void) { sdcStart(&SDCD1, &sdccfg); if (!sdcConnect(&SDCD1)) { int i; + /* Repeated multiple reads.*/ for (i = 0; i < 1000; i++) if (sdcRead(&SDCD1, 0, buf, 16)) chSysHalt(); -- cgit v1.2.3 From 3d0610f1cceb8f13b5b73dfe4dfd855450e69664 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 8 May 2011 19:50:20 +0000 Subject: SDC write seems to work. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2941 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/SDIO/main.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'testhal/STM32/SDIO/main.c') diff --git a/testhal/STM32/SDIO/main.c b/testhal/STM32/SDIO/main.c index bd5375910..075af2cc3 100644 --- a/testhal/STM32/SDIO/main.c +++ b/testhal/STM32/SDIO/main.c @@ -28,7 +28,7 @@ static const SDCConfig sdccfg = { 0 }; -static uint8_t buf[SDC_BLOCK_SIZE * 16]; +static uint8_t buf[SDC_BLOCK_SIZE * 2]; /* * Application entry point. @@ -52,9 +52,18 @@ int main(void) { if (!sdcConnect(&SDCD1)) { int i; /* Repeated multiple reads.*/ - for (i = 0; i < 1000; i++) - if (sdcRead(&SDCD1, 0, buf, 16)) + for (i = 0; i < 5000; i++) { + if (sdcRead(&SDCD1, 0, buf, 2)) chSysHalt(); + } + if (sdcRead(&SDCD1, 0x10000, buf, 2)) + chSysHalt(); + if (sdcWrite(&SDCD1, 0x10000, buf, 2)) + chSysHalt(); + if (sdcRead(&SDCD1, 0x10000, buf, 2)) + chSysHalt(); + if (sdcDisconnect(&SDCD1)) + chSysHalt(); } /* -- cgit v1.2.3 From 6d58148a5270e9b0e64af4273c07fff11fb83b02 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 22 May 2011 07:06:19 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2993 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/SDIO/main.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'testhal/STM32/SDIO/main.c') diff --git a/testhal/STM32/SDIO/main.c b/testhal/STM32/SDIO/main.c index 075af2cc3..8c5452ed7 100644 --- a/testhal/STM32/SDIO/main.c +++ b/testhal/STM32/SDIO/main.c @@ -28,7 +28,7 @@ static const SDCConfig sdccfg = { 0 }; -static uint8_t buf[SDC_BLOCK_SIZE * 2]; +static uint8_t blkbuf[SDC_BLOCK_SIZE * 4]; /* * Application entry point. @@ -53,15 +53,18 @@ int main(void) { int i; /* Repeated multiple reads.*/ for (i = 0; i < 5000; i++) { - if (sdcRead(&SDCD1, 0, buf, 2)) + if (sdcRead(&SDCD1, 0, blkbuf, 4)) + chSysHalt(); + } + /* Repeated multiple write.*/ + for (i = 0; i < 100; i++) { + if (sdcRead(&SDCD1, 0x10000, blkbuf, 4)) + chSysHalt(); + if (sdcWrite(&SDCD1, 0x10000, blkbuf, 4)) + chSysHalt(); + if (sdcWrite(&SDCD1, 0x10000, blkbuf, 4)) chSysHalt(); } - if (sdcRead(&SDCD1, 0x10000, buf, 2)) - chSysHalt(); - if (sdcWrite(&SDCD1, 0x10000, buf, 2)) - chSysHalt(); - if (sdcRead(&SDCD1, 0x10000, buf, 2)) - chSysHalt(); if (sdcDisconnect(&SDCD1)) chSysHalt(); } -- cgit v1.2.3 From 88e92b3fc3a14ec04780815b1061e680dfbb9777 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 29 May 2011 09:09:22 +0000 Subject: Improvements to the STM32 SDC driver. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3001 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/SDIO/main.c | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) (limited to 'testhal/STM32/SDIO/main.c') diff --git a/testhal/STM32/SDIO/main.c b/testhal/STM32/SDIO/main.c index 8c5452ed7..9736f0268 100644 --- a/testhal/STM32/SDIO/main.c +++ b/testhal/STM32/SDIO/main.c @@ -28,7 +28,7 @@ static const SDCConfig sdccfg = { 0 }; -static uint8_t blkbuf[SDC_BLOCK_SIZE * 4]; +static uint8_t blkbuf[SDC_BLOCK_SIZE * 4 + 1]; /* * Application entry point. @@ -51,12 +51,36 @@ int main(void) { sdcStart(&SDCD1, &sdccfg); if (!sdcConnect(&SDCD1)) { int i; - /* Repeated multiple reads.*/ - for (i = 0; i < 5000; i++) { + + /* Single aligned read.*/ + if (sdcRead(&SDCD1, 0, blkbuf, 1)) + chSysHalt(); + + /* Single unaligned read.*/ + if (sdcRead(&SDCD1, 0, blkbuf + 1, 1)) + chSysHalt(); + + /* Multiple aligned read.*/ + if (sdcRead(&SDCD1, 0, blkbuf, 4)) + chSysHalt(); + + /* Multiple unaligned read.*/ + if (sdcRead(&SDCD1, 0, blkbuf + 1, 4)) + chSysHalt(); + + /* Repeated multiple aligned reads.*/ + for (i = 0; i < 1000; i++) { if (sdcRead(&SDCD1, 0, blkbuf, 4)) chSysHalt(); } - /* Repeated multiple write.*/ + + /* Repeated multiple unaligned reads.*/ + for (i = 0; i < 1000; i++) { + if (sdcRead(&SDCD1, 0, blkbuf + 1, 4)) + chSysHalt(); + } + + /* Repeated multiple aligned writes.*/ for (i = 0; i < 100; i++) { if (sdcRead(&SDCD1, 0x10000, blkbuf, 4)) chSysHalt(); @@ -65,6 +89,17 @@ int main(void) { if (sdcWrite(&SDCD1, 0x10000, blkbuf, 4)) chSysHalt(); } + + /* Repeated multiple unaligned writes.*/ + for (i = 0; i < 100; i++) { + if (sdcRead(&SDCD1, 0x10000, blkbuf + 1, 4)) + chSysHalt(); + if (sdcWrite(&SDCD1, 0x10000, blkbuf + 1, 4)) + chSysHalt(); + if (sdcWrite(&SDCD1, 0x10000, blkbuf + 1, 4)) + chSysHalt(); + } + if (sdcDisconnect(&SDCD1)) chSysHalt(); } -- cgit v1.2.3