?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 32

Line No. Rev Author Line
1 32 kaklik /*********************************************************************
2 *
3 * Microchip File System
4 *
5 *********************************************************************
6 * FileName: MPFS.h
7 * Dependencies: StackTsk.H
8 * Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F, PIC32
9 * Compiler: Microchip C32 v1.05 or higher
10 * Microchip C30 v3.12 or higher
11 * Microchip C18 v3.30 or higher
12 * HI-TECH PICC-18 PRO 9.63PL2 or higher
13 * Company: Microchip Technology, Inc.
14 *
15 * Software License Agreement
16 *
17 * Copyright (C) 2002-2009 Microchip Technology Inc. All rights
18 * reserved.
19 *
20 * Microchip licenses to you the right to use, modify, copy, and
21 * distribute:
22 * (i) the Software when embedded on a Microchip microcontroller or
23 * digital signal controller product ("Device") which is
24 * integrated into Licensee's product; or
25 * (ii) ONLY the Software driver source files ENC28J60.c, ENC28J60.h,
26 * ENCX24J600.c and ENCX24J600.h ported to a non-Microchip device
27 * used in conjunction with a Microchip ethernet controller for
28 * the sole purpose of interfacing with the ethernet controller.
29 *
30 * You should refer to the license agreement accompanying this
31 * Software for additional information regarding your rights and
32 * obligations.
33 *
34 * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT
35 * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
36 * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
37 * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
38 * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR
39 * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
40 * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
41 * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE
42 * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER
43 * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
44 * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
45 *
46 *
47 * Author Date Comment
48 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49 * Elliott Wood 07/2007 Complete rewrite as MPFS2
50 * E. Wood 04/2008 Updated as MPFS2.1
51 ********************************************************************/
52  
53 #ifndef __MPFS2_H
54 #define __MPFS2_H
55  
56  
57 /****************************************************************************
58 Section:
59 Storage Type Configurations
60 ***************************************************************************/
61 #if defined(STACK_USE_MPFS) && defined(STACK_USE_MPFS2)
62 #error Both MPFS and MPFS2 are included
63 #endif
64  
65 #if defined(MPFS_USE_EEPROM)
66 #if defined(USE_EEPROM_25LC1024)
67 #define MPFS_WRITE_PAGE_SIZE (256u) // Defines the size of a page in EEPROM
68 #else
69 #define MPFS_WRITE_PAGE_SIZE (64u) // Defines the size of a page in EEPROM
70 #endif
71 #endif
72  
73 /****************************************************************************
74 Section:
75 Type Definitions
76 ***************************************************************************/
77 #define MPFS2_FLAG_ISZIPPED ((WORD)0x0001) // Indicates a file is compressed with GZIP compression
78 #define MPFS2_FLAG_HASINDEX ((WORD)0x0002) // Indicates a file has an associated index of dynamic variables
79 #define MPFS_INVALID (0xffffffffu) // Indicates a position pointer is invalid
80 #define MPFS_INVALID_FAT (0xffffu) // Indicates an invalid FAT cache
81 #define MPFS_INVALID_HANDLE (0xffu) // Indicates that a handle is not valid
82 typedef DWORD MPFS_PTR; // MPFS Pointers are currently DWORDs
83 typedef BYTE MPFS_HANDLE; // MPFS Handles are currently stored as BYTEs
84  
85  
86 // Stores each file handle's information
87 // Handles are free when addr = MPFS_INVALID
88 typedef struct
89 {
90 MPFS_PTR addr; // Current address in the file system
91 DWORD bytesRem; // How many bytes remain in this file
92 WORD fatID; // ID of which file in the FAT was accessed
93 } MPFS_STUB;
94  
95 // Indicates the method for MPFSSeek
96 typedef enum
97 {
98 MPFS_SEEK_START = 0u, // Seek forwards from the front of the file
99 MPFS_SEEK_END, // Seek backwards from the end of the file
100 MPFS_SEEK_FORWARD, // Seek forward from the current position
101 MPFS_SEEK_REWIND // See backwards from the current position
102 } MPFS_SEEK_MODE;
103  
104 // Stores the data for an MPFS2 FAT record
105 typedef struct
106 {
107 DWORD string; // Pointer to the file name
108 DWORD data; // Address of the file data
109 DWORD len; // Length of file data
110 DWORD timestamp; // Timestamp of file
111 DWORD microtime; // Microtime stamp of file
112 WORD flags; // Flags for this file
113 } MPFS_FAT_RECORD;
114  
115 /****************************************************************************
116 Section:
117 Function Definitions
118 ***************************************************************************/
119  
120 void MPFSInit(void);
121  
122 MPFS_HANDLE MPFSOpen(BYTE* cFile);
123 #if defined(__18CXX)
124 MPFS_HANDLE MPFSOpenROM(ROM BYTE* cFile);
125 #else
126 // Non-ROM variant for C30 / C32
127 #define MPFSOpenROM(a) MPFSOpen((BYTE*) a);
128 #endif
129 MPFS_HANDLE MPFSOpenID(WORD hFatID);
130 void MPFSClose(MPFS_HANDLE hMPFS);
131  
132 BOOL MPFSGet(MPFS_HANDLE hMPFS, BYTE* c);
133 WORD MPFSGetArray(MPFS_HANDLE hMPFS, BYTE* cData, WORD wLen);
134 BOOL MPFSGetLong(MPFS_HANDLE hMPFS, DWORD* ul);
135 BOOL MPFSSeek(MPFS_HANDLE hMPFS, DWORD dwOffset, MPFS_SEEK_MODE tMode);
136 #if defined(__C30__)
137 // Assembly function to read all three bytes of program memory for 16-bit parts
138 extern DWORD ReadProgramMemory(DWORD address);
139 #endif
140  
141 MPFS_HANDLE MPFSFormat(void);
142 void MPFSPutEnd(BOOL final);
143 WORD MPFSPutArray(MPFS_HANDLE hMPFS, BYTE* cData, WORD wLen);
144  
145 DWORD MPFSGetTimestamp(MPFS_HANDLE hMPFS);
146 DWORD MPFSGetMicrotime(MPFS_HANDLE hMPFS);
147 WORD MPFSGetFlags(MPFS_HANDLE hMPFS);
148 DWORD MPFSGetSize(MPFS_HANDLE hMPFS);
149 DWORD MPFSGetBytesRem(MPFS_HANDLE hMPFS);
150 MPFS_PTR MPFSGetStartAddr(MPFS_HANDLE hMPFS);
151 MPFS_PTR MPFSGetEndAddr(MPFS_HANDLE hMPFS);
152 BOOL MPFSGetFilename(MPFS_HANDLE hMPFS, BYTE* cName, WORD wLen);
153 DWORD MPFSGetPosition(MPFS_HANDLE hMPFS);
154 WORD MPFSGetID(MPFS_HANDLE hMPFS);
155  
156 // Alias of MPFSGetPosition
157 #define MPFSTell(a) MPFSGetPosition(a)
158  
159 #endif
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3