Changeset 435 for trunk/kernel/devices


Ignore:
Timestamp:
Feb 20, 2018, 5:32:17 PM (6 years ago)
Author:
alain
Message:

Fix a bad bug in scheduler...

Location:
trunk/kernel/devices
Files:
2 edited

Legend:

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

    r433 r435  
    3838extern chdev_directory_t  chdev_dir;         // allocated in kernel_init.c
    3939
    40 #if CONFIG_READ_DEBUG
     40#if (CONFIG_DEBUG_SYS_READ & 1)
    4141extern uint32_t enter_txt_read;
    4242extern uint32_t exit_txt_read;
    4343#endif
     44
     45#if (CONFIG_DEBUG_SYS_WRITE & 1)
     46extern uint32_t enter_txt_write;
     47extern uint32_t exit_txt_write;
     48#endif
     49
     50////////////////////////////////////////
     51char * dev_txt_type_str( uint32_t type )
     52{
     53    if     ( type == TXT_SYNC_WRITE ) return "TXT_SYNC_WRITE";
     54    else if( type == TXT_READ       ) return "TXT_READ";
     55    else if( type == TXT_WRITE      ) return "TXT_WRITE";
     56    else                              return "undefined";
     57}
    4458
    4559//////////////////////////////////
     
    117131    thread_t * this = CURRENT_THREAD;
    118132
     133#if (CONFIG_DEBUG_SYS_READ & 1)
     134enter_txt_read = hal_time_stamp();
     135#endif
     136
     137#if (CONFIG_DEBUG_SYS_WRITE & 1)
     138enter_txt_write = hal_time_stamp();
     139#endif
     140
    119141#if CONFIG_DEBUG_DEV_TXT
    120142uint32_t cycle = (uint32_t)hal_get_cycles();
     
    151173#endif
    152174
     175#if (CONFIG_DEBUG_SYS_READ & 1)
     176exit_txt_read = hal_time_stamp();
     177#endif
     178
     179#if (CONFIG_DEBUG_SYS_WRITE & 1)
     180exit_txt_write = hal_time_stamp();
     181#endif
     182
    153183    // return I/O operation status from calling thread descriptor
    154184    return this->txt_cmd.error;
     
    160190                       uint32_t   count )
    161191{
    162     error_t error = dev_txt_access( TXT_WRITE , channel , buffer , count );
    163     return error;
     192    return dev_txt_access( TXT_WRITE , channel , buffer , count );
    164193}
    165194
     
    168197                      char     * buffer )
    169198{
    170 
    171 #if CONFIG_READ_DEBUG
    172 enter_txt_read = hal_time_stamp();
    173 #endif
    174 
    175     error_t error = dev_txt_access( TXT_READ , channel , buffer , 1 );
    176 
    177 #if CONFIG_READ_DEBUG
    178 exit_txt_read = hal_time_stamp();
    179 #endif
    180 
    181     return error;
    182 
     199    return dev_txt_access( TXT_READ , channel , buffer , 1 );
    183200}
    184201
     
    201218
    202219    // build arguments structure
    203     txt_aux_t  args;
     220    txt_sync_args_t  args;
    204221    args.dev_xp = dev_xp;
    205222    args.buffer = buffer;
  • trunk/kernel/devices/dev_txt.h

    r422 r435  
    8282    TXT_READ       = 0,
    8383    TXT_WRITE      = 1,
     84    TXT_SYNC_WRITE = 2,
    8485};
    8586
     
    8788{
    8889    xptr_t      dev_xp;    /*! extended pointer on the relevant TXT device descriptor    */
    89     uint32_t    type;      /*! TXT_READ / TXT_WRITE / TXT_SYNC_WRITE                     */
     90    uint32_t    type;      /*! TXT_READ / TXT_WRITE                                      */
    9091    xptr_t      buf_xp;    /*! extended pointer on characters array                      */
    9192    uint32_t    count;     /*! number of characters in buffer (must be 1 if to_mem)      */
     
    99100 *****************************************************************************************/
    100101
    101 typedef struct txt_aux_s
     102typedef struct txt_sync_args_s
    102103{
    103     xptr_t      dev_xp;    /*! extended pointer on the TXT0 device descriptor            */
     104    xptr_t      dev_xp;    /*! extended pointer on the TXT0_TX device descriptor            */
    104105    char      * buffer;    /*! local pointer on characters array                         */
    105106    uint32_t    count;     /*! number of characters in buffer                            */
    106107}
    107 txt_aux_t;
     108txt_sync_args_t;
     109
     110/******************************************************************************************
     111 * This function returns a printable string for the comman type.
     112 ******************************************************************************************
     113 * @ type     : command type (TXT_READ / TXT_WRITE / TXT_SYNC_WRITE)
     114 *****************************************************************************************/
     115char * dev_txt_type_str( uint32_t type );
    108116
    109117/******************************************************************************************
     
    157165 * As it is used for debug, the command arguments <buffer> and <count> are registerd
    158166 * in a specific "dbg_cmd" field of the calling thread.
    159  * other TXT accesses.
    160167 ****************************************************************************************
    161168 * @ buffer    : local pointer on source buffer containing the string.
Note: See TracChangeset for help on using the changeset viewer.