[FL-1952] BLE bonding fix (#805)
* furi-hal-bt: add mutex guarding core2 state * ble-glue: configure ble keys storage in SRAM2 * bt: add load and save ble keys in internal storage * bt: improve work furi_hal_bt API * bt: rework app_entry -> ble_glue * bt: apply changes for f6 target * desktop: remove furi check * ble-glue: comment NVM in SRAM2 configuration * FuriHal: fix flash controller state corruption, fix incorrect semaphore release, implement C1-C2 flash controller access according to spec. Gui: change logging level. * Libs: better lfs integration with lfs_config. * Ble: switch C2 NVM to RAM. * FuriHalCrypto: ensure that core2 is alive before sending shci commands * Ble: fix incorrect nvm buffer size Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -9,6 +9,9 @@
|
||||
#include <stdbool.h>
|
||||
#include <gap.h>
|
||||
#include <serial_service.h>
|
||||
#include <ble_glue.h>
|
||||
#include <ble_app.h>
|
||||
|
||||
|
||||
#define FURI_HAL_BT_PACKET_SIZE_MAX SERIAL_SVC_DATA_LEN_MAX
|
||||
|
||||
@@ -20,6 +23,12 @@ extern "C" {
|
||||
*/
|
||||
void furi_hal_bt_init();
|
||||
|
||||
/** Start 2nd core and BLE stack
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
bool furi_hal_bt_start_core2();
|
||||
|
||||
/** Start BLE app
|
||||
* @param event_cb - BleEventCallback instance
|
||||
* @param context - pointer to context
|
||||
@@ -52,6 +61,32 @@ void furi_hal_bt_dump_state(string_t buffer);
|
||||
*/
|
||||
bool furi_hal_bt_is_alive();
|
||||
|
||||
/** Get key storage buffer address and size
|
||||
*
|
||||
* @param key_buff_addr pointer to store buffer address
|
||||
* @param key_buff_size pointer to store buffer size
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
bool furi_hal_bt_get_key_storage_buff(uint8_t** key_buff_addr, uint16_t* key_buff_size);
|
||||
|
||||
/** Get SRAM2 hardware semaphore
|
||||
* @note Must be called before SRAM2 read/write operations
|
||||
*/
|
||||
void furi_hal_bt_nvm_sram_sem_acquire();
|
||||
|
||||
/** Release SRAM2 hardware semaphore
|
||||
* @note Must be called after SRAM2 read/write operations
|
||||
*/
|
||||
void furi_hal_bt_nvm_sram_sem_release();
|
||||
|
||||
/** Set key storage change callback
|
||||
*
|
||||
* @param callback BleGlueKeyStorageChangedCallback instance
|
||||
* @param context pointer to context
|
||||
*/
|
||||
void furi_hal_bt_set_key_storage_change_callback(BleGlueKeyStorageChangedCallback callback, void* context);
|
||||
|
||||
/** Set data event callbacks
|
||||
* @param on_received_cb - SerialSvcDataReceivedCallback instance
|
||||
* @param on_sent_cb - SerialSvcDataSentCallback instance
|
||||
@@ -65,16 +100,11 @@ void furi_hal_bt_set_data_event_callbacks(SerialSvcDataReceivedCallback on_recei
|
||||
*/
|
||||
bool furi_hal_bt_tx(uint8_t* data, uint16_t size);
|
||||
|
||||
/** Wait for Core2 startup */
|
||||
bool furi_hal_bt_wait_startup();
|
||||
|
||||
/** Lock shared access to flash controller
|
||||
*
|
||||
* @param[in] erase_flag true if erase operation
|
||||
*
|
||||
* @return true if lock was successful, false if not
|
||||
*/
|
||||
bool furi_hal_bt_lock_flash(bool erase_flag);
|
||||
void furi_hal_bt_lock_flash(bool erase_flag);
|
||||
|
||||
/** Unlock shared access to flash controller
|
||||
*
|
||||
|
Reference in New Issue
Block a user