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_xcu.c

    r1 r4  
    2525#include <hal_types.h>
    2626#include <core.h>
    27 #include <device.h>
     27#include <chdev.h>
    2828
    2929
    3030
    31 /////////////////////////////////////
    32 void soclib_xcu_init( device_t * icu,
    33                       lid_t      lid )
     31////////////////////////////////////
     32void soclib_xcu_init( chdev_t * icu,
     33                      lid_t     lid )
    3434{
    3535    // get local ICU segment base address
     
    4242}
    4343
    44 ///////////////////////////////////////////////
    45 void soclib_xcu_disable_irq( xptr_t     icu_xp,
     44////////////////////////////////////////////
     45void soclib_xcu_disable_irq( chdev_t  * icu,
    4646                             uint32_t   mask,
    4747                             uint32_t   type,
    4848                             lid_t      lid )
    4949{
    50     // get remote ICU cluster and local pointer
    51     cxy_t      icu_cxy = GET_CXY( icu_xp );
    52     device_t * icu_ptr = (device_t *)GET_PTR( icu_xp );
     50    // get XCU segment base address
     51        uint32_t * base = (uint32_t *)GET_PTR( icu->base );
    5352
    54     // get remote XCU segment base address
    55         xptr_t base = (xptr_t)hal_remote_lwd( XPTR( icu_cxy , &icu_ptr->base ) );
    56 
    57     // compute xptr on relevant XCU mask register
    58     xptr_t   reg_xp;
    59         if     ( type == WTI_TYPE ) reg_xp = base + ((XCU_MSK_WTI_DISABLE << 5 | lid)<<2);
    60         else if( type == HWI_TYPE ) reg_xp = base + ((XCU_MSK_HWI_DISABLE << 5 | lid)<<2);
    61         else                        reg_xp = base + ((XCU_MSK_PTI_DISABLE << 5 | lid)<<2);
    62 
    63     // reset relevant XCU mask register
    64         hal_remote_sw( reg_xp , mask );
     53    // write into register
     54        if     ( type == WTI_TYPE ) base[XCU_MSK_WTI_DISABLE << 5 | lid] = mask;
     55        else if( type == HWI_TYPE ) base[XCU_MSK_HWI_DISABLE << 5 | lid] = mask;
     56        else                        base[XCU_MSK_PTI_DISABLE << 5 | lid] = mask;
    6557}
    6658
    67 //////////////////////////////////////////////
    68 void soclib_xcu_enable_irq( xptr_t     icu_xp,
     59///////////////////////////////////////////
     60void soclib_xcu_enable_irq( chdev_t  * icu,
    6961                            uint32_t   mask,
    7062                            uint32_t   type,
    7163                            lid_t      lid )
    7264{
    73     // get remote ICU cluster and local pointer
    74     cxy_t      icu_cxy = GET_CXY( icu_xp );
    75     device_t * icu_ptr = (device_t *)GET_PTR( icu_xp );
     65    // get XCU segment base address
     66        uint32_t * base = (uint32_t *)GET_PTR( icu->base );
    7667
    77     // get remote XCU segment base address
    78         xptr_t base = (xptr_t)hal_remote_lwd( XPTR( icu_cxy , &icu_ptr->base ) );
    79 
    80     // compute xptr on relevant XCU mask register
    81     xptr_t   reg_xp;
    82         if     ( type == WTI_TYPE ) reg_xp = base + ((XCU_MSK_WTI_ENABLE << 5 | lid)<<2);
    83         else if( type == HWI_TYPE ) reg_xp = base + ((XCU_MSK_HWI_ENABLE << 5 | lid)<<2);
    84         else                        reg_xp = base + ((XCU_MSK_PTI_ENABLE << 5 | lid)<<2);
    85 
    86     // set relevant XCU mask register
    87         hal_remote_sw( reg_xp , mask );
     68    // write into register
     69        if     ( type == WTI_TYPE ) base[XCU_MSK_WTI_ENABLE << 5 | lid] = mask;
     70        else if( type == HWI_TYPE ) base[XCU_MSK_HWI_ENABLE << 5 | lid] = mask;
     71        else                        base[XCU_MSK_PTI_ENABLE << 5 | lid] = mask;
    8872}
    8973
    90 ///////////////////////////////////////////
    91 void soclib_xcu_set_period( device_t * icu,
    92                             uint32_t   index,
    93                             uint32_t   period )
     74//////////////////////////////////////////
     75void soclib_xcu_set_period( chdev_t * icu,
     76                            uint32_t  index,
     77                            uint32_t  period )
    9478{
    9579    // get local ICU segment base address
     
    10084}
    10185
    102 //////////////////////////////////////////////
    103 uint32_t soclib_xcu_ack_timer( device_t * icu,
    104                                uint32_t   index )
     86/////////////////////////////////////////////
     87uint32_t soclib_xcu_ack_timer( chdev_t * icu,
     88                               uint32_t  index )
    10589{
    10690    // get local ICU segment base address
     
    11195}
    11296
    113 ///////////////////////////////////////////////
    114 void soclib_xcu_get_status( device_t * icu,
     97///////////////////////////////////////////
     98void soclib_xcu_get_status( chdev_t * icu,
    11599                            lid_t      lid,
    116100                            uint32_t * hwi_status,
     
    130114
    131115/////////////////////////////////////////
    132 void soclib_xcu_send_ipi( xptr_t  xp_icu,
     116void soclib_xcu_send_ipi( xptr_t  icu_xp,
    133117                          lid_t   lid )
    134118{
    135119    // get target ICU device cluster and local pointer
    136     cxy_t       cxy_icu = GET_CXY( xp_icu );
    137     device_t  * ptr_icu = (device_t *)GET_PTR( xp_icu );
     120    cxy_t       cxy_icu = GET_CXY( icu_xp );
     121    chdev_t  * ptr_icu = (chdev_t *)GET_PTR( icu_xp );
    138122
    139123    // get extended pointer on target ICU segment base
     
    148132
    149133//////////////////////////////////////////////
    150 uint32_t * soclib_xcu_wti_ptr( device_t * icu,
     134uint32_t * soclib_xcu_wti_ptr( chdev_t * icu,
    151135                               uint32_t   index )
    152136{
Note: See TracChangeset for help on using the changeset viewer.