| /* |
| * Licensed to the Apache Software Foundation (ASF) under one |
| * or more contributor license agreements. See the NOTICE file |
| * distributed with this work for additional information |
| * regarding copyright ownership. The ASF licenses this file |
| * to you under the Apache License, Version 2.0 (the |
| * "License"); you may not use this file except in compliance |
| * with the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, |
| * software distributed under the License is distributed on an |
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| * KIND, either express or implied. See the License for the |
| * specific language governing permissions and limitations |
| * under the License. |
| */ |
| |
| #ifndef H_BOOTUTIL_ |
| #define H_BOOTUTIL_ |
| |
| #include <inttypes.h> |
| |
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
| |
| /** Just boot whatever is in slot 0. */ |
| #define BOOT_SWAP_TYPE_NONE 1 |
| |
| /** Swap to slot 1. Absent a confirm command, revert back on next boot. */ |
| #define BOOT_SWAP_TYPE_TEST 2 |
| |
| /** Swap to slot 1 permanently. */ |
| #define BOOT_SWAP_TYPE_PERM 3 |
| |
| /** Swap back to alternate slot. A confirm changes this state to NONE. */ |
| #define BOOT_SWAP_TYPE_REVERT 4 |
| |
| #define BOOT_SWAP_TYPE_FAIL 0xff |
| |
| struct image_header; |
| /** |
| * A response object provided by the boot loader code; indicates where to jump |
| * to execute the main image. |
| */ |
| struct boot_rsp { |
| /** A pointer to the header of the image to be executed. */ |
| const struct image_header *br_hdr; |
| |
| /** |
| * The flash offset of the image to execute. Indicates the position of |
| * the image header. |
| */ |
| uint8_t br_flash_id; |
| uint32_t br_image_addr; |
| }; |
| |
| /* you must have pre-allocated all the entries within this structure */ |
| int boot_go(struct boot_rsp *rsp); |
| |
| int boot_swap_type(void); |
| |
| int boot_set_pending(int permanent); |
| int boot_set_confirmed(void); |
| |
| #define SPLIT_GO_OK (0) |
| #define SPLIT_GO_NON_MATCHING (-1) |
| #define SPLIT_GO_ERR (-2) |
| int |
| split_go(int loader_slot, int split_slot, void **entry); |
| |
| #ifdef __cplusplus |
| } |
| #endif |
| |
| #endif |