Subversion Repositories f9daq

Compare Revisions

No changes between revisions

Ignore whitespace Rev 61 → Rev 62

/cvi/instr/VmUsbStack/cvibuild.VmUsbStack/exports
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/instr/VmUsbStack/cvibuild.VmUsbStack/VmUsbStack_cvi.nidobj
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/cvi/instr/VmUsbStack/VmUsbStack_cvi.c
0,0 → 1,103
 
#include <stdio.h>
#include "VmUsbStack_cvi.h"
 
#define MAXSTACKSIZE 1000
long fStack[MAXSTACKSIZE];
 
 
void VmUsbStackInit(){
fStack[0]=1;
fStack[1]=0;
}
 
void VmUsbStackClear(){
VmUsbStackInit();
}
 
int VmUsbStackGet(int maxn, int *stack){
int i;
for (i=0;i< fStack[0]+1;i++){
if (i<maxn) stack[i]=fStack[i]; else return -1;
}
return fStack[0];
}
 
 
void VmUsbStackAppend(int cmd, int addr ){
int i= fStack[0]+1;
fStack[i] = (cmd & 0xFFFF);
fStack[i+1] = (cmd >> 16);
fStack[i+2] = addr&0xFFFF;
fStack[i+3] = (addr >> 16)& 0xFFFF;
fStack[0]+=4;
}
 
void VmUsbStackAppendData(int cmd, int addr , int data){
int i=0;
VmUsbStackAppend( cmd, addr );
i = fStack[0]+1;
fStack[i] = data & 0xFFFF;
fStack[i+1] = (data >> 16)&0xFFFF;
fStack[0]+=2;
}
 
void VmUsbStackConditionalRead(int adr_mod,int d16d32, int addr, int bmask){
VmUsbStackAppend(CMD_READ| CMD_HD | adr_mod ,addr);
VmUsbStackAppendData(CMD_READ| CMD_HD | CMD_HM |adr_mod, d16d32 |addr,bmask);
}
 
void VmUsbStackMultiRead(int adr_mod,int d16d32, int baseaddr, int n, int increment){
int i;
for (i=0;i<n;i++) VmUsbStackAppend( adr_mod | CMD_READ, d16d32 +baseaddr + i*increment);
}
void VmUsbStackMultiWrite(int adr_mod,int d16d32,int baseaddr, int n, int increment, int data){
int i;
for (i=0;i<n;i++) VmUsbStackAppendData( adr_mod | CMD_WRITE,d16d32 + baseaddr+i*increment, data);
}
 
void VmUsbStackPrint(){
int i;
for (i=0; i < fStack[0]+1;i++) printf("0x%04x\n",fStack[i]);
printf("size of stack %d __________________________________\n",fStack[0]+1);
}
 
#ifdef MAIN
#include "CAENV965_DEF.h"
#include <utility.h>
#define CAEN_V965 0x340000
 
int main(){
 
int st[1000];
int nb, i;
// INIT stackdata
int geo=1,fPedestal=255;
VmUsbStackInit();
VmUsbStackWriteA24D32(CAEN_V965 + CAENV965_CRN, 0x0);
VmUsbStackWriteA24D32(CAEN_V965 + CAENV965_GEO, geo);
VmUsbStackMultiWrite( CMD_A24, CMD_D32, CAEN_V965 + CAENV965_THM, 32, 0x02,0x0); // threshold/kill for 32 channels, 2*i addr increment
VmUsbStackWriteA24D32( CAEN_V965 + CAENV965_BS1, 0x80 ); // soft reset
VmUsbStackWriteA24D32( CAEN_V965 + CAENV965_BC1, 0x80 ); // soft reset
VmUsbStackWriteA24D32( CAEN_V965 + CAENV965_PED, fPedestal ); // pedestal
VmUsbStackWriteA24D32(CAEN_V965 + CAENV965_BS2,0x5000);
VmUsbStackWriteA24D32(CAEN_V965 + CAENV965_BS2,0x4); // clear module
VmUsbStackWriteA24D32(CAEN_V965 + CAENV965_BC2,0x4);
VmUsbStackPrint();
 
// READOUT stackdata
VmUsbStackInit();
VmUsbStackWriteA24D32(CAEN_V965 + CAENV965_BS2,0x4); // clear module
VmUsbStackWriteA24D32(CAEN_V965 + CAENV965_BC2,0x4);
VmUsbStackConditionalRead(CMD_A24, CMD_D32,CAEN_V965 + CAENV965_SR1,0x1); // TRG wait : loop until bit 0 is on
VmUsbStackConditionalRead(CMD_A24, CMD_D32,CAEN_V965 + CAENV965_OB ,0x4000000) ; // loop until bit 26 is on, read data
VmUsbStackMarker(0xFAFB);
VmUsbStackPrint();
 
nb= VmUsbStackGet(1000,st);
for (i=0;i<nb;i++) if (st[i]!=fStack[i]) printf("error i=%d 0x%04x 0x%04x \n",i,st[i],fStack[i] );
Delay(10);
return 0;
}
#endif
/cvi/instr/VmUsbStack/VmUsbStack_dbg.cdb
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/cvi/instr/VmUsbStack/VmUsbStack_cvi.h
0,0 → 1,43
#ifndef VMUSBSTACK_H
#define VMUSBSTACK_H
#define CMD_WRITE 0x000
#define CMD_READ 0x100
#define CMD_A24 0x039
#define CMD_A32 0x009
#define CMD_HM 0x80000
#define CMD_HD 0x20000
#define CMD_MRK 0x2000
#define CMD_DLY 0x8000
#define CMD_BLT 0xFF000000
 
#define CMD_D16 1
#define CMD_D32 0
 
void VmUsbStackInit();
void VmUsbStackClear();
 
 
#define VmUsbStackReadA24D16( ADDR ) VmUsbStackAppend(CMD_READ | CMD_A24 , CMD_D16 | (ADDR) )
#define VmUsbStackReadA24D32( ADDR ) VmUsbStackAppend(CMD_READ | CMD_A24 , CMD_D32 | (ADDR) )
#define VmUsbStackReadA32D16( ADDR ) VmUsbStackAppend(CMD_READ | CMD_A32 , CMD_D16 | (ADDR) )
#define VmUsbStackReadA32D32( ADDR ) VmUsbStackAppend(CMD_READ | CMD_A32 , CMD_D32 | (ADDR) )
 
#define VmUsbStackWriteA24D16( ADDR, DATA) VmUsbStackAppendData(CMD_WRITE | CMD_A24,CMD_D16 | (ADDR), (DATA))
#define VmUsbStackWriteA24D32( ADDR, DATA) VmUsbStackAppendData(CMD_WRITE | CMD_A24,CMD_D32 | (ADDR), (DATA))
#define VmUsbStackWriteA32D16( ADDR, DATA) VmUsbStackAppendData(CMD_WRITE | CMD_A32,CMD_D16 | (ADDR), (DATA))
#define VmUsbStackWriteA32D32( ADDR, DATA) VmUsbStackAppendData(CMD_WRITE | CMD_A32,CMD_D32 | (ADDR), (DATA))
 
#define VmUsbStackMarker(MRK) VmUsbStackAppend(CMD_MRK, (MRK))
 
void VmUsbStackAppend(int cmd, int marker);
void VmUsbStackAppendData(int cmd, int addr, int data);
 
void VmUsbStackConditionalRead(int am ,int d16d32,int addr, int data);
void VmUsbStackMultiRead(int addr_modifier,int d16d32, int baseaddr, int n, int increment);
void VmUsbStackMultiWrite(int addr_modifier,int d16d32, int baseaddr, int n, int increment, int data);
 
int VmUsbStackGet(int maxn, int *stack);
void VmUsbStackPrint();
 
 
#endif
/cvi/instr/VmUsbStack/VmUsbStack.prj
0,0 → 1,192
[Project Header]
Version = 551
Platform Code = 4
Pathname = "/c/MeasurementStudio/cvi/instr/VmUsbStack/VmUsbStack.prj"
CVI Dir = "/c/measurementstudio/cvi"
VXIplug&play Framework Dir = "/C/Program Files/IVI Foundation/VISA/winnt"
Number of Files = 2
Sort Type = "No Sort"
Target Type = "Executable"
Build Configuration = "Debug"
Warn User If Debugging Release = 1
Flags = 16
Drag Bar Left = 135
Window Top = 35
Window Left = 835
Window Bottom = 270
Window Right = 1376
 
[File 0001]
File Type = "CSource"
Path = "/c/MeasurementStudio/cvi/instr/VmUsbStack/VmUsbStack_cvi.c"
Res Id = 1
Exclude = False
Disk Date = 3492764636
Project Flags = 0
Compile Into Object File = False
Object Format = "Win32-MSVC"
ForceCompile_Debug = False
ForceCompile_Release = True
Window Top = 136
Window Left = 50
Window Height = 0
Window Width = 0
Source Window State = "1,78,78,78,10,15,16,0,0,137,0,1,0,1,0,36,60,0,82,42,"
Header Dependencies = "4,5,16,51,59,60,"
 
[File 0002]
File Type = "Include"
Path = "/c/MeasurementStudio/cvi/instr/VmUsbStack/VmUsbStack_cvi.h"
Res Id = 2
Exclude = False
Disk Date = 3492764636
Project Flags = 0
Window Top = 182
Window Left = 86
Window Height = 0
Window Width = 0
Source Window State = "1,35,43,35,0,41,0,0,0,80,0,0,0,0,0,25,23,0,36,22,"
 
[SCC Options]
Use global settings = True
SCC Provider = ""
SCC Project = ""
Local Path = ""
Auxiliary Path = ""
Perform Same Action For .h File As For .uir File = "Ask"
Comment = ""
Username = ""
Use Default Comment = False
Use Default Username = False
Do Not Include PRJ File in Actions = True
Suppress CVI Error Messages = False
 
[Compiler Options]
Default Calling Convention = "cdecl"
Max Number Of Errors = 10
Require Prototypes = True
Require Return Values = True
Enable Pointer Mismatch Warning = False
Enable Unreachable Code Warning = False
Track Include File Dependencies = True
Prompt For Missing Includes = True
Stop On First Error File = False
Bring Up Err Win For Warnings = True
Show Build Dialog = False
O Option Compatible With 5.0 = False
 
[Run Options]
Stack Size = 250000
Debugging Level = "Standard"
Save Changes Before Running = "Ask"
Break On Library Errors = True
Break On First Chance Exceptions = False
Hide Windows = False
Break At First Statement = False
 
[Compiler Defines]
Compiler Defines = "/DWIN32_LEAN_AND_MEAN /DMAIN"
 
[Command Line Args]
Command Line Args = ""
 
[Include Paths]
Include Path 1 = "/c/MeasurementStudio/cvi/instr/CAENV965"
 
[Included Headers]
Header 0001 = "/c/MeasurementStudio/cvi/instr/WUSBVME_DLL/wusbvme_dll.h"
Header 0002 = "/c/MeasurementStudio/cvi/include/ansi_c.h"
Header 0003 = "/c/MeasurementStudio/cvi/include/ansi/assert.h"
Header 0004 = "/c/MeasurementStudio/cvi/include/cvidef.h"
Header 0005 = "/c/MeasurementStudio/cvi/include/cvirte.h"
Header 0006 = "/c/MeasurementStudio/cvi/include/ansi/ctype.h"
Header 0007 = "/c/MeasurementStudio/cvi/include/ansi/errno.h"
Header 0008 = "/c/MeasurementStudio/cvi/include/ansi/float.h"
Header 0009 = "/c/MeasurementStudio/cvi/include/ansi/limits.h"
Header 0010 = "/c/MeasurementStudio/cvi/include/ansi/locale.h"
Header 0011 = "/c/MeasurementStudio/cvi/include/ansi/math.h"
Header 0012 = "/c/MeasurementStudio/cvi/include/ansi/setjmp.h"
Header 0013 = "/c/MeasurementStudio/cvi/include/ansi/signal.h"
Header 0014 = "/c/MeasurementStudio/cvi/include/ansi/stdarg.h"
Header 0015 = "/c/MeasurementStudio/cvi/include/ansi/stddef.h"
Header 0016 = "/c/MeasurementStudio/cvi/include/ansi/stdio.h"
Header 0017 = "/c/MeasurementStudio/cvi/include/ansi/stdlib.h"
Header 0018 = "/c/MeasurementStudio/cvi/include/ansi/string.h"
Header 0019 = "/c/MeasurementStudio/cvi/include/ansi/time.h"
Header 0020 = "/c/MeasurementStudio/cvi/sdk/include/windows.h"
Header 0021 = "/c/MeasurementStudio/cvi/sdk/include/windef.h"
Header 0022 = "/c/MeasurementStudio/cvi/sdk/include/winnt.h"
Header 0023 = "/c/MeasurementStudio/cvi/sdk/include/basetsd.h"
Header 0024 = "/c/MeasurementStudio/cvi/sdk/include/Guiddef.h"
Header 0025 = "/c/MeasurementStudio/cvi/sdk/include/pshpack4.h"
Header 0026 = "/c/MeasurementStudio/cvi/sdk/include/poppack.h"
Header 0027 = "/c/MeasurementStudio/cvi/sdk/include/pshpack2.h"
Header 0028 = "/c/MeasurementStudio/cvi/sdk/include/pshpack8.h"
Header 0029 = "/c/MeasurementStudio/cvi/sdk/include/winbase.h"
Header 0030 = "/c/MeasurementStudio/cvi/sdk/include/winerror.h"
Header 0031 = "/c/MeasurementStudio/cvi/sdk/include/wingdi.h"
Header 0032 = "/c/MeasurementStudio/cvi/sdk/include/pshpack1.h"
Header 0033 = "/c/MeasurementStudio/cvi/sdk/include/winuser.h"
Header 0034 = "/c/MeasurementStudio/cvi/sdk/include/tvout.h"
Header 0035 = "/c/MeasurementStudio/cvi/sdk/include/winnls.h"
Header 0036 = "/c/MeasurementStudio/cvi/sdk/include/wincon.h"
Header 0037 = "/c/MeasurementStudio/cvi/sdk/include/winver.h"
Header 0038 = "/c/MeasurementStudio/cvi/sdk/include/winreg.h"
Header 0039 = "/c/MeasurementStudio/cvi/sdk/include/winnetwk.h"
Header 0040 = "/c/MeasurementStudio/cvi/sdk/include/winsvc.h"
Header 0041 = "/c/MeasurementStudio/cvi/sdk/include/mcx.h"
Header 0042 = "/c/MeasurementStudio/cvi/sdk/include/imm.h"
Header 0043 = "/c/MeasurementStudio/cvi/include/ivi.h"
Header 0044 = "/c/MeasurementStudio/cvi/include/visa.h"
Header 0045 = "/c/MeasurementStudio/cvi/include/visatype.h"
Header 0046 = "/c/MeasurementStudio/cvi/include/vpptype.h"
Header 0047 = "/c/MeasurementStudio/cvi/instr/WUSBVME_DLL/usb.h"
Header 0048 = "/c/MeasurementStudio/cvi/instr/WUSBVME_DLL/xxusb_dll.h"
Header 0049 = "/c/MeasurementStudio/cvi/instr/CAENV673A/CAENV673A.h"
Header 0050 = "/c/MeasurementStudio/cvi/instr/CAENV673A/CAENV673A_DEF.h"
Header 0051 = "/c/MeasurementStudio/cvi/include/utility.h"
Header 0052 = "/c/MeasurementStudio/cvi/include/userint.h"
Header 0053 = "/c/ICFA/2010-samo/rich/rich_ui.h"
Header 0054 = "/c/MeasurementStudio/cvi/instr/WUSBXX_DLL/wusbxx_dll.h"
Header 0055 = "/c/MeasurementStudio/cvi/instr/WUSBXX_DLL/usb.h"
Header 0056 = "/c/MeasurementStudio/cvi/instr/WUSBXX_DLL/xxusb_dll.h"
Header 0057 = "/c/MeasurementStudio/cvi/instr/WUSBXX_DLL/wusbcc.h"
Header 0058 = "/c/MeasurementStudio/cvi/toolslib/toolbox/toolbox.h"
Header 0059 = "/c/MeasurementStudio/cvi/instr/VmUsbStack/VmUsbStack_cvi.h"
Header 0060 = "/c/MeasurementStudio/cvi/instr/CAENV965/CAENV965_DEF.h"
Max Header Number = 60
 
[Create Executable]
Executable File_Debug = "/c/MeasurementStudio/cvi/instr/VmUsbStack/VmUsbStack_dbg.exe"
Target Creation Date_Debug = 3492764634
Force Creation of Target_Debug = False
Executable File_Release = ""
Target Creation Date_Release = 0
Force Creation of Target_Release = False
Icon File = ""
Application Title = ""
DLL Exports = "Include File Symbols"
DLL Import Library Choice = "Gen Lib For Current Mode"
Use VXIPNP Subdirectories for Import Libraries = False
Use Dflt Import Lib Base Name = True
Where to Copy DLL = "Do not copy"
Add Type Lib To DLL = False
Include Type Lib Help Links = False
Type Lib FP File = ""
Type Lib Guid = ""
Uses DataSocket = 0
Uses NIReports = 0
Uses DCom95 = 0
Instrument Driver Support Only = False
 
[External Compiler Support]
UIR Callbacks File Option = 0
Using LoadExternalModule = False
Create Project Symbols File = True
UIR Callbacks Obj File = ""
Project Symbols H File = ""
Project Symbols Obj File = ""
 
[DLL Debugging Support]
External Process Path = ""
 
/cvi/instr/VmUsbStack/VmUsbStack_dbg.exe
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property