2011-8-7 14:25:51

 


 
2011-8-7 14:25:51
 
 
   
   
   
if(source>=32)
 {
  reg=XLLP_INTC_ICMR2;
  tem_source-=32;
 }
 else
 {
  reg=XLLP_INTC_ICMR;
 }
 
 
有2个中断处理掩码寄存器,每个处理32个中断

XllpINTCEnableSource

输入true了就加上这个中断掩码

false 就是去掉这个中断掩码


XllpINTCSetSourceLevel

如果为true,则为fiq
如果为false,则为irq


XllpINTCSave

进入睡眠模式后,保存信息

XllpINTCRestore 恢复

 

typedef enum {
 XLLP_RESOURCE_I2C = 0,
 XLLP_RESOURCE_MFPR,          // MFP registers
 XLLP_RESOURCE_MFPR_RM,       // MFP resource manager
 XLLP_RESOURCE_ID_COUNT,
 XLLP_RESOURCE_CLK_EN
} XLLP_PROTECTED_RESOURCES_ID_T; // more IDs might be added


一些保护资源的ID


硬件复位和复位异常

// Note: currently just stubs.

/******************************************************************************
 * Function: XllpMfpResourceManager
 *
 * Description: Assigns ownership of an MFP to the first claimant or releases
 * ownership if owned and the owner requests release.  Reports conflicts of
 * ownership (claimant ID not the same as owner's ID, if the MFP is already
 * owned)
 *
 指定mfp的所有者关系
 * Input Parameters:
 *  pMfpRmDb    - a pointer to MFP resource management database
 
 指向db
 *  mfpOffset   - The offset of the MFPR for the MFP that is being
 *          claimed or released. One of the XLLP_MFP_[usageName]
 *          _OFFSET constants in the range of 0.. XLLP_MFP_PIN_
 *          MAX_OFFSET (inclusive)
 指向申请的MFP的偏移
 
 *  claimantId  - The identifier of the module that wants to claim or
 *          release the specified MFP. It must be unique within
 *          the BSP (not checked) and (for the initial implementa-
 *          tion) fall within the range of 0x10..0xFF (checked).
 *          0x00 through 0x0F are reserved for XLLP MFP usage.
 *          0x10 .. 0x8F are reserved for XLLP module IDs.  0x90
 *          ..0xFF are reserved for OS-assigned IDs.
 

 *  claimAction - XLLP_SET  = claim ownership
 *          - XLLP_CLEAR    = release ownership
 *
 * Returns:
 *  XLLP_STATUS_SUCCESS     - All parameters were valid.
 *  XLLP_STATUS_WRONG_PARAMETER - Null pointer received or parameter
 *      is out of range.
 *  XLLP_STATUS_NO_RESOURCES    - The MFP ownership is already
 *      assigned to another ID.
 *
 * Global effects:
 *
 * Assumptions:
 *
 * Calls:
 *
 * Called by:
 *
 * Prototype:
 * XLLP_STATUS_T XllpMfpResourceManager(
 *              P_XLLP_MFP_RM_DB_ID_T   pMfpRmDb,
 *              XLLP_UINT32_T       mfpOffset,
 *              XLLP_MFP_RM_DB_ID_T claimantId,
 *              XLLP_UINT32_T       claiAction)
 ******************************************************************************/
XLLP_STATUS_T XllpMfpResourceManager(
                P_XLLP_MFP_RM_DB_ID_T   pMfpRmDb,
                XLLP_UINT32_T       mfpOffset,
                XLLP_MFP_RM_DB_ID_T claimantId,
                XLLP_UINT32_T       claimAction)
{
#if defined(XLLP_DEBUG_PARAM_CHECK)
    if (!pMfpRmDb)
        return(XLLP_STATUS_WRONG_PARAMETER);
   
    if ((mfpOffset < XLLP_MFP_PIN_MIN_OFFSET) ||
        (mfpOffset > XLLP_MFP_PIN_MAX_OFFSET))
        return(XLLP_STATUS_WRONG_PARAMETER);

    if (mfpOffset & 0x3){
        return(XLLP_STATUS_WRONG_PARAMETER); }

    /* Need a macro to define the range of claimantId. -stanley */
    // At first, just check for max ID - carl
    // if ((claimantId > XLLP_MFP_RM_ID_MAX) ||
    //     (claimantId < XLLP_MFP_RM_ID_XLLP_BASE))
    if (claimantId > XLLP_MFP_RM_ID_MAX)
        return(XLLP_STATUS_WRONG_PARAMETER);

    switch (claimAction) {

        case XLLP_SET:
            break;
        case XLLP_CLEAR:
            break;
        default:
            return (XLLP_STATUS_WRONG_PARAMETER);
    }

 

#define XLLP_MFP_RM_ID_XLLP_BASE        0x10
#define XLLP_MFP_RM_ID_XLLP_MAX         0x8F
#define XLLP_MFP_RM_ID_OS_BASE          0x90
#define XLLP_MFP_RM_ID_OS_MAX           0xFF
#define XLLP_MFP_RM_ID_MAX              0xFF

现在有的几种模块标识

    if (XLLP_MFP_RM_ID_PM != pMfpRmDb[mfpOffset>>2]) {

        if (pMfpRmDb[mfpOffset>>2] && pMfpRmDb[mfpOffset>>2] != claimantId) {
            return XLLP_STATUS_NO_RESOURCES;
        }
        else {
            pMfpRmDb[mfpOffset>>2] =
                    (XLLP_SET == claimAction) ? claimantId : 0;
        }
    }
   
    如果所有者不是电源管理还需要额外的判断
   
    XLLP_STATUS_T XllpMfpResourceManager_List (
                P_XLLP_MFP_RM_DB_ID_T   pMfpRmDb,
                P_XLLP_UINT32_T     pMfpOffsetList,
                XLLP_MFP_RM_DB_ID_T claimantId,
                XLLP_UINT32_T       claimAction)
{
    XLLP_STATUS_T status = XLLP_STATUS_SUCCESS;

#if defined(XLLP_DEBUG_PARAM_CHECK)
    if (!pMfpRmDb || !pMfpOffsetList)
        return(XLLP_STATUS_WRONG_PARAMETER);
#endif

    XllpLock(XLLP_RESOURCE_MFPR_RM);

    while ((XLLP_STATUS_SUCCESS == status)
          && (XLLP_MFP_PIN_EOLIST_MARKER != *pMfpOffsetList)) {
        status = XllpMfpResourceManager(pMfpRmDb, *pMfpOffsetList,
                    claimantId, claimAction);
        pMfpOffsetList ++;
    }

 XllpUnlock(XLLP_RESOURCE_MFPR_RM); 

    return(status);

}  // XllpMfpResourceManager_List()

对多个MFP进行设置

 

你可能感兴趣的:(2011-8-7 14:25:51)