Changeset 263
- Timestamp:
- Dec 19, 2013, 9:36:48 AM (11 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/gameoflife/main.c
r251 r263 125 125 126 126 127 ///////////// 127 //////////////////////////////////////// 128 128 __attribute__((constructor)) void main() 129 129 { 130 unsigned int proc_id = giet_procid();// processor id131 unsigned int nlocal_procs = (unsigned int) NB_PROCS_MAX; // number ofprocessors per cluster132 unsigned int nclusters = (unsigned int) NB_CLUSTERS;// number of clusters133 unsigned int local_id = proc_id % nlocal_procs;// local processor id134 unsigned int cluster_id = proc_id / nlocal_procs;// cluster id135 unsigned int nglobal_procs = nclusters * nlocal_procs;// number of tasks130 unsigned int proc_id = giet_procid(); // processor id 131 unsigned int nlocal_procs = NB_PROCS_MAX; // processors per cluster 132 unsigned int nclusters = X_SIZE*Y_SIZE; // number of clusters 133 unsigned int local_id = proc_id % nlocal_procs; // local processor id 134 unsigned int cluster_id = proc_id / nlocal_procs; // cluster id 135 unsigned int nglobal_procs = nclusters * nlocal_procs; // number of tasks 136 136 size_t i; 137 137 138 size_t nb_line 139 size_t base_line 138 size_t nb_line = HEIGHT / nglobal_procs; 139 size_t base_line = nb_line * proc_id; 140 140 141 141 PRINTF("*** Starting init at cycle %d ***\n", giet_proctime()); -
soft/giet_vm/giet_boot/boot.c
r262 r263 11 11 // physicals addresses can have up to 40 bits, and use the (unsigned long long) type. 12 12 // It natively supports clusterised shared mmemory multi-processors architectures, 13 // where each processor is identified by a composite index (cluster_ id, local_id),13 // where each processor is identified by a composite index (cluster_xy, local_id), 14 14 // and where there is one physical memory bank per cluster. 15 15 // … … 61 61 // Each PT2 contains 512 PTE2 of 8bytes => 4K bytes. 62 62 // The total size of a page table is finally = 8K + (GIET_NB_PT2_MAX)*4K bytes. 63 //////////////////////////////////////////////////////////////////////////////////// 63 /////////////////////////////////////////////////////////////////////////////////////// 64 // Implementation Notes: 65 // 66 // 1) The cluster_id variable is a linear index in the mapping_info array of clusters. 67 // We use the cluster_xy variable for the tological index = x << Y_WIDTH + y 68 /////////////////////////////////////////////////////////////////////////////////////// 64 69 65 70 // for vobjs initialisation 71 #include <giet_config.h> 66 72 #include <mwmr_channel.h> 67 73 #include <barrier.h> … … 87 93 #include <stdarg.h> 88 94 89 #if !defined(NB_CLUSTERS) 90 # error The NB_CLUSTERS value must be defined in the 'giet_config.h' file ! 95 #if !defined(X_SIZE) 96 # error The X_SIZE value must be defined in the 'hard_config.h' file ! 97 #endif 98 99 #if !defined(Y_SIZE) 100 # error The Y_SIZE value must be defined in the 'hard_config.h' file ! 101 #endif 102 103 #if !defined(X_WIDTH) 104 # error The X_WIDTH value must be defined in the 'hard_config.h' file ! 105 #endif 106 107 #if !defined(Y_WIDTH) 108 # error The Y_WIDTH value must be defined in the 'hard_config.h' file ! 91 109 #endif 92 110 93 111 #if !defined(NB_PROCS_MAX) 94 # error The NB_PROCS_MAX value must be defined in the ' giet_config.h' file !112 # error The NB_PROCS_MAX value must be defined in the 'hard_config.h' file ! 95 113 #endif 96 114 … … 116 134 unsigned int _ptabs_vaddr[GIET_NB_VSPACE_MAX]; 117 135 118 // Scheduler pointers array (virtual addresses)119 __attribute__((section (".bootdata")))120 static_scheduler_t* _schedulers[NB_CLUSTERS * NB_PROCS_MAX];121 122 136 // Next free PT2 index array 123 137 __attribute__((section (".bootdata"))) … … 129 143 unsigned int _max_pt2[GIET_NB_VSPACE_MAX] = 130 144 { [0 ... GIET_NB_VSPACE_MAX - 1] = 0 }; 145 146 // Scheduler pointers array (virtual addresses) 147 // indexed by (x,y,lpid) : ((x << Y_WIDTH) + y)*NB_PROCS_MAX + lpid 148 __attribute__((section (".bootdata"))) 149 static_scheduler_t* _schedulers[NB_PROCS_MAX<<(X_WIDTH+Y_WIDTH)]; 131 150 132 151 … … 147 166 _exit(); 148 167 } 168 149 169 // checking number of clusters 150 if (header->clusters != NB_CLUSTERS) 151 { 152 _puts("\n[BOOT ERROR] Incoherent NB_CLUSTERS"); 153 _puts("\n - In giet_config, value = "); 154 _putd(NB_CLUSTERS); 155 _puts("\n - In mapping_info, value = "); 156 _putd(header->clusters); 170 if ( (header->x_size != X_SIZE) || 171 (header->y_size != Y_SIZE) || 172 (header->x_width != X_WIDTH) || 173 (header->y_width != Y_WIDTH) ) 174 { 175 _puts("\n[BOOT ERROR] Incoherent X_SIZE or Y_SIZE "); 176 _puts("\n - In hard_config: X_SIZE = "); 177 _putd( X_SIZE ); 178 _puts(" / Y_SIZE = "); 179 _putd( Y_SIZE ); 180 _puts(" / X_WIDTH = "); 181 _putd( X_WIDTH ); 182 _puts(" / Y_WIDTH = "); 183 _putd( Y_WIDTH ); 184 _puts("\n - In mapping_info: x_size = "); 185 _putd( header->x_size ); 186 _puts(" / y_size = "); 187 _putd( header->y_size ); 188 _puts(" / x_width = "); 189 _putd( header->x_width ); 190 _puts(" / y_width = "); 191 _putd( header->y_width ); 157 192 _puts("\n"); 158 193 _exit(); … … 167 202 168 203 #if BOOT_DEBUG_MAPPING 169 _puts("\n - clusters = "); 170 _putd( header->clusters ); 204 _puts("\n - x_size = "); 205 _putd( header->x_size ); 206 _puts("\n - y_size = "); 207 _putd( header->y_size ); 171 208 _puts("\n - procs = "); 172 209 _putd( header->procs ); … … 196 233 _puts("\n"); 197 234 198 unsigned int 235 unsigned int cluster_id; 199 236 mapping_cluster_t * cluster = _get_cluster_base(header); 200 for (cluster_id = 0; cluster_id < NB_CLUSTERS; cluster_id++)237 for( cluster_id = 0; cluster_id < X_SIZE*Y_SIZE ; cluster_id++) 201 238 { 202 _puts("\n cluster = "); 203 _putd( cluster_id ); 204 _puts("\n procs = "); 205 _putd( cluster[cluster_id].procs ); 206 _puts("\n psegs = "); 207 _putd( cluster[cluster_id].psegs ); 208 _puts("\n periphs = "); 209 _putd( cluster[cluster_id].periphs ); 210 _puts("\n"); 239 _puts("\n - cluster["); 240 _putd( cluster[cluster_id].x ); 241 _puts(","); 242 _putd( cluster[cluster_id].y ); 243 _puts("]\n procs = "); 244 _putd( cluster[cluster_id].procs ); 245 _puts("\n psegs = "); 246 _putd( cluster[cluster_id].psegs ); 247 _puts("\n periphs = "); 248 _putd( cluster[cluster_id].periphs ); 249 _puts("\n"); 211 250 } 212 251 #endif … … 1069 1108 { 1070 1109 if ( (vobj[vseg[vseg_id].vobj_offset].type == VOBJ_TYPE_SCHED) && 1071 (pseg[vseg[vseg_id].psegid].cluster == cluster_id ) )1110 (pseg[vseg[vseg_id].psegid].clusterid == cluster_id ) ) 1072 1111 { 1073 1112 *vbase = vseg[vseg_id].vbase; … … 1078 1117 if ( found == 0 ) 1079 1118 { 1080 _puts("\n[BOOT ERROR] No vobj of type SCHED in cluster "); 1081 _putd(cluster_id); 1082 _puts("\n"); 1119 mapping_cluster_t* cluster = _get_cluster_base(header); 1120 _puts("\n[BOOT ERROR] No vobj of type SCHED in cluster ["); 1121 _putd( cluster[cluster_id].x ); 1122 _puts(","); 1123 _putd( cluster[cluster_id].y ); 1124 _puts("]\n"); 1083 1125 _exit(); 1084 1126 } … … 1119 1161 unsigned int alloc_cma_channel = 0; // CMA channel allocator 1120 1162 unsigned int alloc_hba_channel = 0; // IOC channel allocator 1121 unsigned int alloc_tim_channel[ NB_CLUSTERS];// user TIMER allocators1163 unsigned int alloc_tim_channel[X_SIZE*Y_SIZE]; // user TIMER allocators 1122 1164 1123 1165 ///////////////////////////////////////////////////////////////////////// … … 1129 1171 // and lpid to access the schedulers array. 1130 1172 // - the _schedulers[] array of pointers can contain "holes", because 1131 // it is indexed by the global pid = cluster_ id*NB_PROCS_MAX + lpid1173 // it is indexed by the global pid = cluster_xy*NB_PROCS_MAX + lpid 1132 1174 // - the mapping info array of processors is contiguous, it is indexed 1133 1175 // by proc_id, and use an offset specific in each cluster. 1134 1176 1135 for (cluster_id = 0; cluster_id < header->clusters; cluster_id++) 1136 { 1177 for (cluster_id = 0 ; cluster_id < X_SIZE*Y_SIZE ; cluster_id++) 1178 { 1179 unsigned int x = cluster[cluster_id].x; 1180 unsigned int y = cluster[cluster_id].y; 1181 unsigned int cluster_xy = (x<<Y_WIDTH) + y; 1137 1182 1138 1183 #if BOOT_DEBUG_SCHED 1139 _puts("\n[BOOT DEBUG] Initialise schedulers in cluster "); 1140 _putd(cluster_id); 1141 _puts("\n"); 1142 #endif 1143 1184 _puts("\n[BOOT DEBUG] Initialise schedulers in cluster["); 1185 _putd( x ); 1186 _puts(","); 1187 _putd( y ); 1188 _puts("]\n"); 1189 #endif 1144 1190 alloc_tim_channel[cluster_id] = NB_PROCS_MAX; 1145 1191 … … 1154 1200 if ( nprocs > NB_PROCS_MAX ) 1155 1201 { 1156 _puts("\n[BOOT ERROR] Too much processors in cluster "); 1157 _putd(cluster_id); 1158 _puts("\n"); 1202 _puts("\n[BOOT ERROR] Too much processors in cluster["); 1203 _putd( x ); 1204 _puts(","); 1205 _putd( y ); 1206 _puts("]\n"); 1159 1207 _exit(); 1160 1208 } … … 1166 1214 if ( sched_length < (nprocs<<12) ) 1167 1215 { 1168 _puts("\n[BOOT ERROR] Schedulers segment too small in cluster "); 1169 _putd(cluster_id); 1170 _puts("\n"); 1216 _puts("\n[BOOT ERROR] Schedulers segment too small in cluster["); 1217 _putd( x ); 1218 _puts(","); 1219 _putd( y ); 1220 _puts("]\n"); 1171 1221 _exit(); 1172 1222 } … … 1177 1227 proc_id++, lpid++ ) 1178 1228 { 1229 // current processor scheduler pointer : psched 1230 static_scheduler_t* psched = (static_scheduler_t*)(sched_vbase+(lpid<<12)); 1231 1179 1232 // set the schedulers pointers array 1180 _schedulers[cluster_id * NB_PROCS_MAX + lpid] = 1181 (static_scheduler_t*)( sched_vbase + (lpid<<12) ); 1233 _schedulers[cluster_xy * NB_PROCS_MAX + lpid] = psched; 1182 1234 1183 1235 #if BOOT_DEBUG_SCHED 1184 1236 _puts("\nProc_"); 1185 _putd( lpid);1237 _putd( x ); 1186 1238 _puts("_"); 1187 _putd(cluster_id); 1239 _putd( y ); 1240 _puts("_"); 1241 _putd( lpid ); 1188 1242 _puts(" : scheduler virtual base address = "); 1189 1243 _putx( sched_vbase + (lpid<<12) ); 1190 1244 _puts("\n"); 1191 1245 #endif 1192 // current processor scheduler pointer : psched1193 static_scheduler_t* psched = (static_scheduler_t*)(sched_vbase+(lpid<<12));1194 1246 1195 1247 // initialise the "tasks" variable : default value is 0 … … 1269 1321 { 1270 1322 1323 // compute the cluster coordinates 1324 unsigned int x = cluster[task[task_id].clusterid].x; 1325 unsigned int y = cluster[task[task_id].clusterid].y; 1326 unsigned int cluster_xy = (x<<Y_WIDTH) + y; 1327 1271 1328 #if BOOT_DEBUG_SCHED 1272 1329 _puts("\n[BOOT DEBUG] Initialise context for task "); … … 1274 1331 _puts(" in vspace "); 1275 1332 _puts( vspace[vspace_id].name ); 1276 _puts("\n"); 1333 _puts(" running on cluster["); 1334 _putd( x ); 1335 _puts(","); 1336 _putd( y ); 1337 _puts("]\n"); 1277 1338 #endif 1278 1339 // compute gpid (global processor index) and scheduler base address 1279 unsigned int gpid = task[task_id].clusterid * NB_PROCS_MAX + 1280 task[task_id].proclocid; 1340 unsigned int gpid = cluster_xy * NB_PROCS_MAX + task[task_id].proclocid; 1281 1341 static_scheduler_t* psched = _schedulers[gpid]; 1282 1342 … … 1827 1887 unsigned int channel_id; 1828 1888 1829 for (cluster_id = 0; cluster_id < header->clusters; cluster_id++) 1830 { 1889 // loop on all physical clusters 1890 for (cluster_id = 0; cluster_id < X_SIZE*Y_SIZE; cluster_id++) 1891 { 1892 // computes cluster coordinates 1893 unsigned int x = cluster[cluster_id].x; 1894 unsigned int y = cluster[cluster_id].y; 1895 unsigned int cluster_xy = (x<<Y_WIDTH) + y; 1831 1896 1832 1897 #if BOOT_DEBUG_PERI 1833 _puts("\n[BOOT DEBUG] ****** peripherals initialisation in cluster "); 1834 _putd(cluster_id); 1835 _puts(" ******\n"); 1836 #endif 1837 1898 _puts("\n[BOOT DEBUG] ****** peripherals initialisation in cluster["); 1899 _putd( x ); 1900 _puts(","); 1901 _putd( y ); 1902 _puts("] ******\n"); 1903 #endif 1904 1905 // loop on peripherals 1838 1906 for (periph_id = cluster[cluster_id].periph_offset; 1839 1907 periph_id < cluster[cluster_id].periph_offset + … … 1843 1911 unsigned int channels = periph[periph_id].channels; 1844 1912 1845 #if BOOT_DEBUG_PERI1846 _puts("- peripheral type : ");1847 _putd(type);1848 _puts(" / channels = ");1849 _putd(channels);1850 _puts("\n");1851 #endif1852 1913 switch (type) 1853 1914 { … … 1856 1917 _ioc_init(); 1857 1918 #if BOOT_DEBUG_PERI 1858 _puts("- IOC initialised\n"); 1919 _puts("- IOC / channels = "); 1920 _putd(channels); 1921 _puts("\n"); 1859 1922 #endif 1860 1923 break; … … 1864 1927 for (channel_id = 0; channel_id < channels; channel_id++) 1865 1928 { 1866 _dma_init( cluster_ id, channel_id );1929 _dma_init( cluster_xy, channel_id ); 1867 1930 } 1868 1931 #if BOOT_DEBUG_PERI 1869 _puts("- DMA initialised\n"); 1932 _puts("- DMA / channels = "); 1933 _putd(channels); 1934 _puts("\n"); 1870 1935 #endif 1871 1936 break; 1872 1937 } 1873 case PERIPH_TYPE_NIC: // vci_multi_nic component 1938 case PERIPH_TYPE_FBF: // vci_block_device component 1939 { 1940 // nothing to do 1941 #if BOOT_DEBUG_PERI 1942 _puts("- FBF / channels = "); 1943 _putd(channels); 1944 _puts("\n"); 1945 #endif 1946 break; 1947 } 1948 case PERIPH_TYPE_HBA: // vci_multi_ahci component 1874 1949 { 1875 1950 for (channel_id = 0; channel_id < channels; channel_id++) … … 1878 1953 } 1879 1954 #if BOOT_DEBUG_PERI 1880 _puts("- NIC initialised\n"); 1955 _puts("- HBA / channels = "); 1956 _putd(channels); 1957 _puts("\n"); 1881 1958 #endif 1882 1959 break; 1883 1960 } 1961 case PERIPH_TYPE_CMA: // vci_chbuf_dma component 1962 { 1963 for (channel_id = 0; channel_id < channels; channel_id++) 1964 { 1965 // TODO 1966 } 1967 #if BOOT_DEBUG_PERI 1968 _puts("- CMA / channels = "); 1969 _putd(channels); 1970 _puts("\n"); 1971 #endif 1972 break; 1973 } 1974 case PERIPH_TYPE_NIC: // vci_multi_nic component 1975 { 1976 for (channel_id = 0; channel_id < channels; channel_id++) 1977 { 1978 // TODO 1979 } 1980 #if BOOT_DEBUG_PERI 1981 _puts("- NIC / channels = "); 1982 _putd(channels); 1983 _puts("\n"); 1984 #endif 1985 break; 1986 } 1987 case PERIPH_TYPE_XCU: // vci_xicu component 1988 { 1989 // nothing to do 1990 #if BOOT_DEBUG_PERI 1991 _puts("- XCU / channels = "); 1992 _putd(channels); 1993 _puts("\n"); 1994 #endif 1995 break; 1996 } 1997 case PERIPH_TYPE_MMC: // vci_memcache config 1998 { 1999 // nothing to do 2000 #if BOOT_DEBUG_PERI 2001 _puts("- MMC / channels = "); 2002 _putd(channels); 2003 _puts("\n"); 2004 #endif 2005 break; 2006 } 1884 2007 case PERIPH_TYPE_TTY: // vci_multi_tty component 1885 2008 { 1886 2009 #if BOOT_DEBUG_PERI 1887 _puts("- TTY initialised\n"); 2010 _puts("- TTY / channels = "); 2011 _putd(channels); 2012 _puts("\n"); 1888 2013 #endif 1889 2014 break; … … 1902 2027 } 1903 2028 #if BOOT_DEBUG_PERI 1904 _puts("- IOB initialised\n"); 2029 _puts("- IOB / channels = "); 2030 _putd(channels); 2031 _puts("\n"); 1905 2032 #endif 1906 2033 break; … … 1910 2037 1911 2038 #if BOOT_DEBUG_PERI 1912 _puts("\n[BOOT DEBUG] ****** coprocessors initialisation in cluster "); 1913 _putd(cluster_id); 1914 _puts(" ******\n"); 1915 #endif 1916 2039 _puts("\n[BOOT DEBUG] ****** coprocessors initialisation in cluster["); 2040 _putd( x ); 2041 _puts(","); 2042 _putd( y ); 2043 _puts("] ******\n"); 2044 #endif 2045 2046 // loop on coprocessors 1917 2047 for ( coproc_id = cluster[cluster_id].coproc_offset; 1918 2048 coproc_id < cluster[cluster_id].coproc_offset + … … 1939 2069 paddr_t mwmr_channel_pbase = vobj[vobj_id].paddr; 1940 2070 1941 _mw mr_hw_init( cluster_id,1942 1943 1944 2071 _mwr_hw_init( cluster_xy, 2072 cp_port_id, 2073 cp_port[cp_port_id].direction, 2074 mwmr_channel_pbase ); 1945 2075 #if BOOT_DEBUG_PERI 1946 2076 _puts(" port direction: "); … … 1959 2089 } // end boot_peripherals_init() 1960 2090 1961 1962 //////////////////////////////////////////////////////////////////////////////1963 // This function is executed by all processors to jump into kernel:1964 // - Each processor initialises its CP0_SCHED register from the value1965 // contained in the _schedulers[] array (previously initialised1966 // by proc0 in the _schedulers_init() function).1967 // - Each processor (but proc 0) initialise the CP2_PTPR register with1968 // the default value (i.e. PTPR corresponding to vspace_0 page table),1969 // and write into CP2 MODE register to activate their MMU.1970 // - All processors jump to the kernel entry point (seg_kernel_init_base).1971 //////////////////////////////////////////////////////////////////////////////1972 void boot_to_kernel()1973 {1974 // CP0 SCHED register initialisation1975 unsigned int procid = _get_procid();1976 _set_sched( (unsigned int)_schedulers[procid] );1977 1978 // MMU Activation1979 if ( procid != 0 )1980 {1981 _set_mmu_ptpr( (unsigned int)(_ptabs_paddr[0]>>13) );1982 _set_mmu_mode( 0xF );1983 1984 _tty_get_lock( 0 );1985 _puts("\n[BOOT] Proc ");1986 _putd( procid );1987 _puts(" MMU activation at cycle ");1988 _putd(_get_proctime());1989 _puts("\n");1990 _tty_release_lock( 0 );1991 1992 }1993 1994 // jump to kernel_init1995 unsigned int kernel_entry = (unsigned int)&seg_kernel_init_base;1996 1997 _tty_get_lock( 0 );1998 _puts("\n[BOOT] Processor ");1999 _putd( procid );2000 _puts(" jumps to kernel (");2001 _putx( kernel_entry );2002 _puts(") at cycle ");2003 _putd( _get_proctime() );2004 _puts("\n");2005 _tty_release_lock( 0 );2006 2007 asm volatile( "jr %0" ::"r"(kernel_entry) );2008 }2009 2010 2091 ///////////////////////////////////////////////////////////////////////// 2011 2092 // This function is the entry point of the boot code for all processors. … … 2014 2095 void boot_init() 2015 2096 { 2016 mapping_header_t* header = (mapping_header_t *) & seg_boot_mapping_base; 2017 unsigned int procid = _get_procid(); 2097 mapping_header_t* header = (mapping_header_t *) & seg_boot_mapping_base; 2098 unsigned int gpid = _get_procid(); 2099 unsigned int cluster_xy = gpid / NB_PROCS_MAX; 2100 unsigned int lpid = gpid % NB_PROCS_MAX; 2018 2101 2019 if ( procid == 0 ) // only Processor 0 does it2102 if ( gpid == 0 ) // only Processor 0 does it 2020 2103 { 2021 2104 _puts("\n[BOOT] boot_init start at cycle "); … … 2043 2126 _set_mmu_mode( 0xF ); 2044 2127 2045 _puts("\n[BOOT] Processor 0MMU activation at cycle ");2128 _puts("\n[BOOT] Processor[0,0,0] : MMU activation at cycle "); 2046 2129 _putd(_get_proctime()); 2047 2130 _puts("\n"); … … 2064 2147 _set_sched( (unsigned int)_schedulers[0] ); 2065 2148 2066 _puts("\n[BOOT] Proc 0 CPO_SCHED register initialised at cycle "); 2067 _putd(_get_proctime()); 2068 _puts("\n"); 2069 2070 // Initializing external peripherals 2149 // Initializing peripherals 2071 2150 boot_peripherals_init(); 2072 2151 2073 _puts("\n[BOOT] External peripherals initialised at cycle ");2152 _puts("\n[BOOT] All peripherals initialised at cycle "); 2074 2153 _putd(_get_proctime()); 2075 2154 _puts("\n"); … … 2083 2162 2084 2163 // P0 starts all other processors 2085 unsigned int cluster_id; 2086 unsigned int local_id; 2087 for (cluster_id = 0; cluster_id < NB_CLUSTERS; cluster_id++) 2088 { 2089 for(local_id = 0; local_id < NB_PROCS_MAX; local_id++) 2164 unsigned int x,y,p; 2165 for (x = 0 ; x < X_SIZE ; x++) 2166 { 2167 for (y = 0 ; y < Y_SIZE ; y++) 2090 2168 { 2091 if ((cluster_id != 0) || (local_id != 0)) 2092 { 2093 _xcu_send_ipi( cluster_id, 2094 local_id, 2095 (unsigned int)boot_init ); 2169 for(p = 0; p < NB_PROCS_MAX; p++) 2170 { 2171 if ( (x != 0) || (y != 0) || (p != 0) ) 2172 { 2173 _xcu_send_ipi( (x<<Y_WIDTH) + y, 2174 p, 2175 (unsigned int)boot_init ); 2176 } 2096 2177 } 2097 2178 } … … 2104 2185 2105 2186 // all processor initialise SCHED register 2106 _set_sched( (unsigned int)_schedulers[ procid] );2187 _set_sched( (unsigned int)_schedulers[gpid] ); 2107 2188 2108 2189 // all processors (but Proc 0) activate MMU 2109 if ( procid != 0 )2190 if ( gpid != 0 ) 2110 2191 { 2111 2192 _set_mmu_ptpr( (unsigned int)(_ptabs_paddr[0]>>13) ); … … 2113 2194 2114 2195 _tty_get_lock( 0 ); 2115 _puts("\n[BOOT] Processor "); 2116 _putd( procid ); 2117 _puts(" MMU activation at cycle "); 2196 _puts("\n[BOOT] Processor["); 2197 _putd( cluster_xy >> Y_WIDTH ); 2198 _puts(","); 2199 _putd( cluster_xy & ((1<<Y_WIDTH)-1) ); 2200 _puts(","); 2201 _putd( lpid ); 2202 _puts("] : MMU activation at cycle "); 2118 2203 _putd(_get_proctime()); 2119 2204 _puts("\n"); 2120 2205 _tty_release_lock( 0 ); 2121 2122 2206 } 2123 2207 … … 2126 2210 2127 2211 _tty_get_lock( 0 ); 2128 _puts("\n[BOOT] Processor "); 2129 _putd( procid ); 2130 _puts(" enters kernel at cycle "); 2212 _puts("\n[BOOT] Processor["); 2213 _putd( cluster_xy >> Y_WIDTH ); 2214 _puts(","); 2215 _putd( cluster_xy & ((1<<Y_WIDTH)-1) ); 2216 _puts(","); 2217 _putd( lpid ); 2218 _puts("] enters kernel at cycle "); 2131 2219 _putd( _get_proctime() ); 2132 2220 _puts(" / kernel entry = "); -
soft/giet_vm/giet_common/utils.c
r262 r263 19 19 20 20 // This global variable is allocated in the boot.c file or in kernel_init.c file 21 extern static_scheduler_t* _schedulers[ NB_CLUSTERS* NB_PROCS_MAX];21 extern static_scheduler_t* _schedulers[X_SIZE * Y_SIZE * NB_PROCS_MAX]; 22 22 23 23 /////////////////////////////////////////////////////////////////////////////////// … … 565 565 return (mapping_pseg_t *) ((char *) header + 566 566 MAPPING_HEADER_SIZE + 567 MAPPING_CLUSTER_SIZE * header->clusters);567 MAPPING_CLUSTER_SIZE * X_SIZE * Y_SIZE); 568 568 } 569 569 ///////////////////////////////////////////////////////////////////////////// … … 572 572 return (mapping_vspace_t *) ((char *) header + 573 573 MAPPING_HEADER_SIZE + 574 MAPPING_CLUSTER_SIZE * header->clusters+574 MAPPING_CLUSTER_SIZE * X_SIZE * Y_SIZE + 575 575 MAPPING_PSEG_SIZE * header->psegs); 576 576 } … … 580 580 return (mapping_vseg_t *) ((char *) header + 581 581 MAPPING_HEADER_SIZE + 582 MAPPING_CLUSTER_SIZE * header->clusters+582 MAPPING_CLUSTER_SIZE * X_SIZE * Y_SIZE + 583 583 MAPPING_PSEG_SIZE * header->psegs + 584 584 MAPPING_VSPACE_SIZE * header->vspaces); … … 589 589 return (mapping_vobj_t *) ((char *) header + 590 590 MAPPING_HEADER_SIZE + 591 MAPPING_CLUSTER_SIZE * header->clusters+591 MAPPING_CLUSTER_SIZE * X_SIZE * Y_SIZE + 592 592 MAPPING_PSEG_SIZE * header->psegs + 593 593 MAPPING_VSPACE_SIZE * header->vspaces + … … 599 599 return (mapping_task_t *) ((char *) header + 600 600 MAPPING_HEADER_SIZE + 601 MAPPING_CLUSTER_SIZE * header->clusters+601 MAPPING_CLUSTER_SIZE * X_SIZE * Y_SIZE + 602 602 MAPPING_PSEG_SIZE * header->psegs + 603 603 MAPPING_VSPACE_SIZE * header->vspaces + … … 610 610 return (mapping_proc_t *) ((char *) header + 611 611 MAPPING_HEADER_SIZE + 612 MAPPING_CLUSTER_SIZE * header->clusters+612 MAPPING_CLUSTER_SIZE * X_SIZE * Y_SIZE + 613 613 MAPPING_PSEG_SIZE * header->psegs + 614 614 MAPPING_VSPACE_SIZE * header->vspaces + … … 622 622 return (mapping_irq_t *) ((char *) header + 623 623 MAPPING_HEADER_SIZE + 624 MAPPING_CLUSTER_SIZE * header->clusters+624 MAPPING_CLUSTER_SIZE * X_SIZE * Y_SIZE + 625 625 MAPPING_PSEG_SIZE * header->psegs + 626 626 MAPPING_VSPACE_SIZE * header->vspaces + … … 635 635 return (mapping_coproc_t *) ((char *) header + 636 636 MAPPING_HEADER_SIZE + 637 MAPPING_CLUSTER_SIZE * header->clusters+637 MAPPING_CLUSTER_SIZE * X_SIZE * Y_SIZE + 638 638 MAPPING_PSEG_SIZE * header->psegs + 639 639 MAPPING_VSPACE_SIZE * header->vspaces + … … 649 649 return (mapping_cp_port_t *) ((char *) header + 650 650 MAPPING_HEADER_SIZE + 651 MAPPING_CLUSTER_SIZE * header->clusters+651 MAPPING_CLUSTER_SIZE * X_SIZE * Y_SIZE + 652 652 MAPPING_PSEG_SIZE * header->psegs + 653 653 MAPPING_VSPACE_SIZE * header->vspaces + … … 664 664 return (mapping_periph_t *) ((char *) header + 665 665 MAPPING_HEADER_SIZE + 666 MAPPING_CLUSTER_SIZE * header->clusters+666 MAPPING_CLUSTER_SIZE * X_SIZE * Y_SIZE + 667 667 MAPPING_PSEG_SIZE * header->psegs + 668 668 MAPPING_VSPACE_SIZE * header->vspaces + -
soft/giet_vm/giet_config.h
r258 r263 23 23 24 24 #define GIET_DEBUG_INIT 0 /* trace parallel kernel initialisation */ 25 25 26 #define GIET_DEBUG_FAT 0 /* trace fat accesses */ 26 27 #define GIET_DEBUG_SWITCH 0 /* trace context switchs */ 27 28 #define GIET_DEBUG_IOC_DRIVER 0 /* trace IOC accesses */ 28 29 #define GIET_DEBUG_DMA_DRIVER 0 /* trace DMA accesses */ 30 #define GIET_DEBUG_FBF_DRIVER 1 /* trace FBF accesses */ 29 31 30 32 #define CONFIG_SRL_VERBOSITY TRACE -
soft/giet_vm/giet_drivers/dma_driver.c
r258 r263 12 12 // 13 13 // There is (NB_CLUSTERS * NB_DMA_CHANNELS) channels, indexed by a global index: 14 // dma_id = cluster_ id* NB_DMA_CHANNELS + loc_id14 // dma_id = cluster_xy * NB_DMA_CHANNELS + loc_id 15 15 // 16 16 // A DMA channel is a private ressource allocated to a given processor. … … 22 22 // The virtual base address of the segment associated to a channel is: 23 23 // 24 // seg_dma_base + cluster_ id* vseg_cluster_increment + DMA_SPAN * channel_id24 // seg_dma_base + cluster_xy * vseg_cluster_increment + DMA_SPAN * channel_id 25 25 // 26 26 //////////////////////////////////////////////////////////////////////////////////// … … 32 32 #include <vmem.h> 33 33 34 #if !defined( NB_CLUSTERS)35 # error: You must define NB_CLUSTERSin the hard_config.h file36 #endif 37 38 #if (NB_CLUSTERS > 256)39 # error: NB_CLUSTERS cannot be larger than 256!40 #endif 41 42 #if !defined( NB_PROCS_MAX)43 # error: You must define NB_PROCS_MAXin the hard_config.h file44 #endif 45 46 #if (NB_PROCS_MAX > 8)47 # error: NB_PROCS_MAX cannot be larger than 8!48 #endif 49 50 #if (NB_DMA_CHANNELS > 8)51 # error: NB_DMA_CHANNELS cannot be larger than 8!34 #if !defined(X_SIZE) 35 # error: You must define X_SIZE in the hard_config.h file 36 #endif 37 38 #if !defined(Y_SIZE) 39 # error: You must define X_SIZE in the hard_config.h file 40 #endif 41 42 #if !defined(X_WIDTH) 43 # error: You must define X_WIDTH in the hard_config.h file 44 #endif 45 46 #if !defined(Y_WIDTH) 47 # error: You must define X_WIDTH in the hard_config.h file 48 #endif 49 50 #if !defined(NB_DMA_CHANNELS) 51 # error: You must define NB_DMA_CHANNELS in the hard_config.h file 52 52 #endif 53 53 … … 60 60 // Returns 0 if success, returns > 0 if error. 61 61 ////////////////////////////////////////////////////////////////////////////////// 62 unsigned int _dma_init( unsigned int cluster_ id,62 unsigned int _dma_init( unsigned int cluster_xy, 63 63 unsigned int channel_id ) 64 64 { 65 65 #if NB_DMA_CHANNELS > 0 66 66 67 // parameters checking 67 if (cluster_id >= NB_CLUSTERS) return 1; 68 unsigned int x = cluster_xy >> Y_WIDTH; 69 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 70 if (x >= X_SIZE) return 1; 71 if (y >= Y_SIZE) return 1; 68 72 if (channel_id >= NB_DMA_CHANNELS) return 1; 69 73 70 74 // compute DMA base address 71 75 unsigned int* dma_address = (unsigned int*) ((unsigned int)&seg_dma_base + 72 (cluster_ id* (unsigned int)&vseg_cluster_increment));76 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 73 77 74 78 // disable interrupt for selected channel … … 84 88 // completion. It actually forces the channel to return in iDLE state. 85 89 ////////////////////////////////////////////////////////////////////////////////// 86 unsigned int _dma_reset( unsigned int cluster_ id,90 unsigned int _dma_reset( unsigned int cluster_xy, 87 91 unsigned int channel_id ) 88 92 { 89 93 #if NB_DMA_CHANNELS > 0 94 90 95 // parameters checking 91 if (cluster_id >= NB_CLUSTERS) return 1; 96 unsigned int x = cluster_xy >> Y_WIDTH; 97 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 98 if (x >= X_SIZE) return 1; 99 if (y >= Y_SIZE) return 1; 92 100 if (channel_id >= NB_DMA_CHANNELS) return 1; 93 101 94 102 // compute DMA base address 95 103 unsigned int* dma_address = (unsigned int*) ((unsigned int)&seg_dma_base + 96 (cluster_ id* (unsigned int)&vseg_cluster_increment));104 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 97 105 98 106 // reset selected channel … … 107 115 // This function returns the status of a DMA channel in a given cluster 108 116 ////////////////////////////////////////////////////////////////////////////////// 109 unsigned int _dma_get_status( unsigned int cluster_ id,117 unsigned int _dma_get_status( unsigned int cluster_xy, 110 118 unsigned int channel_id ) 111 119 { 112 120 #if NB_DMA_CHANNELS > 0 121 113 122 // parameters checking 114 if (cluster_id >= NB_CLUSTERS) return 1; 123 unsigned int x = cluster_xy >> Y_WIDTH; 124 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 125 if (x >= X_SIZE) return 1; 126 if (y >= Y_SIZE) return 1; 115 127 if (channel_id >= NB_DMA_CHANNELS) return 1; 116 128 117 129 // compute DMA base address 118 130 unsigned int * dma_address = (unsigned int *) ((unsigned int)&seg_dma_base + 119 (cluster_ id* (unsigned int)&vseg_cluster_increment));131 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 120 132 121 133 // get selected channel status … … 131 143 // and sets the transfer size to lauch the transfer. 132 144 ////////////////////////////////////////////////////////////////////////////////// 133 unsigned int _dma_start_transfer( unsigned int cluster_ id,145 unsigned int _dma_start_transfer( unsigned int cluster_xy, 134 146 unsigned int channel_id, 135 147 unsigned long long dst_paddr, // physical address … … 138 150 { 139 151 #if NB_DMA_CHANNELS > 0 152 140 153 // parameters checking 141 if (cluster_id >= NB_CLUSTERS) return 1; 154 unsigned int x = cluster_xy >> Y_WIDTH; 155 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 156 if (x >= X_SIZE) return 1; 157 if (y >= Y_SIZE) return 1; 142 158 if (channel_id >= NB_DMA_CHANNELS) return 1; 143 159 144 160 // compute DMA base address 145 161 unsigned int * dma_address = (unsigned int *) ((unsigned int)&seg_dma_base + 146 (cluster_ id* (unsigned int)&vseg_cluster_increment));162 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 147 163 148 164 // selected channel configuration and lauching … … 179 195 180 196 unsigned int procid = _get_procid(); 181 unsigned int cluster_ id= procid/NB_PROCS_MAX;197 unsigned int cluster_xy = procid/NB_PROCS_MAX; 182 198 unsigned int channel_id = procid%NB_PROCS_MAX; 183 199 … … 192 208 _puts("\n - vspace_id = "); 193 209 _putx( vspace_id ); 194 _puts("\n - cluster_ id= ");195 _putx( cluster_ id);210 _puts("\n - cluster_xy = "); 211 _putx( cluster_xy ); 196 212 _puts("\n - channel_id = "); 197 213 _putx( channel_id ); … … 263 279 264 280 // dma channel configuration & lauching 265 ko = _dma_start_transfer( cluster_ id, channel_id, dst_paddr, src_paddr, size );281 ko = _dma_start_transfer( cluster_xy, channel_id, dst_paddr, src_paddr, size ); 266 282 if ( ko ) 267 283 { … … 273 289 274 290 // scan dma channel status 275 unsigned int status = _dma_get_status( cluster_ id, channel_id );291 unsigned int status = _dma_get_status( cluster_xy, channel_id ); 276 292 while( (status != DMA_SUCCESS) && 277 293 (status != DMA_READ_ERROR) && 278 294 (status != DMA_WRITE_ERROR) ) 279 295 { 280 status = _dma_get_status( cluster_ id, channel_id );296 status = _dma_get_status( cluster_xy, channel_id ); 281 297 282 298 #if GIET_DEBUG_DMA_DRIVER … … 299 315 } 300 316 // reset dma channel 301 _dma_reset( cluster_ id, channel_id );317 _dma_reset( cluster_xy, channel_id ); 302 318 303 319 #if GIET_DEBUG_DMA_DRIVER -
soft/giet_vm/giet_drivers/dma_driver.h
r258 r263 42 42 43 43 // low level access functions 44 extern unsigned int _dma_init( unsigned int cluster_ id,44 extern unsigned int _dma_init( unsigned int cluster_xy, 45 45 unsigned int channel_id ); 46 46 47 extern unsigned int _dma_reset( unsigned int cluster_ id,47 extern unsigned int _dma_reset( unsigned int cluster_xy, 48 48 unsigned int channel_id ); 49 49 50 extern unsigned int _dma_get_status( unsigned int cluster_ id,50 extern unsigned int _dma_get_status( unsigned int cluster_xy, 51 51 unsigned int channel_id ); 52 52 53 extern unsigned int _dma_start_transfer( unsigned int cluster_ id,53 extern unsigned int _dma_start_transfer( unsigned int cluster_xy, 54 54 unsigned int channel_id, 55 55 unsigned long long dst_paddr, -
soft/giet_vm/giet_drivers/fbf_driver.c
r258 r263 96 96 } fb_cma_channel_t; 97 97 98 // array of FB_CMA channels descriptors (32 bytes per entry) 99 // each entry contains one SRC and one DST chbuf descriptors. 98 100 in_unckdata volatile fb_cma_channel_t 99 101 _fb_cma_channel[NB_CMA_CHANNELS] __attribute__((aligned(64))); 100 102 103 // array of physical addresses for the FB_CMA channels descriptors 101 104 in_unckdata volatile paddr_t 102 105 _fb_cma_desc_paddr[NB_CMA_CHANNELS]; … … 105 108 // _fb_cma_init() 106 109 // This function uses the _fb_cma_channel[] and _fb_cma_desc_paddr[] arrays, 107 // that are both indexed by the channel index. 108 // where each entry contains one fb_cma_channel structure (defining two 109 // SRC and DST chbuf descriptors), and does four things: 110 // (that are both indexed by the channel index), and does four things: 110 111 // 111 112 // 1) computes the physical addresses for the two source user buffers, for 112 113 // the destination frame buffer. It initialises the channel descriptor 113 114 // _fb_cma_channel[i], containing the SRC chbuf descriptor (two buffers), 114 // the DST chbuf descriptor (one single framebuffer), and the buffer length.115 // the DST chbuf descriptor (one single buffer), and the buffer length. 115 116 // 116 117 // 2) computes the physical address for the channel descriptor and register it … … 138 139 unsigned int flags; // protection flags 139 140 unsigned int ppn; // physical page number 140 paddr_t channel_pbase;// physical address of channel descriptor141 paddr_t desc_paddr; // physical address of channel descriptor 141 142 142 143 // get CMA channel index … … 255 256 return 1; 256 257 } 257 channel_pbase = (((paddr_t)ppn) << 12) | (vaddr & 0x00000FFF); 258 _fb_cma_desc_paddr[channel_id] = channel_pbase; 259 260 #if GIET_DEBUG_CMA_DRIVER 258 _fb_cma_desc_paddr[channel_id] = (((paddr_t)ppn) << 12) | (vaddr & 0x00000FFF); 259 260 desc_paddr = (((paddr_t)ppn) << 12) | (vaddr & 0x00000FFF); 261 262 263 #if GIET_DEBUG_FBF_DRIVER 264 _tty_get_lock( 0 ); 265 _puts("\n[CMA DEBUG] fb_cma_init()"); 266 _puts("\n - fbf pbase = "); 267 _putl( _fb_cma_channel[channel_id].fbf ); 268 _puts("\n - buf0 pbase = "); 269 _putl( _fb_cma_channel[channel_id].buf0 ); 270 _puts("\n - buf1 pbase = "); 271 _putl( _fb_cma_channel[channel_id].buf1 ); 272 _puts("\n - channel pbase = "); 273 _putl( _fb_cma_desc_paddr[channel_id] ); 261 274 _puts("\n"); 262 _puts("- fbf pbase = "); 263 _putl( _fb_cma_channel[channel_id].fbf ); 264 _puts("\n"); 265 _puts("- buf0 pbase = "); 266 _putl( _fb_cma_channel[channel_id].buf0 ); 267 _puts("\n"); 268 _puts("- buf1 pbase = "); 269 _putl( _fb_cma_channel[channel_id].buf1 ); 270 _puts("\n"); 271 _puts("- channel pbase = "); 272 _putl( channel_pbase ); 273 _puts("\n"); 275 _tty_release_lock( 0 ); 274 276 #endif 275 277 276 278 // SYNC request for channel descriptor 277 _memc_sync( channel_pbase, 32 );279 _memc_sync( desc_paddr, 32 ); 278 280 279 281 // CMA channel activation 280 282 unsigned int* cma_vbase = (unsigned int *)&seg_cma_base; 281 unsigned int offset 282 283 cma_vbase[offset + CHBUF_SRC_DESC] = (unsigned int)( channel_pbase& 0xFFFFFFFF);284 cma_vbase[offset + CHBUF_SRC_EXT] = (unsigned int)( channel_pbase>> 32);283 unsigned int offset = channel_id * CHBUF_CHANNEL_SPAN; 284 285 cma_vbase[offset + CHBUF_SRC_DESC] = (unsigned int)(desc_paddr & 0xFFFFFFFF); 286 cma_vbase[offset + CHBUF_SRC_EXT] = (unsigned int)(desc_paddr >> 32); 285 287 cma_vbase[offset + CHBUF_SRC_NBUFS] = 2; 286 cma_vbase[offset + CHBUF_DST_DESC] = (unsigned int)( channel_pbase& 0xFFFFFFFF) + 16;287 cma_vbase[offset + CHBUF_DST_EXT] = (unsigned int)( channel_pbase>> 32);288 cma_vbase[offset + CHBUF_DST_DESC] = (unsigned int)(desc_paddr & 0xFFFFFFFF) + 16; 289 cma_vbase[offset + CHBUF_DST_EXT] = (unsigned int)(desc_paddr >> 32); 288 290 cma_vbase[offset + CHBUF_DST_NBUFS] = 1; 289 291 cma_vbase[offset + CHBUF_BUF_SIZE] = length; … … 302 304 #endif 303 305 } 304 ////////////////////////////////////////////////////////////////////////////////// 306 //////////////////////////////////////////////////////////////////////////////////// 305 307 // _fb_cma_write() 306 // This function makes a SYNC request for the source user buffer. 307 // Then it updates the status of the SRC and DST chbuf descriptors, to allow 308 // the CMA component to transfer the source user buffer buffer to the destination 309 // frame buffer, and makes a SYNC request for the channel descriptor. 310 // 311 // - buffer_id : user buffer index (0 => buf0 / not 0 => buf1) 308 // 309 // It updates the status of the SRC and DST chbuf descriptors, to allow the CMA 310 // component to transfer the source user buffer to the frame buffer. 311 // 312 // If the IO Bridge component is used: 313 // 1) it makes an INVAL request for the channel descriptor, before testing the 314 // source buffer status, because it is modified in XRAM by the CMA component. 315 // 2) it makes a SYNC request for the source user buffer before activating the CMA 316 // transfer, because the data will be read from XRAM by the CMA component. 317 // 3) it makes a SYNC request for the channel descriptor after modification 318 // of the SRC and DST status, because these descriptors will be read from XRAM 319 // by the CMA component. 320 // 321 // The buffer_id argument is the user buffer index (0 => buf0 / not 0 => buf1) 312 322 // Returns 0 if success, > 0 if error 313 ////////////////////////////////////////////////////////////////////////////////// 323 //////////////////////////////////////////////////////////////////////////////////// 314 324 unsigned int _fb_cma_write( unsigned int buffer_id ) 315 325 { 316 326 #if NB_CMA_CHANNELS > 0 317 327 318 paddr_t buf_paddr; 319 unsigned int buf_length; 328 volatile paddr_t buf_paddr; 329 unsigned int buf_length; 330 unsigned int full = 1; 331 332 unsigned int count = 0; 320 333 321 334 // get CMA channel index 322 335 unsigned int channel_id = _get_context_slot(CTX_CMA_ID); 323 336 324 // SYNC request for the source user buffer 325 if ( buffer_id == 0 ) buf_paddr = _fb_cma_channel[channel_id].buf0; 326 else buf_paddr = _fb_cma_channel[channel_id].buf1; 327 buf_length = _fb_cma_channel[channel_id].length; 328 _memc_sync( buf_paddr, buf_length ); 337 #if GIET_DEBUG_FBF_DRIVER 338 _tty_get_lock( 0 ); 339 _puts("\n[CMA DEBUG] fb_cma_write() for CMA channel "); 340 _putd( channel_id ); 341 _puts(" / buf_id = "); 342 _putd( buffer_id ); 343 _puts("\n"); 344 _tty_release_lock( 0 ); 345 #endif 346 347 // waiting buffer empty 348 while ( full ) 349 { 350 if ( USE_IOB ) 351 { 352 // INVAL L2 cache for the channel descriptor, 353 _memc_inval( _fb_cma_desc_paddr[channel_id], 32 ); 354 355 // INVAL L1 cache for the channel descriptor, 356 _dcache_buf_invalidate( &_fb_cma_channel[channel_id], 32 ); 357 } 358 359 // read SRC buffer descriptor 360 if ( buffer_id == 0 ) buf_paddr = _fb_cma_channel[channel_id].buf0; 361 else buf_paddr = _fb_cma_channel[channel_id].buf1; 362 full = ( (unsigned int)(buf_paddr>>63) ); 363 364 count++; 365 if ( count == 10 ) _exit(); 366 367 #if GIET_DEBUG_FBF_DRIVER 368 _tty_get_lock( 0 ); 369 _puts(" - buffer descriptor = "); 370 _putl( buf_paddr ); 371 _puts(" at cycle "); 372 _putd( _get_proctime() ); 373 _puts("\n"); 374 _tty_release_lock( 0 ); 375 #endif 376 377 } 378 379 if ( USE_IOB ) 380 { 381 // SYNC request for the user buffer because 382 // this buffer will be read from XRAM by the CMA component 383 _memc_sync( buf_paddr, _fb_cma_channel[channel_id].length ); 384 } 329 385 330 386 // set SRC full … … 338 394 & 0x7FFFFFFFFFFFFFFFULL; 339 395 340 // SYNC request for the channel descriptor 341 buf_paddr = _fb_cma_desc_paddr[channel_id]; 342 buf_length = 32; 343 _memc_sync( buf_paddr, buf_length ); 396 if ( USE_IOB ) 397 { 398 // SYNC request for the channel descriptor, because 399 // it will be read in XRAM by the CMA component 400 _memc_sync( _fb_cma_desc_paddr[channel_id], 32 ); 401 } 344 402 345 403 return 0; -
soft/giet_vm/giet_drivers/icu_driver.c
r258 r263 16 16 // The virtual base address of the segment associated to the component is: 17 17 // 18 // seg_icu_base + cluster_ id* vseg_cluster_increment18 // seg_icu_base + cluster_xy * vseg_cluster_increment 19 19 // 20 20 // The seg_icu_base and vseg_cluster_increment values must be defined … … 24 24 #include <giet_config.h> 25 25 #include <icu_driver.h> 26 #include <tty_driver.h> 26 27 #include <utils.h> 27 28 28 #if !defined( NB_CLUSTERS)29 # error: You must define NB_CLUSTERSin the hard_config.h file29 #if !defined(X_SIZE) 30 # error: You must define X_SIZE in the hard_config.h file 30 31 #endif 31 32 32 #if (NB_CLUSTERS > 256) 33 # error: NB_CLUSTERS cannot be larger than 256! 33 #if !defined(Y_SIZE) 34 # error: You must define X_SIZE in the hard_config.h file 35 #endif 36 37 #if !defined(X_WIDTH) 38 # error: You must define X_WIDTH in the hard_config.h file 39 #endif 40 41 #if !defined(Y_WIDTH) 42 # error: You must define X_WIDTH in the hard_config.h file 34 43 #endif 35 44 36 45 #if !defined(NB_PROCS_MAX) 37 46 # error: You must define NB_PROCS_MAX in the hard_config.h file 38 #endif39 40 #if (NB_PROCS_MAX > 8)41 # error: NB_PROCS_MAX cannot be larger than 8!42 47 #endif 43 48 … … 53 58 // Returns 0 if success, > 0 if error. 54 59 //////////////////////////////////////////////////////////////////////////////// 55 unsigned int _icu_set_mask( unsigned int cluster_ id,60 unsigned int _icu_set_mask( unsigned int cluster_xy, 56 61 unsigned int proc_id, 57 62 unsigned int value ) 58 63 { 59 64 // parameters checking 60 if (cluster_id >= NB_CLUSTERS) return 1; 61 if (proc_id >= NB_PROCS_MAX) return 1; 65 unsigned int x = cluster_xy >> Y_WIDTH; 66 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 67 if (x >= X_SIZE) return 1; 68 if (y >= Y_SIZE) return 1; 69 if (proc_id >= NB_PROCS_MAX) return 1; 62 70 63 71 #if USE_XICU 64 _puts("[GIET ERROR] _icu_set_mask should not be used if USE_XICU is set\n");72 _puts("[GIET ERROR] _icu_set_mask() should not be used if USE_XICU is set\n"); 65 73 return 1; 66 74 #else 67 75 unsigned int * icu_address = (unsigned int *) ((unsigned int)&seg_icu_base + 68 (cluster_ id* (unsigned int)&vseg_cluster_increment));76 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 69 77 icu_address[proc_id * ICU_SPAN + ICU_MASK_SET] = value; 70 78 return 0; … … 78 86 // Returns 0 if success, > 0 if error. 79 87 //////////////////////////////////////////////////////////////////////////////// 80 unsigned int _icu_get_index( unsigned int cluster_ id,88 unsigned int _icu_get_index( unsigned int cluster_xy, 81 89 unsigned int proc_id, 82 90 unsigned int * buffer) 83 91 { 84 92 // parameters checking 85 if (cluster_id >= NB_CLUSTERS) return 1; 86 if (proc_id >= NB_PROCS_MAX) return 1; 93 unsigned int x = cluster_xy >> Y_WIDTH; 94 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 95 if (x >= X_SIZE) return 1; 96 if (y >= Y_SIZE) return 1; 97 if (proc_id >= NB_PROCS_MAX) return 1; 87 98 88 99 #if USE_XICU 89 _puts("[GIET ERROR] _icu_get_index should not be used if USE_XICU is set\n");100 _puts("[GIET ERROR] _icu_get_index() should not be used if USE_XICU is set\n"); 90 101 return 1; 91 102 #else 92 103 unsigned int* icu_address = (unsigned int *) ((unsigned int)&seg_icu_base + 93 (cluster_ id* (unsigned int)&vseg_cluster_increment));104 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 94 105 *buffer = icu_address[proc_id * ICU_SPAN + ICU_IT_VECTOR]; 95 106 return 0; -
soft/giet_vm/giet_drivers/icu_driver.h
r258 r263 29 29 /////////////////////////////////////////////////////////////////////////////////// 30 30 31 extern unsigned int _icu_get_index( unsigned int cluster_ id,31 extern unsigned int _icu_get_index( unsigned int cluster_xy, 32 32 unsigned int proc_id, 33 33 unsigned int * buffer ); 34 34 35 extern unsigned int _icu_set_mask( unsigned int cluster_ id,35 extern unsigned int _icu_set_mask( unsigned int cluster_xy, 36 36 unsigned int proc_id, 37 37 unsigned int value ); -
soft/giet_vm/giet_drivers/ioc_driver.c
r258 r263 285 285 _puts("\n"); 286 286 _puts(" - lba = "); 287 _put d( lba );287 _putx( lba ); 288 288 _puts("\n"); 289 289 _tty_release_lock( 0 ); … … 379 379 _puts(" for processor "); 380 380 _putd( _get_procid() ); 381 _puts(" : error = "); 382 _putd( (unsigned int)error ); 381 383 _puts("\n"); 382 384 _tty_release_lock( 0 ); -
soft/giet_vm/giet_drivers/mmc_driver.c
r258 r263 21 21 #include <giet_config.h> 22 22 #include <mmc_driver.h> 23 #include <tty_driver.h> 23 24 #include <utils.h> 24 25 25 #if !defined( NB_CLUSTERS)26 # error: You must define NB_CLUSTERSin the hard_config.h file26 #if !defined(X_SIZE) 27 # error: You must define X_SIZE in the hard_config.h file 27 28 #endif 28 29 29 #if (NB_CLUSTERS > 256) 30 # error: NB_CLUSTERS cannot be larger than 256! 30 #if !defined(Y_SIZE) 31 # error: You must define X_SIZE in the hard_config.h file 32 #endif 33 34 #if !defined(X_WIDTH) 35 # error: You must define X_WIDTH in the hard_config.h file 36 #endif 37 38 #if !defined(Y_WIDTH) 39 # error: You must define X_WIDTH in the hard_config.h file 31 40 #endif 32 41 … … 40 49 unsigned int buf_length ) 41 50 { 42 unsigned int cluster_id = (unsigned int)((buf_paddr>>32)/(256/NB_CLUSTERS)); 51 // compute cluster coordinates 52 unsigned int cluster_xy = (unsigned int)(buf_paddr>>(40-X_WIDTH-Y_WIDTH)); 53 unsigned int x = cluster_xy >> Y_WIDTH; 54 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 55 56 // parameters checking 57 if ( (x >= X_SIZE) || (y >= Y_SIZE) ) 58 { 59 _puts("\n[GIET ERROR] in _memc_inval() : illegal cluster index["); 60 _putd( x ); 61 _puts(","); 62 _putd( y ); 63 _puts("]\n"); 64 _puts(" - paddr = "); 65 _putl( buf_paddr ); 66 _puts("\n - cluster_xy = "); 67 _putx( cluster_xy ); 68 _puts("\n"); 69 _exit(); 70 } 43 71 44 72 unsigned int* mmc_address = (unsigned int*)((unsigned int)&seg_mmc_base + 45 (cluster_ id* (unsigned int)&vseg_cluster_increment));73 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 46 74 47 75 // get the hard lock protecting exclusive access to MEMC … … 66 94 unsigned int buf_length ) 67 95 { 68 unsigned int cluster_id = (unsigned int)((buf_paddr>>32)/(256/NB_CLUSTERS)); 96 // compute cluster coordinates 97 unsigned int cluster_xy = (unsigned int)(buf_paddr>>(40-X_WIDTH-Y_WIDTH)); 98 unsigned int x = cluster_xy >> Y_WIDTH; 99 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 100 101 // parameters checking 102 if ( (x >= X_SIZE) || (y >= Y_SIZE) ) 103 { 104 _puts("\n[GIET ERROR] in _memc_sync() : illegal cluster index["); 105 _putd( x ); 106 _puts(","); 107 _putd( y ); 108 _puts("]\n"); 109 _puts(" - paddr = "); 110 _putl( buf_paddr ); 111 _puts("\n - cluster_xy = "); 112 _putx( cluster_xy ); 113 _puts("\n"); 114 _exit(); 115 } 69 116 70 117 unsigned int * mmc_address = (unsigned int *) ((unsigned int)&seg_mmc_base + 71 (cluster_ id* (unsigned int)&vseg_cluster_increment));118 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 72 119 73 120 // get the hard lock protecting exclusive access to MEMC -
soft/giet_vm/giet_drivers/mwr_driver.c
r258 r263 12 12 // The (virtual) base address of the associated segment is: 13 13 // 14 // seg_mwr_base + cluster_ id* vseg_cluster_increment14 // seg_mwr_base + cluster_xy * vseg_cluster_increment 15 15 // 16 16 // The seg_mwr_base and vseg_cluster_increment values must be defined … … 22 22 #include <utils.h> 23 23 24 #if !defined( NB_CLUSTERS)25 # error: You must define NB_CLUSTERSin the hard_config.h file24 #if !defined(X_SIZE) 25 # error: You must define X_SIZE in the hard_config.h file 26 26 #endif 27 27 28 #if (NB_CLUSTERS > 256) 29 # error: NB_CLUSTERS cannot be larger than 256! 28 #if !defined(Y_SIZE) 29 # error: You must define X_SIZE in the hard_config.h file 30 #endif 31 32 #if !defined(X_WIDTH) 33 # error: You must define X_WIDTH in the hard_config.h file 34 #endif 35 36 #if !defined(Y_WIDTH) 37 # error: You must define X_WIDTH in the hard_config.h file 30 38 #endif 31 39 32 40 ////////////////////////////////////////////////////////////////////////////////// 33 // _mw mr_hw_init()41 // _mwr_hw_init() 34 42 // This function initializes one MWMR controller channel (i.e. one coprocessor 35 43 // port) in a given cluster. 36 // - cluster_ id: cluster index44 // - cluster_xy : cluster index 37 45 // _ port_id : port index 38 46 // - way : direction (to_coproc/from_coproc) … … 40 48 // TODO : The MWMR controler should be modified to support 40 bits addresses... 41 49 // Introduce a MWMR_CONFIG_PADDR_EXT register in the MWMR coprocessor 42 // To support addresses > 32 bits and remove this limitation...43 50 ////////////////////////////////////////////////////////////////////////////////// 44 51 // Returns 0 if success, returns > 0 if error. 45 52 ////////////////////////////////////////////////////////////////////////////////// 46 unsigned int _mw mr_hw_init( unsigned int cluster_id,47 48 49 53 unsigned int _mwr_hw_init( unsigned int cluster_xy, 54 unsigned int port_id, 55 unsigned int from_coproc, 56 paddr_t channel_pbase ) 50 57 { 51 _puts(" [GIET_ERROR] _mw mr_hw_init() function not implemented yet\n");58 _puts(" [GIET_ERROR] _mwr_hw_init() function not supported yet\n"); 52 59 _exit(); 53 60 54 61 /* 55 62 // parameters checking 56 if (cluster_id >= NB_CLUSTERS) return 1; 63 unsigned int x = cluster_xy >> Y_WIDTH; 64 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 65 if (x >= X_SIZE) return 1; 66 if (y >= Y_SIZE) return 1; 57 67 58 // compute MWMRbase address59 unsigned int* mw mr_address = (unsigned int*) ((unsigned int)&seg_mwmr_base +60 (cluster_ id* (unsigned int)&vseg_cluster_increment));68 // compute base address 69 unsigned int* mwr_address = (unsigned int*) ((unsigned int)&seg_mwr_base + 70 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 61 71 62 72 unsigned int lsb = (unsigned int)channel_pbase; … … 68 78 69 79 // initializes and launches mwmr controler 70 mw mr_address[port_id * MWMR_SPAN + MWMR_CONFIG_FIFO_WAY] = from_coproc;71 mw mr_address[port_id * MWMR_SPAN + MWMR_CONFIG_FIFO_NO] = port_id;72 mw mr_address[port_id * MWMR_SPAN + MWMR_CONFIG_WIDTH] = width;73 mw mr_address[port_id * MWMR_SPAN + MWMR_CONFIG_DEPTH] = depth;74 mw mr_address[port_id * MWMR_SPAN + MWMR_CONFIG_STATUS] = lsb;75 mw mr_address[port_id * MWMR_SPAN + MWMR_CONFIG_DATA] = lsb + 24;76 mw mr_address[port_id * MWMR_SPAN + MWMR_CONFIG_EXT] = msb;77 mw mr_address[port_id * MWMR_SPAN + MWMR_CONFIG_RUNNING] = 1;80 mwr_address[port_id * MWMR_SPAN + MWMR_CONFIG_FIFO_WAY] = from_coproc; 81 mwr_address[port_id * MWMR_SPAN + MWMR_CONFIG_FIFO_NO] = port_id; 82 mwr_address[port_id * MWMR_SPAN + MWMR_CONFIG_WIDTH] = width; 83 mwr_address[port_id * MWMR_SPAN + MWMR_CONFIG_DEPTH] = depth; 84 mwr_address[port_id * MWMR_SPAN + MWMR_CONFIG_STATUS] = lsb; 85 mwr_address[port_id * MWMR_SPAN + MWMR_CONFIG_DATA] = lsb + 24; 86 mwr_address[port_id * MWMR_SPAN + MWMR_CONFIG_EXT] = msb; 87 mwr_address[port_id * MWMR_SPAN + MWMR_CONFIG_RUNNING] = 1; 78 88 */ 79 89 return 0; -
soft/giet_vm/giet_drivers/mwr_driver.h
r258 r263 19 19 MWMR_CONFIG_FIFO_WAY, 20 20 MWMR_CONFIG_FIFO_NO, 21 MWMR_CONFIG_STATUS _ADDR,21 MWMR_CONFIG_STATUS, 22 22 MWMR_CONFIG_DEPTH, 23 23 MWMR_CONFIG_BUFFER_ADDR, 24 24 MWMR_CONFIG_RUNNING, 25 25 MWMR_CONFIG_WIDTH, 26 MWMR_FIFO_FILL_STATUS, 26 MWMR_CONFIG_DATA, 27 MWMR_CONFIG_EXT, 28 /***/ 29 MWMR_SPAN, 27 30 }; 28 31 … … 37 40 /////////////////////////////////////////////////////////////////////////////////// 38 41 39 extern unsigned int _mw mr_hw_init( unsigned int cluster_id,40 41 42 42 extern unsigned int _mwr_hw_init( unsigned int cluster_xy, 43 unsigned int port_id, 44 unsigned int from_coproc, 45 unsigned long long channel_pbase); 43 46 44 47 /////////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/giet_drivers/tim_driver.c
r258 r263 16 16 // - "user" timers : requested by the task in the mapping_info data structure. 17 17 // For each user timer, the timer_id is stored in the context of the task. 18 // The global index is cluster_ id* (NB_PROCS_MAX + NB_TIM_CHANNELS) + local_id18 // The global index is cluster_xy * (NB_PROCS_MAX + NB_TIM_CHANNELS) + local_id 19 19 // 20 20 // The NB_PROCS_MAX and NB_TIM_CHANNELS values must be defined in the … … 25 25 // The virtual base address of the segment associated to a channel is: 26 26 // 27 // seg_tim_base + cluster_ id* vseg_cluster_increment + TIMER_SPAN * timer_id27 // seg_tim_base + cluster_xy * vseg_cluster_increment + TIMER_SPAN * timer_id 28 28 // 29 29 // The seg_tim_base and vseg_cluster_increment values must be defined … … 35 35 #include <utils.h> 36 36 37 #if !defined( NB_CLUSTERS)38 # error: You must define NB_CLUSTERSin the hard_config.h file37 #if !defined(X_SIZE) 38 # error: You must define X_SIZE in the hard_config.h file 39 39 #endif 40 40 41 #if (NB_CLUSTERS > 256) 42 # error: NB_CLUSTERS cannot be larger than 256! 41 #if !defined(Y_SIZE) 42 # error: You must define X_SIZE in the hard_config.h file 43 #endif 44 45 #if !defined(X_WIDTH) 46 # error: You must define X_WIDTH in the hard_config.h file 47 #endif 48 49 #if !defined(Y_WIDTH) 50 # error: You must define X_WIDTH in the hard_config.h file 43 51 #endif 44 52 45 53 #if !defined(NB_PROCS_MAX) 46 54 # error: You must define NB_PROCS_MAX in the hard_config.h file 47 #endif48 49 #if (NB_PROCS_MAX > 8)50 # error: NB_PROCS_MAX cannot be larger than 8!51 55 #endif 52 56 … … 59 63 #endif 60 64 61 #if !defined( USE_XICU )62 # error: You must define USE_XICU in the hard_config.h file63 #endif64 65 65 /////////////////// Timer global variables //////////////////////////////////////// 66 66 … … 68 68 69 69 #if (NB_TIM_CHANNELS > 0) 70 in_unckdata volatile unsigned char _user_timer_event[ NB_CLUSTERS *NB_TIM_CHANNELS]71 = { [0 ... (( NB_CLUSTERS *NB_TIM_CHANNELS) - 1)] = 0 };70 in_unckdata volatile unsigned char _user_timer_event[X_SIZE*Y_SIZE*NB_TIM_CHANNELS] 71 = { [0 ... ((X_SIZE*Y_SIZE*NB_TIM_CHANNELS) - 1)] = 0 }; 72 72 #endif 73 73 … … 80 80 // Returns 0 if success, > 0 if error. 81 81 ////////////////////////////////////////////////////////////////////////////// 82 unsigned int _timer_start( unsigned int cluster_ id,82 unsigned int _timer_start( unsigned int cluster_xy, 83 83 unsigned int local_id, 84 84 unsigned int period) 85 85 { 86 86 // parameters checking 87 if (cluster_id >= NB_CLUSTERS) return 1; 87 unsigned int x = cluster_xy >> Y_WIDTH; 88 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 89 if (x >= X_SIZE) return 1; 90 if (y >= Y_SIZE) return 1; 88 91 if (local_id >= NB_TIM_CHANNELS) return 1; 89 92 90 93 unsigned int* timer_address = (unsigned int *) ((unsigned int)&seg_tim_base + 91 (cluster_ id* (unsigned int)&vseg_cluster_increment));94 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 92 95 93 96 timer_address[local_id * TIMER_SPAN + TIMER_PERIOD] = period; … … 102 105 // Returns 0 if success, > 0 if error. 103 106 ////////////////////////////////////////////////////////////////////////////// 104 unsigned int _timer_stop( unsigned int cluster_ id,107 unsigned int _timer_stop( unsigned int cluster_xy, 105 108 unsigned int local_id) 106 109 { 107 110 // parameters checking 108 if (cluster_id >= NB_CLUSTERS) return 1; 111 unsigned int x = cluster_xy >> Y_WIDTH; 112 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 113 if (x >= X_SIZE) return 1; 114 if (y >= Y_SIZE) return 1; 109 115 if (local_id >= NB_TIM_CHANNELS) return 1; 110 116 111 117 unsigned int* timer_address = (unsigned int *) ((unsigned int)&seg_tim_base + 112 (cluster_ id* (unsigned int)&vseg_cluster_increment));118 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 113 119 114 120 timer_address[local_id * TIMER_SPAN + TIMER_MODE] = 0; … … 124 130 // Returns 0 if success, > 0 if error. 125 131 ////////////////////////////////////////////////////////////////////////////// 126 unsigned int _timer_reset_irq( unsigned int cluster_ id,132 unsigned int _timer_reset_irq( unsigned int cluster_xy, 127 133 unsigned int local_id ) 128 134 { 129 135 // parameters checking 130 if (cluster_id >= NB_CLUSTERS) return 1; 136 unsigned int x = cluster_xy >> Y_WIDTH; 137 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 138 if (x >= X_SIZE) return 1; 139 if (y >= Y_SIZE) return 1; 131 140 if (local_id >= NB_TIM_CHANNELS) return 1; 132 141 133 142 unsigned int * timer_address = (unsigned int *) ((unsigned int)&seg_tim_base + 134 (cluster_ id* (unsigned int)&vseg_cluster_increment));143 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 135 144 136 145 timer_address[local_id * TIMER_SPAN + TIMER_RESETIRQ] = 0; … … 147 156 // This function is called during a context switch (user or preemptive) 148 157 //////////////////////////////////////////////////////////////////////i////// 149 unsigned int _timer_reset_cpt( unsigned int cluster_ id,158 unsigned int _timer_reset_cpt( unsigned int cluster_xy, 150 159 unsigned int local_id) 151 160 { 152 161 // parameters checking 153 if (cluster_id >= NB_CLUSTERS) return 1; 162 unsigned int x = cluster_xy >> Y_WIDTH; 163 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 164 if (x >= X_SIZE) return 1; 165 if (y >= Y_SIZE) return 1; 154 166 if (local_id >= NB_TIM_CHANNELS) return 1; 155 167 156 168 // We suppose that the TIMER_MODE register value is 0x3 157 169 unsigned int * timer_address = (unsigned int *) ((unsigned int)&seg_tim_base + 158 (cluster_ id* (unsigned int)&vseg_cluster_increment));170 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 159 171 160 172 unsigned int period = timer_address[local_id * TIMER_SPAN + TIMER_PERIOD]; -
soft/giet_vm/giet_drivers/tim_driver.h
r258 r263 29 29 extern volatile unsigned char _timer_event[]; 30 30 31 extern unsigned int _timer_start( unsigned int cluster_ id,31 extern unsigned int _timer_start( unsigned int cluster_xy, 32 32 unsigned int local_id, 33 33 unsigned int period ); 34 34 35 extern unsigned int _timer_stop( unsigned int cluster_ id,35 extern unsigned int _timer_stop( unsigned int cluster_xy, 36 36 unsigned int local_id ); 37 37 38 extern unsigned int _timer_reset_irq( unsigned int cluster_ id,38 extern unsigned int _timer_reset_irq( unsigned int cluster_xy, 39 39 unsigned int local_id ); 40 40 41 extern unsigned int _timer_reset_cpt( unsigned int cluster_ id,41 extern unsigned int _timer_reset_cpt( unsigned int cluster_xy, 42 42 unsigned int local_id); 43 43 -
soft/giet_vm/giet_drivers/xcu_driver.c
r258 r263 16 16 // The virtual base address of the segment associated to the component is: 17 17 // 18 // seg_xcu_base + cluster_ id* vseg_cluster_increment18 // seg_xcu_base + cluster_xy * vseg_cluster_increment 19 19 // 20 20 // The seg_xcu_base and vseg_cluster_increment values must be defined … … 24 24 #include <giet_config.h> 25 25 #include <xcu_driver.h> 26 #include <tty_driver.h> 27 #include <mapping_info.h> 26 28 #include <utils.h> 27 29 28 #if !defined(NB_CLUSTERS) 29 # error: You must define NB_CLUSTERS in the hard_config.h file 30 #endif 31 32 #if (NB_CLUSTERS > 256) 33 # error: NB_CLUSTERS cannot be larger than 256! 30 #if !defined(X_SIZE) 31 # error: You must define X_SIZE in the hard_config.h file 32 #endif 33 34 #if !defined(Y_SIZE) 35 # error: You must define X_SIZE in the hard_config.h file 36 #endif 37 38 #if !defined(X_WIDTH) 39 # error: You must define X_WIDTH in the hard_config.h file 40 #endif 41 42 #if !defined(Y_WIDTH) 43 # error: You must define X_WIDTH in the hard_config.h file 34 44 #endif 35 45 36 46 #if !defined(NB_PROCS_MAX) 37 47 # error: You must define NB_PROCS_MAX in the hard_config.h file 38 #endif39 40 #if (NB_PROCS_MAX > 8)41 # error: NB_PROCS_MAX cannot be larger than 8!42 48 #endif 43 49 … … 53 59 // Returns 0 if success, > 0 if error. 54 60 //////////////////////////////////////////////////////////////////////////////// 55 unsigned int _xcu_set_mask( unsigned int cluster_id, unsigned int proc_id, 61 unsigned int _xcu_set_mask( unsigned int cluster_xy, 62 unsigned int proc_id, 56 63 unsigned int value, 57 unsigned int is_PTI) 58 { 59 // parameters checking 60 if (cluster_id >= NB_CLUSTERS) return 1; 61 if (proc_id >= NB_PROCS_MAX) return 1; 64 unsigned int irq_type ) 65 { 66 // parameters checking 67 unsigned int x = cluster_xy >> Y_WIDTH; 68 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 69 if (x >= X_SIZE) return 1; 70 if (y >= Y_SIZE) return 1; 71 if (proc_id >= NB_PROCS_MAX) return 1; 62 72 63 73 #if USE_XICU 64 74 unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base + 65 (cluster_id * (unsigned int)&vseg_cluster_increment)); 66 if (is_PTI) 67 xcu_address[XICU_REG(XICU_MSK_PTI_ENABLE, proc_id)] = value; 68 else 69 xcu_address[XICU_REG(XICU_MSK_HWI_ENABLE, proc_id)] = value; 75 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 76 unsigned int func; 77 if (irq_type == IRQ_TYPE_PTI) func = XICU_MSK_PTI_ENABLE; 78 else if (irq_type == IRQ_TYPE_SWI) func = XICU_MSK_WTI_ENABLE; 79 else func = XICU_MSK_HWI_ENABLE; 80 xcu_address[XICU_REG(func,proc_id)] = value; 70 81 return 0; 71 82 #else … … 86 97 // Returns 0 if success, > 0 if error. 87 98 //////////////////////////////////////////////////////////////////////////////// 88 unsigned int _xcu_get_index( unsigned int cluster_ id,99 unsigned int _xcu_get_index( unsigned int cluster_xy, 89 100 unsigned int proc_id, 90 101 unsigned int * buffer) 91 102 { 92 103 // parameters checking 93 if (cluster_id >= NB_CLUSTERS) return 1; 94 if (proc_id >= NB_PROCS_MAX) return 1; 104 unsigned int x = cluster_xy >> Y_WIDTH; 105 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 106 if (x >= X_SIZE) return 1; 107 if (y >= Y_SIZE) return 1; 108 if (proc_id >= NB_PROCS_MAX) return 1; 95 109 96 110 #if USE_XICU 97 111 unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base + 98 (cluster_ id* (unsigned int)&vseg_cluster_increment));112 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 99 113 100 114 unsigned int prio = xcu_address[XICU_REG(XICU_PRIO, proc_id)]; … … 125 139 // Returns 0 if success, > 0 if error. 126 140 //////////////////////////////////////////////////////////////////////////////// 127 unsigned int _xcu_send_ipi( unsigned int cluster_ id,141 unsigned int _xcu_send_ipi( unsigned int cluster_xy, 128 142 unsigned int proc_id, 129 143 unsigned int wdata ) 130 144 { 131 145 // parameters checking 132 if (cluster_id >= NB_CLUSTERS) return 1; 133 if (proc_id >= NB_PROCS_MAX) return 1; 146 unsigned int x = cluster_xy >> Y_WIDTH; 147 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 148 if (x >= X_SIZE) return 1; 149 if (y >= Y_SIZE) return 1; 150 if (proc_id >= NB_PROCS_MAX) return 1; 134 151 135 152 #if USE_XICU 136 153 unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base + 137 (cluster_ id* (unsigned int)&vseg_cluster_increment));154 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 138 155 xcu_address[XICU_REG(XICU_WTI_REG, proc_id)] = wdata; 139 156 return 0; … … 152 169 // Returns 0 if success, > 0 if error. 153 170 //////////////////////////////////////////////////////////////////////////////// 154 unsigned int _xcu_timer_start( unsigned int cluster_ id,155 unsigned int local_id,171 unsigned int _xcu_timer_start( unsigned int cluster_xy, 172 unsigned int proc_id, 156 173 unsigned int period ) 157 174 { 158 175 // parameters checking 159 if (cluster_id >= NB_CLUSTERS) return 1; 160 if (local_id >= NB_TIM_CHANNELS) return 1; 176 unsigned int x = cluster_xy >> Y_WIDTH; 177 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 178 if (x >= X_SIZE) return 1; 179 if (y >= Y_SIZE) return 1; 180 if (proc_id >= NB_PROCS_MAX) return 1; 161 181 162 182 #if USE_XICU 163 183 unsigned int* xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base + 164 (cluster_ id* (unsigned int)&vseg_cluster_increment));165 xcu_address[XICU_REG(XICU_PTI_PER, local_id)] = period;184 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 185 xcu_address[XICU_REG(XICU_PTI_PER, proc_id)] = period; 166 186 return 0; 167 187 #else … … 179 199 // Returns 0 if success, > 0 if error. 180 200 ////////////////////////////////////////////////////////////////////////////// 181 unsigned int _xcu_timer_stop( unsigned int cluster_id, 182 unsigned int local_id) 183 { 184 // parameters checking 185 if (cluster_id >= NB_CLUSTERS) return 1; 186 if (local_id >= NB_TIM_CHANNELS) return 1; 201 unsigned int _xcu_timer_stop( unsigned int cluster_xy, 202 unsigned int proc_id) 203 { 204 // parameters checking 205 unsigned int x = cluster_xy >> Y_WIDTH; 206 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 207 if (x >= X_SIZE) return 1; 208 if (y >= Y_SIZE) return 1; 209 if (proc_id >= NB_PROCS_MAX) return 1; 187 210 188 211 #if USE_XICU 189 212 unsigned int * xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base + 190 (cluster_ id* (unsigned int)&vseg_cluster_increment));191 xcu_address[XICU_REG(XICU_PTI_PER, local_id)] = 0;213 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 214 xcu_address[XICU_REG(XICU_PTI_PER, proc_id)] = 0; 192 215 return 0; 193 216 #else … … 207 230 // Returns 0 if success, > 0 if error. 208 231 ////////////////////////////////////////////////////////////////////////////// 209 unsigned int _xcu_timer_reset_irq( unsigned int cluster_id, 210 unsigned int local_id ) 211 { 212 // parameters checking 213 if (cluster_id >= NB_CLUSTERS) return 1; 214 if (local_id >= NB_TIM_CHANNELS) return 1; 232 unsigned int _xcu_timer_reset_irq( unsigned int cluster_xy, 233 unsigned int proc_id ) 234 { 235 // parameters checking 236 unsigned int x = cluster_xy >> Y_WIDTH; 237 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 238 if (x >= X_SIZE) return 1; 239 if (y >= Y_SIZE) return 1; 240 if (proc_id >= NB_PROCS_MAX) return 1; 215 241 216 242 #if USE_XICU 217 243 unsigned int * xcu_address = (unsigned int *) ((unsigned int)&seg_xcu_base + 218 (cluster_ id* (unsigned int)&vseg_cluster_increment));219 220 unsigned int bloup = xcu_address[XICU_REG(XICU_PTI_ACK, local_id)];244 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 245 246 unsigned int bloup = xcu_address[XICU_REG(XICU_PTI_ACK, proc_id)]; 221 247 bloup++; // to avoid a warning 222 248 return 0; … … 238 264 // This function is called during a context switch (user or preemptive) 239 265 ///////////////////////////////////////////////////////////////////////////// 240 unsigned int _xcu_timer_reset_cpt( unsigned int cluster_id, 241 unsigned int local_id ) 242 { 243 // parameters checking 244 if (cluster_id >= NB_CLUSTERS) return 1; 245 if (local_id >= NB_TIM_CHANNELS) return 1; 266 unsigned int _xcu_timer_reset_cpt( unsigned int cluster_xy, 267 unsigned int proc_id ) 268 { 269 // parameters checking 270 unsigned int x = cluster_xy >> Y_WIDTH; 271 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 272 if (x >= X_SIZE) return 1; 273 if (y >= Y_SIZE) return 1; 274 if (proc_id >= NB_PROCS_MAX) return 1; 246 275 247 276 #if USE_XICU 248 277 unsigned int * xcu_address = (unsigned int *) ((unsigned int) &seg_xcu_base + 249 (cluster_ id* (unsigned int)&vseg_cluster_increment));250 251 unsigned int period = xcu_address[XICU_REG(XICU_PTI_PER, local_id)];278 (cluster_xy * (unsigned int)&vseg_cluster_increment)); 279 280 unsigned int period = xcu_address[XICU_REG(XICU_PTI_PER, proc_id)]; 252 281 253 282 // we write 0 first because if the timer is currently running, 254 283 // the corresponding timer counter is not reset 255 xcu_address[XICU_REG(XICU_PTI_PER, local_id)] = 0;256 xcu_address[XICU_REG(XICU_PTI_PER, local_id)] = period;284 xcu_address[XICU_REG(XICU_PTI_PER, proc_id)] = 0; 285 xcu_address[XICU_REG(XICU_PTI_PER, proc_id)] = period; 257 286 return 0; 258 287 #else -
soft/giet_vm/giet_drivers/xcu_driver.h
r258 r263 39 39 40 40 #define XICU_REG(func, index) (((func)<<5)|(index)) 41 41 42 42 /////////////////////////////////////////////////////////////////////////////////// 43 43 // XICU access functions 44 44 /////////////////////////////////////////////////////////////////////////////////// 45 45 46 extern unsigned int _xcu_get_index( unsigned int cluster_ id,46 extern unsigned int _xcu_get_index( unsigned int cluster_xy, 47 47 unsigned int proc_id, 48 48 unsigned int * buffer ); 49 49 50 extern unsigned int _xcu_set_mask( unsigned int cluster_ id,50 extern unsigned int _xcu_set_mask( unsigned int cluster_xy, 51 51 unsigned int proc_id, 52 52 unsigned int mask, 53 53 unsigned int is_timer ); 54 54 55 extern unsigned int _xcu_send_ipi( unsigned int cluster_ id,55 extern unsigned int _xcu_send_ipi( unsigned int cluster_xy, 56 56 unsigned int proc_id, 57 57 unsigned int wdata ); 58 58 59 extern unsigned int _xcu_timer_start( unsigned int cluster_ id,60 unsigned int local_id,59 extern unsigned int _xcu_timer_start( unsigned int cluster_xy, 60 unsigned int proc_id, 61 61 unsigned int period ); 62 62 63 extern unsigned int _xcu_timer_stop( unsigned int cluster_ id,64 unsigned int local_id );63 extern unsigned int _xcu_timer_stop( unsigned int cluster_xy, 64 unsigned int proc_id ); 65 65 66 extern unsigned int _xcu_timer_reset_irq( unsigned int cluster_ id,67 unsigned int local_id );66 extern unsigned int _xcu_timer_reset_irq( unsigned int cluster_xy, 67 unsigned int proc_id ); 68 68 69 extern unsigned int _xcu_timer_reset_cpt( unsigned int cluster_ id,70 unsigned int local_id );69 extern unsigned int _xcu_timer_reset_cpt( unsigned int cluster_xy, 70 unsigned int proc_id ); 71 71 72 72 /////////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/giet_fat32/fat32.c
r260 r263 497 497 fat.cache_lba = lba; 498 498 499 //#if GIET_DEBUG_FAT500 //display_fat_cache();501 //#endif499 #if GIET_DEBUG_FAT 500 display_fat_cache(); 501 #endif 502 502 503 503 // in this loop we scan all names in directory identified by cluster: … … 714 714 if ( _ioc_read( mode, // mode for IOC driver 715 715 0, // sector index 716 fat.fat_cache, // buffer address716 fat.fat_cache, // buffer address 717 717 1 ) ) // one sector 718 718 { … … 760 760 #if GIET_DEBUG_FAT 761 761 _tty_get_lock( 0 ); 762 _puts("\n[FAT DEBUG] First PartitionSector Loaded\n");762 _puts("\n[FAT DEBUG] Partition First Sector Loaded\n"); 763 763 _tty_release_lock( 0 ); 764 764 #endif … … 839 839 /////////////////////////////////////////////////////////////////////////////// 840 840 // This function checks that the kernel FAT structure has been initialised, 841 // and makes the FAT initialisation if required (first user _fat_open request).841 // and makes the FAT initialisation if it is the first user open request. 842 842 // This function searches a file identified by the "pathname" argument. 843 843 // It starts from root (cluster 2) to scan successively each subdirectory. … … 871 871 if( fat.initialised != FAT_INITIALISED ) 872 872 { 873 _fat_init( IOC_KERNEL_MODE ); // we use KERNEL_MODE, because 874 // we need to write into FAT cache 873 _fat_init( IOC_BOOT_VA_MODE ); 875 874 } 876 875 877 // Scan the sub-directories, starting from the root directory (cluster 2)876 // Scan the directories, starting from the root directory (cluster 2) 878 877 // - The get_name_from_path() function extracts (successively) 879 878 // each directory name from the pathname, and store it in name[] buffer -
soft/giet_vm/giet_kernel/irq_handler.c
r258 r263 29 29 30 30 #if NB_TIM_CHANNELS 31 extern volatile unsigned char _user_timer_event[ NB_CLUSTERS *NB_TIM_CHANNELS] ;31 extern volatile unsigned char _user_timer_event[X_SIZE*Y_SIZE*NB_TIM_CHANNELS] ; 32 32 #endif 33 33 -
soft/giet_vm/giet_kernel/kernel_init.c
r258 r263 11 11 // physicals addresses can have up to 40 bits, and use the (unsigned long long) type. 12 12 // It natively supports clusterised shared mmemory multi-processors architectures, 13 // where each processor is identified by a composite index (cluster_ id, local_id),13 // where each processor is identified by a composite index (cluster_xy, local_id), 14 14 // and where there is one physical memory bank per cluster. 15 15 // … … 61 61 62 62 __attribute__((section (".kdata"))) 63 static_scheduler_t* _schedulers[ NB_CLUSTERS* NB_PROCS_MAX]; // virtual addresses63 static_scheduler_t* _schedulers[X_SIZE*Y_SIZE * NB_PROCS_MAX]; // virtual addresses 64 64 65 65 //////////////////////////////////////////////////////////////////////////////////// … … 68 68 69 69 __attribute__((section (".kdata"))) 70 unsigned int _idle_stack[ NB_CLUSTERS* NB_PROCS_MAX * 128];70 unsigned int _idle_stack[X_SIZE*Y_SIZE * NB_PROCS_MAX * 128]; 71 71 72 72 //////////////////////////////////////////////////////////////////////////////////// … … 108 108 { 109 109 unsigned int global_pid = _get_procid(); 110 unsigned int cluster_xy = global_pid / NB_PROCS_MAX; 111 unsigned int local_pid = global_pid % NB_PROCS_MAX; 110 112 111 113 #if 0 112 // Debug feature: we can kill all processors but one113 if ( global_pid != 1)114 ////////////// Debug : we can kill all processors but one 115 if ( global_pid != 0 ) 114 116 { 115 117 _tty_get_lock( 0 ); 116 _puts("\n[GIET] Processor "); 117 _putd( global_pid ); 118 _puts(" suicide...\n"); 118 _puts("\n[GIET] Processor["); 119 _putd( cluster_xy >> Y_WIDTH ); 120 _puts(","); 121 _putd( cluster_xy & ((1<<Y_WIDTH)-1) ); 122 _puts(","); 123 _putd( local_pid ); 124 _puts("] suicide...\n"); 119 125 _tty_release_lock( 0 ); 120 126 _exit(); … … 125 131 // and contribute to initialise the _schedulers[] array 126 132 127 unsigned int cluster_id = global_pid / NB_PROCS_MAX;128 unsigned int proc_id = global_pid % NB_PROCS_MAX;129 133 static_scheduler_t* psched = (static_scheduler_t*)_get_sched(); 130 134 unsigned int tasks = psched->tasks; … … 134 138 #if GIET_DEBUG_INIT 135 139 _tty_get_lock( 0 ); 136 _puts("\n[GIET DEBUG] Parallel init : step 1 for processor "); 137 _putd(global_pid); 138 _puts("\n - scheduler vbase = "); 140 _puts("\n[GIET DEBUG] Parallel init : step 1 for processor["); 141 _putd( cluster_xy >> Y_WIDTH ); 142 _puts(","); 143 _putd( cluster_xy & ((1<<Y_WIDTH)-1) ); 144 _puts(","); 145 _putd( local_pid ); 146 _puts("]\n - scheduler vbase = "); 139 147 _putx((unsigned int) psched); 140 148 _puts("\n - tasks = "); … … 173 181 #if GIET_DEBUG_INIT 174 182 _tty_get_lock( 0 ); 175 _puts("\n[GIET DEBUG] Parallel init : step 2 for processor "); 176 _putd( global_pid ); 177 _puts(" / task "); 183 _puts("\n[GIET DEBUG] Parallel init : step 2 for processor["); 184 _putd( cluster_xy >> Y_WIDTH ); 185 _puts(","); 186 _putd( cluster_xy & ((1<<Y_WIDTH)-1) ); 187 _puts(","); 188 _putd( local_pid ); 189 _puts("] / task "); 178 190 _putd( ltid ); 179 191 _puts("\n - ctx_vsid = "); … … 202 214 // there is at most 32 interrupts per processor 203 215 204 unsigned int isr_switch_ channel= 0xFFFFFFFF;216 unsigned int isr_switch_index = 0xFFFFFFFF; 205 217 unsigned int irq_id; // IN_IRQ index 206 218 unsigned int hwi_mask = 0; … … 228 240 _exit(); 229 241 } 230 if (isr == ISR_SWITCH) isr_switch_ channel= irq_id;242 if (isr == ISR_SWITCH) isr_switch_index = irq_id; 231 243 } 232 244 233 245 #if GIET_DEBUG_INIT 234 246 _tty_get_lock( 0 ); 235 _puts("\n[GIET DEBUG] Parallel init : step 3 for processor "); 236 _putd(global_pid); 237 _puts("\n - ICU HWI_MASK = "); 247 _puts("\n[GIET DEBUG] Parallel init : step 3 for processor["); 248 _putd( cluster_xy >> Y_WIDTH ); 249 _puts(","); 250 _putd( cluster_xy & ((1<<Y_WIDTH)-1) ); 251 _puts(","); 252 _putd( local_pid ); 253 _puts("]\n - ICU HWI_MASK = "); 238 254 _putx(hwi_mask); 239 255 _puts("\n - ICU SWI_MASK = "); … … 253 269 254 270 #if USE_XICU 255 _xcu_set_mask(cluster_ id, proc_id, hwi_mask, IRQ_TYPE_HWI); // set HWI_MASK256 _xcu_set_mask(cluster_ id, proc_id, swi_mask, IRQ_TYPE_SWI); // set SWI_MASK257 _xcu_set_mask(cluster_ id, proc_id, pti_mask, IRQ_TYPE_PTI); // set PTI_MASK271 _xcu_set_mask(cluster_xy, local_pid, hwi_mask, IRQ_TYPE_HWI); // set HWI_MASK 272 _xcu_set_mask(cluster_xy, local_pid, swi_mask, IRQ_TYPE_SWI); // set SWI_MASK 273 _xcu_set_mask(cluster_xy, local_pid, pti_mask, IRQ_TYPE_PTI); // set PTI_MASK 258 274 #else 259 _icu_set_mask(cluster_ id, proc_id, (hwi_mask | pti_mask | swi_mask) );275 _icu_set_mask(cluster_xy, local_pid, (hwi_mask | pti_mask | swi_mask) ); 260 276 #endif 261 277 … … 264 280 { 265 281 // one ISR_SWITCH must be defined for each proc 266 if (isr_switch_ channel== 0xFFFFFFFF)282 if (isr_switch_index == 0xFFFFFFFF) 267 283 { 268 284 _tty_get_lock( 0 ); 269 _puts("\n[GIET ERROR] ISR_SWITCH not found on proc");270 _put d(proc_id);285 _puts("\n[GIET ERROR] ISR_SWITCH not found for processor "); 286 _putx(global_pid); 271 287 _puts("\n"); 272 288 _tty_release_lock( 0 ); … … 277 293 unsigned int ko; 278 294 #if USE_XICU 279 ko = _xcu_timer_start( cluster_ id, isr_switch_channel, GIET_TICK_VALUE );295 ko = _xcu_timer_start( cluster_xy, local_pid, GIET_TICK_VALUE ); 280 296 #else 281 ko = _timer_start( cluster_ id, isr_switch_channel, GIET_TICK_VALUE );297 ko = _timer_start( cluster_xy, local_pid, GIET_TICK_VALUE ); 282 298 #endif 283 299 if ( ko ) 284 300 { 285 301 _tty_get_lock( 0 ); 286 _puts("\n[GIET ERROR] ISR_SWITCH start error for processor ");287 _putd( proc_id);302 _puts("\n[GIET ERROR] cannot start timer for processor "); 303 _putd(local_pid); 288 304 _puts("\n"); 289 305 _tty_release_lock( 0 ); … … 294 310 #if GIET_DEBUG_INIT 295 311 _tty_get_lock( 0 ); 296 _puts("\n[GIET DEBUG] Parallel init : step 4 for processor "); 297 _putd(global_pid); 312 _puts("\n[GIET DEBUG] Parallel init : step 4 for processor["); 313 _putd( cluster_xy >> Y_WIDTH ); 314 _puts(","); 315 _putd( cluster_xy & ((1<<Y_WIDTH)-1) ); 316 _puts(","); 317 _putd( local_pid ); 318 _puts("]"); 298 319 if ( tasks > 1 ) _puts("\n context switch activated\n"); 299 320 else _puts("\n context switch not activated\n"); … … 315 336 #if GIET_DEBUG_INIT 316 337 _tty_get_lock( 0 ); 317 _puts("\n[GIET DEBUG] Parallel init : step 5 for processor "); 318 _putd(global_pid); 319 _puts("\n idle task context set\n"); 338 _puts("\n[GIET DEBUG] Parallel init : step 5 for processor["); 339 _putd( cluster_xy >> Y_WIDTH ); 340 _puts(","); 341 _putd( cluster_xy & ((1<<Y_WIDTH)-1) ); 342 _puts(","); 343 _putd( local_pid ); 344 _puts("] : idle task context set\n"); 320 345 _tty_release_lock( 0 ); 321 346 #endif … … 333 358 _tty_get_lock( 0 ); 334 359 _puts("\n[GIET WARNING] No task allocated to processor "); 335 _put d(global_pid);360 _putx(global_pid); 336 361 _puts(" => idle\n"); 337 362 _tty_release_lock ( 0 ); … … 345 370 #if GIET_DEBUG_INIT 346 371 _tty_get_lock( 0 ); 347 _puts("\n[GIET DEBUG] Parallel init : step 6 for processor "); 348 _putd(global_pid); 349 _puts("\n - sp = "); 372 _puts("\n[GIET DEBUG] Parallel init : step 6 for processor["); 373 _putd( cluster_xy >> Y_WIDTH ); 374 _puts(","); 375 _putd( cluster_xy & ((1<<Y_WIDTH)-1) ); 376 _puts(","); 377 _putd( local_pid ); 378 _puts("]\n - sp = "); 350 379 _putx(sp_value); 351 380 _puts("\n - sr = "); … … 360 389 361 390 _tty_get_lock( 0 ); 362 _puts("\n[GIET] Processor "); 363 _putd( global_pid ); 364 _puts(" completes kernel init at cycle "); 391 _puts("\n[GIET] Processor["); 392 _putd( cluster_xy >> Y_WIDTH ); 393 _puts(","); 394 _putd( cluster_xy & ((1<<Y_WIDTH)-1) ); 395 _puts(","); 396 _putd( local_pid ); 397 _puts("] completes kernel init at cycle "); 365 398 _putd( _get_proctime() ); 366 399 _puts(" / task_entry_point = "); -
soft/giet_vm/giet_kernel/switch.s
r258 r263 2 2 * This function receives two arguments that are the current task context 3 3 * (virtual) addresses and the next task context (virtual) address. 4 * 5 * TODO (AG) Il semble possible de limiter le nombre de registres à sauver: 6 * - s0 à s8 ($16 à $23 + $30) 7 * - sp ($29) 8 * - ra ($31) 9 * - hi et lo 10 * - sr 11 * - epc 12 * - ptpr 4 13 ******************************************************************************/ 5 14 -
soft/giet_vm/giet_kernel/sys_handler.c
r260 r263 153 153 mapping_cluster_t * cluster = _get_cluster_base(header); 154 154 155 if (cluster_id < header->clusters) { 155 if ( cluster_id < X_SIZE * Y_SIZE ) 156 { 156 157 *buffer = cluster[cluster_id].procs; 157 158 return 0; 158 159 } 159 else { 160 else 161 { 160 162 return 1; 161 163 } -
soft/giet_vm/giet_xml/mapping_info.h
r258 r263 132 132 { 133 133 unsigned int signature; // must contain MAPPING_SIGNATURE 134 unsigned int clusters; // number of clusters 135 unsigned int cluster_x; // number of cluster in a row 136 unsigned int cluster_y; // number of cluster in a column 134 unsigned int x_size; // actual number of clusters in a row 135 unsigned int y_size; // actual number of clusters in a column 136 unsigned int x_width; // number of bits to encode x coordinate 137 unsigned int y_width; // number of bits to encode y coordinate 137 138 unsigned int globals; // number of vsegs mapped in all vspaces 138 139 unsigned int vspaces; // number of virtual spaces … … 183 184 typedef struct __attribute__((packed)) mapping_cluster_s 184 185 { 186 unsigned int x; // x coordinate 187 unsigned int y; // y coordinate 188 185 189 unsigned int psegs; // number of psegs in cluster 186 190 unsigned int pseg_offset; // index of first pseg in pseg set … … 237 241 paddr_t length; // size (bytes) 238 242 unsigned int type; // RAM / PERI 239 unsigned int cluster ; // index of cluster containing pseg243 unsigned int clusterid; // linear index in array of clusters 240 244 unsigned int next_vseg; // linked list of vsegs mapped on pseg 241 245 } mapping_pseg_t; … … 246 250 { 247 251 char name[32]; // task name (unique in vspace) 248 unsigned int clusterid; // physical cluster index252 unsigned int clusterid; // linear index in array of clusters 249 253 unsigned int proclocid; // processor local index (inside cluster) 250 254 unsigned int stack_vobjid; // stack vobj index in vspace -
soft/giet_vm/giet_xml/xml_driver.c
r258 r263 133 133 pseg = (mapping_pseg_t *) ((char *) header + 134 134 MAPPING_HEADER_SIZE + 135 MAPPING_CLUSTER_SIZE * header-> clusters);135 MAPPING_CLUSTER_SIZE * header->x_size * header->y_size); 136 136 137 137 // computes the base adresss for vspaces array, 138 138 vspace = (mapping_vspace_t *) ((char *) header + 139 139 MAPPING_HEADER_SIZE + 140 MAPPING_CLUSTER_SIZE * header-> clusters+140 MAPPING_CLUSTER_SIZE * header->x_size * header->y_size + 141 141 MAPPING_PSEG_SIZE * header->psegs); 142 142 … … 144 144 vseg = (mapping_vseg_t *) ((char *) header + 145 145 MAPPING_HEADER_SIZE + 146 MAPPING_CLUSTER_SIZE * header-> clusters+146 MAPPING_CLUSTER_SIZE * header->x_size * header->y_size + 147 147 MAPPING_PSEG_SIZE * header->psegs + 148 148 MAPPING_VSPACE_SIZE * header->vspaces); … … 151 151 vobj = (mapping_vobj_t *) ((char *) header + 152 152 MAPPING_HEADER_SIZE + 153 MAPPING_CLUSTER_SIZE * header-> clusters+153 MAPPING_CLUSTER_SIZE * header->x_size * header->y_size + 154 154 MAPPING_PSEG_SIZE * header->psegs + 155 155 MAPPING_VSPACE_SIZE * header->vspaces + … … 159 159 task = (mapping_task_t *) ((char *) header + 160 160 MAPPING_HEADER_SIZE + 161 MAPPING_CLUSTER_SIZE * header-> clusters+161 MAPPING_CLUSTER_SIZE * header->x_size * header->y_size + 162 162 MAPPING_PSEG_SIZE * header->psegs + 163 163 MAPPING_VSPACE_SIZE * header->vspaces + … … 168 168 proc = (mapping_proc_t *) ((char *) header + 169 169 MAPPING_HEADER_SIZE + 170 MAPPING_CLUSTER_SIZE * header-> clusters+170 MAPPING_CLUSTER_SIZE * header->x_size * header->y_size + 171 171 MAPPING_PSEG_SIZE * header->psegs + 172 172 MAPPING_VSPACE_SIZE * header->vspaces + … … 178 178 irq = (mapping_irq_t *) ((char *) header + 179 179 MAPPING_HEADER_SIZE + 180 MAPPING_CLUSTER_SIZE * header-> clusters+180 MAPPING_CLUSTER_SIZE * header->x_size * header->y_size + 181 181 MAPPING_PSEG_SIZE * header->psegs + 182 182 MAPPING_VSPACE_SIZE * header->vspaces + … … 189 189 coproc = (mapping_coproc_t *) ((char *) header + 190 190 MAPPING_HEADER_SIZE + 191 MAPPING_CLUSTER_SIZE * header-> clusters+191 MAPPING_CLUSTER_SIZE * header->x_size * header->y_size + 192 192 MAPPING_PSEG_SIZE * header->psegs + 193 193 MAPPING_VSPACE_SIZE * header->vspaces + … … 201 201 cp_port = (mapping_cp_port_t *) ((char *) header + 202 202 MAPPING_HEADER_SIZE + 203 MAPPING_CLUSTER_SIZE * header-> clusters+203 MAPPING_CLUSTER_SIZE * header->x_size * header->y_size + 204 204 MAPPING_PSEG_SIZE * header->psegs + 205 205 MAPPING_VSPACE_SIZE * header->vspaces + … … 214 214 periph = (mapping_periph_t *) ((char *) header + 215 215 MAPPING_HEADER_SIZE + 216 MAPPING_CLUSTER_SIZE * header-> clusters+216 MAPPING_CLUSTER_SIZE * header->x_size * header->y_size + 217 217 MAPPING_PSEG_SIZE * header->psegs + 218 218 MAPPING_VSPACE_SIZE * header->vspaces + … … 229 229 fprintf(fpout, "<?xml version = \"1.0\"?>\n\n"); 230 230 231 fprintf(fpout, "<mapping_info signature = \"0x%x\" ", header->signature); 232 fprintf(fpout, " name = \"%s\" ", header->name); 233 fprintf(fpout, " cluster_x = \"%d\" ", header->cluster_x); 234 fprintf(fpout, " cluster_y = \"%d\" ", header->cluster_y); 235 fprintf(fpout, " vspaces = \"%d\" >\n\n", header->vspaces); 231 fprintf(fpout, "<mapping_info signature = \"0x%x\" \n", header->signature); 232 fprintf(fpout, " name = \"%s\" \n", header->name); 233 fprintf(fpout, " x_size = \"%d\" \n", header->x_size); 234 fprintf(fpout, " y_size = \"%d\" \n", header->y_size); 235 fprintf(fpout, " x_width = \"%d\" \n", header->x_width); 236 fprintf(fpout, " y_width = \"%d\" \n", header->y_width); 237 fprintf(fpout, " vspaces = \"%d\" \n", header->vspaces); 238 fprintf(fpout, " increment = \"%d\" >\n\n", header->vspaces); 236 239 237 240 ///////////////////// clusters /////////////////////////////////////////////// 238 241 239 242 fprintf( fpout, " <clusterset>\n"); 240 for (cluster_id = 0; cluster_id < header->clusters; cluster_id++) 241 { 242 fprintf(fpout, " <cluster index = \"%d\" >\n", cluster_id); 243 for (cluster_id = 0; cluster_id < (header->x_size * header->y_size); cluster_id++) 244 { 245 fprintf(fpout, " <cluster x = \"%d\" y = \"%d\" >\n", 246 cluster[cluster_id].x, cluster[cluster_id].y ); 247 248 ///////////////////// psegs //////////////////////////////////////////////// 249 243 250 for (pseg_id = cluster[cluster_id].pseg_offset; 244 251 pseg_id < cluster[cluster_id].pseg_offset + cluster[cluster_id].psegs; … … 246 253 { 247 254 fprintf(fpout, " <pseg name = \"%s\" ", pseg[pseg_id].name); 248 fprintf(fpout, " 249 fprintf(fpout, " 250 fprintf(fpout, " 255 fprintf(fpout, "type = \"%s\" ", pseg_type[pseg[pseg_id].type]); 256 fprintf(fpout, "base = \"0x%llx\" ", pseg[pseg_id].base); 257 fprintf(fpout, "length = \"0x%llx\" />\n", pseg[pseg_id].length); 251 258 } 252 259 … … 316 323 fprintf(fpout, "vbase = \"0x%x\" ", vseg[vseg_id].vbase); 317 324 fprintf(fpout, "mode = \"%s\" ", mode_str[vseg[vseg_id].mode]); 318 fprintf(fpout, "clusterid = \"%d\" ", pseg[pseg_id].cluster );325 fprintf(fpout, "clusterid = \"%d\" ", pseg[pseg_id].clusterid); 319 326 fprintf(fpout, "psegname = \"%s\" ", pseg[pseg_id].name); 320 327 fprintf(fpout, "ident = \"%d\" >\n", vseg[vseg_id].ident); … … 343 350 fprintf(fpout, " startname = \"%s\" >\n", vobj[func_id].name); 344 351 352 //////////////////// vsegs ////////////////////////////////////////////// 353 345 354 for (vseg_id = vspace[vspace_id].vseg_offset; 346 355 vseg_id < (vspace[vspace_id].vseg_offset + vspace[vspace_id].vsegs); 347 356 vseg_id++) 348 357 { 349 unsigned int pseg_id = vseg[vseg_id].psegid; 358 unsigned int pseg_id = vseg[vseg_id].psegid; 359 unsigned int cluster_id = pseg[pseg_id].clusterid; 360 unsigned int x = cluster_id >> header->y_width; 361 unsigned int y = cluster_id & ((1<<header->y_width)-1); 350 362 351 363 fprintf(fpout, " <vseg name = \"%s\" ", vseg[vseg_id].name); 352 364 fprintf(fpout, "vbase = \"0x%x\" ", vseg[vseg_id].vbase); 353 fprintf(fpout, "mode = \"%s\" ", mode_str[vseg[vseg_id].mode]); 354 fprintf(fpout, "clusterid = \"%d\" ", pseg[pseg_id].cluster); 365 fprintf(fpout, "mode = \"%s\" ", mode_str[vseg[vseg_id].mode]); 366 fprintf(fpout, "x = \"%d\" ", x); 367 fprintf(fpout, "y = \"%d\" ", y); 355 368 fprintf(fpout, "psegname = \"%s\" ", pseg[pseg_id].name); 356 369 fprintf(fpout, "ident = \"%d\" >\n", vseg[vseg_id].ident); … … 369 382 fprintf(fpout, " </vseg>\n\n"); 370 383 } 384 385 //////////////////// tasks ////////////////////////////////////////////// 386 371 387 for (task_id = vspace[vspace_id].task_offset; 372 388 task_id < (vspace[vspace_id].task_offset + vspace[vspace_id].tasks); … … 375 391 unsigned int stack_vobj_id = task[task_id].stack_vobjid + vspace[vspace_id].vobj_offset; 376 392 unsigned int heap_vobj_id = task[task_id].heap_vobjid + vspace[vspace_id].vobj_offset; 393 unsigned int cluster_id = task[task_id].clusterid; 394 unsigned int x = cluster_id >> header->y_width; 395 unsigned int y = cluster_id & ((1<<header->y_width)-1); 377 396 378 397 fprintf(fpout, " <task name = \"%s\" ", task[task_id].name); 379 fprintf(fpout, "clusterid = \"%d\" ", task[task_id].clusterid); 398 fprintf(fpout, "x = \"%d\" ", x); 399 fprintf(fpout, "y = \"%d\" ", y); 380 400 fprintf(fpout, "proclocid = \"%d\" ", task[task_id].proclocid); 381 401 fprintf(fpout, "stackname = \"%s\" ", vobj[stack_vobj_id].name); -
soft/giet_vm/giet_xml/xml_parser.c
r262 r263 109 109 //////////////////////////////////////////////////////////////////// 110 110 111 unsigned int cluster_y = 0; // number of clusters in a column112 unsigned int cluster_x = 0; // number of clusters in a row113 111 unsigned int nb_proc_max = 0; // max number of processors per cluster 114 unsigned int nb_tasks_max = 0; // max number of tasks ( forall vspaces)112 unsigned int nb_tasks_max = 0; // max number of tasks (in all vspaces) 115 113 116 114 unsigned int tim_channels = 0; // max number of user timers (per cluster) … … 132 130 133 131 unsigned int periph_vbase_array[PERIPH_TYPE_MAX_VALUE] 134 = { [0 ... (PERIPH_TYPE_MAX_VALUE - 1)] = 0xFFF 00000};132 = { [0 ... (PERIPH_TYPE_MAX_VALUE - 1)] = 0xFFFFFFFF }; 135 133 136 134 ////////////////////////////////////////////////////////////////////// … … 283 281 // This function set the vbase address for all peripheral types. 284 282 // For replicated peripherals with the same type the virtual base address must be: 285 // vbase = seg_type_base & 0XFF F00000 +286 // (cluster_id * vbase_cluster_increment) & 0x00 0FFFFF283 // vbase = seg_type_base & 0XFF000000 + 284 // (cluster_id * vbase_cluster_increment) & 0x00FF0000 287 285 /////////////////////////////////////////////////////////////////////////////////// 288 286 void set_periph_vbase_array() … … 291 289 unsigned int periph_id; // periph global index 292 290 unsigned int pseg_id; // pseg global index 293 unsigned int cluster_id; // cluster global index 291 unsigned int cluster_id; // cluster linear index 292 unsigned int cluster_xy; // cluster topological index 294 293 unsigned int type; // peripheral type 295 294 296 unsigned int msb_mask = 0xFFF00000; 297 unsigned int lsb_mask = 0x000FFFFF; 298 299 // We are looking for any vseg matching a peripheral 300 // (i.e. they are associated to the same pseg) 295 unsigned int type_mask = 0xFF000000; 296 unsigned int cluster_mask = 0x00FF0000; 297 298 // We are analysing all vsegs corresponding to a peripheral 301 299 302 300 // scan all vsegs … … 306 304 if ( vobj[vseg[vseg_id]->vobj_offset]->type == VOBJ_TYPE_PERI ) 307 305 { 308 pseg_id = vseg[vseg_id]->psegid; 309 cluster_id = pseg[pseg_id]->cluster; 310 311 // scan all periphs 306 pseg_id = vseg[vseg_id]->psegid; 307 308 // scan all periphs to retrieve peripheral type (same psegid) 312 309 for ( periph_id = 0 ; periph_id < header->periphs ; periph_id++) 313 310 { … … 315 312 { 316 313 type = periph[periph_id]->type; 317 if ( periph_vbase_array[type] == 0xFFF 00000) // vbase not set314 if ( periph_vbase_array[type] == 0xFFFFFFFF ) // vbase not set 318 315 { 319 periph_vbase_array[type] = vseg[vseg_id]->vbase ;316 periph_vbase_array[type] = vseg[vseg_id]->vbase & type_mask; 320 317 } 321 318 else // vbase already set 322 319 { 323 // checking 12 MSB bits for replicated peripherals324 if( (vseg[vseg_id]->vbase & msb_mask) !=325 (periph_vbase_array[type] & msb_mask) )320 // checking mask bits 321 if( (vseg[vseg_id]->vbase & type_mask) != 322 (periph_vbase_array[type]) ) 326 323 { 327 324 printf("[XML ERROR] All peripherals with same type "); 328 printf(" should share the same 12 MSB for vbase address\n"); 329 printf("periph index = %d / periph type = %d / vbase = %x\n", 330 periph_id, type, vseg[vseg_id]->vbase); 331 exit(1); 332 } 333 // checking 20 LSB bits for replicated peripherals 334 if( (vseg[vseg_id]->vbase & lsb_mask) != 335 (header->increment * cluster_id) ) 336 { 337 printf("[XML ERROR] All peripherals with same type "); 338 printf(" must have the 20 LSB bits = cluster_id * increment"); 325 printf(" should share the same 8 MSB bits in base address\n"); 339 326 printf("periph index = %d / periph type = %d / vbase = %x\n", 340 327 periph_id, type, vseg[vseg_id]->vbase); … … 342 329 } 343 330 } 331 332 // checking cluster bits for all replicated peripherals 333 if ( (type == PERIPH_TYPE_DMA) || 334 (type == PERIPH_TYPE_MMC) || 335 (type == PERIPH_TYPE_ICU) || 336 (type == PERIPH_TYPE_XCU) || 337 (type == PERIPH_TYPE_TIM) ) 338 { 339 cluster_id = pseg[pseg_id]->clusterid; 340 cluster_xy = (cluster[cluster_id]->x << header->y_width) + 341 cluster[cluster_id]->y; 342 343 if( (vseg[vseg_id]->vbase & cluster_mask) != 344 (header->increment * cluster_xy) ) 345 { 346 printf("[XML ERROR] All replicated peripherals "); 347 printf("must have cluster bits = cluster_id * increment"); 348 printf("periph index = %d / periph type = %d / vbase = %x\n", 349 periph_id, type, vseg[vseg_id]->vbase); 350 exit(1); 351 } 352 } 344 353 } 345 354 } … … 348 357 } // end set_periph_vbase_array() 349 358 350 //////////////////////////////////////////////////////// 351 int getPsegId(unsigned int cluster_id, char * pseg_name) 352 { 359 /////////////////////////////////////////////////////////////// 360 int getClusterId( unsigned int x, unsigned int y ) 361 { 362 // associative search of cluster index 363 unsigned int cluster_id; 364 365 for( cluster_id = 0 ; cluster_id < (header->x_size * header->y_size) ; cluster_id++ ) 366 { 367 if( (cluster[cluster_id]->x == x) && (cluster[cluster_id]->y == y) ) 368 { 369 return cluster_id; 370 } 371 } 372 return -1; 373 } // end getClusterId() 374 375 /////////////////////////////////////////////////////////////// 376 int getPsegId(unsigned int x, unsigned int y, char * pseg_name) 377 { 378 int cluster_id = getClusterId( x, y ); 379 380 if ( cluster_id == -1 ) return -1; 381 382 // associative search for pseg index 353 383 unsigned int pseg_id; 354 384 unsigned int pseg_min = cluster[cluster_id]->pseg_offset; … … 363 393 } 364 394 return -1; 365 } 395 } // end getPsegId() 366 396 367 397 /////////////////////////////////// … … 399 429 unsigned int ok; 400 430 unsigned int value; 431 unsigned int x,y; 401 432 char * str; 402 433 … … 420 451 { 421 452 #if XML_PARSER_DEBUG 422 printf(" name = %s\n", str);453 printf(" name = %s\n", str); 423 454 #endif 424 455 strncpy( task[task_index]->name, str, 31 ); … … 431 462 } 432 463 433 ///////// get clusterid attribute 434 value = getIntValue(reader, "clusterid", &ok); 435 if (ok) 436 { 437 #if XML_PARSER_DEBUG 438 printf(" clusterid = %x\n", value); 439 #endif 440 if (value >= header->clusters) 441 { 442 printf("[XML ERROR] <clusterid> too large for task (%d,%d)\n", 443 vspace_index, task_loc_index); 444 exit(1); 445 } 446 task[task_index]->clusterid = value; 464 ///////// get x coordinate 465 x = getIntValue(reader, "x", &ok); 466 #if XML_PARSER_DEBUG 467 printf(" x = %d\n", x); 468 #endif 469 if ( !(ok && (x < header->x_size)) ) 470 { 471 printf("[XML ERROR] illegal or missing < x > attribute for task (%d,%d)\n", 472 vspace_index, task_loc_index); 473 exit(1); 447 474 } 448 else 449 { 450 printf("[XML ERROR] illegal or missing <clusterid> attribute for task (%d,%d)\n", 475 476 ///////// get y coordinate 477 y = getIntValue(reader, "y", &ok); 478 #if XML_PARSER_DEBUG 479 printf(" y = %d\n", y); 480 #endif 481 if ( !(ok && (y < header->y_size)) ) 482 { 483 printf("[XML ERROR] illegal or missing < y > attribute for task (%d,%d)\n", 484 vspace_index, task_loc_index); 485 exit(1); 486 } 487 488 ///////// set clusterid attribute 489 int index = getClusterId( x, y ); 490 #if XML_PARSER_DEBUG 491 printf(" clusterid = %d\n", index); 492 #endif 493 if( index >= 0 ) 494 { 495 task[task_index]->clusterid = index; 496 } 497 else 498 { 499 printf("[XML ERROR] <clusterid> not found for task (%d,%d)\n", 451 500 vspace_index, task_loc_index); 452 501 exit(1); … … 510 559 { 511 560 #if XML_PARSER_DEBUG 512 printf(" heapname = %s\n", str);513 printf(" heapid = %d\n", index);561 printf(" heapname = %s\n", str); 562 printf(" heapid = %d\n", index); 514 563 #endif 515 564 task[task_index]->heap_vobjid = index; … … 527 576 } 528 577 529 530 578 ////////// get startid attribute 531 579 value = getIntValue(reader, "startid", &ok); … … 533 581 { 534 582 #if XML_PARSER_DEBUG 535 printf(" startid = %x\n", value);583 printf(" startid = %x\n", value); 536 584 #endif 537 585 task[task_index]->startid = value; … … 724 772 unsigned int ok; 725 773 unsigned int value; 774 unsigned int x,y; 726 775 char * str; 727 776 … … 760 809 { 761 810 #if XML_PARSER_DEBUG 762 printf(" name = %s\n", str);811 printf(" name = %s\n", str); 763 812 #endif 764 813 strncpy( vseg[vseg_index]->name, str, 31); … … 776 825 { 777 826 #if XML_PARSER_DEBUG 778 printf(" ident = %d\n", value);827 printf(" ident = %d\n", value); 779 828 #endif 780 829 vseg[vseg_index]->ident = value; … … 790 839 { 791 840 #if XML_PARSER_DEBUG 792 printf(" vbase = 0x%x\n", value);841 printf(" vbase = 0x%x\n", value); 793 842 #endif 794 843 vseg[vseg_index]->vbase = value; … … 801 850 } 802 851 803 ////////// get clusterid and psegname attributes 804 value = getIntValue(reader, "clusterid", &ok); 805 if (ok == 0) 806 { 807 printf("[XML ERROR] illegal or missing <clusterid> for vseg %d\n", 852 ////////// get x coordinate 853 x = getIntValue(reader, "x", &ok); 854 #if XML_PARSER_DEBUG 855 printf(" x = %d\n", x); 856 #endif 857 if ( !(ok && (x < header->x_size)) ) 858 { 859 printf("[XML ERROR] illegal or missing < x > attribute for vseg %d\n", 808 860 vseg_loc_index); 809 861 exit(1); 810 862 } 863 864 ////////// get y coordinate 865 y = getIntValue(reader, "y", &ok); 866 #if XML_PARSER_DEBUG 867 printf(" y = %d\n", y); 868 #endif 869 if ( !(ok && (y < header->y_size)) ) 870 { 871 printf("[XML ERROR] illegal or missing < y > attribute for vseg %d\n", 872 vseg_loc_index); 873 exit(1); 874 } 875 876 ///////// get psegname attribute 811 877 str = getStringValue(reader, "psegname", &ok); 878 #if XML_PARSER_DEBUG 879 printf(" psegname = %s\n", str); 880 #endif 812 881 if (ok == 0) 813 882 { … … 818 887 819 888 /////////// set psegid field 820 int index = getPsegId(value, str); 889 int psegid = getPsegId( x, y, str ); 890 #if XML_PARSER_DEBUG 891 printf(" psegid = %d\n", psegid); 892 #endif 821 893 if (index >= 0) 822 894 { 823 #if XML_PARSER_DEBUG 824 printf(" clusterid = %d\n", value); 825 printf(" psegname = %s\n", str); 826 printf(" psegid = %d\n", index); 827 #endif 828 vseg[vseg_index]->psegid = index; 829 } 830 else 831 { 832 printf("[XML ERROR] pseg not found for vseg %d / clusterid = %d / psegname = %s\n", 833 vseg_loc_index, value, str ); 895 vseg[vseg_index]->psegid = psegid; 896 } 897 else 898 { 899 printf("[XML ERROR] pseg not found for vseg %d / x = %d / y = %d / psegname = %s\n", 900 vseg_loc_index, x, y, str ); 834 901 exit(1); 835 902 } … … 838 905 str = getStringValue(reader, "mode", &ok); 839 906 #if XML_PARSER_DEBUG 840 printf(" mode = %s\n", str);907 printf(" mode = %s\n", str); 841 908 #endif 842 909 if (ok && (strcmp(str, "CXWU") == 0)) { vseg[vseg_index]->mode = 0xF; } … … 955 1022 const char * tag = (const char *) xmlTextReaderConstName(reader); 956 1023 957 if (strcmp(tag, "vseg") == 0) { 1024 if (strcmp(tag, "vseg") == 0) 1025 { 958 1026 vsegNode(reader); 959 1027 } 960 else if (strcmp(tag, "task") == 0) { 1028 else if (strcmp(tag, "task") == 0) 1029 { 961 1030 taskNode(reader); 962 1031 nb_task_vspace++; … … 1144 1213 1145 1214 /////////// set psegid attribute 1146 int index = getPsegId( cluster_index, str);1215 int index = getPsegId( cluster[cluster_index]->x, cluster[cluster_index]->y, str); 1147 1216 if (index >= 0) 1148 1217 { … … 1465 1534 1466 1535 /////////// set psegid attribute 1467 int index = getPsegId( cluster_index, str);1536 int index = getPsegId( cluster[cluster_index]->x, cluster[cluster_index]->y, str); 1468 1537 if (index >= 0) 1469 1538 { … … 1786 1855 1787 1856 //////// set cluster attribute 1788 pseg[pseg_index]->cluster = cluster_index;1857 pseg[pseg_index]->clusterid = cluster_index; 1789 1858 1790 1859 //////// set next_vseg attribute … … 1804 1873 cluster[cluster_index] = (mapping_cluster_t *) malloc(sizeof(mapping_cluster_t)); 1805 1874 1806 //initialise all variables 1807 //they will be incremented by *Node() functions 1808 //FIXME: calloc? 1875 //initialise variables that will be incremented by *Node() functions 1809 1876 cluster[cluster_index]->psegs = 0; 1810 1877 cluster[cluster_index]->procs = 0; … … 1812 1879 cluster[cluster_index]->periphs = 0; 1813 1880 1814 1815 1881 //initialise global variables 1816 //TODO: delete those three1817 1882 proc_loc_index = 0; 1818 1883 coproc_loc_index = 0; … … 1830 1895 } 1831 1896 1832 // checking source file consistency 1833 if (cluster_index >= header->clusters) 1834 { 1835 printf("[XML ERROR] The cluster index is too large : %d\n", cluster_index); 1836 exit(1); 1837 } 1838 1839 #if XML_PARSER_DEBUG 1840 printf(" cluster %d\n", cluster_index); 1841 #endif 1842 1843 1844 /////////// check cluster index attribute (optional) 1845 value = getIntValue(reader, "index", &ok); 1846 if (ok && (value != cluster_index)) 1847 { 1848 printf("[XML ERROR] wrong cluster index / expected value is %d", 1897 #if XML_PARSER_DEBUG 1898 printf("\n cluster %d\n", cluster_index); 1899 #endif 1900 1901 /////////// get x coordinate 1902 value = getIntValue(reader, "x", &ok); 1903 #if XML_PARSER_DEBUG 1904 printf(" x = %d\n", value); 1905 #endif 1906 if (ok && (value < header->x_size) ) 1907 { 1908 cluster[cluster_index]->x = value; 1909 } 1910 else 1911 { 1912 printf("[XML ERROR] Illegal or missing < x > attribute for cluster %d", 1913 cluster_index); 1914 exit(1); 1915 } 1916 1917 /////////// get y coordinate 1918 value = getIntValue(reader, "y", &ok); 1919 #if XML_PARSER_DEBUG 1920 printf(" y = %d\n", value); 1921 #endif 1922 if (ok && (value < header->y_size) ) 1923 { 1924 cluster[cluster_index]->y = value; 1925 } 1926 else 1927 { 1928 printf("[XML ERROR] Illegal or missing < y > attribute for cluster %d", 1849 1929 cluster_index); 1850 1930 exit(1); … … 1858 1938 1859 1939 #if XML_PARSER_DEBUG 1860 1861 1862 1863 1940 printf(" pseg_offset = %d\n", pseg_index); 1941 printf(" proc_offset = %d\n", proc_index); 1942 printf(" coproc_offset = %d\n", coproc_index); 1943 printf(" periph_offset = %d\n", coproc_index); 1864 1944 #endif 1865 1945 … … 1899 1979 1900 1980 #if XML_PARSER_DEBUG 1901 1902 1903 1904 1905 1981 printf(" psegs = %d\n", cluster[cluster_index]->psegs); 1982 printf(" procs = %d\n", cluster[cluster_index]->procs); 1983 printf(" coprocs = %d\n", cluster[cluster_index]->coprocs); 1984 printf(" periphs = %d\n", cluster[cluster_index]->periphs); 1985 printf(" end cluster %d\n", cluster_index); 1906 1986 #endif 1907 1987 cluster_index++; … … 1919 1999 1920 2000 #if XML_PARSER_DEBUG 1921 2001 printf("\n clusters set\n"); 1922 2002 #endif 1923 2003 … … 1933 2013 { 1934 2014 // checking source file consistency 1935 if ( cluster_index != header->clusters)2015 if ( cluster_index != (header->x_size * header->y_size) ) 1936 2016 { 1937 2017 printf("[XML ERROR] Wrong number of clusters\n"); … … 2079 2159 } 2080 2160 2081 /////////// get cluster_x attribute 2082 cluster_x = getIntValue(reader, "cluster_x", &ok); 2083 if (ok) 2084 { 2085 #if XML_PARSER_DEBUG 2086 printf(" cluster_x = %d\n", cluster_x); 2087 #endif 2088 header->cluster_x = cluster_x; 2089 } 2090 else 2091 { 2092 printf("[XML ERROR] illegal or missing <cluster_x> attribute in header\n"); 2093 exit(1); 2094 } 2095 2096 /////////// get cluster_y attribute 2097 cluster_y = getIntValue(reader, "cluster_y", &ok); 2098 if (ok) 2099 { 2100 #if XML_PARSER_DEBUG 2101 printf(" cluster_y = %d\n", cluster_y); 2102 #endif 2103 header->cluster_y = cluster_y; 2104 } 2105 else 2106 { 2107 printf("[XML ERROR] illegal or missing <cluster_y> attribute in header\n"); 2161 /////////// get x_width attribute 2162 value = getIntValue(reader, "x_width", &ok); 2163 if (ok) 2164 { 2165 #if XML_PARSER_DEBUG 2166 printf(" x_width = %d\n", value); 2167 #endif 2168 header->x_width = value; 2169 } 2170 2171 /////////// get y_width attribute 2172 value = getIntValue(reader, "y_width", &ok); 2173 if (ok) 2174 { 2175 #if XML_PARSER_DEBUG 2176 printf(" y_width = %d\n", value); 2177 #endif 2178 header->y_width = value; 2179 } 2180 2181 /////////// get x_size attribute 2182 unsigned int x_size = getIntValue(reader, "x_size", &ok); 2183 if (ok) 2184 { 2185 #if XML_PARSER_DEBUG 2186 printf(" x_size = %d\n", x_size); 2187 #endif 2188 header->x_size = x_size; 2189 } 2190 else 2191 { 2192 printf("[XML ERROR] illegal or missing <x_size> attribute in header\n"); 2193 exit(1); 2194 } 2195 2196 /////////// get y_size attribute 2197 unsigned int y_size = getIntValue(reader, "y_size", &ok); 2198 if (ok) 2199 { 2200 #if XML_PARSER_DEBUG 2201 printf(" y_size = %d\n", y_size); 2202 #endif 2203 header->y_size = y_size; 2204 } 2205 else 2206 { 2207 printf("[XML ERROR] illegal or missing <y_size> attribute in header\n"); 2108 2208 exit(1); 2109 2209 } 2110 2210 2111 2211 //check the number of cluster 2112 value = cluster_x * cluster_y; 2113 if (value >= MAX_CLUSTERS) 2114 { 2115 printf("[XML ERROR] The number of clusters is larger than %d\n", MAX_CLUSTERS); 2116 exit(1); 2117 } 2118 2119 header->clusters = value; 2120 2121 #if XML_PARSER_DEBUG 2122 printf(" clusters = %d\n", value); 2123 #endif 2212 if ( (x_size * y_size) >= MAX_CLUSTERS ) 2213 { 2214 printf("[XML ERROR] Number of clusters cannot be larger than %d\n", MAX_CLUSTERS); 2215 exit(1); 2216 } 2124 2217 2125 2218 ///////// get vspaces attribute … … 2281 2374 printf("Building map.bin for %s\n", header->name); 2282 2375 printf("signature = %x\n", header->signature); 2283 printf("clusters = %d\n", header->clusters); 2376 printf("x_size = %d\n", header->x_size); 2377 printf("y_size = %d\n", header->y_size); 2378 printf("x_width = %d\n", header->x_width); 2379 printf("y_width = %d\n", header->y_width); 2284 2380 printf("vspaces = %d\n", header->vspaces); 2285 2381 printf("psegs = %d\n", header->psegs); … … 2406 2502 file_write(fdout, ifdef); 2407 2503 2408 def_int_write(fdout, "CLUSTER_X ", cluster_x); 2409 def_int_write(fdout, "CLUSTER_Y ", cluster_y); 2410 def_int_write(fdout, "NB_CLUSTERS ", cluster_index); 2504 def_int_write(fdout, "X_SIZE ", header->x_size); 2505 def_int_write(fdout, "Y_SIZE ", header->y_size); 2506 def_int_write(fdout, "X_WIDTH ", header->x_width); 2507 def_int_write(fdout, "Y_WIDTH ", header->y_width); 2508 2509 file_write(fdout, "\n"); 2510 2411 2511 def_int_write(fdout, "NB_PROCS_MAX ", nb_proc_max); 2412 2512 def_int_write(fdout, "NB_TASKS_MAX ", nb_tasks_max); -
soft/giet_vm/mappings/4c_1p_iob_four.xml
r258 r263 3 3 <mapping_info signature = "0xdeadbeef" 4 4 name = "4c_1p_iob_four" 5 cluster_x = "2" 6 cluster_y = "2" 5 x_size = "2" 6 y_size = "2" 7 x_width = "4" 8 y_width = "4" 7 9 vspaces = "4" 8 10 increment = "0x10000" > … … 16 18 <clusterset> 17 19 18 <cluster index= "0" >20 <cluster x = "0" y = "0" > 19 21 <pseg name = "PSEG_RAM" type = "RAM" base = "0x0000000000" length = "0x0010000000" /> 20 22 <pseg name = "PSEG_XCU" type = "PERI" base = "0x00B0000000" length = "0x0000002000" /> … … 79 81 </cluster> 80 82 81 <cluster index= "1" >82 <pseg name = "PSEG_RAM" type = "RAM" base = "0x 4000000000" length = "0x0010000000" />83 <pseg name = "PSEG_XCU" type = "PERI" base = "0x 40B0000000" length = "0x0000002000" />84 <pseg name = "PSEG_DMA" type = "PERI" base = "0x 40B1000000" length = "0x0000008000" />85 <pseg name = "PSEG_MMC" type = "PERI" base = "0x 40B2000000" length = "0x0000001000" />83 <cluster x = "0" y = "1" > 84 <pseg name = "PSEG_RAM" type = "RAM" base = "0x0100000000" length = "0x0010000000" /> 85 <pseg name = "PSEG_XCU" type = "PERI" base = "0x01B0000000" length = "0x0000002000" /> 86 <pseg name = "PSEG_DMA" type = "PERI" base = "0x10B1000000" length = "0x0000008000" /> 87 <pseg name = "PSEG_MMC" type = "PERI" base = "0x01B2000000" length = "0x0000001000" /> 86 88 87 89 <proc index = "0" > … … 95 97 </cluster> 96 98 97 <cluster index = "2" >98 <pseg name = "PSEG_RAM" type = "RAM" base = "0x 8000000000" length = "0x0010000000" />99 <pseg name = "PSEG_XCU" type = "PERI" base = "0x 80B0000000" length = "0x0000002000" />100 <pseg name = "PSEG_DMA" type = "PERI" base = "0x 80B1000000" length = "0x0000008000" />101 <pseg name = "PSEG_MMC" type = "PERI" base = "0x 80B2000000" length = "0x0000001000" />99 <cluster x = "1" y = "0" > 100 <pseg name = "PSEG_RAM" type = "RAM" base = "0x1000000000" length = "0x0010000000" /> 101 <pseg name = "PSEG_XCU" type = "PERI" base = "0x10B0000000" length = "0x0000002000" /> 102 <pseg name = "PSEG_DMA" type = "PERI" base = "0x10B1000000" length = "0x0000008000" /> 103 <pseg name = "PSEG_MMC" type = "PERI" base = "0x10B2000000" length = "0x0000001000" /> 102 104 103 105 <proc index = "0" > … … 111 113 </cluster> 112 114 113 <cluster index = "3" >114 <pseg name = "PSEG_RAM" type = "RAM" base = "0x C000000000" length = "0x0010000000" />115 <pseg name = "PSEG_XCU" type = "PERI" base = "0x C0B0000000" length = "0x0000002000" />116 <pseg name = "PSEG_DMA" type = "PERI" base = "0x C0B1000000" length = "0x0000008000" />117 <pseg name = "PSEG_MMC" type = "PERI" base = "0x C0B2000000" length = "0x0000001000" />115 <cluster x = "1" y = "1" > 116 <pseg name = "PSEG_RAM" type = "RAM" base = "0x1100000000" length = "0x0010000000" /> 117 <pseg name = "PSEG_XCU" type = "PERI" base = "0x11B0000000" length = "0x0000002000" /> 118 <pseg name = "PSEG_DMA" type = "PERI" base = "0x11B1000000" length = "0x0000008000" /> 119 <pseg name = "PSEG_MMC" type = "PERI" base = "0x11B2000000" length = "0x0000001000" /> 118 120 119 121 <proc index = "0" > … … 136 138 - seg_boot_buffer is used by the boot-loader. It can contain a complete .elf file. The content is not reused by the kernel. 137 139 138 <vseg name = "seg_boot_mapping" vbase = "0x00000000" mode = "C_W_" clusterid= "0" psegname = "PSEG_RAM" ident = "1" >140 <vseg name = "seg_boot_mapping" vbase = "0x00000000" mode = "C_W_" x = "0" y = "0" psegname = "PSEG_RAM" ident = "1" > 139 141 <vobj name = "boot_mapping" type = "BLOB" length = "0x00010000" binpath = "map.bin" /> 140 142 </vseg> 141 <vseg name = "seg_boot_code" vbase = "0x00010000" mode = "CXW_" clusterid= "0" psegname = "PSEG_RAM" ident = "1" >143 <vseg name = "seg_boot_code" vbase = "0x00010000" mode = "CXW_" x = "0" y = "0" psegname = "PSEG_RAM" ident = "1" > 142 144 <vobj name = "boot_code" type = "BUFFER" length = "0x00020000" /> 143 145 </vseg> 144 <vseg name = "seg_boot_data" vbase = "0x00030000" mode = "C_W_" clusterid= "0" psegname = "PSEG_RAM" ident = "1" >146 <vseg name = "seg_boot_data" vbase = "0x00030000" mode = "C_W_" x = "0" y = "0" psegname = "PSEG_RAM" ident = "1" > 145 147 <vobj name = "boot_data" type = "BUFFER" length = "0x00010000" /> 146 148 </vseg> 147 <vseg name = "seg_boot_buffer" vbase = "0x00040000" mode = "C_W_" clusterid= "0" psegname = "PSEG_RAM" ident = "1" >149 <vseg name = "seg_boot_buffer" vbase = "0x00040000" mode = "C_W_" x = "0" y = "0" psegname = "PSEG_RAM" ident = "1" > 148 150 <vobj name = "boot_buffer" type = "BUFFER" length = "0x00020000" /> 149 151 </vseg> 150 <vseg name = "seg_boot_stack" vbase = "0x00060000" mode = "C_W_" clusterid= "0" psegname = "PSEG_RAM" ident = "1" >152 <vseg name = "seg_boot_stack" vbase = "0x00060000" mode = "C_W_" x = "0" y = "0" psegname = "PSEG_RAM" ident = "1" > 151 153 <vobj name = "boot_stack" type = "BUFFER" length = "0x00090000" /> 152 154 </vseg> … … 154 156 *** Segments used by the kernel / A[31:28] = 0x8 155 157 156 <vseg name = "seg_kernel_code" vbase = "0x80000000" mode = "CXW_" clusterid= "0" psegname = "PSEG_RAM" >158 <vseg name = "seg_kernel_code" vbase = "0x80000000" mode = "CXW_" x = "0" y = "0" psegname = "PSEG_RAM" > 157 159 <vobj name = "kernel_code" type = "ELF" length = "0x00020000" binpath = "build/kernel/kernel.elf" /> 158 160 </vseg> 159 <vseg name = "seg_kernel_data" vbase = "0x80020000" mode = "C_W_" clusterid= "0" psegname = "PSEG_RAM" >161 <vseg name = "seg_kernel_data" vbase = "0x80020000" mode = "C_W_" x = "0" y = "0" psegname = "PSEG_RAM" > 160 162 <vobj name = "kernel_data" type = "ELF" length = "0x00060000" binpath = "build/kernel/kernel.elf" /> 161 163 </vseg> 162 <vseg name = "seg_kernel_uncdata" vbase = "0x80080000" mode = "__W_" clusterid= "0" psegname = "PSEG_RAM" >164 <vseg name = "seg_kernel_uncdata" vbase = "0x80080000" mode = "__W_" x = "0" y = "0" psegname = "PSEG_RAM" > 163 165 <vobj name = "kernel_uncdata" type = "ELF" length = "0x00040000" binpath = "build/kernel/kernel.elf" /> 164 166 </vseg> 165 <vseg name = "seg_kernel_init" vbase = "0x800C0000" mode = "CXW_" clusterid= "0" psegname = "PSEG_RAM" >167 <vseg name = "seg_kernel_init" vbase = "0x800C0000" mode = "CXW_" x = "0" y = "0" psegname = "PSEG_RAM" > 166 168 <vobj name = "kernel_init" type = "ELF" length = "0x00010000" binpath = "build/kernel/kernel.elf" /> 167 169 </vseg> 168 170 169 171 *** Segments for non replicated peripherals / A[31:28] = 0xB / Identity mapping 170 171 <vseg name = "seg_iob" vbase = "0xBE000000" mode = "__W_" clusterid = "0" psegname = "PSEG_IOB" ident = "1" > 172 *** The peripheral type must be entirely defined by the 8 virtual address MSB bits (mask_type = 0xFF000000) 173 174 <vseg name = "seg_iob" vbase = "0xBE000000" mode = "__W_" x = "0" y = "0" psegname = "PSEG_IOB" ident = "1" > 172 175 <vobj name = "iob" type = "PERI" length = "0x00001000" /> 173 176 </vseg> 174 <vseg name = "seg_ioc" vbase = "0xB3000000" mode = "__W_" clusterid= "0" psegname = "PSEG_IOC" ident = "1" >177 <vseg name = "seg_ioc" vbase = "0xB3000000" mode = "__W_" x = "0" y = "0" psegname = "PSEG_IOC" ident = "1" > 175 178 <vobj name = "ioc" type = "PERI" length = "0x00001000" /> 176 179 </vseg> 177 <vseg name = "seg_tty" vbase = "0xB4000000" mode = "__W_" clusterid= "0" psegname = "PSEG_TTY" ident = "1" >180 <vseg name = "seg_tty" vbase = "0xB4000000" mode = "__W_" x = "0" y = "0" psegname = "PSEG_TTY" ident = "1" > 178 181 <vobj name = "tty" type = "PERI" length = "0x00001000" /> 179 182 </vseg> 180 <vseg name = "seg_nic" vbase = "0xB5000000" mode = "__W_" clusterid= "0" psegname = "PSEG_NIC" ident = "1" >183 <vseg name = "seg_nic" vbase = "0xB5000000" mode = "__W_" x = "0" y = "0" psegname = "PSEG_NIC" ident = "1" > 181 184 <vobj name = "nic" type = "PERI" length = "0x00080000" /> 182 185 </vseg> 183 <vseg name = "seg_cma" vbase = "0xB6000000" mode = "__W_" clusterid= "0" psegname = "PSEG_CMA" ident = "1" >186 <vseg name = "seg_cma" vbase = "0xB6000000" mode = "__W_" x = "0" y = "0" psegname = "PSEG_CMA" ident = "1" > 184 187 <vobj name = "cma" type = "PERI" length = "0x00008000" /> 185 188 </vseg> 186 <vseg name = "seg_fbf" vbase = "0xB7000000" mode = "__W_" clusterid= "0" psegname = "PSEG_FBF" ident = "1" >189 <vseg name = "seg_fbf" vbase = "0xB7000000" mode = "__W_" x = "0" y = "0" psegname = "PSEG_FBF" ident = "1" > 187 190 <vobj name = "fbf" type = "PERI" length = "0x00004000" /> 188 191 </vseg> 189 <vseg name = "seg_rom" vbase = "0xBFC00000" mode = "CXW_" clusterid= "0" psegname = "PSEG_ROM" ident = "1" >192 <vseg name = "seg_rom" vbase = "0xBFC00000" mode = "CXW_" x = "0" y = "0" psegname = "PSEG_ROM" ident = "1" > 190 193 <vobj name = "rom" type = "PERI" length = "0x00004000" /> 191 194 </vseg> 192 195 193 196 *** Segments for replicated ICUS / A[31:24] = 0xB0 / Increment = 0x10000 / Identity mapping in cluster 0 194 195 <vseg name = "seg_icu_0" vbase = "0xB0000000" mode = "__W_" clusterid = "0" psegname = "PSEG_XCU" ident = "1" > 197 *** The peripheral type must be entirely defined by the 8 virtual address MSB bits (mask_type = 0xFF000000) 198 *** The cluster id must be encoded in the next 8 virtual address bits (cluster_mask = 0x00FF0000) 199 200 <vseg name = "seg_icu_0" vbase = "0xB0000000" mode = "__W_" x = "0" y = "0" psegname = "PSEG_XCU" ident = "1" > 196 201 <vobj name = "icu_0" type = "PERI" length = "0x00001000" /> 197 202 </vseg> 198 <vseg name = "seg_icu_1" vbase = "0xB0010000" mode = "__W_" clusterid= "1" psegname = "PSEG_XCU" >203 <vseg name = "seg_icu_1" vbase = "0xB0010000" mode = "__W_" x = "0" y = "1" psegname = "PSEG_XCU" > 199 204 <vobj name = "icu_1" type = "PERI" length = "0x00001000" /> 200 205 </vseg> 201 <vseg name = "seg_icu_2" vbase = "0xB0 020000" mode = "__W_" clusterid = "2" psegname = "PSEG_XCU" >206 <vseg name = "seg_icu_2" vbase = "0xB0100000" mode = "__W_" x = "1" y = "0" psegname = "PSEG_XCU" > 202 207 <vobj name = "icu_2" type = "PERI" length = "0x00001000" /> 203 208 </vseg> 204 <vseg name = "seg_icu_3" vbase = "0xB0 030000" mode = "__W_" clusterid = "3" psegname = "PSEG_XCU" >209 <vseg name = "seg_icu_3" vbase = "0xB0110000" mode = "__W_" x = "1" y = "1" psegname = "PSEG_XCU" > 205 210 <vobj name = "icu_3" type = "PERI" length = "0x00001000" /> 206 211 </vseg> 207 212 208 213 *** segments for replicated DMAs / A[31:24] = 0xB1 / Increment = 0x10000 / Tdentity mapping in cluster 0 209 210 <vseg name = "seg_dma_0" vbase = "0xB1000000" mode = "__W_" clusterid = "0" psegname = "PSEG_DMA" ident = "1" > 214 *** The peripheral type must be entirely defined by the 8 virtual address MSB bits (mask_type = 0xFF000000) 215 *** The cluster id must be encoded in the next 8 virtual address bits (cluster_mask = 0x00FF0000) 216 217 <vseg name = "seg_dma_0" vbase = "0xB1000000" mode = "__W_" x = "0" y = "0" psegname = "PSEG_DMA" ident = "1" > 211 218 <vobj name = "dma_0" type = "PERI" length = "0x00008000" /> 212 219 </vseg> 213 <vseg name = "seg_dma_1" vbase = "0xB1010000" mode = "__W_" clusterid= "1" psegname = "PSEG_DMA" >220 <vseg name = "seg_dma_1" vbase = "0xB1010000" mode = "__W_" x = "0" y = "1" psegname = "PSEG_DMA" > 214 221 <vobj name = "dma_1" type = "PERI" length = "0x00008000" /> 215 222 </vseg> 216 <vseg name = "seg_dma_2" vbase = "0xB1 020000" mode = "__W_" clusterid = "2" psegname = "PSEG_DMA" >223 <vseg name = "seg_dma_2" vbase = "0xB1100000" mode = "__W_" x = "1" y = "0" psegname = "PSEG_DMA" > 217 224 <vobj name = "dma_2" type = "PERI" length = "0x00008000" /> 218 225 </vseg> 219 <vseg name = "seg_dma_3" vbase = "0xB1 030000" mode = "__W_" clusterid = "3" psegname = "PSEG_DMA" >226 <vseg name = "seg_dma_3" vbase = "0xB1110000" mode = "__W_" x = "1" y = "1" psegname = "PSEG_DMA" > 220 227 <vobj name = "dma_3" type = "PERI" length = "0x00008000" /> 221 228 </vseg> 222 229 223 230 *** segments for replicated MMC / A[31:24] = 0xB2 / Increment = 0x10000 / Identity mapping in cluster 0 224 225 <vseg name = "seg_memc_0" vbase = "0xB2000000" mode = "__W_" clusterid = "0" psegname = "PSEG_MMC" ident = "1" > 231 *** The peripheral type must be entirely defined by the 8 virtual address MSB bits (mask_type = 0xFF000000) 232 *** The cluster id must be encoded in the next 8 virtual address bits (cluster_mask = 0x00FF0000) 233 234 <vseg name = "seg_memc_0" vbase = "0xB2000000" mode = "__W_" x = "0" y = "0" psegname = "PSEG_MMC" ident = "1" > 226 235 <vobj name = "memc_0" type = "PERI" length = "0x00001000" /> 227 236 </vseg> 228 <vseg name = "seg_memc_1" vbase = "0xB2010000" mode = "__W_" clusterid= "1" psegname = "PSEG_MMC" >237 <vseg name = "seg_memc_1" vbase = "0xB2010000" mode = "__W_" x = "0" y = "1" psegname = "PSEG_MMC" > 229 238 <vobj name = "memc_1" type = "PERI" length = "0x00001000" /> 230 239 </vseg> 231 <vseg name = "seg_memc_2" vbase = "0xB2 020000" mode = "__W_" clusterid = "2" psegname = "PSEG_MMC" >240 <vseg name = "seg_memc_2" vbase = "0xB2100000" mode = "__W_" x = "1" y = "0" psegname = "PSEG_MMC" > 232 241 <vobj name = "memc_2" type = "PERI" length = "0x00001000" /> 233 242 </vseg> 234 <vseg name = "seg_memc_3" vbase = "0xB2 030000" mode = "__W_" clusterid = "3" psegname = "PSEG_MMC" >243 <vseg name = "seg_memc_3" vbase = "0xB2110000" mode = "__W_" x = "1" y = "1" psegname = "PSEG_MMC" > 235 244 <vobj name = "memc_3" type = "PERI" length = "0x00001000" /> 236 245 </vseg> 237 246 238 247 *** segments for replicated schedulers / A[31:28] = 0xF / Increment = 0x10000 239 240 <vseg name = "seg_sched_0" vbase = "0xF0000000" mode = "C_W_" clusterid = "0" psegname = "PSEG_RAM" > 248 *** The type must be entirely defined by the 8 virtual address MSB bits (mask_type = 0xFF000000) 249 *** The cluster id must be encoded in the next 8 virtual address bits (cluster_mask = 0x00FF0000) 250 251 <vseg name = "seg_sched_0" vbase = "0xF0000000" mode = "C_W_" x = "0" y = "0" psegname = "PSEG_RAM" > 241 252 <vobj name = "sched_0" type = "SCHED" length = "0x00008000" /> 242 253 </vseg> 243 <vseg name = "seg_sched_1" vbase = "0xF0010000" mode = "C_W_" clusterid= "1" psegname = "PSEG_RAM" >254 <vseg name = "seg_sched_1" vbase = "0xF0010000" mode = "C_W_" x = "0" y = "1" psegname = "PSEG_RAM" > 244 255 <vobj name = "sched_1" type = "SCHED" length = "0x00008000" /> 245 256 </vseg> 246 <vseg name = "seg_sched_2" vbase = "0xF0 020000" mode = "C_W_" clusterid = "2" psegname = "PSEG_RAM" >257 <vseg name = "seg_sched_2" vbase = "0xF0100000" mode = "C_W_" x = "1" y = "0" psegname = "PSEG_RAM" > 247 258 <vobj name = "sched_2" type = "SCHED" length = "0x00008000" /> 248 259 </vseg> 249 <vseg name = "seg_sched_3" vbase = "0xF0 030000" mode = "C_W_" clusterid = "3" psegname = "PSEG_RAM" >260 <vseg name = "seg_sched_3" vbase = "0xF0110000" mode = "C_W_" x = "1" y = "1" psegname = "PSEG_RAM" > 250 261 <vobj name = "sched_3" type = "SCHED" length = "0x00008000" /> 251 262 </vseg> 252 *** 263 253 264 </globalset> 254 265 … … 257 268 *** For each vspace, the startname field is the name of the vobj containing the start_vector (entry point array) 258 269 *** For each task, the startid field define the task entry point as an index in the start_vector 259 *** For each task, the clusteridand proclocid arguments define the task static placement270 *** For each task, the x = "0" y and proclocid arguments define the task static placement 260 271 *** For each task, the stackname field is the name of the vobj containing the task stack 261 272 *** For each task, the heapname field is the name of the vobj containing the task heap 262 273 263 274 <vspace name = "router" startname = "router_data" > 264 <vseg name = "seg_code" vbase = "0x00400000" mode = "CXWU" clusterid= "0" psegname = "PSEG_RAM" >275 <vseg name = "seg_code" vbase = "0x00400000" mode = "CXWU" x = "0" y = "0" psegname = "PSEG_RAM" > 265 276 <vobj name = "router_code" type = "ELF" length = "0x00010000" binpath = "build/router/router.elf" /> 266 277 </vseg> 267 <vseg name = "seg_data" vbase = "0x00500000" mode = "__WU" clusterid= "0" psegname = "PSEG_RAM" >278 <vseg name = "seg_data" vbase = "0x00500000" mode = "__WU" x = "0" y = "0" psegname = "PSEG_RAM" > 268 279 <vobj name = "router_data" type = "ELF" length = "0x00010000" binpath = "build/router/router.elf" /> 269 280 </vseg> 270 <vseg name = "seg_ptab" vbase = "0x00600000" mode = "C_W_" clusterid= "0" psegname = "PSEG_RAM" >281 <vseg name = "seg_ptab" vbase = "0x00600000" mode = "C_W_" x = "0" y = "0" psegname = "PSEG_RAM" > 271 282 <vobj name = "ptab" type = "PTAB" length = "0x00020000" align = "13" /> 272 283 </vseg> 273 <vseg name = "seg_stack_prod" vbase = "0x00700000" mode = "C_WU" clusterid= "0" psegname = "PSEG_RAM" >284 <vseg name = "seg_stack_prod" vbase = "0x00700000" mode = "C_WU" x = "0" y = "0" psegname = "PSEG_RAM" > 274 285 <vobj name = "stack_prod" type = "BUFFER" length = "0x00010000" /> 275 286 <vobj name = "heap_prod" type = "BUFFER" length = "0x00010000" /> 276 287 </vseg> 277 <vseg name = "seg_stack_cons" vbase = "0x00800000" mode = "C_WU" clusterid= "1" psegname = "PSEG_RAM" >288 <vseg name = "seg_stack_cons" vbase = "0x00800000" mode = "C_WU" x = "0" y = "1" psegname = "PSEG_RAM" > 278 289 <vobj name = "stack_cons" type = "BUFFER" length = "0x00010000" /> 279 290 <vobj name = "heap_cons" type = "BUFFER" length = "0x00010000" /> 280 291 </vseg> 281 <vseg name = "seg_stack_routA" vbase = "0x00900000" mode = "C_WU" clusterid = "2" psegname = "PSEG_RAM" >292 <vseg name = "seg_stack_routA" vbase = "0x00900000" mode = "C_WU" x = "1" y = "0" psegname = "PSEG_RAM" > 282 293 <vobj name = "stack_routA" type = "BUFFER" length = "0x00010000" /> 283 294 <vobj name = "heap_routA" type = "BUFFER" length = "0x00010000" /> 284 295 </vseg> 285 <vseg name = "seg_stack_routB" vbase = "0x00A00000" mode = "C_WU" clusterid = "3" psegname = "PSEG_RAM" >296 <vseg name = "seg_stack_routB" vbase = "0x00A00000" mode = "C_WU" x = "1" y = "1" psegname = "PSEG_RAM" > 286 297 <vobj name = "stack_routB" type = "BUFFER" length = "0x00010000" /> 287 298 <vobj name = "heap_routB" type = "BUFFER" length = "0x00010000" /> 288 299 </vseg> 289 <vseg name = "seg_mwmrs" vbase = "0x00B00000" mode = "__WU" clusterid= "0" psegname = "PSEG_RAM" >300 <vseg name = "seg_mwmrs" vbase = "0x00B00000" mode = "__WU" x = "0" y = "0" psegname = "PSEG_RAM" > 290 301 <vobj name = "mwmr_in" type = "MWMR" length = "0x00000020" init = "1" /> 291 302 <vobj name = "mwmr_out" type = "MWMR" length = "0x00000020" init = "1" /> 292 303 </vseg> 293 304 294 <task name = "producer" clusterid= "0" proclocid = "0" stackname = "stack_prod" heapname = "heap_prod" startid = "0" usetty = "1" />295 <task name = "consumer" clusterid= "1" proclocid = "0" stackname = "stack_cons" heapname = "heap_cons" startid = "1" usetty = "1" />296 <task name = "router_A" clusterid = "2" proclocid = "0" stackname = "stack_routA" heapname = "heap_routA" startid = "2" usetty = "1" />297 <task name = "router_B" clusterid = "3" proclocid = "0" stackname = "stack_routB" heapname = "heap_routB" startid = "2" usetty = "1" />305 <task name = "producer" x = "0" y = "0" proclocid = "0" stackname = "stack_prod" heapname = "heap_prod" startid = "0" usetty = "1" /> 306 <task name = "consumer" x = "0" y = "1" proclocid = "0" stackname = "stack_cons" heapname = "heap_cons" startid = "1" usetty = "1" /> 307 <task name = "router_A" x = "1" y = "0" proclocid = "0" stackname = "stack_routA" heapname = "heap_routA" startid = "2" usetty = "1" /> 308 <task name = "router_B" x = "1" y = "1" proclocid = "0" stackname = "stack_routB" heapname = "heap_routB" startid = "2" usetty = "1" /> 298 309 </vspace> 299 310 300 311 <vspace name = "hello" startname = "hello_data" > 301 <vseg name = "seg_code" vbase = "0x00400000" mode = "CXWU" clusterid= "1" psegname = "PSEG_RAM" >312 <vseg name = "seg_code" vbase = "0x00400000" mode = "CXWU" x = "0" y = "1" psegname = "PSEG_RAM" > 302 313 <vobj name = "hello_code" type = "ELF" length = "0x00010000" binpath = "build/hello/hello.elf" /> 303 314 </vseg> 304 <vseg name = "seg_data" vbase = "0x00500000" mode = "C_WU" clusterid= "1" psegname = "PSEG_RAM" >315 <vseg name = "seg_data" vbase = "0x00500000" mode = "C_WU" x = "0" y = "1" psegname = "PSEG_RAM" > 305 316 <vobj name = "hello_data" type = "ELF" length = "0x00010000" binpath = "build/hello/hello.elf" /> 306 317 </vseg> 307 <vseg name = "seg_ptab" vbase = "0x00600000" mode = "C_W_" clusterid= "1" psegname = "PSEG_RAM" >318 <vseg name = "seg_ptab" vbase = "0x00600000" mode = "C_W_" x = "0" y = "1" psegname = "PSEG_RAM" > 308 319 <vobj name = "ptab" type = "PTAB" length = "0x00020000" align = "13" /> 309 320 </vseg> 310 <vseg name = "seg_stack" vbase = "0x00700000" mode = "C_WU" clusterid= "1" psegname = "PSEG_RAM" >321 <vseg name = "seg_stack" vbase = "0x00700000" mode = "C_WU" x = "0" y = "1" psegname = "PSEG_RAM" > 311 322 <vobj name = "stack" type = "BUFFER" length = "0x00010000" /> 312 323 <vobj name = "heap" type = "BUFFER" length = "0x00010000" /> 313 324 </vseg> 314 325 315 <task name = "main_hello" clusterid= "1" proclocid = "0" stackname = "stack" heapname = "heap" startid = "0" usetty = "1" />326 <task name = "main_hello" x = "0" y = "1" proclocid = "0" stackname = "stack" heapname = "heap" startid = "0" usetty = "1" /> 316 327 </vspace> 317 328 318 329 <vspace name = "pgcd" startname = "pgcd_data" > 319 <vseg name = "seg_code" vbase = "0x00400000" mode = "CXWU" clusterid = "2" psegname = "PSEG_RAM" >330 <vseg name = "seg_code" vbase = "0x00400000" mode = "CXWU" x = "1" y = "0" psegname = "PSEG_RAM" > 320 331 <vobj name = "pgcd_code" type = "ELF" length = "0x00010000" binpath = "build/pgcd/pgcd.elf" /> 321 332 </vseg> 322 <vseg name = "seg_data" vbase = "0x00500000" mode = "C_WU" clusterid = "2" psegname = "PSEG_RAM" >333 <vseg name = "seg_data" vbase = "0x00500000" mode = "C_WU" x = "1" y = "0" psegname = "PSEG_RAM" > 323 334 <vobj name = "pgcd_data" type = "ELF" length = "0x00010000" binpath = "build/pgcd/pgcd.elf" /> 324 335 </vseg> 325 <vseg name = "seg_ptab" vbase = "0x00600000" mode = "C_W_" clusterid = "2" psegname = "PSEG_RAM" >336 <vseg name = "seg_ptab" vbase = "0x00600000" mode = "C_W_" x = "1" y = "0" psegname = "PSEG_RAM" > 326 337 <vobj name = "ptab" type = "PTAB" length = "0x00020000" align = "13" /> 327 338 </vseg> 328 <vseg name = "seg_stack" vbase = "0x00700000" mode = "C_WU" clusterid = "2" psegname = "PSEG_RAM" >339 <vseg name = "seg_stack" vbase = "0x00700000" mode = "C_WU" x = "1" y = "0" psegname = "PSEG_RAM" > 329 340 <vobj name = "stack" type = "BUFFER" length = "0x00010000" /> 330 341 <vobj name = "heap" type = "BUFFER" length = "0x00010000" /> 331 342 </vseg> 332 343 333 <task name = "main_pgcd" clusterid = "2" proclocid = "0" stackname = "stack" heapname = "heap" startid = "0" usetty = "1" />344 <task name = "main_pgcd" x = "1" y = "0" proclocid = "0" stackname = "stack" heapname = "heap" startid = "0" usetty = "1" /> 334 345 </vspace> 335 346 336 347 <vspace name = "display" startname = "disp_data" > 337 <vseg name = "seg_code" vbase = "0x00400000" mode = "CXWU" clusterid = "3" psegname = "PSEG_RAM" >348 <vseg name = "seg_code" vbase = "0x00400000" mode = "CXWU" x = "1" y = "1" psegname = "PSEG_RAM" > 338 349 <vobj name = "disp_code" type = "ELF" length = "0x00010000" binpath = "build/display/display.elf" /> 339 350 </vseg> 340 <vseg name = "seg_data" vbase = "0x00500000" mode = "C_WU" clusterid = "3" psegname = "PSEG_RAM" >351 <vseg name = "seg_data" vbase = "0x00500000" mode = "C_WU" x = "1" y = "1" psegname = "PSEG_RAM" > 341 352 <vobj name = "disp_data" type = "ELF" length = "0x00010000" binpath = "build/display/display.elf" /> 342 353 </vseg> 343 <vseg name = "seg_ptab" vbase = "0x00600000" mode = "C_W_" clusterid = "3" psegname = "PSEG_RAM" >354 <vseg name = "seg_ptab" vbase = "0x00600000" mode = "C_W_" x = "1" y = "1" psegname = "PSEG_RAM" > 344 355 <vobj name = "ptab" type = "PTAB" length = "0x00020000" align = "13" /> 345 356 </vseg> 346 <vseg name = "seg_stack" vbase = "0x00700000" mode = "C_WU" clusterid = "3" psegname = "PSEG_RAM" >357 <vseg name = "seg_stack" vbase = "0x00700000" mode = "C_WU" x = "1" y = "1" psegname = "PSEG_RAM" > 347 358 <vobj name = "stack" type = "BUFFER" length = "0x00010000" /> 348 359 <vobj name = "heap" type = "BUFFER" length = "0x00010000" /> 349 360 </vseg> 350 361 351 <task name = "main_display" clusterid = "3" proclocid = "0" stackname = "stack" heapname = "heap" startid = "0" usetty = "1" usecma = "1" />362 <task name = "main_display" x = "1" y = "1" proclocid = "0" stackname = "stack" heapname = "heap" startid = "0" usetty = "1" usecma = "1" /> 352 363 </vspace> 353 364 </vspaceset>
Note: See TracChangeset
for help on using the changeset viewer.