23 #include <avr/common.h> 25 #include <avr/interrupt.h> 27 #define TCCR1B_INIT ((1 << WGM12) | (1 << CS12)) 28 #define TIMER_IMSK (1 << OCIE1A) 29 #define TIMER_IFR (1 << OCF1A) 33 using namespace Mark3;
48 s_clTimerSemaphore.Pend();
49 #if KERNEL_ROUND_ROBIN 51 #endif // #if KERNEL_ROUND_ROBIN 53 #if KERNEL_ROUND_ROBIN 55 #endif // #if KERNEL_ROUND_ROBIN 63 s_clTimerSemaphore.Init(0, 1);
64 s_clTimerThread.Init(s_clTimerThreadStack,
65 sizeof(s_clTimerThreadStack) /
sizeof(
K_WORD),
69 #if KERNEL_ROUND_ROBIN 71 #endif // #if KERNEL_ROUND_ROBIN 72 s_clTimerThread.Start();
78 TCCR1B = ((1 << WGM12) | (1 << CS11) | (1 << CS10));
90 TCCR1B &= ~(1 << CS12);
102 using namespace Mark3;
106 s_clTimerSemaphore.Post();
#define K_WORD
Size of a data word.
#define PORT_KERNEL_TIMERS_THREAD_STACK
ISR(INT2_vect) __attribute__((signal
ISR(INT2 _vect) SWI using INT2 - used to trigger a context switch.
static void KernelTimer_Task(void *unused)
static void Process()
Process This function must be called on timer expiry (from the timer's ISR context). This will result in all timers being updated based on the epoch that just elapsed. The next timer epoch is set based on the next Timer object to expire.
the Semaphore class provides Binary & Counting semaphore objects, based on BlockingObject base class...
static void SetTimerThread(Thread *pclTimerThread_)
SetTimerThread Pass the timer thread's Thread pointer to the Quantum module to track against requests...
static void Start(void)
Start Starts the kernel time (must be configured first)
static void SetInTimer()
SetInTimer Set a flag to indicate that the CPU is currently running within the timer-callback routine...
Single include file given to users of the Mark3 Kernel API.
The Thread Class. This object providing the fundamental thread control data structures and functions ...
static void ClearInTimer()
ClearInTimer Clear the flag once the timer callback function has been completed.
#define KERNEL_TIMERS_THREAD_PRIORITY
static void Stop(void)
Stop Shut down the kernel timer, used when no timers are scheduled.
#define PORT_SYSTEM_FREQ
CPU Frequency in Hz.
static void Config(void)
Config Initializes the kernel timer before use.