Use TopfieldUSBEcode for received values too.
[MacTF.git] / TfDllEx.h
blobea957aa23ef363439ae80e5beb047d4f95558fc3
2 #ifndef TFDLLEX_H
3 #define TFDLLEX_H
5 // -----------------------------------------------------------------------------
6 #ifndef word
7 typedef unsigned short word;
8 #endif
9 #ifndef dword
10 typedef unsigned long dword;
11 #endif
12 #ifndef byte
13 typedef unsigned char byte;
14 #endif
16 // -----------------------------------------------------------------------------
17 #define MAX_UsbSendBlockSize 0x10000
18 #define MAX_UsbBlockSize 0xffff
19 #define MAX_UsbFileDataSize 0xfe00
21 #define MAX_UsbDataSize (MAX_UsbBlockSize-16)
23 // -----------------------------------------------------------------------------
24 #define USB_CmdNone 0x00000000
26 #define USB_Fail 0x00000001
27 #define USB_Success 0x00000002
28 #define USB_Cancel 0x00000003
30 #define USB_CmdReady 0x00000100
31 #define USB_CmdReset 0x00000101
32 #define USB_CmdTurbo 0x00000102
34 // Hdd Cmd
35 #define USB_CmdHddSize 0x00001000
36 #define USB_DataHddSize 0x00001001
38 #define USB_CmdHddDir 0x00001002
39 #define USB_DataHddDir 0x00001003
40 #define USB_DataHddDirEnd 0x00001004
42 #define USB_CmdHddDel 0x00001005
43 #define USB_CmdHddRename 0x00001006
44 #define USB_CmdHddCreateDir 0x00001007
46 #define USB_CmdHddFileSend 0x00001008
47 #define USB_DataHddFileStart 0x00001009
48 #define USB_DataHddFileData 0x0000100A
49 #define USB_DataHddFileEnd 0x0000100B
51 // -----------------------------------------------------------------------------
52 // Usb Error Code
53 #define USB_OK 0x00000000
54 #define USB_Err_Crc 0x00000001
55 #define USB_Err_UnknownCmd 0x00000002
56 #define USB_Err_InvalidCmd 0x00000003
57 #define USB_Err_Unknown 0x00000004
58 #define USB_Err_Size 0x00000005
59 #define USB_Err_RunFail 0x00000006
60 #define USB_Err_Memory 0x00000007
62 // -----------------------------------------------------------------------------
63 // File send direct
64 #define USB_FileToDevice 0x00
65 #define USB_FileToHost 0x01
67 // -----------------------------------------------------------------------------
68 // File Attribute
69 #define USB_FileTypeFolder 0x01
70 #define USB_FileTypeNormal 0x02
72 // -----------------------------------------------------------------------------
73 #define USB_FileTypeSize 114
74 #define USB_FileNameSize 95
76 // -----------------------------------------------------------------------------
77 // -----------------------------------------------------------------------------
78 extern "C" __declspec(dllimport) void InitDevice( void );
79 extern "C" __declspec(dllimport) BOOL DeviceArrival( char *pDeviceName );
80 extern "C" __declspec(dllimport) BOOL DeviceRemoval( char *pDeviceName );
81 extern "C" __declspec(dllimport) BOOL GetDeviceVidPid( DWORD *pVid, DWORD *pPid );
82 extern "C" __declspec(dllimport) BOOL StartPnpNotice( HWND hwnd );
83 extern "C" __declspec(dllimport) BOOL TryDeviceOpen( void );
85 // -----------------------------------------------------------------------------
86 extern "C" __declspec(dllimport) BOOL UsbWrite( byte *pBuf, DWORD size );
87 extern "C" __declspec(dllimport) dword UsbRead( byte *pBuf, DWORD size );
88 extern "C" __declspec(dllimport) BOOL UsbCommandSend( dword cmd, byte *pBuf, dword size );
90 //------------------------------------------------------------------------------
91 extern "C" __declspec(dllimport) word GetCrc16(void *data, unsigned long n);
92 extern "C" __declspec(dllimport) word Get16bit(void *p);
93 extern "C" __declspec(dllimport) void Put16bit(void *p, word data);
94 extern "C" __declspec(dllimport) dword Get24bit(void *p);
95 extern "C" __declspec(dllimport) void Put24bit(void *p, dword data);
96 extern "C" __declspec(dllimport) dword Get32bit(void *p);
97 extern "C" __declspec(dllimport) void Put32bit(void *p, dword data);
98 extern "C" __declspec(dllimport) byte ExtractMjd(word mjd, word *year, byte *month, byte *day, byte *weekDay);
99 extern "C" __declspec(dllimport) word MakeMjd(word year, byte month, byte day);
101 //------------------------------------------------------------------------------
102 extern "C" __declspec(dllimport) BOOL UsbTaskFileSend( char *pDestName, char *pSrcName, HWND hWnd, WPARAM wParam );
103 extern "C" __declspec(dllimport) word UsbTaskGetPercent( void );
104 extern "C" __declspec(dllimport) BOOL UsbTaskCancel( void );
105 extern "C" __declspec(dllimport) BOOL UsbTaskFileReceive( char *pDestName, char *pSrcName, HWND hWnd, WPARAM wParam );
108 // -----------------------------------------------------------------------------
109 #endif TFDLLEX_H