#include #include #include #include #include #include "ti_dsp.h" #include "ROD.h" #define RODID 1 rod_t *pROD; /* defined in ROD.h and used here and in ti_vme_gva.c */ /* Default slot, geographical address, and VME mode */ static int slot=4, mode=2, gaddr=11, iopt=1 ; /* ---------------------------------------------------------------------- Usage: mV11 ---------------------------------------------------------------------- */ main(int argc, char** argv) { /* The PU descriptor(s) for one ROD */ ti_dsp_t dsp; unsigned int ist; const static char* bootFile = "evtloop_copy_dbg.x0"; const static char* calibrationFile = NULL; if (argc > 1) slot = atoi(argv[1]); if (argc > 2) mode = atoi(argv[2]); if (argc > 3) gaddr = atoi(argv[3]); if (argc > 4) iopt = atoi(argv[4]); dsp.puid = slot; /* Slot */ dsp.rodid = RODID; dsp.nsamp = 5; dsp.ngain = 1; dsp.bootFile = bootFile; dsp.calibrationFile = calibrationFile; { extern RODDBG *p_RODDBG; p_RODDBG->vme = 0; p_RODDBG->loc = 0; p_RODDBG->misc = 0; p_RODDBG->util = 0; p_RODDBG->pu = 0; p_RODDBG->ttc = 1; p_RODDBG->oc = 1; } { crate_t *aCrate = ROD_CrateInit(1,0,3); assert (aCrate != NULL); pROD = aCrate->rod[0]; } ist = ROD_ModuleInit(pROD, gaddr, RODID); assert (ist == 0); /* Configure PUs (what is this for) */ ist = ROD_PModule(pROD); /* Configure mother board components */ ist = ROD_GeneralReset(pROD); ist = ROD_TtcConfig(pROD, mode); /* === Boot the TI processing unit(s) one by one === */ ti_boot(&dsp, TI_AUTO); ti_fpstatus(&dsp); /* === Configure the Output Controller */ ROD_OcResetGen(pROD); /* general reset */ /* === Mask all PUs except those specified by slot */ { unsigned int reg = 0x4ffffff; reg ^= (1 << 15+dsp.puid); ROD_OcConfig(pROD, reg); ROD_OcRConfig(pROD, &ist); printf("ROD OC Config Register = 0x%08x\n", ist); } ROD_OcStatus(pROD, &ist); ROD_OcPStatus(ist); ROD_OcResetEOE(pROD); /* reset EOE flag */ while(1){ unsigned int data[100]; int nw; usleep(200000); ti_interrupt(&dsp); ti_fpsstatus(&dsp); nw = ti_hread(&dsp, data, sizeof(data)); printf("RAM Counters=0x%08x timer=%4.1f In=%d In_Next=%d Out_Rdy=%d Out_Next=%d\n", data[0], data[1]*16.e-9, data[2], data[3], data[4], data[5]); } ROD_End(pROD); }