summaryrefslogtreecommitdiff
path: root/ce
diff options
context:
space:
mode:
authorlacour2008-02-06 10:17:08 +0000
committerlacour2008-02-06 10:17:08 +0000
commit84177055b9f2a05603e20cc7a17548caa0e56232 (patch)
treefcda6f159859b5769960f09c8c8bb867ea660c59 /ce
parent8d7766e7101bc4ced432ce78de572e6ef5d4a9bf (diff)
Add ecos_overide to be able to compile for linux host.
Change TICK_ECOS to RTC. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1380 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'ce')
-rwxr-xr-xce/inc/cei.h4
-rwxr-xr-xce/inc/rx.h3
-rwxr-xr-xce/src/rx.c3
-rwxr-xr-xce/src/tx.c42
-rw-r--r--ce/test/common/ecos_overide/cyg/kernel/Module1
-rw-r--r--ce/test/common/ecos_overide/cyg/kernel/kapi.h25
-rw-r--r--ce/test/common/ecos_overide/cyg/kernel/src/kapi.c33
-rw-r--r--ce/test/common/ecos_time.h23
-rwxr-xr-xce/test/rx/general/Makefile8
-rw-r--r--ce/test/rx/general/Makefile_TARGET3
-rw-r--r--ce/test/rx/maximus/Makefile1
-rw-r--r--ce/test/rx/tonemap_refresh/Makefile1
-rw-r--r--ce/test/rx/tonemap_refresh/src/test_tonemaps_refresh.c5
-rwxr-xr-xce/test/tx/Makefile6
14 files changed, 143 insertions, 15 deletions
diff --git a/ce/inc/cei.h b/ce/inc/cei.h
index 6a66ca0d88..98a1634fb5 100755
--- a/ce/inc/cei.h
+++ b/ce/inc/cei.h
@@ -19,12 +19,13 @@
#include "mac/common/timings.h"
#include "ce/test/common/print_utils.h"
#include "lib/bitstream.h"
+#include "cyg/kernel/kapi.h"
+#include "ecos_time.h"
#define CM_CHAN_EST_IND 0x6014
#define CM_TM_UPDATE_IND 0x6018
//TODO Accelerate access in tonemap and tonemask management.
-//todo Manage endian.
BEGIN_DECLS
@@ -382,6 +383,7 @@ cei_decoding (tonemaps_t *tms, int mm_type, u8 *mm_entry, u8 *mask)
tms->intervals = intervals;
// ATOMIC set tonemap default;
tms->default_tmi = tmp_default_tmi;
+ tms->expiration_rtc_date = cyg_current_time() + S_TO_RTC (TONEMAPS_LIFE_DURATION_S);
return (tonemaps_valid_status);
}
#endif
diff --git a/ce/inc/rx.h b/ce/inc/rx.h
index 31efd67afd..64ef3e52d6 100755
--- a/ce/inc/rx.h
+++ b/ce/inc/rx.h
@@ -29,9 +29,6 @@
/** Priority of CEI message */
#define CEI_PRIORITY 2
-#define TICK_ECOS_HZ CYGNUM_HAL_RTC_DENOMINATOR
-#define S_TO_TICK_ECOS(s) (s*TICK_ECOS_HZ)
-#define US_TO_TICK_ECOS(us) ((us*TICK_ECOS_HZ)/1000)
// The MARGE can be optimized versus the stations number, and the knowledge of
// worst case where rxce can turned.
#define RXCE_TONEMAPS_REFRESH_MARGING_S 2
diff --git a/ce/src/rx.c b/ce/src/rx.c
index 92427d7b8d..0cf3eae9e9 100755
--- a/ce/src/rx.c
+++ b/ce/src/rx.c
@@ -25,6 +25,7 @@
#if CONFIG_TRACE
#include "mac/common/ntb.h"
#endif
+#include "ecos_time.h"
static rxce_t ce_global;
@@ -265,7 +266,7 @@ rxce_job_cei_add (rxce_t *ctx, tonemaps_t *tms, uint new_tmi, uint old_tmi, uint
cei_param.dtei = dtei;
b = cei_param_add (&cei_param);
if (b) cyg_semaphore_post (&(ctx->job));
- tms->expiration_rtc_date = cyg_current_time() + S_TO_TICK_ECOS (RXCE_TONEMAPS_REFRESH_PERIOD_S);
+ tms->expiration_rtc_date = cyg_current_time() + S_TO_RTC (RXCE_TONEMAPS_REFRESH_PERIOD_S);
}
void
diff --git a/ce/src/tx.c b/ce/src/tx.c
index 24ee314652..09a601cee9 100755
--- a/ce/src/tx.c
+++ b/ce/src/tx.c
@@ -17,10 +17,9 @@
#include "ce/inc/tx.h"
#define TXCE
#include "ce/inc/cei.h"
-
+#include "cyg/kernel/kapi.h"
txce_t ctx;
-tonemaps_t tms;
txce_t *
txce_init (mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx)
@@ -32,6 +31,43 @@ txce_init (mac_store_t *mac_store_ctx, mac_config_t *mac_config_ctx)
return (&ctx);
}
+cyg_tick_count_t
+txce_expiration_tonemaps_management (txce_t *ctx)
+{
+ uint tei;
+ cyg_tick_count_t lowest_expiration_date = 0xFFFFFFFFFFFFFFFFll;
+ for (tei=MAC_TEI_STA_MIN; tei<=MAC_TEI_STA_MAX; tei++)
+ {
+ cyg_tick_count_t current_rtc_date = cyg_current_time();
+ sta_t *lsta = mac_store_sta_get (ctx->mac_store_ctx, tei);
+ if (lsta)
+ {
+ tonemaps_t *tms = lsta->tx_tonemaps;
+ if (tms)
+ {
+ cyg_tick_count_t expiration_date = tms->expiration_rtc_date;
+ if (current_rtc_date >= expiration_date )
+ {
+ int tmi;
+ for (tmi = 0; tmi<TONEMAP_INDEX_NB; tmi++)
+ {
+ if (tms->tm[tmi]) tonemap_release (tms, tmi);
+ }
+ }
+ else
+ {
+ if (lowest_expiration_date > expiration_date)
+ {
+ lowest_expiration_date = expiration_date;
+ }
+ }
+ }
+ blk_release (lsta);
+ }
+ }
+ return lowest_expiration_date;
+}
+
void
txce_rcv_mme (uint stei, u32 mmtype, u8 *mm_entry)
{
@@ -43,6 +79,8 @@ txce_rcv_mme (uint stei, u32 mmtype, u8 *mm_entry)
tonemaps_t *source_tms = source_sta->tx_tonemaps;
cei_decoding (source_tms, mmtype, mm_entry, ctx.tonemask);
blk_release (source_sta);
+ txce_expiration_tonemaps_management (&ctx);
}
+
diff --git a/ce/test/common/ecos_overide/cyg/kernel/Module b/ce/test/common/ecos_overide/cyg/kernel/Module
new file mode 100644
index 0000000000..86ae567be7
--- /dev/null
+++ b/ce/test/common/ecos_overide/cyg/kernel/Module
@@ -0,0 +1 @@
+SOURCES := kapi.c
diff --git a/ce/test/common/ecos_overide/cyg/kernel/kapi.h b/ce/test/common/ecos_overide/cyg/kernel/kapi.h
new file mode 100644
index 0000000000..e9a1ee818c
--- /dev/null
+++ b/ce/test/common/ecos_overide/cyg/kernel/kapi.h
@@ -0,0 +1,25 @@
+#ifndef kapi_h
+#define kapi_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file kapi.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+#define CYGNUM_HAL_RTC_DENOMINATOR 100
+
+typedef u64 cyg_tick_count_t;
+
+cyg_tick_count_t
+cyg_current_time (void);
+
+#endif /* kapi_h */
diff --git a/ce/test/common/ecos_overide/cyg/kernel/src/kapi.c b/ce/test/common/ecos_overide/cyg/kernel/src/kapi.c
new file mode 100644
index 0000000000..0dc2bcd078
--- /dev/null
+++ b/ce/test/common/ecos_overide/cyg/kernel/src/kapi.c
@@ -0,0 +1,33 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/kapi.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "sys/time.h"
+#include "stdio.h"
+#include "string.h"
+#include "cyg/kernel/kapi.h"
+
+#define PERIOD_RTC_US (1000000/CYGNUM_HAL_RTC_DENOMINATOR)
+
+cyg_tick_count_t
+cyg_current_time (void)
+{
+ u64 ret;
+ struct timeval tv0;
+ gettimeofday (&tv0, NULL);
+ u64 date_us = (tv0.tv_sec*1000000 + tv0.tv_usec);
+ ret = date_us / PERIOD_RTC_US;
+ return ( ret);
+}
+
diff --git a/ce/test/common/ecos_time.h b/ce/test/common/ecos_time.h
new file mode 100644
index 0000000000..853099a067
--- /dev/null
+++ b/ce/test/common/ecos_time.h
@@ -0,0 +1,23 @@
+#ifndef macro_h
+#define macro_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file macro.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include <cyg/kernel/kapi.h>
+
+#define RTC_HZ CYGNUM_HAL_RTC_DENOMINATOR
+#define S_TO_RTC(s) (s*RTC_HZ)
+#define US_TO_RTC(us) ((us*RTC_HZ)/1000)
+
+#endif /* macro_h */
diff --git a/ce/test/rx/general/Makefile b/ce/test/rx/general/Makefile
index 85f63ce6f5..e86d0088d5 100755
--- a/ce/test/rx/general/Makefile
+++ b/ce/test/rx/general/Makefile
@@ -1,17 +1,19 @@
BASE = ../../../..
INCLUDES=ce/test/rx
+INCLUDES+=ce/test/common
+INCLUDES+=ce/test/common/ecos_overide
EXTRA_HOST_LDFLAGS=-lm
HOST_PROGRAMS = test_cei_host_linux_i386
test_cei_host_linux_i386_SOURCES = test_cei.c
-test_cei_host_linux_i386_MODULES = lib mac/common ce ce/test/common
+test_cei_host_linux_i386_MODULES = lib mac/common ce ce/test/common ce/test/common/ecos_overide/cyg/kernel
HOST_PROGRAMS += test_cei_param_host_linux_i386
test_cei_param_host_linux_i386_SOURCES = test_cei_param.c
-test_cei_param_host_linux_i386_MODULES = lib mac/common ce ce/test/common
+test_cei_param_host_linux_i386_MODULES = lib mac/common ce ce/test/common ce/test/common/ecos_overide/cyg/kernel
HOST_PROGRAMS += test_fm_host_linux_i386
test_fm_host_linux_i386_SOURCES = test_frame_measurement.c
-test_fm_host_linux_i386_MODULES = lib mac/common ce ce/test/common
+test_fm_host_linux_i386_MODULES = lib mac/common ce ce/test/common ce/test/common/ecos_overide/cyg/kernel
#HOST_PROGRAMS += test_speed_host_linux_i386
#test_speed_host_linux_i386_SOURCES = test_speed.c
diff --git a/ce/test/rx/general/Makefile_TARGET b/ce/test/rx/general/Makefile_TARGET
index 8a39e502d6..352dc1dccf 100644
--- a/ce/test/rx/general/Makefile_TARGET
+++ b/ce/test/rx/general/Makefile_TARGET
@@ -3,6 +3,7 @@ BASE = ../../../..
INCLUDES = ce/test/rx/
INCLUDES += ce/test/rx/general
INCLUDES += ce/test/rx/general/overide
+INCLUDES += ce/test/common
#COV = y
ECOS = y
@@ -17,7 +18,7 @@ mac_pbproc_MODULE_SOURCES = mfs.c
ce_MODULE_SOURCES = cei_param.c frame_measurement.c rx.c trace.c
-ce_test_common_MODULE_SOURCES = print_utils.c
+ce_test_common_MODULE_SOURCES = print_utils.c
include $(BASE)/common/make/top.mk
diff --git a/ce/test/rx/maximus/Makefile b/ce/test/rx/maximus/Makefile
index 2dbb841e8e..fa40702a27 100644
--- a/ce/test/rx/maximus/Makefile
+++ b/ce/test/rx/maximus/Makefile
@@ -2,6 +2,7 @@ BASE = ../../../..
INCLUDES = ce/test/rx/maximus/overide
INCLUDES += ce/test/rx/maximus
INCLUDES += ce/test/rx/general/overide
+INCLUDES += ce/test/common
ECOS = y
TARGET_PROGRAMS = test_rx
diff --git a/ce/test/rx/tonemap_refresh/Makefile b/ce/test/rx/tonemap_refresh/Makefile
index 6ea8eebc1e..fe6c7dd9d9 100644
--- a/ce/test/rx/tonemap_refresh/Makefile
+++ b/ce/test/rx/tonemap_refresh/Makefile
@@ -3,6 +3,7 @@ BASE = ../../../..
INCLUDES = ce/test/rx
INCLUDES += ce/test/rx/tonemap_refresh
INCLUDES += ce/test/rx/general/overide
+INCLUDES += ce/test/common
ECOS = y
diff --git a/ce/test/rx/tonemap_refresh/src/test_tonemaps_refresh.c b/ce/test/rx/tonemap_refresh/src/test_tonemaps_refresh.c
index b9bad825b5..06a5143246 100644
--- a/ce/test/rx/tonemap_refresh/src/test_tonemaps_refresh.c
+++ b/ce/test/rx/tonemap_refresh/src/test_tonemaps_refresh.c
@@ -18,6 +18,7 @@
#include "lib/test.h"
#include "ce/inc/rx.h"
#include "ce/test/common/print_utils.h"
+#include "ecos_time.h"
#define TEST_REFRESH_NUMBER 5000
#define CPU_LOAD_PRIORITY 10
@@ -52,7 +53,7 @@ test_expiration_cb (int dtei)
ce_print ("create cei for sta[%d] @%llu, previous @%llu, diff=%llu\n",dtei, current, date[dtei], current - date[dtei]);
test_begin (test, "Check date of cei creation\n")
{
- test_fail_if (current > date[dtei] + S_TO_TICK_ECOS (TONEMAPS_LIFE_DURATION_S));
+ test_fail_if (current > date[dtei] + S_TO_RTC (TONEMAPS_LIFE_DURATION_S));
} test_end;
blk_release (lsta);
date[dtei] = current;
@@ -102,7 +103,7 @@ cyg_user_start (int argc, char **argv)
lsta->rx_tonemaps = tms;
int random = lib_rnd_uniform (&rnd, 5000);
date[i] = cyg_current_time() + random;
- tms->expiration_rtc_date = date[i] + S_TO_TICK_ECOS(RXCE_TONEMAPS_REFRESH_PERIOD_S);
+ tms->expiration_rtc_date = date[i] + S_TO_RTC (RXCE_TONEMAPS_REFRESH_PERIOD_S);
blk_release (lsta);
}
}
diff --git a/ce/test/tx/Makefile b/ce/test/tx/Makefile
index b77fc5f888..a09826f782 100755
--- a/ce/test/tx/Makefile
+++ b/ce/test/tx/Makefile
@@ -1,10 +1,12 @@
BASE = ../../..
-INCLUDES=ce/test/tx
+INCLUDES = ce/test/tx
+INCLUDES+= ce/test/common
+INCLUDES+= ce/test/common/ecos_overide
HOST_PROGRAMS = test_tx
test_tx_SOURCES = test_tx.c
-test_tx_MODULES = lib mac/common ce ce/test/common
+test_tx_MODULES = lib mac/common ce ce/test/common ce/test/common/ecos_overide/cyg/kernel
ce_MODULE_SOURCES = tx.c rxce_stats.c
ce_test_common_MODULE_SOURCES = print_utils.c