Subversion Repositories NaviCtrl

Rev

Rev 380 | Rev 433 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 380 Rev 427
Line 6... Line 6...
6
// 
6
// 
7
// Definitions
7
// Definitions
8
//                              
8
//                              
9
//________________________________________________________________________________________________________________________________________
9
//________________________________________________________________________________________________________________________________________
Line 10... Line -...
10
 
-
 
11
//#define               __USE_TIME_DATE_ATTRIBUTE
10
 
12
#define FILE_MAX_OPEN   4                               // The number of files that can accessed simultaneously. 
11
#define FILE_MAX_OPEN   4                               // The number of files that can accessed simultaneously. 
13
#define SEEK_SET        0
12
#define SEEK_SET        0
14
#define SEEK_CUR        1
13
#define SEEK_CUR        1
15
#define SEEK_END        2
14
#define SEEK_END        2
Line 37... Line 36...
37
        u8  Cache[BYTES_PER_SECTOR];    // Cache for read and write operation from or to the sd-card.
36
        u8  Cache[BYTES_PER_SECTOR];    // Cache for read and write operation from or to the sd-card.
38
        u32 SectorInCache;                              // The last sector read, which is still in the sector cache.
37
        u32 SectorInCache;                              // The last sector read, which is still in the sector cache.
39
        u8      State;                                          // State of the filepointer (used/unused/...) 
38
        u8      State;                                          // State of the filepointer (used/unused/...) 
40
} File_t;
39
} File_t;
Line 41... Line -...
41
 
-
 
-
 
40
 
42
         
41
// attribute definitions          
43
#define ATTR_NONE               0x00    // normal file
42
#define ATTR_NONE               0x00    // normal file
44
#define ATTR_READONLY           0x01    // file is readonly
43
#define ATTR_READONLY           0x01    // file is readonly
45
#define ATTR_HIDDEN                     0x02    // file is hidden
44
#define ATTR_HIDDEN                     0x02    // file is hidden
46
#define ATTR_SYSTEM                     0x04    // file is a system file
45
#define ATTR_SYSTEM                     0x04    // file is a system file
Line 58... Line 57...
58
//________________________________________________________________________________________________________________________________________
57
//________________________________________________________________________________________________________________________________________
Line 59... Line 58...
59
 
58
 
60
typedef struct
59
typedef struct
61
{
60
{
62
        File_t  fp;                                             // filepointer used to get access to the filesystemstructure
61
        File_t  fp;                                             // filepointer used to get access to the filesystemstructure
63
        s8              searchstring[11];               // findfirst and findnext will only return elements within the specified directory matching this searchstring.
62
        s8              searchstring[12];               // findfirst and findnext will only return elements within the specified directory matching this searchstring (8+3 + Terminator).
64
        s8              name[13];                               // the name of the element found within the specified directory
63
        s8              name[13];                               // the name of the element found within the specified directory
65
        u8              active;                                 // if the attribute active is set the name and the attributes of an element found within DirectoryEntryExist will be entered into the structure 
64
        u8              active;                                 // if the attribute active is set the name and the attributes of an element found within DirectoryEntryExist will be entered into the structure 
66
        u8              attribfilter;                  
65
        u8              attribfilter;                  
67
        u8              attribmask;
66
        u8              attribmask;
Line 71... Line 70...
71
// 
70
// 
72
// API to the FAT16 filesystem
71
// API to the FAT16 filesystem
73
//                              
72
//                              
74
//________________________________________________________________________________________________________________________________________
73
//________________________________________________________________________________________________________________________________________
Line -... Line 74...
-
 
74
 
75
 
75
// File System Funtions
76
u8              Fat16_Init(void);
76
u8              Fat16_Init(void);
77
u8              Fat16_Deinit(void);
77
u8              Fat16_Deinit(void);
78
u8              Fat16_IsValid(void);
78
u8              Fat16_IsValid(void);
79
s8*             FAT16_GetVolumeLabel(void);
79
s8*             FAT16_GetVolumeLabel(void);
-
 
80
 
80
       
81
// File Function        
81
File_t *fopen_(s8 * const filename, const s8 mode);
82
File_t *fopen_(s8* const filename, const s8 mode);
82
s16     fclose_(File_t *file);
83
s16     fclose_(File_t * const file);
83
u8              fexist_(s8 * const filename);
84
u8              fexist_(s8* const filename);
84
s16             fflush_(File_t * const file);
85
s16             fflush_(File_t * const file);
85
s16     fseek_(File_t * const file, s32 offset, s16 origin);
86
s16     fseek_(File_t * const file, s32 offset, s16 origin);
86
s16             fgetc_(File_t * const file);
87
s16             fgetc_(File_t * const file);
87
s16             fputc_(s8 c, File_t * const file);
88
s16             fputc_(s8 c, File_t * const file);
88
u32     fread_(void *buffer, u32 size, u32 count, File_t * const file);
89
u32     fread_(void *buffer, u32 size, u32 count, File_t * const file);
89
u32     fwrite_(void *buffer, u32 size, u32 count, File_t * const file);
90
u32     fwrite_(void *buffer, u32 size, u32 count, File_t * const file);
90
s16             fputs_(s8 * const string, File_t * const file);
91
s16             fputs_(s8 * const string, File_t * const file);
91
s8 *    fgets_(s8 * const string, s16 length, File_t * const file);
92
s8 *    fgets_(s8 * const string, s16 length, File_t * const file);
-
 
93
u8              feof_(File_t * const file);
-
 
94
u8              fdelete_(s8* const filepath);
-
 
95
 
-
 
96
// Directory Functions
92
u8              feof_(File_t * const file);
97
s8              *getcwd_(void);
93
u8              findfirst_(const s8* name, u8 attribmask, Find_t *);
98
u8              findfirst_(const s8* name, u8 attribmask, Find_t *);
94
u8              findnext_(Find_t *);
99
u8              findnext_(Find_t *);
-
 
100
u8              chdir_(s8* const dirpath);
95
u8              chdir_(s8 *folder);
101
u8              mkdir_(s8* const dirpath);
Line 96... Line 102...
96
s8              *GetPath(void);
102
u8              rmdir_(s8* const dirpath);