Index: soft/giet_vm/xml/xml_driver.c
===================================================================
--- soft/giet_vm/xml/xml_driver.c	(revision 173)
+++ soft/giet_vm/xml/xml_driver.c	(revision 181)
@@ -21,32 +21,66 @@
 {
 
-    const char* 
-    vobj_type[] = 
+    const char* vobj_type[] = 
     { 
-        "ELF",
-        "BLOB",
-        "PTAB",   //page table 
-        "PERI",   //hardware component
-        "MWMR",   //MWMR channel
-        "LOCK",   //Lock
-        "BUFFER", //Any "no intialiasation needed" objects (stacks...)
-        "BARRIER" //Barrier
-    };
-    const char* mode_str[] = { "____",
-                               "___U", 
-                               "__W_", 
-                               "__WU", 
-                               "_X__", 
-                               "_X_U", 
-                               "_XW_", 
-                               "_XWU", 
-                               "C___", 
-                               "C__U", 
-                               "C_W_", 
-                               "C_WU", 
-                               "CX__", 
-                               "CX_U", 
-                               "CXW_", 
-                               "CXWU" };
+        "ELF",		// binary code generated by GCC
+        "BLOB",		// binary code generated by GCC
+        "PTAB",		// page table 
+        "PERI",		// hardware component
+        "MWMR",		// MWMR channel
+        "LOCK",		// Spin-Lock
+        "BUFFER",	// Any "no intialiasation needed" objects (stacks...)
+        "BARRIER"	// Barrier
+    };
+
+    const char* pseg_type[] =
+    {
+        "RAM",
+        "ROM",
+        "PERI"
+    };
+
+    const char* irq_type[] =
+    {
+        "HARD",
+        "SOFT"
+    };
+
+    const char* isr_type[] =
+    {
+        "ISR_IOC",
+        "ISR_FBDMA",
+        "ISR_TTY"
+    };
+
+    const char* reg_type[] =
+    {
+        "STATUS",
+        "CONFIG"
+    };
+
+    const char* port_direction[] =
+    {
+        "TO_COPROC",
+        "FROM_COPROC"
+    };
+
+    const char* mode_str[] = 
+    { "____",
+      "___U", 
+      "__W_", 
+      "__WU", 
+      "_X__", 
+      "_X_U", 
+      "_XW_", 
+      "_XWU", 
+      "C___", 
+      "C__U", 
+      "C_W_", 
+      "C_WU", 
+      "CX__", 
+      "CX_U", 
+      "CXW_", 
+      "CXWU" 
+    };
 
     unsigned int		vspace_id;
@@ -56,11 +90,21 @@
     unsigned int		vobj_id;
     unsigned int		task_id;
-
-    mapping_cluster_t*	cluster;
-    mapping_pseg_t*	pseg;
-    mapping_vspace_t*	vspace;
-    mapping_vseg_t*	vseg;
-    mapping_vobj_t*	vobj;
-    mapping_task_t*	task;
+    unsigned int		proc_id;
+    unsigned int		irq_id;
+    unsigned int		coproc_id;
+    unsigned int		port_id;
+    unsigned int		reg_id;
+
+    mapping_cluster_t*	    cluster;
+    mapping_pseg_t*	        pseg;
+    mapping_vspace_t*	    vspace;
+    mapping_vseg_t*	        vseg;
+    mapping_vobj_t*	        vobj;
+    mapping_task_t*	        task;
+    mapping_proc_t*	        proc;
+    mapping_irq_t*	        irq;	
+    mapping_coproc_t*       coproc;
+    mapping_coproc_port_t*	cp_port;
+    mapping_coproc_reg_t*   cp_reg;
 
     // computes the base adresss for clusters array, 
@@ -103,4 +147,68 @@
                                   MAPPING_VSEG_SIZE*header->vsegs );
 
+    // computes the base address the array 
+    proc    = (mapping_proc_t*)   ((char*)header +
+                                  MAPPING_HEADER_SIZE +
+                                  MAPPING_CLUSTER_SIZE*header->clusters +
+                                  MAPPING_PSEG_SIZE*header->psegs +
+                                  MAPPING_VSPACE_SIZE*header->vspaces +
+                                  MAPPING_VOBJ_SIZE*header->vobjs +
+                                  MAPPING_VSEG_SIZE*header->vsegs +
+                                  MAPPING_TASK_SIZE*header->tasks);
+
+    // computes the base address the array 
+    irq    = (mapping_irq_t*)   ((char*)header +
+                                  MAPPING_HEADER_SIZE +
+                                  MAPPING_CLUSTER_SIZE*header->clusters +
+                                  MAPPING_PSEG_SIZE*header->psegs +
+                                  MAPPING_VSPACE_SIZE*header->vspaces +
+                                  MAPPING_VOBJ_SIZE*header->vobjs +
+                                  MAPPING_VSEG_SIZE*header->vsegs+
+                                  MAPPING_TASK_SIZE*header->tasks+
+                                  MAPPING_PROC_SIZE*header->procs
+                                    );
+
+    // computes the base address the array 
+    coproc    = (mapping_coproc_t*)   ((char*)header +
+                                  MAPPING_HEADER_SIZE +
+                                  MAPPING_CLUSTER_SIZE*header->clusters +
+                                  MAPPING_PSEG_SIZE*header->psegs +
+                                  MAPPING_VSPACE_SIZE*header->vspaces +
+                                  MAPPING_VOBJ_SIZE*header->vobjs +
+                                  MAPPING_VSEG_SIZE*header->vsegs+
+                                  MAPPING_TASK_SIZE*header->tasks+
+                                  MAPPING_PROC_SIZE*header->procs+
+                                  MAPPING_IRQ_SIZE*header->irqs
+                                    );
+
+    // computes the base address the array 
+    cp_port    = (mapping_coproc_port_t*)   ((char*)header +
+                                  MAPPING_HEADER_SIZE +
+                                  MAPPING_CLUSTER_SIZE*header->clusters +
+                                  MAPPING_PSEG_SIZE*header->psegs +
+                                  MAPPING_VSPACE_SIZE*header->vspaces +
+                                  MAPPING_VOBJ_SIZE*header->vobjs +
+                                  MAPPING_VSEG_SIZE*header->vsegs+
+                                  MAPPING_TASK_SIZE*header->tasks+
+                                  MAPPING_PROC_SIZE*header->procs+
+                                  MAPPING_IRQ_SIZE*header->irqs+
+                                  MAPPING_COPROC_SIZE*header->coprocs
+                                    );
+
+    // computes the base address the array 
+    cp_reg    = (mapping_coproc_reg_t*)   ((char*)header +
+                                  MAPPING_HEADER_SIZE +
+                                  MAPPING_CLUSTER_SIZE*header->clusters +
+                                  MAPPING_PSEG_SIZE*header->psegs +
+                                  MAPPING_VSPACE_SIZE*header->vspaces +
+                                  MAPPING_VOBJ_SIZE*header->vobjs +
+                                  MAPPING_VSEG_SIZE*header->vsegs+
+                                  MAPPING_TASK_SIZE*header->tasks+
+                                  MAPPING_PROC_SIZE*header->procs+
+                                  MAPPING_IRQ_SIZE*header->irqs+
+                                  MAPPING_COPROC_SIZE*header->coprocs+
+                                  MAPPING_CP_PORT_SIZE*header->cp_ports
+                                    );
+
     fprintf( fpout, "<?xml version = \"1.0\"?>\n\n");
 
@@ -110,5 +218,4 @@
     fprintf( fpout, "              name      = \"%s\"\n", header->name);
     fprintf( fpout, "              clusters  = \"%d\"\n", header->clusters);
-    fprintf( fpout, "              psegs     = \"%d\"\n", header->psegs);
     fprintf( fpout, "              ttys      = \"%d\"\n", header->ttys);
     fprintf( fpout, "              fbs       = \"%d\"\n", header->fbs);
@@ -121,20 +228,57 @@
     for ( cluster_id = 0 ; cluster_id < header->clusters ; cluster_id++ )
     {
-        fprintf( fpout, "        <cluster index  = \"%d\"\n",      cluster_id);
-        fprintf( fpout, "                 procs  = \"%d\" />\n\n", cluster[cluster_id].procs);
-    }
-    fprintf( fpout, "    </clusterset>\n" );
-
-    //////////////////// psegs ///////////////////////////////////////////////////
-
-    fprintf( fpout, "    <psegset>\n" );
-    for ( pseg_id = 0 ; pseg_id < header->psegs ; pseg_id++ )
-    {
-        fprintf( fpout, "        <pseg    name   = \"%s\"\n",        pseg[pseg_id].name);
-        fprintf( fpout, "                 base   = \"0x%x\"\n",      pseg[pseg_id].base);
-        fprintf( fpout, "                 length = \"0x%x\" />\n\n", pseg[pseg_id].length);
-    }
-    fprintf( fpout, "    </psegset>\n" );
-
+        fprintf( fpout, "        <cluster index  = \"%d\" >\n",   cluster_id);
+        for ( pseg_id = cluster[cluster_id].pseg_offset ; 
+                pseg_id < cluster[cluster_id].pseg_offset + cluster[cluster_id].psegs ; 
+                    pseg_id++ )
+        {
+            fprintf( fpout, "                 <pseg    name   = \"%s\"\n",        pseg[pseg_id].name);
+            fprintf( fpout, "                          type   = \"%s\"\n",  pseg_type[pseg[pseg_id].type]);
+            fprintf( fpout, "                          base   = \"0x%x\"\n",      pseg[pseg_id].base);
+            fprintf( fpout, "                          length = \"0x%x\" />\n",   pseg[pseg_id].length);
+        }
+        for ( proc_id = cluster[cluster_id].proc_offset ; 
+                proc_id < cluster[cluster_id].proc_offset + cluster[cluster_id].procs ;
+                    proc_id++ )
+        {
+            fprintf( fpout, "                   <proc index   = \"%d\" >\n",       proc_id);
+            for ( irq_id = proc[proc_id].irq_offset ; irq_id < proc[proc_id].irq_offset + proc[proc_id].irqs ; irq_id++ )
+            {
+                fprintf( fpout, "                         <irq    type    = \"%s\"\n",  irq_type[irq[irq_id].type]);
+                fprintf( fpout, "                                 icuid   = \"0x%x\"\n",      irq[irq_id].icuid);
+                fprintf( fpout, "                                 isr     = \"%s\"\n",  isr_type[irq[irq_id].isr]);
+                fprintf( fpout, "                                 channel = \"0x%x\" />\n",   irq[irq_id].channel);
+            }
+            fprintf( fpout, "                   </proc>\n" );
+        }
+
+        for ( coproc_id = cluster[cluster_id].coproc_offset ; 
+                coproc_id < cluster[cluster_id].coproc_offset + cluster[cluster_id].coprocs ;
+                    coproc_id++ )
+        {
+            fprintf( fpout, "                   <coproc name       = \"%s\"\n",       coproc[coproc_id].name);
+            fprintf( fpout, "                           psegname   = \"%s\" >\n",       pseg[coproc[coproc_id].psegid].name);
+            for ( port_id = coproc[coproc_id].port_offset ; port_id < coproc[coproc_id].port_offset + coproc[coproc_id].ports ; port_id++ )
+            {
+                unsigned int vobj_id = cp_port[port_id].vobjlocid + vspace[cp_port[port_id].vspaceid].vobj_offset; 
+                fprintf( fpout, "                           <port   direction    = \"%s\"\n",  port_direction[ cp_port[port_id].direction]);
+                fprintf( fpout, "                                   vspacename   = \"%s\"\n",  vspace[cp_port[port_id].vspaceid].name);
+                fprintf( fpout, "                                   vobjname     = \"%s\" />\n",  vobj[vobj_id].name);
+            }
+            for ( reg_id = coproc[coproc_id].reg_offset ; 
+                    reg_id < coproc[coproc_id].reg_offset+coproc[coproc_id].regs ;
+                        reg_id++ )
+            {
+                fprintf( fpout, "                           <reg    name        = \"%s\"\n",        cp_reg[reg_id].name);
+                fprintf( fpout, "                                   type        = \"%s\"\n",        reg_type[cp_reg[reg_id].type]);
+                fprintf( fpout, "                                   value       = \"0x%x\"\n",      cp_reg[reg_id].value);
+                fprintf( fpout, "                                   channel     = \"0x%x\"\n",      cp_reg[reg_id].channel_id);
+                fprintf( fpout, "                                   index       = \"0x%x\" />\n",   cp_reg[reg_id].loc_id);
+            }
+            fprintf( fpout, "                   </coproc>\n" );
+        }
+        fprintf( fpout, "        </cluster>\n" );
+    }
+    fprintf( fpout, "    </clusterset>\n\n" );
 
     /////////////////// globals /////////////////////////////////////////////////
@@ -145,9 +289,10 @@
         unsigned int pseg_id = vseg[vseg_id].psegid; 
 
-        fprintf( fpout, "        <vseg    name     = \"%s\"\n",      vseg[vseg_id].name);
-        fprintf( fpout, "                 vbase    = \"0x%x\"\n",    vseg[vseg_id].vbase);
-        fprintf( fpout, "                 mode     = \"%s\"\n", mode_str[vseg[vseg_id].mode]);
-        fprintf( fpout, "                 psegname = \"%s\"\n",      pseg[pseg_id].name);
-        fprintf( fpout, "                 ident    = \"%d\" >\n",    vseg[vseg_id].ident);
+        fprintf( fpout, "        <vseg    name      = \"%s\"\n",      vseg[vseg_id].name);
+        fprintf( fpout, "                 vbase     = \"0x%x\"\n",    vseg[vseg_id].vbase);
+        fprintf( fpout, "                 mode      = \"%s\"\n", mode_str[vseg[vseg_id].mode]);
+        fprintf( fpout, "                 clusterid = \"%d\"\n",      pseg[pseg_id].cluster);
+        fprintf( fpout, "                 psegname  = \"%s\"\n",      pseg[pseg_id].name);
+        fprintf( fpout, "                 ident     = \"%d\" >\n",    vseg[vseg_id].ident);
         for ( vobj_id = vseg[vseg_id].vobj_offset;
               vobj_id < (vseg[vseg_id].vobj_offset + vseg[vseg_id].vobjs); 
@@ -161,5 +306,5 @@
             fprintf( fpout, "                       binpath  = \"%s\" />\n", vobj[vobj_id].binpath);
         }
-        fprintf( fpout, "        </vseg>\n\n");
+        fprintf( fpout, "        </vseg>\n");
     }
     fprintf( fpout, "    </globalset>\n" );
@@ -167,5 +312,5 @@
     //////////////////// vspaces ////////////////////////////////////////////////
 
-    fprintf( fpout, "    <vspaceset>\n" );
+    fprintf( fpout, "\n    <vspaceset>\n\n" );
     for ( vspace_id = 0 ; vspace_id < header->vspaces ; vspace_id++ )
     {
@@ -182,4 +327,5 @@
             fprintf( fpout, "                       vbase     = \"0x%x\"\n",    vseg[vseg_id].vbase);
             fprintf( fpout, "                       mode      = \"%s\"\n", mode_str[vseg[vseg_id].mode]);
+            fprintf( fpout, "                       clusterid = \"%d\"\n",      pseg[pseg_id].cluster);
             fprintf( fpout, "                       psegname  = \"%s\"\n",      pseg[pseg_id].name);
             fprintf( fpout, "                       ident     = \"%d\" >\n",    vseg[vseg_id].ident);
@@ -196,5 +342,5 @@
                 fprintf( fpout, "                             binpath  = \"%s\" />\n", vobj[vobj_id].binpath);
             }
-            fprintf( fpout, "                 </vseg>\n\n");
+            fprintf( fpout, "                 </vseg>\n");
         }
         for ( task_id = vspace[vspace_id].task_offset ;
