http://elm-chan.org/fsw/ff/00index_e.html
http://elm-chan.org/fsw/ff/archives.html
ChaNさんによるFatFSに関して見ている(ソースのバージョンはR0.13)。
(R0.13のR0.12cバグ修正と関連して)。
Fixed exFAT FAT entry can be collapsed when write or lseek operation to the existing file is done. (appeared at R0.12c)
ff.hにおいてFATFS構造体が定義されている。その中で気になっているメンバは以下。
ff.h
...
BYTE win[FF_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */
} FATFS;
win[]の値はどこでセットされているのか?
sync_fs()において以下のような実装で値がセットされている。
st_word()というのはstoreする関数のようだ。他にst_dword()とst_qword()がある。
st_word(fs->win + BS_55AA, 0xAA55);
put_fat()においても以下のような実装で値がセットされている。
st_dword(fs->win + clst * 4 % SS(fs), val);
これらの値がdisk_write()においてData to be written
として使用されているようだ。