Changeset 66


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

style

Location:
trunk/kernel/drivers/soclib
Files:
2 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
  • trunk/kernel/drivers/soclib/soclib_tty.h

    r4 r66  
    3535
    3636/****************************************************************************************
    37  *     SOCLIB_TTY registers offsets 
     37 *     SOCLIB_TTY registers offsets
    3838 ***************************************************************************************/
    3939
     
    4646
    4747/****************************************************************************************
    48  * masks for TTY_STATUS_REG 
     48 * masks for TTY_STATUS_REG
    4949 ***************************************************************************************/
    5050
     
    5353
    5454/****************************************************************************************
    55  * masks for TTY_CONFIG_REG 
     55 * masks for TTY_CONFIG_REG
    5656 ***************************************************************************************/
    5757
     
    6161/****************************************************************************************
    6262 * This function masks both the TTY_RX and TTY_TX IRQs.
    63  * Thes IRQs are unmasked by the soclib_tty_cmd() function.
     63 * These IRQs are unmasked by the soclib_tty_cmd() function.
    6464 ****************************************************************************************
    6565 * @ chdev     : pointer on the TXT chdev descriptor.
     
    8383/****************************************************************************************
    8484 * This ISR should be executed only for the TXT_READ and TXT_WRITE commands.
    85  * It get the command arguments from the first client thread in the TXT chdev queue:
    86  * - if TXT_READ, it transfer one byte from the TTY_READ_REG to the command buffer.
     85 * It gets the command arguments from the first client thread in the TXT chdev queue:
     86 * - if TXT_READ, it transfers one byte from the TTY_READ_REG to the command buffer.
    8787 *   It simply returns for retry if TTY_READ_REG is empty.
    88  * - if TXT_WRITE, it tries to transfer several bytes from the command buffer to the 
    89  *   TTY_WRITE_REG. If the TTY_WRITE_REG is full, it updates the "count" and "buffer" 
     88 * - if TXT_WRITE, it tries to transfer several bytes from the command buffer to the
     89 *   TTY_WRITE_REG. If the TTY_WRITE_REG is full, it updates the "count" and "buffer"
    9090 *   command arguments and returns for retry.
    91  * When the I/O operation is completed, it set the status field in the command, unblock
    92  * the server thread, and unblock the client thread.
     91 * When the I/O operation is completed, it sets the status field in the command, unblocks
     92 * the server thread, and unblocks the client thread.
    9393 ****************************************************************************************
    9494 * @ chdev     : local pointer on TXT chdev descriptor.
Note: See TracChangeset for help on using the changeset viewer.