Changeset 267 for soft/giet_vm
- Timestamp:
- Jan 13, 2014, 3:20:29 PM (11 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_boot/boot.c
r263 r267 1157 1157 // are reserved for the kernel (context switch) 1158 1158 1159 unsigned int alloc_tty_channel = 1; // TTY channel allocator1159 unsigned int alloc_tty_channel = 0; // TTY channel allocator 1160 1160 unsigned int alloc_nic_channel = 0; // NIC channel allocator 1161 1161 unsigned int alloc_cma_channel = 0; // CMA channel allocator 1162 1162 unsigned int alloc_hba_channel = 0; // IOC channel allocator 1163 1163 unsigned int alloc_tim_channel[X_SIZE*Y_SIZE]; // user TIMER allocators 1164 1165 if (!GIET_MONO_TTY) alloc_tty_channel++; 1164 1166 1165 1167 ///////////////////////////////////////////////////////////////////////// … … 1364 1366 } 1365 1367 ctx_tty = alloc_tty_channel; 1366 alloc_tty_channel++;1368 if (!GIET_MONO_TTY) alloc_tty_channel++; 1367 1369 } 1368 1370 // ctx_nic : NIC channel global index provided by the global allocator … … 1468 1470 // get local task index in scheduler 1469 1471 unsigned int ltid = psched->tasks; 1472 1473 // get vspace thread index 1474 unsigned int thread_id = task[task_id].trdid; 1470 1475 1471 1476 if (ltid >= IDLE_TASK_INDEX) … … 1500 1505 psched->context[ltid][CTX_LTID_ID] = ltid; 1501 1506 psched->context[ltid][CTX_GTID_ID] = task_id; 1507 psched->context[ltid][CTX_TRDID_ID] = thread_id; 1502 1508 psched->context[ltid][CTX_VSID_ID] = vspace_id; 1503 1509 psched->context[ltid][CTX_RUN_ID] = 1; … … 1505 1511 #if BOOT_DEBUG_SCHED 1506 1512 _puts("\nTask "); 1507 _puts( task[task_id].name );1508 _puts(" (");1509 1513 _putd( task_id ); 1510 _puts(" )allocated to processor ");1514 _puts(" allocated to processor "); 1511 1515 _putd( gpid ); 1512 1516 _puts("\n - ctx[LTID] = "); … … 1536 1540 _puts("\n - ctx[VSID] = "); 1537 1541 _putd( psched->context[ltid][CTX_VSID_ID] ); 1542 _puts("\n - ctx[TRDID] = "); 1543 _putd( psched->context[ltid][CTX_TRDID_ID] ); 1538 1544 _puts("\n"); 1539 1545 #endif -
soft/giet_vm/giet_config.h
r264 r267 35 35 36 36 #define GIET_IDLE_TASK_PERIOD 10000000 /* Idle Task message period */ 37 #define GIET_IDLE_TASK_VERBOSITY 1 38 39 #define GIET_MONO_TTY 0 /* Only one terminal is used */ 40 37 41 #define GIET_MAX_ELF_FILES 20 /* max .elf files loaded by boot-loader */ 38 42 #define GIET_OPEN_FILES_MAX 16 /* max simultaneously open files */ -
soft/giet_vm/giet_drivers/dma_driver.c
r263 r267 134 134 return dma_address[channel_id * DMA_SPAN + DMA_LEN]; 135 135 #else 136 return DMA_ ERROR;136 return DMA_IDLE; 137 137 #endif 138 138 } -
soft/giet_vm/giet_kernel/ctx_handler.c
r258 r267 41 41 // - LTID : Task local index (in scheduler) 42 42 // - VSID : Virtual space index 43 // - RUN : Task state (0 => sleeping / 1 => runable ) 43 // - RUN : Task state (0 => sleeping / 1 => runnable ) 44 // - TRDID : Thread ID index (in vspace) 44 45 // 45 46 // ctx[0]<- ***|ctx[8] <- $8 |ctx[16]<- $16|ctx[24]<- $24|ctx[32]<- EPC |ctx[40]<- TTY … … 51 52 // ctx[6]<- $6 |ctx[14]<- $14|ctx[22]<- $22|ctx[30]<- $30|ctx[38]<- VSID |ctx[46]<- GTID 52 53 // ctx[7]<- $7 |ctx[15]<- $15|ctx[23]<- $23|ctx[31]<- RA |ctx[39]<- PTPR |ctx[47]<- RUN 54 // 55 // ctx[48]<- TRDID 53 56 ////////////////////////////////////////////////////////////////////////////////////////// 54 57 … … 164 167 : "$3" ); 165 168 169 #if GIET_IDLE_TASK_VERBOSITY == 1 166 170 _tty_get_lock( 0 ); 167 171 _puts("\n[GIET WARNING] Processor "); … … 171 175 _puts("\n"); 172 176 _tty_release_lock( 0 ); 177 #endif 173 178 174 179 count = GIET_IDLE_TASK_PERIOD; -
soft/giet_vm/giet_kernel/ctx_handler.h
r258 r267 48 48 #define CTX_GTID_ID 46 // Global Task Index 49 49 #define CTX_RUN_ID 47 // Boolean: task runable 50 #define CTX_TRDID_ID 48 // Thread Index in vspace 50 51 51 52 ////////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/giet_kernel/giet.s
r258 r267 9 9 * - the _cause_vector[16] array defines the 16 causes to enter the GIET 10 10 * it is initialized in th exc_handler.c file 11 * - the _syscall_vector[ 32] array defines the 32system calls entry points11 * - the _syscall_vector[64] array defines the 64 system calls entry points 12 12 * it is initialised in the sys_handler.c file 13 13 ***********************************************************************************/ -
soft/giet_vm/giet_kernel/sys_handler.c
r263 r267 48 48 &_fb_sync_write, /* 0x10 */ 49 49 &_fb_sync_read, /* 0x11 */ 50 &_ sys_ukn,/* 0x12 */51 &_ sys_ukn,/* 0x13 */50 &_thread_id, /* 0x12 */ 51 &_tty_get_release_lock,/* 0x13 */ 52 52 &_sys_ukn, /* 0x14 */ 53 53 &_sys_ukn, /* 0x15 */ … … 180 180 { 181 181 return _get_context_slot(CTX_GTID_ID); 182 } 183 184 ///////////////////////////////////////////////////////////////////////////// 185 // _thread_id() 186 // Returns current thread index. 187 ///////////////////////////////////////////////////////////////////////////// 188 unsigned int _thread_id() 189 { 190 return _get_context_slot(CTX_TRDID_ID); 191 } 192 193 ///////////////////////////////////////////////////////////////////////////// 194 // _tty_get_release_lock(int val) 195 // Get or release the hardware TTY lock depending on val (0: get,1: release) 196 ///////////////////////////////////////////////////////////////////////////// 197 int _tty_get_release_lock(unsigned int val) 198 { 199 unsigned int channel = _get_context_slot(CTX_TTY_ID); 200 201 if ( val == 0 ) _tty_get_lock(channel); 202 else if ( val == 1 ) _tty_release_lock(channel); 203 else return -1; // Wrong action 204 205 return 0; 182 206 } 183 207 -
soft/giet_vm/giet_kernel/sys_handler.h
r258 r267 24 24 unsigned int _local_task_id(); 25 25 unsigned int _global_task_id(); 26 unsigned int _thread_id(); 27 28 int _tty_get_release_lock(unsigned int val); 26 29 27 30 unsigned int _procs_number( unsigned int cluster_id, -
soft/giet_vm/giet_libs/stdio.c
r260 r267 12 12 #include <stdarg.h> 13 13 #include <stdio.h> 14 #include <giet_config.h> 14 15 15 16 … … 298 299 unsigned int ret; 299 300 301 if (GIET_MONO_TTY) 302 { 303 ret = sys_call(SYSCALL_TTY_LOCK, 0, 0, 0, 0); // Get TTY lock 304 } 305 300 306 printf_text: 301 307 … … 311 317 0xFFFFFFFF, 312 318 0); 313 if (ret != i) return 1; /* return error */ 319 320 if (ret != i) goto return_error; 321 314 322 format += i; 315 323 } … … 319 327 goto printf_arguments; 320 328 } 329 } 330 331 if (GIET_MONO_TTY) 332 { 333 ret = sys_call(SYSCALL_TTY_LOCK, 1, 0, 0, 0); // Release TTY lock 321 334 } 322 335 … … 349 362 0xFFFFFFFF, 350 363 0); 351 if (ret != 1) return 1; /* return error */364 if (ret != 1) goto return_error; 352 365 } 353 366 case ('u'): /* decimal unsigned integer */ … … 366 379 0xFFFFFFFF, 367 380 0); 368 if (ret != 2) return 1; /* return error */381 if (ret != 2) goto return_error; /* return error */ 369 382 for(i = 0; i < 8; i++) 370 383 { … … 394 407 0xFFFFFFFF, 395 408 0); 396 if (ret != len) return 1; 409 if (ret != len) goto return_error; 410 397 411 goto printf_text; 398 412 } 413 414 return_error: 415 if (GIET_MONO_TTY) 416 { 417 ret = sys_call(SYSCALL_TTY_LOCK, 1, 0, 0, 0); // Release TTY lock 418 } 419 420 return 1; 399 421 } 400 422 … … 663 685 } 664 686 687 ////////////////////////////////////////////////////////////////////////////////// 688 // giet_thread_id() 689 ////////////////////////////////////////////////////////////////////////////////// 690 // This functions returns the thread index of the current task. 691 ////////////////////////////////////////////////////////////////////////////////// 692 int giet_thread_id() 693 { 694 return sys_call( SYSCALL_THREAD_ID, 695 0, 0, 0, 0 ); 696 } 697 665 698 /////////////////////////////////////////////////////////////////////////////////// 666 699 ///////////////////// FAT related system calls //////////////////////////////////// -
soft/giet_vm/giet_libs/stdio.h
r260 r267 31 31 #define SYSCALL_FB_SYNC_WRITE 0x10 32 32 #define SYSCALL_FB_SYNC_READ 0x11 33 #define SYSCALL_ FREE_120x1234 #define SYSCALL_ FREE_130x1333 #define SYSCALL_THREAD_ID 0x12 34 #define SYSCALL_TTY_LOCK 0x13 35 35 #define SYSCALL_FREE_14 0x14 36 36 #define SYSCALL_FREE_15 0x15 … … 209 209 extern int giet_global_task_id(); 210 210 211 extern int giet_thread_id(); 212 211 213 extern void giet_assert( unsigned int, 212 214 char* string ); -
soft/giet_vm/giet_xml/mapping_info.h
r263 r267 252 252 unsigned int clusterid; // linear index in array of clusters 253 253 unsigned int proclocid; // processor local index (inside cluster) 254 unsigned int trdid; // thread index in vspace 254 255 unsigned int stack_vobjid; // stack vobj index in vspace 255 256 unsigned int heap_vobjid; // heap vobj index in vspace -
soft/giet_vm/giet_xml/xml_parser.c
r263 r267 463 463 464 464 ///////// get x coordinate 465 x = getIntValue(reader, "x", &ok); 465 task[task_index]->trdid = getIntValue(reader, "trdid", &ok); 466 #if XML_PARSER_DEBUG 467 printf(" x = %d\n", x); 468 #endif 469 if ( !ok ) 470 { 471 task[task_index]->trdid = task_loc_index; 472 printf("[XML WARNING] missing trdid (thread index) attribute " 473 "for task in vspace %d. Using value %d\n" 474 , vspace_index, task_loc_index); 475 } 476 477 ///////// get x coordinate 478 x = getIntValue(reader, "x", &ok); 466 479 #if XML_PARSER_DEBUG 467 480 printf(" x = %d\n", x); … … 475 488 476 489 ///////// get y coordinate 477 490 y = getIntValue(reader, "y", &ok); 478 491 #if XML_PARSER_DEBUG 479 492 printf(" y = %d\n", y);
Note: See TracChangeset
for help on using the changeset viewer.