Commit d9f97688 authored by Federico Vaga's avatar Federico Vaga

sw:rt: port to Mock Turtle 4.0 [UNTESTED]

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 8ff80577
/*
* Copyright (C) 2018 CERN (www.cern.ch)
* Author: Federico Vaga <federico.vaga@cern.ch>
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
......@@ -20,30 +20,13 @@
#ifndef __WRTD_COMMON_H
#define __WRTD_COMMON_H
#define WRTD_IN_RT_ID 0x347D0000
#define WRTD_OUT_RT_ID 0x347D0001
#define WRTD_IN_RT_ID 0x347D
#define WRTD_OUT_RT_ID 0x347E
/* WR Node CPU Core indices */
#define WRTD_CPU_TDC 0 /* Core 0 controls the TDC mezzanine */
#define WRTD_CPU_FD 1 /* Core 1 controls the FD mezzanine */
#define WRTD_IN_MAX 2
#define WRTD_IN_TDC_CONTROL 0
#define WRTD_IN_FD_CONTROL 1
#define WRTD_OUT_MAX 4
#define WRTD_OUT_TDC_CONTROL 0
#define WRTD_OUT_FD_CONTROL 1
#define WRTD_OUT_TDC_LOGGING 2
#define WRTD_OUT_FD_LOGGING 3
#define WRTD_REMOTE_IN_MAX 1
#define WRTD_REMOTE_IN_FD 0
#define WRTD_REMOTE_OUT_MAX 1
#define WRTD_REMOTE_OUT_TDC 0
/* Command and log message IDs */
......@@ -106,7 +89,7 @@
#define TDC_TRIGGER_COALESCE_LIMIT 5
#define FD_NUM_CHANNELS 4
#define FD_HASH_ENTRIES 64
#define FD_HASH_ENTRIES 32
#define FD_MAX_QUEUE_PULSES 16
enum wrtd_in_actions {
......@@ -276,68 +259,6 @@ struct wrtd_log_entry {
is WRTD_LOG_MISSED */
};
#ifdef WRNODE_RT
struct wrtd_trigger_message {
struct rmq_message_addr hdr;
uint32_t transmit_seconds;
uint32_t transmit_cycles;
int count;
struct wrtd_trigger_entry triggers[TDC_TRIGGER_COALESCE_LIMIT];
uint32_t pad; // stupid Etherbone for some reasons drops the last entry on TX
};
#endif
#ifdef WRNODE_RT
static inline void ts_add(struct wr_timestamp *a, const struct wr_timestamp *b)
{
a->frac += b->frac;
if(a->frac >= 4096)
{
a->frac -= 4096;
a->ticks ++;
}
a->ticks += b->ticks;
if(a->ticks >= 125000000)
{
a->ticks -= 125000000;
a->seconds++;
}
a->seconds += b->seconds;
}
static inline void ts_sub(struct wr_timestamp *a, const struct wr_timestamp *b)
{
a->frac -= b->frac;
if(a->frac < 0)
{
a->frac += 4096;
a->ticks --;
}
a->ticks -= b->ticks;
if(a->ticks < 0)
{
a->ticks += 125000000;
a->seconds--;
}
a->seconds -= b->seconds;
if(a->seconds == -1)
{
a->seconds = 0;
a->ticks -= 125000000;
}
}
#endif
/**
* Structure describing state of each TDC channel
......
/*
* copyright (C) 2018 CERN (www.cern.ch)
* author Federico Vaga <federico.vaga@cern.ch>
* author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*/
#define WRTD_IN_PORT 34700
#define WRTD_OUT_PORT 34701
struct wrtd_trigger_message {
uint32_t transmit_seconds;
uint32_t transmit_cycles;
int count;
struct wrtd_trigger_entry triggers[TDC_TRIGGER_COALESCE_LIMIT];
uint32_t pad; // stupid Etherbone for some reasons drops the last entry on TX
};
static inline void ts_add(struct wr_timestamp *a, const struct wr_timestamp *b)
{
a->frac += b->frac;
if(a->frac >= 4096)
{
a->frac -= 4096;
a->ticks ++;
}
a->ticks += b->ticks;
if(a->ticks >= 125000000)
{
a->ticks -= 125000000;
a->seconds++;
}
a->seconds += b->seconds;
}
static inline void ts_sub(struct wr_timestamp *a, const struct wr_timestamp *b)
{
a->frac -= b->frac;
if(a->frac < 0)
{
a->frac += 4096;
a->ticks --;
}
a->ticks -= b->ticks;
if(a->ticks < 0)
{
a->ticks += 125000000;
a->seconds--;
}
a->seconds -= b->seconds;
if(a->seconds == -1)
{
a->seconds = 0;
a->ticks -= 125000000;
}
}
-include Makefile.specific
OBJS := wrtd-rt-fd.o
OBJS += ../common/loop-queue.o
OBJS += common/wrtd-fw-common.o
OBJS += common/loop-queue.o
OBJDIR += common
OUTPUT = wrtd-rt-fd
TRTL ?= ../../../mock-turtle/
TRTL_SW = $(TRTL)/software
......
......@@ -18,10 +18,10 @@ CONFIG_CFLAGS_EXTRA="-ggdb"
#
# Mock Turtle framework configuration
#
# CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE is not set
CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_ACTION_ENABLE=y
# CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE is not set
# CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE is not set
CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_PING_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_VERSION_ENABLE=y
......
This diff is collapsed.
-include Makefile.specific
OBJS := wrtd-rt-tdc.o
OBJS += ../common/loop-queue.o
OBJS += common/wrtd-fw-common.o
OBJS += common/loop-queue.o
OBJDIR += common
OUTPUT = wrtd-rt-tdc
TRTL ?= ../../../mock-turtle/
TRTL_SW = $(TRTL)/software
......
......@@ -18,10 +18,10 @@ CONFIG_CFLAGS_EXTRA="-ggdb"
#
# Mock Turtle framework configuration
#
# CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE is not set
CONFIG_MOCKTURTLE_FRAMEWORK_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_ACTION_ENABLE=y
# CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE is not set
# CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE is not set
CONFIG_MOCKTURTLE_FRAMEWORK_VARIABLE_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_BUFFER_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_PING_ENABLE=y
CONFIG_MOCKTURTLE_FRAMEWORK_VERSION_ENABLE=y
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment