Changeset 473


Ignore:
Timestamp:
Aug 21, 2018, 6:01:01 PM (6 years ago)
Author:
alain
Message:

Fix several GCC warning related to the -Wextra compilation option.

Location:
trunk
Files:
2 deleted
36 edited

Legend:

Unmodified
Added
Removed
  • trunk/boot/tsar_mips32/boot_fat32.c

    r439 r473  
    5050static inline int get_offset(int offset, int size)
    5151{
    52     return offset;
     52    if( size + 1 ) return offset;
    5353
    5454} // get_offset()
     
    6565static inline int get_size(int offset, int size)
    6666{
    67     return size;
     67    if( offset + 1 ) return size;
    6868
    6969} // get_size()
  • trunk/hal/tsar_mips32/core/hal_shared_types.h

    r459 r473  
    3636 **********************************************************************************/
    3737
    38 #ifndef NULL
    39 #define NULL    (void*)0
    40 #endif
    41 
    4238typedef unsigned long int     reg_t;    // core register
    4339
  • trunk/kernel/Makefile

    r457 r473  
    8686              build/kern/dqdt.o            \
    8787              build/kern/do_syscall.o      \
    88               build/kern/do_interrupt.o    \
    8988              build/kern/rpc.o
    9089
  • trunk/kernel/fs/fatfs.c

    r463 r473  
    5555//////////////////////////////////////////////////////////////////////////////////////////
    5656
    57 static inline int get_length( int offset , int length ) { return length; }
    58 
    59 static inline int get_offset( int offset , int length ) { return offset; }
     57static inline int get_length( int offset , int length ) { if( offset + 1 ) return length; }
     58
     59static inline int get_offset( int offset , int length ) { if( length + 1 ) return offset; }
    6060
    6161
  • trunk/kernel/fs/vfs.c

    r459 r473  
    9494    uint32_t lid = bitmap_ffc( ctx->bitmap , CONFIG_VFS_MAX_INODES );
    9595
    96     if( lid == -1 )   // no more free slot => error
     96    if( lid == 0xFFFFFFFF )   // no more free slot => error
    9797    {
    9898        // release lock
     
    321321    // get inode cluster and local pointer
    322322    cxy_t         inode_cxy = GET_CXY( inode_xp );
    323     vfs_inode_t * inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );
     323    vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
    324324
    325325    hal_remote_atomic_add( XPTR( inode_cxy , &inode_ptr->refcount ) , 1 );   
     
    331331    // get inode cluster and local pointer
    332332    cxy_t         inode_cxy = GET_CXY( inode_xp );
    333     vfs_inode_t * inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );
     333    vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
    334334
    335335    hal_remote_atomic_add( XPTR( inode_cxy , &inode_ptr->refcount ) , -1 );   
     
    341341    // get inode cluster and local pointer
    342342    cxy_t         cxy = GET_CXY( inode_xp );
    343     vfs_inode_t * ptr = (vfs_inode_t *)GET_PTR( inode_xp );
     343    vfs_inode_t * ptr = GET_PTR( inode_xp );
    344344
    345345    // get size
     
    356356    // get inode cluster and local pointer
    357357    cxy_t         cxy = GET_CXY( inode_xp );
    358     vfs_inode_t * ptr = (vfs_inode_t *)GET_PTR( inode_xp );
     358    vfs_inode_t * ptr = GET_PTR( inode_xp );
    359359
    360360    // set size
     
    369369    // get inode cluster and local pointer
    370370    cxy_t         cxy = GET_CXY( inode_xp );
    371     vfs_inode_t * ptr = (vfs_inode_t *)GET_PTR( inode_xp );
     371    vfs_inode_t * ptr = GET_PTR( inode_xp );
    372372
    373373    // release the main lock
     
    380380    // get inode cluster and local pointer
    381381    cxy_t         cxy = GET_CXY( inode_xp );
    382     vfs_inode_t * ptr = (vfs_inode_t *)GET_PTR( inode_xp );
     382    vfs_inode_t * ptr = GET_PTR( inode_xp );
    383383
    384384    // get the main lock
     
    398398    // get inode cluster and local pointer
    399399    inode_cxy = GET_CXY( inode_xp );
    400     inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );
     400    inode_ptr = GET_PTR( inode_xp );
    401401
    402402    // get parent dentry
     
    411411    {
    412412        dentry_cxy = GET_CXY( dentry_xp );
    413         dentry_ptr = (vfs_dentry_t *)GET_PTR( dentry_xp );
     413        dentry_ptr = GET_PTR( dentry_xp );
    414414
    415415        hal_remote_strcpy( XPTR( local_cxy  , name ) ,
     
    641641    xptr_t        file_xp;      // extended pointer on created file descriptor
    642642    uint32_t      file_id;      // created file descriptor index in reference fd_array
     643
     644    assert( (mode == 0), __FUNCTION__,
     645    "the mode parameter is not supported yet\n" );
    643646
    644647#if DEBUG_VFS_OPEN
     
    670673    // get target inode cluster and local pointer
    671674    inode_cxy = GET_CXY( inode_xp );
    672     inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );
     675    inode_ptr = GET_PTR( inode_xp );
    673676   
    674677    // create a new file descriptor in cluster containing inode
     
    721724    // get cluster and local pointer on remote file descriptor
    722725    file_cxy  = GET_CXY( file_xp );
    723     file_ptr  = (vfs_file_t *)GET_PTR( file_xp );
     726    file_ptr  = GET_PTR( file_xp );
    724727
    725728    // get inode type from remote file descriptor
     
    776779    // get cluster and local pointer on remote file descriptor
    777780    file_cxy  = GET_CXY( file_xp );
    778     file_ptr  = (vfs_file_t *)GET_PTR( file_xp );
     781    file_ptr  = GET_PTR( file_xp );
    779782
    780783    // get inode type from remote file descriptor
     
    836839    // get cluster and local pointer on remote file descriptor
    837840    file_cxy = GET_CXY( file_xp );
    838     file_ptr = (vfs_file_t *)GET_PTR( file_xp );
     841    file_ptr = GET_PTR( file_xp );
    839842
    840843    // build extended pointers on lock and offset
     
    993996                    char   * path )
    994997{
    995     assert( false , __FUNCTION__ , "not implemented\n" );
     998    assert( false , __FUNCTION__ , "not implemented\n", cwd_xp, path );
    996999    return 0;
    9971000}
     
    10011004                  struct stat * k_stat )
    10021005{
    1003     assert( false , __FUNCTION__ , "not implemented\n" );
     1006    assert( false , __FUNCTION__ , "not implemented\n", file_xp, k_stat );
    10041007    return 0;
    10051008}
     
    10091012                     struct dirent * k_dirent )
    10101013{
    1011     assert( false , __FUNCTION__ , "not implemented\n" );
     1014    assert( false , __FUNCTION__ , "not implemented\n", file_xp, k_dirent );
    10121015    return 0;
    10131016}
     
    10181021                   uint32_t   mode )
    10191022{
    1020     assert( false , __FUNCTION__ , "not implemented\n" );
     1023    assert( false , __FUNCTION__ , "not implemented\n", file_xp, path, mode );
    10211024    return 0;
    10221025}
     
    10261029                   char   * path )
    10271030{
    1028     assert( false , __FUNCTION__ , "not implemented\n" );
     1031    assert( false , __FUNCTION__ , "not implemented\n", file_xp, path );
    10291032    return 0;
    10301033}
     
    10511054    // get inode cluster and local pointer
    10521055    inode_cxy = GET_CXY( inode_xp );
    1053     inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );
     1056    inode_ptr = GET_PTR( inode_xp );
    10541057
    10551058    // get inode type from remote file
     
    10751078    cxy_t             inode_cxy;    // inode cluster identifier       
    10761079    vfs_inode_t     * inode_ptr;    // inode local pointer
    1077     uint32_t          mode;         // lookup working mode
    10781080    vfs_inode_type_t  inode_type;   // target inode type
    10791081
    10801082    // set lookup working mode
    1081     mode = 0;
     1083    assert( (rights == 0), __FUNCTION__,
     1084    "access rights non implemented yet\n" );
    10821085 
    10831086    // get extended pointer on target inode
    1084     error = vfs_lookup( cwd_xp , path , mode , &inode_xp );
     1087    error = vfs_lookup( cwd_xp , path , 0 , &inode_xp );
    10851088
    10861089    if( error ) return error;
     
    10881091    // get inode cluster and local pointer
    10891092    inode_cxy = GET_CXY( inode_xp );
    1090     inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );
     1093    inode_ptr = GET_PTR( inode_xp );
    10911094   
    10921095    // get inode type from remote inode
     
    11031106                    uint32_t rights )
    11041107{
    1105     assert( false , __FUNCTION__ , "not implemented\n" );
     1108    assert( false , __FUNCTION__ , "not implemented\n", cwd_xp, path, rights );
    11061109    return 0;
    11071110}
     
    11331136static void vfs_recursive_display( xptr_t   inode_xp,
    11341137                                   xptr_t   name_xp,
    1135                                    xptr_t   dentry_xp,
    11361138                                   uint32_t indent )
    11371139{
     
    11721174    // get inode cluster and local pointer
    11731175    inode_cxy = GET_CXY( inode_xp );
    1174     inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );
     1176    inode_ptr = GET_PTR( inode_xp );
    11751177
    11761178    // get inode type
     
    12041206            // get dentry cluster and local pointer
    12051207            child_dentry_cxy = GET_CXY( child_dentry_xp );
    1206             child_dentry_ptr = (vfs_dentry_t *)GET_PTR( child_dentry_xp );
     1208            child_dentry_ptr = GET_PTR( child_dentry_xp );
    12071209
    12081210            // get extended pointer on child inode
     
    12161218            vfs_recursive_display( child_inode_xp,
    12171219                                   child_dentry_name_xp,
    1218                                    child_dentry_xp,
    12191220                                   indent+1 );
    12201221
     
    12391240    // get target inode cluster and local pointer
    12401241    cxy_t         inode_cxy = GET_CXY( inode_xp );
    1241     vfs_inode_t * inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );
     1242    vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
    12421243
    12431244    // get extended pointer on associated dentry
     
    12541255        // get dentry cluster and local pointer
    12551256        dentry_cxy = GET_CXY( dentry_xp );
    1256         dentry_ptr = (vfs_dentry_t *)GET_PTR( dentry_xp );
     1257        dentry_ptr = GET_PTR( dentry_xp );
    12571258
    12581259        // get extended pointer on dentry name
     
    12751276
    12761277    // call recursive function
    1277     vfs_recursive_display( inode_xp , name_xp , dentry_xp , 0 );
     1278    vfs_recursive_display( inode_xp , name_xp , 0 );
    12781279
    12791280    // release lock
     
    12991300    // get found inode cluster and local pointer
    13001301    cxy_t         inode_cxy = GET_CXY( inode_xp );
    1301     vfs_inode_t * inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );
     1302    vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
    13021303
    13031304    // get inode access mode, UID, and GID
     
    13311332    // get parent inode cluster and local pointer
    13321333    cxy_t         parent_cxy = GET_CXY( parent_xp );
    1333     vfs_inode_t * parent_ptr = (vfs_inode_t *)GET_PTR( parent_xp );
     1334    vfs_inode_t * parent_ptr = GET_PTR( parent_xp );
    13341335
    13351336    // get extended pointer on hash table of children directory entries
     
    13431344    // get dentry cluster and local pointer
    13441345    cxy_t          dentry_cxy = GET_CXY( dentry_xp );
    1345     vfs_dentry_t * dentry_ptr = (vfs_dentry_t *)GET_PTR( dentry_xp );
     1346    vfs_dentry_t * dentry_ptr = GET_PTR( dentry_xp );
    13461347
    13471348    // return child inode
     
    17011702        // get inode cluster and local pointer
    17021703        cxy_t         inode_cxy = GET_CXY( inode_xp );
    1703         vfs_inode_t * inode_ptr = (vfs_inode_t *)GET_PTR( inode_xp );
     1704        vfs_inode_t * inode_ptr = GET_PTR( inode_xp );
    17041705
    17051706        // get extended pointer on parent dentry               
     
    17081709        // get dentry cluster and local pointer
    17091710        cxy_t          dentry_cxy = GET_CXY( dentry_xp );
    1710         vfs_dentry_t * dentry_ptr = (vfs_dentry_t *)GET_PTR( dentry_xp );
     1711        vfs_dentry_t * dentry_ptr = GET_PTR( dentry_xp );
    17111712
    17121713        // get dentry name length and pointer
     
    18641865    // 3. update extended pointer on inode in dentry
    18651866    cxy_t          dentry_cxy = GET_CXY( dentry_xp );
    1866     vfs_dentry_t * dentry_ptr = (vfs_dentry_t *)GET_PTR( dentry_xp );
     1867    vfs_dentry_t * dentry_ptr = GET_PTR( dentry_xp );
    18671868    hal_remote_swd( XPTR( dentry_cxy , &dentry_ptr->child_xp ) , inode_xp );
    18681869
  • trunk/kernel/kern/do_syscall.c

    r457 r473  
    180180
    181181    // update user time
    182         thread_user_time_update( this );
     182        thread_time_update( this , 1 ); 
    183183
    184184    // check syscall index
     
    204204
    205205    // update kernel time
    206         thread_kernel_time_update( this );
     206        thread_time_update( this , 0 );
    207207
    208208        return error;
  • trunk/kernel/kern/rpc.c

    r459 r473  
    11081108    rpc_send( cxy , &rpc );
    11091109
     1110    // get output argument from RPC descriptor
     1111    *error = (error_t)rpc.args[1];
     1112
    11101113#if DEBUG_RPC_VFS_INODE_DESTROY
    11111114uint32_t cycle = (uint32_t)hal_get_cycles();
     
    12481251/////////////////////////////////////////////////////////////////////////////////////////
    12491252
    1250 
    12511253///////////////////////////////////////////////////////
    12521254void rpc_vfs_dentry_destroy_client( cxy_t          cxy,
     
    12741276    // register RPC request in remote RPC fifo
    12751277    rpc_send( cxy , &rpc );
     1278
     1279    // get output argument from RPC descriptor
     1280    *error = (error_t)rpc.args[1];
    12761281
    12771282#if DEBUG_RPC_VFS_DENTRY_DESTROY
  • trunk/kernel/kern/thread.c

    r469 r473  
    528528        if( error )
    529529        {
    530             vseg_detach( &child_process->vmm , vseg );
     530            vseg_detach( vseg );
    531531            vseg_free( vseg );
    532532            thread_release( child_ptr );
     
    549549            // increment the forks counter
    550550            remote_spinlock_lock( lock_xp ); 
    551             hal_remote_atomic_add( XPTR( page_cxy , &page_ptr->forks ) , 1 );
     551            hal_remote_atomic_add( forks_xp , 1 );
    552552            remote_spinlock_unlock( lock_xp ); 
    553553
     
    11301130
    11311131
    1132 /////////////////////////////////////////////////
    1133 void thread_user_time_update( thread_t * thread )
    1134 {
    1135     // TODO
    1136     // printk("\n[WARNING] function %s not implemented\n", __FUNCTION__ );
    1137 }
    1138 
    1139 ///////////////////////////////////////////////////
    1140 void thread_kernel_time_update( thread_t * thread )
    1141 {
    1142     // TODO
    1143     // printk("\n[WARNING] function %s not implemented\n", __FUNCTION__ );
     1132///////////////////////////////////////////
     1133void thread_time_update( thread_t * thread,
     1134                         uint32_t   is_user )
     1135{
     1136    cycle_t current_cycle;   // current cycle counter value
     1137    cycle_t last_cycle;      // last cycle counter value
     1138
     1139    // get pointer on thread_info structure
     1140    thread_info_t * info = &thread->info;
     1141
     1142    // get last cycle counter value
     1143    last_cycle = info->last_cycle;
     1144
     1145    // get current cycle counter value
     1146    current_cycle = hal_get_cycles();
     1147
     1148    // update thread_info structure
     1149    info->last_cycle = current_cycle;
     1150
     1151    // update time in thread_info
     1152    if( is_user ) info->usr_cycles += (current_cycle - last_cycle);
     1153    else          info->sys_cycles += (current_cycle - last_cycle);
    11441154}
    11451155
  • trunk/kernel/kern/thread.h

    r459 r473  
    103103        uint32_t              u_err_nr;      /*! TODO ???  [AG]                           */
    104104        uint32_t              m_err_nr;      /*! TODO ???  [AG]                           */
    105         uint32_t              tm_tmp;        /*! temp date to compute execution duration  */
    106         uint32_t              tm_exec;       /*! TODO ???  [AG]                           */
    107         uint32_t              tm_create;     /*! date of the creation                     */
    108         uint32_t              tm_born;       /*! date of the thread loading               */
    109         uint32_t              tm_dead;       /*! date of the death                        */
    110         cycle_t               tm_sleep;      /*! TODO ???  [AG]                           */
    111         cycle_t               tm_wait;       /*! TODO ???  [AG]                           */
    112         cycle_t               tm_usr;        /*! user execution duration                  */
    113         cycle_t               tm_sys;        /*! system execution duration                */
     105        cycle_t               last_cycle;    /*! last cycle counter value (date)          */
     106        cycle_t               usr_cycles;    /*! user execution duration (cycles)         */
     107        cycle_t               sys_cycles;    /*! system execution duration (cycles)       */
    114108}
    115109thread_info_t;
     
    435429
    436430/***************************************************************************************
    437  * This function updates the calling thread user_time counter, and resets the thread
    438  * cycles counter.
    439  * TODO This function is not implemented.
     431 * This function updates the calling thread user_time or kernel_time counters.
    440432 ***************************************************************************************
    441433 * @ thread   : local pointer on target thread.
    442  **************************************************************************************/
    443 void thread_user_time_update( thread_t * thread );
    444 
    445 /**************************************************************************************n
    446  * This function updates the calling thread kernel_time counter, and resets the thread
    447  * cycles counter.
    448  * TODO This function is not implemented.
    449  ***************************************************************************************
    450  * @ thread   : local pointer on target thread.
    451  **************************************************************************************/
    452 void thread_kernel_time_update( thread_t * thread );
     434 * @ is_user  : update user time if non zero / update kernel time if zero
     435 **************************************************************************************/
     436void thread_time_update( thread_t * thread,
     437                         uint32_t   is_user );
    453438
    454439/***************************************************************************************
  • trunk/kernel/libk/bits.c

    r457 r473  
    8181                if((len + bit) >= 32)
    8282                {
    83                         val = (bit == 0) ? 0xFFFFFFFF : (1 << (32 - bit)) - 1;
     83            if( bit == 0 ) val = 0xFFFFFFFF;
     84            else           val = (uint32_t)((1 << (32 - bit)) - 1);
     85
    8486                        bitmap[word] |= (val << bit);
    8587                        word++;
     
    108110                if((len + bit) >= 32)
    109111                {
    110                         val = (bit == 0) ? 0xFFFFFFFF : (1 << (32 - bit)) - 1;
     112            if( bit == 0 ) val = 0xFFFFFFFF;
     113            else           val = (uint32_t)((1 << (32 - bit)) - 1);
     114
    111115                        bitmap[word] &= ~(val << bit);
    112116                        word++;
  • trunk/kernel/libk/grdxt.c

    r457 r473  
    7373        req.type = KMEM_GENERIC;
    7474
    75         for( ix1=0 ; ix1 < (1 << w1) ; ix1++ )
     75        for( ix1=0 ; ix1 < (uint32_t)(1 << w1) ; ix1++ )
    7676        {
    7777        ptr2 = ptr1[ix1];
     
    7979                if( ptr2 == NULL ) continue;
    8080
    81         for( ix2=0 ; ix2 < (1 << w2) ; ix2++ )
     81        for( ix2=0 ; ix2 < (uint32_t)(1 << w2) ; ix2++ )
    8282        {
    8383            ptr3 = ptr2[ix2];
     
    129129           name, 1<<w1 , 1<<w2 , 1<<w3 );
    130130
    131         for( ix1=0 ; ix1 < (1<<w1) ; ix1++ )
     131        for( ix1=0 ; ix1 < (uint32_t)(1<<w1) ; ix1++ )
    132132        {
    133133        ptr2 = ptr1[ix1];
    134134        if( ptr2 == NULL )  continue;
    135135   
    136         for( ix2=0 ; ix2 < (1<<w2) ; ix2++ )
     136        for( ix2=0 ; ix2 < (uint32_t)(1<<w2) ; ix2++ )
    137137        {
    138138            ptr3 = ptr2[ix2];
    139139            if( ptr3 == NULL ) continue;
    140140
    141             for( ix3=0 ; ix3 < (1<<w3) ; ix3++ )
     141            for( ix3=0 ; ix3 < (uint32_t)(1<<w3) ; ix3++ )
    142142            {
    143143                value = (intptr_t)ptr3[ix3];
  • trunk/kernel/libk/spinlock.c

    r461 r473  
    4747///////////////////////////////////////////
    4848void spinlock_lock_busy( spinlock_t * lock,
    49                          uint32_t   * irq_state )
     49                         reg_t      * irq_state )
    5050{
    5151    reg_t               mode;
     
    8282//////////////////////////////////////////////
    8383void spinlock_unlock_busy( spinlock_t * lock,
    84                            uint32_t     irq_state )
     84                           reg_t        irq_state )
    8585{
    8686    thread_t * this = CURRENT_THREAD;
  • trunk/kernel/mm/vmm.c

    r469 r473  
    718718
    719719        // remove vseg from VSL
    720                 vseg_detach( vmm , vseg );
     720                vseg_detach( vseg );
    721721
    722722        // release memory allocated to vseg descriptor
     
    747747__FUNCTION__ , vseg_type_str( vseg->type ), vseg->vpn_base, vseg->vpn_size );
    748748#endif
    749                     vseg_detach( vmm , vseg );
     749                    vseg_detach( vseg );
    750750            vseg_free( vseg );
    751751
     
    10221022    // get pointers on calling process and VMM
    10231023    thread_t   * this    = CURRENT_THREAD;
    1024     process_t  * process = this->process;
    10251024    vmm_t      * vmm     = &this->process->vmm;
    10261025    uint32_t     type    = vseg->type;
     
    10291028    xptr_t lock_xp = XPTR( local_cxy , &vmm->vsegs_lock );
    10301029        remote_rwlock_wr_lock( lock_xp );
    1031         vseg_detach( &process->vmm , vseg );
     1030        vseg_detach( vseg );
    10321031        remote_rwlock_wr_unlock( lock_xp );
    10331032
  • trunk/kernel/mm/vseg.c

    r457 r473  
    209209}
    210210
    211 ///////////////////////////////
    212 void vseg_detach( vmm_t  * vmm,
    213                   vseg_t * vseg )
     211/////////////////////////////////
     212void vseg_detach( vseg_t * vseg )
    214213{
    215214    // update vseg descriptor
  • trunk/kernel/mm/vseg.h

    r457 r473  
    161161 * The lock protecting the vsegs list in VMM must be taken by the caller.
    162162 *******************************************************************************************
    163  * @ vmm       : pointer on the VMM
    164163 * @ vseg      : pointer on the vseg descriptor
    165164 ******************************************************************************************/
    166 void vseg_detach( struct vmm_s  * vmm,
    167                   vseg_t        * vseg );
     165void vseg_detach( vseg_t        * vseg );
    168166
    169167
  • trunk/kernel/syscalls/shared_include/shared_stdlib.h

    r445 r473  
    3535exit_statut_t;
    3636
    37 
    38 #define   RAND_MAX   65535
    39 
    40 #ifndef NULL
    41 #define  NULL  (void *)0
    4237#endif
    43 
    44 #endif
  • trunk/kernel/syscalls/sys_alarm.c

    r457 r473  
    3737
    3838    printk("\n[ERROR] in %s for thread %x in process %x : not implemented yet\n",
    39            __FUNCTION__ , this->trdid , process->pid );
    40     this->errno = EFAULT;
     39    __FUNCTION__ , this->trdid , process->pid , cycles );
    4140    return -1;
    4241}
  • trunk/kernel/syscalls/sys_closedir.c

    r457 r473  
    3434int sys_closedir ( DIR * dirp )
    3535{
    36     printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__ );
    37     CURRENT_THREAD->errno = ENOMEM;
     36    printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__, dirp );
    3837    return -1;
    3938}  // end sys_closedir()
  • trunk/kernel/syscalls/sys_opendir.c

    r457 r473  
    3535                  DIR  ** dirp )
    3636{
    37     printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__ );
    38     CURRENT_THREAD->errno = ENOMEM;
     37    printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__, pathname, dirp );
    3938    return -1;
    4039}  // end sys opendir()
  • trunk/kernel/syscalls/sys_pipe.c

    r457 r473  
    3333    thread_t * this = CURRENT_THREAD;
    3434
    35     printk("\n[ERROR] in %d : not implemented yet\n", __FUNCTION__ );
    36     this->errno = ENOSYS;
     35    printk("\n[ERROR] in %d : not implemented yet\n", __FUNCTION__, file_fd );
    3736    return -1;
    3837}
  • trunk/kernel/syscalls/sys_readdir.c

    r457 r473  
    3737                 struct dirent ** dentp )
    3838{
    39     printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__ );
    40     CURRENT_THREAD->errno = ENOMEM;
     39    printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__, dirp, dentp );
    4140    return -1;
    4241}  // end sys_readdir()
  • trunk/kernel/syscalls/sys_signal.c

    r457 r473  
    3333
    3434        thread_t  * this    = CURRENT_THREAD;
     35    process_t * process = this->process;
    3536
    36     printk("\n[ERROR] in %s : not implemented yet\n", __FUNCTION__ );
    37     this->errno = EINVAL;
     37    printk("\n[ERROR] in %s : thread %x in process %x / not implemented yet\n",
     38    __FUNCTION__, this->trdid, process->pid, sig_id, handler );
    3839    return -1;
    3940}
  • trunk/kernel/syscalls/sys_thread_join.c

    r457 r473  
    9696
    9797#if DEBUG_SYSCALLS_ERROR
    98 printk("\n[ERROR] in %s : this thread == target thread\n", __FUNCTION__ );
     98printk("\n[ERROR] in %s : this thread (%x) == target thread(%x)\n",
     99__FUNCTION__, joining_ptr->trdid, trdid );
    99100#endif
    100101        joining_ptr->errno = EDEADLK;
  • trunk/libs/libalmosmkh/almosmkh.c

    r457 r473  
    434434
    435435    // check store size power of 2
    436     if( store_size != (1<<free_index) )
     436    if( store_size != (unsigned int)(1<<free_index) )
    437437    {
    438438        printf("\n[ERROR] in %s : store[%x] size not power of 2 / size = %x\n",
     
    557557{
    558558    // test terminal case
    559     if ( (1<<searched_index) > store->store_size )  // failure : return a NULL value
     559    if ( (unsigned int)(1<<searched_index) > store->store_size )  // failure
    560560    {
    561561        return 0;
     
    729729
    730730    // compute old size
    731     char * pchar = (char *) (store[cxy].alloc_base + index);
    732     int old_size = 1 << ((int) *pchar);
     731    char        * pchar    = (char *) (store[cxy].alloc_base + index);
     732    unsigned int  old_size = (unsigned int)(1 << ((int) *pchar));
    733733
    734734    // allocate a new block
     
    736736
    737737    // save old data to new block
    738     int min_size = (size < old_size) ? size : old_size;
     738    int min_size = (int)((size < old_size) ? size : old_size);
    739739    memcpy( new_ptr, ptr, min_size );
    740740
  • trunk/libs/libpthread/pthread.c

    r457 r473  
    3232
    3333#define PTHREAD_MUTEX_DEBUG     0
    34 #define PTHREAD_BARRIER_DEBUG   0
     34#define PTHREAD_BARRIER_DEBUG   1
    3535
    3636////////////////////////////////////////////////////////////////////////////////////////////
     
    5656{
    5757    return hal_user_syscall( SYS_THREAD_JOIN,
    58                              (reg_t)exit_value, 0, 0, 0 );
     58                             (reg_t)trdid,
     59                             (reg_t)exit_value, 0, 0 );
    5960}
    6061
     
    346347
    347348#if PTHREAD_BARRIER_DEBUG
    348 printf("\n[BARRIER] %s : enter for core[%x,%d] / barrier = %x / node = %x\n",
     349printf("\n[BARRIER] %s : core[%x,%d] enter / barrier = %x / node = %x\n",
    349350__FUNCTION__ , cxy , lid , barrier, barrier->node[x][y][0] );
    350351#endif
  • trunk/libs/mini-libc/dirent.c

    r457 r473  
    2626#include <hal_user.h>
    2727#include <syscalls_numbers.h>
     28#include <stdio.h>
    2829
    2930//////////////////////////////////////
  • trunk/libs/mini-libc/mman.c

    r457 r473  
    2626#include <hal_user.h>
    2727#include <syscalls_numbers.h>
     28#include <stdio.h>
    2829
    2930////////////////////////////////y
  • trunk/libs/mini-libc/stdio.c

    r459 r473  
    3838////////////////////////////////////////////////////////////////////////////////////////
    3939
    40 //////////////////////////////////////////
    41 static int xprintf( char         * string,
    42                     unsigned int   length,
    43                     const char   * format,
    44                     va_list      * args )
     40///////////////////////////////////////////////////
     41static unsigned int xprintf( char         * string,
     42                             unsigned int   length,
     43                             const char   * format,
     44                             va_list      * args )
    4545{
    4646    unsigned int ps = 0;    // write index to the string buffer
     
    265265int printf( const char * format, ... )
    266266{
    267     char      string[4096];
    268     va_list   args;
    269     int       count;
     267    char               string[4096];
     268    va_list            args;
     269    unsigned int       count;
    270270   
    271271    va_start( args, format );
     
    309309              const char     * format, ... )
    310310{
    311     va_list   args;
    312     int       count;
     311    va_list            args;
     312    unsigned int       count;
    313313
    314314    va_start( args, format );
     
    374374             const char * format, ... )
    375375{
    376     char      string[4096];
    377     va_list   args;
    378     int       count;
    379     int       fd;
     376    char               string[4096];
     377    va_list            args;
     378    unsigned int       count;
     379    int                fd;
    380380   
    381381    // check stream valid
  • trunk/libs/mini-libc/stdio.h

    r459 r473  
    3131 ********************************************************************************************/
    3232
    33 /*********************************************************************************************
    34  * This defines the user level FILE structure.
    35  ********************************************************************************************/
    36 
    3733#define  MAX_OPEN_FILE_PER_PROCESS  256
    3834#define  VALID_OPEN_FILE            0x12345678
    3935#define  EOF                        -1
    4036#define  NULL                       (void *)0
     37
     38/*********************************************************************************************
     39 * This defines the user level FILE structure.
     40 ********************************************************************************************/
    4141
    4242typedef struct file_s
  • trunk/libs/mini-libc/stdlib.c

    r457 r473  
    2828#include <almosmkh.h>
    2929#include <stdio.h>
     30
     31//////////////////////////////////////////////////////////////////////////////////////////
     32//           Global variables                   
     33//////////////////////////////////////////////////////////////////////////////////////////
     34
     35unsigned int  rand_seed_value = 1;   // set by srand() , used by rand()
    3036
    3137//////////////////////////
     
    121127    get_cycle( &cycle );
    122128
    123     unsigned int x = (unsigned int)cycle;
    124 
    125     if ((x & 0xF) > 7)
    126     {
    127         return (x*x & 0xFFFF);
     129    unsigned int x = (unsigned int)cycle * rand_seed_value;
     130
     131    if ((x & 0xFF) > 0x7F)
     132    {
     133        return (x*x & RAND_MAX);
    128134    }
    129135    else
    130136    {
    131         return (x*x*x & 0xFFFF);
     137        return (x*x*x & RAND_MAX);
    132138    }
    133139}
     
    136142void srand( unsigned int seed )
    137143{
    138     printf("\n[ERROR] in %s : not implemented yet : do nothing\n", __FUNCTION__ );
     144    rand_seed_value = seed;
    139145}
    140146
  • trunk/libs/mini-libc/stdlib.h

    r445 r473  
    3333
    3434#include <shared_stdlib.h>
     35
     36#define  RAND_MAX       0xFFFF
    3537
    3638/*****************************************************************************************
  • trunk/libs/mini-libc/string.c

    r445 r473  
    2222 */
    2323
    24 #define  NULL  (void *)0
    25 
    2624#include <string.h>
     25#include <stdio.h>
    2726
    2827///////////////////////////////////////
  • trunk/libs/mini-libc/unistd.c

    r457 r473  
    7878int pipe( int fd[2] )
    7979{
    80     return -1;
    81     //return hal_user_syscall( SYS_PIPE, (reg_t)fd, 0, 0, 0 );
     80    return hal_user_syscall( SYS_PIPE,
     81                            (reg_t)fd, 0, 0, 0 );
    8282}
    8383
  • trunk/user/fft/fft.c

    r469 r473  
    8888#define CHECK                   0
    8989#define DEBUG_MAIN              1
    90 #define DEBUG_FFT1D             0
     90#define DEBUG_FFT1D             1
    9191#define DEBUG_ONCE              0
    9292#define MODE                    COSIN
     
    102102unsigned int   y_size;                     // number of clusters per column in the mesh
    103103unsigned int   ncores;                     // number of cores per cluster
    104 long           nthreads;                   // total number of threads (one thread per core)
    105 long           nclusters;                  // total number of clusters
    106 long           M = DEFAULT_M;              // log2(number of points)
    107 long           N;                          // number of points (N = 2^M)         
    108 long           rootN;                      // rootN = 2^M/2   
    109 long           rows_per_thread;            // number of data "rows" handled by a single thread
    110 long           points_per_cluster;         // number of data points per cluster
     104unsigned int   nthreads;                   // total number of threads (one thread per core)
     105unsigned int   nclusters;                  // total number of clusters
     106unsigned int   M = DEFAULT_M;              // log2(number of points)
     107unsigned int   N;                          // number of points (N = 2^M)         
     108unsigned int   rootN;                      // rootN = 2^M/2   
     109unsigned int   rows_per_thread;            // number of data "rows" handled by a single thread
     110unsigned int   points_per_cluster;         // number of data points per cluster
    111111
    112112// arrays of pointers on distributed buffers (one sub-buffer per cluster)
     
    129129pthread_t       trdid[THREADS_MAX];        // kernel threads identifiers
    130130pthread_attr_t  attr[THREADS_MAX];         // POSIX thread attributes
    131 long            args[THREADS_MAX];         // slave function arguments
     131unsigned int    args[THREADS_MAX];         // slave function arguments
    132132
    133133/////////////////////////////////////////////////////////////////////////////////
     
    137137void slave();
    138138
    139 double CheckSum(double ** x);
     139double CheckSum();
    140140
    141141void InitX(double ** x , unsigned int mode);
     
    145145void InitT(double ** u);
    146146
    147 long BitReverse( long k );
    148 
    149 void FFT1D( long direction , double ** x , double ** tmp , double * upriv,
    150             double ** twid , long MyNum , long MyFirst , long MyLast );
    151 
    152 void TwiddleOneCol(long direction, long j, double ** u, double ** x, long offset_x );
    153 
    154 void Scale( double **x, long offset_x );
    155 
    156 void Transpose( double ** src, double ** dest, long MyFirst, long MyLast );
    157 
    158 void Copy( double ** src, double ** dest, long MyFirst , long MyLast );
    159 
    160 void Reverse( double ** x, long offset_x );
    161 
    162 void FFT1DOnce( long direction , double * u , double ** x , long offset_x );
    163 
    164 void PrintArray( double ** x , long size );
    165 
    166 void SimpleDft( long direction , long size , double ** src , long src_offset ,
    167                 double ** dst , long dst_offset );
     147unsigned int BitReverse( unsigned int k );
     148
     149void FFT1D( int          direction,
     150            double    ** x,
     151            double    ** tmp,
     152            double     * upriv,
     153            double    ** twid,
     154            unsigned int MyNum,
     155            unsigned int MyFirst,
     156            unsigned int MyLast );
     157
     158void TwiddleOneCol( int          direction,
     159                    unsigned int j,
     160                    double    ** u,
     161                    double    ** x,
     162                    unsigned int offset_x );
     163
     164void Scale( double    ** x,
     165            unsigned int offset_x );
     166
     167void Transpose( double    ** src,
     168                double    ** dest,
     169                unsigned int MyFirst,
     170                unsigned int MyLast );
     171
     172void Copy( double    ** src,
     173           double    ** dest,
     174           unsigned int MyFirst,
     175           unsigned int MyLast );
     176
     177void Reverse( double    ** x,
     178              unsigned int offset_x );
     179
     180void FFT1DOnce( int          direction,
     181                double     * u,
     182                double    ** x,
     183                unsigned int offset_x );
     184
     185void PrintArray( double ** x,
     186                 unsigned int size );
     187
     188void SimpleDft( int          direction,
     189                unsigned int size,
     190                double    ** src,
     191                unsigned int src_offset,
     192                double    ** dst,
     193                unsigned int dst_offset );
    168194
    169195///////////////////////////////////////////////////////////////////
     
    256282    // allocate memory for the distributed data[i], trans[i], umain[i], twid[i] buffers
    257283    // the index (i) is a continuous cluster index
    258     long data_size   = (N / nclusters) * 2 * sizeof(double);
    259     long coefs_size  = (rootN / nclusters) * 2 * sizeof(double);
     284    unsigned int data_size   = (N / nclusters) * 2 * sizeof(double);
     285    unsigned int coefs_size  = (rootN / nclusters) * 2 * sizeof(double);
    260286    for (x = 0 ; x < x_size ; x++)
    261287    {
     
    278304
    279305#if CHECK
    280 ck1 = CheckSum( data );
     306ck1 = CheckSum();
    281307#endif
    282308
     
    298324    barrierattr.y_size   = y_size;
    299325    barrierattr.nthreads = ncores;
    300     pthread_barrier_init( &barrier, &barrierattr , nthreads);
     326    if( pthread_barrier_init( &barrier, &barrierattr , nthreads) )
     327    {
     328        printf("\n[FFT ERROR] cannot initialize barrier\n");
     329        exit( 0 );
     330    }
     331
     332    printf("\n[FFT] main completes barrier init\n");
    301333
    302334    // launch other threads to execute the slave() function
     
    331363                    }
    332364#if DEBUG_MAIN
    333 printf("\n[FFT] thread %x created\n", trdid[tid] );
     365printf("\n[FFT] main created thread %x\n", trdid[tid] );
    334366#endif
    335367                }
     
    354386            {
    355387                // compute thread continuous index
    356                 long tid = (((x * y_size) + y) * ncores) + lid;
     388                tid = (((x * y_size) + y) * ncores) + lid;
    357389
    358390                if( tid != main_tid )
     
    386418
    387419#if CHECK
    388 ck3 = CheckSum( data );
     420ck3 = CheckSum();
    389421printf("\n*** Results ***\n");
    390422printf("Checksum difference is %f (%f, %f)\n", ck1 - ck3, ck1, ck3);
     
    446478// This function is executed in parallel by all threads.
    447479///////////////////////////////////////////////////////////////
    448 void slave( long * tid )
    449 {
    450     long       i;
    451     long       MyNum;           // continuous thread index
    452     long       MyFirst;         // index first row allocated to thread
    453     long       MyLast;          // index last row allocated to thread
    454     double   * upriv;
    455     long       c_id;
    456     long       c_offset;
     480void slave( unsigned int * tid )
     481{
     482    unsigned int   i;
     483    unsigned int   MyNum;           // continuous thread index
     484    unsigned int   MyFirst;         // index first row allocated to thread
     485    unsigned int   MyLast;          // index last row allocated to thread
     486    double       * upriv;
     487    unsigned int   c_id;
     488    unsigned int   c_offset;
    457489
    458490    unsigned long long  parallel_start;
     
    517549// buffer, to the dst[nclusters][points_per_cluster] distributed buffer.
    518550////////////////////////////////////////////////////////////////////////////////////////
    519 void SimpleDft( long      direction,
    520                 long      size,           // number of points
    521                 double ** src,            // source distributed buffer
    522                 long      src_offset,     // offset in source array
    523                 double ** dst,            // destination distributed buffer
    524                 long      dst_offset )    // offset in destination array
    525 {
    526     long    n , k;
    527     double  phi;            // 2*PI*n*k/N
    528     double  u_r;            // cos( phi )
    529     double  u_c;            // sin( phi )
    530     double  d_r;            // Re(data[n])
    531     double  d_c;            // Im(data[n])
    532     double  accu_r;         // Re(accu)
    533     double  accu_c;         // Im(accu)
    534     long    c_id;           // distributed buffer cluster index
    535     long    c_offset;       // offset in distributed buffer
     551void SimpleDft( int             direction,      // 1 direct / -1 reverse
     552                unsigned int    size,           // number of points
     553                double       ** src,            // source distributed buffer
     554                unsigned int    src_offset,     // offset in source array
     555                double       ** dst,            // destination distributed buffer
     556                unsigned int    dst_offset )    // offset in destination array
     557{
     558    unsigned int  n , k;
     559    double        phi;            // 2*PI*n*k/N
     560    double        u_r;            // cos( phi )
     561    double        u_c;            // sin( phi )
     562    double        d_r;            // Re(data[n])
     563    double        d_c;            // Im(data[n])
     564    double        accu_r;         // Re(accu)
     565    double        accu_c;         // Im(accu)
     566    unsigned int  c_id;           // distributed buffer cluster index
     567    unsigned int  c_offset;       // offset in distributed buffer
    536568
    537569    for ( k = 0 ; k < size ; k++ )       // loop on the output data points
     
    551583            c_id     = (src_offset + n) / (points_per_cluster);
    552584            c_offset = (src_offset + n) % (points_per_cluster);
    553             d_r      = data[c_id][2*c_offset];
    554             d_c      = data[c_id][2*c_offset+1];
     585            d_r      = src[c_id][2*c_offset];
     586            d_c      = src[c_id][2*c_offset+1];
    555587
    556588            // increment accu
     
    575607}  // end SimpleDft()
    576608
    577 ////////////////////////////
    578 double CheckSum(double ** x)
    579 {
    580     long i , j;
     609/////////////////
     610double CheckSum()
     611{
     612    unsigned int        i , j;
    581613    double       cks;
    582     long c_id;
    583     long c_offset;
     614    unsigned int        c_id;
     615    unsigned int        c_offset;
    584616
    585617    cks = 0.0;
     
    602634           unsigned int   mode )
    603635{
    604     long    i , j;
    605     long    c_id;
    606     long    c_offset;
    607     long    index;
     636    unsigned int    i , j;
     637    unsigned int    c_id;
     638    unsigned int    c_offset;
     639    unsigned int    index;
    608640
    609641    for ( j = 0 ; j < rootN ; j++ )      // loop on row index
     
    618650            if ( mode == RANDOM )               
    619651            {
    620                 data[c_id][2*c_offset]   = ( (double)rand() ) / 65536;
    621                 data[c_id][2*c_offset+1] = ( (double)rand() ) / 65536;
     652                x[c_id][2*c_offset]   = ( (double)rand() ) / 65536;
     653                x[c_id][2*c_offset+1] = ( (double)rand() ) / 65536;
    622654            }
    623655           
     
    627659            {
    628660                double phi = (double)( 2 * PI * index) / N;
    629                 data[c_id][2*c_offset]   = cos( phi );
    630                 data[c_id][2*c_offset+1] = sin( phi );
     661                x[c_id][2*c_offset]   = cos( phi );
     662                x[c_id][2*c_offset+1] = sin( phi );
    631663            }
    632664
     
    634666            if ( mode == CONSTANT )               
    635667            {
    636                 data[c_id][2*c_offset]   = 1.0;
    637                 data[c_id][2*c_offset+1] = 0.0;
     668                x[c_id][2*c_offset]   = 1.0;
     669                x[c_id][2*c_offset+1] = 0.0;
    638670            }
    639671        }
     
    644676void InitU( double ** u )
    645677{
    646     long    q;
    647     long    j;
    648     long    base;
    649     long    n1;
    650     long    c_id;
    651     long    c_offset;
     678    unsigned int    q;
     679    unsigned int    j;
     680    unsigned int    base;
     681    unsigned int    n1;
     682    unsigned int    c_id;
     683    unsigned int    c_offset;
    652684    double  phi;
    653     long    stop = 0;
    654 
    655     for (q = 0 ; ((1 << q) < N) && (stop == 0) ; q++)
     685    unsigned int    stop = 0;
     686
     687    for (q = 0 ; ((unsigned int)(1 << q) < N) && (stop == 0) ; q++)
    656688    { 
    657689        n1 = 1 << q;
     
    673705void InitT( double ** u )
    674706{
    675     long    i, j;
    676     long    index;
    677     long    c_id;
    678     long    c_offset;
     707    unsigned int    i, j;
     708    unsigned int    index;
     709    unsigned int    c_id;
     710    unsigned int    c_offset;
    679711    double  phi;
    680712
     
    697729// This function returns an index value that is the bit reverse of the input value.
    698730////////////////////////////////////////////////////////////////////////////////////////
    699 long BitReverse( long k )
    700 {
    701     long i;
    702     long j;
    703     long tmp;
     731unsigned int BitReverse( unsigned int k )
     732{
     733    unsigned int i;
     734    unsigned int j;
     735    unsigned int tmp;
    704736
    705737    j = 0;
     
    724756// on the rootN points contained in a row.
    725757////////////////////////////////////////////////////////////////////////////////////////
    726 void FFT1D( long       direction,       // direct : 1 / inverse : -1
    727             double **  x,               // input & output distributed data points array
    728             double **  tmp,             // auxiliary distributed data points array
    729             double *   upriv,           // local array containing coefs for rootN FFT
    730             double **  twid,            // distributed arrays containing N twiddle factors
    731             long       MyNum,
    732             long       MyFirst,
    733             long       MyLast )
    734 {
    735     long j;
     758void FFT1D( int              direction,       // direct 1 / inverse -1
     759            double       **  x,               // input & output distributed data points array
     760            double       **  tmp,             // auxiliary distributed data points array
     761            double        *  upriv,           // local array containing coefs for rootN FFT
     762            double       **  twid,            // distributed arrays containing N twiddle factors
     763            unsigned int     MyNum,           // thread continuous index
     764            unsigned int     MyFirst,
     765            unsigned int     MyLast )
     766{
     767    unsigned int j;
    736768    unsigned long long barrier_start;
    737769    unsigned long long barrier_stop;
     
    741773
    742774#if DEBUG_FFT1D
    743 printf("\n@@@ tmp after first transpose\n");
    744 PrintArray( tmp , N );
     775printf("\n[FFT] %s : thread %x after first transpose\n", __FUNCTION__, MyNum);
     776if( VERBOSE ) PrintArray( tmp , N );
    745777#endif
    746778
     
    755787    for (j = MyFirst; j < MyLast; j++)
    756788    {
     789printf("@@@  before FFT1Once / j = %d\n", j );
    757790        FFT1DOnce( direction , upriv , tmp , j * rootN );
     791printf("@@@  after  FFT1Once / j = %d\n", j );
    758792        TwiddleOneCol( direction , j , twid , tmp , j * rootN );
     793printf("@@@  after  Twiddle  / j = %d\n", j );
    759794    } 
    760795
    761796#if DEBUG_FFT1D
    762 printf("\n@@@ tmp after columns FFT + twiddle \n");
    763 PrintArray( tmp , N );
     797printf("\n[FFT] %s : thread %x after first twiddle\n", __FUNCTION__, MyNum);
     798if( VERBOSE ) PrintArray( tmp , N );
    764799#endif
    765800
     
    775810
    776811#if DEBUG_FFT1D
    777 printf("\n@@@ x after second transpose \n");
    778 PrintArray( x , N );
     812printf("\n[FFT] %s : thread %x after second transpose\n", __FUNCTION__, MyNum);
     813if( VERBOSE ) PrintArray( x , N );
    779814#endif
    780815
     
    794829
    795830#if DEBUG_FFT1D
    796 printf("\n@@@ x after rows FFT + scaling \n");
    797 PrintArray( x , N );
     831printf("\n[FFT] %s : thread %x after FFT on rows\n", __FUNCTION__, MyNum);
     832if( VERBOSE ) PrintArray( x , N );
    798833#endif
    799834
     
    809844
    810845#if DEBUG_FFT1D
    811 printf("\n@@@ tmp after third transpose \n");
    812 PrintArray( tmp , N );
     846printf("\n[FFT] %s : thread %x after third transpose\n", __FUNCTION__, MyNum);
     847if( VERBOSE ) PrintArray( x , N );
    813848#endif
    814849
     
    824859
    825860#if DEBUG_FFT1D
    826 printf("\n@@@ x after final copy \n");
    827 PrintArray( x , N );
     861printf("\n[FFT] %s : thread %x after final copy\n", __FUNCTION__, MyNum);
     862if( VERBOSE ) PrintArray( x , N );
    828863#endif
    829864
     
    835870// x[] array by the corresponding twiddle factor, contained in the u[] array.
    836871/////////////////////////////////////////////////////////////////////////////////////
    837 void TwiddleOneCol( long      direction,
    838                     long      j,              // y coordinate in 2D view of coef array
    839                     double ** u,              // coef array base address
    840                     double ** x,              // data array base address
    841                     long      offset_x )      // first point in N points data array
    842 {
    843     long i;
     872void TwiddleOneCol( int             direction,
     873                    unsigned int    j,              // y coordinate in 2D view of coef array
     874                    double       ** u,              // coef array base address
     875                    double       ** x,              // data array base address
     876                    unsigned int    offset_x )      // first point in N points data array
     877{
     878    unsigned int i;
    844879    double       omega_r;
    845880    double       omega_c;
    846881    double       x_r;
    847882    double       x_c;
    848     long        c_id;
    849     long        c_offset;
     883    unsigned int c_id;
     884    unsigned int c_offset;
    850885
    851886    for (i = 0; i < rootN ; i++)  // loop on the rootN points
     
    868903}  // end TwiddleOneCol()
    869904
    870 ////////////////////////
    871 void Scale( double ** x,           // data array base address
    872             long      offset_x )   // first point of the row to be scaled
    873 {
    874     long i;
    875     long c_id;
    876     long c_offset;
     905////////////////////////////
     906void Scale( double      ** x,           // data array base address
     907            unsigned int   offset_x )   // first point of the row to be scaled
     908{
     909    unsigned int i;
     910    unsigned int c_id;
     911    unsigned int c_offset;
    877912
    878913    for (i = 0; i < rootN ; i++)
     
    880915        c_id      = (offset_x + i) / (points_per_cluster);
    881916        c_offset  = (offset_x + i) % (points_per_cluster);
    882         data[c_id][2*c_offset]     /= N;
    883         data[c_id][2*c_offset + 1] /= N;
     917        x[c_id][2*c_offset]     /= N;
     918        x[c_id][2*c_offset + 1] /= N;
    884919    }
    885920}
    886921
    887 ////////////////////////////
    888 void Transpose( double ** src,      // source buffer (array of pointers)
    889                 double ** dest,     // destination buffer (array of pointers)
    890                 long      MyFirst,  // first row allocated to the thread
    891                 long      MyLast )  // last row allocated to the thread
    892 {
    893     long row;               // row index
    894     long point;             // data point index in a row
    895 
    896     long index_src;         // absolute index in the source N points array
    897     long c_id_src;          // cluster for the source buffer
    898     long c_offset_src;      // offset in the source buffer
    899 
    900     long index_dst;         // absolute index in the dest N points array
    901     long c_id_dst;          // cluster for the dest buffer
    902     long c_offset_dst;      // offset in the dest buffer
     922///////////////////////////////////
     923void Transpose( double      ** src,      // source buffer (array of pointers)
     924                double      ** dest,     // destination buffer (array of pointers)
     925                unsigned int   MyFirst,  // first row allocated to the thread
     926                unsigned int   MyLast )  // last row allocated to the thread
     927{
     928    unsigned int row;               // row index
     929    unsigned int point;             // data point index in a row
     930
     931    unsigned int index_src;         // absolute index in the source N points array
     932    unsigned int c_id_src;          // cluster for the source buffer
     933    unsigned int c_offset_src;      // offset in the source buffer
     934
     935    unsigned int index_dst;         // absolute index in the dest N points array
     936    unsigned int c_id_dst;          // cluster for the dest buffer
     937    unsigned int c_offset_dst;      // offset in the dest buffer
    903938
    904939   
     
    924959}  // end Transpose()
    925960
    926 /////////////////////////
    927 void Copy( double ** src,      // source buffer (array of pointers)
    928            double ** dest,     // destination buffer (array of pointers)
    929            long      MyFirst,  // first row allocated to the thread
    930            long      MyLast )  // last row allocated to the thread
    931 {
    932     long row;                  // row index
    933     long point;                // data point index in a row
    934 
    935     long index;                // absolute index in the N points array
    936     long c_id;                 // cluster index
    937     long c_offset;             // offset in local buffer
     961//////////////////////////////
     962void Copy( double      ** src,      // source buffer (array of pointers)
     963           double      ** dest,     // destination buffer (array of pointers)
     964           unsigned int   MyFirst,  // first row allocated to the thread
     965           unsigned int   MyLast )  // last row allocated to the thread
     966{
     967    unsigned int row;                  // row index
     968    unsigned int point;                // data point index in a row
     969
     970    unsigned int index;                // absolute index in the N points array
     971    unsigned int c_id;                 // cluster index
     972    unsigned int c_offset;             // offset in local buffer
    938973
    939974    // scan all data points allocated to the thread
     
    952987}  // end Copy()
    953988
    954 //////////////////////////
    955 void Reverse( double ** x,
    956               long      offset_x )
    957 {
    958     long j, k;
    959     long c_id_j;
    960     long c_offset_j;
    961     long c_id_k;
    962     long c_offset_k;
     989///////////////////////////////
     990void Reverse( double      ** x,
     991              unsigned int   offset_x )
     992{
     993    unsigned int j, k;
     994    unsigned int c_id_j;
     995    unsigned int c_offset_j;
     996    unsigned int c_id_k;
     997    unsigned int c_offset_k;
    963998
    964999    for (k = 0 ; k < rootN ; k++)
     
    9821017// (i.e. rootN points) of the x[nclusters][points_per_cluster] array.
    9831018/////////////////////////////////////////////////////////////////////////////
    984 void FFT1DOnce( long      direction,  // direct / inverse
    985                 double * u,          // private coefs array
    986                 double ** x,          // array of pointers on distributed buffers
    987                 long      offset_x )  // absolute offset in the x array
    988 {
    989     long     j;
    990     long     k;
    991     long     q;
    992     long     L;
    993     long     r;
    994     long     Lstar;
     1019void FFT1DOnce( int            direction,  // 1 direct / -1 inverse
     1020                double       * u,          // private coefs array
     1021                double      ** x,          // array of pointers on distributed buffers
     1022                unsigned int   offset_x )  // absolute offset in the x array
     1023{
     1024    unsigned int     j;
     1025    unsigned int     k;
     1026    unsigned int     q;
     1027    unsigned int     L;
     1028    unsigned int     r;
     1029    unsigned int     Lstar;
    9951030    double * u1;
    9961031
    997     long     offset_x1;     // index first butterfly input
    998     long     offset_x2;     // index second butterfly output
    999 
    1000     double   omega_r;       // real part butterfy coef
    1001     double   omega_c;       // complex part butterfly coef
    1002 
    1003     double   tau_r;
    1004     double   tau_c;
    1005 
    1006     double   d1_r;          // real part first butterfly input
    1007     double   d1_c;          // imag part first butterfly input
    1008     double   d2_r;          // real part second butterfly input
    1009     double   d2_c;          // imag part second butterfly input
    1010 
    1011     long     c_id_1;        // cluster index for first butterfly input
    1012     long     c_offset_1;    // offset for first butterfly input
    1013     long     c_id_2;        // cluster index for second butterfly input
    1014     long     c_offset_2;    // offset for second butterfly input
     1032    unsigned int     offset_x1;     // index first butterfly input
     1033    unsigned int     offset_x2;     // index second butterfly output
     1034
     1035    double           omega_r;       // real part butterfy coef
     1036    double           omega_c;       // complex part butterfly coef
     1037
     1038    double           tau_r;
     1039    double           tau_c;
     1040
     1041    double           d1_r;          // real part first butterfly input
     1042    double           d1_c;          // imag part first butterfly input
     1043    double           d2_r;          // real part second butterfly input
     1044    double           d2_c;          // imag part second butterfly input
     1045
     1046    unsigned int     c_id_1;        // cluster index for first butterfly input
     1047    unsigned int     c_offset_1;    // offset for first butterfly input
     1048    unsigned int     c_id_2;        // cluster index for second butterfly input
     1049    unsigned int     c_offset_2;    // offset for second butterfly input
    10151050
    10161051#if DEBUG_ONCE
     
    10201055for ( p = 0 ; p < rootN ; p++ )
    10211056{
    1022     long index    = offset_x + p;
    1023     long c_id     = index / (points_per_cluster);
    1024     long c_offset = index % (points_per_cluster);
     1057    unsigned int index    = offset_x + p;
     1058    unsigned int c_id     = index / (points_per_cluster);
     1059    unsigned int c_offset = index % (points_per_cluster);
    10251060    printf("%f , %f | ", x[c_id][2*c_offset] , x[c_id][2*c_offset+1] );
    10261061}
     
    10351070for ( p = 0 ; p < rootN ; p++ )
    10361071{
    1037     long index    = offset_x + p;
    1038     long c_id     = index / (points_per_cluster);
    1039     long c_offset = index % (points_per_cluster);
     1072    unsigned int index    = offset_x + p;
     1073    unsigned int c_id     = index / (points_per_cluster);
     1074    unsigned int c_offset = index % (points_per_cluster);
    10401075    printf("%f , %f | ", x[c_id][2*c_offset] , x[c_id][2*c_offset+1] );
    10411076}
     
    11061141for ( p = 0 ; p < rootN ; p++ )
    11071142{
    1108     long index    = offset_x + p;
    1109     long c_id     = index / (points_per_cluster);
    1110     long c_offset = index % (points_per_cluster);
     1143    unsigned int index    = offset_x + p;
     1144    unsigned int c_id     = index / (points_per_cluster);
     1145    unsigned int c_offset = index % (points_per_cluster);
    11111146    printf("%f , %f | ", x[c_id][2*c_offset] , x[c_id][2*c_offset+1] );
    11121147}
     
    11161151}  // end FFT1DOnce()
    11171152
    1118 //////////////////////////////////
    1119 void PrintArray( double ** array,
    1120                  long      size )
    1121 {
    1122     long  i;
    1123     long  c_id;
    1124     long  c_offset;
     1153///////////////////////////////////////
     1154void PrintArray( double       ** array,
     1155                 unsigned int    size )
     1156{
     1157    unsigned int  i;
     1158    unsigned int  c_id;
     1159    unsigned int  c_offset;
    11251160
    11261161    // float display
  • trunk/user/ksh/ksh.c

    r469 r473  
    108108        path = argv[1];
    109109
    110     printf("  error: not implemented yet\n");
     110    printf("  error: not implemented yet\n", argc, argv );
    111111
    112112/*
     
    167167        path = argv[1];
    168168
    169     printf("  error: not implemented yet\n");
     169    printf("  error: not implemented yet\n", argc, argv );
    170170
    171171    // release semaphore to get next command
     
    189189        }
    190190
    191     printf("  error: not implemented yet\n");
     191    printf("  error: not implemented yet\n", argc, argv );
    192192
    193193/*
     
    546546        unsigned int i;
    547547
     548        if (argc != 1)
     549    {
     550                printf("  usage: %s\n", argv[0], argc );
     551                return;
     552        }
     553
    548554        printf("--- registered commands ---\n");
    549555        for (i = 0; i < LOG_DEPTH; i++)
     
    639645        if (argc != 1)
    640646    {
    641                 printf("  usage: pwd\n");
     647                printf("  usage: %s\n", argv[0]);
    642648                return;
    643649        }
     
    664670        if (argc != 2)
    665671    {
    666                 printf("  usage: rm pathname\n");
     672                printf("  usage: %s pathname\n", argv[0]);
    667673                return;
    668674        }
     
    10411047}  // end interactive()
    10421048
    1043 ///////////////////////////////////
    1044 int main( int argc , char *argv[] )
     1049//////////
     1050int main()
    10451051{
    10461052    unsigned int cxy;             // owner cluster identifier for this KSH process
     
    10671073        exit( 1 );
    10681074    }
    1069 
    1070 printf("\n@@@ in KSH %s : &semaphore = %x\n", __FUNCTION__, &semaphore );
    10711075
    10721076    // initialize interactive thread attributes
  • trunk/user/sort/sort.c

    r469 r473  
    6464                 unsigned int init_pos )
    6565{
    66     int i;
    67     int j;
    68     int aux;
     66    unsigned int i;
     67    unsigned int j;
     68    int          aux;
    6969
    7070    for(i = 0; i < length; i++)
     
    263263    }
    264264
    265     get_cycle( &cycle );
    266     printf("\n[SORT] main completes barrier init at cycle %d\n", (unsigned int)cycle );
     265    printf("\n[SORT] main completes barrier init\n");
    267266
    268267    // Array to sort initialization
     
    277276#endif
    278277
    279     get_cycle( &cycle );
    280     printf("\n[SORT] main completes array init at cycle %d\n", (unsigned int)cycle );
     278    printf("\n[SORT] main completes array init\n");
    281279
    282280    // launch other threads to execute sort() function
Note: See TracChangeset for help on using the changeset viewer.