ota_manifest.h 981 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2019 Actions Semiconductor Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file
  8. * @brief OTA manifest file interface
  9. */
  10. #ifndef __OTA_MANIFEST_H__
  11. #define __OTA_MANIFEST_H__
  12. #include <fw_version.h>
  13. #define OTA_MANIFEST_MAX_FILE_CNT 15
  14. struct ota_file {
  15. uint8_t name[13];
  16. uint8_t type;
  17. uint8_t file_id;
  18. #ifdef CONFIG_OTA_MUTIPLE_STORAGE
  19. uint8_t storage_id;
  20. #else
  21. uint8_t reserved;
  22. #endif
  23. uint32_t offset;
  24. uint32_t size;
  25. uint32_t orig_size;
  26. uint32_t checksum;
  27. } __attribute__((packed));
  28. struct ota_manifest {
  29. struct fw_version fw_ver;
  30. #if defined(CONFIG_OTA_FILE_PATCH) || defined(CONFIG_OTA_RES_PATCH)
  31. struct fw_version old_fw_ver;
  32. #endif
  33. int file_cnt;
  34. uint8_t *manifest_data;
  35. uint32_t manifest_size;
  36. struct ota_file wfiles[OTA_MANIFEST_MAX_FILE_CNT];
  37. };
  38. struct ota_image;
  39. int ota_manifest_parse_file(struct ota_manifest *manifest, struct ota_image *img,
  40. const char *file_name);
  41. #endif /* __OTA_MANIFEST_H__ */