Commit 594beec6 authored by Alessandro Rubini's avatar Alessandro Rubini

whiterabbit: arch-wrs and arch-wrpc can't be build without WR support

This was a trial of mine, but it really has never been working (at least
on wrs -- I think nobody ever tried a non-wr code base on wrpc).

Too much of the timetamping, servo, pll, is dependent on WR being
available, this academic idea doesn't make much sense, so let's remove
a number of conditionals (and associated potential bugs).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent b8ebe5fe
......@@ -68,23 +68,14 @@ config ARCH
default "sim" if ARCH_SIMULATOR
choice EXTENSION
prompt "Protocol Extension"
# This is not a choice any more: it is mandated by the architecture
config EXT_WR
bool "White Rabbit" if ARCH_WRS || ARCH_WRPC
help
Build WR-PTP (which is able to works as a standard PTP agent,
when the peer is not WR-aware).
bool
default y if ARCH_WRS || ARCH_WRPC
config EXT_NONE
bool "None"
default y
help
Select not protocol extension (build standard PTP-V2 daemon).
endchoice
bool
default !EXT_WR
config EXTENSION
string
......
......@@ -19,8 +19,9 @@ OBJ-y += $A/wrs-startup.o \
lib/drop.o \
lib/div64.o
# The user can set TIME=, but wrs is default
TIME ?= wrs
# These two are mandatory for arch-wrs
TIME = wrs
PROTO_EXT = whiterabbit
include time-$(TIME)/Makefile
......
......@@ -4,12 +4,6 @@
*
* Released to the public domain
*/
#ifdef CONFIG_EXT_WR
# define BUILT_WITH_WHITERABBIT 1
#else
# define BUILT_WITH_WHITERABBIT 0
#endif
/*
* These are the functions provided by the various wrs files
......
......@@ -56,8 +56,7 @@ static int run_all_state_machines(struct pp_globals *ppg)
ppi->n_ops->exit(ppi);
ppi->frgn_rec_num = 0;
ppi->frgn_rec_best = -1;
if (BUILT_WITH_WHITERABBIT
&& ppg->ebest_idx == ppi->port_idx)
if (ppg->ebest_idx == ppi->port_idx)
wr_servo_reset();
}
}
......
......@@ -28,13 +28,11 @@ static struct minipc_pd __rpcdef_cmd = {
/* Execute command coming ipc */
static int wrsipc_cmd(int cmd, int value)
{
if (BUILT_WITH_WHITERABBIT) {
if(cmd == PTPDEXP_COMMAND_TRACKING)
wr_servo_enable_tracking(value);
if(cmd == PTPDEXP_COMMAND_TRACKING)
wr_servo_enable_tracking(value);
if(cmd == PTPDEXP_COMMAND_MAN_ADJUST_PHASE)
wr_servo_man_adjust_phase(value);
}
if(cmd == PTPDEXP_COMMAND_MAN_ADJUST_PHASE)
wr_servo_man_adjust_phase(value);
return 0;
}
......
......@@ -26,11 +26,7 @@
#include <ppsi-wrs.h>
#include <libwr/shmem.h>
#if BUILT_WITH_WHITERABBIT
# define WRSW_HAL_RETRIES 1000
#else
# define WRSW_HAL_RETRIES 0
#endif
#define WRSW_HAL_TIMEOUT 2000000 /* us */
......@@ -100,55 +96,53 @@ int main(int argc, char **argv)
usleep(WRSW_HAL_TIMEOUT);
}
if (BUILT_WITH_WHITERABBIT && !hal_ch) {
if (!hal_ch) {
pp_printf("ppsi: could not connect to HAL RPC");
exit(1);
}
if (BUILT_WITH_WHITERABBIT) {
/* If we connected, we also know "for sure" shmem is there */
hal_head = wrs_shm_get(wrs_shm_hal,"", WRS_SHM_READ);
if (!hal_head || !hal_head->data_off) {
pp_printf("ppsi: Can't connect with HAL "
"shared memory\n");
exit(1);
}
if (hal_head->version != HAL_SHMEM_VERSION) {
pp_printf("ppsi: unknown HAL's shm version %i "
"(known is %i)\n", hal_head->version,
HAL_SHMEM_VERSION);
exit(1);
}
/* If we connected, we also know "for sure" shmem is there */
hal_head = wrs_shm_get(wrs_shm_hal,"", WRS_SHM_READ);
if (!hal_head || !hal_head->data_off) {
pp_printf("ppsi: Can't connect with HAL "
"shared memory\n");
exit(1);
}
if (hal_head->version != HAL_SHMEM_VERSION) {
pp_printf("ppsi: unknown HAL's shm version %i "
"(known is %i)\n", hal_head->version,
HAL_SHMEM_VERSION);
exit(1);
}
h = (void *)hal_head + hal_head->data_off;
hal_nports = h->nports;
h = (void *)hal_head + hal_head->data_off;
hal_nports = h->nports;
hal_ports = wrs_shm_follow(hal_head, h->ports);
hal_ports = wrs_shm_follow(hal_head, h->ports);
if (!hal_ports) {
pp_printf("ppsi: unable to follow hal_ports pointer "
"in HAL's shmem\n");
exit(1);
}
if (!hal_ports) {
pp_printf("ppsi: unable to follow hal_ports pointer "
"in HAL's shmem\n");
exit(1);
}
/* And create your own channel, until we move to shmem too */
ppsi_ch = minipc_server_create("ptpd", 0);
if (!ppsi_ch) { /* FIXME should we retry ? */
pp_printf("ppsi: could not create minipc server");
exit(1);
}
wrs_init_ipcserver(ppsi_ch);
/* And create your own channel, until we move to shmem too */
ppsi_ch = minipc_server_create("ptpd", 0);
if (!ppsi_ch) { /* FIXME should we retry ? */
pp_printf("ppsi: could not create minipc server");
exit(1);
}
wrs_init_ipcserver(ppsi_ch);
ppsi_head = wrs_shm_get(wrs_shm_ptp, "ppsi",
WRS_SHM_WRITE | WRS_SHM_LOCKED);
if (!ppsi_head) {
fprintf(stderr, "Fatal: could not create shmem: %s\n",
strerror(errno));
exit(1);
}
alloc_fn = wrs_shm_alloc;
ppsi_head->version = WRS_PPSI_SHMEM_VERSION;
ppsi_head = wrs_shm_get(wrs_shm_ptp, "ppsi",
WRS_SHM_WRITE | WRS_SHM_LOCKED);
if (!ppsi_head) {
fprintf(stderr, "Fatal: could not create shmem: %s\n",
strerror(errno));
exit(1);
}
alloc_fn = wrs_shm_alloc;
ppsi_head->version = WRS_PPSI_SHMEM_VERSION;
ppg = alloc_fn(ppsi_head, sizeof(*ppg));
ppg->defaultDS = alloc_fn(ppsi_head, sizeof(*ppg->defaultDS));
......@@ -243,8 +237,7 @@ int main(int argc, char **argv)
ppsi_drop_init(ppg, seed);
/* release lock from wrs_shm_get */
if (BUILT_WITH_WHITERABBIT)
wrs_shm_write(ppsi_head, WRS_SHM_WRITE_END);
wrs_shm_write(ppsi_head, WRS_SHM_WRITE_END);
wrs_main_loop(ppg);
return 0; /* never reached */
......
#
# Automatically generated make config: don't edit
#
# CONFIG_ARCH_UNIX is not set
# CONFIG_ARCH_BARE_I386 is not set
# CONFIG_ARCH_BARE_X86_64 is not set
CONFIG_ARCH_WRPC=y
# CONFIG_ARCH_WRS is not set
CONFIG_ARCH="wrpc"
# CONFIG_EXT_WR is not set
CONFIG_EXT_NONE=y
CONFIG_EXTENSION=""
CONFIG_CROSS_COMPILE="/opt/gcc-lm32/bin/lm32-elf-"
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
#
# Automatically generated make config: don't edit
#
# CONFIG_ARCH_UNIX is not set
# CONFIG_ARCH_BARE_I386 is not set
# CONFIG_ARCH_BARE_X86_64 is not set
# CONFIG_ARCH_WRPC is not set
CONFIG_ARCH_WRS=y
CONFIG_ARCH="wrs"
# CONFIG_EXT_WR is not set
CONFIG_EXT_NONE=y
CONFIG_EXTENSION=""
CONFIG_CROSS_COMPILE="/opt/arm-wrswitch/bin/arm-linux-"
CONFIG_ARCH_CFLAGS=""
CONFIG_ARCH_LDFLAGS=""
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