1 | /* |
2 | Copyright (c) 2012, Broadcom Europe Ltd |
3 | All rights reserved. |
4 | |
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the following conditions are met: |
7 | * Redistributions of source code must retain the above copyright |
8 | notice, this list of conditions and the following disclaimer. |
9 | * Redistributions in binary form must reproduce the above copyright |
10 | notice, this list of conditions and the following disclaimer in the |
11 | documentation and/or other materials provided with the distribution. |
12 | * Neither the name of the copyright holder nor the |
13 | names of its contributors may be used to endorse or promote products |
14 | derived from this software without specific prior written permission. |
15 | |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY |
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ |
27 | |
28 | #if !defined(WFC_CLIENT_IPC_H) |
29 | #define WFC_CLIENT_IPC_H |
30 | |
31 | #include "interface/vcos/vcos.h" |
32 | #include "interface/khronos/wf/wfc_ipc.h" |
33 | |
34 | /** Send a message and wait for a reply. |
35 | * |
36 | * @param msg message to send |
37 | * @param size length of message, including header |
38 | * @param dest destination for reply data, or NULL |
39 | * @param destlen size of destination, updated with actual length |
40 | * @return Success or the error code for failure. |
41 | */ |
42 | VCOS_STATUS_T wfc_client_ipc_sendwait(WFC_IPC_MSG_HEADER_T *msg, |
43 | size_t size, |
44 | void *dest, |
45 | size_t *destlen); |
46 | |
47 | /** Send a message and do not wait for a reply. |
48 | * |
49 | * @param msg_header message header to send |
50 | * @param size length of message, including header |
51 | * @param msgid message id |
52 | * @return Success or the error code for failure. |
53 | */ |
54 | VCOS_STATUS_T wfc_client_ipc_send(WFC_IPC_MSG_HEADER_T *msg, |
55 | size_t size); |
56 | |
57 | /** Initialise the OpenWF-C client IPC. If successful, this must be balanced by |
58 | * a call to wfc_client_ipc_deinit(). This must be called at least once before |
59 | * sending a message. |
60 | * |
61 | * @return Success or the error code for failure. |
62 | */ |
63 | VCOS_STATUS_T wfc_client_ipc_init(void); |
64 | |
65 | /** Deinitialise the OpenWF-C client IPC. |
66 | * |
67 | * @return True if the service has been destroyed, false if there are other |
68 | * users still active. |
69 | */ |
70 | bool wfc_client_ipc_deinit(void); |
71 | |
72 | /** Increase the keep alive count by one. If it rises from zero, the VideoCore |
73 | * will be prevented from being suspended. |
74 | */ |
75 | void wfc_client_ipc_use_keep_alive(void); |
76 | |
77 | /** Drop the keep alive count by one. If it reaches zero, the VideoCore may be |
78 | * suspended. |
79 | */ |
80 | void wfc_client_ipc_release_keep_alive(void); |
81 | |
82 | #endif /* WFC_IPC_H */ |
83 | |