Ignore:
Timestamp:
Apr 26, 2017, 2:10:21 PM (7 years ago)
Author:
alain
Message:

Introduce the chdev_t structure in place of device_t.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/drivers/soclib/soclib_bdv.c

    r1 r4  
    2222 */
    2323
    24 #include <device.h>
     24#include <chdev.h>
    2525#include <dev_ioc.h>
    2626#include <soclib_bdv.h>
     
    2929
    3030
    31 /////////////////////////////////////
    32 void soclib_bdv_init( xptr_t dev_xp )
     31///////////////////////////////////////
     32void soclib_bdv_init( chdev_t * chdev )
    3333{
    34     // get IOC device descriptor cluster and local pointer
    35     cxy_t      dev_cxy  = GET_CXY( dev_xp );
    36     device_t * dev_ptr  = (device_t *)GET_PTR( dev_xp );
    37  
    3834    // get extended pointer on SOCLIB_BDV peripheral base address
    39         xptr_t  bdv_xp = hal_remote_lwd( XPTR( dev_cxy , &dev_ptr->base ) );
     35        xptr_t  bdv_xp = chdev->base;
    4036
    4137    // get hardware device cluster and local pointer
     
    4844
    4945    // set IOC device descriptor extension
    50     hal_remote_sw( XPTR( dev_cxy , &dev_ptr->ext.ioc.size  ) , block_size );
    51     hal_remote_sw( XPTR( dev_cxy , &dev_ptr->ext.ioc.count ) , block_count );
     46    chdev->ext.ioc.size  = block_size;
     47    chdev->ext.ioc.count = block_count;
    5248
    5349} // end soclib_bdv_init()
    5450
    5551
    56 //////////////////////////////////////////////////////////////////
    57 void __attribute__ ((noinline)) soclib_bdv_command( xptr_t th_xp )
     52//////////////////////////////////////////////////////////////
     53void __attribute__ ((noinline)) soclib_bdv_cmd( xptr_t th_xp )
    5854{
    5955    uint32_t   to_mem;       // command argument
     
    6864
    6965    // get command arguments and extended pointer on IOC device
    70     to_mem =         hal_remote_lw ( XPTR( th_cxy , &th_ptr->dev.ioc.to_mem ) );
    71     lba    =         hal_remote_lw ( XPTR( th_cxy , &th_ptr->dev.ioc.lba    ) );
    72     count  =         hal_remote_lw ( XPTR( th_cxy , &th_ptr->dev.ioc.count  ) );
    73     buf_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->dev.ioc.buf_xp ) );
    74     dev_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->dev.ioc.dev_xp ) );
     66    to_mem =         hal_remote_lw ( XPTR( th_cxy , &th_ptr->command.ioc.to_mem ) );
     67    lba    =         hal_remote_lw ( XPTR( th_cxy , &th_ptr->command.ioc.lba    ) );
     68    count  =         hal_remote_lw ( XPTR( th_cxy , &th_ptr->command.ioc.count  ) );
     69    buf_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->command.ioc.buf_xp ) );
     70    dev_xp = (xptr_t)hal_remote_lwd( XPTR( th_cxy , &th_ptr->command.ioc.dev_xp ) );
    7571
    7672    // get IOC device cluster and local pointer
    7773    cxy_t      dev_cxy = GET_CXY( dev_xp );
    78     device_t * dev_ptr = (device_t *)GET_PTR( dev_xp );
     74    chdev_t  * dev_ptr = (chdev_t *)GET_PTR( dev_xp );
    7975
    8076    // get extended pointer on SOCLIB-BDV peripheral
     
    107103
    108104
    109 ////////////////////////////////////////////////////////////////
    110 void __attribute__ ((noinline)) soclib_bdv_isr( device_t * dev )
     105/////////////////////////////////////////////////////////////////
     106void __attribute__ ((noinline)) soclib_bdv_isr( chdev_t * chdev )
    111107{
    112108    // get extended pointer on client thread
    113     xptr_t root = XPTR( local_cxy , &dev->wait_root );
     109    xptr_t root = XPTR( local_cxy , &chdev->wait_root );
    114110    xptr_t client_xp = XLIST_FIRST_ELEMENT( root , thread_t , wait_list );
    115111
    116112    // get extended pointer on server thread
    117     xptr_t server_xp = XPTR( local_cxy , &dev->server );
     113    xptr_t server_xp = XPTR( local_cxy , &chdev->server );
    118114
    119115    // get client thread cluster and local pointer
     
    122118
    123119    // get SOCLIB_BDV device cluster and local pointer
    124     cxy_t      bdv_cxy  = GET_CXY( dev->base );
    125     uint32_t * bdv_ptr  = (uint32_t *)GET_PTR( dev->base );
     120    cxy_t      bdv_cxy  = GET_CXY( chdev->base );
     121    uint32_t * bdv_ptr  = (uint32_t *)GET_PTR( chdev->base );
    126122
    127123    // get BDV status register and acknowledge IRQ
     
    131127        if((status != BDV_READ_SUCCESS) && (status != BDV_WRITE_SUCCESS))
    132128    {
    133         hal_remote_sw( XPTR( client_cxy , &client_ptr->dev.ioc.error ) , 1 );
     129        hal_remote_sw( XPTR( client_cxy , &client_ptr->command.ioc.error ) , 1 );
    134130    }
    135131        else
    136132    {
    137         hal_remote_sw( XPTR( client_cxy , &client_ptr->dev.ioc.error ) , 0 );
     133        hal_remote_sw( XPTR( client_cxy , &client_ptr->command.ioc.error ) , 0 );
    138134    }
    139135
Note: See TracChangeset for help on using the changeset viewer.