|
|
|
@ -91,8 +91,7 @@ Device::Device(const char *name,
@@ -91,8 +91,7 @@ Device::Device(const char *name,
|
|
|
|
|
_name(name), |
|
|
|
|
_debug_enabled(false), |
|
|
|
|
// private
|
|
|
|
|
_irq(irq), |
|
|
|
|
_irq_attached(false) |
|
|
|
|
_irq(irq) |
|
|
|
|
{ |
|
|
|
|
sem_init(&_lock, 0, 1); |
|
|
|
|
|
|
|
|
@ -109,7 +108,7 @@ Device::~Device()
@@ -109,7 +108,7 @@ Device::~Device()
|
|
|
|
|
{ |
|
|
|
|
sem_destroy(&_lock); |
|
|
|
|
|
|
|
|
|
if (_irq_attached) { |
|
|
|
|
if (_irq) { |
|
|
|
|
unregister_interrupt(_irq); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -128,20 +127,17 @@ Device::init()
@@ -128,20 +127,17 @@ Device::init()
|
|
|
|
|
ret = register_interrupt(_irq, this); |
|
|
|
|
|
|
|
|
|
if (ret != OK) { |
|
|
|
|
goto out; |
|
|
|
|
_irq = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_irq_attached = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
out: |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
Device::interrupt_enable() |
|
|
|
|
{ |
|
|
|
|
if (_irq_attached) { |
|
|
|
|
if (_irq) { |
|
|
|
|
up_enable_irq(_irq); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -149,7 +145,7 @@ Device::interrupt_enable()
@@ -149,7 +145,7 @@ Device::interrupt_enable()
|
|
|
|
|
void |
|
|
|
|
Device::interrupt_disable() |
|
|
|
|
{ |
|
|
|
|
if (_irq_attached) { |
|
|
|
|
if (_irq) { |
|
|
|
|
up_disable_irq(_irq); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|