23#define USE(x) do {(void)(x);} while (0)
30static __inline__
char *__str2str(
char *s1,
const char *s2,
size_t n)
32 size_t size = strlen(s2);
33 if (n > size) n = size;
38#define str2str(s1, s2, n) __str2str(s1, s2, n)
44#define ngcbCOM_DEFAULT_DEVICE "/dev/ngc0_com"
49#define ngcbDMA_DEFAULT_DEVICE "/dev/ngc0_dma"
54#define ngcbCOM_DEFAULT_TIMEOUT 5
59#define ngcbCOM_FIFO_SIZE 128
65#define ngcbDMA_ERR_FIFO_OVERFLOW 0x1
66#define ngcbDMA_ERR_IPP_OVERRUN 0x2
98#define ngcbPRI_DMA_BURST 20
108 int num,
size_t size,
char *erms);
131 int num,
size_t size,
132 unsigned int *doneCount,
char *erms);
169 unsigned int n,
char *erms);
176 unsigned int *value,
char *erms);
183 unsigned int value,
char *erms);
338int ngcbComRead(
int fd,
char *buffer,
int size,
char *erms);
343int ngcbComWrite(
int fd,
const char *buffer,
int size,
char *erms);
433 size_t size,
char *erms);
458 size_t size,
unsigned int *doneCount,
char *erms);
556 size_t size,
char *erms);
572 size_t size,
unsigned int *doneCount,
char *erms);
647 int numBuf,
char *erms);
int ngcbDmaWaitTmo2(ngcb_dma_t dma, uint64_t *ts, int timeout, char *erms)
Definition ngcbDrvDma.c:213
int ngcbModWrite(ngcb_mod_t *m, int addr, const int *buffer, int size, char *erms)
Definition ngcbDrvMod.c:454
int ngcbComReadStatus(int fd)
Definition ngcbDrvCom.c:299
int ngcbDmaWait2(ngcb_dma_t dma, uint64_t *ts, char *erms)
Definition ngcbDrvDma.c:202
int(* ngcbDMA_ALLOC)(ngcb_dma_p_t *dma, unsigned char **buffer, int num, size_t size, char *erms)
Definition ngcbDrv.h:107
int(* ngcbDMA_CLR)(ngcb_dma_p_t *dma, char *erms)
Definition ngcbDrv.h:142
int ngcbComReset(int fd)
Definition ngcbDrvCom.c:144
void ngcbComStatStr(int status, char *s)
Definition ngcbDrvCom.c:393
int ngcbComTimeout(int fd, int seconds)
Definition ngcbDrvCom.c:192
ngcb_dma_api ngcbDma0
Definition ngcbDma0.c:476
int ngcbDmaClr(ngcb_dma_t dma, char *erms)
Definition ngcbDrvDma.c:174
int ngcbDma0Overflow(ngcb_dma_p_t *dma, char *erms)
Definition ngcbDma0.c:393
int ngcbDma0Open(const char *devName, ngcb_dma_p_t *dma, char *erms)
Definition ngcbDma0.c:94
int ngcbDmaBurstInit(ngcb_burst_t *burst, char *erms)
Definition ngcbDmaBurst.c:353
int ngcbComOpen(const char *name, char *erms)
Definition ngcbDrvCom.c:48
int(* ngcbDMA_DEVRD)(ngcb_dma_p_t *dma, unsigned int addr, unsigned int *value, char *erms)
Definition ngcbDrv.h:175
int(* ngcbDMA_CLOSE)(ngcb_dma_p_t *dma, char *erms)
Definition ngcbDrv.h:125
int ngcbDmaAlloc(ngcb_dma_t dma, unsigned char **buffer, int num, size_t size, char *erms)
Definition ngcbDrvDma.c:161
int ngcbComWrite(int fd, const char *buffer, int size, char *erms)
Definition ngcbDrvCom.c:257
int ngcbModWait(ngcb_mod_t *m, int addr, int mask, int timeout, char *erms)
Definition ngcbDrvMod.c:601
int(* ngcb_dma_select)(const char *devName, ngcb_dma_api *api)
Definition ngcbDrv.h:210
int ngcbDmaOverflow(ngcb_dma_t dma, char *erms)
Definition ngcbDrvDma.c:247
int ngcbDmaBurstStop(ngcb_burst_t *burst, char *erms)
Definition ngcbDmaBurst.c:647
int ngcbModFifo(ngcb_mod_t *m, int size, char *erms)
Definition ngcbDrvMod.c:307
int ngcbDma0Alloc(ngcb_dma_p_t *dma, unsigned char **buffer, int num, size_t size, char *erms)
Definition ngcbDma0.c:151
int(* ngcbDMA_OPEN)(const char *devName, ngcb_dma_p_t *dma, char *erms)
Definition ngcbDrv.h:119
int ngcbDma0Stop(ngcb_dma_p_t *dma, char *erms)
Definition ngcbDma0.c:293
int ngcbDma0Clr(ngcb_dma_p_t *dma, char *erms)
Definition ngcbDma0.c:222
int ngcbModRead(ngcb_mod_t *m, int addr, int *buffer, int size, char *erms)
Definition ngcbDrvMod.c:326
int ngcbDmaInit(ngcb_dma_t *dma, unsigned char **buffer, int num, size_t size, unsigned int *doneCount, char *erms)
Definition ngcbDrvDma.c:179
int ngcbModOpen(const char *path, ngcb_mod_t *m, char *erms)
Definition ngcbDrvMod.c:55
void ngcbComErrStr(int status, char *s)
Definition ngcbDrvCom.c:326
int ngcbComRstDev(int fd)
Definition ngcbDrvCom.c:126
int ngcbDmaBurstWait(ngcb_burst_t *burst, char *erms)
Definition ngcbDmaBurst.c:666
int ngcbDmaStop(ngcb_dma_t dma, char *erms)
Definition ngcbDrvDma.c:186
int(* ngcbDMA_IPP)(ngcb_dma_p_t *dma, int id, int *param, unsigned int n, char *erms)
Definition ngcbDrv.h:168
ngcb_dma_api ngcbAcqTcp
Definition ngcbAcqTcp.c:431
void(* ngcbDMA_FREE)(ngcb_dma_p_t *dma, unsigned char **buffer, int num)
Definition ngcbDrv.h:113
int ngcbDmaBurstOpen(const char *devName, ngcb_burst_t *burst, char *erms)
Definition ngcbDmaBurst.c:421
int ngcbDmaDevRd(ngcb_dma_t dma, unsigned int addr, unsigned int *value, char *erms)
Definition ngcbDrvDma.c:258
int(* ngcbDMA_WAIT)(ngcb_dma_p_t *dma, uint64_t *ts, char *erms)
Definition ngcbDrv.h:153
int ngcbDmaGetCnt(ngcb_dma_t dma, unsigned int *cnt, char *erms)
Definition ngcbDrvDma.c:191
int ngcbDmaBurstClose(ngcb_burst_t *burst, char *erms)
Definition ngcbDmaBurst.c:429
int ngcbDmaWaitTmo(ngcb_dma_t dma, int timeout, char *erms)
Definition ngcbDrvDma.c:207
int(* ngcbDMA_STAT)(ngcb_dma_p_t *dma, size_t *byteCount, char *erms)
Definition ngcbDrv.h:158
int(* ngcbDMA_INIT)(ngcb_dma_p_t *dma, unsigned char **buffer, int num, size_t size, unsigned int *doneCount, char *erms)
Definition ngcbDrv.h:130
ngcb_dma_api ngcbDmaPci
Definition ngcbDmaPci.c:563
ngcb_dma_api ngcbDmaRtSim
Definition ngcbDmaRtSim.c:331
int ngcbDmaWait(ngcb_dma_t dma, char *erms)
Definition ngcbDrvDma.c:196
void ngcbModInit(ngcb_mod_t *m)
Definition ngcbDrvMod.c:43
int ngcbDma0Init(ngcb_dma_p_t *dma, unsigned char **buffer, int num, size_t size, unsigned int *doneCount, char *erms)
Definition ngcbDma0.c:238
int ngcbComUpLink(int fd, int routeThrough, int rst)
Definition ngcbDrvCom.c:168
int ngcbDmaIppCfg(ngcb_dma_t dma, int id, int *param, unsigned int n, char *erms)
Definition ngcbDrvDma.c:252
int ngcbDma0DevWr(ngcb_dma_p_t *dma, unsigned int addr, unsigned int value, char *erms)
Definition ngcbDma0.c:453
int(* ngcbDMA_GETCNT)(ngcb_dma_p_t *dma, unsigned int *cnt, char *erms)
Definition ngcbDrv.h:147
int ngcbDma0Stat(ngcb_dma_p_t *dma, size_t *byteCount, char *erms)
Definition ngcbDma0.c:372
int ngcbComClose(int fd)
Definition ngcbDrvCom.c:94
void ngcbDmaBurstFree(ngcb_burst_t *burst)
Definition ngcbDmaBurst.c:499
int ngcbComGetRev(int fd)
Definition ngcbDrvCom.c:112
int ngcbDmaClose(ngcb_dma_t *dma, char *erms)
Definition ngcbDrvDma.c:153
int ngcbComRead(int fd, char *buffer, int size, char *erms)
Definition ngcbDrvCom.c:215
int ngcbModTimeout(ngcb_mod_t *m, int seconds, char *erms)
Definition ngcbDrvMod.c:285
void ngcbDmaFree(ngcb_dma_t dma, unsigned char **buffer, int num)
Definition ngcbDrvDma.c:168
ngcb_dma_api ngcbAcqUdp
Definition ngcbAcqUdp.c:1748
int ngcbDma0Wait(ngcb_dma_p_t *dma, uint64_t *ts, char *erms)
Definition ngcbDma0.c:336
int ngcbDma0Close(ngcb_dma_p_t *dma, char *erms)
Definition ngcbDma0.c:115
int(* ngcbDMA_STOP)(ngcb_dma_p_t *dma, char *erms)
Definition ngcbDrv.h:137
int(* ngcbDMA_OVERFLOW)(ngcb_dma_p_t *dma, char *erms)
Definition ngcbDrv.h:163
int ngcbDmaBurstStart(ngcb_burst_t *burst, char *erms)
Definition ngcbDmaBurst.c:539
void ngcbDmaBurstRelease(ngcb_burst_t *burst)
Definition ngcbDmaBurst.c:409
ngcb_dma_select ngcbDmaApiSelect
Definition ngcbDrvDma.c:30
int ngcbComErrStatus(void)
Definition ngcbDrvCom.c:321
int ngcbDmaDevWr(ngcb_dma_t dma, unsigned int addr, unsigned int value, char *erms)
Definition ngcbDrvDma.c:264
int(* ngcbDMA_DEVWR)(ngcb_dma_p_t *dma, unsigned int addr, unsigned int value, char *erms)
Definition ngcbDrv.h:182
int ngcbDmaStat(ngcb_dma_t dma, size_t *byteCount, char *erms)
Definition ngcbDrvDma.c:242
int ngcbDma0DevRd(ngcb_dma_p_t *dma, unsigned int addr, unsigned int *value, char *erms)
Definition ngcbDma0.c:431
int ngcbDmaOpen(const char *devName, ngcb_dma_t *dma, char *erms)
Definition ngcbDrvDma.c:82
int ngcbDmaBurstAlloc(ngcb_burst_t *burst, size_t size, size_t dmaSize, int numBuf, char *erms)
Definition ngcbDmaBurst.c:442
int ngcbDma0GetCnt(ngcb_dma_p_t *dma, unsigned int *cnt, char *erms)
Definition ngcbDma0.c:317
void ngcbDma0Free(ngcb_dma_p_t *dma, unsigned char **buffer, int num)
Definition ngcbDma0.c:199
int ngcbDma0IppCfg(ngcb_dma_p_t *dma, int id, int *param, unsigned int n, char *erms)
Definition ngcbDma0.c:411
int ngcbModClose(ngcb_mod_t *m, char *erms)
Definition ngcbDrvMod.c:248
pthread_t ngcb_thread_t
Definition ngcbSched.h:52
char erms[256]
Definition ngcbDrv.h:251
ngcb_sema_t semSync
Definition ngcbDrv.h:255
unsigned int doneCount
Definition ngcbDrv.h:250
ngcb_sema_t semStart
Definition ngcbDrv.h:254
ngcb_sema_t semStat
Definition ngcbDrv.h:256
int tmo
Definition ngcbDrv.h:249
int threadCreated
Definition ngcbDrv.h:253
unsigned char ** dmaBuffer
Definition ngcbDrv.h:245
ngcb_sema_t semWdSync
Definition ngcbDrv.h:258
ngcb_sema_t semWdStart
Definition ngcbDrv.h:257
int timeout
Definition ngcbDrv.h:262
unsigned char * buffer
Definition ngcbDrv.h:242
int dmaStarted
Definition ngcbDrv.h:248
int wdfd[2]
Definition ngcbDrv.h:261
int watchdog
Definition ngcbDrv.h:259
size_t size
Definition ngcbDrv.h:243
size_t dmaSize
Definition ngcbDrv.h:246
ngcb_thread_t threadId
Definition ngcbDrv.h:252
ngcb_thread_t wdThreadId
Definition ngcbDrv.h:260
ngcb_dma_t dma
Definition ngcbDrv.h:244
int dmaNumBuf
Definition ngcbDrv.h:247
ngcbDMA_OVERFLOW Overflow
Definition ngcbDrv.h:199
ngcbDMA_OPEN Open
Definition ngcbDrv.h:191
ngcbDMA_WAIT Wait
Definition ngcbDrv.h:197
ngcbDMA_INIT Init
Definition ngcbDrv.h:193
ngcbDMA_CLOSE Close
Definition ngcbDrv.h:192
ngcb_dma_p_t * param
Definition ngcbDrv.h:203
ngcbDMA_DEVRD DevRd
Definition ngcbDrv.h:201
ngcbDMA_CLR Clr
Definition ngcbDrv.h:195
ngcbDMA_STOP Stop
Definition ngcbDrv.h:194
ngcbDMA_DEVWR DevWr
Definition ngcbDrv.h:202
ngcbDMA_FREE Free
Definition ngcbDrv.h:190
ngcbDMA_STAT Stat
Definition ngcbDrv.h:198
ngcbDMA_IPP IppCfg
Definition ngcbDrv.h:200
ngcbDMA_ALLOC Alloc
Definition ngcbDrv.h:189
int deviceOpen
Definition ngcbDrv.h:204
ngcbDMA_GETCNT GetCnt
Definition ngcbDrv.h:196
int cpu
Definition ngcbDrv.h:80
int timer
Definition ngcbDrv.h:77
unsigned int resync
Definition ngcbDrv.h:86
size_t mapSize
Definition ngcbDrv.h:74
int chanSelect
Definition ngcbDrv.h:79
unsigned int joinerDelay
Definition ngcbDrv.h:85
void * appData
Definition ngcbDrv.h:92
void * mapArea
Definition ngcbDrv.h:73
unsigned int cnt
Definition ngcbDrv.h:76
int reserved2
Definition ngcbDrv.h:90
int tmo
Definition ngcbDrv.h:78
unsigned int syncMode
Definition ngcbDrv.h:84
int reserved3
Definition ngcbDrv.h:91
unsigned int dropped
Definition ngcbDrv.h:87
unsigned int unitSize
Definition ngcbDrv.h:83
unsigned int ippMode
Definition ngcbDrv.h:81
int stay
Definition ngcbDrv.h:88
int reserved1
Definition ngcbDrv.h:89
int running
Definition ngcbDrv.h:75
int fd
Definition ngcbDrv.h:72
unsigned int payloadSize
Definition ngcbDrv.h:82
ngcb_dma_p_t param
Definition ngcbDrv.h:235
ngcb_dma_api api
Definition ngcbDrv.h:234
FILE * sim
Definition ngcbDrv.h:227
int flags
Definition ngcbDrv.h:223
unsigned int offset
Definition ngcbDrv.h:222
unsigned int period
Definition ngcbDrv.h:225
int fd
Definition ngcbDrv.h:226
int fifo
Definition ngcbDrv.h:224
Definition ngcbSched.h:77