📄 csl_intc.h
字号:
/* ============================================================================
* 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_intc.h
*
* @path $(CSLPATH)\inc
*
* @desc Header file for functional layer CSL of INTC
*
*/
/** @mainpage Interrupt Controller
*
* @section Introduction
*
* @subsection xxx Purpose and Scope
* The purpose of this document is to detail the CSL APIs for the
* INTC Module.
*
* @subsection aaa Terms and Abbreviations
* -# CSL: Chip Support Library
* -# API: Application Programmer Interface
* -# INTC: Interrupt Controller
*
* @subsection References
* -# CSL 3.x Technical Requirements Specifications Version 0.5, dated
* May 14th, 2003
* -# Inerrupt Controller Specification
*
* @subsection Assumptions
* The abbreviations INTC, Intc and intc have been used throughout this
* document to refer to Interrupt Controller
*/
/* =============================================================================
* Revision History
* ===============
* 12-Jun-2004 Ruchika Kharwar File Created
* 14-Mar-2005 brn Moved the Event Ids to soc64plus.h
* 16-Mar-2005 brn modified for doxygen documentation
* =============================================================================
*/
#ifndef _CSL_INTC_H_
#define _CSL_INTC_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <csl.h>
#include <cslr_intc.h>
#include <soc.h>
/** Number of Events in the System */
#define CSL_INTC_EVENTID_CNT 128
/** Indicates there is no associated event-handler */
#define CSL_INTC_EVTHANDLER_NONE ((CSL_IntcEventHandler) 0)
/** Invalid handle */
#define CSL_INTC_BADHANDLE (0)
/** None mapped */
#define CSL_INTC_MAPPED_NONE (-1)
/**
* Interrupt Vector IDs
*/
typedef enum {
/** Should be used only along with CSL_intcHookIsr() */
CSL_INTC_VECTID_NMI = 1,
/** CPU Vector 4 */
CSL_INTC_VECTID_4 = 4,
/** CPU Vector 5 */
CSL_INTC_VECTID_5 = 5,
/** CPU Vector 6 */
CSL_INTC_VECTID_6 = 6,
/** CPU Vector 7 */
CSL_INTC_VECTID_7 = 7,
/** CPU Vector 8 */
CSL_INTC_VECTID_8 = 8,
/** CPU Vector 9 */
CSL_INTC_VECTID_9 = 9,
/** CPU Vector 10 */
CSL_INTC_VECTID_10 = 10,
/** CPU Vector 11 */
CSL_INTC_VECTID_11 = 11,
/** CPU Vector 12 */
CSL_INTC_VECTID_12 = 12,
/** CPU Vector 13 */
CSL_INTC_VECTID_13 = 13,
/** CPU Vector 14 */
CSL_INTC_VECTID_14 = 14,
/** CPU Vector 15 */
CSL_INTC_VECTID_15 = 15,
/** Should be used at the time of opening an Event handle
* to specify that the event needs to go to the combiner
*/
CSL_INTC_VECTID_COMBINE = 16,
/** Should be used at the time of opening an Event handle
* to specify that the event needs to go to the exception
* combiner.
*/
CSL_INTC_VECTID_EXCEP = 17
} CSL_IntcVectId;
/**
* Interrupt Event IDs
*/
typedef Int CSL_IntcEventId;
/**
* 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 {
/**
* @brief Enables the event
* @param CSL_IntcEnableState
*/
CSL_INTC_CMD_EVTENABLE = 0,
/**
* @brief Disables the event
* @param CSL_IntcEnableState
*/
CSL_INTC_CMD_EVTDISABLE = 1,
/**
* @brief Sets the event manually
* @param None
*/
CSL_INTC_CMD_EVTSET =2,
/**
* @brief Clears the event (if pending)
* @param None
*/
CSL_INTC_CMD_EVTCLEAR =3,
/**
* @brief Enables the Drop Event detection feature for this event
* @param None
*/
CSL_INTC_CMD_EVTDROPENABLE =4,
/**
* @brief Disables the Drop Event detection feature for this event
* @param None
*/
CSL_INTC_CMD_EVTDROPDISABLE =5,
/**
* @brief To be used ONLY to invoke the associated Function handle
* with Event when the user is writing an exception handling routine.
* @param None
*/
CSL_INTC_CMD_EVTINVOKEFUNCTION = 6
} CSL_IntcHwControlCmd;
/**
* 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 {
/**
* @brief The Pend Status of the Event is queried
* @param Bool
*/
CSL_INTC_QUERY_PENDSTATUS
}CSL_IntcHwStatusQuery;
/**
* Enumeration of the exception mask registers
*
* These are the symbols used along with the value to be programmed
* into the Exception mask register.
*/
typedef enum {
/**
* @brief Symbol for EXPMASK[0]
* @param BitMask for EXPMASK0
*/
CSL_INTC_EXCEP_0TO31 = 0,
/**
* @brief Symbol for EXPMASK[1]
* @param BitMask for EXPMASK1
*/
CSL_INTC_EXCEP_32TO63 = 1,
/**
* @brief Symbol for EXPMASK[2]
* @param BitMask for EXPMASK2
*/
CSL_INTC_EXCEP_64TO95 = 2,
/**
* @brief Symbol for EXPMASK[3]
* @param BitMask for EXPMASK3
*/
CSL_INTC_EXCEP_96TO127 = 3
} CSL_IntcExcepEn;
/**
* Enumeration of the exception
* These are the symbols used along with the Exception Clear API
*/
typedef enum {
/**
* @brief Symbol for NMI
* @param None
*/
CSL_INTC_EXCEPTION_NMI = 31,
/**
* @brief Symbol for External Exception
* @param None
*/
CSL_INTC_EXCEPTION_EXT = 30,
/**
* @brief Symbol for Internal Exception
* @param None
*/
CSL_INTC_EXCEPTION_INT = 1,
/**
* @brief Symbol for Software Exception
* @param None
*/
CSL_INTC_EXCEPTION_SW = 0
} CSL_IntcExcep;
/**
* Event Handler pointer
*
* Event handlers ought to conform to this type
*/
typedef void (* CSL_IntcEventHandler)(void *);
/**
* Event Handler Record
*
* Used to set-up the event-handler using CSL_intcPlugEventHandler(..)
*/
typedef struct {
/** pointer to the event handler */
CSL_IntcEventHandler handler;
/** the argument to be passed to the handler when it is invoked */
void * arg;
} CSL_IntcEventHandlerRecord;
/**
* INTC Module Context.
*/
typedef struct {
/** Pointer to the event handle record */
CSL_IntcEventHandlerRecord* eventhandlerRecord;
/** Event allocation mask */
CSL_BitMask32 eventAllocMask[(CSL_INTC_EVENTID_CNT + 31) / 32];
/** Number of event entries */
Uint16 numEvtEntries;
/** Reserved */
Int8 offsetResv[128];
} CSL_IntcContext;
/**
* Event enable state
*/
typedef Uint32 CSL_IntcEventEnableState;
/**
* Global Interrupt enable state
*/
typedef Uint32 CSL_IntcGlobalEnableState;
/**
* The interrupt handle object
* This object is used by the handle to identify the event.
*/
typedef struct CSL_IntcObj {
/** The event-id */
CSL_IntcEventId eventId;
/** The vector-id */
CSL_IntcVectId vectId;
} CSL_IntcObj;
/**
* The drop status structure
*
* This object is used along with the CSL_intcQueryDropStatus()
* API.
*/
typedef struct {
/** whether dropped/not */
Bool drop;
/** The event-id */
CSL_IntcEventId eventId;
/** The vect-id */
CSL_IntcVectId vectId;
}CSL_IntcDropStatus;
/**
* INTC module parameters for open
*
* This is equivalent to the Vector Id for the event number.
*/
typedef CSL_IntcVectId CSL_IntcParam;
/**
* 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;
/* ============================================================================
* @n@b CSL_intcInit
*
* @b Description
* @n This is the initialization function for the INTC. This function is
* idempotent in that calling it many times is same as calling it once.
* This function initializes the CSL data structures, and doesn't affect
* the H/W.
*
* @b Arguments
* @verbatim
pContext Pointer to module-context structure
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Always returns
*
* <b> Pre Condition </b>
* @n This function should be called before using any of the CSL INTC APIs.
* The context should be initialized such that numEvtEntries is equal to
* the number of records capable of being held in the eventhandlerRecord
*
* <b> Post Condition </b>
* @n None
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_IntcContext context;
CSL_Status intStat;
CSL_IntcParam vectId;
CSL_IntcEventHandlerRecord recordTable[10];
context.numEvtEntries = 10;
context.eventhandlerRecord = &recordTable;
// Init Module
...
if (CSL_intcInit(&context) != CSL_SOK) {
exit;
}
@endverbatim
* =============================================================================
*/
CSL_Status CSL_intcInit (
CSL_IntcContext *pContext
);
/* ============================================================================
* @n@b CSL_intcOpen
*
* @b Description
* @n The API would reserve an interrupt-event for use. It returns
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -