Changeset 436 for trunk/kernel/devices


Ignore:
Timestamp:
Mar 7, 2018, 9:02:03 AM (7 years ago)
Author:
alain
Message:

1) improve the threads and process destruction mechanism.
2) introduce FIFOs in the soclib_tty driver.

Location:
trunk/kernel/devices
Files:
2 edited

Legend:

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

    r408 r436  
    130130
    131131        // block on THREAD_BLOCKED_IO condition and deschedule
    132         thread_block( thread_ptr , THREAD_BLOCKED_IO );
     132        thread_block( XPTR( local_cxy , thread_ptr ) , THREAD_BLOCKED_IO );
    133133        sched_yield("client blocked on I/O");
    134134
     
    200200
    201201        // block on THREAD_BLOCKED I/O condition and deschedule
    202         thread_block( thread_ptr , THREAD_BLOCKED_IO );
     202        thread_block( XPTR( local_cxy , thread_ptr ) , THREAD_BLOCKED_IO );
    203203        sched_yield("client blocked on I/O");
    204204
  • trunk/kernel/devices/dev_txt.c

    r435 r436  
    131131    thread_t * this = CURRENT_THREAD;
    132132
    133 #if (CONFIG_DEBUG_SYS_READ & 1)
    134 enter_txt_read = hal_time_stamp();
    135 #endif
    136 
    137 #if (CONFIG_DEBUG_SYS_WRITE & 1)
    138 enter_txt_write = hal_time_stamp();
    139 #endif
    140 
    141 #if CONFIG_DEBUG_DEV_TXT
    142 uint32_t cycle = (uint32_t)hal_get_cycles();
    143 if( CONFIG_DEBUG_DEV_TXT < cycle )
    144 printk("\n[DBG] %s : thread %x enters / cycle %d\n",
    145 __FUNCTION__, CURRENT_THREAD , cycle );
    146 #endif
    147 
    148133    // check channel argument
    149134    assert( (channel < CONFIG_MAX_TXT_CHANNELS) , __FUNCTION__ , "illegal channel index" );
     
    166151    chdev_register_command( dev_xp );
    167152
    168 #if CONFIG_DEBUG_DEV_TXT
    169 cycle = (uint32_t)hal_get_cycles();
    170 if( CONFIG_DEBUG_DEV_TXT < cycle )
    171 printk("\n[DBG] %s : thread %x exit / cycle %d\n",
    172 __FUNCTION__, CURRENT_THREAD , cycle );
    173 #endif
    174 
    175 #if (CONFIG_DEBUG_SYS_READ & 1)
    176 exit_txt_read = hal_time_stamp();
    177 #endif
    178 
    179 #if (CONFIG_DEBUG_SYS_WRITE & 1)
    180 exit_txt_write = hal_time_stamp();
    181 #endif
    182 
    183153    // return I/O operation status from calling thread descriptor
    184154    return this->txt_cmd.error;
     
    190160                       uint32_t   count )
    191161{
     162
     163#if (CONFIG_DEBUG_SYS_WRITE & 1)
     164enter_txt_write = hal_time_stamp();
     165#endif
     166
     167#if CONFIG_DEBUG_DEV_TXT_TX
     168uint32_t cycle = (uint32_t)hal_get_cycles();
     169if( CONFIG_DEBUG_DEV_TXT_TX < cycle )
     170printk("\n[DBG] %s : thread %x enters / cycle %d\n", __FUNCTION__, CURRENT_THREAD, cycle );
     171#endif
     172
    192173    return dev_txt_access( TXT_WRITE , channel , buffer , count );
     174
     175#if CONFIG_DEBUG_DEV_TXT_TX
     176cycle = (uint32_t)hal_get_cycles();
     177if( CONFIG_DEBUG_DEV_TXT_TX < cycle )
     178printk("\n[DBG] %s : thread %x exit / cycle %d\n", __FUNCTION__, CURRENT_THREAD, cycle );
     179#endif
     180
     181#if (CONFIG_DEBUG_SYS_WRITE & 1)
     182exit_txt_write = hal_time_stamp();
     183#endif
     184
    193185}
    194186
     
    197189                      char     * buffer )
    198190{
     191
     192#if (CONFIG_DEBUG_SYS_READ & 1)
     193enter_txt_read = hal_time_stamp();
     194#endif
     195
     196#if CONFIG_DEBUG_DEV_TXT_RX
     197uint32_t cycle = (uint32_t)hal_get_cycles();
     198if( CONFIG_DEBUG_DEV_TXT_RX < cycle )
     199printk("\n[DBG] %s : thread %x enters / cycle %d\n", __FUNCTION__, CURRENT_THREAD, cycle );
     200#endif
     201
    199202    return dev_txt_access( TXT_READ , channel , buffer , 1 );
     203
     204#if CONFIG_DEBUG_DEV_TXT_RX
     205cycle = (uint32_t)hal_get_cycles();
     206if( CONFIG_DEBUG_DEV_TXT_RX < cycle )
     207printk("\n[DBG] %s : thread %x exit / cycle %d\n", __FUNCTION__, CURRENT_THREAD, cycle );
     208#endif
     209
     210#if (CONFIG_DEBUG_SYS_READ & 1)
     211exit_txt_read = hal_time_stamp();
     212#endif
     213
    200214}
    201215
Note: See TracChangeset for help on using the changeset viewer.