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

📄 csl_intcopen.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_intcOpen.c * *  @brief  File for functional layer of CSL API @a CSL_intcOpen() * *  Description *  - @a CSL_intcOpen() function definition * *  Path: \\(CSLPATH)\\soc\\davinci\\arm9\\src\\intc * *  Modification *  - Modified on: 2004/06/12 (Francis S) *  - Reason: Added Interrupt Priority mask support * *  - Modified on: 2004/04/15 *  - Reason: creation * *  Date   2004/04/15 *  Author RG Kiran */#include <csl_intc.h>#include <csl_error.h>#include <csl_types.h>#include <csl_sysData.h>/** ============================================================================ *   @n@b CSL_intcOpen * *   @b Description *   @n The API would reserve an interrupt-event for use. It returns *      a valid handle to the event only if the event is not currently *      allocated. The user could release the event after use by calling *      CSL_intcClose (). The CSL-object ('intcObj') that the user *      passes would be used to store information pertaining handle. * *   @b Arguments *   @verbatim              pIntcObj     pointer to the CSL-object allocated by the user              eventId      the event-id of the interrupt              vectId       the vector-id of the interrupt              setup        (optional) pointer to an optional setup-structure              pStatus      (optional) pointer for returning status of the                           function call     @endverbatim * *   <b> Return Value </b>  CSL_IntcHandle *   @n                     Valid INTC handle identifying the event * *   <b> Pre Condition </b> *   @n  None * *   <b> Post Condition </b> *   @n   1.    INTC object structure is populated *   @n   2.    The status is returned in the status variable. If status *              returned is *   @li            CSL_SOK             Valid intc handle is returned *   @li            CSL_ESYS_FAIL       The open command failed * *   @b Modifies *   @n    1. The status variable *   @n    2. INTC object structure * * @b Example: * @verbatim        CSL_IntcObj     intcObj;        CSL_IntcHandle  hIntc;        CSL_Status      openStatus;        hIntc = CSL_intcOpen(&intcObj, CSL_INTC_EVENTID_TIMER3,                    CSL_INTC_VECTID_DEFAULT, NULL, &openStatus);        if (openStatus != CSL_SOK) {            // open failed //        }   @endverbatim * ============================================================================= */#pragma CODE_SECTION (CSL_intcOpen, ".text:csl_section:intc");CSL_IntcHandle CSL_intcOpen (    CSL_IntcObj               *intcObj,    CSL_IntcEventId            eventId,    CSL_IntcVectId             vectId,    CSL_IntcHwSetup           *setup,    CSL_Status                *status){    CSL_IntcHandle h = CSL_INTC_BADHANDLE;    CSL_Status     openStatus;    if (vectId == CSL_INTC_VECTID_DEFAULT) {        if (((eventId >= _CSL_INTC_EVENTID__INTC1START) &&             (eventId <= _CSL_INTC_EVENTID__INTC1END))  &&            ((setup->priority >= _CSL_INTC_PRIORITY__INTC1START) &&             (setup->priority <= _CSL_INTC_PRIORITY__INTC1END))) {            int n = eventId - _CSL_INTC_EVENTID__INTC1START;            int x = 1 << (n % 32);  /* x co-ordinate */            int y = n / 32;         /* y co-ordinate */            if ((CSL_sysDataHandle->intcAllocMask[y] & x) == 0) {                CSL_sysDataHandle->intcAllocMask[y] |= x; /* set bit -> used */                h = intcObj;            }        } /* else if (eventId >= _CSL_INTC_EVENTID__INTC0START && eventId <=                      _CSL_INTC_EVENTID__INTC0END) {            do not allow exclusive access to chip-level exception vectors!        } */    }    if (h != CSL_INTC_BADHANDLE) {        intcObj->eventId    = eventId;        intcObj->vectId     = vectId;        intcObj->priority   = setup->priority;        openStatus          = CSL_SOK;        if (setup) {            CSL_intcHwSetup(h, setup);        }    }    else {        intcObj->eventId    = CSL_INTC_EVENTID_INVALID;        intcObj->vectId     = CSL_INTC_VECTID_INVALID;        intcObj->priority   = CSL_INTC_PRIORITY_INVALID;        openStatus          = CSL_ESYS_FAIL;    }    if (status) {        *status = openStatus;    }    return h;}

⌨️ 快捷键说明

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