recovery.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
  2. * Redistribution and use in source and binary forms, with or without
  3. * modification, are permitted provided that the following conditions are
  4. * met:
  5. * * Redistributions of source code must retain the above copyright
  6. * notice, this list of conditions and the following disclaimer.
  7. * * Redistributions in binary form must reproduce the above
  8. * copyright notice, this list of conditions and the following
  9. * disclaimer in the documentation and/or other materials provided
  10. * with the distribution.
  11. * * Neither the name of Code Aurora Forum, Inc. nor the names of its
  12. * contributors may be used to endorse or promote products derived
  13. * from this software without specific prior written permission.
  14. *
  15. * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
  16. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
  18. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  19. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  20. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  21. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  22. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  23. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  24. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  25. * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. #ifndef _BOOTLOADER_RECOVERY_H
  28. #define _BOOTLOADER_RECOVERY_H
  29. #define UPDATE_MAGIC "MSM-RADIO-UPDATE"
  30. #define UPDATE_MAGIC_SIZE 16
  31. #define UPDATE_VERSION 0x00010000
  32. /* Recovery Message */
  33. struct recovery_message {
  34. char command[32];
  35. char status[32];
  36. char recovery[1024];
  37. };
  38. struct update_header {
  39. unsigned char MAGIC[UPDATE_MAGIC_SIZE];
  40. unsigned version;
  41. unsigned size;
  42. unsigned image_offset;
  43. unsigned image_length;
  44. unsigned bitmap_width;
  45. unsigned bitmap_height;
  46. unsigned bitmap_bpp;
  47. unsigned busy_bitmap_offset;
  48. unsigned busy_bitmap_length;
  49. unsigned fail_bitmap_offset;
  50. unsigned fail_bitmap_length;
  51. };
  52. int get_recovery_message(struct recovery_message *out);
  53. int set_recovery_message(const struct recovery_message *in);
  54. int read_update_header_for_bootloader(struct update_header *header);
  55. int update_firmware_image (struct update_header *header, char *name);
  56. int recovery_init (void);
  57. extern unsigned boot_into_recovery;
  58. #endif