1 /*
2  * Copyright 2010-2015 Intel Corporation.
3  *
4  * This library is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License as published
6  * by the Free Software Foundation, version 2.1.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16  * 02110-1301 USA.
17  *
18  * Disclaimer: The codes contained in these modules may be specific
19  * to the Intel Software Development Platform codenamed Knights Ferry,
20  * and the Intel product codenamed Knights Corner, and are not backward
21  * compatible with other Intel products. Additionally, Intel will NOT
22  * support the codes or instruction set in future products.
23  *
24  * Intel offers no warranty of any kind regarding the code. This code is
25  * licensed on an "AS IS" basis and Intel is not obligated to provide
26  * any support, assistance, installation, training, or other services
27  * of any kind. Intel is also not obligated to provide any updates,
28  * enhancements or extensions. Intel specifically disclaims any warranty
29  * of merchantability, non-infringement, fitness for any particular
30  * purpose, and any other warranty.
31  *
32  * Further, Intel disclaims all liability of any kind, including but
33  * not limited to liability for infringement of any proprietary rights,
34  * relating to the use of the code, even if Intel is notified of the
35  * possibility of such liability. Except as expressly stated in an Intel
36  * license agreement provided with this code and agreed upon with Intel,
37  * no license, express or implied, by estoppel or otherwise, to any
38  * intellectual property rights is granted herein.
39  */
40 
41 #ifndef _COIPIPELINE_SINK_H
42 #define _COIPIPELINE_SINK_H
43 
44 /** @ingroup COIPipeline
45  *  @addtogroup COIPipelineSink
46 @{
47 * @file sink/COIPipeline_sink.h
48 */
49 #ifndef DOXYGEN_SHOULD_SKIP_THIS
50 
51 #include "../common/COITypes_common.h"
52 #include "../common/COIResult_common.h"
53 
54 #ifdef __FreeBSD__
55 #define COINATIVELIBEXPORT_VISIBILITY "extern"
56 #else
57 #define COINATIVELIBEXPORT_VISIBILITY "default"
58 #endif
59 
60 #ifdef __cplusplus
61 #define COINATIVELIBEXPORT \
62     extern "C" __attribute__ ((visibility(COINATIVELIBEXPORT_VISIBILITY)))
63 #else
64 #define COINATIVELIBEXPORT \
65     __attribute__ ((visibility(COINATIVELIBEXPORT_VISIBILITY)))
66 #endif
67 
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 #endif // DOXYGEN_SHOULD_SKIP_THIS
72 
73 //////////////////////////////////////////////////////////////////////////////
74 ///
75 /// This is the prototype that run functions should follow.
76 ///
77 /// @param   in_BufferCount
78 ///          The number of buffers passed to the run function.
79 ///
80 /// @param   in_ppBufferPointers
81 ///          An array that is in_BufferCount in length that contains the
82 ///          sink side virtual addresses for each buffer passed in to
83 ///          the run function.
84 ///
85 /// @param   in_pBufferLengths
86 ///          An array that is in_BufferCount in length of uint32_t integers
87 ///          describing the length of each passed in buffer in bytes.
88 ///
89 /// @param   in_pMiscData
90 ///          Pointer to the MiscData passed in when the run function
91 ///          was enqueued on the source.
92 ///
93 /// @param   in_MiscDataLen
94 ///          Length in bytes of the MiscData passed in when the run function
95 ///          was enqueued on the source.
96 ///
97 /// @param   in_pReturnValue
98 ///          Pointer to the location where the return value from this run
99 ///          function will be stored.
100 ///
101 /// @param   in_ReturnValueLength
102 ///          Length in bytes of the user-allocated ReturnValue pointer.
103 ///
104 /// @return  A uint64_t that can be retrieved in the out_UserData parameter
105 ///          from the COIPipelineWaitForEvent function.
106 ///
107 typedef void
108 (*RunFunctionPtr_t)(
109             uint32_t        in_BufferCount,
110             void**          in_ppBufferPointers,
111             uint64_t*       in_pBufferLengths,
112             void*           in_pMiscData,
113             uint16_t        in_MiscDataLength,
114             void*           in_pReturnValue,
115             uint16_t        in_ReturnValueLength);
116 
117 ///////////////////////////////////////////////////////////////////////////////
118 ///
119 /// Start processing pipelines on the Sink. This should be done after any
120 /// required initialization in the Sink's application has finished. No
121 /// run functions will actually be executed (although they may be queued)
122 /// until this function is called.
123 ///
124 ///
125 /// @return COI_SUCCESS if the pipelines were successfully started.
126 ///
127 COIRESULT
128 COIPipelineStartExecutingRunFunctions();
129 
130 
131 #ifdef __cplusplus
132 } /* extern "C" */
133 #endif
134 
135 #endif /* _COIPIPELINE_SINK_H */
136 
137 /*! @} */
138