/*============================================================================= Name: drvPadLlrf.c Abs: Driver support definitions. Modelled after T.Straumann's BPM Application Code. Uses UdpComm-R2-x-y Auth: Shantha Condamoor (scondam) Rev: May 23 2011 - Initial Release -----------------------------------------------------------------------------*/ #ifndef DRV_PAD_AFE_QSPI_H #define DRV_PAD_AFE_QSPI_H /* $Id: drvPadLlrf.h,v 1.2 2012/06/25 19:10:14 scondam Exp $ */ /* Public Interface to AFE control via QSPI driver */ #ifdef __cplusplus extern "C" { #endif /* * Which Arcturus 'IRQ' pins is used for triggering the FIFOs. * This is the default but can be overridden by setting the * 'drvPadLlrfTrigPin' variable. */ #define TRIG_PIN_DFLT 1 extern int drvPadLlrfTrigPin; /* Which Arcturus 'IRQ' pins is used for interrupting the CPU. * This is the default but can be overridden by setting the * 'drvPadLlrfIrqPin' variable. */ #define IRQ_PIN_DFLT 2 extern int drvPadLlrfIrqPin; /* Chip-select mask */ #define AFE_CS 0xe /* Issue a soft calibration cycle; * - send CAL trigger on QSPI (using chip levels from 'cs') * typically, 0xe can be used to select the first device * only (active low). * - delay for 'dely' loops (depends * on processor) * - send ADC trigger * * *** All of this runs with INTERRUPTS DISABLED *** */ void drvPadSoftCal(int dely, int cs, int trig_pin, int irq_pin); /* Issue a software ADC trigger * RETURNS: 0 on success, nonzero if no trigger raised * (but a ongoing acq. is used with no IRQ pending). * */ int drvPadAdcTrigger(int trig_pin, int irq_pin); #define AFE_REG_CSR 0 #define AFE_REG_CALA 1 #define AFE_REG_ATT1 2 #define AFE_REG_ATT2 3 #define AFE_REG_LMT 4 #define AFE_REG_VER 5 #define AFE_REG_CALT 6 #define AFE_REG_T2AMP 0x10 /* trig -> amp on */ /* registers are listed in order of time-sequence not in numerical order */ #define AFE_REG_AMP2RF1 0x11 /* amp on -> RF pulse 1 */ #define AFE_REG_RFWIDTH 0x13 /* RF pulse width */ #define AFE_REG_OFFTIME 0x14 /* pulse OFF -> change of control switches */ #define AFE_REG_RF12RF2 0x12 /* delay to pulse 2 */ #define AFE_REG_CSR_CALM_GET(x) ((x)&3) #define AFE_REG_CSR_CALM_RED 0 #define AFE_REG_CSR_CALM_GRN 1 #define AFE_REG_CSR_CALM_BOTH 2 #define AFE_REG_CSR_CALM_NONE 3 extern uint8_t drvPadAfeRegCache[32]; /* Check if a CAL trigger has arrived; if 'do_reset' is nonzero then * the flag is reset */ int drvPadAfeGotCalt(int do_reset); /* Toggle calibrator from GRN <-> RED * RETURNS: new state, -1 if not in soft toggle mode, * -2 if old state was not GRN nor RED or for other errors. */ int drvPadCalToggle(int cs); int padGetTriggerRate(); int padGetCurrentIntrCount(); #ifdef __cplusplus } #endif #endif