/*============================================================================= Name: drvPadLan9118.h Abs: Function prototypes used by device support for PAD driver. Auth: 16-nov-2005, Dayle Kotturi (dayle): Initial version. -----------------------------------------------------------------------------*/ #include "copyright_SLAC.h" /* SLAC copyright comments */ /*----------------------------------------------------------------------------- Mod: (newest to oldest) xx-xxx-2007, Dayle Kotturi: xxxxxxxxxxxxxxxxxxxxxxxx =============================================================================*/ #include "padLan9118Macros.h" #include #ifndef DRV_PAD_LAN9118_H #define DRV_PAD_LAN9118_H #include /* $Id: drvPadLan9118.h,v 1.1.1.1 2008/06/22 18:25:45 dayle Exp $ */ /* Public Interface to PAD's LAN9118 chip 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) #ifdef NEVER /* Chip-select mask */ #define AFE_CS 0xe #endif /* 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 *** */ /* 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); /*4/16/8 was static. moved from drvPadBpm. 5/12/8 put static back */ /*void static padThread(void *arg); moved to .c to avoid warning */ LOCAL int padOperationMode = PAD_STARTING; LOCAL int padCalibrationControl = PAD_CAL_IDLE; /* NB: To be called from Cexp> prompt, it doesn't need to be here; To be called from dev*Pad.c, it does */ int padInitialise(void); int padInitialiseIntr(void); int padInitialiseScalarFromFile(int channel, int sample, char* filename); int padReport(int interest); int padGetIntrCount(void); int padGetScanIOCount(void); int padGetNumShortsRead(int channel, int sample); int padGetNumShortsToRead(int channel, int sample); long padGetAverageI(int channel, int sample); long padGetAverageQ(int channel, int sample); long padGetAverageS(int channel, int sample); unsigned long padGetVarianceI(int channel, int sample); unsigned long padGetVarianceQ(int channel, int sample); #ifdef NEVER long padGetInterceptI(int channel); long padGetInterceptQ(int channel); #endif short padGetX(int channel, int sample); void *padGetSignal(int channel, int sample, int type); int padGetSampleOffset(int channel, int sample); int padSetSampleOffset(int channel, int sample, int offset); int padGetSampleSize(int channel, int sample); int padSetSampleSize(int type, int channel, int sample, int size); int padSetOperationMode(int mode); int padSetCalibrationControl(int calibrationControl); int padEnableIntr(void); int padDisableIntr(void); #ifdef USING_TIMER int padGetTime(void); void padUpdateWorstCase(void); #endif int padSoftTrigger(void); int padCalibration(void); int padDumpCalDataToFile(void); #ifdef USING_QSPI int padQSPISetMUX(volatile short val); long padQSPIReadData(); #ifdef QSPI_KHKIM long padSlowADCRead(int channel); IOSCANPVT getScanListPadSlowADC(void); #endif #endif /* used by devWaveform */ int padGetIntrCount(); int padInitialiseScalar(); int padGetOverflowQCount(); int padGetOverflowICount(); #ifdef SCAN_IO int padGetScanIOCount(); IOSCANPVT padGetIoScanPvt(void); /* needed by devWaveformPad.c */ #endif /* debug routines used by debug device support. not used in ops */ int padToggleIRQ5(void); #ifdef __cplusplus } #endif #endif