Soundharrajan

Fork of mbed by mbed official

Committer:
mrsoundhar
Date:
Sun Jun 12 16:45:04 2016 +0000
Revision:
92:f7fcbaa5f1b5
Parent:
27:7110ebee3484
Child:
43:e2ed12d17f06
Soundharrajan

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rolf.meyer@arm.com 11:1c1ebd0324fa 1 /* mbed Microcontroller Library - TimerEvent
rolf.meyer@arm.com 11:1c1ebd0324fa 2 * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
rolf.meyer@arm.com 11:1c1ebd0324fa 3 */
rolf.meyer@arm.com 11:1c1ebd0324fa 4
rolf.meyer@arm.com 11:1c1ebd0324fa 5 #ifndef MBED_TIMEREVENT_H
rolf.meyer@arm.com 11:1c1ebd0324fa 6 #define MBED_TIMEREVENT_H
rolf.meyer@arm.com 11:1c1ebd0324fa 7
rolf.meyer@arm.com 11:1c1ebd0324fa 8 namespace mbed {
rolf.meyer@arm.com 11:1c1ebd0324fa 9
rolf.meyer@arm.com 11:1c1ebd0324fa 10 // Base abstraction for timer interrupts
rolf.meyer@arm.com 11:1c1ebd0324fa 11 class TimerEvent {
rolf.meyer@arm.com 11:1c1ebd0324fa 12
rolf.meyer@arm.com 11:1c1ebd0324fa 13 public:
rolf.meyer@arm.com 11:1c1ebd0324fa 14
rolf.meyer@arm.com 11:1c1ebd0324fa 15 TimerEvent();
rolf.meyer@arm.com 11:1c1ebd0324fa 16
rolf.meyer@arm.com 11:1c1ebd0324fa 17 // The handler registered with the underlying timer interrupt
rolf.meyer@arm.com 11:1c1ebd0324fa 18 static void irq();
rolf.meyer@arm.com 11:1c1ebd0324fa 19
rolf.meyer@arm.com 11:1c1ebd0324fa 20 // Destruction removes it...
rolf.meyer@arm.com 11:1c1ebd0324fa 21 virtual ~TimerEvent();
rolf.meyer@arm.com 11:1c1ebd0324fa 22
rolf.meyer@arm.com 11:1c1ebd0324fa 23 protected:
rolf.meyer@arm.com 11:1c1ebd0324fa 24
rolf.meyer@arm.com 11:1c1ebd0324fa 25 // The handler called to service the timer event of the derived class
rolf.meyer@arm.com 11:1c1ebd0324fa 26 virtual void handler() = 0;
rolf.meyer@arm.com 11:1c1ebd0324fa 27
rolf.meyer@arm.com 11:1c1ebd0324fa 28 // insert in to linked list
rolf.meyer@arm.com 11:1c1ebd0324fa 29 void insert(unsigned int timestamp);
rolf.meyer@arm.com 11:1c1ebd0324fa 30
rolf.meyer@arm.com 11:1c1ebd0324fa 31 // remove from linked list, if in it
rolf.meyer@arm.com 11:1c1ebd0324fa 32 void remove();
rolf.meyer@arm.com 11:1c1ebd0324fa 33
rolf.meyer@arm.com 11:1c1ebd0324fa 34 // Get the current usec timestamp
rolf.meyer@arm.com 11:1c1ebd0324fa 35 static unsigned int timestamp();
rolf.meyer@arm.com 11:1c1ebd0324fa 36
rolf.meyer@arm.com 11:1c1ebd0324fa 37 static TimerEvent *_head; // The head of the list of the events, NULL if none
rolf.meyer@arm.com 11:1c1ebd0324fa 38 TimerEvent *_next; // Pointer to the next in the list, NULL if last
rolf.meyer@arm.com 11:1c1ebd0324fa 39 unsigned int _timestamp; // The timestamp at which the even should be triggered
rolf.meyer@arm.com 11:1c1ebd0324fa 40
rolf.meyer@arm.com 11:1c1ebd0324fa 41 };
rolf.meyer@arm.com 11:1c1ebd0324fa 42
rolf.meyer@arm.com 11:1c1ebd0324fa 43 } // namespace mbed
rolf.meyer@arm.com 11:1c1ebd0324fa 44
rolf.meyer@arm.com 11:1c1ebd0324fa 45 #endif