1 /* 2 * SPDX-License-Identifier: Apache-2.0 3 * 4 * Copyright (c) 2021 Nordic Semiconductor ASA 5 * 6 * Original license: 7 * 8 * Licensed to the Apache Software Foundation (ASF) under one 9 * or more contributor license agreements. See the NOTICE file 10 * distributed with this work for additional information 11 * regarding copyright ownership. The ASF licenses this file 12 * to you under the Apache License, Version 2.0 (the 13 * "License"); you may not use this file except in compliance 14 * with the License. You may obtain a copy of the License at 15 * 16 * http://www.apache.org/licenses/LICENSE-2.0 17 * 18 * Unless required by applicable law or agreed to in writing, 19 * software distributed under the License is distributed on an 20 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 21 * KIND, either express or implied. See the License for the 22 * specific language governing permissions and limitations 23 * under the License. 24 */ 25 26 /** 27 * @file 28 * @brief Hooks definition implementation API 29 * 30 * This file contains API interface definition for hooks which can be 31 * implemented for overide some of MCUboot's native routines. 32 */ 33 34 #ifndef H_BOOTUTIL_PUBLIC_HOOKS 35 #define H_BOOTUTIL_PUBLIC_HOOKS 36 37 #include "bootutil/boot_hooks.h" 38 39 /** Hook for provide primary image swap state. 40 * 41 * @param img_index the index of the image pair 42 * @param state image swap state structure to be populated 43 * 44 * @retval 0: header was read/populated 45 * FIH_FAILURE: image is invalid, 46 * BOOT_HOOK_REGULAR if hook not implemented for the image-slot, 47 * othervise an error-code value. 48 */ 49 int boot_read_swap_state_primary_slot_hook(int image_index, 50 struct boot_swap_state *state); 51 52 #endif /*H_BOOTUTIL_PUBLIC_HOOKS*/ 53