diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2007-11-19 11:09:33 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2007-11-19 11:09:33 +0000 |
commit | b3361bd0e8ca074dbf7f312a87bbcdbf0019ebc7 (patch) | |
tree | 6cb55aa7bf6630b87d07b851ab40b44b662033c6 /demos/AVR-AT90CANx-GCC | |
parent | e3617bedb28afefa2993c7e2a8a696d5af16a733 (diff) | |
download | ChibiOS-b3361bd0e8ca074dbf7f312a87bbcdbf0019ebc7.tar.gz ChibiOS-b3361bd0e8ca074dbf7f312a87bbcdbf0019ebc7.tar.bz2 ChibiOS-b3361bd0e8ca074dbf7f312a87bbcdbf0019ebc7.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@97 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'demos/AVR-AT90CANx-GCC')
-rw-r--r-- | demos/AVR-AT90CANx-GCC/chcore.c | 4 | ||||
-rw-r--r-- | demos/AVR-AT90CANx-GCC/chcore.h | 18 | ||||
-rw-r--r-- | demos/AVR-AT90CANx-GCC/main.c | 14 |
3 files changed, 25 insertions, 11 deletions
diff --git a/demos/AVR-AT90CANx-GCC/chcore.c b/demos/AVR-AT90CANx-GCC/chcore.c index 262732676..3bc5b027e 100644 --- a/demos/AVR-AT90CANx-GCC/chcore.c +++ b/demos/AVR-AT90CANx-GCC/chcore.c @@ -121,9 +121,7 @@ void hwinit(void) { TIMSK0 = (1 << OCIE0A); // Interrupt on compare.
}
-void chSysPause(void) {
-
- chThdSetPriority(IDLEPRIO);
+void _IdleThread(void *p) {
while (TRUE) {
// asm volatile ("sleep");
diff --git a/demos/AVR-AT90CANx-GCC/chcore.h b/demos/AVR-AT90CANx-GCC/chcore.h index 935c37488..32c939d32 100644 --- a/demos/AVR-AT90CANx-GCC/chcore.h +++ b/demos/AVR-AT90CANx-GCC/chcore.h @@ -48,7 +48,7 @@ struct extctx { };
/*
- * Stack saved context.
+ * System saved context.
*/
struct intctx {
BYTE8 r29;
@@ -72,6 +72,10 @@ struct intctx { UWORD16 pc;
};
+/*
+ * Port dependent part of the Thread structure, you may add fields in
+ * this structure.
+ */
typedef struct {
struct intctx *sp;
} Context;
@@ -93,18 +97,20 @@ typedef struct { */
#define EXTRA_INT_STACK 0x10
-#define UserStackSize(n) (sizeof(Thread) + \
- sizeof(struct intctx) + \
- sizeof(struct extctx) + \
- EXTRA_INT_STACK + \
+#define UserStackSize(n) (sizeof(Thread) + \
+ sizeof(struct intctx) + \
+ sizeof(struct extctx) + \
+ EXTRA_INT_STACK + \
(n))
#define chSysLock() asm("cli")
#define chSysUnlock() asm("sei")
#define chSysPuts(msg) {}
+#define IDLE_THREAD_STACK_SIZE 8
+void _IdleThread(void *p) __attribute__((noreturn));
+
void chSysHalt(void) __attribute__((noreturn)) ;
-void chSysPause(void) __attribute__((noreturn)) ;
void chSysSwitchI(Context *oldp, Context *newp);
void threadstart(void);
diff --git a/demos/AVR-AT90CANx-GCC/main.c b/demos/AVR-AT90CANx-GCC/main.c index 48f58d080..61156b040 100644 --- a/demos/AVR-AT90CANx-GCC/main.c +++ b/demos/AVR-AT90CANx-GCC/main.c @@ -24,7 +24,6 @@ void hwinit(void);
static BYTE8 waThread1[UserStackSize(32)];
-
static t_msg Thread1(void *arg) {
while (TRUE) {
@@ -37,8 +36,19 @@ int main(int argc, char **argv) { hwinit();
+ /*
+ * The main() function becomes a thread here then the interrupts are
+ * enabled and ChibiOS/RT goes live.
+ */
chSysInit();
+
+ /*
+ * Starts the LED blinker thread.
+ */
chThdCreate(NORMALPRIO, 0, waThread1, sizeof(waThread1), Thread1, NULL);
- chSysPause();
+
+ while(TRUE)
+ /* Do stuff*/ ;
+
return 0;
}
|