Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 52 → Rev 81

/pts/PtsModule_CVI.c
10,8 → 10,9
#include <formatio.h>
static int p1;
 
// ./pts -a 0x1000000 -v 1 -w 2 turn LED ON
// ./pts -a 0x1000000 -v 1 -w 1 turn LED OFF
// sudo ./pts -a 0x1000000 -v 1 -w 2 turn LED ON
// sudo ./pts -a 0x1000000 -v 1 -w 1 turn LED OFF
// sudo ./ptsvmusb -a 0x02501000 -v 2 -i a.bit -b 2
#include <stdlib.h>
#include <stdio.h>
 
19,18 → 20,13
 
#include <string.h>
 
#include "vme.h"
 
#ifndef CAEN_V1718
//typedef unsigned long uint32_t;
#endif
/*
void Delay(double t){
usleep(t*1e6);
}
*/
 
 
 
 
 
int verbose;
uint32_t ptaddr=0;
char str[255];
37,13 → 33,13
 
int Pts_write(uint32_t addr, uint32_t data ){
int i;
VME_A32D32_W(ptaddr+addr,&data);
VME_A32D32_W(ptaddr+addr,data);
return 0;
}
 
int Pts_Mwrite(uint32_t addr, uint32_t data ){
int i;
VME_A32D32_MW(ptaddr+addr,&data);
VME_MW(VME_A32, VME_D32, ptaddr+addr,data);
return 0;
}
 
106,8 → 102,6
(c == 0xff) ? dummyword++ : (dummyword=0);
} while( dummyword < 4 );
 
// const long byte_per_dot = BYTE_PER_DOT;
// unsigned long nchar = 0;
if( mode == SLAVESERIAL_MODE ) {
if(verbose) SetCtrlVal(p1,P1_RESPONSE,"slave serial mode");
Pts_write( ADR_MODE, mode );
125,7 → 119,10
if( verbose ) SetCtrlVal(p1,P1_RESPONSE,"select map mode\n");
Pts_write( ADR_MODE, SELECTMAP_MODE );
Pts_erase( verbose );
for( j=0; j<4; j++ ) Pts_write( ADR_CFG, 0xff );
VME_MWRST();
for( j=0; j<4; j++ ) Pts_Mwrite( ADR_CFG, 0xff );
VME_MWEXEC();
VME_MWRST();
while( (c=getc(fp))!=EOF ){
int cc = 0;
227,7 → 224,7
if ((p1 = LoadPanel (0, "PtsModule_CVI.uir", P1)) < 0)
return -1;
DisplayPanel (p1);
VME_START(NULL);
GetCtrlVal(p1,P1_VERBOSE,&verbose);
GetCtrlVal(p1,P1_ADDRESS,saddr);
ptaddr = strtoul (saddr,NULL,0);
271,8 → 268,11
case EVENT_COMMIT:
GetCtrlVal(p1,P1_FIRMWARE,filename);
GetCtrlVal(p1,P1_MODE,&mode);
Pts_configure_bit( filename, mode, verbose );
if(VME_CONNECTED() >=0 ) {
Pts_configure_bit( filename, mode, verbose );
} else {
MessagePopup ("Warning", "Connect VME!!");
}
break;
}
return 0;
471,3 → 471,30
}
return 0;
}
 
int CVICALLBACK Connect (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
int interface = 0;
switch (event)
{
case EVENT_COMMIT:
GetCtrlVal (p1, P1_VMEINTERFACE, &interface);
VME_START(interface);
break;
}
return 0;
}
 
int CVICALLBACK Disconnect (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
VME_STOP();
break;
}
return 0;
}