Ignore:
Timestamp:
Nov 20, 2020, 12:04:01 AM (4 years ago)
Author:
alain
Message:

1) Introduce up to 4 command lines arguments in the KSH "load" command.
These arguments are transfered to the user process through the
argc/argv mechanism, using the user space "args" vseg.

2) Introduce the named and anonymous "pipes", for inter-process communication
through the pipe() and mkfifo() syscalls.

3) Introduce the "chat" application to validate the two above mechanisms.

4) Improve printk() and assert() fonctions in printk.c.

File:
1 edited

Legend:

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

    r663 r674  
    7474    bool_t    is_rx   = txt->is_rx;
    7575
    76 assert( (pic_xp != XPTR_NULL) || (channel == 0) ,
     76assert( __FUNCTION__, ((pic_xp != XPTR_NULL) || (channel == 0)) ,
    7777"PIC not initialised before TXT" );
    7878
    7979    // set chdev name
    80     if( is_rx ) snprintf( txt->name , 16 , "txt%d_rx" , channel );
    81     else        snprintf( txt->name , 16 , "txt%d_tx" , channel );
     80    if( is_rx ) snprintk( txt->name , 16 , "txt%d_rx" , channel );
     81    else        snprintk( txt->name , 16 , "txt%d_tx" , channel );
    8282
    8383    // set TXT chdev extension
     
    120120                                      lid );
    121121
    122         assert( (error == 0) , "cannot create server thread" );
     122        assert( __FUNCTION__, (error == 0) , "cannot create server thread" );
    123123
    124124        // set "server" field in chdev descriptor
     
    154154
    155155// check channel argument
    156 assert( (channel < CONFIG_MAX_TXT_CHANNELS) , "illegal channel index" );
     156assert( __FUNCTION__, (channel < CONFIG_MAX_TXT_CHANNELS) , "illegal channel index" );
    157157
    158158    // get pointers on chdev
     
    162162
    163163// check dev_xp
    164 assert( (dev_xp != XPTR_NULL) , "undefined TXT chdev descriptor" );
     164assert( __FUNCTION__, (dev_xp != XPTR_NULL) , "undefined TXT chdev descriptor" );
    165165
    166166    // If we use MTTY (vci_multi_tty), we do a synchronous write on TXT[0]
     
    243243
    244244// check channel argument
    245 assert( (channel < CONFIG_MAX_TXT_CHANNELS) , "illegal channel index" );
     245assert( __FUNCTION__, (channel < CONFIG_MAX_TXT_CHANNELS) , "illegal channel index" );
    246246
    247247    // get pointers on chdev
     
    249249
    250250// check dev_xp
    251 assert( (dev_xp != XPTR_NULL) , "undefined TXT chdev descriptor" );
     251assert( __FUNCTION__, (dev_xp != XPTR_NULL) , "undefined TXT chdev descriptor" );
    252252
    253253    // register command in calling thread descriptor
     
    290290                            uint32_t     count )
    291291{
    292     // get extended pointer on TXT[0] chdev
    293     xptr_t  dev_xp = chdev_dir.txt_tx[0];
    294 
    295     assert( (dev_xp != XPTR_NULL) ,
    296     "undefined TXT0 chdev descriptor" );
    297 
    298     // get TXTO chdev cluster and local pointer
    299     cxy_t    dev_cxy  = GET_CXY( dev_xp );
     292    // get extended pointers on TXT[0] chdev
     293    xptr_t    dev_xp  = chdev_dir.txt_tx[0];
     294    cxy_t     dev_cxy = GET_CXY( dev_xp );
    300295    chdev_t * dev_ptr = GET_PTR( dev_xp );
    301296
    302     // get driver command function
    303     dev_aux_t * aux = (dev_aux_t *)hal_remote_lpt( XPTR( dev_cxy , &dev_ptr->aux ) );
    304 
    305     // build arguments structure
    306     txt_sync_args_t  args;
    307     args.dev_xp = dev_xp;
    308     args.buffer = buffer;
    309     args.count  = count;
    310     args.channel = 0;
    311 
    312     // call driver function
    313     aux( &args );
    314 
    315     return 0;
    316 }
    317 
     297    if( dev_xp != XPTR_NULL)
     298    {
     299        // get driver command function
     300        dev_aux_t * aux = (dev_aux_t *)hal_remote_lpt( XPTR( dev_cxy , &dev_ptr->aux ) );
     301
     302        // build arguments structure
     303        txt_sync_args_t  args;
     304        args.dev_xp = dev_xp;
     305        args.buffer = buffer;
     306        args.count  = count;
     307        args.channel = 0;
     308
     309        // call driver function
     310        aux( &args );
     311
     312        return 0;
     313    }
     314    else
     315    {
     316        return -1;
     317    }
     318}   // end dev_txt_sync_write()
     319
Note: See TracChangeset for help on using the changeset viewer.