Changeset 14 for trunk/kernel/drivers


Ignore:
Timestamp:
May 3, 2017, 1:23:24 PM (5 years ago)
Author:
alain
Message:

Bugs fix.

Location:
trunk/kernel/drivers/soclib
Files:
3 edited

Legend:

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

    r4 r14  
    2222 */
    2323
    24 #include <almos_config.h>
     24#include <kernel_config.h>
    2525#include <hal_types.h>
    2626#include <hal_remote.h>
  • trunk/kernel/drivers/soclib/soclib_xcu.c

    r4 r14  
    3636        uint32_t * base = (uint32_t *)GET_PTR( icu->base );
    3737
    38     // write into registers
     38    // disable all IRQs
    3939    base[XCU_MSK_HWI_DISABLE << 5 | lid] = 0xFFFFFFFF;
    4040    base[XCU_MSK_WTI_DISABLE << 5 | lid] = 0xFFFFFFFF;
     
    7070        else if( type == HWI_TYPE ) base[XCU_MSK_HWI_ENABLE << 5 | lid] = mask;
    7171        else                        base[XCU_MSK_PTI_ENABLE << 5 | lid] = mask;
     72}
     73
     74///////////////////////////////////////////
     75void soclib_xcu_get_masks( chdev_t   * icu,
     76                           lid_t       lid,
     77                           uint32_t  * hwi_mask,
     78                           uint32_t  * wti_mask,
     79                           uint32_t  * pti_mask )
     80{
     81    // get XCU segment base address
     82        uint32_t * base = (uint32_t *)GET_PTR( icu->base );
     83 
     84    // get values from registers
     85    *hwi_mask = base[XCU_MSK_HWI << 5 | lid];
     86    *wti_mask = base[XCU_MSK_WTI << 5 | lid];
     87    *pti_mask = base[XCU_MSK_PTI << 5 | lid];
    7288}
    7389
     
    108124        uint32_t prio = base[XCU_PRIO << 5 | lid];
    109125
    110     if( prio & 0x4 ) *wti_status = ((prio >> 24) & 0x1F) + 1;
    111     if( prio & 0x2 ) *hwi_status = ((prio >> 16) & 0x1F) + 1;
    112     if( prio & 0x1 ) *pti_status = ((prio >>  8) & 0x1F) + 1;
     126    *wti_status = (prio & 0x4) ? (((prio >> 24) & 0x1F) + 1) : 0;
     127    *hwi_status = (prio & 0x2) ? (((prio >> 16) & 0x1F) + 1) : 0;
     128    *pti_status = (prio & 0x1) ? (((prio >>  8) & 0x1F) + 1) : 0;
    113129}
    114130
  • trunk/kernel/drivers/soclib/soclib_xcu.h

    r4 r14  
    9494
    9595/******************************************************************************************
     96 * This function returns the values contained in the HWI/WTI/PTI mask registers for
     97 * a given core. It must be called by a local thread.
     98 ******************************************************************************************
     99 * @ icu      : pointer on local XCU chdev descriptor
     100 * @ lid      : local core index == output IRQ index
     101 * @ hwi_mask : [out] HWI mask for selected core
     102 * @ wti_mask : [out] WTI mask for selected core
     103 * @ pti_mask : [out] PTI mask for selected core
     104 *****************************************************************************************/
     105void soclib_xcu_get_masks( chdev_t   * icu,
     106                           lid_t       lid,
     107                           uint32_t  * hwi_mask,
     108                           uint32_t  * wti_mask,
     109                           uint32_t  * pti_mask );
     110
     111/******************************************************************************************
    96112 * This function set the period value for a local XCU timer.
    97113 ******************************************************************************************
Note: See TracChangeset for help on using the changeset viewer.