bootloader.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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.
  31. *
  32. * @param[in] app_addr Address to the region 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 appliction image was successfully transfered.
  41. */
  42. uint32_t bootloader_dfu_start(void);
  43. /**@brief Function for
  44. *
  45. * @param[in] app_addr Address to the region where the application is stored.
  46. */
  47. void bootloader_app_start(uint32_t app_addr);
  48. /**@brief Function for processing DFU status update.
  49. *
  50. * @param[in] update_status DFU update status.
  51. */
  52. void bootloader_dfu_update_process(dfu_update_status_t update_status);
  53. /**@brief Function for continuing the Device Firmware Update of a SoftDevice.
  54. *
  55. * @retval NRF_SUCCESS If the final stage of SoftDevice update was successful.
  56. */
  57. uint32_t bootloader_dfu_sd_update_continue (void);
  58. uint32_t bootloader_dfu_sd_update_validate(void);
  59. uint32_t bootloader_dfu_bl_update_continue(void);
  60. uint32_t bootloader_dfu_ap_update_continue(void);
  61. /**@brief Function for finalizing the Device Firmware Update of a SoftDevice.
  62. *
  63. * @retval NRF_SUCCESS If the final stage of SoftDevice update was successful.
  64. */
  65. uint32_t bootloader_dfu_sd_update_finalize(void);
  66. /**@brief Function for writing word into flash.
  67. *
  68. * @param[in] p_dst Address to write.
  69. * @param[in] data Data to write.
  70. * @retval NRF_SUCCESS If the write operation was successful.
  71. */
  72. uint32_t blocking_flash_word_write(uint32_t * const p_dst, uint32_t data);
  73. #endif // BOOTLOADER_H__
  74. /**@} */