csl_intc.h
来自「dsp在音频处理中的运用」· C头文件 代码 · 共 819 行 · 第 1/2 页
H
819 行
#ifndef _CSL_INTC_H_#define _CSL_INTC_H_#ifdef __cplusplusextern "C" {#endif#include <csl.h>#include <cslr_intc0.h>#include <cslr_intc1.h>#include <cslr_intc2.h>/* Interrupt/Exception Counts */#define _CSL_INTC_EVENTID__INTC0CNT (8) /* ARM exception count */#define _CSL_INTC_EVENTID__INTC1CNT (32) /* Level-1 Interrupt count */#define _CSL_INTC_EVENTID__INTC2CNT (128) /* Level-2 Interrupt count */#define CSL_INTC_EVENTID_INVALID (-1) /**< Invalid Event-ID *//** * @brief Interrupt Event IDs */typedef Int CSL_IntcEventId; /* event-id enumeration in soc.h *//** * @brief Count of the number of interrupt-events */#define CSL_INTC_EVENTID_CNT \ (_CSL_INTC_EVENTID__INTC0CNT + _CSL_INTC_EVENTID__INTC1CNT + _CSL_INTC_EVENTID__INTC2CNT)/** * @brief Indicates there is no associated event-handler */#define CSL_INTC_EVTHANDLER_NONE ((CSL_IntcEventHandlerRecord *) 0)/** * @brief Invalid handle */#define CSL_INTC_BADHANDLE (0)/** * @brief Interrupt Vector IDs */typedef enum { CSL_INTC_VECTID_DEFAULT = 0, /**< default vector */ CSL_INTC_VECTID_INVALID = -1, /**< invalid vector *//* for use only with HookIsr -- by design! */ CSL_INTC_VECTID_RESET = 1, /**< the RESET exception vector */ CSL_INTC_VECTID_UNDEF = 2, /**< the UNDEF exception vector */ CSL_INTC_VECTID_SWI = 3, /**< the SWI exception vector */ CSL_INTC_VECTID_PREABT = 4, /**< the PREABT exception vector */ CSL_INTC_VECTID_DATABT = 5, /**< the DATABT exception vector */ CSL_INTC_VECTID_IRQ = 7, /**< the IRQ exception vector */ CSL_INTC_VECTID_FIQ = 8 /**< the FIQ exception vector */} CSL_IntcVectId;/** * @brief Interrupt Priority */typedef enum { CSL_INTC_PRIORITY_DEFAULT = 0 /**< Default priority */} CSL_IntcPriority;/** * @brief Interrupt Sense */typedef enum { CSL_INTC_SENSE_FALL_EDGE = 0, /**< Falling Edge */ CSL_INTC_SENSE_ACTIVE_LOW = 1 /**< Active Low */} CSL_IntcSense;/** * @brief Interrupt Type (Routing) */typedef enum { CSL_INTC_TYPE_IRQ = 0, /**< IRQ -- normal interrupt request */ CSL_INTC_TYPE_FIQ = 1 /**< FIQ -- fast interrupt request */} CSL_IntcType;/** * @brief Enumeration of the control commands * * These are the control commands that could be used with * CSL_intcHwControl(..). Some of the commands expect an * argument as documented along-side the description of * the command. */typedef enum { CSL_INTC_CMD_EVTENABLE, /**< * @brief Enables the event * @param None */ CSL_INTC_CMD_EVTDISABLE, /**< * @brief Disables the event * @param None */ CSL_INTC_CMD_EVTCLEAR, /**< * @brief Clears the event (if pending) * @param None */ CSL_INTC_CMD_EVTSET, /**< * @brief Sets the event (software triggering) * @param None */ CSL_INTC_CMD_SETPRIORITY, /**< * @brief Modifies the interrupt priority * @param CSL_IntcPriority */ CSL_INTC_CMD_SETTYPE, /**< * @brief Modify the interrupt type (route) * @param CSL_IntcType */ CSL_INTC_CMD_SETSENSE, /**< * @brief Modify the interrupt sensitivity * @param CSL_IntcSense */ CSL_INTC_CMD_SETPACE /**< * @brief Not Supported * @param Not Applicable */} CSL_IntcHwControlCmd;/** * @brief Enumeration of the queries * * These are the queries that could be used with CSL_intcGetHwStatus(..). * The queries return a value through the object pointed to by the pointer * that it takes as an argument. The argument supported by the query is * documented along-side the description of the query. */typedef enum { CSL_INTC_QUERY_PRIORITY, /**< * @brief Retrieves the interrupt priority * @param (CSL_IntcPriority *) */ CSL_INTC_QUERY_TYPE, /**< * @brief Returns the type (route) * @param (CSL_IntcType *) */ CSL_INTC_QUERY_SENSE, /**< * @brief Retrieves the interrupt sensitivity * @param (CSL_IntcSense *) */ CSL_INTC_QUERY_ISEVENTPENDING /**< * @brief Checks if event is pending * @param (Bool *) */} CSL_IntcHwStatusQuery;/** * @brief Event Handler pointer * * Event handlers ought to conform to this type */typedef void (* CSL_IntcEventHandler)(void *);/** * @brief Event Handler Record * * Used to set-up the event-handler using CSL_intcPlugEventHandler(..) */typedef struct CSL_IntcEventHandlerRecord { CSL_IntcEventHandler handler; /**< pointer to the event handler */ void * arg; /**< the argument to be passed to the handler when it is invoked */} CSL_IntcEventHandlerRecord;/** * @brief The setup-structure * * Used to configure the interrupt controller for an event using * CSL_intcHwSetup(..) */typedef struct CSL_IntcHwSetup { CSL_IntcPriority priority; /**< The interrupt priority */ CSL_IntcType type; /**< The interrupt type (routing) */ CSL_IntcSense sense; /**< The interrupt sensing */} CSL_IntcHwSetup;/** * @brief Default values for the setup-parameters */#define CSL_INTC_HWSETUP_DEFAULTS { \ (CSL_IntcPriority) CSL_INTC_PRIORITY_DEFAULT, \ (CSL_IntcType) CSL_INTC_TYPE_IRQ, \ (CSL_IntcSense) CSL_INTC_SENSE_FALL_EDGE \}/** * @brief Event enable state */typedef Uint8 CSL_IntcEventEnableState;/** * @brief Global Interrupt enable state */typedef Uint8 CSL_IntcGlobalEnableState;/** * @brief The interrupt handle object * * This object is used refenced by the handle to identify the event. */typedef struct CSL_IntcObj { CSL_IntcEventId eventId; /**< The event-id */ CSL_IntcVectId vectId; /**< The vector-id */ void * reserved; /**< Reserved for the future */} CSL_IntcObj;/** * @brief The interrupt handle * * This is returned by the CSL_intcOpen(..) API. The handle is used * to identify the event of interest in all INTC calls. */typedef struct CSL_IntcObj * CSL_IntcHandle;/** * @brief INTC Module Context */typedef struct { CSL_BitMask32 eventAllocMask[(CSL_INTC_EVENTID_CNT + 31) / 32];} CSL_IntcContext;/** * @brief INTC Module Context Intialization Value */#define CSL_INTC_CONTEXT_INITVAL { \ {(CSL_BitMask32)0, (CSL_BitMask32)0, (CSL_BitMask32)0, \ (CSL_BitMask32)0, (CSL_BitMask32)0, (CSL_BitMask32)0} \}/** * @brief Intialize INTC module * * This API performs any module-specific initialization. CSL_intcInit(..) * must be invoked before calling any other API in the INTC module. * * @b Example: * @verbatim if ((CSL_intcInit( ) != CSL_SOK) && (CSL_intcInit () != CSL_ESYS_ALREADY_INITIALIZED)) { // module initialization failed! // } @endverbatim * * @return CSL_SOK on success*/CSL_Status CSL_intcInit ( CSL_IntcContext * pContext);/** * @brief INTC module parameters for open * * None as of now */typedef void CSL_IntcParams;/** * @brief Allocates an event for use * * 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 Example: * @verbatim CSL_IntcObj intcObj; CSL_IntcHandle hIntc; CSL_Status openStatus; hIntc = CSL_intcOpen(&intcObj, CSL_INTC_EVENTID_TIMER3, NULL, &openStatus); if (openStatus != CSL_SOK) { // open failed // } @endverbatim * * @return Handle identifying the event */CSL_IntcHandle CSL_intcOpen ( CSL_IntcObj * intcObj, /**< pointer to the CSL-object allocated by the user */ CSL_IntcEventId eventId, /**< the event-id of the interrupt */ CSL_IntcParams * params, /**< module specific parameter */ CSL_Status * status /**< (optional) pointer to a variable that would receive the status */);/** * @brief Releases an allocated event * * CSL_intcClose(..) must be called to release an event that has * been previously allocated with a call to CSL_intcOpen(..). * * @b Example: * @verbatim if (CSL_intcClose(hIntc) != CSL_SOK) { // close failed! // } @endverbatim * * @return CSL_SOK on success; CSL_ESYS_FAIL on failure. */CSL_Status CSL_intcClose ( CSL_IntcHandle hIntc /**< Handle to an event; see CSL_intcOpen(..) */);/** * @brief Sets up the interrupt controller for a particular event * * CSL_intcHwSetup(..) API is used to configure the interrupt controller * for the event identified by the handle. The user must instantiate * and initialize a setup-structure with appropriate configuration * parameters before passing it to the function. * * @b Example: * @verbatim CSL_IntcHwSetup setup = CSL_INTC_HWSETUP_DEFAULTS; setup.priority = CSL_INTC_PRIORITY_DEFAULT; setup.sense = CSL_INTC_SENSE_FALL_EDGE; setup.type = CSL_INTC_TYPE_IRQ; CSL_intcHwSetup(hIntc, &setup); @endverbatim * * @return*/CSL_Status CSL_intcHwSetup ( CSL_IntcHandle hIntc, /**< Handle to an event; see CSL_intcOpen(..) */ CSL_IntcHwSetup * hwSetup /**< Pointer to a Setup-structure */);/**
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?