⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csl_intcexcep.c

📁 TI达芬奇dm644x各硬件模块测试代码
💻 C
字号:
/*  ============================================================================
 *   Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005                 
 *                                                                              
 *   Use of this software is controlled by the terms and conditions found in the
 *   license agreement under which this software has been supplied.             
 *   ===========================================================================
 */

/**
 *  @file  csl_intcExcep.c
 *
 *  @brief  File for functional layer of CSL API
 *
 *  PATH  \\(CSLPATH)\\soc\\davinci\\c64plus\\src\\intc
 *
 *  @date 12th June, 2004
 *  @author Ruchika Kharwar  
 */
 
/* =============================================================================
 *  Revision History
 *  ===============
 *  16-Mar-2005 brn modified for doxygen documentation
 * =============================================================================
 */

#include <csl_intc.h>
/** ============================================================================
 *   @n@b CSL_intcExcepAllEnable
 *
 *   @b Description
 *   This enables the events as specified in the bitmask in either EXPMASK0/1/2/3.
 *
 * <b> Usage Constraints: </b>
 *   CSL_intcInit() must be called before use of this API.
 *
 *  @b Arguments
 *   @verbatim
            excepMask            Exception mask
            excVal               exception value
            prevState            pointer pointing to previous state
     @endverbatim

 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_SOK             - Allways
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_intcOpen() must be invoked before this call.
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *   @n enables all exceptions.
 * @b Example:
 *  @verbatim
    CSL_IntcContext context; 
    CSL_Status intcStat;
    CSL_IntcParam vectId;
    CSL_IntcEventHandlerRecord recordTable[10];
    CSL_IntcGlobalEnableState prevState;
    context.numEvtEntries = 10;
    context.eventhandlerRecord = &recordTable;

    // Init Module
    ...
    if (CSL_intcInit(&context) != CSL_SOK) {
       exit;
    // Enable exception events 9,10,11.
    
    intcStat = CSL_intcExcepAllEnable(CSL_INTC_EXCEP_0TO31,0x0F00,&prevState);

    
   }
    @endverbatim
 *
 * =============================================================================
 */
#pragma CODE_SECTION (CSL_intcExcepAllEnable, ".text:csl_section:intc");
CSL_Status CSL_intcExcepAllEnable(
        CSL_IntcExcepEn excepMask,
        CSL_BitMask32   excVal,
        CSL_IntcGlobalEnableState *prevState
        
)
{
    if (prevState) *prevState =
                    ((CSL_IntcRegsOvly)CSL_INTC_REGS)->EXPMASK[excepMask];

    ((CSL_IntcRegsOvly)CSL_INTC_REGS)->EXPMASK[excepMask] &= ~excVal;
    return CSL_SOK;
}
/** ============================================================================
 *   @n@b CSL_intcExcepAllDisable
 *
 *   @b Description
 *  This disables the events as specified in the bitmask in either EXPMASK0/1/2/3.
 *
 * <b> Usage Constraints: </b>
 *   CSL_intcInit() must be called before use of this API.

 *   @b Arguments
 *   @verbatim
            excepMask            Exception mask
            excVal               Event value
            prevState            Pointer pointing to previous state
     @endverbatim

 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_SOK             - Allways
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_intcOpen() must be invoked before this call.
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *   @n disables all exceptions.
 * @b Example:
 *  @verbatim
    CSL_IntcContext context; 
    CSL_Status intcStat;
    CSL_IntcParam vectId;
    CSL_IntcEventHandlerRecord recordTable[10];
    CSL_IntcGlobalEnableState prevState;
    context.numEvtEntries = 10;
    context.eventhandlerRecord = &recordTable;

    // Init Module
    ...
    if (CSL_intcInit(&context) != CSL_SOK) {
       exit;
    // Disable exception events 9,10,11.
    
    intcStat = CSL_intcExcepAllDisable(CSL_INTC_EXCEP_0TO31,0x0F00,&prevState);

    
   }
    @endverbatim
 *
 *  ============================================================================
 */
#pragma CODE_SECTION (CSL_intcExcepAllDisable, ".text:csl_section:intc");
CSL_Status CSL_intcExcepAllDisable(
        CSL_IntcExcepEn excepMask,
        CSL_BitMask32   excVal,
        CSL_IntcGlobalEnableState *prevState
)
{
    if (prevState)
        *prevState = ((CSL_IntcRegsOvly)CSL_INTC_REGS)->EXPMASK[excepMask];
    ((CSL_IntcRegsOvly)CSL_INTC_REGS)->EXPMASK[excepMask] |= excVal;
    return CSL_SOK;
}

/** ============================================================================
 *   @n@b CSL_intcExcepAllRestore
 *
 *   @b Description
 *   This restores the exception enable mask.
 *
 * <b> Usage Constraints: </b>
 *   CSL_intcInit() and CSL_intcExcepAllDisable()/CSL_intcExcepAllEnable()
 *   must be called before use of this API.
 *
 *   @b Arguments
 *   @verbatim
            excepMask            Exception mask
            restoreVal           Restore value
     @endverbatim

 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_SOK             - Allways
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_intcOpen() must be invoked before this call.
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *   @n restores all exceptions.
 *
 * @b Example:
 *  @verbatim
    CSL_IntcContext context; 
    CSL_Status intcStat;
    CSL_IntcParam vectId;
    CSL_bitMask32 exp0Stat;
    CSL_IntcEventHandlerRecord recordTable[10];
    CSL_IntcGlobalEnableState prevState;
    context.numEvtEntries = 10;
    context.eventhandlerRecord = &recordTable;

    // Init Module
    ...
    if (CSL_intcInit(&context) != CSL_SOK) {
       exit;
    intcStat = CSL_intcExcepAllDisable(CSL_INTC_EXCEP_0TO31,0x0F00,&prevState);
    
    // Restore
    intcStat = CSL_intcExcepAllRestore(CSL_INTC_EXCEP_0TO31,prevState);
   }
 *
 *  @endverbatim
 *  ============================================================================
 */
#pragma CODE_SECTION (CSL_intcExcepAllRestore, ".text:csl_section:intc");
CSL_Status CSL_intcExcepAllRestore(
        CSL_IntcExcepEn excepMask,
        CSL_IntcGlobalEnableState   restoreVal
)
{
    ((CSL_IntcRegsOvly)CSL_INTC_REGS)->EXPMASK[excepMask] = restoreVal;
    return CSL_SOK;
}


/** ============================================================================
 *   @n@b CSL_intcExcepAllClear
 *
 *   @b Description
 *   This clears the exception flags.
 *
 * <b> Usage Constraints: </b>
 *   CSL_intcInit() must be called before use of this API.
 *
 *
 *   @b Arguments
 *   @verbatim
            excepMask            Exception mask
            excVal               Event value
     @endverbatim

 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_SOK             - Allways
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_intcOpen() must be invoked before this call.
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *   @n clears all exceptions.
 *
 * @b Example:
 *  @verbatim
    CSL_IntcContext context; 
    CSL_Status intcStat;
    CSL_IntcParam vectId;
    CSL_IntcEventHandlerRecord recordTable[10];
    CSL_IntcGlobalEnableState prevState;
    context.numEvtEntries = 10;
    context.eventhandlerRecord = &recordTable;

    // Init Module
    ...
    if (CSL_intcInit(&context) != CSL_SOK) {
       exit;
    // Clear exception events 9,10,11.
    
    intcStat = CSL_intcExcepAllClear(CSL_INTC_EXCEP_0TO31,0x0F00);
    
    
   }
 *  @endverbatim
 *
 *  ============================================================================
 */
#pragma CODE_SECTION (CSL_intcExcepAllClear, ".text:csl_section:intc");
CSL_Status CSL_intcExcepAllClear(
        CSL_IntcExcepEn excepMask,
        CSL_BitMask32   excVal
)
{
    ((CSL_IntcRegsOvly)CSL_INTC_REGS)->EVTCLR[excepMask] = excVal;
    return CSL_SOK;
}

/** ============================================================================
 *   @n@b CSL_intcExcepAllStatus
 *
 *   @b Description
 *   This obtains the status of the exception flags.
 *
 * <b> Usage Constraints: </b>
 *   CSL_intcInit() must be called before use of this API.
 *
 *
 *   @b Arguments
 *   @verbatim
            excepMask            Exception mask
            status               Pointer gets the exception flag status
     @endverbatim

 *   <b> Return Value </b>  CSL_Status
 *   @li                    CSL_SOK             - Allways
 *
 *   <b> Pre Condition </b>
 *   @n  CSL_intcOpen() must be invoked before this call.
 *
 *   <b> Post Condition </b>
 *   @n  None
 *
 *   @b Modifies
 *   @n gets the exception status flag.
 *
 * @b Example:
 *  @verbatim
    CSL_IntcContext context; 
    CSL_Status intcStat;
    CSL_IntcParam vectId;
    CSL_bitMask32 exp0Stat;
    CSL_IntcEventHandlerRecord recordTable[10];
    CSL_IntcGlobalEnableState prevState;
    context.numEvtEntries = 10;
    context.eventhandlerRecord = &recordTable;

    // Init Module
    ...
    if (CSL_intcInit(&context) != CSL_SOK) {
       exit;
    intcStat = CSL_intcExcepAllStatus(CSL_INTC_EXCEP_0TO31,&exp0Stat);  
   }
 *  @endverbatim
 *
 *  ============================================================================
 */
#pragma CODE_SECTION (CSL_intcExcepAllStatus, ".text:csl_section:intc");
CSL_Status CSL_intcExcepAllStatus(
        CSL_IntcExcepEn excepMask,
        CSL_BitMask32   *status     
)
{
    if (status)
        *status = ((CSL_IntcRegsOvly)CSL_INTC_REGS)->MEXPFLAG[excepMask] ;
    return CSL_SOK; 
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -