-const char trbnet_version[] = "$Revision: 4.10 $";
+const char trbnet_version[] = "$Revision: 4.11 $ Local";
#include <stdlib.h>
#include <signal.h>
/* ------ Internal Functions for FPGA access ------------------------------ */
-#ifndef PEXOR /* Etrax-Board */
+#ifdef ETRAX /* Etrax-Board */
#define FIFO_TOGGLE_BIT 0x10000
}
/* Check for TX not Busy */
-#ifndef PEXOR
+#ifdef ETRAX
read32_from_FPGA(CHANNEL_N_SENDER_STATUS | ((channel * 2 + 1) << 4), &tmp);
if (tmp != 0) {
/* FIFO_TOGGLE_BIT-BUG Workaround */
}
/* Check receiver FIFO empty */
-#ifndef PEXOR
+#ifdef ETRAX
read32_from_FPGA(CHANNEL_N_RECEIVER_FIFO_STATUS | ((channel * 2 + 1) << 4),
&tmp);
if ((tmp & MASK_FIFO_EMPTY) == 0) {
unsigned int dsize)
{
-#ifndef PEXOR
+#ifdef ETRAX
static uint32_t dataBuffer = 0;
uint32_t* tmp = &dataBuffer;
uint32_t fifoBuffer = 0;
unsigned int timeout = 0;
-#else /* Pexor DMA */
+#else /* Pexor DMA */
uint32_t* tmp = dataBuffer;
#endif
+
TRB_Package package = {0,0,0,0,0};
int headerType = 0;
fprintf(stderr, "FIFO_%03d: 0x%08x\n",
fifoDebugCtr, *tmp);
}
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INCOMPLETE_PACKAGE;
if (((*tmp & MASK_FIFO_TYPE) >> SHIFT_FIFO_TYPE) !=
(counter - 1) % 2) {
/* Error: invalid sequence (not 0, 1, .), flush FIFO-BUFFER, exit */
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_SEQUENZ;
/* First package: headerType must be HDR or TRM */
if (packageCtr == 0) {
if (!((headerType == HEADER_HDR) || (headerType == HEADER_TRM))) {
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_HEADER;
return -1;
}
-#ifndef PEXOR
+#ifdef ETRAX
/* Check Header H0 */
if (((package.H0 & MASK_HEADER_REPLY) >> SHIFT_HEADER_REPLY
!= 0x01) ||
!= channel)) {
/* Error Package inconsistencies, flush FIFO-BUFFER and exit */
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_HEADERS;
switch (mode) {
case FIFO_MODE_TERM_ONLY:
if (packageCtr > 0) {
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_INVALID_PKG_NUMBER;
return -1;
}
if (headerType != HEADER_TRM) {
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_HEADER;
switch (headerType) {
case HEADER_HDR:
if ((packageCtr - endPointCtr * 2) != 0) {
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_HEADER;
case HEADER_DAT:
if ((packageCtr - endPointCtr * 2) != 1) {
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_HEADER;
break;
default:
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_HEADER;
switch (headerType) {
case HEADER_HDR:
if ((packageCtr - endPointCtr * 2) != 0) {
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_HEADER;
case HEADER_DAT:
if ((packageCtr - endPointCtr * 2) != 1) {
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_HEADER;
break;
default:
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_HEADER;
break;
default:
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_HEADER;
break;
default:
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_HEADER;
break;
default:
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_HEADER;
switch (headerType) {
case HEADER_HDR:
if (packageCtr != 0) {
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_HEADER;
case HEADER_TRM:
if ((packageCtr > 0) && (dataCtr != memLen)) {
/* Error invalid length */
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_HDR_DLEN;
break;
default:
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_HEADER;
switch (headerType) {
case HEADER_HDR:
if ((packageCtr - endPointCtr * 3) != 0) {
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_HEADER;
break;
default:
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_HEADER;
case FIFO_MODE_SET_ADDRESS:
if (packageCtr > 2) {
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_INVALID_PKG_NUMBER;
break;
default:
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_HEADER;
break;
default:
-#ifndef PEXOR
+#ifdef ETRAX
fifo_flush(channel);
#endif
trb_errno = TRB_FIFO_INVALID_MODE;
sigprocmask(SIG_SETMASK, &blockSetOld, NULL);
return -1;
}
-#ifndef PEXOR
+#ifdef ETRAX
/* Get FifoToggleBit-Status, needed by read32_from_FPGA ... */
fifoToggleBit = readPC() & FIFO_TOGGLE_BIT;
#endif
/* ----- Global Functions ----------------------------------------------- */
-#ifndef PEXOR /* Etrax-Board */
+#ifdef ETRAX /* Etrax-Board */
/* Init FPGA Interface */
int init_ports()
fprintf(stderr, "Init_Transfer done.\n");
}
-#ifndef PEXOR
+#ifdef ETRAX
/* Build package and start transfer */
write32_to_FPGA(CHANNEL_3_TARGET_ADDRESS, trb_address);
write32_to_FPGA(CHANNEL_3_SENDER_ERROR, 0x00000000);
fprintf(stderr, "Init_Transfer done.\n");
}
-#ifndef PEXOR
+#ifdef ETRAX
/* Build package and start transfer */
write32_to_FPGA(CHANNEL_3_TARGET_ADDRESS, trb_address);
write32_to_FPGA(CHANNEL_3_SENDER_ERROR, 0x00000000);
fprintf(stderr, "Init_Transfer done.\n");
}
-#ifndef PEXOR
+#ifdef ETRAX
/* Build package and start transfer */
write32_to_FPGA(CHANNEL_3_TARGET_ADDRESS, trb_address);
write32_to_FPGA(CHANNEL_3_SENDER_ERROR, 0x00000000);
fprintf(stderr, "Init_Transfer done.\n");
}
-#ifndef PEXOR
+#ifdef ETRAX
/* Build package and start transfer */
write32_to_FPGA(CHANNEL_3_TARGET_ADDRESS, trb_address);
write32_to_FPGA(CHANNEL_3_SENDER_ERROR, 0x00000000);
fprintf(stderr, "Init_Transfer done.\n");
}
-#ifndef PEXOR
+#ifdef ETRAX
/* Build package */
write32_to_FPGA(CHANNEL_3_TARGET_ADDRESS, trb_address);
write32_to_FPGA(CHANNEL_3_SENDER_ERROR, 0x00000000);
uint16_t config;
uint16_t ctr = 0;
int status = -1;
-#ifndef PEXOR
+#ifdef ETRAX
uint16_t i;
#endif
fprintf(stderr, "Init_Transfer done.\n");
}
-#ifndef PEXOR
+#ifdef ETRAX
/* Build package */
write32_to_FPGA(CHANNEL_3_TARGET_ADDRESS, trb_address);
write32_to_FPGA(CHANNEL_3_SENDER_ERROR, 0x00000000);
fprintf(stderr, "Init_Transfer done.\n");
}
-#ifndef PEXOR
+#ifdef ETRAX
/* Build package and start transfer */
write32_to_FPGA(CHANNEL_3_TARGET_ADDRESS, trb_address);
write32_to_FPGA(CHANNEL_3_SENDER_ERROR, 0x00000000);
fprintf(stderr, "Init_Transfer done.\n");
}
-#ifndef PEXOR
+#ifdef ETRAX
/* Build package and start transfer */
write32_to_FPGA(CHANNEL_3_TARGET_ADDRESS, 0xffff); /* always broadcast */
write32_to_FPGA(CHANNEL_3_SENDER_ERROR, 0x00000000);
fprintf(stderr, "Init_Transfer done.\n");
}
-#ifndef PEXOR
+#ifdef ETRAX
/* Prepare IPU channel */
write32_to_FPGA(CHANNEL_1_SENDER_ERROR, (((uint32_t)trg_info << 24) |
((uint32_t)trg_random << 16) |
fprintf(stderr, "Init_Transfer done.\n");
}
-#ifndef PEXOR
+#ifdef ETRAX
/* Prepare trigger channel */
write32_to_FPGA(CHANNEL_0_SENDER_ERROR, (((trg_info & 0xff) << 24) |
((uint32_t)trg_random << 16) |
fprintf(stderr, "Init_Transfer done.\n");
}
-#ifndef PEXOR
+#ifdef ETRAX
/* Prepare slowcontrol channel */
write32_to_FPGA(CHANNEL_3_TARGET_ADDRESS, 0x0000fffb); /* RICH Subnet only */
write32_to_FPGA(CHANNEL_3_SENDER_ERROR, 0x00000000);
return -1;
}
-#ifndef PEXOR
+#ifdef ETRAX
/* Prepare trigger channel */
write32_to_FPGA(CHANNEL_0_SENDER_ERROR, (((trg_info & 0xff) << 24) |
((uint32_t)trg_random << 16) |
int status = 0;
trb_errno = TRB_NONE;
-#ifndef PEXOR
+#ifdef ETRAX
reg_address &= 0xffff;
#endif
int status = 0;
trb_errno = TRB_NONE;
-#ifndef PEXOR
+#ifdef ETRAX
reg_address &= 0xffff;
#endif