summaryrefslogtreecommitdiff
path: root/cp/beacon
diff options
context:
space:
mode:
authorlacour2007-12-20 07:47:47 +0000
committerlacour2007-12-20 07:47:47 +0000
commitd698cd45ccff4da277eee02871ed3323b5a7ae25 (patch)
tree5cec29b876c8387f1dfb58a3006d34ce0d29ba65 /cp/beacon
parent9a34994bd9c2b11abadb3038109b9fcf5a1d0481 (diff)
Add test of ntb_clock_sync
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1170 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cp/beacon')
-rw-r--r--cp/beacon/test/sync/Config1
-rw-r--r--cp/beacon/test/sync/Makefile14
-rw-r--r--cp/beacon/test/sync/hal/phy/Module1
-rw-r--r--cp/beacon/test/sync/hal/phy/phy.h37
-rw-r--r--cp/beacon/test/sync/hal/phy/src/phy.c42
-rw-r--r--cp/beacon/test/sync/src/test_sync.c42
6 files changed, 137 insertions, 0 deletions
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
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \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
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \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
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \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;
+}
+
+