1 /*
2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <boot_upg_common.h>
17
boot_upg_tool_bit_test(const hi_u8 * data,hi_u16 pos)18 hi_bool boot_upg_tool_bit_test(const hi_u8 *data, hi_u16 pos)
19 {
20 hi_u16 base = pos / BIT_U8;
21 hi_u16 i = pos % BIT_U8;
22 return (hi_bool)bit_get(data[base], i);
23 }
24
boot_upg_tool_bit_set(hi_u8 * data,hi_u16 pos,hi_u8 val)25 hi_void boot_upg_tool_bit_set(hi_u8 *data, hi_u16 pos, hi_u8 val)
26 {
27 hi_u16 base = pos / BIT_U8;
28 hi_u16 i = pos % BIT_U8;
29
30 bit_set(data[base], i, val);
31 }