#ifndef _CH375_DEFINED
#define _CH375_DEFINED

#ifdef __cplusplus
extern "C" {
#endif
#define TRUE 1
#define FALSE 0

DSTATUS ch375_probe(void);
//extern ch375_status(void);
DRESULT ch375_read(BYTE *, LBA_t, UINT);
DRESULT ch375_write(const BYTE *, LBA_t, UINT);
DWORD ch375_disk_capacity(void);

//#extern ch375_init()

// ch375 commands
#define CMD_GET_IC_VER	0x01
#define CMD_CHECK_EXIST  0x06
#define CMD_SET_USB_MODE  0x15
#define CMD_GET_STATUS  0x22
#define	CMD_DISK_INIT       0x51
#define	CMD_DISK_READ       0x54
#define CMD_RD_USB_DATA0  0x27
#define CMD_DISK_READ_GO    0x55
#define CMD_DISK_WRITE      0x56
#define CMD_WR_USB_DATA  0x2c	// or is it 0x2b?
#define CMD_DISK_WRITE_GO   0x57
#define CMD_DISK_CAPACITY  0x3e

/*	Switch between different USB modes.
	Input:
		00: invalid device mode (reset default)
		01: usb device, "peripheral firmware"
		02: usb device, "inner firmware"
		03: SD host, manage SD cards
		04: invalid usb host
		05: usb host, don't generate SOF
		06: usb host, generate SOF
		07: usb host, bus reset
	Output:
		0x51: success
		0x5F: failure
*/
#define MODE_HOST_0  0x05
#define MODE_HOST_1  0x07
#define  MODE_HOST_2  0x06
#define  MODE_HOST_SD  0x03
#define  MODE_DEFAULT  0x00

// ch375 status value
#define ANSW_USB_INT_SUCCESS  0x14
#define ANSW_USB_INT_DISK_READ  0x1d
#define ANSW_USB_INT_DISK_WRITE  0x1e

#ifdef __cplusplus
}
#endif

#endif
