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 import ti.sdo.utils.MultiProc;
37 import ti.sdo.ipc.interfaces.INotifyDriver;
38 import ti.sdo.ipc.Notify;
39
40 import ti.sysbios.hal.Hwi;
41
42 import xdc.runtime.Assert;
43 import xdc.rov.ViewInfo;
44
45 /*!
46 * ======== NotifyDriverMbx ========
47 * A TI81xx hardware mailbox based driver for the Notify Module.
48 *
49 * This is a {@link ti.sdo.ipc.Notify} driver that uses hardware mailboxes to
50 * transmit notifications to remote processors.
51 *
52 * Unlike the Notify drivers available in the {@link ti.sdo.ipc.notifyDrivers}
53 * package, this driver is not generic and will only work with the TI81xx
54 * family of devices.
55 *
56 * The driver uses no shared memory since the event IDs and payloads that
57 * comprise notifications are transmitted via the hardware mailbox FIFO. The
58 * FIFO can hold up to 4 mailbox messages. The number of notification that can
59 * be stored in the FIFO depends on the sizes of the payloads being sent via
60 * Notify_sendEvent. If the payload is less than 0x7FFFFFF, then a single
61 * message will be sent per notification. Otherwise, if the payload is greater
62 * than or equal to 0x7FFFFFF, two mailbox messages are needed to send the
63 * notification.
64 *
65 * The behavior of Notify_sendEvent when the FIFO is full depends on the value
66 * of the 'waitClear' argument to the function. If 'waitClear' is TRUE, then
67 * Notify_sendEvent will spin waiting for enough room in the FIFO for the
68 * notification before actually sending it. If 'waitClear' is FALSE, then
69 * Notify_sendEvent will return Notify_E_FAIL if there isn't enough room in the
70 * FIFO to store the notification.
71 *
72 * The Notify_[enable/disable]Event APIs are not supported by this driver.
73 *
74 */
75 @InstanceFinalize
76 @ModuleStartup
77 module NotifyDriverMbx inherits ti.sdo.ipc.interfaces.INotifyDriver
78 {
79 /*! @_nodoc */
80 metaonly struct BasicView {
81 String remoteProcName;
82 UInt numIncomingPending;
83 UInt numOutgoingPending;
84 String incomingIntStatus;
85 String outgoingIntStatus;
86 String registeredEvents;
87 }
88
89 /*!
90 * ======== rovViewInfo ========
91 */
92 @Facet
93 metaonly config ViewInfo.Instance rovViewInfo =
94 ViewInfo.create({
95 viewMap: [
96 ['Basic',
97 {
98 type: ViewInfo.INSTANCE,
99 viewInitFxn: 'viewInitBasic',
100 structName: 'BasicView'
101 }
102 ],
103 ]
104 });
105
106 /*!
107 * Assert raised when trying to use Notify_[enable/disable]Event with
108 * NotifyDriverMbx
109 */
110 config Assert.Id A_notSupported =
111 {msg: "A_notSupported: [enable/disable]Event not supported by NotifyDriverMbx"};
112
113
114 /*! Base address for the Mailbox subsystem */
115 config UInt32 mailboxBaseAddr = 0x480C8000;
116
117 /*!
118 * ======== intVectorId ========
119 * Interrupt vector ID to be used by the driver.
120 *
121 * This parameter is only used by the DSP core
122 */
123 config UInt intVectorId = ~1u;
124
125 instance:
126
127 /*!
128 * ======== remoteProcId ========
129 * The MultiProc ID corresponding to the remote processor
130 */
131 config UInt16 remoteProcId = MultiProc.INVALIDID;
132
133 internal:
134
135 config UInt16 dspProcId = MultiProc.INVALIDID;
136 config UInt16 hostProcId = MultiProc.INVALIDID;
137 config UInt16 videoProcId = MultiProc.INVALIDID;
138 config UInt16 vpssProcId = MultiProc.INVALIDID;
139
140 /*!
141 * Plugs the interrupt and executes the callback functions according
142 * to event priority
143 */
144 Void isr(UArg arg);
145
146 /*! Instance state structure */
147 struct Instance_State {
148 Bits32 evtRegMask;
149 Notify.Handle notifyHandle;
150 UInt16 remoteProcId;
151 }
152
153 struct Module_State {
154 NotifyDriverMbx.Handle drvHandles[4];
155 Hwi.Object hwi;
156 };
157 }