blob: 7862f4229712d3a7b66e08e1199807dc5fe4a4d2 [file] [log] [blame]
/**
* \addtogroup BSP
* \{
* \addtogroup SYSTEM
* \{
* \addtogroup SUOTA
*
* \brief SUOTA structure definitions
*
* \{
*/
/**
*****************************************************************************************
*
* @file suota.h
*
* @brief SUOTA structure definitions
*
* Copyright (c) 2016, Dialog Semiconductor
* All rights reserved.
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
*****************************************************************************************
*/
#ifndef SUOTA_H_
#define SUOTA_H_
#include <stdint.h>
#define SUOTA_VERSION_1_1 11
#define SUOTA_VERSION_1_2 12
#define SUOTA_VERSION_1_3 13
#ifndef SUOTA_VERSION
#define SUOTA_VERSION SUOTA_VERSION_1_3
#endif
#if SUOTA_PSM && (SUOTA_VERSION < SUOTA_VERSION_1_2)
# error "SUOTA_PSM is only applicable to SUOTA_VERSION >= 1.2"
#endif
/**
* \struct suota_1_1_product_header_t;
*
* \brief SUOTA 1.1 product header as defined by Dialog SUOTA specification.
*
* \note the same header is used for any SUOTA version newer than 1.1
*
*/
typedef struct {
uint8_t signature[2];
uint16_t flags;
uint32_t current_image_location;
uint32_t update_image_location;
uint8_t reserved[8];
} __attribute__((packed)) suota_1_1_product_header_t;
#define SUOTA_1_1_PRODUCT_HEADER_SIGNATURE_B1 0x70
#define SUOTA_1_1_PRODUCT_HEADER_SIGNATURE_B2 0x62
/**
* \struct suota_1_1_image_header_t
*
* \brief SUOTA 1.1 image header as defined by Dialog SUOTA specification.
*
* \note the same header is used for any SUOTA version newer than 1.1
*
*/
typedef struct {
uint8_t signature[2];
uint16_t flags;
uint32_t code_size;
uint32_t crc;
uint8_t version[16];
uint32_t timestamp;
uint32_t exec_location;
} __attribute__((packed)) suota_1_1_image_header_t;
#define SUOTA_1_1_IMAGE_HEADER_SIGNATURE_B1 0x70
#define SUOTA_1_1_IMAGE_HEADER_SIGNATURE_B2 0x61
#define SUOTA_1_1_IMAGE_FLAG_FORCE_CRC 0x01
#define SUOTA_1_1_IMAGE_FLAG_VALID 0x02
#define SUOTA_1_1_IMAGE_FLAG_RETRY1 0x04
#define SUOTA_1_1_IMAGE_FLAG_RETRY2 0x08
typedef suota_1_1_image_header_t suota_image_header_t;
#endif /* SUOTA_H_ */
/**
* \}
* \}
* \}
*/