Patched version of nrf51822 FOTA compatible driver, with GPTIO disabled, as it clashed with the mbed definitions...

Fork of nRF51822 by Nordic Semiconductor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers dfu_ble_svc.h Source File

dfu_ble_svc.h

Go to the documentation of this file.
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 
00045 /**@brief The SVC numbers used by the SVC functions in the SoC library. */
00046 enum BOOTLOADER_SVCS
00047 {
00048     DFU_BLE_SVC_SET_PEER_DATA = BOOTLOADER_SVC_BASE,
00049     BOOTLOADER_SVC_LAST
00050 };
00051 
00052 /**@brief   DFU Peer data structure.
00053  *
00054  * @details This structure contains peer data needed for connection to a bonded device during DFU.
00055  *          The peer data must be provided by the application to the bootloader during buttonless
00056  *          update. See @ref dfu_ble_svc_set_peer_data. It contains bond information about the
00057  *          desired DFU peer.
00058  */
00059 typedef struct
00060 {
00061     ble_gap_enc_info_t enc_info;
00062     ble_gap_irk_t      irk;
00063     ble_gap_addr_t     addr;
00064 } dfu_ble_peer_data_t;
00065 
00066 /**@brief   SVC Function for setting peer data containing address, IRK, and LTK to establish bonded
00067  *          connection in DFU mode.
00068  *
00069  * @param[in] p_peer_data  Pointer to the peer data containing keys for the connection.
00070  *
00071  * @retval NRF_ERROR_NULL If a NULL pointer was provided as argument.
00072  * @retval NRF_SUCCESS  If the function completed successfully.
00073  */
00074 SVCALL(DFU_BLE_SVC_SET_PEER_DATA, uint32_t, dfu_ble_svc_set_peer_data(dfu_ble_peer_data_t * p_peer_data));
00075 
00076 #endif // DFU_BLE_SVC_H__
00077 
00078 /** @} */