33 #include "gtest/gtest.h"
63 #define OBJ0_ID 0xAA55AA55
65 #define OBJ1_ID 0x12345678
68 #define OBJ2_ID 0xABCDEFAB
71 #define OBJ3_ID 0x99999999
72 #define OBJ3_SIZE (256 - 12) // leave room for the slot header
74 #define OBJ4_ID 0x90901111
75 #define OBJ4_SIZE (768) // only fits in partition b slots
82 for (uint32_t
i = 0;
i <
sizeof(
obj1);
i++) {
92 for (uint32_t
i = 0;
i <
sizeof(
obj2);
i++) {
97 for (uint32_t
i = 0;
i <
sizeof(
obj3);
i++) {
102 for (uint32_t
i = 0;
i <
sizeof(
obj4);
i++) {
103 obj4[
i] = 0x40 + (
i % 10);
111 unlink(
"theflash.bin");
169 memset(obj1_check, 0,
sizeof(obj1_check));
185 memset(obj1_check, 0,
sizeof(obj1_check));
187 EXPECT_EQ(0, memcmp(obj1, obj1_check,
sizeof(obj1)));
194 memset(obj1_check, 0,
sizeof(obj1_check));
196 EXPECT_EQ(0, memcmp(obj1, obj1_check,
sizeof(obj1)));
210 memset(obj1_check, 0,
sizeof(obj1_check));
212 EXPECT_EQ(0, memcmp(obj1, obj1_check,
sizeof(obj1)));
222 memset(obj1_check, 0,
sizeof(obj1_check));
224 EXPECT_EQ(0, memcmp(obj1, obj1_check,
sizeof(obj1)));
248 memset(obj1_check, 0,
sizeof(obj1_check));
262 memset(obj1_check, 0,
sizeof(obj1_check));
264 EXPECT_EQ(0, memcmp(obj1_alt, obj1_check,
sizeof(obj1_alt)));
267 memset(obj1_check, 0,
sizeof(obj1_check));
269 EXPECT_EQ(0, memcmp(obj1, obj1_check,
sizeof(obj1)));
286 memset(obj1_check, 0,
sizeof(obj1_check));
288 EXPECT_EQ(0, memcmp(obj1, obj1_check,
sizeof(obj1)));
291 memset(obj1_check, 0,
sizeof(obj1_check));
293 EXPECT_EQ(0, memcmp(obj1_alt, obj1_check,
sizeof(obj1_alt)));
297 for (uint32_t
i = 0;
i < 10000;
i++) {
309 memset(obj1_check, 0,
sizeof(obj1_check));
311 EXPECT_EQ(0, memcmp(obj1, obj1_check,
sizeof(obj1)));
314 memset(obj1_alt_check, 0,
sizeof(obj1_alt_check));
316 EXPECT_EQ(0, memcmp(obj1_alt, obj1_alt_check,
sizeof(obj1_alt)));
319 memset(obj2_check, 0,
sizeof(obj2_check));
321 EXPECT_EQ(0, memcmp(obj2, obj2_check,
sizeof(obj2)));
324 memset(obj3_check, 0,
sizeof(obj3_check));
326 EXPECT_EQ(0, memcmp(obj3, obj3_check,
sizeof(obj3)));
357 memset(obj1_check, 0,
sizeof(obj1_check));
359 EXPECT_EQ(0, memcmp(obj1, obj1_check,
sizeof(obj1)));
363 memset(obj2_check, 0,
sizeof(obj2_check));
365 EXPECT_EQ(0, memcmp(obj2, obj2_check,
sizeof(obj2)));
376 memset(obj2_check, 0,
sizeof(obj2_check));
378 EXPECT_EQ(0, memcmp(obj2, obj2_check,
sizeof(obj2)));
387 memset(obj1_check, 0,
sizeof(obj1_check));
392 memset(obj2_check, 0,
sizeof(obj2_check));
404 memset(obj1_check, 0,
sizeof(obj1_check));
409 memset(obj2_check, 0,
sizeof(obj2_check));
418 memset(obj4_check, 0,
sizeof(obj4_check));
TEST_F(RneFromLLATest, Equator)
void PIOS_Flash_Posix_Destroy(uintptr_t chip_id)
unsigned char obj4[OBJ4_SIZE]
unsigned char obj1_alt[OBJ1_SIZE]
unsigned char obj2[OBJ2_SIZE]
int32_t PIOS_FLASHFS_Logfs_Init(uintptr_t *fs_id, const struct flashfs_logfs_cfg *cfg, enum pios_flash_partition_labels partition_label)
Initialize the flash object setting FS.
int32_t PIOS_FLASHFS_Logfs_Destroy(uintptr_t fs_id)
struct flashfs_logfs_cfg flashfs_config_waypoints
struct pios_flash_posix_cfg flash_config
int32_t PIOS_FLASHFS_ObjDelete(uintptr_t fs_id, uint32_t obj_id, uint16_t obj_inst_id)
Delete one instance of an object from the filesystem.
uintptr_t pios_posix_flash_id
struct flashfs_logfs_cfg flashfs_config_settings
unsigned char obj3[OBJ3_SIZE]
int32_t PIOS_FLASHFS_ObjSave(uintptr_t fs_id, uint32_t obj_id, uint16_t obj_inst_id, uint8_t *obj_data, uint16_t obj_size)
Saves one object instance to the filesystem.
int32_t PIOS_FLASHFS_ObjLoad(uintptr_t fs_id, uint32_t obj_id, uint16_t obj_inst_id, uint8_t *obj_data, uint16_t obj_size)
Load one object instance from the filesystem.
void PIOS_FLASH_register_partition_table(const struct pios_flash_partition partition_table[], uint8_t num_partitions)
const struct pios_flash_partition pios_flash_partition_table[]
unsigned char obj1[OBJ1_SIZE]
int32_t PIOS_FLASHFS_Format(uintptr_t fs_id)
Erases all filesystem arenas and activate the first arena.
uint32_t pios_flash_partition_table_size
int32_t PIOS_Flash_Posix_Init(uintptr_t *chip_id, const struct pios_flash_posix_cfg *cfg, bool force_recreate)