Ignore:
Timestamp:
Apr 26, 2017, 2:08:13 PM (8 years ago)
Author:
alain
Message:

Introduce dev_fbf, dev dma, dev_iob

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/devices/dev_pic.c

    r1 r3  
    2525#include <hal_special.h>
    2626#include <dev_icu.h>
    27 #include <device.h>
     27#include <chdev.h>
    2828#include <memcpy.h>
    2929#include <printk.h>
     
    3535/////////////////////////////////////////////////////////////////////////////////////////
    3636
    37 extern devices_directory_t  devices_dir;         // allocated in kernel_init.c
     37extern chdev_directory_t  chdev_dir;         // allocated in kernel_init.c
    3838
    39 extern devices_input_irq_t  devices_input_irq;   // allocated in kernel_init.c
    40 
    41 
     39extern chdev_pic_input_t  chdev_pic_input;   // allocated in kernel_init.c
    4240
    4341///////////////////////////////////
    44 void dev_pic_init( xptr_t   dev_xp,
    45                    uint32_t irq_nr )
     42void dev_pic_init( chdev_t * chdev,
     43                   uint32_t  irq_nr )
    4644{
    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;
    5047
    51     // set PIC device extension field
    52     dev_ptr->ext.pic.irq_nr = irq_nr;
     48    // get implementation
     49    uint32_t impl = chdev->impl;
    5350
    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
    5952    if( impl == IMPL_PIC_SOC )
    6053    {
    61         memcpy( dev_ptr->name , "PIC_TSR" , 16 );
    62         soclib_pic_init( dev_xp );
     54        soclib_pic_init( chdev );
    6355    }
    6456    else
    6557    {
    66         printk("PANIC in %s: illegal PIC device implementation\n", __FUNCTION__ );
    67         hal_core_sleep();
     58        assert( false , __FUNCTION__ , "illegal PIC device implementation" );
    6859    }
    6960} // end dev_pic_init()
     
    7566{
    7667    // 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 ) );
    7869
    79     // get extended pointer on PIC device from directory
    80     xptr_t dev_xp = devices_dir.pic;
     70    // get extended pointer on PIC chdev from directory
     71    xptr_t dev_xp = chdev_dir.pic;
    8172
    82     // get PIC device cluster and local pointer
    83     cxy_t      dev_cxy = GET_CXY( dev_xp );
    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 );
    8576
    8677    // get implementation index and segment base
     
    9283        soclib_pic_bind_irq( dev_xp , irq_id , wti_xp );
    9384    }
    94     else
    95     {
    96         printk("PANIC in %s: illegal PIC device implementation\n", __FUNCTION__ );
    97         hal_core_sleep();
    98     }
    9985}  // end dev_pic_link_wti()
    10086
     
    10288void dev_pic_unbind_irq( uint32_t irq_id )
    10389{
    104     // get extended pointer on PIC device from directory
    105     xptr_t dev_xp = devices_dir.pic;
     90    // get extended pointer on PIC chdev from directory
     91    xptr_t dev_xp = chdev_dir.pic;
    10692
    107     // get PIC device cluster and local pointer
    108     cxy_t      dev_cxy = GET_CXY( dev_xp );
    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 );
    11096
    11197    // get implementation index
     
    117103        soclib_pic_unbind_irq( dev_xp , irq_id );
    118104    }
    119     else
    120     {
    121         printk("PANIC in %s: illegal PIC device implementation\n", __FUNCTION__ );
    122         hal_core_sleep();
    123     }
    124    
    125105} // end dev_pic_disable_irq()
    126106
Note: See TracChangeset for help on using the changeset viewer.