/* * These are translations into C++ of J. Kubic's CAMAC code. Any errors * of course be considered mine. Jonathon's comments have been included. * * Chris Jillings, Cosmic Ray Group, UCLA Physics, August 2000 * */ /* c pc16turbo.for c c FORTRAN version of Wiener's cam_tu16.h C++ routines c 3/23/98 J.Kubic, UCLA c c c cam_adr Set I/O Address (badr) c getstatus Get CC16 Status c cam_cratecheck Test crate available c set_crate Set geographical crate Address c cam_controller_ini Controller Initialization c cam_0 Disable Inhibit c cam_z CAMAC Initialize (Z) c cam_c CAMAC Clear (C) c cam_i CAMAC Inhibit (I) c cam_ri Read Inhibit bit (JK's cam_0) c cam_di Disable Inhibit bit JK c cam_ci CAMAC Clear + Inhibit (I) setzen c cam_irq Enable CAMAC LAM-Interrupt c cam_noirq Disable CAMAC LAM-Interrupt c cam_q Get CAMAC Q-response c cam_x Get CAMAC X-response c cam_nfa Set N,F,A start CAMAC cycle c cam_nfa_read Set N,F,A and read 2 byte c cam_nfaqx_read Set N,F,A and read 2 byte with Q and X c cam_nfaqx_read24 Set N,F,A and read 3 byte with Q and X c cam_nfa_write Set N,F,A and write 2 byte c cam_nfaqx_write Set N,F,A and write 2 byte with Q and X c cam_nfaqx_write24 Set N,F,A and write 2 byte with Q and X c cam_lam Get LAM source c cam_lamf Any LAM request c c badr = base I/O address of pc16turbo ISA card c c---------------------------------------------------------------------- */ //UChar_t inp(UShort_t); //UShort_t inpw(UShort_t); //UInt_t inpd(UShort_t); //void outp(UShort_t, UChar_t); //void outpw(UShort_t, UShort_t); //void outpd(UShort_t, UInt_t); #include class UC_CamacIO { private: // The base address UShort_t fCrate; UShort_t fBaseAddress; // A series of addresses: off sets fromm base UShort_t fAdr00, fAdr02, fAdr04, fAdr06, fAdr08, fAdr0a, fAdr0c, fAdr0e; UShort_t fAdr10, fAdr12, fAdr14, fAdr16, fAdr18, fAdr1a, fAdr1c, fAdr1e; public: // No Default constructor. UC_CamacIO(UShort_t aBaseAddress); UInt_t CrateCheck(void); //checks crate 0 UInt_t GetStatus(void); void Z(void); void C(void); void I(void); void DI(void); UInt_t RI(void); void CI(void); void Zero(void); UInt_t Q(void); UInt_t X(void); void EnableIRQ(void); void DisableIRQ(void); void NFA(UInt_t aN, UInt_t aF, UInt_t aA); void NFAWrite(UInt_t aN, UInt_t aF, UInt_t aA, UShort_t aData); void NFAQXWrite(UInt_t aN, UInt_t aF, UInt_t aA, UShort_t aData, UInt_t* aQ, UInt_t* aX); void NFAQXWrite24(UInt_t aN, UInt_t aF, UInt_t aA, UInt_t aData, UInt_t* aQ, UInt_t* aX); UInt_t NFARead(UInt_t aN, UInt_t aF, UInt_t aA); UInt_t NFAQXRead(UInt_t aN, UInt_t aF, UInt_t aA, UInt_t* q, UInt_t* x); UInt_t NFAQXRead24(UInt_t aN, UInt_t aF, UInt_t aA, UInt_t* q, UInt_t* x); UInt_t LAM(UShort_t station); UInt_t LAMF(void); private: UShort_t calcNFA(UShort_t aN, UShort_t aF, UShort_t aA); void camacControllerIni(UShort_t aBaseAddress, UShort_t Crate); void setCrate(UShort_t aCrate); void cam_adr(UShort_t aBaseAddress); // called by constructor void portcheck(void); // called to avoid hardware conflict/damage // on line 0x0300 };