bootloader.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
  2. *
  3. * The information contained herein is property of Nordic Semiconductor ASA.
  4. * Terms and conditions of usage are described in detail in NORDIC
  5. * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
  6. *
  7. * Licensees are granted free, non-transferable use of the information. NO
  8. * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
  9. * the file.
  10. *
  11. */
  12. /**@file
  13. *
  14. * @defgroup nrf_bootloader Bootloader API.
  15. * @{
  16. *
  17. * @brief Bootloader module interface.
  18. */
  19. #ifndef BOOTLOADER_H__
  20. #define BOOTLOADER_H__
  21. #include <stdbool.h>
  22. #include <stdint.h>
  23. #include "bootloader_types.h"
  24. #include <dfu_types.h>
  25. /**@brief Function for initializing the Bootloader.
  26. *
  27. * @retval NRF_SUCCESS If bootloader was succesfully initialized.
  28. */
  29. uint32_t bootloader_init(void);
  30. /**@brief Function for validating application region in flash.
  31. *
  32. * @param[in] app_addr Address to the region in flash where the application is stored.
  33. *
  34. * @retval true If Application region is valid.
  35. * @retval false If Application region is not valid.
  36. */
  37. bool bootloader_app_is_valid(uint32_t app_addr);
  38. /**@brief Function for starting the Device Firmware Update.
  39. *
  40. * @retval NRF_SUCCESS If new application image was successfully transferred.
  41. */
  42. uint32_t bootloader_dfu_start(void);
  43. /**@brief Function for exiting bootloader and booting into application.
  44. *
  45. * @details This function will disable SoftDevice and all interrupts before jumping to application.
  46. * The SoftDevice vector table base for interrupt forwarding will be set the application
  47. * address.
  48. *
  49. * @param[in] app_addr Address to the region where the application is stored.
  50. */
  51. void bootloader_app_start(uint32_t app_addr);
  52. /**@brief Function for retrieving the bootloader settings.
  53. *
  54. * @param[out] p_settings A copy of the current bootloader settings is returned in the structure
  55. * provided.
  56. */
  57. void bootloader_settings_get(bootloader_settings_t * const p_settings);
  58. /**@brief Function for processing DFU status update.
  59. *
  60. * @param[in] update_status DFU update status.
  61. */
  62. void bootloader_dfu_update_process(dfu_update_status_t update_status);
  63. /**@brief Function getting state of SoftDevice update in progress.
  64. * After a successfull SoftDevice transfer the system restarts in orderto disable SoftDevice
  65. * and complete the update.
  66. *
  67. * @retval true A SoftDevice update is in progress. This indicates that second stage
  68. * of a SoftDevice update procedure can be initiated.
  69. * @retval false No SoftDevice update is in progress.
  70. */
  71. bool bootloader_dfu_sd_in_progress(void);
  72. /**@brief Function for continuing the Device Firmware Update of a SoftDevice.
  73. *
  74. * @retval NRF_SUCCESS If the final stage of SoftDevice update was successful.
  75. */
  76. uint32_t bootloader_dfu_sd_update_continue(void);
  77. /**@brief Function for finalizing the Device Firmware Update of a SoftDevice.
  78. *
  79. * @retval NRF_SUCCESS If the final stage of SoftDevice update was successful.
  80. */
  81. uint32_t bootloader_dfu_sd_update_finalize(void);
  82. #endif // BOOTLOADER_H__
  83. /**@} */