 	#ifndef ___MSG___
	#define ___MSG___
//**************************************************************************
//
// The  copyright  of  this  unpublished work  rests  in  dbx  Professional
// Products,  a  division of  Harman  Music  Group,  Inc., all  rights  are
// reserved.
//
// PROJECT:             Drive Rack Main Board OS
//
// SYSTEM DEPENDENCIES: Archimedes Version 3.20E/DXT
//
// FILE NAME:           Msg.h
//
// DESCRIPTION:         Drive Rack message table.   Coded in ANSI C to
//                      provide compatibility with both the Microsoft
//                      Visual C++ 6.0 compiler and with the Archimedes
//                      C compiler for the Z80/Z180.
//
// WRITTEN BY:          John Lee 09/02                   					
//
//**************************************************************************
//
// Notes:	Tab settings for this file is +4.
//
//			This file provides an application layer interface into the drive
//			rack network API.   Primary intent behind this module is to hide the
//			detailed message format from the Windows GUI allowing the message
//			format to be changed/modified as needed without impacting the
//			application.
//
//			The following typedefs should be defined before this include file
//			to provide a platform independent means of specifying byte and word
//			wide data.
//
//				Byte -	A single byte.
//				Word -	A single little endian 16 bit word.
//				Long -	A single little endian 32 bit word.
//
//			Message length will be maintained for every message.   We can
//			therefore maintain a single field in any given message without
//			explicitely providing the field size.
//
// Defines:
//

#include "msgparam.h"
#include "sendglob.h"
#include "global.h"
#include "eep.h"

#define Network_Address	0

#define	BYTE_SIZE		1
#define WORD_SIZE		2
#define LONG_SIZE		4

/*
 * Message structs/defines:
 */

//**********************************************
// NETWORK messages
// Network messages maintain the DataLink and Network Layers
//**********************************************
/*
 * Network Messages:
 *
 *		Ping -	Format of this message fixed by Net485HD transport layer in
 *				the drive rack firmware.
 */

#define MSG_NETWORK_PING					    0x0000

#define MSG_NETWORK_DID_CONFIG				    0x0001
typedef struct
{
	Byte	Devices[16];
} Network_Did_Config_msg;


#define NETWORK_IDENTIFY_480	0x0001
#define NETWORK_IDENTIFY_240	0x0002
#define NETWORK_IDENTIFY_260	0x0003
#define MSG_NETWORK_IDENTIFY				    0x0002
typedef struct
{
	Word	network_type;		// twiddle
} network_identify_msg;

#define MSG_NETWORK_TEST_QEURRY					0x0004
typedef struct
{
	Word	num_querries;		// twiddle
} network_test_qeurry_msg;

#define MSG_NETWORK_TEST_REPLY					0x0005
typedef struct
{
	Word	num_replies;        // twiddle
} network_test_reply_msg;


#define MSG_NETWORK_EVENT_NOW_INACTIVE		    0x000E
#define MSG_NETWORK_EVENT_NOW_ACTIVE		    0x000F

//**********************************************
// SYSTEM Information
// System information is data that is requested on discovery of
// a device.  It is the data that gives a device identity.
//**********************************************

#define MSG_GUI_IDENTIFY					    0x0003
typedef struct
{
	Word	gui_version;	// twiddle
}Gui_Identity_msg;


#define MSG_SYSTEM_DO_SOFT_RESET			0x0010

#define MSG_SYSTEM_DO_START_FLASH_DOWNLOAD	0x0015
typedef struct
{
	Byte	Memory_Space;
} System_Do_Start_Flash_Download_msg;

#define MSG_SYSTEM_DID_START_FLASH_DOWNLOAD	0x0016
typedef struct
{
	Byte	Memory_Space;
} System_Did_Start_Flash_Download_msg;

#define MSG_SYSTEM_DO_END_FLASH_DOWNLOAD	0x0017

#define MSG_SYSTEM_DID_END_FLASH_DOWNLOAD	0x0018
typedef struct
{
	Word	Checksum;
	Word	Number_Blocks;
	Byte	Memory_Space;
} System_Did_End_Flash_Download_msg;

#define MSG_SYSTEM_DO_WRITE_FLASH			0x0019
#define MSG_SYSTEM_DO_WRITE_FLASH_MIN_SIZE					(WORD_SIZE+LONG_SIZE)
#define MSG_SYSTEM_DO_WRITE_FLASH_SIZE(Number_Data_Bytes)	(WORD_SIZE+LONG_SIZE+Number_Data_Bytes)
#define MSG_SYSTEM_DO_WRITE_FLASH_DATA_SIZE(Length)			(Length-WORD_SIZE-LONG_SIZE)
typedef struct
{
	Word	Block_Number;
	Long	Address;
	Byte	Data[254 - MSG_SYSTEM_DO_WRITE_FLASH_MIN_SIZE];									/* Data to be written, dynamic size. */
} System_Do_Write_Flash_msg;

#define MSG_SYSTEM_DID_WRITE_FLASH			0x0024
typedef struct
{
	Word	Block_Number;
} System_Did_Write_Flash_msg;

#define MSG_SYSTEM_REQUEST_DEVICE_DATA		    0x001A

#define MSG_SYSTEM_REPLY_DEVICE_DATA		    0x001B
typedef struct
{
	Byte	Spare;
	Byte	Shipping_Version_Number;
	Byte	Release_Sub_Version_Number;
	Byte	Sub_Version_MSN;
	Byte	Sub_Version_LSN;
	Byte	Device_ID;
	Byte	Hardware_Version_MSN;
	Byte	Hardware_Version_LSN;
} System_Reply_Device_Data_msg;

#define MSG_SYSTEM_WRITE_DEVICE_NAME		    0x001C
typedef struct
{
	Byte	Name[256-WORD_SIZE];
} System_Write_Device_Name_msg;

#define MSG_SYSTEM_WRITE_DEVICE_NAME_MIN_SIZE				(0)
#define MSG_SYSTEM_WRITE_DEVICE_NAME_SIZE(Name_Length)		(Name_Length*BYTE_SIZE)
#define MSG_SYSTEM_WRITE_DEVICE_NAME_NAME_SIZE(Length)		(Length/BYTE_SIZE)


#define MSG_SYSTEM_REQUEST_DEVICE_NAME		    0x001D

#define MSG_SYSTEM_REPLY_DEVICE_NAME		    0x001E

#define MSG_SYSTEM_REPLY_DEVICE_NAME_MIN_SIZE				(0)
#define MSG_SYSTEM_REPLY_DEVICE_NAME_SIZE(Name_Length)		(Name_Length*BYTE_SIZE)
#define MSG_SYSTEM_REPLY_DEVICE_NAME_NAME_SIZE(Length)		((Length)/BYTE_SIZE)


#define MSG_SYSTEM_DO_ATTACH				    0x001F
#define MSG_SYSTEM_DO_RELEASE				    0x0020
#define MSG_SYSTEM_REQUEST_STATE			    0x0021
#define MSG_SYSTEM_REPLY_STATE				    0x0022
typedef struct
{
	Byte	Current_Land;
	Byte	Current_Page;
	Byte	fx_pos;
} System_State_msg;

#define MSG_SYSTEM_WRITE_STATE				    0x0023

#define MSG_DEBUG_BFR_REQUEST				0x0024
#define MSG_DEBUG_BFR_REPLY					0x0025
typedef struct
{
  Byte msg_string[254];
} debug_bfr_reply_msg;

//**********************************************
// ERROR MESSAGES
// error messages are message layer error responses
// to inconsitancies in recieved messages
//**********************************************

#define MSG_ERROR_INVALID_MESSAGE			    0x002D

typedef struct
{
	Word	Received_Message_Type;	// twiddle
	Byte	Received_Length;
} Error_Invalid_Message_msg;

#define MSG_ERROR_INVALID_LENGTH			    0x002E
typedef struct
{
	Word	Received_Message_Type;	// twiddle
	Byte	Received_Length;
} Error_Invalid_Length_msg;


//
// GUI/480 firmware has this code....
//
#define MSG_ERROR_INVALID_PARAMETER			    0x002F
typedef struct
{
	Word	Received_Message_Type;	// twiddle
	Word	Parameter_Code;         // twiddle
	Word	optional_data;          // twiddle
	Word	optional_data2;         // twiddle
} Error_Invalid_Parameter_msg;

//
// Loader firmware has this message definition ....
//
//	typedef struct _T_Error_Invalid_Parameter
//	{
//		Word	Received_Message_Type;
//		Byte	Parameter_Code;
//	} T_Error_Invalid_Parameter;



//**********************************************
// Debug Messages:
// debug messages allow developers to request information
// that relates to either network or OS, or DSP statistics or data
//**********************************************

#define MSG_DEBUG_WRITE_DSP_MEMORY			    0x0030

typedef struct
{
	Byte	Chip;				// Zero based chip number.
	Byte	Memory_Space;		// Upper case character name of memory space, "X", or "Y"
	Long	Address;			// Address in DSP memory (right justified, pad MSB with zero's if needed).	long_twiddle
	Long	Values[62];			// Values to write to DSP memory (right justified, fractional, pad MSB with zero's if needed)	long_twiddle
} Debug_Write_DSP_Memory_msg;

#define MSG_DEBUG_WRITE_DSP_MEMORY_MIN_SIZE					((2*BYTE_SIZE)+LONG_SIZE)
#define MSG_DEBUG_WRITE_DSP_MEMORY_SIZE(Number_Words)		((2*BYTE_SIZE)+LONG_SIZE+(LONG_SIZE*Number_Words))
#define MSG_DEBUG_WRITE_DSP_MEMORY_VALUES_SIZE(Length)		((Length-(2*BYTE_SIZE)-LONG_SIZE)/LONG_SIZE)

#define MSG_DEBUG_REQUEST_DSP_MEMORY	   	    0x0031
typedef struct
{
	Byte	Chip;				// Zero based chip number.
	Byte	Memory_Space;		// Upper case character name of memory space, "X", or "Y"
	Long	Address;			// Address in DSP memory to extact data from	long_twiddle
	Byte	Number_Values;		// Number of words to return <= 63.
} Debug_Request_DSP_Memory_msg;
														
#define MSG_DEBUG_REPLY_DSP_MEMORY		   	    0x0032
typedef struct
{
	Byte	Chip;				// Zero based chip number.
	Byte	Memory_Space;		// Upper case character name of memory space, "X", or "Y"
	Long	Address;			// Base address into DSP memory space (right justified, pad MSB with zero's if needed).	long_twiddle
	Long	Values[62];			// Values to write to DSP memory (right justified, fractional, pad MSB with zero's if needed)	long_twiddle
} Debug_Reply_DSP_Memory_msg;

#define MSG_DEBUG_REPLY_DSP_MEMORY_MIN_SIZE					((2*BYTE_SIZE)+LONG_SIZE)
#define MSG_DEBUG_REPLY_DSP_MEMORY_SIZE(Number_Words)		((2*BYTE_SIZE)+LONG_SIZE+(LONG_SIZE*Number_Words))
#define MSG_DEBUG_REPLY_DSP_MEMORY_VALUES_SIZE(Length)		((Length-(2*BYTE_SIZE)-LONG_SIZE)/LONG_SIZE)

#define MSG_DEBUG_REQUEST_RESPONSE			    0x0033
typedef struct
{
	Byte	Data[256-WORD_SIZE];
} Debug_Request_Response_msg;

#define MSG_DEBUG_REQUEST_RESPONSE_MIN_SIZE					0
#define MSG_DEBUG_REQUEST_RESPONSE_SIZE(Number_Bytes)		((BYTE_SIZE*Number_Bytes))
#define MSG_DEBUG_REQUEST_RESPONSE_DATA_SIZE(Length)		((Length)/BYTE_SIZE)

#define MSG_DEBUG_REPLY_RESPONSE		   	    0x0034
typedef struct
{
	Byte	Data[256-WORD_SIZE];
} Debug_Reply_Response_msg;

#define MSG_DEBUG_REPLY_RESPONSE_MIN_SIZE					0
#define MSG_DEBUG_REPLY_RESPONSE_SIZE(Number_Bytes)			((BYTE_SIZE*Number_Bytes))
#define MSG_DEBUG_REPLY_RESPONSE_DATA_SIZE(Length)			((Length)/BYTE_SIZE)

#define MSG_DEBUG_QUE_TEST_REQUEST			    0x0035
#define MSG_DEBUG_QUE_TEST_REPLY			    0x0036



//**********************************************
// KPS
// kps messages are used to control and respond to
// kps key press and key commands
//**********************************************

#define MSG_KPS_KEYRESS						    0x003a
#define MSG_KPS_COMMAND						    0x003e
#define MSG_KPS_CONFIG_REPLY				    0x003b
#define MSG_KPS_CONFIG_REQUEST				    0x003c
#define MSG_KPS_LUT_REPLY					    0x003d


//**********************************************
// SYSCON
// syscon messages are used to control and respond to
// systeom control commands and responses
//**********************************************

#define MSG_SYSCON_DATA_REQUEST				    0x0040
#define MSG_SYSCON_DATA_REPLY				    0x0041
#define MSG_SYSCON_CONFIG_REQUEST			    0x0042
#define MSG_SYSCON_CONFIG_REPLY				    0x0043
#define MSG_SYSCON_PARAM_REPLY                  0x0044
#define MSG_SYSCON_GROUP_NAME_REQUEST		    0x0045
#define MSG_SYSCON_GROUP_NAME_REPLY			    0x0046
#define MSG_SYSCON_REQUEST					    0x0047
#define MSG_SYSCON_REPLY					    0x0048

typedef struct
{
	Byte					msg_data;
} syscon_reply_msg;

#define MSG_SYSCON_CLEAR					    0x0049

//**********************************************
// HOTKEY
// hotkeys are user definable keys on the 480 that can be
// used to save and restore a device to a edit page or box state
//**********************************************

	#define MSG_HOTKEY_REQUEST					    0x004d
	#define MSG_HOTKEY_REPLY1					    0x004e
	#define MSG_HOTKEY_REPLY2					    0x004f
	
	#ifdef DR_480R_CODE
	typedef struct
	{
		box_state hotkey[32];
	} msg_hotkey_reply;
	#endif
 	
//**********************************************
// Program Messages
// Program Messages handle program table operations
//**********************************************

#define MSG_PROGRAM_REQUEST_CURRENT			    0x0050
#define MSG_PROGRAM_REPLY_CURRENT			    0x0051
typedef struct
{
	Byte	Program_Number;
} Program_Reply_Current_msg;

#define MSG_PROGRAM_REQUEST_LOADED			    0x0052
#define MSG_PROGRAM_REPLY_LOADED			    0x0053
#define MSG_PROGRAM_REQUEST_CURRENT_NAME	    0x0054
#define MSG_PROGRAM_REPLY_CURRENT_NAME		    0x0055
typedef struct
{
	Byte	Fill[2];
	Byte	Name[NAME_LENGTH+1];
} Program_Reply_Current_Name_msg;

#define MSG_PROGRAM_REPLY_CURRENT_NAME_MIN_SIZE				((2*BYTE_SIZE))
#define MSG_PROGRAM_REPLY_CURRENT_NAME_SIZE(Length)			((2*BYTE_SIZE)+Length)
#define MSG_PROGRAM_REPLY_CURRENT_NAME_NAME_SIZE(Leng)		(Leng-((2*BYTE_SIZE)))

#define MSG_PROGRAM_REQUEST_NAME			    0x0056
typedef struct
{
	Byte	Program_Number;
} Program_Request_Name_msg;

#define MSG_PROGRAM_REPLY_NAME				    0x0057

typedef struct
{
	Byte	Program_Number;
	Byte	Fill;
	Byte	Name[NAME_LENGTH+1];
} Program_Reply_Name_msg;

#define MSG_PROGRAM_REPLY_NAME_MIN_SIZE						((2*BYTE_SIZE))
#define MSG_PROGRAM_REPLY_NAME_SIZE(Length)					((2*BYTE_SIZE)+Length)
#define MSG_PROGRAM_REPLY_NAME_NAME_SIZE(Leng)				(Leng-(2*BYTE_SIZE))

#define MSG_PROGRAM_DO_STORE				    0x0058
typedef struct
{
	Byte	Program_Number;
	Byte	Insert_Mode;
	Byte	Name[256-(WORD_SIZE+(2*BYTE_SIZE))];
} Program_Do_Store_msg;

#define MSG_PROGRAM_DO_STORE_MIN_SIZE						(2*BYTE_SIZE)
#define MSG_PROGRAM_DO_STORE_SIZE(Name_Length)				((2*BYTE_SIZE)+(Name_Length*BYTE_SIZE))
#define MSG_PROGRAM_DO_STORE_NAME_SIZE(Length)				((Length-(2*BYTE_SIZE))/BYTE_SIZE)

#define MSG_PROGRAM_DID_STORE				    0x0059
typedef struct
{
	Byte	Program_Number;
	Byte	Insert_Mode;
} Program_Did_Store_msg;

#define MSG_PROGRAM_DO_RETRIEVE				    0x005A
typedef struct
{
	Byte	Program_Number;
} Program_Do_Retrieve_msg;

#define MSG_PROGRAM_DID_RETRIEVE			    0x005B
typedef struct
{
	Byte	Program_Number;
} Program_Did_Retrieve_msg;

#define MSG_PROGRAM_DO_LOAD					    0x005C
#define MSG_PROGRAM_DID_LOAD				    0x005D
typedef struct
{
	Byte Program_Number;
	Byte FX_Checksum;
	Byte Param_Checksum;
} Program_Did_Load_msg;

#define MSG_PROGRAM_REQUEST					    0x005E
#define MSG_PROGRAM_REPLY_UPLOAD_HEADER		    0x005F
#define	MSG_PROGRAM_REPLY_BULK_DATA			    0x0060
typedef struct
{
	Byte	Program_Number;
	Byte	Block_Number;
	Word	Block_Offset;		// twiddle
	Byte	Data[MSGPARAM_PROGRAM_REPLY_BULK_DATA_MAX_LENGTH];
} Program_Reply_Bulk_Data;

#define MSG_PROGRAM_REPLY_BULK_DATA_MIN_SIZE				((2*BYTE_SIZE)+WORD_SIZE)
#define MSG_PROGRAM_REPLY_BULK_DATA_SIZE(Block_Size)		((2*BYTE_SIZE)+WORD_SIZE+(Block_Size*BYTE_SIZE))
#define MSG_PROGRAM_REPLY_BULK_DATA_DATA_SIZE(Length)		((Length-((2*BYTE_SIZE)+WORD_SIZE))/BYTE_SIZE)

#define MSG_PROGRAM_DO_START_DOWNLOAD		    0x0061
typedef struct
{
	Byte	Program_Number;
	Byte	Number_Blocks;
	Word	Program_Dump_Version;			// twiddle
} Program_Do_Start_Download_msg;

#define MSG_PROGRAM_WRITE_BULK_DATA			    0x0062

#define MSG_PROGRAM_WRITE_BULK_DATA_MIN_SIZE				((2*BYTE_SIZE)+WORD_SIZE+(2*BYTE_SIZE))
#define MSG_PROGRAM_WRITE_BULK_DATA_SIZE(Block_Size)		((2*BYTE_SIZE)+WORD_SIZE+(2*BYTE_SIZE)+(Block_Size*BYTE_SIZE))
#define MSG_PROGRAM_WRITE_BULK_DATA_DATA_SIZE(Length)		((Length-((2*BYTE_SIZE)+WORD_SIZE+(2*BYTE_SIZE)))/BYTE_SIZE)

#define MSG_PROGRAM_DO_END_DOWNLOAD			    0x0063
typedef struct
{
	Byte	Program_Number;
} Program_Do_End_Download_msg;

#define MSG_PROGRAM_DID_END_DOWNLOAD		    0x0064
#define MSG_PROGRAM_REQUEST_FORMAT			    0x0065
typedef struct
{
	Byte	Program_Number;
} Program_Request_Format_msg;

#define MSG_PROGRAM_REPLY_FORMAT			    0x0066
typedef struct
{
	Byte	Program_Number;
	Byte	Fill;

	Word	Program_Dump_Version;		// twiddle

	Word	Name_Base;					// twiddle
	Word	Pre_EQ_Mode_Base;           // twiddle
	Word	Dynamics_Mode_Base;         // twiddle
	Word	Xover_Mode_Base;            // twiddle
	Word	FX_Table_Base;              // twiddle
	Byte	FX_Table_Index_Size;
	Byte	FX_Table_Entry_Size;
	Word	Coef_Change_Base;           // twiddle
	Byte	Coef_Table_Index_Size;
	Byte	Coef_Table_Entry_Size;
	Word	Parameter_Table_Base;       // twiddle
	Byte	Parameter_Table_Index_Size;
} Program_Reply_Format_msg;

#define MSG_PROGRAM_REQUEST_GLOBAL_DATA		    0x0067
#define MSG_PROGRAM_REPLY_GLOBAL_DATA		    0x0068
typedef struct
{
	Word	Number_User_Programs;		// twiddle
	Word	Number_Factory_Programs;    // twiddle
	Word	Program_Dump_Version;       // twiddle
} Program_Reply_Global_Data_msg;


#define MSG_ZC_CONTROL_REQUEST		0x0069
#define MSG_ZC_CONTROL_REPLY		0x006A
typedef struct
{
	zc_info panel[6];
} zc_control_reply_msg;

//**********************************************
// Device Configuration Messages:
// Device Configuration messages control program
// configuration operations for creating programs
//**********************************************

#define MSG_CONFIG_REQUEST_ALL				    0x0070
typedef struct
{
	Byte	Program_Number;
} Config_Request_All_msg;

#define MSG_CONFIG_DO_START					    0x0071
#define MSG_CONFIG_DO_END					    0x0072
#define MSG_CONFIG_WRITE_FX_DATA			    0x0073
typedef struct
{
	Byte	Cfx;
	Byte	FX_Number;
	Byte	Input_Channel;
	Byte	Output_Channel;
	Byte	Input_FX;
	Byte	Output_FX;
	Byte	FX_Position;
	Byte	Fill;
	Word	Parameters[(256-(WORD_SIZE+(8*BYTE_SIZE)))/WORD_SIZE];		// twiddle
} Config_Write_FX_Data_msg;

#define MSG_CONFIG_WRITE_FX_DATA_MIN_SIZE					((8*BYTE_SIZE))
#define MSG_CONFIG_WRITE_FX_DATA_SIZE(Number_Parameters)	((8*BYTE_SIZE)+(Number_Parameters*WORD_SIZE))
#define MSG_CONFIG_WRITE_FX_DATA_NUMBER_PARAMS(Leng)		((Leng-((8*BYTE_SIZE)))/WORD_SIZE)

#define MSG_CONFIG_REQUEST_FX_DATA			    0x0074
typedef struct
{
	Byte	Cfx;
} Config_Request_FX_Data_msg;

#define MSG_CONFIG_REPLY_FX_DATA			    0x0075
typedef struct
{
	Byte	Cfx;
	Byte	FX_Number;
	Byte	Input_Channel;
	Byte	Output_Channel;
	Byte	Input_FX;
	Byte	Output_FX;
	Byte	FX_Position;
	Byte 	Num_Params;
} Config_Reply_FX_Data_msg;

#define MSG_CONFIG_WRITE_NUMBER_FX			    0x0076
typedef struct
{
	Byte	Number_FX;
} Config_Write_Number_FX_msg;

#define MSG_CONFIG_REQUEST_NUMBER_FX		    0x0077

#define MSG_CONFIG_REPLY_NUMBER_FX			    0x0078
typedef struct
{
	Byte	Number_FX;
} Config_Reply_Number_FX_msg;

#define MSG_CONFIG_REQUEST_FX_NAME			    0x0079
typedef struct
{
	Byte	FX_Num;
} Config_Request_FX_Name_msg;

#define MSG_CONFIG_REPLY_FX_NAME			    0x007A
typedef struct
{
	Byte	FX_Num;
	Byte	Fill;
	Byte	Name[256-(WORD_SIZE+(2*BYTE_SIZE))];
} Config_Reply_FX_Name_msg;

#define MSG_CONFIG_REPLY_FX_NAME_MIN_SIZE					((2*BYTE_SIZE))
#define MSG_CONFIG_REPLY_FX_NAME_SIZE(Length)				((2*BYTE_SIZE)+Length)
#define MSG_CONFIG_REPLY_FX_NAME_NAME_SIZE(Leng)			(Leng-(WORD_SIZE+2*BYTE_SIZE))

#define MSG_CONFIG_REQUEST_FX_IN_OUT		    0x007B
typedef struct
{
	Byte	FX_Num;
} Config_Request_FX_In_Out_msg;

#define MSG_CONFIG_REPLY_FX_IN_OUT			    0x007C
typedef struct
{
	Byte	FX_Num;
	Byte	Number_Input_FX;
	Byte	Number_Output_FX;
} Config_Reply_FX_In_Out_msg;

#define MSG_CONFIG_REQUEST_CURRENT_PRE_EQ	    0x007D
#define MSG_CONFIG_REPLY_CURRENT_PRE_EQ_31	    0x007E
#define MSG_CONFIG_REQUEST_NUMBER_PARAMS	    0x007F
typedef struct
{
	Byte	FX_Number;
} Config_Request_Number_Params_msg;

#define MSG_CONFIG_REPLY_NUMBER_PARAMS		    0x0080
typedef struct
{
	Byte	FX_Number;
	Byte	Number_Params;
} Config_Reply_Number_Params_msg;

#define MSG_CONFIG_REQUEST_OUTPUT_NAME	    	0x008c
typedef struct
{
	Byte	program_num;
} config_request_output_name_msg;

#define MSG_CONFIG_REPLY_OUTPUT_NAME	    0x008d
typedef struct
{
	Byte	program_num;
	Byte	name[6][OUTPUT_NAME_LENGTH];
} config_reply_output_name_msg;


#define MSG_CONFIG_REQUEST_CURENT_OUTPUT_NAME	0x008e
#define MSG_CONFIG_REPLY_CURENT_OUTPUT_NAME	    0x008f
typedef struct
{
	Byte	name[6][OUTPUT_NAME_LENGTH];
} config_reply_current_output_name_msg;
		
#define MSG_CONFIG_REPLY_OUTPUT_NAME_MIN_SIZE				(2*BYTE_SIZE)
#define MSG_CONFIG_REPLY_OUTPUT_NAME_SIZE(name_length)		((BYTE_SIZE)+(name_length*BYTE_SIZE))

//**********************************************
// COHERENCY/REDUNDANCY
//
// redundancy data is maintained so that if a device
// is removed from a network, a replacement device can
// restore the last known values to the new device
//**********************************************
	
#define MSG_COHERENCY_REQUEST 					0x0081
#define MSG_COHERENCY_NUM_PARAMS_REPLY		    0x0082
typedef struct
{
	Byte	table_id;
	Byte	prog_num;
	Byte	fx_chksum;
	Byte	num_fx;
	Byte 	num_params[MAX_FX];

} Coherency_Num_Params_Reply_msg;

#define MSG_COHERENCY_NUM_PARAMS_REPLY_MIN_SIZE					((4*BYTE_SIZE))
#define MSG_COHERENCY_NUM_PARAMS_REPLY_SIZE(Number_Parameters)	((4*BYTE_SIZE)+(Number_Parameters*BYTE_SIZE))
#define MSG_COHERENCY_NUM_PARAMS_REPLY_COUNT(Leng)				((Leng-((4*BYTE_SIZE)))/BYTE_SIZE)

#define MSG_COHERENCY_CUR_VALS_REPLY			0x0083
typedef struct
{
	Byte	table_id;
	Byte	cfx;
	Byte	num_params;
	Byte 	cur_vals[MAX_NUM_PARAMS];
} Coherency_Cur_Vals_Reply_msg;

#define MSG_COHERENCY_CUR_VALS_REPLY_MIN_SIZE					((3*BYTE_SIZE))
#define MSG_COHERENCY_CUR_VALS_REPLY_SIZE(Number_Parameters)	((3*BYTE_SIZE)+(Number_Parameters*BYTE_SIZE))
#define MSG_COHERENCY_CUR_VALS_REPLY_COUNT(Leng)				((Leng-((3*BYTE_SIZE)))/BYTE_SIZE)

#define MSG_COHERENCY_PROGRAM_REQUEST 			0x0086
typedef struct
{
	Byte	Program;
} Coherency_Program_Request_msg;

#define MSG_COHERENCY_PROGRAM_REPLY 			0x0087
typedef struct
{
	Byte 				box_id;
	Byte 				prog_num;
	Byte 				fx_chksum;
	Byte 				num_fx;
	Byte 				param_chksum;

} Coherency_Program_Reply_msg;

#define MSG_COHERENCY_REMOTE_UPDATE_REQUEST 	0x0088
#define MSG_COHERENCY_REMOTE_UPDATE_REPLY 		0x0089
#define MSG_COHERENCY_DO_LOAD					0x008A

//**********************************************
// Param Value/Param Change Messages:
// param messages allow access to parameter characteristics
//**********************************************

#define MSG_PARAM_REQUEST_ALL				    0x0090
#define MSG_PARAM_WRITE_ALL_IN_FX			    0x0091
typedef struct
{
	Byte Cfx;
	Byte Fill;
	Word Parameters[(256-(WORD_SIZE+(2*BYTE_SIZE)))/WORD_SIZE];		// twiddle
} Param_Write_All_In_FX_msg;

#define MSG_PARAM_WRITE_ALL_IN_FX_MIN_SIZE					((2*BYTE_SIZE))
#define MSG_PARAM_WRITE_ALL_IN_FX_SIZE(Count)				((2*BYTE_SIZE)+(WORD_SIZE*Count))
#define MSG_PARAM_WRITE_ALL_IN_FX_COUNT(Leng)				((Leng-((2*BYTE_SIZE)))/WORD_SIZE)

#define MSG_PARAM_REQUEST_ALL_IN_FX			    0x0092
typedef struct
{
	Byte Cfx;
} Param_Request_All_In_FX_msg;


#define MSG_PARAM_REPLY_ALL_IN_FX			    0x0093
typedef struct
{
	Byte src;
	Byte Cfx;
	Byte Fill;
	Word Parameters[(128-(WORD_SIZE+(3*BYTE_SIZE)))/WORD_SIZE];		// twiddle
} Param_Reply_All_In_FX_msg;


#define MSG_PARAM_REPLY_ALL_IN_FX_MIN_SIZE					((3*BYTE_SIZE))
#define MSG_PARAM_REPLY_ALL_IN_FX_SIZE(Count)				((3*BYTE_SIZE)+(WORD_SIZE*Count))
#define MSG_PARAM_REPLY_ALL_IN_FX_COUNT(Leng)				((Leng-((3*BYTE_SIZE)))/WORD_SIZE)

typedef struct
{
	Byte src;
	Byte Cfx;
	Byte Cparam;
	Byte Fill;
	Word Cval;			// twiddle
} Param_Reply_msg;

#define MSG_PARAM_WRITE						    0x0094
typedef struct
{
	Byte Cfx;
	Byte Cparam;
	Word Cval;			// twiddle
} Param_Write_msg;

#define MSG_PARAM_REQUEST					    0x0095
typedef struct
{
	Byte Cfx;
	Byte Cparam;
} Param_Request_msg;

#define MSG_PARAM_REPLY						    0x0096
#define MSG_PARAM_REQUEST_INPUT_TYPE		    0x0097
typedef struct
{
	Byte Cfx;
	Byte Cparam;
} Param_Request_Input_Type_msg;

#define MSG_PARAM_REPLY_INPUT_TYPE			    0x0098
typedef struct
{
	Byte Cfx;
	Byte Cparam;
	Byte Ctype;
} Param_Reply_Input_Type_msg;

#define MSG_PARAM_REQUEST_PROMPT_STRING			0x0099
typedef struct
{
	Byte Cfx;
	Byte Cparam;
} Param_Request_Prompt_String_msg;

#define MAX_PROMPT_STRING_SIZE		15		// Maximum size of a prompt string
#define MSG_PARAM_REPLY_PROMPT_STRING			0x009A
typedef struct
{
	Byte Cfx;
	Byte Cparam;
	Byte Prompt[MAX_PROMPT_STRING_SIZE];
} Param_Reply_Prompt_String_msg;

#define MSG_PARAM_REPLY_PROMPT_STRING_MIN_SIZE				((2*BYTE_SIZE))
#define MSG_PARAM_REPLY_PROMPT_STRING_SIZE(Length)			((2*BYTE_SIZE)+Length)
#define MSG_PARAM_REPLY_PROMPT_STRING_PROMPT_SIZE(Leng)		(Leng-(2*BYTE_SIZE))

#define MSG_PARAM_REQUEST_MAX_SELECT			0x009B
typedef struct
{
	Byte Ctype;
} Param_Request_Max_Select_msg;

#define MSG_PARAM_REPLY_MAX_SELECT				0x009C
typedef struct
{
	Byte Ctype;
	Word Max_Value;				// twiddle
} Param_Reply_Max_Select_msg;

#define MSG_PARAM_WRITE_CUE						0x009D
typedef struct
{
	Byte fx_pos;
	Byte Cparam;
	Word Cval;					// twiddle
} Param_Write_Cue_msg;

#define MSG_PARAM_WRITE_CUE_ALL_IN_FX			0x009E
typedef struct
{
	Byte fx_pos;
	Byte Fill;
	Word Parameters[(256-(WORD_SIZE+(2*BYTE_SIZE)))/WORD_SIZE];		// twiddle
} Param_Write_Cue_All_In_FX_msg;

#define MSG_PARAM_TYPE_REQUEST_REPLY_STRING		0x00A1
typedef struct
{
	Byte	type;
	Word	Value;				// twiddle
} ParamType_Request_Reply_String_msg;
	
#define MSG_PARAM_TYPE_REPLY_STRING				0x00A2
typedef struct
{
	Byte	type;
	Word	Value;				// twiddle
	Byte	String[16];
} ParamType_Reply_String_msg;

#define MSG_PARAM_REQUEST_REPLY_STRING			0x00A3
typedef struct
{
	Byte	cfx;
	Byte	cparam;
} Param_Request_Reply_String_msg;

#define MSG_PARAM_REPLY_STRING					0x00A4
typedef struct
{
	Byte	cfx;
	Byte	cparam;
	Byte	String[16];
} Param_Reply_String_msg;


#define MSG_AFB_REQUEST		0x00A5
typedef struct
{
	UCHAR cfx;
	UCHAR filter;
} afb_request_msg;

#define MSG_AFB_REPLY 		0x00A6
typedef struct
{
	UCHAR cfx;
	UCHAR filter;
	gui_afb_info info;
} afb_reply_msg;


#define MSG_OUTPUT_TRIM_REPLY		0x00A7
typedef struct
{
	UCHAR 	zone;
	SINT	trim_val;		// signed 16 bit value in 0.1dB increments
} output_trim_reply_msg;

#define MSG_OUTPUT_TRIM_REQUEST		0x00A8
typedef struct
{
	UCHAR 	out_ch;
} output_trim_request_msg;

#define MSG_ZONE_TRIM_REPLY		0x00A9
typedef struct
{
	UCHAR 	zone;
	SINT	trim_val;		// signed 16 bit value in 0.1dB increments
} zone_trim_reply_msg;

#define MSG_ZONE_TRIM_REQUEST		0x00AA
typedef struct
{
	UCHAR 	out_ch;
} zone_trim_request_msg;


#define MSG_DID_COPY_FX							0x004a
#define MSG_COPY_FX			                	0x004b
#define MSG_PASTE_FX		                	0x004c
#define MSG_DO_PASTE_FX							0x0039
typedef struct
{
	fx_data msg_data;
} copy_fx_msg;

//**********************************************
// Button Press / User Interface Messages:
// alows a remote control surface to operate as if
// it were controlling the front pannel of a device
// Front Pannel data is returned to a control surface
// for coherent display of the user interface.
//**********************************************

#define MSG_BUTTON_DO_PRESS					    0x00A0
typedef struct
{
	Byte	Key_Value;		// Key value of button.
	Byte	Count;			// Number of repetitions since last report.
} Button_Do_Press_msg;


#define MSG_UI_DO_ATTACH					    0x00B0
#define MSG_UI_DID_ATTACH					    0x00B9
typedef struct
{
	Byte drawprog_screen;
} UI_Do_Attach_msg;

#define MSG_UI_DO_RELEASE					    0x00B1
#define MSG_UI_DO_BUNDLE					    0x00B2
typedef struct
{
	Word Bundle_Type;				// twiddle
	Byte Bundle[256-(2*WORD_SIZE)];
} UI_Do_Bundle_msg;

#define MSG_UI_DO_BUNDLE_MIN_SIZE							(sizeof(Word))
#define MSG_UI_DO_BUNDLE_SIZE(Length)						(sizeof(Word) + Length*BYTE_SIZE)
#define MSG_UI_DO_BUNDLE_BUNDLE_SIZE(Leng)					((Leng - sizeof(Word)) /BYTE_SIZE)

#define       MSG_CONFIG_MUTE_STATUS_REQUEST	0x00B3
#define       MSG_CONFIG_MUTE_STATUS_REPLY		0x00B4
typedef struct
{
	Byte Mute_Status;
} Config_Mute_Status_Reply_msg;

#define       MSG_CONFIG_WRITE_SYSTEM_MUTE 		0x00B5
typedef struct
{
	Byte System_Mute;
} Config_Write_System_Mute_msg;

#define 	  MSG_CONFIG_SYSTEM_MUTE_REPLY		0x00B6
typedef struct
{
	Byte System_Mute;
} Config_System_Mute_Reply_msg;

#define       MSG_CONFIG_SYSTEM_MUTE_REQUEST	0x00B7
#define       MSG_CONFIG_WRITE_MUTE_STATUS		0x00B8
typedef struct
{
	Byte Mute_Status;
} Config_Write_Mute_Status_msg;

//**********************************************
// Utility
// Utility is device configuration data  The utility
// data can be requested and returned by these messages
//**********************************************


typedef struct
{
	UCHAR system_version;
	system sys;
} utility_reply_msg;

#define 	MSG_UTILITY_REQUEST					0x00c0
#define 	MSG_UTILITY_REPLY					0x00c1
#define 	MSG_UTILITY_485FD_PROTOCOL_REQUEST	0x00c4
#define 	MSG_UTILITY_485FD_PROTOCOL_REPLY	0x00c5
//	typedef struct
//	{
//		Byte protocol_485HD;
//	} utility_reply_485HD_protocol_msg;
//	
//
//**********************************************
// AFL messages control the "After Fader Listen" features
// avaliable on mixing consoles.
//**********************************************

#define 	MSG_AFL_REQUEST					    0x00c2
#define 	MSG_AFL_REPLY					    0x00c3

//**********************************************
// meter messages allow the configuration of meter data
// channels, and contain handles for the meter data stream.
//**********************************************

#define MSG_CHANNEL_CONFIG_REQUEST			    0x00d0
#define MSG_CHANNEL_CONFIG_REPLY			    0x00d1
#define MSG_CHANNEL_0   					    0x2000
#define MSG_CHANNEL_1                           0x2001
#define MSG_CHANNEL_2                           0x2002
#define MSG_CHANNEL_3                           0x2003

//**********************************************
// general message information
//**********************************************
 	
typedef struct T_General_Message_
{
	UINT	Message_Type;
	UCHAR	msg_data[254];
} T_General_Message;

//**********************************************
//  Generic Message:
//**********************************************

typedef union _T_Message
{
	Word								Message_Type;
	T_General_Message					General_Message;
} T_Message;

typedef struct rcvfunc_type_
{
	void  (*function)(UCHAR *msg_data) reentrant;
	UCHAR min_length;
	UCHAR max_length;
} rcvfunc_type;

#define NETAPI_TBL_SIZE 210

#endif

//**************************************************************************
//  History:
//
//**************************************************************************
//**************************************************************************
// EOF
//**************************************************************************




