boot_uimage.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Copyright (C) 2017 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _BOOT_UIMAGE_H_
  13. #define _BOOT_UIMAGE_H_
  14. #include "osi_compiler.h"
  15. OSI_EXTERN_C_BEGIN
  16. /**
  17. * \brief get uimage size
  18. *
  19. * \p buf should be large enough for uimage header. The return size
  20. * is the total size including uimage header.
  21. *
  22. * \param buf buffer for uimage, 4 bytes aligned
  23. * \return uimage size
  24. */
  25. unsigned bootUimageSize(const void *buf);
  26. /**
  27. * \brief check whether uimage is valid
  28. *
  29. * \p len is the buffer size. It shoun't be less than the uimage size
  30. * including uimage header.
  31. *
  32. * \param buf buffer for uimage, 4 bytes aligned
  33. * \param len buffer size
  34. * \return
  35. * - true if the uimage is valid
  36. * - false if the uimage is invalid
  37. */
  38. bool bootUimageCheck(const void *buf, unsigned len);
  39. /**
  40. * \brief quick check whether uimage is valid
  41. *
  42. * It is similar to \p bootUimageCheck, and the data CRC isn't checked.
  43. * It is provided in case that a quick and not-so-reliable check is
  44. * needed.
  45. *
  46. * \param buf buffer for uimage, 4 bytes aligned
  47. * \param len buffer size
  48. * \return
  49. * - true if the uimage is valid
  50. * - false if the uimage is invalid
  51. */
  52. bool bootUimageQuickCheck(const void *buf, unsigned len);
  53. /**
  54. * \brief get uimage entry address
  55. *
  56. * \p buf should be checked by \p bootUimageCheck before.
  57. *
  58. * \param buf buffer for uimage, must be checked
  59. * \return uimage entry point
  60. */
  61. uint32_t bootUimageEntry(const void *buf);
  62. OSI_EXTERN_C_END
  63. #endif