Changeset 101 for trunk/Softwares/Common/src/c
- Timestamp:
- Jan 15, 2009, 6:19:08 PM (16 years ago)
- Location:
- trunk/Softwares/Common/src/c
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Softwares/Common/src/c/func_io.c
r81 r101 2 2 #include "thread_info.h" 3 3 4 void print(intdata)4 void tty (unsigned char data) 5 5 { 6 int *show =(int*)(TTY_BASE + (get_thread_id() << 4) + 8);6 unsigned int * addr =(unsigned int*)(TTY_BASE + (get_thread_id() << 4) + 0); 7 7 8 *( show) = data;8 *(addr) = data; 9 9 } 10 10 11 void quit (intdata)11 void print (char * data) 12 12 { 13 int *stop =(int*)(TTY_BASE + (get_thread_id() << 4) + 4);13 unsigned int * addr =(unsigned int*)(TTY_BASE + (get_thread_id() << 4) + 0); 14 14 15 *(stop) = data; 15 while ((*data) != '\0') 16 { 17 *(addr) = (*data); 18 data++; 19 } 16 20 } 21 22 void show (unsigned int data) 23 { 24 unsigned int * addr =(unsigned int*)(TTY_BASE + (get_thread_id() << 4) + 8); 25 26 *(addr) = data; 27 } 28 29 void quit (unsigned int data) 30 { 31 unsigned int * addr = (unsigned int*)(TTY_BASE + (get_thread_id() << 4) + 4); 32 33 *(addr) = data; 34 } -
trunk/Softwares/Common/src/c/service_clock.c
r81 r101 1 #include <time.h> 2 #include <errno.h> 3 #include <sys/lock.h> 4 #include "mapping_memory.h" 5 #include "sim2os.h" 6 #include "service_clock.h" 1 /* #include <time.h> */ 2 /* #include <errno.h> */ 3 /* #include <sys/lock.h> */ 4 /* #include "mapping_memory.h" */ 5 /* #include "sim2os.h" */ 6 /* #include "service_clock.h" */ 7 7 8 unsigned int service_clock () 9 { 10 unsigned int * addr = (unsigned int *)(SIM2OS_BASE); 11 unsigned int result = -1; 8 /* unsigned int service_clock () */ 9 /* { */ 10 /* unsigned int * addr = (unsigned int *)(SIM2OS_BASE); */ 11 /* unsigned int result = -1; */ 12 12 13 __lock_init (service_lock); 13 /* __lock_init (service_lock); */ 14 14 15 __lock_acquire (service_lock); 15 /* __lock_acquire (service_lock); */ 16 16 17 *(addr+0) = (unsigned int)SERVICE_CLOCK; 17 /* *(addr+0) = (unsigned int)SERVICE_CLOCK; */ 18 18 19 // memory synchronisation 20 // (else read (with an address that depend not of store address) can be lunch before a store) 21 asm("l.msync;"); 19 /* // memory synchronisation */ 20 /* // (else read (with an address that depend not of store address) can be lunch before a store) */ 21 /* asm("l.msync;"); */ 22 22 23 result = (clock_t) *(addr+1); 23 /* result = (clock_t) *(addr+1); */ 24 24 25 if (result == (clock_t)-1) 26 errno = (int) *(addr+2); 25 /* if (result == (clock_t)-1) */ 26 /* errno = (int) *(addr+2); */ 27 27 28 __lock_release (service_lock); 28 /* __lock_release (service_lock); */ 29 29 30 return result; 31 } 30 /* return result; */ 31 /* } */
Note: See TracChangeset
for help on using the changeset viewer.