Mistake on this page?
Report an issue in GitHub or email us
lctr_pdu_iso.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Link layer controller data channel packet interface file.
6  *
7  * Copyright (c) 2013-2018 Arm Ltd. All Rights Reserved.
8  *
9  * Copyright (c) 2019-2020 Packetcraft, Inc.
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 /*************************************************************************************************/
24 
25 #ifndef LCTR_PDU_ISO_H
26 #define LCTR_PDU_ISO_H
27 
28 #include "wsf_types.h"
29 #include "wsf_queue.h"
30 #include "bb_ble_api.h"
31 #include "ll_defs.h"
32 #include "ll_api.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 
39 /**************************************************************************************************
40  Macros
41 **************************************************************************************************/
42 
43 /*! \brief Get length of ISO Header. */
44 #define LCTR_GET_ISO_DATA_HDR_LEN(pIsoHdr) (HCI_ISO_HDR_LEN + (((pIsoHdr)->tsFlag) ? HCI_ISO_DL_MAX_LEN : HCI_ISO_DL_MIN_LEN))
45 
46 /**************************************************************************************************
47  Constants
48 **************************************************************************************************/
49 
50 /*! \brief Packet boundary flags. */
51 typedef enum
52 {
53  LCTR_PB_FIRST = 0, /*!< Data is the first fragment of a fragmented SDU. */
54  LCTR_PB_CONT = 1, /*!< Data is a continuation fragment of a fragmented SDU. */
55  LCTR_PB_COMP = 2, /*!< Data is a complete SDU. */
56  LCTR_PB_LAST = 3 /*!< Data is the last fragment of a fragmented SDU. */
58 
59 /*! \brief Packet status flags. */
60 typedef enum
61 {
62  LCTR_PS_VALID = 0, /*!< Data is received correctly. */
63  LCTR_PS_INVALID = 1, /*!< Data with possible errors. */
64  LCTR_PS_LOST = 2, /*!< Data with lost data. */
66 
67 /**************************************************************************************************
68  Data Types
69 **************************************************************************************************/
70 
71 /*! \brief ISO header. */
72 typedef struct
73 {
74  /* ISO header */
75  uint16_t handle; /*!< CIS or BIS handle. */
76  lctrPktBoundary_t pb:8; /*!< Packet boundary flag. */
77  bool_t tsFlag; /*!< Timestamp flag. */
78  uint16_t len; /*!< Data length. */
79 
80  /* ISO Data Load */
81  uint32_t ts; /*!< Timestamp. */
82  uint16_t pktSn; /*!< Packet sequence number. */
83  uint16_t sduLen; /*!< SDU length. */
84  lctrPktStatus_t ps:8; /*!< Packet status. */
85  const uint8_t *pSdu; /*!< First byte of ISO SDU. */
86 } lctrIsoHdr_t;
87 
88 /*! \brief ISO SDU descriptor. */
89 typedef struct
90 {
91  lctrIsoHdr_t hdr; /*!< ISO header. */
92  uint32_t ts; /*!< Timestamp. */
93  uint8_t data; /*!< Data. */
95 
96 /*! \brief ISO CIS PDU header. */
97 typedef struct
98 {
99  uint8_t llid; /*!< PDU type. */
100  uint8_t nesn; /*!< Next Expected Sequence Number. */
101  uint8_t sn; /*!< Sequence Number. */
102  uint8_t cie; /*!< TRUE if stop next subevent. */
103  uint8_t np; /*!< PDU type, whether a NULL PDU. */
104  uint8_t len; /*!< Payload length. */
106 
107 /*! \brief ISO BIS PDU header. */
108 typedef struct
109 {
110  LlIsoLlid_t llid:8; /*!< PDU type. */
111  uint8_t cssn; /*!< Control Subevent Sequence Number. */
112  bool_t cstf; /*!< Control Subevent Submission Flag. */
113  uint8_t len; /*!< Payload length. */
115 
116 /*! \brief ISOAL Segmentation Header. */
117 typedef struct
118 {
119  bool_t sc; /*!< Segment continuation flag. */
120  bool_t cmplt; /*!< Segment complete flag. */
121  uint8_t len; /*!< Payload length. */
122  uint32_t toffs; /*!< Time offset. */
124 
125 /**************************************************************************************************
126  Function Declarations
127 **************************************************************************************************/
128 
129 /* Pack */
130 uint8_t lctrIsoPackHdr(uint8_t *pBuf, const lctrIsoHdr_t *pHdr);
131 uint8_t lctrIsoPackSegHdr(uint8_t *pBuf, const lctrIsoSegHdr_t *pSegHdr);
132 uint8_t lctrIsoUnpackSegHdr(lctrIsoSegHdr_t *pHdr, uint8_t *pBuf);
133 uint8_t lctrCisPackDataPduHdr(uint8_t *pBuf, const lctrCisDataPduHdr_t *pHdr);
134 uint8_t lctrBisPackDataPduHdr(uint8_t *pBuf, const lctrBisDataPduHdr_t *pHdr);
135 uint8_t lctrBisPackBigChannelMapInd(uint8_t *pBuf, uint64_t chanMap, uint16_t instance);
136 uint8_t lctrBisPackBigTerminateInd(uint8_t *pBuf, uint8_t reason, uint16_t instance);
137 
138 /* Unpack */
139 uint8_t lctrIsoUnpackHdr(lctrIsoHdr_t *pHdr, const uint8_t *pBuf);
140 uint8_t lctrCisUnpackDataPduHdr(lctrCisDataPduHdr_t *pHdr, const uint8_t *pBuf);
141 uint8_t lctrBisUnpackDataPduHdr(lctrBisDataPduHdr_t *pHdr, const uint8_t *pBuf);
142 uint8_t lctrBisUnpackBigChannelMapInd(uint64_t *pChanMap, uint16_t *pInstance, const uint8_t *pBuf);
143 uint8_t lctrBisUnpackBigTerminateInd(uint8_t *pReason, uint16_t *pInstance, const uint8_t *pBuf);
144 
145 #ifdef __cplusplus
146 };
147 #endif
148 
149 #endif /* LCTR_PDU_ISO_H */
BLE baseband interface file.
Link layer interface file.
lctrPktStatus_t
Packet status flags.
Definition: lctr_pdu_iso.h:60
ISO header.
Definition: lctr_pdu_iso.h:72
uint16_t pktSn
Definition: lctr_pdu_iso.h:82
uint32_t ts
Definition: lctr_pdu_iso.h:92
lctrIsoHdr_t hdr
Definition: lctr_pdu_iso.h:91
Platform-independent data types.
lctrPktBoundary_t
Packet boundary flags.
Definition: lctr_pdu_iso.h:51
bool_t tsFlag
Definition: lctr_pdu_iso.h:77
LlIsoLlid_t
ISO PDU LLID types.
Definition: ll_defs.h:419
ISO SDU descriptor.
Definition: lctr_pdu_iso.h:89
Link layer constant definitions.
uint16_t sduLen
Definition: lctr_pdu_iso.h:83
General purpose queue service.
const uint8_t * pSdu
Definition: lctr_pdu_iso.h:85
uint16_t len
Definition: lctr_pdu_iso.h:78
ISO BIS PDU header.
Definition: lctr_pdu_iso.h:108
ISOAL Segmentation Header.
Definition: lctr_pdu_iso.h:117
uint16_t handle
Definition: lctr_pdu_iso.h:75
uint32_t ts
Definition: lctr_pdu_iso.h:81
uint8_t data
Definition: lctr_pdu_iso.h:93
ISO CIS PDU header.
Definition: lctr_pdu_iso.h:97
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.