Changeset 181 for soft/giet_vm/xml/xml_driver.c
- Timestamp:
- Jul 26, 2012, 5:43:08 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/xml/xml_driver.c
r173 r181 21 21 { 22 22 23 const char* 24 vobj_type[] = 23 const char* vobj_type[] = 25 24 { 26 "ELF", 27 "BLOB", 28 "PTAB", //page table 29 "PERI", //hardware component 30 "MWMR", //MWMR channel 31 "LOCK", //Lock 32 "BUFFER", //Any "no intialiasation needed" objects (stacks...) 33 "BARRIER" //Barrier 34 }; 35 const char* mode_str[] = { "____", 36 "___U", 37 "__W_", 38 "__WU", 39 "_X__", 40 "_X_U", 41 "_XW_", 42 "_XWU", 43 "C___", 44 "C__U", 45 "C_W_", 46 "C_WU", 47 "CX__", 48 "CX_U", 49 "CXW_", 50 "CXWU" }; 25 "ELF", // binary code generated by GCC 26 "BLOB", // binary code generated by GCC 27 "PTAB", // page table 28 "PERI", // hardware component 29 "MWMR", // MWMR channel 30 "LOCK", // Spin-Lock 31 "BUFFER", // Any "no intialiasation needed" objects (stacks...) 32 "BARRIER" // Barrier 33 }; 34 35 const char* pseg_type[] = 36 { 37 "RAM", 38 "ROM", 39 "PERI" 40 }; 41 42 const char* irq_type[] = 43 { 44 "HARD", 45 "SOFT" 46 }; 47 48 const char* isr_type[] = 49 { 50 "ISR_IOC", 51 "ISR_FBDMA", 52 "ISR_TTY" 53 }; 54 55 const char* reg_type[] = 56 { 57 "STATUS", 58 "CONFIG" 59 }; 60 61 const char* port_direction[] = 62 { 63 "TO_COPROC", 64 "FROM_COPROC" 65 }; 66 67 const char* mode_str[] = 68 { "____", 69 "___U", 70 "__W_", 71 "__WU", 72 "_X__", 73 "_X_U", 74 "_XW_", 75 "_XWU", 76 "C___", 77 "C__U", 78 "C_W_", 79 "C_WU", 80 "CX__", 81 "CX_U", 82 "CXW_", 83 "CXWU" 84 }; 51 85 52 86 unsigned int vspace_id; … … 56 90 unsigned int vobj_id; 57 91 unsigned int task_id; 58 59 mapping_cluster_t* cluster; 60 mapping_pseg_t* pseg; 61 mapping_vspace_t* vspace; 62 mapping_vseg_t* vseg; 63 mapping_vobj_t* vobj; 64 mapping_task_t* task; 92 unsigned int proc_id; 93 unsigned int irq_id; 94 unsigned int coproc_id; 95 unsigned int port_id; 96 unsigned int reg_id; 97 98 mapping_cluster_t* cluster; 99 mapping_pseg_t* pseg; 100 mapping_vspace_t* vspace; 101 mapping_vseg_t* vseg; 102 mapping_vobj_t* vobj; 103 mapping_task_t* task; 104 mapping_proc_t* proc; 105 mapping_irq_t* irq; 106 mapping_coproc_t* coproc; 107 mapping_coproc_port_t* cp_port; 108 mapping_coproc_reg_t* cp_reg; 65 109 66 110 // computes the base adresss for clusters array, … … 103 147 MAPPING_VSEG_SIZE*header->vsegs ); 104 148 149 // computes the base address the array 150 proc = (mapping_proc_t*) ((char*)header + 151 MAPPING_HEADER_SIZE + 152 MAPPING_CLUSTER_SIZE*header->clusters + 153 MAPPING_PSEG_SIZE*header->psegs + 154 MAPPING_VSPACE_SIZE*header->vspaces + 155 MAPPING_VOBJ_SIZE*header->vobjs + 156 MAPPING_VSEG_SIZE*header->vsegs + 157 MAPPING_TASK_SIZE*header->tasks); 158 159 // computes the base address the array 160 irq = (mapping_irq_t*) ((char*)header + 161 MAPPING_HEADER_SIZE + 162 MAPPING_CLUSTER_SIZE*header->clusters + 163 MAPPING_PSEG_SIZE*header->psegs + 164 MAPPING_VSPACE_SIZE*header->vspaces + 165 MAPPING_VOBJ_SIZE*header->vobjs + 166 MAPPING_VSEG_SIZE*header->vsegs+ 167 MAPPING_TASK_SIZE*header->tasks+ 168 MAPPING_PROC_SIZE*header->procs 169 ); 170 171 // computes the base address the array 172 coproc = (mapping_coproc_t*) ((char*)header + 173 MAPPING_HEADER_SIZE + 174 MAPPING_CLUSTER_SIZE*header->clusters + 175 MAPPING_PSEG_SIZE*header->psegs + 176 MAPPING_VSPACE_SIZE*header->vspaces + 177 MAPPING_VOBJ_SIZE*header->vobjs + 178 MAPPING_VSEG_SIZE*header->vsegs+ 179 MAPPING_TASK_SIZE*header->tasks+ 180 MAPPING_PROC_SIZE*header->procs+ 181 MAPPING_IRQ_SIZE*header->irqs 182 ); 183 184 // computes the base address the array 185 cp_port = (mapping_coproc_port_t*) ((char*)header + 186 MAPPING_HEADER_SIZE + 187 MAPPING_CLUSTER_SIZE*header->clusters + 188 MAPPING_PSEG_SIZE*header->psegs + 189 MAPPING_VSPACE_SIZE*header->vspaces + 190 MAPPING_VOBJ_SIZE*header->vobjs + 191 MAPPING_VSEG_SIZE*header->vsegs+ 192 MAPPING_TASK_SIZE*header->tasks+ 193 MAPPING_PROC_SIZE*header->procs+ 194 MAPPING_IRQ_SIZE*header->irqs+ 195 MAPPING_COPROC_SIZE*header->coprocs 196 ); 197 198 // computes the base address the array 199 cp_reg = (mapping_coproc_reg_t*) ((char*)header + 200 MAPPING_HEADER_SIZE + 201 MAPPING_CLUSTER_SIZE*header->clusters + 202 MAPPING_PSEG_SIZE*header->psegs + 203 MAPPING_VSPACE_SIZE*header->vspaces + 204 MAPPING_VOBJ_SIZE*header->vobjs + 205 MAPPING_VSEG_SIZE*header->vsegs+ 206 MAPPING_TASK_SIZE*header->tasks+ 207 MAPPING_PROC_SIZE*header->procs+ 208 MAPPING_IRQ_SIZE*header->irqs+ 209 MAPPING_COPROC_SIZE*header->coprocs+ 210 MAPPING_CP_PORT_SIZE*header->cp_ports 211 ); 212 105 213 fprintf( fpout, "<?xml version = \"1.0\"?>\n\n"); 106 214 … … 110 218 fprintf( fpout, " name = \"%s\"\n", header->name); 111 219 fprintf( fpout, " clusters = \"%d\"\n", header->clusters); 112 fprintf( fpout, " psegs = \"%d\"\n", header->psegs);113 220 fprintf( fpout, " ttys = \"%d\"\n", header->ttys); 114 221 fprintf( fpout, " fbs = \"%d\"\n", header->fbs); … … 121 228 for ( cluster_id = 0 ; cluster_id < header->clusters ; cluster_id++ ) 122 229 { 123 fprintf( fpout, " <cluster index = \"%d\"\n", cluster_id); 124 fprintf( fpout, " procs = \"%d\" />\n\n", cluster[cluster_id].procs); 125 } 126 fprintf( fpout, " </clusterset>\n" ); 127 128 //////////////////// psegs /////////////////////////////////////////////////// 129 130 fprintf( fpout, " <psegset>\n" ); 131 for ( pseg_id = 0 ; pseg_id < header->psegs ; pseg_id++ ) 132 { 133 fprintf( fpout, " <pseg name = \"%s\"\n", pseg[pseg_id].name); 134 fprintf( fpout, " base = \"0x%x\"\n", pseg[pseg_id].base); 135 fprintf( fpout, " length = \"0x%x\" />\n\n", pseg[pseg_id].length); 136 } 137 fprintf( fpout, " </psegset>\n" ); 138 230 fprintf( fpout, " <cluster index = \"%d\" >\n", cluster_id); 231 for ( pseg_id = cluster[cluster_id].pseg_offset ; 232 pseg_id < cluster[cluster_id].pseg_offset + cluster[cluster_id].psegs ; 233 pseg_id++ ) 234 { 235 fprintf( fpout, " <pseg name = \"%s\"\n", pseg[pseg_id].name); 236 fprintf( fpout, " type = \"%s\"\n", pseg_type[pseg[pseg_id].type]); 237 fprintf( fpout, " base = \"0x%x\"\n", pseg[pseg_id].base); 238 fprintf( fpout, " length = \"0x%x\" />\n", pseg[pseg_id].length); 239 } 240 for ( proc_id = cluster[cluster_id].proc_offset ; 241 proc_id < cluster[cluster_id].proc_offset + cluster[cluster_id].procs ; 242 proc_id++ ) 243 { 244 fprintf( fpout, " <proc index = \"%d\" >\n", proc_id); 245 for ( irq_id = proc[proc_id].irq_offset ; irq_id < proc[proc_id].irq_offset + proc[proc_id].irqs ; irq_id++ ) 246 { 247 fprintf( fpout, " <irq type = \"%s\"\n", irq_type[irq[irq_id].type]); 248 fprintf( fpout, " icuid = \"0x%x\"\n", irq[irq_id].icuid); 249 fprintf( fpout, " isr = \"%s\"\n", isr_type[irq[irq_id].isr]); 250 fprintf( fpout, " channel = \"0x%x\" />\n", irq[irq_id].channel); 251 } 252 fprintf( fpout, " </proc>\n" ); 253 } 254 255 for ( coproc_id = cluster[cluster_id].coproc_offset ; 256 coproc_id < cluster[cluster_id].coproc_offset + cluster[cluster_id].coprocs ; 257 coproc_id++ ) 258 { 259 fprintf( fpout, " <coproc name = \"%s\"\n", coproc[coproc_id].name); 260 fprintf( fpout, " psegname = \"%s\" >\n", pseg[coproc[coproc_id].psegid].name); 261 for ( port_id = coproc[coproc_id].port_offset ; port_id < coproc[coproc_id].port_offset + coproc[coproc_id].ports ; port_id++ ) 262 { 263 unsigned int vobj_id = cp_port[port_id].vobjlocid + vspace[cp_port[port_id].vspaceid].vobj_offset; 264 fprintf( fpout, " <port direction = \"%s\"\n", port_direction[ cp_port[port_id].direction]); 265 fprintf( fpout, " vspacename = \"%s\"\n", vspace[cp_port[port_id].vspaceid].name); 266 fprintf( fpout, " vobjname = \"%s\" />\n", vobj[vobj_id].name); 267 } 268 for ( reg_id = coproc[coproc_id].reg_offset ; 269 reg_id < coproc[coproc_id].reg_offset+coproc[coproc_id].regs ; 270 reg_id++ ) 271 { 272 fprintf( fpout, " <reg name = \"%s\"\n", cp_reg[reg_id].name); 273 fprintf( fpout, " type = \"%s\"\n", reg_type[cp_reg[reg_id].type]); 274 fprintf( fpout, " value = \"0x%x\"\n", cp_reg[reg_id].value); 275 fprintf( fpout, " channel = \"0x%x\"\n", cp_reg[reg_id].channel_id); 276 fprintf( fpout, " index = \"0x%x\" />\n", cp_reg[reg_id].loc_id); 277 } 278 fprintf( fpout, " </coproc>\n" ); 279 } 280 fprintf( fpout, " </cluster>\n" ); 281 } 282 fprintf( fpout, " </clusterset>\n\n" ); 139 283 140 284 /////////////////// globals ///////////////////////////////////////////////// … … 145 289 unsigned int pseg_id = vseg[vseg_id].psegid; 146 290 147 fprintf( fpout, " <vseg name = \"%s\"\n", vseg[vseg_id].name); 148 fprintf( fpout, " vbase = \"0x%x\"\n", vseg[vseg_id].vbase); 149 fprintf( fpout, " mode = \"%s\"\n", mode_str[vseg[vseg_id].mode]); 150 fprintf( fpout, " psegname = \"%s\"\n", pseg[pseg_id].name); 151 fprintf( fpout, " ident = \"%d\" >\n", vseg[vseg_id].ident); 291 fprintf( fpout, " <vseg name = \"%s\"\n", vseg[vseg_id].name); 292 fprintf( fpout, " vbase = \"0x%x\"\n", vseg[vseg_id].vbase); 293 fprintf( fpout, " mode = \"%s\"\n", mode_str[vseg[vseg_id].mode]); 294 fprintf( fpout, " clusterid = \"%d\"\n", pseg[pseg_id].cluster); 295 fprintf( fpout, " psegname = \"%s\"\n", pseg[pseg_id].name); 296 fprintf( fpout, " ident = \"%d\" >\n", vseg[vseg_id].ident); 152 297 for ( vobj_id = vseg[vseg_id].vobj_offset; 153 298 vobj_id < (vseg[vseg_id].vobj_offset + vseg[vseg_id].vobjs); … … 161 306 fprintf( fpout, " binpath = \"%s\" />\n", vobj[vobj_id].binpath); 162 307 } 163 fprintf( fpout, " </vseg>\n \n");308 fprintf( fpout, " </vseg>\n"); 164 309 } 165 310 fprintf( fpout, " </globalset>\n" ); … … 167 312 //////////////////// vspaces //////////////////////////////////////////////// 168 313 169 fprintf( fpout, " <vspaceset>\n" );314 fprintf( fpout, "\n <vspaceset>\n\n" ); 170 315 for ( vspace_id = 0 ; vspace_id < header->vspaces ; vspace_id++ ) 171 316 { … … 182 327 fprintf( fpout, " vbase = \"0x%x\"\n", vseg[vseg_id].vbase); 183 328 fprintf( fpout, " mode = \"%s\"\n", mode_str[vseg[vseg_id].mode]); 329 fprintf( fpout, " clusterid = \"%d\"\n", pseg[pseg_id].cluster); 184 330 fprintf( fpout, " psegname = \"%s\"\n", pseg[pseg_id].name); 185 331 fprintf( fpout, " ident = \"%d\" >\n", vseg[vseg_id].ident); … … 196 342 fprintf( fpout, " binpath = \"%s\" />\n", vobj[vobj_id].binpath); 197 343 } 198 fprintf( fpout, " </vseg>\n \n");344 fprintf( fpout, " </vseg>\n"); 199 345 } 200 346 for ( task_id = vspace[vspace_id].task_offset ;
Note: See TracChangeset
for help on using the changeset viewer.