libmetal  v2024.10.0
sys.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, Xilinx Inc. and Contributors. All rights reserved.
3  * Copyright (C) 2023, Advanced Micro Devices, Inc.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 /*
9  * @file generic/xlnx/sys.h
10  * @brief generic xlnx system primitives for libmetal.
11  */
12 
13 #ifndef __METAL_GENERIC_SYS__H__
14 #error "Include metal/sys.h instead of metal/generic/@PROJECT_MACHINE@/sys.h"
15 #endif
16 
17 #ifndef __MICROBLAZE__
18 #include "xscugic.h"
19 #endif
20 
21 #include <metal/assert.h>
22 #include <metal/io.h>
23 #include <metal/sys.h>
24 #include <stdint.h>
25 #include <metal/compiler.h>
26 #include <metal/utilities.h>
27 
28 #include <xil_cache.h>
29 #include <xil_exception.h>
30 #include <xparameters.h>
31 
32 #ifdef SDT
33 #include <metal/system/generic/xlnx/sys_devicetree.h>
34 #endif
35 
36 #ifndef __METAL_GENERIC_XLNX_SYS__H__
37 #define __METAL_GENERIC_XLNX_SYS__H__
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 #ifndef __MICROBLAZE__
44 #define XLNX_MAXIRQS XSCUGIC_MAX_NUM_INTR_INPUTS
45 #endif
46 
47 #if defined(SDT) && !defined(__MICROBLAZE__)
48 #define XPAR_SCUGIC_0_DIST_BASEADDR XPAR_SCUGIC_DIST_BASEADDR
49 #endif
50 
59 void metal_xlnx_irq_isr(void *arg);
60 
69 int metal_xlnx_irq_init(void);
70 
71 /* Microblaze defines these routines */
72 #ifdef __MICROBLAZE__
73 void metal_weak sys_irq_enable(unsigned int vector);
74 
75 void metal_weak sys_irq_disable(unsigned int vector);
76 #else
77 static inline void sys_irq_enable(unsigned int vector)
78 {
79  XScuGic_EnableIntr(XPAR_SCUGIC_0_DIST_BASEADDR, vector);
80 }
81 
82 static inline void sys_irq_disable(unsigned int vector)
83 {
84  XScuGic_DisableIntr(XPAR_SCUGIC_0_DIST_BASEADDR, vector);
85 }
86 #endif
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif /* __METAL_GENERIC_XLNX_SYS__H__ */
#define metal_weak
Definition: compiler.h:21
#define XPAR_SCUGIC_0_DIST_BASEADDR
Definition: sys_devicetree.h:23
int metal_xlnx_irq_init(void)
metal_xlnx_irq_int
Definition: irq.c:62
void metal_xlnx_irq_isr(void *arg)
metal_xlnx_irq_isr
Definition: irq.c:51
static void sys_irq_enable(unsigned int vector)
Definition: sys.h:77
static void sys_irq_disable(unsigned int vector)
Definition: sys.h:82