/******************************************************************************
 *
 *	NDT Solutions Pulser/Receiver Software Development Kit v1.0beta
 *
 ******************************************************************************
 *
 *  File:        PRXStructs.h.
 *
 *  Description: Secondary header file for Pulser/Receiver SDK containing 
 *               structuredtypes. This file does not need to be explicitly 
 *				 included.
 *
 *	Revision:    14/06/05 - Jonathan Welch (jonathan@ndtsolutions.com).
 *
 ******************************************************************************/
#ifndef PRXSTRUCTS_H
#define PRXSTRUCTS_H

#include "PRXEnums.h"

#define SEQUENCE_TABLE_BLOCKS 32
#define PRX_CHANNELS 8

#define PRX_MAXIMUM_NUMBER_OF_ERROR_LOG_STRINGS		64
#define PRX_MAXIMUM_ERROR_STRING_LENGTH				128
#define PRX_MAX_OVERSAMPLING_SAMPLES 255

// The fields below need to be unsigned because e.g. 400V pulserVoltage is a +ve number using the top bit
// This structure reflects the Global Configuration registers within the PRX card
typedef struct
{
	unsigned int pulserVoltage : 12;
	unsigned int ultranPowerOnReq : 1;		//Setting 1 requests enable of internal HVPA power supplies (ultran pulser only)
	unsigned int unused_13 : 1;
	unsigned int autoResetOnOverload : 1;
	unsigned int highVoltageEnable : 1;		//PRX:1=Enable HT    //Ultran HVPA  1=request HT startup //0=request HT shutdown
	unsigned int externalTrigger : 1;
	unsigned int unused_17to23 : 7;
	unsigned int pulseEchoMask : 8;
} PRX_GlobalRegs;

// This structure reflects the Sequence Table within the PRX card
typedef struct
{
	unsigned int transmitPulseEnable : 8;
	unsigned int unused0_8to15 : 8;
	unsigned int rxChannelSelect : 3;
	unsigned int unused0_19to22 : 4;
	unsigned int mpxGain : 1;
	unsigned int stepSkip: 5;
	unsigned int unused0_28to30 : 2;
	unsigned int sequenceFlag : 1;

	unsigned int fineGainControl : 12;
	unsigned int unused1_12to30 : 19;
	unsigned int externalTCGSelect : 1;

	unsigned int backendLowpassFilter : 3;
	unsigned int unused2_3to7 : 5;
	unsigned int backendHighpassFilter : 3;
	unsigned int unused2_11to15 : 5;
	unsigned int frontendLowpassFilter : 3;
	unsigned int unused2_19to23 : 5;
	unsigned int frontendHighpassFilter : 3;
	unsigned int unused2_27to31 : 5;

	unsigned int impedanceselect : 4;
	unsigned int unused3_4to7 : 4;
	unsigned int coarseGain : 2;
	unsigned int unused3_10to31 : 22;

	unsigned int oversamplingFineDelay : 8;
	unsigned int unused4_8to15 : 8;
	unsigned int numberOfOversamples : 8;
	unsigned int unused4a_24to31 : 8;

	unsigned int pulseWidth : 16;
	unsigned int unused5_16to23 : 8;
	unsigned int pulseTrain : 4;
	unsigned int unused5_28to31 : 4;

	unsigned int unused6_0to31 : 32;

	unsigned int repetitionDelay : 32;
} PRX_SequenceTableBlock;

typedef struct
{
	PRX_GlobalRegs globalRegs;
	PRX_SequenceTableBlock sequence[SEQUENCE_TABLE_BLOCKS];
} PRX_Shadow;



#endif