summaryrefslogtreecommitdiff
path: root/ce/test/tx
diff options
context:
space:
mode:
authorlacour2007-10-31 15:51:56 +0000
committerlacour2007-10-31 15:51:56 +0000
commit439056c6cd73d1c133c9a57d77fbe30a9aedc889 (patch)
treedd48e5f67e374117001d9dcbf48abf1bcebb8eb4 /ce/test/tx
parent495500c121468b0bb24823be9928803f9f9ab660 (diff)
Add new CE module at root. (rxce process; txce function)
Delete cp/ce module. RIFS_AV timings. sta, tonemap, phy_chandata in pbdma structures modified for CE fonctionality. test_tonemap.c adapted. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@927 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'ce/test/tx')
-rwxr-xr-xce/test/tx/Makefile11
-rwxr-xr-xce/test/tx/ecos.ecc.sh5
-rwxr-xr-xce/test/tx/src/test_tx.c145
3 files changed, 161 insertions, 0 deletions
diff --git a/ce/test/tx/Makefile b/ce/test/tx/Makefile
new file mode 100755
index 0000000000..1dd8011712
--- /dev/null
+++ b/ce/test/tx/Makefile
@@ -0,0 +1,11 @@
+BASE = ../../..
+
+ECOS = y
+
+TARGET_PROGRAMS = test_tx
+test_tx_SOURCES = test_tx.c
+test_tx_MODULES = lib mac/common ce ce/test/common
+
+ce_MODULE_SOURCES = tx.c io_utils.c rxce_stats.c
+
+include $(BASE)/common/make/top.mk
diff --git a/ce/test/tx/ecos.ecc.sh b/ce/test/tx/ecos.ecc.sh
new file mode 100755
index 0000000000..8253d98c9a
--- /dev/null
+++ b/ce/test/tx/ecos.ecc.sh
@@ -0,0 +1,5 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new linux default
+cat >> $config <<EOF
+EOF
+ecosconfig --config=$config check
diff --git a/ce/test/tx/src/test_tx.c b/ce/test/tx/src/test_tx.c
new file mode 100755
index 0000000000..c622b6209f
--- /dev/null
+++ b/ce/test/tx/src/test_tx.c
@@ -0,0 +1,145 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file ./src/test_tx.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+#include "common/std.h"
+
+#include <stdio.h>
+#include "cyg/hal/hal_intr.h"
+#include "ce/test/common/print_utils.h"
+
+#include "mac/common/store.h"
+#include "ce/inc/tx.h"
+#include "mac/common/tonemask.h"
+#include "ce/inc/cei.h"
+#include "mac/common/timings.h"
+#include "lib/test.h"
+
+#define MME_BUFFER_SIZE 1536
+
+#define STEI 1
+
+
+void
+cyg_user_start (int argc, char **argv)
+{
+ int i;
+ test_t test;
+ mac_config_t mac_config;
+ test_init (test, argc, argv);
+ tonemask_default ((u8 *)(&(mac_config.tonemask_info.tonemask)));
+ //for (i=0; i< PHY_CARRIER_NB/8; i++) mac_config.tonemask_info.tonemask[i] = 0xFF;
+ u16 MAX_FL_FL = MAC_MAX_FL_MAX_FL;
+ u8 RESPT = 0;
+ u8 MAXTM = TONEMAP_INDEX_NB;
+ u8 CP_TMI_AV = 0x04;
+ u8 SCL = 0x0;
+ u8 TM_VALID_NB = 0x1;
+ u8 TMI_VALID0 = CP_TMI_AV;
+ u8 NINT = 0;
+ u8 NEW_TMI = CP_TMI_AV;
+ u8 CPF = 1;
+ u8 FEC = 0;
+ u8 GI = 0;
+ u8 rx_mm_entry[MME_BUFFER_SIZE]= {
+ MAX_FL_FL>>8, MAX_FL_FL&0xFF,
+ MAC_RIFS_AV_ONE_SYM_FL, MAC_RIFS_AV_TWO_SYM_FL, MAC_RIFS_AV_G2_SYM_FL,
+ RESPT, MAXTM,CP_TMI_AV, SCL, SCL,
+ TM_VALID_NB, TMI_VALID0,
+ NINT,
+ NEW_TMI,
+ CPF, FEC, GI,
+ 0x00 // CBD_ENC encodage
+ };
+ uint mask_len = tonemask_carrier_nb ((u8 * ) &(mac_config.tonemask_info.tonemask));
+ rx_mm_entry[18] = mask_len>>8;
+ rx_mm_entry[19] = mask_len & 0xFF;
+
+ u8 tonemap[PHY_CARRIER_NB];
+ for (i=0; i<PHY_CARRIER_NB; i++) tonemap[i] = (i%7)+1;
+ u8 cbd_byte = 0;
+ for (i = 0; i<PHY_CARRIER_NB; i++)
+ {
+ if ((i&0x01) == 0x00) cbd_byte = tonemap[i] & 0x07;
+ if ((i&0x01) == 0x01)
+ {
+ cbd_byte = ((tonemap[i]&0x07)<<4)+cbd_byte;
+ //my_print("0x%x\n",cbd_byte);
+ rx_mm_entry[20+(i>>1)] = cbd_byte;
+ }
+ }
+ if ((i&0x01) == 0x01)
+ {
+ rx_mm_entry[20+(i>>1)] = cbd_byte;
+ }
+ //print_buffer (rx_mm_entry, MME_BUFFER_SIZE);
+
+ mac_store_t *mac_store_ctx = mac_store_init();
+ mac_store_sta_add (mac_store_ctx, STEI);
+ sta_t *sta = mac_store_sta_get (mac_store_ctx, STEI);
+ txce_init (mac_store_ctx, &mac_config);
+ txce_rcv_mme (STEI, CM_CHAN_EST_IND, rx_mm_entry);
+ //print_tonemaps (sta->tx_tonemaps);
+ test_case_begin (test, "CE-create tonemap from cei received");
+ test_begin (test, "No encodage")
+ {
+ test_fail_if (sta->tx_tonemaps->max_fl_av != MAX_FL_FL);
+ test_fail_if (sta->tx_tonemaps->rifs_av_one_sym_tck != MAC_RIFS_AV_ONE_SYM_TCK);
+ test_fail_if (sta->tx_tonemaps->rifs_av_two_sym_tck != MAC_RIFS_AV_TWO_SYM_TCK);
+ test_fail_if (sta->tx_tonemaps->rifs_av_g2_sym_tck != MAC_RIFS_AV_G2_SYM_TCK);
+ test_fail_if (sta->tx_tonemaps->max_tm != MAXTM);
+ test_fail_if (sta->tx_tonemaps->cp_tmi_av != CP_TMI_AV);
+ test_fail_if (sta->tx_tonemaps->scl_cp != SCL);
+ test_fail_if (sta->tx_tonemaps->scl_cfp != SCL);
+ int nint = tonemap_valid_nb (sta->tx_tonemaps);
+ test_fail_if (nint != TM_VALID_NB);
+ u8 *mask = (mac_config.tonemask_info.tonemask);
+ u8 tmp[PHY_CARRIER_NB];
+ for (i=0; i<PHY_CARRIER_NB; i++)
+ {
+ uint n1 = read_in_blk (sta->tx_tonemaps->tm[CP_TMI_AV-4]->tmdma_desc_head, i/2);
+ uint n2 = n1>>4;
+ n1 = n1&0xF;
+ tmp[i++]= n1;
+ tmp[i] = n2;
+ }
+ uint z=0;
+ for (i=0; i<PHY_CARRIER_NB; i++)
+ {
+ if ((mask[i/8] & (1<<(i%8))) == 0)
+ {
+ //my_print ("c%d : masked\n",i);
+ test_fail_if (tmp[i] != 0 && tmp[i]<0x08);
+ }
+ else
+ {
+ //my_print ("c%d : tmp[%d]=%d; previous=%d\n",i,i,tmp[i],z);
+ test_fail_if (tmp[i]!= (z+1));
+ z = tmp[i];
+ if (z==7) z=0;
+ }
+ }
+ test_fail_if (sta->tx_tonemaps->intervals->intervals_nb != NINT);
+ } test_end;
+ blk_release (sta);
+ sta_uninit (sta);
+ mac_store_sta_remove (mac_store_ctx, STEI);
+ test_begin (test, "check alloc/free")
+ {
+ test_fail_unless (blk_check_memory());
+ } test_end;
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+}
+