1 /*
2  * Copyright (c) 2019, Xilinx Inc. and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 /*
8  * @file	softirq.h
9  * @brief	Soft Interrupt handling primitives for libmetal.
10  */
11 
12 #ifndef __METAL_SOFTIRQ__H__
13 #define __METAL_SOFTIRQ__H__
14 
15 #include <metal/irq.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /** \defgroup soft irq Interrupt Handling Interfaces
22  *  @{
23  */
24 
25 /**
26  * @brief	metal_softirq_init
27  *
28  * Initialize libmetal soft IRQs controller
29  *
30  * @return 0 on success, or negative value for failure
31  */
32 int metal_softirq_init(void);
33 
34 /**
35  * @brief	metal_softirq_dispatch
36  *
37  * Dispatch the pending soft IRQs
38  */
39 void metal_softirq_dispatch(void);
40 
41 /**
42  * @brief	metal_softirq_allocate
43  *
44  * Allocate soft IRQs
45  *
46  * This function doesn't have any locking, it is not supposed
47  * to be called by multiple threads.
48  *
49  * @param[in]  num number of soft irqs requested
50  * @return soft irq base for success, or negative value for failure
51  */
52 int metal_softirq_allocate(int num);
53 
54 /**
55  * @brief	metal_softirq_set
56  *
57  * Set soft IRQ to pending
58  *
59  * @param[in]  irq soft IRQ ID to set
60  */
61 void metal_softirq_set(int irq);
62 
63 /** @} */
64 
65 #ifdef __cplusplus
66 }
67 #endif
68 
69 #endif /* __METAL_SOFTIRQ__H__ */
70