EBST_CAM
|
All the low level platform specific implementations for interacting with the Stresing PCIe board. More...
#include <stdint.h>
#include "globals.h"
#include "../shared_src/es_status_codes.h"
#include "lscpciej_lib.h"
Go to the source code of this file.
Macros | |
#define | ES_LOG(...) |
#define | ES_TRACE(...) |
Functions | |
es_status_codes | checkDriverHandle (uint32_t drvno) |
es_status_codes | readRegister_32 (uint32_t drvno, uint32_t *data, uint32_t address) |
Reads 4 bytes on DMA area. | |
es_status_codes | readRegister_16 (uint32_t drvno, uint16_t *data, uint32_t address) |
Reads long on DMA area. | |
es_status_codes | readRegister_8 (uint32_t drvno, uint8_t *data, uint32_t address) |
Read byte (8 bit) from register of PCIe board, except r10-r1f. | |
es_status_codes | writeRegister_32 (uint32_t drvno, uint32_t data, uint32_t address) |
Writes 32 bits (4 bytes) to register. | |
es_status_codes | writeRegister_16 (uint32_t drvno, uint16_t data, uint32_t address) |
Writes 16 bits (2 bytes) to register. | |
es_status_codes | writeRegister_8 (uint32_t drvno, uint8_t data, uint32_t address) |
Write byte (8 bit) to register in space0 of PCIe board, except r10-r1f. | |
es_status_codes | readConfig_32 (uint32_t drvno, uint32_t *data, uint32_t address) |
Read long (32 bit) from runtime register of PCIe board. | |
es_status_codes | writeConfig_32 (uint32_t drvno, uint32_t data, uint32_t address) |
Write long (32 bit) to register in space0 of PCIe board. | |
void | FreeMemInfo (uint64_t *pmemory_all, uint64_t *pmemory_free) |
Get the free and installed memory info. | |
es_status_codes | SetupDma (uint32_t drvno) |
Allocate DMA buffer - should only be called once. | |
es_status_codes | enableInterrupt (uint32_t drvno) |
es_status_codes | disableInterrupt (uint32_t drvno) |
Disable interrupt. | |
uint64_t | getPhysicalDmaAddress (uint32_t drvno) |
void | ResetBufferWritePos (uint32_t drvno) |
Reset the buffer write pointers and software ISR counter. | |
void | copyRestData (uint32_t drvno, size_t rest_in_bytes) |
DMA copies in blocks of dmaBufferSizeInWords/DMA_BUFFER_PARTS - the rest is copied here. | |
es_status_codes | _InitBoard (uint32_t drvno) |
Initializes PCIe board on a platform specific way. | |
es_status_codes | _InitDriver () |
Windows specific function for initializing driver. | |
es_status_codes | _ExitDriver () |
Exit driver. Call this after Cleanup driver. | |
es_status_codes | CleanupDriver (uint32_t drvno) |
Cleanup driver. Call this before Exit driver. | |
es_status_codes | StartCopyDataToUserBufferThread (uint32_t drvno) |
uint16_t | checkEscapeKeyState () |
uint16_t | checkSpaceKeyState () |
es_status_codes | InitMutex (uint32_t drvno) |
es_status_codes | SetPriority () |
Set thread to high priority level. | |
es_status_codes | ResetPriority () |
Reset thread priority to normal. | |
uint16_t * | getVirtualDmaAddress (uint32_t drvno) |
uint32_t | getDmaBufferSizeInBytes (uint32_t drvno) |
int64_t | getCurrentInterruptCounter (uint32_t drvno) |
uint8_t | WaitforTelapsed (int64_t microseconds) |
This functions returns after a time given in microseconds. The time is measured in CPU ticks. The function is escapable by pressing ESC. | |
es_status_codes | SaveMeasurementDataToFileBIN (const char *filename) |
Export the measurement data to a binary file. | |
es_status_codes | CopyFromFileToUserBufferBIN (const char *filename) |
void | openFile (uint32_t drvno) |
void | closeFile (uint32_t drvno) |
void | setTimestamp () |
void | writeFileHeaderToFile (uint32_t drvno) |
Creates a file at filename_full and writes struct file_header to it. | |
void | writeToDisc (uint32_t *drvno_ptr) |
void | startWriteToDiscThead (uint32_t drvno) |
void | VerifyData (struct verify_data_parameter *vd) |
Check a file for its data consistency. | |
void | getFileHeaderFromFile (struct file_header *fh, const char *filename_full) |
Open the file at filename_full and write the header to fh. | |
void | Start2dViewer (uint32_t drvno, uint32_t block, uint16_t camera, uint16_t pixel, uint32_t nos) |
Start 2d viewer. | |
void | ShowNewBitmap (uint32_t drvno, uint32_t block, uint16_t camera, uint16_t pixel, uint32_t nos) |
Update the displayed bitmap. | |
void | Deinit2dViewer () |
Call when closing 2d viewer or at least before opening a new 2d viewer. | |
void | SetGammaValue (uint16_t white, uint16_t black) |
Set gamma value. | |
uint16_t | GetGammaWhite () |
return gamma value white | |
uint16_t | GetGammaBlack () |
return gamma value black | |
void | WaitForAllInterruptsDone () |
void | LockHighLevelMutex (uint32_t drvno) |
void | UnlockHighLevelMutex (uint32_t drvno) |
int64_t | GetTimestampInMicroseconds () |
int64_t | GetTimestampInMilliseconds () |
void | initPerformanceCounter () |
int64_t | GetTimestampInTicks () |
Reads system timer. | |
int64_t | ConvertTicksToMicroseconds (int64_t ticks) |
Translate ticks to microseconds. | |
es_status_codes | About (uint32_t board_sel) |
Display information about registers and settings in pop up windows. | |
es_status_codes | AboutDrv (uint32_t drvno) |
Shows window with infos about the PCIe board. | |
es_status_codes | AboutGPX (uint32_t drvno) |
Reads registers 0 to 12 of TDC-GPX chip. Time delay counter option. | |
es_status_codes | AboutS0 (uint32_t drvno) |
Read registers of space0. Space0 are the control registers of the PCIe board. | |
es_status_codes | AboutTLPs (uint32_t drvno) |
es_status_codes | AboutPCI (uint32_t drvno) |
es_status_codes | AboutMeasurementSettings () |
es_status_codes | AboutCameraSettings (uint32_t drvno) |
void | ErrMsgBoxOn () |
Switch on error message boxes of our software. Default is On. | |
void | ErrMsgBoxOff () |
Disable error message boxes, if not needed. | |
void | ErrorMsg (char ErrMsg[100]) |
Display error message. If ErrMsgBoxOn is set. | |
void | ValMsg (uint64_t val) |
Simple display of unsigned integer as error message for test purpose. | |
Variables | |
WDC_DEVICE_HANDLE * | hDev |
bool | _SHOW_MSG |
All the low level platform specific implementations for interacting with the Stresing PCIe board.
#define ES_LOG | ( | ... | ) |
#define ES_TRACE | ( | ... | ) |
es_status_codes _ExitDriver | ( | ) |
Exit driver. Call this after Cleanup driver.
es_status_codes _InitBoard | ( | uint32_t | drvno | ) |
Initializes PCIe board on a platform specific way.
drvno | PCIe board identifier. |
es_status_codes _InitDriver | ( | ) |
Windows specific function for initializing driver.
es_status_codes About | ( | uint32_t | board_sel | ) |
Display information about registers and settings in pop up windows.
es_status_codes AboutCameraSettings | ( | uint32_t | drvno | ) |
es_status_codes AboutDrv | ( | uint32_t | drvno | ) |
Shows window with infos about the PCIe board.
drvno | board number (=1 if one PCI board) |
es_status_codes AboutGPX | ( | uint32_t | drvno | ) |
Reads registers 0 to 12 of TDC-GPX chip. Time delay counter option.
drvno | PCIe board identifier |
es_status_codes AboutMeasurementSettings | ( | ) |
es_status_codes AboutPCI | ( | uint32_t | drvno | ) |
drvno | PCIe board identifier. |
es_status_codes AboutS0 | ( | uint32_t | drvno | ) |
Read registers of space0. Space0 are the control registers of the PCIe board.
drvno | PCIe board identifier |
es_status_codes AboutTLPs | ( | uint32_t | drvno | ) |
drvno | PCIe board identifier. |
es_status_codes checkDriverHandle | ( | uint32_t | drvno | ) |
uint16_t checkEscapeKeyState | ( | ) |
uint16_t checkSpaceKeyState | ( | ) |
es_status_codes CleanupDriver | ( | uint32_t | drvno | ) |
Cleanup driver. Call this before Exit driver.
drvno | PCIe board identifier. |
void closeFile | ( | uint32_t | drvno | ) |
int64_t ConvertTicksToMicroseconds | ( | int64_t | ticks | ) |
Translate ticks to microseconds.
ticks | ticks of system timer |
es_status_codes CopyFromFileToUserBufferBIN | ( | const char * | filename | ) |
void copyRestData | ( | uint32_t | drvno, |
size_t | rest_in_bytes ) |
DMA copies in blocks of dmaBufferSizeInWords/DMA_BUFFER_PARTS - the rest is copied here.
drvno | PCIe board identifier. |
rest_in_bytes | bytes which were not copied by INTR. |
void Deinit2dViewer | ( | ) |
Call when closing 2d viewer or at least before opening a new 2d viewer.
es_status_codes disableInterrupt | ( | uint32_t | drvno | ) |
es_status_codes enableInterrupt | ( | uint32_t | drvno | ) |
void ErrMsgBoxOff | ( | ) |
Disable error message boxes, if not needed.
void ErrMsgBoxOn | ( | ) |
Switch on error message boxes of our software. Default is On.
void ErrorMsg | ( | char | ErrMsg[100] | ) |
Display error message. If ErrMsgBoxOn is set.
[in] | ErrMsg | Message. Buffer size: 100. |
void FreeMemInfo | ( | uint64_t * | pmemory_all, |
uint64_t * | pmemory_free ) |
Get the free and installed memory info.
[out] | pmemory_all | how much is installed |
[out] | pmemory_free | how much is free |
int64_t getCurrentInterruptCounter | ( | uint32_t | drvno | ) |
uint32_t getDmaBufferSizeInBytes | ( | uint32_t | drvno | ) |
void getFileHeaderFromFile | ( | struct file_header * | fh, |
const char * | filename_full ) |
Open the file at filename_full and write the header to fh.
fh | struct file_header* |
filename_full | Path and file name to the file. |
uint16_t GetGammaBlack | ( | ) |
return gamma value black
uint16_t GetGammaWhite | ( | ) |
return gamma value white
uint64_t getPhysicalDmaAddress | ( | uint32_t | drvno | ) |
int64_t GetTimestampInMicroseconds | ( | ) |
int64_t GetTimestampInMilliseconds | ( | ) |
int64_t GetTimestampInTicks | ( | ) |
Reads system timer.
Read 2x ticks and calculate the difference between the calls in microseconds with DLLTickstous, init timer by calling DLLInitSysTimer before use.
uint16_t * getVirtualDmaAddress | ( | uint32_t | drvno | ) |
es_status_codes InitMutex | ( | uint32_t | drvno | ) |
void initPerformanceCounter | ( | ) |
void LockHighLevelMutex | ( | uint32_t | drvno | ) |
void openFile | ( | uint32_t | drvno | ) |
es_status_codes readConfig_32 | ( | uint32_t | drvno, |
uint32_t * | data, | ||
uint32_t | address ) |
Read long (32 bit) from runtime register of PCIe board.
This function reads the memory mapped data , not the I/O Data. Reads data from PCIe config space.
drvno | board number (=1 if one PCI board) |
data | pointer to where data is stored |
address | offset of register (count in bytes) |
es_status_codes readRegister_16 | ( | uint32_t | drvno, |
uint16_t * | data, | ||
uint32_t | address ) |
Reads long on DMA area.
drvno | PCIe board identifier |
data | buffer for data |
address | Offset from BaseAdress - in Bytes ! 0..3= Regs of Board. |
es_status_codes readRegister_32 | ( | uint32_t | drvno, |
uint32_t * | data, | ||
uint32_t | address ) |
Reads 4 bytes on DMA area.
drvno | PCIe board identifier |
data | buffer for data |
address | Offset from BaseAdress - in Bytes ! 0..3= Regs of Board. |
es_status_codes readRegister_8 | ( | uint32_t | drvno, |
uint8_t * | data, | ||
uint32_t | address ) |
Read byte (8 bit) from register of PCIe board, except r10-r1f.
drvno | board number (=1 if one PCI board) |
data | pointer to where data is stored |
address | offset of register from base address (count in bytes) |
void ResetBufferWritePos | ( | uint32_t | drvno | ) |
Reset the buffer write pointers and software ISR counter.
drvno | PCIe board identifier. |
es_status_codes ResetPriority | ( | ) |
Reset thread priority to normal.
es_status_codes SaveMeasurementDataToFileBIN | ( | const char * | filename | ) |
Export the measurement data to a binary file.
filename | Filename with complete absolute path. |
void SetGammaValue | ( | uint16_t | white, |
uint16_t | black ) |
Set gamma value.
[in] | white | set value for maximum brightness. Default: 0xFFFF (16 bit), 0x3FFF (14 bit) |
[in] | black | set value for minimum brightness. Default: 0 |
es_status_codes SetPriority | ( | ) |
Set thread to high priority level.
void setTimestamp | ( | ) |
es_status_codes SetupDma | ( | uint32_t | drvno | ) |
Allocate DMA buffer - should only be called once.
Gets address of DMASubBuf from driver and copy it later to our pDMABigBuf.
drvno | PCIe board identifier. |
void ShowNewBitmap | ( | uint32_t | drvno, |
uint32_t | block, | ||
uint16_t | camera, | ||
uint16_t | pixel, | ||
uint32_t | nos ) |
Update the displayed bitmap.
[in] | drvno | board number |
[in] | block | current number of blocks |
[in] | camera | which camera to display (when camcnt is >1) |
[in] | pixel | count of pixel of one line |
[in] | nos | samples in one block |
void Start2dViewer | ( | uint32_t | drvno, |
uint32_t | block, | ||
uint16_t | camera, | ||
uint16_t | pixel, | ||
uint32_t | nos ) |
Start 2d viewer.
[in] | drvno | board number |
[in] | block | current number of block |
[in] | camera | which camera to display (when camcnt is >1) |
[in] | pixel | count of pixel of one line |
[in] | nos | samples in one block |
es_status_codes StartCopyDataToUserBufferThread | ( | uint32_t | drvno | ) |
void startWriteToDiscThead | ( | uint32_t | drvno | ) |
void UnlockHighLevelMutex | ( | uint32_t | drvno | ) |
void ValMsg | ( | uint64_t | val | ) |
Simple display of unsigned integer as error message for test purpose.
val | unsigned integer 64 bit |
void VerifyData | ( | struct verify_data_parameter * | vd | ) |
Check a file for its data consistency.
vd | see struct verify_data_parameter in globals.h for details |
void WaitForAllInterruptsDone | ( | ) |
uint8_t WaitforTelapsed | ( | int64_t | microseconds | ) |
This functions returns after a time given in microseconds. The time is measured in CPU ticks. The function is escapable by pressing ESC.
microseconds | Time to wait in microseconds. |
es_status_codes writeConfig_32 | ( | uint32_t | drvno, |
uint32_t | data, | ||
uint32_t | address ) |
Write long (32 bit) to register in space0 of PCIe board.
drvno | board number (=1 if one PCI board) |
data | long value to write |
address | offset from base address of register (count in bytes) |
void writeFileHeaderToFile | ( | uint32_t | drvno | ) |
Creates a file at filename_full and writes struct file_header to it.
drvno | PCIe board identifier. |
es_status_codes writeRegister_16 | ( | uint32_t | drvno, |
uint16_t | data, | ||
uint32_t | address ) |
Writes 16 bits (2 bytes) to register.
drvno | PCIe board identifier. |
data | data to write |
address | Register offset from BaseAdress - in bytes |
es_status_codes writeRegister_32 | ( | uint32_t | drvno, |
uint32_t | data, | ||
uint32_t | address ) |
Writes 32 bits (4 bytes) to register.
drvno | PCIe board identifier. |
data | data to write |
address | Register offset from BaseAdress - in bytes |
es_status_codes writeRegister_8 | ( | uint32_t | drvno, |
uint8_t | data, | ||
uint32_t | address ) |
Write byte (8 bit) to register in space0 of PCIe board, except r10-r1f.
drvno | board number (=1 if one PCI board) |
data | byte value to write |
address | Offset from BaseAdress of register (count in bytes) |
void writeToDisc | ( | uint32_t * | drvno_ptr | ) |
|
extern |
|
extern |