1 /******************************************************************************
3 * Copyright (C) 2002 - 2014 Xilinx, Inc. All rights reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
31 ******************************************************************************/
32 /*****************************************************************************/
35 * @file xintc_options.c
37 * Contains option functions for the XIntc driver. These functions allow the
38 * user to configure an instance of the XIntc driver. This file requires other
39 * files of the component to be linked in also.
42 * MODIFICATION HISTORY:
44 * Ver Who Date Changes
45 * ----- ---- -------- -----------------------------------------------------
46 * 1.00b jhl 02/21/02 First release
47 * 1.00c rpm 10/17/03 New release. Support the relocation of the options flag
48 * from the instance structure to the xintc_g.c
49 * configuration table.
50 * 1.10c mta 03/21/07 Updated to new coding style
51 * 2.00a ktn 10/20/09 Updated to use HAL Processor APIs
52 * 2.06a bss 01/28/13 To support Cascade mode:
53 * Modified XIntc_SetOptions API.
56 ******************************************************************************/
58 /***************************** Include Files *********************************/
60 #include "xil_types.h"
61 #include "xil_assert.h"
64 /************************** Constant Definitions *****************************/
67 /**************************** Type Definitions *******************************/
70 /***************** Macros (Inline Functions) Definitions *********************/
73 /************************** Function Prototypes ******************************/
76 /************************** Variable Definitions *****************************/
79 /*****************************************************************************/
82 * Set the options for the interrupt controller driver. In Cascade mode same
83 * Option is set to Slave controllers.
85 * @param InstancePtr is a pointer to the XIntc instance to be worked on.
86 * @param Options to be set. The available options are described in
90 * - XST_SUCCESS if the options were set successfully
91 * - XST_INVALID_PARAM if the specified option was not valid
95 ****************************************************************************/
96 int XIntc_SetOptions(XIntc * InstancePtr, u32 Options)
100 Xil_AssertNonvoid(InstancePtr != NULL);
101 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
104 * Make sure option request is valid
106 if ((Options == XIN_SVC_SGL_ISR_OPTION) ||
107 (Options == XIN_SVC_ALL_ISRS_OPTION)) {
108 InstancePtr->CfgPtr->Options = Options;
109 /* If Cascade mode set the option for all Slaves */
110 if (InstancePtr->CfgPtr->IntcType != XIN_INTC_NOCASCADE) {
112 for (Index = 1; Index <= XPAR_XINTC_NUM_INSTANCES - 1;
114 CfgPtr = XIntc_LookupConfig(Index);
115 CfgPtr->Options = Options;
121 return XST_INVALID_PARAM;
125 /*****************************************************************************/
128 * Return the currently set options.
130 * @param InstancePtr is a pointer to the XIntc instance to be worked on.
132 * @return The currently set options. The options are described in xintc.h.
136 ****************************************************************************/
137 u32 XIntc_GetOptions(XIntc * InstancePtr)
140 * Assert the arguments
142 Xil_AssertNonvoid(InstancePtr != NULL);
143 Xil_AssertNonvoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
145 return InstancePtr->CfgPtr->Options;