bugfix for duplicate symbol
Fork of nRF51822 by
nordic-sdk/components/libraries/bootloader_dfu/dfu.h@103:138bdc859cc9, 2015-04-15 (annotated)
- Committer:
- rgrover1
- Date:
- Wed Apr 15 08:59:11 2015 +0100
- Revision:
- 103:138bdc859cc9
Synchronized with git rev fa183c40
Author: Rohit Grover
updating to v7.1 of the Nordic SDK.
Re-organized file layout to match that from the SDK.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rgrover1 | 103:138bdc859cc9 | 1 | /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. |
rgrover1 | 103:138bdc859cc9 | 2 | * |
rgrover1 | 103:138bdc859cc9 | 3 | * The information contained herein is property of Nordic Semiconductor ASA. |
rgrover1 | 103:138bdc859cc9 | 4 | * Terms and conditions of usage are described in detail in NORDIC |
rgrover1 | 103:138bdc859cc9 | 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. |
rgrover1 | 103:138bdc859cc9 | 6 | * |
rgrover1 | 103:138bdc859cc9 | 7 | * Licensees are granted free, non-transferable use of the information. NO |
rgrover1 | 103:138bdc859cc9 | 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from |
rgrover1 | 103:138bdc859cc9 | 9 | * the file. |
rgrover1 | 103:138bdc859cc9 | 10 | * |
rgrover1 | 103:138bdc859cc9 | 11 | */ |
rgrover1 | 103:138bdc859cc9 | 12 | |
rgrover1 | 103:138bdc859cc9 | 13 | /**@file |
rgrover1 | 103:138bdc859cc9 | 14 | * |
rgrover1 | 103:138bdc859cc9 | 15 | * @defgroup nrf_dfu Device Firmware Update API. |
rgrover1 | 103:138bdc859cc9 | 16 | * @{ |
rgrover1 | 103:138bdc859cc9 | 17 | * |
rgrover1 | 103:138bdc859cc9 | 18 | * @brief Device Firmware Update module interface. |
rgrover1 | 103:138bdc859cc9 | 19 | */ |
rgrover1 | 103:138bdc859cc9 | 20 | |
rgrover1 | 103:138bdc859cc9 | 21 | #ifndef DFU_H__ |
rgrover1 | 103:138bdc859cc9 | 22 | #define DFU_H__ |
rgrover1 | 103:138bdc859cc9 | 23 | |
rgrover1 | 103:138bdc859cc9 | 24 | #include "dfu_types.h" |
rgrover1 | 103:138bdc859cc9 | 25 | #include <stdbool.h> |
rgrover1 | 103:138bdc859cc9 | 26 | #include <stdint.h> |
rgrover1 | 103:138bdc859cc9 | 27 | |
rgrover1 | 103:138bdc859cc9 | 28 | |
rgrover1 | 103:138bdc859cc9 | 29 | /**@brief DFU event callback for asynchronous calls. |
rgrover1 | 103:138bdc859cc9 | 30 | * |
rgrover1 | 103:138bdc859cc9 | 31 | * @param[in] packet Packet type for which this callback is related. START_PACKET, DATA_PACKET. |
rgrover1 | 103:138bdc859cc9 | 32 | * @param[in] result Operation result code. NRF_SUCCESS when a queued operation was successful. |
rgrover1 | 103:138bdc859cc9 | 33 | * @param[in] p_data Pointer to the data to which the operation is related. |
rgrover1 | 103:138bdc859cc9 | 34 | */ |
rgrover1 | 103:138bdc859cc9 | 35 | typedef void (*dfu_callback_t)(uint32_t packet, uint32_t result, uint8_t * p_data); |
rgrover1 | 103:138bdc859cc9 | 36 | |
rgrover1 | 103:138bdc859cc9 | 37 | /**@brief Function for initializing the Device Firmware Update module. |
rgrover1 | 103:138bdc859cc9 | 38 | * |
rgrover1 | 103:138bdc859cc9 | 39 | * @return NRF_SUCCESS on success, an error_code otherwise. |
rgrover1 | 103:138bdc859cc9 | 40 | */ |
rgrover1 | 103:138bdc859cc9 | 41 | uint32_t dfu_init(void); |
rgrover1 | 103:138bdc859cc9 | 42 | |
rgrover1 | 103:138bdc859cc9 | 43 | /**@brief Function for registering a callback listener for \ref dfu_data_pkt_handle callbacks. |
rgrover1 | 103:138bdc859cc9 | 44 | * |
rgrover1 | 103:138bdc859cc9 | 45 | * @param[in] callback_handler Callback handler for receiving DFU events on completed operations |
rgrover1 | 103:138bdc859cc9 | 46 | * of DFU packets. |
rgrover1 | 103:138bdc859cc9 | 47 | */ |
rgrover1 | 103:138bdc859cc9 | 48 | void dfu_register_callback(dfu_callback_t callback_handler); |
rgrover1 | 103:138bdc859cc9 | 49 | |
rgrover1 | 103:138bdc859cc9 | 50 | /**@brief Function for setting the DFU image size. |
rgrover1 | 103:138bdc859cc9 | 51 | * |
rgrover1 | 103:138bdc859cc9 | 52 | * @details Function sets the DFU image size. This function must be called when an update is started |
rgrover1 | 103:138bdc859cc9 | 53 | * in order to notify the DFU of the new image size. If multiple images are to be |
rgrover1 | 103:138bdc859cc9 | 54 | * transferred within the same update context then this function must be called with size |
rgrover1 | 103:138bdc859cc9 | 55 | * information for each image being transfered. |
rgrover1 | 103:138bdc859cc9 | 56 | * If an image type is not being transfered, e.g. SoftDevice but no Application , then the |
rgrover1 | 103:138bdc859cc9 | 57 | * image size for application must be zero. |
rgrover1 | 103:138bdc859cc9 | 58 | * |
rgrover1 | 103:138bdc859cc9 | 59 | * @param[in] p_packet Pointer to the DFU packet containing information on DFU update process to |
rgrover1 | 103:138bdc859cc9 | 60 | * be started. |
rgrover1 | 103:138bdc859cc9 | 61 | * |
rgrover1 | 103:138bdc859cc9 | 62 | * @return NRF_SUCCESS on success, an error_code otherwise. |
rgrover1 | 103:138bdc859cc9 | 63 | */ |
rgrover1 | 103:138bdc859cc9 | 64 | uint32_t dfu_start_pkt_handle(dfu_update_packet_t * p_packet); |
rgrover1 | 103:138bdc859cc9 | 65 | |
rgrover1 | 103:138bdc859cc9 | 66 | /**@brief Function for handling DFU data packets. |
rgrover1 | 103:138bdc859cc9 | 67 | * |
rgrover1 | 103:138bdc859cc9 | 68 | * @param[in] p_packet Pointer to the DFU packet. |
rgrover1 | 103:138bdc859cc9 | 69 | * |
rgrover1 | 103:138bdc859cc9 | 70 | * @return NRF_SUCCESS on success, an error_code otherwise. |
rgrover1 | 103:138bdc859cc9 | 71 | */ |
rgrover1 | 103:138bdc859cc9 | 72 | uint32_t dfu_data_pkt_handle(dfu_update_packet_t * p_packet); |
rgrover1 | 103:138bdc859cc9 | 73 | |
rgrover1 | 103:138bdc859cc9 | 74 | /**@brief Function for handling DFU init packets. |
rgrover1 | 103:138bdc859cc9 | 75 | * |
rgrover1 | 103:138bdc859cc9 | 76 | * @return NRF_SUCCESS on success, an error_code otherwise. |
rgrover1 | 103:138bdc859cc9 | 77 | */ |
rgrover1 | 103:138bdc859cc9 | 78 | uint32_t dfu_init_pkt_handle(dfu_update_packet_t * p_packet); |
rgrover1 | 103:138bdc859cc9 | 79 | |
rgrover1 | 103:138bdc859cc9 | 80 | /**@brief Function for validating a transferred image after the transfer has completed. |
rgrover1 | 103:138bdc859cc9 | 81 | * |
rgrover1 | 103:138bdc859cc9 | 82 | * @return NRF_SUCCESS on success, an error_code otherwise. |
rgrover1 | 103:138bdc859cc9 | 83 | */ |
rgrover1 | 103:138bdc859cc9 | 84 | uint32_t dfu_image_validate(void); |
rgrover1 | 103:138bdc859cc9 | 85 | |
rgrover1 | 103:138bdc859cc9 | 86 | /**@brief Function for activating the transfered image after validation has successfully completed. |
rgrover1 | 103:138bdc859cc9 | 87 | * |
rgrover1 | 103:138bdc859cc9 | 88 | * @return NRF_SUCCESS on success, an error_code otherwise. |
rgrover1 | 103:138bdc859cc9 | 89 | */ |
rgrover1 | 103:138bdc859cc9 | 90 | uint32_t dfu_image_activate(void); |
rgrover1 | 103:138bdc859cc9 | 91 | |
rgrover1 | 103:138bdc859cc9 | 92 | /**@brief Function for reseting the current update procedure and return to initial state. |
rgrover1 | 103:138bdc859cc9 | 93 | * |
rgrover1 | 103:138bdc859cc9 | 94 | * @details This function call will result in a system reset to ensure correct system behavior. |
rgrover1 | 103:138bdc859cc9 | 95 | * The reset will might be scheduled to execute at a later point in time to ensure pending |
rgrover1 | 103:138bdc859cc9 | 96 | * flash operations has completed. |
rgrover1 | 103:138bdc859cc9 | 97 | */ |
rgrover1 | 103:138bdc859cc9 | 98 | void dfu_reset(void); |
rgrover1 | 103:138bdc859cc9 | 99 | |
rgrover1 | 103:138bdc859cc9 | 100 | /**@brief Function for validating that new bootloader has been correctly installed. |
rgrover1 | 103:138bdc859cc9 | 101 | * |
rgrover1 | 103:138bdc859cc9 | 102 | * @return NRF_SUCCESS if install was successful. NRF_ERROR_NULL if the images differs. |
rgrover1 | 103:138bdc859cc9 | 103 | */ |
rgrover1 | 103:138bdc859cc9 | 104 | uint32_t dfu_bl_image_validate(void); |
rgrover1 | 103:138bdc859cc9 | 105 | |
rgrover1 | 103:138bdc859cc9 | 106 | /**@brief Function for validating that new SoftDevicehas been correctly installed. |
rgrover1 | 103:138bdc859cc9 | 107 | * |
rgrover1 | 103:138bdc859cc9 | 108 | * @return NRF_SUCCESS if install was successful. NRF_ERROR_NULL if the images differs. |
rgrover1 | 103:138bdc859cc9 | 109 | */ |
rgrover1 | 103:138bdc859cc9 | 110 | uint32_t dfu_sd_image_validate(void); |
rgrover1 | 103:138bdc859cc9 | 111 | |
rgrover1 | 103:138bdc859cc9 | 112 | /**@brief Function for swapping existing bootloader with newly received. |
rgrover1 | 103:138bdc859cc9 | 113 | * |
rgrover1 | 103:138bdc859cc9 | 114 | * @return NRF_SUCCESS on succesfull swapping. For error code please refer to |
rgrover1 | 103:138bdc859cc9 | 115 | * \ref sd_mbr_command_copy_bl_t. |
rgrover1 | 103:138bdc859cc9 | 116 | */ |
rgrover1 | 103:138bdc859cc9 | 117 | uint32_t dfu_bl_image_swap(void); |
rgrover1 | 103:138bdc859cc9 | 118 | |
rgrover1 | 103:138bdc859cc9 | 119 | /**@brief Function for swapping existing SoftDevice with newly received. |
rgrover1 | 103:138bdc859cc9 | 120 | * |
rgrover1 | 103:138bdc859cc9 | 121 | * @return NRF_SUCCESS on succesfull swapping. For error code please refer to |
rgrover1 | 103:138bdc859cc9 | 122 | * \ref sd_mbr_command_copy_sd_t. |
rgrover1 | 103:138bdc859cc9 | 123 | */ |
rgrover1 | 103:138bdc859cc9 | 124 | uint32_t dfu_sd_image_swap(void); |
rgrover1 | 103:138bdc859cc9 | 125 | |
rgrover1 | 103:138bdc859cc9 | 126 | /**@brief Function for handling DFU init packet complete. |
rgrover1 | 103:138bdc859cc9 | 127 | * |
rgrover1 | 103:138bdc859cc9 | 128 | * @return NRF_SUCCESS on success, an error_code otherwise. |
rgrover1 | 103:138bdc859cc9 | 129 | */ |
rgrover1 | 103:138bdc859cc9 | 130 | uint32_t dfu_init_pkt_complete(void); |
rgrover1 | 103:138bdc859cc9 | 131 | |
rgrover1 | 103:138bdc859cc9 | 132 | #endif // DFU_H__ |
rgrover1 | 103:138bdc859cc9 | 133 | |
rgrover1 | 103:138bdc859cc9 | 134 | /** @} */ |