- Timestamp:
- Aug 14, 2012, 8:14:55 PM (12 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/Makefile
r203 r204 4 4 LD=mipsel-unknown-elf-ld 5 5 DU=mipsel-unknown-elf-objdump 6 7 MAP_XML = 1c_4p_four.xml 6 8 7 9 SYS_OBJS = build/sys/vm_handler.o \ … … 57 59 58 60 ### mapping compilation 59 map.bin: 1c_4p_four.xml61 map.bin: $(MAP_XML) 60 62 $(MAKE) -C xml 61 63 xml/xml2bin $< $@ -
soft/giet_vm/boot/boot_init.c
r203 r204 286 286 void boot_puts(const char *buffer) 287 287 { 288 unsigned int* tty_address = (unsigned int*)&seg_tty_base; 288 unsigned int* tty_address = (unsigned int*)( (unsigned)&seg_tty_base + 289 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 289 290 unsigned int n; 290 291 … … 297 298 } 298 299 //////////////////////////////////////////////////////////////////////////// 299 // boot_put w()300 // boot_putx() 300 301 // (it uses TTY0) 301 302 //////////////////////////////////////////////////////////////////////////// 302 void boot_put w(unsigned int val)303 void boot_putx(unsigned int val) 303 304 { 304 305 static const char HexaTab[] = "0123456789ABCDEF"; … … 316 317 } 317 318 boot_puts(buf); 319 } 320 //////////////////////////////////////////////////////////////////////////// 321 // boot_putd() 322 // (it uses TTY0) 323 //////////////////////////////////////////////////////////////////////////// 324 void boot_putd(unsigned int val) 325 { 326 static const char DecTab[] = "0123456789"; 327 char buf[11]; 328 unsigned int i; 329 unsigned int first; 330 331 buf[10] = 0; 332 333 for ( i = 0 ; i < 10 ; i++ ) 334 { 335 if ((val != 0) || (i == 0)) 336 { 337 buf[9-i] = DecTab[val % 10]; 338 first = 9-i; 339 } 340 else 341 { 342 break; 343 } 344 val /= 10; 345 } 346 boot_puts( &buf[first] ); 318 347 } 319 348 … … 495 524 { 496 525 boot_puts("Unfound page table for vspace "); 497 boot_put w(vspace_id);526 boot_putd(vspace_id); 498 527 boot_puts("\n"); 499 528 boot_exit(); … … 530 559 if ( ( *pt_flags & PTE_V) != 0 ) // page already mapped 531 560 { 532 boot_puts("\n[BOOT ERROR] in boot_add_pte() function\n"); 533 boot_puts("page already mapped\n"); 561 boot_puts("\n[BOOT ERROR] double mapping in vspace "); 562 boot_putd( vspace_id ); 563 boot_puts(" for vpn = "); 564 boot_putx( vpn ); 565 boot_puts("\n"); 534 566 boot_exit(); 535 567 } … … 579 611 boot_puts( vseg[vseg_id].name ); 580 612 boot_puts(" : flags = "); 581 boot_put w( flags );613 boot_putx( flags ); 582 614 boot_puts(" / npages = "); 583 boot_put w( npages );615 boot_putd( npages ); 584 616 boot_puts(" / pbase = "); 585 boot_put w( vseg[vseg_id].pbase );617 boot_putx( vseg[vseg_id].pbase ); 586 618 boot_puts("\n"); 587 619 #endif … … 615 647 boot_puts( vseg[vseg_id].name ); 616 648 boot_puts(" / flags = "); 617 boot_put w( flags );649 boot_putx( flags ); 618 650 boot_puts(" / npages = "); 619 boot_put w( npages );651 boot_putd( npages ); 620 652 boot_puts(" / pbase = "); 621 boot_put w( vseg[vseg_id].pbase );653 boot_putx( vseg[vseg_id].pbase ); 622 654 boot_puts("\n"); 623 655 #endif … … 720 752 boot_puts( "\n[BOOT ERROR] in boot_vseg_map() function, " ); 721 753 boot_puts("PTAB too small, minumum size is: "); 722 boot_put w( PT1_SIZE + PT2_SIZE);754 boot_putx( PT1_SIZE + PT2_SIZE); 723 755 boot_exit(); 724 756 } … … 750 782 boot_puts("\n"); 751 783 boot_puts("vseg pbase = "); 752 boot_put w( vseg->pbase );784 boot_putx( vseg->pbase ); 753 785 boot_puts("\n"); 754 786 boot_puts("vseg length = "); 755 boot_put w( vseg->length );787 boot_putx( vseg->length ); 756 788 boot_puts("\n"); 757 789 boot_puts("pseg pbase = "); 758 boot_put w( pseg->base );790 boot_putx( pseg->base ); 759 791 boot_puts("\n"); 760 792 boot_puts("pseg length = "); 761 boot_put w( pseg->length );793 boot_putx( pseg->length ); 762 794 boot_puts("\n"); 763 795 boot_exit(); … … 771 803 boot_puts( vseg->name ); 772 804 boot_puts(" : len = "); 773 boot_put w( vseg->length );805 boot_putx( vseg->length ); 774 806 boot_puts(" / vbase = "); 775 boot_put w( vseg->vbase );807 boot_putx( vseg->vbase ); 776 808 boot_puts(" / pbase = "); 777 boot_put w( vseg->pbase );809 boot_putx( vseg->pbase ); 778 810 boot_puts("\n"); 779 811 #endif … … 795 827 { 796 828 boot_puts("\n[BOOT ERROR] Illegal mapping signature: "); 797 boot_put w(header->signature);829 boot_putx(header->signature); 798 830 boot_puts("\n"); 799 831 boot_exit(); … … 805 837 boot_puts("\n[BOOT ERROR] Incoherent NB_CLUSTERS"); 806 838 boot_puts("\n - In giet_config, value = "); 807 boot_put w( NB_CLUSTERS );839 boot_putd ( NB_CLUSTERS ); 808 840 boot_puts("\n - In mapping_info, value = "); 809 boot_put w( header->clusters );841 boot_putd ( header->clusters ); 810 842 boot_puts("\n"); 811 843 boot_exit(); … … 823 855 unsigned int periph_id; 824 856 unsigned int cluster_id; 825 unsigned int channels;826 857 unsigned int tty_found = 0; 827 858 unsigned int nic_found = 0; … … 832 863 { 833 864 boot_puts("\n[BOOT ERROR] too much processors in cluster "); 834 boot_put w( cluster_id );865 boot_putd( cluster_id ); 835 866 boot_puts(" : procs = "); 836 boot_put w( cluster[cluster_id].procs );867 boot_putd ( cluster[cluster_id].procs ); 837 868 boot_puts("\n"); 838 869 boot_exit(); … … 854 885 { 855 886 boot_puts("\n[BOOT ERROR] Wrong NB_TTYS in cluster "); 856 boot_put w( cluster_id );887 boot_putd( cluster_id ); 857 888 boot_puts(" : ttys = "); 858 boot_put w( periph[periph_id].channels );889 boot_putd ( periph[periph_id].channels ); 859 890 boot_puts("\n"); 860 891 boot_exit(); … … 873 904 { 874 905 boot_puts("\n[BOOT ERROR] Wrong NB_NICS in cluster "); 875 boot_put w( cluster_id );906 boot_putd( cluster_id ); 876 907 boot_puts(" : nics = "); 877 boot_put w( periph[periph_id].channels );908 boot_putd ( periph[periph_id].channels ); 878 909 boot_puts("\n"); 879 910 boot_exit(); … … 887 918 { 888 919 boot_puts("\n[BOOT ERROR] Too much user timers in cluster "); 889 boot_put w( cluster_id );920 boot_putd( cluster_id ); 890 921 boot_puts(" : timers = "); 891 boot_put w( periph[periph_id].channels );922 boot_putd ( periph[periph_id].channels ); 892 923 boot_puts("\n"); 893 924 boot_exit(); … … 900 931 { 901 932 boot_puts("\n[BOOT ERROR] Too much DMA channels in cluster "); 902 boot_put w( cluster_id );933 boot_putd( cluster_id ); 903 934 boot_puts(" : channels = "); 904 boot_put w( periph[periph_id].channels );935 boot_putd ( periph[periph_id].channels ); 905 936 boot_puts("\n"); 906 937 boot_exit(); … … 937 968 { 938 969 boot_puts("\n[BOOT ERROR] The number of processors in cluster "); 939 boot_put w( cluster_id );970 boot_putd( cluster_id ); 940 971 boot_puts(" is larger than NB_PROCS_MAX \n"); 941 972 boot_exit(); … … 959 990 #if BOOT_DEBUG_PT 960 991 boot_puts("cluster "); 961 boot_put w(cluster_id);992 boot_putd(cluster_id); 962 993 boot_puts(" / pseg "); 963 994 boot_puts(pseg[pseg_id].name); 964 995 boot_puts(" : next_base = "); 965 boot_put w(pseg[pseg_id].next_base);996 boot_putx(pseg[pseg_id].next_base); 966 997 boot_puts("\n"); 967 998 #endif … … 1028 1059 #if BOOT_DEBUG_PT 1029 1060 boot_puts("\n>>> page table physical address = "); 1030 boot_put w((unsigned int)boot_ptabs_paddr[vspace_id]);1061 boot_putx((unsigned int)boot_ptabs_paddr[vspace_id]); 1031 1062 boot_puts(", page table number of PT2 = "); 1032 boot_put w((unsigned int)boot_max_pt2[vspace_id]);1063 boot_putd((unsigned int)boot_max_pt2[vspace_id]); 1033 1064 boot_puts("\n"); 1034 1065 #endif … … 1082 1113 boot_puts( vobj[vobj_id].name); 1083 1114 boot_puts(" / depth = "); 1084 boot_put w( mwmr->depth );1115 boot_putd( mwmr->depth ); 1085 1116 boot_puts(" / width = "); 1086 boot_put w( mwmr->width );1117 boot_putd( mwmr->width ); 1087 1118 boot_puts("\n"); 1088 1119 #endif … … 1095 1126 boot_puts( vobj[vobj_id].name); 1096 1127 boot_puts(" / length = "); 1097 boot_put w( vobj[vobj_id].length );1128 boot_putx( vobj[vobj_id].length ); 1098 1129 boot_puts("\n"); 1099 1130 #endif … … 1106 1137 boot_puts( vobj[vobj_id].name); 1107 1138 boot_puts(" / length = "); 1108 boot_put w( vobj[vobj_id].length );1139 boot_putx( vobj[vobj_id].length ); 1109 1140 boot_puts("\n"); 1110 1141 #endif … … 1120 1151 boot_puts( vobj[vobj_id].name); 1121 1152 boot_puts(" / init_value = "); 1122 boot_put w( barrier->init );1153 boot_putd( barrier->init ); 1123 1154 boot_puts("\n"); 1124 1155 #endif … … 1142 1173 boot_puts( vobj[vobj_id].name); 1143 1174 boot_puts(" / length = "); 1144 boot_put w( vobj[vobj_id].length );1175 boot_putx( vobj[vobj_id].length ); 1145 1176 boot_puts("\n"); 1146 1177 #endif … … 1154 1185 boot_puts( vobj[vobj_id].name); 1155 1186 boot_puts(" / length = "); 1156 boot_put w( vobj[vobj_id].length );1187 boot_putx( vobj[vobj_id].length ); 1157 1188 boot_puts("\n"); 1158 1189 #endif … … 1173 1204 { 1174 1205 boot_puts("\n[INIT ERROR] Missing PTAB for vspace "); 1175 boot_put w( vspace_id );1206 boot_putd( vspace_id ); 1176 1207 boot_exit(); 1177 1208 } … … 1185 1216 volatile unsigned int *cbase = (unsigned int*) coproc; 1186 1217 1187 1188 1218 cbase[MWMR_CONFIG_FIFO_WAY] = way ; 1189 1219 cbase[MWMR_CONFIG_FIFO_NO] = no ; … … 1222 1252 #if BOOT_DEBUG_PERI 1223 1253 boot_puts("\n[BOOT DEBUG] ****** peripheral initialisation in cluster "); 1224 boot_put w( cluster_id );1254 boot_putd( cluster_id ); 1225 1255 boot_puts(" ******\n"); 1226 1256 #endif … … 1245 1275 #if BOOT_DEBUG_PERI 1246 1276 boot_puts("- IOC initialised : "); 1247 boot_put w( channels );1277 boot_putd( channels ); 1248 1278 boot_puts(" channels\n"); 1249 1279 #endif … … 1261 1291 #if BOOT_DEBUG_PERI 1262 1292 boot_puts("- DMA initialised : "); 1263 boot_put w( channels );1293 boot_putd( channels ); 1264 1294 boot_puts(" channels\n"); 1265 1295 #endif … … 1276 1306 #if BOOT_DEBUG_PERI 1277 1307 boot_puts("- NIC initialised : "); 1278 boot_put w( channels );1308 boot_putd( channels ); 1279 1309 boot_puts(" channels\n"); 1280 1310 #endif … … 1298 1328 #if BOOT_DEBUG_PERI 1299 1329 boot_puts("- IOB initialised : "); 1300 boot_put w( channels );1330 boot_putd( channels ); 1301 1331 boot_puts(" channels\n"); 1302 1332 #endif … … 1304 1334 1305 1335 } // end for periphs 1306 /* 1336 1307 1337 for ( coproc_id = cluster[cluster_id].coproc_offset ; 1308 1338 coproc_id < cluster[cluster_id].coproc_offset + cluster[cluster_id].coprocs ; … … 1315 1345 #if BOOT_DEBUG_PERI 1316 1346 boot_puts("[BOOT] mwmr coproc initialisation of "); 1317 boot_put w((unsigned int) coproc[coproc_id].name);1347 boot_putx((unsigned int) coproc[coproc_id].name); 1318 1348 boot_puts(", nb ports"); 1319 boot_put w((unsigned int)coproc[coproc_id].ports);1349 boot_putd((unsigned int)coproc[coproc_id].ports); 1320 1350 boot_puts("\n"); 1321 1351 #endif … … 1356 1386 } 1357 1387 } // end for coprocs 1358 */ 1388 1359 1389 } // end for clusters 1360 1390 } // end boot_peripherals_init() … … 1417 1447 #if BOOT_DEBUG_SCHED 1418 1448 boot_puts("\n[BOOT DEBUG] Initialise schedulers / IT vector in cluster "); 1419 boot_put w( cluster_id );1449 boot_putd( cluster_id ); 1420 1450 boot_puts("\n"); 1421 1451 #endif … … 1440 1470 { 1441 1471 boot_puts("\n[BOOT ERROR] Missing RAM pseg in cluster "); 1442 boot_put w( cluster_id );1472 boot_putd( cluster_id ); 1443 1473 boot_puts("\n"); 1444 1474 boot_exit(); … … 1459 1489 #if BOOT_DEBUG_SCHED 1460 1490 boot_puts("\nProc "); 1461 boot_put w( proc_id );1491 boot_putd( proc_id ); 1462 1492 boot_puts(" : scheduler pbase = "); 1463 boot_put w( pseg_pbase + (proc_id<<12) );1493 boot_putx( pseg_pbase + (proc_id<<12) ); 1464 1494 boot_puts("\n"); 1465 1495 #endif … … 1488 1518 #if BOOT_DEBUG_SCHED 1489 1519 boot_puts("- IRQ : icu = "); 1490 boot_put w( icu_id );1520 boot_putd( icu_id ); 1491 1521 boot_puts(" / type = "); 1492 boot_put w( type );1522 boot_putd( type ); 1493 1523 boot_puts(" / isr = "); 1494 boot_put w( isr_id );1524 boot_putd( isr_id ); 1495 1525 boot_puts(" / channel = "); 1496 boot_put w( channel );1526 boot_putd( channel ); 1497 1527 boot_puts("\n"); 1498 1528 #endif … … 1627 1657 { 1628 1658 boot_puts("\n[BOOT ERROR] : "); 1629 boot_put w( ltid );1659 boot_putd( ltid ); 1630 1660 boot_puts(" tasks allocated to processor "); 1631 boot_put w( gpid );1661 boot_putd( gpid ); 1632 1662 boot_puts(" / max is 15\n"); 1633 1663 boot_exit(); … … 1659 1689 boot_puts( task[task_id].name ); 1660 1690 boot_puts(" allocated to processor "); 1661 boot_put w( gpid );1691 boot_putd( gpid ); 1662 1692 boot_puts(" - ctx[LTID] = "); 1663 boot_put w( ltid );1693 boot_putd( ltid ); 1664 1694 boot_puts("\n"); 1665 1695 1666 1696 boot_puts(" - ctx[SR] = "); 1667 boot_put w( ctx_sr );1697 boot_putx( ctx_sr ); 1668 1698 boot_puts("\n"); 1669 1699 1670 1700 boot_puts(" - ctx[SR] = "); 1671 boot_put w( ctx_sp );1701 boot_putx( ctx_sp ); 1672 1702 boot_puts("\n"); 1673 1703 1674 1704 boot_puts(" - ctx[RA] = "); 1675 boot_put w( ctx_ra );1705 boot_putx( ctx_ra ); 1676 1706 boot_puts("\n"); 1677 1707 1678 1708 boot_puts(" - ctx[EPC] = "); 1679 boot_put w( ctx_epc );1709 boot_putx( ctx_epc ); 1680 1710 boot_puts("\n"); 1681 1711 1682 1712 boot_puts(" - ctx[PTPR] = "); 1683 boot_put w( ctx_ptpr );1713 boot_putx( ctx_ptpr ); 1684 1714 boot_puts("\n"); 1685 1715 1686 1716 boot_puts(" - ctx[TTY] = "); 1687 boot_put w( ctx_tty );1717 boot_putd( ctx_tty ); 1688 1718 boot_puts("\n"); 1689 1719 1690 1720 boot_puts(" - ctx[NIC] = "); 1691 boot_put w( ctx_nic );1721 boot_putd( ctx_nic ); 1692 1722 boot_puts("\n"); 1693 1723 1694 1724 boot_puts(" - ctx[TIMER] = "); 1695 boot_put w( ctx_timer );1725 boot_putd( ctx_timer ); 1696 1726 boot_puts("\n"); 1697 1727 1698 1728 boot_puts(" - ctx[FBDMA] = "); 1699 boot_put w( ctx_fbdma );1729 boot_putd( ctx_fbdma ); 1700 1730 boot_puts("\n"); 1701 1731 1702 1732 boot_puts(" - ctx[PTAB] = "); 1703 boot_put w( ctx_ptab );1733 boot_putx( ctx_ptab ); 1704 1734 boot_puts("\n"); 1705 1735 1706 1736 boot_puts(" - ctx[VSID] = "); 1707 boot_put w( vspace_id );1737 boot_putd( vspace_id ); 1708 1738 boot_puts("\n"); 1709 1739 … … 1732 1762 1733 1763 boot_puts("\n[BOOT] Mapping check completed at cycle "); 1734 boot_put w( boot_proctime() );1764 boot_putd( boot_proctime() ); 1735 1765 boot_puts("\n"); 1736 1766 … … 1739 1769 1740 1770 boot_puts("\n[BOOT] Pseg allocators initialisation completed at cycle "); 1741 boot_put w( boot_proctime() );1771 boot_putd( boot_proctime() ); 1742 1772 boot_puts("\n"); 1743 1773 … … 1746 1776 1747 1777 boot_puts("\n[BOOT] Page Tables initialisation completed at cycle "); 1748 boot_put w( boot_proctime() );1778 boot_putd( boot_proctime() ); 1749 1779 boot_puts("\n"); 1750 1780 … … 1753 1783 1754 1784 boot_puts("\n[BOOT] Vobjs initialisation completed at cycle : "); 1755 boot_put w( boot_proctime() );1785 boot_putd( boot_proctime() ); 1756 1786 boot_puts("\n"); 1757 1787 … … 1760 1790 1761 1791 boot_puts("\n[BOOT] Peripherals initialisation completed at cycle "); 1762 boot_put w( boot_proctime() );1792 boot_putd( boot_proctime() ); 1763 1793 boot_puts("\n"); 1764 1794 … … 1768 1798 1769 1799 boot_puts("\n[BOOT] MMU activation completed at cycle "); 1770 boot_put w( boot_proctime() );1800 boot_putd( boot_proctime() ); 1771 1801 boot_puts("\n"); 1772 1802 … … 1775 1805 1776 1806 boot_puts("\n[BOOT] Schedulers initialisation completed at cycle "); 1777 boot_put w( boot_proctime() );1807 boot_putd( boot_proctime() ); 1778 1808 boot_puts("\n"); 1779 1809 -
soft/giet_vm/boot/reset.S
r199 r204 65 65 nop 66 66 mfc0 a0, CP0_TIME 67 jal boot_put w67 jal boot_putx 68 68 nop 69 69 la a0, boot_lf_string … … 76 76 mfc0 k0, CP0_PROCID 77 77 andi a0, k0, 0xFFF 78 jal boot_put w78 jal boot_putx 79 79 nop 80 80 la a0, boot_lf_string … … 86 86 nop 87 87 mfc0 a0, CP0_EPC 88 jal boot_put w88 jal boot_putx 89 89 nop 90 90 la a0, boot_lf_string … … 96 96 nop 97 97 mfc0 a0, CP0_CR 98 jal boot_put w98 jal boot_putx 99 99 nop 100 100 la a0, boot_lf_string … … 106 106 nop 107 107 mfc0 a0, CP0_SR 108 jal boot_put w108 jal boot_putx 109 109 nop 110 110 la a0, boot_lf_string … … 116 116 nop 117 117 mfc0 a0, CP0_BVAR 118 jal boot_put w118 jal boot_putx 119 119 nop 120 120 la a0, boot_lf_string -
soft/giet_vm/giet_config.h
r203 r204 12 12 /* Debug parameters */ 13 13 14 #define BOOT_DEBUG_PERI 0 /* displayperipherals initialisation on TTY0 */15 #define BOOT_DEBUG_PT 0 /* displaypage tables initialisation on TTY0 */16 #define BOOT_DEBUG_VOBJS 0 /* displayvobjs initialisation on TTY0 */17 #define BOOT_DEBUG_SCHED 0 /* displayschedulers initialisation on TTY0 */14 #define BOOT_DEBUG_PERI 0 /* trace peripherals initialisation on TTY0 */ 15 #define BOOT_DEBUG_PT 0 /* trace page tables initialisation on TTY0 */ 16 #define BOOT_DEBUG_VOBJS 0 /* trace vobjs initialisation on TTY0 */ 17 #define BOOT_DEBUG_SCHED 0 /* trace schedulers initialisation on TTY0 */ 18 18 19 #define GIET_DEBUG_INIT 0 /* displayparallel kernel initialisation on TTY0 */20 #define GIET_DEBUG_SWITCH 0 /* displaycontext switchs on TTY0 */19 #define GIET_DEBUG_INIT 0 /* trace parallel kernel initialisation on TTY0 */ 20 #define GIET_DEBUG_SWITCH 0 /* trace context switchs on TTY0 */ 21 21 22 22 … … 25 25 /* hardware parameters */ 26 26 27 #define NB_CLUSTERS 1 /* number of clusters */ 28 #define CLUSTER_SPAN 0 /* address increment between clusters */ 29 #define NB_PROCS_MAX 4 /* max number of processors per cluster */ 30 #define NB_TIMERS_MAX 0 /* max number of user timers per cluster */ 31 #define NB_DMAS_MAX 1 /* max number of DMA channels per cluster*/ 32 #define NB_TTYS 8 /* total number of TTY channels */ 33 #define NB_IOCS 0 /* total number of IOC channels */ 34 #define NB_NICS 0 /* total number of NIC channels */ 27 #define NB_CLUSTERS 1 /* number of clusters */ 28 #define CLUSTER_SIZE 0x40000000 /* address increment between clusters */ 29 #define CLUSTER_IO_ID 0 /* cluster containing non replicated peripherals */ 30 31 #define NB_PROCS_MAX 4 /* max number of processors per cluster */ 32 #define NB_TIMERS_MAX 0 /* max number of user timers per cluster */ 33 #define NB_DMAS_MAX 1 /* max number of DMA channels per cluster*/ 34 #define NB_TTYS 8 /* total number of TTY channels */ 35 #define NB_IOCS 0 /* total number of IOC channels */ 36 #define NB_NICS 0 /* total number of NIC channels */ 35 37 36 38 /* software parameters */ 37 39 38 #define GIET_NB_VSPACE_MAX 4 39 #define GIET_TICK_VALUE 0x4000 40 #define GIET_IOMMU_ACTIVE 0 /* The IOMMU vspace is defined */41 #define GIET_USE_XICU 1 /* Use the XICU interrupt controler */40 #define GIET_NB_VSPACE_MAX 4 /* max number of virtual spaces */ 41 #define GIET_TICK_VALUE 0x4000 /* context switch period (number of cycles) */ 42 #define GIET_IOMMU_ACTIVE 0 /* The IOMMU vspace is defined */ 43 #define GIET_USE_XICU 1 /* Use the XICU interrupt controler */ 42 44 43 45 #endif -
soft/giet_vm/libs/stdio.c
r203 r204 21 21 #define SYSCALL_GCD_WRITE 0x06 22 22 #define SYSCALL_GCD_READ 0x07 23 #define SYSCALL_TTY_READ_IRQ 0x0A24 #define SYSCALL_TTY_WRITE_IRQ 0x0B25 23 #define SYSCALL_CTX_SWITCH 0x0D 26 24 #define SYSCALL_EXIT 0x0E … … 165 163 0,0); 166 164 } 167 168 ////////////////////////////////////////////////////////////////////////////////////169 // giet_tty_getc_no_irq()170 ////////////////////////////////////////////////////////////////////////////////////171 // This blocking function fetches a single ascii character from a terminal.172 // The terminal index must be defined in the task context in the boot phase.173 // It doesn't use the IRQ_GET interrupt, and the associated kernel buffer.174 // - Returns necessarily 0 when completed.175 ////////////////////////////////////////////////////////////////////////////////////176 unsigned int giet_tty_getc_no_irq(char *byte)177 {178 unsigned int ret = 0;179 while (ret == 0)180 {181 ret = sys_call(SYSCALL_TTY_READ,182 (unsigned int)byte,183 1,184 0,0);185 }186 return 0;187 }188 165 //////////////////////////////////////////////////////////////////////////////////// 189 166 // giet_tty_getc() … … 199 176 while (ret == 0) 200 177 { 201 ret = sys_call(SYSCALL_TTY_READ _IRQ,178 ret = sys_call(SYSCALL_TTY_READ, 202 179 (unsigned int)byte, 203 180 1, … … 231 208 { 232 209 do { 233 ret = sys_call(SYSCALL_TTY_READ _IRQ,210 ret = sys_call(SYSCALL_TTY_READ, 234 211 (unsigned int)(&byte), 235 212 1, … … 283 260 { 284 261 do { 285 ret = sys_call(SYSCALL_TTY_READ _IRQ,262 ret = sys_call(SYSCALL_TTY_READ, 286 263 (unsigned int)(&byte), 287 264 1, -
soft/giet_vm/sys/drivers.c
r203 r204 17 17 // 18 18 // The following global parameters must be defined in the giet_config.h file: 19 // - CLUSTER_IO_ID 20 // - CLUSTER_SIZE 19 21 // - NB_CLUSTERS 20 22 // - NB_PROCS_MAX … … 23 25 // - NB_TTYS 24 26 // 25 // The following virtual base addresses must be defined in the sys.ld file:27 // The following virtual base addresses must be defined in the giet.ld file: 26 28 // - seg_icu_base 27 29 // - seg_tim_base … … 31 33 // - seg_fbf_base 32 34 // - seg_ioc_base 35 // As some peripherals can be replicated in the clusters (ICU, TIMER, DMA) 36 // These addresses must be completed by an offset depending on the cluster index 37 // full_base_address = seg_***_base + cluster_id * CLUSTER_SIZE 33 38 /////////////////////////////////////////////////////////////////////////////////// 34 39 … … 54 59 #endif 55 60 56 #if !defined(CLUSTER_S PAN)57 # error: You must define CLUSTER_S PANin 'giet_config.h' file61 #if !defined(CLUSTER_SIZE) 62 # error: You must define CLUSTER_SIZE in 'giet_config.h' file 58 63 #endif 59 64 … … 132 137 133 138 #if GIET_USE_XICU 134 unsigned int* timer_address = (unsigned int*) &seg_icu_base +135 (cluster_id * CLUSTER_S PAN);139 unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base + 140 (cluster_id * CLUSTER_SIZE) ); 136 141 137 142 timer_address[XICU_REG(XICU_PTI_PER, local_id)] = period; 138 143 #else 139 unsigned int* timer_address = (unsigned int*) &seg_tim_base +140 (cluster_id * CLUSTER_S PAN);144 unsigned int* timer_address = (unsigned int*)((char*)&seg_tim_base + 145 (cluster_id * CLUSTER_SIZE) ); 141 146 142 147 timer_address[local_id * TIMER_SPAN + TIMER_PERIOD] = period; … … 160 165 161 166 #if GIET_USE_XICU 162 unsigned int* timer_address = (unsigned int*) &seg_icu_base +163 (cluster_id * CLUSTER_S PAN);167 unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base + 168 (cluster_id * CLUSTER_SIZE) ); 164 169 165 170 timer_address[XICU_REG(XICU_PTI_PER, local_id)] = 0; 166 171 #else 167 unsigned int* timer_address = (unsigned int*) &seg_tim_base +168 (cluster_id * CLUSTER_S PAN);172 unsigned int* timer_address = (unsigned int*)((char*)&seg_tim_base + 173 (cluster_id * CLUSTER_SIZE) ); 169 174 170 175 timer_address[local_id * TIMER_SPAN + TIMER_MODE] = 0; … … 176 181 // _timer_reset_irq() 177 182 // This function acknowlegge a timer interrupt in the vci_timer (or vci_xicu) 178 // component by writing in the proper register the period value.183 // component by reading/writing in the proper register. 179 184 // It can be used by both the isr_switch() for a "system" timer, 180 185 // or by the _isr_timer() for an "user" timer. … … 189 194 190 195 #if GIET_USE_XICU 191 unsigned int* timer_address = (unsigned int*) &seg_icu_base +192 (cluster_id * CLUSTER_SPAN);196 unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base + 197 (cluster_id * (unsigned)CLUSTER_SIZE) ); 193 198 194 199 unsigned int bloup = timer_address[XICU_REG(XICU_PTI_ACK, local_id)]; 200 bloup++; // to avoid a warning 195 201 #else 196 unsigned int* timer_address = (unsigned int*) &seg_tim_base +197 (cluster_id * CLUSTER_S PAN);202 unsigned int* timer_address = (unsigned int*)((char*)&seg_tim_base + 203 (cluster_id * CLUSTER_SIZE) ); 198 204 199 205 timer_address[local_id * TIMER_SPAN + TIMER_RESETIRQ] = 0; … … 258 264 } 259 265 260 unsigned int* tty_address = (unsigned int*)&seg_tty_base + tty_id*TTY_SPAN; 266 unsigned int* tty_address = (unsigned int*)( (char*)&seg_tty_base + 267 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 261 268 262 269 for (nwritten = 0; nwritten < length; nwritten++) 263 270 { 264 271 // check tty's status 265 if ((tty_address[ TTY_STATUS] & 0x2) == 0x2)272 if ((tty_address[tty_id*TTY_SPAN + TTY_STATUS] & 0x2) == 0x2) 266 273 break; 267 274 else 268 275 // write character 269 tty_address[ TTY_WRITE] = (unsigned int)buffer[nwritten];276 tty_address[tty_id*TTY_SPAN + TTY_WRITE] = (unsigned int)buffer[nwritten]; 270 277 } 271 278 return nwritten; 272 279 } 273 280 ////////////////////////////////////////////////////////////////////////////// 274 // _tty_read _irq()281 // _tty_read() 275 282 // This non-blocking function uses the TTY_GET_IRQ[tty_id] interrupt and 276 283 // the associated kernel buffer, that has been written by the ISR. 284 // It get the TTY terminal index from the context of the current task. 277 285 // It fetches one single character from the _tty_get_buf[tty_id] kernel 278 286 // buffer, writes this character to the user buffer, and resets the 279 287 // _tty_get_full[tty_id] buffer. 288 // The length argument is not used. 280 289 // Returns 0 if the kernel buffer is empty, 1 if the buffer is full. 281 290 ////////////////////////////////////////////////////////////////////////////// 282 unsigned int _tty_read _irq( char *buffer,283 291 unsigned int _tty_read( char *buffer, 292 unsigned int length) 284 293 { 285 294 unsigned int task_id = _get_current_task_id(); … … 304 313 } 305 314 //////////////////////////////////////////////////////////////////////////////// 306 // _tty_read() 307 // This non-blocking function fetches one character directly from the TTY_READ 308 // register of the TTY controler, and writes this character to the user buffer. 309 // It doesn't use the TTY_GET_IRQ interrupt and the associated kernel buffer. 310 // Returns 0 if the register is empty, 1 if the register is full. 311 //////////////////////////////////////////////////////////////////////////////// 312 unsigned int _tty_read( char *buffer, 313 unsigned int length) 314 { 315 unsigned int task_id = _get_current_task_id(); 316 unsigned int tty_id = _get_context_slot(task_id, CTX_TTY_ID); 317 318 if ( tty_id >= NB_TTYS ) 319 { 320 _tty_error( task_id ); 321 return 0; 322 } 323 324 unsigned int* tty_address = (unsigned int*)&seg_tty_base + tty_id*TTY_SPAN; 325 326 if ((tty_address[TTY_STATUS] & 0x1) != 0x1) 327 { 328 return 0; 329 } 330 else 331 { 332 *buffer = (char)tty_address[TTY_READ]; 333 return 1; 334 } 315 // _tty_get_char() 316 // This function is used by the _isr_tty to read a character in the TTY 317 // terminal defined by the tty_id argument. The character is stored 318 // in requested buffer, and the IRQ is acknowledged. 319 // Returns 0 if success, 1 if tty_id too large. 320 //////////////////////////////////////////////////////////////////////////////// 321 unsigned int _tty_get_char( unsigned int tty_id, 322 char* buffer ) 323 { 324 // checking argument 325 if ( tty_id >= NB_TTYS ) return 1; 326 327 // compute terminal base address 328 unsigned int *tty_address = (unsigned int*)( (char*)&seg_tty_base + 329 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 330 331 *buffer = (unsigned char)tty_address[tty_id*TTY_SPAN + TTY_READ]; 332 return 0; 335 333 } 336 334 … … 359 357 if ( proc_id >= NB_PROCS_MAX ) return 1; 360 358 361 unsigned int* icu_address = (unsigned int*) &seg_icu_base +362 (cluster_id * CLUSTER_SPAN);359 unsigned int* icu_address = (unsigned int*)( (char*)&seg_icu_base + 360 (cluster_id * (unsigned)CLUSTER_SIZE) ); 363 361 #if GIET_USE_XICU 364 362 if ( is_timer ) icu_address[XICU_REG(XICU_MSK_PTI_ENABLE, proc_id)] = value; … … 385 383 if ( proc_id >= NB_PROCS_MAX ) return 1; 386 384 387 unsigned int* icu_address = (unsigned int*) &seg_icu_base +388 (cluster_id * CLUSTER_SPAN);385 unsigned int* icu_address = (unsigned int*)( (char*)&seg_icu_base + 386 (cluster_id * (unsigned)CLUSTER_SIZE) ); 389 387 #if GIET_USE_XICU 390 388 unsigned int prio = icu_address[XICU_REG(XICU_PRIO, proc_id)]; … … 422 420 unsigned int value) 423 421 { 424 volatile unsigned int *gcd_address;425 426 422 // parameters checking 427 423 if (register_index >= GCD_END) 428 424 return 1; 429 425 430 gcd_address = (unsigned int*)&seg_gcd_base; 426 unsigned int* gcd_address = (unsigned int*)( (char*)&seg_gcd_base + 427 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 431 428 432 429 gcd_address[register_index] = value; // write word … … 441 438 unsigned int *buffer) 442 439 { 443 volatile unsigned int *gcd_address;444 445 440 // parameters checking 446 441 if (register_index >= GCD_END) 447 442 return 1; 448 443 449 gcd_address = (unsigned int*)&seg_gcd_base; 444 unsigned int* gcd_address = (unsigned int*)( (char*)&seg_gcd_base + 445 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 450 446 451 447 *buffer = gcd_address[register_index]; // read word … … 538 534 if ( (unsigned int)user_vaddr & 0x3 ) return 1; 539 535 540 unsigned int* ioc_address = (unsigned int*)&seg_ioc_base; 536 unsigned int* ioc_address = (unsigned int*)( (char*)&seg_ioc_base + 537 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 538 541 539 unsigned int block_size = ioc_address[BLOCK_DEVICE_BLOCK_SIZE]; 542 540 unsigned int length = count*block_size; … … 630 628 if ( GIET_IOMMU_ACTIVE ) 631 629 { 632 unsigned int* iob_address = (unsigned int*)&seg_iob_base; 630 unsigned int* iob_address = (unsigned int*)( (char*)&seg_iob_base + 631 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 633 632 634 633 for ( ix2 = 0 ; ix2 < _ioc_iommu_npages ; ix2++ ) … … 687 686 (unsigned int)buffer, 688 687 count ); 688 } 689 /////////////////////////////////////////////////////////////////////////////// 690 // _ioc_get_status() 691 // This function returns the transfert status, and acknowledge the IRQ. 692 // Returns 0 if success, > 0 if error. 693 /////////////////////////////////////////////////////////////////////////////// 694 unsigned int _ioc_get_status(unsigned int* status) 695 { 696 // get IOC base address 697 unsigned int* ioc_address = (unsigned int*)( (char*)&seg_ioc_base + 698 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 699 700 *status = ioc_address[BLOCK_DEVICE_STATUS]; // read status & reset IRQ 701 return 0; 689 702 } 690 703 … … 718 731 in_unckdata unsigned int _dma_iommu_npages[NB_DMAS_MAX * NB_CLUSTERS]; 719 732 #endif 733 734 ////////////////////////////////////////////////////////////////////////////////// 735 // _dma_reset_irq() 736 ////////////////////////////////////////////////////////////////////////////////// 737 unsigned int _dma_reset_irq( unsigned int cluster_id, 738 unsigned int local_id ) 739 { 740 // parameters checking 741 if ( cluster_id >= NB_CLUSTERS ) return 1; 742 if ( local_id >= NB_DMAS_MAX ) return 1; 743 744 // compute DMA base address 745 unsigned int* dma_address = (unsigned int*)( (char*)&seg_dma_base + 746 (cluster_id * (unsigned)CLUSTER_SIZE) ); 747 748 dma_address[local_id*DMA_SPAN + DMA_RESET] = 0; 749 return 0; 750 } 751 ////////////////////////////////////////////////////////////////////////////////// 752 // _dma_get_status() 753 ////////////////////////////////////////////////////////////////////////////////// 754 unsigned int _dma_get_status( unsigned int cluster_id, 755 unsigned int local_id, 756 unsigned int* status ) 757 { 758 // parameters checking 759 if ( cluster_id >= NB_CLUSTERS ) return 1; 760 if ( local_id >= NB_DMAS_MAX ) return 1; 761 762 // compute DMA base address 763 unsigned int* dma_address = (unsigned int*)( (char*)&seg_dma_base + 764 (cluster_id * (unsigned)CLUSTER_SIZE) ); 765 766 *status = dma_address[local_id*DMA_SPAN + DMA_LEN]; 767 return 0; 768 } 720 769 721 770 ////////////////////////////////////////////////////////////////////////////////// … … 819 868 unsigned int cluster_id = dma_id / NB_DMAS_MAX; 820 869 unsigned int loc_id = dma_id % NB_DMAS_MAX; 821 unsigned int* dma_base = (unsigned int*)&seg_dma_base + 822 (cluster_id * CLUSTER_SPAN) +823 ( loc_id * DMA_SPAN);824 870 871 unsigned int* dma_base = (unsigned int*)( (char*)&seg_dma_base + 872 (cluster_id * (unsigned)CLUSTER_SIZE) ); 873 825 874 // check user buffer address and length alignment 826 875 if ( (user_vaddr & 0x3) || (length & 0x3) ) … … 930 979 931 980 */ 981 932 982 // invalidate data cache in case of memory write 933 983 if ( to_user ) _dcache_buf_invalidate( (void*)user_vaddr, length ); … … 939 989 if ( to_user ) 940 990 { 941 dma_base[ DMA_SRC] = (unsigned int)fb_pbase;942 dma_base[ DMA_DST] = (unsigned int)user_pbase;991 dma_base[loc_id*DMA_SPAN + DMA_SRC] = (unsigned int)fb_pbase; 992 dma_base[loc_id*DMA_SPAN + DMA_DST] = (unsigned int)user_pbase; 943 993 } 944 994 else 945 995 { 946 dma_base[ DMA_SRC] = (unsigned int)user_pbase;947 dma_base[ DMA_DST] = (unsigned int)fb_pbase;948 } 949 dma_base[ DMA_LEN] = (unsigned int)length;996 dma_base[loc_id*DMA_SPAN + DMA_SRC] = (unsigned int)user_pbase; 997 dma_base[loc_id*DMA_SPAN + DMA_DST] = (unsigned int)fb_pbase; 998 } 999 dma_base[loc_id*DMA_SPAN + DMA_LEN] = (unsigned int)length; 950 1000 951 1001 return 0; … … 1011 1061 if ( GIET_IOMMU_ACTIVE ) 1012 1062 { 1013 unsigned int* iob_address = (unsigned int*)&seg_iob_base; 1063 unsigned int* iob_address = (unsigned int*)( (char*)&seg_iob_base + 1064 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) ); 1065 1014 1066 unsigned int ix1 = _dma_iommu_ix1 + dma_id; 1015 1067 unsigned int ix2; -
soft/giet_vm/sys/drivers.h
r203 r204 40 40 unsigned int length); 41 41 42 unsigned int _tty_ read_irq( char* buffer,43 unsigned int length);42 unsigned int _tty_get_char( unsigned int tty_id, 43 char* buffer); 44 44 45 45 /////////////////////////////////////////////////////////////////////////////////// … … 77 77 unsigned int _ioc_completed(); 78 78 79 unsigned int _ioc_get_status( unsigned int* status); 80 79 81 /////////////////////////////////////////////////////////////////////////////////// 80 82 // Multi DMA variables (vci_multi_dma) … … 86 88 extern unsigned int _dma_iommu_ix1; 87 89 extern unsigned int _dma_iommu_npages[]; 90 91 unsigned int _dma_reset_irq( unsigned int cluster_id, 92 unsigned int local_id ); 93 94 unsigned int _dma_get_status( unsigned int cluster_id, 95 unsigned int local_id, 96 unsigned int* status ); 88 97 89 98 /////////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/sys/irq_handler.c
r203 r204 92 92 // compute cluster_id and loc_id 93 93 unsigned int cluster_id = channel_id / NB_DMAS_MAX; 94 unsigned int loc_id = channel_id % NB_DMAS_MAX; 95 96 // compute DMA channel address 97 unsigned int* dma_address = (unsigned int*)&seg_dma_base + 98 (loc_id * DMA_SPAN) + 99 (cluster_id * CLUSTER_SPAN); 94 unsigned int local_id = channel_id % NB_DMAS_MAX; 100 95 101 96 // save DMA channel status 102 _dma_status[channel_id] = dma_address[DMA_LEN]; 103 104 // reset DMA channel 105 dma_address[DMA_RESET] = 0; 97 if ( _dma_get_status(cluster_id, local_id, &_dma_status[channel_id]) ) 98 { 99 _get_lock(&_tty_put_lock); 100 _puts("[GIET ERROR] illegal DMA channel detected by _isr_dma\n"); 101 _release_lock(&_tty_put_lock); 102 return; 103 } 104 105 // reset DMA channel irq 106 if ( _dma_reset_irq(cluster_id, local_id) ) 107 { 108 _get_lock(&_tty_put_lock); 109 _puts("[GIET ERROR] illegal DMA channel detected by _isr_dma\n"); 110 _release_lock(&_tty_put_lock); 111 return; 112 } 106 113 107 114 // release DMA channel … … 117 124 void _isr_ioc() 118 125 { 119 unsigned int* ioc_address = (unsigned int*)&seg_ioc_base; 120 121 _ioc_status = ioc_address[BLOCK_DEVICE_STATUS]; // save status & reset IRQ 122 _ioc_done = 1; // signals completion 126 // save status & reset IRQ 127 if ( _ioc_get_status( &_ioc_status ) ) 128 { 129 _get_lock(&_tty_put_lock); 130 _puts("[GIET ERROR] bad access to IOC status detected by _isr_ioc\n"); 131 _release_lock(&_tty_put_lock); 132 return; 133 } 134 135 // signals completion 136 _ioc_done = 1; 123 137 } 124 138 … … 148 162 _puts("[GIET ERROR] Strange... User timer ISR for a system timer\n"); 149 163 _release_lock(&_tty_put_lock); 164 return; 150 165 } 151 166 152 167 // aknowledge IRQ 153 _timer_reset_irq( cluster_id, local_id ); 168 if ( _timer_reset_irq( cluster_id, local_id ) ) 169 { 170 _get_lock(&_tty_put_lock); 171 _puts("[GIET ERROR] illegal timer index detected by _isr_timer\n"); 172 _release_lock(&_tty_put_lock); 173 return; 174 } 154 175 155 176 #if NB_TIMERS_MAX … … 172 193 // This ISR handles the IRQs generated by the multi_tty controler, 173 194 // signaling that a character is available. 174 // There is one single multi_tty component controling all TTYs, and the tty_id175 // a rgument is the global TTY index.195 // There is one single multi_tty component controling all TTYs, 196 // and the tty_id // argument is the global TTY index. 176 197 // There is one communication buffer _tty_buf[tty_id] per terminal. 177 198 // The sychronisation variable _tty_full[tty_id], is set by the ISR, … … 181 202 void _isr_tty(unsigned int tty_id) 182 203 { 183 // compute terminal base address184 unsigned int *tty_address = (unsigned int*)&seg_tty_base + (tty_id * TTY_SPAN);185 186 204 // save character and reset IRQ 187 _tty_get_buf[tty_id] = (unsigned char)tty_address[TTY_READ]; 205 if ( _tty_get_char( tty_id, &_tty_get_buf[tty_id] ) ) 206 { 207 _get_lock(&_tty_put_lock); 208 _puts("[GIET ERROR] illegal tty index detected by _isr_tty\n"); 209 _release_lock(&_tty_put_lock); 210 return; 211 } 188 212 189 213 // signals character available … … 207 231 208 232 // acknowledge IRQ 209 _timer_reset_irq( cluster_id, local_id ); 233 if ( _timer_reset_irq( cluster_id, local_id ) ) 234 { 235 _get_lock(&_tty_put_lock); 236 _puts("[GIET ERROR] illegal proc index detected by _isr_switch\n"); 237 _release_lock(&_tty_put_lock); 238 return; 239 } 210 240 211 241 // performs the context switch -
soft/giet_vm/sys/sys_handler.c
r203 r204 32 32 &_sys_ukn, /* 0x08 */ 33 33 &_sys_ukn, /* 0x09 */ 34 &_ tty_read_irq,/* 0x0A */34 &_sys_ukn, /* 0x0A */ 35 35 &_sys_ukn, /* 0x0B */ 36 36 &_sys_ukn, /* 0x0C */ -
soft/giet_vm/xml/xml_driver.c
r189 r204 218 218 fprintf( fpout, "<?xml version = \"1.0\"?>\n\n"); 219 219 220 fprintf( fpout, "<mapping_info signature = \"0x%x\"\n", header->signature); 221 fprintf( fpout, " name = \"%s\"\n", header->name); 222 fprintf( fpout, " clusters = \"%d\"\n", header->clusters); 223 fprintf( fpout, " vspaces = \"%d\"\n", header->vspaces); 224 fprintf( fpout, " globals = \"%d\" >\n\n", header->globals); 220 fprintf( fpout, "<mapping_info signature = \"0x%x\" ", header->signature); 221 fprintf( fpout, " name = \"%s\" ", header->name); 222 fprintf( fpout, " clusters = \"%d\" ", header->clusters); 223 fprintf( fpout, " vspaces = \"%d\" >\n\n", header->vspaces); 225 224 226 225 ///////////////////// clusters /////////////////////////////////////////////// … … 231 230 fprintf( fpout, " <cluster index = \"%d\" >\n", cluster_id); 232 231 for ( pseg_id = cluster[cluster_id].pseg_offset ; 233 234 235 { 236 fprintf( fpout, " <pseg name = \"%s\"\n",pseg[pseg_id].name);237 fprintf( fpout, " type = \"%s\"\n",pseg_type[pseg[pseg_id].type]);238 fprintf( fpout, " base = \"0x%x\"\n",pseg[pseg_id].base);239 fprintf( fpout, " 232 pseg_id < cluster[cluster_id].pseg_offset + cluster[cluster_id].psegs ; 233 pseg_id++ ) 234 { 235 fprintf( fpout, " <pseg name = \"%s\" ", pseg[pseg_id].name); 236 fprintf( fpout, " type = \"%s\" ", pseg_type[pseg[pseg_id].type]); 237 fprintf( fpout, " base = \"0x%x\" ", pseg[pseg_id].base); 238 fprintf( fpout, " length = \"0x%x\" />\n", pseg[pseg_id].length); 240 239 } 241 240 … … 243 242 244 243 for ( proc_id = cluster[cluster_id].proc_offset ; 245 proc_id < cluster[cluster_id].proc_offset + cluster[cluster_id].procs ; 246 proc_id++ ) 247 { 248 fprintf( fpout, " <proc index = \"%d\" >\n", proc_id); 249 for ( irq_id = proc[proc_id].irq_offset ; irq_id < proc[proc_id].irq_offset + proc[proc_id].irqs ; irq_id++ ) 244 proc_id < cluster[cluster_id].proc_offset + cluster[cluster_id].procs ; 245 proc_id++ ) 246 { 247 fprintf( fpout, " <proc index = \"%d\" >\n", proc_id); 248 for ( irq_id = proc[proc_id].irq_offset ; 249 irq_id < proc[proc_id].irq_offset + proc[proc_id].irqs ; 250 irq_id++ ) 250 251 { 251 fprintf( fpout, " <irq type = \"%s\"\n",irq_type[irq[irq_id].type]);252 fprintf( fpout, " icuid = \"0x%x\"\n",irq[irq_id].icuid);253 fprintf( fpout, " isr = \"%s\"\n",isr_type[irq[irq_id].isr]);254 fprintf( fpout, " channel = \"0x%x\" />\n",irq[irq_id].channel);252 fprintf( fpout, " <irq type = \"%s\" ", irq_type[irq[irq_id].type]); 253 fprintf( fpout, " icuid = \"0x%x\" ", irq[irq_id].icuid); 254 fprintf( fpout, " isr = \"%s\" ", isr_type[irq[irq_id].isr]); 255 fprintf( fpout, " channel = \"0x%x\" />\n", irq[irq_id].channel); 255 256 } 256 fprintf( fpout, " 257 fprintf( fpout, " </proc>\n" ); 257 258 } 258 259 … … 261 262 262 263 for ( coproc_id = cluster[cluster_id].coproc_offset ; 263 coproc_id < cluster[cluster_id].coproc_offset + cluster[cluster_id].coprocs ; 264 coproc_id++ ) 265 { 266 fprintf( fpout, " <coproc name = \"%s\"\n", coproc[coproc_id].name); 267 fprintf( fpout, " psegname = \"%s\" >\n", pseg[coproc[coproc_id].psegid].name); 268 for ( port_id = coproc[coproc_id].port_offset ; port_id < coproc[coproc_id].port_offset + coproc[coproc_id].ports ; port_id++ ) 264 coproc_id < cluster[cluster_id].coproc_offset + cluster[cluster_id].coprocs ; 265 coproc_id++ ) 266 { 267 fprintf( fpout, " <coproc name = \"%s\" ", coproc[coproc_id].name); 268 fprintf( fpout, " psegname = \"%s\" >\n", pseg[coproc[coproc_id].psegid].name); 269 for ( port_id = coproc[coproc_id].port_offset ; 270 port_id < coproc[coproc_id].port_offset + coproc[coproc_id].ports ; 271 port_id++ ) 269 272 { 270 273 unsigned int vobj_id = cp_port[port_id].vobjlocid + vspace[cp_port[port_id].vspaceid].vobj_offset; 271 fprintf( fpout, " <port direction = \"%s\"\n", port_direction[ cp_port[port_id].direction]);272 fprintf( fpout, " vspacename = \"%s\"\n",vspace[cp_port[port_id].vspaceid].name);273 fprintf( fpout, " vobjname= \"%s\" />\n", vobj[vobj_id].name);274 fprintf( fpout, " <port direction = \"%s\" ", port_direction[ cp_port[port_id].direction]); 275 fprintf( fpout, " vspacename = \"%s\" ", vspace[cp_port[port_id].vspaceid].name); 276 fprintf( fpout, " vobjname = \"%s\" />\n", vobj[vobj_id].name); 274 277 } 275 fprintf( fpout, " 278 fprintf( fpout, " </coproc>\n" ); 276 279 } 277 280 … … 279 282 280 283 for ( periph_id = cluster[cluster_id].periph_offset ; 281 282 283 { 284 fprintf( fpout, " <periph type = \"%s\"\n",periph_type[periph[periph_id].type]);285 fprintf( fpout, " psegname = \"%s\"\n",pseg[periph[periph_id].psegid].name);286 fprintf( fpout, " channels= \"%d\" />\n", periph[periph_id].channels);284 periph_id < cluster[cluster_id].periph_offset + cluster[cluster_id].periphs ; 285 periph_id++ ) 286 { 287 fprintf( fpout, " <periph type = \"%s\" ", periph_type[periph[periph_id].type]); 288 fprintf( fpout, " psegname = \"%s\" ", pseg[periph[periph_id].psegid].name); 289 fprintf( fpout, " channels = \"%d\" />\n", periph[periph_id].channels); 287 290 } 288 291 fprintf( fpout, " </cluster>\n" ); … … 297 300 unsigned int pseg_id = vseg[vseg_id].psegid; 298 301 299 fprintf( fpout, " <vseg name = \"%s\"\n",vseg[vseg_id].name);300 fprintf( fpout, " vbase = \"0x%x\"\n",vseg[vseg_id].vbase);301 fprintf( fpout, " mode = \"%s\"\n", mode_str[vseg[vseg_id].mode]);302 fprintf( fpout, " clusterid = \"%d\"\n",pseg[pseg_id].cluster);303 fprintf( fpout, " psegname = \"%s\"\n",pseg[pseg_id].name);304 fprintf( fpout, " ident = \"%d\" >\n",vseg[vseg_id].ident);302 fprintf( fpout, " <vseg name = \"%s\" ", vseg[vseg_id].name); 303 fprintf( fpout, "vbase = \"0x%x\" ", vseg[vseg_id].vbase); 304 fprintf( fpout, "mode = \"%s\" ", mode_str[vseg[vseg_id].mode]); 305 fprintf( fpout, "clusterid = \"%d\" ", pseg[pseg_id].cluster); 306 fprintf( fpout, "psegname = \"%s\" ", pseg[pseg_id].name); 307 fprintf( fpout, "ident = \"%d\" >\n", vseg[vseg_id].ident); 305 308 for ( vobj_id = vseg[vseg_id].vobj_offset; 306 309 vobj_id < (vseg[vseg_id].vobj_offset + vseg[vseg_id].vobjs); 307 310 vobj_id++ ) 308 311 { 309 fprintf( fpout, " <vobj name = \"%s\"\n",vobj[vobj_id].name);310 fprintf( fpout, " type = \"%s\"\n",vobj_type[vobj[vobj_id].type]);311 fprintf( fpout, " length = \"0x%x\"\n",vobj[vobj_id].length);312 fprintf( fpout, " align = \"%d\"\n",vobj[vobj_id].align);313 fprintf( fpout, " init = \"%d\" \n",vobj[vobj_id].init);314 fprintf( fpout, " binpath= \"%s\" />\n", vobj[vobj_id].binpath);312 fprintf( fpout, " <vobj name = \"%s\" ", vobj[vobj_id].name); 313 fprintf( fpout, "type = \"%s\" ", vobj_type[vobj[vobj_id].type]); 314 fprintf( fpout, "length = \"0x%x\" ", vobj[vobj_id].length); 315 fprintf( fpout, "align = \"%d\" ", vobj[vobj_id].align); 316 fprintf( fpout, "init = \"%d\" ", vobj[vobj_id].init); 317 fprintf( fpout, "binpath = \"%s\" />\n", vobj[vobj_id].binpath); 315 318 } 316 319 fprintf( fpout, " </vseg>\n"); … … 324 327 { 325 328 unsigned int func_id = vspace[vspace_id].vobj_offset + vspace[vspace_id].start_offset; 326 fprintf( fpout, " <vspace name = \"%s\"\n",vspace[vspace_id].name);327 fprintf( fpout, " startname = \"%s\" >\n\n", vobj[func_id].name);329 fprintf( fpout, " <vspace name = \"%s\" ", vspace[vspace_id].name); 330 fprintf( fpout, " startname = \"%s\" >\n", vobj[func_id].name); 328 331 329 332 for ( vseg_id = vspace[vspace_id].vseg_offset ; 330 vseg_id < (vspace[vspace_id].vseg_offset + vspace[vspace_id].vsegs) ; vseg_id++ ) 333 vseg_id < (vspace[vspace_id].vseg_offset + vspace[vspace_id].vsegs) ; 334 vseg_id++ ) 331 335 { 332 336 unsigned int pseg_id = vseg[vseg_id].psegid; 333 337 334 fprintf( fpout, " <vseg name = \"%s\"\n",vseg[vseg_id].name);335 fprintf( fpout, " vbase = \"0x%x\"\n",vseg[vseg_id].vbase);336 fprintf( fpout, " mode = \"%s\"\n", mode_str[vseg[vseg_id].mode]);337 fprintf( fpout, " clusterid = \"%d\"\n",pseg[pseg_id].cluster);338 fprintf( fpout, " psegname = \"%s\"\n",pseg[pseg_id].name);339 fprintf( fpout, " ident = \"%d\" >\n",vseg[vseg_id].ident);338 fprintf( fpout, " <vseg name = \"%s\" ", vseg[vseg_id].name); 339 fprintf( fpout, "vbase = \"0x%x\" ", vseg[vseg_id].vbase); 340 fprintf( fpout, "mode = \"%s\" ", mode_str[vseg[vseg_id].mode]); 341 fprintf( fpout, "clusterid = \"%d\" ", pseg[pseg_id].cluster); 342 fprintf( fpout, "psegname = \"%s\" ", pseg[pseg_id].name); 343 fprintf( fpout, "ident = \"%d\" >\n", vseg[vseg_id].ident); 340 344 341 345 for ( vobj_id = vseg[vseg_id].vobj_offset ; … … 343 347 vobj_id++ ) 344 348 { 345 fprintf( fpout, " <vobj name = \"%s\"\n",vobj[vobj_id].name);346 fprintf( fpout, " type = \"%s\" \n",vobj_type[vobj[vobj_id].type]);347 fprintf( fpout, " length = \"0x%x\" \n", vobj[vobj_id].length);348 fprintf( fpout, " align = \"%d\" \n",vobj[vobj_id].align);349 fprintf( fpout, " init = \"%d\" \n",vobj[vobj_id].init);350 fprintf( fpout, " binpath= \"%s\" />\n", vobj[vobj_id].binpath);349 fprintf( fpout, " <vobj name = \"%s\" ", vobj[vobj_id].name); 350 fprintf( fpout, "type = \"%s\" ", vobj_type[vobj[vobj_id].type]); 351 fprintf( fpout, "length = \"0x%x\" ", vobj[vobj_id].length); 352 fprintf( fpout, "align = \"%d\" ", vobj[vobj_id].align); 353 fprintf( fpout, "init = \"%d\" ", vobj[vobj_id].init); 354 fprintf( fpout, "binpath = \"%s\" />\n", vobj[vobj_id].binpath); 351 355 } 352 fprintf( fpout, " </vseg>\n");356 fprintf( fpout, " </vseg>\n\n"); 353 357 } 354 358 for ( task_id = vspace[vspace_id].task_offset ; … … 358 362 unsigned int vobj_id = task[task_id].vobjlocid + vspace[vspace_id].vobj_offset; 359 363 360 fprintf( fpout, " <task name = \"%s\"\n",task[task_id].name);361 fprintf( fpout, " clusterid = \"%d\"\n",task[task_id].clusterid);362 fprintf( fpout, " proclocid = \"%d\"\n",task[task_id].proclocid);363 fprintf( fpout, " stackname = \"%s\"\n",vobj[vobj_id].name);364 fprintf( fpout, " startid = \"%d\"\n",task[task_id].startid);365 fprintf( fpout, " usetty = \"%d\"\n",task[task_id].use_tty);366 fprintf( fpout, " usenic = \"%d\"\n",task[task_id].use_nic);367 fprintf( fpout, " usetimer = \"%d\"\n",task[task_id].use_timer);368 fprintf( fpout, " usefbma = \"%d\" />\n\n", task[task_id].use_fbdma);364 fprintf( fpout, " <task name = \"%s\" ", task[task_id].name); 365 fprintf( fpout, "clusterid = \"%d\" ", task[task_id].clusterid); 366 fprintf( fpout, "proclocid = \"%d\" ", task[task_id].proclocid); 367 fprintf( fpout, "stackname = \"%s\" ", vobj[vobj_id].name); 368 fprintf( fpout, "startid = \"%d\" ", task[task_id].startid); 369 fprintf( fpout, "usetty = \"%d\" ", task[task_id].use_tty); 370 fprintf( fpout, "usenic = \"%d\" ", task[task_id].use_nic); 371 fprintf( fpout, "usetimer = \"%d\" ", task[task_id].use_timer); 372 fprintf( fpout, "usefbma = \"%d\" />\n", task[task_id].use_fbdma); 369 373 } 370 374 fprintf( fpout, " </vspace>\n\n"); -
soft/giet_vm/xml/xml_parser.c
r203 r204 1565 1565 else if ( strcmp(tag, "globalset") == 0 ) 1566 1566 { 1567 // checking source file consistency1568 if ( vseg_index != header->globals )1569 {1570 printf("[XML ERROR] Wrong number of global vsegs\n");1571 exit(1);1572 }1573 else1574 {1575 1567 #if XML_PARSER_DEBUG 1576 1568 printf(" end global set\n\n"); 1577 1569 #endif 1578 vseg_loc_index = 0;1579 return;1580 }1570 header->globals = vseg_index; 1571 vseg_loc_index = 0; 1572 return; 1581 1573 } 1582 1574 else … … 1703 1695 } 1704 1696 1705 ////////// get globals attribute1706 value = getIntValue(reader, "globals", &ok);1707 if ( ok )1708 {1709 if ( value >= MAX_VSEGS )1710 {1711 printf("[XML ERROR] The number of globals is larger than %d\n", MAX_VSEGS);1712 exit(1);1713 }1714 #if XML_PARSER_DEBUG1715 printf(" globals = %d\n", value);1716 #endif1717 header->globals = value;1718 }1719 else1720 {1721 printf("[XML ERROR] illegal or missing <globals> attribute in mapping_info_header\n");1722 exit(1);1723 }1724 1725 1697 //////// initialise non replicated peripherals cluster_id 1726 1698 header->tty_clusterid = 0xFFFFFFFF;
Note: See TracChangeset
for help on using the changeset viewer.