summaryrefslogtreecommitdiff
path: root/cesar/mac/sar/test/functional/src/sar_tx.c
diff options
context:
space:
mode:
authorlaranjeiro2010-06-15 12:27:37 +0000
committerlaranjeiro2010-06-15 12:27:37 +0000
commitc5c791afde303519ecae53ed762b29d6dfa2b5eb (patch)
tree4ecfc10a2af4c4fc5b5ba41454f8d861b82fea6c /cesar/mac/sar/test/functional/src/sar_tx.c
parenteb5e017003ac0a95bf18c21d4c5a0b61e438fa5c (diff)
cesar/mac/sar: remove duplicated tests
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7214 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/mac/sar/test/functional/src/sar_tx.c')
-rw-r--r--cesar/mac/sar/test/functional/src/sar_tx.c248
1 files changed, 0 insertions, 248 deletions
diff --git a/cesar/mac/sar/test/functional/src/sar_tx.c b/cesar/mac/sar/test/functional/src/sar_tx.c
deleted file mode 100644
index d2c92dd35d..0000000000
--- a/cesar/mac/sar/test/functional/src/sar_tx.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2009 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file src/sar_tx.c
- * \brief « brief description »
- * \ingroup « module »
- *
- * « long description »
- */
-#include "common/std.h"
-#include "common/defs/homeplugAV.h"
-
-#include "lib/test.h"
-#include "lib/bitstream.h"
-#include "lib/crc.h"
-#include "lib/trace.h"
-#include "lib/stats.h"
-
-#include <cyg/kernel/kapi.h>
-#include <cyg/hal/hal_arch.h>
-#include <string.h>
-
-#include "hal/arch/arch.h"
-
-#include "mac/common/ntb.h"
-#include "mac/common/store.h"
-
-#include "mac/pbproc/pbproc.h"
-#include "mac/sar/sar.h"
-#include "hal/phy/bridgedma.h"
-
-#include "mac/sar/inc/sar_context.h"
-#include "hal/phy/soft/bridgedma/inc/bridgedma.h"
-#include "hal/phy/soft/bridgedma/bridgedma_crc.h"
-#include "mac/sar/test/functional/test_functions.h"
-
-/* Variables needed by the test. */
-#ifdef __sparc__
-static u8 skbuffer[2048] __attribute__ ((section(".private")));
-#else
-static u8 skbuffer[2048];
-#endif
-static sar_t *sar_ctx = NULL;
-static mac_store_t *mac_store = NULL;
-
-static uint count = 0;
-static u32 crcb1;
-static u32 crcb2;
-
-/* Thread data for the test. */
-cyg_thread my_test_thread;
-cyg_handle_t my_test_thread_handle;
-u8 my_test_thread_stack [CYGNUM_HAL_STACK_SIZE_TYPICAL];
-
-void
-segmentation_done (void *ctx, u8 *buffer, void *user_data)
-{
- count ++;
-}
-
-void
-prepare_test (test_t test)
-{
- uint i;
- u8 *buffer = NULL;
- mfs_tx_t *mfs = NULL;
- bool added = false;
- crc_t crc_ctx;
- u32 enc_tab[256];
-
- /* Prepare the buffer. */
- buffer = ARCH_CPU_TO_UNCACHEABLE (skbuffer);
- for (i = 0; i < 2048/4; i++)
- bitstream_direct_write (buffer, i*8, 0xffffffff, 32);
-
- /* Compute the CRC. */
- crc_ctx.width = 32;
- crc_ctx.generator = HPAV_CRC32_GENERATOR;
- crc_ctx.init = HPAV_CRC32_INIT;
- crc_ctx.refin = true;
- crc_ctx.refout = true;
- crc_ctx.xorout = 0xffffffff;
- crc_ctx.reg_init = 0;
- crc_ctx.table.t32 = enc_tab;
- crc_init(&crc_ctx);
-
- crcb1 = crc_compute_begin (&crc_ctx);
- crcb1 = bridgedma_crc_compute_continue_block (&crc_ctx, crcb1, buffer, 1434);
- crcb1 = crc_compute_end (&crc_ctx, crcb1);
-
- crcb2 = crc_compute_begin (&crc_ctx);
- crcb2 = bridgedma_crc_compute_continue_block (&crc_ctx, crcb2, buffer, 1334);
- crcb2 = crc_compute_end (&crc_ctx, crcb2);
-
- /* Add the MFS. */
- mfs = mac_store_mfs_add_tx (mac_store, false, false, 1, 1, &added);
- dbg_assert (mfs);
-
- if (added)
- sar_mfs_add (sar_ctx, (mfs_t *)mfs);
-
- /* Add the first frame. */
- sar_msdu_add (sar_ctx, buffer, 1434, mfs, NULL, mac_ntb());
- /* Add the second frame. */
- sar_msdu_add (sar_ctx, buffer, 1334, mfs, NULL, mac_ntb());
-
- /* Release the reference on the MFS. */
- blk_release (mfs);
-}
-
-void
-verify_test (test_t test)
-{
- mfs_tx_t *mfs = NULL;
- pb_t *pb_first = NULL;
- pb_t *pb_last = NULL;
- sar_mf_t sar_mf;
- pb_t *pb_list[6 + 1];
- pb_t *pb_current = NULL;
- uint i = 0;
- u32 crc;
-
- mfs = mac_store_mfs_get_tx (mac_store, false, false, 1, 1);
- dbg_assert (mfs);
-
- test_case_begin (test, "SAR TX");
-
- test_begin (test, "Verify PBs")
- {
- test_fail_unless (count == 2);
- test_fail_unless (mfs->seg_nb == 6);
- test_fail_unless (mfs->fsm_state != MFS_FSM_CMD_RELEASE);
- test_fail_unless (mfs->head != NULL);
- test_fail_unless (mfs->tail!= NULL);
- test_fail_unless (mfs->head != mfs->tail);
- test_fail_unless (mfs->tail->header.ssn + 1 == mfs->seg_nb);
-
- pb_first = mfs->head;
- pb_last = mfs->tail;
- pb_last->next = NULL;
- mfs->head = NULL;
- mfs->tail = NULL;
-
- for (i = 0, pb_current = pb_first;
- pb_current;
- i++, pb_current = pb_current->next)
- {
- pb_list[i] = pb_current;
- arch_load_cache ((u32*) &(pb_current->header), 1);
- arch_load_cache ((u32*) (pb_current->data), BLK_SIZE / 4);
- test_fail_unless (pb_current->header.ssn == i);
- }
-
- /* Test the header mfbf and mfbo. */
- test_fail_unless (pb_list[0]->header.mfbf == true);
- test_fail_unless (pb_list[0]->header.mfbo == 0);
- test_fail_unless (pb_list[2]->header.mfbf == true);
- test_fail_unless (pb_list[2]->header.mfbo == 416);
-
- /* Verify the headers. */
- sar_mf_header (pb_list[0], 0, &sar_mf);
- test_fail_unless (sar_mf.type == SAR_MF_TYPE_DATA);
- test_fail_unless (sar_mf.length == 1434);
-
- sar_mf_header (pb_list[2], 416, &sar_mf);
- test_fail_unless (sar_mf.type == SAR_MF_TYPE_DATA);
- test_fail_unless (sar_mf.length == 1334);
-
- /* Verify the CRC. */
- crc = bitstream_direct_read (pb_list[2]->data, 412 * 8, 32);
- test_fail_unless (crc == crcb1);
-
- crc = bitstream_direct_read (pb_list[5]->data, 216 * 8, 32);
- test_fail_unless (crc == crcb2);
-
- sar_mfs_free_tx (sar_ctx, mfs);
- }
- test_end;
-
- blk_release (mfs);
-}
-
-void
-test_thread_process (cyg_addrword_t data)
-{
- test_t test;
- mac_config_t mac_config;
- uint ca;
- uint pbproc;
-
- test_init (test, 0, NULL);
- trace_init ();
- lib_stats_init ();
-
- /* Initialise the test. */
- mac_ntb_init (&mac_config);
- mac_store = mac_store_init ();
- sar_ctx = sar_init (mac_store, (pbproc_t *) &pbproc, (ca_t *) &ca, 0x1);
- sar_activate (sar_ctx, true);
-
- sar_init_data_context (sar_ctx, sar_ctx);
- sar_init_mme_context (sar_ctx, sar_ctx);
- sar_init_measurement_cb (sar_ctx, ce_measurements);
- sar_init_segmentation_data_cb (sar_ctx, segmentation_done);
- sar_init_segmentation_mme_cb (sar_ctx, segmentation_done);
-
- prepare_test (test);
-
- /* Wait the bridgedma ends its job. */
- cyg_thread_delay (1);
- verify_test (test);
-
- test_result (test);
-
- sar_uninit (sar_ctx);
- pbproc_uninit ((pbproc_t *) &pbproc);
-
- dbg_check (mac_store_sta_remove (mac_store, 0x1));
- mac_store_uninit (mac_store);
- mac_ntb_uninit();
- lib_stats_uninit ();
-
-#ifndef __sparc__
- HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
-#endif
-}
-
-int
-cyg_user_start (void)
-{
- // Create the thread.
- cyg_thread_create( 10,
- &test_thread_process,
- (cyg_addrword_t) 0,
- "TEST_THREAD",
- my_test_thread_stack,
- CYGNUM_HAL_STACK_SIZE_TYPICAL,
- &my_test_thread_handle,
- &my_test_thread);
- cyg_thread_resume (my_test_thread_handle);
-
- return 0;
-}