core: Introduce a logging macro AVR_LOG()
[simavr] / simavr / sim / sim_irq.h
index 6f4be93..d3ac30b 100644 (file)
@@ -31,7 +31,7 @@ extern "C" {
 /*
  * Internal IRQ system
  * 
- * This subsystem allow any piece of code to "register" a hook to be called when an IRQ is
+ * This subsystem allows any piece of code to "register" a hook to be called when an IRQ is
  * raised. The IRQ definition is up to the module defining it, for example a IOPORT pin change
  * might be an IRQ in which case any piece of code can be notified when a pin has changed state
  * 
@@ -55,6 +55,7 @@ enum {
        IRQ_FLAG_NOT            = (1 << 0),     //!< change polarity of the IRQ
        IRQ_FLAG_FILTERED       = (1 << 1),     //!< do not "notify" if "value" is the same as previous raise
        IRQ_FLAG_ALLOC          = (1 << 2), //!< this irq structure was malloced via avr_alloc_irq
+       IRQ_FLAG_INIT           = (1 << 3), //!< this irq hasn't been used yet
 };
 
 /*
@@ -62,7 +63,7 @@ enum {
  */
 typedef struct avr_irq_pool_t {
        int count;                                              //!< number of irqs living in the pool
-       struct avr_irq_t ** irq;                //!< irqs belongging in this pool
+       struct avr_irq_t ** irq;                //!< irqs belonging in this pool
 } avr_irq_pool_t;
 
 /*!
@@ -107,6 +108,11 @@ void
 avr_connect_irq(
                avr_irq_t * src,
                avr_irq_t * dst);
+void
+avr_unconnect_irq(
+               avr_irq_t * src,
+               avr_irq_t * dst);
+
 //! register a notification 'hook' for 'irq' -- 'param' is anything that your want passed back as argument
 void
 avr_irq_register_notify(
@@ -114,6 +120,12 @@ avr_irq_register_notify(
                avr_irq_notify_t notify,
                void * param);
 
+void
+avr_irq_unregister_notify(
+               avr_irq_t * irq,
+               avr_irq_notify_t notify,
+               void * param);
+
 #ifdef __cplusplus
 };
 #endif