1 /*
2 * Copyright (c) 2015-2017, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32 /**
33 * \ingroup DRV_OSAL_MODULE
34 * \defgroup DRV_OSAL_MuxIntcP MuxIntcP
35 * MuxIntcP interface
36 *
37 * @{
38 */
39 /** ============================================================================
40 * @file MuxIntcP.h
41 *
42 * @brief Interrupt Controller Mux module for the RTOS Porting Interface
43 *
44 *
45 * ============================================================================
46 */
48 #ifndef ti_osal_MuxIntcP__include
49 #define ti_osal_MuxIntcP__include
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
55 #include <stdint.h>
56 #include <stdbool.h>
57 #include <stddef.h>
59 /*!
60 * @brief Status codes for MuxIntcP APIs
61 */
62 typedef enum MuxIntcP_Status_e {
63 MuxIntcP_OK = 0,
64 MuxIntcP_FAILURE = (-(int32_t)1)
65 } MuxIntcP_Status;
66 /* Cross bar MuxNum to be used for MuxIntcP_create() */
67 #define MUXINTCP_CROSSBAR_MUXNUM_DSP1 (0)
68 #define MUXINTCP_CROSSBAR_MUXNUM_DSP2 (1)
69 #define MUXINTCP_CROSSBAR_MUXNUM_IPU1 (2)
70 #define MUXINTCP_CROSSBAR_MUXNUM_IPU2 (3)
71 #define MUXINTCP_CROSSBAR_MUXNUM_MPU (4)
73 #define MUXINTCP_CROSSBAR_MUXNUM_INVALID (-(int32_t)1)
75 /*!
76 * @brief Prototype for the entry function for a cpIntc interrupt
77 */
78 typedef void (*MuxIntcP_Fxn)(uintptr_t arg);
80 /*!
81 * @brief Prototype for the MuxIntc dispatch function
82 */
83 typedef void (*MuxIntcFxn)(uintptr_t arg);
85 /*!
86 * @brief Basic MuxIntcP Input Parameters
87 *
88 * Structure that contains the parameters passed into ::MuxIntcP_create
89 * when creating a MuxIntcP instance.
90 */
91 typedef struct MuxIntcP_inParams_s {
92 /* Input parameters */
93 uintptr_t arg; /*!< Argument passed into the MuxIntc function. */
94 int32_t muxNum; /*!< K2: CIC number; AM: Xbar instance number:MUXINTCP_CROSSBAR_MUXNUM_##,-1: reserved for RM */
95 int32_t muxInEvent; /*!< K2: CIC input event; AM: Xbar input system event; -1: reserved for RM */
96 int32_t muxOutEvent; /*!< K2: Host int num, output int from CIC; AM: Xbar IRQ instance */
97 MuxIntcFxn muxIntcFxn; /*!< K2: ISR function for CIC; AM: not used */
98 } MuxIntcP_inParams;
100 typedef struct MuxIntcP_outParams_s {
101 /* Output parameters */
102 uintptr_t arg; /*!< Argument passed out from the MuxIntc function. */
103 uint32_t eventId; /*!< K2: Mapped CorePac Event Id, input event to CorePac IntC; AM: not used */
104 MuxIntcFxn muxIntcFxn; /*!< K2: CIC dispatch function for Intc; AM: not used */
105 } MuxIntcP_outParams;
107 /*!
108 * @brief Function to create an interrupt controller mux
109 *
110 * @param inParams Pointer to the MuxIntcP input Parameters
111 *
112 * @param outParams Pointer to the MuxIntcP output Parameters
113 *
114 * @return MuxIntcP_Status on MuxIntcP_OK or MuxIntcP_FAILURE
115 */
116 extern MuxIntcP_Status MuxIntcP_create(MuxIntcP_inParams *inParams, MuxIntcP_outParams *outParams);
118 /*!
119 * @brief Function to enable interrupt controller mux for an input event
120 *
121 * @param muxNum Interrupt Controller mux number
122 * @param muxInEvent Interrupt Controller mux input event ID
123 */
124 extern void MuxIntcP_enableInEvent(int32_t muxNum, int32_t muxInEvent);
126 /*!
127 * @brief Function to disable interrupt controller mux for an input event
128 *
129 * @param muxNum Interrupt Controller mux number
130 * @param muxInEvent Interrupt Controller mux input event ID
131 */
132 extern void MuxIntcP_disableInEvent(int32_t muxNum, int32_t muxInEvent);
134 /*!
135 * @brief Function to clear interrupt controller mux for an input event
136 *
137 * @param muxNum Interrupt Controller mux number
138 * @param muxInEvent Interrupt Controller mux input event ID
139 */
140 extern void MuxIntcP_clearInEvent(int32_t muxNum, int32_t muxInEvent);
142 /*!
143 * @brief Function to enable interrupt controller mux for an output event
144 *
145 * @param muxNum Interrupt Controller mux number
146 * @param muxOutEvent Interrupt Controller mux output event ID
147 */
148 extern void MuxIntcP_enableOutEvent(int32_t muxNum, int32_t muxOutEvent);
150 /*!
151 * @brief Function to disable interrupt controller mux for an output event
152 *
153 * @param muxNum Interrupt Controller mux number
154 * @param muxOutEvent Interrupt Controller mux output event ID
155 */
156 extern void MuxIntcP_disableOutEvent(int32_t muxNum, int32_t muxOutEvent);
158 #ifdef __cplusplus
159 }
160 #endif
162 #endif /* ti_osal_MuxIntcP__include */
163 /* @} */