git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6310 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
06eaa953ac
commit
5df36352fb
|
@ -153,16 +153,22 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define STM32_SDC_WRITE_TIMEOUT \
|
#define STM32_SDC_WRITE_TIMEOUT \
|
||||||
(((STM32_PLL48CLK / (STM32_SDIO_DIV_HS + 2)) / 1000) * SDC_WRITE_TIMEOUT_MS)
|
(((STM32_PLL48CLK / (STM32_SDIO_DIV_HS + 2)) / 1000) * \
|
||||||
|
STM32_SDC_WRITE_TIMEOUT_MS)
|
||||||
#define STM32_SDC_READ_TIMEOUT \
|
#define STM32_SDC_READ_TIMEOUT \
|
||||||
(((STM32_PLL48CLK / (STM32_SDIO_DIV_HS + 2)) / 1000) * SDC_READ_TIMEOUT_MS)
|
(((STM32_PLL48CLK / (STM32_SDIO_DIV_HS + 2)) / 1000) * \
|
||||||
|
STM32_SDC_READ_TIMEOUT_MS)
|
||||||
|
|
||||||
|
#else /* !(defined(STM32F4XX) || defined(STM32F2XX)) */
|
||||||
|
|
||||||
#else
|
|
||||||
#define STM32_SDC_WRITE_TIMEOUT \
|
#define STM32_SDC_WRITE_TIMEOUT \
|
||||||
(((STM32_HCLK / (STM32_SDIO_DIV_HS + 2)) / 1000) * SDC_WRITE_TIMEOUT_MS)
|
(((STM32_HCLK / (STM32_SDIO_DIV_HS + 2)) / 1000) * \
|
||||||
|
STM32_SDC_WRITE_TIMEOUT_MS)
|
||||||
#define STM32_SDC_READ_TIMEOUT \
|
#define STM32_SDC_READ_TIMEOUT \
|
||||||
(((STM32_HCLK / (STM32_SDIO_DIV_HS + 2)) / 1000) * SDC_READ_TIMEOUT_MS)
|
(((STM32_HCLK / (STM32_SDIO_DIV_HS + 2)) / 1000) * \
|
||||||
#endif
|
STM32_SDC_READ_TIMEOUT_MS)
|
||||||
|
|
||||||
|
#endif /* !(defined(STM32F4XX) || defined(STM32F2XX)) */
|
||||||
|
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
/* Driver data structures and types. */
|
/* Driver data structures and types. */
|
||||||
|
|
|
@ -89,7 +89,7 @@ static const ADCConversionGroup adcgrpcfg2 = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Red LEDs blinker thread, times are in milliseconds.
|
* Red LED blinker thread, times are in milliseconds.
|
||||||
*/
|
*/
|
||||||
static THD_WORKING_AREA(waThread1, 128);
|
static THD_WORKING_AREA(waThread1, 128);
|
||||||
static msg_t Thread1(void *arg) {
|
static msg_t Thread1(void *arg) {
|
||||||
|
|
|
@ -77,7 +77,7 @@ PROJECT = ch
|
||||||
# Imported source files and paths
|
# Imported source files and paths
|
||||||
CHIBIOS = ../../..
|
CHIBIOS = ../../..
|
||||||
include $(CHIBIOS)/os/hal/hal.mk
|
include $(CHIBIOS)/os/hal/hal.mk
|
||||||
include $(CHIBIOS)/os/hal/boards/NONSTANDARD_STM32F4_BARTHESS1/board.mk
|
include $(CHIBIOS)/os/hal/boards/OLIMEX_STM32_E407/board.mk
|
||||||
include $(CHIBIOS)/os/hal/ports/STM32F4xx/platform.mk
|
include $(CHIBIOS)/os/hal/ports/STM32F4xx/platform.mk
|
||||||
include $(CHIBIOS)/os/rt/rt.mk
|
include $(CHIBIOS)/os/rt/rt.mk
|
||||||
include $(CHIBIOS)/os/rt/osal/osal.mk
|
include $(CHIBIOS)/os/rt/osal/osal.mk
|
||||||
|
@ -96,10 +96,6 @@ CSRC = $(PORTSRC) \
|
||||||
$(OSALSRC) \
|
$(OSALSRC) \
|
||||||
$(PLATFORMSRC) \
|
$(PLATFORMSRC) \
|
||||||
$(BOARDSRC) \
|
$(BOARDSRC) \
|
||||||
$(FATFSSRC) \
|
|
||||||
$(CHIBIOS)/os/various/evtimer.c \
|
|
||||||
$(CHIBIOS)/os/various/syscalls.c \
|
|
||||||
$(CHIBIOS)/os/various/shell.c \
|
|
||||||
$(CHIBIOS)/os/various/chprintf.c \
|
$(CHIBIOS)/os/various/chprintf.c \
|
||||||
main.c
|
main.c
|
||||||
|
|
||||||
|
@ -132,7 +128,6 @@ ASMSRC = $(PORTASM)
|
||||||
|
|
||||||
INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \
|
INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) \
|
||||||
$(HALINC) $(OSALINC) $(PLATFORMINC) $(BOARDINC) \
|
$(HALINC) $(OSALINC) $(PLATFORMINC) $(BOARDINC) \
|
||||||
$(FATFSINC) \
|
|
||||||
$(CHIBIOS)/os/various
|
$(CHIBIOS)/os/various
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -14,369 +14,51 @@
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include "ch.h"
|
#include "ch.h"
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
|
|
||||||
#include "shell.h"
|
|
||||||
#include "chprintf.h"
|
#include "chprintf.h"
|
||||||
|
|
||||||
#include "ff.h"
|
|
||||||
|
|
||||||
#define SDC_DATA_DESTRUCTIVE_TEST FALSE
|
|
||||||
|
|
||||||
#define SDC_BURST_SIZE 8 /* how many sectors reads at once */
|
|
||||||
static uint8_t outbuf[MMCSD_BLOCK_SIZE * SDC_BURST_SIZE + 1];
|
|
||||||
static uint8_t inbuf[MMCSD_BLOCK_SIZE * SDC_BURST_SIZE + 1];
|
|
||||||
|
|
||||||
/* FS object.*/
|
|
||||||
static FATFS SDC_FS;
|
|
||||||
|
|
||||||
/* FS mounted and ready.*/
|
|
||||||
static bool_t fs_ready = FALSE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Parody of UNIX badblocks program.
|
|
||||||
*
|
|
||||||
* @param[in] start first block to check
|
|
||||||
* @param[in] end last block to check
|
|
||||||
* @param[in] blockatonce number of blocks to check at once
|
|
||||||
* @param[in] pattern check pattern
|
|
||||||
*
|
|
||||||
* @return The operation status.
|
|
||||||
* @retval SDC_SUCCESS operation succeeded, the requested blocks have been
|
|
||||||
* read.
|
|
||||||
* @retval SDC_FAILED operation failed, the state of the buffer is uncertain.
|
|
||||||
*/
|
|
||||||
bool_t badblocks(uint32_t start, uint32_t end, uint32_t blockatonce, uint8_t pattern){
|
|
||||||
uint32_t position = 0;
|
|
||||||
uint32_t i = 0;
|
|
||||||
|
|
||||||
chDbgCheck(blockatonce <= SDC_BURST_SIZE, "badblocks");
|
|
||||||
|
|
||||||
/* fill control buffer */
|
|
||||||
for (i=0; i < MMCSD_BLOCK_SIZE * blockatonce; i++)
|
|
||||||
outbuf[i] = pattern;
|
|
||||||
|
|
||||||
/* fill SD card with pattern. */
|
|
||||||
position = start;
|
|
||||||
while (position < end){
|
|
||||||
if (sdcWrite(&SDCD1, position, outbuf, blockatonce))
|
|
||||||
goto ERROR;
|
|
||||||
position += blockatonce;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* read and compare. */
|
|
||||||
position = start;
|
|
||||||
while (position < end){
|
|
||||||
if (sdcRead(&SDCD1, position, inbuf, blockatonce))
|
|
||||||
goto ERROR;
|
|
||||||
if (memcmp(inbuf, outbuf, blockatonce * MMCSD_BLOCK_SIZE) != 0)
|
|
||||||
goto ERROR;
|
|
||||||
position += blockatonce;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
ERROR:
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void fillbuffer(uint8_t pattern, uint8_t *b){
|
|
||||||
uint32_t i = 0;
|
|
||||||
for (i=0; i < MMCSD_BLOCK_SIZE * SDC_BURST_SIZE; i++)
|
|
||||||
b[i] = pattern;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void fillbuffers(uint8_t pattern){
|
|
||||||
fillbuffer(pattern, inbuf);
|
|
||||||
fillbuffer(pattern, outbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void cmd_sdiotest(BaseSequentialStream *chp, int argc, char *argv[]){
|
|
||||||
(void)argc;
|
|
||||||
(void)argv;
|
|
||||||
uint32_t i = 0;
|
|
||||||
|
|
||||||
chprintf(chp, "Trying to connect SDIO... ");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
|
|
||||||
if (!sdcConnect(&SDCD1)) {
|
|
||||||
|
|
||||||
chprintf(chp, "OK\r\n");
|
|
||||||
chprintf(chp, "*** Card CSD content is: ");
|
|
||||||
chprintf(chp, "%X %X %X %X \r\n", (&SDCD1)->csd[3], (&SDCD1)->csd[2],
|
|
||||||
(&SDCD1)->csd[1], (&SDCD1)->csd[0]);
|
|
||||||
|
|
||||||
chprintf(chp, "Single aligned read...");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
if (sdcRead(&SDCD1, 0, inbuf, 1))
|
|
||||||
chSysHalt();
|
|
||||||
chprintf(chp, " OK\r\n");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
|
|
||||||
|
|
||||||
chprintf(chp, "Single unaligned read...");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
if (sdcRead(&SDCD1, 0, inbuf + 1, 1))
|
|
||||||
chSysHalt();
|
|
||||||
if (sdcRead(&SDCD1, 0, inbuf + 2, 1))
|
|
||||||
chSysHalt();
|
|
||||||
if (sdcRead(&SDCD1, 0, inbuf + 3, 1))
|
|
||||||
chSysHalt();
|
|
||||||
chprintf(chp, " OK\r\n");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
|
|
||||||
|
|
||||||
chprintf(chp, "Multiple aligned reads...");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
fillbuffers(0x55);
|
|
||||||
/* fill reference buffer from SD card */
|
|
||||||
if (sdcRead(&SDCD1, 0, inbuf, SDC_BURST_SIZE))
|
|
||||||
chSysHalt();
|
|
||||||
for (i=0; i<1000; i++){
|
|
||||||
if (sdcRead(&SDCD1, 0, outbuf, SDC_BURST_SIZE))
|
|
||||||
chSysHalt();
|
|
||||||
if (memcmp(inbuf, outbuf, SDC_BURST_SIZE * MMCSD_BLOCK_SIZE) != 0)
|
|
||||||
chSysHalt();
|
|
||||||
}
|
|
||||||
chprintf(chp, " OK\r\n");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
|
|
||||||
|
|
||||||
chprintf(chp, "Multiple unaligned reads...");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
fillbuffers(0x55);
|
|
||||||
/* fill reference buffer from SD card */
|
|
||||||
if (sdcRead(&SDCD1, 0, inbuf + 1, SDC_BURST_SIZE))
|
|
||||||
chSysHalt();
|
|
||||||
for (i=0; i<1000; i++){
|
|
||||||
if (sdcRead(&SDCD1, 0, outbuf + 1, SDC_BURST_SIZE))
|
|
||||||
chSysHalt();
|
|
||||||
if (memcmp(inbuf, outbuf, SDC_BURST_SIZE * MMCSD_BLOCK_SIZE) != 0)
|
|
||||||
chSysHalt();
|
|
||||||
}
|
|
||||||
chprintf(chp, " OK\r\n");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
|
|
||||||
#if SDC_DATA_DESTRUCTIVE_TEST
|
|
||||||
|
|
||||||
chprintf(chp, "Single aligned write...");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
fillbuffer(0xAA, inbuf);
|
|
||||||
if (sdcWrite(&SDCD1, 0, inbuf, 1))
|
|
||||||
chSysHalt();
|
|
||||||
fillbuffer(0, outbuf);
|
|
||||||
if (sdcRead(&SDCD1, 0, outbuf, 1))
|
|
||||||
chSysHalt();
|
|
||||||
if (memcmp(inbuf, outbuf, MMCSD_BLOCK_SIZE) != 0)
|
|
||||||
chSysHalt();
|
|
||||||
chprintf(chp, " OK\r\n");
|
|
||||||
|
|
||||||
chprintf(chp, "Single unaligned write...");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
fillbuffer(0xFF, inbuf);
|
|
||||||
if (sdcWrite(&SDCD1, 0, inbuf+1, 1))
|
|
||||||
chSysHalt();
|
|
||||||
fillbuffer(0, outbuf);
|
|
||||||
if (sdcRead(&SDCD1, 0, outbuf+1, 1))
|
|
||||||
chSysHalt();
|
|
||||||
if (memcmp(inbuf+1, outbuf+1, MMCSD_BLOCK_SIZE) != 0)
|
|
||||||
chSysHalt();
|
|
||||||
chprintf(chp, " OK\r\n");
|
|
||||||
|
|
||||||
chprintf(chp, "Running badblocks at 0x10000 offset...");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
if(badblocks(0x10000, 0x11000, SDC_BURST_SIZE, 0xAA))
|
|
||||||
chSysHalt();
|
|
||||||
chprintf(chp, " OK\r\n");
|
|
||||||
#endif /* !SDC_DATA_DESTRUCTIVE_TEST */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Now perform some FS tests.
|
|
||||||
*/
|
|
||||||
|
|
||||||
FRESULT err;
|
|
||||||
uint32_t clusters;
|
|
||||||
FATFS *fsp;
|
|
||||||
FIL FileObject;
|
|
||||||
uint32_t bytes_written;
|
|
||||||
uint32_t bytes_read;
|
|
||||||
FILINFO filinfo;
|
|
||||||
uint8_t teststring[] = {"This is test file\r\n"};
|
|
||||||
|
|
||||||
chprintf(chp, "Register working area for filesystem... ");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
err = f_mount(0, &SDC_FS);
|
|
||||||
if (err != FR_OK){
|
|
||||||
chSysHalt();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
fs_ready = TRUE;
|
|
||||||
chprintf(chp, "OK\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#if SDC_DATA_DESTRUCTIVE_TEST
|
|
||||||
chprintf(chp, "Formatting... ");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
err = f_mkfs (0,0,0);
|
|
||||||
if (err != FR_OK){
|
|
||||||
chSysHalt();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
chprintf(chp, "OK\r\n");
|
|
||||||
}
|
|
||||||
#endif /* SDC_DATA_DESTRUCTIVE_TEST */
|
|
||||||
|
|
||||||
|
|
||||||
chprintf(chp, "Mount filesystem... ");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
err = f_getfree("/", &clusters, &fsp);
|
|
||||||
if (err != FR_OK) {
|
|
||||||
chSysHalt();
|
|
||||||
}
|
|
||||||
chprintf(chp, "OK\r\n");
|
|
||||||
chprintf(chp,
|
|
||||||
"FS: %lu free clusters, %lu sectors per cluster, %lu bytes free\r\n",
|
|
||||||
clusters, (uint32_t)SDC_FS.csize,
|
|
||||||
clusters * (uint32_t)SDC_FS.csize * (uint32_t)MMCSD_BLOCK_SIZE);
|
|
||||||
|
|
||||||
|
|
||||||
chprintf(chp, "Create file \"chtest.txt\"... ");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
err = f_open(&FileObject, "0:chtest.txt", FA_WRITE | FA_OPEN_ALWAYS);
|
|
||||||
if (err != FR_OK) {
|
|
||||||
chSysHalt();
|
|
||||||
}
|
|
||||||
chprintf(chp, "OK\r\n");
|
|
||||||
chprintf(chp, "Write some data in it... ");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
err = f_write(&FileObject, teststring, sizeof(teststring), (void *)&bytes_written);
|
|
||||||
if (err != FR_OK) {
|
|
||||||
chSysHalt();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
chprintf(chp, "OK\r\n");
|
|
||||||
|
|
||||||
chprintf(chp, "Close file \"chtest.txt\"... ");
|
|
||||||
err = f_close(&FileObject);
|
|
||||||
if (err != FR_OK) {
|
|
||||||
chSysHalt();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
chprintf(chp, "OK\r\n");
|
|
||||||
|
|
||||||
chprintf(chp, "Check file size \"chtest.txt\"... ");
|
|
||||||
err = f_stat("0:chtest.txt", &filinfo);
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
if (err != FR_OK) {
|
|
||||||
chSysHalt();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if (filinfo.fsize == sizeof(teststring))
|
|
||||||
chprintf(chp, "OK\r\n");
|
|
||||||
else
|
|
||||||
chSysHalt();
|
|
||||||
}
|
|
||||||
|
|
||||||
chprintf(chp, "Check file content \"chtest.txt\"... ");
|
|
||||||
err = f_open(&FileObject, "0:chtest.txt", FA_READ | FA_OPEN_EXISTING);
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
if (err != FR_OK) {
|
|
||||||
chSysHalt();
|
|
||||||
}
|
|
||||||
uint8_t buf[sizeof(teststring)];
|
|
||||||
err = f_read(&FileObject, buf, sizeof(teststring), (void *)&bytes_read);
|
|
||||||
if (err != FR_OK) {
|
|
||||||
chSysHalt();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if (memcmp(teststring, buf, sizeof(teststring)) != 0){
|
|
||||||
chSysHalt();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
chprintf(chp, "OK\r\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
chprintf(chp, "Umount filesystem... ");
|
|
||||||
f_mount(0, NULL);
|
|
||||||
chprintf(chp, "OK\r\n");
|
|
||||||
|
|
||||||
chprintf(chp, "Disconnecting from SDIO...");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
if (sdcDisconnect(&SDCD1))
|
|
||||||
chSysHalt();
|
|
||||||
chprintf(chp, " OK\r\n");
|
|
||||||
chprintf(chp, "------------------------------------------------------\r\n");
|
|
||||||
chprintf(chp, "All tests passed successfully.\r\n");
|
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
chSysHalt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SDIO configuration.
|
* LED blinker thread, times are in milliseconds.
|
||||||
*/
|
*/
|
||||||
static const SDCConfig sdccfg = {
|
static THD_WORKING_AREA(waThread1, 128);
|
||||||
0
|
static msg_t Thread1(void *arg) {
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
(void)arg;
|
||||||
*
|
chRegSetThreadName("blinker");
|
||||||
*/
|
while (TRUE) {
|
||||||
static SerialConfig ser_cfg = {
|
palSetPad(GPIOC, GPIOC_LED);
|
||||||
115200,
|
chThdSleepMilliseconds(500);
|
||||||
0,
|
palClearPad(GPIOC, GPIOC_LED);
|
||||||
0,
|
chThdSleepMilliseconds(500);
|
||||||
0,
|
}
|
||||||
};
|
}
|
||||||
static const ShellCommand commands[] = {
|
|
||||||
{"sdiotest", cmd_sdiotest},
|
|
||||||
{NULL, NULL}
|
|
||||||
};
|
|
||||||
static const ShellConfig shell_cfg1 = {
|
|
||||||
(BaseSequentialStream *)&SD2,
|
|
||||||
commands
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Application entry point.
|
* Application entry point.
|
||||||
*/
|
*/
|
||||||
int main(void) {
|
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();
|
halInit();
|
||||||
chSysInit();
|
chSysInit();
|
||||||
|
|
||||||
/* start debugging serial link */
|
|
||||||
sdStart(&SD2, &ser_cfg);
|
|
||||||
shellInit();
|
|
||||||
static WORKING_AREA(waShell, 2048);
|
|
||||||
shellCreateStatic(&shell_cfg1, waShell, sizeof(waShell), NORMALPRIO);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initializes the SDIO drivers.
|
* Creates the blinker thread.
|
||||||
*/
|
*/
|
||||||
sdcStart(&SDCD1, &sdccfg);
|
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Normal main() thread activity.
|
* Normal main() thread activity, in this demo it does nothing.
|
||||||
* Blinking signaling about successful passing.
|
|
||||||
*/
|
*/
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
palTogglePad(GPIOB, GPIOB_LED_R);
|
chThdSleepMilliseconds(500);
|
||||||
chThdSleepMilliseconds(100);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#define STM32_CLOCK48_REQUIRED TRUE
|
#define STM32_CLOCK48_REQUIRED TRUE
|
||||||
#define STM32_SW STM32_SW_PLL
|
#define STM32_SW STM32_SW_PLL
|
||||||
#define STM32_PLLSRC STM32_PLLSRC_HSE
|
#define STM32_PLLSRC STM32_PLLSRC_HSE
|
||||||
#define STM32_PLLM_VALUE 8
|
#define STM32_PLLM_VALUE 12
|
||||||
#define STM32_PLLN_VALUE 336
|
#define STM32_PLLN_VALUE 336
|
||||||
#define STM32_PLLP_VALUE 2
|
#define STM32_PLLP_VALUE 2
|
||||||
#define STM32_PLLQ_VALUE 7
|
#define STM32_PLLQ_VALUE 7
|
||||||
|
@ -65,9 +65,9 @@
|
||||||
* ADC driver system settings.
|
* ADC driver system settings.
|
||||||
*/
|
*/
|
||||||
#define STM32_ADC_ADCPRE ADC_CCR_ADCPRE_DIV4
|
#define STM32_ADC_ADCPRE ADC_CCR_ADCPRE_DIV4
|
||||||
#define STM32_ADC_USE_ADC1 FALSE
|
#define STM32_ADC_USE_ADC1 TRUE
|
||||||
#define STM32_ADC_USE_ADC2 FALSE
|
#define STM32_ADC_USE_ADC2 TRUE
|
||||||
#define STM32_ADC_USE_ADC3 FALSE
|
#define STM32_ADC_USE_ADC3 TRUE
|
||||||
#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
|
#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
|
||||||
#define STM32_ADC_ADC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
|
#define STM32_ADC_ADC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
|
||||||
#define STM32_ADC_ADC3_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
|
#define STM32_ADC_ADC3_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
|
||||||
|
@ -218,6 +218,16 @@
|
||||||
#define STM32_SERIAL_UART5_PRIORITY 12
|
#define STM32_SERIAL_UART5_PRIORITY 12
|
||||||
#define STM32_SERIAL_USART6_PRIORITY 12
|
#define STM32_SERIAL_USART6_PRIORITY 12
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SDIO driver system settings.
|
||||||
|
*/
|
||||||
|
#define STM32_SDC_SDIO_DMA_PRIORITY 3
|
||||||
|
#define STM32_SDC_SDIO_IRQ_PRIORITY 9
|
||||||
|
#define STM32_SDC_WRITE_TIMEOUT_MS 250
|
||||||
|
#define STM32_SDC_READ_TIMEOUT_MS 5
|
||||||
|
#define STM32_SDC_SDIO_UNALIGNED_SUPPORT TRUE
|
||||||
|
#define STM32_SDC_SDIO_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SPI driver system settings.
|
* SPI driver system settings.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue