Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/i386/include/IOKit/ata/ATATimerEventSource.h

1/*
2 * Copyright (c) 2001-2008 Apple Inc. All rights reserved.
3 *
4 *
5 * The contents of this file constitute Original Code as defined in and
6 * are subject to the Apple Public Source License Version 1.1 (the
7 * "License"). You may not use this file except in compliance with the
8 * License. Please obtain a copy of the License at
9 * http://www.apple.com/publicsource and read it before using this file.
10 *
11 * This Original Code and all software distributed under the License are
12 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
13 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
14 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
16 * License for the specific language governing rights and limitations
17 * under the License.
18 *
19 */
20
21#ifndef _ATATIMEREVENTSOURCE_H
22#define _ATATIMEREVENTSOURCE_H
23
24
25#include <IOKit/IOTypes.h>
26#include <IOKit/IOCommandGate.h>
27#include <IOKit/IOService.h>
28#include <IOKit/IOWorkLoop.h>
29#include <IOKit/IOTimerEventSource.h>
30
31
32/*!
33@class ATATimerEventSource
34
35@discussion
36Extend the timer event source to allow checking for timer expiration
37from behind the workloop.
38*/
39
40class ATATimerEventSource : public IOTimerEventSource
41{
42 OSDeclareDefaultStructors(ATATimerEventSource);
43
44public:
45
46/*!@function ataTimerEventSource
47@abstract allocate an instance of this type.
48*/
49 static ATATimerEventSource *
50ataTimerEventSource(OSObject *owner, Action action = 0);
51
52/*!@function hasTimedOut
53@abstract returns true if the timer has expired since the last enable/disable or setTimeout() or wakeAtTime() call.
54*/
55virtual bool hasTimedOut( void );
56
57// override to initialize the time out flag.
58 /*!@function
59@abstract
60*/
61virtual bool init(OSObject *owner, Action action = 0);
62
63/*!@function enable
64@abstract overrides in order to set/clear the timed out flag
65*/
66virtual void enable();
67
68/*!@function disable
69@abstract overrides in order to set/clear the timed out flag
70*/
71virtual void disable();
72
73/*!@function wakeAtTime
74@abstract overrides in order to set/clear the timed out flag
75*/
76virtual IOReturn wakeAtTime(UnsignedWide abstime);
77
78/*!@function cancelTimeout
79@abstract overrides in order to set/clear the timed out flag
80*/
81virtual void cancelTimeout();
82
83protected:
84
85enum{ kTimedOutTrue = 'true',
86kTimedOutFalse = 'fals'
87};
88
89UInt32 hasExpired;
90
91
92/*!@function myTimeout
93@abstract my timeout function which sets the timedOut flag atomically.
94*/
95static void myTimeout(void *self);
96
97/*!@function setTimeoutFunc
98@abstract override to install my timeout function instead of the super's.
99*/
100 virtual void setTimeoutFunc();
101
102/*! @struct ExpansionData
103 @discussion This structure will be used to expand the capablilties of the IOWorkLoop in the future.
104 */
105 struct ExpansionData { };
106
107/*! @var reserved
108 Reserved for future use. (Internal use only) */
109 ExpansionData *reserved;
110
111private:
112 OSMetaClassDeclareReservedUnused(ATATimerEventSource, 0);
113 OSMetaClassDeclareReservedUnused(ATATimerEventSource, 1);
114 OSMetaClassDeclareReservedUnused(ATATimerEventSource, 2);
115 OSMetaClassDeclareReservedUnused(ATATimerEventSource, 3);
116 OSMetaClassDeclareReservedUnused(ATATimerEventSource, 4);
117 OSMetaClassDeclareReservedUnused(ATATimerEventSource, 5);
118 OSMetaClassDeclareReservedUnused(ATATimerEventSource, 6);
119 OSMetaClassDeclareReservedUnused(ATATimerEventSource, 7);
120
121};
122
123
124#endif /*_ATATIMEREVENTSOURCE_H*/
125

Archive Download this file

Revision: 2045