]> git.sur5r.net Git - freertos/blob - FreeRTOS-Plus/Source/FreeRTOS-Plus-FAT-SL/api/api_mdriver.h
c10ffec07f30b9559a8bb60a144ddb67c24fd309
[freertos] / FreeRTOS-Plus / Source / FreeRTOS-Plus-FAT-SL / api / api_mdriver.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 _API_MDRIVER_H_\r
40 #define _API_MDRIVER_H_\r
41 \r
42 #include "../version/ver_mdriver.h"\r
43 #if VER_MDRIVER_MAJOR != 1 || VER_MDRIVER_MINOR != 0\r
44  #error Incompatible MDRIVER version number!\r
45 #endif\r
46 \r
47 #ifdef __cplusplus\r
48 extern "C" {\r
49 #endif\r
50 \r
51 \r
52 typedef struct\r
53 {\r
54   unsigned short  number_of_cylinders;\r
55   unsigned short  sector_per_track;\r
56   unsigned short  number_of_heads;\r
57   unsigned long   number_of_sectors;\r
58   unsigned char   media_descriptor;\r
59 \r
60   unsigned short  bytes_per_sector;\r
61 } F_PHY;\r
62 \r
63 /* media descriptor to be set in getphy function */\r
64 #define F_MEDIADESC_REMOVABLE 0xf0\r
65 #define F_MEDIADESC_FIX       0xf8\r
66 \r
67 /* return bitpattern for driver getphy function */\r
68 #define F_ST_MISSING          0x00000001\r
69 #define F_ST_CHANGED          0x00000002\r
70 #define F_ST_WRPROTECT        0x00000004\r
71 \r
72 /* Driver definitions */\r
73 typedef struct F_DRIVER  F_DRIVER;\r
74 \r
75 typedef int           ( *F_WRITESECTOR )( F_DRIVER * driver, void * data, unsigned long sector );\r
76 typedef int           ( *F_READSECTOR )( F_DRIVER * driver, void * data, unsigned long sector );\r
77 typedef int           ( *F_GETPHY )( F_DRIVER * driver, F_PHY * phy );\r
78 typedef long          ( *F_GETSTATUS )( F_DRIVER * driver );\r
79 typedef void          ( *F_RELEASE )( F_DRIVER * driver );\r
80 \r
81 typedef struct F_DRIVER\r
82 {\r
83   unsigned long  user_data;     /* user defined data */\r
84   void         * user_ptr;      /* user define pointer */\r
85 \r
86   /* driver functions */\r
87   F_WRITESECTOR          writesector;\r
88   F_READSECTOR           readsector;\r
89   F_GETPHY               getphy;\r
90   F_GETSTATUS            getstatus;\r
91   F_RELEASE              release;\r
92 } _F_DRIVER;\r
93 \r
94 typedef F_DRIVER *( *F_DRIVERINIT )( unsigned long driver_param );\r
95 \r
96 #ifdef __cplusplus\r
97 }\r
98 #endif\r
99 \r
100 #endif /* _API_MDRIVER_H_ */\r
101 \r
102 \r