Ignore:
Timestamp:
May 3, 2017, 1:23:24 PM (7 years ago)
Author:
alain
Message:

Bugs fix.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/printk.c

    r5 r14  
    2828#include <remote_spinlock.h>
    2929#include <cluster.h>
     30#include <chdev.h>
    3031#include <printk.h>
     32
     33///////////////////////////////////////////////////////////////////////////////////
     34//      Extern variables
     35///////////////////////////////////////////////////////////////////////////////////
     36
     37extern chdev_t            txt0_chdev;        // allocated in kernel_init.c
    3138
    3239///////////////////////////////////////////////////////////////////////////////////
     
    213220}  // end kernel_printf()
    214221
    215 ////////////////////////////////
    216 void printk( char * format, ...)
     222/////////////////////////////////
     223void printk( char * format , ...)
    217224{
    218225    va_list       args;
    219 
    220     // call kernel_printf
     226    uint32_t      save_sr;
     227
     228    // get extended pointer on remote TXT0 chdev lock
     229    xptr_t  txt0_lock_xp = XPTR( LOCAL_CLUSTER->io_cxy , &txt0_chdev.wait_lock );
     230
     231    // get TXT0 lock in busy waiting mode
     232    remote_spinlock_lock_busy( txt0_lock_xp , &save_sr );
     233
     234    // call kernel_printf in busy waiting mode
    221235    va_start( args , format );
    222236    kernel_printf( 0 , 1 , format , &args );
    223237    va_end( args );
     238
     239    // release lock
     240    remote_spinlock_unlock_busy( txt0_lock_xp , save_sr );
    224241}
    225242
    226 /////////////////////////////////////
    227 void user_printk( char* format, ...)
     243//////////////////////////////////////
     244void user_printk( char * format , ...)
    228245{
    229246    va_list   args;
     
    232249    uint32_t channel = 0;
    233250
    234     // call kernel_printf
     251   // call kernel_printf in descheduling mode
    235252    va_start( args , format );
    236253    kernel_printf( channel, 0 , format , &args );
Note: See TracChangeset for help on using the changeset viewer.