Ignore:
Timestamp:
Jun 26, 2017, 1:40:02 PM (7 years ago)
Author:
max@…
Message:

style

File:
1 edited

Legend:

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

    r23 r49  
    11/*
    22 * dev_txt.c - TXT (Text Terminal) generic device API implementation.
    3  * 
     3 *
    44 * Author  Alain Greiner    (2016)
    55 *
     
    4343{
    4444    // the local ICU chdev must be initialized before the TXT chdev, because
    45     // the TXT chdev initialisation requires allocation of a WTI from local ICU
     45    // the TXT chdev initialization requires allocation of a WTI from local ICU
    4646    xptr_t  icu_xp  = chdev_dir.icu[local_cxy];
    4747    assert( (icu_xp != XPTR_NULL) , __FUNCTION__ , "ICU not initialised before TXT" );
     
    7777    dev_icu_enable_irq( lid , WTI_TYPE , wti_id , chdev );
    7878
    79     // link IOC IRQ to WTI mailbox in PIC component 
     79    // link IOC IRQ to WTI mailbox in PIC component
    8080    uint32_t irq_id = chdev_pic_input.txt[channel];
    8181    dev_pic_bind_irq( irq_id , local_cxy , wti_id );
     
    8989                                  &chdev_sequencial_server,
    9090                                  chdev,
    91                                   lid ); 
     91                                  lid );
    9292    assert( (error == 0) , __FUNCTION__ , "cannot create server thread" );
    9393
    9494    // set "server" field in chdev descriptor
    9595    chdev->server = new_thread;
    96    
     96
    9797    // start server thread
    9898    thread_unblock( XPTR( local_cxy , new_thread ) , THREAD_BLOCKED_GLOBAL );
    99 
    100 } // end dev_txt_init()
    101 
     99}
    102100
    103101//////////////////////////////////////////////////////////////////////////////////
     
    111109    thread_t * this = CURRENT_THREAD;
    112110
    113     txt_dmsg("\n[INFO] in %s : thread %x in process %x enters\n", 
     111    txt_dmsg("\n[INFO] in %s : thread %x in process %x enters\n",
    114112                 __FUNCTION__ , this->trdid , this->process->pid );
    115113
     
    133131    chdev_register_command( dev_xp , this );
    134132
    135     txt_dmsg("\n[INFO] in %s : thread %x in process %x completes / error = %d\n", 
     133    txt_dmsg("\n[INFO] in %s : thread %x in process %x completes / error = %d\n",
    136134             __FUNCTION__ , this->trdid , this->process->pid , this->command.txt.error );
    137135
    138136    // return I/O operation status from calling thread descriptor
    139     return this->command.txt.error; 
    140 
    141 }  // end dev_txt_access()
     137    return this->command.txt.error;
     138}
    142139
    143140/////////////////////////////////////////
     
    148145    return dev_txt_access( TXT_WRITE , channel , buffer , count );
    149146}
    150  
     147
    151148/////////////////////////////////////////
    152149error_t dev_txt_read( uint32_t   channel,
     
    161158                            uint32_t   count )
    162159{
    163     // get pointer on calling thread 
     160    // get pointer on calling thread
    164161    thread_t * this = CURRENT_THREAD;
    165162
    166     // get extended pointer on TXT[0] chdev 
     163    // get extended pointer on TXT[0] chdev
    167164    xptr_t  dev_xp = chdev_dir.txt[channel];
    168165
    169166    assert( (dev_xp != XPTR_NULL) , __FUNCTION__ , "undefined TXT0 chdev descriptor" );
    170167
    171     // register command in calling thread 
     168    // register command in calling thread
    172169    this->command.txt.dev_xp  = dev_xp;
    173170    this->command.txt.type    = TXT_SYNC_WRITE;
     
    175172    this->command.txt.count   = count;
    176173
    177     // get driver command function 
     174    // get driver command function
    178175    cxy_t       dev_cxy = GET_CXY( dev_xp );
    179176    chdev_t   * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
    180177    dev_cmd_t * cmd = (dev_cmd_t *)hal_remote_lpt( XPTR( dev_cxy , &dev_ptr->cmd ) );
    181178
    182     // call directly driver command 
     179    // call directly driver command
    183180    cmd( XPTR( local_cxy , this ) );
    184181
    185182    // return I/O operation status from calling thread descriptor
    186183    return this->command.txt.error;
    187  
    188 }  // end dev_txt_sync_write()
     184}
    189185
Note: See TracChangeset for help on using the changeset viewer.