#ifndef __DEV_DEVICE_H
#define __DEV_DEVICE_H

#include <dev/DeviceNode.h>

namespace OS {
namespace Dev {

class IntController;

class Device : public DeviceNode {
public:
	Device(const char *name);
	virtual ~Device();

	/* mask and unmask the device's interrupt, if set */
	status_t UnmaskInterrupt(bool *oldstate = NULL);
	status_t MaskInterrupt(bool *oldstate = NULL);

	/* set the interrupt handler */
	status_t InstallIntHandler(IntController *intController, unsigned int vector);

protected:
	/* should only be called by the interrupt controller */
	virtual handlerReturn IntHandler() = 0;

private:
	IntController *mIntController;
	unsigned int mIntVector;

	friend class IntController;
};
	
}} // namespace OS::Dev

#endif
