Software | C/C++ Driver Interface |
|
|
Using the Driver under Linux:
hDrv = open ("/dev/spc0", O_RDWR);
...
close (hDrv);
Function SpcSetParam
All hardware settings are based on software registers that can be set by the function SpcSetParam. This function sets a register to a defined value or executes a command. The board must first be initialized. The available software registers for the driver are listed in the board specific part of the documentation below.
The value „nr“ contains the index of the board that you want to access, the value „reg“ is the register that has to be changed and the value „value“ is the new value that should be set to this software register. The function will return an error value in case of malfunction.
Function SpcSetParam
int16 SpcSetParam (int16 nr, int32 reg, int32 value);
Under Linux the value „nr“ must contain the handle that was retrieved by the open function for that specific board. The values is then not of the type „int16“ but of the type „handle“.
Function SpcGetParam
The function SpcGetParam reads out software registers or status information. The board must first be initialized. The available software reg- isters for the driver are listed in the board specific part of the documentation below.
The value „nr“ contains the index of the board that you want to access, the value „reg“ is the register that has to be read out and the value „value“ is a pointer to a value that should contain the read parameter after function call. The function will return an error value in case of malfunction.
Function SpcGetParam
int16 SpcGetParam (int16 nr, int32 reg, int32* value);
Under Linux the value „nr“ must contain the handle that was given back by the open function of that specific board. The values is then not of the type „int16“ but of the type „handle“.
Function SpcSetData
Writes data to the board for a specific memory channel. The board must first be initialized. The value „nr“ contains the index of the board that you want to access, the „ch“ parameter contains the memory channel. „start“ and „len“ define the position of data to be written. „data“ is a pointer to the array holding the data. The function will return an error value in case of malfunction.
This function is only available on generator or i/o boards. The function is not available on acquisition boards.
Function SpcSetData (Windows)
int16 SpcSetData (int16 nr, int16 ch, int32 start, int32 len, dataptr data);
Under Linux the additional parameter nBytesPerSample must be used for this function. For all boards with 8 bit resolution the parameter is „1“, for all boards with 12, 14 or 16 bit resolution this parameter has to be „2“. Under Linux the value „hDrv“ must contain the handle that was given back by the open function of that specific board. Under Linux the return value is not an error code but the number of bytes that has been written.
Function SpcSetData (Linux)
int32 SpcSetData (int hDrv, int32 lCh, int32 lStart, int32 lLen, int16 nBytesPerSample, dataptr pvData)
Function SpcGetData
Reads data from the board from a specific memory channel. The board must first be initialized. The value „nr“ contains the index of the board that you want to access, the „ch“ parameter contains the memory channel. „start“ and „len“ define the position of data to be read. „data“ is a pointer to the array that should hold the data. The function will return an error value in case of malfunction.
This function is only available on acquisition or i/o boards. The function is not available on generator boards.
(c) Spectrum GmbH | 31 |