Ignore:
Timestamp:
Oct 10, 2020, 3:48:50 PM (4 years ago)
Author:
alain
Message:

Improve the TSAR NIC driver.

Location:
trunk/hal/tsar_mips32/core
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/hal/tsar_mips32/core/hal_gpt.c

    r647 r658  
    11871187
    11881188
    1189 
    1190 
    1191 
  • trunk/hal/tsar_mips32/core/hal_special.c

    r625 r658  
    292292}
    293293
     294
  • trunk/hal/tsar_mips32/core/hal_uspace.c

    r657 r658  
    3131
    3232///////////////////////////////////////////////////////////////////////////////////////
    33 // This function moves <size> bytes from a source buffer in user virtual space,
    34 // defined by the <u_src_ptr> argument, to a destination kernel buffer, defined by the
    35 // <k_dst_xp> argument.
     33// Implementation note
    3634// It works in a critical section, as it modifies two CP2 registers:
    3735// It activates briefly the DATA_MMU by writing into the CP2_MODE register to access the
     
    4139// If the buffers are not aligned, it moves all data byte per byte.
    4240///////////////////////////////////////////////////////////////////////////////////////
    43 // @ k_dst_xp  : extended pointer on destination kernel buffer
    44 // @ u_src_ptr : pointer on source user buffer
    45 // @ size     : number of bytes to move
    46 ///////////////////////////////////////////////////////////////////////////////////////
    4741void hal_copy_from_uspace( xptr_t     k_dst_xp,
    4842                           void     * u_src_ptr,
     
    5549    uint32_t cxy = (uint32_t)GET_CXY( k_dst_xp );
    5650 
     51assert( (CURRENT_THREAD->process->pid > 0), "must be called by an user thread" );
     52
    5753#if DEBUG_HAL_USPACE
    5854thread_t * this  = CURRENT_THREAD;
     
    133129
    134130///////////////////////////////////////////////////////////////////////////////////////
    135 // This function moves <size> bytes from a source kernel buffer, defined by the
    136 // <k_src_xp> argument, to a destination buffer in user virtual space, defined by
    137 // the <u_dst_ptr> argument.
     131// Implementation note
    138132// It works in a critical section, as it modifies two CP2 registers:
    139133// It activates briefly the DATA_MMU by writing into the CP2_MODE register to access the
     
    143137// If the buffers are not word aligned, it moves all data byte per byte.
    144138///////////////////////////////////////////////////////////////////////////////////////
    145 // @ u_dst_ptr : pointer on destination user buffer
    146 // @ k_src_xp  : extended pointer on source kernel buffer
    147 // @ size      : number of bytes to move
    148 ///////////////////////////////////////////////////////////////////////////////////////
    149139void hal_copy_to_uspace( void     * u_dst_ptr,
    150140                         xptr_t     k_src_xp,
     
    156146    uint32_t src = (uint32_t)GET_PTR( k_src_xp );
    157147    uint32_t cxy = (uint32_t)GET_CXY( k_src_xp );
     148
     149assert( (CURRENT_THREAD->process->pid > 0), "must be called by an user thread" );
    158150
    159151#if DEBUG_HAL_USPACE
     
    244236    uint32_t cxy = (uint32_t)GET_CXY( k_dst_xp );
    245237
     238assert( (CURRENT_THREAD->process->pid > 0), "must be called by an user thread" );
     239
    246240    hal_disable_irq( &save_sr );
    247241
     
    297291    uint32_t cxy = (uint32_t)GET_CXY( k_src_xp );
    298292
     293assert( (CURRENT_THREAD->process->pid > 0), "must be called by an user thread" );
     294
    299295    hal_disable_irq( &save_sr );
    300296
     
    346342    uint32_t count = 0;
    347343    uint32_t str   = (uint32_t)u_str;
     344
     345assert( (CURRENT_THREAD->process->pid > 0), "must be called by an user thread" );
    348346
    349347    hal_disable_irq( &save_sr );
Note: See TracChangeset for help on using the changeset viewer.