Ignore:
Timestamp:
Jan 13, 2021, 12:45:27 AM (3 years ago)
Author:
alain
Message:

Introduce the display_socket() function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libs/libalmosmkh/almosmkh.c

    r678 r685  
    2323
    2424#include <almosmkh.h>
     25#include <shared_almos.h>
    2526#include <hal_user.h>
    2627#include <hal_macros.h>
     
    6061int get_config( struct hard_config_s * config )
    6162{
    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);
    6466}
    6567
     
    6870                 unsigned int * lid )
    6971{
    70     return hal_user_syscall( SYS_GET_CORE_ID,
     72    return hal_user_syscall( SYS_GET,
     73                             GET_CORE_ID,
    7174                             (reg_t)cxy,
    72                              (reg_t)lid, 0, 0 );
     75                             (reg_t)lid, 0 );
    7376}
    7477
     
    7780                  unsigned int * ncores )
    7881{
    79     return hal_user_syscall( SYS_GET_NB_CORES,
     82    return hal_user_syscall( SYS_GET,
     83                             GET_NB_CORES,
    8084                             (reg_t)cxy,
    81                              (reg_t)ncores, 0, 0 );
     85                             (reg_t)ncores, 0 );
    8286}
    8387
     
    8892                   unsigned int * lid )
    8993{
    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)),
    9397                             (reg_t)cxy,
    9498                             (reg_t)lid );
    9599}
    96100
     101//////////////////////////////////////////////
     102int 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
    97114///////////////////////////////////////////
    98115int get_cycle( unsigned long long * cycle )
    99116{
    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///////////////////////////////////////////
     123int 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 );
    102128}
    103129
     
    180206    {
    181207        // test (decimal / hexa)
    182         if( (buf[0] == 0x30) && (buf[1] == 0x58) )     // hexadecimal input
     208        if( (buf[0] == 0x30) && ((buf[1] == 0x58) || (buf[1] == 0x78)) )     // hexa input
    183209        {
    184210            for (i = 2; (i < length) && (overflow == 0) ; i++)
     
    190216            }
    191217        }
    192         else                                           // decimal input
     218        else                                                                // decimal input
    193219        {
    194220            for (i = 0; (i < length) && (overflow == 0) ; i++)
     
    269295        }
    270296    }
    271 
    272     // set NUL character in string and return success
    273 
    274297}  // 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 overflow
    289         if( length >= maxlen-1 )  length = 0;                 
    290 
    291         // read one character from stream
    292         ret = read( fdid , &c , 1 );
    293 
    294         if( ret == 1 )
    295         {
    296             if ( (c >= 0x20) && (c < 0x7F) )    // printable character
    297             {
    298                 string[length] = (char)c;       // register character in string
    299                 length++;                       // update length
    300             }
    301             else if ( c == 0 )                  // end of string
    302             {
    303                 string[length] = (char)c;       // register character in string
    304                 length++;                       // update length
    305                 break;                          // exit loop
    306             }
    307             // discard all characters not printable or NUL
    308         }
    309         else
    310         {
    311             printf("\n[%s] cannot read stream %d\n", __FUNCTION__, fdid );
    312             length = 0;
    313             break;
    314         }
    315     }
    316 }  // end fget_string()
    317298
    318299
     
    320301///////////////    non standard debug functions    ///////////////////////////////////
    321302//////////////////////////////////////////////////////////////////////////////////////
    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 }
    329303
    330304////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.