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