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
29typedef uint8_t tUIPC_CH_ID;
30
31/* Events generated */
32typedef 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
49typedef void(tUIPC_RCV_CBACK)(
50    tUIPC_CH_ID ch_id,
51    tUIPC_EVENT event); /* points to BT_HDR which describes event type and
52                           length of data; len contains the number of bytes of
53                           entire message (sizeof(BT_HDR) + offset + size of
54                           data) */
55
56const char* dump_uipc_event(tUIPC_EVENT event);
57
58/*******************************************************************************
59 *
60 * Function         UIPC_Init
61 *
62 * Description      Initialize UIPC module
63 *
64 * Returns          void
65 *
66 ******************************************************************************/
67void UIPC_Init(void*);
68
69/*******************************************************************************
70 *
71 * Function         UIPC_Open
72 *
73 * Description      Open UIPC interface
74 *
75 * Returns          void
76 *
77 ******************************************************************************/
78bool UIPC_Open(tUIPC_CH_ID ch_id, tUIPC_RCV_CBACK* p_cback);
79
80/*******************************************************************************
81 *
82 * Function         UIPC_Close
83 *
84 * Description      Close UIPC interface
85 *
86 * Returns          void
87 *
88 ******************************************************************************/
89void UIPC_Close(tUIPC_CH_ID ch_id);
90
91/*******************************************************************************
92 *
93 * Function         UIPC_Send
94 *
95 * Description      Called to transmit a message over UIPC.
96 *
97 * Returns          void
98 *
99 ******************************************************************************/
100bool UIPC_Send(tUIPC_CH_ID ch_id, uint16_t msg_evt, const uint8_t* p_buf,
101               uint16_t msglen);
102
103/*******************************************************************************
104 *
105 * Function         UIPC_Read
106 *
107 * Description      Called to read a message from UIPC.
108 *
109 * Returns          void
110 *
111 ******************************************************************************/
112uint32_t UIPC_Read(tUIPC_CH_ID ch_id, uint16_t* p_msg_evt, uint8_t* p_buf,
113                   uint32_t len);
114
115/*******************************************************************************
116 *
117 * Function         UIPC_Ioctl
118 *
119 * Description      Called to control UIPC.
120 *
121 * Returns          void
122 *
123 ******************************************************************************/
124bool UIPC_Ioctl(tUIPC_CH_ID ch_id, uint32_t request, void* param);
125
126#endif /* UIPC_H */
127