Nordic stack and drivers for the mbed BLE API

Fork of nRF51822 by Nordic Semiconductor

Committer:
Vincent Coubard
Date:
Wed Sep 14 14:39:43 2016 +0100
Revision:
640:c90ae1400bf2
Sync with bdab10dc0f90748b6989c8b577771bb403ca6bd8 from ARMmbed/mbed-os.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Vincent Coubard 640:c90ae1400bf2 1 /*
Vincent Coubard 640:c90ae1400bf2 2 * Copyright (c) Nordic Semiconductor ASA
Vincent Coubard 640:c90ae1400bf2 3 * All rights reserved.
Vincent Coubard 640:c90ae1400bf2 4 *
Vincent Coubard 640:c90ae1400bf2 5 * Redistribution and use in source and binary forms, with or without modification,
Vincent Coubard 640:c90ae1400bf2 6 * are permitted provided that the following conditions are met:
Vincent Coubard 640:c90ae1400bf2 7 *
Vincent Coubard 640:c90ae1400bf2 8 * 1. Redistributions of source code must retain the above copyright notice, this
Vincent Coubard 640:c90ae1400bf2 9 * list of conditions and the following disclaimer.
Vincent Coubard 640:c90ae1400bf2 10 *
Vincent Coubard 640:c90ae1400bf2 11 * 2. Redistributions in binary form must reproduce the above copyright notice, this
Vincent Coubard 640:c90ae1400bf2 12 * list of conditions and the following disclaimer in the documentation and/or
Vincent Coubard 640:c90ae1400bf2 13 * other materials provided with the distribution.
Vincent Coubard 640:c90ae1400bf2 14 *
Vincent Coubard 640:c90ae1400bf2 15 * 3. Neither the name of Nordic Semiconductor ASA nor the names of other
Vincent Coubard 640:c90ae1400bf2 16 * contributors to this software may be used to endorse or promote products
Vincent Coubard 640:c90ae1400bf2 17 * derived from this software without specific prior written permission.
Vincent Coubard 640:c90ae1400bf2 18 *
Vincent Coubard 640:c90ae1400bf2 19 *
Vincent Coubard 640:c90ae1400bf2 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
Vincent Coubard 640:c90ae1400bf2 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Vincent Coubard 640:c90ae1400bf2 22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Vincent Coubard 640:c90ae1400bf2 23 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
Vincent Coubard 640:c90ae1400bf2 24 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
Vincent Coubard 640:c90ae1400bf2 25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
Vincent Coubard 640:c90ae1400bf2 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
Vincent Coubard 640:c90ae1400bf2 27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Vincent Coubard 640:c90ae1400bf2 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
Vincent Coubard 640:c90ae1400bf2 29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Vincent Coubard 640:c90ae1400bf2 30 *
Vincent Coubard 640:c90ae1400bf2 31 */
Vincent Coubard 640:c90ae1400bf2 32
Vincent Coubard 640:c90ae1400bf2 33 /**@file
Vincent Coubard 640:c90ae1400bf2 34 *
Vincent Coubard 640:c90ae1400bf2 35 * @defgroup nrf_bootloader Bootloader API.
Vincent Coubard 640:c90ae1400bf2 36 * @{
Vincent Coubard 640:c90ae1400bf2 37 *
Vincent Coubard 640:c90ae1400bf2 38 * @brief Bootloader module interface.
Vincent Coubard 640:c90ae1400bf2 39 */
Vincent Coubard 640:c90ae1400bf2 40
Vincent Coubard 640:c90ae1400bf2 41 #ifndef BOOTLOADER_H__
Vincent Coubard 640:c90ae1400bf2 42 #define BOOTLOADER_H__
Vincent Coubard 640:c90ae1400bf2 43
Vincent Coubard 640:c90ae1400bf2 44 #include <stdbool.h>
Vincent Coubard 640:c90ae1400bf2 45 #include <stdint.h>
Vincent Coubard 640:c90ae1400bf2 46 #include "bootloader_types.h"
Vincent Coubard 640:c90ae1400bf2 47 #include <dfu_types.h>
Vincent Coubard 640:c90ae1400bf2 48
Vincent Coubard 640:c90ae1400bf2 49 /**@brief Function for initializing the Bootloader.
Vincent Coubard 640:c90ae1400bf2 50 *
Vincent Coubard 640:c90ae1400bf2 51 * @retval NRF_SUCCESS If bootloader was succesfully initialized.
Vincent Coubard 640:c90ae1400bf2 52 */
Vincent Coubard 640:c90ae1400bf2 53 uint32_t bootloader_init(void);
Vincent Coubard 640:c90ae1400bf2 54
Vincent Coubard 640:c90ae1400bf2 55 /**@brief Function for validating application region in flash.
Vincent Coubard 640:c90ae1400bf2 56 *
Vincent Coubard 640:c90ae1400bf2 57 * @param[in] app_addr Address to the region in flash where the application is stored.
Vincent Coubard 640:c90ae1400bf2 58 *
Vincent Coubard 640:c90ae1400bf2 59 * @retval true If Application region is valid.
Vincent Coubard 640:c90ae1400bf2 60 * @retval false If Application region is not valid.
Vincent Coubard 640:c90ae1400bf2 61 */
Vincent Coubard 640:c90ae1400bf2 62 bool bootloader_app_is_valid(uint32_t app_addr);
Vincent Coubard 640:c90ae1400bf2 63
Vincent Coubard 640:c90ae1400bf2 64 /**@brief Function for starting the Device Firmware Update.
Vincent Coubard 640:c90ae1400bf2 65 *
Vincent Coubard 640:c90ae1400bf2 66 * @retval NRF_SUCCESS If new application image was successfully transferred.
Vincent Coubard 640:c90ae1400bf2 67 */
Vincent Coubard 640:c90ae1400bf2 68 uint32_t bootloader_dfu_start(void);
Vincent Coubard 640:c90ae1400bf2 69
Vincent Coubard 640:c90ae1400bf2 70 /**@brief Function for exiting bootloader and booting into application.
Vincent Coubard 640:c90ae1400bf2 71 *
Vincent Coubard 640:c90ae1400bf2 72 * @details This function will disable SoftDevice and all interrupts before jumping to application.
Vincent Coubard 640:c90ae1400bf2 73 * The SoftDevice vector table base for interrupt forwarding will be set the application
Vincent Coubard 640:c90ae1400bf2 74 * address.
Vincent Coubard 640:c90ae1400bf2 75 *
Vincent Coubard 640:c90ae1400bf2 76 * @param[in] app_addr Address to the region where the application is stored.
Vincent Coubard 640:c90ae1400bf2 77 */
Vincent Coubard 640:c90ae1400bf2 78 void bootloader_app_start(uint32_t app_addr);
Vincent Coubard 640:c90ae1400bf2 79
Vincent Coubard 640:c90ae1400bf2 80 /**@brief Function for retrieving the bootloader settings.
Vincent Coubard 640:c90ae1400bf2 81 *
Vincent Coubard 640:c90ae1400bf2 82 * @param[out] p_settings A copy of the current bootloader settings is returned in the structure
Vincent Coubard 640:c90ae1400bf2 83 * provided.
Vincent Coubard 640:c90ae1400bf2 84 */
Vincent Coubard 640:c90ae1400bf2 85 void bootloader_settings_get(bootloader_settings_t * const p_settings);
Vincent Coubard 640:c90ae1400bf2 86
Vincent Coubard 640:c90ae1400bf2 87 /**@brief Function for processing DFU status update.
Vincent Coubard 640:c90ae1400bf2 88 *
Vincent Coubard 640:c90ae1400bf2 89 * @param[in] update_status DFU update status.
Vincent Coubard 640:c90ae1400bf2 90 */
Vincent Coubard 640:c90ae1400bf2 91 void bootloader_dfu_update_process(dfu_update_status_t update_status);
Vincent Coubard 640:c90ae1400bf2 92
Vincent Coubard 640:c90ae1400bf2 93 /**@brief Function getting state of SoftDevice update in progress.
Vincent Coubard 640:c90ae1400bf2 94 * After a successfull SoftDevice transfer the system restarts in orderto disable SoftDevice
Vincent Coubard 640:c90ae1400bf2 95 * and complete the update.
Vincent Coubard 640:c90ae1400bf2 96 *
Vincent Coubard 640:c90ae1400bf2 97 * @retval true A SoftDevice update is in progress. This indicates that second stage
Vincent Coubard 640:c90ae1400bf2 98 * of a SoftDevice update procedure can be initiated.
Vincent Coubard 640:c90ae1400bf2 99 * @retval false No SoftDevice update is in progress.
Vincent Coubard 640:c90ae1400bf2 100 */
Vincent Coubard 640:c90ae1400bf2 101 bool bootloader_dfu_sd_in_progress(void);
Vincent Coubard 640:c90ae1400bf2 102
Vincent Coubard 640:c90ae1400bf2 103 /**@brief Function for continuing the Device Firmware Update of a SoftDevice.
Vincent Coubard 640:c90ae1400bf2 104 *
Vincent Coubard 640:c90ae1400bf2 105 * @retval NRF_SUCCESS If the final stage of SoftDevice update was successful.
Vincent Coubard 640:c90ae1400bf2 106 */
Vincent Coubard 640:c90ae1400bf2 107 uint32_t bootloader_dfu_sd_update_continue(void);
Vincent Coubard 640:c90ae1400bf2 108
Vincent Coubard 640:c90ae1400bf2 109 /**@brief Function for finalizing the Device Firmware Update of a SoftDevice.
Vincent Coubard 640:c90ae1400bf2 110 *
Vincent Coubard 640:c90ae1400bf2 111 * @retval NRF_SUCCESS If the final stage of SoftDevice update was successful.
Vincent Coubard 640:c90ae1400bf2 112 */
Vincent Coubard 640:c90ae1400bf2 113 uint32_t bootloader_dfu_sd_update_finalize(void);
Vincent Coubard 640:c90ae1400bf2 114
Vincent Coubard 640:c90ae1400bf2 115 #endif // BOOTLOADER_H__
Vincent Coubard 640:c90ae1400bf2 116
Vincent Coubard 640:c90ae1400bf2 117 /**@} */