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 package ti.sdo.ipc.family.tda3xx;
37
38 import ti.sdo.utils.MultiProc;
39 import ti.sdo.ipc.interfaces.INotifyDriver;
40 import ti.sdo.ipc.Notify;
41
42 import ti.sysbios.hal.Hwi;
43
44 import xdc.runtime.Assert;
45 import xdc.rov.ViewInfo;
46
47 /*!
48 * ======== NotifyDriverMbx ========
49 * A notify driver based on hardware mailbox.
50 *
51 * This notify driver uses hardware mailboxes to transmit notifications
52 * to remote processors. This driver implements the
53 * {@link ti.sdo.ipc.interfaces.INotifyDriver} interface.
54 *
55 * Unlike the Notify drivers available in the {@link ti.sdo.ipc.notifyDrivers}
56 * package, this driver is not generic and will only work with the TDA3XX
57 * family of devices.
58 *
59 * The driver does not use shared memory. The event IDs and payloads are
60 * transmitted via the hardware mailbox FIFO. The FIFO can hold up to 4
61 * mailbox messages. The number of notification that can be stored in the
62 * FIFO depends on the size of the payloads being sent via Notify_sendEvent.
63 * If the payload is less than 0x7FFFFFF, then a single message will be
64 * sent per notification. Otherwise, two mailbox messages are needed to
65 * send the notification.
66 *
67 * The behavior of Notify_sendEvent when the FIFO is full depends on the
68 * value of the 'waitClear' argument to the function. If 'waitClear' is
69 * TRUE, then Notify_sendEvent will spin waiting for enough room in the
70 * FIFO. If 'waitClear' is FALSE, then Notify_sendEvent will return
71 * Notify_E_FAIL.
72 *
73 * The Notify_enableEvent and Notify_disableEvent APIs are not supported
74 * by this driver.
75 */
76 @InstanceFinalize
77 @ModuleStartup
78
79 module NotifyDriverMbx inherits ti.sdo.ipc.interfaces.INotifyDriver
80 {
81 /*! @_nodoc */
82 metaonly struct BasicView {
83 String remoteProc;
84 }
85
86 /*! @_nodoc */
87 metaonly struct MailboxView {
88 String direction;
89 String mailboxAddr;
90 Int subMbxId;
91 Int msgCount;
92 Int mbxInterrupt;
93 }
94
95 /*! @_nodoc */
96 metaonly struct ModuleView {
97 NotifyDriverMbx.Handle drvHandles[NUM_CORES];
98 }
99
100 /*!
101 * ======== rovViewInfo ========
102 */
103 @Facet
104 metaonly config ViewInfo.Instance rovViewInfo =
105 ViewInfo.create({
106 viewMap: [
107 ['Basic',
108 {
109 type: ViewInfo.INSTANCE,
110 viewInitFxn: 'viewInitBasic',
111 structName: 'BasicView'
112 }
113 ],
114 ['Mailbox',
115 {
116 type: ViewInfo.INSTANCE_DATA,
117 viewInitFxn: 'viewInitMailbox',
118 structName: 'MailboxView'
119 }
120 ]
121
122
123
124
125
126
127
128 ]
129 });
130
131 /*!
132 * Assert raised when trying to use Notify_[enable/disable]Event with
133 * NotifyDriverMbx
134 */
135 config Assert.Id A_notSupported = {
136 msg: "A_notSupported: [enable/disable]Event not supported"
137 };
138
139 instance:
140
141 /*!
142 * ======== remoteProcId ========
143 * The MultiProc ID corresponding to the remote processor
144 *
145 * This is a required parameter, it is not optional.
146 */
147 config UInt16 remoteProcId = MultiProc.INVALIDID;
148
149 /*!
150 * ======== intVectorId ========
151 * Interrupt vector ID to be used by the driver.
152 *
153 * This parameter is only used by C66 targets.
154 * This is a required parameter, it is not optional.
155 */
156 config UInt intVectorId = ~1u;
157
158 internal:
159
160 const UInt8 NUM_CORES = 5;
161
162
163 const UInt8 NUM_EVES = 1;
164
165
166 const UInt8 NUM_EVE_MBX = 2;
167
168
169 const UInt8 NUM_SYS_MBX = 1;
170
171 172 173
174 config UInt32 mailboxTable[NUM_CORES * NUM_CORES];
175
176
177
178 config UInt32 mailboxBaseAddr[NUM_EVE_MBX + NUM_SYS_MBX];
179
180
181 config UInt32 procIdTable[NUM_CORES];
182
183 /*! define MultiProcID for each core to avoid doing this at runtime */
184 config UInt eve1ProcId = MultiProc.INVALIDID;
185 config UInt dsp1ProcId = MultiProc.INVALIDID;
186 config UInt dsp2ProcId = MultiProc.INVALIDID;
187 config UInt ipu1_0ProcId = MultiProc.INVALIDID;
188 config UInt ipu1_1ProcId = MultiProc.INVALIDID;
189
190
191 Void isr(UInt16 idx);
192
193 /*! instance state structure */
194 struct Instance_State {
195 Bits32 evtRegMask;
196 Notify.Handle notifyHandle;
197 UInt16 remoteProcId;
198 UInt16 remoteVirtId;
199 Int cpuIntrNum;
200 }
201
202 struct Module_State {
203 204 205
206 NotifyDriverMbx.Handle drvHandles[NUM_CORES];
207 };
208 }