qlge: bugfix: Pad outbound frames smaller than 60 bytes.
[safe/jmp/linux-2.6] / drivers / staging / epl / ShbIpc.h
1 /****************************************************************************
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
60 //---------------------------------------------------------------------------
61 //  Type definitions
62 //---------------------------------------------------------------------------
63
64 typedef int (*tSigHndlrNewData) (tShbInstance pShbInstance_p);
65 typedef void (*tSigHndlrJobReady) (tShbInstance pShbInstance_p,
66                                    unsigned int fTimeOut_p);
67
68 #if (TARGET_SYSTEM == _WIN32_)
69 #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"
75 #endif
76
77 #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
86
87 //---------------------------------------------------------------------------
88 //  Prototypes
89 //---------------------------------------------------------------------------
90
91 tShbError ShbIpcInit(void);
92 tShbError ShbIpcExit(void);
93
94 tShbError ShbIpcAllocBuffer(unsigned long ulBufferSize_p,
95                             const char *pszBufferID_p,
96                             tShbInstance * ppShbInstance_p,
97                             unsigned int *pfShbNewCreated_p);
98 tShbError ShbIpcReleaseBuffer(tShbInstance pShbInstance_p);
99
100 #if !defined(SHBIPC_INLINE_ENABLED)
101
102 tShbError ShbIpcEnterAtomicSection(tShbInstance pShbInstance_p);
103 tShbError ShbIpcLeaveAtomicSection(tShbInstance pShbInstance_p);
104
105 tShbError ShbIpcStartSignalingNewData(tShbInstance pShbInstance_p,
106                                       tSigHndlrNewData
107                                       pfnSignalHandlerNewData_p,
108                                       tShbPriority ShbPriority_p);
109 tShbError ShbIpcStopSignalingNewData(tShbInstance pShbInstance_p);
110 tShbError ShbIpcSignalNewData(tShbInstance pShbInstance_p);
111
112 tShbError ShbIpcStartSignalingJobReady(tShbInstance pShbInstance_p,
113                                        unsigned long ulTimeOut_p,
114                                        tSigHndlrJobReady
115                                        pfnSignalHandlerJobReady_p);
116 tShbError ShbIpcSignalJobReady(tShbInstance pShbInstance_p);
117
118 void *ShbIpcGetShMemPtr(tShbInstance pShbInstance_p);
119 #endif
120
121 #undef  SHBIPC_INLINE_ENABLED   // disable actual inlining of functions
122 #undef  INLINE_FUNCTION
123 #define INLINE_FUNCTION         // define INLINE_FUNCTION to nothing
124
125 #endif // #ifndef _SHBIPC_H_