Changeset 661 for trunk/libs/libalmosmkh
- Timestamp:
- Oct 10, 2020, 4:41:37 PM (4 years ago)
- Location:
- trunk/libs/libalmosmkh
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libs/libalmosmkh/almosmkh.c
r657 r661 57 57 } 58 58 59 ////////////////////////////////////// 60 int get_config( unsigned int * x_size, 61 unsigned int * y_size, 62 unsigned int * ncores ) 59 /////////////////////////////////////////////// 60 int get_config( struct hard_config_s * config ) 63 61 { 64 62 return hal_user_syscall( SYS_GET_CONFIG, 65 (reg_t)x_size, 66 (reg_t)y_size, 67 (reg_t)ncores, 0 ); 63 (reg_t)config, 0, 0, 0); 68 64 } 69 65 … … 242 238 if( length >= maxlen-1 ) 243 239 { 244 return -1; // return failure 240 // cancel all echo characters 241 while( length ) 242 { 243 printf("\b \b"); // cancel one echo character 244 length--; 245 } 245 246 } 246 247 … … 257 258 else if (c == 0x0A) // LF character marks end of string 258 259 { 260 putchar( c ); 259 261 done = 1; 260 262 } … … 264 266 if ( length > 0 ) 265 267 { 268 printf("\b \b"); // cancel one echo character 266 269 length--; 267 printf("\b \b"); // BS / / BS268 270 } 269 271 } 270 272 else if ( c == 0 ) // EOF character 271 273 { 274 // cancel all echo characters 275 while( length ) 276 { 277 printf("\b \b"); // cancel one echo character 278 length--; 279 } 272 280 return -1; // return failure 273 281 } … … 276 284 // set NUL character in string and return success 277 285 string[length] = 0; 278 return 0;286 return length + 1; 279 287 280 288 } // end get_string() … … 399 407 (reg_t)nb_slots, 0 ); 400 408 } 409 410 ///////////////////////////////////// 411 int display_socket( unsigned int pid, 412 unsigned int fdid ) 413 { 414 return hal_user_syscall( SYS_DISPLAY, 415 DISPLAY_SOCKET, 416 (reg_t)pid, 417 (reg_t)fdid, 0 ); 418 } 401 419 402 420 /////////////////////////////// … … 1495 1513 1496 1514 // get platform parameters 1497 unsigned int x_size; 1498 unsigned int y_size; 1499 unsigned int ncores; 1500 get_config( &x_size , &y_size , &ncores ); 1515 hard_config_t config; 1516 get_config( &config ); 1517 unsigned int x_size = config.x_size; 1518 unsigned int y_size = config.y_size; 1519 unsigned int ncores = config.ncores; 1501 1520 1502 1521 // get calling thread cluster identifier -
trunk/libs/libalmosmkh/almosmkh.h
r657 r661 63 63 64 64 /*************************************************************************************** 65 * This syscall returns the hardware platform parameters .66 * **************************************************************************************67 * @ x_size : [out] number of clusters in a row.68 * @ y_size : [out] number of clusters in a column.69 * @ ncores : [out] number of cores per cluster.70 * @ return always 0.71 * *************************************************************************************/72 int get_config( unsigned int * x_size, 73 unsigned int * y_size,74 unsigned int * ncores);65 * This syscall returns the hardware platform parameters in the hard_config_t pointed 66 * by the <config> argument. This structure is defined in the shared_almos.h file. 67 * The available configuration parameters are : 68 * - cores : x_size / y_size / ncores 69 * - peripherals : nb_txt_channels / nb_nic_channels / nb_ioc_channels / nb_fbf_channels 70 *************************************************************************************** 71 * @ config : [out] pointer on hard_config_t structure in user space. 72 * @ return 0 if success / return -1 if illegal argument. 73 **************************************************************************************/ 74 int get_config( struct hard_config_s * config ); 75 75 76 76 /*************************************************************************************** … … 153 153 * This syscall returns a character string from the standard "stdin" stream. 154 154 * The string is copied in buffer pointed by the <string> argument. 155 * The string length (including the NUL terminating character) cannot be larger 156 * than the size defined by the <size> argument. 155 * If the number of characters exceed the buffer length, all character are canceled 156 * in both the buffer & the echoed string, and a new string capture start. 157 * - Only printable characters c such as (0x20 <= c) and (c < 0x7f) are echoed 158 * and copied in the target buffer. 159 * - The LF (0x0A) character signaling the end of string is replaced by an extra 160 * NUL (0x00) character in the target buffer. 161 * - the DEL (0x7F), BS (0x08) control characters are taken into account, and can be 162 * used to correct both the buffer content and the echoed string. 157 163 *************************************************************************************** 158 164 * @ string : pointer on the string buffer. 159 * @ maxlen : max number of bytes in string buffer .160 * @ returns 0if success / returns -1 if failure.165 * @ maxlen : max number of bytes in string buffer, including the terminating NUL. 166 * @ returns string length (including NUL) if success / returns -1 if failure. 161 167 **************************************************************************************/ 162 168 int get_string( char * string, … … 308 314 int display_fat( unsigned int min_slot, 309 315 unsigned int nb_slots ); 316 317 /*************************************************************************************** 318 * This debug syscall displays on the kernel terminal the current state of 319 * a socket identified by the <pid> and <fdid> arguments. 320 * It can be called by any thread running in any cluster. 321 *************************************************************************************** 322 * @ pid : target process identifier. 323 * @ fdid : file descriptor identifying the target socket. 324 * @ return 0 if success / return -1 if socket not found. 325 **************************************************************************************/ 326 int display_socket( unsigned int pid, 327 unsigned int fdid ); 310 328 311 329 /*****************************************************************************************
Note: See TracChangeset
for help on using the changeset viewer.