Develop and Download Open Source Software

Browse CVS Repository

Contents of /enbanfukusyaya/EnbanFukusyaYa/DriveAccess/drive.h

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.10 - (show annotations) (download) (as text)
Mon Nov 1 14:34:11 2010 UTC (13 years, 5 months ago) by bananajinn
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +9 -5 lines
File MIME type: text/x-chdr
*** empty log message ***

1 /**
2 * @file drive.h
3 * @brief ドライブアクセス
4 * @author BananaJinn
5 * @version $Id: drive.h,v 1.9 2007/10/02 15:10:52 bananajinn Exp $
6 * 円盤複写屋
7 * Copyright (C) 2004-2006 BananaJinn<banana@mxh.mesh.ne.jp>.
8 */
9 #ifndef __DRIVE_H__
10 #define __DRIVE_H__
11
12 #include "aspi.h"
13 #include "netaccess.h"
14 #include "image.h"
15 #include "mkisofs.h"
16
17 #define CMDDRVTYPE_DRIVE 0
18 #define CMDDRVTYPE_NET 1
19 #define CMDDRVTYPE_IMAGE 2
20 #define CMDDRVTYPE_ISO 3
21 #define CMDDRVTYPE_MKISOFS 4
22
23 #define CMDDRVCTYPE_UNKNOWN -1
24 #define CMDDRVCTYPE_CHECKING 0
25 #define CMDDRVCTYPE_ATAPI 1
26 #define CMDDRVCTYPE_SCSI 2
27
28 #define SD_SENSEKEY(d) ((d)->sense_data[2] & 0x0f)
29 #define SD_ASC(d) ((d)->sense_data[12])
30 #define SD_ASCQ(d) ((d)->sense_data[13])
31
32 /* return value */
33 #define RET_OK 0
34 #define RET_ABORT 1
35 #define RET_READFD 2
36 #define RET_COMPLETE 3
37 #define RET_NG -1
38 #define RET_TIMEOUT -2
39 #define RET_CMDERR -3
40 #define RET_MEMERR -4
41 #define RET_SOCKET -5
42
43 /* reqflag */
44 #define REQ_NODATA 0x18
45 #define REQ_DATAOUT 0x10
46 #define REQ_DATAIN 0x08
47
48 #define SENSEDATA_SIZE 0x20
49
50 typedef struct {
51 BYTE cdb[12];
52 BYTE snskey;
53 BYTE asc;
54 BYTE ascq;
55 BYTE reqflag;
56 DWORD datalen;
57 BYTE *data;
58 WORD repeat;
59 } CMDLOG;
60
61
62 typedef struct {
63 int type; /* CMDDRVTYPE_* */
64 union {
65 DRIVE drive;
66 SOCKCB net;
67 IMAGEFILE image;
68 MKISOFS mkisofs;
69 } u;
70 BOOL own_alloc; /* この構造体でバッファメモリ管理 */
71 BYTE *data_buf;
72 int bufsize;
73 BYTE sense_data[SENSEDATA_SIZE];
74 int cmd_type; /* CMDDRVCTYPE_* */
75 BYTE cmdcode;
76 CMDLOG *cmdlog;
77 int cmdlog_size;
78 int cmdlog_start;
79 int cmdlog_end;
80 DWORD cmdlog_maxdatalen;
81 int disc_type;
82 } CMDDRIVE;
83
84
85 #define REALDRIVE(d) ((d)->type==CMDDRVTYPE_DRIVE || (d)->type==CMDDRVTYPE_NET)
86
87
88 #ifdef __cplusplus
89 extern "C" {
90 #endif
91
92 extern int SendCmd(CMDDRIVE *drive, BYTE *cdb, DWORD buflen, BYTE reqflag);
93 extern int SendCmdLongRead(CMDDRIVE *drive, BYTE *cdb, DWORD buflen,
94 BYTE reqflag, DWORD total_blocks);
95 extern int InitializeCmdDrive(CMDDRIVE *drive, int bufsize, int cdblog_size, int type);
96 extern void FreeCmdDrive(CMDDRIVE *drive);
97 extern void CheckAtapi(CMDDRIVE *drive);
98 extern int SetDriveAspiSetting(CMDDRIVE *drive, int *ha, int *tg, DWORD *timeout);
99 extern void SetDriveBuffer(CMDDRIVE *drive, BYTE *data_buf, int bufsize);
100
101 extern int OpenDevice(CMDDRIVE *drive, int hid, int tid,
102 BOOL reader, BOOL bWaitDisc,
103 BYTE *data_buf, int bufsize);
104 extern void CloseDevice(CMDDRIVE *drive);
105 extern int OpenTempImageDevice(CMDDRIVE *drive, BOOL reader,
106 BYTE *data_buf, int bufsize,
107 const char *tmpfile);
108 extern int OpenMkisofsDevice(CMDDRIVE *drive, BYTE *data_buf, int bufsize);
109 extern int OpenISOImageDevice(CMDDRIVE *drive, BOOL reader,
110 BYTE *data_buf, int bufsize);
111 extern int OpenEnbanImageDevice(CMDDRIVE *drive, BOOL reader,
112 BYTE *data_buf, int bufsize);
113 extern int OpenNetDevice(CMDDRIVE *drive, BOOL server,
114 BYTE *data_buf, int bufsize);
115
116 #ifdef __cplusplus
117 }
118 #endif
119
120 #endif /* !__DRIVE_H__ */

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26