2 #include "yaffs_endian.h"
4 #define YAFFS_MOUNT_POINT "/yflash2/"
5 #define FILE_PATH "/yflash2/foo.txt"
8 int simulate_power_failure = 0;
15 //test that ytime is 64 bits
17 if (sizeof(YTIME_T) != 8) {
18 printf("Error:size of YTIME_T is not 64 bits\n");
23 //create several times and save them
27 //need to set this to get the function to swap
28 //endianess of the values.
30 //remember that the first two bytes are swapped to the
31 //other end while still retaining their order.
32 // i.e. 0xfa..... becomes 0x...fa
35 struct yaffs_obj_hdr oh;
37 oh.yst_atime = 0xaf1732b0;
38 oh.yst_mtime = 0xaf1732b0;
39 oh.yst_ctime = 0xaf1732b0;
41 yaffs_do_endian_oh(&dev,&oh);
43 //check that the endianess is correct
44 u64 expected = 0xb03217af;
45 if (oh.yst_atime != expected || oh.yst_mtime != expected || oh.yst_ctime != expected) {
46 printf("endian test failed, got %x\n",oh.yst_atime);
50 printf("all tests pass\n");