00001 #ifndef FS_PHATFS_H_ 00002 #define FS_PHATFS_H_ 00003 00004 /* 00005 * Copyright (C) 2005-2006 by egnite Software GmbH. All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * 1. Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 2. Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in the 00015 * documentation and/or other materials provided with the distribution. 00016 * 3. Neither the name of the copyright holders nor the names of 00017 * contributors may be used to endorse or promote products derived 00018 * from this software without specific prior written permission. 00019 * 00020 * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS 00021 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00022 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00023 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE 00024 * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00025 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00026 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 00027 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00028 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00029 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 00030 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00031 * SUCH DAMAGE. 00032 * 00033 * For additional information see http://www.ethernut.de/ 00034 */ 00035 00067 #include <sys/types.h> 00068 #include <sys/file.h> 00069 #include <sys/device.h> 00070 00071 #include <fs/phatdir.h> 00072 00077 00081 typedef struct _PHATFILE { 00083 u_long f_pos; 00085 u_long f_clust; 00087 u_long f_clust_pos; 00089 u_long f_sect_pos; 00091 u_long f_clust_prv; 00093 u_long f_mode; 00095 PHATDIRENT f_dirent; 00101 u_long f_de_sect; 00103 u_long f_de_offs; 00105 u_int f_de_dirty; 00110 u_short f_pde_clust; 00112 u_short f_pde_clusthi; 00113 } PHATFILE; 00114 00116 #define PHATEOC 0x0FFFFFF8 00117 00122 00124 #define PHAT_FATTR_RDONLY 0x01 00125 00126 #define PHAT_FATTR_HIDDEN 0x02 00127 00128 #define PHAT_FATTR_SYSTEM 0x04 00129 00130 #define PHAT_FATTR_VOLID 0x08 00131 00132 #define PHAT_FATTR_DIR 0x10 00133 00136 #define PHAT_FATTR_ARCHIV 0x20 00137 00139 #define PHAT_FATTR_LFN (PHAT_FATTR_RDONLY | PHAT_FATTR_HIDDEN | PHAT_FATTR_SYSTEM | PHAT_FATTR_VOLID) 00140 00142 #define PHAT_FATTR_FILEMASK 0x37 00143 00146 00147 00148 #include <fs/phat12.h> 00149 #include <fs/phat16.h> 00150 #include <fs/phat32.h> 00151 00152 extern NUTDEVICE devPhat0; 00153 extern NUTDEVICE devPhat1; 00154 00155 extern u_long AllocFirstCluster(NUTFILE * nfp); 00156 00157 extern NUTFILE *PhatFileOpen(NUTDEVICE * dev, CONST char *path, int mode, int acc); 00158 extern int PhatFileClose(NUTFILE * nfp); 00159 extern int PhatFileWrite(NUTFILE * nfp, CONST void *buffer, int len); 00160 #ifdef __HARVARD_ARCH__ 00161 extern int PhatFileWrite_P(NUTFILE * nfp, PGM_P buffer, int len); 00162 #endif 00163 extern int PhatFileRead(NUTFILE * nfp, void *buffer, int size); 00164 00165 #endif