NetBurner 3.5.8
PDF Version
cardtype-ram.h
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4
5/*
6 RAM-drive card-type selection for the EFFS-FAT RamDrive example.
7
8 Why this file exists
9 --------------------
10 The other EFFS FAT examples select their storage device in the shared
11 "cardtype.h", which lives in examples/_common/EFFS/FAT/src and is copied into
12 each example's src/ directory at build time. Because it is a *common* file,
13 any local edit to it is overwritten on the next build (and deleted by
14 "make clean"), so it is not a reliable place to force this example onto the
15 RAM drive. This header is example-owned and is NOT a common file, so it
16 survives clean builds and SDK updates.
17
18 Why the include guard is named _CARDTYPE_H (and not _CARDTYPE_RAM_H)
19 -------------------------------------------------------------------
20 This is deliberate, not a copy/paste slip. The shared "cardtype.h" guards its
21 body with:
22
23 #ifndef _CARDTYPE_H
24 #define _CARDTYPE_H
25 ... defines USE_MMC (or USE_SDHC) and EXT_FLASH_DRV_NUM ...
26 #endif
27
28 main.cpp includes THIS file before it includes FileSystemUtils.h. Because we
29 define _CARDTYPE_H here first, when FileSystemUtils.h later pulls in the
30 shared "cardtype.h", that header's include guard is already satisfied and its
31 body is skipped entirely. The net effect is that main.cpp sees only the
32 RAM configuration below -- it never picks up the shared header's USE_MMC, so
33 there is no conflicting/duplicate card-type define in this translation unit.
34
35 Note this trick only affects main.cpp. The shared FileSystemUtils.cpp is a
36 separate translation unit that includes the real "cardtype.h" (USE_MMC), so
37 its EXT_FLASH_DRV_NUM-based helpers (InitExtFlash, DisplayEffsSpaceStats,
38 UnmountExtFlash, FormatExtFlash) remain compiled for the SD/MMC drive. That is
39 why main.cpp performs its own mount/stat/unmount against the RAM drive and
40 only reuses the current-drive helpers (DumpDir, ReadWriteTest). See the
41 ReadMe, "Selecting the RAM Drive", for the full explanation.
42*/
43#ifndef _CARDTYPE_H
44#define _CARDTYPE_H
45
46#define USE_RAM // RAM file system (see EFFS-FAT-RamDrive ReadMe)
47
48#define EXT_FLASH_DRV_NUM (F_RAM_DRIVE0)
49
50#endif /* _CARDTYPE_H */