blob: cad8846a0824991ac389ab8debcfe420fe97bb8d [file] [log] [blame]
Daniel Krueger9d7164c2008-12-19 11:41:57 -08001/****************************************************************************
2
3 (c) SYSTEC electronic GmbH, D-07973 Greiz, August-Bebel-Str. 29
4 www.systec-electronic.com
5
6 Project: Project independend shared buffer (linear + circular)
7
8 Description: Declaration of platform specific part for the
9 shared buffer
10
11 License:
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions
15 are met:
16
17 1. Redistributions of source code must retain the above copyright
18 notice, this list of conditions and the following disclaimer.
19
20 2. Redistributions in binary form must reproduce the above copyright
21 notice, this list of conditions and the following disclaimer in the
22 documentation and/or other materials provided with the distribution.
23
24 3. Neither the name of SYSTEC electronic GmbH nor the names of its
25 contributors may be used to endorse or promote products derived
26 from this software without prior written permission. For written
27 permission, please contact info@systec-electronic.com.
28
29 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
32 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
33 COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
34 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
35 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
37 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
39 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40 POSSIBILITY OF SUCH DAMAGE.
41
42 Severability Clause:
43
44 If a provision of this License is or becomes illegal, invalid or
45 unenforceable in any jurisdiction, that shall not affect:
46 1. the validity or enforceability in that jurisdiction of any other
47 provision of this License; or
48 2. the validity or enforceability in other jurisdictions of that or
49 any other provision of this License.
50
51 -------------------------------------------------------------------------
52
53 2006/06/27 -rs: V 1.00 (initial version)
54
55****************************************************************************/
56
57#ifndef _SHBIPC_H_
58#define _SHBIPC_H_
59
Daniel Krueger9d7164c2008-12-19 11:41:57 -080060//---------------------------------------------------------------------------
61// Type definitions
62//---------------------------------------------------------------------------
63
Greg Kroah-Hartmane0ca0592008-12-19 17:09:38 -080064typedef int (*tSigHndlrNewData) (tShbInstance pShbInstance_p);
65typedef void (*tSigHndlrJobReady) (tShbInstance pShbInstance_p,
66 unsigned int fTimeOut_p);
Daniel Krueger9d7164c2008-12-19 11:41:57 -080067
68#if (TARGET_SYSTEM == _WIN32_)
Greg Kroah-Hartmane0ca0592008-12-19 17:09:38 -080069#if defined(INLINE_FUNCTION_DEF)
70#undef INLINE_FUNCTION
71#define INLINE_FUNCTION INLINE_FUNCTION_DEF
72#define SHBIPC_INLINE_ENABLED TRUE
73#define SHBIPC_INLINED
74#include "ShbIpc-Win32.c"
Daniel Krueger9d7164c2008-12-19 11:41:57 -080075#endif
76
Greg Kroah-Hartmane0ca0592008-12-19 17:09:38 -080077#elif (TARGET_SYSTEM == _LINUX_)
78#if defined(INLINE_FUNCTION_DEF)
79#undef INLINE_FUNCTION
80#define INLINE_FUNCTION INLINE_FUNCTION_DEF
81#define SHBIPC_INLINE_ENABLED TRUE
82#define SHBIPC_INLINED
83#include "ShbIpc-LinuxKernel.c"
84#endif
85#endif
Daniel Krueger9d7164c2008-12-19 11:41:57 -080086
87//---------------------------------------------------------------------------
88// Prototypes
89//---------------------------------------------------------------------------
90
Greg Kroah-Hartmane0ca0592008-12-19 17:09:38 -080091tShbError ShbIpcInit(void);
92tShbError ShbIpcExit(void);
Daniel Krueger9d7164c2008-12-19 11:41:57 -080093
Greg Kroah-Hartmane0ca0592008-12-19 17:09:38 -080094tShbError ShbIpcAllocBuffer(unsigned long ulBufferSize_p,
95 const char *pszBufferID_p,
96 tShbInstance * ppShbInstance_p,
97 unsigned int *pfShbNewCreated_p);
98tShbError ShbIpcReleaseBuffer(tShbInstance pShbInstance_p);
Daniel Krueger9d7164c2008-12-19 11:41:57 -080099
100#if !defined(SHBIPC_INLINE_ENABLED)
101
Greg Kroah-Hartmane0ca0592008-12-19 17:09:38 -0800102tShbError ShbIpcEnterAtomicSection(tShbInstance pShbInstance_p);
103tShbError ShbIpcLeaveAtomicSection(tShbInstance pShbInstance_p);
Daniel Krueger9d7164c2008-12-19 11:41:57 -0800104
Greg Kroah-Hartmane0ca0592008-12-19 17:09:38 -0800105tShbError ShbIpcStartSignalingNewData(tShbInstance pShbInstance_p,
106 tSigHndlrNewData
107 pfnSignalHandlerNewData_p,
108 tShbPriority ShbPriority_p);
109tShbError ShbIpcStopSignalingNewData(tShbInstance pShbInstance_p);
110tShbError ShbIpcSignalNewData(tShbInstance pShbInstance_p);
Daniel Krueger9d7164c2008-12-19 11:41:57 -0800111
Greg Kroah-Hartmane0ca0592008-12-19 17:09:38 -0800112tShbError ShbIpcStartSignalingJobReady(tShbInstance pShbInstance_p,
113 unsigned long ulTimeOut_p,
114 tSigHndlrJobReady
115 pfnSignalHandlerJobReady_p);
116tShbError ShbIpcSignalJobReady(tShbInstance pShbInstance_p);
Daniel Krueger9d7164c2008-12-19 11:41:57 -0800117
Greg Kroah-Hartmane0ca0592008-12-19 17:09:38 -0800118void *ShbIpcGetShMemPtr(tShbInstance pShbInstance_p);
Daniel Krueger9d7164c2008-12-19 11:41:57 -0800119#endif
120
Greg Kroah-Hartmane0ca0592008-12-19 17:09:38 -0800121#undef SHBIPC_INLINE_ENABLED // disable actual inlining of functions
Daniel Krueger9d7164c2008-12-19 11:41:57 -0800122#undef INLINE_FUNCTION
Greg Kroah-Hartmane0ca0592008-12-19 17:09:38 -0800123#define INLINE_FUNCTION // define INLINE_FUNCTION to nothing
Daniel Krueger9d7164c2008-12-19 11:41:57 -0800124
125#endif // #ifndef _SHBIPC_H_