1 /**
2   ******************************************************************************
3   * @file    bleplat_cntr.h
4   * @author  GPM WBL Application team
5   * @brief   This file contains the interface of the Bluetooth LE platform layer
6   *          (lower interface of the Bluetooth LE stack library).
7   ******************************************************************************
8   * @attention
9   *
10   * Copyright (c) 2024 STMicroelectronics.
11   * All rights reserved.
12   *
13   * This software is licensed under terms that can be found in the LICENSE file
14   * in the root directory of this software component.
15   * If no LICENSE file comes with this software, it is provided AS-IS.
16   *
17   ******************************************************************************
18   */
19 
20 #ifndef BLEPLAT_CNTR_H__
21 #define BLEPLAT_CNTR_H__
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include <stdint.h>
29 
30 /** @addtogroup BLEPLAT_CNTR_Peripheral  BLE CONTROLLER
31  * @{
32  */
33 
34 /** @defgroup BLEPLAT_CNTR_Exported_Types Exported Types
35  * @{
36  */
37 
38 
39 /* Enumerated values used to report the RNG result status after a process */
40 typedef enum
41 {
42   BLEPLAT_CNTR_SUCCESS     =  0,
43   BLEPLAT_CNTR_ERROR,
44   BLEPLAT_CNTR_ERROR_TIMEOUT
45 } BLEPLAT_CNTR_ResultStatus;
46 
47 
48 typedef struct {
49     volatile uint32_t WORD0;
50     volatile uint32_t WORD1;
51     volatile uint32_t WORD2;
52     volatile uint32_t WORD3;
53     volatile uint32_t WORD4;
54 } BLEPLAT_CNTR_TXRXPACK_TypeDef;
55 
56 typedef enum
57 {
58     BLEPLAT_CNTR_TxRx = 0,
59     BLEPLAT_CNTR_RxTx,
60     BLEPLAT_CNTR_TxTx,
61     BLEPLAT_CNTR_RxRx
62 } BLEPLAT_CNTR_Transaction;
63 /**
64  * @}
65  */
66 
67 /** @defgroup BLEPLAT_CNTR_Exported_Constants  Exported Constants
68  * @{
69  */
70 
71 /**
72  * @}
73  */
74 
75 /** @defgroup BLEPLAT_CNTR_Exported_Macros           Exported Macros
76  * @{
77  */
78 
79 /**
80  * @}
81  */
82 
83 /** @defgroup BLEPLAT_CNTR_Exported_Functions        Exported Functions
84  * @{
85  */
86 BLEPLAT_CNTR_ResultStatus BLEPLAT_CNTR_Init(void);
87 
88 BLEPLAT_CNTR_ResultStatus BLEPLAT_CNTR_Deinit(void);
89 
90 void BLEPLAT_CNTR_ClearInterrupt(uint32_t x);
91 void BLEPLAT_CNTR_ClearSemareq(void);
92 void BLEPLAT_CNTR_TxRxSkip(void);
93 uint32_t* BLEPLAT_CNTR_GetCipherTextPtr(void);
94 uint32_t* BLEPLAT_CNTR_GetClrTextPtr(void);
95 uint32_t* BLEPLAT_CNTR_GetEncKeyPtr(void);
96 uint8_t BLEPLAT_CNTR_GetEncryptDoneStatus(void);
97 uint8_t BLEPLAT_CNTR_GetIqsamplesMissingError(void);
98 uint8_t BLEPLAT_CNTR_GetIqsamplesNumber(void);
99 uint8_t BLEPLAT_CNTR_getIqsamplesReady(void);
100 uint8_t BLEPLAT_CNTR_GetIsrLatency(void);
101 uint32_t BLEPLAT_CNTR_GetTimercapture(void);
102 void BLEPLAT_CNTR_GlobDisableBlue(void);
103 void BLEPLAT_CNTR_GlobEnableBlue(void);
104 void BLEPLAT_CNTR_GlobEnableIntnoactivelerrorInt(void);
105 void BLEPLAT_CNTR_GlobEnableTxRxSkipInt(void);
106 void BLEPLAT_CNTR_GlobEnableOverrunAct2Int(void);
107 uint8_t BLEPLAT_CNTR_GlobGetDefaultAntennaid(void);
108 uint8_t BLEPLAT_CNTR_GlobGetWakeupinitdelay(void);
109 void BLEPLAT_CNTR_GlobReloadRadioConfigP(void);
110 void BLEPLAT_CNTR_GlobSetChkflagautoclearena(void);
111 void BLEPLAT_CNTR_GlobSetDefaultAntennaid(uint8_t x);
112 void BLEPLAT_CNTR_GlobSetInitRadioDelayTxCal(uint8_t x);
113 void BLEPLAT_CNTR_GlobSetInitRadioDelayTxNocal(uint8_t x);
114 void BLEPLAT_CNTR_GlobSetRadioConfigP(volatile uint32_t* x);
115 void BLEPLAT_CNTR_GlobSetWakeupinitdelay(uint8_t x);
116 void BLEPLAT_CNTR_GlobWriteConfigEnd(uint8_t x);
117 void BLEPLAT_CNTR_GlobWritePeriodslow(uint16_t x);
118 void BLEPLAT_CNTR_GlobWriteRcvdelay(uint8_t x);
119 void BLEPLAT_CNTR_GlobWriteRcvdelay1(uint8_t x);
120 void BLEPLAT_CNTR_GlobWriteSlot(uint8_t slotNo);
121 void BLEPLAT_CNTR_GlobWriteTimer12initdelaycal(uint8_t x);
122 void BLEPLAT_CNTR_GlobWriteTimer2initdelaynocal(uint8_t x);
123 void BLEPLAT_CNTR_GlobWriteTxDataReadyCheck(uint8_t x);
124 void BLEPLAT_CNTR_GlobWriteTxReadyTimeout(uint8_t x);
125 void BLEPLAT_CNTR_GlobWriteTxdelay(uint8_t x) ;
126 void BLEPLAT_CNTR_GlobWriteTxdelayEnd(uint8_t x);
127 uint32_t BLEPLAT_CNTR_IntGetIntStatusAnyHwError(uint32_t x);
128 uint32_t BLEPLAT_CNTR_IntGetIntStatusRxOverflowError(uint32_t x);
129 uint32_t BLEPLAT_CNTR_IntGetIntStatusBitAct2Error(uint32_t x);
130 uint32_t BLEPLAT_CNTR_IntGetIntStatusBitTimerOverrun(uint32_t x);
131 uint32_t BLEPLAT_CNTR_IntGetIntStatusCrcErr(uint32_t x);
132 uint32_t BLEPLAT_CNTR_IntGetIntStatusDone(uint32_t x);
133 uint32_t BLEPLAT_CNTR_IntGetIntStatusEncErr(uint32_t x);
134 uint32_t BLEPLAT_CNTR_IntGetIntStatusLenErr(uint32_t x);
135 uint32_t BLEPLAT_CNTR_IntGetIntStatusNoactiveError(uint32_t x);
136 uint32_t BLEPLAT_CNTR_IntGetIntStatusRxOk(uint32_t x);
137 uint32_t BLEPLAT_CNTR_IntGetIntStatusTimeout(uint32_t x);
138 uint32_t BLEPLAT_CNTR_IntGetIntStatusTrigRcv(uint32_t x);
139 uint32_t BLEPLAT_CNTR_IntGetIntStatusTxDone(uint32_t x);
140 uint32_t BLEPLAT_CNTR_IntGetIntStatusTxOk(uint32_t x);
141 uint32_t BLEPLAT_CNTR_IntGetIntStatusTxRxSkip(uint32_t x);
142 uint32_t BLEPLAT_CNTR_IntGetIntStatusTxError1(uint32_t x);
143 uint32_t BLEPLAT_CNTR_IntGetIntStatusTxError3(uint32_t x);
144 void BLEPLAT_CNTR_PacketClrCrcinitSel(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
145 void BLEPLAT_CNTR_PacketClrCteSamplingEn(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
146 void BLEPLAT_CNTR_PacketClrIncChan(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
147 void BLEPLAT_CNTR_PacketClrPllTrig(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
148 void BLEPLAT_CNTR_PacketDisableWhitening(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
149 uint8_t BLEPLAT_CNTR_PacketGetCteSamplingEn(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
150 uint8_t* BLEPLAT_CNTR_PacketGetDataPtr(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
151 void BLEPLAT_CNTR_PacketInitTo0(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
152 void BLEPLAT_CNTR_PacketSetAdvPduFormat(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
153 void BLEPLAT_CNTR_PacketSetCrcinitSel(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
154 void BLEPLAT_CNTR_PacketSetCteSamplingEn(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
155 void BLEPLAT_CNTR_PacketSetDataPduFormat(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
156 void BLEPLAT_CNTR_PacketSetDataPtr(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP, void* dataP);
157 void BLEPLAT_CNTR_PacketSetIncChan(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
158 void BLEPLAT_CNTR_PacketSetIntCrcErr(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
159 void BLEPLAT_CNTR_PacketSetIntDone(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
160 void BLEPLAT_CNTR_PacketSetIntRcvOk(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
161 void BLEPLAT_CNTR_PacketSetIntTimeout(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
162 void BLEPLAT_CNTR_PacketSetIntTrigRcv(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
163 void BLEPLAT_CNTR_PacketSetIntTxOk(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
164 void BLEPLAT_CNTR_PacketSetKeepsemareq(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
165 void BLEPLAT_CNTR_PacketSetNextPtr(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP, BLEPLAT_CNTR_TXRXPACK_TypeDef* packetNextP);
166 void BLEPLAT_CNTR_PacketSetNextRxMode(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
167 void BLEPLAT_CNTR_PacketSetNextSlot(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP, uint8_t slot);
168 void BLEPLAT_CNTR_PacketSetNextTxMode(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
169 void BLEPLAT_CNTR_PacketSetNsEn(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
170 void BLEPLAT_CNTR_PacketSetPllTrig(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
171 void BLEPLAT_CNTR_PacketSetRxReady(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
172 void BLEPLAT_CNTR_PacketSetTimeout(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP, uint32_t x);
173 void BLEPLAT_CNTR_PacketSetTimer2Active(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
174 void BLEPLAT_CNTR_PacketSetTimerTrigDone(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
175 void BLEPLAT_CNTR_PacketSetTimerTrigRcv(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
176 void BLEPLAT_CNTR_PacketSetTxReady(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
177 void BLEPLAT_CNTR_SetRadioConfig(uint8_t* value);
178 void BLEPLAT_CNTR_SetRcvLen(BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP, uint32_t rcvLen);
179 void BLEPLAT_CNTR_SmCteOff(uint8_t smNo);
180 void BLEPLAT_CNTR_SmCteOn(uint8_t smNo);
181 void BLEPLAT_CNTR_SmEnRadioConfig(uint8_t smNo, uint32_t enable);
182 void BLEPLAT_CNTR_SmEncOff(uint8_t smNo);
183 void BLEPLAT_CNTR_SmEncOn(uint8_t smNo);
184 uint32_t BLEPLAT_CNTR_SmGetAccessAddr(uint8_t smNo);
185 void BLEPLAT_CNTR_SmGetChannelMap(uint8_t smNo, uint8_t* chanMap);
186 uint8_t BLEPLAT_CNTR_SmGetCteAntennaPatternLen(uint8_t smNo);
187 uint8_t BLEPLAT_CNTR_SmGetCteAodNaoa(uint8_t smNo);
188 uint8_t BLEPLAT_CNTR_SmGetCteSlotWidth(uint8_t smNo);
189 uint8_t BLEPLAT_CNTR_SmGetCteStatus(uint8_t smNo);
190 uint8_t BLEPLAT_CNTR_SmGetCteTime(uint8_t smNo);
191 uint32_t* BLEPLAT_CNTR_SmGetEncIvPtr(uint8_t smNo);
192 uint32_t* BLEPLAT_CNTR_SmGetEncKeyPtr(uint8_t smNo);
193 uint8_t BLEPLAT_CNTR_SmGetEncStatus(uint8_t smNo);
194 uint8_t BLEPLAT_CNTR_SmGetHopIncr(uint8_t smNo);
195 uint8_t BLEPLAT_CNTR_SmGetMode(uint8_t smNo);
196 uint8_t* BLEPLAT_CNTR_SmGetPrevRxPacketDataPtr(uint8_t smNo);
197 BLEPLAT_CNTR_TXRXPACK_TypeDef* BLEPLAT_CNTR_SmGetPrevRxPacketPtr(uint8_t smNo) ;
198 uint8_t* BLEPLAT_CNTR_SmGetPrevTxPacketDataPtr(uint8_t smNo);
199 BLEPLAT_CNTR_TXRXPACK_TypeDef* BLEPLAT_CNTR_SmGetPrevTxPacketPtr(uint8_t smNo);
200 uint8_t BLEPLAT_CNTR_SmGetRemapChan(uint8_t smNo);
201 void BLEPLAT_CNTR_SmGetRxCount(uint8_t smNo, uint32_t* packetCount);
202 uint8_t BLEPLAT_CNTR_SmGetRxPhy(uint8_t smNo);
203 BLEPLAT_CNTR_TXRXPACK_TypeDef* BLEPLAT_CNTR_SmGetTxPacketPtr(uint8_t smNo);
204 uint8_t BLEPLAT_CNTR_SmGetTxPhy(uint8_t smNo);
205 uint8_t BLEPLAT_CNTR_SmGetTxPwr(uint8_t smNo);
206 uint8_t BLEPLAT_CNTR_SmGetUnmappedChan(uint8_t smNo);
207 void BLEPLAT_CNTR_SmInitTo0(uint8_t smNo);
208 void BLEPLAT_CNTR_SmSetAccessAddr(uint8_t smNo, uint32_t x);
209 void BLEPLAT_CNTR_SmSetChannelMap(uint8_t smNo, uint8_t* chanMap);
210 void BLEPLAT_CNTR_SmSetCrcInit(uint8_t smNo, uint32_t x);
211 void BLEPLAT_CNTR_SmSetCteAntennaPatternLen(uint8_t smNo, uint8_t antPattLen);
212 void BLEPLAT_CNTR_SmSetCteAntennaPatternPtr(uint8_t smNo, uint8_t* antPattP);
213 uint32_t BLEPLAT_CNTR_SmGetCteAntennaPatternPtr(uint8_t smNo);
214 void BLEPLAT_CNTR_SmSetCteAoa(uint8_t smNo);
215 void BLEPLAT_CNTR_SmSetCteAod(uint8_t smNo);
216 void BLEPLAT_CNTR_SmSetCteIqsamplesPtr(uint8_t smNo, uint32_t* iqSamplesP);
217 void BLEPLAT_CNTR_SmSetCteMaxIqsamplesNumb(uint8_t smNo, uint8_t iqsamplesNumb);
218 void BLEPLAT_CNTR_SmSetCteSlotWidth(uint8_t smNo, uint32_t cteSlot);
219 void BLEPLAT_CNTR_SmSetCteTime(uint8_t smNo, uint8_t cteTime);
220 void BLEPLAT_CNTR_SmSetDataLength(uint8_t smNo, uint8_t length);
221 void BLEPLAT_CNTR_SmSetDataLengthExtnEn(uint8_t smNo);
222 void BLEPLAT_CNTR_SmSetHopIncr(uint8_t smNo, uint8_t x);
223 void BLEPLAT_CNTR_SmSetRemapChan(uint8_t smNo, uint8_t chan);
224 void BLEPLAT_CNTR_SmSetRxCount(uint8_t smNo, uint32_t* packetCount);
225 void BLEPLAT_CNTR_SmSetRxCountDirectionBit(uint8_t smNo);
226 void BLEPLAT_CNTR_SmSetRxMode(uint8_t smNo);
227 void BLEPLAT_CNTR_SmSetRxPacketPtr(uint8_t smNo, BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
228 void BLEPLAT_CNTR_SmSetRxPhy(uint8_t smNo, uint8_t rxPhy);
229 void BLEPLAT_CNTR_SmSetTxCount(uint8_t smNo, uint32_t* packetCount);
230 void BLEPLAT_CNTR_SmSetTxCountDirectionBit(uint8_t smNo);
231 void BLEPLAT_CNTR_SmSetTxMode(uint8_t smNo);
232 void BLEPLAT_CNTR_SmSetTxPacketPtr(uint8_t smNo, BLEPLAT_CNTR_TXRXPACK_TypeDef* packetP);
233 void BLEPLAT_CNTR_SmSetTxPhy(uint8_t smNo, uint8_t txPhy);
234 void BLEPLAT_CNTR_SmEnTxHp(uint8_t smNo, uint8_t enable);
235 void BLEPLAT_CNTR_SmSetTxPwr(uint8_t smNo, uint8_t paLevel);
236 void BLEPLAT_CNTR_SmSetUnmappedChan(uint8_t smNo, uint8_t chan);
237 void BLEPLAT_CNTR_SmToggleNesn(uint8_t smNo);
238 void BLEPLAT_CNTR_SmToggleSn(uint8_t smNo);
239 void BLEPLAT_CNTR_StartEncrypt(void);
240 uint32_t BLEPLAT_CNTR_TimeDiff(uint32_t x, uint32_t y);
241 uint8_t BLEPLAT_CNTR_DemodDelaySt(uint8_t RxPHY);
242 uint32_t BLEPLAT_CNTR_GetTimer2TimeoutForIfs(uint32_t T_Ifs, BLEPLAT_CNTR_Transaction Transaction, uint8_t Cal_Enabled);
243 
244 
245 /**
246   * @}
247   */
248 
249 
250 /**
251  * @}
252  */
253 
254 /**
255  * @}
256  */
257 
258 #ifdef __cplusplus
259 }
260 #endif
261 
262 
263 #endif /* ! BLEPLAT_H__ */
264