The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Copyright (C) 2002-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 | |
| 19 | /****************************************************************************** |
| 20 | * |
| 21 | * This file contains interfaces which are internal to AVDTP. |
| 22 | * |
| 23 | ******************************************************************************/ |
| 24 | #ifndef AVDT_INT_H |
| 25 | #define AVDT_INT_H |
| 26 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 27 | #include "avdt_api.h" |
| 28 | #include "avdt_defs.h" |
| 29 | #include "avdtc_api.h" |
| 30 | #include "bt_common.h" |
| 31 | #include "btm_api.h" |
| 32 | #include "l2c_api.h" |
Pavlin Radoslavov | 78bcff7 | 2015-12-04 17:36:34 -0800 | [diff] [blame] | 33 | #include "osi/include/alarm.h" |
Pavlin Radoslavov | 1a3844f | 2015-09-25 11:21:15 -0700 | [diff] [blame] | 34 | #include "osi/include/fixed_queue.h" |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 35 | |
| 36 | #ifndef AVDT_DEBUG |
Pavlin Radoslavov | 5ce0116 | 2016-12-05 13:02:26 -0800 | [diff] [blame^] | 37 | #define AVDT_DEBUG FALSE |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 38 | #endif |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 39 | |
| 40 | /***************************************************************************** |
Myles Watson | ee96a3c | 2016-11-23 14:49:54 -0800 | [diff] [blame] | 41 | * constants |
| 42 | ****************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 43 | |
| 44 | /* channel types */ |
| 45 | enum { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 46 | AVDT_CHAN_SIG, /* signaling channel */ |
| 47 | AVDT_CHAN_MEDIA, /* media channel */ |
Marie Janssen | d19e078 | 2016-07-15 12:48:27 -0700 | [diff] [blame] | 48 | #if (AVDT_REPORTING == TRUE) |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 49 | AVDT_CHAN_REPORT, /* reporting channel */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 50 | #endif |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 51 | AVDT_CHAN_NUM_TYPES |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | /* protocol service capabilities of this AVDTP implementation */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 55 | #if (AVDT_REPORTING == TRUE) |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 56 | #define AVDT_PSC (AVDT_PSC_TRANS | AVDT_PSC_REPORT | AVDT_PSC_DELAY_RPT) |
| 57 | #define AVDT_LEG_PSC (AVDT_PSC_TRANS | AVDT_PSC_REPORT) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 58 | #else /* AVDT_REPORTING */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 59 | #define AVDT_PSC (AVDT_PSC_TRANS | AVDT_PSC_DELAY_RPT) |
| 60 | #define AVDT_LEG_PSC (AVDT_PSC_TRANS) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 61 | #endif /* AVDT_REPORTING */ |
| 62 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 63 | /* initiator/acceptor signaling roles */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 64 | #define AVDT_CLOSE_ACP 0 |
| 65 | #define AVDT_CLOSE_INT 1 |
| 66 | #define AVDT_OPEN_ACP 2 |
| 67 | #define AVDT_OPEN_INT 3 |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 68 | |
| 69 | /* states for avdt_scb_verify */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 70 | #define AVDT_VERIFY_OPEN 0 |
| 71 | #define AVDT_VERIFY_STREAMING 1 |
| 72 | #define AVDT_VERIFY_SUSPEND 2 |
| 73 | #define AVDT_VERIFY_START 3 |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 74 | |
| 75 | /* to distinguish CCB events from SCB events */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 76 | #define AVDT_CCB_MKR 0x80 |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 77 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 78 | /* offset where AVDTP signaling message content starts; |
Myles Watson | ee96a3c | 2016-11-23 14:49:54 -0800 | [diff] [blame] | 79 | * use the size of a start header since it's the largest possible |
| 80 | * layout of signaling message in a buffer is: |
| 81 | * |
| 82 | * | BT_HDR | SCB handles | L2CAP + HCI header | AVDTP header | data ... | |
| 83 | * |
| 84 | * Note that we "hide" the scb handles at the top of the message buffer. |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 85 | */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 86 | #define AVDT_MSG_OFFSET (L2CAP_MIN_OFFSET + AVDT_NUM_SEPS + AVDT_LEN_TYPE_START) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 87 | |
Pavlin Radoslavov | 78bcff7 | 2015-12-04 17:36:34 -0800 | [diff] [blame] | 88 | /* scb transport channel connect timeout value (in milliseconds) */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 89 | #define AVDT_SCB_TC_CONN_TIMEOUT_MS (10 * 1000) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 90 | |
Pavlin Radoslavov | 78bcff7 | 2015-12-04 17:36:34 -0800 | [diff] [blame] | 91 | /* scb transport channel disconnect timeout value (in milliseconds) */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 92 | #define AVDT_SCB_TC_DISC_TIMEOUT_MS (10 * 1000) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 93 | |
| 94 | /* maximum number of command retransmissions */ |
| 95 | #ifndef AVDT_RET_MAX |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 96 | #define AVDT_RET_MAX 1 |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 97 | #endif |
| 98 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 99 | /* ccb state machine states */ |
| 100 | enum { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 101 | AVDT_CCB_IDLE_ST, |
| 102 | AVDT_CCB_OPENING_ST, |
| 103 | AVDT_CCB_OPEN_ST, |
| 104 | AVDT_CCB_CLOSING_ST |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 105 | }; |
| 106 | |
| 107 | /* state machine action enumeration list */ |
| 108 | enum { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 109 | AVDT_CCB_CHAN_OPEN, |
| 110 | AVDT_CCB_CHAN_CLOSE, |
| 111 | AVDT_CCB_CHK_CLOSE, |
| 112 | AVDT_CCB_HDL_DISCOVER_CMD, |
| 113 | AVDT_CCB_HDL_DISCOVER_RSP, |
| 114 | AVDT_CCB_HDL_GETCAP_CMD, |
| 115 | AVDT_CCB_HDL_GETCAP_RSP, |
| 116 | AVDT_CCB_HDL_START_CMD, |
| 117 | AVDT_CCB_HDL_START_RSP, |
| 118 | AVDT_CCB_HDL_SUSPEND_CMD, |
| 119 | AVDT_CCB_HDL_SUSPEND_RSP, |
| 120 | AVDT_CCB_SND_DISCOVER_CMD, |
| 121 | AVDT_CCB_SND_DISCOVER_RSP, |
| 122 | AVDT_CCB_SND_GETCAP_CMD, |
| 123 | AVDT_CCB_SND_GETCAP_RSP, |
| 124 | AVDT_CCB_SND_START_CMD, |
| 125 | AVDT_CCB_SND_START_RSP, |
| 126 | AVDT_CCB_SND_SUSPEND_CMD, |
| 127 | AVDT_CCB_SND_SUSPEND_RSP, |
| 128 | AVDT_CCB_CLEAR_CMDS, |
| 129 | AVDT_CCB_CMD_FAIL, |
| 130 | AVDT_CCB_FREE_CMD, |
| 131 | AVDT_CCB_CONG_STATE, |
| 132 | AVDT_CCB_RET_CMD, |
| 133 | AVDT_CCB_SND_CMD, |
| 134 | AVDT_CCB_SND_MSG, |
| 135 | AVDT_CCB_SET_RECONN, |
| 136 | AVDT_CCB_CLR_RECONN, |
| 137 | AVDT_CCB_CHK_RECONN, |
| 138 | AVDT_CCB_CHK_TIMER, |
| 139 | AVDT_CCB_SET_CONN, |
| 140 | AVDT_CCB_SET_DISCONN, |
| 141 | AVDT_CCB_DO_DISCONN, |
| 142 | AVDT_CCB_LL_CLOSED, |
| 143 | AVDT_CCB_LL_OPENED, |
| 144 | AVDT_CCB_DEALLOC, |
| 145 | AVDT_CCB_NUM_ACTIONS |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 146 | }; |
| 147 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 148 | #define AVDT_CCB_IGNORE AVDT_CCB_NUM_ACTIONS |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 149 | |
| 150 | /* ccb state machine events */ |
| 151 | enum { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 152 | AVDT_CCB_API_DISCOVER_REQ_EVT, |
| 153 | AVDT_CCB_API_GETCAP_REQ_EVT, |
| 154 | AVDT_CCB_API_START_REQ_EVT, |
| 155 | AVDT_CCB_API_SUSPEND_REQ_EVT, |
| 156 | AVDT_CCB_API_DISCOVER_RSP_EVT, |
| 157 | AVDT_CCB_API_GETCAP_RSP_EVT, |
| 158 | AVDT_CCB_API_START_RSP_EVT, |
| 159 | AVDT_CCB_API_SUSPEND_RSP_EVT, |
| 160 | AVDT_CCB_API_CONNECT_REQ_EVT, |
| 161 | AVDT_CCB_API_DISCONNECT_REQ_EVT, |
| 162 | AVDT_CCB_MSG_DISCOVER_CMD_EVT, |
| 163 | AVDT_CCB_MSG_GETCAP_CMD_EVT, |
| 164 | AVDT_CCB_MSG_START_CMD_EVT, |
| 165 | AVDT_CCB_MSG_SUSPEND_CMD_EVT, |
| 166 | AVDT_CCB_MSG_DISCOVER_RSP_EVT, |
| 167 | AVDT_CCB_MSG_GETCAP_RSP_EVT, |
| 168 | AVDT_CCB_MSG_START_RSP_EVT, |
| 169 | AVDT_CCB_MSG_SUSPEND_RSP_EVT, |
| 170 | AVDT_CCB_RCVRSP_EVT, |
| 171 | AVDT_CCB_SENDMSG_EVT, |
| 172 | AVDT_CCB_RET_TOUT_EVT, |
| 173 | AVDT_CCB_RSP_TOUT_EVT, |
| 174 | AVDT_CCB_IDLE_TOUT_EVT, |
| 175 | AVDT_CCB_UL_OPEN_EVT, |
| 176 | AVDT_CCB_UL_CLOSE_EVT, |
| 177 | AVDT_CCB_LL_OPEN_EVT, |
| 178 | AVDT_CCB_LL_CLOSE_EVT, |
| 179 | AVDT_CCB_LL_CONG_EVT |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 180 | }; |
| 181 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 182 | /* scb state machine states; these state values are private to this module so |
Myles Watson | ee96a3c | 2016-11-23 14:49:54 -0800 | [diff] [blame] | 183 | * the scb state cannot be read or set by actions functions |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 184 | */ |
| 185 | enum { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 186 | AVDT_SCB_IDLE_ST, |
| 187 | AVDT_SCB_CONF_ST, |
| 188 | AVDT_SCB_OPENING_ST, |
| 189 | AVDT_SCB_OPEN_ST, |
| 190 | AVDT_SCB_STREAM_ST, |
| 191 | AVDT_SCB_CLOSING_ST |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 192 | }; |
| 193 | |
| 194 | /* state machine action enumeration list */ |
| 195 | enum { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 196 | AVDT_SCB_HDL_ABORT_CMD, |
| 197 | AVDT_SCB_HDL_ABORT_RSP, |
| 198 | AVDT_SCB_HDL_CLOSE_CMD, |
| 199 | AVDT_SCB_HDL_CLOSE_RSP, |
| 200 | AVDT_SCB_HDL_GETCONFIG_CMD, |
| 201 | AVDT_SCB_HDL_GETCONFIG_RSP, |
| 202 | AVDT_SCB_HDL_OPEN_CMD, |
| 203 | AVDT_SCB_HDL_OPEN_REJ, |
| 204 | AVDT_SCB_HDL_OPEN_RSP, |
| 205 | AVDT_SCB_HDL_PKT, |
| 206 | AVDT_SCB_DROP_PKT, |
| 207 | AVDT_SCB_HDL_RECONFIG_CMD, |
| 208 | AVDT_SCB_HDL_RECONFIG_RSP, |
| 209 | AVDT_SCB_HDL_SECURITY_CMD, |
| 210 | AVDT_SCB_HDL_SECURITY_RSP, |
| 211 | AVDT_SCB_HDL_SETCONFIG_CMD, |
| 212 | AVDT_SCB_HDL_SETCONFIG_REJ, |
| 213 | AVDT_SCB_HDL_SETCONFIG_RSP, |
| 214 | AVDT_SCB_HDL_START_CMD, |
| 215 | AVDT_SCB_HDL_START_RSP, |
| 216 | AVDT_SCB_HDL_SUSPEND_CMD, |
| 217 | AVDT_SCB_HDL_SUSPEND_RSP, |
| 218 | AVDT_SCB_HDL_TC_CLOSE, |
Marie Janssen | d19e078 | 2016-07-15 12:48:27 -0700 | [diff] [blame] | 219 | #if (AVDT_REPORTING == TRUE) |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 220 | AVDT_SCB_HDL_TC_CLOSE_STO, |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 221 | #endif |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 222 | AVDT_SCB_HDL_TC_OPEN, |
Marie Janssen | d19e078 | 2016-07-15 12:48:27 -0700 | [diff] [blame] | 223 | #if (AVDT_REPORTING == TRUE) |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 224 | AVDT_SCB_HDL_TC_OPEN_STO, |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 225 | #endif |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 226 | AVDT_SCB_SND_DELAY_RPT_REQ, |
| 227 | AVDT_SCB_HDL_DELAY_RPT_CMD, |
| 228 | AVDT_SCB_HDL_DELAY_RPT_RSP, |
| 229 | AVDT_SCB_HDL_WRITE_REQ, |
| 230 | AVDT_SCB_SND_ABORT_REQ, |
| 231 | AVDT_SCB_SND_ABORT_RSP, |
| 232 | AVDT_SCB_SND_CLOSE_REQ, |
| 233 | AVDT_SCB_SND_STREAM_CLOSE, |
| 234 | AVDT_SCB_SND_CLOSE_RSP, |
| 235 | AVDT_SCB_SND_GETCONFIG_REQ, |
| 236 | AVDT_SCB_SND_GETCONFIG_RSP, |
| 237 | AVDT_SCB_SND_OPEN_REQ, |
| 238 | AVDT_SCB_SND_OPEN_RSP, |
| 239 | AVDT_SCB_SND_RECONFIG_REQ, |
| 240 | AVDT_SCB_SND_RECONFIG_RSP, |
| 241 | AVDT_SCB_SND_SECURITY_REQ, |
| 242 | AVDT_SCB_SND_SECURITY_RSP, |
| 243 | AVDT_SCB_SND_SETCONFIG_REQ, |
| 244 | AVDT_SCB_SND_SETCONFIG_REJ, |
| 245 | AVDT_SCB_SND_SETCONFIG_RSP, |
| 246 | AVDT_SCB_SND_TC_CLOSE, |
| 247 | AVDT_SCB_CB_ERR, |
| 248 | AVDT_SCB_CONG_STATE, |
| 249 | AVDT_SCB_REJ_STATE, |
| 250 | AVDT_SCB_REJ_IN_USE, |
| 251 | AVDT_SCB_REJ_NOT_IN_USE, |
| 252 | AVDT_SCB_SET_REMOVE, |
| 253 | AVDT_SCB_FREE_PKT, |
| 254 | AVDT_SCB_CLR_PKT, |
| 255 | AVDT_SCB_CHK_SND_PKT, |
| 256 | AVDT_SCB_TC_TIMER, |
| 257 | AVDT_SCB_CLR_VARS, |
| 258 | AVDT_SCB_DEALLOC, |
| 259 | AVDT_SCB_NUM_ACTIONS |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 260 | }; |
| 261 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 262 | #define AVDT_SCB_IGNORE AVDT_SCB_NUM_ACTIONS |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 263 | |
| 264 | /* scb state machine events */ |
| 265 | enum { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 266 | AVDT_SCB_API_REMOVE_EVT, |
| 267 | AVDT_SCB_API_WRITE_REQ_EVT, |
| 268 | AVDT_SCB_API_GETCONFIG_REQ_EVT, |
| 269 | AVDT_SCB_API_DELAY_RPT_REQ_EVT, |
| 270 | AVDT_SCB_API_SETCONFIG_REQ_EVT, |
| 271 | AVDT_SCB_API_OPEN_REQ_EVT, |
| 272 | AVDT_SCB_API_CLOSE_REQ_EVT, |
| 273 | AVDT_SCB_API_RECONFIG_REQ_EVT, |
| 274 | AVDT_SCB_API_SECURITY_REQ_EVT, |
| 275 | AVDT_SCB_API_ABORT_REQ_EVT, |
| 276 | AVDT_SCB_API_GETCONFIG_RSP_EVT, |
| 277 | AVDT_SCB_API_SETCONFIG_RSP_EVT, |
| 278 | AVDT_SCB_API_SETCONFIG_REJ_EVT, |
| 279 | AVDT_SCB_API_OPEN_RSP_EVT, |
| 280 | AVDT_SCB_API_CLOSE_RSP_EVT, |
| 281 | AVDT_SCB_API_RECONFIG_RSP_EVT, |
| 282 | AVDT_SCB_API_SECURITY_RSP_EVT, |
| 283 | AVDT_SCB_API_ABORT_RSP_EVT, |
| 284 | AVDT_SCB_MSG_SETCONFIG_CMD_EVT, |
| 285 | AVDT_SCB_MSG_GETCONFIG_CMD_EVT, |
| 286 | AVDT_SCB_MSG_OPEN_CMD_EVT, |
| 287 | AVDT_SCB_MSG_START_CMD_EVT, |
| 288 | AVDT_SCB_MSG_SUSPEND_CMD_EVT, |
| 289 | AVDT_SCB_MSG_CLOSE_CMD_EVT, |
| 290 | AVDT_SCB_MSG_ABORT_CMD_EVT, |
| 291 | AVDT_SCB_MSG_RECONFIG_CMD_EVT, |
| 292 | AVDT_SCB_MSG_SECURITY_CMD_EVT, |
| 293 | AVDT_SCB_MSG_DELAY_RPT_CMD_EVT, |
| 294 | AVDT_SCB_MSG_DELAY_RPT_RSP_EVT, |
| 295 | AVDT_SCB_MSG_SETCONFIG_RSP_EVT, |
| 296 | AVDT_SCB_MSG_GETCONFIG_RSP_EVT, |
| 297 | AVDT_SCB_MSG_OPEN_RSP_EVT, |
| 298 | AVDT_SCB_MSG_START_RSP_EVT, |
| 299 | AVDT_SCB_MSG_SUSPEND_RSP_EVT, |
| 300 | AVDT_SCB_MSG_CLOSE_RSP_EVT, |
| 301 | AVDT_SCB_MSG_ABORT_RSP_EVT, |
| 302 | AVDT_SCB_MSG_RECONFIG_RSP_EVT, |
| 303 | AVDT_SCB_MSG_SECURITY_RSP_EVT, |
| 304 | AVDT_SCB_MSG_SETCONFIG_REJ_EVT, |
| 305 | AVDT_SCB_MSG_OPEN_REJ_EVT, |
| 306 | AVDT_SCB_MSG_START_REJ_EVT, |
| 307 | AVDT_SCB_MSG_SUSPEND_REJ_EVT, |
| 308 | AVDT_SCB_TC_TOUT_EVT, |
| 309 | AVDT_SCB_TC_OPEN_EVT, |
| 310 | AVDT_SCB_TC_CLOSE_EVT, |
| 311 | AVDT_SCB_TC_CONG_EVT, |
| 312 | AVDT_SCB_TC_DATA_EVT, |
| 313 | AVDT_SCB_CC_CLOSE_EVT |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 314 | }; |
| 315 | |
| 316 | /* adaption layer number of stream routing table entries */ |
Marie Janssen | d19e078 | 2016-07-15 12:48:27 -0700 | [diff] [blame] | 317 | #if (AVDT_REPORTING == TRUE) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 318 | /* 2 channels(1 media, 1 report) for each SEP and one for signalling */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 319 | #define AVDT_NUM_RT_TBL ((AVDT_NUM_SEPS << 1) + 1) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 320 | #else |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 321 | #define AVDT_NUM_RT_TBL (AVDT_NUM_SEPS + 1) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 322 | #endif |
| 323 | |
| 324 | /* adaption layer number of transport channel table entries - moved to target.h |
| 325 | #define AVDT_NUM_TC_TBL (AVDT_NUM_SEPS + AVDT_NUM_LINKS) */ |
| 326 | |
| 327 | /* "states" used in transport channel table */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 328 | #define AVDT_AD_ST_UNUSED 0 /* Unused - unallocated */ |
| 329 | #define AVDT_AD_ST_IDLE 1 /* No connection */ |
| 330 | #define AVDT_AD_ST_ACP 2 /* Waiting to accept a connection */ |
| 331 | #define AVDT_AD_ST_INT 3 /* Initiating a connection */ |
| 332 | #define AVDT_AD_ST_CONN 4 /* Waiting for connection confirm */ |
| 333 | #define AVDT_AD_ST_CFG 5 /* Waiting for configuration complete */ |
| 334 | #define AVDT_AD_ST_OPEN 6 /* Channel opened */ |
| 335 | #define AVDT_AD_ST_SEC_INT 7 /* Security process as INT */ |
| 336 | #define AVDT_AD_ST_SEC_ACP 8 /* Security process as ACP */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 337 | |
| 338 | /* Configuration flags. tAVDT_TC_TBL.cfg_flags */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 339 | #define AVDT_L2C_CFG_IND_DONE (1 << 0) |
| 340 | #define AVDT_L2C_CFG_CFM_DONE (1 << 1) |
| 341 | #define AVDT_L2C_CFG_CONN_INT (1 << 2) |
| 342 | #define AVDT_L2C_CFG_CONN_ACP (1 << 3) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 343 | |
| 344 | /* result code for avdt_ad_write_req() (L2CA_DataWrite()) */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 345 | #define AVDT_AD_FAILED L2CAP_DW_FAILED /* FALSE */ |
| 346 | #define AVDT_AD_SUCCESS L2CAP_DW_SUCCESS /* TRUE */ |
| 347 | #define AVDT_AD_CONGESTED L2CAP_DW_CONGESTED /* 2 */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 348 | |
| 349 | /***************************************************************************** |
Myles Watson | ee96a3c | 2016-11-23 14:49:54 -0800 | [diff] [blame] | 350 | * data types |
| 351 | ****************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 352 | |
| 353 | /* msg union of all message parameter types */ |
| 354 | typedef union { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 355 | tAVDT_EVT_HDR hdr; |
| 356 | tAVDT_EVT_HDR single; |
| 357 | tAVDT_SETCONFIG config_cmd; |
| 358 | tAVDT_CONFIG reconfig_cmd; |
| 359 | tAVDT_MULTI multi; |
| 360 | tAVDT_SECURITY security_cmd; |
| 361 | tAVDT_DISCOVER discover_rsp; |
| 362 | tAVDT_CONFIG svccap; |
| 363 | tAVDT_SECURITY security_rsp; |
| 364 | tAVDT_DELAY_RPT delay_rpt_cmd; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 365 | } tAVDT_MSG; |
| 366 | |
| 367 | /* data type for AVDT_CCB_API_DISCOVER_REQ_EVT */ |
| 368 | typedef struct { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 369 | tAVDT_CTRL_CBACK* p_cback; |
| 370 | tAVDT_SEP_INFO* p_sep_info; |
| 371 | uint8_t num_seps; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 372 | } tAVDT_CCB_API_DISCOVER; |
| 373 | |
| 374 | /* data type for AVDT_CCB_API_GETCAP_REQ_EVT */ |
| 375 | typedef struct { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 376 | tAVDT_EVT_HDR single; |
| 377 | tAVDT_CTRL_CBACK* p_cback; |
| 378 | tAVDT_CFG* p_cfg; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 379 | } tAVDT_CCB_API_GETCAP; |
| 380 | |
| 381 | /* data type for AVDT_CCB_API_CONNECT_REQ_EVT */ |
| 382 | typedef struct { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 383 | tAVDT_CTRL_CBACK* p_cback; |
| 384 | uint8_t sec_mask; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 385 | } tAVDT_CCB_API_CONNECT; |
| 386 | |
| 387 | /* data type for AVDT_CCB_API_DISCONNECT_REQ_EVT */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 388 | typedef struct { tAVDT_CTRL_CBACK* p_cback; } tAVDT_CCB_API_DISCONNECT; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 389 | |
| 390 | /* union associated with ccb state machine events */ |
| 391 | typedef union { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 392 | tAVDT_CCB_API_DISCOVER discover; |
| 393 | tAVDT_CCB_API_GETCAP getcap; |
| 394 | tAVDT_CCB_API_CONNECT connect; |
| 395 | tAVDT_CCB_API_DISCONNECT disconnect; |
| 396 | tAVDT_MSG msg; |
| 397 | bool llcong; |
| 398 | uint8_t err_code; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 399 | } tAVDT_CCB_EVT; |
| 400 | |
| 401 | /* channel control block type */ |
| 402 | typedef struct { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 403 | BD_ADDR peer_addr; /* BD address of peer */ |
| 404 | /* |
| 405 | * NOTE: idle_ccb_timer, ret_ccb_timer and rsp_ccb_timer are mutually |
| 406 | * exclusive - no more than one timer should be running at the same time. |
| 407 | */ |
| 408 | alarm_t* idle_ccb_timer; /* Idle CCB timer entry */ |
| 409 | alarm_t* ret_ccb_timer; /* Ret CCB timer entry */ |
| 410 | alarm_t* rsp_ccb_timer; /* Rsp CCB timer entry */ |
| 411 | fixed_queue_t* cmd_q; /* Queue for outgoing command messages */ |
| 412 | fixed_queue_t* rsp_q; /* Queue for outgoing response and reject messages */ |
| 413 | tAVDT_CTRL_CBACK* proc_cback; /* Procedure callback function */ |
| 414 | tAVDT_CTRL_CBACK* |
| 415 | p_conn_cback; /* Connection/disconnection callback function */ |
| 416 | void* p_proc_data; /* Pointer to data storage for procedure */ |
| 417 | BT_HDR* p_curr_cmd; /* Current command being sent awaiting response */ |
| 418 | BT_HDR* p_curr_msg; /* Current message being sent */ |
| 419 | BT_HDR* p_rx_msg; /* Current message being received */ |
| 420 | bool allocated; /* Whether ccb is allocated */ |
| 421 | uint8_t state; /* The CCB state machine state */ |
| 422 | bool ll_opened; /* true if LL is opened */ |
| 423 | bool proc_busy; /* true when a discover or get capabilities procedure in |
| 424 | progress */ |
| 425 | uint8_t proc_param; /* Procedure parameter; either SEID for get capabilities |
| 426 | or number of SEPS for discover */ |
| 427 | bool cong; /* Whether signaling channel is congested */ |
| 428 | uint8_t label; /* Message header "label" (sequence number) */ |
| 429 | bool reconn; /* If true, reinitiate connection after transitioning from |
| 430 | CLOSING to IDLE state */ |
| 431 | uint8_t ret_count; /* Command retransmission count */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 432 | } tAVDT_CCB; |
| 433 | |
| 434 | /* type for action functions */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 435 | typedef void (*tAVDT_CCB_ACTION)(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 436 | |
| 437 | /* type for AVDT_SCB_API_WRITE_REQ_EVT */ |
| 438 | typedef struct { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 439 | BT_HDR* p_buf; |
| 440 | uint32_t time_stamp; |
| 441 | uint8_t m_pt; |
| 442 | tAVDT_DATA_OPT_MASK opt; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 443 | } tAVDT_SCB_APIWRITE; |
| 444 | |
| 445 | /* type for AVDT_SCB_TC_CLOSE_EVT */ |
| 446 | typedef struct { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 447 | uint8_t old_tc_state; /* channel state before closed */ |
| 448 | uint8_t tcid; /* TCID */ |
| 449 | uint8_t type; /* channel type */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 450 | } tAVDT_SCB_TC_CLOSE; |
| 451 | |
| 452 | /* type for scb event data */ |
| 453 | typedef union { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 454 | tAVDT_MSG msg; |
| 455 | tAVDT_SCB_APIWRITE apiwrite; |
| 456 | tAVDT_DELAY_RPT apidelay; |
| 457 | tAVDT_OPEN open; |
| 458 | tAVDT_SCB_TC_CLOSE close; |
| 459 | bool llcong; |
| 460 | BT_HDR* p_pkt; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 461 | } tAVDT_SCB_EVT; |
| 462 | |
| 463 | /* stream control block type */ |
| 464 | typedef struct { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 465 | tAVDT_CS cs; /* stream creation struct */ |
| 466 | tAVDT_CFG curr_cfg; /* current configuration */ |
| 467 | tAVDT_CFG req_cfg; /* requested configuration */ |
| 468 | alarm_t* transport_channel_timer; /* transport channel connect timer */ |
| 469 | BT_HDR* p_pkt; /* packet waiting to be sent */ |
| 470 | tAVDT_CCB* p_ccb; /* ccb associated with this scb */ |
| 471 | uint16_t media_seq; /* media packet sequence number */ |
| 472 | bool allocated; /* whether scb is allocated or unused */ |
| 473 | bool in_use; /* whether stream being used by peer */ |
| 474 | uint8_t role; /* initiator/acceptor role in current procedure */ |
| 475 | bool remove; /* whether CB is marked for removal */ |
| 476 | uint8_t state; /* state machine state */ |
| 477 | uint8_t peer_seid; /* SEID of peer stream */ |
| 478 | uint8_t curr_evt; /* current event; set only by state machine */ |
| 479 | bool cong; /* Whether media transport channel is congested */ |
| 480 | uint8_t close_code; /* Error code received in close response */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 481 | } tAVDT_SCB; |
| 482 | |
| 483 | /* type for action functions */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 484 | typedef void (*tAVDT_SCB_ACTION)(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 485 | |
| 486 | /* adaption layer type for transport channel table */ |
| 487 | typedef struct { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 488 | uint16_t peer_mtu; /* L2CAP mtu of the peer device */ |
| 489 | uint16_t my_mtu; /* Our MTU for this channel */ |
| 490 | uint16_t my_flush_to; /* Our flush timeout for this channel */ |
| 491 | uint16_t lcid; |
| 492 | uint8_t tcid; /* transport channel id */ |
| 493 | uint8_t ccb_idx; /* channel control block associated with this tc */ |
| 494 | uint8_t state; /* transport channel state */ |
| 495 | uint8_t cfg_flags; /* L2CAP configuration flags */ |
| 496 | uint8_t id; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 497 | } tAVDT_TC_TBL; |
| 498 | |
| 499 | /* adaption layer type for stream routing table */ |
| 500 | typedef struct { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 501 | uint16_t lcid; /* L2CAP LCID of the associated transport channel */ |
| 502 | uint8_t scb_hdl; /* stream control block associated with this tc */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 503 | } tAVDT_RT_TBL; |
| 504 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 505 | /* adaption layer control block */ |
| 506 | typedef struct { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 507 | tAVDT_RT_TBL rt_tbl[AVDT_NUM_LINKS][AVDT_NUM_RT_TBL]; |
| 508 | tAVDT_TC_TBL tc_tbl[AVDT_NUM_TC_TBL]; |
| 509 | uint8_t lcid_tbl[MAX_L2CAP_CHANNELS]; /* map LCID to tc_tbl index */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 510 | } tAVDT_AD; |
| 511 | |
| 512 | /* Control block for AVDT */ |
| 513 | typedef struct { |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 514 | tAVDT_REG rcb; /* registration control block */ |
| 515 | tAVDT_CCB ccb[AVDT_NUM_LINKS]; /* channel control blocks */ |
| 516 | tAVDT_SCB scb[AVDT_NUM_SEPS]; /* stream control blocks */ |
| 517 | tAVDT_AD ad; /* adaption layer control block */ |
| 518 | tAVDTC_CTRL_CBACK* p_conf_cback; /* conformance callback function */ |
| 519 | tAVDT_CCB_ACTION* p_ccb_act; /* pointer to CCB action functions */ |
| 520 | tAVDT_SCB_ACTION* p_scb_act; /* pointer to SCB action functions */ |
| 521 | tAVDT_CTRL_CBACK* p_conn_cback; /* connection callback function */ |
| 522 | uint8_t trace_level; /* trace level */ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 523 | } tAVDT_CB; |
| 524 | |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 525 | /***************************************************************************** |
Myles Watson | ee96a3c | 2016-11-23 14:49:54 -0800 | [diff] [blame] | 526 | * function declarations |
| 527 | ****************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 528 | |
| 529 | /* CCB function declarations */ |
| 530 | extern void avdt_ccb_init(void); |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 531 | extern void avdt_ccb_event(tAVDT_CCB* p_ccb, uint8_t event, |
| 532 | tAVDT_CCB_EVT* p_data); |
| 533 | extern tAVDT_CCB* avdt_ccb_by_bd(BD_ADDR bd_addr); |
| 534 | extern tAVDT_CCB* avdt_ccb_alloc(BD_ADDR bd_addr); |
| 535 | extern void avdt_ccb_dealloc(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 536 | extern uint8_t avdt_ccb_to_idx(tAVDT_CCB* p_ccb); |
| 537 | extern tAVDT_CCB* avdt_ccb_by_idx(uint8_t idx); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 538 | |
| 539 | /* CCB action functions */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 540 | extern void avdt_ccb_chan_open(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 541 | extern void avdt_ccb_chan_close(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 542 | extern void avdt_ccb_chk_close(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 543 | extern void avdt_ccb_hdl_discover_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 544 | extern void avdt_ccb_hdl_discover_rsp(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 545 | extern void avdt_ccb_hdl_getcap_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 546 | extern void avdt_ccb_hdl_getcap_rsp(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 547 | extern void avdt_ccb_hdl_start_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 548 | extern void avdt_ccb_hdl_start_rsp(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 549 | extern void avdt_ccb_hdl_suspend_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 550 | extern void avdt_ccb_hdl_suspend_rsp(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 551 | extern void avdt_ccb_snd_discover_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 552 | extern void avdt_ccb_snd_discover_rsp(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 553 | extern void avdt_ccb_snd_getcap_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 554 | extern void avdt_ccb_snd_getcap_rsp(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 555 | extern void avdt_ccb_snd_start_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 556 | extern void avdt_ccb_snd_start_rsp(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 557 | extern void avdt_ccb_snd_suspend_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 558 | extern void avdt_ccb_snd_suspend_rsp(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 559 | extern void avdt_ccb_clear_cmds(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 560 | extern void avdt_ccb_cmd_fail(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 561 | extern void avdt_ccb_free_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 562 | extern void avdt_ccb_cong_state(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 563 | extern void avdt_ccb_ret_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 564 | extern void avdt_ccb_snd_cmd(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 565 | extern void avdt_ccb_snd_msg(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 566 | extern void avdt_ccb_set_reconn(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 567 | extern void avdt_ccb_clr_reconn(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 568 | extern void avdt_ccb_chk_reconn(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 569 | extern void avdt_ccb_chk_timer(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 570 | extern void avdt_ccb_set_conn(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 571 | extern void avdt_ccb_set_disconn(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 572 | extern void avdt_ccb_do_disconn(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 573 | extern void avdt_ccb_ll_closed(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
| 574 | extern void avdt_ccb_ll_opened(tAVDT_CCB* p_ccb, tAVDT_CCB_EVT* p_data); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 575 | |
| 576 | /* SCB function prototypes */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 577 | extern void avdt_scb_event(tAVDT_SCB* p_scb, uint8_t event, |
| 578 | tAVDT_SCB_EVT* p_data); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 579 | extern void avdt_scb_init(void); |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 580 | extern tAVDT_SCB* avdt_scb_alloc(tAVDT_CS* p_cs); |
| 581 | extern void avdt_scb_dealloc(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 582 | extern uint8_t avdt_scb_to_hdl(tAVDT_SCB* p_scb); |
| 583 | extern tAVDT_SCB* avdt_scb_by_hdl(uint8_t hdl); |
| 584 | extern uint8_t avdt_scb_verify(tAVDT_CCB* p_ccb, uint8_t state, uint8_t* p_seid, |
| 585 | uint16_t num_seid, uint8_t* p_err_code); |
| 586 | extern void avdt_scb_peer_seid_list(tAVDT_MULTI* p_multi); |
| 587 | extern uint32_t avdt_scb_gen_ssrc(tAVDT_SCB* p_scb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 588 | |
| 589 | /* SCB action functions */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 590 | extern void avdt_scb_hdl_abort_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 591 | extern void avdt_scb_hdl_abort_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 592 | extern void avdt_scb_hdl_close_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 593 | extern void avdt_scb_hdl_close_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 594 | extern void avdt_scb_hdl_getconfig_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 595 | extern void avdt_scb_hdl_getconfig_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 596 | extern void avdt_scb_hdl_open_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 597 | extern void avdt_scb_hdl_open_rej(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 598 | extern void avdt_scb_hdl_open_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 599 | extern void avdt_scb_hdl_pkt(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 600 | extern void avdt_scb_drop_pkt(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 601 | extern void avdt_scb_hdl_reconfig_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 602 | extern void avdt_scb_hdl_reconfig_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 603 | extern void avdt_scb_hdl_security_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 604 | extern void avdt_scb_hdl_security_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 605 | extern void avdt_scb_hdl_setconfig_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 606 | extern void avdt_scb_hdl_setconfig_rej(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 607 | extern void avdt_scb_hdl_setconfig_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 608 | extern void avdt_scb_hdl_start_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 609 | extern void avdt_scb_hdl_start_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 610 | extern void avdt_scb_hdl_suspend_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 611 | extern void avdt_scb_hdl_suspend_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 612 | extern void avdt_scb_snd_delay_rpt_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 613 | extern void avdt_scb_hdl_delay_rpt_cmd(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 614 | extern void avdt_scb_hdl_delay_rpt_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 615 | extern void avdt_scb_hdl_tc_close(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 616 | extern void avdt_scb_hdl_tc_open(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 617 | extern void avdt_scb_hdl_tc_close_sto(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 618 | extern void avdt_scb_hdl_tc_open_sto(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 619 | extern void avdt_scb_hdl_write_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 620 | extern void avdt_scb_snd_abort_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 621 | extern void avdt_scb_snd_abort_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 622 | extern void avdt_scb_snd_close_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 623 | extern void avdt_scb_snd_stream_close(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 624 | extern void avdt_scb_snd_close_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 625 | extern void avdt_scb_snd_getconfig_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 626 | extern void avdt_scb_snd_getconfig_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 627 | extern void avdt_scb_snd_open_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 628 | extern void avdt_scb_snd_open_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 629 | extern void avdt_scb_snd_reconfig_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 630 | extern void avdt_scb_snd_reconfig_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 631 | extern void avdt_scb_snd_security_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 632 | extern void avdt_scb_snd_security_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 633 | extern void avdt_scb_snd_setconfig_req(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 634 | extern void avdt_scb_snd_setconfig_rej(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 635 | extern void avdt_scb_snd_setconfig_rsp(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 636 | extern void avdt_scb_snd_tc_close(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 637 | extern void avdt_scb_cb_err(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 638 | extern void avdt_scb_cong_state(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 639 | extern void avdt_scb_rej_state(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 640 | extern void avdt_scb_rej_in_use(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 641 | extern void avdt_scb_rej_not_in_use(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 642 | extern void avdt_scb_set_remove(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 643 | extern void avdt_scb_free_pkt(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 644 | extern void avdt_scb_chk_snd_pkt(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 645 | extern void avdt_scb_clr_pkt(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
| 646 | extern void avdt_scb_transport_channel_timer(tAVDT_SCB* p_scb, |
| 647 | tAVDT_SCB_EVT* p_data); |
| 648 | extern void avdt_scb_clr_vars(tAVDT_SCB* p_scb, tAVDT_SCB_EVT* p_data); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 649 | |
| 650 | /* msg function declarations */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 651 | extern bool avdt_msg_send(tAVDT_CCB* p_ccb, BT_HDR* p_msg); |
| 652 | extern void avdt_msg_send_cmd(tAVDT_CCB* p_ccb, void* p_scb, uint8_t sig_id, |
| 653 | tAVDT_MSG* p_params); |
| 654 | extern void avdt_msg_send_rsp(tAVDT_CCB* p_ccb, uint8_t sig_id, |
| 655 | tAVDT_MSG* p_params); |
| 656 | extern void avdt_msg_send_rej(tAVDT_CCB* p_ccb, uint8_t sig_id, |
| 657 | tAVDT_MSG* p_params); |
| 658 | extern void avdt_msg_send_grej(tAVDT_CCB* p_ccb, uint8_t sig_id, |
| 659 | tAVDT_MSG* p_params); |
| 660 | extern void avdt_msg_ind(tAVDT_CCB* p_ccb, BT_HDR* p_buf); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 661 | |
| 662 | /* adaption layer function declarations */ |
| 663 | extern void avdt_ad_init(void); |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 664 | extern uint8_t avdt_ad_type_to_tcid(uint8_t type, tAVDT_SCB* p_scb); |
| 665 | extern tAVDT_TC_TBL* avdt_ad_tc_tbl_by_st(uint8_t type, tAVDT_CCB* p_ccb, |
| 666 | uint8_t state); |
| 667 | extern tAVDT_TC_TBL* avdt_ad_tc_tbl_by_lcid(uint16_t lcid); |
| 668 | extern tAVDT_TC_TBL* avdt_ad_tc_tbl_alloc(tAVDT_CCB* p_ccb); |
| 669 | extern uint8_t avdt_ad_tc_tbl_to_idx(tAVDT_TC_TBL* p_tbl); |
| 670 | extern void avdt_ad_tc_close_ind(tAVDT_TC_TBL* p_tbl, uint16_t reason); |
| 671 | extern void avdt_ad_tc_open_ind(tAVDT_TC_TBL* p_tbl); |
| 672 | extern void avdt_ad_tc_cong_ind(tAVDT_TC_TBL* p_tbl, bool is_congested); |
| 673 | extern void avdt_ad_tc_data_ind(tAVDT_TC_TBL* p_tbl, BT_HDR* p_buf); |
| 674 | extern tAVDT_TC_TBL* avdt_ad_tc_tbl_by_type(uint8_t type, tAVDT_CCB* p_ccb, |
| 675 | tAVDT_SCB* p_scb); |
| 676 | extern uint8_t avdt_ad_write_req(uint8_t type, tAVDT_CCB* p_ccb, |
| 677 | tAVDT_SCB* p_scb, BT_HDR* p_buf); |
| 678 | extern void avdt_ad_open_req(uint8_t type, tAVDT_CCB* p_ccb, tAVDT_SCB* p_scb, |
| 679 | uint8_t role); |
| 680 | extern void avdt_ad_close_req(uint8_t type, tAVDT_CCB* p_ccb, tAVDT_SCB* p_scb); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 681 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 682 | extern void avdt_ccb_idle_ccb_timer_timeout(void* data); |
| 683 | extern void avdt_ccb_ret_ccb_timer_timeout(void* data); |
| 684 | extern void avdt_ccb_rsp_ccb_timer_timeout(void* data); |
| 685 | extern void avdt_scb_transport_channel_timer_timeout(void* data); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 686 | |
| 687 | /***************************************************************************** |
Myles Watson | ee96a3c | 2016-11-23 14:49:54 -0800 | [diff] [blame] | 688 | * macros |
| 689 | ****************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 690 | |
| 691 | /* we store the scb and the label in the layer_specific field of the |
Myles Watson | ee96a3c | 2016-11-23 14:49:54 -0800 | [diff] [blame] | 692 | * current cmd |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 693 | */ |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 694 | #define AVDT_BLD_LAYERSPEC(ls, msg, label) ls = (((label) << 4) | (msg)) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 695 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 696 | #define AVDT_LAYERSPEC_LABEL(ls) ((uint8_t)((ls) >> 4)) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 697 | |
Myles Watson | 911d1ae | 2016-11-28 16:44:40 -0800 | [diff] [blame] | 698 | #define AVDT_LAYERSPEC_MSG(ls) ((uint8_t)((ls)&0x000F)) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 699 | |
| 700 | /***************************************************************************** |
Myles Watson | ee96a3c | 2016-11-23 14:49:54 -0800 | [diff] [blame] | 701 | * global data |
| 702 | ****************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 703 | |
| 704 | /****************************************************************************** |
Myles Watson | ee96a3c | 2016-11-23 14:49:54 -0800 | [diff] [blame] | 705 | * Main Control Block |
| 706 | ******************************************************************************/ |
Pavlin Radoslavov | 37c1b5f | 2016-10-14 15:47:27 -0700 | [diff] [blame] | 707 | extern tAVDT_CB avdt_cb; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 708 | |
| 709 | /* L2CAP callback registration structure */ |
| 710 | extern const tL2CAP_APPL_INFO avdt_l2c_appl; |
| 711 | |
| 712 | /* reject message event lookup table */ |
Marie Janssen | d19e078 | 2016-07-15 12:48:27 -0700 | [diff] [blame] | 713 | extern const uint8_t avdt_msg_rej_2_evt[]; |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 714 | |
| 715 | #endif /* AVDT_INT_H */ |