1 /*
2  * Copyright (c) 2018 Nordic Semiconductor ASA
3  * Copyright (c) 2015 Runtime Inc
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #ifndef _SETTINGS_TEST_FCB_H
9 #define _SETTINGS_TEST_FCB_H
10 
11 #include <stdio.h>
12 #include <string.h>
13 #include <zephyr/ztest.h>
14 
15 #include <zephyr/settings/settings.h>
16 #include <zephyr/storage/flash_map.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #define SETTINGS_TEST_FCB_VAL_STR_CNT   64
23 #define SETTINGS_TEST_FCB_FLASH_CNT   4
24 
25 
26 extern uint8_t val8;
27 extern uint8_t val8_un;
28 extern uint32_t val32;
29 extern uint64_t val64;
30 
31 extern int test_get_called;
32 extern int test_set_called;
33 extern int test_commit_called;
34 extern int test_export_block;
35 
36 extern int c2_var_count;
37 
38 extern struct flash_sector fcb_sectors[SETTINGS_TEST_FCB_FLASH_CNT];
39 
40 extern char val_string[SETTINGS_TEST_FCB_VAL_STR_CNT][SETTINGS_MAX_VAL_LEN];
41 extern char test_ref_value[SETTINGS_TEST_FCB_VAL_STR_CNT][SETTINGS_MAX_VAL_LEN];
42 
43 extern struct settings_handler c_test_handlers[];
44 
45 void ctest_clear_call_state(void);
46 int ctest_get_call_state(void);
47 
48 void config_wipe_srcs(void);
49 void config_wipe_fcb(struct flash_sector *fs, int cnt);
50 
51 void test_config_fill_area(
52 	char test_value[SETTINGS_TEST_FCB_VAL_STR_CNT][SETTINGS_MAX_VAL_LEN],
53 		int iteration);
54 
55 void *settings_config_setup(void);
56 void settings_config_teardown(void *fixture);
57 void test_config_insert2(void);
58 void test_config_insert3(void);
59 int settings_unregister(struct settings_handler *handler);
60 #ifdef __cplusplus
61 }
62 #endif
63 #endif /* _SETTINGS_TEST_FCB_H */
64