Changeset 100 for trunk/hal/x86_64/drivers
- Timestamp:
- Jun 29, 2017, 3:49:52 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/drivers/soclib_tty.c
r89 r100 29 29 #include <hal_special.h> 30 30 31 #include <hal_internal.h> // XXX 32 31 33 void soclib_tty_init( chdev_t * chdev ) 32 34 { 33 35 // nothing to do 34 36 } 35 37 38 // Pour le write: tout en sync, ça part direct sur le VGA/série 39 // Pour le read: là on attend l'ISR 36 40 void __attribute__ ((noinline)) soclib_tty_cmd( xptr_t th_xp ) 37 41 { 38 // Pour le write: tout en sync, ça part direct sur le VGA/série 39 // Pour le read: là on attend l'ISR 42 // get client thread cluster and local pointer 43 cxy_t th_cxy = GET_CXY( th_xp ); 44 thread_t * th_ptr = (thread_t *)GET_PTR( th_xp ); 45 46 // get command type and extended pointer on TXT device 47 uint32_t type = hal_remote_lw ( XPTR( th_cxy , &th_ptr->command.txt.type ) ); 48 xptr_t dev_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->command.txt.dev_xp ) ); 49 50 // get TXT device cluster and local pointer 51 cxy_t dev_cxy = GET_CXY( dev_xp ); 52 chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp ); 53 54 // get extended pointer on SOCLIB_TTY base segment 55 xptr_t tty_xp = (xptr_t)hal_remote_lwd( XPTR( dev_cxy , &dev_ptr->base ) ); 56 57 // get SOCLIB_TTY base segment cluster and local pointer 58 cxy_t tty_cxy = GET_CXY( tty_xp ); 59 uint32_t * tty_ptr = (uint32_t *)GET_PTR( tty_xp ); 60 61 // get TTY channel index 62 uint32_t channel = hal_remote_lw( XPTR( dev_cxy , &dev_ptr->channel ) ); 63 64 // for now, only channel zero 65 if (channel != 0) { 66 x86_panic("should have been channel zero"); 67 } 68 69 if (type == TXT_READ) // descheduling strategy for calling thread 70 { 71 x86_panic("TXT_READ not handled"); 72 } 73 else if (type == TXT_WRITE || type == TXT_SYNC_WRITE) // busy waiting strategy for calling thread 74 { 75 uint32_t i; 76 77 // get source buffer extended pointer & bytes count 78 uint32_t count = hal_remote_lw ( XPTR( th_cxy , &th_ptr->command.txt.count ) ); 79 xptr_t buf_xp = hal_remote_lwd( XPTR( th_cxy , &th_ptr->command.txt.buf_xp ) ); 80 81 // loop on characters 82 for (i = 0; i < count; i++) 83 { 84 // get one byte from command buffer in client cluster 85 char byte = (char)hal_remote_lb( buf_xp + i ); 86 87 // VGA output (for now) 88 x86_putc(byte); 89 } 90 } 40 91 } 41 92 … … 44 95 // Cette ISR est juste utile pour le clavier; on arrive ici quand une touche 45 96 // est pressée 97 x86_panic("soclib_tty_isr not handled"); 46 98 } 47 99
Note: See TracChangeset
for help on using the changeset viewer.