![]() |
![]() |
00001 /* 00002 * Copyright (c) 2010, Texas Instruments Incorporated 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions 00007 * are met: 00008 * 00009 * * Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * 00012 * * Redistributions in binary form must reproduce the above copyright 00013 * notice, this list of conditions and the following disclaimer in the 00014 * documentation and/or other materials provided with the distribution. 00015 * 00016 * * Neither the name of Texas Instruments Incorporated nor the names of 00017 * its contributors may be used to endorse or promote products derived 00018 * from this software without specific prior written permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00021 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00022 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00023 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 00024 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00025 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00026 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 00027 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00028 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00029 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 00030 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 * */ 00063 #ifndef ti_ipc_ListMP__include 00064 #define ti_ipc_ListMP__include 00065 00066 #include <ti/ipc/SharedRegion.h> 00067 #include <ti/ipc/GateMP.h> 00068 00069 #if defined (__cplusplus) 00070 extern "C" { 00071 #endif 00072 00073 /* ============================================================================= 00074 * All success and failure codes for the module 00075 * ============================================================================= 00076 */ 00077 00082 #define ListMP_S_BUSY 2 00083 00088 #define ListMP_S_ALREADYSETUP 1 00089 00094 #define ListMP_S_SUCCESS 0 00095 00100 #define ListMP_E_FAIL -1 00101 00106 #define ListMP_E_INVALIDARG -2 00107 00112 #define ListMP_E_MEMORY -3 00113 00118 #define ListMP_E_ALREADYEXISTS -4 00119 00124 #define ListMP_E_NOTFOUND -5 00125 00130 #define ListMP_E_TIMEOUT -6 00131 00136 #define ListMP_E_INVALIDSTATE -7 00137 00142 #define ListMP_E_OSFAILURE -8 00143 00148 #define ListMP_E_RESOURCE -9 00149 00154 #define ListMP_E_RESTART -10 00155 00156 /* ============================================================================= 00157 * Structures & Enums 00158 * ============================================================================= 00159 */ 00160 00164 typedef struct ListMP_Object *ListMP_Handle; 00165 00169 typedef struct ListMP_Elem { 00170 volatile SharedRegion_SRPtr next; 00173 volatile SharedRegion_SRPtr prev; 00176 } ListMP_Elem; 00177 00181 typedef struct ListMP_Params { 00182 GateMP_Handle gate; 00190 Ptr sharedAddr; 00200 String name; 00208 UInt16 regionId; 00216 } ListMP_Params; 00217 00218 /* ============================================================================= 00219 * ListMP Module-wide Functions 00220 * ============================================================================= 00221 */ 00222 00228 Void ListMP_Params_init(ListMP_Params *params); 00229 00239 ListMP_Handle ListMP_create(const ListMP_Params *params); 00240 00258 Int ListMP_close(ListMP_Handle *handlePtr); 00259 00271 Int ListMP_delete(ListMP_Handle *handlePtr); 00272 00304 Int ListMP_open(String name, ListMP_Handle *handlePtr); 00305 00334 Int ListMP_openByAddr(Ptr sharedAddr, ListMP_Handle *handlePtr); 00335 00350 SizeT ListMP_sharedMemReq(const ListMP_Params *params); 00351 00354 /* ============================================================================= 00355 * ListMP Per-instance Functions 00356 * ============================================================================= 00357 */ 00358 00366 Bool ListMP_empty(ListMP_Handle handle); 00367 00375 GateMP_Handle ListMP_getGate(ListMP_Handle handle); 00376 00388 Ptr ListMP_getHead(ListMP_Handle handle); 00389 00401 Ptr ListMP_getTail(ListMP_Handle handle); 00402 00427 Int ListMP_insert(ListMP_Handle handle, 00428 ListMP_Elem *newElem, 00429 ListMP_Elem *curElem); 00430 00470 Ptr ListMP_next(ListMP_Handle handle, ListMP_Elem *elem); 00471 00510 Ptr ListMP_prev(ListMP_Handle handle, ListMP_Elem *elem); 00511 00525 Int ListMP_putHead(ListMP_Handle handle, ListMP_Elem *elem); 00526 00540 Int ListMP_putTail(ListMP_Handle handle, ListMP_Elem *elem); 00541 00557 Int ListMP_remove(ListMP_Handle handle, ListMP_Elem *elem); 00558 00559 #if defined (__cplusplus) 00560 } 00561 #endif /* defined (__cplusplus) */ 00562 00563 #endif /* ti_ipc_ListMP__include */ 00564 00565 /* 00566 */ 00567 00568 /* 00569 * @(#) ti.ipc; 1, 0, 0, 0,83; 4-9-2010 18:37:32; /db/vtree/library/trees/ipc/ipc-d23x/src/ 00570 */ 00571