TestIokit.h
#include <IOKit/IOService.h>
class com_MyCompany_driver_MyDriver : public IOService
{
OSDeclareDefaultStructors(com_MyCompany_driver_MyDriver)
public:
virtual bool init(OSDictionary *dictionary = 0);
virtual void free(void);
virtual IOService *probe(IOService *provider, SInt32 *score);
virtual bool start(IOService *provider);
virtual void stop(IOService *provider);
};
TestIokit.cpp
#include <IOKit/IOLib.h>
#include "MyDriver.h"
// This required macro defines the class's constructors, destructors,
// and several other methods I/O Kit requires.
OSDefineMetaClassAndStructors(com_MyCompany_driver_MyDriver, IOService)
// Define the driver's superclass.
#define super IOService
bool com_MyCompany_driver_MyDriver::init(OSDictionary *dict)
{
bool result = super::init(dict);
IOLog("Initializing\n");
return result;
}
void com_MyCompany_driver_MyDriver::free(void)
{
IOLog("Freeing\n");
super::free();
}
IOService *com_MyCompany_driver_MyDriver::probe(IOService *provider,
SInt32 *score)
{
IOService *result = super::probe(provider, score);
IOLog("Probing\n");
return result;
}
bool com_MyCompany_driver_MyDriver::start(IOService *provider)
{
bool result = super::start(provider);
IOLog("Starting\n");
return result;
}
void com_MyCompany_driver_MyDriver::stop(IOService *provider)
{
IOLog("Stopping\n");
super::stop(provider);
}
沒有留言:
張貼留言