Changeset 66 for trunk/kernel/drivers/soclib/soclib_tty.c
- Timestamp:
- Jun 27, 2017, 9:56:10 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/drivers/soclib/soclib_tty.c
r4 r66 33 33 { 34 34 // get extended pointer on TTY-SOCLIB peripheral base address 35 xptr_t tty_xp = chdev->base; 35 xptr_t tty_xp = chdev->base; 36 36 37 37 // get SOCLIB_TTY device cluster and local pointer 38 38 cxy_t tty_cxy = GET_CXY( tty_xp ); 39 39 uint32_t * tty_ptr = (uint32_t *)GET_PTR( tty_xp ); 40 40 41 41 // mask both TTY_RX_IRQ and TTY_TX_IRQ 42 42 hal_remote_sw( XPTR( tty_cxy , tty_ptr + TTY_CONFIG_REG ) , 0 ); 43 44 } // soclib_tty_init() 43 } 45 44 46 45 ////////////////////////////////////////////////////////////// … … 54 53 uint32_t type = hal_remote_lw ( XPTR( th_cxy , &th_ptr->command.txt.type ) ); 55 54 xptr_t dev_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->command.txt.dev_xp ) ); 56 55 57 56 // get TXT device cluster and local pointer 58 57 cxy_t dev_cxy = GET_CXY( dev_xp ); … … 70 69 uint32_t * base = tty_ptr + TTY_SPAN * channel; 71 70 72 if( type == TXT_READ ) // descheduling strategy for calling th ead71 if( type == TXT_READ ) // descheduling strategy for calling thread 73 72 { 74 73 // unmask RX_IRQ (data transfer will be done by the TTY_RX ISR) … … 78 77 hal_remote_atomic_cas( config_xp , old , new ); 79 78 80 // Block and deschedule server thread 79 // Block and deschedule server thread 81 80 thread_block( CURRENT_THREAD , THREAD_BLOCKED_DEV_ISR ); 82 81 sched_yield(); … … 90 89 hal_remote_atomic_cas( config_xp , old , new ); 91 90 92 // Block and deschedule server thread 91 // Block and deschedule server thread 93 92 thread_block( CURRENT_THREAD , THREAD_BLOCKED_DEV_ISR ); 94 93 sched_yield(); … … 96 95 else if( type == TXT_SYNC_WRITE ) // busy waiting strategy for calling thread 97 96 { 98 uint32_t status; 97 uint32_t status; 99 98 bool_t empty; 100 99 uint32_t i; … … 104 103 xptr_t buf_xp = hal_remote_lwd( XPTR( th_cxy , &th_ptr->command.txt.buf_xp ) ); 105 104 106 // loop on characters 105 // loop on characters 107 106 for( i = 0 ; i < count ; i++ ) 108 { 107 { 109 108 do 110 109 { … … 121 120 hal_remote_sb( XPTR( tty_cxy , base + TTY_WRITE_REG ) , byte ); 122 121 } 123 } 122 } 124 123 while ( empty == false ); 125 124 } 126 125 } 127 } // soclib_tty_command() 128 126 } 129 127 130 128 ///////////////////////////////////////////////////////////////// … … 193 191 else if( type == TXT_WRITE ) // write a string 194 192 { 195 // loop on characters 193 // loop on characters 196 194 for( i = 0 ; i < count ; i++ ) 197 { 195 { 198 196 // get TTY_STATUS_REG 199 197 status = hal_remote_lw( XPTR( tty_cxy , base + TTY_STATUS_REG ) ); … … 209 207 else // TTY_TX full => update command arguments and exit ISR for retry 210 208 { 211 hal_remote_sw ( XPTR( client_cxy , &client_ptr->command.txt.count ), count-i ); 209 hal_remote_sw ( XPTR( client_cxy , &client_ptr->command.txt.count ), count-i ); 212 210 hal_remote_swd( XPTR( client_cxy , &client_ptr->command.txt.buf_xp ), buf_xp+i ); 213 211 return; … … 229 227 // unblock client thread 230 228 thread_unblock( client_xp , THREAD_BLOCKED_IO ); 231 232 } // soclib_tty_isr() 233 234 229 } 230
Note: See TracChangeset
for help on using the changeset viewer.