Changeset 323 for soft/giet_vm/giet_xml/xml_parser.c
- Timestamp:
- Jun 10, 2014, 1:31:01 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_xml/xml_parser.c
r306 r323 294 294 // 295 295 // - For replicated peripherals the virtual base address must be: 296 // vbase = seg_type_base & 0XFF000000 + (cluster_xy * increment) & 0x00FF0000296 // vbase = seg_type_base & 0XFF000000 + (cluster_xy * 0x00010000) & 0x00FF0000 297 297 // 298 298 // - For non-replicated peripherals, the cluster index must be cluster_io. … … 307 307 unsigned int type; // peripheral type 308 308 309 unsigned int type_mask = 0xFF000000; 310 unsigned int cluster_mask = 0x00FF0000; 309 unsigned int type_mask = 0xFF000000; 310 unsigned int cluster_mask = 0x00FF0000; 311 unsigned int vseg_increment = 0x00010000; 311 312 312 313 #if XML_PARSER_DEBUG … … 348 349 349 350 if( (vseg[vseg_id]->vbase & cluster_mask) != 350 ( header->increment * cluster_xy) )351 (vseg_increment * cluster_xy) ) 351 352 { 352 353 printf("[XML ERROR] All replicated peripherals " … … 444 445 } 445 446 446 //////////////////////////////////////////////////////////////////////////////// ///447 int getVobj LocId(unsigned int vspace_id, char * vobj_name, unsigned int vspace_max)447 //////////////////////////////////////////////////////////////////////////////// 448 int getVobjId(unsigned int vspace_id, char * vobj_name, unsigned int vspace_max) 448 449 { 449 450 unsigned int vobj_id; … … 453 454 for (vobj_id = vobj_min; vobj_id < vobj_max; vobj_id++) 454 455 { 455 if (strcmp(vobj[vobj_id]->name, vobj_name) == 0) return (vobj_id - vobj_min);456 if (strcmp(vobj[vobj_id]->name, vobj_name) == 0) return vobj_id; 456 457 } 457 458 return -1; … … 649 650 if (ok) 650 651 { 651 int index = getVobj LocId(vspace_index, str , vobj_loc_index);652 int index = getVobjId(vspace_index, str , vobj_loc_index); 652 653 if (index >= 0) 653 654 { 654 655 #if XML_PARSER_DEBUG 655 656 printf(" stackname = %s\n", str); 656 printf(" stack id= %d\n", index);657 #endif 658 task[task_index]->stack_vobj id = index;657 printf(" stack_id = %d\n", index); 658 #endif 659 task[task_index]->stack_vobj_id = index; 659 660 } 660 661 else … … 676 677 if (ok) 677 678 { 678 int index = getVobj LocId(vspace_index, str, vobj_loc_index);679 int index = getVobjId(vspace_index, str, vobj_loc_index); 679 680 if (index >= 0) 680 681 { 681 682 #if XML_PARSER_DEBUG 682 683 printf(" heapname = %s\n", str); 683 printf(" heap id = %d\n", index);684 #endif 685 task[task_index]->heap_vobj id = index;684 printf(" heap_id = %d\n", index ); 685 #endif 686 task[task_index]->heap_vobj_id = index; 686 687 } 687 688 else … … 694 695 else 695 696 { 696 task[task_index]->heap_vobj id = -1;697 task[task_index]->heap_vobj_id = -1; 697 698 } 698 699 … … 1129 1130 ////////// get startname attribute 1130 1131 str = getStringValue(reader, "startname", &ok); 1131 if (ok) { 1132 if (ok) 1133 { 1132 1134 //used after parsing the vobjs 1133 1135 } … … 1162 1164 1163 1165 // get index of the vobj containing the start vector 1164 int index = getVobj LocId(vspace_index, str , vobj_loc_index);1166 int index = getVobjId(vspace_index, str , vobj_loc_index); 1165 1167 if (index == -1) 1166 1168 { … … 1171 1173 else 1172 1174 { 1173 vspace[vspace_index]->start_ offset= index;1175 vspace[vspace_index]->start_vobj_id = index; 1174 1176 #if XML_PARSER_DEBUG 1175 1177 printf(" startname = %s\n", str); 1176 printf(" start id= %d\n", index);1178 printf(" start_id = %d\n", index); 1177 1179 printf(" end vspace %d\n\n", vspace_index); 1178 1180 #endif 1179 1181 } 1180 1182 1181 // checking startid values for all tasks in vspace 1183 // checking for all tasks that the startid 1184 // is smaller than the number of tasks in vspace 1182 1185 int task_id; 1183 1186 int task_min = vspace[vspace_index]->task_offset; 1184 1187 int task_max = task_min + vspace[vspace_index]->tasks; 1185 for (task_id = task_min; task_id < task_max; task_id++) { 1188 for (task_id = task_min; task_id < task_max; task_id++) 1189 { 1186 1190 if (task[task_id]->startid >= vspace[vspace_index]->tasks) 1187 1191 { … … 1212 1216 char * str; 1213 1217 1214 unsigned int is_pic = (periph[periph_index]->type == PERIPH_TYPE_PIC);1215 unsigned int is_icu = (periph[periph_index]->type == PERIPH_TYPE_ICU) ||1216 (periph[periph_index]->type == PERIPH_TYPE_XCU);1217 1218 1218 if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return; 1219 1219 … … 1251 1251 } 1252 1252 1253 ///////// get srctype attribute ... if ICU or XCU 1254 if ( is_icu ) 1255 { 1256 str = getStringValue(reader, "srctype", &ok); 1257 if (ok) 1258 { 1253 ///////// get srctype attribute 1254 str = getStringValue(reader, "srctype", &ok); 1255 if (ok) 1256 { 1259 1257 #if XML_PARSER_DEBUG 1260 1258 printf(" srctype = %s\n", str); 1261 1259 #endif 1262 if ( strcmp(str, "HWI") == 0 ) irq[irq_index]->srctype = IRQ_TYPE_HWI; 1263 else if ( strcmp(str, "WTI") == 0 ) irq[irq_index]->srctype = IRQ_TYPE_WTI; 1264 else if ( strcmp(str, "PTI") == 0 ) irq[irq_index]->srctype = IRQ_TYPE_PTI; 1265 else 1266 { 1267 printf("[XML ERROR] illegal IRQ <srctype> for periph %d in cluster %d\n", 1268 cluster_index, periph_loc_index); 1269 exit(1); 1270 } 1271 } 1272 else 1273 { 1274 printf("[XML ERROR] missing IRQ <srctype> for periph %d in cluster %d\n", 1260 if ( strcmp(str, "HWI") == 0 ) irq[irq_index]->srctype = IRQ_TYPE_HWI; 1261 else if ( strcmp(str, "WTI") == 0 ) irq[irq_index]->srctype = IRQ_TYPE_WTI; 1262 else if ( strcmp(str, "PTI") == 0 ) irq[irq_index]->srctype = IRQ_TYPE_PTI; 1263 else 1264 { 1265 printf("[XML ERROR] illegal IRQ <srctype> for periph %d in cluster %d\n", 1275 1266 cluster_index, periph_loc_index); 1276 1267 exit(1); 1277 1268 } 1278 1269 } 1279 1280 ///////// get isr attribute ... if ICU or XCU 1281 if ( is_icu ) 1282 { 1283 str = getStringValue(reader, "isr", &ok); 1284 if (ok) 1285 { 1270 else 1271 { 1272 printf("[XML ERROR] missing IRQ <srctype> for periph %d in cluster %d\n", 1273 cluster_index, periph_loc_index); 1274 exit(1); 1275 } 1276 1277 ///////// get isr attribute 1278 str = getStringValue(reader, "isr", &ok); 1279 if (ok) 1280 { 1286 1281 #if XML_PARSER_DEBUG 1287 1282 printf(" isr = %s\n", str); 1288 1283 #endif 1289 if (strcmp(str, "ISR_TICK" ) == 0) irq[irq_index]->isr = ISR_TICK; 1290 else if (strcmp(str, "ISR_BDV" ) == 0) irq[irq_index]->isr = ISR_BDV; 1291 else if (strcmp(str, "ISR_CMA" ) == 0) irq[irq_index]->isr = ISR_CMA; 1292 else if (strcmp(str, "ISR_TTY_RX" ) == 0) irq[irq_index]->isr = ISR_TTY_RX; 1293 else if (strcmp(str, "ISR_TTY_TX" ) == 0) irq[irq_index]->isr = ISR_TTY_TX; 1294 else if (strcmp(str, "ISR_TIMER" ) == 0) irq[irq_index]->isr = ISR_TIMER; 1295 else if (strcmp(str, "ISR_WAKUP" ) == 0) irq[irq_index]->isr = ISR_WAKUP; 1296 else if (strcmp(str, "ISR_NIC_RX" ) == 0) irq[irq_index]->isr = ISR_NIC_RX; 1297 else if (strcmp(str, "ISR_NIC_TX" ) == 0) irq[irq_index]->isr = ISR_NIC_TX; 1298 else if (strcmp(str, "ISR_MMC" ) == 0) irq[irq_index]->isr = ISR_MMC; 1299 else if (strcmp(str, "ISR_DEFAULT") == 0) irq[irq_index]->isr = ISR_DEFAULT; 1300 else 1301 { 1302 printf("[XML ERROR] illegal IRQ <isr> for periph %d in cluster %d\n", 1303 periph_loc_index, cluster_index ); 1304 exit(1); 1305 } 1306 } 1284 if (strcmp(str, "ISR_TICK" ) == 0) irq[irq_index]->isr = ISR_TICK; 1285 else if (strcmp(str, "ISR_BDV" ) == 0) irq[irq_index]->isr = ISR_BDV; 1286 else if (strcmp(str, "ISR_CMA" ) == 0) irq[irq_index]->isr = ISR_CMA; 1287 else if (strcmp(str, "ISR_TTY_RX" ) == 0) irq[irq_index]->isr = ISR_TTY_RX; 1288 else if (strcmp(str, "ISR_TTY_TX" ) == 0) irq[irq_index]->isr = ISR_TTY_TX; 1289 else if (strcmp(str, "ISR_TIMER" ) == 0) irq[irq_index]->isr = ISR_TIMER; 1290 else if (strcmp(str, "ISR_WAKUP" ) == 0) irq[irq_index]->isr = ISR_WAKUP; 1291 else if (strcmp(str, "ISR_NIC_RX" ) == 0) irq[irq_index]->isr = ISR_NIC_RX; 1292 else if (strcmp(str, "ISR_NIC_TX" ) == 0) irq[irq_index]->isr = ISR_NIC_TX; 1293 else if (strcmp(str, "ISR_MMC" ) == 0) irq[irq_index]->isr = ISR_MMC; 1294 else if (strcmp(str, "ISR_DMA" ) == 0) irq[irq_index]->isr = ISR_DMA; 1295 else if (strcmp(str, "ISR_SPI" ) == 0) irq[irq_index]->isr = ISR_SPI; 1296 else if (strcmp(str, "ISR_DEFAULT") == 0) irq[irq_index]->isr = ISR_DEFAULT; 1307 1297 else 1308 1298 { 1309 printf("[XML ERROR] missingIRQ <isr> for periph %d in cluster %d\n",1310 cluster_index, periph_loc_index);1299 printf("[XML ERROR] illegal IRQ <isr> for periph %d in cluster %d\n", 1300 periph_loc_index, cluster_index ); 1311 1301 exit(1); 1312 1302 } 1303 } 1304 else 1305 { 1306 printf("[XML ERROR] missing IRQ <isr> for periph %d in cluster %d\n", 1307 cluster_index, periph_loc_index); 1308 exit(1); 1313 1309 } 1314 1310 … … 1325 1321 { 1326 1322 irq[irq_index]->channel = 0; 1327 }1328 1329 ///////// get dstx attribute ... if PIC1330 if ( is_pic )1331 {1332 value = getIntValue(reader, "dstx", &ok);1333 if (ok)1334 {1335 #if XML_PARSER_DEBUG1336 printf(" dstx = %d\n", value);1337 #endif1338 1339 if ( value < header->x_size )1340 {1341 irq[irq_index]->dstx = value;1342 }1343 else1344 {1345 printf("[XML ERROR] IRQ <dstx> too large for periph %d in cluster %d\n",1346 cluster_index, periph_loc_index);1347 exit(1);1348 }1349 }1350 else1351 {1352 printf("[XML ERROR] missing IRQ <dstx> for periph %d in cluster %d\n",1353 cluster_index, periph_loc_index);1354 exit(1);1355 }1356 }1357 1358 ///////// get dsty attribute ... if PIC1359 if ( is_pic )1360 {1361 value = getIntValue(reader, "dsty", &ok);1362 if (ok)1363 {1364 #if XML_PARSER_DEBUG1365 printf(" dsty = %d\n", value);1366 #endif1367 1368 if ( value < header->y_size )1369 {1370 irq[irq_index]->dsty = value;1371 }1372 else1373 {1374 printf("[XML ERROR] IRQ <dsty> too large for periph %d in cluster %d\n",1375 cluster_index, periph_loc_index);1376 exit(1);1377 }1378 }1379 else1380 {1381 printf("[XML ERROR] missing IRQ <dsty> for periph %d in cluster %d\n",1382 cluster_index, periph_loc_index);1383 exit(1);1384 }1385 }1386 1387 ///////// get dstid attribute1388 value = getIntValue(reader, "dstid", &ok);1389 if (ok)1390 {1391 #if XML_PARSER_DEBUG1392 printf(" dstid = %d\n", value);1393 #endif1394 irq[irq_index]->dstid = value;1395 if (value >= 32)1396 {1397 printf("[XML ERROR] IRQ <dstid> too large for periph %d in cluster %d\n",1398 cluster_index, periph_loc_index);1399 exit(1);1400 }1401 }1402 else1403 {1404 printf("[XML ERROR] missing IRQ <dstid> for periph %d in cluster %d\n",1405 cluster_index, periph_loc_index);1406 exit(1);1407 1323 } 1408 1324 … … 1535 1451 { 1536 1452 periph[periph_index]->channels = 1; 1453 } 1454 1455 ///////// get arg attribute (optionnal : 0 if missing) 1456 value = getIntValue(reader, "arg", &ok); 1457 if (ok) 1458 { 1459 #if XML_PARSER_DEBUG 1460 printf(" arg = %d\n", value); 1461 #endif 1462 periph[periph_index]->arg = value; 1463 } 1464 else 1465 { 1466 periph[periph_index]->arg = 1; 1537 1467 } 1538 1468 … … 2473 2403 2474 2404 ///////// set other header fields 2475 header->increment = 0x10000;2476 2405 header->globals = 0; 2477 2406 header->vspaces = 0; … … 2619 2548 2620 2549 2621 /////////////////////////////////////////////////////////////////////// 2622 // this function set the value the vobj_id fiels ofall cp_ports2623 /////////////////////////////////////////////////////////////////////// 2550 /////////////////////////////////////////////////////////////////////////////////// 2551 // this function set the values of vspace_id and vobj_id fields for all cp_ports 2552 /////////////////////////////////////////////////////////////////////////////////// 2624 2553 void prepareBuild() 2625 2554 { 2626 2555 unsigned int i; 2627 //asign for all cp_ports the correct vspaceid and vobjid 2628 for (i = 0; i < cp_port_index; i++) { 2556 2557 for (i = 0; i < cp_port_index; i++) 2558 { 2629 2559 int vspace_id = getVspaceId(cp_port_vobj_ref[i]->vspace_name); 2630 if (vspace_id < 0) { 2560 if (vspace_id < 0) 2561 { 2631 2562 printf("[XML ERROR] illegal <vspacename> for cp_port %d,\n", i); 2632 2563 exit(1); … … 2634 2565 cp_port[i]->vspaceid = vspace_id; 2635 2566 2636 int vobj_id = getVobjLocId(vspace_id, cp_port_vobj_ref[i]->vobj_name, vspace[vspace_id]->vobjs); 2637 if (vobj_id >= 0) { 2567 int vobj_id = getVobjId( vspace_id, 2568 cp_port_vobj_ref[i]->vobj_name, 2569 vspace[vspace_id]->vobjs ); 2570 if (vobj_id >= 0) 2571 { 2638 2572 2639 2573 #if XML_PARSER_DEBUG … … 2643 2577 printf(" vobj_index = %d\n", vobj_id); 2644 2578 #endif 2645 cp_port[i]->mwmr_vobjid = vobj_id; 2646 2647 assert((vobj[ vspace[vspace_id]->vobj_offset + vobj_id]->type == VOBJ_TYPE_MWMR) 2648 && "coproc ports have to refer to a vobj of type MWMR"); 2649 } 2650 else { 2651 printf("[XML ERROR] illegal <vobjname> for cp_port %d,\n", i); 2579 cp_port[i]->mwmr_vobj_id = vobj_id; 2580 2581 assert((vobj[vspace[vspace_id]->vobj_offset + vobj_id]->type == VOBJ_TYPE_MWMR) 2582 && "coproc ports must refer a vobj of type MWMR"); 2583 } 2584 else 2585 { 2586 printf("[XML ERROR] <vobjname> not found for cp_port %d,\n", i); 2652 2587 exit(1); 2653 2588 } … … 2925 2860 file_write(fdout, "\n"); 2926 2861 2927 ld_write(fdout, "vseg_cluster_increment ", header->increment);2862 ld_write(fdout, "vseg_cluster_increment ", 0x00010000); 2928 2863 2929 2864 close(fdout);
Note: See TracChangeset
for help on using the changeset viewer.