[158] | 1 | /////////////////////////////////////////////////////////////////////////////////////// |
---|
| 2 | // File : xml_parser.c |
---|
[181] | 3 | // Date : 14/04/2012 |
---|
[158] | 4 | // Author : alain greiner |
---|
| 5 | // Copyright (c) UPMC-LIP6 |
---|
| 6 | /////////////////////////////////////////////////////////////////////////////////////// |
---|
[217] | 7 | // This program translate a "map.xml" source file to a binary file "map.bin" that |
---|
| 8 | // can be directly loaded in the boot ROM and used by the GIET-VM operating system. |
---|
| 9 | // |
---|
| 10 | // This map.xml file contains : |
---|
| 11 | // 1) the multi-cluster/multi-processors hardware architecture description |
---|
| 12 | // 2) the various multi-threaded software applications |
---|
| 13 | // 3) the mapping directives bor both the tasks and the virtual segments. |
---|
| 14 | // The corresponding C structures are defined in the "mapping_info.h" file. |
---|
| 15 | // |
---|
| 16 | // This program also generates the "hard_config.h" and the "giet_vsegs.ld" files, |
---|
| 17 | // required to compile the GIET-VM code. |
---|
[158] | 18 | /////////////////////////////////////////////////////////////////////////////////////// |
---|
| 19 | |
---|
| 20 | #include <stdlib.h> |
---|
| 21 | #include <fcntl.h> |
---|
[162] | 22 | #include <sys/types.h> |
---|
| 23 | #include <sys/stat.h> |
---|
[158] | 24 | #include <unistd.h> |
---|
| 25 | #include <stdio.h> |
---|
| 26 | #include <string.h> |
---|
[181] | 27 | #include <assert.h> |
---|
[158] | 28 | #include <libxml/xmlreader.h> |
---|
| 29 | #include <mapping_info.h> |
---|
[189] | 30 | #include <irq_handler.h> |
---|
[158] | 31 | |
---|
[228] | 32 | #define MAX_CLUSTERS 1024 |
---|
| 33 | #define MAX_PSEGS 4096 |
---|
| 34 | #define MAX_VSPACES 1024 |
---|
| 35 | #define MAX_TASKS 4096 |
---|
| 36 | #define MAX_MWMRS 4096 |
---|
| 37 | #define MAX_VSEGS 4096 |
---|
| 38 | #define MAX_VOBJS 8192 |
---|
| 39 | #define MAX_PROCS 1024 |
---|
| 40 | #define MAX_IRQS 8192 |
---|
| 41 | #define MAX_COPROCS 4096 |
---|
| 42 | #define MAX_CP_PORTS 8192 |
---|
| 43 | #define MAX_PERIPHS 8192 |
---|
[158] | 44 | |
---|
[228] | 45 | #define XML_PARSER_DEBUG 0 |
---|
[158] | 46 | |
---|
| 47 | /////////////////////////////////////////////////////////////////////////////////// |
---|
[228] | 48 | // global variables used to store and index the data structures |
---|
[158] | 49 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 50 | |
---|
[228] | 51 | mapping_header_t * header; |
---|
| 52 | mapping_cluster_t * cluster[MAX_CLUSTERS]; // cluster array |
---|
| 53 | mapping_pseg_t * pseg[MAX_PSEGS]; // pseg array |
---|
| 54 | mapping_vspace_t * vspace[MAX_VSPACES]; // vspace array |
---|
| 55 | mapping_vseg_t * vseg[MAX_VSEGS]; // vseg array |
---|
| 56 | mapping_vobj_t * vobj[MAX_VOBJS]; // vobj array |
---|
| 57 | mapping_task_t * task[MAX_TASKS]; // task array |
---|
| 58 | mapping_proc_t * proc[MAX_PROCS]; // proc array |
---|
| 59 | mapping_irq_t * irq[MAX_IRQS]; // irq array |
---|
| 60 | mapping_coproc_t * coproc[MAX_COPROCS]; // coproc array |
---|
| 61 | mapping_cp_port_t * cp_port[MAX_CP_PORTS]; // coproc port array |
---|
| 62 | mapping_periph_t * periph[MAX_PERIPHS]; // peripheral array |
---|
[158] | 63 | |
---|
[189] | 64 | // Index for the various arrays |
---|
[181] | 65 | |
---|
[228] | 66 | unsigned int cluster_index = 0; |
---|
| 67 | unsigned int vspace_index = 0; |
---|
| 68 | unsigned int global_index = 0; |
---|
| 69 | unsigned int pseg_index = 0; |
---|
[181] | 70 | |
---|
[228] | 71 | unsigned int proc_index = 0; |
---|
| 72 | unsigned int proc_loc_index = 0; |
---|
[181] | 73 | |
---|
[228] | 74 | unsigned int irq_index = 0; |
---|
| 75 | unsigned int irq_loc_index = 0; |
---|
[181] | 76 | |
---|
[228] | 77 | unsigned int coproc_index = 0; |
---|
| 78 | unsigned int coproc_loc_index = 0; |
---|
[181] | 79 | |
---|
[228] | 80 | unsigned int cp_port_index = 0; |
---|
| 81 | unsigned int cp_port_loc_index = 0; |
---|
[181] | 82 | |
---|
[228] | 83 | unsigned int periph_index = 0; |
---|
| 84 | unsigned int periph_loc_index = 0; |
---|
[181] | 85 | |
---|
[228] | 86 | unsigned int vseg_index = 0; |
---|
| 87 | unsigned int vseg_loc_index = 0; |
---|
[189] | 88 | |
---|
[228] | 89 | unsigned int task_index = 0; |
---|
| 90 | unsigned int task_loc_index = 0; |
---|
[189] | 91 | |
---|
[228] | 92 | unsigned int vobj_index = 0; |
---|
| 93 | unsigned int vobj_loc_index = 0; |
---|
| 94 | unsigned int vobj_count = 0; |
---|
[165] | 95 | |
---|
[215] | 96 | |
---|
| 97 | ///////////////////////// |
---|
| 98 | // found peripheral |
---|
| 99 | ///////////////////////// |
---|
| 100 | char found_timer = 0; |
---|
| 101 | char found_icu = 0; |
---|
| 102 | char found_xicu = 0; |
---|
| 103 | char found_dma = 0; |
---|
| 104 | |
---|
| 105 | |
---|
| 106 | ////////////////////////////////// |
---|
| 107 | //needed to generate map_config.ld |
---|
| 108 | ////////////////////////////////// |
---|
[228] | 109 | unsigned int cluster_y = 0; |
---|
| 110 | unsigned int cluster_x = 0; |
---|
| 111 | unsigned int nb_proc_max = 0; // max number of processors per cluster |
---|
| 112 | unsigned int nb_timer_channel_max = 0; // max number of user timer |
---|
| 113 | unsigned int nb_dma_channel_max = 0; |
---|
| 114 | unsigned int nb_tty_channel = 0; |
---|
| 115 | unsigned int nb_ioc_channel = 0; |
---|
| 116 | unsigned int nb_nic_channel = 0; |
---|
| 117 | unsigned int io_mmu_active = 0; |
---|
| 118 | unsigned int use_xicu = 0xFFFFFFFF; |
---|
[215] | 119 | |
---|
| 120 | |
---|
| 121 | ////////////////////////////////// |
---|
| 122 | //needed to generate giet_vseg.ld |
---|
| 123 | ////////////////////////////////// |
---|
| 124 | |
---|
| 125 | //kernel and boot code |
---|
[228] | 126 | unsigned int kernel_code_base = 0x80000000; /* kernel code */ |
---|
| 127 | unsigned int kernel_data_base = 0x80010000; /* system cacheable data */ |
---|
| 128 | unsigned int kernel_uncdata_base = 0x80080000; /* system uncacheable data */ |
---|
| 129 | unsigned int kernel_init_base = 0x80090000; /* system init entry */ |
---|
[215] | 130 | |
---|
[228] | 131 | unsigned int boot_code_base = 0xBFC00000; /* boot code */ |
---|
| 132 | unsigned int boot_stack_base = 0xBFC08000; /* boot temporary stack */ |
---|
| 133 | unsigned int boot_mapping_base = 0xBFC0C000; /* mapping_info blob */ |
---|
[215] | 134 | |
---|
| 135 | //periphs |
---|
| 136 | unsigned int tim_base_offset = 0xFFFFFFFF; |
---|
| 137 | unsigned int tty_base_offset = 0xFFFFFFFF; |
---|
| 138 | unsigned int dma_base_offset = 0xFFFFFFFF; |
---|
| 139 | unsigned int ioc_base_offset = 0xFFFFFFFF; |
---|
[218] | 140 | unsigned int nic_base_offset = 0xFFFFFFFF; |
---|
[215] | 141 | unsigned int fbf_base_offset = 0xFFFFFFFF; |
---|
| 142 | unsigned int icu_base_offset = 0xFFFFFFFF; |
---|
| 143 | unsigned int gcd_base_offset = 0xFFFFFFFF; |
---|
| 144 | unsigned int iob_base_offset = 0xFFFFFFFF; |
---|
| 145 | |
---|
| 146 | |
---|
| 147 | ////////////////////////////////////////////////////////////////////// |
---|
[189] | 148 | // This arrray is useful to build a temporary list of vobj references. |
---|
| 149 | // The struct vobj_ref_s is formed by a vspace_name and a vobj_name. |
---|
| 150 | // This array is used to set the attribute vobj_id of a cp_port |
---|
| 151 | // once all the vspace have been parsed. |
---|
[215] | 152 | ///////////////////////////////////////////////////////////////////// |
---|
[228] | 153 | typedef struct vobj_ref_s { |
---|
[189] | 154 | char vspace_name[32]; |
---|
| 155 | char vobj_name[32]; |
---|
[228] | 156 | } vobj_ref_t; |
---|
[189] | 157 | |
---|
[228] | 158 | vobj_ref_t * cp_port_vobj_ref[MAX_CP_PORTS]; |
---|
[189] | 159 | |
---|
| 160 | |
---|
[158] | 161 | ////////////////////////////////////////////////// |
---|
[228] | 162 | unsigned int getIntValue(xmlTextReaderPtr reader, const char * attributeName, unsigned int * ok) { |
---|
| 163 | unsigned int value = 0; |
---|
| 164 | unsigned int i; |
---|
| 165 | char c; |
---|
[158] | 166 | |
---|
[228] | 167 | char * string = (char *) xmlTextReaderGetAttribute(reader, (const xmlChar *) attributeName); |
---|
[158] | 168 | |
---|
[228] | 169 | if (string == NULL) { |
---|
| 170 | // missing argument |
---|
[158] | 171 | *ok = 0; |
---|
| 172 | return 0; |
---|
| 173 | } |
---|
[228] | 174 | else { |
---|
| 175 | if ((string[0] == '0') && ((string[1] == 'x') || (string[1] == 'X'))) { |
---|
| 176 | // Hexa |
---|
| 177 | for (i = 2 ; (string[i] != 0) && (i < 10) ; i++) { |
---|
[158] | 178 | c = string[i]; |
---|
[228] | 179 | if ((c >= '0') && (c <= '9')) { value = (value << 4) + string[i] - 48; } |
---|
| 180 | else if ((c >= 'a') && (c <= 'f')) { value = (value << 4) + string[i] - 87; } |
---|
| 181 | else if ((c >= 'A') && (c <= 'F')) { value = (value << 4) + string[i] - 55; } |
---|
| 182 | else { |
---|
[158] | 183 | *ok = 0; |
---|
| 184 | return 0; |
---|
| 185 | } |
---|
| 186 | } |
---|
| 187 | } |
---|
[228] | 188 | else { |
---|
| 189 | // Decimal |
---|
| 190 | for (i = 0; (string[i] != 0) && (i < 9); i++) { |
---|
[158] | 191 | c = string[i]; |
---|
[228] | 192 | if ((c >= '0') && (c <= '9')) value = (value * 10) + string[i] - 48; |
---|
| 193 | else { |
---|
[158] | 194 | *ok = 0; |
---|
| 195 | return 0; |
---|
| 196 | } |
---|
| 197 | } |
---|
| 198 | } |
---|
| 199 | *ok = 1; |
---|
| 200 | return value; |
---|
| 201 | } |
---|
| 202 | } // end getIntValue() |
---|
| 203 | |
---|
[228] | 204 | |
---|
[158] | 205 | /////////////////////////////////////////////// |
---|
[228] | 206 | char * getStringValue(xmlTextReaderPtr reader, const char * attributeName, unsigned int * ok) { |
---|
| 207 | char * string = (char *) xmlTextReaderGetAttribute(reader, (const xmlChar *) attributeName); |
---|
[158] | 208 | |
---|
[228] | 209 | |
---|
| 210 | if (string == NULL) { |
---|
| 211 | // missing argument |
---|
[158] | 212 | *ok = 0; |
---|
| 213 | return NULL; |
---|
| 214 | } |
---|
[228] | 215 | else { |
---|
[215] | 216 | //we read only string smaller than 32 byte |
---|
[228] | 217 | if (strlen(string) > 32) { |
---|
[215] | 218 | printf("[XML ERROR] all strings must be less than 32 bytes\n"); |
---|
| 219 | exit(1); |
---|
| 220 | } |
---|
| 221 | |
---|
[158] | 222 | *ok = 1; |
---|
| 223 | return string; |
---|
| 224 | } |
---|
| 225 | } // end getStringValue() |
---|
| 226 | |
---|
[228] | 227 | |
---|
[181] | 228 | /////////////////////////////////////// |
---|
[228] | 229 | int getPsegId(unsigned int cluster_id, char * pseg_name) { |
---|
[158] | 230 | unsigned int pseg_id; |
---|
[181] | 231 | unsigned int pseg_min = cluster[cluster_id]->pseg_offset; |
---|
| 232 | unsigned int pseg_max = pseg_min + cluster[cluster_id]->psegs; |
---|
[158] | 233 | |
---|
[228] | 234 | for (pseg_id = pseg_min; pseg_id < pseg_max; pseg_id++) { |
---|
| 235 | if (strcmp(pseg[pseg_id]->name, pseg_name) == 0) { |
---|
[215] | 236 | return pseg_id; |
---|
| 237 | } |
---|
[158] | 238 | } |
---|
| 239 | return -1; |
---|
| 240 | } |
---|
| 241 | |
---|
[228] | 242 | |
---|
[181] | 243 | //////////////////////////////////////////// |
---|
[228] | 244 | int getVspaceId(char * vspace_name) { |
---|
[181] | 245 | unsigned int vspace_id; |
---|
| 246 | |
---|
[228] | 247 | for (vspace_id = 0; vspace_id < vspace_index; vspace_id++) { |
---|
| 248 | if (!strcmp(vspace[vspace_id]->name, vspace_name)) { |
---|
[181] | 249 | return vspace_id; |
---|
| 250 | } |
---|
| 251 | } |
---|
| 252 | return -1; |
---|
| 253 | } |
---|
| 254 | |
---|
[228] | 255 | |
---|
[181] | 256 | //////////////////////////////////////////// |
---|
[228] | 257 | int getVobjLocId(unsigned int vspace_id, char * vobj_name, unsigned int vspace_max) { |
---|
[160] | 258 | unsigned int vobj_id; |
---|
| 259 | unsigned int vobj_min = vspace[vspace_id]->vobj_offset; |
---|
[181] | 260 | unsigned int vobj_max = vobj_min + vspace_max; |
---|
[158] | 261 | |
---|
[228] | 262 | for (vobj_id = vobj_min; vobj_id < vobj_max; vobj_id++) { |
---|
| 263 | if (strcmp(vobj[vobj_id]->name, vobj_name) == 0) { |
---|
| 264 | return (vobj_id - vobj_min); |
---|
[160] | 265 | } |
---|
[158] | 266 | } |
---|
| 267 | return -1; |
---|
| 268 | } |
---|
| 269 | |
---|
[228] | 270 | |
---|
[181] | 271 | ///////////////////////////////////////// |
---|
[228] | 272 | void taskNode(xmlTextReaderPtr reader) { |
---|
| 273 | unsigned int ok; |
---|
| 274 | unsigned int value; |
---|
| 275 | char * str; |
---|
[181] | 276 | |
---|
[228] | 277 | if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { |
---|
| 278 | return; |
---|
| 279 | } |
---|
[181] | 280 | |
---|
[228] | 281 | if (task_index >= MAX_TASKS) { |
---|
[158] | 282 | printf("[XML ERROR] The number of tasks is larger than %d\n", MAX_TASKS); |
---|
| 283 | } |
---|
| 284 | |
---|
| 285 | #if XML_PARSER_DEBUG |
---|
[228] | 286 | printf(" task %d\n", task_loc_index); |
---|
[158] | 287 | #endif |
---|
| 288 | |
---|
[228] | 289 | task[task_index] = (mapping_task_t *) malloc(sizeof(mapping_task_t)); |
---|
[158] | 290 | |
---|
| 291 | ////////// get name attribute |
---|
| 292 | str = getStringValue(reader, "name", &ok); |
---|
[228] | 293 | if (ok) { |
---|
[158] | 294 | #if XML_PARSER_DEBUG |
---|
[228] | 295 | printf(" name = %s\n", str); |
---|
[158] | 296 | #endif |
---|
| 297 | strncpy( task[task_index]->name, str, 31 ); |
---|
| 298 | } |
---|
[228] | 299 | else { |
---|
[158] | 300 | printf("[XML ERROR] illegal or missing <name> attribute for task (%d,%d)\n", |
---|
[228] | 301 | vspace_index, task_loc_index); |
---|
[158] | 302 | exit(1); |
---|
| 303 | } |
---|
| 304 | |
---|
| 305 | ///////// get clusterid attribute |
---|
[228] | 306 | value = getIntValue(reader, "clusterid", &ok); |
---|
| 307 | if (ok) { |
---|
[158] | 308 | #if XML_PARSER_DEBUG |
---|
[228] | 309 | printf(" clusterid = %x\n", value); |
---|
[158] | 310 | #endif |
---|
[228] | 311 | if (value >= header->clusters) { |
---|
[165] | 312 | printf("[XML ERROR] <clusterid> too large for task (%d,%d)\n", |
---|
[228] | 313 | vspace_index, task_loc_index); |
---|
[165] | 314 | exit(1); |
---|
| 315 | } |
---|
[158] | 316 | task[task_index]->clusterid = value; |
---|
| 317 | } |
---|
[228] | 318 | else { |
---|
[158] | 319 | printf("[XML ERROR] illegal or missing <clusterid> attribute for task (%d,%d)\n", |
---|
[228] | 320 | vspace_index, task_loc_index); |
---|
[158] | 321 | exit(1); |
---|
| 322 | } |
---|
| 323 | |
---|
| 324 | ////////// get proclocid attribute |
---|
[228] | 325 | value = getIntValue(reader, "proclocid", &ok); |
---|
| 326 | if (ok) { |
---|
[158] | 327 | #if XML_PARSER_DEBUG |
---|
[228] | 328 | printf(" proclocid = %x\n", value); |
---|
[158] | 329 | #endif |
---|
[228] | 330 | if (value >= cluster[task[task_index]->clusterid]->procs) { |
---|
[165] | 331 | printf("[XML ERROR] <proclocid> too large for task (%d,%d)\n", |
---|
[228] | 332 | vspace_index, task_loc_index); |
---|
[165] | 333 | exit(1); |
---|
| 334 | } |
---|
[158] | 335 | task[task_index]->proclocid = value; |
---|
| 336 | } |
---|
[228] | 337 | else { |
---|
[158] | 338 | printf("[XML ERROR] illegal or missing <locprocid> attribute for task (%d,%d)\n", |
---|
| 339 | vspace_index, task_loc_index); |
---|
| 340 | exit(1); |
---|
| 341 | } |
---|
| 342 | |
---|
| 343 | ////////// get stackname attribute |
---|
| 344 | str = getStringValue(reader, "stackname" , &ok); |
---|
[228] | 345 | if (ok) { |
---|
| 346 | int index = getVobjLocId(vspace_index, str , vobj_loc_index); |
---|
| 347 | if (index >= 0) { |
---|
[158] | 348 | #if XML_PARSER_DEBUG |
---|
[228] | 349 | printf(" stackname = %s\n", str); |
---|
| 350 | printf(" stackid = %d\n", index); |
---|
[158] | 351 | #endif |
---|
[160] | 352 | task[task_index]->vobjlocid = index; |
---|
[158] | 353 | } |
---|
[228] | 354 | else { |
---|
[165] | 355 | printf("[XML ERROR] illegal or missing <stackname> for task (%d,%d)\n", |
---|
| 356 | vspace_index, task_loc_index); |
---|
[158] | 357 | exit(1); |
---|
| 358 | } |
---|
| 359 | } |
---|
[228] | 360 | else { |
---|
[165] | 361 | printf("[XML ERROR] illegal or missing <stackname> for task (%d,%d)\n", |
---|
[158] | 362 | vspace_index, task_loc_index); |
---|
| 363 | exit(1); |
---|
| 364 | } |
---|
| 365 | |
---|
| 366 | ////////// get startid attribute |
---|
[228] | 367 | value = getIntValue(reader, "startid", &ok); |
---|
| 368 | if (ok) { |
---|
[158] | 369 | #if XML_PARSER_DEBUG |
---|
[228] | 370 | printf(" startid = %x\n", value); |
---|
[158] | 371 | #endif |
---|
| 372 | task[task_index]->startid = value; |
---|
| 373 | } |
---|
[228] | 374 | else { |
---|
[158] | 375 | printf("[XML ERROR] illegal or missing <startid> attribute for task (%d,%d)\n", |
---|
| 376 | vspace_index, task_loc_index); |
---|
| 377 | exit(1); |
---|
| 378 | } |
---|
| 379 | |
---|
[189] | 380 | /////////// get usetty attribute (optionnal : 0 if missing) |
---|
[228] | 381 | value = getIntValue(reader, "usetty", &ok); |
---|
| 382 | if (ok) { |
---|
[158] | 383 | #if XML_PARSER_DEBUG |
---|
[228] | 384 | printf(" usetty = %x\n", value); |
---|
[158] | 385 | #endif |
---|
[165] | 386 | task[task_index]->use_tty = value; |
---|
[158] | 387 | } |
---|
[228] | 388 | else { |
---|
[165] | 389 | task[task_index]->use_tty = 0; |
---|
| 390 | } |
---|
| 391 | |
---|
[189] | 392 | /////////// get usenic attribute (optionnal : 0 if missing) |
---|
[228] | 393 | value = getIntValue(reader, "usenic", &ok); |
---|
| 394 | if (ok) { |
---|
[165] | 395 | #if XML_PARSER_DEBUG |
---|
[228] | 396 | printf(" usenic = %x\n", value); |
---|
[165] | 397 | #endif |
---|
[189] | 398 | task[task_index]->use_nic = value; |
---|
[165] | 399 | } |
---|
[228] | 400 | else { |
---|
[189] | 401 | task[task_index]->use_nic = 0; |
---|
[158] | 402 | } |
---|
| 403 | |
---|
[189] | 404 | /////////// get usetimer attribute (optionnal : 0 if missing) |
---|
[228] | 405 | value = getIntValue(reader, "usetimer", &ok); |
---|
| 406 | if (ok) { |
---|
[189] | 407 | #if XML_PARSER_DEBUG |
---|
[228] | 408 | printf(" usetimer = %x\n", value); |
---|
[189] | 409 | #endif |
---|
| 410 | task[task_index]->use_timer = value; |
---|
| 411 | } |
---|
[228] | 412 | else { |
---|
[189] | 413 | task[task_index]->use_timer = 0; |
---|
| 414 | } |
---|
| 415 | |
---|
| 416 | /////////// get usefbdma attribute (optionnal : 0 if missing) |
---|
[228] | 417 | value = getIntValue(reader, "usefbdma", &ok); |
---|
| 418 | if (ok) { |
---|
[189] | 419 | #if XML_PARSER_DEBUG |
---|
[228] | 420 | printf(" usefbdma = %x\n", value); |
---|
[189] | 421 | #endif |
---|
| 422 | task[task_index]->use_fbdma = value; |
---|
[228] | 423 | } |
---|
| 424 | else { |
---|
[189] | 425 | task[task_index]->use_fbdma = 0; |
---|
| 426 | } |
---|
| 427 | |
---|
[158] | 428 | task_index++; |
---|
| 429 | task_loc_index++; |
---|
| 430 | } // end taskNode() |
---|
| 431 | |
---|
[228] | 432 | |
---|
[165] | 433 | ////////////////////////////////////////// |
---|
[228] | 434 | void vobjNode(xmlTextReaderPtr reader) { |
---|
| 435 | unsigned int ok; |
---|
| 436 | unsigned int value; |
---|
| 437 | char * str; |
---|
[160] | 438 | |
---|
[228] | 439 | if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { |
---|
| 440 | return; |
---|
| 441 | } |
---|
[160] | 442 | |
---|
[228] | 443 | if (vobj_index >= MAX_VOBJS) { |
---|
[160] | 444 | printf("[XML ERROR] The number of vobjs is larger than %d\n", MAX_VSEGS); |
---|
| 445 | exit(1); |
---|
| 446 | } |
---|
| 447 | |
---|
| 448 | #if XML_PARSER_DEBUG |
---|
[228] | 449 | printf(" vobj %d\n", vobj_loc_index); |
---|
[160] | 450 | #endif |
---|
| 451 | |
---|
[228] | 452 | vobj[vobj_index] = (mapping_vobj_t *) malloc(sizeof(mapping_vobj_t)); |
---|
[160] | 453 | |
---|
| 454 | ///////// get name attribute |
---|
| 455 | str = getStringValue(reader, "name", &ok); |
---|
[228] | 456 | if (ok) { |
---|
[160] | 457 | #if XML_PARSER_DEBUG |
---|
[228] | 458 | printf(" name = %s\n", str); |
---|
[160] | 459 | #endif |
---|
[228] | 460 | strncpy(vobj[vobj_index]->name, str, 31); |
---|
[160] | 461 | } |
---|
[228] | 462 | else { |
---|
[160] | 463 | printf("[XML ERROR] illegal or missing <name> attribute for vobj (%d,%d)\n", |
---|
| 464 | vseg_index, vobj_loc_index); |
---|
| 465 | exit(1); |
---|
| 466 | } |
---|
| 467 | |
---|
[165] | 468 | //////// get type attribute |
---|
[182] | 469 | str = getStringValue(reader, "type", &ok); |
---|
[160] | 470 | #if XML_PARSER_DEBUG |
---|
[228] | 471 | printf(" type = %s\n", str); |
---|
[160] | 472 | #endif |
---|
[228] | 473 | if (ok && (strcmp(str, "ELF") == 0)) { |
---|
[165] | 474 | vobj[vobj_index]->type = VOBJ_TYPE_ELF; |
---|
| 475 | |
---|
| 476 | //check that this vobj is the first in vseg |
---|
[228] | 477 | if (vobj_count != 0) { |
---|
[165] | 478 | printf("[XML ERROR] an ELF vobj must be alone in a vseg (%d,%d)\n", |
---|
| 479 | vspace_index, vobj_loc_index); |
---|
[160] | 480 | exit(1); |
---|
| 481 | } |
---|
| 482 | } |
---|
[228] | 483 | else if (ok && (strcmp(str, "BLOB") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_BLOB; } |
---|
| 484 | else if (ok && (strcmp(str, "PTAB") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_PTAB; } |
---|
| 485 | else if (ok && (strcmp(str, "PERI") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_PERI; } |
---|
| 486 | else if (ok && (strcmp(str, "MWMR") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_MWMR; } |
---|
| 487 | else if (ok && (strcmp(str, "LOCK") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_LOCK; } |
---|
| 488 | else if (ok && (strcmp(str, "BUFFER") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_BUFFER; } |
---|
| 489 | else if (ok && (strcmp(str, "BARRIER") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_BARRIER; } |
---|
| 490 | else if (ok && (strcmp(str, "CONST") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_CONST; } |
---|
| 491 | else if (ok && (strcmp(str, "MEMSPACE") == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_MEMSPACE; } |
---|
| 492 | else { |
---|
[160] | 493 | printf("[XML ERROR] illegal or missing <type> attribute for vobj (%d,%d)\n", |
---|
[165] | 494 | vspace_index, vobj_loc_index); |
---|
[160] | 495 | exit(1); |
---|
| 496 | } |
---|
| 497 | |
---|
[165] | 498 | ////////// get length attribute |
---|
[228] | 499 | value = getIntValue(reader, "length", &ok); |
---|
| 500 | if (ok) { |
---|
[160] | 501 | #if XML_PARSER_DEBUG |
---|
[228] | 502 | printf(" length = %d\n", value); |
---|
[160] | 503 | #endif |
---|
| 504 | vobj[vobj_index]->length = value; |
---|
| 505 | } |
---|
[228] | 506 | else { |
---|
[165] | 507 | printf("[XML ERROR] illegal or missing <length> attribute for vobj (%d,%d)\n", |
---|
| 508 | vspace_index, vobj_loc_index); |
---|
| 509 | exit(1); |
---|
[160] | 510 | } |
---|
| 511 | |
---|
[165] | 512 | ////////// get align attribute (optional : 0 if missing) |
---|
[228] | 513 | value = getIntValue(reader, "align", &ok); |
---|
| 514 | if (ok) { |
---|
[160] | 515 | #if XML_PARSER_DEBUG |
---|
[228] | 516 | printf(" align = %d\n", value); |
---|
[160] | 517 | #endif |
---|
| 518 | vobj[vobj_index]->align = value; |
---|
| 519 | } |
---|
[228] | 520 | else { |
---|
[160] | 521 | vobj[vobj_index]->align = 0; |
---|
| 522 | } |
---|
| 523 | |
---|
[165] | 524 | ////////// get binpath attribute (optional : '\0' if missing) |
---|
[160] | 525 | str = getStringValue(reader, "binpath", &ok); |
---|
[228] | 526 | if (ok) { |
---|
[160] | 527 | #if XML_PARSER_DEBUG |
---|
[228] | 528 | printf(" binpath = %s\n", str); |
---|
[160] | 529 | #endif |
---|
| 530 | strncpy(vobj[vobj_index]->binpath, str, 63); |
---|
| 531 | } |
---|
[228] | 532 | else { |
---|
[160] | 533 | vobj[vobj_index]->binpath[0] = '\0'; |
---|
| 534 | } |
---|
[228] | 535 | |
---|
[175] | 536 | ////////// get init attribute (mandatory for mwmr and barrier) |
---|
[228] | 537 | value = getIntValue(reader, "init", &ok); |
---|
| 538 | if (ok) { |
---|
[165] | 539 | #if XML_PARSER_DEBUG |
---|
[228] | 540 | printf(" init = %d\n", value); |
---|
[165] | 541 | #endif |
---|
| 542 | vobj[vobj_index]->init = value; |
---|
| 543 | } |
---|
[228] | 544 | else { |
---|
| 545 | if ((vobj[vobj_index]->type == VOBJ_TYPE_MWMR) || |
---|
| 546 | (vobj[vobj_index]->type == VOBJ_TYPE_BARRIER) || |
---|
| 547 | (vobj[vobj_index]->type == VOBJ_TYPE_CONST)) { |
---|
[181] | 548 | printf("[XML ERROR] illegal or missing <value> attribute for vobj (%d,%d). \ |
---|
[228] | 549 | All MWMR or BARRIER vobj must have a init value \n", |
---|
[181] | 550 | vspace_index, vobj_loc_index); |
---|
[175] | 551 | exit(1); |
---|
| 552 | } |
---|
[181] | 553 | vobj[vobj_index]->init = 0; |
---|
[165] | 554 | } |
---|
| 555 | |
---|
[160] | 556 | vobj_index++; |
---|
[165] | 557 | vobj_count++; |
---|
[160] | 558 | vobj_loc_index++; |
---|
[165] | 559 | } // end vobjNode() |
---|
[160] | 560 | |
---|
[228] | 561 | |
---|
[165] | 562 | ////////////////////////////////////////// |
---|
[228] | 563 | void vsegNode(xmlTextReaderPtr reader) { |
---|
| 564 | unsigned int ok; |
---|
| 565 | unsigned int value; |
---|
| 566 | char * str; |
---|
[158] | 567 | |
---|
[228] | 568 | vobj_count = 0; |
---|
[165] | 569 | |
---|
[228] | 570 | if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { |
---|
| 571 | return; |
---|
| 572 | } |
---|
[158] | 573 | |
---|
[228] | 574 | if (vseg_index >= MAX_VSEGS) { |
---|
[158] | 575 | printf("[XML ERROR] The number of vsegs is larger than %d\n", MAX_VSEGS); |
---|
| 576 | exit(1); |
---|
| 577 | } |
---|
| 578 | |
---|
| 579 | #if XML_PARSER_DEBUG |
---|
[228] | 580 | printf(" vseg %d\n", vseg_loc_index); |
---|
[158] | 581 | #endif |
---|
| 582 | |
---|
[228] | 583 | vseg[vseg_index] = (mapping_vseg_t *) malloc(sizeof(mapping_vseg_t)); |
---|
| 584 | |
---|
[160] | 585 | ////////// set vobj_offset attributes |
---|
| 586 | vseg[vseg_index]->vobj_offset = vobj_index; |
---|
| 587 | #if XML_PARSER_DEBUG |
---|
[228] | 588 | printf(" vobj_offset = %d\n", vobj_index); |
---|
[160] | 589 | #endif |
---|
[158] | 590 | |
---|
| 591 | ///////// get name attribute |
---|
| 592 | str = getStringValue(reader, "name", &ok); |
---|
[228] | 593 | if (ok) { |
---|
[158] | 594 | #if XML_PARSER_DEBUG |
---|
[228] | 595 | printf(" name = %s\n", str); |
---|
[158] | 596 | #endif |
---|
| 597 | strncpy( vseg[vseg_index]->name, str, 31); |
---|
| 598 | } |
---|
[228] | 599 | else { |
---|
[158] | 600 | printf("[XML ERROR] illegal or missing <name> attribute for vseg (%d,%d)\n", |
---|
| 601 | vspace_index, vseg_loc_index); |
---|
| 602 | exit(1); |
---|
| 603 | } |
---|
| 604 | |
---|
[203] | 605 | ////////// get ident attribute (optional : 0 if missing) |
---|
[228] | 606 | value = getIntValue(reader, "ident", &ok); |
---|
| 607 | if (ok) { |
---|
[203] | 608 | #if XML_PARSER_DEBUG |
---|
[228] | 609 | printf(" ident = %d\n", value); |
---|
[203] | 610 | #endif |
---|
| 611 | vseg[vseg_index]->ident = value; |
---|
| 612 | } |
---|
[228] | 613 | else { |
---|
[203] | 614 | vseg[vseg_index]->ident = 0; |
---|
| 615 | } |
---|
| 616 | |
---|
[158] | 617 | /////////// get vbase attribute |
---|
[228] | 618 | value = getIntValue(reader, "vbase", &ok); |
---|
| 619 | if (ok) { |
---|
[158] | 620 | #if XML_PARSER_DEBUG |
---|
[228] | 621 | printf(" vbase = 0x%x\n", value); |
---|
[158] | 622 | #endif |
---|
| 623 | vseg[vseg_index]->vbase = value; |
---|
| 624 | } |
---|
[228] | 625 | else { |
---|
[158] | 626 | printf("[XML ERROR] illegal or missing <vbase> attribute for vseg (%d,%d)\n", |
---|
| 627 | vspace_index, vseg_loc_index); |
---|
| 628 | exit(1); |
---|
| 629 | } |
---|
| 630 | |
---|
[181] | 631 | ////////// get clusterid and psegname attributes |
---|
[228] | 632 | value = getIntValue(reader, "clusterid", &ok); |
---|
| 633 | if (ok == 0) { |
---|
[181] | 634 | printf("[XML ERROR] illegal or missing <clusterid> for vseg %d\n", |
---|
[228] | 635 | vseg_loc_index); |
---|
[181] | 636 | exit(1); |
---|
| 637 | } |
---|
[228] | 638 | str = getStringValue(reader, "psegname", &ok); |
---|
| 639 | if (ok == 0) { |
---|
[181] | 640 | printf("[XML ERROR] illegal or missing <psegname> for vseg %d\n", |
---|
[228] | 641 | vseg_loc_index); |
---|
[181] | 642 | exit(1); |
---|
| 643 | } |
---|
| 644 | |
---|
| 645 | /////////// set psegid field |
---|
[228] | 646 | int index = getPsegId(value, str); |
---|
| 647 | if (index >= 0) { |
---|
[181] | 648 | #if XML_PARSER_DEBUG |
---|
[228] | 649 | printf(" clusterid = %d\n", value); |
---|
| 650 | printf(" psegname = %s\n", str); |
---|
| 651 | printf(" psegid = %d\n", index); |
---|
[181] | 652 | #endif |
---|
| 653 | vseg[vseg_index]->psegid = index; |
---|
| 654 | } |
---|
[228] | 655 | else { |
---|
[181] | 656 | printf("[XML ERROR] pseg not found for vseg %d / clusterid = %d / psegname = %s\n", |
---|
[228] | 657 | vseg_loc_index, value, str ); |
---|
[181] | 658 | exit(1); |
---|
| 659 | } |
---|
| 660 | |
---|
[165] | 661 | //////// get mode attribute |
---|
[228] | 662 | str = getStringValue(reader, "mode", &ok); |
---|
[158] | 663 | #if XML_PARSER_DEBUG |
---|
[228] | 664 | printf(" mode = %s\n", str); |
---|
[158] | 665 | #endif |
---|
[228] | 666 | if (ok && (strcmp(str, "CXWU") == 0)) { vseg[vseg_index]->mode = 0xF; } |
---|
| 667 | else if (ok && (strcmp(str, "CXW_") == 0)) { vseg[vseg_index]->mode = 0xE; } |
---|
| 668 | else if (ok && (strcmp(str, "CX_U") == 0)) { vseg[vseg_index]->mode = 0xD; } |
---|
| 669 | else if (ok && (strcmp(str, "CX__") == 0)) { vseg[vseg_index]->mode = 0xC; } |
---|
| 670 | else if (ok && (strcmp(str, "C_WU") == 0)) { vseg[vseg_index]->mode = 0xB; } |
---|
| 671 | else if (ok && (strcmp(str, "C_W_") == 0)) { vseg[vseg_index]->mode = 0xA; } |
---|
| 672 | else if (ok && (strcmp(str, "C__U") == 0)) { vseg[vseg_index]->mode = 0x9; } |
---|
| 673 | else if (ok && (strcmp(str, "C___") == 0)) { vseg[vseg_index]->mode = 0x8; } |
---|
| 674 | else if (ok && (strcmp(str, "_XWU") == 0)) { vseg[vseg_index]->mode = 0x7; } |
---|
| 675 | else if (ok && (strcmp(str, "_XW_") == 0)) { vseg[vseg_index]->mode = 0x6; } |
---|
| 676 | else if (ok && (strcmp(str, "_X_U") == 0)) { vseg[vseg_index]->mode = 0x5; } |
---|
| 677 | else if (ok && (strcmp(str, "_X__") == 0)) { vseg[vseg_index]->mode = 0x4; } |
---|
| 678 | else if (ok && (strcmp(str, "__WU") == 0)) { vseg[vseg_index]->mode = 0x3; } |
---|
| 679 | else if (ok && (strcmp(str, "__W_") == 0)) { vseg[vseg_index]->mode = 0x2; } |
---|
| 680 | else if (ok && (strcmp(str, "___U") == 0)) { vseg[vseg_index]->mode = 0x1; } |
---|
| 681 | else if (ok && (strcmp(str, "____") == 0)) { vseg[vseg_index]->mode = 0x0; } |
---|
| 682 | else { |
---|
[158] | 683 | printf("[XML ERROR] illegal or missing <mode> attribute for vseg (%d,%d)\n", |
---|
| 684 | vspace_index, vseg_loc_index); |
---|
| 685 | exit(1); |
---|
| 686 | } |
---|
[228] | 687 | |
---|
[181] | 688 | ////////// get vobjs in vseg |
---|
| 689 | int status = xmlTextReaderRead(reader); |
---|
[228] | 690 | while (status == 1) { |
---|
| 691 | const char * tag = (const char *) xmlTextReaderConstName(reader); |
---|
[160] | 692 | |
---|
[228] | 693 | if (strcmp(tag, "vobj") == 0 ) { |
---|
| 694 | vobjNode(reader); |
---|
| 695 | } |
---|
| 696 | else if (strcmp(tag, "#text" ) == 0 ) { } |
---|
| 697 | else if (strcmp(tag, "#comment") == 0 ) { } |
---|
| 698 | else if (strcmp(tag, "vseg") == 0 ) { |
---|
[165] | 699 | vseg[vseg_index]->vobjs = vobj_count; |
---|
[160] | 700 | vseg_index++; |
---|
| 701 | vseg_loc_index++; |
---|
| 702 | return; |
---|
| 703 | } |
---|
[228] | 704 | else { |
---|
| 705 | printf("[XML ERROR] Unknown tag %s", tag); |
---|
[160] | 706 | exit(1); |
---|
| 707 | } |
---|
[228] | 708 | status = xmlTextReaderRead (reader); |
---|
[160] | 709 | } |
---|
[158] | 710 | } // end vsegNode() |
---|
| 711 | |
---|
[228] | 712 | |
---|
[158] | 713 | ////////////////////////////////////////// |
---|
[228] | 714 | void vspaceNode(xmlTextReaderPtr reader) { |
---|
| 715 | char * str; |
---|
| 716 | unsigned int ok; |
---|
[165] | 717 | |
---|
| 718 | vobj_loc_index = 0; |
---|
[228] | 719 | vseg_loc_index = 0; |
---|
| 720 | task_loc_index = 0; |
---|
[158] | 721 | |
---|
[228] | 722 | if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { |
---|
| 723 | return; |
---|
| 724 | } |
---|
[158] | 725 | |
---|
| 726 | // checking source file consistency |
---|
[228] | 727 | if (vspace_index >= header->vspaces) { |
---|
[158] | 728 | printf("[XML ERROR] The vspace index is too large : %d\n", |
---|
[228] | 729 | vspace_index); |
---|
[158] | 730 | exit(1); |
---|
| 731 | } |
---|
| 732 | |
---|
| 733 | #if XML_PARSER_DEBUG |
---|
[228] | 734 | printf("\n vspace %d\n", vspace_index); |
---|
[158] | 735 | #endif |
---|
| 736 | |
---|
[228] | 737 | vspace[vspace_index] = (mapping_vspace_t *) malloc(sizeof(mapping_vspace_t)); |
---|
[158] | 738 | |
---|
| 739 | ////////// get name attribute |
---|
| 740 | str = getStringValue(reader, "name", &ok); |
---|
[228] | 741 | if (ok) { |
---|
[158] | 742 | #if XML_PARSER_DEBUG |
---|
[228] | 743 | printf(" name = %s\n", str); |
---|
[158] | 744 | #endif |
---|
| 745 | strncpy(vspace[vspace_index]->name, str, 31); |
---|
| 746 | } |
---|
[228] | 747 | else { |
---|
[165] | 748 | printf("[XML ERROR] illegal or missing <name> attribute for vspace %d\n", |
---|
[228] | 749 | vspace_index); |
---|
[158] | 750 | exit(1); |
---|
| 751 | } |
---|
| 752 | |
---|
[165] | 753 | ////////// set vseg_offset and task_offset attributes |
---|
| 754 | vspace[vspace_index]->vseg_offset = vseg_index; |
---|
| 755 | vspace[vspace_index]->vobj_offset = vobj_index; |
---|
| 756 | vspace[vspace_index]->task_offset = task_index; |
---|
[228] | 757 | |
---|
[158] | 758 | #if XML_PARSER_DEBUG |
---|
[228] | 759 | printf(" vseg_offset = %d\n", vseg_index); |
---|
| 760 | printf(" vobj_offset = %d\n", vobj_index); |
---|
| 761 | printf(" task_offset = %d\n", task_index); |
---|
[158] | 762 | #endif |
---|
| 763 | |
---|
[165] | 764 | ////////// get startname attribute |
---|
| 765 | str = getStringValue(reader, "startname", &ok); |
---|
[228] | 766 | if (ok) { |
---|
[165] | 767 | //used after parsing the vobjs |
---|
[158] | 768 | } |
---|
[228] | 769 | else { |
---|
[203] | 770 | printf("[XML ERROR] illegal or missing <startname> attribute for vspace %s\n", |
---|
[228] | 771 | vspace[vspace_index]->name); |
---|
[158] | 772 | exit(1); |
---|
| 773 | } |
---|
| 774 | |
---|
[181] | 775 | int status = xmlTextReaderRead(reader); |
---|
[228] | 776 | while (status == 1) { |
---|
| 777 | const char * tag = (const char *) xmlTextReaderConstName(reader); |
---|
[158] | 778 | |
---|
[228] | 779 | if (strcmp(tag, "vseg") == 0 ) { |
---|
| 780 | vsegNode(reader); |
---|
| 781 | } |
---|
| 782 | else if (strcmp(tag, "task") == 0 ) { |
---|
| 783 | taskNode(reader); |
---|
| 784 | } |
---|
| 785 | else if (strcmp(tag, "#text") == 0 ) { } |
---|
| 786 | else if (strcmp(tag, "#comment") == 0 ) { } |
---|
| 787 | else if (strcmp(tag, "vspace") == 0 ) { |
---|
[181] | 788 | vspace[vspace_index]->vobjs = vobj_loc_index; |
---|
[160] | 789 | vspace[vspace_index]->tasks = task_loc_index ; |
---|
| 790 | vspace[vspace_index]->vsegs = vseg_loc_index ; |
---|
[165] | 791 | |
---|
| 792 | // get index of the vobj containing the start vector |
---|
[228] | 793 | int index = getVobjLocId(vspace_index, str , vobj_loc_index); |
---|
| 794 | if (index == -1) { |
---|
[203] | 795 | printf("[XML ERROR] vobj containing start vector not found in vspace %s\n", |
---|
| 796 | vspace[vspace_index]->name); |
---|
[160] | 797 | exit(-1); |
---|
[158] | 798 | } |
---|
[228] | 799 | else { |
---|
[165] | 800 | vspace[vspace_index]->start_offset = index; |
---|
| 801 | #if XML_PARSER_DEBUG |
---|
[228] | 802 | printf(" startname = %s\n", str); |
---|
| 803 | printf(" startid = %d\n", index); |
---|
| 804 | printf(" end vspace %d\n\n", vspace_index); |
---|
[165] | 805 | #endif |
---|
| 806 | } |
---|
[160] | 807 | |
---|
[165] | 808 | // checking startid values for all tasks in vspace |
---|
| 809 | int task_id; |
---|
| 810 | int task_min = vspace[vspace_index]->task_offset; |
---|
| 811 | int task_max = task_min + vspace[vspace_index]->tasks; |
---|
[228] | 812 | for (task_id = task_min; task_id < task_max; task_id++) { |
---|
| 813 | if (task[task_id]->startid >= vspace[vspace_index]->tasks) { |
---|
[165] | 814 | printf("[XML ERROR] <startid> too large for task (%d,%d)\n", |
---|
[228] | 815 | vspace_index, task_id ); |
---|
[165] | 816 | exit(1); |
---|
| 817 | } |
---|
| 818 | } |
---|
| 819 | |
---|
[160] | 820 | vspace_index++; |
---|
| 821 | return; |
---|
[158] | 822 | } |
---|
[228] | 823 | else { |
---|
| 824 | printf("[XML ERROR] Unknown tag %s", tag); |
---|
[158] | 825 | exit(1); |
---|
| 826 | } |
---|
[228] | 827 | status = xmlTextReaderRead(reader); |
---|
[158] | 828 | } |
---|
| 829 | } // end vspaceNode() |
---|
| 830 | |
---|
[228] | 831 | |
---|
[215] | 832 | /////////////////////////////////////////// |
---|
[228] | 833 | void cpPortNode(xmlTextReaderPtr reader) { |
---|
| 834 | char * str; |
---|
| 835 | unsigned int ok; |
---|
[215] | 836 | |
---|
[228] | 837 | if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { |
---|
| 838 | return; |
---|
| 839 | } |
---|
[215] | 840 | |
---|
[228] | 841 | if (cp_port_index >= MAX_CP_PORTS) { |
---|
[215] | 842 | printf("[XML ERROR] The number of ports (for coprocs) is larger than %d\n", MAX_CP_PORTS); |
---|
| 843 | } |
---|
| 844 | |
---|
| 845 | #if XML_PARSER_DEBUG |
---|
[228] | 846 | printf("\n port %d\n", cp_port_index); |
---|
[215] | 847 | #endif |
---|
| 848 | |
---|
[228] | 849 | cp_port[cp_port_index] = (mapping_cp_port_t *) malloc(sizeof(mapping_cp_port_t)); |
---|
| 850 | cp_port_vobj_ref[cp_port_index] = (vobj_ref_t *) malloc(sizeof(vobj_ref_t)); |
---|
[215] | 851 | |
---|
| 852 | |
---|
[228] | 853 | |
---|
[215] | 854 | ///////// get direction attribute |
---|
[228] | 855 | str = getStringValue(reader, "direction", &ok); |
---|
| 856 | if (ok) { |
---|
[215] | 857 | #if XML_PARSER_DEBUG |
---|
[228] | 858 | printf(" direction = %s\n", str); |
---|
[215] | 859 | #endif |
---|
[228] | 860 | if (strcmp(str, "TO_COPROC") == 0) { |
---|
| 861 | cp_port[cp_port_index]->direction = PORT_TO_COPROC; |
---|
| 862 | } |
---|
| 863 | else if (strcmp(str, "FROM_COPROC") == 0) { |
---|
| 864 | cp_port[cp_port_index]->direction = PORT_FROM_COPROC; |
---|
| 865 | } |
---|
| 866 | else { |
---|
[215] | 867 | printf("[XML ERROR] illegal <direction> for cp_port %d in cluster %d\n", |
---|
[228] | 868 | cp_port_index, cluster_index); |
---|
[215] | 869 | exit(1); |
---|
| 870 | } |
---|
| 871 | } |
---|
[228] | 872 | else { |
---|
[215] | 873 | printf("[XML ERROR] missing <direction> for cp_port %d in cluster %d\n", |
---|
[228] | 874 | cp_port_index, cluster_index); |
---|
[215] | 875 | exit(1); |
---|
| 876 | } |
---|
[228] | 877 | |
---|
[215] | 878 | /////////// get vspacename attribute |
---|
[228] | 879 | str = getStringValue(reader, "vspacename", &ok); |
---|
[215] | 880 | #if XML_PARSER_DEBUG |
---|
[228] | 881 | printf(" vspacename = %s\n", str); |
---|
[215] | 882 | #endif |
---|
[228] | 883 | if (ok) { |
---|
[215] | 884 | strncpy(cp_port_vobj_ref[cp_port_index]->vspace_name, str, 31); |
---|
| 885 | } |
---|
[228] | 886 | else { |
---|
[215] | 887 | printf("[XML ERROR] missing <vspacename> for cp_port %d in cluster %d\n", |
---|
[228] | 888 | cp_port_index, cluster_index); |
---|
[215] | 889 | exit(1); |
---|
| 890 | } |
---|
| 891 | |
---|
| 892 | /////////// get vobjname attribute |
---|
[228] | 893 | str = getStringValue(reader, "vobjname", &ok); |
---|
[215] | 894 | #if XML_PARSER_DEBUG |
---|
[228] | 895 | printf(" vobjname = %s\n", str); |
---|
[215] | 896 | #endif |
---|
[228] | 897 | if (ok) { |
---|
[215] | 898 | strncpy(cp_port_vobj_ref[cp_port_index]->vobj_name, str, 31); |
---|
| 899 | } |
---|
[228] | 900 | else { |
---|
[215] | 901 | printf("[XML ERROR] missing <vobjname> for cp_port %d in cluster %d\n", |
---|
[228] | 902 | cp_port_index, cluster_index); |
---|
[215] | 903 | exit(1); |
---|
| 904 | } |
---|
[228] | 905 | |
---|
[215] | 906 | cp_port_index++; |
---|
| 907 | cp_port_loc_index++; |
---|
| 908 | |
---|
| 909 | } // end cpPortNode() |
---|
| 910 | |
---|
[228] | 911 | |
---|
[215] | 912 | /////////////////////////////////////////// |
---|
[228] | 913 | void periphNode(xmlTextReaderPtr reader) { |
---|
| 914 | char * str; |
---|
| 915 | unsigned int value; |
---|
| 916 | unsigned int ok; |
---|
[215] | 917 | |
---|
[228] | 918 | if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { |
---|
| 919 | return; |
---|
| 920 | } |
---|
[215] | 921 | |
---|
[228] | 922 | if (periph_index >= MAX_PERIPHS) { |
---|
[215] | 923 | printf("[XML ERROR] The number of periphs is larger than %d\n", MAX_PERIPHS); |
---|
| 924 | } |
---|
| 925 | |
---|
| 926 | #if XML_PARSER_DEBUG |
---|
[228] | 927 | printf("\n periph %d\n", periph_index); |
---|
[215] | 928 | #endif |
---|
| 929 | |
---|
[228] | 930 | periph[periph_index] = (mapping_periph_t *) malloc(sizeof(mapping_periph_t)); |
---|
[215] | 931 | |
---|
| 932 | |
---|
| 933 | ///////// get channels attribute (optionnal : 1 if missing) |
---|
[228] | 934 | value = getIntValue(reader, "channels", &ok); |
---|
| 935 | if (ok) { |
---|
[215] | 936 | #if XML_PARSER_DEBUG |
---|
[228] | 937 | printf(" channels = %d\n", value); |
---|
[215] | 938 | #endif |
---|
| 939 | periph[periph_index]->channels = value; |
---|
| 940 | } |
---|
[228] | 941 | else { |
---|
[215] | 942 | periph[periph_index]->channels = 1; |
---|
| 943 | } |
---|
| 944 | |
---|
| 945 | /////////// get psegname attribute |
---|
[228] | 946 | str = getStringValue(reader, "psegname", &ok); |
---|
| 947 | if (ok == 0) { |
---|
[215] | 948 | printf("[XML ERROR] illegal or missing <psegname> for coproc %d in cluster %d\n", |
---|
[228] | 949 | coproc_index, cluster_index); |
---|
[215] | 950 | exit(1); |
---|
| 951 | } |
---|
| 952 | |
---|
| 953 | /////////// set psegid attribute |
---|
[228] | 954 | int index = getPsegId(cluster_index, str); |
---|
| 955 | if (index >= 0) { |
---|
[215] | 956 | #if XML_PARSER_DEBUG |
---|
[228] | 957 | printf(" clusterid = %d\n", cluster_index); |
---|
| 958 | printf(" psegname = %s\n", str); |
---|
| 959 | printf(" psegid = %d\n", index); |
---|
[215] | 960 | #endif |
---|
| 961 | periph[periph_index]->psegid = index; |
---|
| 962 | assert(pseg[index]->type == PSEG_TYPE_PERI && |
---|
[228] | 963 | "peripheral psegname attribute must refer to a pseg of type PERI" ); |
---|
[215] | 964 | } |
---|
[228] | 965 | else { |
---|
[215] | 966 | printf("[XML ERROR] pseg not found for periph %d / clusterid = %d / psegname = %s\n", |
---|
[228] | 967 | periph_loc_index, cluster_index, str ); |
---|
[215] | 968 | exit(1); |
---|
| 969 | } |
---|
| 970 | |
---|
| 971 | |
---|
| 972 | /////////// get type attribute |
---|
[228] | 973 | str = getStringValue(reader, "type", &ok); |
---|
| 974 | if (ok) { |
---|
[215] | 975 | #if XML_PARSER_DEBUG |
---|
[228] | 976 | printf(" type = %s\n", str); |
---|
[215] | 977 | #endif |
---|
| 978 | unsigned int error = 0; |
---|
[228] | 979 | |
---|
[215] | 980 | // The TTY, IOC, NIC, FBF and IOB peripherals cannot be replicated |
---|
| 981 | // one per architecture |
---|
[228] | 982 | if (strcmp(str, "IOC") == 0) { |
---|
[215] | 983 | periph[periph_index]->type = PERIPH_TYPE_IOC; |
---|
[228] | 984 | if (header->ioc_clusterid == 0xFFFFFFFF) { |
---|
| 985 | header->ioc_clusterid = cluster_index; |
---|
| 986 | } |
---|
| 987 | else { |
---|
| 988 | error = 1; |
---|
| 989 | } |
---|
[215] | 990 | |
---|
[228] | 991 | ioc_base_offset = pseg[periph[periph_index]->psegid]->base; |
---|
[215] | 992 | nb_ioc_channel = periph[periph_index]->channels; |
---|
| 993 | } |
---|
[228] | 994 | else if (strcmp(str, "TTY") == 0) { |
---|
[215] | 995 | periph[periph_index]->type = PERIPH_TYPE_TTY; |
---|
[228] | 996 | if (header->tty_clusterid == 0xFFFFFFFF) { |
---|
| 997 | header->tty_clusterid = cluster_index; |
---|
| 998 | } |
---|
| 999 | else { |
---|
| 1000 | error = 1; |
---|
| 1001 | } |
---|
[215] | 1002 | |
---|
[228] | 1003 | tty_base_offset = pseg[periph[periph_index]->psegid]->base; |
---|
[215] | 1004 | nb_tty_channel = periph[periph_index]->channels; |
---|
| 1005 | } |
---|
[228] | 1006 | else if (strcmp(str, "FBF") == 0) { |
---|
[215] | 1007 | periph[periph_index]->type = PERIPH_TYPE_FBF; |
---|
[228] | 1008 | if (header->fbf_clusterid == 0xFFFFFFFF) { |
---|
| 1009 | header->fbf_clusterid = cluster_index; |
---|
| 1010 | } |
---|
| 1011 | else { |
---|
| 1012 | error = 1; |
---|
| 1013 | } |
---|
| 1014 | fbf_base_offset = pseg[periph[periph_index]->psegid]->base; |
---|
[215] | 1015 | } |
---|
[228] | 1016 | else if (strcmp(str, "NIC") == 0) { |
---|
[215] | 1017 | periph[periph_index]->type = PERIPH_TYPE_NIC; |
---|
[228] | 1018 | if (header->nic_clusterid == 0xFFFFFFFF) { |
---|
| 1019 | header->nic_clusterid = cluster_index; |
---|
| 1020 | } |
---|
| 1021 | else { |
---|
| 1022 | error = 1; |
---|
| 1023 | } |
---|
| 1024 | nic_base_offset = pseg[periph[periph_index]->psegid]->base; |
---|
[215] | 1025 | nb_nic_channel = periph[periph_index]->channels; |
---|
| 1026 | } |
---|
[228] | 1027 | else if (strcmp(str, "IOB") == 0) { |
---|
[215] | 1028 | periph[periph_index]->type = PERIPH_TYPE_IOB; |
---|
[228] | 1029 | iob_base_offset = pseg[periph[periph_index]->psegid]->base; |
---|
[215] | 1030 | |
---|
[228] | 1031 | if (io_mmu_active) { |
---|
| 1032 | error = 1; |
---|
| 1033 | } |
---|
[215] | 1034 | io_mmu_active = 1; |
---|
| 1035 | } |
---|
| 1036 | // The TIM, ICU, XICU, DMA and IOB peripherals can be replicated in several clusters |
---|
| 1037 | // one per cluster |
---|
[228] | 1038 | else if (strcmp(str, "TIM") == 0 ) { |
---|
[215] | 1039 | periph[periph_index]->type = PERIPH_TYPE_TIM; |
---|
[228] | 1040 | if (found_timer) { |
---|
| 1041 | error = 1; |
---|
| 1042 | } |
---|
[215] | 1043 | found_timer = 1; |
---|
| 1044 | |
---|
[228] | 1045 | if (tim_base_offset == 0xFFFFFFFF) { |
---|
[215] | 1046 | tim_base_offset = pseg[ periph[periph_index]->psegid ]->base; |
---|
[228] | 1047 | } |
---|
[215] | 1048 | |
---|
[228] | 1049 | if (nb_timer_channel_max < periph[periph_index]->channels) { |
---|
[215] | 1050 | nb_timer_channel_max = periph[periph_index]->channels; |
---|
[228] | 1051 | } |
---|
[215] | 1052 | } |
---|
[228] | 1053 | else if (strcmp(str, "ICU") == 0) { |
---|
[215] | 1054 | periph[periph_index]->type = PERIPH_TYPE_ICU; |
---|
[228] | 1055 | if (found_icu) { |
---|
| 1056 | error = 1; |
---|
| 1057 | } |
---|
[215] | 1058 | found_icu = 1; |
---|
| 1059 | |
---|
[228] | 1060 | if (icu_base_offset == 0xFFFFFFFF) { |
---|
| 1061 | icu_base_offset = pseg[periph[periph_index]->psegid]->base; |
---|
| 1062 | } |
---|
[215] | 1063 | } |
---|
[228] | 1064 | else if (strcmp(str, "XICU") == 0) { |
---|
[215] | 1065 | periph[periph_index]->type = PERIPH_TYPE_XICU; |
---|
[228] | 1066 | if (found_xicu) { |
---|
| 1067 | error = 1; |
---|
| 1068 | } |
---|
[215] | 1069 | found_xicu = 1; |
---|
| 1070 | |
---|
| 1071 | //'icu' since we can't have both xicu and icu in an arch |
---|
[228] | 1072 | if (icu_base_offset == 0xFFFFFFFF) { |
---|
[215] | 1073 | icu_base_offset = pseg[ periph[periph_index]->psegid ]->base; |
---|
[228] | 1074 | } |
---|
[216] | 1075 | |
---|
[228] | 1076 | if (nb_timer_channel_max == 0) { |
---|
[216] | 1077 | nb_timer_channel_max = 32; |
---|
[228] | 1078 | } |
---|
[215] | 1079 | } |
---|
[228] | 1080 | else if (strcmp(str, "DMA") == 0) { |
---|
[215] | 1081 | periph[periph_index]->type = PERIPH_TYPE_DMA; |
---|
[228] | 1082 | if (found_dma) { |
---|
| 1083 | error = 1; |
---|
| 1084 | } |
---|
[215] | 1085 | found_dma = 1; |
---|
| 1086 | |
---|
[228] | 1087 | if (dma_base_offset == 0xFFFFFFFF) { |
---|
| 1088 | dma_base_offset = pseg[periph[periph_index]->psegid]->base; |
---|
| 1089 | } |
---|
| 1090 | if (nb_dma_channel_max < periph[periph_index]->channels) { |
---|
[215] | 1091 | nb_dma_channel_max = periph[periph_index]->channels; |
---|
[228] | 1092 | } |
---|
[215] | 1093 | } |
---|
[228] | 1094 | else { |
---|
[215] | 1095 | printf("[XML ERROR] illegal <type> for peripheral %d in cluster %d\n", |
---|
[228] | 1096 | periph_loc_index, cluster_index); |
---|
[215] | 1097 | exit(1); |
---|
| 1098 | } |
---|
| 1099 | |
---|
[228] | 1100 | if (error) { |
---|
[215] | 1101 | printf("[XML ERROR] illegal <type> for peripheral %d in cluster %d\n", |
---|
[228] | 1102 | periph_loc_index, cluster_index); |
---|
[215] | 1103 | exit(1); |
---|
| 1104 | } |
---|
| 1105 | } |
---|
[228] | 1106 | else { |
---|
[215] | 1107 | printf("[XML ERROR] missing <type> for peripheral %d in cluster %d\n", |
---|
[228] | 1108 | periph_loc_index, cluster_index); |
---|
[215] | 1109 | exit(1); |
---|
| 1110 | } |
---|
| 1111 | |
---|
[228] | 1112 | |
---|
[215] | 1113 | periph_index++; |
---|
| 1114 | periph_loc_index++; |
---|
| 1115 | cluster[cluster_index]->periphs++; |
---|
| 1116 | |
---|
| 1117 | } // end periphNode |
---|
| 1118 | |
---|
[228] | 1119 | |
---|
[215] | 1120 | ///////////////////////////////////////// |
---|
[228] | 1121 | void coprocNode(xmlTextReaderPtr reader) { |
---|
| 1122 | char * str; |
---|
| 1123 | unsigned int ok; |
---|
[215] | 1124 | |
---|
| 1125 | cp_port_loc_index = 0; |
---|
| 1126 | |
---|
[228] | 1127 | if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { |
---|
| 1128 | return; |
---|
| 1129 | } |
---|
[215] | 1130 | |
---|
[228] | 1131 | if (coproc_index >= MAX_COPROCS) { |
---|
[215] | 1132 | printf("[XML ERROR] The number of coprocs is larger than %d\n", MAX_COPROCS); |
---|
| 1133 | } |
---|
| 1134 | |
---|
| 1135 | #if XML_PARSER_DEBUG |
---|
[228] | 1136 | printf("\n coproc %d\n", coproc_index); |
---|
[215] | 1137 | #endif |
---|
| 1138 | |
---|
[228] | 1139 | coproc[coproc_index] = (mapping_coproc_t *) malloc(sizeof(mapping_coproc_t)); |
---|
[215] | 1140 | |
---|
| 1141 | /////////// get name attribute |
---|
[228] | 1142 | str = getStringValue(reader, "name", &ok); |
---|
| 1143 | if (ok) { |
---|
[215] | 1144 | #if XML_PARSER_DEBUG |
---|
[228] | 1145 | printf(" name = %s\n", str); |
---|
[215] | 1146 | #endif |
---|
| 1147 | strncpy(coproc[coproc_index]->name, str, 31); |
---|
| 1148 | } |
---|
[228] | 1149 | else { |
---|
[215] | 1150 | printf("[XML ERROR] illegal or missing <name> for coproc %d in cluster %d\n", |
---|
[228] | 1151 | coproc_index, cluster_index); |
---|
[215] | 1152 | exit(1); |
---|
| 1153 | } |
---|
| 1154 | |
---|
| 1155 | /////////// get psegname attribute |
---|
[228] | 1156 | str = getStringValue(reader, "psegname", &ok); |
---|
| 1157 | if (ok == 0) { |
---|
[215] | 1158 | printf("[XML ERROR] illegal or missing <psegname> for coproc %d in cluster %d\n", |
---|
[228] | 1159 | coproc_index, cluster_index); |
---|
[215] | 1160 | exit(1); |
---|
| 1161 | } |
---|
| 1162 | |
---|
| 1163 | /////////// set psegid attribute |
---|
[228] | 1164 | int index = getPsegId(cluster_index, str); |
---|
| 1165 | if (index >= 0) { |
---|
[215] | 1166 | #if XML_PARSER_DEBUG |
---|
[228] | 1167 | printf(" clusterid = %d\n", cluster_index); |
---|
| 1168 | printf(" psegname = %s\n", str); |
---|
| 1169 | printf(" psegid = %d\n", index); |
---|
[215] | 1170 | #endif |
---|
| 1171 | coproc[coproc_index]->psegid = index; |
---|
| 1172 | assert(pseg[index]->type == PSEG_TYPE_PERI && "coproc psegname attribute must refer to a pseg of type PERI" ); |
---|
| 1173 | } |
---|
[228] | 1174 | else { |
---|
[215] | 1175 | printf("[XML ERROR] pseg not found for coproc %d / clusterid = %d / psegname = %s\n", |
---|
[228] | 1176 | coproc_index, cluster_index, str ); |
---|
[215] | 1177 | exit(1); |
---|
| 1178 | } |
---|
| 1179 | |
---|
| 1180 | ////////// set port_offset |
---|
| 1181 | coproc[coproc_index]->port_offset = cp_port_index; |
---|
| 1182 | |
---|
| 1183 | #if XML_PARSER_DEBUG |
---|
[228] | 1184 | printf(" port_offset = %d\n", cp_port_index); |
---|
[215] | 1185 | #endif |
---|
| 1186 | |
---|
| 1187 | int status = xmlTextReaderRead(reader); |
---|
[228] | 1188 | while (status == 1) { |
---|
| 1189 | const char * tag = (const char *) xmlTextReaderConstName(reader); |
---|
[215] | 1190 | |
---|
[228] | 1191 | if (strcmp(tag, "port") == 0 ) { |
---|
| 1192 | cpPortNode(reader); |
---|
| 1193 | } |
---|
| 1194 | else if (strcmp(tag, "#text") == 0 ) { } |
---|
| 1195 | else if (strcmp(tag, "#comment") == 0 ) { } |
---|
| 1196 | else if (strcmp(tag, "coproc") == 0 ) { |
---|
[215] | 1197 | coproc[coproc_index]->ports = cp_port_loc_index; |
---|
| 1198 | cluster[cluster_index]->coprocs++; |
---|
| 1199 | coproc_loc_index++; |
---|
| 1200 | coproc_index++; |
---|
| 1201 | return; |
---|
| 1202 | } |
---|
[228] | 1203 | else { |
---|
| 1204 | printf("[XML ERROR] Unknown tag %s", tag); |
---|
[215] | 1205 | exit(1); |
---|
| 1206 | } |
---|
[228] | 1207 | status = xmlTextReaderRead(reader); |
---|
[215] | 1208 | } |
---|
| 1209 | } // end coprocNode() |
---|
| 1210 | |
---|
[228] | 1211 | |
---|
[215] | 1212 | /////////////////////////////////////// |
---|
[228] | 1213 | void irqNode(xmlTextReaderPtr reader) { |
---|
| 1214 | unsigned int ok; |
---|
| 1215 | unsigned int value; |
---|
| 1216 | char * str; |
---|
[215] | 1217 | |
---|
[228] | 1218 | if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { |
---|
| 1219 | return; |
---|
| 1220 | } |
---|
[215] | 1221 | |
---|
[228] | 1222 | if (irq_index >= MAX_IRQS) { |
---|
[215] | 1223 | printf("[XML ERROR] The number of irqs is larger than %d\n", MAX_IRQS); |
---|
| 1224 | } |
---|
| 1225 | |
---|
| 1226 | #if XML_PARSER_DEBUG |
---|
[228] | 1227 | printf(" irq %d\n", irq_loc_index); |
---|
[215] | 1228 | #endif |
---|
| 1229 | |
---|
[228] | 1230 | irq[irq_index] = (mapping_irq_t *) malloc(sizeof(mapping_irq_t)); |
---|
[215] | 1231 | |
---|
| 1232 | ///////// get type attribute |
---|
[228] | 1233 | str = getStringValue(reader, "type", &ok); |
---|
| 1234 | if (ok) { |
---|
[215] | 1235 | #if XML_PARSER_DEBUG |
---|
[228] | 1236 | printf(" type = %s\n", str); |
---|
[215] | 1237 | #endif |
---|
[228] | 1238 | if (strcmp(str, "HARD") == 0 ) { |
---|
| 1239 | irq[irq_index]->type = 0; |
---|
| 1240 | } |
---|
| 1241 | else if (strcmp(str, "SOFT") == 0 ) { |
---|
| 1242 | irq[irq_index]->type = 1; |
---|
| 1243 | } |
---|
| 1244 | else { |
---|
[215] | 1245 | printf("[XML ERROR] undefined IRQ <type> for processor %d in cluster %d\n", |
---|
[228] | 1246 | cluster_index, proc_loc_index); |
---|
[215] | 1247 | exit(1); |
---|
| 1248 | } |
---|
| 1249 | } |
---|
[228] | 1250 | else { |
---|
[215] | 1251 | printf("[XML ERROR] missing IRQ <type> for processor %d in cluster %d\n", |
---|
[228] | 1252 | cluster_index, proc_loc_index); |
---|
[215] | 1253 | exit(1); |
---|
| 1254 | } |
---|
| 1255 | |
---|
| 1256 | ///////// get icuid attribute |
---|
| 1257 | value = getIntValue(reader, "icuid", &ok); |
---|
[228] | 1258 | if (ok) { |
---|
[215] | 1259 | #if XML_PARSER_DEBUG |
---|
[228] | 1260 | printf(" icuid = %d\n", value); |
---|
[215] | 1261 | #endif |
---|
| 1262 | irq[irq_index]->icuid = value; |
---|
[228] | 1263 | if (value >= 32) { |
---|
[215] | 1264 | printf("[XML ERROR] IRQ <icuid> too large for processor %d in cluster %d\n", |
---|
[228] | 1265 | cluster_index, proc_loc_index); |
---|
[215] | 1266 | exit(1); |
---|
| 1267 | } |
---|
| 1268 | } |
---|
[228] | 1269 | else { |
---|
[215] | 1270 | printf("[XML ERROR] missing IRQ <icuid> for processor %d in cluster %d\n", |
---|
[228] | 1271 | cluster_index, proc_loc_index); |
---|
[215] | 1272 | exit(1); |
---|
| 1273 | } |
---|
| 1274 | |
---|
| 1275 | ///////// get isr attribute |
---|
[228] | 1276 | str = getStringValue(reader, "isr", &ok); |
---|
| 1277 | if (ok) { |
---|
[215] | 1278 | #if XML_PARSER_DEBUG |
---|
[228] | 1279 | printf(" isr = %s\n", str); |
---|
[215] | 1280 | #endif |
---|
[228] | 1281 | if (strcmp(str, "ISR_SWITCH" ) == 0) { irq[irq_index]->isr = ISR_SWITCH; } |
---|
| 1282 | else if (strcmp(str, "ISR_IOC" ) == 0) { irq[irq_index]->isr = ISR_IOC; } |
---|
| 1283 | else if (strcmp(str, "ISR_DMA" ) == 0) { irq[irq_index]->isr = ISR_DMA; } |
---|
| 1284 | else if (strcmp(str, "ISR_TTY" ) == 0) { irq[irq_index]->isr = ISR_TTY; } |
---|
| 1285 | else if (strcmp(str, "ISR_TIMER" ) == 0) { irq[irq_index]->isr = ISR_TIMER; } |
---|
| 1286 | else { |
---|
[215] | 1287 | printf("[XML ERROR] illegal IRQ <isr> for processor %d in cluster %d\n", |
---|
[228] | 1288 | cluster_index, proc_loc_index); |
---|
[215] | 1289 | exit(1); |
---|
| 1290 | } |
---|
| 1291 | #if XML_PARSER_DEBUG |
---|
[228] | 1292 | printf(" isrnum = %d\n", irq[irq_index]->isr); |
---|
[215] | 1293 | #endif |
---|
| 1294 | } |
---|
[228] | 1295 | else { |
---|
[215] | 1296 | printf("[XML ERROR] missing IRQ <isr> for processor %d in cluster %d\n", |
---|
[228] | 1297 | cluster_index, proc_loc_index); |
---|
[215] | 1298 | exit(1); |
---|
| 1299 | } |
---|
| 1300 | |
---|
| 1301 | ///////// get channel attribute (optionnal : 0 if missing) |
---|
| 1302 | value = getIntValue(reader, "channel", &ok); |
---|
[228] | 1303 | if (ok) { |
---|
[215] | 1304 | #if XML_PARSER_DEBUG |
---|
[228] | 1305 | printf(" channel = %d\n", value); |
---|
[215] | 1306 | #endif |
---|
| 1307 | irq[irq_index]->channel = value; |
---|
| 1308 | } |
---|
[228] | 1309 | else { |
---|
[215] | 1310 | irq[irq_index]->channel = 0; |
---|
| 1311 | } |
---|
| 1312 | |
---|
| 1313 | irq_index++; |
---|
| 1314 | irq_loc_index++; |
---|
| 1315 | |
---|
| 1316 | } // end irqNode |
---|
| 1317 | |
---|
[228] | 1318 | |
---|
[215] | 1319 | ///////////////////////////////////////// |
---|
[228] | 1320 | void procNode(xmlTextReaderPtr reader) { |
---|
| 1321 | unsigned int ok; |
---|
| 1322 | unsigned int value; |
---|
[215] | 1323 | |
---|
| 1324 | irq_loc_index = 0; |
---|
| 1325 | |
---|
[228] | 1326 | if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { |
---|
| 1327 | return; |
---|
| 1328 | } |
---|
[215] | 1329 | |
---|
[228] | 1330 | if (proc_index >= MAX_PROCS) { |
---|
[215] | 1331 | printf("[XML ERROR] The number of procs is larger than %d\n", MAX_PROCS); |
---|
| 1332 | } |
---|
| 1333 | |
---|
| 1334 | #if XML_PARSER_DEBUG |
---|
[228] | 1335 | printf("\n proc %d\n", proc_index); |
---|
[215] | 1336 | #endif |
---|
| 1337 | |
---|
[228] | 1338 | proc[proc_index] = (mapping_proc_t *) malloc(sizeof(mapping_proc_t)); |
---|
[215] | 1339 | |
---|
| 1340 | |
---|
| 1341 | /////////// get index attribute (optional) |
---|
[228] | 1342 | value = getIntValue(reader, "index", &ok); |
---|
| 1343 | if (ok && (value != proc_loc_index)) { |
---|
| 1344 | printf("[XML ERROR] wrong proc index / expected value is %d", |
---|
[215] | 1345 | proc_loc_index); |
---|
[228] | 1346 | exit(1); |
---|
[215] | 1347 | } |
---|
| 1348 | |
---|
| 1349 | ////////// set irq_offset attribute |
---|
| 1350 | proc[proc_index]->irq_offset = irq_index; |
---|
| 1351 | |
---|
| 1352 | #if XML_PARSER_DEBUG |
---|
[228] | 1353 | printf(" irq_offset = %d\n", irq_index); |
---|
[215] | 1354 | #endif |
---|
| 1355 | |
---|
| 1356 | int status = xmlTextReaderRead(reader); |
---|
[228] | 1357 | while (status == 1) { |
---|
| 1358 | const char * tag = (const char *) xmlTextReaderConstName(reader); |
---|
[215] | 1359 | |
---|
[228] | 1360 | if (strcmp(tag, "irq") == 0) { |
---|
| 1361 | irqNode(reader); |
---|
| 1362 | } |
---|
| 1363 | else if (strcmp(tag, "#text") == 0) { } |
---|
| 1364 | else if (strcmp(tag, "#comment") == 0) { } |
---|
| 1365 | else if (strcmp(tag, "proc") == 0) { |
---|
[215] | 1366 | proc[proc_index]->irqs = irq_loc_index; |
---|
| 1367 | cluster[cluster_index]->procs++; |
---|
| 1368 | proc_loc_index++; |
---|
| 1369 | proc_index++; |
---|
| 1370 | return; |
---|
| 1371 | } |
---|
[228] | 1372 | else { |
---|
| 1373 | printf("[XML ERROR] Unknown tag %s", tag); |
---|
[215] | 1374 | exit(1); |
---|
| 1375 | } |
---|
[228] | 1376 | status = xmlTextReaderRead(reader); |
---|
[215] | 1377 | } |
---|
| 1378 | } // end procNode() |
---|
| 1379 | |
---|
| 1380 | |
---|
[158] | 1381 | ////////////////////////////////////////// |
---|
[228] | 1382 | void psegNode(xmlTextReaderPtr reader) { |
---|
| 1383 | unsigned int ok; |
---|
| 1384 | unsigned int value; |
---|
| 1385 | char * str; |
---|
[158] | 1386 | |
---|
[228] | 1387 | if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { |
---|
| 1388 | return; |
---|
| 1389 | } |
---|
[158] | 1390 | |
---|
[228] | 1391 | if (pseg_index >= MAX_PSEGS) { |
---|
[158] | 1392 | printf("[XML ERROR] The number of psegs is larger than %d\n", MAX_PSEGS); |
---|
| 1393 | exit(1); |
---|
| 1394 | } |
---|
| 1395 | |
---|
| 1396 | #if XML_PARSER_DEBUG |
---|
[228] | 1397 | printf(" pseg %d\n", pseg_index); |
---|
[158] | 1398 | #endif |
---|
| 1399 | |
---|
[228] | 1400 | pseg[pseg_index] = (mapping_pseg_t *) malloc(sizeof(mapping_pseg_t)); |
---|
[158] | 1401 | |
---|
[181] | 1402 | /////// get name attribute |
---|
[228] | 1403 | str = getStringValue(reader, "name", &ok); |
---|
[158] | 1404 | #if XML_PARSER_DEBUG |
---|
[228] | 1405 | printf(" name = %s\n", str); |
---|
[158] | 1406 | #endif |
---|
[228] | 1407 | if (ok) { |
---|
[158] | 1408 | strncpy(pseg[pseg_index]->name, str, 31); |
---|
| 1409 | } |
---|
[228] | 1410 | else { |
---|
[181] | 1411 | printf("[XML ERROR] illegal or missing <name> for pseg %d in cluster %d\n", |
---|
[228] | 1412 | pseg_index, cluster_index); |
---|
[158] | 1413 | exit(1); |
---|
| 1414 | } |
---|
| 1415 | |
---|
[181] | 1416 | //////// get type attribute |
---|
| 1417 | str = getStringValue(reader, "type", &ok); |
---|
| 1418 | #if XML_PARSER_DEBUG |
---|
[228] | 1419 | printf(" type = %s\n", str); |
---|
[181] | 1420 | #endif |
---|
[228] | 1421 | if (ok && (strcmp(str, "RAM" ) == 0)) { pseg[pseg_index]->type = PSEG_TYPE_RAM; } |
---|
| 1422 | else if (ok && (strcmp(str, "ROM" ) == 0)) { pseg[pseg_index]->type = PSEG_TYPE_ROM; } |
---|
| 1423 | else if (ok && (strcmp(str, "PERI") == 0)) { pseg[pseg_index]->type = PSEG_TYPE_PERI; } |
---|
| 1424 | else { |
---|
[181] | 1425 | printf("[XML ERROR] illegal or missing <type> for pseg %s in cluster %d\n", |
---|
[228] | 1426 | pseg[pseg_index]->name, cluster_index); |
---|
[181] | 1427 | exit(1); |
---|
| 1428 | } |
---|
| 1429 | |
---|
| 1430 | //////// get base attribute |
---|
[228] | 1431 | value = getIntValue(reader, "base", &ok); |
---|
[158] | 1432 | #if XML_PARSER_DEBUG |
---|
[228] | 1433 | printf(" base = 0x%x\n", value); |
---|
[158] | 1434 | #endif |
---|
[228] | 1435 | if (ok) { |
---|
[158] | 1436 | pseg[pseg_index]->base = value; |
---|
| 1437 | } |
---|
[228] | 1438 | else { |
---|
[181] | 1439 | printf("[XML ERROR] illegal or missing <base> for pseg %s in cluster %d\n", |
---|
[228] | 1440 | pseg[pseg_index]->name, cluster_index); |
---|
[158] | 1441 | exit(1); |
---|
| 1442 | } |
---|
| 1443 | |
---|
[181] | 1444 | //////// get length attribute |
---|
[228] | 1445 | value = getIntValue(reader, "length", &ok); |
---|
[158] | 1446 | #if XML_PARSER_DEBUG |
---|
[228] | 1447 | printf(" length = 0x%x\n", value); |
---|
[158] | 1448 | #endif |
---|
[228] | 1449 | if (ok) { |
---|
[158] | 1450 | pseg[pseg_index]->length = value; |
---|
| 1451 | } |
---|
[228] | 1452 | else { |
---|
[181] | 1453 | printf("[XML ERROR] illegal or missing <length> for pseg %s in cluster %d\n", |
---|
[228] | 1454 | pseg[pseg_index]->name, cluster_index); |
---|
[158] | 1455 | exit(1); |
---|
| 1456 | } |
---|
| 1457 | |
---|
[181] | 1458 | //////// set cluster attribute |
---|
| 1459 | pseg[pseg_index]->cluster = cluster_index; |
---|
| 1460 | |
---|
[158] | 1461 | pseg_index++; |
---|
[181] | 1462 | cluster[cluster_index]->psegs++; |
---|
[158] | 1463 | } // end psegNode() |
---|
| 1464 | |
---|
[228] | 1465 | |
---|
[158] | 1466 | ///////////////////////////////////////////// |
---|
[228] | 1467 | void clusterNode(xmlTextReaderPtr reader) { |
---|
[158] | 1468 | unsigned int ok; |
---|
| 1469 | unsigned int value; |
---|
| 1470 | |
---|
[228] | 1471 | cluster[cluster_index] = (mapping_cluster_t *) malloc(sizeof(mapping_cluster_t)); |
---|
| 1472 | |
---|
[215] | 1473 | //initialise all variables |
---|
| 1474 | //they will be incremented by *Node() functions |
---|
| 1475 | //FIXME: calloc? |
---|
| 1476 | cluster[cluster_index]->psegs = 0; |
---|
| 1477 | cluster[cluster_index]->procs = 0; |
---|
| 1478 | cluster[cluster_index]->coprocs = 0; |
---|
| 1479 | cluster[cluster_index]->periphs = 0; |
---|
| 1480 | |
---|
| 1481 | |
---|
| 1482 | //initialise global variables |
---|
| 1483 | //TODO: delete those three |
---|
[181] | 1484 | proc_loc_index = 0; |
---|
| 1485 | coproc_loc_index = 0; |
---|
[189] | 1486 | periph_loc_index = 0; |
---|
[181] | 1487 | |
---|
[215] | 1488 | // for replicated periph |
---|
| 1489 | found_timer = 0; |
---|
| 1490 | found_icu = 0; |
---|
| 1491 | found_xicu = 0; |
---|
| 1492 | found_dma = 0; |
---|
| 1493 | |
---|
[228] | 1494 | if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { |
---|
| 1495 | return; |
---|
| 1496 | } |
---|
[158] | 1497 | |
---|
| 1498 | // checking source file consistency |
---|
[228] | 1499 | if (cluster_index >= header->clusters) { |
---|
[158] | 1500 | printf("[XML ERROR] The cluster index is too large : %d\n", cluster_index); |
---|
| 1501 | exit(1); |
---|
| 1502 | } |
---|
| 1503 | |
---|
| 1504 | #if XML_PARSER_DEBUG |
---|
[228] | 1505 | printf(" cluster %d\n", cluster_index); |
---|
[158] | 1506 | #endif |
---|
| 1507 | |
---|
| 1508 | |
---|
[189] | 1509 | /////////// check cluster index attribute (optional) |
---|
[228] | 1510 | value = getIntValue(reader, "index", &ok); |
---|
| 1511 | if (ok && (value != cluster_index)) { |
---|
| 1512 | printf("[XML ERROR] wrong cluster index / expected value is %d", |
---|
[158] | 1513 | cluster_index); |
---|
[228] | 1514 | exit(1); |
---|
[158] | 1515 | } |
---|
| 1516 | |
---|
[189] | 1517 | ////////// set offsets |
---|
[228] | 1518 | cluster[cluster_index]->pseg_offset = pseg_index; |
---|
| 1519 | cluster[cluster_index]->proc_offset = proc_index; |
---|
[189] | 1520 | cluster[cluster_index]->coproc_offset = coproc_index; |
---|
| 1521 | cluster[cluster_index]->periph_offset = periph_index; |
---|
[181] | 1522 | |
---|
[158] | 1523 | #if XML_PARSER_DEBUG |
---|
[228] | 1524 | printf(" pseg_offset = %d\n", pseg_index); |
---|
| 1525 | printf(" proc_offset = %d\n", proc_index); |
---|
| 1526 | printf(" coproc_offset = %d\n", coproc_index); |
---|
| 1527 | printf(" periph_offset = %d\n", coproc_index); |
---|
[158] | 1528 | #endif |
---|
[181] | 1529 | |
---|
[189] | 1530 | ////////// get psegs, procs, coprocs and periphs |
---|
[181] | 1531 | int status = xmlTextReaderRead(reader); |
---|
| 1532 | |
---|
[228] | 1533 | while (status == 1) { |
---|
| 1534 | const char * tag = (const char *) xmlTextReaderConstName(reader); |
---|
[181] | 1535 | |
---|
[228] | 1536 | if (strcmp(tag, "pseg") == 0) psegNode(reader); |
---|
| 1537 | else if (strcmp(tag, "proc") == 0) procNode(reader); |
---|
| 1538 | else if (strcmp(tag, "coproc") == 0) coprocNode(reader); |
---|
| 1539 | else if (strcmp(tag, "periph") == 0) periphNode(reader); |
---|
| 1540 | else if (strcmp(tag, "#text") == 0) { } |
---|
| 1541 | else if (strcmp(tag, "#comment") == 0) { } |
---|
| 1542 | else if (strcmp(tag, "cluster") == 0) { |
---|
[189] | 1543 | |
---|
[228] | 1544 | if (use_xicu == 0xFFFFFFFF) { |
---|
[215] | 1545 | use_xicu = found_xicu; |
---|
[228] | 1546 | } |
---|
[189] | 1547 | |
---|
[215] | 1548 | ////////////////// peripherals checks //////////////////// |
---|
[228] | 1549 | if ((found_timer && use_xicu) || (!found_timer && !use_xicu)) { |
---|
[215] | 1550 | printf("[XML ERROR] illegal or missing timer peripheral in cluster %d\n", cluster_index); |
---|
| 1551 | exit(1); |
---|
| 1552 | } |
---|
| 1553 | |
---|
[228] | 1554 | if ((found_icu && use_xicu) || (!found_icu && !use_xicu)) { |
---|
[215] | 1555 | printf("[XML ERROR] illegal or missing icu peripheral in cluster %d\n", cluster_index); |
---|
| 1556 | exit(1); |
---|
| 1557 | } |
---|
| 1558 | |
---|
[228] | 1559 | if (!found_xicu && use_xicu) { |
---|
[215] | 1560 | printf("[XML ERROR] illegal or missing dma peripheral in cluster %d\n", cluster_index); |
---|
| 1561 | exit(1); |
---|
| 1562 | } |
---|
| 1563 | |
---|
[228] | 1564 | if (!found_dma) { |
---|
[215] | 1565 | printf("[XML ERROR] illegal or missing dma peripheral in cluster %d\n", cluster_index); |
---|
| 1566 | exit(1); |
---|
| 1567 | } |
---|
| 1568 | |
---|
[228] | 1569 | |
---|
| 1570 | if (nb_proc_max < cluster[cluster_index]->procs) { |
---|
[215] | 1571 | nb_proc_max = cluster[cluster_index]->procs; |
---|
[228] | 1572 | } |
---|
[215] | 1573 | |
---|
[181] | 1574 | #if XML_PARSER_DEBUG |
---|
[228] | 1575 | printf(" psegs = %d\n", cluster[cluster_index]->psegs); |
---|
| 1576 | printf(" procs = %d\n", cluster[cluster_index]->procs); |
---|
| 1577 | printf(" coprocs = %d\n", cluster[cluster_index]->coprocs); |
---|
| 1578 | printf(" periphs = %d\n", cluster[cluster_index]->periphs); |
---|
| 1579 | printf(" end cluster %d\n", cluster_index); |
---|
[181] | 1580 | #endif |
---|
| 1581 | cluster_index++; |
---|
| 1582 | return; |
---|
| 1583 | } |
---|
| 1584 | status = xmlTextReaderRead(reader); |
---|
[158] | 1585 | } |
---|
| 1586 | } // end clusterNode() |
---|
| 1587 | |
---|
[228] | 1588 | |
---|
[158] | 1589 | ////////////////////////////////////////////// |
---|
[228] | 1590 | void clusterSetNode(xmlTextReaderPtr reader) { |
---|
| 1591 | if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { |
---|
| 1592 | return; |
---|
| 1593 | } |
---|
[158] | 1594 | |
---|
| 1595 | #if XML_PARSER_DEBUG |
---|
[228] | 1596 | printf("\n clusters set\n"); |
---|
[158] | 1597 | #endif |
---|
| 1598 | |
---|
[181] | 1599 | int status = xmlTextReaderRead(reader); |
---|
[228] | 1600 | while (status == 1) { |
---|
| 1601 | const char * tag = (const char *) xmlTextReaderConstName(reader); |
---|
[158] | 1602 | |
---|
[228] | 1603 | if (strcmp(tag, "cluster") == 0) { |
---|
| 1604 | clusterNode(reader); |
---|
| 1605 | } |
---|
| 1606 | else if (strcmp(tag, "#text") == 0) { } |
---|
| 1607 | else if (strcmp(tag, "#comment") == 0) { } |
---|
| 1608 | else if (strcmp(tag, "clusterset") == 0) { |
---|
[158] | 1609 | // checking source file consistency |
---|
[228] | 1610 | if (cluster_index != header->clusters) { |
---|
[158] | 1611 | printf("[XML ERROR] Wrong number of clusters\n"); |
---|
| 1612 | exit(1); |
---|
| 1613 | } |
---|
[215] | 1614 | |
---|
[228] | 1615 | if (header->tty_clusterid == 0xFFFFFFFF) { |
---|
[215] | 1616 | printf("[XML ERROR] illegal or missing tty peripheral"); |
---|
| 1617 | exit(1); |
---|
| 1618 | } |
---|
| 1619 | |
---|
[181] | 1620 | #if XML_PARSER_DEBUG |
---|
[228] | 1621 | printf(" end cluster set\n\n"); |
---|
[181] | 1622 | #endif |
---|
[228] | 1623 | header->psegs = pseg_index; |
---|
| 1624 | header->procs = proc_index; |
---|
| 1625 | header->irqs = irq_index; |
---|
| 1626 | header->coprocs = coproc_index; |
---|
[215] | 1627 | header->cp_ports = cp_port_index; |
---|
| 1628 | return; |
---|
[158] | 1629 | } |
---|
[228] | 1630 | else { |
---|
[158] | 1631 | printf("[XML ERROR] Unknown tag in clusterset node : %s",tag); |
---|
| 1632 | exit(1); |
---|
| 1633 | } |
---|
[181] | 1634 | status = xmlTextReaderRead(reader); |
---|
[158] | 1635 | } |
---|
| 1636 | } // end clusterSetNode() |
---|
| 1637 | |
---|
[228] | 1638 | |
---|
[158] | 1639 | ///////////////////////////////////////////// |
---|
[228] | 1640 | void globalSetNode(xmlTextReaderPtr reader) { |
---|
| 1641 | if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { |
---|
| 1642 | return; |
---|
| 1643 | } |
---|
[158] | 1644 | |
---|
| 1645 | #if XML_PARSER_DEBUG |
---|
[228] | 1646 | printf(" globals set\n"); |
---|
[158] | 1647 | #endif |
---|
| 1648 | |
---|
[181] | 1649 | int status = xmlTextReaderRead(reader); |
---|
[228] | 1650 | while (status == 1) { |
---|
| 1651 | const char * tag = (const char *) xmlTextReaderConstName(reader); |
---|
[158] | 1652 | |
---|
[228] | 1653 | if (strcmp(tag, "vseg") == 0) { |
---|
| 1654 | vsegNode(reader); |
---|
| 1655 | } |
---|
| 1656 | else if (strcmp(tag, "#text") == 0) { } |
---|
| 1657 | else if (strcmp(tag, "#comment") == 0) { } |
---|
| 1658 | else if (strcmp(tag, "globalset") == 0) { |
---|
[181] | 1659 | #if XML_PARSER_DEBUG |
---|
[228] | 1660 | printf(" end global set\n\n"); |
---|
[181] | 1661 | #endif |
---|
[204] | 1662 | header->globals = vseg_index; |
---|
| 1663 | vseg_loc_index = 0; |
---|
| 1664 | return; |
---|
[158] | 1665 | } |
---|
[228] | 1666 | else { |
---|
[158] | 1667 | printf("[XML ERROR] Unknown tag in globalset node : %s",tag); |
---|
| 1668 | exit(1); |
---|
| 1669 | } |
---|
[228] | 1670 | status = xmlTextReaderRead(reader); |
---|
[158] | 1671 | } |
---|
| 1672 | } // end globalSetNode() |
---|
| 1673 | |
---|
[228] | 1674 | |
---|
[158] | 1675 | ///////////////////////////////////////////// |
---|
[228] | 1676 | void vspaceSetNode(xmlTextReaderPtr reader) { |
---|
| 1677 | if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { |
---|
| 1678 | return; |
---|
| 1679 | } |
---|
[158] | 1680 | |
---|
| 1681 | #if XML_PARSER_DEBUG |
---|
[228] | 1682 | printf("\n vspaces set\n"); |
---|
[158] | 1683 | #endif |
---|
| 1684 | |
---|
| 1685 | int status = xmlTextReaderRead ( reader ); |
---|
[228] | 1686 | while (status == 1) { |
---|
| 1687 | const char * tag = (const char *) xmlTextReaderConstName(reader); |
---|
[158] | 1688 | |
---|
[228] | 1689 | if (strcmp(tag, "vspace") == 0) { |
---|
| 1690 | vspaceNode(reader); |
---|
| 1691 | } |
---|
| 1692 | else if (strcmp(tag, "#text" ) == 0 ) { } |
---|
| 1693 | else if (strcmp(tag, "#comment" ) == 0 ) { } |
---|
| 1694 | else if (strcmp(tag, "vspaceset") == 0 ) { |
---|
[158] | 1695 | // checking source file consistency |
---|
[228] | 1696 | if (vspace_index != header->vspaces) { |
---|
[158] | 1697 | printf("[XML ERROR] Wrong number of vspaces\n"); |
---|
| 1698 | exit(1); |
---|
| 1699 | } |
---|
[228] | 1700 | else { |
---|
[158] | 1701 | header->vsegs = vseg_index; |
---|
[160] | 1702 | header->vobjs = vobj_index; |
---|
[158] | 1703 | header->tasks = task_index; |
---|
| 1704 | return; |
---|
| 1705 | } |
---|
| 1706 | } |
---|
[228] | 1707 | else { |
---|
[158] | 1708 | printf("[XML ERROR] Unknown tag in vspaceset node : %s",tag); |
---|
| 1709 | exit(1); |
---|
| 1710 | } |
---|
[228] | 1711 | status = xmlTextReaderRead(reader); |
---|
[158] | 1712 | } |
---|
| 1713 | } // end globalSetNode() |
---|
| 1714 | |
---|
[228] | 1715 | |
---|
[158] | 1716 | ////////////////////////////////////////// |
---|
[228] | 1717 | void headerNode(xmlTextReaderPtr reader) { |
---|
| 1718 | char * name; |
---|
| 1719 | unsigned int value; |
---|
| 1720 | unsigned int ok; |
---|
[158] | 1721 | |
---|
[228] | 1722 | if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { |
---|
| 1723 | return; |
---|
| 1724 | } |
---|
[158] | 1725 | |
---|
| 1726 | #if XML_PARSER_DEBUG |
---|
[228] | 1727 | printf("mapping_info\n"); |
---|
[158] | 1728 | #endif |
---|
| 1729 | |
---|
[228] | 1730 | header = (mapping_header_t *) malloc(sizeof(mapping_header_t)); |
---|
[158] | 1731 | |
---|
[165] | 1732 | ////////// get name attribute |
---|
[158] | 1733 | name = getStringValue(reader, "name", &ok); |
---|
[228] | 1734 | if (ok) { |
---|
[158] | 1735 | #if XML_PARSER_DEBUG |
---|
[228] | 1736 | printf(" name = %s\n", name); |
---|
[158] | 1737 | #endif |
---|
[228] | 1738 | strncpy( header->name, name, 31); |
---|
| 1739 | } |
---|
| 1740 | else { |
---|
[158] | 1741 | printf("[XML ERROR] illegal or missing <name> attribute in header\n"); |
---|
| 1742 | exit(1); |
---|
| 1743 | } |
---|
| 1744 | |
---|
[215] | 1745 | /////////// get cluster_x attribute |
---|
| 1746 | cluster_x = getIntValue(reader, "cluster_x", &ok); |
---|
[228] | 1747 | if (ok) { |
---|
[158] | 1748 | #if XML_PARSER_DEBUG |
---|
[228] | 1749 | printf(" cluster_x = %d\n", cluster_x); |
---|
[158] | 1750 | #endif |
---|
[215] | 1751 | header->cluster_x = cluster_x; |
---|
[158] | 1752 | } |
---|
[228] | 1753 | else { |
---|
[215] | 1754 | printf("[XML ERROR] illegal or missing <cluster_x> attribute in header\n"); |
---|
[158] | 1755 | exit(1); |
---|
| 1756 | } |
---|
| 1757 | |
---|
[215] | 1758 | /////////// get cluster_y attribute |
---|
| 1759 | cluster_y = getIntValue(reader, "cluster_y", &ok); |
---|
[228] | 1760 | if (ok) { |
---|
[215] | 1761 | #if XML_PARSER_DEBUG |
---|
[228] | 1762 | printf(" cluster_y = %d\n", cluster_y); |
---|
[215] | 1763 | #endif |
---|
| 1764 | header->cluster_y = cluster_y; |
---|
| 1765 | } |
---|
[228] | 1766 | else { |
---|
[215] | 1767 | printf("[XML ERROR] illegal or missing <cluster_y> attribute in header\n"); |
---|
| 1768 | exit(1); |
---|
| 1769 | } |
---|
| 1770 | |
---|
| 1771 | //check the number of cluster |
---|
[228] | 1772 | value = cluster_x * cluster_y; |
---|
| 1773 | if (value >= MAX_CLUSTERS) { |
---|
[215] | 1774 | printf("[XML ERROR] The number of clusters is larger than %d\n", MAX_CLUSTERS); |
---|
| 1775 | exit(1); |
---|
| 1776 | } |
---|
[228] | 1777 | |
---|
[215] | 1778 | header->clusters = value; |
---|
| 1779 | |
---|
| 1780 | #if XML_PARSER_DEBUG |
---|
[228] | 1781 | printf(" clusters = %d\n", value); |
---|
[215] | 1782 | #endif |
---|
| 1783 | |
---|
[165] | 1784 | ///////// get vspaces attribute |
---|
[158] | 1785 | value = getIntValue(reader, "vspaces", &ok); |
---|
[228] | 1786 | if (ok) { |
---|
| 1787 | if (value >= MAX_VSPACES) { |
---|
[158] | 1788 | printf("[XML ERROR] The number of vspaces is larger than %d\n", MAX_VSPACES); |
---|
| 1789 | exit(1); |
---|
| 1790 | } |
---|
| 1791 | #if XML_PARSER_DEBUG |
---|
[228] | 1792 | printf(" vspaces = %d\n", value); |
---|
[158] | 1793 | #endif |
---|
[228] | 1794 | header->vspaces = value; |
---|
[158] | 1795 | } |
---|
[228] | 1796 | else { |
---|
[158] | 1797 | printf("[XML ERROR] illegal or missing <vspaces> attribute in mapping\n"); |
---|
| 1798 | exit(1); |
---|
| 1799 | } |
---|
| 1800 | |
---|
[189] | 1801 | //////// initialise non replicated peripherals cluster_id |
---|
| 1802 | header->tty_clusterid = 0xFFFFFFFF; |
---|
| 1803 | header->nic_clusterid = 0xFFFFFFFF; |
---|
| 1804 | header->ioc_clusterid = 0xFFFFFFFF; |
---|
| 1805 | header->fbf_clusterid = 0xFFFFFFFF; |
---|
| 1806 | |
---|
| 1807 | ///////// set signature |
---|
[158] | 1808 | header->signature = IN_MAPPING_SIGNATURE; |
---|
| 1809 | |
---|
[181] | 1810 | int status = xmlTextReaderRead(reader); |
---|
[228] | 1811 | while (status == 1) { |
---|
| 1812 | const char * tag = (const char *) xmlTextReaderConstName(reader); |
---|
[158] | 1813 | |
---|
[228] | 1814 | if (strcmp(tag, "clusterset") == 0) { |
---|
| 1815 | clusterSetNode(reader); |
---|
| 1816 | } |
---|
| 1817 | else if (strcmp(tag, "globalset") == 0) { globalSetNode(reader); } |
---|
| 1818 | else if (strcmp(tag, "vspaceset") == 0) { vspaceSetNode(reader); } |
---|
| 1819 | else if (strcmp(tag, "#text") == 0) { } |
---|
| 1820 | else if (strcmp(tag, "#comment") == 0) { } |
---|
| 1821 | else if (strcmp(tag, "mapping_info") == 0) { |
---|
[158] | 1822 | #if XML_PARSER_DEBUG |
---|
[228] | 1823 | printf("end mapping_info\n"); |
---|
[158] | 1824 | #endif |
---|
| 1825 | return; |
---|
| 1826 | } |
---|
[228] | 1827 | else { |
---|
[174] | 1828 | printf("[XML ERROR] Unknown tag in header node : %s\n",tag); |
---|
[158] | 1829 | exit(1); |
---|
| 1830 | } |
---|
[181] | 1831 | status = xmlTextReaderRead(reader); |
---|
[158] | 1832 | } |
---|
| 1833 | } // end headerNode() |
---|
[228] | 1834 | |
---|
| 1835 | |
---|
[189] | 1836 | /////////////////////////////////////// |
---|
[228] | 1837 | void BuildTable(int fdout, const char * type, unsigned int nb_elem, |
---|
| 1838 | unsigned int elem_size, char ** table) { |
---|
[181] | 1839 | unsigned int i; |
---|
| 1840 | // write element |
---|
[228] | 1841 | for (i = 0; i < nb_elem; i++) { |
---|
| 1842 | if (elem_size != write(fdout, table[i], elem_size)) { |
---|
[215] | 1843 | printf("function %s: %s(%d) write error \n", __FUNCTION__, type, i); |
---|
| 1844 | exit(1); |
---|
| 1845 | } |
---|
| 1846 | |
---|
[181] | 1847 | #if XML_PARSER_DEBUG |
---|
[228] | 1848 | printf("Building binary: writing %s %d\n", type, i); |
---|
[181] | 1849 | #endif |
---|
[215] | 1850 | } |
---|
| 1851 | } |
---|
[158] | 1852 | |
---|
[215] | 1853 | |
---|
[228] | 1854 | int open_file(const char * file_path) { |
---|
| 1855 | |
---|
[215] | 1856 | //open file |
---|
[228] | 1857 | int fdout = open( file_path, (O_CREAT | O_RDWR), (S_IWUSR | S_IRUSR) ); |
---|
| 1858 | if (fdout < 0) { |
---|
[215] | 1859 | perror("open"); |
---|
| 1860 | exit(1); |
---|
[181] | 1861 | } |
---|
[215] | 1862 | |
---|
[228] | 1863 | //reinitialise the file |
---|
| 1864 | if (ftruncate(fdout, 0)) { |
---|
| 1865 | perror("truncate"); |
---|
| 1866 | exit(1); |
---|
| 1867 | } |
---|
[215] | 1868 | |
---|
[228] | 1869 | //#if XML_PARSER_DEBUG |
---|
| 1870 | printf("%s\n", file_path); |
---|
| 1871 | //#endif |
---|
| 1872 | |
---|
[215] | 1873 | return fdout; |
---|
[181] | 1874 | } |
---|
| 1875 | |
---|
[215] | 1876 | |
---|
[158] | 1877 | /////////////////////////// |
---|
[228] | 1878 | void buildBin(const char * file_path) { |
---|
| 1879 | unsigned int length; |
---|
[158] | 1880 | |
---|
[215] | 1881 | int fdout = open_file(file_path); |
---|
| 1882 | |
---|
[158] | 1883 | // write header to binary file |
---|
[228] | 1884 | length = write(fdout, (char *) header, sizeof(mapping_header_t)); |
---|
| 1885 | if (length != sizeof(mapping_header_t)) { |
---|
[181] | 1886 | printf("write header error : length = %d \n", length); |
---|
[158] | 1887 | exit(1); |
---|
| 1888 | } |
---|
| 1889 | |
---|
| 1890 | // write clusters |
---|
[228] | 1891 | BuildTable(fdout, "cluster", cluster_index, sizeof(mapping_cluster_t), (char **) cluster); |
---|
[158] | 1892 | // write psegs |
---|
[228] | 1893 | BuildTable(fdout, "pseg", pseg_index, sizeof(mapping_pseg_t), (char **) pseg); |
---|
[158] | 1894 | // write vspaces |
---|
[228] | 1895 | BuildTable(fdout, "vspace", vspace_index, sizeof(mapping_vspace_t), (char **) vspace); |
---|
[158] | 1896 | // write vsegs |
---|
[228] | 1897 | BuildTable(fdout, "vseg", vseg_index, sizeof(mapping_vseg_t), (char **) vseg); |
---|
[160] | 1898 | // write vobjs |
---|
[228] | 1899 | BuildTable(fdout, "vobj", vobj_index, sizeof(mapping_vobj_t), (char **) vobj); |
---|
[189] | 1900 | // write tasks array |
---|
[228] | 1901 | BuildTable(fdout, "task", task_index, sizeof(mapping_task_t), (char **) task); |
---|
[189] | 1902 | //building procs array |
---|
[228] | 1903 | BuildTable(fdout, "proc", proc_index, sizeof(mapping_proc_t), (char **) proc); |
---|
[189] | 1904 | //building irqs array |
---|
[228] | 1905 | BuildTable(fdout, "irq", irq_index, sizeof(mapping_irq_t), (char **) irq); |
---|
[189] | 1906 | //building coprocs array |
---|
[228] | 1907 | BuildTable(fdout, "coproc", coproc_index, sizeof(mapping_coproc_t), (char **) coproc); |
---|
[189] | 1908 | //building cp_ports array |
---|
[228] | 1909 | BuildTable(fdout, "cp_port", cp_port_index, sizeof(mapping_cp_port_t),(char **) cp_port); |
---|
[189] | 1910 | //building periphs array |
---|
[228] | 1911 | BuildTable(fdout, "periph", periph_index, sizeof(mapping_periph_t), (char **) periph); |
---|
| 1912 | |
---|
[215] | 1913 | close(fdout); |
---|
[181] | 1914 | |
---|
| 1915 | } // end buildBin() |
---|
| 1916 | |
---|
[228] | 1917 | |
---|
[189] | 1918 | /////////////////////////////////////////////////////////////////////// |
---|
| 1919 | // this function set the value the vobj_id fiels of all cp_ports |
---|
| 1920 | /////////////////////////////////////////////////////////////////////// |
---|
[228] | 1921 | void prepareBuild() { |
---|
[181] | 1922 | unsigned int i; |
---|
[200] | 1923 | //asign for all cp_ports the correct vspaceid and vobjid |
---|
[228] | 1924 | for (i = 0; i < cp_port_index; i++) { |
---|
| 1925 | int vspace_id = getVspaceId(cp_port_vobj_ref[i]->vspace_name); |
---|
| 1926 | if (vspace_id < 0) { |
---|
| 1927 | printf("[XML ERROR] illegal <vspacename> for cp_port %d,\n", i); |
---|
[181] | 1928 | exit(1); |
---|
| 1929 | } |
---|
| 1930 | cp_port[i]->vspaceid = vspace_id; |
---|
[189] | 1931 | |
---|
[228] | 1932 | int vobj_id = getVobjLocId(vspace_id, cp_port_vobj_ref[i]->vobj_name, vspace[vspace_id]->vobjs); |
---|
| 1933 | if (vobj_id >= 0) { |
---|
| 1934 | |
---|
[158] | 1935 | #if XML_PARSER_DEBUG |
---|
[228] | 1936 | printf("\ncp_port = %d\n", i); |
---|
| 1937 | printf(" vspace_name = %s\n", cp_port_vobj_ref[i]->vspace_name); |
---|
| 1938 | printf(" vobj_name = %s\n", cp_port_vobj_ref[i]->vobj_name); |
---|
| 1939 | printf(" vobj_index = %d\n", vobj_id); |
---|
[158] | 1940 | #endif |
---|
[181] | 1941 | cp_port[i]->vobjlocid = vobj_id; |
---|
[189] | 1942 | |
---|
| 1943 | assert((vobj[ vspace[vspace_id]->vobj_offset + vobj_id]->type == VOBJ_TYPE_MWMR) |
---|
[228] | 1944 | && "coproc ports have to refer to a vobj of type MWMR"); |
---|
[181] | 1945 | } |
---|
[228] | 1946 | else { |
---|
| 1947 | printf("[XML ERROR] illegal <vobjname> for cp_port %d,\n", i); |
---|
[158] | 1948 | exit(1); |
---|
| 1949 | } |
---|
| 1950 | } |
---|
[181] | 1951 | } |
---|
[158] | 1952 | |
---|
[228] | 1953 | |
---|
[217] | 1954 | ////////////////////////////////////////// |
---|
[228] | 1955 | void file_write(int fdout, char * towrite) { |
---|
[215] | 1956 | unsigned int size = strlen(towrite); |
---|
[228] | 1957 | if (size != write(fdout, towrite, size)) { |
---|
[215] | 1958 | printf("file_write error"); |
---|
| 1959 | exit(1); |
---|
| 1960 | } |
---|
| 1961 | } |
---|
| 1962 | |
---|
[228] | 1963 | |
---|
[217] | 1964 | ////////////////////////////////////////////////// |
---|
[228] | 1965 | void def_int_write(int fdout, char * def, int num) { |
---|
| 1966 | char buf[64]; |
---|
[215] | 1967 | sprintf(buf, "#define\t %s %d\n", def, num); |
---|
| 1968 | file_write(fdout, buf); |
---|
| 1969 | } |
---|
| 1970 | |
---|
[228] | 1971 | |
---|
[217] | 1972 | ///////////////////////////////////////////////// |
---|
[228] | 1973 | void def_hex_write(int fdout, char * def, int num) { |
---|
| 1974 | char buf[64]; |
---|
[215] | 1975 | sprintf(buf, "#define\t %s 0x%x\n", def, num); |
---|
| 1976 | file_write(fdout, buf); |
---|
| 1977 | } |
---|
| 1978 | |
---|
[228] | 1979 | |
---|
[217] | 1980 | /////////////////////////////////////// |
---|
[228] | 1981 | void genHd(const char * file_path) { |
---|
[215] | 1982 | int fdout = open_file(file_path); |
---|
| 1983 | |
---|
[228] | 1984 | char * prol = " /* Generated from the mapping_info file */\n\n#ifndef _HD_CONFIG_H\n#define _HD_CONFIG_H\n\n"; |
---|
[215] | 1985 | file_write(fdout, prol); |
---|
| 1986 | |
---|
[228] | 1987 | def_int_write(fdout, "CLUSTER_X" , cluster_x); |
---|
| 1988 | def_int_write(fdout, "CLUSTER_Y" , cluster_y); |
---|
| 1989 | def_int_write(fdout, "NB_CLUSTERS" , cluster_index); |
---|
| 1990 | def_hex_write(fdout, "CLUSTER_SIZE" , (((unsigned long long) 1) << 32) / cluster_index); |
---|
| 1991 | def_int_write(fdout, "NB_PROCS_MAX" , nb_proc_max); |
---|
| 1992 | def_int_write(fdout, "NB_TIMERS_MAX", nb_timer_channel_max); |
---|
| 1993 | def_int_write(fdout, "NB_DMAS_MAX" , nb_dma_channel_max); |
---|
| 1994 | def_int_write(fdout, "NB_TTYS" , nb_tty_channel); |
---|
| 1995 | def_int_write(fdout, "NB_IOCS" , nb_ioc_channel); |
---|
| 1996 | def_int_write(fdout, "NB_NICS" , nb_nic_channel); |
---|
| 1997 | |
---|
[215] | 1998 | file_write(fdout, "\n"); |
---|
[228] | 1999 | def_int_write(fdout, "USE_XICU" , use_xicu); |
---|
| 2000 | def_int_write(fdout, "IOMMU_ACTIVE ", io_mmu_active); |
---|
[215] | 2001 | |
---|
[228] | 2002 | char * epil = "\n#endif //_HD_CONFIG_H"; |
---|
[215] | 2003 | file_write(fdout, epil); |
---|
| 2004 | |
---|
| 2005 | close(fdout); |
---|
| 2006 | } |
---|
| 2007 | |
---|
[228] | 2008 | |
---|
[217] | 2009 | //////////////////////////////////////////////////////// |
---|
[228] | 2010 | void ld_write(int fdout, char * seg, unsigned int addr) { |
---|
| 2011 | char buf[64]; |
---|
[215] | 2012 | sprintf(buf, "%s = 0x%x;\n", seg, addr); |
---|
| 2013 | file_write(fdout, buf); |
---|
| 2014 | |
---|
| 2015 | } |
---|
| 2016 | |
---|
[228] | 2017 | |
---|
[217] | 2018 | /////////////////////////////////////// |
---|
[228] | 2019 | void genLd(const char * file_path) { |
---|
[215] | 2020 | int fdout = open_file(file_path); |
---|
| 2021 | |
---|
[228] | 2022 | char * prol = "/* Generated from the mapping_info file */\n\n"; |
---|
[215] | 2023 | file_write(fdout, prol); |
---|
| 2024 | |
---|
| 2025 | //boot |
---|
[228] | 2026 | ld_write(fdout, "seg_boot_code_base", boot_code_base); |
---|
| 2027 | ld_write(fdout, "seg_boot_stack_base", boot_stack_base); |
---|
| 2028 | ld_write(fdout, "seg_mapping_base", boot_mapping_base); |
---|
[215] | 2029 | |
---|
| 2030 | //kernel |
---|
[228] | 2031 | ld_write(fdout, "\nseg_kernel_code_base", kernel_code_base); |
---|
| 2032 | ld_write(fdout, "seg_kernel_data_base", kernel_data_base); |
---|
| 2033 | ld_write(fdout, "seg_kernel_uncdata_base", kernel_uncdata_base); |
---|
| 2034 | ld_write(fdout, "seg_kernel_init_base", kernel_init_base); |
---|
[215] | 2035 | |
---|
| 2036 | //peripherals |
---|
[228] | 2037 | ld_write(fdout, "\nseg_fbf_base", fbf_base_offset); |
---|
| 2038 | ld_write(fdout, "seg_icu_base", icu_base_offset); |
---|
| 2039 | ld_write(fdout, "seg_ioc_base", ioc_base_offset); |
---|
| 2040 | ld_write(fdout, "seg_nic_base", nic_base_offset); |
---|
| 2041 | ld_write(fdout, "seg_tty_base", tty_base_offset); |
---|
| 2042 | ld_write(fdout, "seg_dma_base", dma_base_offset); |
---|
| 2043 | ld_write(fdout, "seg_tim_base", tim_base_offset); |
---|
| 2044 | ld_write(fdout, "seg_gcd_base", gcd_base_offset); |
---|
| 2045 | ld_write(fdout, "seg_iob_base", iob_base_offset); |
---|
[215] | 2046 | |
---|
| 2047 | close(fdout); |
---|
| 2048 | } |
---|
| 2049 | |
---|
[228] | 2050 | |
---|
| 2051 | char * buildPath(const char * path, const char * name) { |
---|
[222] | 2052 | char * res = calloc(strlen(path) + strlen(name) + 1, 1); |
---|
[215] | 2053 | strcat(res, path); |
---|
| 2054 | strcat(res, "/"); |
---|
| 2055 | strcat(res, name); |
---|
| 2056 | return res; |
---|
| 2057 | } |
---|
| 2058 | |
---|
[228] | 2059 | |
---|
[158] | 2060 | ///////////////////////////////////// |
---|
[228] | 2061 | int main(int argc, char * argv[]) { |
---|
| 2062 | if (argc < 3) { |
---|
[215] | 2063 | printf("Usage: xml2bin <input_file_path> <output_path>\n"); |
---|
[158] | 2064 | return 1; |
---|
| 2065 | } |
---|
| 2066 | |
---|
[215] | 2067 | struct stat dir_st; |
---|
[228] | 2068 | if (stat( argv[2], &dir_st)) { |
---|
[215] | 2069 | perror("bad path"); |
---|
[158] | 2070 | exit(1); |
---|
| 2071 | } |
---|
[215] | 2072 | |
---|
[228] | 2073 | if ((dir_st.st_mode & S_IFDIR) == 0) { |
---|
[215] | 2074 | printf("path is not a dir: %s", argv[2] ); |
---|
| 2075 | exit(1); |
---|
| 2076 | } |
---|
| 2077 | |
---|
| 2078 | |
---|
[228] | 2079 | char * map_path = buildPath(argv[2], "map.bin"); |
---|
| 2080 | char * ld_path = buildPath(argv[2], "giet_vsegs.ld"); |
---|
| 2081 | char * hd_path = buildPath(argv[2], "hard_config.h"); |
---|
| 2082 | |
---|
[158] | 2083 | LIBXML_TEST_VERSION; |
---|
| 2084 | |
---|
[181] | 2085 | int status; |
---|
[228] | 2086 | xmlTextReaderPtr reader = xmlReaderForFile(argv[1], NULL, 0); |
---|
[158] | 2087 | |
---|
[228] | 2088 | if (reader != NULL) { |
---|
| 2089 | status = xmlTextReaderRead (reader); |
---|
| 2090 | while (status == 1) { |
---|
| 2091 | const char * tag = (const char *) xmlTextReaderConstName(reader); |
---|
[181] | 2092 | |
---|
[228] | 2093 | if (strcmp(tag, "mapping_info") == 0) { |
---|
| 2094 | headerNode(reader); |
---|
[181] | 2095 | prepareBuild(); |
---|
[228] | 2096 | buildBin(map_path); |
---|
[215] | 2097 | genHd(hd_path); |
---|
| 2098 | genLd(ld_path); |
---|
[158] | 2099 | } |
---|
[228] | 2100 | else { |
---|
[158] | 2101 | printf("[XML ERROR] Wrong file type: \"%s\"\n", argv[1]); |
---|
| 2102 | return 1; |
---|
| 2103 | } |
---|
[228] | 2104 | status = xmlTextReaderRead(reader); |
---|
[158] | 2105 | } |
---|
[228] | 2106 | xmlFreeTextReader(reader); |
---|
[158] | 2107 | |
---|
[228] | 2108 | if (status != 0) { |
---|
[158] | 2109 | printf("[XML ERROR] Wrong Syntax in \"%s\" file\n", argv[1]); |
---|
| 2110 | return 1; |
---|
| 2111 | } |
---|
| 2112 | } |
---|
| 2113 | return 0; |
---|
| 2114 | } // end main() |
---|
[222] | 2115 | |
---|
| 2116 | |
---|
[228] | 2117 | // Local Variables: |
---|
| 2118 | // tab-width: 4 |
---|
| 2119 | // c-basic-offset: 4 |
---|
| 2120 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 2121 | // indent-tabs-mode: nil |
---|
| 2122 | // End: |
---|
| 2123 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
[222] | 2124 | |
---|