Ignore:
Timestamp:
Jul 18, 2019, 2:06:55 PM (5 years ago)
Author:
alain
Message:

Introduce the non-standard pthread_parallel_create() system call
and re-write the <fft> and <sort> applications to improve the
intrinsic paralelism in applications.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/devices/dev_txt.c

    r626 r637  
    9595    {
    9696        // select a core to execute the server thread
    97         lid_t lid = cluster_select_local_core();
     97        lid_t lid = cluster_select_local_core( local_cxy );
    9898
    9999        // The unique IRQ from cluster 00's MTTY must be bound to a RX chdev
     
    131131        thread_unblock( XPTR( local_cxy , new_thread ) , THREAD_BLOCKED_GLOBAL );
    132132    }
    133 }
     133}  // end dev_txt_init()
    134134
    135135//////////////////////////////////////////////////////////////////////////////////
     
    166166    // return I/O operation status from calling thread descriptor
    167167    return this->txt_cmd.error;
    168 }
     168
     169}  // end dev_txt_access()
    169170
    170171/////////////////////////////////////////
     
    173174                       uint32_t   count )
    174175{
     176    error_t error;
    175177
    176178#if (DEBUG_SYS_WRITE & 1)
     
    182184uint32_t   cycle = (uint32_t)hal_get_cycles();
    183185if( DEBUG_DEV_TXT_TX < cycle )
    184 printk("\n[%s] thread[%x,%x] enters / cycle %d\n",
    185 __FUNCTION__, this->process->pid, this->trdid, cycle );
    186 #endif
    187 
    188     // get extended pointer on TXT[0] chdev
     186printk("\n[%s] thread[%x,%x] enters for <%s> / cycle %d\n",
     187__FUNCTION__, this->process->pid, this->trdid, buffer, cycle );
     188#endif
     189
     190    // If we use MTTY (vci_multi_tty), we do a synchronous write on TXT[0]
     191    // If we use TTY  (vci_tty_tsar), we do a standard asynchronous write
     192    // TODO this is not very clean ... [AG]
     193
     194    // get pointers on chdev
    189195    xptr_t dev_xp = chdev_dir.txt_tx[0];
    190 
    191     assert( (dev_xp != XPTR_NULL) , __FUNCTION__ ,
    192     "undefined TXT0 chdev descriptor" );
    193 
    194     // get TXTO chdev cluster and local pointer
    195     cxy_t    dev_cxy  = GET_CXY( dev_xp );
    196     chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
    197 
    198     // If we use MTTYs (vci_multi_tty), we perform only sync writes
    199     // Otherwise, we use vci_tty_tsar so we can use async writes
     196    cxy_t     dev_cxy = GET_CXY( dev_xp );
     197    chdev_t * dev_ptr = GET_PTR( dev_xp );
    200198
    201199    if( dev_ptr->impl == IMPL_TXT_MTY )
     
    211209        args.channel = channel;
    212210
    213         // call driver function
     211        // call directly the driver function
    214212        aux( &args );
    215213
    216         return 0;
    217     }
    218 
     214        error = 0;
     215    }
    219216    else
    220217    {
    221         return dev_txt_access( TXT_WRITE , channel , buffer , count );
     218        // register command in chdev queue for an asynchronous access
     219        error = dev_txt_access( TXT_WRITE , channel , buffer , count );
     220
     221        if( error )
     222        {
     223            printk("\n[ERROR] in %s : cannot write string %s / cycle %d\n",
     224            __FUNCTION__, buffer, (uint32_t)hal_get_cycles() );
     225        }
    222226    }
    223227
     
    225229cycle = (uint32_t)hal_get_cycles();
    226230if( DEBUG_DEV_TXT_TX < cycle )
    227 printk("\n[%s] thread[%x,%x] exit / cycle %d\n",
     231printk("\n[%s] thread[%x,%x] exit /  cycle %d\n",
    228232__FUNCTION__, this->process->pid, this->trdid, cycle );
    229233#endif
     
    233237#endif
    234238
    235 }
     239    return error;
     240
     241}  // end dev_txt_write()
    236242
    237243/////////////////////////////////////////
     
    239245                      char     * buffer )
    240246{
     247    error_t error;
    241248
    242249#if (DEBUG_SYS_READ & 1)
     
    252259#endif
    253260
    254     return dev_txt_access( TXT_READ , channel , buffer , 1 );
     261    // register command in chdev queue for an asynchronous access
     262    error = dev_txt_access( TXT_READ , channel , buffer , 1 );
     263
     264    if( error )
     265    {
     266        printk("\n[ERROR] in %s : cannot get character / cycle %d\n",
     267        __FUNCTION__, (uint32_t)hal_get_cycles() );
     268    }
    255269
    256270#if DEBUG_DEV_TXT_RX
    257271cycle = (uint32_t)hal_get_cycles();
    258272if( DEBUG_DEV_TXT_RX < cycle )
    259 printk("\n[%s] thread[%x,%x] exit / cycle %d\n",
    260 __FUNCTION__, this->process->pid, this->trdid, cycle );
     273printk("\n[%s] thread[%x,%x] get character <%c> / cycle %d\n",
     274__FUNCTION__, this->process->pid, this->trdid, *buffer, cycle );
    261275#endif
    262276
     
    265279#endif
    266280
    267 }
     281    return error;
     282
     283}  // end dev_txt_read()
    268284
    269285////////////////////////////////////////////////
Note: See TracChangeset for help on using the changeset viewer.