Index: soft/giet_vm/sys/irq_handler.c
===================================================================
--- soft/giet_vm/sys/irq_handler.c	(revision 237)
+++ soft/giet_vm/sys/irq_handler.c	(revision 238)
@@ -19,6 +19,6 @@
 #include <hwr_mapping.h>
 
-#if NB_TIMERS_MAX
-extern volatile unsigned char _user_timer_event[NB_CLUSTERS * NB_TIMERS_MAX] ;
+#if NB_TIM_CHANNELS
+extern volatile unsigned char _user_timer_event[NB_CLUSTERS * NB_TIM_CHANNELS] ;
 #endif
 
@@ -33,6 +33,7 @@
 //
 // There is one interrupt vector per processor (stored in the scheduler associated
-// to the processor. Each interrupt vector entry contains two 16 bits fields:
-// - isr_id : defines the type of ISR to be executed.
+// to the processor. Each interrupt vector entry contains three bits fields:
+// - isr_id     : defines the type of ISR to be executed.
+// - type_id    : HWI if zero / PTI if non zero 
 // - channel_id : defines the specific channel for multi-channels peripherals.
 //
@@ -40,11 +41,12 @@
 // a global index : channel_id = cluster_id * NB_CHANNELS_MAX + loc_id   
 ///////////////////////////////////////////////////////////////////////////////////
-void _irq_demux() {
+void _irq_demux() 
+{
     unsigned int pid = _procid();
     unsigned int irq_id;
 
-
     // get the highest priority active IRQ index 
-    if (_icu_get_index( pid / NB_PROCS_MAX, pid % NB_PROCS_MAX, &irq_id)) {
+    if (_icu_get_index( pid / NB_PROCS_MAX, pid % NB_PROCS_MAX, &irq_id)) 
+    {
         _get_lock(&_tty_put_lock);
         _puts("\n[GIET ERROR] Strange... Wrong _icu_read in _irq_demux()\n");
@@ -52,11 +54,13 @@
     }
 
-
-    if (irq_id < 32) {
-        // do nothing if no interrupt active 
-        unsigned int entry = _get_interrupt_vector_entry(irq_id);
-        unsigned int isr_id = entry & 0x000000FF;
-        unsigned int type_id = (entry >> 8) & 0x000000FF;
-        unsigned int channel_id = (entry >> 16) & 0x0000FFFF;
+    // do nothing if no interrupt active 
+    if (irq_id < 32) 
+    {
+        static_scheduler_t* psched     = _get_sched();
+        unsigned int        entry      = psched->interrupt_vector[irq_id];
+        unsigned int        isr_id     = entry & 0x000000FF;
+        unsigned int        type_id    = (entry >> 8) & 0x000000FF;
+        unsigned int        channel_id = (entry >> 16) & 0x0000FFFF;
+
         if(type_id == 0) // HARD irq type
         {
@@ -76,5 +80,4 @@
 }
 
-
 ///////////////////////////////////////////////////////////////////////////////////
 //     _isr_default()
@@ -82,5 +85,6 @@
 // interrupt vector. It simply displays an error message on kernel TTY[0].
 ///////////////////////////////////////////////////////////////////////////////////
-void _isr_default() {
+void _isr_default() 
+{
     _get_lock(&_tty_put_lock);
     _puts("\n[GIET ERROR] Strange... Default ISR activated for processor ");
@@ -96,20 +100,22 @@
 // The multi_dma components can be distributed in the clusters.
 // The channel_id argument is the local DMA channel index.
-//     dma_global_id = cluster_id*NB_DMAS_MAX + channel_id
+//     dma_global_id = cluster_id*NB_DMA_CHANNELS + channel_id
 // - The ISR saves the transfert status in _dma_status[dma_global_id].
 // - It acknowledges the interrupt to reinitialize the DMA controler.
 // - it resets the synchronisation variable _dma_busy[dma_global_id].
 ///////////////////////////////////////////////////////////////////////////////////
-void _isr_dma(unsigned int channel_id) {
-#if NB_DMAS_MAX > 0
+void _isr_dma(unsigned int channel_id) 
+{
+#if NB_DMA_CHANNELS > 0
     // compute cluster_id 
     unsigned int cluster_id = _procid() / NB_PROCS_MAX;
 
     // compute dma_global_id
-    unsigned int dma_global_id = cluster_id * NB_DMAS_MAX + channel_id;
+    unsigned int dma_global_id = cluster_id * NB_DMA_CHANNELS + channel_id;
 
     // save DMA channel status  
     if (_dma_get_status(cluster_id, channel_id, 
-            (unsigned int *) &_dma_status[dma_global_id])) {
+            (unsigned int *) &_dma_status[dma_global_id])) 
+    {
         _get_lock(&_tty_put_lock);
         _puts("[GIET ERROR] illegal DMA channel detected by _isr_dma\n");
@@ -119,5 +125,6 @@
 
     // reset DMA channel irq
-    if (_dma_reset_irq(cluster_id, channel_id)) {
+    if (_dma_reset_irq(cluster_id, channel_id)) 
+    {
         _get_lock(&_tty_put_lock);
         _puts("[GIET ERROR] illegal DMA channel detected by _isr_dma\n");
@@ -128,7 +135,9 @@
     // release DMA channel 
     _dma_done[dma_global_id] = 1;
+
 #else
-    _puts("[GIET ERROR] NB_DMAS_MAX is set to zero\n");
-
+    _get_lock(&_tty_put_lock);
+    _puts("[GIET ERROR] NB_DMA_CHANNELS is set to zero\n");
+    _release_lock(&_tty_put_lock);
 #endif
 }
@@ -140,7 +149,9 @@
 // - It sets the _ioc_done variable to signal completion.
 ///////////////////////////////////////////////////////////////////////////////////
-void _isr_ioc() {
+void _isr_ioc() 
+{
     // save status & reset IRQ 
-    if (_ioc_get_status((unsigned int *) &_ioc_status )) {
+    if (_ioc_get_status((unsigned int *) &_ioc_status )) 
+    {
         _get_lock(&_tty_put_lock);
         _puts("[GIET ERROR] bad access to IOC status detected by _isr_ioc\n");
@@ -161,14 +172,16 @@
 // in a vci_multi_timer component, or in a vci_xicu component.
 // The timer_id argument is the user timer local index.
-//     timer_globa_id = cluster_id*(NB_TIMERS_MAX) + timer_id 
+//     timer_globa_id = cluster_id*(NB_TIM_CHANNELS) + timer_id 
 // The ISR acknowledges the IRQ and registers the event in the proper entry
 // of the _timer_event[] array, and a log message is displayed on kernel terminal.
 ///////////////////////////////////////////////////////////////////////////////////
-void _isr_timer(unsigned int timer_id) {
+void _isr_timer(unsigned int timer_id) 
+{
     // compute cluster_id 
     unsigned int cluster_id = _procid() / NB_PROCS_MAX;
 
     // aknowledge IRQ 
-    if (_timer_reset_irq( cluster_id, timer_id)) {
+    if (_timer_reset_irq( cluster_id, timer_id)) 
+    {
         _get_lock(&_tty_put_lock);
         _puts("[GIET ERROR] illegal timer index detected by _isr_timer\n");
@@ -177,7 +190,7 @@
     }
 
-#if NB_TIMERS_MAX
+#if NB_TIM_CHANNELS
     // register the event
-    unsigned int timer_global_id = cluster_id * NB_TIMERS_MAX + timer_id;
+    unsigned int timer_global_id = cluster_id * NB_TIM_CHANNELS + timer_id;
     _user_timer_event[timer_global_id] = 1;
 #endif
@@ -207,7 +220,9 @@
 // A character is lost if the buffer is full when the ISR is executed.
 ///////////////////////////////////////////////////////////////////////////////////
-void _isr_tty(unsigned int tty_id) {
+void _isr_tty(unsigned int tty_id) 
+{
     // save character and reset IRQ 
-    if (_tty_get_char( tty_id, (unsigned char *) &_tty_get_buf[tty_id])) {
+    if (_tty_get_char( tty_id, (unsigned char *) &_tty_get_buf[tty_id])) 
+    {
         _get_lock(&_tty_put_lock);
         _puts("[GIET ERROR] illegal tty index detected by _isr_tty\n");
@@ -229,10 +244,12 @@
 // The ISR acknowledges the IRQ and calls the _ctx_switch() function.
 /////////////////////////////////////////////////////////////////////////////////////
-void _isr_switch( unsigned int timer_id) {
+void _isr_switch( unsigned int timer_id) 
+{
     // get cluster index and proc local index
     unsigned int cluster_id = _procid() / NB_PROCS_MAX;
 
     // acknowledge IRQ
-    if (_timer_reset_irq(cluster_id, timer_id)) {
+    if (_timer_reset_irq(cluster_id, timer_id)) 
+    {
         _get_lock(&_tty_put_lock);
         _puts("[GIET ERROR] illegal proc index detected by _isr_switch\n");
