Changeset 685 for trunk/libs/libalmosmkh/almosmkh.c
- Timestamp:
- Jan 13, 2021, 12:45:27 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libs/libalmosmkh/almosmkh.c
r678 r685 23 23 24 24 #include <almosmkh.h> 25 #include <shared_almos.h> 25 26 #include <hal_user.h> 26 27 #include <hal_macros.h> … … 60 61 int get_config( struct hard_config_s * config ) 61 62 { 62 return hal_user_syscall( SYS_GET_CONFIG, 63 (reg_t)config, 0, 0, 0); 63 return hal_user_syscall( SYS_GET, 64 GET_CONFIG, 65 (reg_t)config, 0, 0); 64 66 } 65 67 … … 68 70 unsigned int * lid ) 69 71 { 70 return hal_user_syscall( SYS_GET_CORE_ID, 72 return hal_user_syscall( SYS_GET, 73 GET_CORE_ID, 71 74 (reg_t)cxy, 72 (reg_t)lid, 0 , 0);75 (reg_t)lid, 0 ); 73 76 } 74 77 … … 77 80 unsigned int * ncores ) 78 81 { 79 return hal_user_syscall( SYS_GET_NB_CORES, 82 return hal_user_syscall( SYS_GET, 83 GET_NB_CORES, 80 84 (reg_t)cxy, 81 (reg_t)ncores, 0 , 0);85 (reg_t)ncores, 0 ); 82 86 } 83 87 … … 88 92 unsigned int * lid ) 89 93 { 90 return hal_user_syscall( SYS_GET _BEST_CORE,91 (reg_t)base_cxy,92 (reg_t) level,94 return hal_user_syscall( SYS_GET, 95 GET_BEST_CORE, 96 (reg_t)((base_cxy << 16) | (level & 0xFFFF)), 93 97 (reg_t)cxy, 94 98 (reg_t)lid ); 95 99 } 96 100 101 ////////////////////////////////////////////// 102 int get_processes( unsigned int cxy, 103 unsigned int owned, 104 char * u_buf, 105 unsigned int size ) 106 { 107 return hal_user_syscall( SYS_GET, 108 GET_PROCESSES, 109 (reg_t)((cxy << 16) | (owned & 0xFFFF)), 110 (reg_t)u_buf, 111 (reg_t)size ); 112 } 113 97 114 /////////////////////////////////////////// 98 115 int get_cycle( unsigned long long * cycle ) 99 116 { 100 return hal_user_syscall( SYS_GET_CYCLE, 101 (reg_t)cycle, 0, 0, 0 ); 117 return hal_user_syscall( SYS_GET, 118 GET_CYCLE, 119 (reg_t)cycle, 0, 0 ); 120 } 121 122 /////////////////////////////////////////// 123 int get_thread_info( thread_info_t * info ) 124 { 125 return hal_user_syscall( SYS_GET, 126 GET_THREAD_INFO, 127 (reg_t)info, 0, 0 ); 102 128 } 103 129 … … 180 206 { 181 207 // test (decimal / hexa) 182 if( (buf[0] == 0x30) && ( buf[1] == 0x58) ) // hexadecimalinput208 if( (buf[0] == 0x30) && ((buf[1] == 0x58) || (buf[1] == 0x78)) ) // hexa input 183 209 { 184 210 for (i = 2; (i < length) && (overflow == 0) ; i++) … … 190 216 } 191 217 } 192 else // decimal input218 else // decimal input 193 219 { 194 220 for (i = 0; (i < length) && (overflow == 0) ; i++) … … 269 295 } 270 296 } 271 272 // set NUL character in string and return success273 274 297 } // end get_string() 275 276 277 /////////////////////////////278 int fget_string( int fdid,279 char * string,280 int maxlen )281 {282 int ret;283 char c;284 int length = 0;285 286 while( 1 )287 {288 // check buffer overflow289 if( length >= maxlen-1 ) length = 0;290 291 // read one character from stream292 ret = read( fdid , &c , 1 );293 294 if( ret == 1 )295 {296 if ( (c >= 0x20) && (c < 0x7F) ) // printable character297 {298 string[length] = (char)c; // register character in string299 length++; // update length300 }301 else if ( c == 0 ) // end of string302 {303 string[length] = (char)c; // register character in string304 length++; // update length305 break; // exit loop306 }307 // discard all characters not printable or NUL308 }309 else310 {311 printf("\n[%s] cannot read stream %d\n", __FUNCTION__, fdid );312 length = 0;313 break;314 }315 }316 } // end fget_string()317 298 318 299 … … 320 301 /////////////// non standard debug functions /////////////////////////////////// 321 302 ////////////////////////////////////////////////////////////////////////////////////// 322 323 ///////////////////////////////////////////324 int get_thread_info( thread_info_t * info )325 {326 return hal_user_syscall( SYS_GET_THREAD_INFO,327 (reg_t)info, 0, 0, 0 );328 }329 303 330 304 ////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.