Mistake on this page?
Report an issue in GitHub or email us
dm_main.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief DM main module.
6  *
7  * Copyright (c) 2009-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 #ifndef DM_MAIN_H
25 #define DM_MAIN_H
26 
27 #include "util/bda.h"
28 #include "wsf_os.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /**************************************************************************************************
35  Macros
36 **************************************************************************************************/
37 
38 /* DM component IDs */
39 #define DM_ID_ADV 0
40 #define DM_ID_DEV_PRIV 1
41 #define DM_ID_SCAN 2
42 #define DM_ID_CONN 3
43 #define DM_ID_CONN_2 4
44 #define DM_ID_SEC 5
45 #define DM_ID_PRIV 6
46 #define DM_ID_DEV 7
47 #define DM_ID_LESC 8
48 #define DM_ID_PHY 9
49 #define DM_ID_ADV_PER 10
50 #define DM_ID_SYNC 11
51 #define DM_ID_PAST 12
52 #define DM_ID_CONN_CTE 13
53 #define DM_ID_CONN_UPD 14
54 #define DM_ID_PRIV_AES 15
55 #define DM_ID_CIS 16
56 #define DM_ID_CIS_CIG 17
57 #define DM_ID_BIS 18
58 #define DM_ID_BIS_SYNC 19
59 #define DM_ID_ISO 20
60 #define DM_NUM_IDS 21
61 
62 /* Start of component message enumeration */
63 #define DM_MSG_START(id) ((id) << 3)
64 
65 /* Get the component ID from a message ID */
66 #define DM_ID_FROM_MSG(msg) ((msg) >> 3)
67 
68 /* Mask off the ID from the message ID */
69 #define DM_MSG_MASK(msg) ((msg) & 0x07)
70 
71 /* Length of hash part of private resolvable address */
72 #define DM_PRIV_HASH_LEN 3
73 
74 /* Length of random part of private resolvable address */
75 #define DM_PRIV_PRAND_LEN 3
76 
77 /* Length of plaintext used for private resolvable address calculation */
78 #define DM_PRIV_PLAINTEXT_LEN 16
79 
80 /**************************************************************************************************
81  Data Types
82 **************************************************************************************************/
83 
84 /* DM reset function type */
85 typedef void (*dmReset_t)(void);
86 
87 /* DM message handling function types */
88 typedef void (*dmMsgHandler_t)(wsfMsgHdr_t *pMsg);
89 typedef void (*dmHciHandler_t)(hciEvt_t *pEvent);
90 
91 /* DM component reset and handler function interface */
92 typedef struct
93 {
94  dmReset_t reset;
95  dmHciHandler_t hciHandler;
96  dmMsgHandler_t msgHandler;
97 } dmFcnIf_t;
98 
99 /* Main control block of the DM subsystem */
100 typedef struct
101 {
102  bdAddr_t localAddr;
103  dmCback_t cback;
104  wsfHandlerId_t handlerId;
105  uint8_t connAddrType;
106  uint8_t advAddrType;
107  uint8_t scanAddrType;
108  bool_t resetting;
109 
110  /* Filter policies for Advertising, Scanning, Initiator and Synchronization */
111  uint8_t advFiltPolicy[DM_NUM_ADV_SETS];
112  uint8_t scanFiltPolicy;
113  uint8_t initFiltPolicy;
114 
115  /* Options (filter policies and periodic advertising report enablement) for Synchronization */
116  uint8_t syncOptions;
117 
118  /* LL Privacy */
119  bool_t llPrivEnabled;
120 } dmCb_t;
121 
122 /**************************************************************************************************
123  Global Variables
124 **************************************************************************************************/
125 
126 /* Component function interface table indexed DM component ID */
127 extern dmFcnIf_t *dmFcnIfTbl[DM_NUM_IDS];
128 
129 /* Control block */
130 extern dmCb_t dmCb;
131 
132 /**************************************************************************************************
133  Function Declarations
134 **************************************************************************************************/
135 
136 void dmEmptyReset(void);
137 void dmEmptyHandler(wsfMsgHdr_t *pMsg);
138 
139 /* utility functions */
140 uint8_t DmScanPhyToIdx(uint8_t scanPhy);
141 uint8_t DmInitPhyToIdx(uint8_t initPhy);
142 void dmDevPassHciEvtToConn(hciEvt_t *pEvent);
143 
144 #ifdef __cplusplus
145 };
146 #endif
147 
148 #endif /* DM_MAIN_H */
uint8_t bdAddr_t[6]
BD address data type.
Definition: bda.h:67
#define DM_NUM_ADV_SETS
Number of supported advertising sets: must be set to 1 for legacy advertising.
Definition: cfg_stack.h:91
uint8_t wsfHandlerId_t
Event handler ID data type.
Definition: wsf_os.h:80
void(* dmCback_t)(dmEvt_t *pDmEvt)
Callback type.
Definition: dm_api.h:868
Bluetooth device address utilities.
Union of all event types.
Definition: hci_api.h:931
Software foundation OS API.
Common message structure passed to event handler.
Definition: wsf_os.h:106
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.