#ifndef DRV_PAD_BPM_H #define DRV_PAD_BPM_H #include /* $Id: drvPadBpm.h,v 1.1.1.1 2010/05/03 22:17:34 khkim Exp $ */ /* Public Interface to AFE control via QSPI driver */ #ifdef __cplusplus extern "C" { #endif /* Direct access to the LAN9118 FIFO -- an ugly hack * but it's much faster... */ #define LAN9118_FIFO_HACK ((volatile void*)0x31000800) /* Which Arcturus 'IRQ' pins is used for triggering the FIFOs */ #define TRIG_PIN 1 /* Which Arcturus 'IRQ' pins is used for interrupting the CPU */ #define IRQ_PIN 2 /* 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); /* read PAD FIFO into column or row-major array of 'n' * elements (n MUST be a multiple of 4 to account for the 4 channels * of a PAD). * * 'le' - if nonzero causes bytes to be swapped so that the data * are converted to little-endian byteorder. This feature * and the 'volatile' declaration of the destination address * are added so that we can directly write to the LAN9118 chip's * TX fifo. This violates nice encapsulation but gains ~30% / 80us * in speed. */ void drvPadReadFifosColMajor(volatile void *dst_p, int n, int le); void drvPadReadFifosRowMajor(volatile void *dst_p, int n, int le); #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 #ifdef NEVER /* 4/14/8 moved from devWfPadBpm.c at creation of drvPadBpm.c */ /* Direct access to the LAN9118 FIFO -- an ugly hack * but it's much faster... */ #define LAN9118_FIFO_HACK ((volatile void*)0x31000800) #endif 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); #ifdef NEVER /* 4/14/8 moved from devWfPadBpm.h at creation of drvPadBpm.c */ /* Write RARM field of waveform through database */ int devPadWfSetRarm(int val); #endif void /*4/16/8 was static. moved from drvPadBpm.c*/ padThread(void *arg); #ifdef __cplusplus } #endif #endif