Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ble_lld.h « lld « ble_lld « STM32_WPAN « ST « Middlewares - github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: eaf4f93b9d5d53b5a03f46ddeea20baff8626b5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
 ******************************************************************************
  * File Name          : ble_lld.h
  * Description        : Header for BLE LLD application.
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
  * All rights reserved.</center></h2>
  *
  * This software component is licensed by ST under Ultimate Liberty license
  * SLA0044, the "License"; You may not use this file except in compliance with
  * the License. You may obtain a copy of the License at:
  *                             www.st.com/SLA0044
  *
  ******************************************************************************
 */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef BLE_LLD_H
#define BLE_LLD_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32_wpan_common.h"
#include "stm32wbxx.h"
#include <stdbool.h>
#include "ipBLE_lld_public.h"
#include "ble_lld_transport.h"

/* Private includes ----------------------------------------------------------*/

/* Exported types ------------------------------------------------------------*/

/* Exported constants --------------------------------------------------------*/

/* External variables --------------------------------------------------------*/

/* Exported macros ------------------------------------------------------------*/

/* Exported functions ------------------------------------------------------- */

/* ---------------------------------------------------------------------------*/
/* ------------------------------- BLE LLD -----------------------------------*/
/* ---------------------------------------------------------------------------*/
typedef struct ActPac_s {
  uint8_t StateMachineNo ;      /* This parameter indicates the state machine number for this action. From 0 to 7. */
  uint8_t ActionTag;            /* The configuration of the current action.
                                 * Action Tag: TXRX, TIMER_WAKEUP, INC_CHAN, TIMESTAMP_POSITION */
  uint32_t WakeupTime;          /* Contains the wakeup time in microsecond.
                                 * It only applies if TIMER_WAKEUP flag is set in ActionTag. */
  uint32_t ReceiveWindowLength; /* Sets RX window size in microsecond. Applicable only for RX actions. */
  void *   data;                /* Pointer to the array with the data to send (header, length and data field), for TX. */
  uint8_t dataSize;             /* Size of payload for Tx */
  uint32_t status;              /* The Status Register with the information on the action. */
  int32_t rssi;                 /* The rssi of the packet was received with. RX only. */
  uint8_t nextTrue;            /* Pointer to next ActionPacket if success */
  uint8_t nextFalse;           /* Pointer to next ActionPacket if failure */
  uint8_t actionPacketNb;       /* User callback for managing data. */
  void (*callback)(radioEventType ,   /* Callback to run when action packet has finished */
                   struct ActPac_s *, /* If not used, it must be set to NULL */
                   void *,
                   uint8_t);
} ActionPacket;

typedef void (lldCallback_t)(radioEventType, ActionPacket *, void *, uint8_t);

/* Exported functions ------------------------------------------------------- */
void BLE_LLD_PRX_Init(param_BLE_LLD_t *parameters,
                      ipBLE_lld_txrxdata_Type *transmitBuffer,
                      ipBLE_lld_txrxdata_Type *receiveBuffer,
                      uint8_t (*callbackSend)(BLE_LLD_Code_t bleCmd));
void BLE_LLD_PRX_EventProcessInter(radioEventType event);
void BLE_LLD_PRX_EventProcessTask(void);

uint8_t BLE_LLD_GetStatus(void);
void    BLE_LLD_SetChannel(uint8_t StateMachineNo, uint8_t channel);
void    BLE_LLD_SetTxAttributes(uint8_t StateMachineNo, uint32_t NetworkID);
void    BLE_LLD_SetBackToBackTime(uint32_t backToBackTime);
void    BLE_LLD_SetTxPower(txPower_t powerLevel);
void    BLE_LLD_SetTx_Rx_Phy(uint8_t StateMachineNo, uint8_t txPhy, uint8_t rxPhy);
uint8_t BLE_LLD_StopActivity(void);
void    BLE_LLD_SetEncryptionCount(uint8_t StateMachineNo, const uint8_t (*countTx)[5], const uint8_t (*countRx)[5]);
void    BLE_LLD_SetEncryptionAttributes(uint8_t StateMachineNo, const uint8_t (*encIv)[8], const uint8_t (*encKey)[16]);
void    BLE_LLD_SetEncryptFlags(uint8_t StateMachineNo, FunctionalState EncryptFlag);
void    BLE_LLD_StartTone(uint8_t rfChannel, uint8_t powerLevel);
void    BLE_LLD_StopTone(void);
void    BLE_LLD_SetReservedArea(ActionPacket *p);
uint8_t BLE_LLD_MakeActionPacketPending(const ActionPacket *p);
void    BLE_LLD_Init(uint16_t hsStartupTime, uint8_t lowSpeedOsc, FunctionalState whitening);

uint8_t BLE_LLD_packetPrepareCopy(ipBLE_lld_txrxdata_Type *packet,
                                  const void *data,
                                  uint8_t size,
                                  bool encrypt);
uint8_t BLE_LLD_packetPrepareInPlace(ipBLE_lld_txrxdata_Type *packet,
                                     bool encrypt);
uint8_t BLE_LLD_packetExtractCopy(const ipBLE_lld_txrxdata_Type *packet,
                                  void *data,
                                  bool encrypt);
uint8_t BLE_LLD_packetExtractInPlace(ipBLE_lld_txrxdata_Type *packet,
                                     void **data,
                                     bool encrypt);
uint8_t BLE_LLD_packetGetSize(const ipBLE_lld_txrxdata_Type *packet,
                              bool encrypt);

const char *eventToString(radioEventType evt);
#endif /* BLE_LLD_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/