Changeset 438 for soft/giet_vm/giet_libs/stdio.c
- Timestamp:
- Nov 3, 2014, 10:54:50 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_libs/stdio.c
r431 r438 14 14 //////////////////////////////////////////////////////////////////////////////////// 15 15 16 ///////////////// 16 //////////////////////////////////////////// 17 17 void giet_proc_xyp( unsigned int* cluster_x, 18 18 unsigned int* cluster_y, 19 19 unsigned int* lpid ) 20 20 { 21 sys_call( SYSCALL_PROC ID,21 sys_call( SYSCALL_PROC_XYP, 22 22 (unsigned int)cluster_x, 23 23 (unsigned int)cluster_y, … … 26 26 } 27 27 28 //////////////////// 29 int giet_proctime()30 { 31 return sys_call( SYSCALL_PROCTIME,32 0, 0, 0, 0 );33 } 34 35 /////////////// 36 int giet_rand()37 { 38 unsigned int x = sys_call(SYSCALL_PROCTIME,39 0, 0, 0, 0);28 //////////////////////////// 29 unsigned int giet_proctime() 30 { 31 return (unsigned int)sys_call( SYSCALL_PROC_TIME, 32 0, 0, 0, 0 ); 33 } 34 35 //////////////////////// 36 unsigned int giet_rand() 37 { 38 unsigned int x = (unsigned int)sys_call( SYSCALL_PROC_TIME, 39 0, 0, 0, 0); 40 40 if ((x & 0xF) > 7) 41 41 { … … 47 47 } 48 48 } 49 50 ////////////////////////////////////////////////////////////////////////////////// 51 ///////////////////// Task context system calls ///////////////////////////////// 52 ////////////////////////////////////////////////////////////////////////////////// 53 54 //////////////////////////////// 55 unsigned int giet_proc_task_id() 56 { 57 return (unsigned int)sys_call( SYSCALL_LOCAL_TASK_ID, 58 0, 0, 0, 0 ); 59 } 60 61 ////////////////////////////////// 62 unsigned int giet_global_task_id() 63 { 64 return (unsigned int)sys_call( SYSCALL_GLOBAL_TASK_ID, 65 0, 0, 0, 0 ); 66 } 67 68 ///////////////////////////// 69 unsigned int giet_thread_id() 70 { 71 return (unsigned int)sys_call( SYSCALL_THREAD_ID, 72 0, 0, 0, 0 ); 73 } 74 49 75 50 76 //////////////////////////////////////////////////////////////////////////////////// … … 52 78 //////////////////////////////////////////////////////////////////////////////////// 53 79 54 /////////////////////////////////////////////////////////////////////// 55 static int __printf( char* format, unsigned int channel, va_list* args) 56 { 57 int ret; // return value from the syscalls 80 ///////////////////// 81 void giet_tty_alloc() 82 { 83 sys_call( SYSCALL_TTY_ALLOC, 0, 0 ,0 ,0 ); 84 } 85 86 //////////////////////////////////////////////////////////////////////// 87 static int __printf( char* format, unsigned int channel, va_list* args) 88 { 89 int ret; // return value from the syscall 58 90 59 91 printf_text: … … 420 452 421 453 /////////////////////// 422 void giet_timer_start() 423 { 424 if ( sys_call( SYSCALL_TIMER_START, 0, 0, 0, 0 ) ) 425 giet_exit("error in giet_timer_start()"); 454 void giet_timer_alloc() 455 { 456 if ( sys_call( SYSCALL_TIM_ALLOC, 457 0, 0, 0, 0 ) ) giet_exit("error in giet_timer_alloc()"); 458 } 459 460 //////////////////////////////////////////// 461 void giet_timer_start( unsigned int period ) 462 { 463 if ( sys_call( SYSCALL_TIM_START, 464 period, 465 0, 0, 0 ) ) giet_exit("error in giet_timer_start()"); 426 466 } 427 467 … … 429 469 void giet_timer_stop() 430 470 { 431 if ( sys_call( SYSCALL_TIM ER_STOP, 0, 0, 0, 0 ) )432 giet_exit("error in giet_timer_stop()");471 if ( sys_call( SYSCALL_TIM_STOP, 472 0, 0, 0, 0 ) ) giet_exit("error in giet_timer_stop()"); 433 473 } 434 474 … … 438 478 ////////////////////////////////////////////////////////////////////////////////// 439 479 440 //////////////////////////////////////////// 441 void giet_fb_sync_write( unsigned int offset, 442 void * buffer, 443 unsigned int length ) 444 { 445 if ( sys_call( SYSCALL_FB_SYNC_WRITE, 480 ///////////////////////// 481 void giet_fbf_cma_alloc() 482 { 483 if ( sys_call( SYSCALL_FBF_CMA_ALLOC, 484 0, 0, 0, 0 ) ) giet_exit("error in giet_fbf_cma_alloc()"); 485 } 486 487 /////////////////////////////////////////// 488 void giet_fbf_cma_start( void * buf0, 489 void * buf1, 490 unsigned int length ) 491 { 492 if ( sys_call( SYSCALL_FBF_CMA_START, 493 (unsigned int)buf0, 494 (unsigned int)buf1, 495 length, 496 0 ) ) giet_exit("error in giet_fbf_cma_start()"); 497 } 498 499 //////////////////////////////////////////////// 500 void giet_fbf_cma_display( unsigned int buffer ) 501 { 502 if ( sys_call( SYSCALL_FBF_CMA_DISPLAY, 503 buffer, 504 0, 0, 0 ) ) giet_exit("error in giet_fbf_cma_display()"); 505 } 506 507 //////////////////////// 508 void giet_fbf_cma_stop() 509 { 510 if ( sys_call( SYSCALL_FBF_CMA_STOP, 511 0, 0, 0, 0 ) ) giet_exit("error in giet_fbf_cma_stop()"); 512 } 513 514 ////////////////////////////////////////////// 515 void giet_fbf_sync_write( unsigned int offset, 516 void * buffer, 517 unsigned int length ) 518 { 519 if ( sys_call( SYSCALL_FBF_SYNC_WRITE, 446 520 offset, 447 521 (unsigned int)buffer, 448 522 length, 449 0 ) ) giet_exit("error in giet_fb _sync_write()");450 } 451 452 /////////////////////////////////////////// 453 void giet_fb _sync_read( unsigned int offset,454 void * buffer,455 unsigned int length )456 { 457 if ( sys_call( SYSCALL_FB _SYNC_READ,523 0 ) ) giet_exit("error in giet_fbf_sync_write()"); 524 } 525 526 ///////////////////////////////////////////// 527 void giet_fbf_sync_read( unsigned int offset, 528 void * buffer, 529 unsigned int length ) 530 { 531 if ( sys_call( SYSCALL_FBF_SYNC_READ, 458 532 offset, 459 533 (unsigned int)buffer, 460 534 length, 461 0 ) ) giet_exit("error in giet_fb_sync_read()"); 462 } 463 464 ///////////////////////////////////////// 465 void giet_fb_cma_init( void * buf0, 466 void * buf1, 467 unsigned int length ) 468 { 469 if ( sys_call( SYSCALL_FB_CMA_INIT, 470 (unsigned int)buf0, 471 (unsigned int)buf1, 472 length, 473 0 ) ) giet_exit("error in giet_fb_cma_init()"); 474 } 475 476 /////////////////////////////////////////////// 477 void giet_fb_cma_write( unsigned int buffer_id ) 478 { 479 if ( sys_call( SYSCALL_FB_CMA_WRITE, 480 buffer_id, 481 0, 0, 0 ) ) giet_exit("error in giet_fb_cma_write()"); 482 } 483 484 //////////////////////// 485 void giet_fb_cma_stop() 486 { 487 if ( sys_call( SYSCALL_FB_CMA_STOP, 488 0, 0, 0, 0 ) ) giet_exit("error in giet_fb_cma_stop()"); 535 0 ) ) giet_exit("error in giet_fbf_sync_read()"); 489 536 } 490 537 … … 494 541 ////////////////////////////////////////////////////////////////////////////////// 495 542 496 ///////////////////////// 497 void giet_nic_cma_start() 498 { 499 if ( sys_call( SYSCALL_NIC_CMA_START, 0, 0, 0, 0 ) ) 500 giet_exit("error in giet_nic_cma_start()"); 501 } 502 503 ///////////////////////// 504 void giet_nic_cma_stop() 505 { 506 if ( sys_call( SYSCALL_NIC_CMA_STOP, 0, 0, 0, 0 ) ) 507 giet_exit("error in giet_nic_cma_stop()"); 543 ///////////////////// 544 void giet_nic_alloc() 545 { 546 if ( sys_call( SYSCALL_NIC_ALLOC, 547 0, 0, 0, 0 ) ) giet_exit("error in giet_nic_alloc()"); 548 } 549 550 /////////////////////////////////////// 551 void giet_nic_sync_send( void* buffer ) 552 { 553 if ( sys_call( SYSCALL_NIC_SYNC_SEND, 554 (unsigned int)buffer, 555 0, 0, 0 ) ) giet_exit("error in giet_nic_sync_send()"); 556 } 557 558 ////////////////////////////////////////// 559 void giet_nic_sync_receive( void* buffer ) 560 { 561 if ( sys_call( SYSCALL_NIC_SYNC_RECEIVE, 562 (unsigned int)buffer, 563 0, 0, 0 ) ) giet_exit("error in giet_nic_sync_receive()"); 508 564 } 509 565 … … 595 651 596 652 597 //////////////////////////////////////////////////////////////////////////////////598 ///////////////////// Task context system calls /////////////////////////////////599 //////////////////////////////////////////////////////////////////////////////////600 601 ///////////////////////602 int giet_proc_task_id()603 {604 return sys_call( SYSCALL_LOCAL_TASK_ID,605 0, 0, 0, 0 );606 }607 608 /////////////////////////609 int giet_global_task_id()610 {611 return sys_call( SYSCALL_GLOBAL_TASK_ID,612 0, 0, 0, 0 );613 }614 615 ////////////////////616 int giet_thread_id()617 {618 return sys_call( SYSCALL_THREAD_ID,619 0, 0, 0, 0 );620 }621 653 622 654 … … 645 677 sys_call( SYSCALL_CTX_SWITCH, 646 678 0, 0, 0, 0 ); 647 }648 649 ////////////////////////////////////////////////////650 void giet_vobj_get_vbase( char* vspace_name,651 char* vobj_name,652 unsigned int* vobj_vaddr )653 {654 if ( sys_call( SYSCALL_VOBJ_GET_VBASE,655 (unsigned int) vspace_name,656 (unsigned int) vobj_name,657 (unsigned int) vobj_vaddr,658 0 ) ) giet_exit("ERROR in giet_vobj_get_vbase()");659 679 } 660 680 … … 667 687 (unsigned int) buffer, 668 688 0, 0) ) giet_exit("ERROR in giet_proc_number()"); 689 } 690 691 //////////////////////////////////////////////////// 692 void giet_vobj_get_vbase( char* vspace_name, 693 char* vobj_name, 694 unsigned int* vbase ) 695 { 696 if ( sys_call( SYSCALL_VOBJ_GET_VBASE, 697 (unsigned int) vspace_name, 698 (unsigned int) vobj_name, 699 (unsigned int) vbase, 700 0 ) ) giet_exit("ERROR in giet_vobj_get_vbase()"); 701 } 702 703 //////////////////////////////////////////////////// 704 void giet_vobj_get_length( char* vspace_name, 705 char* vobj_name, 706 unsigned int* length ) 707 { 708 if ( sys_call( SYSCALL_VOBJ_GET_LENGTH, 709 (unsigned int) vspace_name, 710 (unsigned int) vobj_name, 711 (unsigned int) length, 712 0 ) ) giet_exit("ERROR in giet_vobj_get_length()"); 669 713 } 670 714
Note: See TracChangeset
for help on using the changeset viewer.