Mistake on this page?
Report an issue in GitHub or email us
lctr_int_adv_slave.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Internal link layer controller advertising slave interface file.
6  *
7  * Copyright (c) 2013-2017 ARM Ltd. All Rights Reserved.
8  *
9  * Copyright (c) 2019 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_INT_ADV_SLAVE_H
26 #define LCTR_INT_ADV_SLAVE_H
27 
28 #include "lctr_int.h"
29 #include "lctr_api_adv_slave.h"
30 #include "lctr_pdu_adv.h"
31 #include "bb_ble_api.h"
32 #include "bb_ble_api_op.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /**************************************************************************************************
39  Constants
40 **************************************************************************************************/
41 
42 /*! \brief Slave advertising states. */
43 enum
44 {
45  LCTR_ADV_STATE_DISABLED, /*!< Advertising disabled state. */
46  LCTR_ADV_STATE_ENABLED, /*!< Advertising enabled state. */
47  LCTR_ADV_STATE_SHUTDOWN, /*!< Advertising shutdown in progress. */
48  LCTR_ADV_STATE_RESET, /*!< Advertising reset in progress. */
49  LCTR_ADV_STATE_TOTAL /*!< Total number of advertising states. */
50 };
51 
52 /*! \brief Common extended advertising PDU types. */
53 
54 enum
55 {
56  LCTR_PDU_ADV_EXT_IND,
57  LCTR_PDU_AUX_ADV_IND,
58  LCTR_PDU_AUX_SCAN_RSP,
59  LCTR_PDU_AUX_SYNC_IND,
60  LCTR_PDU_AUX_CHAIN_IND,
61  LCTR_PDU_AUX_CONNECT_RSP
62 };
63 
64 /**************************************************************************************************
65  Data Types
66 **************************************************************************************************/
67 
68 /*! \brief Slave advertising state context. */
69 typedef struct
70 {
71  /* Adv buffer (placed here to 32-bit align) */
72  uint8_t advBuf[LL_ADVB_MAX_LEN];
73  /*!< Advertising host data buffer. */
74 
75  uint8_t state; /*!< Advertising state. */
76 
77  /* BB/ISR context */
78  bool_t connIndRcvd; /*!< Connection indication received flag. */
79  bool_t shutdown; /*!< Client initiated shutdown flag. */
80  uint8_t usedChSel; /*!< Used channel selection. */
81  BbOpDesc_t advBod; /*!< Advertising BOD. */
82  BbBleData_t bleData; /*!< BLE BB operation data. */
83  uint32_t reqEndTsUsec; /*!< Last received request end of packet timestamp in microseconds. */
84 
85  /* Scan buffer (placed here to 32-bit align) */
86  uint8_t scanRspBuf[LL_ADVB_MAX_LEN];
87  /*!< Advertising host data buffer. */
88 
89  wsfQueue_t rxScanReqQ; /*!< Received SCAN_REQ queue. */
91 
92 /*! \brief Scan request. */
93 typedef struct
94 {
95  uint8_t scanAddrType; /*!< Scanner address type. */
96  uint64_t scanAddr; /*!< Scanner address. */
97  uint8_t scanIdAddrType; /*!< Scanner ID address type. */
98  uint64_t scanIdAddr; /*!< Scanner ID address. */
100 
101 /**************************************************************************************************
102  Globals
103 **************************************************************************************************/
104 
105 extern lctrSlvAdvCtx_t lctrSlvAdv;
106 
107 /**************************************************************************************************
108  Function Declarations
109 **************************************************************************************************/
110 
111 /* Builder */
112 void lctrSlvAdvBuildOp(void);
113 void lctrSlvAdvCleanupOp(void);
114 
115 /* Event handlers */
116 void lctrSlvRxScanReq(void);
117 
118 /* Address selection */
119 void lctrChooseAdvA(BbBleData_t * const pBle, lctrAdvbPduHdr_t *pPduHdr,
120  uint8_t ownAddrType, uint8_t peerAddrType, uint64_t peerAddr,
121  uint64_t *pAdvA);
122 void lctrChoosePeerAddr(BbBleData_t * const pBle, uint8_t ownAddrType,
123  uint8_t peerAddrType, uint64_t peerAddr, uint64_t *pPeerRpa);
124 
125 /* ISR */
126 bool_t lctrSlvAdvHandler(BbOpDesc_t *pOp, const uint8_t *pReqBuf);
127 bool_t lctrScanReqHandler(BbOpDesc_t *pOp, uint8_t reqLen);
128 void lctrConnIndHandler(BbOpDesc_t *pOp, uint8_t reqLen, const uint8_t *pReqBuf);
129 void lctrSlvAdvPostProcessHandler(BbOpDesc_t *pOp, const uint8_t *pReqBuf);
130 void lctrSlvAdvEndOp(BbOpDesc_t *pOp);
131 
132 /* Channel */
133 uint32_t lctrCalcAdvDelay(void);
134 
135 /* Action routines */
136 void lctrAdvActStart(void);
137 void lctrAdvActSelfStart(void);
138 void lctrAdvActShutdown(void);
139 void lctrAdvActAdvCnf(void);
140 void lctrAdvActDisallowAdvCnf(void);
141 void lctrAdvActSelfTerm(void);
142 void lctrAdvActAdvTerm(void);
143 void lctrAdvActResetTerm(void);
144 void lctrAdvActUpdateAdvParam(void);
145 
146 #ifdef __cplusplus
147 };
148 #endif
149 
150 #endif /* LCTR_INT_ADV_SLAVE_H */
BLE baseband interface file.
Link layer controller advertising channel packet interface file.
Bluetooth Low Energy protocol specific operation parameters.
Advertising channel PDU header.
Definition: lctr_pdu_adv.h:50
Queue structure.
Definition: wsf_queue.h:46
Baseband operation descriptor (BOD).
Definition: bb_api.h:149
BLE baseband interface file.
#define LL_ADVB_MAX_LEN
Definition: ll_defs.h:103
Slave advertising state context.
Internal link layer controller interface file.
Link layer controller advertising slave interface file.
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.