avct_defs.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. * This contains constants definitions and other information from the AVCTP
  21. * specification. This file is intended for use internal to AVCT only.
  22. *
  23. ******************************************************************************/
  24. #ifndef AVCT_DEFS_H
  25. #define AVCT_DEFS_H
  26. /*****************************************************************************
  27. ** constants
  28. *****************************************************************************/
  29. /* packet type */
  30. #define AVCT_PKT_TYPE_SINGLE 0 /* single packet */
  31. #define AVCT_PKT_TYPE_START 1 /* start packet */
  32. #define AVCT_PKT_TYPE_CONT 2 /* continue packet */
  33. #define AVCT_PKT_TYPE_END 3 /* end packet */
  34. /* header lengths for different packet types */
  35. #define AVCT_HDR_LEN_SINGLE 3
  36. #define AVCT_HDR_LEN_START 4
  37. #define AVCT_HDR_LEN_CONT 1
  38. #define AVCT_HDR_LEN_END 1
  39. /* invalid cr+ipid value */
  40. #define AVCT_CR_IPID_INVALID 1
  41. /*****************************************************************************
  42. ** message parsing and building macros
  43. *****************************************************************************/
  44. #define AVCT_BLD_HDR(p, label, type, cr_ipid) \
  45. *(p)++ = ((label) << 4) | ((type) << 2) | (cr_ipid);
  46. #define AVCT_PRS_HDR(p, label, type, cr_ipid) \
  47. label = *(p) >> 4; \
  48. type = (*(p) >> 2) & 3; \
  49. cr_ipid = *(p)++ & 3;
  50. #define AVCT_PRS_PKT_TYPE(p, type) \
  51. type = (*(p) >> 2) & 3;
  52. #endif /* AVCT_DEFS_H */