SysLink API Reference  2.21.03.11
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ListMP.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, 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 
87 #define ListMP_S_BUSY 2
88 
93 #define ListMP_S_ALREADYSETUP 1
94 
99 #define ListMP_S_SUCCESS 0
100 
105 #define ListMP_E_FAIL -1
106 
111 #define ListMP_E_INVALIDARG -2
112 
117 #define ListMP_E_MEMORY -3
118 
123 #define ListMP_E_ALREADYEXISTS -4
124 
129 #define ListMP_E_NOTFOUND -5
130 
135 #define ListMP_E_TIMEOUT -6
136 
141 #define ListMP_E_INVALIDSTATE -7
142 
147 #define ListMP_E_OSFAILURE -8
148 
153 #define ListMP_E_RESOURCE -9
154 
159 #define ListMP_E_RESTART -10
160 
161 /* =============================================================================
162  * Structures & Enums
163  * =============================================================================
164  */
165 
169 typedef struct ListMP_Object *ListMP_Handle;
170 
174 typedef struct ListMP_Elem {
175  volatile SharedRegion_SRPtr next;
178  volatile SharedRegion_SRPtr prev;
181 } ListMP_Elem;
182 
186 typedef struct ListMP_Params {
195  Ptr sharedAddr;
205  String name;
224 } ListMP_Params;
225 
226 /* =============================================================================
227  * ListMP Module-wide Functions
228  * =============================================================================
229  */
230 
237 
247 ListMP_Handle ListMP_create(const ListMP_Params *params);
248 
265 Int ListMP_close(ListMP_Handle *handlePtr);
266 
278 Int ListMP_delete(ListMP_Handle *handlePtr);
279 
312 Int ListMP_open(String name, ListMP_Handle *handlePtr);
313 
342 Int ListMP_openByAddr(Ptr sharedAddr, ListMP_Handle *handlePtr);
343 
358 SizeT ListMP_sharedMemReq(const ListMP_Params *params);
359 
362 /* =============================================================================
363  * ListMP Per-instance Functions
364  * =============================================================================
365  */
366 
374 Bool ListMP_empty(ListMP_Handle handle);
375 
383 GateMP_Handle ListMP_getGate(ListMP_Handle handle);
384 
397 Ptr ListMP_getHead(ListMP_Handle handle);
398 
411 Ptr ListMP_getTail(ListMP_Handle handle);
412 
437 Int ListMP_insert(ListMP_Handle handle,
438  ListMP_Elem *newElem,
439  ListMP_Elem *curElem);
440 
480 Ptr ListMP_next(ListMP_Handle handle, ListMP_Elem *elem);
481 
520 Ptr ListMP_prev(ListMP_Handle handle, ListMP_Elem *elem);
521 
535 Int ListMP_putHead(ListMP_Handle handle, ListMP_Elem *elem);
536 
550 Int ListMP_putTail(ListMP_Handle handle, ListMP_Elem *elem);
551 
567 Int ListMP_remove(ListMP_Handle handle, ListMP_Elem *elem);
568 
569 #if defined (__cplusplus)
570 }
571 #endif /* defined (__cplusplus) */
572 
573 #endif /* ti_ipc_ListMP__include */
574 
575 /*
576  */
577 
578 /*
579  * @(#) ti.ipc; 1, 0, 0, 0,; 11-7-2012 13:07:52; /db/vtree/library/trees/ipc/ipc-i09/src/ xlibrary
580 
581  */
582 
Copyright 2014, Texas Instruments Incorporated