1 /******************************************************************************
2 * Copyright (C) 2010 - 2020 Xilinx, Inc. All rights reserved.
3 * SPDX-License-Identifier: MIT
4 ******************************************************************************/
5
6 /*****************************************************************************/
7 /**
8 *
9 * @file xgpiops_sinit.c
10 * @addtogroup gpiops_v3_7
11 * @{
12 *
13 * This file contains the implementation of the XGpioPs driver's static
14 * initialization functionality.
15 *
16 * @note None.
17 *
18 * <pre>
19 *
20 * MODIFICATION HISTORY:
21 *
22 * Ver Who Date Changes
23 * ----- ---- -------- -----------------------------------------------
24 * 1.00a sv 01/15/10 First Release
25 * 3.00 kvn 02/13/15 Modified code for MISRA-C:2012 compliance.
26 * </pre>
27 *
28 ******************************************************************************/
29
30 /***************************** Include Files *********************************/
31
32 #include "xgpiops.h"
33 #include "xparameters.h"
34
35 /************************** Constant Definitions *****************************/
36
37 /**************************** Type Definitions *******************************/
38
39 /***************** Macros (Inline Functions) Definitions *********************/
40
41 /************************** Function Prototypes ******************************/
42
43 /************************** Variable Definitions *****************************/
44 extern XGpioPs_Config XGpioPs_ConfigTable[XPAR_XGPIOPS_NUM_INSTANCES];
45
46 /*****************************************************************************/
47 /**
48 *
49 * This function looks for the device configuration based on the unique device
50 * ID. The table XGpioPs_ConfigTable[] contains the configuration information
51 * for each device in the system.
52 *
53 * @param DeviceId is the unique device ID of the device being looked up.
54 *
55 * @return A pointer to the configuration table entry corresponding to the
56 * given device ID, or NULL if no match is found.
57 *
58 * @note None.
59 *
60 ******************************************************************************/
XGpioPs_LookupConfig(u16 DeviceId)61 XGpioPs_Config *XGpioPs_LookupConfig(u16 DeviceId)
62 {
63 XGpioPs_Config *CfgPtr = NULL;
64 u32 Index;
65
66 for (Index = 0U; Index < (u32)XPAR_XGPIOPS_NUM_INSTANCES; Index++) {
67 if (XGpioPs_ConfigTable[Index].DeviceId == DeviceId) {
68 CfgPtr = &XGpioPs_ConfigTable[Index];
69 break;
70 }
71 }
72
73 return (XGpioPs_Config *)CfgPtr;
74 }
75 /** @} */
76