aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boards/OLIMEX_AVR_CAN/board.c44
-rw-r--r--boards/OLIMEX_AVR_CAN/board.h4
-rw-r--r--demos/AVR-AT90CANx-GCC/main.c32
-rw-r--r--demos/AVR-ATmega128-GCC/main.c30
-rw-r--r--docs/reports/ATmega128-16.txt34
-rw-r--r--os/hal/platforms/AVR/pal_lld.c4
-rw-r--r--readme.txt1
7 files changed, 61 insertions, 88 deletions
diff --git a/boards/OLIMEX_AVR_CAN/board.c b/boards/OLIMEX_AVR_CAN/board.c
index de1af241c..cd84a8086 100644
--- a/boards/OLIMEX_AVR_CAN/board.c
+++ b/boards/OLIMEX_AVR_CAN/board.c
@@ -21,6 +21,32 @@
#include "ch.h"
#include "hal.h"
+/**
+ * @brief PAL setup.
+ * @details Digital I/O ports static configuration as defined in @p board.h.
+ * This variable is used by the HAL when initializing the PAL driver.
+ */
+#if HAL_USE_PAL || defined(__DOXYGEN__)
+const PALConfig pal_default_config =
+{
+#if defined(PORTA)
+ {VAL_PORTA, VAL_DDRA},
+#endif
+#if defined(PORTA)
+ {VAL_PORTB, VAL_DDRB},
+#endif
+#if defined(PORTA)
+ {VAL_PORTC, VAL_DDRC},
+#endif
+#if defined(PORTA)
+ {VAL_PORTD, VAL_DDRD},
+#endif
+#if defined(PORTA)
+ {VAL_PORTE, VAL_DDRE},
+#endif
+};
+#endif /* HAL_USE_PAL */
+
CH_IRQ_HANDLER(TIMER0_COMP_vect) {
CH_IRQ_PROLOGUE();
@@ -38,24 +64,6 @@ CH_IRQ_HANDLER(TIMER0_COMP_vect) {
void boardInit(void) {
/*
- * I/O ports setup.
- */
- DDRA = VAL_DDRA;
- PORTA = VAL_PORTA;
- DDRB = VAL_DDRB;
- PORTB = VAL_PORTB;
- DDRC = VAL_DDRC;
- PORTC = VAL_PORTC;
- DDRD = VAL_DDRD;
- PORTD = VAL_PORTD;
- DDRE = VAL_DDRE;
- PORTE = VAL_PORTE;
- DDRF = VAL_DDRF;
- PORTF = VAL_PORTF;
- DDRG = VAL_DDRG;
- PORTG = VAL_PORTG;
-
- /*
* External interrupts setup, all disabled initially.
*/
EICRA = 0x00;
diff --git a/boards/OLIMEX_AVR_CAN/board.h b/boards/OLIMEX_AVR_CAN/board.h
index b1d6038c3..c4db2338a 100644
--- a/boards/OLIMEX_AVR_CAN/board.h
+++ b/boards/OLIMEX_AVR_CAN/board.h
@@ -87,8 +87,8 @@
#define VAL_DDRG 0x00
#define VAL_PORTG 0x07
-#define PORTE_LED (1 << 4)
-#define PORTE_BUTTON (1 << 5)
+#define PORTE_LED 4
+#define PORTE_BUTTON 5
#if !defined(_FROM_ASM_)
#ifdef __cplusplus
diff --git a/demos/AVR-AT90CANx-GCC/main.c b/demos/AVR-AT90CANx-GCC/main.c
index d039c6cf6..50d43a7f9 100644
--- a/demos/AVR-AT90CANx-GCC/main.c
+++ b/demos/AVR-AT90CANx-GCC/main.c
@@ -20,34 +20,22 @@
#include "ch.h"
#include "hal.h"
-#include "evtimer.h"
+#include "test.h"
static WORKING_AREA(waThread1, 32);
static msg_t Thread1(void *arg) {
while (TRUE) {
- PORTE ^= PORTE_LED;
- chThdSleepMilliseconds(500);
+ palTogglePad(IOPORT5, PORTE_LED);
+ chThdSleepMilliseconds(500);
}
return 0;
}
-static void TimerHandler(eventid_t id) {
- msg_t TestThread(void *p);
-
- if (!(PORTE & PORTE_BUTTON))
- TestThread(&SD2);
-}
-
/*
* Application entry point.
*/
int main(void) {
- static EvTimer evt;
- static evhandler_t handlers[1] = {
- TimerHandler
- };
- static EventListener el0;
/*
* System initializations.
@@ -65,19 +53,15 @@ int main(void) {
sdStart(&SD2, NULL);
/*
- * Event Timer initialization.
- */
- evtInit(&evt, MS2ST(500)); /* Initializes an event timer object. */
- evtStart(&evt); /* Starts the event timer. */
- chEvtRegister(&evt.et_es, &el0, 0); /* Registers on the timer event source. */
-
- /*
* Starts the LED blinker thread.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
- while(TRUE)
- chEvtDispatch(handlers, chEvtWaitOne(ALL_EVENTS));
+ while(TRUE) {
+ if (!palReadPad(IOPORT5, PORTE_BUTTON))
+ TestThread(&SD2);
+ chThdSleepMilliseconds(500);
+ }
return 0;
}
diff --git a/demos/AVR-ATmega128-GCC/main.c b/demos/AVR-ATmega128-GCC/main.c
index cd982d1b9..36b482c4b 100644
--- a/demos/AVR-ATmega128-GCC/main.c
+++ b/demos/AVR-ATmega128-GCC/main.c
@@ -20,7 +20,7 @@
#include "ch.h"
#include "hal.h"
-#include "evtimer.h"
+#include "test.h"
#include "lcd.h"
@@ -35,22 +35,10 @@ static msg_t Thread1(void *arg) {
return 0;
}
-static void TimerHandler(eventid_t id) {
- msg_t TestThread(void *p);
-
- if (!palReadPad(IOPORT1, PORTA_BUTTON1))
- TestThread(&SD2);
-}
-
/*
* Application entry point.
*/
int main(void) {
- static EvTimer evt;
- static evhandler_t handlers[1] = {
- TimerHandler
- };
- static EventListener el0;
/*
* System initializations.
@@ -77,19 +65,13 @@ int main(void) {
lcdPuts(LCD_LINE2, " Hello World! ");
/*
- * Event Timer initialization.
- */
- evtInit(&evt, MS2ST(500)); /* Initializes an event timer object. */
- evtStart(&evt); /* Starts the event timer. */
- chEvtRegister(&evt.et_es, &el0, 0); /* Registers on the timer event source. */
-
- /*
* Starts the LED blinker thread.
*/
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
- while(TRUE)
- chEvtDispatch(handlers, chEvtWaitOne(ALL_EVENTS));
-
- return 0;
+ while(TRUE) {
+ if (!palReadPad(IOPORT1, PORTA_BUTTON1))
+ TestThread(&SD2);
+ chThdSleepMilliseconds(500);
+ }
}
diff --git a/docs/reports/ATmega128-16.txt b/docs/reports/ATmega128-16.txt
index 2317da5c7..8b2c21f4a 100644
--- a/docs/reports/ATmega128-16.txt
+++ b/docs/reports/ATmega128-16.txt
@@ -5,10 +5,12 @@ Settings: F_CPU=16000000
*** ChibiOS/RT test suite
***
-*** Kernel: 2.1.6unstable
-*** GCC Version: 4.3.0
+*** Kernel: 2.3.4unstable
+*** Compiled: Oct 9 2011 - 10:47:27
+*** Compiler: GCC 4.3.0
*** Architecture: AVR
*** Core Variant: MegaAVR
+*** Port Info: None
*** Platform: ATmega128
*** Test Board: Olimex AVR-MT-128
@@ -83,31 +85,31 @@ Settings: F_CPU=16000000
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.1 (Benchmark, messages #1)
---- Score : 31125 msgs/S, 62250 ctxswc/S
+--- Score : 31561 msgs/S, 63122 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.2 (Benchmark, messages #2)
---- Score : 24979 msgs/S, 49958 ctxswc/S
+--- Score : 24980 msgs/S, 49960 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.3 (Benchmark, messages #3)
---- Score : 24979 msgs/S, 49958 ctxswc/S
+--- Score : 24980 msgs/S, 49960 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.4 (Benchmark, context switch)
---- Score : 89904 ctxswc/S
+--- Score : 88896 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.5 (Benchmark, threads, full cycle)
---- Score : 21054 threads/S
+--- Score : 19766 threads/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.6 (Benchmark, threads, create only)
---- Score : 27121 threads/S
+--- Score : 25179 threads/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.7 (Benchmark, mass reschedule, 5 threads)
---- Score : 7970 reschedules/S, 47820 ctxswc/S
+--- Score : 7891 reschedules/S, 47346 ctxswc/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.8 (Benchmark, round robin context switching)
@@ -115,31 +117,31 @@ Settings: F_CPU=16000000
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.9 (Benchmark, I/O Queues throughput)
---- Score : 80180 bytes/S
+--- Score : 96364 bytes/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.10 (Benchmark, virtual timers set/reset)
---- Score : 81522 timers/S
+--- Score : 85724 timers/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.11 (Benchmark, semaphores wait/signal)
---- Score : 227560 wait+signal/S
+--- Score : 227568 wait+signal/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.12 (Benchmark, mutexes lock/unlock)
---- Score : 116720 lock+unlock/S
+--- Score : 116724 lock+unlock/S
--- Result: SUCCESS
----------------------------------------------------------------------------
--- Test Case 11.13 (Benchmark, RAM footprint)
---- System: 230 bytes
---- Thread: 29 bytes
+--- System: 234 bytes
+--- Thread: 31 bytes
--- Timer : 10 bytes
--- Semaph: 5 bytes
--- EventS: 2 bytes
--- EventL: 5 bytes
--- Mutex : 8 bytes
--- CondV.: 4 bytes
---- Queue : 15 bytes
+--- Queue : 16 bytes
--- MailB.: 18 bytes
--- Result: SUCCESS
----------------------------------------------------------------------------
diff --git a/os/hal/platforms/AVR/pal_lld.c b/os/hal/platforms/AVR/pal_lld.c
index 4bfd7bd04..2f3174934 100644
--- a/os/hal/platforms/AVR/pal_lld.c
+++ b/os/hal/platforms/AVR/pal_lld.c
@@ -103,8 +103,6 @@ void _pal_lld_init(const PALConfig *config) {
* with pull-up by default.
*
* @notapi
- *
- * TODO: check PAL_MODE_UNCONNECTED mode recommended for AVR
*/
void _pal_lld_setgroupmode(ioportid_t port,
ioportmask_t mask,
@@ -113,8 +111,6 @@ void _pal_lld_setgroupmode(ioportid_t port,
switch (mode) {
case PAL_MODE_RESET:
case PAL_MODE_INPUT:
- port->dir &= ~mask;
- break;
case PAL_MODE_INPUT_ANALOG:
port->dir &= ~mask;
port->out &= ~mask;
diff --git a/readme.txt b/readme.txt
index 58316233c..3b365809d 100644
--- a/readme.txt
+++ b/readme.txt
@@ -82,6 +82,7 @@
together with sources, also implemented a simplified output log mode.
Now makefiles and load script files are requirements and trigger a
rebuild if touched.
+- NEW: Updated AVR demos to use the new PAL driver.
- CHANGE: Moved the STM32 DMA helper drivers files under the sub-family
specific directories because documentation issues.