#ifdef ETRAX
-const char trbnet_version[] = "$Revision: 4.39 $ Local Etrax";
+const char trbnet_version[] = "$Revision: 4.40 $ Local Etrax";
#elif defined PEXOR
-const char trbnet_version[] = "$Revision: 4.39 $ Local Pexor";
+const char trbnet_version[] = "$Revision: 4.40 $ Local Pexor";
#elif defined TRB3
-const char trbnet_version[] = "$Revision: 4.39 $ Local TRB3";
+const char trbnet_version[] = "$Revision: 4.40 $ Local TRB3";
#else
-const char trbnet_version[] = "$Revision: 4.39 $ UNKNOWN, i.e. ERROR";
+const char trbnet_version[] = "$Revision: 4.40 $ UNKNOWN, i.e. ERROR";
#endif
#include <stdlib.h>
/* Semaphore handling */
static int semid = -1;
-#if defined TRB3
-static const key_t sem_key = 0x747262;
-#else
+#ifndef TRB3
static const key_t sem_key = 0x545242;
#endif
static int lockPorts(int masterLock)
{
+#ifndef TRB3
struct sembuf sops = {
0, /* sem_num: We only use one track */
-1, /* sem_op: decrement semaphore by 1, i.e. lock it */
if ((master_lock == 1) && (masterLock == 0)) {
return 0;
}
+#endif
/* Block Signals */
if (sigprocmask(SIG_BLOCK, &blockSet, &blockSetOld) == -1) {
return -1;
}
+#ifndef TRB3
/* Wait for semaphore and lock it */
if (semop(semid, &sops, 1) == -1) {
/* Unblock signals */
#ifdef ETRAX
/* Get FifoToggleBit-Status, needed by read32_from_FPGA ... */
fifoToggleBit = readPC() & FIFO_TOGGLE_BIT;
+#endif
#endif
if (masterLock != 0) master_lock = 1;
static int unlockPorts(int masterLock)
{
+#ifndef TRB3
struct sembuf sops = {
0, /* sem_num: We only use one track */
1, /* sem_op: increment semaphore by 1, i.e. unlock it */
SEM_UNDO /* sem_flg: remove lock if process gets killed */
};
+#endif
if ((master_lock == 1) && (masterLock == 0)) {
return 0;
if (masterLock != 0) master_lock = 0;
+#ifndef TRB3
/* Release semaphore */
if (semop(semid, &sops, 1) == -1) {
trb_errno = TRB_SEMAPHORE;
return -1;
}
+#endif
/* Unblock Signals */
if (sigprocmask(SIG_SETMASK, &blockSetOld, NULL) == -1) {
/* Set signal mask to block ALL signals */
sigfillset(&blockSet);
sigemptyset(&blockSetOld);
+
+#ifdef TRB3
+ return 0;
+#else
/* Get / Create semaphore */
if ((semid = semget(sem_key, 1,
}
return 0;
+#endif
}
/* ----- Global Functions ----------------------------------------------- */