ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcppStartup.c File Reference
#include <ngc/core/ngcpp.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <ctype.h>
#include <sys/ipc.h>
#include <sys/sem.h>

Macros

#define _bailOut()
 

Functions

int ngcppGetLocHostAddr (char *addr, char *erms)
 
void ngcppDim (int nx, int ny)
 
void ngcppAppInit (void)
 
void ngcppCmdLineHelp (const char *paramStr, const char *helpStr, const char *defaultStr)
 
int ngcppStartup (int argc, char **argv, size_t defaultBufsize, char *erms)
 
void ngcppShutdown (int sigFlag)
 
void ngcppExit (int stat)
 
void ngcppSignalHandler (int sig)
 
void ngcppChanMap (int *cm, int n)
 
ngcb_thread_t ngcppCI_THID ()
 
ngcb_thread_t ngcppERR_THID ()
 

Variables

ngcpp_dma_tngcppDev = (ngcpp_dma_t *)NULL
 
ngcb_thread_t ngcppThCapture [ngcppMAX_DEV]
 
char ngcppCapInitFlag [ngcppMAX_DEV]
 
char ngcppCiInitFlag = 1
 
char ngcppErrInitFlag = 1
 
char ngcppDataInitFlag = 1
 
char ngcppStatus =ngcppSTAT_IDLE
 
char ngcppRunning = 0
 
int * ngcppDynPtr = (int *)NULL
 
ngcpp_param_t ngcppDynParam
 
char ngcppMapFile [256]
 
double ngcppTime [2]
 
int ngcppDynCmd =ngcppDYN_CMD_IVLD
 
int ngcppDynCmdAck = 0
 
int ngcppNumDynCmd = 0
 
int ngcppNumDataFiles
 
char ** ngcppPublisherName = (char **)NULL
 
int ngcppPid = 0
 
int ngcppCPU = ngcbCPU_HIGH
 
int ngcppNumDev = 1
 
int ngcppSimTime = 500
 
int ngcppSimStartDelay = 0
 
int ngcppSimRt = 0
 
int ngcppRtCheck = 1
 
char ngcppPrintPars = 0
 
char ngcppProcName [128]
 
int ngcppRemoteFd = -1
 
char ngcppRstCnt = 0
 
char ngcppRstCnt_ = 0
 
char ngcppQRstCnt = 0
 
char ngcppQRstCnt_ = 0
 
char ngcppEndFlg = 0
 
char ngcppTransferring = 0
 
int ngcppStartX = 0
 
int ngcppStartY = 0
 
int ngcppChopZero = ngcppCHOP_ZERO
 
char * ngcppErmsCi = (char *)NULL
 
char * ngcppErmsData = (char *)NULL
 
int * ngcppPixMap = (int *)NULL
 
size_t * ngcppPixMap64 = (size_t *)NULL
 
int ngcppMapOp [4]
 
int ngcppNoSort = 0
 
char ngcppPauseFlag = 0
 
char ngcppSyncInput = 0
 
int ngcppNumDiv = 1
 
int ngcppNumDet = 1
 
uint64_t ngcppTimeStamp = 0
 
int ngcppAutoTimeStamp = 1
 
int ngcppDmaChan = -1
 
int ngcppDmaResync = 0
 
int ngcppDmaPacketSize = 4
 
int ngcppAdcPacketSize = 0
 
size_t ngcppFrameSize = 0
 
int ngcppNumBuf = ngcppNUMBUF_AUTO
 
int ngcppDetSetup = 0
 
int ngcppTestCnt = 0
 
int ngcppNQ = 3
 
int ngcppQSize = 0
 
int ngcppQType = ngcppFRAME_NO_FRAME
 
int ngcppQCnt = 0
 
int ngcppQEnd = 0
 
size_t ngcppQBufSize = 0
 
char ngcppDitX = 0
 
ngcpp_win_t ngcppQWin
 
int ngcppPayloadSize = 0
 
int ngcppUnitSize = 2
 
int ngcppJoinerDelay = -1
 
int ngcppDmaDiag = 0
 
int ngcppDmaMon = 1
 
int ngcppSimDma = 0
 
int ngcppEndian = ngcbLITTLE_ENDIAN
 
unsigned int ngcppDmaIPPMode = NGCDRV_IPP_NONE
 
int ngcppIppTaskId = -1
 
int ngcppIppParam [NGCDRV_MAX_PARAM]
 
unsigned int ngcppIppNumParam = 0
 
int ngcppSimHiRes = 1000
 
ngcb_ma_t ngcppTimeFilter [2]
 
char ** ngcppArgv = (char **)NULL
 
int ngcppArgc = 0
 
int ngcppOvrScanX = 0
 
int ngcppOvrScanY = 0
 
ngcb_sema_t semCam
 
ngcb_sema_t semRun
 
ngcb_sema_t semStat
 
ngcb_sema_t semParam
 
ngcb_sema_t semParamLock
 
ngcb_sema_t semCmd
 
ngcb_sema_t semCmdAck
 
ngcb_sema_t semBuf
 
ngcb_sema_t semCiInit
 
ngcb_sema_t semErrInit
 
ngcb_sema_t semDataInit
 
ngcb_sema_t semAppInit
 
ngcb_sema_t semMem
 
ngcb_sema_t semTerm
 

Detailed Description

Macro Definition Documentation

◆ _bailOut

#define _bailOut ( )
Value:
{ngcbExecReply(ngcppRemoteFd, 0, erms);return (-1);}
void ngcbExecReply(int fd, int success, const char *reply)
Definition ngcbExec.c:626
int ngcppRemoteFd
Definition ngcppStartup.c:49

Function Documentation

◆ ngcppAppInit()

void ngcppAppInit ( void )

Function to be called by the application to signal that all initialization is done.

◆ ngcppChanMap()

void ngcppChanMap ( int * cm,
int n )

Default channel mapping

◆ ngcppCI_THID()

ngcb_thread_t ngcppCI_THID ( )

command service thread id

◆ ngcppCmdLineHelp()

void ngcppCmdLineHelp ( const char * paramStr,
const char * helpStr,
const char * defaultStr )

Add a help text for the -h command line option.

◆ ngcppDim()

void ngcppDim ( int nx,
int ny )

Set pixel map dimension

◆ ngcppERR_THID()

ngcb_thread_t ngcppERR_THID ( )

error stack thread id

◆ ngcppExit()

void ngcppExit ( int stat)

Calls ngcppShutdwon() and exits.

◆ ngcppGetLocHostAddr()

int ngcppGetLocHostAddr ( char * addr,
char * erms )

Returns the ip-address of the local host.

◆ ngcppShutdown()

void ngcppShutdown ( int sigFlag)

Terminate all running DMA, close the DMA device and clean up all allocated resource. When called from within a signal handler the sigFlag should be set.

◆ ngcppSignalHandler()

void ngcppSignalHandler ( int sig)

Signal handler of the ngcpp framework.

◆ ngcppStartup()

int ngcppStartup ( int argc,
char ** argv,
size_t defaultBufsize,
char * erms )

Perform complete startup of the scd dma interface. Depending on the argument line interactive and capture threads are started. All semaphores are initialized here. A default buffersize (in bytes) can be passed which might be overwritten by the command line argument.

Variable Documentation

◆ ngcppAdcPacketSize

int ngcppAdcPacketSize = 0

ADC-module packet size

◆ ngcppArgc

int ngcppArgc = 0

Number of command line arguments

◆ ngcppArgv

char** ngcppArgv = (char **)NULL

Pointer to command line arguments

◆ ngcppAutoTimeStamp

int ngcppAutoTimeStamp = 1

Automatic frame timestamp

◆ ngcppCapInitFlag

char ngcppCapInitFlag[ngcppMAX_DEV]

◆ ngcppChopZero

int ngcppChopZero = ngcppCHOP_ZERO

Chop zero phase

◆ ngcppCiInitFlag

char ngcppCiInitFlag = 1

Command interpreter initialization flag

◆ ngcppCPU

int ngcppCPU = ngcbCPU_HIGH

Main-task CPU(s)

◆ ngcppDataInitFlag

char ngcppDataInitFlag = 1

Data server initialization flag

◆ ngcppDetSetup

int ngcppDetSetup = 0

Setup-id

◆ ngcppDev

ngcpp_dma_t* ngcppDev = (ngcpp_dma_t *)NULL

Global variables Acquisition devices

◆ ngcppDitX

char ngcppDitX = 0

DIT-handler DIT transfer

◆ ngcppDmaChan

int ngcppDmaChan = -1

DMA channel selection

◆ ngcppDmaDiag

int ngcppDmaDiag = 0

DMA interrupt latency diagnose on/off

◆ ngcppDmaIPPMode

unsigned int ngcppDmaIPPMode = NGCDRV_IPP_NONE

DMA interrupt post processor mode

◆ ngcppDmaMon

int ngcppDmaMon = 1

DMA interrupt queue monitoring flag

◆ ngcppDmaPacketSize

int ngcppDmaPacketSize = 4

DMA channel packet size

◆ ngcppDmaResync

int ngcppDmaResync = 0

DMA resync

◆ ngcppDynCmd

int ngcppDynCmd =ngcppDYN_CMD_IVLD

Dynamic command code

◆ ngcppDynCmdAck

int ngcppDynCmdAck = 0

Dynamic command code acknowledge

◆ ngcppDynParam

ngcpp_param_t ngcppDynParam

Parameter configuration

◆ ngcppDynPtr

int* ngcppDynPtr = (int *)NULL

Pointer to parameter buffer

◆ ngcppEndFlg

char ngcppEndFlg = 0

End of measurement flag

◆ ngcppEndian

int ngcppEndian = ngcbLITTLE_ENDIAN

Endianess

◆ ngcppErmsCi

char* ngcppErmsCi = (char *)NULL

Command interpreter initialization error

◆ ngcppErmsData

char* ngcppErmsData = (char *)NULL

Data server initialization error

◆ ngcppErrInitFlag

char ngcppErrInitFlag = 1

Error-stack initialization flag

◆ ngcppFrameSize

size_t ngcppFrameSize = 0

Output frame size

◆ ngcppIppNumParam

unsigned int ngcppIppNumParam = 0

Number of DMA interrupt post processor task parameters

◆ ngcppIppParam

int ngcppIppParam[NGCDRV_MAX_PARAM]

DMA interrupt post processor task parameters

◆ ngcppIppTaskId

int ngcppIppTaskId = -1

DMA interrupt post processor task-id

◆ ngcppJoinerDelay

int ngcppJoinerDelay = -1

Multicast joinder delay (microseconds)

◆ ngcppMapFile

char ngcppMapFile[256]

Channel mapping file

◆ ngcppMapOp

int ngcppMapOp[4]

Pixel map operation matrix

◆ ngcppNoSort

int ngcppNoSort = 0

Flag to disable the pixel sorting

◆ ngcppNQ

int ngcppNQ = 3

Raw-frame output queue size (number of frames)

◆ ngcppNumBuf

int ngcppNumBuf = ngcppNUMBUF_AUTO

Requested number of ringbuffers (0 = automatic)

◆ ngcppNumDataFiles

int ngcppNumDataFiles

Number of data files

◆ ngcppNumDet

int ngcppNumDet = 1

Number of detector instances

◆ ngcppNumDev

int ngcppNumDev = 1

Number of acquisition devices

◆ ngcppNumDiv

int ngcppNumDiv = 1

Number of DMA sub-divisions

◆ ngcppNumDynCmd

int ngcppNumDynCmd = 0

Number of dynamic command codes

◆ ngcppOvrScanX

int ngcppOvrScanX = 0

Overscan in X

◆ ngcppOvrScanY

int ngcppOvrScanY = 0

Overscan in Y

◆ ngcppPauseFlag

char ngcppPauseFlag = 0

Pause flag

◆ ngcppPayloadSize

int ngcppPayloadSize = 0

RTMS payload Size (bytes)

◆ ngcppPid

int ngcppPid = 0

Acquisition process id

◆ ngcppPixMap

int* ngcppPixMap = (int *)NULL

Pixel map

◆ ngcppPixMap64

size_t* ngcppPixMap64 = (size_t *)NULL

Pixel map (64-bit)

◆ ngcppPrintPars

char ngcppPrintPars = 0

Print params flag

◆ ngcppProcName

char ngcppProcName[128]

Process name

◆ ngcppPublisherName

char** ngcppPublisherName = (char **)NULL

Publisher names

◆ ngcppQBufSize

size_t ngcppQBufSize = 0

Queue buffer size (bytes)

◆ ngcppQCnt

int ngcppQCnt = 0

Queue frame counter

◆ ngcppQEnd

int ngcppQEnd = 0

Queue end-command

◆ ngcppQRstCnt

char ngcppQRstCnt = 0

Reset queue counters flag

◆ ngcppQRstCnt_

char ngcppQRstCnt_ = 0

Reset queue counters flag (internal)

◆ ngcppQSize

int ngcppQSize = 0

Queue size

◆ ngcppQType

int ngcppQType = ngcppFRAME_NO_FRAME

Queue frame type

◆ ngcppQWin

ngcpp_win_t ngcppQWin

Queue window

◆ ngcppRemoteFd

int ngcppRemoteFd = -1

Remote execution reply file descriptor

◆ ngcppRstCnt

char ngcppRstCnt = 0

Reset counters flag

◆ ngcppRstCnt_

char ngcppRstCnt_ = 0

Reset counters flag (internal)

◆ ngcppRtCheck

int ngcppRtCheck = 1

Run-time check flag

◆ ngcppRunning

char ngcppRunning = 0

Capture running flag

◆ ngcppSimDma

int ngcppSimDma = 0

DMA simulation flag

◆ ngcppSimHiRes

int ngcppSimHiRes = 1000

High-resolution simulation

◆ ngcppSimRt

int ngcppSimRt = 0

Real-time simulation flag

◆ ngcppSimStartDelay

int ngcppSimStartDelay = 0

Simulation start delay

◆ ngcppSimTime

int ngcppSimTime = 500

Simulation interval

◆ ngcppStartX

int ngcppStartX = 0

Chip offset in x-direction

◆ ngcppStartY

int ngcppStartY = 0

Chip offset in y-direction

◆ ngcppStatus

char ngcppStatus =ngcppSTAT_IDLE

Processing status

◆ ngcppSyncInput

char ngcppSyncInput = 0

Synchronous input flag

◆ ngcppTestCnt

int ngcppTestCnt = 0

Counter for tests

◆ ngcppThCapture

ngcb_thread_t ngcppThCapture[ngcppMAX_DEV]

◆ ngcppTime

double ngcppTime[2]

Calculation-time and frame-time information

◆ ngcppTimeFilter

ngcb_ma_t ngcppTimeFilter[2]

Filters for time measurements

◆ ngcppTimeStamp

uint64_t ngcppTimeStamp = 0

Last sample timestamp

◆ ngcppTransferring

char ngcppTransferring = 0

Transferring flag

◆ ngcppUnitSize

int ngcppUnitSize = 2

RTMS data unit size (bytes)

◆ semAppInit

ngcb_sema_t semAppInit

Application startup synchronization semaphore

◆ semBuf

ngcb_sema_t semBuf

Ringbuffer access protection semaphore

◆ semCam

ngcb_sema_t semCam

◆ semCiInit

ngcb_sema_t semCiInit

Command interpreter synchronization semaphore

◆ semCmd

ngcb_sema_t semCmd

Dynamic command synchronization semaphore

◆ semCmdAck

ngcb_sema_t semCmdAck

Dynamic command acknowledge semaphore

◆ semDataInit

ngcb_sema_t semDataInit

Data server synchronization semaphore

◆ semErrInit

ngcb_sema_t semErrInit

Error-stack synchronization semaphore

◆ semMem

ngcb_sema_t semMem

Data set access protection semaphore

◆ semParam

ngcb_sema_t semParam

Parameter access protection semaphore

◆ semParamLock

ngcb_sema_t semParamLock

Parameter lock synchronization semaphore

◆ semRun

ngcb_sema_t semRun

Running flag access protection semaphore

◆ semStat

ngcb_sema_t semStat

Status access protection semaphore

◆ semTerm

ngcb_sema_t semTerm

Termination synchronization semaphore