1 /******************************************************************************
2  *
3  *  Copyright (C) 2007-2012 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 #ifndef UIPC_H
19 #define UIPC_H
20 
21 #define UIPC_CH_ID_AV_CTRL  0
22 #define UIPC_CH_ID_AV_AUDIO 1
23 #define UIPC_CH_NUM         2
24 
25 #define UIPC_CH_ID_ALL      3   /* used to address all the ch id at once */
26 
27 #define DEFAULT_READ_POLL_TMO_MS 100
28 
29 typedef UINT8 tUIPC_CH_ID;
30 
31 /* Events generated */
32 typedef enum {
33     UIPC_OPEN_EVT           = 0x0001,
34     UIPC_CLOSE_EVT          = 0x0002,
35     UIPC_RX_DATA_EVT        = 0x0004,
36     UIPC_RX_DATA_READY_EVT  = 0x0008,
37     UIPC_TX_DATA_READY_EVT  = 0x0010
38 } tUIPC_EVENT;
39 
40 /*
41  * UIPC IOCTL Requests
42  */
43 
44 #define UIPC_REQ_RX_FLUSH               1
45 #define UIPC_REG_CBACK                  2
46 #define UIPC_REG_REMOVE_ACTIVE_READSET  3
47 #define UIPC_SET_READ_POLL_TMO          4
48 
49 typedef void (tUIPC_RCV_CBACK)(tUIPC_CH_ID ch_id, tUIPC_EVENT event); /* points to BT_HDR which describes event type and length of data; len contains the number of bytes of entire message (sizeof(BT_HDR) + offset + size of data) */
50 
51 const char* dump_uipc_event(tUIPC_EVENT event);
52 
53 /*******************************************************************************
54 **
55 ** Function         UIPC_Init
56 **
57 ** Description      Initialize UIPC module
58 **
59 ** Returns          void
60 **
61 *******************************************************************************/
62 void UIPC_Init(void *);
63 
64 /*******************************************************************************
65 **
66 ** Function         UIPC_Open
67 **
68 ** Description      Open UIPC interface
69 **
70 ** Returns          void
71 **
72 *******************************************************************************/
73 BOOLEAN UIPC_Open(tUIPC_CH_ID ch_id, tUIPC_RCV_CBACK *p_cback);
74 
75 /*******************************************************************************
76 **
77 ** Function         UIPC_Close
78 **
79 ** Description      Close UIPC interface
80 **
81 ** Returns          void
82 **
83 *******************************************************************************/
84 void UIPC_Close(tUIPC_CH_ID ch_id);
85 
86 /*******************************************************************************
87 **
88 ** Function         UIPC_Send
89 **
90 ** Description      Called to transmit a message over UIPC.
91 **
92 ** Returns          void
93 **
94 *******************************************************************************/
95 BOOLEAN UIPC_Send(tUIPC_CH_ID ch_id, UINT16 msg_evt, UINT8 *p_buf, UINT16 msglen);
96 
97 /*******************************************************************************
98 **
99 ** Function         UIPC_Read
100 **
101 ** Description      Called to read a message from UIPC.
102 **
103 ** Returns          void
104 **
105 *******************************************************************************/
106 UINT32 UIPC_Read(tUIPC_CH_ID ch_id, UINT16 *p_msg_evt, UINT8 *p_buf, UINT32 len);
107 
108 /*******************************************************************************
109 **
110 ** Function         UIPC_Ioctl
111 **
112 ** Description      Called to control UIPC.
113 **
114 ** Returns          void
115 **
116 *******************************************************************************/
117 BOOLEAN UIPC_Ioctl(tUIPC_CH_ID ch_id, UINT32 request, void *param);
118 
119 #endif  /* UIPC_H */
120