1 /*************************************************************************/ /*!
3 @Title Services Transport Layer shared API
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description Transport layer common API used in both clients and server
6 @License Dual MIT/GPLv2
8 The contents of this file are subject to the MIT license as set out below.
10 Permission is hereby granted, free of charge, to any person obtaining a copy
11 of this software and associated documentation files (the "Software"), to deal
12 in the Software without restriction, including without limitation the rights
13 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
20 Alternatively, the contents of this file may be used under the terms of
21 the GNU General Public License Version 2 ("GPL") in which case the provisions
22 of GPL are applicable instead of those above.
24 If you wish to allow use of your version of this file only under the terms of
25 GPL, and not to allow others to use your version of this file under the terms
26 of the MIT license, indicate your decision by deleting the provisions above
27 and replace them with the notice and other provisions required by GPL as set
28 out in the file called "GPL-COPYING" included in this distribution. If you do
29 not delete the provisions above, a recipient may use your version of this file
30 under the terms of either the MIT license or GPL.
32 This License is also included in this distribution in the file called
35 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
36 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
37 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
38 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
39 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
40 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
41 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42 */ /**************************************************************************/
49 #include "pvrsrv_error.h"
52 /* This value is used for the hSrvHandle argument in the client API when
53 * called directly from the kernel which will lead to a direct bridge access.
55 #define DIRECT_BRIDGE_HANDLE ((IMG_HANDLE)0xDEADBEEFU)
58 /**************************************************************************/ /*!
59 @Function TLClientOpenStream
60 @Description Open a descriptor onto an existing kernel transport stream.
61 @Input hSrvHandle Address of a pointer to a connection object
62 @Input pszName Address of the stream name string, no longer
63 than PRVSRVTL_MAX_STREAM_NAME_SIZE.
64 @Input ui32Mode Unused
65 @Output phSD Address of a pointer to an stream object
66 @Return PVRSRV_ERROR_NOT_FOUND: when named stream not found
67 @Return PVRSRV_ERROR_ALREADY_OPEN: stream already open by another
68 @Return PVRSRV_ERROR_STREAM_ERROR: internal driver state error
69 @Return PVRSRV_ERROR_TIMEOUT: block timed out, stream not found
70 @Return PVRSRV_ERROR: for other system codes
71 */ /***************************************************************************/
73 PVRSRV_ERROR TLClientOpenStream(IMG_HANDLE hSrvHandle,
74 const IMG_CHAR* pszName,
79 /**************************************************************************/ /*!
80 @Function TLClientCloseStream
81 @Description Close and release the stream connection to Services kernel
82 server transport layer. Any outstanding Acquire will be
84 @Input hSrvHandle Address of a pointer to a connection object
85 @Input hSD Handle of the stream object to close
86 @Return PVRSRV_ERROR_HANDLE_NOT_FOUND: when SD handle is not known
87 @Return PVRSRV_ERROR_STREAM_ERROR: internal driver state error
88 @Return PVRSRV_ERROR: for system codes
89 */ /***************************************************************************/
91 PVRSRV_ERROR TLClientCloseStream(IMG_HANDLE hSrvHandle,
94 /**************************************************************************/ /*!
95 @Function TLClientDiscoverStreams
96 @Description Finds all streams that's name starts with pszNamePattern and
98 @Input hSrvHandle Address of a pointer to a connection object
99 @Input pszNamePattern Name pattern. Must be beginning of a string.
100 @Output pui32Streams Array of numbers from end of the discovered
102 @inOut pui32Count When input max number of number that can fit
103 into pui32Streams. When output number of
105 @Return PVRSRV_ERROR for system codes
106 */ /***************************************************************************/
108 PVRSRV_ERROR TLClientDiscoverStreams(IMG_HANDLE hSrvHandle,
109 const IMG_CHAR *pszNamePattern,
110 IMG_UINT32 *pui32Streams,
111 IMG_UINT32 *pui32NumFound);
113 /**************************************************************************/ /*!
114 @Function TLClientReserveStream
115 @Description Reserves a region with given size in the stream. If the stream
116 is already reserved the function will return an error.
117 @Input hSrvHandle Address of a pointer to a connection object
118 @Input hSD Handle of the stream object to close
119 @Output ppui8Data pointer to the buffer
120 @Input ui32Size size of the data
122 */ /***************************************************************************/
124 PVRSRV_ERROR TLClientReserveStream(IMG_HANDLE hSrvHandle,
126 IMG_UINT8 **ppui8Data,
127 IMG_UINT32 ui32Size);
129 /**************************************************************************/ /*!
130 @Function TLClientStreamReserve2
131 @Description Reserves a region with given size in the stream. If the stream
132 is already reserved the function will return an error.
133 @Input hSrvHandle Address of a pointer to a connection object
134 @Input hSD Handle of the stream object to close
135 @Output ppui8Data pointer to the buffer
136 @Input ui32Size size of the data
137 @Input ui32SizeMin minimum size of the data
138 @Input ui32Available available space in buffer
140 */ /***************************************************************************/
142 PVRSRV_ERROR TLClientReserveStream2(IMG_HANDLE hSrvHandle,
144 IMG_UINT8 **ppui8Data,
146 IMG_UINT32 ui32SizeMin,
147 IMG_UINT32 *pui32Available);
149 /**************************************************************************/ /*!
150 @Function TLClientStreamCommit
151 @Description Commits previously reserved region in the stream and therefore
152 allows next reserves.
153 This function call has to be preceded by the call to
154 TLClientReserveStream or TLClientReserveStream2.
155 @Input hSrvHandle Address of a pointer to a connection object
156 @Input hSD Handle of the stream object to close
157 @Input ui32Size Size of the data
159 */ /***************************************************************************/
161 PVRSRV_ERROR TLClientCommitStream(IMG_HANDLE hSrvHandle,
163 IMG_UINT32 ui32Size);
165 /**************************************************************************/ /*!
166 @Function TLClientAcquireData
167 @Description When there is data available in the stream buffer this call
168 returns with the address and length of the data buffer the
169 client can safely read. This buffer may contain one or more
171 If no data is available then this call blocks until it becomes
172 available. However if the stream has been destroyed while
173 waiting then a resource unavailable error will be returned
174 to the caller. Clients must pair this call with a
176 @Input hSrvHandle Address of a pointer to a connection object
177 @Input hSD Handle of the stream object to read
178 @Output ppPacketBuf Address of a pointer to an byte buffer. On exit
179 pointer contains address of buffer to read from
180 @Output puiBufLen Pointer to an integer. On exit it is the size
181 of the data to read from the packet buffer
182 @Return PVRSRV_ERROR_RESOURCE_UNAVAILABLE: when stream no longer exists
183 @Return PVRSRV_ERROR_HANDLE_NOT_FOUND: when SD handle not known
184 @Return PVRSRV_ERROR_STREAM_ERROR: internal driver state error
185 @Return PVRSRV_ERROR_RETRY: release not called beforehand
186 @Return PVRSRV_ERROR_TIMEOUT: block timed out, no data
187 @Return PVRSRV_ERROR: for other system codes
188 */ /***************************************************************************/
190 PVRSRV_ERROR TLClientAcquireData(IMG_HANDLE hSrvHandle,
192 IMG_PBYTE* ppPacketBuf,
193 IMG_UINT32* puiBufLen);
196 /**************************************************************************/ /*!
197 @Function TLClientReleaseData
198 @Description Called after client has read the stream data out of the buffer
199 The data is subsequently flushed from the stream buffer to make
200 room for more data packets from the stream source.
201 @Input hSrvHandle Address of a pointer to a connection object
202 @Input hSD Handle of the stream object to read
203 @Return PVRSRV_ERROR_RESOURCE_UNAVAILABLE: when stream no longer exists
204 @Return PVRSRV_ERROR_HANDLE_NOT_FOUND: when SD handle not known to TL
205 @Return PVRSRV_ERROR_STREAM_ERROR: internal driver state error
206 @Return PVRSRV_ERROR_RETRY: acquire not called beforehand
207 @Return PVRSRV_ERROR: for system codes
208 */ /***************************************************************************/
210 PVRSRV_ERROR TLClientReleaseData(IMG_HANDLE hSrvHandle,
213 /**************************************************************************/ /*!
214 @Function TLClientWriteData
215 @Description Writes data to the stream.
216 @Input hSrvHandle Address of a pointer to a connection object
217 @Input hSD Handle of the stream object to read
218 @Input ui32Size Size of the data
219 @Input pui8Data Pointer to data
220 */ /***************************************************************************/
222 PVRSRV_ERROR TLClientWriteData(IMG_HANDLE hSrvHandle,
228 #endif /* TLCLIENT_H_ */
230 /******************************************************************************
231 End of file (tlclient.h)
232 ******************************************************************************/