]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blob - psdk_cust/ipc_3_43_00_00_eng/docs/cdoc/ti/sdo/ipc/family/vayu/NotifyDriverMbx-src.html
Update test_arm and test_dsp projects for new locations of IPC and PDK eng
[processor-sdk/performance-audio-sr.git] / psdk_cust / ipc_3_43_00_00_eng / docs / cdoc / ti / sdo / ipc / family / vayu / NotifyDriverMbx-src.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html><head><title>module ti.sdo.ipc.family.vayu.NotifyDriverMbx</title>
3 <meta name="googlebot" content="noindex,nofollow">
4 <link rel="stylesheet" type="text/css" href="../../../../../src.css"/>
5 </head>
6 <body>
7 <pre class=src>
8      1    <span class="comment">/*
9 </span>     2    <span class="comment"> * Copyright (c) 2014 Texas Instruments Incorporated - http://www.ti.com
10 </span>     3    <span class="comment"> * All rights reserved.
11 </span>     4    <span class="comment"> *
12 </span>     5    <span class="comment"> * Redistribution and use in source and binary forms, with or without
13 </span>     6    <span class="comment"> * modification, are permitted provided that the following conditions
14 </span>     7    <span class="comment"> * are met:
15 </span>     8    <span class="comment"> *
16 </span>     9    <span class="comment"> * *  Redistributions of source code must retain the above copyright
17 </span>    10    <span class="comment"> *    notice, this list of conditions and the following disclaimer.
18 </span>    11    <span class="comment"> *
19 </span>    12    <span class="comment"> * *  Redistributions in binary form must reproduce the above copyright
20 </span>    13    <span class="comment"> *    notice, this list of conditions and the following disclaimer in the
21 </span>    14    <span class="comment"> *    documentation and/or other materials provided with the distribution.
22 </span>    15    <span class="comment"> *
23 </span>    16    <span class="comment"> * *  Neither the name of Texas Instruments Incorporated nor the names of
24 </span>    17    <span class="comment"> *    its contributors may be used to endorse or promote products derived
25 </span>    18    <span class="comment"> *    from this software without specific prior written permission.
26 </span>    19    <span class="comment"> *
27 </span>    20    <span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28 </span>    21    <span class="comment"> * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
29 </span>    22    <span class="comment"> * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 </span>    23    <span class="comment"> * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
31 </span>    24    <span class="comment"> * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32 </span>    25    <span class="comment"> * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33 </span>    26    <span class="comment"> * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
34 </span>    27    <span class="comment"> * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
35 </span>    28    <span class="comment"> * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
36 </span>    29    <span class="comment"> * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
37 </span>    30    <span class="comment"> * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 </span>    31    <span class="comment"> */</span>
39     32    
40     33    <span class="comment">/*
41 </span>    34    <span class="comment"> *  ======== NotifyDriverMbx.xdc ================
42 </span>    35    <span class="comment"> */</span>
43     36    <span class=key>package</span> ti.sdo.ipc.family.vayu;
44     37    
45     38    import ti.sdo.utils.MultiProc;
46     39    import ti.sdo.ipc.interfaces.INotifyDriver;
47     40    import ti.sdo.ipc.Notify;
48     41    
49     42    import ti.sysbios.hal.Hwi;
50     43    
51     44    import xdc.runtime.Assert;
52     45    import xdc.rov.ViewInfo;
53     46    
54     47    <span class="xdoc">/*!
55 </span>    48    <span class="xdoc"> *  ======== NotifyDriverMbx ========
56 </span>    49    <span class="xdoc"> *  A notify driver based on hardware mailbox.
57 </span>    50    <span class="xdoc"> *
58 </span>    51    <span class="xdoc"> *  This notify driver uses hardware mailboxes to transmit notifications
59 </span>    52    <span class="xdoc"> *  to remote processors. This driver implements the
60 </span>    53    <span class="xdoc"> *  {<b>@link</b> ti.sdo.ipc.interfaces.INotifyDriver} interface.
61 </span>    54    <span class="xdoc"> *
62 </span>    55    <span class="xdoc"> *  Unlike the Notify drivers available in the {<b>@link</b> ti.sdo.ipc.notifyDrivers}
63 </span>    56    <span class="xdoc"> *  package, this driver is not generic and will only work with the Vayu
64 </span>    57    <span class="xdoc"> *  family of devices.
65 </span>    58    <span class="xdoc"> *
66 </span>    59    <span class="xdoc"> *  The driver does not use shared memory. The event IDs and payloads are
67 </span>    60    <span class="xdoc"> *  transmitted via the hardware mailbox FIFO. The FIFO can hold up to 4
68 </span>    61    <span class="xdoc"> *  mailbox messages. The number of notification that can be stored in the
69 </span>    62    <span class="xdoc"> *  FIFO depends on the size of the payloads being sent via Notify_sendEvent.
70 </span>    63    <span class="xdoc"> *  If the payload is less than 0x7FFFFFF, then a single message will be
71 </span>    64    <span class="xdoc"> *  sent per notification. Otherwise, two mailbox messages are needed to
72 </span>    65    <span class="xdoc"> *  send the notification.
73 </span>    66    <span class="xdoc"> *
74 </span>    67    <span class="xdoc"> *  The behavior of Notify_sendEvent when the FIFO is full depends on the
75 </span>    68    <span class="xdoc"> *  value of the 'waitClear' argument to the function. If 'waitClear' is
76 </span>    69    <span class="xdoc"> *  TRUE, then Notify_sendEvent will spin waiting for enough room in the
77 </span>    70    <span class="xdoc"> *  FIFO. If 'waitClear' is FALSE, then Notify_sendEvent will return
78 </span>    71    <span class="xdoc"> *  Notify_E_FAIL.
79 </span>    72    <span class="xdoc"> *
80 </span>    73    <span class="xdoc"> *  The Notify_enableEvent and Notify_disableEvent APIs are not supported
81 </span>    74    <span class="xdoc"> *  by this driver.
82 </span>    75    <span class="xdoc"> */</span>
83     76    @InstanceFinalize
84     77    @ModuleStartup
85     78    
86     79    <span class=key>module</span> NotifyDriverMbx <span class=key>inherits</span> ti.sdo.ipc.interfaces.INotifyDriver
87     80    {
88     81        <span class="xdoc">/*! <b>@_nodoc</b> */</span>
89     82        <span class=key>metaonly</span> <span class=key>struct</span> BasicView {
90     83            String      remoteProc;
91     84        }
92     85    
93     86        <span class="xdoc">/*! <b>@_nodoc</b> */</span>
94     87        <span class=key>metaonly</span> <span class=key>struct</span> MailboxView {
95     88            String      direction;
96     89            String      mailboxAddr;
97     90            Int         subMbxId;
98     91            Int         msgCount;
99     92            Int         mbxInterrupt;
100     93        }
101     94    
102     95        <span class="xdoc">/*!  <b>@_nodoc</b> */</span>
103     96        <span class=key>metaonly</span> <span class=key>struct</span> ModuleView {
104     97            NotifyDriverMbx.Handle  drvHandles[NUM_CORES];
105     98        }
106     99    
107    100        <span class="xdoc">/*!
108 </span>   101    <span class="xdoc">     *  ======== rovViewInfo ========
109 </span>   102    <span class="xdoc">     */</span>
110    103        @Facet
111    104        <span class=key>metaonly</span> <span class=key>config</span> ViewInfo.Instance rovViewInfo =
112    105            ViewInfo.create({
113    106                viewMap: [
114    107                    [<span class="string">'Basic'</span>,
115    108                        {
116    109                            type: ViewInfo.INSTANCE,
117    110                            viewInitFxn: <span class="string">'viewInitBasic'</span>,
118    111                            structName: <span class="string">'BasicView'</span>
119    112                        }
120    113                    ],
121    114                    [<span class="string">'Mailbox'</span>,
122    115                        {
123    116                            type: ViewInfo.INSTANCE_DATA,
124    117                            viewInitFxn: <span class="string">'viewInitMailbox'</span>,
125    118                            structName: <span class="string">'MailboxView'</span>
126    119                        }
127    120                    ]
128    121    <span class=comment>//              ['Module',</span>
129    122    <span class=comment>//                  {</span>
130    123    <span class=comment>//                      type: ViewInfo.MODULE,</span>
131    124    <span class=comment>//                      viewInitFxn: 'viewInitModule',</span>
132    125    <span class=comment>//                      structName: 'ModuleView'</span>
133    126    <span class=comment>//                  }</span>
134    127    <span class=comment>//              ]</span>
135    128                ]
136    129            });
137    130    
138    131        <span class="xdoc">/*!
139 </span>   132    <span class="xdoc">     *  Assert raised when trying to use Notify_[enable/disable]Event with
140 </span>   133    <span class="xdoc">     *  NotifyDriverMbx
141 </span>   134    <span class="xdoc">     */</span>
142    135        <span class=key>config</span> Assert.Id A_notSupported = {
143    136            msg: <span class="string">"A_notSupported: [enable/disable]Event not supported"</span>
144    137        };
145    138    
146    139    <span class=key>instance</span>:
147    140    
148    141        <span class="xdoc">/*!
149 </span>   142    <span class="xdoc">     *  ======== remoteProcId ========
150 </span>   143    <span class="xdoc">     *  The MultiProc ID corresponding to the remote processor
151 </span>   144    <span class="xdoc">     *
152 </span>   145    <span class="xdoc">     *  This is a required parameter, it is not optional.
153 </span>   146    <span class="xdoc">     */</span>
154    147        <span class=key>config</span> UInt16 remoteProcId = MultiProc.INVALIDID;
155    148    
156    149        <span class="xdoc">/*!
157 </span>   150    <span class="xdoc">     *  ======== intVectorId ========
158 </span>   151    <span class="xdoc">     *  Interrupt vector ID to be used by the driver.
159 </span>   152    <span class="xdoc">     *
160 </span>   153    <span class="xdoc">     *  This parameter is only used by C66 targets.
161 </span>   154    <span class="xdoc">     *  This is a required parameter, it is not optional.
162 </span>   155    <span class="xdoc">     */</span>
163    156        <span class=key>config</span> UInt intVectorId = ~1u;
164    157    
165    158    <span class=key>internal</span>:
166    159        <span class="comment">/* total number of cores on Vayu SoC */</span>
167    160        <span class=key>const</span> UInt8 NUM_CORES = 11;
168    161    
169    162        <span class="comment">/* number of cores in eve subsystem */</span>
170    163        <span class=key>const</span> UInt8 NUM_EVES = 4;
171    164    
172    165        <span class="comment">/* number of internal eve mailboxes */</span>
173    166        <span class=key>const</span> UInt8 NUM_EVE_MBX = 12;
174    167    
175    168        <span class="comment">/* number of system mailboxes (used by IPC) */</span>
176    169        <span class=key>const</span> UInt8 NUM_SYS_MBX = 4;
177    170    
178    171        <span class="comment">/*  Mailbox table for storing encoded base address, mailbox user ID,
179 </span>   172    <span class="comment">     *  and sub-mailbox index.
180 </span>   173    <span class="comment">     */</span>
181    174        <span class=key>config</span> UInt32 mailboxTable[NUM_CORES * NUM_CORES];
182    175    
183    176        <span class="comment">/* base address table for the mailbox subsystem */</span>
184    177        <span class="comment">/* TODO use the table in NotifySetup module */</span>
185    178        <span class=key>config</span> UInt32 mailboxBaseAddr[NUM_EVE_MBX + NUM_SYS_MBX];
186    179    
187    180        <span class="comment">/* map MultiProc ID to virtual ID, virtId = procIdTable[procId] */</span>
188    181        <span class=key>config</span> UInt32 procIdTable[NUM_CORES];
189    182    
190    183        <span class="xdoc">/*! define MultiProcID for each core to avoid doing this at runtime */</span>
191    184        <span class=key>config</span> UInt eve1ProcId     = MultiProc.INVALIDID;
192    185        <span class=key>config</span> UInt eve2ProcId     = MultiProc.INVALIDID;
193    186        <span class=key>config</span> UInt eve3ProcId     = MultiProc.INVALIDID;
194    187        <span class=key>config</span> UInt eve4ProcId     = MultiProc.INVALIDID;
195    188        <span class=key>config</span> UInt dsp1ProcId     = MultiProc.INVALIDID;
196    189        <span class=key>config</span> UInt dsp2ProcId     = MultiProc.INVALIDID;
197    190        <span class=key>config</span> UInt ipu1_0ProcId   = MultiProc.INVALIDID;
198    191        <span class=key>config</span> UInt ipu2_0ProcId   = MultiProc.INVALIDID;
199    192        <span class=key>config</span> UInt hostProcId     = MultiProc.INVALIDID;
200    193        <span class=key>config</span> UInt ipu1_1ProcId   = MultiProc.INVALIDID;
201    194        <span class=key>config</span> UInt ipu2_1ProcId   = MultiProc.INVALIDID;
202    195    
203    196        <span class="comment">/* plugs the interrupt and executes the callback functions */</span>
204    197        Void isr(UInt16 idx);
205    198    
206    199        <span class="xdoc">/*! instance state structure */</span>
207    200        <span class=key>struct</span> Instance_State {
208    201            Bits32          evtRegMask;     <span class="comment">/* local event register mask        */</span>
209    202            Notify.Handle   notifyHandle;   <span class="comment">/* handle to front-end object       */</span>
210    203            UInt16          remoteProcId;   <span class="comment">/* remote processor ID              */</span>
211    204            UInt16          remoteVirtId;   <span class="comment">/* remote processor virtual ID      */</span>
212    205            Int             cpuIntrNum;     <span class="comment">/* cpu interrupt number             */</span>
213    206        }
214    207    
215    208        <span class=key>struct</span> Module_State {
216    209            <span class="comment">/*  Used by the isr to retrieve the driver handle. This table is
217 </span>   210    <span class="comment">         *  indexed by virtual processorID.
218 </span>   211    <span class="comment">         */</span>
219    212            NotifyDriverMbx.Handle drvHandles[NUM_CORES];
220    213        };
221    214    }
222 </pre>
223 </body></html>