Fixed build error by changing buildrequires from pkgconfig(turbo-jpeg) to libjpeg...
[platform/upstream/hplip.git] / pcard / fat.h
1 /*****************************************************************************\
2
3   fat.h - FAT12/FAT16 file system
4  
5   (c) 2004 Copyright Hewlett-Packard Development Company, LP
6
7   This program is free software; you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation; either version 2 of the License, or
10   (at your option) any later version.
11
12   This program is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with this program; if not, write to the Free Software
19   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USALP
20
21 \*****************************************************************************/
22 #ifndef _FAT_H
23 #define _FAT_H
24
25 #define FAT_HARDSECT 512  /* sector size in bytes */
26
27 /* Block size is set to the lowest common denominator. The ps325 reads 3 sectors max per command (LP?). While the ps130, ps 245,
28  * and ?? can do 8 sector reads.
29  */
30 #define FAT_BLKSIZE 3    /* block size in sectors */
31
32 typedef struct
33 {
34    char Name[16];
35    char Attr;
36    int Size;
37 } FILE_ATTRIBUTES;
38
39 typedef struct
40 {
41    char OEMID[8];                  
42    int BytesPerSector;         
43    int SectorsPerCluster;       
44    int ReservedSectors;        
45    int RootEntries;         
46    int SectorsPerFat;         
47    char VolumeLabel[11]; 
48    char SystemID[8];     
49    int WriteProtect;
50 } PHOTO_CARD_ATTRIBUTES;
51
52 /* APIs */
53 int FatInit(void);
54 int FatListDir(void);
55 int FatReadFile(char *name, int fd);
56 int FatReadFileExt(char *name, int offset, int len, void *outbuf);
57 int FatSetCWD(char *dir);
58 int FatDeleteFile(char *name); 
59 int FatFreeSpace(void);
60 int FatDirBegin(FILE_ATTRIBUTES * a);
61 int FatDirNext(FILE_ATTRIBUTES * a);
62 int FatDiskAttributes(PHOTO_CARD_ATTRIBUTES * pa);
63
64 /* System dependent external functions */
65 extern int ReadSector(int sector, int nsector, void *buf, int size);
66 extern int WriteSector(int sector, int nsector, void *buf, int size);
67
68 extern int verbose;
69
70 #if defined(WORDS_BIGENDIAN)
71 #define h2lits(A) ((((uint16_t)(A) & 0xff00) >> 8) | (((uint16_t)(A) & 0x00ff) << 8))    /* host to little-endian 16-bit value */
72 #define lit2hs h2lits                         /* little-endian to host 16-bit value */
73
74 #else
75 #define h2lits(A) (A)
76 #define lit2hs(A) (A)
77 #endif
78
79 #endif // _FAT_H