Changeset 14 for trunk/kernel/devices
- Timestamp:
- May 3, 2017, 1:23:24 PM (8 years ago)
- Location:
- trunk/kernel/devices
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/devices/dev_dma.h
r3 r14 25 25 #define _DEV_DMA_H_ 26 26 27 #include < almos_config.h>27 #include <kernel_config.h> 28 28 #include <hal_types.h> 29 29 #include <spinlock.h> -
trunk/kernel/devices/dev_fbf.c
r3 r14 22 22 */ 23 23 24 #include < almos_config.h>24 #include <kernel_config.h> 25 25 #include <hal_types.h> 26 26 #include <hal_gpt.h> -
trunk/kernel/devices/dev_icu.c
r3 r14 82 82 if( irq_type == HWI_TYPE ) 83 83 { 84 assert( (irq_index < icu->ext.icu.hwi_nr) , __FUNCTION__ , "illegal HWI" ); 85 } 86 if( irq_type == WTI_TYPE ) 87 { 88 assert( (irq_index < icu->ext.icu.wti_nr) , __FUNCTION__ , "illegal WTI" ); 89 } 90 if( irq_type == PTI_TYPE ) 91 { 92 assert( (irq_index < icu->ext.icu.pti_nr) , __FUNCTION__ , "illegal PTI" ); 84 if( irq_index >= icu->ext.icu.hwi_nr ) 85 { 86 printk("\n[PANIC] in %s : illegal HWI index = %d / max = %d\n", 87 __FUNCTION__ , irq_index , icu->ext.icu.hwi_nr ); 88 hal_core_sleep(); 89 } 90 } 91 else if( irq_type == WTI_TYPE ) 92 { 93 if( irq_index >= icu->ext.icu.wti_nr ) 94 { 95 printk("\n[PANIC] in %s : illegal WTI index = %d / max = %d\n", 96 __FUNCTION__ , irq_index , icu->ext.icu.wti_nr ); 97 hal_core_sleep(); 98 } 99 } 100 else // irq_type == PTI_TYPE 101 { 102 if( irq_index >= icu->ext.icu.pti_nr ) 103 { 104 printk("\n[PANIC] in %s : illegal PTI index = %d / max = %d\n", 105 __FUNCTION__ , irq_index , icu->ext.icu.pti_nr ); 106 hal_core_sleep(); 107 } 93 108 } 94 109 } // end dev_icu_check_irq() … … 107 122 dev_icu_check_irq( icu , irq_type , irq_index ); 108 123 109 // (1)call implementation specific ICU driver to enable IRQ124 // call implementation specific ICU driver to enable IRQ 110 125 if( icu->impl == IMPL_ICU_XCU ) 111 126 { 112 soclib_xcu_enable_irq( icu , 1<<irq_index , irq_type , lid ); 113 } 114 115 // (2) get selected core local pointer, and register 116 // source chdev pointer in relevant interrupt vector 117 core_t * core = &LOCAL_CLUSTER->core_tbl[lid]; 118 core_set_irq_vector_entry( core , irq_type , irq_index , src_chdev ); 119 120 // (3) register IRQ type and index in source chdev descriptor 121 src_chdev->irq_type = irq_type; 122 src_chdev->irq_id = irq_index; 123 127 soclib_xcu_enable_irq( icu , 1<<irq_index , irq_type , lid ); 128 } 129 130 // This is only done for an HWI, or for a WTI that is not an IPI 131 if( (irq_type != PTI_TYPE) && (src_chdev != NULL) ) 132 { 133 // get selected core local pointer, and register 134 // source chdev pointer in relevant interrupt vector 135 core_t * core = &LOCAL_CLUSTER->core_tbl[lid]; 136 core_set_irq_vector_entry( core , irq_type , irq_index , src_chdev ); 137 138 // (3) register IRQ type and index in source chdev descriptor 139 src_chdev->irq_type = irq_type; 140 src_chdev->irq_id = irq_index; 141 } 124 142 } // end dev_icu_enable_irq() 125 143 … … 136 154 dev_icu_check_irq( icu , irq_type , irq_index ); 137 155 138 // (1)call the implementation specific ICU driver to disable IRQ156 // call the implementation specific ICU driver to disable IRQ 139 157 if( icu->impl == IMPL_ICU_XCU ) 140 158 { … … 142 160 } 143 161 144 // (2) get selected remote core local pointer, and remove 145 // the source chdev xptr from relevant interrupt vector 146 147 core_t * core = &LOCAL_CLUSTER->core_tbl[lid]; 148 core_set_irq_vector_entry( core , irq_type , irq_index , NULL ); 149 162 // This is only done for HWI or WTI that are not IPI 163 if( irq_type != PTI_TYPE ) 164 { 165 // get selected remote core local pointer, and remove 166 // the source chdev xptr from relevant interrupt vector 167 core_t * core = &LOCAL_CLUSTER->core_tbl[lid]; 168 core_set_irq_vector_entry( core , irq_type , irq_index , NULL ); 169 } 150 170 } // end dev_icu_disable_irq() 171 172 /////////////////////////////////////// 173 void dev_icu_get_masks( lid_t lid, 174 uint32_t * hwi_mask, 175 uint32_t * wti_mask, 176 uint32_t * pti_mask ) 177 { 178 // get local pointer on local ICU chdev 179 xptr_t icu_xp = chdev_dir.icu[local_cxy]; 180 chdev_t * icu = (chdev_t *)GET_PTR( icu_xp ); 181 182 if( icu->impl == IMPL_ICU_XCU ) 183 { 184 soclib_xcu_get_masks( icu , lid , hwi_mask , wti_mask , pti_mask ); 185 } 186 } 151 187 152 188 ////////////////////////////////////////////// … … 312 348 dev_icu_ack_timer( index ); 313 349 314 // TODO execute all actions related to TICK event 315 core_clock( core ); 350 if( index < LOCAL_CLUSTER->cores_nr ) // its a TICK event 351 { 352 // TODO execute all actions related to TICK event 353 core_clock( core ); 354 } 355 else 356 { 357 printk("\n[WARNING] in %s : no handler for PTI %d on core %d in cluster %x\n", 358 __FUNCTION__ , index , core->lid , local_cxy ); 359 core->spurious_irqs ++; 360 dev_icu_disable_irq( core->lid , PTI_TYPE , index ); 361 } 316 362 } 317 363 } // end dev_icu_irq_handler() … … 340 386 // release lock 341 387 spinlock_unlock( lock ); 342 388 343 389 return index; 344 390 } // end dev_icu_wti_alloc() -
trunk/kernel/devices/dev_icu.h
r3 r14 25 25 #define _DEV_ICU_H_ 26 26 27 #include < almos_config.h>27 #include <kernel_config.h> 28 28 #include <hal_types.h> 29 29 #include <spinlock.h> … … 179 179 uint32_t irq_type, 180 180 uint32_t irq_id ); 181 181 182 /***************************************************************************************** 183 * This function returns the set of enabled IRQs for a given core. 184 ***************************************************************************************** 185 * @ lid : local index of selected core in remote cluster. 186 * @ hwi_mask : each non zero bit define an enabled HWI IRQ. 187 * @ wti_mask : each non zero bit define an enabled WTI IRQ. 188 * @ pti_mask : each non zero bit define an enabled PTI IRQ. 189 ****************************************************************************************/ 190 void dev_icu_get_masks( lid_t lid, 191 uint32_t * hwi_mask, 192 uint32_t * WTi_mask, 193 uint32_t * pti_mask ); 194 182 195 /***************************************************************************************** 183 196 * This function set the period value for a timer identified by the PTI index, -
trunk/kernel/devices/dev_iob.c
r3 r14 22 22 */ 23 23 24 #include < almos_config.h>24 #include <kernel_config.h> 25 25 #include <hal_types.h> 26 26 #include <hal_special.h> -
trunk/kernel/devices/dev_iob.h
r3 r14 25 25 #define _DEV_IOB_H_ 26 26 27 #include < almos_config.h>27 #include <kernel_config.h> 28 28 #include <hal_types.h> 29 29 #include <spinlock.h> -
trunk/kernel/devices/dev_ioc.c
r3 r14 22 22 */ 23 23 24 #include < almos_config.h>24 #include <kernel_config.h> 25 25 #include <hal_types.h> 26 26 #include <hal_gpt.h> -
trunk/kernel/devices/dev_ioc.h
r3 r14 25 25 #define _DEV_IOC_H 26 26 27 #include < almos_config.h>27 #include <kernel_config.h> 28 28 #include <hal_types.h> 29 29 -
trunk/kernel/devices/dev_mmc.c
r3 r14 55 55 assert( false , __FUNCTION__ , "undefined MMC device implementation" ); 56 56 } 57 58 // get MMC HWI IRQ index 59 uint32_t hwi_id = chdev_icu_input.mmc; 60 61 // enable HWI IRQ to CP0 in local ICU, and update interrupt vector 62 dev_icu_enable_irq( 0 , HWI_TYPE , hwi_id , chdev ); 63 57 64 } // end dev_mmc_init() 58 65 -
trunk/kernel/devices/dev_mmc.h
r3 r14 25 25 #define _DEV_MMC_H_ 26 26 27 #include < almos_config.h>27 #include <kernel_config.h> 28 28 #include <hal_types.h> 29 29 #include <spinlock.h> -
trunk/kernel/devices/dev_nic.h
r3 r14 25 25 #define _DEV_NIC_H 26 26 27 #include < almos_config.h>27 #include <kernel_config.h> 28 28 #include <hal_types.h> 29 29 -
trunk/kernel/devices/dev_pic.h
r3 r14 25 25 #define _DEV_PIC_H_ 26 26 27 #include < almos_config.h>27 #include <kernel_config.h> 28 28 #include <hal_types.h> 29 29 -
trunk/kernel/devices/dev_txt.c
r3 r14 158 158 uint32_t count ) 159 159 { 160 uint32_t save_sr; 161 160 162 // get pointer on calling thread 161 163 thread_t * this = CURRENT_THREAD; … … 175 177 dev_cmd_t * cmd = (dev_cmd_t *)hal_remote_lpt( XPTR( dev_cxy , &dev_ptr->cmd ) ); 176 178 177 // call directly driver command after taking chdev lock 178 remote_spinlock_lock( XPTR( dev_cxy , &dev_ptr->wait_lock ) ); 179 // call directly driver command 179 180 cmd( XPTR( local_cxy , this ) ); 180 remote_spinlock_unlock( XPTR( dev_cxy , &dev_ptr->wait_lock ) );181 181 182 182 // return I/O operation status from calling thread descriptor -
trunk/kernel/devices/dev_txt.h
r3 r14 25 25 #define _DEV_TXT_H_ 26 26 27 #include < almos_config.h>27 #include <kernel_config.h> 28 28 #include <hal_types.h> 29 29 … … 80 80 /****************************************************************************************** 81 81 * This function completes the TXT chdev descriptor initialisation, 82 * namely the link with the implementation specific driver.82 i * namely the link with the implementation specific driver. 83 83 * The func, impl, channel, is_rxt, base fields have been previously initialised. 84 84 * It calls the specific driver initialisation function, to initialise the hardware
Note: See TracChangeset
for help on using the changeset viewer.