]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blob - packages/ti/sdo/ipc/family/f2837x/NotifyDriverCirc.xdc
Android: fix build issues with Android Marshmallow
[ipc/ipcdev.git] / packages / ti / sdo / ipc / family / f2837x / NotifyDriverCirc.xdc
1 /*
2  * Copyright (c) 2014, 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  *  ======== NotifyDriverCirc.xdc ================
34  */
36 import ti.sdo.utils.MultiProc;
37 import ti.sdo.ipc.interfaces.INotifyDriver;
38 import ti.sdo.ipc.notifyDrivers.IInterrupt;
39 import ti.sdo.ipc.Notify;
41 import xdc.rov.ViewInfo;
43 import xdc.runtime.Assert;
45 /*!
46  *  @_nodoc
47  *  ======== NotifyDriverCirc ========
48  *  Shared memory driver using circular buffer for F2837x devices.
49  *
50  *  This is a {@link ti.sdo.ipc.Notify} driver that utilizes shared memory
51  *  and inter-processor hardware interrupts for notification between cores.
52  *
53  *  This driver is designed to work with only the F2837x family of devices.
54  *  This module needs to be plugged with an appropriate module that implements
55  *  the {@link ti.sdo.ipc.notifyDrivers.IInterrupt} interface for a given
56  *  device.
57  *
58  *  The driver utilizes shared memory in the manner indicated by the following
59  *  diagram.
60  *
61  *  @p(code)
62  *
63  *  NOTE: Processor '0' corresponds to the master C28 and '1' corresponds to
64  *  the slave C28
65  *
66  * sharedAddr -> --------------------------- bytes
67  *               |  eventEntry0  (0)       | 8
68  *               |  eventEntry1  (0)       | 8
69  *               |  ...                    |
70  *               |  eventEntry15 (0)       | 8
71  *               |                         |
72  *               |-------------------------|
73  *               |  eventEntry16 (0)       | 8
74  *               |  eventEntry17 (0)       | 8
75  *               |  ...                    |
76  *               |  eventEntry31 (0)       | 8
77  *               |                         |
78  *               |-------------------------|
79  *               |  putWriteIndex (0)      | 4
80  *               |                         |
81  *               |-------------------------|
82  *               |  getReadIndex (0)       | 4
83  *               |                         |
84  *               |-------------------------|
85  *               |  eventEntry0  (1)       | 8
86  *               |  eventEntry1  (1)       | 8
87  *               |  ...                    |
88  *               |  eventEntry15 (1)       | 8
89  *               |                         |
90  *               |-------------------------|
91  *               |  eventEntry16 (1)       | 8
92  *               |  eventEntry17 (1)       | 8
93  *               |  ...                    |
94  *               |  eventEntry31 (1)       | 8
95  *               |                         |
96  *               |-------------------------|
97  *               |  putWriteIndex (1)      | 4
98  *               |                         |
99  *               |-------------------------|
100  *               |  getReadIndex (1)       | 4
101  *               |                         |
102  *               |-------------------------|
103  *
104  *
105  *  Legend:
106  *  (0), (1) : Owned by the respective processor.
107  *
108  *  @p
109  */
111 @InstanceFinalize
113 module NotifyDriverCirc inherits ti.sdo.ipc.interfaces.INotifyDriver
115     /*! @_nodoc */
116     metaonly struct BasicView {
117         String      remoteProcName;
118         UInt        bufSize;
119         UInt        spinCount;
120         UInt        maxSpinWait;
121     }
123     /*! @_nodoc */
124     metaonly struct EventDataView {
125         UInt        index;
126         String      buffer;
127         Ptr         addr;
128         UInt        eventId;
129         Ptr         payload;
130     }
132     /*!
133      *  ======== rovViewInfo ========
134      */
135     @Facet
136     metaonly config ViewInfo.Instance rovViewInfo =
137         ViewInfo.create({
138             viewMap: [
139                 ['Basic',
140                     {
141                         type: ViewInfo.INSTANCE,
142                         viewInitFxn: 'viewInitBasic',
143                         structName: 'BasicView'
144                     }
145                 ],
146                 ['Events',
147                     {
148                         type: ViewInfo.INSTANCE_DATA,
149                         viewInitFxn: 'viewInitData',
150                         structName: 'EventDataView'
151                     }
152                 ],
153             ]
154         });
156     /*!
157      *  Assert raised when trying to use Notify_[enable/disable]Event with
158      *  NotifyDriverCirc
159      */
160     config Assert.Id A_notSupported =
161         {msg: "A_notSupported: [enable/disable]Event not supported by NotifyDriverCirc"};
163     /*! @_nodoc
164      *  ======== numMsgs ========
165      *  The number of messages or slots in the circular buffer
166      *
167      *  This is used to determine the size of the put and get buffers.
168      *  Each eventEntry is two 32bits wide, therefore the total size
169      *  of each circular buffer is [numMsgs * sizeof(eventEntry)].
170      */
171     config UInt numMsgs = 16;
173     /*!
174      *  ======== sharedMemReq ========
175      *  Amount of shared memory required for creation of each instance
176      *
177      *  @param(params)      Pointer to parameters that will be used in the
178      *                      create
179      *
180      *  @a(returns)         Number of MAUs in shared memory needed to create
181      *                      the instance.
182      */
183     SizeT sharedMemReq(const Params *params);
185     /*! @_nodoc
186      *  ======== sharedMemReqMeta ========
187      *  Amount of shared memory required
188      *
189      *  @param(params)      Pointer to the parameters that will be used in
190      *                      create.
191      *
192      *  @a(returns)         Size of shared memory in MAUs on local processor.
193      */
194     metaonly SizeT sharedMemReqMeta(const Params *params);
196 instance:
198     /*!
199      *  ======== readAddr ========
200      *  Address in shared memory where buffer is placed
201      *
202      *  Use {@link #sharedMemReq} to determine the amount of shared memory
203      *  required.
204      */
205     config Ptr readAddr = null;
207     /*!
208      *  ======== writeAddr ========
209      *  Address in shared memory where buffer is placed
210      *
211      *  Use {@link #sharedMemReq} to determine the amount of shared memory
212      *  required.
213      */
214     config Ptr writeAddr = null;
216 internal:
218     /*!
219      *  ======== localIntId ========
220      *  Local interrupt ID for interrupt line
221      *
222      *  For devices that support multiple inter-processor interrupt lines, this
223      *  configuration parameter allows selecting a specific line to use for
224      *  receiving an interrupt.  The value specified here corresponds to the
225      *  incoming interrupt line on the local processor.
226      */
227     config UInt localIntId;
229     /*!
230      *  ======== remoteIntId ========
231      *  Remote interrupt ID for interrupt line
232      *
233      *  For devices that support multiple inter-processor interrupt lines, this
234      *  configuration parameter allows selecting a specific line to use for
235      *  receiving an interrupt.  The value specified here corresponds to the
236      *  incoming interrupt line on the remote processor.
237      */
238     config UInt remoteIntId;
240     /*! The max index set to (numMsgs - 1) */
241     config UInt maxIndex;
243     /*!
244      *  The modulo index value. Set to (numMsgs / 4).
245      *  Used in the isr for doing cache_wb of readIndex.
246      */
247     config UInt modIndex;
249     /*!
250      *  enable IPC interrupt
251      */
252     Void intEnable();
254     /*!
255      *  disable IPC interrupt
256      */
257     Void intDisable();
259     /*!
260      *  trigger IPC interrupt
261      */
262     Void intSend();
264     /*!
265      *  clear IPC interrupt
266      */
267     UInt intClear();
269     /*!
270      *  executes the callback functions according to event priority
271      */
272     Void isr(UArg arg);
274     /*!
275      *  Structure for each event. This struct is placed in shared memory.
276      */
277     struct EventEntry {
278         volatile Bits32 eventid;
279         volatile Bits32 payload;
280     }
282     /*! Instance state structure */
283     struct Instance_State {
284         EventEntry      *putBuffer;     /* buffer used to put events        */
285         Bits32          *putReadIndex;  /* ptr to readIndex for put buffer  */
286         Bits32          *putWriteIndex; /* ptr to writeIndex for put buffer */
287         EventEntry      *getBuffer;     /* buffer used to get events        */
288         Bits32          *getReadIndex;  /* ptr to readIndex for get buffer  */
289         Bits32          *getWriteIndex; /* ptr to writeIndex for put buffer */
290         Bits32          evtRegMask;     /* local event register mask        */
291         Notify.Handle   notifyHandle;   /* Handle to front-end object       */
292         UInt16          remoteProcId;   /* Remote MultiProc id              */
293     }