V1495Lib.h

From New IAC Wiki
Revision as of 17:25, 29 June 2009 by Oborn (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


/* v1495Lib.h */

#ifndef V1495LIB_H

#define V1495LIB_H

#define V890_MAX_CHANNELS   128
#define V890_MAX_WORDS_PER_EVENT  34
#define V890_MAX_WORDS_PER_BOARD  3000

/* Define a Structure for access */
/* all addressing is A24/A32, all data D16 except scratch32 */
typedef struct v1495_struct
{
  /*0x0000*/ volatile unsigned short data[16384];    /* R/W */
  /*0x8000*/ volatile unsigned short control;        /* R/W */
  /*0x8002*/ volatile unsigned short status;         /* R */
  /*0x8004*/ volatile unsigned short intLevel;       /* R/W */
  /*0x8006*/ volatile unsigned short intVector;      /* R/W */
  /*0x8008*/ volatile unsigned short geoAddr;        /* R */
  /*0x800A*/ volatile unsigned short moduleReset;    /* W */
  /*0x800C*/ volatile unsigned short firmwareRev;    /* R */
  /*0x800E*/ volatile unsigned short selflashVME;    /* R/W */
  /*0x8010*/ volatile unsigned short flashVME;       /* R/W */
  /*0x8012*/ volatile unsigned short selflashUSER;   /* R/W */
  /*0x8014*/ volatile unsigned short flashUSER;      /* R/W */
  /*0x8016*/ volatile unsigned short configUSER;     /* R/W */
  /*0x8018*/ volatile unsigned short scratch16;      /* R/W */
  /*0x801A*/ volatile unsigned short res1[3];
  /*0x8020*/ volatile unsigned int scratch32;        /* R/W */
  /*0x8024*/ volatile unsigned short res2[110];
  /*0x8100*/ volatile unsigned short configROM[127]; /* R */

} V1495;



#define V1495_READOUTCTRL_ADDR_A32	0x90110000

#define V1495_READOUTCTRL_ADDR_A24	0x110000



#define TXSTART_SOFTTRIG			0x0001

#define TXSTART_EXTTRIG				0x0002



#define TRIGWORD_LV1A				0x4

#define TRIGWORD_CAL					0x7

#define TRIGWORD_RESYNC				0x6

#define TRIGWORD_BC0					0x5

#define FIFO_WORDS_MASK				0x3F
#define EVENT_SIZE_MASK				0x0F

#define V1495_BOARD_ID				0x05D7
#define BOARD_ID_OFFSET_H			0x8139
#define BOARD_ID_OFFSET_L			0x813D




typedef struct

{

	volatile unsigned short MezzanineIDs;		/* 0x0000 - 0x0001 */  

	volatile unsigned short Revision;		/* 0x0002 - 0x0003 */

	volatile unsigned short Reset;			/* 0x0004 - 0x0005 */ 

	volatile unsigned short Reserved1[5];		/* 0x0006 - 0x000F */

	volatile unsigned short TxStart;		/* 0x0010 - 0x0011 */

	volatile unsigned short SoftTrigger; 		/* 0x0012 - 0x0013 */

	volatile unsigned short TriggerWords;		/* 0x0014 - 0x0015 */

	volatile unsigned short TxWord[12];		/* 0x0016 - 0x002D */

	volatile unsigned short Reserved2[1];		/* 0x002E - 0x002F */

	volatile unsigned short FIFOLength[12];		/* 0x0030 - 0x0047 */

	volatile unsigned short EventSize[12];		/* 0x0048 - 0x005F */

	volatile unsigned short Reserved3[16];		/* 0x0060 - 0x007F */

	volatile unsigned short EventsSentH[12];	/* 0x0080 - 0x0097 */

	volatile unsigned short Reserved4[4];		/* 0x0098 - 0x009F */

	volatile unsigned short EventsSentL[12];	/* 0x00A0 - 0x00B7 */

	volatile unsigned short Reserved5[8100];	/* 0x00B8 - 0x3FFF */

	volatile unsigned short EventData[12][128];	/* 0x4000 - 0x4BFF */
	//volatile unsigned short EventData_1[128];

	//volatile unsigned short EventData_2[128];

	//volatile unsigned short EventData_3[128];

	//volatile unsigned short EventData_4[128];

	//volatile unsigned short EventData_5[128];

	//volatile unsigned short EventData_6[128];

	//volatile unsigned short EventData_7[128];

	//volatile unsigned short EventData_8[128];

	//volatile unsigned short EventData_9[128];

	//volatile unsigned short EventData_A[128];

	//volatile unsigned short EventData_B[128];

} V1495ReadoutCtrlRegs;



#endif