EasyManua.ls Logo

LeCroy SDA - Page 193

LeCroy SDA
397 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SDA Operator’s Manual
SDA-OM-E Rev H 193
};
#pragma pack(pop) // restore packing
//------------------------------------------------------------------------------------------
// The buffer size is 80MB (40,000,000 samples, stored as short integers) plus 0x1000 bytes for
the header.
const unsigned long HEADER_SIZE = 0x1000
const unsigned long MEM_MAP_FILE_SIZE = 80000000 + HEADER_SIZE; // = 40MSamples,
or 80MBytes
int main(int argc, char* argv[])
{
// names based on 'FastWavePort1' name defined in Processor setup.
char szMapFileName[] = "FastWavePort1File";
char szMutexDataAvailableName[] = "FastWavePort1MutexDataAvailable";
char szMutexProcessingCompleteName[] = "FastWavePort1MutexProcessingComplete";
// Associate shared memory file handle value.
HANDLE m_hMMFile = CreateFileMapping ((HANDLE)0xffffffff, NULL,
PAGE_READWRITE, 0, MEM_MAP_FILE_SIZE, szMapFileName);
if(m_hMMFile == 0)
{
printf("Unable to create file mapping\n");
return 0;
}
// Map a view of this file for writing.
short *m_lpMMFile = (short *)MapViewOfFile (m_hMMFile, FILE_MAP_ALL_ACCESS, 0, 0,
0);
if(m_lpMMFile == 0)
{
printf("Unable to map view of file\n");
return 0;
}
// create/open events used for synchronization
// if the client app. was run before the scope then these events will be created, if the scope was
run first then these events
// will just be opened
HANDLE m_hDataAvailable = CreateEvent(NULL, FALSE, FALSE /* initial state */,
szMutexDataAvailableName);
HANDLE m_hProcessingComplete = CreateEvent(NULL, FALSE, FALSE /* initial state */,
szMutexProcessingCompleteName);
if(m_hDataAvailable == 0 || m_hProcessingComplete == 0)
{
printf("Unable to open events\n");
return 0;
}
// main loop

Table of Contents