The Android Open Source Project | c24a8e6 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef _RECOVERY_BOOTLOADER_H |
| 18 | #define _RECOVERY_BOOTLOADER_H |
| 19 | |
| 20 | /* Bootloader Message |
| 21 | * |
| 22 | * This structure describes the content of a block in flash |
| 23 | * that is used for recovery and the bootloader to talk to |
| 24 | * each other. |
| 25 | * |
| 26 | * The command field is updated by linux when it wants to |
| 27 | * reboot into recovery or to update radio or bootloader firmware. |
| 28 | * It is also updated by the bootloader when firmware update |
| 29 | * is complete (to boot into recovery for any final cleanup) |
| 30 | * |
| 31 | * The status field is written by the bootloader after the |
| 32 | * completion of an "update-radio" or "update-hboot" command. |
| 33 | * |
| 34 | * The recovery field is only written by linux and used |
| 35 | * for the system to send a message to recovery or the |
| 36 | * other way around. |
| 37 | */ |
| 38 | struct bootloader_message { |
| 39 | char command[32]; |
| 40 | char status[32]; |
| 41 | char recovery[1024]; |
| 42 | }; |
| 43 | |
| 44 | /* Read and write the bootloader command from the "misc" partition. |
| 45 | * These return zero on success. |
| 46 | */ |
| 47 | int get_bootloader_message(struct bootloader_message *out); |
| 48 | int set_bootloader_message(const struct bootloader_message *in); |
| 49 | |
| 50 | /* Write an update to the cache partition for update-radio or update-hboot. |
| 51 | * Note, this destroys any filesystem on the cache partition! |
| 52 | * The expected bitmap format is 240x320, 16bpp (2Bpp), RGB 5:6:5. |
| 53 | */ |
| 54 | int write_update_for_bootloader( |
| 55 | const char *update, int update_len, |
| 56 | int bitmap_width, int bitmap_height, int bitmap_bpp, |
| 57 | const char *busy_bitmap, const char *error_bitmap); |
| 58 | |
| 59 | #endif |