Go to the source code of this file.
Defines | |
#define | LOW_MASK 0x000000FF |
#define | LOW_MID_MASK 0x0000FF00 |
#define | HIGH_MID_MASK 0x00FF0000 |
#define | HIGH_MASK 0xFF000000 |
#define | BRANCH1_MASK 0X000FF000 |
#define | BRANCH2_MASK 0X00000FF0 |
#define | BRANCH3_MASK 0X0000000F |
Functions | |
void | ppg (void) |
void | VPPGPolzSet (MVME_INTERFACE *mvme, const DWORD base_adr, BYTE value) |
BYTE | VPPGPolzRead (MVME_INTERFACE *mvme, const DWORD base_adr) |
BYTE | VPPGPolzFlip (MVME_INTERFACE *mvme, const DWORD base_adr) |
BYTE | VPPGRegWrite (MVME_INTERFACE *mvme, const DWORD base_adr, DWORD reg_offset, BYTE value) |
BYTE | VPPGRegRead (MVME_INTERFACE *mvme, const DWORD base_adr, DWORD reg_offset) |
void | VPPGInit (MVME_INTERFACE *mvme, const DWORD base_adr) |
BYTE | VPPGStatusRead (MVME_INTERFACE *mvme, const DWORD base_adr) |
void | VPPGBeamOn (MVME_INTERFACE *mvme, const DWORD base_adr) |
void | VPPGBeamOff (MVME_INTERFACE *mvme, const DWORD base_adr) |
void | VPPGBeamCtlPPG (MVME_INTERFACE *mvme, const DWORD base_adr) |
void | VPPGPolzCtlVME (MVME_INTERFACE *mvme, const DWORD base_adr) |
void | VPPGPolzCtlPPG (MVME_INTERFACE *mvme, const DWORD base_adr) |
BYTE | VPPGBeamCtlRegRead (MVME_INTERFACE *mvme, const DWORD base_adr) |
void | VPPGStartSequencer (MVME_INTERFACE *mvme, const DWORD base_adr) |
void | VPPGStopSequencer (MVME_INTERFACE *mvme, const DWORD base_adr) |
BYTE | VPPGEnableExtTrig (MVME_INTERFACE *mvme, const DWORD base_adr) |
BYTE | VPPGDisableExtTrig (MVME_INTERFACE *mvme, const DWORD base_adr) |
BYTE | VPPGExtTrigRegRead (MVME_INTERFACE *mvme, const DWORD base_adr) |
DWORD | VPPGPolmskWrite (MVME_INTERFACE *mvme, const DWORD base_adr, const DWORD pol) |
DWORD | VPPGPolmskRead (MVME_INTERFACE *mvme, const DWORD base_adr) |
DWORD | VPPGStartpatternWrite (MVME_INTERFACE *mvme, const DWORD base_adr, const DWORD pol) |
void | byteOutputOrder (PARAM data, char *array) |
PARAM | lineRead (FILE *infile) |
int | VPPGLoad (MVME_INTERFACE *mvme, const DWORD base_adr, char *file) |
Variables | |
int | ddd = 1 |
FILE * | ppginput |
#define BRANCH1_MASK 0X000FF000 |
Referenced by byteOutputOrder().
#define BRANCH2_MASK 0X00000FF0 |
Referenced by byteOutputOrder().
#define BRANCH3_MASK 0X0000000F |
Referenced by byteOutputOrder().
#define HIGH_MASK 0xFF000000 |
Referenced by byteOutputOrder().
#define HIGH_MID_MASK 0x00FF0000 |
Referenced by byteOutputOrder().
#define LOW_MASK 0x000000FF |
Referenced by byteOutputOrder().
#define LOW_MID_MASK 0x0000FF00 |
Referenced by byteOutputOrder().
void byteOutputOrder | ( | PARAM | data, | |
char * | array | |||
) |
byteOutputOrder byte swap for output byte swap for PPG.
data | ||
array |
Definition at line 490 of file vppg.c.
Referenced by VPPGLoad().
00491 { 00492 #define LOW_MASK 0x000000FF 00493 #define LOW_MID_MASK 0x0000FF00 00494 #define HIGH_MID_MASK 0x00FF0000 00495 #define HIGH_MASK 0xFF000000 00496 #define BRANCH1_MASK 0X000FF000 00497 #define BRANCH2_MASK 0X00000FF0 00498 #define BRANCH3_MASK 0X0000000F 00499 00500 //unsigned long total_bits; 00501 //unsigned int *test; 00502 00503 /*total_bits = data.opcode_width + data.branch_width + data.delay_width */ 00504 /* + data.flag_width; */ 00505 00506 array[0] = (char)( (data.flags & HIGH_MID_MASK) >> 16); 00507 array[1] = (char)( (data.flags & LOW_MID_MASK) >> 8); 00508 array[2] = (char)( (data.flags & LOW_MASK)); 00509 00510 if (ddd) printf("branch = %lx\n",data.branch_addr); 00511 00512 array[3] = (char)( (data.branch_addr & BRANCH1_MASK) >> 12); 00513 array[4] = (char)( (data.branch_addr & BRANCH2_MASK) >> 4); 00514 array[5] = (char)((data.branch_addr & BRANCH3_MASK) << 4); 00515 array[5] = array[5] | (char)(data.opcode & BRANCH3_MASK); 00516 00517 array[6] = (char)( (data.delay & HIGH_MASK) >> 24); 00518 array[7] = (char)( (data.delay & HIGH_MID_MASK) >> 16); 00519 array[8] = (char)( (data.delay & LOW_MID_MASK) >> 8); 00520 array[9] = (char)( (data.delay & LOW_MASK)); 00521 }
PARAM lineRead | ( | FILE * | infile | ) |
lineRead Read line of input file read line.
*input | FILE pointer |
Definition at line 530 of file vppg.c.
Referenced by VPPGLoad().
00531 { 00532 PARAM data_struct; 00533 unsigned int temp; 00534 // char line[128]; 00535 00536 /* 00537 fgets(line, 128, infile); 00538 printf("line:%s\n", line); 00539 */ 00540 fscanf(infile,"%x",&temp); 00541 data_struct.opcode = (char)temp; 00542 00543 fscanf(infile,"%lx",&(data_struct.branch_addr)); 00544 fscanf(infile,"%lx",&(data_struct.delay)); 00545 fscanf(infile,"%lx",&(data_struct.flags)); 00546 00547 return(data_struct); 00548 }
void ppg | ( | void | ) |
Definition at line 24 of file vppg.c.
00025 { 00026 printf(" PPG function support\n"); 00027 printf("A Init B Load\n"); 00028 printf("C StopSequencer E StartSequencer\n"); 00029 printf("F EnableExtTrig G DisableExtTrig\n"); 00030 printf("H ExtTrigRegRead I StatusRead\n"); 00031 printf("J PolmskRead K PolmskWrite\n"); 00032 printf("L RegWrite M RegRead\n"); 00033 printf("N StartpatternWrite O PolzSet\n"); 00034 printf("Q PolzRead R PolzFlip\n"); 00035 printf("S PolzCtlPPG T PolzCtlVME\n"); 00036 printf("U BeamOn V BeamOff \n"); 00037 printf("W BeamCtlPPG Y BeamCtlRegRead\n"); 00038 printf("D debug (toggles) P print this list\n"); 00039 printf("X exit \n"); 00040 printf("\n"); 00041 }
void VPPGBeamCtlPPG | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr | |||
) |
VPPGBeamCtlPPG PPG controls the Beam On/Off signal. Give PPG script control of Beam On/Off signal (ch14)
base\_adr | PPG VME base address |
Definition at line 267 of file vppg.c.
Referenced by VPPGInit().
00268 { 00269 VPPGRegWrite(mvme, base_adr,VPPG_VME_BEAM_CTL , 3); 00270 /* channel 14 (beam on/off) follows ppg pulseblaster script */ 00271 return; 00272 }
BYTE VPPGBeamCtlRegRead | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr | |||
) |
VPPGBeamCtlRegRead Read the Beam Control Register Read the Beam Control Register
base\_adr | PPG VME base address |
Definition at line 307 of file vppg.c.
00308 { 00309 BYTE data; 00310 data = (0xFF & (VPPGRegRead(mvme, base_adr, VPPG_VME_BEAM_CTL))); 00311 if(ddd)printf("VPPGBeamCtlRegRead: read back %d \n",data); 00312 if(data == 0) 00313 printf("Beam off independent of PPG script\n"); 00314 else if(data == 1) 00315 printf("Beam on independent of PPG script\n"); 00316 else 00317 printf("PPG script controls Beam output\n"); 00318 return(data); 00319 }
void VPPGBeamOff | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr | |||
) |
VPPGBeamOff Directly set Beam Off signal. Set Beam Off (independent of PPG script)
base\_adr | PPG VME base address |
Definition at line 253 of file vppg.c.
00254 { 00255 VPPGRegWrite(mvme, base_adr,VPPG_VME_BEAM_CTL , 0); 00256 /* channel 14 (beam on/off) set to OFF; ignores ppg pulseblaster script */ 00257 return; 00258 }
void VPPGBeamOn | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr | |||
) |
VPPGBeamOn Directly set Beam On signal. Set Beam On (independent of ppg script)
base\_adr | PPG VME base address |
Definition at line 237 of file vppg.c.
00238 { 00239 00240 VPPGRegWrite(mvme, base_adr,VPPG_VME_BEAM_CTL , 1); 00241 /* channel 14 (beam on/off) set to ON; ignores ppg pulseblaster script */ 00242 return; 00243 }
BYTE VPPGDisableExtTrig | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr | |||
) |
VPPGDisableExtTrig(ppg_base) Disable front panel trigger input so external inputs cannot start the sequence Disable external trigger input so external inputs cannot start the sequence
base\_adr | PPG VME base address |
Definition at line 373 of file vppg.c.
Referenced by VPPGInit().
00374 { 00375 return VPPGRegWrite(mvme, base_adr, VPPG_VME_TRIG_CTL , 1); 00376 }
BYTE VPPGEnableExtTrig | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr | |||
) |
VPPGEnableExtTrig(ppg_base) Enable front panel trigger input so external inputs can start the sequence Enable external trigger input so external inputs can start the sequence
base\_adr | PPG VME base address |
Definition at line 357 of file vppg.c.
00358 { 00359 BYTE data; 00360 data = VPPGRegWrite(mvme, base_adr, VPPG_VME_TRIG_CTL , 0); 00361 return data; 00362 }
BYTE VPPGExtTrigRegRead | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr | |||
) |
VPPGExtTrigRegRead Read external trig register (bit 0 int/ext trigger is enabled bit 1 trigger active/inactive) Read PPG.
base\_adr | PPG VME base addroless |
Definition at line 386 of file vppg.c.
00387 { 00388 BYTE data; 00389 data = (BYTE) VPPGRegRead(mvme, base_adr, VPPG_VME_TRIG_CTL); 00390 if(data == 0) 00391 printf("External trigger is ENABLED\n"); 00392 else 00393 printf("External trigger is DISABLED\n"); 00394 return(data); 00395 }
void VPPGInit | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr | |||
) |
VPPGInit Initialize the PPG Initialize PPG
base\_adr | PPG VME base address |
Definition at line 173 of file vppg.c.
00174 { 00175 VPPGPolmskWrite(mvme, base_adr, VPPG_DEFAULT_PPG_POL_MSK ); 00176 00177 //by default PPG controls these outputs (Titan) 00178 VPPGPolzCtlPPG(mvme, base_adr); 00179 VPPGBeamCtlPPG(mvme, base_adr); 00180 00181 // default.. external trigger input disabled 00182 VPPGDisableExtTrig(mvme, base_adr); 00183 00184 return; 00185 }
int VPPGLoad | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr, | |||
char * | file | |||
) |
ppgLoad Load PPG file into sequencer. Load file PPG.
base\_adr | PPG VME base address |
Definition at line 557 of file vppg.c.
00558 { 00559 /* Local Variables */ 00560 long j,i; 00561 int index = 0; 00562 char text[100]; 00563 char num_instructions; 00564 char flag_size; 00565 char delay_size; 00566 char branch_size; 00567 char opcode_size; 00568 unsigned char array[12]; 00569 PARAM command_info; 00570 unsigned int temp; 00571 unsigned char result; 00572 // FILE *ppginput; 00573 unsigned short port_address; 00574 00575 printf("Opening file: %s ... ",file); 00576 ppginput = fopen(file,"r"); 00577 sleep(1) ; // sleep 1s 00578 if(ppginput == NULL){ 00579 printf("ppgLoad: Byte code file %s could not be opened. [%p]\n", file, ppginput); 00580 printf(" If file is present, problem may be too many rpc processes. Reboot ppc and retry\n"); 00581 return -1; 00582 } 00583 00584 fscanf(ppginput,"%s",text); 00585 index = strcmp(text,"Op_Code"); 00586 if(index == 0){ 00587 fscanf(ppginput,"%s",text); 00588 index = strcmp(text,"Size"); 00589 if(index == 0){ 00590 fscanf(ppginput,"%s",text); 00591 } 00592 else { 00593 printf("ppgLoad: Input file has wrong format. Aborting procedure.\n"); 00594 return -1; 00595 } 00596 } 00597 opcode_size = (char)atol(text); 00598 00599 fscanf(ppginput,"%s",text); 00600 index = strcmp(text,"Branch"); 00601 if(index == 0){ 00602 fscanf(ppginput,"%s",text); 00603 index = strcmp(text,"Size"); 00604 if(index == 0){ 00605 fscanf(ppginput,"%s",text); 00606 } 00607 else { 00608 printf("ppgLoad: Input file has wrong format. Aborting procedure.\n"); 00609 return -1; 00610 } 00611 } 00612 branch_size = (char)atol(text); 00613 00614 fscanf(ppginput,"%s",text); 00615 index = strcmp(text,"Delay"); 00616 if(index == 0){ 00617 fscanf(ppginput,"%s",text); 00618 index = strcmp(text,"Size"); 00619 if(index == 0){ 00620 fscanf(ppginput,"%s",text); 00621 } 00622 else { 00623 printf("ppgLoad: Input file has wrong format. Aborting procedure.\n"); 00624 return -1; 00625 } 00626 } 00627 delay_size = (char)atol(text); 00628 00629 fscanf(ppginput,"%s",text); 00630 index = strcmp(text,"Flag"); 00631 if(index == 0){ 00632 fscanf(ppginput,"%s",text); 00633 index = strcmp(text,"Size"); 00634 if(index == 0){ 00635 fscanf(ppginput,"%s",text); 00636 } 00637 else { 00638 printf("ppgLoad: Input file has wrong format. Aborting procedure.\n"); 00639 return -1; 00640 } 00641 } 00642 flag_size = (char)atol(text); 00643 00644 fscanf(ppginput,"%s",text); 00645 index = strcmp(text,"Instruction"); 00646 if(index == 0){ 00647 fscanf(ppginput,"%s",text); 00648 index = strcmp(text,"Lines"); 00649 if(index == 0){ 00650 fscanf(ppginput,"%s",text); 00651 } 00652 else { 00653 printf("ppgLoad: Input file has wrong format. Aborting procedure.\n"); 00654 return -1; 00655 } 00656 } 00657 num_instructions = (char)atol(text); 00658 if (ddd) printf("instruction lines = %d\n",num_instructions); 00659 00660 fscanf(ppginput,"%s",text); 00661 index = strcmp(text,"Port"); 00662 if(index == 0){ 00663 fscanf(ppginput,"%s",text); 00664 index = strcmp(text,"Address"); 00665 if(index == 0){ 00666 fscanf(ppginput,"%hx",&port_address); 00667 } 00668 else { 00669 printf("ppgLoad: Input file has wrong format. Aborting procedure.\n"); 00670 return -1; 00671 } 00672 } 00673 if (ddd) printf("Base Address = %lx\n",base_adr); 00674 00675 if (ddd) printf("Reading byte code file...\n"); 00676 00677 00678 command_info.opcode_width = opcode_size; 00679 command_info.branch_width = branch_size; 00680 command_info.delay_width = delay_size; 00681 command_info.flag_width = flag_size; 00682 00683 /* init ISA BUS Controller */ 00684 VPPGRegWrite(mvme, base_adr, VPPG_PPG_RESET_REG,0x00); 00685 VPPGRegWrite(mvme, base_adr, VPPG_BYTES_PER_WORD,0x0A); 00686 VPPGRegWrite(mvme, base_adr, VPPG_TOGL_MEM_DEVICE,0x00);/*Is this still active?*/ 00687 VPPGRegWrite(mvme, base_adr, VPPG_CLEAR_ADDR_COUNTER,0x00); 00688 00689 for(i=0;i<num_instructions;i++){ 00690 command_info = lineRead(ppginput); 00691 if (ddd) 00692 { 00693 printf("%1x ",command_info.opcode); 00694 printf("%5lx ",command_info.branch_addr); 00695 printf("%8lx ",command_info.delay); 00696 printf("%6lx ",command_info.flags); 00697 printf("\n"); 00698 } 00699 byteOutputOrder(command_info,array); 00700 00701 for(j=0;j<10;j++){ 00702 result = array[j]; 00703 temp = (unsigned int) result; 00704 if (ddd) printf("%x ",temp); 00705 } 00706 if (ddd) printf("\n"); 00707 00708 for(j=0;j<10;j++) 00709 { 00710 VPPGRegWrite(mvme, base_adr, VPPG_LOAD_MEM, array[j]); 00711 } 00712 } 00713 00714 /* arm controller */ 00715 VPPGRegWrite(mvme, base_adr, VPPG_LOAD_MEM,0x00);/*writes the stop command */ 00716 VPPGRegWrite(mvme, base_adr, VPPG_LOAD_MEM,0x00); 00717 VPPGRegWrite(mvme, base_adr, VPPG_LOAD_MEM,0x00); 00718 VPPGRegWrite(mvme, base_adr, VPPG_LOAD_MEM,0x00); 00719 VPPGRegWrite(mvme, base_adr, VPPG_LOAD_MEM,0x00); 00720 VPPGRegWrite(mvme, base_adr, VPPG_LOAD_MEM,0x01); 00721 VPPGRegWrite(mvme, base_adr, VPPG_LOAD_MEM,0x00); 00722 VPPGRegWrite(mvme, base_adr, VPPG_LOAD_MEM,0x00); 00723 VPPGRegWrite(mvme, base_adr, VPPG_LOAD_MEM,0x00); 00724 VPPGRegWrite(mvme, base_adr, VPPG_LOAD_MEM,0x02); /*End of stop command */ 00725 00726 00727 VPPGRegWrite(mvme, base_adr, VPPG_PROGRAMMING_FIN,0x00); 00728 fclose(ppginput); 00729 if(ddd) printf("Programming ended, controller armed"); 00730 return 1; 00731 }
DWORD VPPGPolmskRead | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr | |||
) |
VPPGPolmskRead Read the Polarity mask. Read polarity mask.
base\_adr | PPG VME base address |
Definition at line 431 of file vppg.c.
Referenced by VPPGPolmskWrite(), and VPPGStartpatternWrite().
00432 { 00433 BYTE temp; 00434 DWORD pol; 00435 pol = 0; 00436 temp = (BYTE)(VPPGRegRead(mvme, base_adr, VPPG_OUTP_POL_MASK_HI)); 00437 if(ddd)printf("read high bits : 0x%x\n",temp); 00438 pol |= (temp & 0xFF) << 16; 00439 if(ddd)printf("pol = 0x%lx\n",pol); 00440 00441 temp =(BYTE)(VPPGRegRead(mvme, base_adr, VPPG_OUTP_POL_MASK_MID)); 00442 if(ddd)printf("read mid bits : 0x%x\n",temp); 00443 pol |= (temp & 0xFF) << 8; 00444 if(ddd)printf("pol = 0x%lx\n",pol); 00445 00446 temp =(BYTE)(VPPGRegRead(mvme, base_adr, VPPG_OUTP_POL_MASK_LO)); 00447 if(ddd)printf("read low bits : 0x%x\n",temp); 00448 pol |= (temp & 0xFF); 00449 printf("pol = 0x%lx\n",pol); 00450 00451 return pol; 00452 }
DWORD VPPGPolmskWrite | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr, | |||
const DWORD | pol | |||
) |
VPPG Write the Polarity mask. Write and read back polarity mask.
base\_adr | PPG VME base address | |
pol | polarity (24bit) |
Definition at line 405 of file vppg.c.
Referenced by VPPGInit(), and VPPGStartSequencer().
00406 { 00407 BYTE temp; 00408 00409 temp = *((BYTE *) &pol + 2); 00410 if(ddd)printf("write high bits : 0x%x\n",temp); 00411 VPPGRegWrite(mvme, base_adr, VPPG_OUTP_POL_MASK_HI, temp); 00412 00413 temp = *((BYTE *) &pol + 1); 00414 if(ddd)printf("write mid bits : 0x%x\n",temp); 00415 VPPGRegWrite(mvme, base_adr, VPPG_OUTP_POL_MASK_MID, temp); 00416 00417 temp = *((BYTE *) &pol + 0); 00418 if(ddd)printf("write low bits : 0x%x\n",temp); 00419 VPPGRegWrite(mvme, base_adr, VPPG_OUTP_POL_MASK_LO, temp); 00420 00421 return VPPGPolmskRead(mvme,base_adr); 00422 }
void VPPGPolzCtlPPG | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr | |||
) |
VPPGPolzCtlPPG PPG controls the Pol On/Off signal for helicity Give PPG script control of Pol On/Off signal (DRV POL) which now follows ch15
base\_adr | PPG VME base address |
Definition at line 294 of file vppg.c.
Referenced by VPPGInit().
00295 { 00296 VPPGRegWrite(mvme, base_adr, VPPG_POLZ_SOURCE_CONTROL , 2); 00297 /* DRV POL (helicity) follows ch15 and ppg pulseblaster script */ 00298 return; 00299 }
void VPPGPolzCtlVME | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr | |||
) |
VPPGPolzCtlVME VME controls the Pol On/Off signal for helicity Give VME control of Pol On/Off signal (DRV POL) (PPG script ignored)
base\_adr | PPG VME base address |
Definition at line 281 of file vppg.c.
00282 { 00283 VPPGRegWrite(mvme, base_adr, VPPG_POLZ_SOURCE_CONTROL , 0); 00284 /* DRV POL (helicity) independent of ppg pulseblaster script */ 00285 return; 00286 }
BYTE VPPGPolzFlip | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr | |||
) |
VPPGPolzFlip Flip the polarization bit. Read PPG.
base\_adr | PPG VME base address |
Definition at line 81 of file vppg.c.
00082 { 00083 DWORD value; 00084 00085 value = (0xFF & (VPPGPolzRead(mvme, base_adr))); 00086 00087 if(ddd)printf("VPPGPolzFlip: read back %lu, now flipping \n",value); 00088 if(value) { 00089 VPPGPolzSet(mvme, base_adr, 0); 00090 } 00091 else { 00092 VPPGPolzSet(mvme, base_adr, 1); 00093 } 00094 value = (0xFF & (VPPGPolzRead(mvme, base_adr))); 00095 if(ddd)printf("VPPGPolzFlip: after flip, read back %lu \n",value); 00096 00097 00098 00099 return (BYTE)value; 00100 }
BYTE VPPGPolzRead | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr | |||
) |
ppgPolzRead Read Polarization bit. Read PPG.
base\_adr | PPG VME base addroless |
Definition at line 64 of file vppg.c.
Referenced by VPPGPolzFlip().
00065 { 00066 DWORD value; 00067 value = VPPGRegRead(mvme, base_adr, VPPG_VME_POLZ_SET); 00068 value &= 0xFF; 00069 00070 if (ddd) printf("Read addr 0x%lx data=%lu\n", (DWORD)(base_adr +VPPG_VME_POLZ_SET),value ); 00071 00072 return (BYTE)value; 00073 }
void VPPGPolzSet | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr, | |||
BYTE | value | |||
) |
ppgPolzSet Set Polarization bit to a given value. Write PPG.
base\_adr | PPG VME base addroless | |
value | (8bit) |
Definition at line 51 of file vppg.c.
Referenced by VPPGPolzFlip().
00052 { 00053 VPPGRegWrite(mvme, base_adr, VPPG_VME_POLZ_SET, value); 00054 return; 00055 }
BYTE VPPGRegRead | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr, | |||
DWORD | reg_offset | |||
) |
VPPGRegRead Read PPG register. Read PPG.
base\_adr | PPG VME base addroless | |
reg\_offset | PPG register |
Definition at line 145 of file vppg.c.
Referenced by VPPGBeamCtlRegRead(), VPPGExtTrigRegRead(), VPPGPolmskRead(), VPPGPolzRead(), and VPPGStatusRead().
00146 { 00147 DWORD value,myreg; 00148 int cmode, localam; 00149 00150 mvme_get_dmode(mvme, &cmode); // store present data mode 00151 mvme_set_dmode(mvme, MVME_DMODE_D8); // set D8 for PPG 00152 00153 mvme_get_am(mvme, &localam); // store present addressing mode 00154 mvme_set_am(mvme, MVME_AM_A16_ND); // set A16 for PPG 00155 00156 myreg = base_adr + reg_offset; 00157 if (ddd) printf("Reading from address 0x%lx\n", myreg ); 00158 value = mvme_read_value(mvme, myreg ); 00159 printf("Read back 0x%lx (%lu)\n",value,value); 00160 00161 mvme_set_dmode(mvme, cmode);// restore data mode 00162 mvme_set_am(mvme, localam);// restore addressing mode 00163 return (BYTE) value; 00164 }
BYTE VPPGRegWrite | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr, | |||
DWORD | reg_offset, | |||
BYTE | value | |||
) |
VPPGRegWrite Write into PPG register. Write PPG.
base\_adr | PPG VME base address | |
reg\_offset | PPG register | |
value | (8bit) |
Definition at line 111 of file vppg.c.
Referenced by VPPGBeamCtlPPG(), VPPGBeamOff(), VPPGBeamOn(), VPPGDisableExtTrig(), VPPGEnableExtTrig(), VPPGLoad(), VPPGPolmskWrite(), VPPGPolzCtlPPG(), VPPGPolzCtlVME(), VPPGPolzSet(), VPPGStartpatternWrite(), VPPGStartSequencer(), and VPPGStopSequencer().
00112 { 00113 00114 DWORD myval,myreg; 00115 int cmode, localam; 00116 00117 mvme_get_dmode(mvme, &cmode); // remember present VME data mode 00118 mvme_set_dmode(mvme, MVME_DMODE_D8); // set D8 for PPG 00119 00120 mvme_get_am(mvme, &localam); // remember present VME addressing mode 00121 mvme_set_am(mvme, MVME_AM_A16_ND); // set A16 for PPG 00122 00123 myreg = base_adr + reg_offset; 00124 myval = (DWORD)value; 00125 mvme_write_value(mvme, myreg, value); 00126 if (ddd) printf("Writing 0x%x to 0x%lx\n", value, myreg ); 00127 myval = 0x1BAD1BAD; // set to a different value 00128 myval = mvme_read_value(mvme, myreg); 00129 if(ddd)printf("mvme_read_value returns 0x%lx (%lu)\n",myval,myval); 00130 00131 mvme_set_dmode(mvme, cmode); // restore VME data mode 00132 mvme_set_am(mvme, localam); // restore VME addressing mode 00133 00134 return (BYTE)myval; 00135 }
DWORD VPPGStartpatternWrite | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr, | |||
const DWORD | pol | |||
) |
ppg ????????????????????? Write the Start(Power up or Reset)Pattern. Write and read back startup pattern.
base\_adr | PPG VME base address | |
pol | polarity (24bit) |
Definition at line 462 of file vppg.c.
00464 { 00465 00466 VPPGRegWrite(mvme, base_adr, VPPG_PPG_RESET_REG,0); 00467 VPPGRegWrite(mvme, base_adr, VPPG_BYTES_PER_WORD,0x0A); 00468 VPPGRegWrite(mvme, base_adr, VPPG_TOGL_MEM_DEVICE,0); 00469 VPPGRegWrite(mvme, base_adr, VPPG_CLEAR_ADDR_COUNTER,0x55); 00470 VPPGRegWrite(mvme, base_adr, VPPG_PROGRAMMING_FIN,7); 00471 VPPGRegWrite(mvme, base_adr, VPPG_PPG_START_TRIGGER,7); 00472 VPPGRegWrite(mvme, base_adr, VPPG_PPG_RESET_REG,1); 00473 VPPGRegWrite(mvme, base_adr, VPPG_BYTES_PER_WORD,3); 00474 VPPGRegWrite(mvme, base_adr, VPPG_CLEAR_ADDR_COUNTER,0); 00475 VPPGRegWrite(mvme, base_adr, VPPG_LOAD_MEM,*((BYTE *) &pol + 1)); 00476 VPPGRegWrite(mvme, base_adr, VPPG_LOAD_MEM,*((BYTE *) &pol + 2)); 00477 VPPGRegWrite(mvme, base_adr, VPPG_LOAD_MEM,*((BYTE *) &pol + 3)); 00478 VPPGRegWrite(mvme, base_adr,0x05,0); 00479 VPPGRegWrite(mvme, base_adr,0x05,0); 00480 return VPPGPolmskRead(mvme, base_adr); 00481 }
void VPPGStartSequencer | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr | |||
) |
VPPGStartSequencer Start the PPG sequencer (internal trigger) start the PPG sequencer.
base\_adr | PPG VME base address |
Definition at line 328 of file vppg.c.
00329 { 00330 00331 VPPGPolmskWrite(mvme, base_adr, VPPG_DEFAULT_PPG_POL_MSK); 00332 VPPGRegWrite(mvme, base_adr, VPPG_PPG_START_TRIGGER , 0); 00333 return; 00334 }
BYTE VPPGStatusRead | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr | |||
) |
VPPGStatusRead Read Status register. Read status.
base\_adr | PPG VME base address |
Definition at line 194 of file vppg.c.
00195 { 00196 BYTE value,itmp; 00197 value = VPPGRegRead(mvme, base_adr, VPPG_VME_READ_STAT_REG ); 00198 if (value & 1) 00199 printf("Pulseblaster IS reset\n"); 00200 else 00201 printf("Pulseblaster is NOT reset\n"); 00202 if (value & 2) 00203 printf("Pulseblaster IS running \n"); 00204 else 00205 printf("Pulseblaster NOT running \n"); 00206 if (value & 4) 00207 printf("Pulseblaster IS stopped \n"); 00208 else 00209 printf("Pulseblaster is NOT stopped \n"); 00210 00211 itmp = (value & 0x18)>> 4; 00212 printf("VME polarization source control bits = 0x%x\n",itmp); 00213 00214 if (value & 20) 00215 printf("VME Polarization control: ACTIVE \n"); 00216 else 00217 printf("VME Polarization control: OFF \n"); 00218 if (value & 40) 00219 printf("External clock IS present \n"); 00220 else 00221 printf("External clock NOT present \n"); 00222 00223 if (value & 80) 00224 printf("External Polarization control: ACTIVE \n"); 00225 else 00226 printf("External Polarization control: OFF \n"); 00227 00228 return (BYTE)value; 00229 }
void VPPGStopSequencer | ( | MVME_INTERFACE * | mvme, | |
const DWORD | base_adr | |||
) |
VPPGStopSequencer Stop the PPG sequencer. Stop the PPG sequencer.
base\_adr | PPG VME base address |
Definition at line 343 of file vppg.c.
00344 { 00345 VPPGRegWrite(mvme, base_adr, VPPG_VME_RESET , 0); 00346 return; 00347 }
int ddd = 1 |
Definition at line 18 of file vppg.c.
Referenced by byteOutputOrder(), VPPGBeamCtlRegRead(), VPPGLoad(), VPPGPolmskRead(), VPPGPolmskWrite(), VPPGPolzFlip(), VPPGPolzRead(), VPPGRegRead(), and VPPGRegWrite().
FILE* ppginput |