1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
32 33 34 35
36
37 package ti.sysbios.family.arm.ducati.dm8148;
38
39 import xdc.runtime.Assert;
40 import xdc.runtime.Error;
41
42 import ti.sysbios.interfaces.IHwi;
43
44 /*!
45 * ======== IntMux ========
46 * IntMux Module
47 *
48 * Below is an example of how to override the default mapping of
49 * interrupt 42 so that it is sourced by I2CINT2 rather than its
50 * default mapping to I2CINT1:
51 *
52 * @p(code)
53 * #include <ti/sysbios/family/arm/m3/Hwi.h>
54 * #include <ti/sysbios/family/arm/ducati/dm8148/IntMux.h>
55 *
56 * Void myI2CINT2Handler(UArg arg)
57 * {
58 * System_printf("I2CINT2 arg = %d\n", (UInt)arg);
59 * }
60 *
61 * Int main(Int argc, Char* argv[])
62 * {
63 * Hwi_Params params;
64 *
65 * Hwi_Params_init(¶ms);
66 *
67 * // set IntMux 19 to event number 4 (I2CINT2)
68 * IntMux_setEvent(19, 4);
69 *
70 * // create a corresponding interrupt handler
71 * // notice that Ducati interrupt number 42 corresponds to IntMux 19
72 *
73 * params.arg = 42; // pass the Int number to the handler for demo
74 *
75 * Hwi_create(42, myI2CINT2Handler, ¶ms, NULL);
76 *
77 * BIOS_start();
78 *
79 * return (0);
80 * }
81 * @p
82 *
83 * Here is how you would define the same interrupt handler statically
84 * in a configuration script:
85 *
86 * @p(code)
87 * var Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
88 * var IntMux = xdc.useModule('ti.sysbios.family.arm.ducati.dm8148.IntMux');
89 *
90 * IntMux.setEventMeta(19, 4);
91 *
92 * var hwiParams = new Hwi.Params();
93 * hwiParams.arg = 42;
94 * Program.global.staticHwi = Hwi.create(42, '&myI2CINT2Handler', hwiParams);
95 * @p
96 *
97 * @p(html)
98 * <h3> Calling Context </h3>
99 * <table border="1" cellpadding="3">
100 * <colgroup span="1"></colgroup> <colgroup span="5" align="center"></colgroup>
101 *
102 * <tr><th> Function </th><th> Hwi </th><th> Swi </th><th> Task </th><th> Main </th><th> Startup </th></tr>
103 * <!-- -->
104 * <tr><td> {@link #setEvent} </td><td> Y </td><td> Y </td><td> Y </td><td> Y </td><td> Y </td></tr>
105 * <tr><td colspan="6"> Definitions: <br />
106 * <ul>
107 * <li> <b>Hwi</b>: API is callable from a Hwi thread. </li>
108 * <li> <b>Swi</b>: API is callable from a Swi thread. </li>
109 * <li> <b>Task</b>: API is callable from a Task thread. </li>
110 * <li> <b>Main</b>: API is callable during any of these phases: </li>
111 * <ul>
112 * <li> In your module startup after this module is started (e.g. Mod_Module_startupDone() returns TRUE). </li>
113 * <li> During xdc.runtime.Startup.lastFxns. </li>
114 * <li> During main().</li>
115 * <li> During BIOS.startupFxns.</li>
116 * </ul>
117 * <li> <b>Startup</b>: API is callable during any of these phases:</li>
118 * <ul>
119 * <li> During xdc.runtime.Startup.firstFxns.</li>
120 * <li> In your module startup before this module is started (e.g. Mod_Module_startupDone() returns FALSE).</li>
121 * </ul>
122 * </ul>
123 * </td></tr>
124 *
125 * </table>
126 * @p
127 */
128
129 @DirectCall
130 module IntMux
131 {
132
133 /*!
134 * Assert if interrupt number > 56
135 */
136 config Assert.Id A_badIntNum = {
137 msg: "A_badIntNum: intNum must be <= 56"
138 };
139
140 /*!
141 * Assert if event number > 47
142 */
143 config Assert.Id A_badEventNum = {
144 msg: "A_badIntNum: eventNum must be <= 47"
145 };
146
147 /*!
148 * Address of "DUCATI_INTMUX_0_3" register
149 */
150 config Ptr intMuxBaseAddr = 0x48140F54;
151
152
153 /*!
154 * ======== setEventMeta ========
155 * Set the event number associated with an interrupt.
156 *
157 * Statically sets the event number associated with
158 * an interrupt in the Ducati Interrupt Mux as described
159 * in section 5.9.2 of the Centaurus Architecture Spec.
160 *
161 * @param(intNum) The intMux number (0-56)
162 * @param(eventNum) The event number (0-47)
163 */
164 metaonly Void setEventMeta(UInt intMuxNum, UInt eventNum);
165
166 /*!
167 * ======== setEvent ========
168 * Set the event number associated with an interrupt.
169 *
170 * Dynamically sets the event number associated with
171 * an interrupt in the Ducati Interrupt Mux as described
172 * in section 5.9.2 of the Centaurus Architecture Spec.
173 *
174 * @param(intNum) The intMux number (0-56)
175 * @param(eventNum) The event number (0-47)
176 */
177 Void setEvent(UInt intMuxNum, UInt eventNum);
178
179 internal:
180
181 182 183
184 Void initIntMux();
185
186 config UInt8 intMux[57];
187 }