diff options
Diffstat (limited to 'testhal/STM32F30x/IRQ_STORM/main.c')
-rw-r--r-- | testhal/STM32F30x/IRQ_STORM/main.c | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/testhal/STM32F30x/IRQ_STORM/main.c b/testhal/STM32F30x/IRQ_STORM/main.c index 554faa6fb..89d688016 100644 --- a/testhal/STM32F30x/IRQ_STORM/main.c +++ b/testhal/STM32F30x/IRQ_STORM/main.c @@ -46,18 +46,18 @@ #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];
/*
* Test worker threads.
*/
-static WORKING_AREA(waWorkerThread[NUM_THREADS], 128);
+static THD_WORKING_AREA(waWorkerThread[NUM_THREADS], 128);
static msg_t WorkerThread(void *arg) {
static volatile unsigned x = 0;
static unsigned cnt = 0;
@@ -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 {
@@ -117,15 +117,15 @@ static msg_t WorkerThread(void *arg) { /*
* GPT2 callback.
*/
-static void gpt2cb(GPTDriver *gptp) {
+static void gpt4cb(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,19 +135,20 @@ 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();
}
/*
* GPT2 configuration.
*/
-static const GPTConfig gpt2cfg = {
+static const GPTConfig gpt4cfg = {
1000000, /* 1MHz timer clock.*/
- gpt2cb, /* Timer callback.*/
+ gpt4cb, /* Timer callback.*/
+ 0,
0
};
@@ -157,6 +158,7 @@ static const GPTConfig gpt2cfg = { static const GPTConfig gpt3cfg = {
1000000, /* 1MHz timer clock.*/
gpt3cb, /* Timer callback.*/
+ 0,
0
};
@@ -221,14 +223,14 @@ int main(void) { /*
* Activates GPTs.
*/
- gptStart(&GPTD2, &gpt2cfg);
+ gptStart(&GPTD4, &gpt4cfg);
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);
}
@@ -243,19 +245,19 @@ int main(void) { println(CH_KERNEL_VERSION);
print("*** Compiled: ");
println(__DATE__ " - " __TIME__);
-#ifdef CH_COMPILER_NAME
+#ifdef PORT_COMPILER_NAME
print("*** Compiler: ");
- println(CH_COMPILER_NAME);
+ println(PORT_COMPILER_NAME);
#endif
print("*** Architecture: ");
- println(CH_ARCHITECTURE_NAME);
-#ifdef CH_CORE_VARIANT_NAME
+ println(PORT_ARCHITECTURE_NAME);
+#ifdef PORT_CORE_VARIANT_NAME
print("*** Core Variant: ");
- println(CH_CORE_VARIANT_NAME);
+ println(PORT_CORE_VARIANT_NAME);
#endif
-#ifdef CH_PORT_INFO
+#ifdef PORT_INFO
print("*** Port Info: ");
- println(CH_PORT_INFO);
+ println(PORT_INFO);
#endif
#ifdef PLATFORM_NAME
print("*** Platform: ");
@@ -291,10 +293,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 +317,7 @@ int main(void) { if (threshold > worst)
worst = threshold;
}
- gptStopTimer(&GPTD2);
+ gptStopTimer(&GPTD4);
gptStopTimer(&GPTD3);
print("Worst case at ");
|