From bd38af98eab8d9cee50e18e242cdf0ed9df57fcb Mon Sep 17 00:00:00 2001 From: lacour Date: Tue, 5 Feb 2008 09:27:37 +0000 Subject: Move test/maximus into test/rx/maximus. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1363 017c9cb6-072f-447c-8318-d5b54f68fe89 --- ce/test/maximus/Makefile | 15 -- ce/test/maximus/config_test.h | 19 -- ce/test/maximus/ecos.ecc.sh | 104 --------- ce/test/maximus/overide/mac/pbproc/Module | 1 - ce/test/maximus/overide/mac/pbproc/pbproc.h | 140 ------------ ce/test/maximus/overide/mac/pbproc/src/pbproc.c | 247 --------------------- ce/test/maximus/send_noise.py | 92 -------- ce/test/maximus/src/test_rx.c | 188 ---------------- ce/test/maximus/test.h | 18 -- ce/test/rx/maximus/Makefile | 15 ++ ce/test/rx/maximus/config_test.h | 19 ++ ce/test/rx/maximus/ecos.ecc.sh | 104 +++++++++ ce/test/rx/maximus/overide/mac/pbproc/Module | 1 + ce/test/rx/maximus/overide/mac/pbproc/pbproc.h | 140 ++++++++++++ ce/test/rx/maximus/overide/mac/pbproc/src/pbproc.c | 247 +++++++++++++++++++++ ce/test/rx/maximus/send_noise.py | 92 ++++++++ ce/test/rx/maximus/src/test_rx.c | 188 ++++++++++++++++ ce/test/rx/maximus/test.h | 18 ++ 18 files changed, 824 insertions(+), 824 deletions(-) delete mode 100644 ce/test/maximus/Makefile delete mode 100644 ce/test/maximus/config_test.h delete mode 100644 ce/test/maximus/ecos.ecc.sh delete mode 100644 ce/test/maximus/overide/mac/pbproc/Module delete mode 100644 ce/test/maximus/overide/mac/pbproc/pbproc.h delete mode 100644 ce/test/maximus/overide/mac/pbproc/src/pbproc.c delete mode 100644 ce/test/maximus/send_noise.py delete mode 100644 ce/test/maximus/src/test_rx.c delete mode 100644 ce/test/maximus/test.h create mode 100644 ce/test/rx/maximus/Makefile create mode 100644 ce/test/rx/maximus/config_test.h create mode 100644 ce/test/rx/maximus/ecos.ecc.sh create mode 100644 ce/test/rx/maximus/overide/mac/pbproc/Module create mode 100644 ce/test/rx/maximus/overide/mac/pbproc/pbproc.h create mode 100644 ce/test/rx/maximus/overide/mac/pbproc/src/pbproc.c create mode 100644 ce/test/rx/maximus/send_noise.py create mode 100644 ce/test/rx/maximus/src/test_rx.c create mode 100644 ce/test/rx/maximus/test.h (limited to 'ce/test') diff --git a/ce/test/maximus/Makefile b/ce/test/maximus/Makefile deleted file mode 100644 index be3965d2b1..0000000000 --- a/ce/test/maximus/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -BASE = ../../.. -INCLUDES = ce/test/maximus/overide -INCLUDES += ce/test/maximus -INCLUDES += ce/test/rx/general/overide -ECOS = y - -TARGET_PROGRAMS = test_rx -test_rx_SOURCES = test_rx.c -#test_rx_MODULES=lib host mac/common hal/phy/maximus mac/sar ce mac/pbproc ce/test/rx/overide/cp/interf ce/test/common -test_rx_MODULES=lib host mac/common hal/phy/maximus mac/sar ce ce/test/maximus/overide/mac/pbproc ce/test/rx/general/overide/cp/interf ce/test/common - -ce_MODULE_SOURCES = cei_param.c frame_measurement.c rx.c trace.c - -include $(BASE)/common/make/top.mk - diff --git a/ce/test/maximus/config_test.h b/ce/test/maximus/config_test.h deleted file mode 100644 index 5d4bd8a7e4..0000000000 --- a/ce/test/maximus/config_test.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __config_test_h -#define __config_test_h -/* Cesar project {{{ - * - * Copyright (C) 2007 Spidcom - * - * <<>> - * - * }}} */ -/** - * \file ./config_test.h - * \brief « brief description » - * \ingroup « module » - * - * « long description » - */ -#define MAXIMUS_TEST -//#define CE_DBG -#endif /* __config_test_h */ diff --git a/ce/test/maximus/ecos.ecc.sh b/ce/test/maximus/ecos.ecc.sh deleted file mode 100644 index 19597e4621..0000000000 --- a/ce/test/maximus/ecos.ecc.sh +++ /dev/null @@ -1,104 +0,0 @@ -config=${1:-ecos-gen.ecc} -ecosconfig --config=$config new maximus default -cat >> $config <<'EOF' -cdl_option CYGPKG_HAL_MAXIMUS_CFLAGS_ADD { - user_value "-I\$(BASE) -I\$(OBJ_DIR)/inc" - # value_source user - # Default value: "-I\$(REPOSITORY)/../.." -} -cdl_option CYGBLD_GLOBAL_CFLAGS { - user_value "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority -finline" - # value_source user - # Default value: "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" -} -cdl_option CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT { - user_value 0 - inferred_value 0 -} -cdl_option CYGBLD_ISO_CTYPE_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_ERRNO_CODES_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_ERRNO_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STDIO_FILETYPES_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STDIO_STREAMS_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STDIO_FILEOPS_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STDIO_FILEACCESS_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STDIO_FORMATTED_IO_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STDIO_CHAR_IO_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STDIO_DIRECT_IO_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STDIO_FILEPOS_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STDIO_ERROR_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STDLIB_STRCONV_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STDLIB_ABS_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STDLIB_DIV_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STRERROR_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STRTOK_R_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_C_TIME_TYPES_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_C_CLOCK_FUNCS_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_SIGNAL_NUMBERS_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_SIGNAL_IMPL_HEADER { - inferred_value 1 -} -cdl_option CYGBLD_ISO_SETJMP_HEADER { - inferred_value 1 -} -cdl_option CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE { - user_value 16384 - inferred_value 16384 -} -cdl_option CYGSEM_ERROR_PER_THREAD_ERRNO { - user_value 0 -} -EOF -ecosconfig --config=$config check diff --git a/ce/test/maximus/overide/mac/pbproc/Module b/ce/test/maximus/overide/mac/pbproc/Module deleted file mode 100644 index e9f0167e68..0000000000 --- a/ce/test/maximus/overide/mac/pbproc/Module +++ /dev/null @@ -1 +0,0 @@ -SOURCES := pbproc.c diff --git a/ce/test/maximus/overide/mac/pbproc/pbproc.h b/ce/test/maximus/overide/mac/pbproc/pbproc.h deleted file mode 100644 index f8d1b976b4..0000000000 --- a/ce/test/maximus/overide/mac/pbproc/pbproc.h +++ /dev/null @@ -1,140 +0,0 @@ -#ifndef overide_pbproc_h -#define overide_pbproc_h -/* Cesar project {{{ - * - * Copyright (C) 2007 Spidcom - * - * <<>> - * - * }}} */ -/** - * \file overide/pbproc.h - * \brief « brief description » - * \ingroup « module » - * - * « long description » - */ -#include "host/station.h" -#include "hal/phy/maximus/inc/maximus_phy_ctx.h" // 'phy_t' -#include "mac/common/mfs.h" -#include "mac/common/pb.h" -#include "mac/ca/ca.h" - - -struct pbproc_rx_params_t -{ - /** Preamble start NTB. */ - u32 preamble_ntb; - /** TEI of the transmitter. */ - u8 tei; - /** Link ID of this MPDU. */ - u8 lid; - /** Short network identifier. */ - uint snid:4; - /** Whether this is a multicast frame. */ - bool bcast:1; - /** Multi-network broadcast flag. */ - bool multi_net_bcast:1; - /** Network encryption key select. */ - uint eks:4; - /** Pending PB. */ - uint pending_seg_nb:8; - /** Bit loading estimate. */ - uint ble:8; - /** Tone map index. */ - uint tmi_av:5; - /** Beacon detect flag. */ - bool bdf:1; - /** Homeplug 1.0.1 detect flag. */ - bool hp10df:1; - /** Homeplug 1.1 detect flag. */ - bool hp11df:1; -}; -typedef struct pbproc_rx_params_t pbproc_rx_params_t; - -typedef void (*pbproc_rx_cb_t) (void *user, mfs_t *mfs, mfs_t *mfs_mme, - const pbproc_rx_params_t *rx_params, - pb_t *pb_first, pb_t *pb_last, - uint pb_nb, pb_t *chandata_first); - -struct pbproc_t -{ - pbproc_rx_cb_t rx_cb; - mac_config_t *config; -}; -typedef struct pbproc_t pbproc_t; - -struct pbproc_rx_beacon_params_t -{ - /** Preamble start NTB. */ - u32 preamble_ntb; - /** Beacon Time Stamp. */ - u32 bts; - /** Beacon Transmission Offset. */ - u16 bto[4]; - /** Short network identifier. */ - u8 snid; -}; -typedef struct pbproc_rx_beacon_params_t pbproc_rx_beacon_params_t; - -typedef void (*pbproc_rx_beacon_cb_t) (void *user, pb_beacon_t *pb, - pbproc_rx_beacon_params_t *params); - - -BEGIN_DECLS - -bool phy_rx_fc_cb (void *user, u32 rx_date, const u32 *fc_av); - -bool phy_access_cb (void *user); - -bool phy_access_conf_cb (void *user); - -bool phy_pbdma_cb (void *user, u32 status_word); - -void phy_deferred_cb (void *user); - -bool phy_extra_timer_cb (void *user); - -int set_tonemask (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data); - -int prepare_rx (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data); - -pbproc_t * -pbproc_init (mac_config_t *config, mac_store_t *store); - -void -pbproc_init_cb (pbproc_t *ctx, void *user_data, pbproc_rx_cb_t rx_cb, pbproc_rx_beacon_cb_t rx_beacon_cb); - -void -pbproc_uninit (pbproc_t *ctx); - -void -pbproc_rx_segment_refill (pbproc_t *ctx, pb_t *first, pb_t *last, - uint nb); - -pb_t * -pbproc_mfs_extract_tail (mfs_tx_t *mfs); - -void -pbproc_mfs_insert (mfs_tx_t *mfs, pb_t *first, pb_t *last, uint nb, uint cap); - -void -pbproc_mfs_provide (mfs_tx_t *mfs, uint nb); - -/** set SCF in pbproc ctx */ -void -pbproc_scf (void); - -void -pbproc_set_config (mac_config_t *config); - - -bool -ca_mfs_remove (ca_t *ctx, mfs_tx_t *mfs); - -void -ca_mfs_update (ca_t *ctx, mfs_tx_t *mfs); - -END_DECLS - -#endif /* overide_pbproc_h */ diff --git a/ce/test/maximus/overide/mac/pbproc/src/pbproc.c b/ce/test/maximus/overide/mac/pbproc/src/pbproc.c deleted file mode 100644 index f4f1654de2..0000000000 --- a/ce/test/maximus/overide/mac/pbproc/src/pbproc.c +++ /dev/null @@ -1,247 +0,0 @@ -/* Cesar project {{{ - * - * Copyright (C) 2007 Spidcom - * - * <<>> - * - * }}} */ -/** - * \file ./overide/src/pbproc.c - * \brief « brief description » - * \ingroup « module » - * - * « long description » - */ -#include -#include "common/std.h" -#include "mac/pbproc/pbproc.h" -#include "mac/common/tonemask.h" -#include "hal/phy/maximus/dur/inc/maximus_dur.h" -#include "ce/test/common/print_utils.h" -#include "mac/common/ntb.h" - -phy_t * phy_ctx; -int user_data = 123; -bool short_ppdu = false; -unsigned short mod = 0; -unsigned short fecrate = 0; -unsigned short pb_size = 0; -unsigned short gil = 0; -//u8 tonemask[(PHY_CARRIER_NB+7)/8]; - -static pbproc_t pbproc_global; -phy_chandata_t *rx_chandata_first; -phy_pb_t *rx_pb_first; -phy_pb_t *rx_pb_last; -uint rx_pb_nb; -pbproc_rx_params_t rx_params; -void *sar_ctx; -uint rx_symbol_nb; - -bool phy_rx_fc_cb (void *user, u32 rx_date, const u32 *fc_av) -{ - // When the FC is received, prepare RX - rx_symbol_nb = maximus_dur_symbol_nb ((phy_fecrate_t) fecrate, - (phy_pb_size_t) pb_size, - maximus_dur_bits_per_symbol ( (phy_mod_t) mod, - pbproc_global.config->tonemask_info.tonemask, - NULL, - maximus_dur_carrier_nb (pbproc_global.config->tonemask_info.tonemask) - ), - rx_pb_nb - ); - - - ce_print ("phy_rx_fc_cb ******* symbol NB = %d\n",rx_symbol_nb); - phy_rx_prepare(phy_ctx, short_ppdu, (phy_mod_t)mod, - (phy_fecrate_t)fecrate, (phy_pb_size_t)pb_size, (phy_gil_t)gil, - 0 /* tonemap_index */, rx_symbol_nb); - - return true; -} - -bool phy_access_cb (void *user) -{ - return true; -} - -bool phy_access_conf_cb (void *user) -{ - return true; -} - -bool phy_pbdma_cb (void *user, u32 status_word) -{ - ce_print ("phy_pbdma_cb ******* PB NB = %d\n",rx_pb_nb); - phy_pbdma_status_t status = *(phy_pbdma_status_t *)&status_word; - rx_params.tei = 1; - rx_params.lid = 0; - if (1 == status.end_chandata) - { - pbproc_global.rx_cb (sar_ctx, NULL, NULL, &rx_params, (pb_t *) rx_pb_first,(pb_t *) rx_pb_last, rx_pb_nb,(pb_t *) rx_chandata_first); - } - return true; -} - -void phy_deferred_cb (void *user) -{ - return; -} - -bool phy_extra_timer_cb (void *user) -{ - return true; -} - -int prepare_rx (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data) -{ - unsigned short fc_mode = 0; - unsigned short pb_nb = 0; - int i = 0; - u32 iv[3]; - u32 nek[4]; - - phy_pb_t *pb_last; - phy_pb_t *pb_first; - - ce_print("=> prepare_rx\n"); - - /* get parameters content */ - fcall_param_bind_short(*param, *msg, "fc_mode", &fc_mode); - fcall_param_bind(*param, *msg, "short_ppdu", sizeof(bool), &short_ppdu); - fcall_param_bind_short(*param, *msg, "mod", &mod); - fcall_param_bind_short(*param, *msg, "fecrate", &fecrate); - fcall_param_bind_short(*param, *msg, "pb_size", &pb_size); - fcall_param_bind_short(*param, *msg, "gil", &gil); - fcall_param_bind_short(*param, *msg, "pb_nb", &pb_nb); - - dbg_assert (pb_nb); - pb_first = (phy_pb_t *) blk_alloc_desc_range (pb_nb, (blk_t **) &pb_last); - pb_last->blk.next = NULL; - - // Activate RX - phy_rx_activate(phy_ctx, true /* now */, my_station.current_tick_tck, true /* pre_detection */); - - // Set RX parameters - phy_rx_param(phy_ctx, (phy_fc_mode_t)fc_mode); - - for (i=0; i<3; i++) - { - iv[i] = i; - } - for (i=0; i<4; i++) - { - nek[i] = i; - } - phy_pbdma_start(phy_ctx, true /* bypass_aes */, iv, - nek, (uint)pb_nb /* nb_total */, (uint)pb_nb /* nb_ready */, - (uint)pb_nb /* nb_pb_it */, pb_first); - - phy_chandata_t *time_noise = (phy_chandata_t *) blk_alloc_desc(); - time_noise->blk.next = NULL; - time_noise->last=0; - time_noise->type = PHY_CHANDATA_TYPE_NRJ_SYMBOL; - time_noise->size = (pb_nb * sizeof(phy_noise_t)+ 3)/4; - - phy_chandata_t *last_chan; - phy_chandata_t *freq_noise = (phy_chandata_t *) blk_alloc_desc_range(PHY_CHANDATA_BLK_NB-1, (blk_t **) &last_chan); // if 4 bytes per freq_noise - last_chan->blk.next = NULL; - last_chan->last = 1; - last_chan->type = PHY_CHANDATA_TYPE_NRJ; - last_chan->size = PHY_CHANDATA_NRJ_LAST_SIZE; - phy_chandata_t *browser = freq_noise; - uint address=0; - while (browser != last_chan) - { - browser->last = 0; - browser->type = PHY_CHANDATA_TYPE_NRJ; - browser->size = 128; - browser->address = address; - browser = (phy_chandata_t *)browser->blk.next; - address+= 128; - } - last_chan->address = address; - - - - /** registering reception status to be able to run pbproc_rx_cb that wake - * up the sar */ - rx_pb_first = pb_first; - rx_pb_last = pb_last; - //rx_chandata_first = freq_noise; - //last_chan->blk.next = time_noise; - rx_chandata_first = time_noise; - time_noise->blk.next = (blk_t *) freq_noise; - rx_pb_nb = pb_nb; - - ce_print_chandata (time_noise); - - phy_pbdma_start_chandata(phy_ctx, time_noise); - //phy_pbdma_start_chandata(ctx, freq_noise); - - /* now make the return parameter list */ - fcall_param_reset(*param); - - return 0; -} - -pbproc_t * -pbproc_init (mac_config_t *config, mac_store_t *store) -{ - pbproc_t *pbproc_ctx = &pbproc_global; - pbproc_ctx->config = config; - // Initialize the HAL PHY - phy_ctx = phy_init ((void *)&user_data, &phy_rx_fc_cb, &phy_access_cb, &phy_access_conf_cb, &phy_pbdma_cb, &phy_deferred_cb); - mac_ntb_init (phy_ctx, config); - - // Enable assertions on warnings - phy_ctx->warning_assert = true; - - // Set TONEMASK - phy_set_tonemask(phy_ctx, config->tonemask_info.tonemask, PHY_CARRIER_NB); - return(pbproc_ctx); -} - -void -pbproc_init_cb (pbproc_t *ctx, void *user_data, pbproc_rx_cb_t rx_cb, pbproc_rx_beacon_cb_t rx_beacon_cb) -{ - dbg_assert (ctx); - dbg_assert (rx_cb); - dbg_assert (rx_beacon_cb); - //ctx->user_data = user_data; - ctx->rx_cb = rx_cb; - //ctx->rx_beacon_cb = rx_beacon_cb; -} - -void -pbproc_rx_segment_refill (pbproc_t *ctx, pb_t *f, pb_t *l, uint nb) -{ - return; -} - -pb_t * -pbproc_mfs_extract_tail (mfs_tx_t *mfs) {return NULL;} - -void -pbproc_mfs_insert (mfs_tx_t *mfs, pb_t *first, pb_t *last, uint nb, uint cap) {return;} - -void -pbproc_mfs_provide (mfs_tx_t *mfs, uint nb) {return;} - -void -pbproc_scf (void) -{ - return; -} - -bool -ca_mfs_remove (ca_t *ctx, mfs_tx_t *mfs) -{ - return true; -} - -void -ca_mfs_update (ca_t *ctx, mfs_tx_t *mfs) -{ - -} diff --git a/ce/test/maximus/send_noise.py b/ce/test/maximus/send_noise.py deleted file mode 100644 index d210c62532..0000000000 --- a/ce/test/maximus/send_noise.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/python - -#print __name__ - -import sys -sys.path.append ('../../../maximus/python') -sys.path.append ('../../../maximus/python/obj') -from interface import * -from maximus.macframe import * -from maximus.macframe.msdu import MAX_SIZE_OF_MSDU -from struct import * - -# Create and initializes Maximus -maximus = Maximus() -maximus.init(sys.argv) - -# Create a station -sta = maximus.create_sta () -sta.debug() -maximus.disturb_channel() - -pb_nb = 200 -frame_nb = 22 - -ce_init_fcall = maximus.create_fcall ('ce_init') -ce_init_fcall.send(sta) -sar_start_fcall = maximus.create_fcall ('sar_start') -sar_start_fcall.send(sta) - -ce_check_stock_fcall = maximus.create_fcall ('ce_check_stock') -ce_check_stock_fcall.add_param_ushort ('frame_nb', frame_nb); -ce_check_stock_fcall.add_param_ushort ('pb_nb', pb_nb); -ce_start_fcall = maximus.create_fcall ('ce_start') -ce_check_computation_fcall = maximus.create_fcall ('ce_check_computation') - - -def prepare_rx_param_init(): - prepare_rx_fcall = maximus.create_fcall('prepare_rx') - fc_mode = 2 # PHY_FC_MODE_AV_1 - prepare_rx_fcall.add_param_ushort("fc_mode", fc_mode) - prepare_rx_fcall.add_param_bool("short_ppdu", False) - mod = 0 # PHY_MOD_ROBO - prepare_rx_fcall.add_param_ushort("mod", mod) - fecrate = 0 # PHY_FEC_RATE_1_2 - prepare_rx_fcall.add_param_ushort("fecrate", fecrate) - pb_size = 1 - prepare_rx_fcall.add_param_ushort("pb_size", pb_size) - gil = 1 # PHY_GIL_567 - prepare_rx_fcall.add_param_ushort("gil", gil) - #pb_nb = 1 - prepare_rx_fcall.add_param_ushort("pb_nb", pb_nb) - #prepare_rx_fcall.send(sta) - return prepare_rx_fcall - -test_result_fcall = maximus.create_fcall('test_result_get') - -queue = MACFrameQueue() -queue.set_fc_av(pack('IIII', 0, 456, 789, 10)) -payload = 512*'X'+(pb_nb-1)*512*'Y' -macframe_nb = (len(payload) + (MAX_SIZE_OF_MSDU-1)) / MAX_SIZE_OF_MSDU -payload = payload[macframe_nb*6:] - -def create_msdu(): - msdu = MACFrame() - msdu.set_macframeheader ('MF') - msdu.set_icv ('CRC0') - return msdu - -def send_queue(): - for i in range (macframe_nb): - macFrame = create_msdu() - macFrame.set_msdu(payload[i*MAX_SIZE_OF_MSDU:min((i+1)*MAX_SIZE_OF_MSDU, len(payload))]) - queue.add(macFrame) - queue.send(maximus) - -for i in range(frame_nb) : - prepare_rx_param_init().send(sta) - send_queue() - -ce_check_stock_fcall.send(sta) -ce_start_fcall.send(sta) -ce_check_computation_fcall.send(sta) - -maximus.wait(10000000) - -res = test_result_fcall.send(sta) -result = res.bind_param_ushort ("test_result") -#print "test has returned ", hex(result) -sta.remove() - -sys.exit(result) - diff --git a/ce/test/maximus/src/test_rx.c b/ce/test/maximus/src/test_rx.c deleted file mode 100644 index 6a5c82f6fd..0000000000 --- a/ce/test/maximus/src/test_rx.c +++ /dev/null @@ -1,188 +0,0 @@ -#include -#include "common/std.h" -#include "host/station.h" -#include "mac/pbproc/pbproc.h" -#include "mac/sar/sar.h" -#include "cyg/kernel/kapi.h" -#include "cyg/hal/hal_arch.h" -#include "ce/inc/rx.h" -#include "ce/test/common/print_utils.h" -#define TXCE -#include "lib/test.h" -#include "ce/test/common/tonemap_utils.h" - -extern station_ctx_t my_station; -test_t test; - -#define SAR_PRIORITY 14 -cyg_thread sar_thread; -cyg_handle_t sar_handle; -unsigned char sar_stack[CYGNUM_HAL_STACK_SIZE_TYPICAL]; - -#define RXCE_PRIORITY 15 -cyg_thread rxce_thread; -cyg_handle_t rxce_handle; -unsigned char rxce_stack[CYGNUM_HAL_STACK_SIZE_TYPICAL]; - -mac_store_t *mac_store_ctx; -mac_config_t mac_config_ctx; -sar_t *sar_ctx; -sta_t *sta; -ca_t *ca; -rxce_t *rxce_ctx; - -bool -local_sar_mpdu_measurement_cb (void *user, pbproc_rx_params_t *rx_params, - uint pb_nb, blk_t **f, blk_t **l, pb_t *noise) -{ - - uint i,j; - diag_printf ("pb_nb = %d\n",pb_nb); - diag_printf ("noise @Ox%x\n",(unsigned int) noise); - phy_chandata_t *chandata = (phy_chandata_t *) noise; - phy_noise_t *data_noise; - for (i=0; itype, - chandata->size, - chandata->last); - data_noise = (phy_noise_t *) chandata->blk.data; - for (j=0; jblk.next; - } - - return true; -} - -void -sar_start (void) -{ - pbproc_t *pbproc_ctx = pbproc_init (&mac_config_ctx, mac_store_ctx); - ca = blk_alloc(); - sar_ctx = sar_init (mac_store_ctx, pbproc_ctx, ca); - sar_init_measure_context (sar_ctx, rxce_ctx); - //sar_init_measurement_cb (sar_ctx, &local_sar_mpdu_measurement_cb); - sar_init_measurement_cb (sar_ctx, &sar_mpdu_measurement_cb); - mac_store_sta_add (mac_store_ctx, 1); - sta = mac_store_sta_get (mac_store_ctx, 1); - cyg_thread_create (SAR_PRIORITY, &sar_process, (cyg_addrword_t)sar_ctx, "sar_test", - sar_stack, CYGNUM_HAL_STACK_SIZE_TYPICAL, - &sar_handle, &sar_thread); - cyg_thread_resume (sar_handle); -} - -void -sar_end (void) -{ - blk_release (sta); // release reference to sta added by mac_store_mfs_get in START. - dbg_check (mac_store_sta_remove (mac_store_ctx, 1)); - blk_release(ca); - sar_uninit (sar_ctx); -} - -void -ce_init (void) -{ - rxce_ctx = rxce_init (mac_store_ctx, &mac_config_ctx); - cyg_thread_create (RXCE_PRIORITY, &rxce_process, (cyg_addrword_t) rxce_ctx, "rxce", - rxce_stack, CYGNUM_HAL_STACK_SIZE_TYPICAL, - &rxce_handle, &rxce_thread); -} - -void -ce_check_stock (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data) -{ - unsigned short pb_nb; - unsigned short fm_nb; - uint pb_ix, fm_ix; - - fcall_param_bind_short(*param, *msg, "pb_nb", &pb_nb); - fcall_param_bind_short(*param, *msg, "frame_nb", &fm_nb); - - test_begin (test, "check pb measurement") - { - dbg_assert (fm_number == fm_nb); - for (fm_ix=0; fm_ixnext; - } - pb_measurement_t m = *(ber_blk->data+(pb_ix%(BLK_SIZE/sizeof(pb_measurement_t)))); - test_fail_if (m.halfit != 0x04); - test_fail_if ( m.ber != (1<< (pb_ix%16)) ); - test_fail_if ( m.crc_error != (pb_ix%2) ); - } - } - } test_end; - fcall_param_reset(*param); - return; -} - -void -ce_check_computation (void) -{ - sta_t *sta = mac_store_sta_get (mac_store_ctx, 1); - ce_print_tonemaps (sta->rx_tonemaps); - ce_print_tonemaps (sta->tx_tonemaps); - - compare_tonemaps (test, sta->rx_tonemaps, sta->tx_tonemaps, - (u8 *)(&(mac_config_ctx.tonemask_info.tonemask))); - test_result (test); - return; -} - -void -ce_start (void) -{ - cyg_thread_resume (rxce_handle); -} - -int -test_result_get (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data) -{ - unsigned short result; - result = (test_nb_failed (test)); - fcall_param_reset(*param); - fcall_param_add_short(*param, *msg, "test_result", &result); - return (result); -} - -int main(void) -{ - trace_init(); - test_init (test, 0, NULL); - test_case_begin (test, "RXCE-maximus"); - station_log_set_level(&my_station, STATION_LOG_NONE); - station_log_set_mask(&my_station, STATION_LOGTYPE_ALL); - my_station.pipe_log_fd = 1; - diag_write_string(" hello by eCos in maximus test\n"); - fcall_register(my_station.fcall, "sar_start", (void*)&sar_start, NULL); - fcall_register(my_station.fcall, "ce_init", (void*)&ce_init, NULL); - fcall_register(my_station.fcall, "ce_check_stock", (void*)&ce_check_stock, NULL); - fcall_register(my_station.fcall, "ce_start", (void*)&ce_start, NULL); - fcall_register(my_station.fcall, "ce_check_computation", (void*)&ce_check_computation, NULL); - fcall_register(my_station.fcall, "prepare_rx", (void*)&prepare_rx, NULL); - fcall_register(my_station.fcall, "test_result_get", (void*)&test_result_get, NULL); - - tonemask_default ((u8 *)(&(mac_config_ctx.tonemask_info.tonemask))); - //int i; - //for (i=0; i<(PHY_CARRIER_NB+7)/8; i++) mac_config_ctx.tonemask_info.tonemask[i] = 0xFF; - //mac_config_ctx.tonemask_info.tonemask[i-1] = ((1<<(PHY_CARRIER_NB%8))-1); - - mac_store_ctx = mac_store_init (); - - return 0; -} - diff --git a/ce/test/maximus/test.h b/ce/test/maximus/test.h deleted file mode 100644 index 2be7038cce..0000000000 --- a/ce/test/maximus/test.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef test_h -#define test_h -/* Cesar project {{{ - * - * Copyright (C) 2008 Spidcom - * - * <<>> - * - * }}} */ -/** - * \file test.h - * \brief « brief description » - * \ingroup « module » - * - * « long description » - */ -#define MAXIMUS_TEST -#endif /* test_h */ diff --git a/ce/test/rx/maximus/Makefile b/ce/test/rx/maximus/Makefile new file mode 100644 index 0000000000..2dbb841e8e --- /dev/null +++ b/ce/test/rx/maximus/Makefile @@ -0,0 +1,15 @@ +BASE = ../../../.. +INCLUDES = ce/test/rx/maximus/overide +INCLUDES += ce/test/rx/maximus +INCLUDES += ce/test/rx/general/overide +ECOS = y + +TARGET_PROGRAMS = test_rx +test_rx_SOURCES = test_rx.c +#test_rx_MODULES=lib host mac/common hal/phy/maximus mac/sar ce mac/pbproc ce/test/rx/overide/cp/interf ce/test/common +test_rx_MODULES=lib host mac/common hal/phy/maximus mac/sar ce ce/test/rx/maximus/overide/mac/pbproc ce/test/rx/general/overide/cp/interf ce/test/common + +ce_MODULE_SOURCES = cei_param.c frame_measurement.c rx.c trace.c + +include $(BASE)/common/make/top.mk + diff --git a/ce/test/rx/maximus/config_test.h b/ce/test/rx/maximus/config_test.h new file mode 100644 index 0000000000..5d4bd8a7e4 --- /dev/null +++ b/ce/test/rx/maximus/config_test.h @@ -0,0 +1,19 @@ +#ifndef __config_test_h +#define __config_test_h +/* Cesar project {{{ + * + * Copyright (C) 2007 Spidcom + * + * <<>> + * + * }}} */ +/** + * \file ./config_test.h + * \brief « brief description » + * \ingroup « module » + * + * « long description » + */ +#define MAXIMUS_TEST +//#define CE_DBG +#endif /* __config_test_h */ diff --git a/ce/test/rx/maximus/ecos.ecc.sh b/ce/test/rx/maximus/ecos.ecc.sh new file mode 100644 index 0000000000..19597e4621 --- /dev/null +++ b/ce/test/rx/maximus/ecos.ecc.sh @@ -0,0 +1,104 @@ +config=${1:-ecos-gen.ecc} +ecosconfig --config=$config new maximus default +cat >> $config <<'EOF' +cdl_option CYGPKG_HAL_MAXIMUS_CFLAGS_ADD { + user_value "-I\$(BASE) -I\$(OBJ_DIR)/inc" + # value_source user + # Default value: "-I\$(REPOSITORY)/../.." +} +cdl_option CYGBLD_GLOBAL_CFLAGS { + user_value "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority -finline" + # value_source user + # Default value: "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" +} +cdl_option CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT { + user_value 0 + inferred_value 0 +} +cdl_option CYGBLD_ISO_CTYPE_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_ERRNO_CODES_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_ERRNO_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STDIO_FILETYPES_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STDIO_STREAMS_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STDIO_FILEOPS_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STDIO_FILEACCESS_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STDIO_FORMATTED_IO_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STDIO_CHAR_IO_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STDIO_DIRECT_IO_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STDIO_FILEPOS_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STDIO_ERROR_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STDLIB_STRCONV_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STDLIB_ABS_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STDLIB_DIV_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STRERROR_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_C_TIME_TYPES_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_C_CLOCK_FUNCS_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_SIGNAL_NUMBERS_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_SIGNAL_IMPL_HEADER { + inferred_value 1 +} +cdl_option CYGBLD_ISO_SETJMP_HEADER { + inferred_value 1 +} +cdl_option CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE { + user_value 16384 + inferred_value 16384 +} +cdl_option CYGSEM_ERROR_PER_THREAD_ERRNO { + user_value 0 +} +EOF +ecosconfig --config=$config check diff --git a/ce/test/rx/maximus/overide/mac/pbproc/Module b/ce/test/rx/maximus/overide/mac/pbproc/Module new file mode 100644 index 0000000000..e9f0167e68 --- /dev/null +++ b/ce/test/rx/maximus/overide/mac/pbproc/Module @@ -0,0 +1 @@ +SOURCES := pbproc.c diff --git a/ce/test/rx/maximus/overide/mac/pbproc/pbproc.h b/ce/test/rx/maximus/overide/mac/pbproc/pbproc.h new file mode 100644 index 0000000000..f8d1b976b4 --- /dev/null +++ b/ce/test/rx/maximus/overide/mac/pbproc/pbproc.h @@ -0,0 +1,140 @@ +#ifndef overide_pbproc_h +#define overide_pbproc_h +/* Cesar project {{{ + * + * Copyright (C) 2007 Spidcom + * + * <<>> + * + * }}} */ +/** + * \file overide/pbproc.h + * \brief « brief description » + * \ingroup « module » + * + * « long description » + */ +#include "host/station.h" +#include "hal/phy/maximus/inc/maximus_phy_ctx.h" // 'phy_t' +#include "mac/common/mfs.h" +#include "mac/common/pb.h" +#include "mac/ca/ca.h" + + +struct pbproc_rx_params_t +{ + /** Preamble start NTB. */ + u32 preamble_ntb; + /** TEI of the transmitter. */ + u8 tei; + /** Link ID of this MPDU. */ + u8 lid; + /** Short network identifier. */ + uint snid:4; + /** Whether this is a multicast frame. */ + bool bcast:1; + /** Multi-network broadcast flag. */ + bool multi_net_bcast:1; + /** Network encryption key select. */ + uint eks:4; + /** Pending PB. */ + uint pending_seg_nb:8; + /** Bit loading estimate. */ + uint ble:8; + /** Tone map index. */ + uint tmi_av:5; + /** Beacon detect flag. */ + bool bdf:1; + /** Homeplug 1.0.1 detect flag. */ + bool hp10df:1; + /** Homeplug 1.1 detect flag. */ + bool hp11df:1; +}; +typedef struct pbproc_rx_params_t pbproc_rx_params_t; + +typedef void (*pbproc_rx_cb_t) (void *user, mfs_t *mfs, mfs_t *mfs_mme, + const pbproc_rx_params_t *rx_params, + pb_t *pb_first, pb_t *pb_last, + uint pb_nb, pb_t *chandata_first); + +struct pbproc_t +{ + pbproc_rx_cb_t rx_cb; + mac_config_t *config; +}; +typedef struct pbproc_t pbproc_t; + +struct pbproc_rx_beacon_params_t +{ + /** Preamble start NTB. */ + u32 preamble_ntb; + /** Beacon Time Stamp. */ + u32 bts; + /** Beacon Transmission Offset. */ + u16 bto[4]; + /** Short network identifier. */ + u8 snid; +}; +typedef struct pbproc_rx_beacon_params_t pbproc_rx_beacon_params_t; + +typedef void (*pbproc_rx_beacon_cb_t) (void *user, pb_beacon_t *pb, + pbproc_rx_beacon_params_t *params); + + +BEGIN_DECLS + +bool phy_rx_fc_cb (void *user, u32 rx_date, const u32 *fc_av); + +bool phy_access_cb (void *user); + +bool phy_access_conf_cb (void *user); + +bool phy_pbdma_cb (void *user, u32 status_word); + +void phy_deferred_cb (void *user); + +bool phy_extra_timer_cb (void *user); + +int set_tonemask (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data); + +int prepare_rx (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data); + +pbproc_t * +pbproc_init (mac_config_t *config, mac_store_t *store); + +void +pbproc_init_cb (pbproc_t *ctx, void *user_data, pbproc_rx_cb_t rx_cb, pbproc_rx_beacon_cb_t rx_beacon_cb); + +void +pbproc_uninit (pbproc_t *ctx); + +void +pbproc_rx_segment_refill (pbproc_t *ctx, pb_t *first, pb_t *last, + uint nb); + +pb_t * +pbproc_mfs_extract_tail (mfs_tx_t *mfs); + +void +pbproc_mfs_insert (mfs_tx_t *mfs, pb_t *first, pb_t *last, uint nb, uint cap); + +void +pbproc_mfs_provide (mfs_tx_t *mfs, uint nb); + +/** set SCF in pbproc ctx */ +void +pbproc_scf (void); + +void +pbproc_set_config (mac_config_t *config); + + +bool +ca_mfs_remove (ca_t *ctx, mfs_tx_t *mfs); + +void +ca_mfs_update (ca_t *ctx, mfs_tx_t *mfs); + +END_DECLS + +#endif /* overide_pbproc_h */ diff --git a/ce/test/rx/maximus/overide/mac/pbproc/src/pbproc.c b/ce/test/rx/maximus/overide/mac/pbproc/src/pbproc.c new file mode 100644 index 0000000000..f4f1654de2 --- /dev/null +++ b/ce/test/rx/maximus/overide/mac/pbproc/src/pbproc.c @@ -0,0 +1,247 @@ +/* Cesar project {{{ + * + * Copyright (C) 2007 Spidcom + * + * <<>> + * + * }}} */ +/** + * \file ./overide/src/pbproc.c + * \brief « brief description » + * \ingroup « module » + * + * « long description » + */ +#include +#include "common/std.h" +#include "mac/pbproc/pbproc.h" +#include "mac/common/tonemask.h" +#include "hal/phy/maximus/dur/inc/maximus_dur.h" +#include "ce/test/common/print_utils.h" +#include "mac/common/ntb.h" + +phy_t * phy_ctx; +int user_data = 123; +bool short_ppdu = false; +unsigned short mod = 0; +unsigned short fecrate = 0; +unsigned short pb_size = 0; +unsigned short gil = 0; +//u8 tonemask[(PHY_CARRIER_NB+7)/8]; + +static pbproc_t pbproc_global; +phy_chandata_t *rx_chandata_first; +phy_pb_t *rx_pb_first; +phy_pb_t *rx_pb_last; +uint rx_pb_nb; +pbproc_rx_params_t rx_params; +void *sar_ctx; +uint rx_symbol_nb; + +bool phy_rx_fc_cb (void *user, u32 rx_date, const u32 *fc_av) +{ + // When the FC is received, prepare RX + rx_symbol_nb = maximus_dur_symbol_nb ((phy_fecrate_t) fecrate, + (phy_pb_size_t) pb_size, + maximus_dur_bits_per_symbol ( (phy_mod_t) mod, + pbproc_global.config->tonemask_info.tonemask, + NULL, + maximus_dur_carrier_nb (pbproc_global.config->tonemask_info.tonemask) + ), + rx_pb_nb + ); + + + ce_print ("phy_rx_fc_cb ******* symbol NB = %d\n",rx_symbol_nb); + phy_rx_prepare(phy_ctx, short_ppdu, (phy_mod_t)mod, + (phy_fecrate_t)fecrate, (phy_pb_size_t)pb_size, (phy_gil_t)gil, + 0 /* tonemap_index */, rx_symbol_nb); + + return true; +} + +bool phy_access_cb (void *user) +{ + return true; +} + +bool phy_access_conf_cb (void *user) +{ + return true; +} + +bool phy_pbdma_cb (void *user, u32 status_word) +{ + ce_print ("phy_pbdma_cb ******* PB NB = %d\n",rx_pb_nb); + phy_pbdma_status_t status = *(phy_pbdma_status_t *)&status_word; + rx_params.tei = 1; + rx_params.lid = 0; + if (1 == status.end_chandata) + { + pbproc_global.rx_cb (sar_ctx, NULL, NULL, &rx_params, (pb_t *) rx_pb_first,(pb_t *) rx_pb_last, rx_pb_nb,(pb_t *) rx_chandata_first); + } + return true; +} + +void phy_deferred_cb (void *user) +{ + return; +} + +bool phy_extra_timer_cb (void *user) +{ + return true; +} + +int prepare_rx (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data) +{ + unsigned short fc_mode = 0; + unsigned short pb_nb = 0; + int i = 0; + u32 iv[3]; + u32 nek[4]; + + phy_pb_t *pb_last; + phy_pb_t *pb_first; + + ce_print("=> prepare_rx\n"); + + /* get parameters content */ + fcall_param_bind_short(*param, *msg, "fc_mode", &fc_mode); + fcall_param_bind(*param, *msg, "short_ppdu", sizeof(bool), &short_ppdu); + fcall_param_bind_short(*param, *msg, "mod", &mod); + fcall_param_bind_short(*param, *msg, "fecrate", &fecrate); + fcall_param_bind_short(*param, *msg, "pb_size", &pb_size); + fcall_param_bind_short(*param, *msg, "gil", &gil); + fcall_param_bind_short(*param, *msg, "pb_nb", &pb_nb); + + dbg_assert (pb_nb); + pb_first = (phy_pb_t *) blk_alloc_desc_range (pb_nb, (blk_t **) &pb_last); + pb_last->blk.next = NULL; + + // Activate RX + phy_rx_activate(phy_ctx, true /* now */, my_station.current_tick_tck, true /* pre_detection */); + + // Set RX parameters + phy_rx_param(phy_ctx, (phy_fc_mode_t)fc_mode); + + for (i=0; i<3; i++) + { + iv[i] = i; + } + for (i=0; i<4; i++) + { + nek[i] = i; + } + phy_pbdma_start(phy_ctx, true /* bypass_aes */, iv, + nek, (uint)pb_nb /* nb_total */, (uint)pb_nb /* nb_ready */, + (uint)pb_nb /* nb_pb_it */, pb_first); + + phy_chandata_t *time_noise = (phy_chandata_t *) blk_alloc_desc(); + time_noise->blk.next = NULL; + time_noise->last=0; + time_noise->type = PHY_CHANDATA_TYPE_NRJ_SYMBOL; + time_noise->size = (pb_nb * sizeof(phy_noise_t)+ 3)/4; + + phy_chandata_t *last_chan; + phy_chandata_t *freq_noise = (phy_chandata_t *) blk_alloc_desc_range(PHY_CHANDATA_BLK_NB-1, (blk_t **) &last_chan); // if 4 bytes per freq_noise + last_chan->blk.next = NULL; + last_chan->last = 1; + last_chan->type = PHY_CHANDATA_TYPE_NRJ; + last_chan->size = PHY_CHANDATA_NRJ_LAST_SIZE; + phy_chandata_t *browser = freq_noise; + uint address=0; + while (browser != last_chan) + { + browser->last = 0; + browser->type = PHY_CHANDATA_TYPE_NRJ; + browser->size = 128; + browser->address = address; + browser = (phy_chandata_t *)browser->blk.next; + address+= 128; + } + last_chan->address = address; + + + + /** registering reception status to be able to run pbproc_rx_cb that wake + * up the sar */ + rx_pb_first = pb_first; + rx_pb_last = pb_last; + //rx_chandata_first = freq_noise; + //last_chan->blk.next = time_noise; + rx_chandata_first = time_noise; + time_noise->blk.next = (blk_t *) freq_noise; + rx_pb_nb = pb_nb; + + ce_print_chandata (time_noise); + + phy_pbdma_start_chandata(phy_ctx, time_noise); + //phy_pbdma_start_chandata(ctx, freq_noise); + + /* now make the return parameter list */ + fcall_param_reset(*param); + + return 0; +} + +pbproc_t * +pbproc_init (mac_config_t *config, mac_store_t *store) +{ + pbproc_t *pbproc_ctx = &pbproc_global; + pbproc_ctx->config = config; + // Initialize the HAL PHY + phy_ctx = phy_init ((void *)&user_data, &phy_rx_fc_cb, &phy_access_cb, &phy_access_conf_cb, &phy_pbdma_cb, &phy_deferred_cb); + mac_ntb_init (phy_ctx, config); + + // Enable assertions on warnings + phy_ctx->warning_assert = true; + + // Set TONEMASK + phy_set_tonemask(phy_ctx, config->tonemask_info.tonemask, PHY_CARRIER_NB); + return(pbproc_ctx); +} + +void +pbproc_init_cb (pbproc_t *ctx, void *user_data, pbproc_rx_cb_t rx_cb, pbproc_rx_beacon_cb_t rx_beacon_cb) +{ + dbg_assert (ctx); + dbg_assert (rx_cb); + dbg_assert (rx_beacon_cb); + //ctx->user_data = user_data; + ctx->rx_cb = rx_cb; + //ctx->rx_beacon_cb = rx_beacon_cb; +} + +void +pbproc_rx_segment_refill (pbproc_t *ctx, pb_t *f, pb_t *l, uint nb) +{ + return; +} + +pb_t * +pbproc_mfs_extract_tail (mfs_tx_t *mfs) {return NULL;} + +void +pbproc_mfs_insert (mfs_tx_t *mfs, pb_t *first, pb_t *last, uint nb, uint cap) {return;} + +void +pbproc_mfs_provide (mfs_tx_t *mfs, uint nb) {return;} + +void +pbproc_scf (void) +{ + return; +} + +bool +ca_mfs_remove (ca_t *ctx, mfs_tx_t *mfs) +{ + return true; +} + +void +ca_mfs_update (ca_t *ctx, mfs_tx_t *mfs) +{ + +} diff --git a/ce/test/rx/maximus/send_noise.py b/ce/test/rx/maximus/send_noise.py new file mode 100644 index 0000000000..98e127bd75 --- /dev/null +++ b/ce/test/rx/maximus/send_noise.py @@ -0,0 +1,92 @@ +#!/usr/bin/python + +#print __name__ + +import sys +sys.path.append ('../../../../maximus/python') +sys.path.append ('../../../../maximus/python/obj') +from interface import * +from maximus.macframe import * +from maximus.macframe.msdu import MAX_SIZE_OF_MSDU +from struct import * + +# Create and initializes Maximus +maximus = Maximus() +maximus.init(sys.argv) + +# Create a station +sta = maximus.create_sta () +sta.debug() +maximus.disturb_channel() + +pb_nb = 200 +frame_nb = 22 + +ce_init_fcall = maximus.create_fcall ('ce_init') +ce_init_fcall.send(sta) +sar_start_fcall = maximus.create_fcall ('sar_start') +sar_start_fcall.send(sta) + +ce_check_stock_fcall = maximus.create_fcall ('ce_check_stock') +ce_check_stock_fcall.add_param_ushort ('frame_nb', frame_nb); +ce_check_stock_fcall.add_param_ushort ('pb_nb', pb_nb); +ce_start_fcall = maximus.create_fcall ('ce_start') +ce_check_computation_fcall = maximus.create_fcall ('ce_check_computation') + + +def prepare_rx_param_init(): + prepare_rx_fcall = maximus.create_fcall('prepare_rx') + fc_mode = 2 # PHY_FC_MODE_AV_1 + prepare_rx_fcall.add_param_ushort("fc_mode", fc_mode) + prepare_rx_fcall.add_param_bool("short_ppdu", False) + mod = 0 # PHY_MOD_ROBO + prepare_rx_fcall.add_param_ushort("mod", mod) + fecrate = 0 # PHY_FEC_RATE_1_2 + prepare_rx_fcall.add_param_ushort("fecrate", fecrate) + pb_size = 1 + prepare_rx_fcall.add_param_ushort("pb_size", pb_size) + gil = 1 # PHY_GIL_567 + prepare_rx_fcall.add_param_ushort("gil", gil) + #pb_nb = 1 + prepare_rx_fcall.add_param_ushort("pb_nb", pb_nb) + #prepare_rx_fcall.send(sta) + return prepare_rx_fcall + +test_result_fcall = maximus.create_fcall('test_result_get') + +queue = MACFrameQueue() +queue.set_fc_av(pack('IIII', 0, 456, 789, 10)) +payload = 512*'X'+(pb_nb-1)*512*'Y' +macframe_nb = (len(payload) + (MAX_SIZE_OF_MSDU-1)) / MAX_SIZE_OF_MSDU +payload = payload[macframe_nb*6:] + +def create_msdu(): + msdu = MACFrame() + msdu.set_macframeheader ('MF') + msdu.set_icv ('CRC0') + return msdu + +def send_queue(): + for i in range (macframe_nb): + macFrame = create_msdu() + macFrame.set_msdu(payload[i*MAX_SIZE_OF_MSDU:min((i+1)*MAX_SIZE_OF_MSDU, len(payload))]) + queue.add(macFrame) + queue.send(maximus) + +for i in range(frame_nb) : + prepare_rx_param_init().send(sta) + send_queue() + +ce_check_stock_fcall.send(sta) +ce_start_fcall.send(sta) +ce_check_computation_fcall.send(sta) + +maximus.wait(10000000) + +res = test_result_fcall.send(sta) +result = res.bind_param_ushort ("test_result") +#print "test has returned ", hex(result) +sta.remove() + +sys.exit(result) + diff --git a/ce/test/rx/maximus/src/test_rx.c b/ce/test/rx/maximus/src/test_rx.c new file mode 100644 index 0000000000..6a5c82f6fd --- /dev/null +++ b/ce/test/rx/maximus/src/test_rx.c @@ -0,0 +1,188 @@ +#include +#include "common/std.h" +#include "host/station.h" +#include "mac/pbproc/pbproc.h" +#include "mac/sar/sar.h" +#include "cyg/kernel/kapi.h" +#include "cyg/hal/hal_arch.h" +#include "ce/inc/rx.h" +#include "ce/test/common/print_utils.h" +#define TXCE +#include "lib/test.h" +#include "ce/test/common/tonemap_utils.h" + +extern station_ctx_t my_station; +test_t test; + +#define SAR_PRIORITY 14 +cyg_thread sar_thread; +cyg_handle_t sar_handle; +unsigned char sar_stack[CYGNUM_HAL_STACK_SIZE_TYPICAL]; + +#define RXCE_PRIORITY 15 +cyg_thread rxce_thread; +cyg_handle_t rxce_handle; +unsigned char rxce_stack[CYGNUM_HAL_STACK_SIZE_TYPICAL]; + +mac_store_t *mac_store_ctx; +mac_config_t mac_config_ctx; +sar_t *sar_ctx; +sta_t *sta; +ca_t *ca; +rxce_t *rxce_ctx; + +bool +local_sar_mpdu_measurement_cb (void *user, pbproc_rx_params_t *rx_params, + uint pb_nb, blk_t **f, blk_t **l, pb_t *noise) +{ + + uint i,j; + diag_printf ("pb_nb = %d\n",pb_nb); + diag_printf ("noise @Ox%x\n",(unsigned int) noise); + phy_chandata_t *chandata = (phy_chandata_t *) noise; + phy_noise_t *data_noise; + for (i=0; itype, + chandata->size, + chandata->last); + data_noise = (phy_noise_t *) chandata->blk.data; + for (j=0; jblk.next; + } + + return true; +} + +void +sar_start (void) +{ + pbproc_t *pbproc_ctx = pbproc_init (&mac_config_ctx, mac_store_ctx); + ca = blk_alloc(); + sar_ctx = sar_init (mac_store_ctx, pbproc_ctx, ca); + sar_init_measure_context (sar_ctx, rxce_ctx); + //sar_init_measurement_cb (sar_ctx, &local_sar_mpdu_measurement_cb); + sar_init_measurement_cb (sar_ctx, &sar_mpdu_measurement_cb); + mac_store_sta_add (mac_store_ctx, 1); + sta = mac_store_sta_get (mac_store_ctx, 1); + cyg_thread_create (SAR_PRIORITY, &sar_process, (cyg_addrword_t)sar_ctx, "sar_test", + sar_stack, CYGNUM_HAL_STACK_SIZE_TYPICAL, + &sar_handle, &sar_thread); + cyg_thread_resume (sar_handle); +} + +void +sar_end (void) +{ + blk_release (sta); // release reference to sta added by mac_store_mfs_get in START. + dbg_check (mac_store_sta_remove (mac_store_ctx, 1)); + blk_release(ca); + sar_uninit (sar_ctx); +} + +void +ce_init (void) +{ + rxce_ctx = rxce_init (mac_store_ctx, &mac_config_ctx); + cyg_thread_create (RXCE_PRIORITY, &rxce_process, (cyg_addrword_t) rxce_ctx, "rxce", + rxce_stack, CYGNUM_HAL_STACK_SIZE_TYPICAL, + &rxce_handle, &rxce_thread); +} + +void +ce_check_stock (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data) +{ + unsigned short pb_nb; + unsigned short fm_nb; + uint pb_ix, fm_ix; + + fcall_param_bind_short(*param, *msg, "pb_nb", &pb_nb); + fcall_param_bind_short(*param, *msg, "frame_nb", &fm_nb); + + test_begin (test, "check pb measurement") + { + dbg_assert (fm_number == fm_nb); + for (fm_ix=0; fm_ixnext; + } + pb_measurement_t m = *(ber_blk->data+(pb_ix%(BLK_SIZE/sizeof(pb_measurement_t)))); + test_fail_if (m.halfit != 0x04); + test_fail_if ( m.ber != (1<< (pb_ix%16)) ); + test_fail_if ( m.crc_error != (pb_ix%2) ); + } + } + } test_end; + fcall_param_reset(*param); + return; +} + +void +ce_check_computation (void) +{ + sta_t *sta = mac_store_sta_get (mac_store_ctx, 1); + ce_print_tonemaps (sta->rx_tonemaps); + ce_print_tonemaps (sta->tx_tonemaps); + + compare_tonemaps (test, sta->rx_tonemaps, sta->tx_tonemaps, + (u8 *)(&(mac_config_ctx.tonemask_info.tonemask))); + test_result (test); + return; +} + +void +ce_start (void) +{ + cyg_thread_resume (rxce_handle); +} + +int +test_result_get (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data) +{ + unsigned short result; + result = (test_nb_failed (test)); + fcall_param_reset(*param); + fcall_param_add_short(*param, *msg, "test_result", &result); + return (result); +} + +int main(void) +{ + trace_init(); + test_init (test, 0, NULL); + test_case_begin (test, "RXCE-maximus"); + station_log_set_level(&my_station, STATION_LOG_NONE); + station_log_set_mask(&my_station, STATION_LOGTYPE_ALL); + my_station.pipe_log_fd = 1; + diag_write_string(" hello by eCos in maximus test\n"); + fcall_register(my_station.fcall, "sar_start", (void*)&sar_start, NULL); + fcall_register(my_station.fcall, "ce_init", (void*)&ce_init, NULL); + fcall_register(my_station.fcall, "ce_check_stock", (void*)&ce_check_stock, NULL); + fcall_register(my_station.fcall, "ce_start", (void*)&ce_start, NULL); + fcall_register(my_station.fcall, "ce_check_computation", (void*)&ce_check_computation, NULL); + fcall_register(my_station.fcall, "prepare_rx", (void*)&prepare_rx, NULL); + fcall_register(my_station.fcall, "test_result_get", (void*)&test_result_get, NULL); + + tonemask_default ((u8 *)(&(mac_config_ctx.tonemask_info.tonemask))); + //int i; + //for (i=0; i<(PHY_CARRIER_NB+7)/8; i++) mac_config_ctx.tonemask_info.tonemask[i] = 0xFF; + //mac_config_ctx.tonemask_info.tonemask[i-1] = ((1<<(PHY_CARRIER_NB%8))-1); + + mac_store_ctx = mac_store_init (); + + return 0; +} + diff --git a/ce/test/rx/maximus/test.h b/ce/test/rx/maximus/test.h new file mode 100644 index 0000000000..2be7038cce --- /dev/null +++ b/ce/test/rx/maximus/test.h @@ -0,0 +1,18 @@ +#ifndef test_h +#define test_h +/* Cesar project {{{ + * + * Copyright (C) 2008 Spidcom + * + * <<>> + * + * }}} */ +/** + * \file test.h + * \brief « brief description » + * \ingroup « module » + * + * « long description » + */ +#define MAXIMUS_TEST +#endif /* test_h */ -- cgit v1.2.3