Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nRF51822 by
dfu_ble_svc.h
00001 /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. 00002 * 00003 * The information contained herein is property of Nordic Semiconductor ASA. 00004 * Terms and conditions of usage are described in detail in NORDIC 00005 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 00006 * 00007 * Licensees are granted free, non-transferable use of the information. NO 00008 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 00009 * the file. 00010 * 00011 */ 00012 00013 /** @file 00014 * 00015 * @defgroup nrf_dfu_ble_svc DFU BLE SVC 00016 * @{ 00017 * 00018 * @brief DFU BLE SVC in bootloader. The DFU BLE SuperVisor Calls allow an application to execute 00019 * functions in the installed bootloader. 00020 * 00021 * @details This module implements handling of SuperVisor Calls in the bootloader. 00022 * SuperVisor Calls allow for an application to execute calls into the bootloader. 00023 * Currently, it is possible to exchange bonding information (like keys) from the 00024 * application to a bootloader supporting DFU OTA using BLE, so the update process can be 00025 * done through an already existing bond. 00026 * 00027 * @note The application must make sure that all SuperVisor Calls (SVC) are forwarded to the 00028 * bootloader to ensure correct behavior. Forwarding of SVCs to the bootloader is 00029 * done using the SoftDevice SVC @ref sd_softdevice_vector_table_base_set with the value 00030 * present in @c NRF_UICR->BOOTLOADERADDR. 00031 */ 00032 00033 #ifndef DFU_BLE_SVC_H__ 00034 #define DFU_BLE_SVC_H__ 00035 00036 #include "nrf_svc.h" 00037 #include <stdint.h> 00038 #include "ble_gap.h" 00039 #include "nrf51.h" 00040 #include "nrf_soc.h" 00041 #include "nrf_error_sdm.h" 00042 00043 #define BOOTLOADER_SVC_BASE 0x0 /**< The number of the lowest SVC number reserved for the bootloader. */ 00044 #define SYSTEM_SERVICE_ATT_SIZE 8 /**< Size of the system service attribute length including CRC-16 at the end. */ 00045 00046 /**@brief The SVC numbers used by the SVC functions in the SoC library. */ 00047 enum BOOTLOADER_SVCS 00048 { 00049 DFU_BLE_SVC_SET_PEER_DATA = BOOTLOADER_SVC_BASE, /**< SVC number for the setting of peer data call. */ 00050 BOOTLOADER_SVC_LAST 00051 }; 00052 00053 /**@brief DFU Peer data structure. 00054 * 00055 * @details This structure contains peer data needed for connection to a bonded device during DFU. 00056 * The peer data must be provided by the application to the bootloader during buttonless 00057 * update. See @ref dfu_ble_svc_set_peer_data. It contains bond information about the 00058 * desired DFU peer. 00059 */ 00060 typedef struct 00061 { 00062 ble_gap_addr_t addr; /**< BLE GAP address of the device that initiated the DFU process. */ 00063 ble_gap_irk_t irk; /**< IRK of the device that initiated the DFU process if this device uses Private Resolvable Addresses. */ 00064 ble_gap_enc_key_t enc_key; /**< Encryption key structure containing encrypted diversifier and LTK for re-establishing the bond. */ 00065 uint8_t sys_serv_attr[SYSTEM_SERVICE_ATT_SIZE]; /**< System service attributes for restoring of Service Changed Indication setting in DFU mode. */ 00066 } dfu_ble_peer_data_t; 00067 00068 /**@brief SVC Function for setting peer data containing address, IRK, and LTK to establish bonded 00069 * connection in DFU mode. 00070 * 00071 * @param[in] p_peer_data Pointer to the peer data containing keys for the connection. 00072 * 00073 * @retval NRF_ERROR_NULL If a NULL pointer was provided as argument. 00074 * @retval NRF_SUCCESS If the function completed successfully. 00075 */ 00076 SVCALL(DFU_BLE_SVC_SET_PEER_DATA, uint32_t, dfu_ble_svc_set_peer_data(dfu_ble_peer_data_t * p_peer_data)); 00077 00078 #endif // DFU_BLE_SVC_H__ 00079 00080 /** @} */
Generated on Tue Jul 12 2022 19:22:46 by
1.7.2
