//-----------------------------------------------------------------------------
//                           Shell Packet Accessory
//
// $Workfile: shellPacket.h $
// $Author: Mdean $
// $Date: 10/02/03 17:23 $
// $Revision: 2 $
//
// Copyright (c) 2002-3 Sony Computer Entertainment Europe.
// All Rights Reserved.
//
//-----------------------------------------------------------------------------

#ifndef _SHELL_PACKET_H
#define _SHELL_PACKET_H

//-----------------------------------------------------------------------------
// T Y P E D E F S
//-----------------------------------------------------------------------------

#define SHELL_PACKET_UNPACK_S32 0x60
#define SHELL_PACKET_UNPACK_S16 0x61
#define SHELL_PACKET_UNPACK_S8 0x62
#define SHELL_PACKET_UNPACK_V2_32 0x64
#define SHELL_PACKET_UNPACK_V2_16 0x65
#define SHELL_PACKET_UNPACK_V2_8 0x66
#define SHELL_PACKET_UNPACK_V3_32 0x68
#define SHELL_PACKET_UNPACK_V3_16 0x69
#define SHELL_PACKET_UNPACK_V3_8 0x6a
#define SHELL_PACKET_UNPACK_V4_32 0x6c
#define SHELL_PACKET_UNPACK_V4_16 0x6d
#define SHELL_PACKET_UNPACK_V4_8 0x6e
#define SHELL_PACKET_UNPACK_V4_5 0x6f

typedef enum
{
	SHELLPACKET_GIFTAG_TYPE_PACKED	=0,
	SHELLPACKET_GIFTAG_TYPE_REGLIST	=1,
	SHELLPACKET_GIFTAG_TYPE_IMAGE	=2
}	EShellPacketGifTagType;


//-----------------------------------------------------------------------------
// P R O T O T Y P E S
//-----------------------------------------------------------------------------

#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif

void shellPacketInit(void);
int shellPacketBind(int list);
void shellPacketStart(u_char *pointer,u_int tte);
void shellPacketPad(u_int word);

// General data functions
void *shellPacketAddULong128(u_long128 data);
void *shellPacketAddULong(u_long data);
void *shellPacketAddUInt(u_int data);
void *shellPacketAddFloat(float data);
void *shellPacketAddUShort(u_short data);
void *shellPacketAddUChar(u_char data);

void *shellPacketAddULong128x2(u_long128 data1,u_long128 data2);
void *shellPacketAddULongx2(u_long data1,u_long data2);
void *shellPacketAddUIntx2(u_int data1, u_int data2);
void *shellPacketAddFloatx2(float data1, float data2);
void *shellPacketAddUShortx2(u_short data1, u_short data2);
void *shellPacketAddUCharx2(u_char data1, u_char data2);

void *shellPacketAddULong128x3(u_long128 data1, u_long128 data2, u_long128 data3);
void *shellPacketAddULongx3(u_long data1, u_long data2, u_long data3);
void *shellPacketAddUIntx3(u_int data1, u_int data2, u_int data3);
void *shellPacketAddFloatx3(float data1, float data2, float data3);
void *shellPacketAddUShortx3(u_short data1, u_short data2, u_short data3);
void *shellPacketAddUCharx3(u_char data1, u_char data2, u_char data3);

void *shellPacketAddULong128x4(u_long128 data1, u_long128 data2, u_long128 data3, u_long128 data4);
void *shellPacketAddULongx4(u_long data1, u_long data2, u_long data3, u_long data4);
void *shellPacketAddUIntx4(u_int data1, u_int data2, u_int data3, u_int data4);
void *shellPacketAddFloatx4(float data1, float data2, float data3, float data4);
void *shellPacketAddUShortx4(u_short data1, u_short data2, u_short data3, u_short data4);
void *shellPacketAddUCharx4(u_char data1, u_char data2, u_char data3, u_char data4);

// DMA list functions
void *shellPacketAddDmaTag(u_int id,u_char *address,u_short qwc, u_int irq, u_int pce);
void *shellPacketEndDmaTag(void);

// GIF specific functions
void *shellPacketAddGifTag(int eop,int pre,int prim,EShellPacketGifTagType type,u_int nreg,u_long regs);
void *shellPacketAddGsRegister(u_long rnum, u_long rdata);
#define shellPacketAddGsRegister(a,b) shellPacketAddULongx2(b,a)

void *shellPacketEndGifTag(void);

// VIF specific functions
void shellPacketAddVifCode(u_int vifcode);
void *shellPacketEndVifCode(void);
void shellPacketHandleVifUnpack(u_int pad,u_int calculate);

#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif

#endif



