Changeset 714 for soft


Ignore:
Timestamp:
Oct 7, 2015, 12:02:48 PM (9 years ago)
Author:
alain
Message:

Introduce the _sys_fbf_size() function.
Modify the _sys_fbf_alloc() / _sys_fbf_release() functions
to allow all threads of a given vspace to access the frame buffer.
(replace the lock by a multi-threads allocator.

Location:
soft/giet_vm/giet_kernel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_kernel/ctx_handler.c

    r709 r714  
    5858    if ( psched->context[ltid].slot[CTX_LOCKS_ID] & LOCKS_MASK_FAT )
    5959    {
     60       
    6061        _spin_lock_release( &_fat.fat_lock );
     62    }
     63
     64    // release FBF lock if taken
     65    if ( psched->context[ltid].slot[CTX_LOCKS_ID] & LOCKS_MASK_FBF )
     66    {
     67        _sys_fbf_release();
    6168    }
    6269
  • soft/giet_vm/giet_kernel/ctx_handler.h

    r709 r714  
    104104#define LOCKS_MASK_BDV        0x00000001   // BDV kernel lock taken
    105105#define LOCKS_MASK_FAT        0x00000002   // FAT kernel lock taken
     106#define LOCKS_MASK_FBF        0x00000004   // FBF kernel lock taken
    106107
    107108/////////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/giet_kernel/sys_handler.c

    r709 r714  
    9595extern static_scheduler_t* _schedulers[X_SIZE][Y_SIZE][NB_PROCS_MAX];
    9696
     97// allocated in bdv_driver.c file
     98spin_lock_t  _bdv_lock;
     99
     100////////////////////////////////////////////////////////////////////////////////
     101//     Allocator protecting exclusive access to FBF by a single application.
     102// - The number of users in a given application should be set by a single
     103//   thread using an _atomic_test_and_set().
     104// - The allocator is atomically decremented by each user thread when
     105//   the thread exit.   
     106////////////////////////////////////////////////////////////////////////////////
     107
     108__attribute__((section(".kdata")))
     109unsigned int _fbf_alloc = 0;
     110
    97111////////////////////////////////////////////////////////////////////////////////
    98112//     Channel allocators for multi-channels peripherals
     
    179193    &_sys_xy_from_ptr,               /* 0x03 */
    180194    &_sys_ukn,                       /* 0x04 */
    181     &_sys_ukn,                       /* 0x05 */
    182     &_sys_ukn,                       /* 0x06 */
     195    &_sys_vseg_get_vbase,            /* 0x05 */
     196    &_sys_vseg_get_length,           /* 0x06 */
    183197    &_sys_heap_info,                 /* 0x07 */
    184     &_sys_vseg_get_vbase,            /* 0x08 */
    185     &_sys_vseg_get_length,           /* 0x09 */
     198    &_sys_fbf_size,                  /* 0x08 */
     199    &_sys_fbf_alloc,                 /* 0x09 */
    186200    &_sys_fbf_cma_alloc,             /* 0x0A */
    187201    &_sys_fbf_cma_init_buf,          /* 0x0B */
     
    251265// This function is called by the _sys_exec_application function
    252266// to reload all data segments contained in an application.elf file.
     267// File checking is minimal, because these segments have already
     268// been loaded by the boot code.
    253269////////////////////////////////////////////////////////////////////////
    254270static unsigned int _load_writable_segments( mapping_vspace_t*  vspace )
     
    262278unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
    263279if ( _get_proctime() > GIET_DEBUG_EXEC )
    264 _printf("\n[DEBUG EXEC] _load_writable_segments() : P[%d,%d,%d] "
    265         "enters for %s\n", x , y , p , vspace->name );
     280_printf("\n[DEBUG EXEC] _load_writable_segments() at cycle %d\n"
     281        "P[%d,%d,%d] enters for %s\n",
     282        _get_proctime() , x , y , p , vspace->name );
    266283#endif
    267284
     
    271288    unsigned int vseg_id;        // vseg index in mapping
    272289    char         buf[4096];      // buffer to store one cluster
    273     unsigned int fd = 0;         // file descriptor
     290    unsigned int fd    = 0;      // file descriptor
     291    unsigned int found = 0;
    274292
    275293    // first scan on vsegs in vspace to find the .elf pathname
     
    283301            fd = _fat_open( vseg[vseg_id].binpath , O_RDONLY );
    284302            if ( fd < 0 ) return 1;
    285             break;
    286303
    287304#if GIET_DEBUG_EXEC
    288305if ( _get_proctime() > GIET_DEBUG_EXEC )
    289 _printf("\n[DEBUG EXEC] _load_writable_segments() : P[%d,%d,%d] "
    290         "open %s / fd = %d\n", x , y , p , vseg[vseg_id].binpath , fd );
    291 #endif
     306_printf("\n[DEBUG EXEC] _load_writable_segments() at cycle %d\n"
     307        "P[%d,%d,%d] open %s / fd = %d\n",
     308        _get_proctime() , x , y , p , vseg[vseg_id].binpath , fd );
     309#endif
     310            found = 1;
     311            break;
     312 
    292313        }
    293314    }
    294315 
     316    // check .elf file found
     317    if ( found == 0 )
     318    {
     319
     320_printf("@@@ _load_writable_segments() : .elf not found\n");
     321
     322        return 1;
     323    }
     324
    295325    // load Elf-Header into buffer from .elf file
    296326    if ( _fat_lseek( fd, 0, SEEK_SET ) < 0 )
    297327    {
     328
     329_printf("@@@ _load_writable_segments() : cannot seek\n");
     330
    298331        _fat_close( fd );
    299332        return 1;
     333
    300334    }
    301335    if ( _fat_read( fd, (unsigned int)buf, 4096, 0 ) < 0 )
    302336    {
     337
     338_printf("@@@ _load_writable_segments() : cannot read\n");
     339
    303340        _fat_close( fd );
    304341        return 1;
     
    307344#if GIET_DEBUG_EXEC
    308345if ( _get_proctime() > GIET_DEBUG_EXEC )
    309 _printf("\n[DEBUG EXEC] _load_writable_segments() : P[%d,%d,%d] "
    310         "loaded Elf-Header\n", x , y , p );
     346_printf("\n[DEBUG EXEC] _load_writable_segments() at cycle %d\n"
     347        "P[%d,%d,%d] loaded Elf-Header\n",
     348        _get_proctime() , x , y , p );
    311349#endif
    312350
     
    330368#if GIET_DEBUG_EXEC
    331369if ( _get_proctime() > GIET_DEBUG_EXEC )
    332 _printf("\n[DEBUG EXEC] _load_writable_segments() : P[%d,%d,%d] "
    333         "loaded Program-Header-Table\n", x , y , p );
     370_printf("\n[DEBUG EXEC] _load_writable_segments() at cycle %d\n"
     371        "P[%d,%d,%d] loaded Program-Header-Table\n",
     372        _get_proctime() , x , y , p );
    334373#endif
    335374
     
    384423#if GIET_DEBUG_EXEC
    385424if ( _get_proctime() > GIET_DEBUG_EXEC )
    386 _printf("\n[DEBUG EXEC] _load_writable_segments() : P[%d,%d,%d] "
    387         "loaded segment %x\n", x , y , p , vbase );
     425_printf("\n[DEBUG EXEC] _load_writable_segments() at cycle %d\n"
     426        "P[%d,%d,%d] loaded segment %x\n",
     427        _get_proctime() , x , y , p , vbase );
    388428#endif
    389429        }
     
    416456unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
    417457if ( _get_proctime() > GIET_DEBUG_EXEC )
    418 _printf("\n[DEBUG EXEC] _sys_exec_application() : P[%d,%d,%d] "
    419         "enters for %s at cycle %d\n", x, y, p, name, _get_proctime() );
     458_printf("\n[DEBUG EXEC] _sys_exec_application() at cycle %d\n"
     459        "P[%d,%d,%d] enters for vspace %s\n",
     460        _get_proctime() , x, y, p, name );
    420461#endif
    421462
     
    430471#if GIET_DEBUG_EXEC
    431472if ( _get_proctime() > GIET_DEBUG_EXEC )
    432 _printf("\n[DEBUG EXEC] _sys_exec_application() : P[%d,%d,%d] "
    433         "found vspace %s at cycle  %d\n", x, y, p, name, _get_proctime() );
     473_printf("\n[DEBUG EXEC] _sys_exec_application() at cycle %d\n"
     474        "P[%d,%d,%d] found vspace %s\n",
     475        _get_proctime() , x, y, p, name );
    434476#endif
    435477            // reload writable segments
     
    438480                _printf("[GIET ERROR] _sys_exec_application() : "
    439481                        "can't load data segment for vspace %s\n", name );
    440                 return GIET_SYSCALL_CANNOT_LOAD_DATA_SEGMENT;
     482                return SYSCALL_CANNOT_LOAD_DATA_SEGMENT;
    441483            }
    442484 
    443485#if GIET_DEBUG_EXEC
    444486if ( _get_proctime() > GIET_DEBUG_EXEC )
    445 _printf("\n[DEBUG EXEC] _sys_exec_application() : P[%d,%d,%d] "
    446         "load segments for vspace %s at cycle  %d\n", x, y, p, name, _get_proctime() );
     487_printf("\n[DEBUG EXEC] _sys_exec_application() at cycle %d\n"
     488        "P[%d,%d,%d] loaded all writable segments for vspace %s\n",
     489        _get_proctime() , x, y, p, name );
    447490#endif
    448491            // scan threads in vspace with three goals :
     
    474517                            "thread %s already active in vspace %s\n",
    475518                            thread[thread_id].name, name );
    476                     return GIET_SYSCALL_THREAD_ALREADY_ACTIVE;
     519                    return SYSCALL_THREAD_ALREADY_ACTIVE;
    477520                }
    478521               
     
    499542#if GIET_DEBUG_EXEC
    500543if ( _get_proctime() > GIET_DEBUG_EXEC )
    501 _printf("\n[DEBUG EXEC] _sys_exec_application() : P[%d,%d,%d] "
    502         "initialise thread %s at cycle  %d\n",
    503         x, y, p, thread[thread_id].name, _get_proctime() );
    504 #endif
    505             }  // end loop on vspace threads
     544_printf("\n[DEBUG EXEC] _sys_exec_application() at cycle %d\n"
     545        "P[%d,%d,%d] initialise thread %s in vspace %s\n",
     546        _get_proctime() , x, y, p, thread[thread_id].name , name );
     547#endif
     548            }  // end loop on threads
    506549
    507550            // activate main thread
     
    514557                _printf("\n[GIET ERROR] in _sys_exec_application() : "
    515558                        "main not found in vspace %s\n", name );
    516                 return GIET_SYSCALL_MAIN_NOT_FOUND;
     559                return SYSCALL_MAIN_NOT_FOUND;
    517560            }
    518561             
    519 #if GIET_DEBUG_EXEC
    520 if ( _get_proctime() > GIET_DEBUG_EXEC )
    521 _printf("\n[DEBUG EXEC] _sys_exec_application() : P[%d,%d,%d] "
    522         "lauched %s at cycle %d\n", x, y, p, name, _get_proctime() );
    523 #endif
    524             return GIET_SYSCALL_OK;
     562            _printf("\n[GIET WARNING] application %s launched : %d threads\n",
     563                    name , max-min );
     564
     565            return SYSCALL_OK;
    525566        }
    526567    }  // end of loop on vspaces
     
    529570    _printf("\n[GIET ERROR] in _sys_exec_application() : "
    530571            "vspace %s not found\n", name );
    531     return GIET_SYSCALL_VSPACE_NOT_FOUND;
     572    return SYSCALL_VSPACE_NOT_FOUND;
    532573
    533574}  // end _sys_exec_application()
     
    551592unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
    552593if ( _get_proctime() > GIET_DEBUG_EXEC )
    553 _printf("\n[DEBUG EXEC] _sys_kill_application() P[%d,%d,%d] "
    554         "enters at cycle %d for %s\n", x, y, p, _get_proctime() , name );
     594_printf("\n[DEBUG EXEC] _sys_kill_application() at cycle %d\n"
     595        "P[%d,%d,%d] enters for vspace %s\n",
     596        _get_proctime() , x , y , p , name );
    555597#endif
    556598
     
    560602        _printf("\n[GIET ERROR] in _sys_kill_application() : "
    561603                "%s application cannot be killed\n", name );
    562         return GIET_SYSCALL_APPLI_CANNOT_BE_KILLED;
     604        return SYSCALL_APPLI_CANNOT_BE_KILLED;
    563605    }
    564606
     
    587629            }
    588630
    589 #if GIET_DEBUG_EXEC
    590 if ( _get_proctime() > GIET_DEBUG_EXEC )
    591 _printf("\n[DEBUG EXEC] _sys_kill_application() P[%d,%d,%d] "
    592         "kill %s at cycle %d\n", x, y, p, name, _get_proctime() );
    593 #endif
    594 
    595             return GIET_SYSCALL_OK;
     631            _printf("\n[GIET WARNING] application %s killed / %d threads\n",
     632                    name , max-min );
     633
     634            return SYSCALL_OK;
    596635        }
    597636    }  // en loop on vspaces
     
    599638    _printf("\n[GIET ERROR] in _sys_kill_application() : "
    600639            "application %s not found\n", name );
    601     return GIET_SYSCALL_VSPACE_NOT_FOUND;
     640    return SYSCALL_VSPACE_NOT_FOUND;
    602641
    603642}  // end _sys_kill_application()
     
    605644
    606645
    607 //////////////////////////////
    608 int _sys_applications_status()
     646//////////////////////////////////////////
     647int _sys_applications_status( char* name )
    609648{
    610649    mapping_header_t *  header  = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
     
    613652    mapping_cluster_t * cluster = _get_cluster_base(header);
    614653
    615     unsigned int thread_id;
    616     unsigned int vspace_id;
    617 
    618     // scan all vspaces
     654    unsigned int thread_id;   // thread index in mapping
     655    unsigned int vspace_id;   // vspace index in mapping
     656
     657    // scan vspaces
    619658    for( vspace_id = 0 ; vspace_id < header->vspaces ; vspace_id++ )
    620659    {
    621         _user_printf("\n*** vspace %s\n", vspace[vspace_id].name );
    622 
    623         // scan all threads in vspace
    624         unsigned int min = vspace[vspace_id].thread_offset ;
    625         unsigned int max = min + vspace[vspace_id].threads ;
    626         for ( thread_id = min ; thread_id < max ; thread_id++ )
     660        if ( (name == NULL) || (_strcmp(vspace[vspace_id].name , name ) == 0) )
    627661        {
    628             unsigned int         clusterid = thread[thread_id].clusterid;
    629             unsigned int         p         = thread[thread_id].proclocid;
    630             unsigned int         x         = cluster[clusterid].x;
    631             unsigned int         y         = cluster[clusterid].y;
    632             unsigned int         ltid      = thread[thread_id].ltid;
    633             static_scheduler_t*  psched    = (static_scheduler_t*)_schedulers[x][y][p];
    634             unsigned int         norun     = psched->context[ltid].slot[CTX_NORUN_ID];
    635             unsigned int         tty       = psched->context[ltid].slot[CTX_TTY_ID];
    636             unsigned int         current   = psched->current;
    637 
    638             if ( current == ltid )
    639             _user_printf(" - thread %s / P[%d,%d,%d] / ltid = %d / "
    640                          "TTY = %d / norun = %x : running\n",
    641                          thread[thread_id].name, x, y, p, ltid, tty, norun );
    642             else if ( norun == 0 )
    643             _user_printf(" - thread %s / P[%d,%d,%d] / ltid = %d / "
    644                          "TTY = %d / norun = %x : runable\n",
    645                          thread[thread_id].name, x, y, p, ltid, tty, norun);
    646             else
    647             _user_printf(" - thread %s / P[%d,%d,%d] / ltid = %d / "
    648                          "TTY = %d / norun = %x : blocked\n",
    649                          thread[thread_id].name, x, y, p, ltid, tty, norun);
     662            _user_printf("\n*** vspace %s\n", vspace[vspace_id].name );
     663
     664            // scan all threads in vspace
     665            unsigned int min = vspace[vspace_id].thread_offset ;
     666            unsigned int max = min + vspace[vspace_id].threads ;
     667            for ( thread_id = min ; thread_id < max ; thread_id++ )
     668            {
     669                unsigned int         clusterid = thread[thread_id].clusterid;
     670                unsigned int         p         = thread[thread_id].proclocid;
     671                unsigned int         x         = cluster[clusterid].x;
     672                unsigned int         y         = cluster[clusterid].y;
     673                unsigned int         ltid      = thread[thread_id].ltid;
     674                static_scheduler_t*  psched    = (static_scheduler_t*)_schedulers[x][y][p];
     675                unsigned int         norun     = psched->context[ltid].slot[CTX_NORUN_ID];
     676                unsigned int         tty       = psched->context[ltid].slot[CTX_TTY_ID];
     677                unsigned int         current   = psched->current;
     678
     679                if ( current == ltid )
     680                _user_printf(" - thread %s / P[%d,%d,%d] / ltid = %d / "
     681                             "TTY = %d / norun = %x : running\n",
     682                             thread[thread_id].name, x, y, p, ltid, tty, norun );
     683                else if ( norun == 0 )
     684                _user_printf(" - thread %s / P[%d,%d,%d] / ltid = %d / "
     685                             "TTY = %d / norun = %x : runable\n",
     686                             thread[thread_id].name, x, y, p, ltid, tty, norun);
     687                else
     688                _user_printf(" - thread %s / P[%d,%d,%d] / ltid = %d / "
     689                             "TTY = %d / norun = %x : blocked\n",
     690                             thread[thread_id].name, x, y, p, ltid, tty, norun);
     691            }
    650692        }
    651693    }
    652694    _user_printf("\n");
    653     return GIET_SYSCALL_OK;
     695
     696    return SYSCALL_OK;
    654697}  // end _sys_applications_status()
    655698
     
    672715                "attr argument not supported\n" );
    673716       
    674         return GIET_SYSCALL_PTHREAD_ARGUMENT_NOT_SUPPORTED;
     717        return SYSCALL_PTHREAD_ARGUMENT_NOT_SUPPORTED;
    675718    }
    676719
     
    691734
    692735#if GIET_DEBUG_EXEC
     736unsigned int gpid       = _get_procid();
     737unsigned int cluster_xy = gpid >> P_WIDTH;
     738unsigned int p          = gpid & ((1<<P_WIDTH)-1);
     739unsigned int x          = cluster_xy >> Y_WIDTH;
     740unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
    693741if ( _get_proctime() > GIET_DEBUG_EXEC )
    694 _printf("\n[DEBUG EXEC] _sys_pthread_create() : enters at cycle %d"
    695         " for vspace %s / entry = %x\n",
    696         _get_proctime() , vspace[vspace_id].name , (unsigned int)function );
     742_printf("\n[DEBUG EXEC] _sys_pthread_create() at cycle %d\n"
     743        "P[%d,%d,%d] enters for vspace %s / entry = %x\n",
     744        _get_proctime() , x , y , p , vspace[vspace_id].name , (unsigned int)function );
    697745#endif
    698746
     
    747795#if GIET_DEBUG_EXEC
    748796if ( _get_proctime() > GIET_DEBUG_EXEC )
    749 _printf("\n[DEBUG EXEC] exit _sys_pthread_create() at cycle %d : thread %x launched\n",
    750         _get_proctime() , trdid);
    751 #endif
    752         return GIET_SYSCALL_OK;
     797_printf("\n[DEBUG EXEC] _sys_pthread_create() at cycle %d\n"
     798        "P[%d,%d,%d] exit : thread %x launched in vspace %s\n",
     799        _get_proctime() , x , y , p , trdid , vspace[vspace_id].name );
     800#endif
     801        return SYSCALL_OK;
    753802    }
    754803    else         // no matching thread found
     
    758807                (unsigned int)function , vspace[vspace_id].name );
    759808       
    760         return GIET_SYSCALL_THREAD_NOT_FOUND;
     809        return SYSCALL_THREAD_NOT_FOUND;
    761810    }
    762811
     
    774823                "ptr argument not supported, must be NULL\n" );
    775824       
    776         return GIET_SYSCALL_PTHREAD_ARGUMENT_NOT_SUPPORTED;
    777     }
    778 
     825        return SYSCALL_PTHREAD_ARGUMENT_NOT_SUPPORTED;
     826    }
     827
     828    // get calling thread vspace
     829    unsigned int  caller_vspace = _get_context_slot( CTX_VSID_ID );
    779830               
    780831#if GIET_DEBUG_EXEC
     832unsigned int gpid       = _get_procid();
     833unsigned int cluster_xy = gpid >> P_WIDTH;
     834unsigned int p          = gpid & ((1<<P_WIDTH)-1);
     835unsigned int x          = cluster_xy >> Y_WIDTH;
     836unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
    781837if ( _get_proctime() > GIET_DEBUG_EXEC )
    782 _printf("\n[DEBUG EXEC] enters _sys_pthread_join() at cycle %d for thread %x\n",
    783         _get_proctime() , trdid );
    784 #endif
    785 
     838_printf("\n[DEBUG EXEC] _sys_pthread_join() at cycle %d\n"
     839        "P[%d,%d,%d] enters for thread %x in vspace %d\n",
     840        _get_proctime() , x , y , p , trdid , caller_vspace );
     841#endif
     842
     843    // get target thread indexes from trdid
     844    unsigned int cx   = (trdid>>24) & 0xFF;
     845    unsigned int cy   = (trdid>>16) & 0xFF;
     846    unsigned int lpid = (trdid>>8 ) & 0xFF;
     847    unsigned int ltid = (trdid    ) & 0xFF;
     848
     849    // get target thread scheduler, vspace and registered trdid
     850    static_scheduler_t*  psched   = _schedulers[cx][cy][lpid];
     851    unsigned int target_vspace    = psched->context[ltid].slot[CTX_VSID_ID];
     852    unsigned int registered_trdid = psched->context[ltid].slot[CTX_TRDID_ID];
     853
     854    // check trdid
     855    if ( trdid != registered_trdid )
     856    {
     857       _printf("\nerror in _sys_pthread_join() : "
     858               "trdid = %x / registered_trdid = %x\n",
     859               trdid , registered_trdid );
     860
     861       return SYSCALL_UNCOHERENT_THREAD_CONTEXT;
     862    }
     863   
     864    // check calling thread and target thread in same vspace
     865    if ( caller_vspace != target_vspace )
     866    {
     867       _printf("\n[GIET ERROR] in _sys_pthread_join() : "
     868               " calling thread and target thread not in same vspace\n");
     869
     870       return SYSCALL_NOT_IN_SAME_VSPACE;
     871    }
     872
     873    // get target thread state
     874    unsigned int* pnorun = &psched->context[ltid].slot[CTX_NORUN_ID];
     875
     876    asm volatile ( "2000:                      \n"                         
     877                   "move  $11,  %0             \n"   /* $11 <= pnorun        */
     878                   "lw    $11,  0($11)         \n"   /* $11 <= norun         */
     879                   "andi  $11,  $11,    1      \n"   /* $11 <= norun & 0x1   */
     880                   "beqz  $11,  2000b          \n"   
     881                   :
     882                   : "r" (pnorun)
     883                   : "$11" );
     884
     885#if GIET_DEBUG_EXEC
     886if ( _get_proctime() > GIET_DEBUG_EXEC )
     887_printf("\n[DEBUG EXEC] _sys_pthread_join() at cycle %d\n"
     888        "P[%d,%d,%d] exit for thread %x in vspace %d\n",
     889        _get_proctime() , x , y , p , trdid , caller_vspace );
     890#endif
     891
     892    return SYSCALL_OK;
     893
     894}  // end _sys_pthread_join()
     895                       
     896
     897////////////////////////////////////////
     898int _sys_pthread_kill( pthread_t  trdid,
     899                       int        signal )
     900{
    786901    // get calling thread vspace
    787902    unsigned int  caller_vspace = _get_context_slot( CTX_VSID_ID );
     903
     904#if GIET_DEBUG_EXEC
     905unsigned int gpid       = _get_procid();
     906unsigned int cluster_xy = gpid >> P_WIDTH;
     907unsigned int p          = gpid & ((1<<P_WIDTH)-1);
     908unsigned int x          = cluster_xy >> Y_WIDTH;
     909unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
     910if ( _get_proctime() > GIET_DEBUG_EXEC )
     911_printf("\n[DEBUG EXEC] _sys_pthread_kill() at cycle %d\n"
     912        "P[%d,%d,%d] enters for thread %x in vspace %d\n",
     913        _get_proctime() , x , y , p , trdid , caller_vspace );
     914#endif
     915
    788916
    789917    // get and check target thread indexes from trdid
     
    794922
    795923    // get target thread scheduler, vspace and registered trdid
    796     static_scheduler_t*  psched   = _schedulers[cx][cy][lpid];
    797     unsigned int target_vspace    = psched->context[ltid].slot[CTX_VSID_ID];
     924    static_scheduler_t*  psched       = _schedulers[cx][cy][lpid];
     925    unsigned int target_vspace        = psched->context[ltid].slot[CTX_VSID_ID];
    798926    unsigned int registered_trdid = psched->context[ltid].slot[CTX_TRDID_ID];
    799927
     
    801929    if ( trdid != registered_trdid )
    802930    {
    803        _printf("\nerror in _sys_pthread_join() : "
    804                "trdid = %x / registered_trdid = %x\n",
    805                trdid , registered_trdid );
    806 
    807        return GIET_SYSCALL_UNCOHERENT_THREAD_CONTEXT;
     931       _printf("\n[GIET ERROR] in _sys_pthread_kill() : trdid = %x"
     932               " / registered_trdid = %x\n", trdid , registered_trdid );
     933       return SYSCALL_UNCOHERENT_THREAD_CONTEXT;
    808934    }
    809935   
     
    811937    if ( caller_vspace != target_vspace )
    812938    {
    813        _printf("\n[GIET ERROR] in _sys_pthread_join() : "
    814                " calling thread and target thread not in same vspace\n");
    815 
    816        return GIET_SYSCALL_NOT_IN_SAME_VSPACE;
    817     }
    818 
    819     // get target thread state
    820     unsigned int* pnorun = &psched->context[ltid].slot[CTX_NORUN_ID];
    821 
    822     asm volatile ( "2000:                      \n"                         
    823                    "move  $11,  %0             \n"   /* $11 <= ptr           */
    824                    "lw    $11,  0($11)         \n"   /* $11 <= M[ptr]        */
    825                    "andi  $11,  $11,    1      \n"   /* $11 <= norun & 0x1   */
    826                    "beqz  $11,  2000b          \n"   
    827                    :
    828                    : "r" (pnorun)
    829                    : "$11" );
    830 
    831     return GIET_SYSCALL_OK;
    832 
    833 }  // end _sys_pthread_join()
    834                        
    835 
    836 ////////////////////////////////////////
    837 int _sys_pthread_kill( pthread_t  trdid,
    838                        int        signal )
    839 {
    840     // get calling thread vspace
    841     unsigned int  caller_vspace = _get_context_slot( CTX_VSID_ID );
    842 
    843     // get and check target thread indexes from trdid
    844     unsigned int cx   = (trdid>>24) & 0xFF;
    845     unsigned int cy   = (trdid>>16) & 0xFF;
    846     unsigned int lpid = (trdid>>8 ) & 0xFF;
    847     unsigned int ltid = (trdid    ) & 0xFF;
    848 
    849     // get target thread scheduler, vspace and registered trdid
    850     static_scheduler_t*  psched       = _schedulers[cx][cy][lpid];
    851     unsigned int target_vspace        = psched->context[ltid].slot[CTX_VSID_ID];
    852     unsigned int registered_trdid = psched->context[ltid].slot[CTX_TRDID_ID];
    853 
    854     // check trdid
    855     if ( trdid != registered_trdid )
    856     {
    857        _printf("\n[GIET ERROR] in _sys_pthread_kill() : trdid = %x"
    858                " / registered_trdid = %x\n", trdid , registered_trdid );
    859        return GIET_SYSCALL_UNCOHERENT_THREAD_CONTEXT;
    860     }
    861    
    862     // check calling thread and target thread in same vspace
    863     if ( caller_vspace != target_vspace )
    864     {
    865939       _printf("\n[GIET ERROR] in _sys_pthread_kill() : not in same vspace\n");
    866        return GIET_SYSCALL_NOT_IN_SAME_VSPACE;
     940       return SYSCALL_NOT_IN_SAME_VSPACE;
    867941    }
    868942
     
    873947    }
    874948
    875     return GIET_SYSCALL_OK;
     949#if GIET_DEBUG_EXEC
     950if ( _get_proctime() > GIET_DEBUG_EXEC )
     951_printf("\n[DEBUG EXEC] _sys_pthread_kill() at cycle %d\n"
     952        "P[%d,%d,%d] exit for thread %x in vspace %d\n",
     953        _get_proctime() , x , y , p , trdid , caller_vspace );
     954#endif
     955
     956    return SYSCALL_OK;
    876957
    877958}  // end _sys_pthread_kill()
     
    881962int _sys_pthread_exit( void* string )
    882963{
    883     unsigned int date       = _get_proctime();
    884 
    885964    mapping_header_t * header  = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
    886965    mapping_vspace_t * vspace  = _get_vspace_base(header);
     
    893972    if ( string == NULL )
    894973    {
    895         _printf("\n[GIET WARNING] Exit thread %x in vspace %s at cycle %d\n",
    896                 trdid , vspace[vsid].name , date );
     974        _printf("\n[GIET WARNING] Exit thread %x in vspace %s\n",
     975                trdid , vspace[vsid].name );
    897976    }
    898977    else
    899978    {
    900         _printf("\n[GIET WARNING] Exit thread %x in vspace %s at cycle %d\n"
     979        _printf("\n[GIET WARNING] Exit thread %x in vspace %s\n"
    901980                "               Cause : %s\n\n",
    902                 trdid , vspace[vsid].name , date , (char*) string );
     981                trdid , vspace[vsid].name , (char*) string );
    903982    }
    904983   
     
    915994    _ctx_switch();
    916995
    917     return GIET_SYSCALL_OK;
     996    return SYSCALL_OK;
    918997
    919998}  // end _sys_pthread_exit()
     
    9281007    _it_restore( &save_sr );
    9291008
    930     return GIET_SYSCALL_OK;
     1009    return SYSCALL_OK;
    9311010}
    9321011
     
    9381017
    9391018#if GIET_DEBUG_EXEC
     1019unsigned int gpid       = _get_procid();
     1020unsigned int cluster_xy = gpid >> P_WIDTH;
     1021unsigned int p          = gpid & ((1<<P_WIDTH)-1);
     1022unsigned int x          = cluster_xy >> Y_WIDTH;
     1023unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);
    9401024if ( _get_proctime() > GIET_DEBUG_EXEC )
    941 _printf("\n[DEBUG EXEC] _sys_pthread_control() at cycle %d : "
    942         "enter for vspace %s / thread %s / command = %d\n",
    943         _get_proctime() , vspace_name, thread_name, command );
     1025_printf("\n[DEBUG EXEC] _sys_pthread_control() at cycle %d\n"
     1026        "P[%d,%d,%d] enter for vspace %s / thread %s / command = %d\n",
     1027        _get_proctime() , x , y , p , vspace_name, thread_name, command );
    9441028#endif
    9451029
     
    9641048    }
    9651049
    966     if ( found == 0 ) return GIET_SYSCALL_VSPACE_NOT_FOUND;
     1050    if ( found == 0 ) return SYSCALL_VSPACE_NOT_FOUND;
    9671051
    9681052    // search thread name in vspace to get thread index: tid
     
    9801064    }
    9811065
    982     if ( found == 0 ) return GIET_SYSCALL_THREAD_NOT_FOUND;
    983 
    984     // get thread coordinates
     1066    if ( found == 0 ) return SYSCALL_THREAD_NOT_FOUND;
     1067
     1068    // get target thread coordinates
    9851069    unsigned int cid  = thread[tid].clusterid;
    986     unsigned int x    = cluster[cid].x;
    987     unsigned int y    = cluster[cid].y;
    988     unsigned int p    = thread[tid].proclocid;
     1070    unsigned int cx   = cluster[cid].x;
     1071    unsigned int cy   = cluster[cid].y;
     1072    unsigned int cp   = thread[tid].proclocid;
    9891073    unsigned int ltid = thread[tid].ltid;
    9901074
    991     static_scheduler_t* psched = _schedulers[x][y][p];
     1075    // get target thread scheduler
     1076    static_scheduler_t* psched = _schedulers[cx][cy][cp];
    9921077
    9931078    // check trdid and vsid
    994     unsigned int trdid = x<<24 | y<<16 | p<<8 | ltid;
     1079    unsigned int trdid = cx<<24 | cy<<16 | cp<<8 | ltid;
    9951080    if ( (psched->context[ltid].slot[CTX_TRDID_ID] != trdid) ||
    9961081         (psched->context[ltid].slot[CTX_VSID_ID]  != vsid) )
    997         return GIET_SYSCALL_UNCOHERENT_THREAD_CONTEXT;
     1082    {
     1083        return SYSCALL_UNCOHERENT_THREAD_CONTEXT;
     1084    }
    9981085
    9991086    // execute command
     
    10011088    {
    10021089        _atomic_or ( &psched->context[ltid].slot[CTX_NORUN_ID],  NORUN_MASK_THREAD );
    1003         return GIET_SYSCALL_OK;
     1090        return SYSCALL_OK;
    10041091    }
    10051092    else if ( command == THREAD_CMD_RESUME )
    10061093    {
    10071094        _atomic_and( &psched->context[ltid].slot[CTX_NORUN_ID], ~NORUN_MASK_THREAD );
    1008         return GIET_SYSCALL_OK;
     1095        return SYSCALL_OK;
    10091096    }
    10101097    else if ( command == THREAD_CMD_CONTEXT )
     
    10461133                      psched->context[ltid].slot[CTX_CMA_TX_ID],
    10471134                      psched->context[ltid].slot[CTX_CMA_FB_ID] );
    1048         return GIET_SYSCALL_OK;
     1135        return SYSCALL_OK;
    10491136    }
    10501137    else
    10511138    {
    1052         return GIET_SYSCALL_ILLEGAL_THREAD_COMMAND_TYPE;
     1139        return SYSCALL_ILLEGAL_THREAD_COMMAND_TYPE;
    10531140    }
    10541141
     
    11151202
    11161203#if GIET_DEBUG_COPROC
    1117 _printf("\n[GIET DEBUG COPROC] _sys_coproc_alloc() in cluster[%d,%d]\n"
    1118         "  coproc_info = %x / cluster_xy = %x\n",
    1119         x , y , *coproc_info , cluster_xy );
    1120 #endif
    1121         return GIET_SYSCALL_OK;
     1204_printf("\n[DEBUG COPROC] _sys_coproc_alloc() at cycle %d\n"
     1205        "coproc_info = %x / cluster_xy = %x\n",
     1206        _get_proctime() , *coproc_info , cluster_xy );
     1207#endif
     1208        return SYSCALL_OK;
    11221209    }
    11231210    else
    11241211    {
    1125          _printf("\n[GIET_ERROR] in _sys_coproc_alloc(): no coprocessor "
    1126                  " with type %d available in cluster[%d,%d]\n",
     1212         _printf("\n[GIET_ERROR] in _sys_coproc_alloc(): "
     1213                 "no coprocessor with type %d in cluster[%d,%d]\n",
    11271214                 coproc_type , x , y );
    1128         return GIET_SYSCALL_COPROCESSOR_NOT_FOUND;
     1215
     1216        return SYSCALL_COPROCESSOR_NOT_FOUND;
    11291217    }
    11301218}  // end _sys_coproc_alloc()
     
    11331221int _sys_coproc_release( unsigned int coproc_reg_index )
    11341222{
    1135     // processor coordinates
    1136     unsigned int procid = _get_procid();
    1137     unsigned int x      = procid >> (Y_WIDTH + P_WIDTH);
    1138     unsigned int y      = (procid >> P_WIDTH) & ((1<<Y_WIDTH)-1);
    1139     unsigned int p      = procid & ((1<<P_WIDTH)-1);
    1140    
     1223    // get thread trdid
     1224    unsigned int trdid = _get_thread_trdid();
     1225
    11411226    // get coprocessor coordinates
    11421227    unsigned int cluster_xy = _get_context_slot( CTX_COPROC_ID );
     1228
    11431229    if ( cluster_xy > 0xFF )
    11441230    {
    11451231         _printf("\n[GIET_ERROR] in _sys_coproc_release(): "
    1146                  "no coprocessor allocated to thread running on P[%d,%d,%d]\n",
    1147                  x , y , p );
    1148          return GIET_SYSCALL_COPROCESSOR_NOT_FOUND;
     1232                 "no coprocessor allocated to thread %x\n", trdid );
     1233
     1234         return SYSCALL_COPROCESSOR_NON_ALLOCATED;
    11491235    }
    11501236
     
    11711257
    11721258#if GIET_DEBUG_COPROC
    1173 _printf("\n[GIET DEBUG COPROC] _sys_coproc_release() in cluster[%d,%d]\n",
    1174         cx, cy );
    1175 #endif
    1176 
    1177     return GIET_SYSCALL_OK;
     1259_printf("\n[DEBUG COPROC] _sys_coproc_release() at cycle %d\n"
     1260        "thread %x release coprocessor in cluster[%d,%d]\n", cx, cy );
     1261#endif
     1262
     1263    return SYSCALL_OK;
    11781264}  // end _sys_coproc_release()
    11791265
     
    11821268                              giet_coproc_channel_t*  desc )
    11831269{
    1184     // processor coordinates
    1185     unsigned int procid = _get_procid();
    1186     unsigned int x      = procid >> (Y_WIDTH + P_WIDTH);
    1187     unsigned int y      = (procid >> P_WIDTH) & ((1<<Y_WIDTH)-1);
    1188     unsigned int p      = procid & ((1<<P_WIDTH)-1);
    1189    
     1270    // get thread trdid
     1271    unsigned int trdid = _get_thread_trdid();
     1272
    11901273    // get coprocessor coordinates
    11911274    unsigned int cluster_xy = _get_context_slot( CTX_COPROC_ID );
     1275
    11921276    if ( cluster_xy > 0xFF )
    11931277    {
    11941278         _printf("\n[GIET_ERROR] in _sys_coproc_channel_init(): "
    1195                  "no coprocessor allocated to thread running on P[%d,%d,%d]\n",
    1196                  x , y , p );
    1197          return GIET_SYSCALL_COPROCESSOR_NOT_FOUND;
     1279                 "no coprocessor allocated to thread %x\n", trdid );
     1280
     1281         return SYSCALL_COPROCESSOR_NON_ALLOCATED;
    11981282    }
    11991283
     
    12051289    {
    12061290         _printf("\n[GIET_ERROR] in _sys_coproc_channel_init(): "
    1207                  " illegal mode\n");
    1208          return GIET_SYSCALL_COPROCESSOR_ILLEGAL_MODE;
     1291                 "illegal mode\n");
     1292
     1293         return SYSCALL_COPROCESSOR_ILLEGAL_MODE;
    12091294    }
    12101295
     
    12581343
    12591344#if GIET_DEBUG_COPROC
    1260 _printf("\n[GIET DEBUG COPROC] _sys_coproc_channel_init() for coproc[%d,%d]\n"
    1261         " channel = %d / mode = %d / buffer_size = %d\n"
     1345_printf("\n[DEBUG COPROC] _sys_coproc_channel_init() at cycle %d\n"
     1346        "cluster[%d,%d] / channel = %d / mode = %d / buffer_size = %d\n"
    12621347        " buffer_paddr = %l / mwmr_paddr = %l / lock_paddr = %l\n",
    1263         x , y , channel , mode , size ,
     1348        _get_proctime() , x , y , channel , mode , size ,
    12641349        buffer_paddr, mwmr_paddr, lock_paddr );
    12651350#endif
    12661351       
    1267     return GIET_SYSCALL_OK;
     1352    return SYSCALL_OK;
    12681353} // end _sys_coproc_channel_init()
    12691354
     
    12711356int _sys_coproc_run( unsigned int coproc_reg_index )
    12721357{
    1273     // processor coordinates
    1274     unsigned int procid = _get_procid();
    1275     unsigned int x      = procid >> (Y_WIDTH + P_WIDTH);
    1276     unsigned int y      = (procid >> P_WIDTH) & ((1<<Y_WIDTH)-1);
    1277     unsigned int p      = procid & ((1<<P_WIDTH)-1);
    1278    
     1358    // get thread trdid
     1359    unsigned int trdid = _get_thread_trdid();
     1360
    12791361    // get coprocessor coordinates
    12801362    unsigned int cluster_xy = _get_context_slot( CTX_COPROC_ID );
     1363
    12811364    if ( cluster_xy > 0xFF )
    12821365    {
    12831366         _printf("\n[GIET_ERROR] in _sys_coproc_run(): "
    1284                  "no coprocessor allocated to thread running on P[%d,%d,%d]\n",
    1285                  x , y , p );
    1286          return -1111;
     1367                 "no coprocessor allocated to thread %d\n", trdid );
     1368
     1369         return SYSCALL_COPROCESSOR_NON_ALLOCATED;
    12871370    }
    12881371
     
    13081391        else if ( temp != mode )
    13091392        {
    1310             _printf("\n[GIET_ERROR] P[%d,%d,%d] in _sys_coproc_run() for coprocessor[%d,%d]\n"
    1311                     "  all channels don't have the same mode\n", x , y , p , cx , cy );
    1312             return -1111;
     1393            _printf("\n[GIET_ERROR] in _sys_coproc_run(): "
     1394                    "channels don't have same mode in coprocessor[%d,%d]\n", cx , cy );
     1395
     1396            return SYSCALL_COPROCESSOR_ILLEGAL_MODE;
    13131397        }
    13141398    }
     
    13291413#if GIET_DEBUG_COPROC
    13301414if ( mode == MODE_MWMR )
    1331 _printf("\n[GIET DEBUG COPROC] _sys_coproc_run() P[%d,%d,%d] starts coprocessor[%d,%d]\n"
    1332         "   MODE_MWMR at cycle %d\n", x , y , p , cx , cy , _get_proctime() );
     1415_printf("\n[DEBUG COPROC] _sys_coproc_run() at cycle %d\n"
     1416        "thread %x starts coprocessor[%d,%d] in  MODE_MWMR\n",
     1417        _get_proctime() , trdid , cx , cy );
    13331418else
    1334 _printf("\n[GIET DEBUG COPROC] _sys_coproc_run() P[%d,%d,%d] starts coprocessor[%d,%d]\n"
    1335         "   MODE_DMA_NO_IRQ at cycle %d\n", x , y , p , cx , cy , _get_proctime() );
    1336 #endif
    1337 
    1338         return GIET_SYSCALL_OK;
     1419_printf("\n[DEBUG COPROC] _sys_coproc_run() at cycle %d\n"
     1420        "thread %x starts coprocessor[%d,%d] in  MODE_DMA_NO_IRQ\n",
     1421        _get_proctime() , trdid , cx , cy );
     1422#endif
     1423
     1424        return SYSCALL_OK;
    13391425    }
    13401426    ///////////////////////////////////////////////////////////////////////////
    13411427    else                                // mode == MODE_DMA_IRQ => descheduling
    13421428    {
    1343         // set _coproc_trdid
    1344         unsigned int ltid = _get_thread_ltid();
     1429        // set _coproc_trdid
     1430        unsigned int gpid         = _get_procid();
     1431        unsigned int x            = gpid >> (Y_WIDTH+P_WIDTH);
     1432        unsigned int y            = (gpid >> P_WIDTH) & ((1<<Y_WIDTH)-1);
     1433        unsigned int p            = gpid & ((1<<P_WIDTH)-1);
     1434        unsigned int ltid         = _get_thread_ltid();
    13451435        _coproc_trdid[cluster_id] = (x<<24) + (y<<16) + (p<<8) + ltid;
    13461436
     
    13581448
    13591449#if GIET_DEBUG_COPROC
    1360 _printf("\n[GIET DEBUG COPROC] _sys_coproc_run() P[%d,%d,%d] starts coprocessor[%d,%d]\n"
    1361         "   MODE_DMA_IRQ at cycle %d\n", x , y , p , cx , cy , _get_proctime() );
     1450_printf("\n[DEBUG COPROC] _sys_coproc_run() at cycle %d\n"
     1451        "thread %x starts coprocessor[%d,%d] in  MODE_DMA_IRQ\n",
     1452        _get_proctime() , trdid , cx , cy );
    13621453#endif
    13631454
     
    13661457
    13671458#if GIET_DEBUG_COPROC
    1368 _printf("\n[GIET DEBUG COPROC] _sys_coproc_run() P[%d,%d,%d] resume\n"
    1369         "  coprocessor[%d,%d] completion at cycle %d\n",
    1370         x , y , p , cx , cy , _get_proctime() );
     1459_printf("\n[DEBUG COPROC] _sys_coproc_run() at cycle %d\n"
     1460        "thread %x resume after coprocessor[%d,%d] completion\n",
     1461        _get_proctime() , trdid , cx , cy );
    13711462#endif
    13721463
     
    13821473int _sys_coproc_completed()
    13831474{
    1384     // processor coordinates
    1385     unsigned int procid = _get_procid();
    1386     unsigned int x      = procid >> (Y_WIDTH + P_WIDTH);
    1387     unsigned int y      = (procid >> P_WIDTH) & ((1<<Y_WIDTH)-1);
    1388     unsigned int p      = procid & ((1<<P_WIDTH)-1);
    1389    
     1475    // get thread trdid
     1476    unsigned int trdid = _get_thread_trdid();
     1477
    13901478    // get coprocessor coordinates
    13911479    unsigned int cluster_xy = _get_context_slot( CTX_COPROC_ID );
     1480
    13921481    if ( cluster_xy > 0xFF )
    13931482    {
    13941483         _printf("\n[GIET_ERROR] in _sys_coproc_completed(): "
    1395                  "no coprocessor allocated to thread running on P[%d,%d,%d]\n",
    1396                  x , y , p );
    1397          return -1111;
     1484                 "no coprocessor allocated to thread %x\n", trdid );
     1485
     1486         return SYSCALL_COPROCESSOR_NON_ALLOCATED;
    13981487    }
    13991488
     
    14131502        unsigned int status;
    14141503
    1415         // get status for all channels, and signal all reported errors
     1504        // get status for all channels, and signal reported errors
    14161505        for ( channel = 0 ; channel < (nb_to +nb_from) ; channel++ )
    14171506        {
    14181507            do
    14191508            {
    1420                 status = _mwr_get_channel_register( cluster_xy , channel , MWR_CHANNEL_STATUS );
     1509                status = _mwr_get_channel_register( cluster_xy, channel,
     1510                                                    MWR_CHANNEL_STATUS );
    14211511                if ( status == MWR_CHANNEL_ERROR_DATA )
    14221512                {
    1423                     _printf("\n[GIET_ERROR] in _sys_coproc_completed()"
    1424                             " / channel %d / DATA_ERROR\n", channel );
     1513                    _printf("\n[GIET_ERROR] in _sys_coproc_completed(): "
     1514                            "channel %d / DATA_ERROR\n", channel );
    14251515                    error = 1;
    1426                     break;
    14271516                }
    14281517                else if ( status == MWR_CHANNEL_ERROR_LOCK )
     
    14311520                            " / channel %d / LOCK_ERROR\n", channel );
    14321521                    error = 1;
    1433                     break;
    14341522                }
    14351523                else if ( status == MWR_CHANNEL_ERROR_DESC )
     
    14381526                            " / channel %d / DESC_ERROR\n", channel );
    14391527                    error = 1;
    1440                     break;
    14411528                }
    1442             } while ( status == MWR_CHANNEL_BUSY );
     1529            }
     1530            while ( status == MWR_CHANNEL_BUSY );
    14431531
    14441532            // reset channel
    1445             _mwr_set_channel_register( cluster_xy , channel , MWR_CHANNEL_RUNNING , 0 );
     1533            _mwr_set_channel_register( cluster_xy, channel,
     1534                                       MWR_CHANNEL_RUNNING , 0 );
    14461535
    14471536        }  // end for channels
    14481537
     1538        if ( error )
     1539        {
     1540            return SYSCALL_COPROCESSOR_ILLEGAL_MODE;
     1541        }
     1542        else
     1543        {
     1544
    14491545#if GIET_DEBUG_COPROC
    1450 _printf("\n[GIET DEBUG COPROC] _sys_coproc_completed() for coprocessor[%d,%d] error = %d\n",
    1451         cx , cy , error );
    1452 #endif
    1453 
    1454         return error;
     1546_printf("\n[DEBUG COPROC] _sys_coproc_completed() at cycle %d\n"
     1547        "coprocessor[%d,%d] successfully completes operation for thread %d\n",
     1548        cx , cy , trdid );
     1549#endif
     1550            return SYSCALL_OK;
     1551        }
    14551552    }
    14561553    else  // mode == MODE_MWMR or MODE_DMA_IRQ
    14571554    {
    1458         _printf("\n[GIET ERROR] sys_coproc_completed() should not be called for "
    1459                 "coprocessor[%d,%d] running in MODE_MWMR or MODE_DMA_IRQ\n", cx , cy );
    1460         return 1;
     1555        _printf("\n[GIET ERROR] in sys_coproc_completed(): "
     1556                "coprocessor[%d,%d] is not running in MODE_DMA_NO_IRQ\n", cx , cy );
     1557
     1558        return SYSCALL_COPROCESSOR_ILLEGAL_MODE;
    14611559    }
    14621560} // end _sys_coproc_completed()
     
    14811579        _printf("\n[GIET_ERROR] in _sys_tty_alloc() : "
    14821580                "TTY channel already allocated to thread %x\n", trdid );
    1483         return -1111;
     1581        return SYSCALL_CHANNEL_ALREADY_ALLOCATED;
    14841582    }
    14851583
     
    15041602        _printf("\n[GIET_ERROR] in _sys_tty_alloc() : "
    15051603                "no TTY channel available for thread %x\n", trdid );
    1506         return -1111;
     1604        return SYSCALL_NO_CHANNEL_AVAILABLE;
    15071605    }
    15081606
     
    15461644    }
    15471645
    1548     return GIET_SYSCALL_OK;
     1646    return SYSCALL_OK;
    15491647}  // end _sys_tty_alloc()
    15501648
    15511649//////////////////////
    1552 int _sys_tty_release()     // NOTE: not a syscall
     1650int _sys_tty_release()     // NOTE: not a syscall: used by _ctx_kill_thread()
    15531651{
    15541652    unsigned int channel = _get_context_slot( CTX_TTY_ID );
     
    15591657        _printf("\n[GIET_ERROR] in _sys_tty_release() : "
    15601658                "TTY channel already released for thread %x\n", trdid );
    1561         return -1111;
     1659
     1660        return SYSCALL_CHANNEL_ALREADY_ALLOCATED;
    15621661    }
    15631662
     
    15741673    }
    15751674
    1576     return GIET_SYSCALL_OK;
     1675    return SYSCALL_OK;
    15771676}  // end sys_tty_release()
    15781677
     
    15861685    // compute and check tty channel
    15871686    if( channel == 0xFFFFFFFF )  channel = _get_context_slot(CTX_TTY_ID);
    1588     if( channel >= NB_TTY_CHANNELS ) return -1111;
     1687
     1688    if( channel >= NB_TTY_CHANNELS )
     1689    {
     1690        _printf("\n[GIET_ERROR] in _sys_tty_write() : "
     1691                "no TTY channel allocated for thread %x\n", _get_thread_trdid() );
     1692
     1693        return SYSCALL_CHANNEL_NON_ALLOCATED;
     1694    }
    15891695
    15901696    // write string to TTY channel
     
    16121718    // compute and check tty channel
    16131719    if( channel == 0xFFFFFFFF )  channel = _get_context_slot(CTX_TTY_ID);
    1614     if( channel >= NB_TTY_CHANNELS ) return -1111;
     1720
     1721    if( channel >= NB_TTY_CHANNELS )
     1722    {
     1723        _printf("\n[GIET_ERROR] in _sys_tty_read() : "
     1724                "no TTY channel allocated for thread %x\n", _get_thread_trdid() );
     1725
     1726        return SYSCALL_CHANNEL_NON_ALLOCATED;
     1727    }
    16151728
    16161729    unsigned int save_sr;
     
    16761789        _printf("\n[GIET_ERROR] in _sys_tim_alloc() : "
    16771790                "TIMER channel already allocated to thread %x\n", trdid );
    1678         return -1111;
     1791
     1792        return SYSCALL_CHANNEL_ALREADY_ALLOCATED;
    16791793    }
    16801794
     
    16901804        _printf("\n[GIET_ERROR] in _sys_tim_alloc() : "
    16911805                "no TIMER channel available for thread %x\n", trdid );
    1692         return -1111;
     1806
     1807        return SYSCALL_NO_CHANNEL_AVAILABLE;
    16931808    }
    16941809
     
    17071822    _set_context_slot( CTX_TIM_ID, channel );
    17081823
    1709     return GIET_SYSCALL_OK;
     1824    return SYSCALL_OK;
    17101825
    17111826#else
    17121827
    1713     _printf("\n[GIET ERROR] in _sys_tim_alloc() : NB_TIM_CHANNELS = 0\n");
    1714     return -1111;
     1828    _printf("\n[GIET ERROR] in _sys_tim_alloc(): NB_TIM_CHANNELS == 0\n");
     1829
     1830    return SYSCALL_NO_CHANNEL_AVAILABLE;
    17151831
    17161832#endif
     
    17191835
    17201836//////////////////////
    1721 int _sys_tim_release()     // NOTE: not a syscall
     1837int _sys_tim_release()     // NOTE: not a syscall: used by _ctx_kill_thread()
    17221838{
    17231839
     
    17291845    {
    17301846        unsigned int trdid = _get_thread_trdid();
    1731         _printf("\n[GIET_ERROR] in _sys_tim_release() : "
     1847        _printf("\n[GIET_ERROR] in _sys_tim_release(): "
    17321848                "TIMER channel already released for thread %x\n", trdid );
    1733         return -1111;
     1849
     1850        return SYSCALL_CHANNEL_ALREADY_ALLOCATED;
    17341851    }
    17351852
     
    17461863    }
    17471864
    1748     return GIET_SYSCALL_OK;
     1865    return SYSCALL_OK;
    17491866
    17501867#else
    17511868
    1752     _printf("\n[GIET ERROR] in _sys_tim_release() : NB_TIM_CHANNELS = 0\n");
    1753     return -1111;
     1869    _printf("\n[GIET ERROR] in _sys_tim_release(): NB_TIM_CHANNELS = 0\n");
     1870
     1871    return SYSCALL_NO_CHANNEL_AVAILABLE;
    17541872
    17551873#endif
     
    17641882    // get timer index
    17651883    unsigned int channel = _get_context_slot( CTX_TIM_ID );
     1884
    17661885    if ( channel >= NB_TIM_CHANNELS )
    17671886    {
    1768         _printf("\n[GIET_ERROR] in _sys_tim_start() : not enough TIM channels\n");
    1769         return -1111;
     1887        _printf("\n[GIET_ERROR] in _sys_tim_start(): not enough TIM channels\n");
     1888
     1889        return SYSCALL_NO_CHANNEL_AVAILABLE;
    17701890    }
    17711891
     
    17731893    _timer_start( channel, period );
    17741894
    1775     return GIET_SYSCALL_OK;
     1895    return SYSCALL_OK;
    17761896
    17771897#else
    17781898
    17791899    _printf("\n[GIET ERROR] in _sys_tim_start() : NB_TIM_CHANNELS = 0\n");
    1780     return -1111;
     1900
     1901    return SYSCALL_NO_CHANNEL_AVAILABLE;
    17811902
    17821903#endif
     
    17911912    // get timer index
    17921913    unsigned int channel = _get_context_slot( CTX_TIM_ID );
     1914
    17931915    if ( channel >= NB_TIM_CHANNELS )
    17941916    {
    17951917        _printf("\n[GIET_ERROR] in _sys_tim_stop() : illegal timer index\n");
    1796         return -1111;
     1918
     1919        return SYSCALL_CHANNEL_NON_ALLOCATED;
    17971920    }
    17981921
     
    18001923    _timer_stop( channel );
    18011924
    1802     return GIET_SYSCALL_OK;
     1925    return SYSCALL_OK;
    18031926
    18041927#else
    18051928
    18061929    _printf("\n[GIET ERROR] in _sys_tim_stop() : NB_TIM_CHANNELS = 0\n");
    1807     return -1111;
     1930
     1931    return SYSCALL_NO_CHANNEL_AVAILABLE;
    18081932
    18091933#endif
     
    18381962        _printf("\n[GIET_ERROR] in _sys_nic_alloc() "
    18391963                "xmax or ymax argument too large for thread %x\n", trdid );
    1840         return -1111;
     1964
     1965        return SYSCALL_ILLEGAL_XY_ARGUMENTS;
    18411966    }
    18421967
     
    18611986        _printf("\n[GIET_ERROR] in _sys_nic_alloc() : "
    18621987                "no NIC channel available for thread %x\n", trdid );
    1863         return -1111;
     1988
     1989        return SYSCALL_NO_CHANNEL_AVAILABLE;
    18641990    }
    18651991
     
    18772003        if ( is_rx )  _nic_rx_channel_alloc[nic_channel] = 0;
    18782004        else          _nic_tx_channel_alloc[nic_channel] = 0;
    1879         return -1111;
     2005
     2006        return SYSCALL_NO_CHANNEL_AVAILABLE;
    18802007    }
    18812008
    18822009#if GIET_DEBUG_NIC
    1883 _printf("\n[GIET DEBUG NIC] Thread %d enters sys_nic_alloc() at cycle %d\n"
    1884         "  nic_channel = %d / cma_channel = %d\n",
    1885         trdid , _get_proctime() , nic_channel , cma_channel );
     2010_printf("\n[DEBUG NIC] sys_nic_alloc() at cycle %d\n"
     2011        "thread %d get nic_channel = %d / cma_channel = %d\n",
     2012        _get_proctime() , trdid , nic_channel , cma_channel );
    18862013#endif
    18872014
     
    19102037                _nic_rx_channel_alloc[nic_channel] = 0;
    19112038                _cma_channel_alloc[cma_channel]    = 0;
    1912                 return -1111;
     2039
     2040                return SYSCALL_CHANNEL_ALREADY_ALLOCATED;
    19132041            }
    19142042            else
     
    19272055                _nic_tx_channel_alloc[nic_channel] = 0;
    19282056                _cma_channel_alloc[cma_channel]    = 0;
    1929                 return -1111;
     2057
     2058                return SYSCALL_CHANNEL_ALREADY_ALLOCATED;
    19302059            }
    19312060            else
     
    19712100            {
    19722101                _printf("\n[GIET_ERROR] in _sys_nic_alloc() : "
    1973                         "not enough kenel heap in cluster[%d,%d]\n", cx, cy );
    1974                 return -1111;
     2102                        "not enough kernel heap in cluster[%d,%d]\n", cx, cy );
     2103
     2104                return SYSCALL_OUT_OF_KERNEL_HEAP_MEMORY;
    19752105            }
    19762106
     
    19822112            {
    19832113                _printf("\n[GIET ERROR] in _sys_nic_alloc() : "
    1984                         "container address of cluster[%d,%d] not aligned\n", cx, cy);
    1985                 return -1111;
     2114                        "container address in cluster[%d,%d] not aligned\n", cx, cy);
     2115
     2116                return SYSCALL_ADDRESS_NON_ALIGNED;
    19862117            }
    19872118
    19882119#if GIET_DEBUG_NIC
    1989 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_alloc()\n"
    1990         " allocates in cluster[%d,%d]:\n"
    1991         " - container vaddr = %x / paddr = %l\n",
    1992         thread , cx , cy , vaddr, cont_paddr );
     2120_printf("\n[DEBUG NIC] _sys_nic_alloc() at cycle %d\n"
     2121        "thread %x allocates a container in cluster[%d,%d] / vaddr = %x / paddr = %l\n",
     2122        -get_proctime() , trdid , cx , cy , vaddr, cont_paddr );
    19932123#endif
    19942124
     
    20012131                _printf("\n[GIET_ERROR] in _sys_nic_alloc() : "
    20022132                        "not enough kernel heap in cluster[%d,%d]\n", cx, cy );
    2003                 return -1111;
     2133
     2134                return SYSCALL_OUT_OF_KERNEL_HEAP_MEMORY;
    20042135            }
    20052136
     
    20112142            {
    20122143                _printf("\n[GIET ERROR] in _sys_nic_alloc() : "
    2013                         "status address of cluster[%d,%d] not aligned\n", cx, cy);
    2014                 return -1111;
     2144                        "status address in cluster[%d,%d] not aligned\n", cx, cy);
     2145
     2146                return SYSCALL_ADDRESS_NON_ALIGNED;
    20152147            }
    20162148
     
    20342166
    20352167#if GIET_DEBUG_NIC
    2036 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_alloc()\n"
    2037         " - status vaddr = %x / paddr = %l\n"
    2038         " Buffer descriptor = %l\n",
    2039         thread, vaddr, sts_paddr,
     2168_printf("\n[DEBUG NIC] _sys_nic_alloc() at cycle %d\n"
     2169        "thread %x allocates a status in cluster[%d,%d] / vaddr = %x / paddr = %l\n"
     2170        "   descriptor = %l\n",
     2171        _get_proctime() , trdid , cx , cy , vaddr, sts_paddr,
    20402172        (unsigned long long)((sts_paddr & 0xFFFFFFFFULL) >> 6) +
    20412173        (((cont_paddr & 0xFFFFFFFFFFFULL) >> 6) << 26) );
     
    20632195
    20642196#if GIET_DEBUG_NIC
    2065 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_alloc() get kernel chbuf\n"
    2066         "  vaddr = %x / paddr = %l\n",
    2067         thread , vaddr , ker_chbuf_pbase );
     2197_printf("\n[DEBUG NIC] _sys_nic_alloc() at cycle %d\n"
     2198        "thread %x initialise kernel chbuf / vaddr = %x / paddr = %l\n",
     2199        _get_proctime() , trdid , vaddr , ker_chbuf_pbase );
    20682200#endif
    20692201
     
    20822214
    20832215#if GIET_DEBUG_NIC
    2084 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_alloc() get NIC chbuf : paddr = %l\n",
    2085         thread , nic_chbuf_pbase );
     2216_printf("\n[DEBUG NIC] _sys_nic_alloc() at cycle %d\n"
     2217        "thread %x get NIC chbuf paddr = %l\n",
     2218        _get_proctime() , trdid , nic_chbuf_pbase );
    20862219#endif
    20872220
     
    21102243
    21112244#if GIET_DEBUG_NIC
    2112 _printf("\n[GIET DEBUG NIC] Task %d exit _sys_nic_alloc() at cycle %d\n",
    2113         thread, _get_proctime() );
    2114 #endif
    2115 
    2116     return GIET_SYSCALL_OK;
     2245_printf("\n[DEBUG NIC] _sys_nic_alloc() at cycle %d\n"
     2246        "thread %x exit\n",
     2247        _get_proctime() , trdid );
     2248#endif
     2249
     2250    return SYSCALL_OK;
    21172251} // end _sys_nic_alloc()
    21182252
    21192253
    21202254//////////////////////////////////////////
    2121 int _sys_nic_release( unsigned int is_rx )     // NOTE: not a syscall
     2255int _sys_nic_release( unsigned int is_rx )     // NOTE: not a syscall: used by _ctx_kill_thread()
    21222256{
    21232257    unsigned int trdid = _get_thread_trdid();
     
    21362270            _printf("\n[GIET ERROR] in _sys_nic_release() : "
    21372271                    "NIC_RX channel already released for thread %x\n", trdid );
    2138             return -1111;
     2272
     2273            return SYSCALL_CHANNEL_NON_ALLOCATED;
    21392274        }
    21402275        if ( (cma_channel >= NB_CMA_CHANNELS) )
     
    21422277            _printf("\n[GIET ERROR] in _sys_nic_release() : "
    21432278                    "CMA_RX channel already released for thread %x\n", trdid );
    2144             return -1111;
     2279
     2280            return SYSCALL_CHANNEL_NON_ALLOCATED;
    21452281        }
    21462282
     
    21662302            _printf("\n[GIET ERROR] in _sys_nic_release() : "
    21672303                    "NIC_TX channel already released for thread %x\n", trdid );
    2168             return -1111;
     2304
     2305            return SYSCALL_CHANNEL_NON_ALLOCATED;
    21692306        }
    21702307        if ( (cma_channel >= NB_CMA_CHANNELS) )
     
    21722309            _printf("\n[GIET ERROR] in _sys_nic_release() : "
    21732310                    "CMA_TX channel already released for thread %x\n", trdid );
    2174             return -1111;
     2311
     2312            return SYSCALL_CHANNEL_NON_ALLOCATED;
    21752313        }
    21762314
     
    21882326    }
    21892327
    2190     return GIET_SYSCALL_OK;
     2328    return SYSCALL_OK;
    21912329}  // end sys_nic_release()
    21922330
     
    22132351
    22142352#if GIET_DEBUG_NIC
    2215 _printf("\n[GIET DEBUG NIC] Thread %x in _sys_nic_start() at cycle %d\n"
    2216         "  get NIC channel = %d / CMA channel = %d\n",
    2217         trdid, _get_proctime(), nic_channel, cma_channel );
     2353_printf("\n[DEBUG NIC] _sys_nic_start() at cycle %d\n"
     2354        "thread %x enter / NIC channel = %d / CMA channel = %d\n",
     2355        _get_proctime() , trdid , nic_channel, cma_channel );
    22182356#endif
    22192357
     
    22412379
    22422380#if GIET_DEBUG_NIC
    2243     _printf("\n[GIET DEBUG NIC] Task %d exit _sys_nic_start() at cycle %d\n",
    2244             trdid , _get_proctime() );
    2245 #endif
    2246 
    2247     return GIET_SYSCALL_OK;
     2381    _printf("\n[DEBUG NIC] _sys_nic_start() at cycle %d\n"
     2382            "thread %d exit\n",
     2383            _get_proctime() , trdid );
     2384#endif
     2385
     2386    return SYSCALL_OK;
    22482387}  // end _sys_nic_start()
    22492388
     
    22582397
    22592398#if GIET_DEBUG_NIC
    2260 _printf("\n[GIET DEBUG NIC] Task %d enters _sys_nic_move() at cycle %d\n",
    2261         trdid , _get_proctime() );
     2399_printf("\n[DEBUG NIC] _sys_nic_move() at cycle %d\n",
     2400        "thread %x enters\n",
     2401        _get_proctime() , trdid );
    22622402#endif
    22632403
     
    22702410    {
    22712411        _printf("\n[GIET_ERROR] in _sys_nic_move() : "
    2272                 "illegal NIC channel index for thread %x\n", trdid );
    2273         return -1111;
     2412                "NIC channel non allocated for thread %x\n", trdid );
     2413
     2414        return SYSCALL_CHANNEL_NON_ALLOCATED;
    22742415    }
    22752416
     
    22892430   
    22902431    // check processor coordinates / (xmax,ymax)
    2291     if ( cx >= xmax )
    2292     {
    2293         _printf("\n[GIET_ERROR] in _sys_nic_move() : processor X coordinate = %d"
    2294                 " / xmax = %d\n", cx , xmax );
    2295         return -1111;
    2296     }
    2297     if ( cy >= ymax )
    2298     {
    2299         _printf("\n[GIET_ERROR] in _sys_nic_move() : processor Y coordinate = %d"
    2300                 " / ymax = %d\n", cy , ymax );
    2301         return -1111;
     2432    if ( (cx >= xmax) || (cy >= ymax) )
     2433    {
     2434        _printf("\n[GIET_ERROR] in _sys_nic_move(): "
     2435         "processor coordinates [%d,%d] larger than (xmax,ymax) = [%d,%d]\n",
     2436         cx , cy , xmax , ymax );
     2437
     2438        return SYSCALL_ILLEGAL_XY_ARGUMENTS;
    23022439    }
    23032440   
     
    23152452    if ( (flags & PTE_U) == 0 )
    23162453    {
    2317         _printf("\n[GIET ERROR] in _sys_nic_tx_move() : illegal user buffer address\n");
    2318         return -1111;
     2454        _printf("\n[GIET ERROR] in _sys_nic_tx_move() : "
     2455                "buffer address non user accessible\n");
     2456
     2457        return SYSCALL_ADDRESS_NON_USER_ACCESSIBLE;
    23192458    }
    23202459
    23212460#if GIET_DEBUG_NIC
    2322 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_move() get user buffer : paddr = %l\n",
    2323         thread, usr_buf_paddr );
     2461_printf("\n[DEBUG NIC] _sys_nic_move() at cycle %d\n"
     2462        "thread %x get user buffer : paddr = %l\n",
     2463        _get_proctime() , trdid , usr_buf_paddr );
    23242464#endif
    23252465
     
    23312471
    23322472#if GIET_DEBUG_NIC
    2333 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_move() read ker_buf_desc %d at cycle %d\n"
    2334         "  kernel buffer descriptor = %l\n",
    2335         thread, index, _get_proctime(), ker_buf_desc );
     2473_printf("\n[DEBUG NIC] _sys_nic_move() at cycle %d\n"
     2474        "thread %x get ker_buf_desc %d / paddr = %l\n",
     2475        _get_proctime(), trdid , index , ker_buf_desc );
    23362476#endif
    23372477
     
    23442484
    23452485#if GIET_DEBUG_NIC
    2346 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_move() read ker_buf_sts %d at cycle %d\n"
    2347         "  paddr = %l / kernel buffer status = %x\n",
    2348         thread, index, _get_proctime(), ker_sts_paddr, ker_sts );
     2486_printf("\n[DEBUG NIC] _sys_nic_move() at cycle %d\n"
     2487        "thread %x get status %d /  paddr = %l / status = %x\n",
     2488        _get_proctime() , trdid , index , ker_sts_paddr, ker_sts );
    23492489#endif
    23502490
     
    23682508                          NIC_CONTAINER_SIZE );
    23692509#if GIET_DEBUG_NIC
    2370 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_move() transfer kernel buffer %l\n"
    2371         " to user buffer %l at cycle %d\n",
    2372         thread , ker_buf_paddr , usr_buf_paddr , _get_proctime() );
     2510_printf("\n[DEBUG NIC] _sys_nic_move() at cycle %d\n"
     2511        "thread %x transfer kernel buffer %l to user buffer %l\n",
     2512        _get_proctime() , trdid , ker_buf_paddr , usr_buf_paddr );
    23732513#endif
    23742514
     
    23852525
    23862526#if GIET_DEBUG_NIC
    2387 _printf("\n[GIET DEBUG NIC] Task %d in _sys_nic_move() transfer "
    2388         "user buffer %l to kernel buffer %l at cycle %d\n",
    2389         thread , usr_buf_paddr , ker_buf_paddr , _get_proctime() );
     2527_printf("\n[DEBUG NIC] _sys_nic_move() at cycle %d\n"
     2528        "thread %x transfer user buffer %l to kernel buffer %l\n",
     2529        _get_proctime() , trdid , usr_buf_paddr , ker_buf_paddr );
    23902530#endif
    23912531
     
    24002540
    24012541#if GIET_DEBUG_NIC
    2402 _printf("\n[GIET DEBUG NIC] Task %d get buffer %d  and exit _sys_nic_move() at cycle %d\n",
    2403         thread , index , _get_proctime() );
    2404 #endif
    2405 
    2406     return GIET_SYSCALL_OK;
     2542_printf("\n[DEBUG NIC] _sys_nic_move() at cycle %d\n"
     2543        "thread %x exit\n",
     2544        _get_proctime() , trdid );
     2545#endif
     2546
     2547    return SYSCALL_OK;
    24072548} // end _sys_nic_move()
    24082549
     
    24322573    {
    24332574        _printf("\n[GIET_ERROR] in _sys_nic_stop() : "
    2434                 "illegal NIC channel for thread %x\n", trdid );
    2435         return -1111;
     2575                "NIC channel non allocated for thread %x\n", trdid );
     2576
     2577        return SYSCALL_CHANNEL_NON_ALLOCATED;
    24362578    }
    24372579    if ( cma_channel >= NB_CMA_CHANNELS )
    24382580    {
    24392581        _printf("\n[GIET_ERROR] in _sys_nic_stop() : "
    2440                 "illegal CMA channel for thread %x\n", trdid );
    2441         return -1111;
     2582                "CMA channel non allocated for thread %x\n", trdid );
     2583 
     2584        return SYSCALL_CHANNEL_NON_ALLOCATED;
    24422585    }
    24432586
     
    24502593    {
    24512594         status = _cma_get_register( cma_channel, CHBUF_STATUS );
    2452     } while ( status );
     2595    }
     2596    while ( status );
    24532597
    24542598    // desactivates the NIC channel
    24552599    _nic_channel_stop( nic_channel, is_rx );
    24562600
    2457     return GIET_SYSCALL_OK;
     2601    return SYSCALL_OK;
    24582602}  // end _sys_nic_stop()
    24592603
     
    24722616    {
    24732617        _printf("\n[GIET_ERROR] in _sys_nic_clear() : "
    2474                 "illegal NIC channel for thread %x\n", trdid );
    2475         return -1111;
     2618                "NIC channel non allocated for thread %x\n", trdid );
     2619
     2620        return SYSCALL_CHANNEL_NON_ALLOCATED;
    24762621    }
    24772622
     
    24982643        _nic_set_global_register( NIC_G_NPKT_TX_DISPATCH_BROADCAST , 0 );
    24992644    }
    2500     return GIET_SYSCALL_OK;
     2645    return SYSCALL_OK;
    25012646}  // en _sys_nic_clear()
    25022647
     
    25152660    {
    25162661        _printf("\n[GIET_ERROR] in _sys_nic_stats() : "
    2517                 "illegal NIC channel for thread %x\n", trdid );
    2518         return -1111;
     2662                "NIC channel non allocated for thread %x\n", trdid );
     2663
     2664        return SYSCALL_CHANNEL_NON_ALLOCATED;
    25192665    }
    25202666
     
    25712717                broadcast );
    25722718    }
    2573     return GIET_SYSCALL_OK;
     2719    return SYSCALL_OK;
    25742720}  // end _sys_nic_stats()
    25752721
     
    25792725//    FBF related syscall handlers
    25802726/////////////////////////////////////////////////////////////////////////////////////////
     2727
     2728//////////////////////////////////////
     2729int _sys_fbf_size( unsigned int* width,
     2730                   unsigned int* height )
     2731{
     2732    if ( USE_FBF == 0 )
     2733    {
     2734        *width  = 0;
     2735        *height = 0;
     2736    }
     2737    else
     2738    {
     2739        *width  = FBUF_X_SIZE;
     2740        *height = FBUF_Y_SIZE;
     2741    }
     2742
     2743    return SYSCALL_OK;
     2744}
     2745
     2746////////////////////
     2747int _sys_fbf_alloc()
     2748{
     2749    mapping_header_t  *header   = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
     2750    mapping_vspace_t  *vspace   = _get_vspace_base(header);
     2751    mapping_thread_t  *thread   = _get_thread_base(header);
     2752   
     2753    // compute number of users
     2754    unsigned int   vsid  = _get_context_slot(CTX_VSID_ID);
     2755    unsigned int   users = vspace[vsid].threads;
     2756
     2757    // access FBF allocator
     2758    // register it in all threads contexts
     2759    if ( _atomic_test_and_set( &_fbf_alloc , users ) == 0 )     // FBF available   
     2760    {
     2761        unsigned int   min   = vspace[vsid].thread_offset;
     2762        unsigned int   max   = min + users;
     2763        unsigned int   tid;
     2764        for ( tid = min ; tid < max ; tid++ )
     2765        {
     2766            unsigned int y_size        = header->y_size;
     2767            unsigned int cid           = thread[tid].clusterid;
     2768            unsigned int x             = cid / y_size;
     2769            unsigned int y             = cid % y_size;
     2770            unsigned int p             = thread[tid].proclocid;
     2771            unsigned int ltid          = thread[tid].ltid;
     2772            static_scheduler_t* psched = (static_scheduler_t*)_schedulers[x][y][p];
     2773            _atomic_or( &psched->context[ltid].slot[CTX_LOCKS_ID] , LOCKS_MASK_FBF );
     2774        }
     2775        return SYSCALL_OK;
     2776    }
     2777    else                                                       // FBF already allocated
     2778    {
     2779        return SYSCALL_SHARED_PERIPHERAL_BUSY;
     2780    }
     2781}
     2782
     2783//////////////////////
     2784int _sys_fbf_release()    // not a syscall: used by _ctx_kill_thread()
     2785{
     2786    // get calling thread scheduler, ltid and trdid
     2787    static_scheduler_t*  psched = _get_sched();
     2788    unsigned int         ltid   = _get_thread_ltid();
     2789    unsigned int         trdid  = _get_thread_trdid();
     2790
     2791    if ( (psched->context[ltid].slot[CTX_LOCKS_ID] & LOCKS_MASK_FBF) == 0 )
     2792    {
     2793        _printf("\n[GIET ERROR] in _sys_fbf_release() : "
     2794                "FBF not allocated to thread %x\n", trdid );
     2795
     2796        return SYSCALL_CHANNEL_NON_ALLOCATED;
     2797    }
     2798
     2799    // decrement FBF allocator
     2800    // reset the calling thread context
     2801    _atomic_increment( &_fbf_alloc , 0xFFFFFFFF );
     2802    _atomic_and( &psched->context[ltid].slot[CTX_LOCKS_ID] , ~LOCKS_MASK_FBF );
     2803
     2804    return SYSCALL_OK;   
     2805}
    25812806
    25822807/////////////////////////////////////////////
     
    25852810                         unsigned int length )
    25862811{
     2812    // get calling thread scheduler, ltid and trdid
     2813    static_scheduler_t*  psched = _get_sched();
     2814    unsigned int         ltid   = _get_thread_ltid();
     2815    unsigned int         trdid  = _get_thread_trdid();
     2816
     2817    if ( (psched->context[ltid].slot[CTX_LOCKS_ID] & LOCKS_MASK_FBF) == 0 )
     2818    {
     2819        _printf("\n[GIET ERROR] in _sys_fbf_release() : "
     2820                "FBF not allocated to thread %x\n", trdid );
     2821
     2822        return SYSCALL_CHANNEL_NON_ALLOCATED;
     2823    }
     2824
    25872825    char* fbf_address = (char *)SEG_FBF_BASE + offset;
    25882826    memcpy( fbf_address, buffer, length);
    25892827
    2590     return GIET_SYSCALL_OK;
     2828    return SYSCALL_OK;
    25912829}
    25922830
     
    25962834                         unsigned int length )
    25972835{
     2836    // get calling thread scheduler, ltid and trdid
     2837    static_scheduler_t*  psched = _get_sched();
     2838    unsigned int         ltid   = _get_thread_ltid();
     2839    unsigned int         trdid  = _get_thread_trdid();
     2840
     2841    if ( (psched->context[ltid].slot[CTX_LOCKS_ID] & LOCKS_MASK_FBF) == 0 )
     2842    {
     2843        _printf("\n[GIET ERROR] in _sys_fbf_release() : "
     2844                "FBF not allocated to thread %x\n", trdid );
     2845
     2846        return SYSCALL_CHANNEL_NON_ALLOCATED;
     2847    }
     2848
    25982849    char* fbf_address = (char *)SEG_FBF_BASE + offset;
    25992850    memcpy( buffer, fbf_address, length);
    26002851
    2601     return GIET_SYSCALL_OK;
     2852    return SYSCALL_OK;
    26022853}
    26032854
     
    26112862        _printf("\n[GIET ERROR] in _sys_fbf_cma_alloc() : "
    26122863                "CMA channel already allocated for thread %x\n", trdid );
    2613         return GIET_SYSCALL_OK;
     2864
     2865        return SYSCALL_CHANNEL_ALREADY_ALLOCATED;
    26142866    }
    26152867
     
    26242876    {
    26252877        _printf("\n[GIET ERROR] in _sys_fbf_cma_alloc() : no CMA channel available\n");
    2626         return -1111;
     2878
     2879        return SYSCALL_NO_CHANNEL_AVAILABLE;
    26272880    }
    26282881    else
    26292882    {
    26302883        _set_context_slot( CTX_CMA_FB_ID, channel );
    2631         return GIET_SYSCALL_OK;
     2884
     2885        return SYSCALL_OK;
    26322886    }
    26332887} // end sys_fbf_cma_alloc()
     
    26422896    {
    26432897        _printf("\n[GIET_ERROR] in _sys_fbf_cma_release() : "
    2644                 "CMA_FB channel already releasedifor thread %x\n", trdid );
    2645         return -1111;
     2898                "CMA_FB channel already released for thread %x\n", trdid );
     2899
     2900        return SYSCALL_CHANNEL_NON_ALLOCATED;
    26462901    }
    26472902
     
    26552910    _cma_channel_alloc[channel] = 0;
    26562911
    2657     return GIET_SYSCALL_OK;
     2912    return SYSCALL_OK;
    26582913}
    26592914
     
    26642919                           void*        sts1_vaddr )
    26652920{
    2666 #if NB_CMA_CHANNELS > 0
    2667 
    26682921    unsigned int       vaddr;           // virtual address
    26692922    unsigned int       flags;           // for _v2p_translate()
     
    26752928    unsigned long long sts1_paddr;      // buffer 1 status physical address
    26762929
     2930    // get calling thread scheduler, ltid and trdid
     2931    static_scheduler_t*  psched = _get_sched();
     2932    unsigned int         ltid   = _get_thread_ltid();
     2933    unsigned int         trdid  = _get_thread_trdid();
     2934
     2935    // check FBF allocated
     2936    if ( (psched->context[ltid].slot[CTX_LOCKS_ID] & LOCKS_MASK_FBF) == 0 )
     2937    {
     2938        _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : "
     2939                "FBF not allocated to thread %x\n", trdid );
     2940
     2941        return SYSCALL_CHANNEL_NON_ALLOCATED;
     2942    }
     2943
    26772944    // get channel index
    26782945    unsigned int channel = _get_context_slot( CTX_CMA_FB_ID );
     
    26802947    if ( channel >= NB_CMA_CHANNELS )
    26812948    {
    2682         _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : CMA channel index too large\n");
    2683         return -1111;
     2949        _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : "
     2950                "CMA channel non allocated to thread %x\n", trdid );
     2951
     2952        return SYSCALL_CHANNEL_NON_ALLOCATED;
    26842953    }
    26852954
    26862955#if GIET_DEBUG_FBF_CMA
    2687 _printf("\n[FBF_CMA DEBUG] enters _sys_fbf_cma_init_buf()\n"
     2956_printf("\n[FBF_CMA DEBUG] _sys_fbf_cma_init_buf()\n"
    26882957        " - channel           = %d\n"
    26892958        " - buf0        vbase = %x\n"
     
    27022971         ((unsigned int)buf1_vbase & 0x3F) )
    27032972    {
    2704         _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : user buffer not aligned\n");
    2705         return -1111;
     2973        _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : "
     2974                "user buffer not aligned for thread %x\n", trdid );
     2975
     2976        return SYSCALL_ADDRESS_NON_ALIGNED;
    27062977    }
    27072978
     
    27102981         ((unsigned int)sts1_vaddr & 0x3F) )
    27112982    {
    2712         _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : user status not aligned\n");
    2713         return -1111;
     2983        _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : "
     2984                "user status not aligned for thread %x\n", trdid );
     2985
     2986        return SYSCALL_ADDRESS_NON_ALIGNED;
    27142987    }
    27152988
     
    27293002    if ((flags & PTE_U) == 0)
    27303003    {
    2731         _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : buf0 not in user space\n");
    2732         return -1111;
     3004        _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : "
     3005                "buf0 not in user space for thread %x\n", trdid );
     3006
     3007        return SYSCALL_ADDRESS_NON_USER_ACCESSIBLE;
    27333008    }
    27343009
     
    27373012    if ((flags & PTE_U) == 0)
    27383013    {
    2739         _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : sts0 not in user space\n");
    2740         return -1111;
     3014        _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : "
     3015                "sts0 not in user space for thread %x\n", trdid);
     3016
     3017        return SYSCALL_ADDRESS_NON_USER_ACCESSIBLE;
    27413018    }
    27423019
     
    27503027    if ((flags & PTE_U) == 0)
    27513028    {
    2752         _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : buf1 not in user space\n");
    2753         return -1111;
     3029        _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : "
     3030                "buf1 not in user space for thread %x\n", trdid );
     3031
     3032        return SYSCALL_ADDRESS_NON_USER_ACCESSIBLE;
    27543033    }
    27553034
     
    27583037    if ((flags & PTE_U) == 0)
    27593038    {
    2760         _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : sts1 not in user space\n");
    2761         return -1111;
     3039        _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : "
     3040                "sts1 not in user space for thread %x\n", trdid);
     3041
     3042        return SYSCALL_ADDRESS_NON_USER_ACCESSIBLE;
    27623043    }
    27633044
     
    27873068#endif
    27883069
    2789     return GIET_SYSCALL_OK;
    2790 
    2791 #else
    2792 
    2793     _printf("\n[GIET ERROR] in _sys_fbf_cma_init_buf() : NB_CMA_CHANNELS = 0\n");
    2794     return -1111;
    2795 
    2796 #endif 
     3070    return SYSCALL_OK;
     3071
    27973072} // end sys_fbf_cma_init_buf()
    27983073
     
    28003075int _sys_fbf_cma_start( unsigned int length )
    28013076{
    2802 #if NB_CMA_CHANNELS > 0
     3077    // get calling thread scheduler, ltid and trdid
     3078    static_scheduler_t*  psched = _get_sched();
     3079    unsigned int         ltid   = _get_thread_ltid();
     3080    unsigned int         trdid  = _get_thread_trdid();
     3081
     3082    // check FBF allocated
     3083    if ( (psched->context[ltid].slot[CTX_LOCKS_ID] & LOCKS_MASK_FBF) == 0 )
     3084    {
     3085        _printf("\n[GIET ERROR] in _sys_fbf_release() : "
     3086                "FBF not allocated to thread %x\n", trdid );
     3087
     3088        return SYSCALL_CHANNEL_NON_ALLOCATED;
     3089    }
    28033090
    28043091    // get channel index
     
    28073094    if ( channel >= NB_CMA_CHANNELS )
    28083095    {
    2809         _printf("\n[GIET ERROR] in _fbf_cma_start() : CMA channel index too large\n");
    2810         return -1111;
     3096        _printf("\n[GIET ERROR] in _fbf_cma_start() : "
     3097                "CMA channel non allocated\n");
     3098
     3099        return SYSCALL_CHANNEL_NON_ALLOCATED;
    28113100    }
    28123101
     
    28163105         ( _fbf_chbuf[channel].fbf_desc == 0x0ULL) )
    28173106    {
    2818         _printf("\n[GIET ERROR] in _sys_fbf_cma_start() :\n"
    2819                 "Buffer initialization has not been done\n");
    2820         return -1111;
     3107        _printf("\n[GIET ERROR] in _sys_fbf_cma_start(): initialization not done\n");
     3108
     3109        return SYSCALL_MISSING_INITIALISATION;
    28213110    }
    28223111
     
    28473136    _cma_set_register( channel, CHBUF_RUN      , 1 );
    28483137
    2849     return GIET_SYSCALL_OK;
    2850 
    2851 #else
    2852 
    2853     _printf("\n[GIET ERROR] in _sys_fbf_cma_start() : NB_CMA_CHANNELS = 0\n");
    2854     return -1111;
    2855 
    2856 #endif
     3138    return SYSCALL_OK;
     3139
    28573140} // end _sys_fbf_cma_start()
    28583141
     
    28603143int _sys_fbf_cma_display( unsigned int buffer_index )
    28613144{
    2862 #if NB_CMA_CHANNELS > 0
    2863 
    28643145    volatile unsigned int full = 1;
     3146
     3147    // get calling thread scheduler, ltid and trdid
     3148    static_scheduler_t*  psched = _get_sched();
     3149    unsigned int         ltid   = _get_thread_ltid();
     3150    unsigned int         trdid  = _get_thread_trdid();
     3151
     3152    // check FBF allocated
     3153    if ( (psched->context[ltid].slot[CTX_LOCKS_ID] & LOCKS_MASK_FBF) == 0 )
     3154    {
     3155        _printf("\n[GIET ERROR] in _sys_fbf_release() : "
     3156                "FBF not allocated to thread %x\n", trdid );
     3157
     3158        return SYSCALL_CHANNEL_NON_ALLOCATED;
     3159    }
    28653160
    28663161    // get channel index
     
    28703165    {
    28713166        _printf("\n[GIET ERROR] in _sys_fbf_cma_display() : "
    2872                 "CMA channel index too large\n");
    2873         return -1111;
     3167                "CMA channel non allocated\n");
     3168
     3169        return SYSCALL_CHANNEL_NON_ALLOCATED;
    28743170    }
    28753171
     
    29513247    _mmc_sync( fbf_sts_paddr, 4 );
    29523248
    2953     return GIET_SYSCALL_OK;
    2954 
    2955 #else
    2956 
    2957     _printf("\n[GIET ERROR] in _sys_fbf_cma_display() : no CMA channel allocated\n");
    2958     return -1111;
    2959 
    2960 #endif
     3249    return SYSCALL_OK;
     3250
    29613251} // end _sys_fbf_cma_display()
    29623252
     
    29643254int _sys_fbf_cma_stop()
    29653255{
    2966 #if NB_CMA_CHANNELS > 0
    2967 
    29683256    // get channel index
    29693257    unsigned int channel = _get_context_slot( CTX_CMA_FB_ID );
     
    29713259    if ( channel >= NB_CMA_CHANNELS )
    29723260    {
    2973         _printf("\n[GIET ERROR] in _sys_fbf_cma_stop() : CMA channel index too large\n");
    2974         return -1111;
     3261        _printf("\n[GIET ERROR] in _sys_fbf_cma_stop() : CMA channel non allocated\n");
     3262
     3263        return SYSCALL_CHANNEL_NON_ALLOCATED;
    29753264    }
    29763265
     
    29783267    _cma_set_register( channel, CHBUF_RUN, 0 );
    29793268
    2980     return GIET_SYSCALL_OK;
    2981 
    2982 #else
    2983 
    2984     _printf("\n[GIET ERROR] in _sys_fbf_cma_stop() : no CMA channel allocated\n");
    2985     return -1111;
    2986 
    2987 #endif
     3269    return SYSCALL_OK;
     3270
    29883271} // end _sys_fbf_cma_stop()
    29893272
     
    29973280{
    29983281    _printf("\n[GIET ERROR] Undefined System Call / EPC = %x\n", _get_epc() );
    2999     return GIET_SYSCALL_UNDEFINED_SYSTEM_CALL;
     3282
     3283    return SYSCALL_UNDEFINED_SYSTEM_CALL;
    30003284}
    30013285
     
    30113295    *p = gpid & ((1<<P_WIDTH)-1);
    30123296
    3013     return GIET_SYSCALL_OK;
     3297    return SYSCALL_OK;
    30143298}
    30153299
     
    30663350        *nprocs = 0;
    30673351    }
    3068     return GIET_SYSCALL_OK;
     3352    return SYSCALL_OK;
    30693353}
    30703354
     
    30943378                {
    30953379                    *vbase = vseg[vseg_id].vbase;
    3096                     return GIET_SYSCALL_OK;
     3380                    return SYSCALL_OK;
    30973381                }
    30983382            }
    30993383        }
    31003384    }
    3101     return GIET_SYSCALL_VSEG_NOT_FOUND;
     3385    return SYSCALL_VSEG_NOT_FOUND;
    31023386}
    31033387
     
    31273411                {
    31283412                    *length = vseg[vseg_id].length;
    3129                     return GIET_SYSCALL_OK;
     3413                    return SYSCALL_OK;
    31303414                }
    31313415            }
    31323416        }
    31333417    }
    3134     return GIET_SYSCALL_VSEG_NOT_FOUND;
     3418    return SYSCALL_VSEG_NOT_FOUND;
    31353419}
    31363420
     
    31463430    *y = (paddr>>32) & 0xF;
    31473431
    3148     return GIET_SYSCALL_OK;
     3432    return SYSCALL_OK;
    31493433}
    31503434
     
    31623446        _printf("\n[GIET ERROR] in _sys_heap_info() : "
    31633447                "illegal (%d,%d) coordinates\n", x , y );
    3164         return GIET_SYSCALL_ILLEGAL_CLUSTER_COORDINATES;
     3448        return SYSCALL_ILLEGAL_CLUSTER_COORDINATES;
    31653449    }
    31663450
     
    32013485        _printf("error in _sys_heap_info() : no heap in cluster (%d,%d)\n", x , y );
    32023486    }
    3203     return GIET_SYSCALL_OK;
     3487    return SYSCALL_OK;
    32043488}  // end _sys_heap_info()
    32053489
  • soft/giet_vm/giet_kernel/sys_handler.h

    r709 r714  
    1919///////////////////////////////////////////////////////////////////////////////
    2020// Define the possible command values for the giet_pthread_control() syscall
     21// These define must be synchronized with values in the stdio.c file
    2122///////////////////////////////////////////////////////////////////////////////
    2223
     
    2627
    2728///////////////////////////////////////////////////////////////////////////////
    28 // Define the error codes for the thread related syscalls
    29 ///////////////////////////////////////////////////////////////////////////////
    30 
    31 #define GIET_SYSCALL_OK                               ( 0 )
    32 #define GIET_SYSCALL_VSPACE_NOT_FOUND                 (-1 )
    33 #define GIET_SYSCALL_THREAD_NOT_FOUND                 (-2 )
    34 #define GIET_SYSCALL_NOT_IN_SAME_VSPACE               (-3 )
    35 #define GIET_SYSCALL_UNCOHERENT_THREAD_CONTEXT        (-4 )
    36 #define GIET_SYSCALL_ILLEGAL_THREAD_COMMAND_TYPE      (-5 )
    37 #define GIET_SYSCALL_CANNOT_LOAD_DATA_SEGMENT         (-6 )
    38 #define GIET_SYSCALL_THREAD_ALREADY_ACTIVE            (-7 )
    39 #define GIET_SYSCALL_MAIN_NOT_FOUND                   (-8 )
    40 #define GIET_SYSCALL_APPLI_CANNOT_BE_KILLED           (-9 )
    41 #define GIET_SYSCALL_PTHREAD_ARGUMENT_NOT_SUPPORTED   (-10)
    42 #define GIET_SYSCALL_ILLEGAL_CLUSTER_COORDINATES      (-11)
    43 #define GIET_SYSCALL_VSEG_NOT_FOUND                   (-12)
    44 #define GIET_SYSCALL_UNDEFINED_SYSTEM_CALL            (-13)
    45 #define GIET_SYSCALL_COPROCESSOR_NOT_FOUND            (-14)
    46 #define GIET_SYSCALL_COPROCESSOR_ILLEGAL_MODE         (-15)
     29// Define the error codes for the syscall handlers
     30// These define must be synchronized with values in the stdio.c file
     31///////////////////////////////////////////////////////////////////////////////
     32
     33#define SYSCALL_OK                               ( 0 )
     34#define SYSCALL_VSPACE_NOT_FOUND                 (-1 )
     35#define SYSCALL_THREAD_NOT_FOUND                 (-2 )
     36#define SYSCALL_NOT_IN_SAME_VSPACE               (-3 )
     37#define SYSCALL_UNCOHERENT_THREAD_CONTEXT        (-4 )
     38#define SYSCALL_ILLEGAL_THREAD_COMMAND_TYPE      (-5 )
     39#define SYSCALL_CANNOT_LOAD_DATA_SEGMENT         (-6 )
     40#define SYSCALL_THREAD_ALREADY_ACTIVE            (-7 )
     41#define SYSCALL_MAIN_NOT_FOUND                   (-8 )
     42#define SYSCALL_APPLI_CANNOT_BE_KILLED           (-9 )
     43#define SYSCALL_PTHREAD_ARGUMENT_NOT_SUPPORTED   (-10)
     44#define SYSCALL_ILLEGAL_CLUSTER_COORDINATES      (-11)
     45#define SYSCALL_VSEG_NOT_FOUND                   (-12)
     46#define SYSCALL_UNDEFINED_SYSTEM_CALL            (-13)
     47#define SYSCALL_COPROCESSOR_NOT_FOUND            (-14)
     48#define SYSCALL_COPROCESSOR_ILLEGAL_MODE         (-15)
     49#define SYSCALL_COPROCESSOR_NON_ALLOCATED        (-16)
     50#define SYSCALL_CHANNEL_ALREADY_ALLOCATED        (-17)
     51#define SYSCALL_NO_CHANNEL_AVAILABLE             (-18)
     52#define SYSCALL_CHANNEL_NON_ALLOCATED            (-19)
     53#define SYSCALL_ILLEGAL_XY_ARGUMENTS             (-20)
     54#define SYSCALL_OUT_OF_KERNEL_HEAP_MEMORY        (-21)
     55#define SYSCALL_ADDRESS_NON_ALIGNED              (-22)
     56#define SYSCALL_ADDRESS_NON_USER_ACCESSIBLE      (-23)
     57#define SYSCALL_MISSING_INITIALISATION           (-24)
    4758
    4859///////////////////////////////////////////////////////////////////////////////
     
    123134extern int _sys_exec_application( char* name );
    124135
    125 extern int _sys_applications_status();
     136extern int _sys_applications_status( char* name );
    126137
    127138/////////////////////////////////////////////////////////////////////////////
     
    217228//////////////////////////////////////////////////////////////////////////////
    218229
     230extern int _sys_fbf_size( unsigned int* width,
     231                          unsigned int* height );
     232
     233extern int _sys_fbf_alloc();
     234
     235extern int _sys_fbf_release();
     236
    219237extern int _sys_fbf_sync_write( unsigned int offset,
    220238                         void*        buffer,
     
    230248
    231249extern int _sys_fbf_cma_init_buf(void*        buf0_vbase,
    232                           void*        buf1_vbase,
    233                           void*        sts0_vaddr,
    234                           void*        sts1_vaddr );
     250                                 void*        buf1_vbase,
     251                                 void*        sts0_vaddr,
     252                                 void*        sts1_vaddr );
    235253
    236254extern int _sys_fbf_cma_start( unsigned int length );
Note: See TracChangeset for help on using the changeset viewer.