aboutsummaryrefslogtreecommitdiffstats
path: root/testhal/STM32F30x
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-08-19 15:07:47 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-08-19 15:07:47 +0000
commita042a8234acfdce62f65a5c72112f3256fade060 (patch)
treefab52fdade992466c216926e26f869d4d50f4fe3 /testhal/STM32F30x
parent79ad42bc2b8e9013d0a02a9d758fa8af36322b27 (diff)
downloadChibiOS-a042a8234acfdce62f65a5c72112f3256fade060.tar.gz
ChibiOS-a042a8234acfdce62f65a5c72112f3256fade060.tar.bz2
ChibiOS-a042a8234acfdce62f65a5c72112f3256fade060.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6183 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'testhal/STM32F30x')
-rw-r--r--testhal/STM32F30x/ADC/.project2
-rw-r--r--testhal/STM32F30x/ADC_DUAL/.project2
-rw-r--r--testhal/STM32F30x/CAN/.project2
-rw-r--r--testhal/STM32F30x/CAN/main.c8
-rw-r--r--testhal/STM32F30x/EXT/.project2
-rw-r--r--testhal/STM32F30x/EXT/main.c11
-rw-r--r--testhal/STM32F30x/IRQ_STORM/.project2
-rw-r--r--testhal/STM32F30x/IRQ_STORM/chconf.h14
-rw-r--r--testhal/STM32F30x/IRQ_STORM/main.c28
-rw-r--r--testhal/STM32F30x/IRQ_STORM/mcuconf.h6
-rw-r--r--testhal/STM32F30x/PWM-ICU/.project2
-rw-r--r--testhal/STM32F30x/PWM-ICU/main.c22
-rw-r--r--testhal/STM32F30x/PWM-ICU/mcuconf.h6
-rw-r--r--testhal/STM32F30x/PWM-ICU/readme.txt2
-rw-r--r--testhal/STM32F30x/SPI/.project2
-rw-r--r--testhal/STM32F30x/UART/.project2
-rw-r--r--testhal/STM32F30x/UART/main.c20
17 files changed, 66 insertions, 67 deletions
diff --git a/testhal/STM32F30x/ADC/.project b/testhal/STM32F30x/ADC/.project
index 723f89815..9503708ca 100644
--- a/testhal/STM32F30x/ADC/.project
+++ b/testhal/STM32F30x/ADC/.project
@@ -79,7 +79,7 @@
<link>
<name>board</name>
<type>2</type>
- <locationURI>CHIBIOS/boards/ST_STM32F3_DISCOVERY</locationURI>
+ <locationURI>CHIBIOS/os/hal/boards/ST_STM32F3_DISCOVERY</locationURI>
</link>
<link>
<name>os</name>
diff --git a/testhal/STM32F30x/ADC_DUAL/.project b/testhal/STM32F30x/ADC_DUAL/.project
index 216f76c48..86fadf546 100644
--- a/testhal/STM32F30x/ADC_DUAL/.project
+++ b/testhal/STM32F30x/ADC_DUAL/.project
@@ -79,7 +79,7 @@
<link>
<name>board</name>
<type>2</type>
- <locationURI>CHIBIOS/boards/ST_STM32F3_DISCOVERY</locationURI>
+ <locationURI>CHIBIOS/os/hal/boards/ST_STM32F3_DISCOVERY</locationURI>
</link>
<link>
<name>os</name>
diff --git a/testhal/STM32F30x/CAN/.project b/testhal/STM32F30x/CAN/.project
index a01f8a133..03f4bead6 100644
--- a/testhal/STM32F30x/CAN/.project
+++ b/testhal/STM32F30x/CAN/.project
@@ -79,7 +79,7 @@
<link>
<name>board</name>
<type>2</type>
- <locationURI>CHIBIOS/boards/ST_STM32F3_DISCOVERY</locationURI>
+ <locationURI>CHIBIOS/os/hal/boards/ST_STM32F3_DISCOVERY</locationURI>
</link>
<link>
<name>os</name>
diff --git a/testhal/STM32F30x/CAN/main.c b/testhal/STM32F30x/CAN/main.c
index c44acf566..52e3ad1b6 100644
--- a/testhal/STM32F30x/CAN/main.c
+++ b/testhal/STM32F30x/CAN/main.c
@@ -32,16 +32,16 @@ static const CANConfig cancfg = {
*/
static WORKING_AREA(can_rx_wa, 256);
static msg_t can_rx(void *p) {
- EventListener el;
+ event_listener_t el;
CANRxFrame rxmsg;
(void)p;
chRegSetThreadName("receiver");
chEvtRegister(&CAND1.rxfull_event, &el, 0);
- while(!chThdShouldTerminate()) {
+ while(!chThdShouldTerminateX()) {
if (chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(100)) == 0)
continue;
- while (canReceive(&CAND1, CAN_ANY_MAILBOX, &rxmsg, TIME_IMMEDIATE) == RDY_OK) {
+ while (canReceive(&CAND1, CAN_ANY_MAILBOX, &rxmsg, TIME_IMMEDIATE) == MSG_OK) {
/* Process message.*/
palTogglePad(GPIOE, GPIOE_LED3_RED);
}
@@ -66,7 +66,7 @@ static msg_t can_tx(void * p) {
txmsg.data32[0] = 0x55AA55AA;
txmsg.data32[1] = 0x00FF00FF;
- while (!chThdShouldTerminate()) {
+ while (!chThdShouldTerminateX()) {
canTransmit(&CAND1, CAN_ANY_MAILBOX, &txmsg, MS2ST(100));
chThdSleepMilliseconds(500);
}
diff --git a/testhal/STM32F30x/EXT/.project b/testhal/STM32F30x/EXT/.project
index 7c6f467a6..1504226d3 100644
--- a/testhal/STM32F30x/EXT/.project
+++ b/testhal/STM32F30x/EXT/.project
@@ -79,7 +79,7 @@
<link>
<name>board</name>
<type>2</type>
- <locationURI>CHIBIOS/boards/ST_STM32F3_DISCOVERY</locationURI>
+ <locationURI>CHIBIOS/os/hal/boards/ST_STM32F3_DISCOVERY</locationURI>
</link>
<link>
<name>os</name>
diff --git a/testhal/STM32F30x/EXT/main.c b/testhal/STM32F30x/EXT/main.c
index 9ef548d87..bd8b4359c 100644
--- a/testhal/STM32F30x/EXT/main.c
+++ b/testhal/STM32F30x/EXT/main.c
@@ -25,19 +25,20 @@ static void led5off(void *arg) {
/* Triggered when the button is pressed or released. The LED5 is set to ON.*/
static void extcb1(EXTDriver *extp, expchannel_t channel) {
- static VirtualTimer vt4;
+ static virtual_timer_t vt4;
(void)extp;
(void)channel;
palSetPad(GPIOE, GPIOE_LED10_RED);
- chSysLockFromIsr();
- if (chVTIsArmedI(&vt4))
- chVTResetI(&vt4);
+ chSysLockFromISR();
+
+ /* Timer reset, if still active.*/
+ chVTResetI(&vt4);
/* LED4 set to OFF after 200mS.*/
chVTSetI(&vt4, MS2ST(200), led5off, NULL);
- chSysUnlockFromIsr();
+ chSysUnlockFromISR();
}
static const EXTConfig extcfg = {
diff --git a/testhal/STM32F30x/IRQ_STORM/.project b/testhal/STM32F30x/IRQ_STORM/.project
index a7a6d0b2e..c3e2f6a31 100644
--- a/testhal/STM32F30x/IRQ_STORM/.project
+++ b/testhal/STM32F30x/IRQ_STORM/.project
@@ -27,7 +27,7 @@
<link>
<name>board</name>
<type>2</type>
- <locationURI>CHIBIOS/boards/ST_STM32F3_DISCOVERY</locationURI>
+ <locationURI>CHIBIOS/os/hal/boards/ST_STM32F3_DISCOVERY</locationURI>
</link>
<link>
<name>os</name>
diff --git a/testhal/STM32F30x/IRQ_STORM/chconf.h b/testhal/STM32F30x/IRQ_STORM/chconf.h
index dea615e32..2efd81b54 100644
--- a/testhal/STM32F30x/IRQ_STORM/chconf.h
+++ b/testhal/STM32F30x/IRQ_STORM/chconf.h
@@ -357,7 +357,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_STATISTICS) || defined(__DOXYGEN__)
-#define CH_DBG_STATISTICS TRUE
+#define CH_DBG_STATISTICS FALSE
#endif
/**
@@ -368,7 +368,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_SYSTEM_STATE_CHECK) || defined(__DOXYGEN__)
-#define CH_DBG_SYSTEM_STATE_CHECK TRUE
+#define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/**
@@ -379,7 +379,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_ENABLE_CHECKS) || defined(__DOXYGEN__)
-#define CH_DBG_ENABLE_CHECKS TRUE
+#define CH_DBG_ENABLE_CHECKS FALSE
#endif
/**
@@ -391,7 +391,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_ENABLE_ASSERTS) || defined(__DOXYGEN__)
-#define CH_DBG_ENABLE_ASSERTS TRUE
+#define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/**
@@ -402,7 +402,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_ENABLE_TRACE) || defined(__DOXYGEN__)
-#define CH_DBG_ENABLE_TRACE TRUE
+#define CH_DBG_ENABLE_TRACE FALSE
#endif
/**
@@ -416,7 +416,7 @@
* @p panic_msg variable set to @p NULL.
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__)
-#define CH_DBG_ENABLE_STACK_CHECK TRUE
+#define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/**
@@ -428,7 +428,7 @@
* @note The default is @p FALSE.
*/
#if !defined(CH_DBG_FILL_THREADS) || defined(__DOXYGEN__)
-#define CH_DBG_FILL_THREADS TRUE
+#define CH_DBG_FILL_THREADS FALSE
#endif
/**
diff --git a/testhal/STM32F30x/IRQ_STORM/main.c b/testhal/STM32F30x/IRQ_STORM/main.c
index 554faa6fb..21684a868 100644
--- a/testhal/STM32F30x/IRQ_STORM/main.c
+++ b/testhal/STM32F30x/IRQ_STORM/main.c
@@ -46,12 +46,12 @@
#define MSG_SEND_LEFT 0
#define MSG_SEND_RIGHT 1
-static bool_t saturated;
+static bool saturated;
/*
* Mailboxes and buffers.
*/
-static Mailbox mb[NUM_THREADS];
+static mailbox_t mb[NUM_THREADS];
static msg_t b[NUM_THREADS][MAILBOX_SIZE];
/*
@@ -101,7 +101,7 @@ static msg_t WorkerThread(void *arg) {
/* If this thread is not at the end of a chain re-sending the message,
note this check works because the variable target is unsigned.*/
msg = chMBPost(&mb[target], msg, TIME_IMMEDIATE);
- if (msg != RDY_OK)
+ if (msg != MSG_OK)
saturated = TRUE;
}
else {
@@ -121,11 +121,11 @@ static void gpt2cb(GPTDriver *gptp) {
msg_t msg;
(void)gptp;
- chSysLockFromIsr();
+ chSysLockFromISR();
msg = chMBPostI(&mb[0], MSG_SEND_RIGHT);
- if (msg != RDY_OK)
+ if (msg != MSG_OK)
saturated = TRUE;
- chSysUnlockFromIsr();
+ chSysUnlockFromISR();
}
/*
@@ -135,11 +135,11 @@ static void gpt3cb(GPTDriver *gptp) {
msg_t msg;
(void)gptp;
- chSysLockFromIsr();
+ chSysLockFromISR();
msg = chMBPostI(&mb[NUM_THREADS - 1], MSG_SEND_LEFT);
- if (msg != RDY_OK)
+ if (msg != MSG_OK)
saturated = TRUE;
- chSysUnlockFromIsr();
+ chSysUnlockFromISR();
}
/*
@@ -221,14 +221,14 @@ int main(void) {
/*
* Activates GPTs.
*/
- gptStart(&GPTD2, &gpt2cfg);
+ gptStart(&GPTD4, &gpt2cfg);
gptStart(&GPTD3, &gpt3cfg);
/*
* Initializes the mailboxes and creates the worker threads.
*/
for (i = 0; i < NUM_THREADS; i++) {
- chMBInit(&mb[i], b[i], MAILBOX_SIZE);
+ chMBObjectInit(&mb[i], b[i], MAILBOX_SIZE);
chThdCreateStatic(waWorkerThread[i], sizeof waWorkerThread[i],
NORMALPRIO - 20, WorkerThread, (void *)i);
}
@@ -291,10 +291,10 @@ int main(void) {
saturated = FALSE;
threshold = 0;
for (interval = 2000; interval >= 10; interval -= interval / 10) {
- gptStartContinuous(&GPTD2, interval - 1); /* Slightly out of phase.*/
+ gptStartContinuous(&GPTD4, interval - 1); /* Slightly out of phase.*/
gptStartContinuous(&GPTD3, interval + 1); /* Slightly out of phase.*/
chThdSleepMilliseconds(1000);
- gptStopTimer(&GPTD2);
+ gptStopTimer(&GPTD4);
gptStopTimer(&GPTD3);
if (!saturated)
print(".");
@@ -315,7 +315,7 @@ int main(void) {
if (threshold > worst)
worst = threshold;
}
- gptStopTimer(&GPTD2);
+ gptStopTimer(&GPTD4);
gptStopTimer(&GPTD3);
print("Worst case at ");
diff --git a/testhal/STM32F30x/IRQ_STORM/mcuconf.h b/testhal/STM32F30x/IRQ_STORM/mcuconf.h
index 0d8c991d3..9b902182f 100644
--- a/testhal/STM32F30x/IRQ_STORM/mcuconf.h
+++ b/testhal/STM32F30x/IRQ_STORM/mcuconf.h
@@ -107,16 +107,16 @@
* GPT driver system settings.
*/
#define STM32_GPT_USE_TIM1 TRUE
-#define STM32_GPT_USE_TIM2 TRUE
+#define STM32_GPT_USE_TIM2 FALSE
#define STM32_GPT_USE_TIM3 TRUE
#define STM32_GPT_USE_TIM4 TRUE
#define STM32_GPT_USE_TIM6 TRUE
#define STM32_GPT_USE_TIM7 TRUE
#define STM32_GPT_USE_TIM8 TRUE
#define STM32_GPT_TIM1_IRQ_PRIORITY 7
-#define STM32_GPT_TIM2_IRQ_PRIORITY 6
+#define STM32_GPT_TIM2_IRQ_PRIORITY 7
#define STM32_GPT_TIM3_IRQ_PRIORITY 10
-#define STM32_GPT_TIM4_IRQ_PRIORITY 7
+#define STM32_GPT_TIM4_IRQ_PRIORITY 6
#define STM32_GPT_TIM6_IRQ_PRIORITY 7
#define STM32_GPT_TIM7_IRQ_PRIORITY 7
#define STM32_GPT_TIM8_IRQ_PRIORITY 7
diff --git a/testhal/STM32F30x/PWM-ICU/.project b/testhal/STM32F30x/PWM-ICU/.project
index 6d36832e8..d8190d4c4 100644
--- a/testhal/STM32F30x/PWM-ICU/.project
+++ b/testhal/STM32F30x/PWM-ICU/.project
@@ -27,7 +27,7 @@
<link>
<name>board</name>
<type>2</type>
- <locationURI>CHIBIOS/boards/ST_STM32F3_DISCOVERY</locationURI>
+ <locationURI>CHIBIOS/os/hal/boards/ST_STM32F3_DISCOVERY</locationURI>
</link>
<link>
<name>os</name>
diff --git a/testhal/STM32F30x/PWM-ICU/main.c b/testhal/STM32F30x/PWM-ICU/main.c
index 4d7c3afd0..96444baef 100644
--- a/testhal/STM32F30x/PWM-ICU/main.c
+++ b/testhal/STM32F30x/PWM-ICU/main.c
@@ -83,13 +83,13 @@ int main(void) {
chSysInit();
/*
- * Initializes the PWM driver 2 and ICU driver 3.
- * GPIOA15 is the PWM output.
- * GPIOC6 is the ICU input.
+ * Initializes the PWM driver 4 and ICU driver 3.
+ * GPIOD12 is the PWM output channel 0.
+ * GPIOC6 is the ICU input ICU_CHANNEL_1.
* The two pins have to be externally connected together.
*/
- pwmStart(&PWMD2, &pwmcfg);
- palSetPadMode(GPIOA, 15, PAL_MODE_ALTERNATE(1));
+ pwmStart(&PWMD4, &pwmcfg);
+ palSetPadMode(GPIOD, 12, PAL_MODE_ALTERNATE(2));
icuStart(&ICUD3, &icucfg);
palSetPadMode(GPIOC, 6, PAL_MODE_ALTERNATE(2));
icuEnable(&ICUD3);
@@ -98,33 +98,33 @@ int main(void) {
/*
* Starts the PWM channel 0 using 75% duty cycle.
*/
- pwmEnableChannel(&PWMD2, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD2, 7500));
+ pwmEnableChannel(&PWMD4, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD4, 7500));
chThdSleepMilliseconds(5000);
/*
* Changes the PWM channel 0 to 50% duty cycle.
*/
- pwmEnableChannel(&PWMD2, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD2, 5000));
+ pwmEnableChannel(&PWMD4, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD4, 5000));
chThdSleepMilliseconds(5000);
/*
* Changes the PWM channel 0 to 25% duty cycle.
*/
- pwmEnableChannel(&PWMD2, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD2, 2500));
+ pwmEnableChannel(&PWMD4, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD4, 2500));
chThdSleepMilliseconds(5000);
/*
* Changes PWM period to half second the duty cycle becomes 50%
* implicitly.
*/
- pwmChangePeriod(&PWMD2, 5000);
+ pwmChangePeriod(&PWMD4, 5000);
chThdSleepMilliseconds(5000);
/*
* Disables channel 0 and stops the drivers.
*/
- pwmDisableChannel(&PWMD2, 0);
- pwmStop(&PWMD2);
+ pwmDisableChannel(&PWMD4, 0);
+ pwmStop(&PWMD4);
icuDisable(&ICUD3);
icuStop(&ICUD3);
palClearPad(GPIOE, GPIOE_LED4_BLUE);
diff --git a/testhal/STM32F30x/PWM-ICU/mcuconf.h b/testhal/STM32F30x/PWM-ICU/mcuconf.h
index bff25a4c6..a5dca256c 100644
--- a/testhal/STM32F30x/PWM-ICU/mcuconf.h
+++ b/testhal/STM32F30x/PWM-ICU/mcuconf.h
@@ -139,7 +139,7 @@
#define STM32_ICU_USE_TIM1 TRUE
#define STM32_ICU_USE_TIM2 FALSE
#define STM32_ICU_USE_TIM3 TRUE
-#define STM32_ICU_USE_TIM4 TRUE
+#define STM32_ICU_USE_TIM4 FALSE
#define STM32_ICU_USE_TIM8 TRUE
#define STM32_ICU_TIM1_IRQ_PRIORITY 7
#define STM32_ICU_TIM2_IRQ_PRIORITY 7
@@ -152,9 +152,9 @@
*/
#define STM32_PWM_USE_ADVANCED FALSE
#define STM32_PWM_USE_TIM1 FALSE
-#define STM32_PWM_USE_TIM2 TRUE
+#define STM32_PWM_USE_TIM2 FALSE
#define STM32_PWM_USE_TIM3 FALSE
-#define STM32_PWM_USE_TIM4 FALSE
+#define STM32_PWM_USE_TIM4 TRUE
#define STM32_PWM_USE_TIM8 FALSE
#define STM32_PWM_TIM1_IRQ_PRIORITY 7
#define STM32_PWM_TIM2_IRQ_PRIORITY 7
diff --git a/testhal/STM32F30x/PWM-ICU/readme.txt b/testhal/STM32F30x/PWM-ICU/readme.txt
index cfb53f76a..bf4069267 100644
--- a/testhal/STM32F30x/PWM-ICU/readme.txt
+++ b/testhal/STM32F30x/PWM-ICU/readme.txt
@@ -12,7 +12,7 @@ The application demonstrates the use of the STM32F30x PWM-ICU drivers.
** Board Setup **
-- Connect PA15 and PC6 together.
+- Connect PD12 (PWM output) and PC6 (ICU input) together.
** Build Procedure **
diff --git a/testhal/STM32F30x/SPI/.project b/testhal/STM32F30x/SPI/.project
index 61b728dcf..5c0b3a88c 100644
--- a/testhal/STM32F30x/SPI/.project
+++ b/testhal/STM32F30x/SPI/.project
@@ -79,7 +79,7 @@
<link>
<name>board</name>
<type>2</type>
- <locationURI>CHIBIOS/boards/ST_STM32F3_DISCOVERY</locationURI>
+ <locationURI>CHIBIOS/os/hal/boards/ST_STM32F3_DISCOVERY</locationURI>
</link>
<link>
<name>os</name>
diff --git a/testhal/STM32F30x/UART/.project b/testhal/STM32F30x/UART/.project
index 24b9d53ce..15900d6dc 100644
--- a/testhal/STM32F30x/UART/.project
+++ b/testhal/STM32F30x/UART/.project
@@ -79,7 +79,7 @@
<link>
<name>board</name>
<type>2</type>
- <locationURI>CHIBIOS/boards/ST_STM32F3_DISCOVERY</locationURI>
+ <locationURI>CHIBIOS/os/hal/boards/ST_STM32F3_DISCOVERY</locationURI>
</link>
<link>
<name>os</name>
diff --git a/testhal/STM32F30x/UART/main.c b/testhal/STM32F30x/UART/main.c
index 9d0bea53c..170f14f20 100644
--- a/testhal/STM32F30x/UART/main.c
+++ b/testhal/STM32F30x/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(&UARTD1, 14, "Hello World!\r\n");
- chSysUnlockFromIsr();
+ chSysUnlockFromISR();
}
static void ledoff(void *p) {
@@ -51,11 +51,10 @@ static void txend2(UARTDriver *uartp) {
(void)uartp;
palClearPad(GPIOE, GPIOE_LED3_RED);
- chSysLockFromIsr();
- if (chVTIsArmedI(&vt1))
- chVTResetI(&vt1);
+ chSysLockFromISR();
+ chVTResetI(&vt1);
chVTSetI(&vt1, MS2ST(5000), restart, NULL);
- chSysUnlockFromIsr();
+ chSysUnlockFromISR();
}
/*
@@ -78,11 +77,10 @@ static void rxchar(UARTDriver *uartp, uint16_t c) {
(void)c;
/* Flashing the LED each time a character is received.*/
palSetPad(GPIOE, GPIOE_LED3_RED);
- chSysLockFromIsr();
- if (chVTIsArmedI(&vt2))
- chVTResetI(&vt2);
+ chSysLockFromISR();
+ chVTResetI(&vt2);
chVTSetI(&vt2, MS2ST(200), ledoff, NULL);
- chSysUnlockFromIsr();
+ chSysUnlockFromISR();
}
/*