1 /*
2     OWFS -- One-Wire filesystem
3     OWHTTPD -- One-Wire Web Server
4     Written 2003 Paul H Alfille
5     email: paul.alfille@gmail.com
6     Released under the GPL
7     See the header file: ow.h for full attribution
8     1wire/iButton system from Dallas Semiconductor
9 */
10 
11 /* DS9490R-W USB 1-Wire master
12 
13    USB parameters:
14        Vendor ID: 04FA
15        ProductID: 2490
16 
17    Dallas controller DS2490
18 
19 */
20 
21 #ifndef OW_USB_MSG_H			/* tedious wrapper */
22 #define OW_USB_MSG_H
23 
24 #if OW_USB						/* conditional inclusion of USB */
25 
26 
27 /* All the rest of the code sees is the DS9490_detect routine and the iroutine structure */
28 
29 GOOD_OR_BAD USB_Control_Msg(BYTE bRequest, UINT wValue, UINT wIndex, const struct parsedname *pn);
30 GOOD_OR_BAD DS9490_open(struct connection_in *in);
31 
32 #define DS9490_getstatus_BUFFER ( 16 )
33 #define DS9490_getstatus_BUFFER_LENGTH ( DS9490_getstatus_BUFFER * 2 )
34 RESET_TYPE DS9490_getstatus(BYTE * buffer, int * readlen, const struct parsedname *pn);
35 SIZE_OR_ERROR DS9490_read(BYTE * buf, size_t size, const struct parsedname *pn);
36 SIZE_OR_ERROR DS9490_write(BYTE * buf, size_t size, const struct parsedname *pn);
37 void DS9490_close(struct connection_in *in);
38 void DS9490_port_setup( libusb_device * dev, struct port_in * pin ) ;
39 
40 // Mode Command Code Constants
41 #define ONEWIREDEVICEDETECT               0xA5
42 #define COMMCMDERRORRESULT_NRS            0x01
43 #define COMMCMDERRORRESULT_SH             0x02
44 
45 extern char badUSBname[] ;
46 
47 #define CONTROL_CMD     0x00
48 #define COMM_CMD        0x01
49 #define MODE_CMD        0x02
50 #define TEST_CMD        0x03
51 
52 #define CTL_RESET_DEVICE        0x0000
53 #define CTL_START_EXE           0x0001
54 #define CTL_RESUME_EXE          0x0002
55 #define CTL_HALT_EXE_IDLE       0x0003
56 #define CTL_HALT_EXE_DONE       0x0004
57 #define CTL_FLUSH_COMM_CMDS     0x0007
58 #define CTL_FLUSH_CV_BUFFER     0x0008
59 #define CTL_FLUSH_CMT_BUFFER    0x0009
60 #define CTL_GET_COMM_CMDS       0x000A
61 
62 // Device Status Flags
63 #define STATUSFLAGS_SPUA                       0x01	// if set Strong Pull-up is active
64 #define STATUSFLAGS_PRGA                       0x02	// if set a 12V programming pulse is being generated
65 #define STATUSFLAGS_12VP                       0x04	// if set the external 12V programming voltage is present
66 #define STATUSFLAGS_PMOD                       0x08	// if set the DS2490 powered from USB and external sources
67 #define STATUSFLAGS_HALT                       0x10	// if set the DS2490 is currently halted
68 #define STATUSFLAGS_IDLE                       0x20	// if set the DS2490 is currently idle
69 
70 #endif							/* OW_USB */
71 
72 #endif /* OW_USB_MSG_H */
73