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
dfu_bank_internal.h
00001 /* Copyright (c) 2014 Nordic Semiconductor. All Rights Reserved. 00002 * 00003 * The information contained herein is property of Nordic Semiconductor ASA. 00004 * Terms and conditions of usage are described in detail in NORDIC 00005 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 00006 * 00007 * Licensees are granted free, non-transferable use of the information. NO 00008 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 00009 * the file. 00010 * 00011 */ 00012 00013 /**@file 00014 * 00015 * @defgroup dfu_bank_internal Device Firmware Update internal header for bank handling in DFU. 00016 * @{ 00017 * 00018 * @brief Device Firmware Update Bank handling module interface. 00019 * 00020 * @details This header is intended for shared definition and functions between single and dual bank 00021 * implementations used for DFU support. It is not supposed to be used for external access 00022 * to the DFU module. 00023 * 00024 */ 00025 #ifndef DFU_BANK_INTERNAL_H__ 00026 #define DFU_BANK_INTERNAL_H__ 00027 00028 #include "dfu_types.h " 00029 00030 /**@brief States of the DFU state machine. */ 00031 typedef enum 00032 { 00033 DFU_STATE_INIT_ERROR, /**< State for: dfu_init(...) error. */ 00034 DFU_STATE_IDLE, /**< State for: idle. */ 00035 DFU_STATE_PREPARING, /**< State for: preparing, indicates that the flash is being erased and no data packets can be processed. */ 00036 DFU_STATE_RDY, /**< State for: ready. */ 00037 DFU_STATE_RX_INIT_PKT, /**< State for: receiving initialization packet. */ 00038 DFU_STATE_RX_DATA_PKT, /**< State for: receiving data packet. */ 00039 DFU_STATE_VALIDATE, /**< State for: validate. */ 00040 DFU_STATE_WAIT_4_ACTIVATE /**< State for: waiting for dfu_image_activate(). */ 00041 } dfu_state_t; 00042 00043 #define APP_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. */ 00044 #define DFU_TIMEOUT_INTERVAL APP_TIMER_TICKS(120000, APP_TIMER_PRESCALER) /**< DFU timeout interval in units of timer ticks. */ 00045 00046 #define IS_UPDATING_SD(START_PKT) ((START_PKT).dfu_update_mode & DFU_UPDATE_SD) /**< Macro for determining if a SoftDevice update is ongoing. */ 00047 #define IS_UPDATING_BL(START_PKT) ((START_PKT).dfu_update_mode & DFU_UPDATE_BL) /**< Macro for determining if a Bootloader update is ongoing. */ 00048 #define IS_UPDATING_APP(START_PKT) ((START_PKT).dfu_update_mode & DFU_UPDATE_APP) /**< Macro for determining if a Application update is ongoing. */ 00049 #define IMAGE_WRITE_IN_PROGRESS() (m_data_received > 0) /**< Macro for determining is image write in progress. */ 00050 #define IS_WORD_SIZED(SIZE) ((SIZE & (sizeof(uint32_t) - 1)) == 0) /**< Macro for checking that the provided is word sized. */ 00051 00052 static uint32_t m_data_received; /**< Amount of received data. */ 00053 00054 /**@brief Type definition of function used for preparing of the bank before receiving of a 00055 * software image. 00056 * 00057 * @param[in] image_size Size of software image being received. 00058 */ 00059 typedef void (*dfu_bank_prepare_t)(uint32_t image_size); 00060 00061 /**@brief Type definition of function used for handling clear complete of the bank before 00062 * receiving of a software image. 00063 */ 00064 typedef void (*dfu_bank_cleared_t)(void); 00065 00066 /**@brief Type definition of function used for activating of the software image received. 00067 * 00068 * @return NRF_SUCCESS If the image has been successfully activated any other NRF_ERROR code in 00069 * case of a failure. 00070 */ 00071 typedef uint32_t (*dfu_bank_activate_t)(void); 00072 00073 /**@brief Structure for holding of function pointers for needed prepare and activate procedure for 00074 * the requested update procedure. 00075 */ 00076 typedef struct 00077 { 00078 dfu_bank_prepare_t prepare; /**< Function pointer to the prepare function called on start of update procedure. */ 00079 dfu_bank_cleared_t cleared; /**< Function pointer to the cleared function called after prepare function completes. */ 00080 dfu_bank_activate_t activate; /**< Function pointer to the activate function called on finalizing the update procedure. */ 00081 } dfu_bank_func_t; 00082 00083 #endif // DFU_BANK_INTERNAL_H__ 00084 00085 /** @} */
Generated on Tue Jul 12 2022 16:21:02 by
