params_test.h
Go to the documentation of this file.
1 /*
2  * params_test.h
3  *
4  * Created on: May 26, 2013
5  * Author: petera
6  */
7 
8 #ifndef PARAMS_TEST_H_
9 #define PARAMS_TEST_H_
10 
12 
13 // default test total emulated spi flash size
14 #define PHYS_FLASH_SIZE (16*1024*1024)
15 // default test spiffs file system size
16 #define SPIFFS_FLASH_SIZE (2*1024*1024)
17 // default test spiffs file system offset in emulated spi flash
18 #define SPIFFS_PHYS_ADDR (4*1024*1024)
19 // default test sector size
20 #define SECTOR_SIZE 65536
21 // default test logical block size
22 #define LOG_BLOCK (SECTOR_SIZE*2)
23 // default test logical page size
24 #define LOG_PAGE (SECTOR_SIZE/256)
25 // default test number of filedescs
26 #define DEFAULT_NUM_FD 16
27 // default test number of cache pages
28 #define DEFAULT_NUM_CACHE_PAGES 8
29 
30 // When testing, test bench create reference files for comparison on
31 // the actual hard drive. By default, put these on ram drive for speed.
32 #define TEST_PATH "/dev/shm/spiffs/test-data/"
33 
34 #define ASSERT(c, m) real_assert((c),(m), __FILE__, __LINE__);
35 void real_assert(int c, const char *n, const char *file, int l);
36 
38 
39 // test using filesystem magic
40 #ifndef SPIFFS_USE_MAGIC
41 #define SPIFFS_USE_MAGIC 1
42 #endif
43 // test using filesystem magic length
44 #ifndef SPIFFS_USE_MAGIC_LENGTH
45 #define SPIFFS_USE_MAGIC_LENGTH 1
46 #endif
47 // test using extra param in callback
48 #ifndef SPIFFS_HAL_CALLBACK_EXTRA
49 #define SPIFFS_HAL_CALLBACK_EXTRA 1
50 #endif
51 // test using filehandle offset
52 #ifndef SPIFFS_FILEHDL_OFFSET
53 #define SPIFFS_FILEHDL_OFFSET 1
54 // use this offset
55 #define TEST_SPIFFS_FILEHDL_OFFSET 0x1000
56 #endif
57 
58 #ifdef NO_TEST
59 #define SPIFFS_LOCK(fs)
60 #define SPIFFS_UNLOCK(fs)
61 #else
62 struct spiffs_t;
63 extern void test_lock(struct spiffs_t *fs);
64 extern void test_unlock(struct spiffs_t *fs);
65 #define SPIFFS_LOCK(fs) test_lock(fs)
66 #define SPIFFS_UNLOCK(fs) test_unlock(fs)
67 #endif
68 
69 // dbg output
70 #define SPIFFS_DBG(_f, ...) //printf("\x1b[32m" _f "\x1b[0m", ## __VA_ARGS__)
71 #define SPIFFS_API_DBG(_f, ...) //printf("\n\x1b[1m\x1b[7m" _f "\x1b[0m", ## __VA_ARGS__)
72 #define SPIFFS_GC_DBG(_f, ...) //printf("\x1b[36m" _f "\x1b[0m", ## __VA_ARGS__)
73 #define SPIFFS_CACHE_DBG(_f, ...) //printf("\x1b[33m" _f "\x1b[0m", ## __VA_ARGS__)
74 #define SPIFFS_CHECK_DBG(_f, ...) //printf("\x1b[31m" _f "\x1b[0m", ## __VA_ARGS__)
75 
76 // needed types
77 typedef signed int s32_t;
78 typedef unsigned int u32_t;
79 typedef signed short s16_t;
80 typedef unsigned short u16_t;
81 typedef signed char s8_t;
82 typedef unsigned char u8_t;
83 
84 #endif /* PARAMS_TEST_H_ */
signed int s32_t
Definition: params_test.h:77
void test_lock(struct spiffs_t *fs)
Definition: spiffs.h:231
unsigned char u8_t
Definition: params_test.h:82
signed short s16_t
Definition: params_test.h:79
unsigned short u16_t
Definition: params_test.h:80
void real_assert(int c, const char *n, const char *file, int l)
void test_unlock(struct spiffs_t *fs)
unsigned int u32_t
Definition: params_test.h:78
signed char s8_t
Definition: params_test.h:81