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 if (sizeof(obj.yst_atime) != 8) {
24 printf("Error: size of yaffs_obj.yst_atime is not 64 bits\n");
28 //create several times and save them
32 //need to set this to get the function to swap
33 //endianess of the values.
35 //remember that the first two bytes are swapped to the
36 //other end while still retaining their order.
37 // i.e. 0xfa..... becomes 0x...fa
40 struct yaffs_obj_hdr oh;
42 oh.yst_atime = 0xaf1732b0;
43 oh.yst_mtime = 0xaf1732b0;
44 oh.yst_ctime = 0xaf1732b0;
46 yaffs_do_endian_oh(&dev,&oh);
48 //check that the endianess is correct
49 u32 expected = 0xb03217af;
50 if (oh.yst_atime != expected ) {
51 printf("endian test failed for yst_atime, got %x expected %x\n",oh.yst_atime,expected);
54 if (oh.yst_mtime != expected) {
55 printf("endian test failed for yst_mtime, got %x, expected %x\n",oh.yst_mtime,expected);
58 if (oh.yst_ctime != expected) {
59 printf("endian test failed for yst_ctime, got %x, expected %x\n",oh.yst_ctime,expected);
63 printf("all tests pass\n");