Changeset 495 for soft/giet_vm/giet_common/tty0.c
- Timestamp:
- Feb 8, 2015, 12:55:35 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_common/tty0.c
r466 r495 13 13 #include <tty_driver.h> 14 14 #include <utils.h> 15 #include <locks.h> 15 #include <kernel_locks.h> 16 17 ///////////////////////////////////////////////////////////////////////////// 18 // The global variable tty0_boot_mode define the type of lock used, 19 // and must be defined in both kernel_init.c and boot.c files. 20 // - the boot code must use a spin_lock because the kernel heap is not set. 21 // - the kernel code can use a sqt_lock when the kernel heap is set. 22 ///////////////////////////////////////////////////////////////////////////// 23 24 extern unsigned int _tty0_boot_mode; 25 26 __attribute__((section(".kdata"))) 27 sqt_lock_t _tty0_sqt_lock __attribute__((aligned(64))); 28 29 __attribute__((section(".kdata"))) 30 spin_lock_t _tty0_spin_lock __attribute__((aligned(64))); 16 31 17 32 ////////////////////////////////////////////// … … 20 35 { 21 36 unsigned int n; 37 unsigned int k; 22 38 23 39 for ( n = 0 ; n < nbytes ; n++ ) 24 40 { 25 // return error if TTY_TX buffer full 26 if ( (_tty_get_register( 0, TTY_STATUS ) & 0x2) ) return 1; 41 // test TTY_TX buffer full 42 if ( (_tty_get_register( 0, TTY_STATUS ) & 0x2) ) // buffer full 43 { 44 // retry if full 45 for( k = 0 ; k < 10000 ; k++ ) 46 { 47 if ( (_tty_get_register( 0, TTY_STATUS ) & 0x2) == 0) break; 48 } 49 // return error if full after 10000 retry 50 return 1; 51 } 27 52 28 53 // write one byte … … 240 265 unsigned int lpid = procid & ((1<<P_WIDTH)-1); 241 266 _puts("\n\n[GIET ERROR] in _printf() for processor["); 242 _putd( x ); 267 _putd( x ); 243 268 _puts(","); 244 269 _putd( y ); … … 268 293 // get TTY0 lock 269 294 _it_disable( &save_sr ); 270 _sbt_lock_acquire( &_tty_tx_lock[0] ); 295 if ( _tty0_boot_mode ) _spin_lock_acquire( &_tty0_spin_lock ); 296 else _sqt_lock_acquire( &_tty0_sqt_lock ); 271 297 272 298 va_start( args , format ); … … 275 301 276 302 // release TTY0 lock 277 _sbt_lock_release( &_tty_tx_lock[0] ); 303 if ( _tty0_boot_mode ) _spin_lock_release( &_tty0_spin_lock ); 304 else _sqt_lock_release( &_tty0_sqt_lock ); 278 305 _it_restore( &save_sr ); 279 306 }
Note: See TracChangeset
for help on using the changeset viewer.