Changeset 407 for trunk/hal/tsar_mips32/drivers
- Timestamp:
- Nov 7, 2017, 3:08:12 PM (7 years ago)
- Location:
- trunk/hal/tsar_mips32/drivers
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/drivers/soclib_bdv.c
r296 r407 104 104 105 105 // waiting policy depends on the command type 106 // - for IOC_READ / IOC_WRITE commands, this function is called by the server thread 107 // - for IOC_SYNC_READ command, this function is directly called by the client thread 106 108 107 if( cmd_type == IOC_SYNC_READ ) //polling policy109 if( cmd_type == IOC_SYNC_READ ) // status polling policy 108 110 { 109 111 uint32_t status; … … 131 133 { 132 134 thread_block( CURRENT_THREAD , THREAD_BLOCKED_DEV_ISR ); 133 sched_yield( NULL ); 135 sched_yield(); 136 137 // the IO operation status is reported in the command by the ISR 134 138 } 135 139 -
trunk/hal/tsar_mips32/drivers/soclib_dma.c
r296 r407 91 91 // Block and deschedule server thread 92 92 thread_block( CURRENT_THREAD , THREAD_BLOCKED_DEV_ISR ); 93 sched_yield( NULL);93 sched_yield(); 94 94 95 95 } // soclib_dma_cmd() -
trunk/hal/tsar_mips32/drivers/soclib_hba.c
r296 r407 197 197 else // retry if asynchronous access. 198 198 { 199 sched_yield( NULL);199 sched_yield(); 200 200 } 201 201 } … … 240 240 { 241 241 thread_block( CURRENT_THREAD , THREAD_BLOCKED_DEV_ISR ); 242 sched_yield( NULL);242 sched_yield(); 243 243 } 244 244 -
trunk/hal/tsar_mips32/drivers/soclib_pic.c
r406 r407 43 43 extern lapic_input_t lapic_input; // defined in dev_pic.h / allocated in kernel_init.c 44 44 45 46 45 47 ////////////////////////////////////////////////////////////////////////////////////// 46 48 // SOCLIB PIC private functions … … 127 129 &pti_status ); 128 130 129 irq_dmsg("\n[D MSG] %s : enter for core[%x,%d]/ WTI = %x / HWI = %x / WTI = %x\n",131 irq_dmsg("\n[DBG] %s : core[%x,%d] enter / WTI = %x / HWI = %x / WTI = %x\n", 130 132 __FUNCTION__ , local_cxy , core->lid , wti_status , hwi_status , pti_status ); 131 133 … … 140 142 assert( (index == core->lid) , __FUNCTION__ , "illegal IPI index" ); 141 143 142 irq_dmsg("\n[D MSG] %s : core[%x,%d] received an IPI / cycle %d\n",144 irq_dmsg("\n[DBG] %s : core[%x,%d] received an IPI / cycle %d\n", 143 145 __FUNCTION__ , local_cxy , core->lid , hal_time_stamp() ); 144 146 … … 168 170 else // call relevant ISR 169 171 { 170 irq_dmsg("\n[D MSG] %s : core[%x,%d] received external WTI %d / cycle %d\n",172 irq_dmsg("\n[DBG] %s : core[%x,%d] received external WTI %d / cycle %d\n", 171 173 __FUNCTION__ , local_cxy , core->lid , index , hal_time_stamp() ); 172 174 … … 196 198 else // call relevant ISR 197 199 { 198 irq_dmsg("\n[D MSG] %s : core[%x,%d] received HWI %d / cycle %d\n",200 irq_dmsg("\n[DBG] %s : core[%x,%d] received HWI %d / cycle %d\n", 199 201 __FUNCTION__ , local_cxy , core->lid , index , hal_time_stamp() ); 200 202 … … 208 210 index = pti_status - 1; 209 211 210 irq_dmsg("\n[D MSG] %s : core[%x,%d] received PTI %d / cycle %d\n",212 irq_dmsg("\n[DBG] %s : core[%x,%d] received PTI %d / cycle %d\n", 211 213 __FUNCTION__ , core->lid , local_cxy , index , hal_time_stamp() ); 212 214 … … 248 250 uint32_t * iopic_seg_ptr = (uint32_t *)GET_PTR( pic->base ); 249 251 250 // reset the IOPIC component registers : maskall input IRQs252 // reset the IOPIC component registers : disable all input IRQs 251 253 for( i = 0 ; i < CONFIG_MAX_EXTERNAL_IRQS ; i++ ) 252 254 { … … 364 366 { 365 367 // get external IRQ index 366 uint32_t irq_id; 367 if ( func == DEV_FUNC_IOC ) irq_id = iopic_input.ioc[channel]; 368 else if( func == DEV_FUNC_TXT ) irq_id = iopic_input.txt[channel]; 369 else if( (func == DEV_FUNC_NIC) && is_rx ) irq_id = iopic_input.nic_rx[channel]; 370 else if( (func == DEV_FUNC_NIC) && !is_rx ) irq_id = iopic_input.nic_tx[channel]; 371 else if( func == DEV_FUNC_IOB ) irq_id = iopic_input.iob; 368 uint32_t hwi_id; 369 if ( func == DEV_FUNC_IOC ) hwi_id = iopic_input.ioc[channel]; 370 else if( func == DEV_FUNC_TXT && is_rx ) hwi_id = iopic_input.txt_rx[channel]; 371 else if( func == DEV_FUNC_TXT && !is_rx ) hwi_id = iopic_input.txt_tx[channel]; 372 else if( (func == DEV_FUNC_NIC) && is_rx ) hwi_id = iopic_input.nic_rx[channel]; 373 else if( (func == DEV_FUNC_NIC) && !is_rx ) hwi_id = iopic_input.nic_tx[channel]; 374 else if( func == DEV_FUNC_IOB ) hwi_id = iopic_input.iob; 372 375 else assert( false , __FUNCTION__ , "illegal device functionnal type\n"); 373 376 … … 385 388 uint32_t lsb_wdata = (uint32_t)wti_xp; 386 389 uint32_t msb_wdata = (uint32_t)(wti_xp >> 32); 387 xptr_t lsb_xp = XPTR( seg_pic_cxy , seg_pic_ptr+ irq_id*IOPIC_SPAN+IOPIC_ADDRESS );388 xptr_t msb_xp = XPTR( seg_pic_cxy , seg_pic_ptr+ irq_id*IOPIC_SPAN+IOPIC_EXTEND );390 xptr_t lsb_xp = XPTR( seg_pic_cxy , seg_pic_ptr+hwi_id*IOPIC_SPAN+IOPIC_ADDRESS ); 391 xptr_t msb_xp = XPTR( seg_pic_cxy , seg_pic_ptr+hwi_id*IOPIC_SPAN+IOPIC_EXTEND ); 389 392 hal_remote_sw( lsb_xp , lsb_wdata ); 390 393 hal_remote_sw( msb_xp , msb_wdata ); 391 394 392 // unmaskIRQ in IOPIC393 hal_remote_sw( XPTR( seg_pic_cxy , seg_pic_ptr+ irq_id*IOPIC_SPAN+IOPIC_MASK ), 1 );395 // enable IRQ in IOPIC 396 hal_remote_sw( XPTR( seg_pic_cxy , seg_pic_ptr+hwi_id*IOPIC_SPAN+IOPIC_MASK ), 1 ); 394 397 395 398 // update the WTI interrupt vector for core[lid] 396 399 core_t * core = &LOCAL_CLUSTER->core_tbl[lid]; 397 400 ((soclib_pic_core_t *)core->pic_extend)->wti_vector[wti_id] = src_chdev; 401 402 pic_dmsg("\n[DBG] %s : %s / channel = %d / rx = %d / hwi_id = %d / wti_id = %d / cluster = %x\n", 403 __FUNCTION__ , chdev_func_str( func ) , channel , is_rx , hwi_id , wti_id , local_cxy ); 404 398 405 } 399 406 else if( (func == DEV_FUNC_DMA) || (func == DEV_FUNC_MMC) ) // internal IRQ => HWI … … 411 418 core_t * core = &LOCAL_CLUSTER->core_tbl[lid]; 412 419 ((soclib_pic_core_t *)core->pic_extend)->wti_vector[hwi_id] = src_chdev; 420 421 pic_dmsg("\n[DBG] %s : %s / channel = %d / hwi_id = %d / cluster = %x\n", 422 __FUNCTION__ , chdev_func_str( func ) , channel , hwi_id , local_cxy ); 423 413 424 } 414 425 else … … 494 505 495 506 // set period value in XCU (in cycles) 496 uint32_t cycles = period * SOCLIB_CYCLES_PER_MS * CONFIG_SCHED_TICK_MS_PERIOD;507 uint32_t cycles = period * SOCLIB_CYCLES_PER_MS; 497 508 base[(XCU_PTI_PER << 5) | lid] = cycles; 498 509 … … 525 536 } 526 537 527 528 538 ///////////////////////// 539 void soclib_pic_ack_ipi() 540 { 541 // get calling core local index 542 lid_t lid = CURRENT_THREAD->core->lid; 543 544 // get pointer on local XCU segment base 545 uint32_t * base = soclib_pic_xcu_base(); 546 547 // acknowlege IPI 548 uint32_t ack = base[(XCU_WTI_REG << 5) | lid]; 549 550 // we must make a fake use for ack value to avoid a warning 551 if( (ack + 1) == 0 ) panic("this should never happen"); 552 } 553 554 -
trunk/hal/tsar_mips32/drivers/soclib_pic.h
r380 r407 1 1 /* 2 * soclib_pic. c- soclib PIC driver definition.2 * soclib_pic.h - soclib PIC driver definition. 3 3 * 4 4 * Author Alain Greiner (2016,2017) … … 90 90 #define SOCLIB_MAX_PTI 16 91 91 92 #define SOCLIB_CYCLES_PER_MS 1000 // for a SystemC virtual prototype92 #define SOCLIB_CYCLES_PER_MS 60 // SystemC virtual prototype at 60 KHz 93 93 94 94 /****************************************************************************************** … … 238 238 239 239 /****************************************************************************************** 240 * This function activates the WTI[lid] in the local cluster, where helid is the calling240 * This function activates the WTI[lid] in the local cluster, where lid is the calling 241 241 * core local index. 242 242 *****************************************************************************************/ … … 252 252 void soclib_pic_send_ipi( cxy_t cxy, 253 253 lid_t lid ); 254 255 /****************************************************************************************** 256 * This function acknowleges the WTI[lid] in the local cluster, where lid is the calling 257 * core local index. 258 *****************************************************************************************/ 259 void soclib_pic_ack_ipi(); 254 260 255 261 -
trunk/hal/tsar_mips32/drivers/soclib_tty.c
r296 r407 27 27 #include <remote_spinlock.h> 28 28 #include <thread.h> 29 #include <printk.h> 29 30 #include <hal_special.h> 31 32 #if CONFIG_READ_DEBUG 33 extern uint32_t enter_tty_cmd; 34 extern uint32_t exit_tty_cmd; 35 36 extern uint32_t enter_tty_isr; 37 extern uint32_t exit_tty_isr; 38 #endif 30 39 31 40 /////////////////////////////////////// 32 41 void soclib_tty_init( chdev_t * chdev ) 33 42 { 43 xptr_t reg_xp; 44 34 45 chdev->cmd = &soclib_tty_cmd; 35 46 chdev->isr = &soclib_tty_isr; 36 37 // get extended pointer on TTY-SOCLIB peripheral base address 38 xptr_t tty_xp = chdev->base; 47 chdev->aux = &soclib_tty_aux; 48 49 // get TTY channel and extended pointer on TTY peripheral base address 50 xptr_t tty_xp = chdev->base; 51 uint32_t channel = chdev->channel; 39 52 40 53 // get SOCLIB_TTY device cluster and local pointer … … 42 55 uint32_t * tty_ptr = (uint32_t *)GET_PTR( tty_xp ); 43 56 44 // mask both TTY_RX_IRQ and TTY_TX_IRQ 45 hal_remote_sw( XPTR( tty_cxy , tty_ptr + TTY_CONFIG_REG ) , 0 ); 57 // reset TTY_RX_IRQ_ENABLE 58 reg_xp = XPTR( tty_cxy , tty_ptr + (channel * TTY_SPAN) + TTY_RX_IRQ_ENABLE ); 59 hal_remote_sw( reg_xp , 0 ); 60 61 // reset TTY_TX_IRQ_ENABLE 62 reg_xp = XPTR( tty_cxy , tty_ptr + (channel * TTY_SPAN) + TTY_TX_IRQ_ENABLE ); 63 hal_remote_sw( reg_xp , 0 ); 46 64 } 47 65 … … 49 67 void __attribute__ ((noinline)) soclib_tty_cmd( xptr_t th_xp ) 50 68 { 69 70 #if CONFIG_READ_DEBUG 71 enter_tty_cmd = hal_time_stamp(); 72 #endif 73 74 txt_dmsg("\n[DBG] %s : core[%x,%d] / DEV thread enter / cycle %d\n", 75 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , hal_time_stamp() ); 76 51 77 // get client thread cluster and local pointer 52 78 cxy_t th_cxy = GET_CXY( th_xp ); … … 57 83 xptr_t dev_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->txt_cmd.dev_xp ) ); 58 84 85 assert( (type == TXT_READ) || (type == TXT_WRITE) , __FUNCTION__, "illegal command type"); 86 59 87 // get TXT device cluster and local pointer 60 88 cxy_t dev_cxy = GET_CXY( dev_xp ); … … 72 100 uint32_t * base = tty_ptr + TTY_SPAN * channel; 73 101 74 if( type == TXT_READ ) // descheduling strategy for calling thread 102 // compute extended pointer on relevant TTY register 103 xptr_t reg_xp; 104 if( type == TXT_READ ) reg_xp = XPTR( tty_cxy , base + TTY_RX_IRQ_ENABLE ); 105 else reg_xp = XPTR( tty_cxy , base + TTY_TX_IRQ_ENABLE ); 106 107 // enable relevant IRQ : data transfer will be done by the TTY_RX ISR) 108 hal_remote_sw( reg_xp , 1 ); 109 110 txt_dmsg("\n[DBG] %s : core[%x,%d] DEV thread deschedule / cycle %d\n", 111 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , hal_time_stamp() ); 112 113 // Block and deschedule server thread 114 thread_block( CURRENT_THREAD , THREAD_BLOCKED_DEV_ISR ); 115 sched_yield(); 116 117 txt_dmsg("\n[DBG] %s : core[%x,%d] / DEV thread resume / cycle %d\n", 118 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , hal_time_stamp() ); 119 120 #if CONFIG_READ_DEBUG 121 exit_tty_cmd = hal_time_stamp(); 122 #endif 123 124 } // end soclib_tty_cmd() 125 126 ///////////////////////////////////////////////////////////// 127 void __attribute__ ((noinline)) soclib_tty_aux( void * args ) 128 { 129 uint32_t status; 130 bool_t empty; 131 uint32_t i; 132 133 xptr_t dev_xp = ((txt_aux_t *)args)->dev_xp; 134 char * buffer = ((txt_aux_t *)args)->buffer; 135 uint32_t count = ((txt_aux_t *)args)->count; 136 137 // get TXT0 chdev cluster and local pointer 138 cxy_t dev_cxy = GET_CXY( dev_xp ); 139 chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp ); 140 141 // get extended pointer on TTY channel base address 142 xptr_t tty_xp = (xptr_t)hal_remote_lwd( XPTR( dev_cxy , &dev_ptr->base ) ); 143 144 // get TTY channel segment cluster and local pointer 145 cxy_t tty_cxy = GET_CXY( tty_xp ); 146 uint32_t * tty_ptr = (uint32_t *)GET_PTR( tty_xp ); 147 148 // get extended pointers on TTY_WRITE & TTY_STATUS registers 149 xptr_t write_xp = XPTR( tty_cxy , tty_ptr + TTY_WRITE ); 150 xptr_t status_xp = XPTR( tty_cxy , tty_ptr + TTY_STATUS ); 151 152 // loop on characters (busy waiting strategy) 153 for( i = 0 ; i < count ; i++ ) 75 154 { 76 // unmask RX_IRQ (data transfer will be done by the TTY_RX ISR) 77 xptr_t config_xp = XPTR( tty_cxy , base + TTY_CONFIG_REG ); 78 uint32_t old = hal_remote_lw( config_xp ); 79 uint32_t new = old | TTY_CONFIG_RX_ENABLE; 80 hal_remote_atomic_cas( config_xp , old , new ); 81 82 // Block and deschedule server thread 83 thread_block( CURRENT_THREAD , THREAD_BLOCKED_DEV_ISR ); 84 sched_yield( NULL ); 155 do 156 { 157 // get TTY_STATUS 158 status = hal_remote_lw( status_xp ); 159 empty = ( (status & TTY_STATUS_TX_FULL) == 0 ); 160 161 // transfer one byte if TX buffer empty 162 if ( empty ) hal_remote_sb( write_xp , buffer[i] ); 163 } 164 while ( empty == false ); 85 165 } 86 else if( type == TXT_WRITE ) // descheduling strategy for calling thread 87 { 88 // unmask TX_IRQ (data transfer will be done by the TTY_TX ISR) 89 xptr_t config_xp = XPTR( tty_cxy , base + TTY_CONFIG_REG ); 90 uint32_t old = hal_remote_lw( config_xp ); 91 uint32_t new = old | TTY_CONFIG_TX_ENABLE; 92 hal_remote_atomic_cas( config_xp , old , new ); 93 94 // Block and deschedule server thread 95 thread_block( CURRENT_THREAD , THREAD_BLOCKED_DEV_ISR ); 96 sched_yield( NULL ); 97 } 98 else if( type == TXT_SYNC_WRITE ) // busy waiting strategy for calling thread 99 { 100 uint32_t status; 101 bool_t empty; 102 uint32_t i; 103 104 // get source buffer extended pointer & bytes count 105 uint32_t count = hal_remote_lw ( XPTR( th_cxy , &th_ptr->txt_cmd.count ) ); 106 xptr_t buf_xp = hal_remote_lwd( XPTR( th_cxy , &th_ptr->txt_cmd.buf_xp ) ); 107 108 // loop on characters 109 for( i = 0 ; i < count ; i++ ) 110 { 111 do 112 { 113 // get TTY_STATUS_REG 114 status = hal_remote_lw( XPTR( tty_cxy , base + TTY_STATUS_REG ) ); 115 empty = ( (status & TTY_STATUS_TX_FULL) == 0 ); 116 117 if ( empty ) // TTY_TX empty => transfer one byte 118 { 119 // get one byte from command buffer in client cluster 120 char byte = (char)hal_remote_lb( buf_xp + i ); 121 122 // write byte to TTY_WRITE_REG in TTY cluster 123 hal_remote_sb( XPTR( tty_cxy , base + TTY_WRITE_REG ) , byte ); 124 } 125 } 126 while ( empty == false ); 127 } 128 } 129 } // end soclib_tty_cmd() 166 } // end soclib_tty_aux() 130 167 131 168 … … 135 172 uint32_t type; // command type 136 173 uint32_t count; // number of bytes in buffer 137 xptr_t buf_xp; // Rextended pointer on buffer 174 xptr_t buf_xp; // extended pointer on buffer 175 xptr_t status_xp; // extended pointer on TTY_STATUS register 176 xptr_t write_xp; // extended pointer on TTY_WRITE register 177 xptr_t read_xp; // extended pointer on TTY_READ register 138 178 uint32_t status; // TTY terminal status 139 179 char byte; // read byte 140 180 uint32_t i; 181 182 #if CONFIG_READ_DEBUG 183 enter_tty_isr = hal_time_stamp(); 184 #endif 141 185 142 186 // get extended pointer on client thread … … 153 197 buf_xp = hal_remote_lwd( XPTR( client_cxy , &client_ptr->txt_cmd.buf_xp ) ); 154 198 199 txt_dmsg("\n[DBG] %s : core[%x,%d] enter / cycle %d\n", 200 __FUNCTION__ , local_cxy, CURRENT_THREAD->core->lid , hal_time_stamp() ); 201 155 202 // get SOCLIB_TTY peripheral cluster and local pointer 156 203 cxy_t tty_cxy = GET_CXY( chdev->base ); … … 160 207 uint32_t * base = tty_ptr + TTY_SPAN * chdev->channel; 161 208 209 // get extended pointer on TTY registers 210 status_xp = XPTR( tty_cxy , base + TTY_STATUS ); 211 write_xp = XPTR( tty_cxy , base + TTY_WRITE ); 212 read_xp = XPTR( tty_cxy , base + TTY_READ ); 213 162 214 if( type == TXT_READ ) // read one single character 163 215 { 164 // get TTY_STATUS _REG165 status = hal_remote_lw( XPTR( tty_cxy , base + TTY_STATUS_REG ));166 167 if( status & TTY_STATUS_RX_FULL ) // TTY_RX full => transferone byte168 { 169 // get a byte from TTY_READ _REG, and acknowledge RX_IRQ170 byte = (char)hal_remote_lb( XPTR( tty_cxy , base + TTY_READ_REG ));216 // get TTY_STATUS 217 status = hal_remote_lw( status_xp ); 218 219 if( status & TTY_STATUS_RX_FULL ) // TTY_RX full => move one byte 220 { 221 // get a byte from TTY_READ, and acknowledge RX_IRQ 222 byte = (char)hal_remote_lb( read_xp ); 171 223 172 224 // write it to command buffer 173 225 hal_remote_sb( buf_xp , byte ); 174 175 // update TTY_WRITE_REG if echo mode176 if( CONFIG_TXT_ECHO_MODE )177 {178 if( (byte == '\b') || (byte == 0x7F) )179 {180 hal_remote_sb( XPTR( tty_cxy , base + TTY_WRITE_REG ) , '\b' );181 hal_remote_sb( XPTR( tty_cxy , base + TTY_WRITE_REG ) , ' ' );182 hal_remote_sb( XPTR( tty_cxy , base + TTY_WRITE_REG ) , '\b' );183 }184 else185 {186 hal_remote_sw( XPTR( tty_cxy , base + TTY_WRITE_REG ) , byte );187 }188 }189 226 } 190 227 else // buffer empty => exit ISR for retry … … 192 229 return; 193 230 } 231 232 // disable RX_IRQ 233 xptr_t reg_xp = XPTR( tty_cxy , base + TTY_RX_IRQ_ENABLE ); 234 hal_remote_sw( reg_xp , 0 ); 194 235 } 195 else if( type == TXT_WRITE ) // write a string236 else if( type == TXT_WRITE ) // write all characters in string 196 237 { 197 238 // loop on characters 198 239 for( i = 0 ; i < count ; i++ ) 199 240 { 200 // get TTY_STATUS _REG201 status = hal_remote_lw( XPTR( tty_cxy , base + TTY_STATUS_REG ));202 203 if( (status & TTY_STATUS_TX_FULL) == 0 ) // TTY_TX empty => transferone byte241 // get TTY_STATUS 242 status = hal_remote_lw( status_xp ); 243 244 if( (status & TTY_STATUS_TX_FULL) == 0 ) // TTY_TX empty => move one byte 204 245 { 205 246 // get one byte from command buffer 206 247 byte = (char)hal_remote_lb( buf_xp + i ); 207 248 208 // write byte to TTY_WRITE _REG, and acknowledge TX_IRQ209 hal_remote_sb( XPTR( tty_cxy , base + TTY_STATUS_REG ), byte );249 // write byte to TTY_WRITE, and acknowledge TX_IRQ 250 hal_remote_sb( write_xp , byte ); 210 251 } 211 252 else // TTY_TX full => update command arguments and exit ISR for retry … … 216 257 } 217 258 } 259 260 // disable TX_IRQ 261 xptr_t reg_xp = XPTR( tty_cxy , base + TTY_TX_IRQ_ENABLE ); 262 hal_remote_sw( reg_xp , 0 ); 218 263 } 219 264 220 265 // The I/O operation completed when we reach this point 221 222 // mask both TTY_RX_IRQ and TTY_TX_IRQ223 hal_remote_sw( XPTR( tty_cxy , base + TTY_CONFIG_REG ) , 0 );224 266 225 267 // set I/O operation status in command … … 227 269 228 270 // unblock server thread 229 thread_unblock( XPTR( local_cxy , &chdev->server ) , THREAD_BLOCKED_DEV_ISR );271 thread_unblock( XPTR( local_cxy , chdev->server ) , THREAD_BLOCKED_DEV_ISR ); 230 272 231 273 // unblock client thread 232 274 thread_unblock( client_xp , THREAD_BLOCKED_IO ); 233 275 276 hal_fence(); 277 278 txt_dmsg("\n[DBG] %s : core[%x,%d] exit / cycle %d\n", 279 __FUNCTION__ , local_cxy , CURRENT_THREAD->core->lid , hal_time_stamp() ); 280 281 #if CONFIG_READ_DEBUG 282 exit_tty_isr = hal_time_stamp(); 283 #endif 284 234 285 } // end soclib_tty_isr() 235 286 -
trunk/hal/tsar_mips32/drivers/soclib_tty.h
r75 r407 38 38 ***************************************************************************************/ 39 39 40 #define TTY_WRITE_REG 0 41 #define TTY_STATUS_REG 1 42 #define TTY_READ_REG 2 43 #define TTY_CONFIG_REG 3 40 #define TTY_WRITE 0 41 #define TTY_STATUS 1 42 #define TTY_READ 2 43 #define TTY_RX_IRQ_ENABLE 3 44 #define TTY_TX_IRQ_ENABLE 4 44 45 45 #define TTY_SPAN 4// number of registers per channel46 #define TTY_SPAN 8 // number of registers per channel 46 47 47 48 /**************************************************************************************** … … 51 52 #define TTY_STATUS_RX_FULL 1 // TTY_READ_REG full if 1 52 53 #define TTY_STATUS_TX_FULL 2 // TTY_WRITE_REG full if 1 53 54 /****************************************************************************************55 * masks for TTY_CONFIG_REG56 ***************************************************************************************/57 58 #define TTY_CONFIG_RX_ENABLE 1 // TTY_RX IRQ enabled if 159 #define TTY_CONFIG_TX_ENABLE 2 // TTY_TX IRQ enabled if 160 54 61 55 /**************************************************************************************** … … 68 62 69 63 /**************************************************************************************** 70 * This function handles the command registered in the thread descriptor identified 71 * by the <xp_thread> argument. 72 * - For the TXT_READ and TXT_WRITE commands, it only unmask the proper TTY_RX / TTY_TX 73 * IRQ, and blocks the TXT device server thread on the THREAD_BLOCKED_DEV_ISR, as the 74 * data transfer is done by the ISR. 75 * - For the TXT_SYNC_READ command, that should be only used by the kernel do display 76 * log or debug messages, it directly access the SOCLIB_TTY registers, using 77 * a busy waiting policy if required. 78 **************************************************************************************** 64 * This function implements the TXT_READ & TXT_WRITE commands registered in the client 65 * thread descriptor (in the txt_cmd field), identified by the <xp_thread> argument. 66 * Depending on the command type, it only unmasks the relevant TTY_RX / TTY_TX IRQ, 67 * and blocks the TXT device server thread on the THREAD_BLOCKED_DEV_ISR, as the data 68 * transfer is done by the ISR. 69 * **************************************************************************************** 79 70 * @ thread_xp : extended pointer on client thread descriptor. 80 71 ***************************************************************************************/ 81 72 void soclib_tty_cmd( xptr_t thread_xp ); 73 74 /**************************************************************************************** 75 * This function implements the TXT_SYNC_WRITE command registered in the txt_aux_t 76 * structure, using a busy waiting policy, without using the TTY IRQ. 77 * It is used by the kernel do display debug messages on TXT0 terminal, without 78 * interference with another TXT access to another terminal done by the same thread. 79 **************************************************************************************** 80 * @ thread_xp : pointer on the txt_aux_t structure containing the arguments. 81 ***************************************************************************************/ 82 void soclib_tty_aux( void * args ); 82 83 83 84 /****************************************************************************************
Note: See TracChangeset
for help on using the changeset viewer.