From c30a15e590c7e5bfd27e4704c81648071f11d51f Mon Sep 17 00:00:00 2001 From: Donggeun Kim Date: Mon, 24 Oct 2011 21:15:28 +0000 Subject: FAT: Add FAT write feature In some cases, saving data in RAM as a file with FAT format is required. This patch allows the file to be written in FAT formatted partition. The usage is similar with reading a file. First, fat_register_device function is called before file_fat_write function in order to set target partition. Then, file_fat_write function is invoked with desired file name, start ram address for writing data, and file size. Signed-off-by: Donggeun Kim Signed-off-by: Kyungmin Park --- include/fat.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/fat.h') diff --git a/include/fat.h b/include/fat.h index 15dbf1094c..4c92442fd3 100644 --- a/include/fat.h +++ b/include/fat.h @@ -99,6 +99,8 @@ #endif #define TOLOWER(c) if((c) >= 'A' && (c) <= 'Z'){(c)+=('a' - 'A');} +#define TOUPPER(c) if ((c) >= 'a' && (c) <= 'z') \ + (c) -= ('a' - 'A'); #define START(dent) (FAT2CPU16((dent)->start) \ + (mydata->fatsize != 32 ? 0 : \ (FAT2CPU16((dent)->starthi) << 16))) @@ -210,4 +212,5 @@ long file_fat_read(const char *filename, void *buffer, unsigned long maxsize); const char *file_getfsname(int idx); int fat_register_device(block_dev_desc_t *dev_desc, int part_no); +int file_fat_write(const char *filename, void *buffer, unsigned long maxsize); #endif /* _FAT_H_ */ -- cgit v1.2.3