The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 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 Watson | ee96a3c | 2016-11-23 14:49:54 -0800 | [diff] [blame^] | 29 | * constants |
| 30 | ****************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 31 | |
| 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 Watson | ee96a3c | 2016-11-23 14:49:54 -0800 | [diff] [blame^] | 48 | * message parsing and building macros |
| 49 | ****************************************************************************/ |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 50 | |
Avish Shah | a408eb7 | 2016-06-22 06:47:20 +0530 | [diff] [blame] | 51 | #define AVCT_BUILD_HDR(p, label, type, cr_ipid) \ |
Myles Watson | 3cb4b33 | 2016-10-21 16:25:30 -0700 | [diff] [blame] | 52 | *(p)++ = ((label) << 4) | ((type) << 2) | (cr_ipid); |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 53 | |
Avish Shah | a408eb7 | 2016-06-22 06:47:20 +0530 | [diff] [blame] | 54 | #define AVCT_PARSE_HDR(p, label, type, cr_ipid) \ |
Myles Watson | 3cb4b33 | 2016-10-21 16:25:30 -0700 | [diff] [blame] | 55 | do { \ |
| 56 | (label) = *(p) >> 4; \ |
| 57 | (type) = (*(p) >> 2) & 3; \ |
| 58 | (cr_ipid) = *(p)++ & 3; \ |
| 59 | } while (0) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 60 | |
Myles Watson | 3cb4b33 | 2016-10-21 16:25:30 -0700 | [diff] [blame] | 61 | #define AVCT_PKT_TYPE(p) ((*(p) >> 2) & 3) |
The Android Open Source Project | 5738f83 | 2012-12-12 16:00:35 -0800 | [diff] [blame] | 62 | |
| 63 | #endif /* AVCT_DEFS_H */ |