24#define USE(x) do {(void)(x);} while (0)
31static __inline__
char *__str2str(
char *s1,
const char *s2,
size_t n)
33 size_t size = strlen(s2);
34 if (n > size) n = size;
39#define str2str(s1, s2, n) __str2str(s1, s2, n)
45#define ngcbCOM_DEFAULT_DEVICE "/dev/ngc0_com"
50#define ngcbDMA_DEFAULT_DEVICE "/dev/ngc0_dma"
55#define ngcbCOM_DEFAULT_TIMEOUT 5
60#define ngcbCOM_FIFO_SIZE 128
66#define ngcbDMA_ERR_FIFO_OVERFLOW 0x1
67#define ngcbDMA_ERR_IPP_OVERRUN 0x2
99#define ngcbPRI_DMA_BURST 20
109 int num,
size_t size,
char *erms);
132 int num,
size_t size,
133 unsigned int *doneCount,
char *erms);
170 unsigned int n,
char *erms);
177 unsigned int *value,
char *erms);
184 unsigned int value,
char *erms);
339int ngcbComRead(
int fd,
char *buffer,
int size,
char *erms);
344int ngcbComWrite(
int fd,
const char *buffer,
int size,
char *erms);
434 size_t size,
char *erms);
459 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:214
int ngcbModWrite(ngcb_mod_t *m, int addr, const int *buffer, int size, char *erms)
Definition ngcbDrvMod.c:455
int ngcbComReadStatus(int fd)
Definition ngcbDrvCom.c:300
int ngcbDmaWait2(ngcb_dma_t dma, uint64_t *ts, char *erms)
Definition ngcbDrvDma.c:203
int(* ngcbDMA_ALLOC)(ngcb_dma_p_t *dma, unsigned char **buffer, int num, size_t size, char *erms)
Definition ngcbDrv.h:108
int(* ngcbDMA_CLR)(ngcb_dma_p_t *dma, char *erms)
Definition ngcbDrv.h:143
int ngcbComReset(int fd)
Definition ngcbDrvCom.c:145
void ngcbComStatStr(int status, char *s)
Definition ngcbDrvCom.c:394
int ngcbComTimeout(int fd, int seconds)
Definition ngcbDrvCom.c:193
int ngcbDma0Stat(ngcb_dma_p_t *dma, int *err, int *stat, char *erms)
Definition ngcbDma0.c:373
ngcb_dma_api ngcbDma0
Definition ngcbDma0.c:464
int ngcbDmaClr(ngcb_dma_t dma, char *erms)
Definition ngcbDrvDma.c:175
int ngcbDma0Overflow(ngcb_dma_p_t *dma, char *erms)
Definition ngcbDma0.c:381
int ngcbDma0Open(const char *devName, ngcb_dma_p_t *dma, char *erms)
Definition ngcbDma0.c:95
int ngcbDmaBurstInit(ngcb_burst_t *burst, char *erms)
Definition ngcbDmaBurst.c:354
int ngcbComOpen(const char *name, char *erms)
Definition ngcbDrvCom.c:49
int(* ngcbDMA_DEVRD)(ngcb_dma_p_t *dma, unsigned int addr, unsigned int *value, char *erms)
Definition ngcbDrv.h:176
int(* ngcbDMA_CLOSE)(ngcb_dma_p_t *dma, char *erms)
Definition ngcbDrv.h:126
int ngcbDmaAlloc(ngcb_dma_t dma, unsigned char **buffer, int num, size_t size, char *erms)
Definition ngcbDrvDma.c:162
int ngcbComWrite(int fd, const char *buffer, int size, char *erms)
Definition ngcbDrvCom.c:258
int ngcbModWait(ngcb_mod_t *m, int addr, int mask, int timeout, char *erms)
Definition ngcbDrvMod.c:602
int(* ngcb_dma_select)(const char *devName, ngcb_dma_api *api)
Definition ngcbDrv.h:211
int ngcbDmaOverflow(ngcb_dma_t dma, char *erms)
Definition ngcbDrvDma.c:248
int ngcbDmaBurstStop(ngcb_burst_t *burst, char *erms)
Definition ngcbDmaBurst.c:648
int ngcbModFifo(ngcb_mod_t *m, int size, char *erms)
Definition ngcbDrvMod.c:308
int ngcbDma0Alloc(ngcb_dma_p_t *dma, unsigned char **buffer, int num, size_t size, char *erms)
Definition ngcbDma0.c:152
int(* ngcbDMA_OPEN)(const char *devName, ngcb_dma_p_t *dma, char *erms)
Definition ngcbDrv.h:120
int ngcbDma0Stop(ngcb_dma_p_t *dma, char *erms)
Definition ngcbDma0.c:294
int ngcbDma0Clr(ngcb_dma_p_t *dma, char *erms)
Definition ngcbDma0.c:223
int ngcbModRead(ngcb_mod_t *m, int addr, int *buffer, int size, char *erms)
Definition ngcbDrvMod.c:327
int ngcbDmaInit(ngcb_dma_t *dma, unsigned char **buffer, int num, size_t size, unsigned int *doneCount, char *erms)
Definition ngcbDrvDma.c:180
int ngcbModOpen(const char *path, ngcb_mod_t *m, char *erms)
Definition ngcbDrvMod.c:56
void ngcbComErrStr(int status, char *s)
Definition ngcbDrvCom.c:327
int ngcbComRstDev(int fd)
Definition ngcbDrvCom.c:127
int ngcbDmaBurstWait(ngcb_burst_t *burst, char *erms)
Definition ngcbDmaBurst.c:667
int ngcbDmaStop(ngcb_dma_t dma, char *erms)
Definition ngcbDrvDma.c:187
int(* ngcbDMA_IPP)(ngcb_dma_p_t *dma, int id, int *param, unsigned int n, char *erms)
Definition ngcbDrv.h:169
ngcb_dma_api ngcbAcqTcp
Definition ngcbAcqTcp.c:432
void(* ngcbDMA_FREE)(ngcb_dma_p_t *dma, unsigned char **buffer, int num)
Definition ngcbDrv.h:114
int ngcbDmaBurstOpen(const char *devName, ngcb_burst_t *burst, char *erms)
Definition ngcbDmaBurst.c:422
int(* ngcbDMA_STAT)(ngcb_dma_p_t *dma, int *err, int *stat, char *erms)
Definition ngcbDrv.h:159
int ngcbDmaDevRd(ngcb_dma_t dma, unsigned int addr, unsigned int *value, char *erms)
Definition ngcbDrvDma.c:259
int(* ngcbDMA_WAIT)(ngcb_dma_p_t *dma, uint64_t *ts, char *erms)
Definition ngcbDrv.h:154
int ngcbDmaGetCnt(ngcb_dma_t dma, unsigned int *cnt, char *erms)
Definition ngcbDrvDma.c:192
int ngcbDmaBurstClose(ngcb_burst_t *burst, char *erms)
Definition ngcbDmaBurst.c:430
int ngcbDmaWaitTmo(ngcb_dma_t dma, int timeout, char *erms)
Definition ngcbDrvDma.c:208
int(* ngcbDMA_INIT)(ngcb_dma_p_t *dma, unsigned char **buffer, int num, size_t size, unsigned int *doneCount, char *erms)
Definition ngcbDrv.h:131
ngcb_dma_api ngcbDmaPci
Definition ngcbDmaPci.c:544
ngcb_dma_api ngcbDmaRtSim
Definition ngcbDmaRtSim.c:332
int ngcbDmaWait(ngcb_dma_t dma, char *erms)
Definition ngcbDrvDma.c:197
void ngcbModInit(ngcb_mod_t *m)
Definition ngcbDrvMod.c:44
int ngcbDma0Init(ngcb_dma_p_t *dma, unsigned char **buffer, int num, size_t size, unsigned int *doneCount, char *erms)
Definition ngcbDma0.c:239
int ngcbDmaStat(ngcb_dma_t dma, int *err, int *stat, char *erms)
Definition ngcbDrvDma.c:243
int ngcbComUpLink(int fd, int routeThrough, int rst)
Definition ngcbDrvCom.c:169
int ngcbDmaIppCfg(ngcb_dma_t dma, int id, int *param, unsigned int n, char *erms)
Definition ngcbDrvDma.c:253
int ngcbDma0DevWr(ngcb_dma_p_t *dma, unsigned int addr, unsigned int value, char *erms)
Definition ngcbDma0.c:441
int(* ngcbDMA_GETCNT)(ngcb_dma_p_t *dma, unsigned int *cnt, char *erms)
Definition ngcbDrv.h:148
int ngcbComClose(int fd)
Definition ngcbDrvCom.c:95
void ngcbDmaBurstFree(ngcb_burst_t *burst)
Definition ngcbDmaBurst.c:500
int ngcbComGetRev(int fd)
Definition ngcbDrvCom.c:113
int ngcbDmaClose(ngcb_dma_t *dma, char *erms)
Definition ngcbDrvDma.c:154
int ngcbComRead(int fd, char *buffer, int size, char *erms)
Definition ngcbDrvCom.c:216
int ngcbModTimeout(ngcb_mod_t *m, int seconds, char *erms)
Definition ngcbDrvMod.c:286
void ngcbDmaFree(ngcb_dma_t dma, unsigned char **buffer, int num)
Definition ngcbDrvDma.c:169
ngcb_dma_api ngcbAcqUdp
Definition ngcbAcqUdp.c:1834
int ngcbDma0Wait(ngcb_dma_p_t *dma, uint64_t *ts, char *erms)
Definition ngcbDma0.c:337
int ngcbDma0Close(ngcb_dma_p_t *dma, char *erms)
Definition ngcbDma0.c:116
int(* ngcbDMA_STOP)(ngcb_dma_p_t *dma, char *erms)
Definition ngcbDrv.h:138
int(* ngcbDMA_OVERFLOW)(ngcb_dma_p_t *dma, char *erms)
Definition ngcbDrv.h:164
int ngcbDmaBurstStart(ngcb_burst_t *burst, char *erms)
Definition ngcbDmaBurst.c:540
void ngcbDmaBurstRelease(ngcb_burst_t *burst)
Definition ngcbDmaBurst.c:410
ngcb_dma_select ngcbDmaApiSelect
Definition ngcbDrvDma.c:31
int ngcbComErrStatus(void)
Definition ngcbDrvCom.c:322
int ngcbDmaDevWr(ngcb_dma_t dma, unsigned int addr, unsigned int value, char *erms)
Definition ngcbDrvDma.c:265
int(* ngcbDMA_DEVWR)(ngcb_dma_p_t *dma, unsigned int addr, unsigned int value, char *erms)
Definition ngcbDrv.h:183
int ngcbDma0DevRd(ngcb_dma_p_t *dma, unsigned int addr, unsigned int *value, char *erms)
Definition ngcbDma0.c:419
int ngcbDmaOpen(const char *devName, ngcb_dma_t *dma, char *erms)
Definition ngcbDrvDma.c:83
int ngcbDmaBurstAlloc(ngcb_burst_t *burst, size_t size, size_t dmaSize, int numBuf, char *erms)
Definition ngcbDmaBurst.c:443
int ngcbDma0GetCnt(ngcb_dma_p_t *dma, unsigned int *cnt, char *erms)
Definition ngcbDma0.c:318
void ngcbDma0Free(ngcb_dma_p_t *dma, unsigned char **buffer, int num)
Definition ngcbDma0.c:200
int ngcbDma0IppCfg(ngcb_dma_p_t *dma, int id, int *param, unsigned int n, char *erms)
Definition ngcbDma0.c:399
int ngcbModClose(ngcb_mod_t *m, char *erms)
Definition ngcbDrvMod.c:249
pthread_t ngcb_thread_t
Definition ngcbSched.h:53
char erms[256]
Definition ngcbDrv.h:252
ngcb_sema_t semSync
Definition ngcbDrv.h:256
unsigned int doneCount
Definition ngcbDrv.h:251
ngcb_sema_t semStart
Definition ngcbDrv.h:255
ngcb_sema_t semStat
Definition ngcbDrv.h:257
int tmo
Definition ngcbDrv.h:250
int threadCreated
Definition ngcbDrv.h:254
unsigned char ** dmaBuffer
Definition ngcbDrv.h:246
ngcb_sema_t semWdSync
Definition ngcbDrv.h:259
ngcb_sema_t semWdStart
Definition ngcbDrv.h:258
int timeout
Definition ngcbDrv.h:263
unsigned char * buffer
Definition ngcbDrv.h:243
int dmaStarted
Definition ngcbDrv.h:249
int wdfd[2]
Definition ngcbDrv.h:262
int watchdog
Definition ngcbDrv.h:260
size_t size
Definition ngcbDrv.h:244
size_t dmaSize
Definition ngcbDrv.h:247
ngcb_thread_t threadId
Definition ngcbDrv.h:253
ngcb_thread_t wdThreadId
Definition ngcbDrv.h:261
ngcb_dma_t dma
Definition ngcbDrv.h:245
int dmaNumBuf
Definition ngcbDrv.h:248
ngcbDMA_OVERFLOW Overflow
Definition ngcbDrv.h:200
ngcbDMA_OPEN Open
Definition ngcbDrv.h:192
ngcbDMA_WAIT Wait
Definition ngcbDrv.h:198
ngcbDMA_INIT Init
Definition ngcbDrv.h:194
ngcbDMA_CLOSE Close
Definition ngcbDrv.h:193
ngcb_dma_p_t * param
Definition ngcbDrv.h:204
ngcbDMA_DEVRD DevRd
Definition ngcbDrv.h:202
ngcbDMA_CLR Clr
Definition ngcbDrv.h:196
ngcbDMA_STOP Stop
Definition ngcbDrv.h:195
ngcbDMA_DEVWR DevWr
Definition ngcbDrv.h:203
ngcbDMA_FREE Free
Definition ngcbDrv.h:191
ngcbDMA_STAT Stat
Definition ngcbDrv.h:199
ngcbDMA_IPP IppCfg
Definition ngcbDrv.h:201
ngcbDMA_ALLOC Alloc
Definition ngcbDrv.h:190
int deviceOpen
Definition ngcbDrv.h:205
ngcbDMA_GETCNT GetCnt
Definition ngcbDrv.h:197
int cpu
Definition ngcbDrv.h:82
int timer
Definition ngcbDrv.h:89
unsigned int resync
Definition ngcbDrv.h:84
size_t mapSize
Definition ngcbDrv.h:76
int chanSelect
Definition ngcbDrv.h:81
unsigned int joinerDelay
Definition ngcbDrv.h:87
void * appData
Definition ngcbDrv.h:93
void * mapArea
Definition ngcbDrv.h:75
unsigned int cnt
Definition ngcbDrv.h:77
int reserved2
Definition ngcbDrv.h:91
int tmo
Definition ngcbDrv.h:80
unsigned int syncMode
Definition ngcbDrv.h:83
int reserved3
Definition ngcbDrv.h:92
unsigned int dropped
Definition ngcbDrv.h:85
unsigned int unitSize
Definition ngcbDrv.h:79
unsigned int ippMode
Definition ngcbDrv.h:86
int stay
Definition ngcbDrv.h:88
int reserved1
Definition ngcbDrv.h:90
int running
Definition ngcbDrv.h:74
int fd
Definition ngcbDrv.h:73
unsigned int payloadSize
Definition ngcbDrv.h:78
ngcb_dma_p_t param
Definition ngcbDrv.h:236
ngcb_dma_api api
Definition ngcbDrv.h:235
FILE * sim
Definition ngcbDrv.h:228
int flags
Definition ngcbDrv.h:224
unsigned int offset
Definition ngcbDrv.h:223
unsigned int period
Definition ngcbDrv.h:226
int fd
Definition ngcbDrv.h:227
int fifo
Definition ngcbDrv.h:225
Definition ngcbSched.h:78