aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32F37x
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-09-29 10:39:31 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-09-29 10:39:31 +0000
commit2c928f2833afa53ec045adafb39d85b84685a2d8 (patch)
treea542c9dc0184d3681dfded286fcf8d75edcf3f69 /testhal/STM32F37x
parent67177198e9228a0b8c8086d85ba206ad8164bd01 (diff)
downloadChibiOS-2c928f2833afa53ec045adafb39d85b84685a2d8.tar.gz
ChibiOS-2c928f2833afa53ec045adafb39d85b84685a2d8.tar.bz2
ChibiOS-2c928f2833afa53ec045adafb39d85b84685a2d8.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6330 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32F37x')
-rw-r--r--testhal/STM32F37x/PWM-ICU/.project2
-rw-r--r--testhal/STM32F37x/PWM-ICU/mcuconf.h2
-rw-r--r--testhal/STM32F37x/SDADC/.project2
-rw-r--r--testhal/STM32F37x/SDADC/main.c5
-rw-r--r--testhal/STM32F37x/SDADC/mcuconf.h8
-rw-r--r--testhal/STM32F37x/SPI/.project2
-rw-r--r--testhal/STM32F37x/SPI/halconf.h4
-rw-r--r--testhal/STM32F37x/SPI/main.c15
-rw-r--r--testhal/STM32F37x/SPI/mcuconf.h10
-rw-r--r--testhal/STM32F37x/UART/.project2
-rw-r--r--testhal/STM32F37x/UART/halconf.h4
-rw-r--r--testhal/STM32F37x/UART/main.c24
-rw-r--r--testhal/STM32F37x/UART/mcuconf.h10
-rw-r--r--testhal/STM32F37x/USB_CDC/.project2
-rw-r--r--testhal/STM32F37x/USB_CDC/Makefile2
-rw-r--r--testhal/STM32F37x/USB_CDC/halconf.h6
-rw-r--r--testhal/STM32F37x/USB_CDC/main.c29
-rw-r--r--testhal/STM32F37x/USB_CDC/mcuconf.h6
18 files changed, 70 insertions, 65 deletions
diff --git a/testhal/STM32F37x/PWM-ICU/.project b/testhal/STM32F37x/PWM-ICU/.project
index 958fa1637..3ee772eaa 100644
--- a/testhal/STM32F37x/PWM-ICU/.project
+++ b/testhal/STM32F37x/PWM-ICU/.project
@@ -27,7 +27,7 @@
<link>
<name>board</name>
<type>2</type>
- <locationURI>CHIBIOS/boards/ST_STM32373C_EVAL</locationURI>
+ <locationURI>CHIBIOS/os/hal/boards/ST_STM32373C_EVAL</locationURI>
</link>
<link>
<name>os</name>
diff --git a/testhal/STM32F37x/PWM-ICU/mcuconf.h b/testhal/STM32F37x/PWM-ICU/mcuconf.h
index 062fe87e0..0e5bc5c39 100644
--- a/testhal/STM32F37x/PWM-ICU/mcuconf.h
+++ b/testhal/STM32F37x/PWM-ICU/mcuconf.h
@@ -152,7 +152,7 @@
#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 FALSE
#define STM32_PWM_USE_TIM4 FALSE
-#define STM32_PWM_USE_TIM5 FALSE
+#define STM32_PWM_USE_TIM5 TRUE
#define STM32_PWM_TIM2_IRQ_PRIORITY 7
#define STM32_PWM_TIM3_IRQ_PRIORITY 7
#define STM32_PWM_TIM4_IRQ_PRIORITY 7
diff --git a/testhal/STM32F37x/SDADC/.project b/testhal/STM32F37x/SDADC/.project
index 83a87eb03..72cfb92b9 100644
--- a/testhal/STM32F37x/SDADC/.project
+++ b/testhal/STM32F37x/SDADC/.project
@@ -27,7 +27,7 @@
<link>
<name>board</name>
<type>2</type>
- <locationURI>CHIBIOS/boards/ST_STM32373C_EVAL</locationURI>
+ <locationURI>CHIBIOS/os/hal/boards/ST_STM32373C_EVAL</locationURI>
</link>
<link>
<name>os</name>
diff --git a/testhal/STM32F37x/SDADC/main.c b/testhal/STM32F37x/SDADC/main.c
index 1d700a3a5..6d5bd4383 100644
--- a/testhal/STM32F37x/SDADC/main.c
+++ b/testhal/STM32F37x/SDADC/main.c
@@ -102,10 +102,11 @@ static const ADCConversionGroup adcgrpcfg2 = {
/*
* Red LEDs blinker thread, times are in milliseconds.
*/
-static WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_WORKING_AREA(waThread1, 128);
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
+
chRegSetThreadName("blinker");
while (TRUE) {
palClearPad(GPIOC, GPIOC_LED1);
diff --git a/testhal/STM32F37x/SDADC/mcuconf.h b/testhal/STM32F37x/SDADC/mcuconf.h
index f2e3e3def..9f383d592 100644
--- a/testhal/STM32F37x/SDADC/mcuconf.h
+++ b/testhal/STM32F37x/SDADC/mcuconf.h
@@ -63,9 +63,9 @@
* ADC driver system settings.
*/
#define STM32_ADC_USE_ADC1 TRUE
-#define STM32_ADC_USE_SDADC1 FALSE
-#define STM32_ADC_USE_SDADC2 FALSE
-#define STM32_ADC_USE_SDADC3 FALSE
+#define STM32_ADC_USE_SDADC1 TRUE
+#define STM32_ADC_USE_SDADC2 TRUE
+#define STM32_ADC_USE_SDADC3 TRUE
#define STM32_ADC_ADC1_DMA_PRIORITY 2
#define STM32_ADC_SDADC1_DMA_PRIORITY 2
#define STM32_ADC_SDADC2_DMA_PRIORITY 2
@@ -81,7 +81,7 @@
/*
* CAN driver system settings.
*/
-#define STM32_CAN_USE_CAN1 TRUE
+#define STM32_CAN_USE_CAN1 FALSE
#define STM32_CAN_CAN1_IRQ_PRIORITY 11
/*
diff --git a/testhal/STM32F37x/SPI/.project b/testhal/STM32F37x/SPI/.project
index c3985659c..b3ceb5b95 100644
--- a/testhal/STM32F37x/SPI/.project
+++ b/testhal/STM32F37x/SPI/.project
@@ -27,7 +27,7 @@
<link>
<name>board</name>
<type>2</type>
- <locationURI>CHIBIOS/boards/ST_STM32373C_EVAL</locationURI>
+ <locationURI>CHIBIOS/os/hal/boards/ST_STM32373C_EVAL</locationURI>
</link>
<link>
<name>os</name>
diff --git a/testhal/STM32F37x/SPI/halconf.h b/testhal/STM32F37x/SPI/halconf.h
index d60800288..461d509b4 100644
--- a/testhal/STM32F37x/SPI/halconf.h
+++ b/testhal/STM32F37x/SPI/halconf.h
@@ -41,7 +41,7 @@
* @brief Enables the ADC subsystem.
*/
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
-#define HAL_USE_ADC TRUE
+#define HAL_USE_ADC FALSE
#endif
/**
@@ -132,7 +132,7 @@
* @brief Enables the SPI subsystem.
*/
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
-#define HAL_USE_SPI FALSE
+#define HAL_USE_SPI TRUE
#endif
/**
diff --git a/testhal/STM32F37x/SPI/main.c b/testhal/STM32F37x/SPI/main.c
index 3a828f3a9..7c005122a 100644
--- a/testhal/STM32F37x/SPI/main.c
+++ b/testhal/STM32F37x/SPI/main.c
@@ -48,10 +48,11 @@ static uint8_t rxbuf[512];
/*
* SPI bus contender 1.
*/
-static WORKING_AREA(spi_thread_1_wa, 256);
-static msg_t spi_thread_1(void *p) {
+static THD_WORKING_AREA(spi_thread_1_wa, 256);
+static THD_FUNCTION(spi_thread_1, p) {
(void)p;
+
chRegSetThreadName("SPI thread 1");
while (TRUE) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
@@ -69,10 +70,11 @@ static msg_t spi_thread_1(void *p) {
/*
* SPI bus contender 2.
*/
-static WORKING_AREA(spi_thread_2_wa, 256);
-static msg_t spi_thread_2(void *p) {
+static THD_WORKING_AREA(spi_thread_2_wa, 256);
+static THD_FUNCTION(spi_thread_2, p) {
(void)p;
+
chRegSetThreadName("SPI thread 2");
while (TRUE) {
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
@@ -91,10 +93,11 @@ static msg_t spi_thread_2(void *p) {
* This is a periodic thread that does absolutely nothing except flashing
* a LED.
*/
-static WORKING_AREA(blinker_wa, 128);
-static msg_t blinker(void *arg) {
+static THD_WORKING_AREA(blinker_wa, 128);
+static THD_FUNCTION(blinker, arg) {
(void)arg;
+
chRegSetThreadName("blinker");
while (TRUE) {
palSetPad(GPIOC, GPIOC_LED1);
diff --git a/testhal/STM32F37x/SPI/mcuconf.h b/testhal/STM32F37x/SPI/mcuconf.h
index f2e3e3def..3747b2b78 100644
--- a/testhal/STM32F37x/SPI/mcuconf.h
+++ b/testhal/STM32F37x/SPI/mcuconf.h
@@ -62,7 +62,7 @@
/*
* ADC driver system settings.
*/
-#define STM32_ADC_USE_ADC1 TRUE
+#define STM32_ADC_USE_ADC1 FALSE
#define STM32_ADC_USE_SDADC1 FALSE
#define STM32_ADC_USE_SDADC2 FALSE
#define STM32_ADC_USE_SDADC3 FALSE
@@ -81,7 +81,7 @@
/*
* CAN driver system settings.
*/
-#define STM32_CAN_USE_CAN1 TRUE
+#define STM32_CAN_USE_CAN1 FALSE
#define STM32_CAN_CAN1_IRQ_PRIORITY 11
/*
@@ -175,9 +175,9 @@
/*
* SPI driver system settings.
*/
-#define STM32_SPI_USE_SPI1 FALSE
-#define STM32_SPI_USE_SPI2 FALSE
-#define STM32_SPI_USE_SPI3 FALSE
+#define STM32_SPI_USE_SPI1 TRUE
+#define STM32_SPI_USE_SPI2 TRUE
+#define STM32_SPI_USE_SPI3 TRUE
#define STM32_SPI_SPI1_DMA_PRIORITY 1
#define STM32_SPI_SPI2_DMA_PRIORITY 1
#define STM32_SPI_SPI3_DMA_PRIORITY 1
diff --git a/testhal/STM32F37x/UART/.project b/testhal/STM32F37x/UART/.project
index dfdbbc5df..b1fb421f4 100644
--- a/testhal/STM32F37x/UART/.project
+++ b/testhal/STM32F37x/UART/.project
@@ -27,7 +27,7 @@
<link>
<name>board</name>
<type>2</type>
- <locationURI>CHIBIOS/boards/ST_STM32373C_EVAL</locationURI>
+ <locationURI>CHIBIOS/os/hal/boards/ST_STM32373C_EVAL</locationURI>
</link>
<link>
<name>os</name>
diff --git a/testhal/STM32F37x/UART/halconf.h b/testhal/STM32F37x/UART/halconf.h
index d60800288..dd527aeda 100644
--- a/testhal/STM32F37x/UART/halconf.h
+++ b/testhal/STM32F37x/UART/halconf.h
@@ -41,7 +41,7 @@
* @brief Enables the ADC subsystem.
*/
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
-#define HAL_USE_ADC TRUE
+#define HAL_USE_ADC FALSE
#endif
/**
@@ -139,7 +139,7 @@
* @brief Enables the UART subsystem.
*/
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
-#define HAL_USE_UART FALSE
+#define HAL_USE_UART TRUE
#endif
/**
diff --git a/testhal/STM32F37x/UART/main.c b/testhal/STM32F37x/UART/main.c
index 7b9577f8a..ddba3eed7 100644
--- a/testhal/STM32F37x/UART/main.c
+++ b/testhal/STM32F37x/UART/main.c
@@ -17,15 +17,15 @@
#include "ch.h"
#include "hal.h"
-static VirtualTimer vt1, vt2;
+static virtual_timer_t vt1, vt2;
static void restart(void *p) {
(void)p;
- chSysLockFromIsr();
+ chSysLockFromISR();
uartStartSendI(&UARTD2, 14, "Hello World!\r\n");
- chSysUnlockFromIsr();
+ chSysUnlockFromISR();
}
static void ledoff(void *p) {
@@ -51,11 +51,10 @@ static void txend2(UARTDriver *uartp) {
(void)uartp;
palSetPad(GPIOC, GPIOC_LED1);
- chSysLockFromIsr();
- if (chVTIsArmedI(&vt1))
- chVTResetI(&vt1);
- chVTSetI(&vt1, MS2ST(5000), restart, NULL);
- chSysUnlockFromIsr();
+ chSysLockFromISR();
+ chVTResetI(&vt1);
+ chVTDoSetI(&vt1, MS2ST(5000), restart, NULL);
+ chSysUnlockFromISR();
}
/*
@@ -78,11 +77,10 @@ static void rxchar(UARTDriver *uartp, uint16_t c) {
(void)c;
/* Flashing the LED each time a character is received.*/
palClearPad(GPIOC, GPIOC_LED1);
- chSysLockFromIsr();
- if (chVTIsArmedI(&vt2))
- chVTResetI(&vt2);
- chVTSetI(&vt2, MS2ST(200), ledoff, NULL);
- chSysUnlockFromIsr();
+ chSysLockFromISR();
+ chVTResetI(&vt2);
+ chVTDoSetI(&vt2, MS2ST(200), ledoff, NULL);
+ chSysUnlockFromISR();
}
/*
diff --git a/testhal/STM32F37x/UART/mcuconf.h b/testhal/STM32F37x/UART/mcuconf.h
index f2e3e3def..1ce2fb303 100644
--- a/testhal/STM32F37x/UART/mcuconf.h
+++ b/testhal/STM32F37x/UART/mcuconf.h
@@ -62,7 +62,7 @@
/*
* ADC driver system settings.
*/
-#define STM32_ADC_USE_ADC1 TRUE
+#define STM32_ADC_USE_ADC1 FALSE
#define STM32_ADC_USE_SDADC1 FALSE
#define STM32_ADC_USE_SDADC2 FALSE
#define STM32_ADC_USE_SDADC3 FALSE
@@ -81,7 +81,7 @@
/*
* CAN driver system settings.
*/
-#define STM32_CAN_USE_CAN1 TRUE
+#define STM32_CAN_USE_CAN1 FALSE
#define STM32_CAN_CAN1_IRQ_PRIORITY 11
/*
@@ -195,9 +195,9 @@
/*
* UART driver system settings.
*/
-#define STM32_UART_USE_USART1 FALSE
-#define STM32_UART_USE_USART2 FALSE
-#define STM32_UART_USE_USART3 FALSE
+#define STM32_UART_USE_USART1 TRUE
+#define STM32_UART_USE_USART2 TRUE
+#define STM32_UART_USE_USART3 TRUE
#define STM32_UART_USART1_IRQ_PRIORITY 12
#define STM32_UART_USART2_IRQ_PRIORITY 12
#define STM32_UART_USART3_IRQ_PRIORITY 12
diff --git a/testhal/STM32F37x/USB_CDC/.project b/testhal/STM32F37x/USB_CDC/.project
index 4e173140c..fb16abfeb 100644
--- a/testhal/STM32F37x/USB_CDC/.project
+++ b/testhal/STM32F37x/USB_CDC/.project
@@ -27,7 +27,7 @@
<link>
<name>board</name>
<type>2</type>
- <locationURI>CHIBIOS/boards/ST_STM32373C_EVAL</locationURI>
+ <locationURI>CHIBIOS/os/hal/boards/ST_STM32373C_EVAL</locationURI>
</link>
<link>
<name>os</name>
diff --git a/testhal/STM32F37x/USB_CDC/Makefile b/testhal/STM32F37x/USB_CDC/Makefile
index 7fa47c79c..d9be7f5fc 100644
--- a/testhal/STM32F37x/USB_CDC/Makefile
+++ b/testhal/STM32F37x/USB_CDC/Makefile
@@ -96,6 +96,8 @@ CSRC = $(PORTSRC) \
$(OSALSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
+ $(CHIBIOS)/os/various/chprintf.c \
+ $(CHIBIOS)/os/various/shell.c \
main.c
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
diff --git a/testhal/STM32F37x/USB_CDC/halconf.h b/testhal/STM32F37x/USB_CDC/halconf.h
index d60800288..bd5a46fba 100644
--- a/testhal/STM32F37x/USB_CDC/halconf.h
+++ b/testhal/STM32F37x/USB_CDC/halconf.h
@@ -41,7 +41,7 @@
* @brief Enables the ADC subsystem.
*/
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
-#define HAL_USE_ADC TRUE
+#define HAL_USE_ADC FALSE
#endif
/**
@@ -125,7 +125,7 @@
* @brief Enables the SERIAL over USB subsystem.
*/
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
-#define HAL_USE_SERIAL_USB FALSE
+#define HAL_USE_SERIAL_USB TRUE
#endif
/**
@@ -146,7 +146,7 @@
* @brief Enables the USB subsystem.
*/
#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
-#define HAL_USE_USB FALSE
+#define HAL_USE_USB TRUE
#endif
/*===========================================================================*/
diff --git a/testhal/STM32F37x/USB_CDC/main.c b/testhal/STM32F37x/USB_CDC/main.c
index 200a0f3d5..8730cabe6 100644
--- a/testhal/STM32F37x/USB_CDC/main.c
+++ b/testhal/STM32F37x/USB_CDC/main.c
@@ -291,7 +291,7 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
case USB_EVENT_ADDRESS:
return;
case USB_EVENT_CONFIGURED:
- chSysLockFromIsr();
+ chSysLockFromISR();
/* Enables the endpoints specified into the configuration.
Note, this callback is invoked from an ISR so I-Class functions
@@ -302,7 +302,7 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
/* Resetting the state of the CDC subsystem.*/
sduConfigureHookI(&SDU1);
- chSysUnlockFromIsr();
+ chSysUnlockFromISR();
return;
case USB_EVENT_SUSPEND:
return;
@@ -338,8 +338,8 @@ static const SerialUSBConfig serusbcfg = {
/* Command line related. */
/*===========================================================================*/
-#define SHELL_WA_SIZE THD_WA_SIZE(2048)
-#define TEST_WA_SIZE THD_WA_SIZE(256)
+#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(2048)
+#define TEST_WA_SIZE THD_WORKING_AREA_SIZE(256)
static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) {
size_t n, size;
@@ -356,8 +356,8 @@ static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) {
}
static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) {
- static const char *states[] = {THD_STATE_NAMES};
- Thread *tp;
+ static const char *states[] = {CH_STATE_NAMES};
+ thread_t *tp;
(void)argv;
if (argc > 0) {
@@ -367,23 +367,23 @@ static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) {
chprintf(chp, " addr stack prio refs state time\r\n");
tp = chRegFirstThread();
do {
- chprintf(chp, "%.8lx %.8lx %4lu %4lu %9s %lu\r\n",
+ chprintf(chp, "%.8lx %.8lx %4lu %4lu %9s\r\n",
(uint32_t)tp, (uint32_t)tp->p_ctx.r13,
(uint32_t)tp->p_prio, (uint32_t)(tp->p_refs - 1),
- states[tp->p_state], (uint32_t)tp->p_time);
+ states[tp->p_state]);
tp = chRegNextThread(tp);
} while (tp != NULL);
}
static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) {
- Thread *tp;
+ thread_t *tp;
(void)argv;
if (argc > 0) {
chprintf(chp, "Usage: test\r\n");
return;
}
- tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriority(),
+ tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriorityX(),
TestThread, chp);
if (tp == NULL) {
chprintf(chp, "out of memory\r\n");
@@ -443,10 +443,11 @@ static const ShellConfig shell_cfg1 = {
/*
* Red LED blinker thread, times are in milliseconds.
*/
-static WORKING_AREA(waThread1, 128);
-static msg_t Thread1(void *arg) {
+static THD_WORKING_AREA(waThread1, 128);
+static THD_FUNCTION(Thread1, arg) {
(void)arg;
+
chRegSetThreadName("blinker");
while (TRUE) {
systime_t time = serusbcfg.usbp->state == USB_ACTIVE ? 250 : 500;
@@ -461,7 +462,7 @@ static msg_t Thread1(void *arg) {
* Application entry point.
*/
int main(void) {
- Thread *shelltp = NULL;
+ thread_t *shelltp = NULL;
/*
* System initializations.
@@ -506,7 +507,7 @@ int main(void) {
while (TRUE) {
if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE))
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
- else if (chThdTerminated(shelltp)) {
+ else if (chThdTerminatedX(shelltp)) {
chThdRelease(shelltp); /* Recovers memory of the previous shell. */
shelltp = NULL; /* Triggers spawning of a new shell. */
}
diff --git a/testhal/STM32F37x/USB_CDC/mcuconf.h b/testhal/STM32F37x/USB_CDC/mcuconf.h
index f2e3e3def..6ae1d389a 100644
--- a/testhal/STM32F37x/USB_CDC/mcuconf.h
+++ b/testhal/STM32F37x/USB_CDC/mcuconf.h
@@ -62,7 +62,7 @@
/*
* ADC driver system settings.
*/
-#define STM32_ADC_USE_ADC1 TRUE
+#define STM32_ADC_USE_ADC1 FALSE
#define STM32_ADC_USE_SDADC1 FALSE
#define STM32_ADC_USE_SDADC2 FALSE
#define STM32_ADC_USE_SDADC3 FALSE
@@ -81,7 +81,7 @@
/*
* CAN driver system settings.
*/
-#define STM32_CAN_USE_CAN1 TRUE
+#define STM32_CAN_USE_CAN1 FALSE
#define STM32_CAN_CAN1_IRQ_PRIORITY 11
/*
@@ -209,7 +209,7 @@
/*
* USB driver system settings.
*/
-#define STM32_USB_USE_USB1 FALSE
+#define STM32_USB_USE_USB1 TRUE
#define STM32_USB_LOW_POWER_ON_SUSPEND FALSE
#define STM32_USB_USB1_HP_IRQ_PRIORITY 13
#define STM32_USB_USB1_LP_IRQ_PRIORITY 14