Ignore:
Timestamp:
Jun 27, 2017, 9:56:10 AM (5 years ago)
Author:
max@…
Message:

style

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/drivers/soclib/soclib_tty.c

    r4 r66  
    3333{
    3434    // get extended pointer on TTY-SOCLIB peripheral base address
    35     xptr_t tty_xp = chdev->base; 
     35    xptr_t tty_xp = chdev->base;
    3636
    3737    // get SOCLIB_TTY device cluster and local pointer
    3838    cxy_t      tty_cxy = GET_CXY( tty_xp );
    3939    uint32_t * tty_ptr = (uint32_t *)GET_PTR( tty_xp );
    40  
     40
    4141    // mask both TTY_RX_IRQ and TTY_TX_IRQ
    4242    hal_remote_sw( XPTR( tty_cxy , tty_ptr + TTY_CONFIG_REG ) , 0 );
    43 
    44 }  // soclib_tty_init()
     43}
    4544
    4645//////////////////////////////////////////////////////////////
     
    5453    uint32_t type   =         hal_remote_lw ( XPTR( th_cxy , &th_ptr->command.txt.type ) );
    5554    xptr_t   dev_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->command.txt.dev_xp ) );
    56    
     55
    5756    // get TXT device cluster and local pointer
    5857    cxy_t     dev_cxy = GET_CXY( dev_xp );
     
    7069    uint32_t * base    = tty_ptr + TTY_SPAN * channel;
    7170
    72     if( type == TXT_READ )              // descheduling strategy for calling thead
     71    if( type == TXT_READ )              // descheduling strategy for calling thread
    7372    {
    7473        // unmask RX_IRQ (data transfer will be done by the TTY_RX ISR)
     
    7877        hal_remote_atomic_cas( config_xp , old , new );
    7978
    80         // Block and deschedule server thread 
     79        // Block and deschedule server thread
    8180        thread_block( CURRENT_THREAD , THREAD_BLOCKED_DEV_ISR );
    8281        sched_yield();
     
    9089        hal_remote_atomic_cas( config_xp , old , new );
    9190
    92         // Block and deschedule server thread 
     91        // Block and deschedule server thread
    9392        thread_block( CURRENT_THREAD , THREAD_BLOCKED_DEV_ISR );
    9493        sched_yield();
     
    9695    else if( type == TXT_SYNC_WRITE )  // busy waiting strategy for calling thread
    9796    {
    98         uint32_t   status;       
     97        uint32_t   status;
    9998        bool_t     empty;
    10099        uint32_t   i;
     
    104103        xptr_t   buf_xp = hal_remote_lwd( XPTR( th_cxy , &th_ptr->command.txt.buf_xp ) );
    105104
    106         // loop on characters 
     105        // loop on characters
    107106        for( i = 0 ; i < count ; i++ )
    108         { 
     107        {
    109108            do
    110109            {
     
    121120                    hal_remote_sb( XPTR( tty_cxy , base + TTY_WRITE_REG ) , byte );
    122121                }
    123             } 
     122            }
    124123            while ( empty == false );
    125124        }
    126125    }
    127 }  // soclib_tty_command()
    128 
     126}
    129127
    130128/////////////////////////////////////////////////////////////////
     
    193191    else if( type == TXT_WRITE )         // write a string
    194192    {
    195         // loop on characters 
     193        // loop on characters
    196194        for( i = 0 ; i < count ; i++ )
    197         { 
     195        {
    198196            // get TTY_STATUS_REG
    199197            status = hal_remote_lw( XPTR( tty_cxy , base + TTY_STATUS_REG ) );
     
    209207            else         // TTY_TX full => update command arguments and exit ISR for retry
    210208            {
    211                 hal_remote_sw ( XPTR( client_cxy , &client_ptr->command.txt.count ), count-i ); 
     209                hal_remote_sw ( XPTR( client_cxy , &client_ptr->command.txt.count ), count-i );
    212210                hal_remote_swd( XPTR( client_cxy , &client_ptr->command.txt.buf_xp ), buf_xp+i );
    213211                return;
     
    229227    // unblock client thread
    230228    thread_unblock( client_xp , THREAD_BLOCKED_IO );
    231 
    232 }  // soclib_tty_isr()
    233 
    234 
     229}
     230
Note: See TracChangeset for help on using the changeset viewer.