]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/fat_sl/common/volume.h
e65a44f8d6fd0f4bcf28d86824811076794f03af
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-Plus-FAT-SL / fat_sl / common / volume.h
1 /*\r
2  * FreeRTOS+FAT FS V1.0.0 (C) 2013 HCC Embedded\r
3  *\r
4  * The FreeRTOS+FAT SL license terms are different to the FreeRTOS license \r
5  * terms.\r
6  * \r
7  * FreeRTOS+FAT SL uses a dual license model that allows the software to be used\r
8  * under a pure GPL open source license (as opposed to the modified GPL licence\r
9  * under which FreeRTOS is distributed) or a commercial license.  Details of \r
10  * both license options follow:\r
11  * \r
12  * - Open source licensing -\r
13  * FreeRTOS+FAT SL is a free download and may be used, modified, evaluated and\r
14  * distributed without charge provided the user adheres to version two of the \r
15  * GNU General Public License (GPL) and does not remove the copyright notice or \r
16  * this text.  The GPL V2 text is available on the gnu.org web site, and on the\r
17  * following URL: http://www.FreeRTOS.org/gpl-2.0.txt.\r
18  * \r
19  * - Commercial licensing -\r
20  * Businesses and individuals who for commercial or other reasons cannot comply\r
21  * with the terms of the GPL V2 license must obtain a commercial license before \r
22  * incorporating FreeRTOS+FAT SL into proprietary software for distribution in \r
23  * any form.  Commercial licenses can be purchased from \r
24  * http://shop.freertos.org/fat_sl and do not require any source files to be \r
25  * changed.\r
26  *\r
27  * FreeRTOS+FAT SL is distributed in the hope that it will be useful.  You\r
28  * cannot use FreeRTOS+FAT SL unless you agree that you use the software 'as\r
29  * is'.  FreeRTOS+FAT SL is provided WITHOUT ANY WARRANTY; without even the\r
30  * implied warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A\r
31  * PARTICULAR PURPOSE. Real Time Engineers Ltd. and HCC Embedded disclaims all\r
32  * conditions and terms, be they implied, expressed, or statutory.\r
33  *\r
34  * http://www.FreeRTOS.org\r
35  * http://www.FreeRTOS.org/FreeRTOS-Plus\r
36  *\r
37  */\r
38 \r
39 #ifndef __VOLUME_H\r
40 #define __VOLUME_H\r
41 \r
42 #include "config_fat_sl.h"\r
43 \r
44 #include "../../version/ver_fat_sl.h"\r
45 #if VER_FAT_SL_MAJOR != 3 || VER_FAT_SL_MINOR != 2\r
46  #error Incompatible FAT_SL version number!\r
47 #endif\r
48 \r
49 #ifdef __cplusplus\r
50 extern "C" {\r
51 #endif\r
52 \r
53 \r
54 typedef struct\r
55 {\r
56   unsigned char  sector_per_cluster;\r
57   unsigned char  number_of_FATs;\r
58   unsigned char  media_descriptor;\r
59   unsigned long  rootcluster;\r
60   unsigned long  sector_per_FAT;\r
61   unsigned long  sector_per_FAT32;\r
62   unsigned long  serial_number;\r
63 } F_BOOTRECORD;\r
64 \r
65 \r
66 typedef struct\r
67 {\r
68   unsigned long  sector; /*start sector*/\r
69   unsigned long  num;    /*number of sectors*/\r
70 } F_SECTOR;\r
71 \r
72 \r
73 typedef struct\r
74 {\r
75   unsigned char  state;\r
76   F_BOOTRECORD   bootrecord;\r
77   F_SECTOR       firstfat;\r
78   F_SECTOR       root;\r
79   F_SECTOR       _tdata;\r
80 \r
81   unsigned long  actsector;\r
82   unsigned long  fatsector;\r
83 \r
84   unsigned long  lastalloccluster;\r
85   unsigned char  modified;\r
86   char           cwd[F_MAXPATH]; /*current working folder in this volume*/\r
87   unsigned char  mediatype;\r
88   unsigned long  maxcluster;\r
89 } F_VOLUME;\r
90 \r
91 \r
92 enum\r
93 {\r
94 /*  0 */\r
95   F_STATE_NONE,\r
96 \r
97 /*  1 */ F_STATE_NEEDMOUNT,\r
98 \r
99 /*  2 */ F_STATE_WORKING\r
100 };\r
101 \r
102 \r
103 extern F_VOLUME  gl_volume;\r
104 extern F_FILE    gl_file;\r
105 extern char      gl_sector[F_SECTOR_SIZE]; /* actual sector */\r
106 \r
107 unsigned char _f_getvolume ( void );\r
108 \r
109 #ifdef __cplusplus\r
110 }\r
111 #endif\r
112 \r
113 #endif /* ifndef __VOLUME_H */\r