Cefn Hoile / nRF51822

Dependencies:   nrf51-sdk

Dependents:   microbit-dal

Fork of nRF51822 by Lancaster University

Committer:
rgrover1
Date:
Fri Jun 19 15:55:35 2015 +0100
Revision:
346:14b090482fd2
Parent:
345:dfde56236c36
Child:
361:d2405f5a4853
Synchronized with git rev bb88aaad
Author: Rohit Grover
renamed BLEDevice to BLE

Who changed what in which revision?

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