Changeset 3 for trunk/kernel/devices/dev_pic.c
- Timestamp:
- Apr 26, 2017, 2:08:13 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/devices/dev_pic.c
r1 r3 25 25 #include <hal_special.h> 26 26 #include <dev_icu.h> 27 #include < device.h>27 #include <chdev.h> 28 28 #include <memcpy.h> 29 29 #include <printk.h> … … 35 35 ///////////////////////////////////////////////////////////////////////////////////////// 36 36 37 extern devices_directory_t devices_dir; // allocated in kernel_init.c37 extern chdev_directory_t chdev_dir; // allocated in kernel_init.c 38 38 39 extern devices_input_irq_t devices_input_irq; // allocated in kernel_init.c 40 41 39 extern chdev_pic_input_t chdev_pic_input; // allocated in kernel_init.c 42 40 43 41 /////////////////////////////////// 44 void dev_pic_init( xptr_t dev_xp,45 uint32_t irq_nr )42 void dev_pic_init( chdev_t * chdev, 43 uint32_t irq_nr ) 46 44 { 47 // get PIC device cluster and local pointer 48 cxy_t dev_cxy = GET_CXY( dev_xp ); 49 device_t * dev_ptr = (device_t *)GET_PTR( dev_xp ); 45 // set PIC chdev extension field 46 chdev->ext.pic.irq_nr = irq_nr; 50 47 51 // set PIC device extension field52 dev_ptr->ext.pic.irq_nr = irq_nr;48 // get implementation 49 uint32_t impl = chdev->impl; 53 50 54 // get implementation index from PIC device descriptor 55 uint32_t impl = hal_remote_lw( XPTR( dev_cxy , &dev_ptr->impl ) ); 56 57 // set the "name" field in PIC device descriptor 58 // and call the relevant driver init function 51 // call the relevant driver init function 59 52 if( impl == IMPL_PIC_SOC ) 60 53 { 61 memcpy( dev_ptr->name , "PIC_TSR" , 16 ); 62 soclib_pic_init( dev_xp ); 54 soclib_pic_init( chdev ); 63 55 } 64 56 else 65 57 { 66 printk("PANIC in %s: illegal PIC device implementation\n", __FUNCTION__ ); 67 hal_core_sleep(); 58 assert( false , __FUNCTION__ , "illegal PIC device implementation" ); 68 59 } 69 60 } // end dev_pic_init() … … 75 66 { 76 67 // get extended pointer on WTI mailbox 77 xptr_t wti_xp = dev_icu_wti_xptr( cxy , wti_id);68 xptr_t wti_xp = XPTR( cxy , dev_icu_wti_ptr( wti_id ) ); 78 69 79 // get extended pointer on PIC devicefrom directory80 xptr_t dev_xp = devices_dir.pic;70 // get extended pointer on PIC chdev from directory 71 xptr_t dev_xp = chdev_dir.pic; 81 72 82 // get PIC devicecluster and local pointer83 cxy_t 84 device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );73 // get PIC chdev cluster and local pointer 74 cxy_t dev_cxy = GET_CXY( dev_xp ); 75 chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp ); 85 76 86 77 // get implementation index and segment base … … 92 83 soclib_pic_bind_irq( dev_xp , irq_id , wti_xp ); 93 84 } 94 else95 {96 printk("PANIC in %s: illegal PIC device implementation\n", __FUNCTION__ );97 hal_core_sleep();98 }99 85 } // end dev_pic_link_wti() 100 86 … … 102 88 void dev_pic_unbind_irq( uint32_t irq_id ) 103 89 { 104 // get extended pointer on PIC devicefrom directory105 xptr_t dev_xp = devices_dir.pic;90 // get extended pointer on PIC chdev from directory 91 xptr_t dev_xp = chdev_dir.pic; 106 92 107 // get PIC devicecluster and local pointer108 cxy_t 109 device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );93 // get PIC chdev cluster and local pointer 94 cxy_t dev_cxy = GET_CXY( dev_xp ); 95 chdev_t * dev_ptr = (chdev_t *)GET_PTR( dev_xp ); 110 96 111 97 // get implementation index … … 117 103 soclib_pic_unbind_irq( dev_xp , irq_id ); 118 104 } 119 else120 {121 printk("PANIC in %s: illegal PIC device implementation\n", __FUNCTION__ );122 hal_core_sleep();123 }124 125 105 } // end dev_pic_disable_irq() 126 106
Note: See TracChangeset
for help on using the changeset viewer.