SAM4S-EK_FreeRTOS+FAT-SL  1.0
An example project to test the functionality of FreeRTOS+FAT-SL using SD card as data storage medium
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
dir.h
Go to the documentation of this file.
1 /*
2  * FreeRTOS+FAT SL V1.0.1 (C) 2014 HCC Embedded
3  *
4  * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license
5  * terms.
6  *
7  * FreeRTOS+FAT SL uses a dual license model that allows the software to be used
8  * under a standard GPL open source license, or a commercial license. The
9  * standard GPL license (unlike the modified GPL license under which FreeRTOS
10  * itself is distributed) requires that all software statically linked with
11  * FreeRTOS+FAT SL is also distributed under the same GPL V2 license terms.
12  * Details of both license options follow:
13  *
14  * - Open source licensing -
15  * FreeRTOS+FAT SL is a free download and may be used, modified, evaluated and
16  * distributed without charge provided the user adheres to version two of the
17  * GNU General Public License (GPL) and does not remove the copyright notice or
18  * this text. The GPL V2 text is available on the gnu.org web site, and on the
19  * following URL: http://www.FreeRTOS.org/gpl-2.0.txt.
20  *
21  * - Commercial licensing -
22  * Businesses and individuals who for commercial or other reasons cannot comply
23  * with the terms of the GPL V2 license must obtain a commercial license before
24  * incorporating FreeRTOS+FAT SL into proprietary software for distribution in
25  * any form. Commercial licenses can be purchased from
26  * http://shop.freertos.org/fat_sl and do not require any source files to be
27  * changed.
28  *
29  * FreeRTOS+FAT SL is distributed in the hope that it will be useful. You
30  * cannot use FreeRTOS+FAT SL unless you agree that you use the software 'as
31  * is'. FreeRTOS+FAT SL is provided WITHOUT ANY WARRANTY; without even the
32  * implied warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A
33  * PARTICULAR PURPOSE. Real Time Engineers Ltd. and HCC Embedded disclaims all
34  * conditions and terms, be they implied, expressed, or statutory.
35  *
36  * http://www.FreeRTOS.org
37  * http://www.FreeRTOS.org/FreeRTOS-Plus
38  *
39  */
40 
41 #ifndef __DIR_H
42 #define __DIR_H
43 
44 #include "../../version/ver_fat_sl.h"
45 #if VER_FAT_SL_MAJOR != 5 || VER_FAT_SL_MINOR != 2
46  #error Incompatible FAT_SL version number!
47 #endif
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 
54 /* definitions for ctime */
55 #define F_CTIME_SEC_SHIFT 0
56 #define F_CTIME_SEC_MASK 0x001f /*0-30 in 2seconds*/
57 #define F_CTIME_MIN_SHIFT 5
58 #define F_CTIME_MIN_MASK 0x07e0 /*0-59 */
59 #define F_CTIME_HOUR_SHIFT 11
60 #define F_CTIME_HOUR_MASK 0xf800 /*0-23*/
61 
62 
63 /* definitions for cdate */
64 #define F_CDATE_DAY_SHIFT 0
65 #define F_CDATE_DAY_MASK 0x001f /*0-31*/
66 #define F_CDATE_MONTH_SHIFT 5
67 #define F_CDATE_MONTH_MASK 0x01e0 /*1-12*/
68 #define F_CDATE_YEAR_SHIFT 9
69 #define F_CDATE_YEAR_MASK 0xfe00 /*0-119 (1980+value)*/
70 
71 
72 #define NTRES_LOW 0x08 /*lower case name*/
73 
74 
75 typedef struct
76 {
77  unsigned char name[F_MAXNAME]; /* 8+3 */
78  unsigned char ext[F_MAXEXT];
79  unsigned char attr; /* 00ADVSHR */
80 
81  unsigned char ntres; /* FAT32 only */
82  unsigned char crttimetenth; /* FAT32 only */
83  unsigned char crttime[2]; /* FAT32 only */
84  unsigned char crtdate[2]; /* FAT32 only */
85  unsigned char lastaccessdate[2]; /* FAT32 only */
86 
87  unsigned char clusterhi[2]; /* FAT32 only */
88  unsigned char ctime[2];
89  unsigned char cdate[2];
90  unsigned char clusterlo[2]; /* fat12,fat16,fat32 */
91  unsigned char filesize[4];
92 } F_DIRENTRY;
93 
94 
95 unsigned char _f_getdirsector ( unsigned long );
96 unsigned char _f_findfilewc ( char *, char *, F_POS *, F_DIRENTRY * *, unsigned char );
97 unsigned char _f_findpath ( F_NAME *, F_POS * );
98 unsigned long _f_getdecluster ( F_DIRENTRY * );
99 
100 unsigned char _f_writedirsector ( void );
101 void _f_setdecluster ( F_DIRENTRY *, unsigned long );
102 unsigned char _f_addentry ( F_NAME *, F_POS *, F_DIRENTRY * * );
103 
104 #ifdef __cplusplus
105 }
106 #endif
107 
108 #endif /* ifndef __DIR_H */
unsigned char ntres
Definition: dir.h:81
unsigned char crttimetenth
Definition: dir.h:82
void _f_setdecluster(F_DIRENTRY *, unsigned long)
Definition: dir.c:333
Definition: fat_sl.h:58
unsigned char _f_findpath(F_NAME *, F_POS *)
Definition: dir.c:365
#define F_MAXNAME
Definition: fat_sl.h:55
unsigned long _f_getdecluster(F_DIRENTRY *)
Definition: dir.c:305
Definition: dir.h:75
unsigned char attr
Definition: dir.h:79
unsigned char _f_addentry(F_NAME *, F_POS *, F_DIRENTRY **)
Definition: dir.c:768
Definition: fat_sl.h:65
unsigned char _f_getdirsector(unsigned long)
unsigned char _f_writedirsector(void)
unsigned char _f_findfilewc(char *, char *, F_POS *, F_DIRENTRY **, unsigned char)
Definition: dir.c:78
#define F_MAXEXT
Definition: fat_sl.h:56