blob: 37846721a0c96b00ba32bc84fff605234f36cff1 [file] [log] [blame]
The Android Open Source Project5738f832012-12-12 16:00:35 -08001/******************************************************************************
2 *
3 * Copyright (C) 2003-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 contains constants definitions and other information from the AVCTP
22 * specification. This file is intended for use internal to AVCT only.
23 *
24 ******************************************************************************/
25#ifndef AVCT_DEFS_H
26#define AVCT_DEFS_H
27
28/*****************************************************************************
Myles Watsonee96a3c2016-11-23 14:49:54 -080029 * constants
30 ****************************************************************************/
The Android Open Source Project5738f832012-12-12 16:00:35 -080031
32/* packet type */
33#define AVCT_PKT_TYPE_SINGLE 0 /* single packet */
34#define AVCT_PKT_TYPE_START 1 /* start packet */
35#define AVCT_PKT_TYPE_CONT 2 /* continue packet */
36#define AVCT_PKT_TYPE_END 3 /* end packet */
37
38/* header lengths for different packet types */
39#define AVCT_HDR_LEN_SINGLE 3
40#define AVCT_HDR_LEN_START 4
41#define AVCT_HDR_LEN_CONT 1
42#define AVCT_HDR_LEN_END 1
43
44/* invalid cr+ipid value */
45#define AVCT_CR_IPID_INVALID 1
46
47/*****************************************************************************
Myles Watsonee96a3c2016-11-23 14:49:54 -080048 * message parsing and building macros
49 ****************************************************************************/
The Android Open Source Project5738f832012-12-12 16:00:35 -080050
Avish Shaha408eb72016-06-22 06:47:20 +053051#define AVCT_BUILD_HDR(p, label, type, cr_ipid) \
Myles Watson3cb4b332016-10-21 16:25:30 -070052 *(p)++ = ((label) << 4) | ((type) << 2) | (cr_ipid);
The Android Open Source Project5738f832012-12-12 16:00:35 -080053
Avish Shaha408eb72016-06-22 06:47:20 +053054#define AVCT_PARSE_HDR(p, label, type, cr_ipid) \
Myles Watson3cb4b332016-10-21 16:25:30 -070055 do { \
56 (label) = *(p) >> 4; \
57 (type) = (*(p) >> 2) & 3; \
58 (cr_ipid) = *(p)++ & 3; \
59 } while (0)
The Android Open Source Project5738f832012-12-12 16:00:35 -080060
Myles Watson3cb4b332016-10-21 16:25:30 -070061#define AVCT_PKT_TYPE(p) ((*(p) >> 2) & 3)
The Android Open Source Project5738f832012-12-12 16:00:35 -080062
63#endif /* AVCT_DEFS_H */