#ifndef _MASTER_H_
#define _MASTER_H_

#include "common.h"

#define TOTAL_COMMAND_COUNT		8

#define HPI_CMD_UNKNOWN			0
#define HPI_CMD_STATUSLIST		1
#define HPI_CMD_ERRORLIST		2

#define MASTER_BUFFER_SIZE		0x100
/*
typedef struct
{
	union
	{
		unsigned int buffer[MASTER_BUFFER_SIZE];
		TPacket packet;
	} tx;
	
	union
	{
		unsigned int buffer[MASTER_BUFFER_SIZE];
		TPacket packet;
	} rx;
	
	int retry_count;
	unsigned int timeout10ms;
	unsigned int packetID;
	unsigned short current_command;
	unsigned short cpbIndex;

} TMasterData;

typedef struct
{
	TMasterData data[CLIENT_COUNT];
} TMaster;
*/

/*
typedef int (*funcMakeCommand) (TMasterData *);
typedef void (*funcResponseCommand) (TPacket *, int);
typedef void (*funcErrorOccured) (void);

extern funcMakeCommand OnMakeCommand[TOTAL_COMMAND_COUNT];
extern funcResponseCommand OnResponseReceive[TOTAL_COMMAND_COUNT];
extern funcErrorOccured OnErrorOccured[TOTAL_COMMAND_COUNT];
*/

extern TCPBDeviceInfo CPBDeviceInfo[SYSTEM_CPB_COUNT];

extern volatile unsigned int dummy_fin;

void Master10msTimer();
void Master_Process();
void MasterPushCommand(int dst_cpb_index, unsigned short command);

#endif
