IPC API  3.40.00.06
ListMP.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2013, 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  */
68 #ifndef ti_ipc_ListMP__include
69 #define ti_ipc_ListMP__include
70 
71 #include <ti/ipc/SharedRegion.h>
72 #include <ti/ipc/GateMP.h>
73 
74 #if defined (__cplusplus)
75 extern "C" {
76 #endif
77 
78 /* =============================================================================
79  * All success and failure codes for the module
80  * =============================================================================
81  */
82 
86 #define ListMP_S_BUSY 2
87 
91 #define ListMP_S_ALREADYSETUP 1
92 
96 #define ListMP_S_SUCCESS 0
97 
101 #define ListMP_E_FAIL -1
102 
106 #define ListMP_E_INVALIDARG -2
107 
111 #define ListMP_E_MEMORY -3
112 
116 #define ListMP_E_ALREADYEXISTS -4
117 
121 #define ListMP_E_NOTFOUND -5
122 
126 #define ListMP_E_TIMEOUT -6
127 
131 #define ListMP_E_INVALIDSTATE -7
132 
136 #define ListMP_E_OSFAILURE -8
137 
141 #define ListMP_E_RESOURCE -9
142 
146 #define ListMP_E_RESTART -10
147 
148 /* =============================================================================
149  * Structures & Enums
150  * =============================================================================
151  */
152 
156 typedef struct ListMP_Object *ListMP_Handle;
157 
161 typedef struct ListMP_Elem {
168 } ListMP_Elem;
169 
173 typedef struct ListMP_Params {
182  Ptr sharedAddr;
192  String name;
203  UInt16 regionId;
211 } ListMP_Params;
212 
213 /* =============================================================================
214  * ListMP Module-wide Functions
215  * =============================================================================
216  */
217 
223 Void ListMP_Params_init(ListMP_Params *params);
224 
234 ListMP_Handle ListMP_create(const ListMP_Params *params);
235 
252 Int ListMP_close(ListMP_Handle *handlePtr);
253 
265 Int ListMP_delete(ListMP_Handle *handlePtr);
266 
300 Int ListMP_open(String name, ListMP_Handle *handlePtr);
301 
330 Int ListMP_openByAddr(Ptr sharedAddr, ListMP_Handle *handlePtr);
331 
346 SizeT ListMP_sharedMemReq(const ListMP_Params *params);
347 
350 /* =============================================================================
351  * ListMP Per-instance Functions
352  * =============================================================================
353  */
354 
362 Bool ListMP_empty(ListMP_Handle handle);
363 
371 GateMP_Handle ListMP_getGate(ListMP_Handle handle);
372 
384 Ptr ListMP_getHead(ListMP_Handle handle);
385 
397 Ptr ListMP_getTail(ListMP_Handle handle);
398 
423 Int ListMP_insert(ListMP_Handle handle,
424  ListMP_Elem *newElem,
425  ListMP_Elem *curElem);
426 
466 Ptr ListMP_next(ListMP_Handle handle, ListMP_Elem *elem);
467 
506 Ptr ListMP_prev(ListMP_Handle handle, ListMP_Elem *elem);
507 
521 Int ListMP_putHead(ListMP_Handle handle, ListMP_Elem *elem);
522 
536 Int ListMP_putTail(ListMP_Handle handle, ListMP_Elem *elem);
537 
553 Int ListMP_remove(ListMP_Handle handle, ListMP_Elem *elem);
554 
555 #if defined (__cplusplus)
556 }
557 #endif /* defined (__cplusplus) */
558 
559 #endif /* ti_ipc_ListMP__include */
struct ListMP_Params ListMP_Params
Structure defining parameter structure for ListMP_create().
struct ListMP_Elem ListMP_Elem
Structure defining a ListMP element.
volatile SharedRegion_SRPtr prev
Definition: ListMP.h:165
Ptr ListMP_getHead(ListMP_Handle handle)
Get an element from front of a ListMP instance.
Ptr ListMP_next(ListMP_Handle handle, ListMP_Elem *elem)
Return the next element in a ListMP instance (non-atomic)
ListMP_Handle ListMP_create(const ListMP_Params *params)
Creates and initializes ListMP module.
struct GateMP_Object * GateMP_Handle
GateMP_Handle type.
Definition: GateMP.h:222
Bool ListMP_empty(ListMP_Handle handle)
Determines if a ListMP instance is empty.
Bits32 SharedRegion_SRPtr
SharedRegion pointer type.
Definition: SharedRegion.h:197
Void ListMP_Params_init(ListMP_Params *params)
Initializes ListMP parameters.
Multiple processor gate that provides local and remote context protection.
Int ListMP_insert(ListMP_Handle handle, ListMP_Elem *newElem, ListMP_Elem *curElem)
Insert an element into a ListMP instance.
Structure defining parameter structure for ListMP_create().
Definition: ListMP.h:173
Ptr ListMP_getTail(ListMP_Handle handle)
Get an element from back of a ListMP instance.
Int ListMP_delete(ListMP_Handle *handlePtr)
Deletes a ListMP instance.
String name
Definition: ListMP.h:192
Int ListMP_close(ListMP_Handle *handlePtr)
Close an opened ListMP instance.
Ptr ListMP_prev(ListMP_Handle handle, ListMP_Elem *elem)
Return the previous element in ListMP instance (non-atomic)
Int ListMP_remove(ListMP_Handle handle, ListMP_Elem *elem)
Remove an element from a ListMP instance.
Int ListMP_putTail(ListMP_Handle handle, ListMP_Elem *elem)
Put an element at back of a ListMP instance.
struct ListMP_Object * ListMP_Handle
ListMP_Handle type.
Definition: ListMP.h:156
UInt16 regionId
Definition: ListMP.h:203
Int ListMP_putHead(ListMP_Handle handle, ListMP_Elem *elem)
Put an element at head of a ListMP instance.
Shared memory manager and address translator.
Structure defining a ListMP element.
Definition: ListMP.h:161
volatile SharedRegion_SRPtr next
Definition: ListMP.h:162
GateMP_Handle gate
Definition: ListMP.h:174
GateMP_Handle ListMP_getGate(ListMP_Handle handle)
Retrieves the GateMP handle associated with the ListMP instance.
Int ListMP_open(String name, ListMP_Handle *handlePtr)
Open a created ListMP instance.
Copyright 2015, Texas Instruments Incorporated