Go to the source code of this file.
Functions | |
uint32_t | v1720_RegisterRead (MVME_INTERFACE *mvme, uint32_t a32base, int offset) |
uint32_t | v1720_BufferFreeRead (MVME_INTERFACE *mvme, uint32_t a32base) |
uint32_t | v1720_BufferOccupancy (MVME_INTERFACE *mvme, uint32_t a32base, uint32_t channel) |
uint32_t | v1720_BufferFree (MVME_INTERFACE *mvme, uint32_t base, int nbuffer) |
void | v1720_AcqCtl (MVME_INTERFACE *mvme, uint32_t a32base, uint32_t operation) |
void | v1720_ChannelCtl (MVME_INTERFACE *mvme, uint32_t a32base, uint32_t reg, uint32_t mask) |
void | v1720_TrgCtl (MVME_INTERFACE *mvme, uint32_t a32base, uint32_t reg, uint32_t mask) |
void | v1720_RegisterWrite (MVME_INTERFACE *mvme, uint32_t a32base, int offset, uint32_t value) |
void | v1720_Reset (MVME_INTERFACE *mvme, uint32_t a32base) |
void | v1720_Status (MVME_INTERFACE *mvme, uint32_t a32base) |
int | v1720_Setup (MVME_INTERFACE *mvme, uint32_t a32base, int mode) |
void | v1720_info (MVME_INTERFACE *mvme, uint32_t a32base, int *nch, uint32_t *n32w) |
uint32_t | v1720_DataRead (MVME_INTERFACE *mvme, uint32_t a32base, uint32_t *pdata, uint32_t n32w) |
uint32_t | v1720_DataBlockRead (MVME_INTERFACE *mvme, uint32_t a32base, uint32_t *pdest, uint32_t *nentry) |
void | v1720_ChannelThresholdSet (MVME_INTERFACE *mvme, uint32_t base, uint32_t channel, uint32_t threshold) |
void | v1720_ChannelOUThresholdSet (MVME_INTERFACE *mvme, uint32_t base, uint32_t channel, uint32_t threshold) |
void | v1720_ChannelDACSet (MVME_INTERFACE *mvme, uint32_t base, uint32_t channel, uint32_t dac) |
int | v1720_ChannelDACGet (MVME_INTERFACE *mvme, uint32_t base, uint32_t channel, uint32_t *dac) |
void | v1720_ChannelSet (MVME_INTERFACE *mvme, uint32_t base, uint32_t channel, uint32_t what, uint32_t that) |
uint32_t | v1720_ChannelGet (MVME_INTERFACE *mvme, uint32_t base, uint32_t channel, uint32_t what) |
void | v1720_Align64Set (MVME_INTERFACE *mvme, uint32_t base) |
void v1720_AcqCtl | ( | MVME_INTERFACE * | mvme, | |
uint32_t | a32base, | |||
uint32_t | operation | |||
) |
Definition at line 145 of file v1720.c.
00146 { 00147 uint32_t reg; 00148 00149 reg = regRead(mvme, base, V1720_ACQUISITION_CONTROL); 00150 switch (operation) { 00151 case V1720_RUN_START: 00152 regWrite(mvme, base, V1720_ACQUISITION_CONTROL, (reg | 0x4)); 00153 break; 00154 case V1720_RUN_STOP: 00155 regWrite(mvme, base, V1720_ACQUISITION_CONTROL, (reg & ~(0x4))); 00156 break; 00157 case V1720_REGISTER_RUN_MODE: 00158 regWrite(mvme, base, V1720_ACQUISITION_CONTROL, (reg & ~(0x3))); 00159 break; 00160 case V1720_SIN_RUN_MODE: 00161 regWrite(mvme, base, V1720_ACQUISITION_CONTROL, (reg | 0x01)); 00162 break; 00163 case V1720_SIN_GATE_RUN_MODE: 00164 regWrite(mvme, base, V1720_ACQUISITION_CONTROL, (reg | 0x02)); 00165 break; 00166 case V1720_MULTI_BOARD_SYNC_MODE: 00167 regWrite(mvme, base, V1720_ACQUISITION_CONTROL, (reg | 0x03)); 00168 break; 00169 case V1720_COUNT_ACCEPTED_TRIGGER: 00170 regWrite(mvme, base, V1720_ACQUISITION_CONTROL, (reg | 0x08)); 00171 break; 00172 case V1720_COUNT_ALL_TRIGGER: 00173 regWrite(mvme, base, V1720_ACQUISITION_CONTROL, (reg & ~(0x08))); 00174 break; 00175 default: 00176 break; 00177 } 00178 }
void v1720_Align64Set | ( | MVME_INTERFACE * | mvme, | |
uint32_t | base | |||
) |
Definition at line 139 of file v1720.c.
00140 { 00141 regWrite(mvme, base, V1720_VME_CONTROL, V1720_ALIGN64); 00142 }
uint32_t v1720_BufferFree | ( | MVME_INTERFACE * | mvme, | |
uint32_t | base, | |||
int | nbuffer | |||
) |
Definition at line 212 of file v1720.c.
00213 { 00214 int mode; 00215 00216 mode = regRead(mvme, base, V1720_BUFFER_ORGANIZATION); 00217 if (nbuffer <= (1<< mode) ) { 00218 regWrite(mvme, base, V1720_BUFFER_FREE, nbuffer); 00219 return mode; 00220 } else 00221 return mode; 00222 }
uint32_t v1720_BufferFreeRead | ( | MVME_INTERFACE * | mvme, | |
uint32_t | a32base | |||
) |
Definition at line 225 of file v1720.c.
00226 { 00227 return regRead(mvme, base, V1720_BUFFER_FREE); 00228 }
uint32_t v1720_BufferOccupancy | ( | MVME_INTERFACE * | mvme, | |
uint32_t | a32base, | |||
uint32_t | channel | |||
) |
Definition at line 203 of file v1720.c.
00204 { 00205 uint32_t reg; 00206 reg = V1720_BUFFER_OCCUPANCY + (channel<<16); 00207 return regRead(mvme, base, reg); 00208 }
void v1720_ChannelCtl | ( | MVME_INTERFACE * | mvme, | |
uint32_t | a32base, | |||
uint32_t | reg, | |||
uint32_t | mask | |||
) |
int v1720_ChannelDACGet | ( | MVME_INTERFACE * | mvme, | |
uint32_t | base, | |||
uint32_t | channel, | |||
uint32_t * | dac | |||
) |
Definition at line 126 of file v1720.c.
00127 { 00128 uint32_t reg; 00129 int status; 00130 00131 reg = V1720_CHANNEL_DAC | (channel << 8); 00132 *dac = regRead(mvme, base, reg); 00133 reg = V1720_CHANNEL_STATUS | (channel << 8); 00134 status = regRead(mvme, base, reg); 00135 return status; 00136 }
void v1720_ChannelDACSet | ( | MVME_INTERFACE * | mvme, | |
uint32_t | base, | |||
uint32_t | channel, | |||
uint32_t | dac | |||
) |
Definition at line 116 of file v1720.c.
00117 { 00118 uint32_t reg; 00119 00120 reg = V1720_CHANNEL_DAC | (channel << 8); 00121 printf("base:0x%x reg:0x%x, DAC:%x\n", base, reg, dac); 00122 regWrite(mvme, base, reg, (dac & 0xFFFF)); 00123 }
uint32_t v1720_ChannelGet | ( | MVME_INTERFACE * | mvme, | |
uint32_t | base, | |||
uint32_t | channel, | |||
uint32_t | what | |||
) |
Definition at line 86 of file v1720.c.
00087 { 00088 uint32_t reg, mask; 00089 00090 if (what == V1720_CHANNEL_THRESHOLD) mask = 0x0FFF; 00091 if (what == V1720_CHANNEL_OUTHRESHOLD) mask = 0x0FFF; 00092 if (what == V1720_CHANNEL_DAC) mask = 0xFFFF; 00093 reg = what | (channel << 8); 00094 return regRead(mvme, base, reg); 00095 }
void v1720_ChannelOUThresholdSet | ( | MVME_INTERFACE * | mvme, | |
uint32_t | base, | |||
uint32_t | channel, | |||
uint32_t | threshold | |||
) |
Definition at line 107 of file v1720.c.
00108 { 00109 uint32_t reg; 00110 reg = V1720_CHANNEL_OUTHRESHOLD | (channel << 8); 00111 printf("base:0x%x reg:0x%x, outhreshold:%x\n", base, reg, threshold); 00112 regWrite(mvme, base, reg, (threshold & 0xFFF)); 00113 }
void v1720_ChannelSet | ( | MVME_INTERFACE * | mvme, | |
uint32_t | base, | |||
uint32_t | channel, | |||
uint32_t | what, | |||
uint32_t | that | |||
) |
Definition at line 73 of file v1720.c.
00074 { 00075 uint32_t reg, mask; 00076 00077 if (what == V1720_CHANNEL_THRESHOLD) mask = 0x0FFF; 00078 if (what == V1720_CHANNEL_OUTHRESHOLD) mask = 0x0FFF; 00079 if (what == V1720_CHANNEL_DAC) mask = 0xFFFF; 00080 reg = what | (channel << 8); 00081 printf("base:0x%x reg:0x%x, this:%x\n", base, reg, that); 00082 regWrite(mvme, base, reg, (that & 0xFFF)); 00083 }
void v1720_ChannelThresholdSet | ( | MVME_INTERFACE * | mvme, | |
uint32_t | base, | |||
uint32_t | channel, | |||
uint32_t | threshold | |||
) |
Definition at line 98 of file v1720.c.
00099 { 00100 uint32_t reg; 00101 reg = V1720_CHANNEL_THRESHOLD | (channel << 8); 00102 printf("base:0x%x reg:0x%x, threshold:%x\n", base, reg, threshold); 00103 regWrite(mvme, base, reg, (threshold & 0xFFF)); 00104 }
uint32_t v1720_DataBlockRead | ( | MVME_INTERFACE * | mvme, | |
uint32_t | base, | |||
uint32_t * | pdest, | |||
uint32_t * | nentry | |||
) |
v1720_DataBlockRead Read N entries (32bit)
mvme | vme structure | |
base | base address | |
pdest | Destination pointer |
Definition at line 253 of file v1720.c.
00254 { 00255 int status; 00256 00257 mvme_set_am( mvme, MVME_AM_A32); 00258 mvme_set_dmode( mvme, MVME_DMODE_D32); 00259 mvme_set_blt( mvme, MVME_BLT_MBLT64); 00260 // mvme_set_blt( mvme, MVME_BLT_BLT32); 00261 //mvme_set_blt( mvme, 0); 00262 00263 // Transfer in MBLT64 (8bytes), nentry is in 32bits(VF48) 00264 // *nentry * 8 / 2 00265 status = mvme_read(mvme, pdest, base+V1720_EVENT_READOUT_BUFFER, *nentry<<2); 00266 if (status != MVME_SUCCESS) 00267 return 0; 00268 00269 return (*nentry); 00270 }
uint32_t v1720_DataRead | ( | MVME_INTERFACE * | mvme, | |
uint32_t | a32base, | |||
uint32_t * | pdata, | |||
uint32_t | n32w | |||
) |
Definition at line 231 of file v1720.c.
00232 { 00233 uint32_t i; 00234 00235 for (i=0;i<n32w;i++) { 00236 *pdata = regRead(mvme, base, V1720_EVENT_READOUT_BUFFER); 00237 if (*pdata != 0xffffffff) 00238 pdata++; 00239 else 00240 break; 00241 } 00242 return i; 00243 }
void v1720_info | ( | MVME_INTERFACE * | mvme, | |
uint32_t | a32base, | |||
int * | nch, | |||
uint32_t * | n32w | |||
) |
Definition at line 181 of file v1720.c.
00182 { 00183 int i, chanmask; 00184 00185 // Evaluate the event size 00186 // Number of samples per channels 00187 *n32word = V1720_NSAMPLES_MODE[regRead(mvme, base, V1720_BUFFER_ORGANIZATION)]; 00188 00189 // times the number of active channels 00190 chanmask = 0xff & regRead(mvme, base, V1720_CHANNEL_EN_MASK); 00191 *nchannels = 0; 00192 for (i=0;i<8;i++) { 00193 if (chanmask & (1<<i)) 00194 *nchannels += 1; 00195 } 00196 00197 *n32word *= *nchannels; 00198 *n32word /= 2; // 2 samples per 32bit word 00199 *n32word += 4; // Headers 00200 }
uint32_t v1720_RegisterRead | ( | MVME_INTERFACE * | mvme, | |
uint32_t | a32base, | |||
int | offset | |||
) |
void v1720_RegisterWrite | ( | MVME_INTERFACE * | mvme, | |
uint32_t | a32base, | |||
int | offset, | |||
uint32_t | value | |||
) |
void v1720_Reset | ( | MVME_INTERFACE * | mvme, | |
uint32_t | a32base | |||
) |
Definition at line 55 of file v1720.c.
00056 { 00057 regWrite(mvme, base, V1720_SW_RESET, 0); 00058 }
int v1720_Setup | ( | MVME_INTERFACE * | mvme, | |
uint32_t | base, | |||
int | mode | |||
) |
Sets all the necessary paramters for a given configuration. The configuration is provided by the mode argument. Add your own configuration in the case statement. Let me know your setting if you want to include it in the distribution.
*mvme | VME structure | |
base | Module base address | |
mode | Configuration mode number |
Definition at line 297 of file v1720.c.
00298 { 00299 switch (mode) { 00300 case 0x0: 00301 printf("--------------------------------------------\n"); 00302 printf("Setup Skip\n"); 00303 printf("--------------------------------------------\n"); 00304 case 0x1: 00305 printf("--------------------------------------------\n"); 00306 printf("Trigger from FP, 8ch, 1Ks, postTrigger 800\n"); 00307 printf("--------------------------------------------\n"); 00308 regWrite(mvme, base, V1720_BUFFER_ORGANIZATION, 0x0A); // 1K buffer 00309 regWrite(mvme, base, V1720_TRIG_SRCE_EN_MASK, 0x4000); // External Trigger 00310 regWrite(mvme, base, V1720_CHANNEL_EN_MASK, 0xFF); // 8ch enable 00311 regWrite(mvme, base, V1720_POST_TRIGGER_SETTING, 800); // PreTrigger (1K-800) 00312 regWrite(mvme, base, V1720_ACQUISITION_CONTROL, 0x00); // Reset Acq Control 00313 printf("\n"); 00314 break; 00315 case 0x2: 00316 printf("--------------------------------------------\n"); 00317 printf("Trigger from LEMO\n"); 00318 printf("--------------------------------------------\n"); 00319 regWrite(mvme, base, V1720_BUFFER_ORGANIZATION, 1); 00320 printf("\n"); 00321 break; 00322 default: 00323 printf("Unknown setup mode\n"); 00324 return -1; 00325 } 00326 v1720_Status(mvme, base); 00327 return 0; 00328 }
void v1720_Status | ( | MVME_INTERFACE * | mvme, | |
uint32_t | a32base | |||
) |
Definition at line 274 of file v1720.c.
Referenced by v1720_Setup().
00275 { 00276 printf("================================================\n"); 00277 printf("V1720 at A32 0x%x\n", (int)base); 00278 printf("Board ID : 0x%x\n", regRead(mvme, base, V1720_BOARD_ID)); 00279 printf("Board Info : 0x%x\n", regRead(mvme, base, V1720_BOARD_INFO)); 00280 printf("Acquisition status : 0x%8.8x\n", regRead(mvme, base, V1720_ACQUISITION_STATUS)); 00281 printf("================================================\n"); 00282 }
void v1720_TrgCtl | ( | MVME_INTERFACE * | mvme, | |
uint32_t | a32base, | |||
uint32_t | reg, | |||
uint32_t | mask | |||
) |