ota_image.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2019 Actions Semiconductor Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file
  8. * @brief OTA firmware image interface
  9. */
  10. #ifndef __OTA_IMAGE_H__
  11. #define __OTA_IMAGE_H__
  12. struct ota_image;
  13. struct ota_backend;
  14. struct ota_image *ota_image_init(void);
  15. void ota_image_exit(struct ota_image *img);
  16. int ota_image_bind(struct ota_image *img, struct ota_backend *backend);
  17. int ota_image_unbind(struct ota_image *img, struct ota_backend *backend);
  18. struct ota_backend *ota_image_get_backend(struct ota_image *img);
  19. uint32_t ota_image_get_checksum(struct ota_image *img);
  20. uint32_t ota_image_get_datasize(struct ota_image *img);
  21. int ota_image_open(struct ota_image *img);
  22. int ota_image_close(struct ota_image *img);
  23. int ota_image_check_data(struct ota_image *img);
  24. int ota_image_read_prepare(struct ota_image *img, int offset, uint8_t *buf, int size);
  25. int ota_image_read_complete(struct ota_image *img, int offset, uint8_t *buf, int size);
  26. int ota_image_read(struct ota_image *img, int offset, uint8_t *buf, int size);
  27. int ota_image_ioctl(struct ota_image *img, int cmd, unsigned int param);
  28. int ota_image_get_file_length(struct ota_image *img, const char *filename);
  29. int ota_image_get_file_offset(struct ota_image *img, const char *filename);
  30. int ota_image_check_file(struct ota_image *img, const char *filename, const uint8_t *buf, int size);
  31. int ota_image_report_progress(struct ota_image *img, uint32_t pre_xfer_size, bool is_final);
  32. int ota_image_progress_on(struct ota_image *img, uint32_t total_size, uint32_t start_offset);
  33. int ota_image_progress_reset(struct ota_image *img);
  34. #endif /* __OTA_IMAGE_H__ */