/*****************************************************************************
Copyright(c) 2005 Analog Devices, Inc.  All Rights Reserved. This software is 
proprietary and confidential to Analog Devices, Inc. and its licensors.
******************************************************************************

$RCSfile: adi_usbcmd.h,v $
$Revision: 1.5 $
$Date: 2007/11/14 22:38:03 $

Project:	BlackfinSDK
Title:		USB command defines
Author(s):	ADI
Revised by: bmk

Description:
			List of USB commands supported by BlackfinSDK applications
			Common file for Blackfin & PC Host

References:
			None

******************************************************************************
Tab Setting:			4
Target Processor:		ADSP-BF5xx
Target Tools Revision:	ADSP VisualDSP++ v4.5
******************************************************************************

Modification History:
====================
$Log: adi_usbcmd.h,v $
Revision 1.5  2007/11/14 22:38:03  randreol
Add AUDIO_PLAYER ID

Revision 1.3  2007/08/29 04:38:55  randreol
Modified to support porting to new USB driver

Revision 1.3  2006/11/09 03:59:41  bmk
Added support to Audio apps

*****************************************************************************/

#ifndef __ADI_USBCMD_H__
#define __ADI_USBCMD_H__

// defines for both host and device

#define	MAX_VERSION_STRING_LEN		100		// maximum length of one version string
#define VERSION_STRING_BLOCK_SIZE	(NUM_VERSION_STRINGS*MAX_VERSION_STRING_LEN)

#define LOOPBACK_HEADER_BYTES		4						// bytes in header of loopback data
#define MAX_DATA_BYTES_EZEXTENDER	0x10000					// max bytes to send
#define MIN_DATA_BYTES_EZEXTENDER	LOOPBACK_HEADER_BYTES	// min bytes to send

#define FILE_OPEN_MODE_OFFSET		0						// byte offset for mode for file open
#define FILE_OPEN_FILENAME_OFFSET	4						// byte offset for filename for file open

#define USBIO_STDIN_FD 	0		// file descriptor for stdin on Blackfin
#define USBIO_STDOUT_FD 1		// file descriptor for stdout on Blackfin
#define USBIO_STDERR_FD 2		// file descriptor for stderr on Blackfin

// List of supported USB commands
enum _USB_COMMAND
{
	NO_COMMAND,				// nothing doing here...
	GET_APP_ID,				// get the application ID
	GET_FW_VERSION,			// get the firmware version
	QUERY_SUPPORT,			// query for support
	QUERY_REPLY,			// query reply
	MEMORY_READ,			// read from specified memory on the device
	MEMORY_WRITE,			// write to specified memory on the device
	SET_PARAMS,				// Set Codec Parameters
	USBIO_START,			// run USB IO on this device
	USBIO_STOP,				// stop USB IO on this device
	USBIO_OPEN,				// open file on host
	USBIO_CLOSE,			// close file on host
	USBIO_READ,				// read file on host
	USBIO_READ_REPLY,		// read reply from host
	USBIO_WRITE,			// write file on host
	USBIO_WRITE_REPLY,		// write reply from host
	USBIO_SEEK_CUR,			// seek from current position of file on host
	USBIO_SEEK_END,			// seek from end of file on host
	USBIO_SEEK_SET,			// seek from beginning of file on host
	USBIO_SEEK_REPLY,		// seek reply from host
	USBIO_FILEPTR,			// sending file pointer
};

// USB command block structure
typedef struct _USBCB		// USB command block
{
	unsigned int ulCommand;		// command to execute
  	unsigned int ulData;		// generic data field
  	unsigned int ulCount;		// number of bytes to transfer
  	unsigned int ulParams[6];	// array of other command parameters
} USBCB, *PUSBCB;

// Version string fields
enum _VERSION_STRINGS		// version string info
{
	FW_APPLICATION_NAME,	// application name
	FW_TARGET_PROC,			// target processor
	FW_BUILD_DATE,			// build date of firmware
	FW_BUILD_TIME,			// build time of firmware
	FW_VERSION_NUMBER,		// version number of firmware
	HW_INFO,				// Ez-Kit/Hardware Info

	NUM_VERSION_STRINGS		// number of version strings
};

// List of BlackfinSDK applications supported by this Host application
enum _APPLICATION_ID		// Application ID
{
	ADI_JPEG_MJPEG=0x8001,				// JPEG-MJPEG Encoder/Decoder application
	ADI_JPEG_IMAGE_EDGE_DETECTION,		// JPEG Image Edge Detection
	ADI_MP3_PLAYER,						// MP3 Player
	ADI_WMA_PLAYER,						// WMA Player
	ADI_AAC_PLAYER,						// AAC Player
	ADI_AUDIO_PLAYER,
// Add new application id here

	NUM_SUPPORTED_APPS			// number of BlackfinSDK applications supported by this Host app
};

// List of return codes
enum _ERROR_VALUES			// error values
{
	OPERATION_PASSED = 0,
	OPERATION_FAILED,
	UNSUPPORTED_COMMAND,
	APPLICATION_NOT_SUPPORTED,
	IO_WRITE_USBCB_FAILED,
	IO_READ_USBCB_FAILED,
	IO_READ_DATA_FAILED,
	IO_WRITE_DATA_FAILED,
	OUT_OF_MEMORY_ON_HOST,
	ERROR_OPENING_FILE,
	ERROR_READING_FILE,
	NO_AVAILABLE_FILE_PTRS,
	COULD_NOT_CONNECT,	
};

#endif // __ADI_USBCMD_H__

/*****/
