Changeset 306 for soft/giet_vm/giet_xml/xml_parser.c
- Timestamp:
- Apr 21, 2014, 5:14:17 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_xml/xml_parser.c
r299 r306 1 ////////////////////////////////////////////////////////////////////////////////////// /1 ////////////////////////////////////////////////////////////////////////////////////// 2 2 // File : xml_parser.c 3 3 // Date : 14/04/2012 … … 124 124 unsigned int use_pic = 0; // using PIC component 125 125 unsigned int use_xcu = 0; // using XCU (not ICU) 126 unsigned int use_fbf = 0; // using Frame Buffer 126 127 127 128 // These variables define the IOC peripheral subtype … … 622 623 } 623 624 624 ////////// get p roclocidattribute625 value = getIntValue(reader, "p roclocid", &ok);625 ////////// get p attribute 626 value = getIntValue(reader, "p", &ok); 626 627 if (ok) 627 628 { … … 639 640 else 640 641 { 641 printf("[XML ERROR] illegal or missing < locprocid> attribute for task (%d,%d)\n",642 printf("[XML ERROR] illegal or missing <p> attribute for task (%d,%d)\n", 642 643 vspace_index, task_loc_index); 643 644 exit(1); … … 805 806 else if (ok && (strcmp(str, "MEMSPACE") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_MEMSPACE; } 806 807 else if (ok && (strcmp(str, "SCHED") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_SCHED; } 807 else if (ok && (strcmp(str, "BOOT") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_BOOT; }808 808 else 809 809 { … … 850 850 } 851 851 852 ////////// get binpath attribute (optional : '\0'if missing)852 ////////// get binpath attribute (optional : "" if missing) 853 853 str = getStringValue(reader, "binpath", &ok); 854 854 if (ok) … … 859 859 strncpy(vobj[vobj_index]->binpath, str, 63); 860 860 } 861 else { 862 vobj[vobj_index]->binpath[0] = '\0'; 863 } 864 865 ////////// get init attribute (mandatory for mwmr and barrier) 861 else 862 { 863 vobj[vobj_index]->binpath[0] = 0; 864 } 865 866 ////////// get init attribute (optional, mandatory for mwmr and barrier) 866 867 value = getIntValue(reader, "init", &ok); 867 868 if (ok) … … 915 916 vseg[vseg_index] = (mapping_vseg_t *) malloc(sizeof(mapping_vseg_t)); 916 917 917 ////////// set vobj_offset attribute s918 ////////// set vobj_offset attribute 918 919 vseg[vseg_index]->vobj_offset = vobj_index; 919 920 … … 1015 1016 printf(" psegid = %d\n", psegid); 1016 1017 #endif 1017 if ( index>= 0)1018 if (psegid >= 0) 1018 1019 { 1019 1020 vseg[vseg_index]->psegid = psegid; … … 1211 1212 char * str; 1212 1213 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 1213 1218 if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return; 1214 1219 … … 1223 1228 1224 1229 irq[irq_index] = (mapping_irq_t *) malloc(sizeof(mapping_irq_t)); 1225 1226 ///////// get srctype attribute1227 str = getStringValue(reader, "srctype", &ok);1228 if (ok)1229 {1230 #if XML_PARSER_DEBUG1231 printf(" srctype = %s\n", str);1232 #endif1233 if ( strcmp(str, "HWI") == 0 ) irq[irq_index]->srctype = IRQ_TYPE_HWI;1234 else if ( strcmp(str, "WTI") == 0 ) irq[irq_index]->srctype = IRQ_TYPE_WTI;1235 else if ( strcmp(str, "PTI") == 0 ) irq[irq_index]->srctype = IRQ_TYPE_PTI;1236 else1237 {1238 printf("[XML ERROR] illegal IRQ <srctype> for periph %d in cluster %d\n",1239 cluster_index, periph_loc_index);1240 exit(1);1241 }1242 }1243 else1244 {1245 printf("[XML ERROR] missing IRQ <srctype> for periph %d in cluster %d\n",1246 cluster_index, periph_loc_index);1247 exit(1);1248 }1249 1230 1250 1231 ///////// get srcid attribute … … 1265 1246 else 1266 1247 { 1267 printf("[XML ERROR] missing IRQ < icuid> for periph %d in cluster %d\n",1248 printf("[XML ERROR] missing IRQ <srcid> for periph %d in cluster %d\n", 1268 1249 cluster_index, periph_loc_index); 1269 1250 exit(1); 1270 1251 } 1271 1252 1272 ///////// get isr attribute 1273 str = getStringValue(reader, "isr", &ok); 1274 if (ok) 1275 { 1253 ///////// get srctype attribute ... if ICU or XCU 1254 if ( is_icu ) 1255 { 1256 str = getStringValue(reader, "srctype", &ok); 1257 if (ok) 1258 { 1259 #if XML_PARSER_DEBUG 1260 printf(" srctype = %s\n", str); 1261 #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", 1275 cluster_index, periph_loc_index); 1276 exit(1); 1277 } 1278 } 1279 1280 ///////// get isr attribute ... if ICU or XCU 1281 if ( is_icu ) 1282 { 1283 str = getStringValue(reader, "isr", &ok); 1284 if (ok) 1285 { 1276 1286 #if XML_PARSER_DEBUG 1277 1287 printf(" isr = %s\n", str); 1278 1288 #endif 1279 if (strcmp(str, "ISR_TICK" ) == 0) irq[irq_index]->isr = ISR_TICK; 1280 else if (strcmp(str, "ISR_BDV" ) == 0) irq[irq_index]->isr = ISR_BDV; 1281 else if (strcmp(str, "ISR_CMA" ) == 0) irq[irq_index]->isr = ISR_CMA; 1282 else if (strcmp(str, "ISR_TTY_RX" ) == 0) irq[irq_index]->isr = ISR_TTY_RX; 1283 else if (strcmp(str, "ISR_TTY_TX" ) == 0) irq[irq_index]->isr = ISR_TTY_TX; 1284 else if (strcmp(str, "ISR_TIMER" ) == 0) irq[irq_index]->isr = ISR_TIMER; 1285 else if (strcmp(str, "ISR_WAKUP" ) == 0) irq[irq_index]->isr = ISR_WAKUP; 1286 else if (strcmp(str, "ISR_NIC_RX" ) == 0) irq[irq_index]->isr = ISR_NIC_RX; 1287 else if (strcmp(str, "ISR_NIC_TX" ) == 0) irq[irq_index]->isr = ISR_NIC_TX; 1288 else if (strcmp(str, "ISR_MMC" ) == 0) irq[irq_index]->isr = ISR_MMC; 1289 else if (strcmp(str, "ISR_DEFAULT") == 0) irq[irq_index]->isr = ISR_DEFAULT; 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 } 1290 1307 else 1291 1308 { 1292 printf("[XML ERROR] illegalIRQ <isr> for periph %d in cluster %d\n",1293 periph_loc_index, cluster_index);1309 printf("[XML ERROR] missing IRQ <isr> for periph %d in cluster %d\n", 1310 cluster_index, periph_loc_index); 1294 1311 exit(1); 1295 1312 } 1296 }1297 else1298 {1299 printf("[XML ERROR] missing IRQ <isr> for periph %d in cluster %d\n",1300 cluster_index, periph_loc_index);1301 exit(1);1302 1313 } 1303 1314 … … 1316 1327 } 1317 1328 1318 ///////// get dstx attribute 1319 value = getIntValue(reader, "dstx", &ok); 1320 if (ok) 1321 { 1329 ///////// get dstx attribute ... if PIC 1330 if ( is_pic ) 1331 { 1332 value = getIntValue(reader, "dstx", &ok); 1333 if (ok) 1334 { 1322 1335 #if XML_PARSER_DEBUG 1323 1336 printf(" dstx = %d\n", value); 1324 1337 #endif 1325 1338 1326 if ( value < header->x_size ) 1327 { 1328 irq[irq_index]->dstx = value; 1329 } 1330 else 1331 { 1332 printf("[XML ERROR] IRQ <dstx> too large for periph %d in cluster %d\n", 1339 if ( value < header->x_size ) 1340 { 1341 irq[irq_index]->dstx = value; 1342 } 1343 else 1344 { 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 else 1351 { 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 PIC 1359 if ( is_pic ) 1360 { 1361 value = getIntValue(reader, "dsty", &ok); 1362 if (ok) 1363 { 1364 #if XML_PARSER_DEBUG 1365 printf(" dsty = %d\n", value); 1366 #endif 1367 1368 if ( value < header->y_size ) 1369 { 1370 irq[irq_index]->dsty = value; 1371 } 1372 else 1373 { 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 else 1380 { 1381 printf("[XML ERROR] missing IRQ <dsty> for periph %d in cluster %d\n", 1333 1382 cluster_index, periph_loc_index); 1334 1383 exit(1); 1335 1384 } 1336 }1337 else1338 {1339 printf("[XML ERROR] missing IRQ <dstx> for periph %d in cluster %d\n",1340 cluster_index, periph_loc_index);1341 exit(1);1342 }1343 1344 ///////// get dsty attribute1345 value = getIntValue(reader, "dsty", &ok);1346 if (ok)1347 {1348 #if XML_PARSER_DEBUG1349 printf(" dsty = %d\n", value);1350 #endif1351 1352 if ( value < header->y_size )1353 {1354 irq[irq_index]->dsty = value;1355 }1356 else1357 {1358 printf("[XML ERROR] IRQ <dsty> too large for periph %d in cluster %d\n",1359 cluster_index, periph_loc_index);1360 exit(1);1361 }1362 }1363 else1364 {1365 printf("[XML ERROR] missing IRQ <dsty> for periph %d in cluster %d\n",1366 cluster_index, periph_loc_index);1367 exit(1);1368 1385 } 1369 1386 … … 1575 1592 { 1576 1593 periph[periph_index]->type = PERIPH_TYPE_FBF; 1594 use_fbf = 1; 1577 1595 } 1578 1596 ///////////////////////////////// … … 1597 1615 periph[periph_index]->subtype = PERIPH_SUBTYPE_BDV; 1598 1616 ioc_channels = 1; 1599 if ( header->use_ram disk == 0 ) use_bdv = 1;1617 if ( header->use_ram_disk == 0 ) use_bdv = 1; 1600 1618 } 1601 1619 else if ( strcmp(subtype, "HBA") == 0 ) … … 1604 1622 periph[periph_index]->subtype = PERIPH_SUBTYPE_HBA; 1605 1623 ioc_channels = periph[periph_index]->channels; 1606 if ( header->use_ram disk == 0 ) use_hba = 1;1624 if ( header->use_ram_disk == 0 ) use_hba = 1; 1607 1625 } 1608 1626 else if ( strcmp(subtype, "SPI") == 0 ) … … 1611 1629 periph[periph_index]->subtype = PERIPH_SUBTYPE_SPI; 1612 1630 ioc_channels = periph[periph_index]->channels; 1613 if ( header->use_ram disk == 0 ) use_spi = 1;1631 if ( header->use_ram_disk == 0 ) use_spi = 1; 1614 1632 } 1615 1633 else … … 1924 1942 if (ok && (value != proc_loc_index)) 1925 1943 { 1926 printf("[XML ERROR] wrong proc index / expected value is %d",1944 printf("[XML ERROR] wrong local proc index / expected value is %d", 1927 1945 proc_loc_index); 1928 1946 exit(1); … … 2124 2142 { 2125 2143 ///////// TIMER and ICU peripheral are mandatory when nprocs != 0 2144 2126 2145 unsigned int procs = cluster[cluster_index]->procs; 2127 2146 if ( procs && !found_timer && !found_xcu) … … 2439 2458 } 2440 2459 2441 ///////// get use_ram disk attribute (default = 0)2442 value = getIntValue(reader, "use_ram disk", &ok);2443 if (ok) 2444 { 2445 #if XML_PARSER_DEBUG 2446 printf(" use_ram disk = %d\n", value);2447 #endif 2448 header->use_ram disk = value;2449 } 2450 else 2451 { 2452 header->use_ram disk = 0;2460 ///////// get use_ram_disk attribute (default = 0) 2461 value = getIntValue(reader, "use_ram_disk", &ok); 2462 if (ok) 2463 { 2464 #if XML_PARSER_DEBUG 2465 printf(" use_ram_disk = %d\n", value); 2466 #endif 2467 header->use_ram_disk = value; 2468 } 2469 else 2470 { 2471 header->use_ram_disk = 0; 2453 2472 } 2454 2473 … … 2707 2726 def_int_write(fdout, "USE_IOB ", use_iob); 2708 2727 def_int_write(fdout, "USE_PIC ", use_pic); 2728 def_int_write(fdout, "USE_FBF ", use_fbf); 2709 2729 2710 2730 file_write(fdout, "\n"); 2711 2731 2712 def_int_write(fdout, "USE_IOC_RDK ", header->use_ram disk);2732 def_int_write(fdout, "USE_IOC_RDK ", header->use_ram_disk); 2713 2733 def_int_write(fdout, "USE_IOC_HBA ", use_hba); 2714 2734 def_int_write(fdout, "USE_IOC_BDV ", use_bdv);
Note: See TracChangeset
for help on using the changeset viewer.