00001 /* 00002 * Copyright (c) 2011, 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 * */ 00068 #ifndef ti_ipc_ListMP__include 00069 #define ti_ipc_ListMP__include 00070 00071 #include <ti/ipc/SharedRegion.h> 00072 #include <ti/ipc/GateMP.h> 00073 00074 #if defined (__cplusplus) 00075 extern "C" { 00076 #endif 00077 00078 /* ============================================================================= 00079 * All success and failure codes for the module 00080 * ============================================================================= 00081 */ 00082 00087 #define ListMP_S_BUSY 2 00088 00093 #define ListMP_S_ALREADYSETUP 1 00094 00099 #define ListMP_S_SUCCESS 0 00100 00105 #define ListMP_E_FAIL -1 00106 00111 #define ListMP_E_INVALIDARG -2 00112 00117 #define ListMP_E_MEMORY -3 00118 00123 #define ListMP_E_ALREADYEXISTS -4 00124 00129 #define ListMP_E_NOTFOUND -5 00130 00135 #define ListMP_E_TIMEOUT -6 00136 00141 #define ListMP_E_INVALIDSTATE -7 00142 00147 #define ListMP_E_OSFAILURE -8 00148 00153 #define ListMP_E_RESOURCE -9 00154 00159 #define ListMP_E_RESTART -10 00160 00161 /* ============================================================================= 00162 * Structures & Enums 00163 * ============================================================================= 00164 */ 00165 00169 typedef struct ListMP_Object *ListMP_Handle; 00170 00174 typedef struct ListMP_Elem { 00175 volatile SharedRegion_SRPtr next; 00178 volatile SharedRegion_SRPtr prev; 00181 } ListMP_Elem; 00182 00186 typedef struct ListMP_Params { 00187 GateMP_Handle gate; 00195 Ptr sharedAddr; 00205 String name; 00216 UInt16 regionId; 00224 } ListMP_Params; 00225 00226 /* ============================================================================= 00227 * ListMP Module-wide Functions 00228 * ============================================================================= 00229 */ 00230 00236 Void ListMP_Params_init(ListMP_Params *params); 00237 00247 ListMP_Handle ListMP_create(const ListMP_Params *params); 00248 00265 Int ListMP_close(ListMP_Handle *handlePtr); 00266 00278 Int ListMP_delete(ListMP_Handle *handlePtr); 00279 00312 Int ListMP_open(String name, ListMP_Handle *handlePtr); 00313 00342 Int ListMP_openByAddr(Ptr sharedAddr, ListMP_Handle *handlePtr); 00343 00358 SizeT ListMP_sharedMemReq(const ListMP_Params *params); 00359 00362 /* ============================================================================= 00363 * ListMP Per-instance Functions 00364 * ============================================================================= 00365 */ 00366 00374 Bool ListMP_empty(ListMP_Handle handle); 00375 00383 GateMP_Handle ListMP_getGate(ListMP_Handle handle); 00384 00396 Ptr ListMP_getHead(ListMP_Handle handle); 00397 00409 Ptr ListMP_getTail(ListMP_Handle handle); 00410 00435 Int ListMP_insert(ListMP_Handle handle, 00436 ListMP_Elem *newElem, 00437 ListMP_Elem *curElem); 00438 00478 Ptr ListMP_next(ListMP_Handle handle, ListMP_Elem *elem); 00479 00518 Ptr ListMP_prev(ListMP_Handle handle, ListMP_Elem *elem); 00519 00533 Int ListMP_putHead(ListMP_Handle handle, ListMP_Elem *elem); 00534 00548 Int ListMP_putTail(ListMP_Handle handle, ListMP_Elem *elem); 00549 00565 Int ListMP_remove(ListMP_Handle handle, ListMP_Elem *elem); 00566 00567 #if defined (__cplusplus) 00568 } 00569 #endif /* defined (__cplusplus) */ 00570 00571 #endif /* ti_ipc_ListMP__include */ 00572 00573 /* 00574 */ 00575 00576 /* 00577 * @(#) ti.ipc; 1, 0, 0, 0,141; 6-18-2011 18:44:46; /db/vtree/library/trees/ipc/ipc.git/src/ ipc-f30 00578 */ 00579