Changeset 279 for trunk/hal/tsar_mips32/drivers/soclib_pic.c
- Timestamp:
- Jul 27, 2017, 12:23:29 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/drivers/soclib_pic.c
r205 r279 83 83 } 84 84 85 86 //////////////////////////////////////////87 uint32_t soclib_pic_ack_timer( lid_t lid )88 {89 // get local XCU segment base90 uint32_t * base = soclib_pic_xcu_base();91 92 // read from register93 return base[(XCU_PTI_ACK << 5) | lid];94 95 } // end soclib_pic_ack_timer()96 97 85 /////////////////////////////////////////// 98 86 void soclib_pic_xcu_status( lid_t lid, … … 113 101 } 114 102 103 //////////////////////////////////////////////////// 104 inline uint32_t soclib_pic_xcu_ack( uint32_t * reg ) 105 { 106 return *reg; 107 } 108 115 109 ///////////////////////////// 116 110 void soclib_pic_irq_handler() … … 120 114 uint32_t pti_status; // PTI index + 1 / no pending PTI if 0 121 115 chdev_t * src_chdev; // pointer on source chdev descriptor 122 uint32_t index; // IRQ index 116 uint32_t index; // WTI / HWI / PTI index 117 uint32_t ack; // XCU acknowledge requires a read... 123 118 124 119 core_t * core = CURRENT_THREAD->core; … … 130 125 &pti_status ); 131 126 127 irq_dmsg("\n[INFO] %s : enter / WTI_STS = %x / HWI_STS = %x / WTI_STS = %x\n", 128 __FUNCTION__ , wti_status , hwi_status , pti_status ); 129 132 130 // analyse status and handle up to 3 pending IRQ (one WTI, one HWI, one PTI) 133 131 … … 140 138 assert( (index == core->lid) , __FUNCTION__ , "illegal IPI index" ); 141 139 142 // TODO acknowledge WTI [AG] 143 144 // TODO force scheduling [AG] 140 // acknowledge WTI 141 uint32_t * base = soclib_pic_xcu_base(); 142 ack = base[(XCU_WTI_REG << 5) | core->lid]; 143 144 // force scheduling 145 sched_yield(); 145 146 } 146 147 else // it is an external device … … 156 157 core->spurious_irqs ++; 157 158 158 // TODO disable this WTI in local XCU [AG] 159 // disable WTI in local XCU controller 160 uint32_t * base = soclib_pic_xcu_base(); 161 base[(XCU_MSK_WTI_DISABLE << 5) | core->lid] = 1 << core->lid; 159 162 } 160 163 else // call relevant ISR … … 183 186 core->spurious_irqs ++; 184 187 185 // TODO disable this HWI in local XCU [AG] 188 // disable HWI in local XCU controller 189 uint32_t * base = soclib_pic_xcu_base(); 190 base[(XCU_MSK_HWI_DISABLE << 5) | core->lid] = 1 << core->lid; 186 191 } 187 192 else // call relevant ISR … … 205 210 206 211 // acknowledge PTI 207 soclib_pic_ack_timer( index ); 208 209 // TODO execute all actions related to TICK event 212 uint32_t * base = soclib_pic_xcu_base(); 213 ack = base[(XCU_PTI_ACK << 5) | core->lid]; 214 215 // execute all actions related to TICK event 210 216 core_clock( core ); 211 217 } … … 431 437 else if( irq_type == SOCLIB_TYPE_WTI ) 432 438 { 433 // enable this WTI in localXCU controller439 // enable this WTI in remote XCU controller 434 440 hal_remote_sw( XPTR( src_chdev_cxy , 435 441 &seg_xcu_ptr[(XCU_MSK_WTI_ENABLE << 5) | lid] ) , (1 << irq_id) ); … … 464 470 else if( irq_type == SOCLIB_TYPE_WTI ) 465 471 { 466 // enable this WTI in localXCU controller472 // enable this WTI in remote XCU controller 467 473 hal_remote_sw( XPTR( src_chdev_cxy , 468 474 &seg_xcu_ptr[(XCU_MSK_WTI_DISABLE << 5) | lid] ) , (1 << irq_id) ); … … 486 492 base[(XCU_PTI_PER << 5) | lid] = period; 487 493 488 // enable thePTI in local XCU controller494 // enable PTI in local XCU controller 489 495 base[(XCU_MSK_PTI_ENABLE << 5) | lid] = 1 << lid; 496 } 497 498 //////////////////////////// 499 void soclib_pic_enable_ipi() 500 { 501 // calling core local index 502 lid_t lid = CURRENT_CORE->lid; 503 504 // get XCU segment base 505 uint32_t * base = soclib_pic_xcu_base(); 506 507 // enable WTI in local XCU controller 508 base[(XCU_MSK_WTI_ENABLE << 5) | lid] = 1 << lid; 490 509 } 491 510
Note: See TracChangeset
for help on using the changeset viewer.