Fix #define to somethin which works :)

This commit is contained in:
Stefan `Sec` Zehl 2011-07-27 00:11:30 +02:00
parent 0477dc01e2
commit 0a268ebfc3
1 changed files with 11 additions and 4 deletions

View File

@ -4,9 +4,10 @@
#include "lcd/print.h" #include "lcd/print.h"
QUEUE the_queue; QUEUE the_queue;
#ifdef ARM #ifdef __arm__
volatile uint32_t _timectr=0; volatile uint32_t _timectr=0;
#else #else
#error "foo"
extern uint32_t simTimeCounter(); extern uint32_t simTimeCounter();
#define _timectr (simTimeCounter()) #define _timectr (simTimeCounter())
#endif #endif
@ -18,8 +19,10 @@ void work_queue(void){
int start; int start;
if (the_queue.qstart == the_queue.qend){ if (the_queue.qstart == the_queue.qend){
#ifdef ARM #ifdef __arm__
__asm volatile ("WFI"); __asm volatile ("WFI");
#else
delayms(10);
#endif #endif
return; return;
}; };
@ -36,8 +39,10 @@ void delayms_queue(uint32_t ms){
int end=_timectr+ms/10; int end=_timectr+ms/10;
do { do {
if (the_queue.qstart == the_queue.qend){ if (the_queue.qstart == the_queue.qend){
#ifdef ARM #ifdef __arm__
__asm volatile ("WFI"); __asm volatile ("WFI");
#else
delayms(10);
#endif #endif
}else{ }else{
work_queue(); work_queue();
@ -48,8 +53,10 @@ void delayms_queue(uint32_t ms){
void delayms_power(uint32_t ms){ void delayms_power(uint32_t ms){
ms+=_timectr; ms+=_timectr;
do { do {
#ifdef ARM #ifdef __arm__
__asm volatile ("WFI"); __asm volatile ("WFI");
#else
delayms(10);
#endif #endif
} while (ms >_timectr); } while (ms >_timectr);
}; };