From d698cd45ccff4da277eee02871ed3323b5a7ae25 Mon Sep 17 00:00:00 2001 From: lacour Date: Thu, 20 Dec 2007 07:47:47 +0000 Subject: Add test of ntb_clock_sync git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1170 017c9cb6-072f-447c-8318-d5b54f68fe89 --- cp/beacon/test/sync/Config | 1 + cp/beacon/test/sync/Makefile | 14 ++++++++++++ cp/beacon/test/sync/hal/phy/Module | 1 + cp/beacon/test/sync/hal/phy/phy.h | 37 ++++++++++++++++++++++++++++++ cp/beacon/test/sync/hal/phy/src/phy.c | 42 +++++++++++++++++++++++++++++++++++ cp/beacon/test/sync/src/test_sync.c | 42 +++++++++++++++++++++++++++++++++++ 6 files changed, 137 insertions(+) create mode 100644 cp/beacon/test/sync/Config create mode 100644 cp/beacon/test/sync/Makefile create mode 100644 cp/beacon/test/sync/hal/phy/Module create mode 100644 cp/beacon/test/sync/hal/phy/phy.h create mode 100644 cp/beacon/test/sync/hal/phy/src/phy.c create mode 100644 cp/beacon/test/sync/src/test_sync.c (limited to 'cp/beacon/test') diff --git a/cp/beacon/test/sync/Config b/cp/beacon/test/sync/Config new file mode 100644 index 0000000000..9c23c2ca94 --- /dev/null +++ b/cp/beacon/test/sync/Config @@ -0,0 +1 @@ +#CONFIG_DEBUG=y diff --git a/cp/beacon/test/sync/Makefile b/cp/beacon/test/sync/Makefile new file mode 100644 index 0000000000..789b6be456 --- /dev/null +++ b/cp/beacon/test/sync/Makefile @@ -0,0 +1,14 @@ +BASE = ../../../.. + +INCLUDES=cp/beacon/test/sync + +EXTRA_HOST_LDFLAGS=-lm +HOST_PROGRAMS = test_sync +test_sync_SOURCES = test_sync.c +test_sync_MODULES = cp/beacon/test/sync/hal/phy lib + + +beacon_MODULE_SOURCES = ntb_clock_sync.c + +include $(BASE)/common/make/top.mk + diff --git a/cp/beacon/test/sync/hal/phy/Module b/cp/beacon/test/sync/hal/phy/Module new file mode 100644 index 0000000000..d7a6adc888 --- /dev/null +++ b/cp/beacon/test/sync/hal/phy/Module @@ -0,0 +1 @@ +SOURCES = phy.c diff --git a/cp/beacon/test/sync/hal/phy/phy.h b/cp/beacon/test/sync/hal/phy/phy.h new file mode 100644 index 0000000000..818b52f306 --- /dev/null +++ b/cp/beacon/test/sync/hal/phy/phy.h @@ -0,0 +1,37 @@ +#ifndef phy_h +#define phy_h +/* Cesar project {{{ + * + * Copyright (C) 2007 Spidcom + * + * <<>> + * + * }}} */ +/** + * \file phy.h + * \brief « brief description » + * \ingroup « module » + * + * « long description » + */ + +struct phy_t +{ + uint numerator; + double rho; +}; +typedef struct phy_t phy_t; + + +phy_t * +phy_init(void); + +void +phy_set_clock_numerator (phy_t *ctx, uint numerator); + +void +phy_set_freqerror (phy_t *ctx, double rho); + + + +#endif /* phy_h */ diff --git a/cp/beacon/test/sync/hal/phy/src/phy.c b/cp/beacon/test/sync/hal/phy/src/phy.c new file mode 100644 index 0000000000..fabd52b3ef --- /dev/null +++ b/cp/beacon/test/sync/hal/phy/src/phy.c @@ -0,0 +1,42 @@ +/* Cesar project {{{ + * + * Copyright (C) 2007 Spidcom + * + * <<>> + * + * }}} */ +/** + * \file hal/phy/src/phy.c + * \brief « brief description » + * \ingroup « module » + * + * « long description » + */ +#include "common/std.h" +#include "hal/phy/phy.h" + +phy_t phy_global; + +phy_t * +phy_init (void) +{ + phy_t *ctx = &phy_global; + phy_set_clock_numerator(ctx, 1000000); + phy_set_freqerror (ctx, 0); + return ctx; +} + + +void +phy_set_clock_numerator (phy_t *ctx, uint numerator) +{ + ctx->numerator = numerator; +} + +void +phy_set_freqerror (phy_t *ctx, double rho) +{ + ctx->rho = rho; +} + + diff --git a/cp/beacon/test/sync/src/test_sync.c b/cp/beacon/test/sync/src/test_sync.c new file mode 100644 index 0000000000..feeabaef71 --- /dev/null +++ b/cp/beacon/test/sync/src/test_sync.c @@ -0,0 +1,42 @@ +/* Cesar project {{{ + * + * Copyright (C) 2007 Spidcom + * + * <<>> + * + * }}} */ +/** + * \file ./src/test_sync.c + * \brief « brief description » + * \ingroup « module » + * + * « long description » + */ +#include "common/std.h" +#include "lib/test.h" +#include "hal/phy/phy.h" + +//#include "cp/beacon/inc/ntb_sync.h" + +int +main (int argc, char **argv) +{ + test_t test; + test_init (test, argc, argv); + test_case_begin (test, "CALCUL DE SYNCHRO NTB TEST"); + phy_t *phy_ctx = phy_init (); + test_begin (test, "phy_init") + { + test_fail_if (phy_ctx->numerator != 1000000); + test_fail_if (phy_ctx->rho != 0); + } test_end; + + //ntb_clock_sync (3000000, 3000000, 3000000); + + + test_result (test); + return (test_nb_failed (test) == 0 ? 0 : 1); + return 0; +} + + -- cgit v1.2.3