summaryrefslogtreecommitdiff
path: root/cesar/hal/phy/test/bridgedma-soft
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/hal/phy/test/bridgedma-soft')
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/Makefile13
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/sparc-Config1
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/sparc-Makefile31
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/sparc-ecos.ecc.sh5
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/src/bridgedma-crc-test.c359
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/src/bridgedma-init-test.c114
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/src/bridgedma-rx-test.c310
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/src/bridgedma-tx-test.c381
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/src/data.c545
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/src/test_bridgedma.c_old1003
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/synth-Config1
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/synth-Makefile26
-rw-r--r--cesar/hal/phy/test/bridgedma-soft/synth-ecos.ecc.sh5
13 files changed, 0 insertions, 2794 deletions
diff --git a/cesar/hal/phy/test/bridgedma-soft/Makefile b/cesar/hal/phy/test/bridgedma-soft/Makefile
deleted file mode 100644
index 27600eecea..0000000000
--- a/cesar/hal/phy/test/bridgedma-soft/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-all: synth sparc
-
-synth:
- $(MAKE) -f synth-Makefile
-
-sparc:
- $(MAKE) -f sparc-Makefile
-
-debug: $(TARGET_PROGRAMS)
- $(CROSS_COMPILE)objdump -DSt $< > $<.dis
-
-clean:
- rm -rf obj
diff --git a/cesar/hal/phy/test/bridgedma-soft/sparc-Config b/cesar/hal/phy/test/bridgedma-soft/sparc-Config
deleted file mode 100644
index ddad644109..0000000000
--- a/cesar/hal/phy/test/bridgedma-soft/sparc-Config
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_BRIDGEDMA_SOFT = y
diff --git a/cesar/hal/phy/test/bridgedma-soft/sparc-Makefile b/cesar/hal/phy/test/bridgedma-soft/sparc-Makefile
deleted file mode 100644
index fa08193943..0000000000
--- a/cesar/hal/phy/test/bridgedma-soft/sparc-Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-BASE = ../../../..
-
-TARGET = sparc
-
-ECOS = y
-
-TARGET_PROGRAMS = test-bridgedma-proto \
- test-bridgedma-proto-tx \
- test-bridgedma-proto-rx \
- test-bridgedma-proto-crc
-
-test-bridgedma-proto_SOURCES = bridgedma-init-test.c
-test-bridgedma-proto_MODULES = hal/phy lib
-
-test-bridgedma-proto-tx_SOURCES = bridgedma-tx-test.c
-test-bridgedma-proto-tx_MODULES = hal/phy lib
-
-test-bridgedma-proto-rx_SOURCES = bridgedma-rx-test.c
-test-bridgedma-proto-rx_MODULES = hal/phy lib
-
-test-bridgedma-proto-crc_SOURCES = bridgedma-crc-test.c
-test-bridgedma-proto-crc_MODULES = hal/phy lib
-
-hal_phy_MODULE_SOURCES = bridgedma_soft.c
-VARIANT = sparc
-include $(BASE)/common/make/top.mk
-
-all: $(TARGET_PROGRAMS:%=obj/sparc/%.lst)
-
-%.lst: %.elf
- $(CROSS_COMPILE)objdump -DSt $< > $@
diff --git a/cesar/hal/phy/test/bridgedma-soft/sparc-ecos.ecc.sh b/cesar/hal/phy/test/bridgedma-soft/sparc-ecos.ecc.sh
deleted file mode 100644
index db2208c6cc..0000000000
--- a/cesar/hal/phy/test/bridgedma-soft/sparc-ecos.ecc.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-config=${1:-ecos-gen.ecc}
-ecosconfig --config=$config new sparc_leon default
-cat >> $config <<'EOF'
-EOF
-ecosconfig --config=$config check
diff --git a/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-crc-test.c b/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-crc-test.c
deleted file mode 100644
index c42bd975c4..0000000000
--- a/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-crc-test.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file bridgedma-init-test.c
- * \brief « brief description »
- * \ingroup « module »
- *
- * « long description »
- */
-#include <cyg/kernel/kapi.h>
-#include <cyg/hal/hal_arch.h>
-
-#include "common/std.h"
-#include "common/defs/ethernet.h"
-
-#include "lib/test.h"
-#include "lib/list.h"
-#include "lib/bitstream.h"
-
-#include "hal/phy/inc/bridgedma.h"
-#include "hal/phy/inc/bridgedma_soft.h"
-
-#include "mac/common/pb.h"
-
-#include <string.h>
-#include <stdio.h>
-#include <cyg/infra/diag.h>
-
-#define START_OFFSET 128
-
-
-cyg_thread my_test_thread;
-cyg_handle_t my_test_thread_handle;
-u8 my_test_thread_stack [CYGNUM_HAL_STACK_SIZE_TYPICAL];
-
-pb_t *my_pb_first;
-pb_t *my_pb_last;
-phy_bridgedma_job_t *job_current;
-
-phy_bridgedma_job_t job1;
-phy_bridgedma_t *bridgedma_ctx;
-u8 frame_buffer [2048] __attribute__((aligned(2048)));
-crc_t crc_ctx;
-blk_t *pb_first, *pb_last, *pb_current;
-u32 mf_header;
-u32 enc_tab[256];
-uint ats;
-
-/* WARNING: callback are not possible to test inside UNIT TEST */
-bool _bridgedma_segmentation_cb(void *data, u32 status)
-{
- // If no more jobs to process by the bridgedma wake up the test thread to
- // continue
- if (!job_current)
- {
- cyg_thread_resume (my_test_thread_handle);
- }
-
- if (job_current)
- {
- diag_printf ("----- Bridge Cb ----\n");
- diag_printf ("SSN : %d\n",
- ((pb_t*)job_current->first_pb_desc)->header.ssn);
- diag_printf ("offset : %d\n", job_current->first_pb_offset);
- diag_printf ("length : %d\n", read_u16_from_word
- (((pb_t *)job_current->first_pb_desc)->data +
- job_current->first_pb_offset) >> 2);
- diag_printf ("---- END Bridge Cb ----\n");
- }
-
- job_current = job_current->next;
- return true;
-}
-
-/* WARNING: callback are not possible to test inside UNIT TEST */
-void _bridgedma_deffered_cb(void *data)
-{
-}
-
-void bridgedma_init_test_case(test_t t)
-{
- int user_data;
-
- test_case_begin(t, "init");
-
- test_begin(t, "init")
- {
- bridgedma_ctx = NULL;
- bridgedma_ctx = phy_bridgedma_init(&user_data, _bridgedma_segmentation_cb, _bridgedma_deffered_cb);
- test_fail_unless(
- (bridgedma_ctx != NULL)
- && (bridgedma_ctx->job_first == NULL)
- && (bridgedma_ctx->job_current == NULL)
- && (bridgedma_ctx->job_last == NULL)
- && (bridgedma_ctx->user_data == &user_data)
- && (bridgedma_ctx->bridgedma_cb == _bridgedma_segmentation_cb)
- && (bridgedma_ctx->deferred_cb == _bridgedma_deffered_cb)
- && !bridgedma_ctx->status.running
- && bridgedma_ctx->status.stop
- );
- } test_end;
- return;
-}
-
-void bridgedma_segmentation_test_case(test_t t)
-{
- uint i;
- pb_t *my_current;
- dbg_assert (bridgedma_ctx);
- test_case_begin(t, "segmentation");
-
- pb_first = blk_alloc_desc_range(4, &pb_last);
- pb_last->next = NULL;
-
- my_pb_first = (pb_t *) pb_first;
- my_pb_last = (pb_t *)pb_last;
-
- my_current = my_pb_first;
- for (i = 0; i < 4; i++)
- {
- my_current->header.ssn = i;
- my_current = my_current->next;
- }
-
- ats = 0x12345678;
-
- /************************************************************************
- * simple segmentation with 3 mac frames into 5 PBs
- * 1st mac frame: len=1518, offset=128, ATS, ICV into 1st to 4th PB
- * 2nd mac frame: len=64, ATS, ICV into 4th PB
- * 3nd mac frame: len=466, ATS, ICV, padding into 4th to 5th PB
- ***********************************************************************/
-
- memset(&job1, '\0', sizeof(job1));
- job1.next = NULL;
- job1.data_addr = frame_buffer;
- job1.header_len = 6;
- job1.data_len = ETH_PACKET_MAX_SIZE;
- job1.first_pb_desc = pb_first;
- job1.first_pb_offset = START_OFFSET;
- job1.segment_len = 512;
- job1.direction = 0;
- job1.crc_reset = 1;
- job1.crc_store = 1;
- job1.job_it = 1;
- job1.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
- job1.mf_header1 = (((job1.data_len + 4 - 1) << 2) | 0x02) | (ats << 16); /* Payload + ATS */
- job1.mf_header2 = (ats >> 16);
-
- job_current = &job1;
- phy_bridgedma_start (bridgedma_ctx, &job1, &job1);
-
- return;
-}
-
-void
-bridgedma_segmentation_crc_verify_test_case (test_t test)
-{
- uint payload_cnt;
- uint crc_current;
- pb_t *my_pb_current;
-
- uint i;
- uint length;
- uint pb_offset;
- uint qte_pb;
- uint frame_offset;
- bool cont;
-
- 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);
-
- test_begin(test, "segmentation of 1 frames")
- {
- for (i = 0, my_pb_current = my_pb_first; my_pb_current; my_pb_current =
- my_pb_current->next, i++)
- {
- test_fail_if (my_pb_current->header.ssn != i, "Wong sequence");
- }
-
- /* check pb content */
- /* check 1st mac frame into PB */
- payload_cnt = 0;
-
- pb_offset = START_OFFSET;
- job_current = &job1;
- frame_offset = 0;
- pb_current = pb_first;
-
- cont = true;
- length = 1 + (read_u16_from_word (pb_current->data + pb_offset) >> 2);
-
- // To get the payload length, the frame length is 10
- // bytes greater.
- length -= 4;
-
- diag_printf ("Length read in pb : %d\n", length);
- diag_printf ("pb ssn : %d\n", ((pb_t *)pb_current)->header.ssn);
- diag_printf ("pb offset : %d\n", pb_offset);
- test_fail_unless (length == job_current->data_len,
- "Data length is wrong.");
-
- // Copy the data of the current pb.
-
- // Jump directly to the start of the payload.
- pb_offset += 6;
- if (length + pb_offset > BLK_SIZE)
- {
- test_fail_unless (
- bitstream_memcmp (frame_buffer + frame_offset,
- pb_current->data + pb_offset,
- BLK_SIZE - pb_offset),
- "data corrupted");
- frame_offset += BLK_SIZE - pb_offset;
- length -= BLK_SIZE - pb_offset;
- }
- else
- {
- test_fail_unless (
- bitstream_memcmp (frame_buffer + frame_offset,
- pb_current->data + pb_offset,
- length),
- "data corrupted");
- frame_offset += length;
- cont = false;
- }
-
-
- if (cont)
- {
- // Add 10 to the length to use the complete MF length
- // (ATS + MFH + ICV), the ATS and MFH are already include in the
- // pb_offset.
- for (qte_pb = (pb_offset + length + 4) / BLK_SIZE + 1;
- qte_pb;
- qte_pb --)
- {
- pb_current = pb_current->next;
-
- if (length > BLK_SIZE)
- {
- test_fail_unless(
- bitstream_memcmp (frame_buffer + frame_offset,
- pb_current->data ,
- BLK_SIZE),
- "data corrupted");
- length -= BLK_SIZE;
- frame_offset += BLK_SIZE;
- }
- else
- {
- test_fail_unless(
- bitstream_memcmp (frame_buffer + frame_offset,
- pb_current->data ,
- length),
- "data corrupted");
- frame_offset += length;
- }
- }
- }
-
- // The future offset is length + 4 cause of the ICV of the MF.
- // The ATS and the MFH has already been jumped above in the
- // pb_offset.
- pb_offset = (pb_offset + job_current->data_len + 4) % BLK_SIZE;
- } test_end;
-
- test_begin (test, "Verify CRC")
- {
- uint mf_length;
- uint offset;
- uint crc_pb;
- u8 buffer_reconstitute [2048] __attribute__((aligned(2048)));
-
- mf_length = (read_u16_from_word((u8 *) &job1.mf_header1)>> 2) + 3;
- offset = (job1.first_pb_offset + mf_length) % BLK_SIZE;
-
- crc_pb = read_u32_from_word (my_pb_last->data + offset);
-
- bitstream_memcpy (buffer_reconstitute, frame_buffer,
- ETH_PACKET_MAX_SIZE);
-
- crc_current = bridgedma_crc_compute_block (&crc_ctx, buffer_reconstitute,
- job1.data_len);
-
- diag_printf ("Data length = %d\n", mf_length);
- diag_printf ("ICV pos = %d\n", offset);
-
- diag_printf ("CRC pb = %x\n", crc_pb);
- diag_printf ("CRC frame = %x\n", crc_current);
- test_fail_if (crc_current != crc_pb, "Wrong CRC computed");
- }
- test_end;
-
- blk_release_desc_range((blk_t *)my_pb_first, (blk_t *) my_pb_last);
-}
-
-void
-test_thread_process (cyg_addrword_t data)
-{
- test_t *test;
-
- test = (test_t *) data;
-
- bridgedma_init_test_case (*test);
- bridgedma_segmentation_test_case (*test);
- bridgedma_segmentation_crc_verify_test_case (*test);
-
- phy_bridgedma_uninit (bridgedma_ctx);
-
- test_result (*test);
-
-#ifndef __sparc__
- HAL_PLATFORM_EXIT (test_nb_failed (*test) == 0 ? 0 : 1);
-#endif
-}
-
-int
-main (void)
-{
- test_t test;
- uint i;
-
- test_init (test, 0, NULL);
-
- pb_first = NULL;
- pb_last = NULL;
-
- my_pb_first = NULL;
- my_pb_last = NULL;
-
- for (i = 0; i < 2048; i++)
- frame_buffer[i] = i;
-
- // Create the thread.
- cyg_thread_create( 9,
- &test_thread_process,
- (cyg_addrword_t) &test,
- "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;
-}
diff --git a/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-init-test.c b/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-init-test.c
deleted file mode 100644
index d228179036..0000000000
--- a/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-init-test.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file bridgedma-init-test.c
- * \brief « brief description »
- * \ingroup « module »
- *
- * « long description »
- */
-#include <cyg/kernel/kapi.h>
-#include <cyg/hal/hal_arch.h>
-
-#include "common/std.h"
-#include "common/defs/ethernet.h"
-
-#include "lib/test.h"
-#include "lib/list.h"
-#include "lib/bitstream.h"
-
-#include "hal/phy/inc/bridgedma.h"
-#include "hal/phy/inc/bridgedma_soft.h"
-
-#include "mac/common/pb.h"
-
-#include <string.h>
-#include <stdio.h>
-#include <cyg/infra/diag.h>
-
-#define START_OFFSET 128
-
-cyg_thread my_test_thread;
-cyg_handle_t my_test_thread_handle;
-u8 my_test_thread_stack [CYGNUM_HAL_STACK_SIZE_TYPICAL];
-
-phy_bridgedma_t *bridgedma_ctx;
-
-/* WARNING: callback are not possible to test inside UNIT TEST */
-bool _bridgedma_segmentation_cb(void *data, u32 status)
-{
- return true;
-}
-
-/* WARNING: callback are not possible to test inside UNIT TEST */
-void _bridgedma_deffered_cb(void *data)
-{
-}
-
-void bridgedma_init_test_case(test_t t)
-{
- int user_data;
-
- test_case_begin(t, "init");
-
- test_begin(t, "init")
- {
- bridgedma_ctx = NULL;
- bridgedma_ctx = phy_bridgedma_init(&user_data, _bridgedma_segmentation_cb, _bridgedma_deffered_cb);
- test_fail_unless(
- (bridgedma_ctx != NULL)
- && (bridgedma_ctx->job_first == NULL)
- && (bridgedma_ctx->job_current == NULL)
- && (bridgedma_ctx->job_last == NULL)
- && (bridgedma_ctx->user_data == &user_data)
- && (bridgedma_ctx->bridgedma_cb == _bridgedma_segmentation_cb)
- && (bridgedma_ctx->deferred_cb == _bridgedma_deffered_cb)
- && !bridgedma_ctx->status.running
- && bridgedma_ctx->status.stop
- );
- } test_end;
- return;
-}
-
-void
-test_thread_process (cyg_addrword_t data)
-{
- test_t *test;
-
- test = (test_t *) data;
-
- bridgedma_init_test_case (*test);
- phy_bridgedma_uninit (bridgedma_ctx);
-
- test_result (*test);
-
-#ifndef __sparc__
- HAL_PLATFORM_EXIT (test_nb_failed (*test) == 0 ? 0 : 1);
-#endif
-}
-
-int
-main (void)
-{
- test_t test;
-
- test_init (test, 0, NULL);
-
- // Create the thread.
- cyg_thread_create( 9,
- &test_thread_process,
- (cyg_addrword_t) &test,
- "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;
-}
diff --git a/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-rx-test.c b/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-rx-test.c
deleted file mode 100644
index 890ac8a4db..0000000000
--- a/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-rx-test.c
+++ /dev/null
@@ -1,310 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file bridgedma-init-test.c
- * \brief « brief description »
- * \ingroup « module »
- *
- * « long description »
- */
-#include <cyg/kernel/kapi.h>
-#include <cyg/hal/hal_arch.h>
-
-#include "common/std.h"
-#include "common/defs/ethernet.h"
-
-#include "lib/test.h"
-#include "lib/list.h"
-#include "lib/bitstream.h"
-
-#include "hal/phy/inc/bridgedma.h"
-#include "hal/phy/inc/bridgedma_soft.h"
-
-#include "mac/common/pb.h"
-
-#include <string.h>
-#include <stdio.h>
-#include <cyg/infra/diag.h>
-
-#define START_OFFSET 128
-
-cyg_thread my_test_thread;
-cyg_handle_t my_test_thread_handle;
-u8 my_test_thread_stack [CYGNUM_HAL_STACK_SIZE_TYPICAL];
-
-pb_t *my_pb_first;
-pb_t *my_pb_last;
-phy_bridgedma_job_t *job_current;
-
-phy_bridgedma_job_t job1, job2, job3;
-phy_bridgedma_t *bridgedma_ctx;
-u8 frame_buffer [2048] __attribute__((aligned(2048)));
-u8 eth_buffer [2048] __attribute__((aligned(2048)));
-
-crc_t crc_ctx;
-blk_t *pb_first, *pb_last, *pb_current;
-u32 mf_header;
-u32 enc_tab[256];
-uint ats;
-
-/* WARNING: callback are not possible to test inside UNIT TEST */
-bool _bridgedma_reassembly_cb(void *data, u32 status)
-{
- // If no more jobs to process by the bridgedma wake up the test thread to
- // continue
- if (!job_current)
- {
- cyg_thread_resume (my_test_thread_handle);
- }
-
- if (job_current)
- {
- diag_printf ("----- Bridge Cb ----\n");
- diag_printf ("SSN : %d\n",
- ((pb_t*)job_current->first_pb_desc)->header.ssn);
- diag_printf ("offset : %d\n", job_current->first_pb_offset);
- diag_printf ("length : %d\n", read_u16_from_word
- (((pb_t *)job_current->first_pb_desc)->data +
- job_current->first_pb_offset) >> 2);
- diag_printf ("---- END Bridge Cb ----\n");
- }
-
- job_current = job_current->next;
- return true;
-}
-
-/* WARNING: callback are not possible to test inside UNIT TEST */
-void _bridgedma_deffered_cb(void *data)
-{
-}
-
-void bridgedma_init_test_case(test_t t)
-{
- int user_data;
-
- test_case_begin(t, "init");
-
- test_begin(t, "init")
- {
- bridgedma_ctx = NULL;
- bridgedma_ctx = phy_bridgedma_init(&user_data, _bridgedma_reassembly_cb, _bridgedma_deffered_cb);
- test_fail_unless(
- (bridgedma_ctx != NULL)
- && (bridgedma_ctx->job_first == NULL)
- && (bridgedma_ctx->job_current == NULL)
- && (bridgedma_ctx->job_last == NULL)
- && (bridgedma_ctx->user_data == &user_data)
- && (bridgedma_ctx->bridgedma_cb == _bridgedma_reassembly_cb)
- && (bridgedma_ctx->deferred_cb == _bridgedma_deffered_cb)
- && !bridgedma_ctx->status.running
- && bridgedma_ctx->status.stop
- );
- } test_end;
- return;
-}
-
-void
-bridgedma_reassembly_test_case (test_t test)
-{
- uint user_data;
- uint data_cnt;
- uint payload_cnt;
- uint crc_current;
- uint data_bitstream;
- bitstream_t bitstream;
- test_case_begin(test, "reassembly");
-
- bridgedma_ctx = phy_bridgedma_init(&user_data, _bridgedma_reassembly_cb, _bridgedma_deffered_cb);
-
- pb_first = blk_alloc_desc_range(4, &pb_last);
- 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);
-
- /***********************************************************************
- * simple reassembly from 3 mac frames into 5 PBs
- * 1st mac frame: len=1024, mac-offset=1536, pb-offset=128, ATS, ICV into 1st to 3rd PB
- * 2nd : len=512, no-ATS, ICV into 3rd to 4th pb
- * 3rd : len=256, no-ATS, ICV, padding into 4th PB
- ***********************************************************************/
- pb_current = pb_first;
- data_cnt = START_OFFSET;
- payload_cnt = 0;
- crc_current = crc_compute_begin(&crc_ctx);
-
- bitstream_init (&bitstream, pb_current->data + data_cnt, 6,
- BITSTREAM_WRITE);
- data_bitstream = ((1024 + 4 - 1) << 2) | 0x02;
- bitstream_access (&bitstream, &data_bitstream, 16);
- data_bitstream = 0x12345678;
- bitstream_access (&bitstream, &data_bitstream, 32);
- bitstream_finalise (&bitstream);
- data_cnt += 2;
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, pb_current->data + data_cnt, 4);
- data_cnt += 4;
- bitstream_memcpy(pb_current->data + data_cnt, frame_buffer, 512 - data_cnt);
- payload_cnt += 512 - data_cnt;
- pb_current = pb_current->next;
- bitstream_memcpy(pb_current->data, frame_buffer + payload_cnt, 512);
- payload_cnt += 512;
- pb_current = pb_current->next;
- bitstream_memcpy(pb_current->data, frame_buffer + payload_cnt, 1024 - payload_cnt);
- data_cnt = 1024 - payload_cnt;
- payload_cnt = 1024;
- data_cnt += 4;
-
- data_bitstream = ((512 - 1) << 2) | 0x01;
- bitstream_init (&bitstream, pb_current->data + data_cnt, 6,
- BITSTREAM_WRITE);
- bitstream_access (&bitstream, &data_bitstream, 16);
- bitstream_finalise (&bitstream);
-
- data_cnt += 2;
- bitstream_memcpy(pb_current->data + data_cnt, frame_buffer + payload_cnt, 512 - data_cnt);
- payload_cnt += 512 - data_cnt;
- pb_current = pb_current->next;
- bitstream_memcpy(pb_current->data, frame_buffer + payload_cnt, 1024 + 512 - payload_cnt);
- data_cnt = 1024 + 512 - payload_cnt;
- payload_cnt = 1024 + 512;
- data_cnt += 4;
-
- bitstream_init (&bitstream, pb_current->data + data_cnt, 2,
- BITSTREAM_WRITE);
- data_bitstream = ((256 - 1) << 2) | 0x01;
- bitstream_access (&bitstream, &data_bitstream, 16);
- bitstream_finalise (&bitstream);
- data_cnt += 2;
- bitstream_memcpy(pb_current->data + data_cnt, frame_buffer + payload_cnt, 256);
- payload_cnt += 256;
- data_cnt += 256;
- data_cnt += 4;
-
- memset(pb_current->data + data_cnt, '\0', 512 - data_cnt);
-
- /* prepare jobs */
- memset(&job1, '\0', sizeof(job1));
- job1.next = &job2;
- job1.data_addr = eth_buffer + 1536;
- job1.header_len = 6;
- job1.data_len = 1024;
- job1.first_pb_desc = pb_first;
- job1.first_pb_offset = START_OFFSET;
- job1.segment_len = 512;
- job1.direction = 1;
- job1.crc_reset = 1;
- job1.crc_store = 1;
- job1.job_it = 1;
- job1.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
-
- memset(&job2, '\0', sizeof(job2));
- job2.next = &job3;
- job2.data_addr = eth_buffer + 512;
- job2.header_len = 2;
- job2.data_len = 512;
- job2.first_pb_desc = pb_first->next->next; /* 3rd PB */
- job2.first_pb_offset = (START_OFFSET + job1.data_len + 10) % 512;
- job2.segment_len = 512;
- job2.direction = 1;
- job2.crc_reset = 1;
- job3.crc_store = 1;
- job2.job_it = 1;
- job2.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
-
- memset(&job3, '\0', sizeof(job3));
- job3.next = NULL;
- job3.data_addr = eth_buffer + 1024;
- job3.header_len = 2;
- job3.data_len = 256;
- job3.first_pb_desc = pb_first->next->next->next; /* 4th PB */
- job3.first_pb_offset = (START_OFFSET + job1.data_len + 10 + job2.data_len + 6) % 512;
- job3.segment_len = 512;
- job3.last = 1;
- job3.direction = 1;
- job3.crc_reset = 1;
- job3.crc_store = 1;
- job3.job_it = 1;
- job3.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
-
- job_current = &job1;
- phy_bridgedma_start(bridgedma_ctx, &job1, &job3);
-}
-
-void
-bridgedma_reassembly_verify_test_case (test_t test)
-{
- test_begin (test, "Verify data.")
- {
- test_fail_unless (!bitstream_memcmp (eth_buffer, frame_buffer,
- sizeof(frame_buffer)));
- }
- test_end;
-}
-
-
-void
-test_thread_process (cyg_addrword_t data)
-{
- test_t *test;
- uint i;
-
- for (i = 0; i < sizeof (frame_buffer); i++)
- {
- frame_buffer[i] = i;
- }
-
- test = (test_t *) data;
-
- bridgedma_init_test_case (*test);
-
- bridgedma_reassembly_test_case (*test);
- bridgedma_reassembly_verify_test_case (*test);
- phy_bridgedma_uninit (bridgedma_ctx);
-
- test_result (*test);
-
-#ifndef __sparc__
- HAL_PLATFORM_EXIT (test_nb_failed (*test) == 0 ? 0 : 1);
-#endif
-}
-
-int
-main (void)
-{
- test_t test;
- uint i;
-
- test_init (test, 0, NULL);
-
- pb_first = NULL;
- pb_last = NULL;
-
- my_pb_first = NULL;
- my_pb_last = NULL;
-
- for (i = 0; i < 2048; i++)
- frame_buffer[i] = i;
-
- // Create the thread.
- cyg_thread_create( 9,
- &test_thread_process,
- (cyg_addrword_t) &test,
- "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;
-}
diff --git a/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-tx-test.c b/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-tx-test.c
deleted file mode 100644
index acaf6c27ac..0000000000
--- a/cesar/hal/phy/test/bridgedma-soft/src/bridgedma-tx-test.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file bridgedma-init-test.c
- * \brief « brief description »
- * \ingroup « module »
- *
- * « long description »
- */
-#include <cyg/kernel/kapi.h>
-#include <cyg/hal/hal_arch.h>
-
-#include "common/std.h"
-#include "common/defs/ethernet.h"
-
-#include "lib/test.h"
-#include "lib/list.h"
-#include "lib/bitstream.h"
-
-#include "hal/phy/inc/bridgedma.h"
-#include "hal/phy/inc/bridgedma_soft.h"
-
-#include "mac/common/pb.h"
-
-#include <string.h>
-#include <stdio.h>
-#include <cyg/infra/diag.h>
-
-#define START_OFFSET 128
-
-cyg_thread my_test_thread;
-cyg_handle_t my_test_thread_handle;
-u8 my_test_thread_stack [CYGNUM_HAL_STACK_SIZE_TYPICAL];
-
-pb_t *my_pb_first;
-pb_t *my_pb_last;
-phy_bridgedma_job_t *job_current;
-
-phy_bridgedma_job_t job1, job2, job3;
-phy_bridgedma_t *bridgedma_ctx;
-u8 frame_buffer [2048] __attribute__((aligned(2048)));
-crc_t crc_ctx;
-blk_t *pb_first, *pb_last, *pb_current;
-u32 mf_header;
-u32 enc_tab[256];
-uint ats;
-
-/* WARNING: callback are not possible to test inside UNIT TEST */
-bool _bridgedma_segmentation_cb(void *data, u32 status)
-{
- // If no more jobs to process by the bridgedma wake up the test thread to
- // continue
- if (!job_current)
- {
- cyg_thread_resume (my_test_thread_handle);
- }
-
- if (job_current)
- {
- diag_printf ("----- Bridge Cb ----\n");
- diag_printf ("SSN : %d\n",
- ((pb_t*)job_current->first_pb_desc)->header.ssn);
- diag_printf ("offset : %d\n", job_current->first_pb_offset);
- diag_printf ("length : %d\n", read_u16_from_word
- (((pb_t *)job_current->first_pb_desc)->data +
- job_current->first_pb_offset) >> 2);
- diag_printf ("---- END Bridge Cb ----\n");
- }
-
- job_current = job_current->next;
- return true;
-}
-
-/* WARNING: callback are not possible to test inside UNIT TEST */
-void _bridgedma_deffered_cb(void *data)
-{
-}
-
-void bridgedma_init_test_case(test_t t)
-{
- int user_data;
-
- test_case_begin(t, "init");
-
- test_begin(t, "init")
- {
- bridgedma_ctx = NULL;
- bridgedma_ctx = phy_bridgedma_init(&user_data, _bridgedma_segmentation_cb, _bridgedma_deffered_cb);
- test_fail_unless(
- (bridgedma_ctx != NULL)
- && (bridgedma_ctx->job_first == NULL)
- && (bridgedma_ctx->job_current == NULL)
- && (bridgedma_ctx->job_last == NULL)
- && (bridgedma_ctx->user_data == &user_data)
- && (bridgedma_ctx->bridgedma_cb == _bridgedma_segmentation_cb)
- && (bridgedma_ctx->deferred_cb == _bridgedma_deffered_cb)
- && !bridgedma_ctx->status.running
- && bridgedma_ctx->status.stop
- );
- } test_end;
- return;
-}
-
-void bridgedma_segmentation_test_case(test_t t)
-{
- uint i;
- pb_t *my_current;
- dbg_assert (bridgedma_ctx);
- test_case_begin(t, "segmentation");
-
- pb_first = blk_alloc_desc_range(5, &pb_last);
- pb_last->next = NULL;
-
- my_pb_first = (pb_t *) pb_first;
- my_pb_last = (pb_t *)pb_last;
-
- my_current = my_pb_first;
- for (i = 0; i < 5; i++)
- {
- my_current->header.ssn = i;
- my_current = my_current->next;
- }
-
- 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);
- ats = 0x12345678;
-
- /************************************************************************
- * simple segmentation with 3 mac frames into 5 PBs
- * 1st mac frame: len=1518, offset=128, ATS, ICV into 1st to 4th PB
- * 2nd mac frame: len=64, ATS, ICV into 4th PB
- * 3nd mac frame: len=466, ATS, ICV, padding into 4th to 5th PB
- ***********************************************************************/
-
- memset(&job1, '\0', sizeof(job1));
- job1.next = &job2;
- job1.data_addr = frame_buffer;
- job1.header_len = 6;
- job1.data_len = ETH_PACKET_MAX_SIZE;
- job1.first_pb_desc = pb_first;
- job1.first_pb_offset = START_OFFSET;
- job1.segment_len = 512;
- job1.direction = 0;
- job1.crc_reset = 1;
- job1.crc_store = 1;
- job1.job_it = 1;
- job1.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
- job1.mf_header1 = (((job1.data_len + 4 - 1) << 2) | 0x02) | (ats << 16); /* Payload + ATS */
- job1.mf_header2 = (ats >> 16);
-
- memset(&job2, '\0', sizeof(job2));
- job2.next = &job3;
- job2.data_addr = frame_buffer + job1.data_len;
- job2.header_len = 6;
- job2.data_len = ETH_PACKET_MIN_SIZE;
- job2.first_pb_desc = pb_first->next->next->next; /* 4th PB */
- job2.first_pb_offset = (START_OFFSET + job1.data_len + 10) % 512;
- job2.segment_len = 512;
- job2.direction = 0;
- job2.crc_reset = 1;
- job2.crc_store = 1;
- job2.job_it = 1;
- job2.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
- job2.mf_header1 = (((job2.data_len + 4 - 1) << 2) | 0x02) | (ats << 16); /* Payload + ATS */
- job2.mf_header2 = (ats >> 16);
-
- memset(&job3, '\0', sizeof(job3));
- job3.next = NULL;
- job3.data_addr = frame_buffer + job1.data_len + job2.data_len;
- job3.header_len = 6;
- job3.data_len = sizeof(frame_buffer) - ETH_PACKET_MAX_SIZE - ETH_PACKET_MIN_SIZE;
- job3.first_pb_desc = pb_first->next->next->next; /* 4th PB */
- job3.first_pb_offset = (START_OFFSET + job1.data_len + 10 + job2.data_len + 10) % 512;
- job3.segment_len = 512;
- job3.last = 1;
- job3.direction = 0;
- job3.crc_reset = 1;
- job3.crc_store = 1;
- job3.append_zero = 1;
- job3.job_it = 1;
- job3.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
- job3.mf_header1 = (((job3.data_len + 4 - 1) << 2) | 0x02) | (ats << 16); /* Payload + ATS */
- job3.mf_header2 = (ats >> 16);
-
- job_current = &job1;
- phy_bridgedma_start (bridgedma_ctx, &job1, &job3);
-
- return;
-}
-
-void
-bridgedma_segmentation_verify_test_case (test_t test)
-{
- uint payload_cnt;
- uint crc_current;
- pb_t *my_pb_current;
-
- uint i;
- uint length;
- uint pb_offset;
- uint qte_pb;
- uint frame_offset;
- bool cont;
-
- test_begin(test, "segmentation of 3 frames")
- {
- for (i = 0, my_pb_current = my_pb_first; my_pb_current; my_pb_current =
- my_pb_current->next, i++)
- {
- test_fail_if (my_pb_current->header.ssn != i, "Wong sequence");
- }
-
- /* check pb content */
- /* check 1st mac frame into PB */
- payload_cnt = 0;
- crc_current = crc_compute_begin(&crc_ctx);
-
- pb_offset = START_OFFSET;
- job_current = &job1;
- frame_offset = 0;
- for (pb_current = pb_first, i = 0; i < 3; i++, job_current =
- job_current->next)
- {
- cont = true;
- length = 1 + (read_u16_from_word (pb_current->data + pb_offset) >> 2);
-
- // To get the payload length, the frame length is 10
- // bytes greater.
- length -= 4;
-
- diag_printf ("Length read in pb : %d\n", length);
- diag_printf ("pb ssn : %d\n", ((pb_t *)pb_current)->header.ssn);
- diag_printf ("pb offset : %d\n", pb_offset);
- test_fail_unless (length == job_current->data_len,
- "Data length is wrong.");
-
- // Copy the data of the current pb.
-
- // Jump directly to the start of the payload.
- pb_offset += 6;
- if (length + pb_offset > BLK_SIZE)
- {
- test_fail_unless (
- bitstream_memcmp (frame_buffer + frame_offset,
- pb_current->data + pb_offset,
- BLK_SIZE - pb_offset),
- "data corrupted");
-
- frame_offset += BLK_SIZE - pb_offset;
- length -= BLK_SIZE - pb_offset;
- }
- else
- {
- test_fail_unless (
- bitstream_memcmp (frame_buffer + frame_offset,
- pb_current->data + pb_offset,
- length),
- "data corrupted");
-
- frame_offset += length;
- cont = false;
- }
-
-
- if (cont)
- {
- // Add 10 to the length to use the complete MF length
- // (ATS + MFH + ICV), the ATS and MFH are already include in the
- // pb_offset.
- for (qte_pb = (pb_offset + length + 4) / BLK_SIZE + 1;
- qte_pb;
- qte_pb --)
- {
- pb_current = pb_current->next;
-
- if (length > BLK_SIZE)
- {
- test_fail_unless(
- bitstream_memcmp (frame_buffer + frame_offset,
- pb_current->data ,
- BLK_SIZE),
- "data corrupted");
-
- length -= BLK_SIZE;
- frame_offset += BLK_SIZE;
- }
- else
- {
- test_fail_unless(
- bitstream_memcmp (frame_buffer + frame_offset,
- pb_current->data ,
- length),
- "data corrupted");
-
- frame_offset += length;
- }
- }
- }
-
- // The futur offset is length + 4 cause of the ICV of the MF.
- // The ATS and the MFH has already been jumped above in the
- // pb_offset.
- pb_offset = (pb_offset + job_current->data_len + 4) % BLK_SIZE;
- }
- } test_end;
-
- blk_release_desc_range((blk_t *)my_pb_first, (blk_t *) my_pb_last);
-}
-
-void
-test_thread_process (cyg_addrword_t data)
-{
- test_t *test;
-
- test = (test_t *) data;
-
- bridgedma_init_test_case (*test);
-
- bridgedma_segmentation_test_case (*test);
-
-
- /* Just to test. */
- diag_printf ("Job 1 header : %x\n", job1.mf_header1);
- diag_printf ("Job 2 header : %x\n", job2.mf_header1);
- diag_printf ("Job 3 header : %x\n", job3.mf_header1);
-
- /* */
-
- bridgedma_segmentation_verify_test_case (*test);
-
- phy_bridgedma_uninit (bridgedma_ctx);
-
- test_result (*test);
-
-#ifndef __sparc__
- HAL_PLATFORM_EXIT (test_nb_failed (*test) == 0 ? 0 : 1);
-#endif
-}
-
-int
-main (void)
-{
- test_t test;
- uint i;
-
- test_init (test, 0, NULL);
-
- pb_first = NULL;
- pb_last = NULL;
-
- my_pb_first = NULL;
- my_pb_last = NULL;
-
- for (i = 0; i < 2048; i++)
- frame_buffer[i] = i;
-
- // Create the thread.
- cyg_thread_create( 9,
- &test_thread_process,
- (cyg_addrword_t) &test,
- "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;
-}
diff --git a/cesar/hal/phy/test/bridgedma-soft/src/data.c b/cesar/hal/phy/test/bridgedma-soft/src/data.c
deleted file mode 100644
index 636bf51fce..0000000000
--- a/cesar/hal/phy/test/bridgedma-soft/src/data.c
+++ /dev/null
@@ -1,545 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2008 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file bridgedma-init-test.c
- * \brief « brief description »
- * \ingroup « module »
- *
- * « long description »
- */
-#include <cyg/kernel/kapi.h>
-#include <cyg/hal/hal_arch.h>
-
-#include "common/std.h"
-#include "common/defs/ethernet.h"
-
-#include "lib/test.h"
-#include "lib/list.h"
-
-#include "hal/phy/inc/bridgedma.h"
-#include "hal/phy/inc/bridgedma_proto.h"
-
-#include "mac/common/pb.h"
-
-#include <string.h>
-#include <stdio.h>
-#include <cyg/infra/diag.h>
-
-#define START_OFFSET 128
-
-cyg_thread my_test_thread;
-cyg_handle_t my_test_thread_handle;
-u8 my_test_thread_stack [CYGNUM_HAL_STACK_SIZE_TYPICAL];
-
-pb_t *my_pb_first;
-pb_t *my_pb_last;
-phy_bridgedma_job_t *job_current;
-
-phy_bridgedma_job_t job1, job2, job3;
-phy_bridgedma_t *bridgedma_ctx;
-u8 frame_buffer [2048] __attribute__((aligned(2048)));
-crc_t crc_ctx;
-blk_t *pb_first, *pb_last, *pb_current;
-u32 mf_header;
-u32 enc_tab[256];
-uint ats;
-
-/* WARNING: callback are not possible to test inside UNIT TEST */
-bool _bridgedma_segmentation_cb(void *data, u32 status)
-{
- job_current = job_current->next;
-
- // If no more jobs to process by the bridgedma wake up the test thread to
- // continue
- if (!job_current)
- {
- cyg_thread_resume (my_test_thread_handle);
- }
-
- return true;
-}
-
-/* WARNING: callback are not possible to test inside UNIT TEST */
-void _bridgedma_deffered_cb(void *data)
-{
-}
-
-void bridgedma_init_test_case(test_t t)
-{
- int user_data;
-
- test_case_begin(t, "init");
-
- test_begin(t, "init")
- {
- bridgedma_ctx = NULL;
- bridgedma_ctx = phy_bridgedma_init(&user_data, _bridgedma_segmentation_cb, _bridgedma_deffered_cb);
- test_fail_unless(
- (bridgedma_ctx != NULL)
- && (bridgedma_ctx->job_first == NULL)
- && (bridgedma_ctx->job_current == NULL)
- && (bridgedma_ctx->job_last == NULL)
- && (bridgedma_ctx->user_data == &user_data)
- && (bridgedma_ctx->bridgedma_cb == _bridgedma_segmentation_cb)
- && (bridgedma_ctx->deferred_cb == _bridgedma_deffered_cb)
- && !bridgedma_ctx->status.running
- && bridgedma_ctx->status.stop
- );
- } test_end;
- return;
-}
-
-void bridgedma_segmentation_test_case(test_t t)
-{
- uint i;
- pb_t *my_current;
- dbg_assert (bridgedma_ctx);
- test_case_begin(t, "segmentation");
-
- pb_first = blk_alloc_desc_range(5, &pb_last);
- pb_last->next = NULL;
-
- my_pb_first = (pb_t *) pb_first;
- my_pb_last = (pb_t *)pb_last;
-
- my_current = my_pb_first;
- for (i = 0; i < 5; i++)
- {
- my_current->header.ssn = i;
- my_current = my_current->next;
- }
-
- 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);
- ats = 0x12345678;
-
- /************************************************************************
- * simple segmentation with 3 mac frames into 5 PBs
- * 1st mac frame: len=1518, offset=128, ATS, ICV into 1st to 4th PB
- * 2nd mac frame: len=64, ATS, ICV into 4th PB
- * 3nd mac frame: len=466, ATS, ICV, padding into 4th to 5th PB
- ***********************************************************************/
-
- memset(&job1, '\0', sizeof(job1));
- job1.next = &job2;
- job1.data_addr = frame_buffer;
- job1.header_len = 6;
- job1.data_len = ETH_PACKET_MAX_SIZE;
- job1.first_pb_desc = pb_first;
- job1.first_pb_offset = START_OFFSET;
- job1.segment_len = 512;
- job1.direction = 0;
- job1.crc_reset = 1;
- job1.crc_store = 1;
- job1.job_it = 1;
- job1.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
- job1.mf_header1 = (((job1.data_len + 4 - 1) << 2) | 0x02) | (ats << 16); /* Payload + ATS */
- job1.mf_header2 = (ats >> 16);
-
- memset(&job2, '\0', sizeof(job2));
- job2.next = &job3;
- job2.data_addr = frame_buffer + job1.data_len;
- job2.header_len = 6;
- job2.data_len = ETH_PACKET_MIN_SIZE;
- job2.first_pb_desc = pb_first->next->next->next; /* 4th PB */
- job2.first_pb_offset = (START_OFFSET + job1.data_len + 10) % 512;
- job2.segment_len = 512;
- job2.direction = 0;
- job2.crc_reset = 1;
- job2.crc_store = 1;
- job2.job_it = 1;
- job2.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
- job2.mf_header1 = (((job2.data_len + 4 - 1) << 2) | 0x02) | (ats << 16); /* Payload + ATS */
- job2.mf_header2 = (ats >> 16);
-
- memset(&job3, '\0', sizeof(job3));
- job3.next = NULL;
- job3.data_addr = frame_buffer + job1.data_len + job2.data_len;
- job3.header_len = 6;
- job3.data_len = sizeof(frame_buffer) - ETH_PACKET_MAX_SIZE - ETH_PACKET_MIN_SIZE;
- job3.first_pb_desc = pb_first->next->next->next; /* 4th PB */
- job3.first_pb_offset = (START_OFFSET + job1.data_len + 10 + job2.data_len + 10) % 512;
- job3.segment_len = 512;
- job3.last = 1;
- job3.direction = 0;
- job3.crc_reset = 1;
- job3.crc_store = 1;
- job3.append_zero = 1;
- job3.job_it = 1;
- job3.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
- job3.mf_header1 = (((job3.data_len + 4 - 1) << 2) | 0x02) | (ats << 16); /* Payload + ATS */
- job3.mf_header2 = (ats >> 16);
-
- job_current = &job1;
- phy_bridgedma_start (bridgedma_ctx, &job1, &job3);
-
-
-// /************************************************************
-// * icv substitution + no ATS + no interrupt
-// ************************************************************/
-// memset(&job1, '\0', sizeof(job1));
-// job1.next = NULL;
-// job1.data_addr = frame_buffer;
-// job1.header_len = 2;
-// job1.data_len = 256;
-// job1.first_pb_desc = pb_first;
-// job1.first_pb_offset = 0;
-// job1.segment_len = 512;
-// job1.last = 1;
-// job1.direction = 0;
-// job1.crc_error = 1;
-// job1.crc_reset = 1;
-// job1.crc_store = 1;
-// job1.append_zero = 1;
-// job1.job_it = 0;
-// job1.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
-// job1.mf_header1 = ((job1.data_len - 1) << 2) | 0x01; /* Payload */
-// bridgedma_ctx->proto_ctx.icv_substitution = 0xdeadbeef;
-// bridgedma_ctx->proto_ctx.icv_current = 0;
-//
-// test_begin(t, "icv substitution + no ATS + no interrupt")
-// {
-// phy_bridgedma_start(bridgedma_ctx, &job1, &job1);
-// pb_current = pb_first;
-// /* check for no ats */
-// mf_header = *((u32 *)(pb_current->data));
-// test_fail_unless(
-// ((u32) (mf_header & 0x0000ffff)
-// == (u32)((((unsigned int)job1.data_len - 1) << 2) | 0x01))
-// && !memcmp(pb_current->data + 2, frame_buffer, 256)
-// );
-// /* check for icv substitution */
-// mf_header = *((u32 *)(pb_current->data + 2 + 256));
-// test_fail_unless(
-// (mf_header == 0xdeadbeef)
-// );
-//
-// } test_end;
-//
-// phy_bridgedma_start(bridgedma_ctx, &job1, &job3);
-//
-// /***************************************************************
-// * no ATS + no ICV store + no append zero
-// ***************************************************************/
-//
-// memset(&job1, '\0', sizeof(job1));
-// job1.next = NULL;
-// job1.data_addr = frame_buffer;
-// job1.header_len = 2;
-// job1.data_len = 256;
-// job1.first_pb_desc = pb_first;
-// job1.first_pb_offset = 0;
-// job1.segment_len = 512;
-// job1.last = 1;
-// job1.direction = 0;
-// job1.crc_error = 1;
-// job1.crc_reset = 1;
-// job1.crc_store = 0;
-// job1.append_zero = 0;
-// job1.job_it = 1;
-// job1.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
-// job1.mf_header1 = ((job1.data_len - 1) << 2) | 0x01; /* Payload */
-// *(u32 *)(pb_first->data + 256 +2) = 0xdeadbeef;
-//
-// test_begin(t, "no icv store + no append zero for padding")
-// {
-// int i, total;
-// phy_bridgedma_start(bridgedma_ctx, &job1, &job1);
-// /* check for no icv */
-// test_fail_unless(
-// (*(u32 *)(pb_first->data + 256 +2) == 0xdeadbeef)
-// );
-// /* check no zero padding */
-// for(i = 256 + 2 + 4, total = 0; i < 512; i++)
-// {
-// total |= pb_first->data[i];
-// }
-// test_fail_unless(
-// (total != 0)
-// );
-// } test_end;
-//
-// blk_release_desc_range(pb_first, pb_last);
-
- return;
-}
-
-void
-bridgedma_segmentation_verify_test_case (test_t test)
-{
- uint payload_cnt;
- uint crc_current;
- pb_t *my_pb_current;
-
- uint i;
- uint length;
- uint pb_offset;
- uint qte_pb;
- uint frame_offset;
- bool cont;
-
- test_begin(test, "segmentation of 3 frames")
- {
- for (i = 0, my_pb_current = my_pb_first; my_pb_current; my_pb_current =
- my_pb_current->next, i++)
- {
- test_fail_if (my_pb_current->header.ssn != i, "Wong sequence");
- }
-
- /* check pb content */
- /* check 1st mac frame into PB */
- payload_cnt = 0;
- crc_current = crc_compute_begin(&crc_ctx);
-
- pb_offset = START_OFFSET;
- job_current = &job1;
- frame_offset = 0;
- for (pb_current = pb_first, i = 0; i < 3; i++, job_current =
- job_current->next)
- {
- cont = true;
- length = 1 + (read_u16_from_word (pb_current->data + pb_offset) >> 2);
-
- // To get the payload length, the frame length is 10
- // bytes greater.
- length -= 4;
-
- test_fail_unless (length == job_current->data_len,
- "Data length is wrong.");
-
- // Copy the data of the current pb.
-
- // Jump directly to the start of the payload.
- pb_offset += 6;
- if (length + pb_offset > BLK_SIZE)
- {
- test_fail_unless (
- !memcmp (frame_buffer + frame_offset,
- pb_current->data + pb_offset,
- BLK_SIZE - pb_offset),
- "data corrupted");
-
- frame_offset += BLK_SIZE - pb_offset;
- length -= BLK_SIZE - pb_offset;
- }
- else
- {
- test_fail_unless (
- !memcmp (frame_buffer + frame_offset,
- pb_current->data + pb_offset,
- length),
- "data corrupted");
-
- frame_offset += length;
- cont = false;
- }
-
-
- if (cont)
- {
- // Add 10 to the length to use the complete MF length
- // (ATS + MFH + ICV), the ATS and MFH are already include in the
- // pb_offset.
- for (qte_pb = (pb_offset + length + 4) / BLK_SIZE + 1;
- qte_pb;
- qte_pb --)
- {
- pb_current = pb_current->next;
-
- if (length > BLK_SIZE)
- {
- test_fail_unless(
- !memcmp (frame_buffer + frame_offset,
- pb_current->data ,
- BLK_SIZE),
- "data corrupted");
-
- length -= BLK_SIZE;
- frame_offset += BLK_SIZE;
- }
- else
- {
- test_fail_unless(
- !memcmp (frame_buffer + frame_offset,
- pb_current->data ,
- length),
- "data corrupted");
-
- frame_offset += length;
- }
- }
- }
-
- // The futur offset is length + 4 cause of the ICV of the MF.
- // The ATS and the MFH has already been jumped above in the
- // pb_offset.
- pb_offset = (pb_offset + job_current->data_len + 4) % BLK_SIZE;
- }
-
-/* data_cnt += 2;
- mf_header = *((u32 *)(pb_current->data + data_cnt));
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, (unsigned char *)&mf_header, 4);
- data_cnt += 4;
- test_fail_unless(
- !memcmp(pb_current->data + data_cnt, frame_buffer, 512 - data_cnt)
- );
- payload_cnt += 512 - data_cnt;
- data_cnt = 0;
- pb_current = pb_current->next;
- test_fail_unless(
- !memcmp(pb_current->data, frame_buffer + payload_cnt, 512)
- );
- payload_cnt += 512;
- pb_current = pb_current->next;
- test_fail_unless(
- !memcmp(pb_current->data, frame_buffer + payload_cnt, 512)
- );
- payload_cnt += 512;
- pb_current = pb_current->next;
- test_fail_unless(
- !memcmp(pb_current->data, frame_buffer + payload_cnt, ETH_PACKET_MAX_SIZE - payload_cnt)
- );
- data_cnt = ETH_PACKET_MAX_SIZE - payload_cnt;
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, frame_buffer, ETH_PACKET_MAX_SIZE);
- test_fail_unless(
- (*((u32 *)(pb_current->data + data_cnt)) == crc_compute_end(&crc_ctx, crc_current))
- );
- payload_cnt = ETH_PACKET_MAX_SIZE;
- data_cnt += 4;
- */
-
- /* check 2nd mac frame into PB */
- /*
- crc_current = crc_compute_begin(&crc_ctx);
- mf_header = *((u32 *)(pb_current->data + data_cnt));
- test_fail_unless(
- ((mf_header & 0x0000ffff) == (((ETH_PACKET_MIN_SIZE + 4 - 1) << 2) | 0x02))
- );
- data_cnt += 2;
- mf_header = *((u32 *)(pb_current->data + data_cnt));
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, (unsigned char *)&mf_header, 4);
- data_cnt += 4;
- test_fail_unless(
- !memcmp(pb_current->data + data_cnt, frame_buffer + payload_cnt, ETH_PACKET_MIN_SIZE)
- );
- data_cnt += ETH_PACKET_MIN_SIZE;
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, frame_buffer + ETH_PACKET_MAX_SIZE, ETH_PACKET_MIN_SIZE);
- test_fail_unless(
- (*((u32 *)(pb_current->data + data_cnt)) == crc_compute_end(&crc_ctx, crc_current))
- );
- payload_cnt += ETH_PACKET_MIN_SIZE;
- data_cnt += 4;
- */
-
- /* check 3rd mac frame into PB */
- /*
- crc_current = crc_compute_begin(&crc_ctx);
- mf_header = *((u32 *)(pb_current->data + data_cnt));
-
- test_fail_unless(
- ((mf_header & 0x0000ffff) == (((sizeof(frame_buffer) - ETH_PACKET_MAX_SIZE - ETH_PACKET_MIN_SIZE + 4 - 1) << 2) | 0x02))
- );
-
- data_cnt += 2;
- mf_header = *((u32 *)(pb_current->data + data_cnt));
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, (unsigned char *)&mf_header, 4);
- data_cnt += 4;
-
- test_fail_unless(
- !memcmp(pb_current->data + data_cnt, frame_buffer + payload_cnt, 512 - data_cnt)
- );
-
- payload_cnt += (512 - data_cnt);
- data_cnt = 0;
- pb_current = pb_current->next;
-
- test_fail_unless(
- !memcmp(pb_current->data, frame_buffer + payload_cnt, sizeof(frame_buffer) - payload_cnt)
- );
-
- data_cnt += sizeof(frame_buffer) - payload_cnt;
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, frame_buffer + ETH_PACKET_MAX_SIZE + ETH_PACKET_MIN_SIZE, sizeof(frame_buffer) - ETH_PACKET_MAX_SIZE - ETH_PACKET_MIN_SIZE);
-
- test_fail_unless(
- (*((u32 *)(pb_current->data + data_cnt)) == crc_compute_end(&crc_ctx, crc_current))
- );
-
- data_cnt += 4;
- */
-
- /* check if there is a zeroed padding */
- /*
- {
- int i, total;
- for(i = data_cnt, total = 0; i < 512; i++)
- total |= (pb_current->data[i]);
- test_fail_unless(
- (total == 0)
- );
- }
- */
- } test_end;
-
- blk_release_desc_range((blk_t *)my_pb_first, (blk_t *) my_pb_last);
-}
-
-void
-test_thread_process (cyg_addrword_t data)
-{
- test_t *test;
-
- test = (test_t *) data;
-
- bridgedma_init_test_case (*test);
-
- bridgedma_segmentation_test_case (*test);
- bridgedma_segmentation_verify_test_case (*test);
-
- phy_bridgedma_uninit (bridgedma_ctx);
-
- test_result (*test);
- HAL_PLATFORM_EXIT (test_nb_failed (*test) == 0 ? 0 : 1);
-}
-
-int
-main (void)
-{
- test_t test;
- uint i;
-
- test_init (test, 0, NULL);
-
- pb_first = NULL;
- pb_last = NULL;
-
- my_pb_first = NULL;
- my_pb_last = NULL;
-
- for (i = 0; i < 2048; i++)
- frame_buffer[i] = i;
-
- // Create the thread.
- cyg_thread_create( 9,
- &test_thread_process,
- (cyg_addrword_t) &test,
- "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;
-}
diff --git a/cesar/hal/phy/test/bridgedma-soft/src/test_bridgedma.c_old b/cesar/hal/phy/test/bridgedma-soft/src/test_bridgedma.c_old
deleted file mode 100644
index 06ab4fe40e..0000000000
--- a/cesar/hal/phy/test/bridgedma-soft/src/test_bridgedma.c_old
+++ /dev/null
@@ -1,1003 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2007 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file hal/phy/maximus/test/src/test_bridgedma.c
- * \brief HAL Phy Bridge DMA test functions for Maximus.
- * \ingroup hal_phy_maximus
- */
-
-#include "common/std.h"
-#include "lib/test.h"
-
-
-#include "hal/phy/maximus/inc/maximus_bridgedma_ctx.h"
-
-#define MAC_FRAME_MAX_LEN 1518
-#define MAC_FRAME_MIN_LEN 64
-#define START_OFFSET 128
-
-unsigned char frame_buffer[2048] __attribute__((aligned(2048)));
-unsigned char eth_buffer[2048] __attribute__((aligned(2048)));
-
-static int _buffer_random_fill(unsigned char *buffer, int length)
-{
- lib_rnd_t my_rnd;
- uint i;
-
- lib_rnd_init (&my_rnd, 0x81245452);
-
- for (i = 0; i < length; i++)
- {
- buffer[i] = lib_rnd32 (&my_rnd);
- }
-
- return i;
-}
-
-struct segmentation_cb_data
-{
- phy_bridgedma_job_t *job;
-};
-
-/* WARNING: callback are not possible to test inside UNIT TEST */
-static bool _bridgedma_segmentation_cb(void *data, uint32_t status)
-{
- int *counter;
- counter = (int *)data;
- counter++;
- return 0;
-}
-
-/* WARNING: callback are not possible to test inside UNIT TEST */
-static void _bridgedma_deffered_cb(void *data)
-{
- return;
-}
-
-void bridgedma_init_test_case(test_t t)
-{
- phy_bridgedma_t *bridgedma_ctx;
- int user_data;
-
- test_case_begin(t, "init");
-
- test_begin(t, "init")
- {
- bridgedma_ctx = NULL;
- bridgedma_ctx = phy_bridgedma_init(&user_data, _bridgedma_segmentation_cb, _bridgedma_deffered_cb);
- test_fail_unless(
- (bridgedma_ctx != NULL)
- && (bridgedma_ctx->job_first == NULL)
- && (bridgedma_ctx->job_current == NULL)
- && (bridgedma_ctx->job_last == NULL)
- && (bridgedma_ctx->user_data == &user_data)
- && (bridgedma_ctx->bridgedma_cb == _bridgedma_segmentation_cb)
- && (bridgedma_ctx->deferred_cb == _bridgedma_deffered_cb)
- && !bridgedma_ctx->status.running
- && bridgedma_ctx->status.stop
- );
- } test_end;
- return;
-}
-
-void bridgedma_pb_data_add_test_case(test_t t)
-{
- blk_t *pb_first, *pb_last, *pb_current;
- unsigned char frame_buffer[2048], copy_buffer[2048], *pb_data_ptr;
-
- test_case_begin(t, "pb_data_add");
-
- pb_first = blk_alloc_desc_range(3, &pb_last);
- pb_current = pb_first;
- pb_data_ptr = pb_first->data + 128;
- _buffer_random_fill(frame_buffer, sizeof(frame_buffer));
-
- /* adding 1280 bytes into 3 PBs with 1st PB offset=128 */
- test_begin(t, "adding 1280 bytes from mac-frame into 3 pbs")
- {
- _pb_data_add(&pb_current, &pb_data_ptr, 512, frame_buffer, 1280, MACFRAME_TO_PB);
- test_fail_unless(
- (pb_current == pb_last)
- && (pb_data_ptr == pb_last->data + 384)
- && !memcmp(pb_first->data + 128, frame_buffer, 384)
- && !memcmp(pb_first->next->data, frame_buffer + 512 - 128, 512)
- && !memcmp(pb_last->data, frame_buffer + 1024 - 128, 384)
- );
- } test_end;
-
- /* adding 1280 bytes into 3 PBs with 1st PB offset=128 */
- pb_current = pb_first;
- pb_data_ptr = pb_first->data + 128;
- memset(copy_buffer, '\0', sizeof(copy_buffer));
- test_begin(t, "adding 1280 bytes from 3 pbs into mac-frame")
- {
- _pb_data_add(&pb_current, &pb_data_ptr, 512, copy_buffer, 1280, PB_TO_MACFRAME);
- test_fail_unless(
- (pb_current == pb_last)
- && (pb_data_ptr == pb_last->data + 384)
- && !memcmp(copy_buffer, frame_buffer, 1280)
- );
- } test_end;
-
- blk_release_desc_range(pb_first, pb_last);
- return;
-}
-
-void bridgedma_segmentation_test_case(test_t t)
-{
- phy_bridgedma_job_t job1, job2, job3;
- phy_bridgedma_t *bridgedma_ctx;
- blk_t *pb_first, *pb_last, *pb_current;
- struct segmentation_cb_data bridgedma_data;
- sci_msg_hdr_t *sci_hdr;
- netclock_msg_hdr_t *netclock_hdr;
- unsigned char msg_buffer[256];
- int fd_in, fd_out, data_cnt, payload_cnt;
- tick_t end_of_dma_tck, max_end_of_dma_tck, min_end_of_dma_tck;
- uint32_t mf_header;
- u32 enc_tab[256];
- crc_t crc_ctx;
- unsigned long crc_current;
- time_t ats;
-
- test_case_begin(t, "segmentation");
-
- bridgedma_ctx = phy_bridgedma_init(&bridgedma_data, _bridgedma_segmentation_cb, _bridgedma_deffered_cb);
- pb_first = blk_alloc_desc_range(5, &pb_last);
- _buffer_random_fill(frame_buffer, sizeof(frame_buffer));
- 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);
- time(&ats);
-
- /************************************************************************
- * simple segmentation with 3 mac frames into 5 PBs
- * 1st mac frame: len=1518, offset=128, ATS, ICV into 1st to 4th PB
- * 2nd mac frame: len=64, ATS, ICV into 4th PB
- * 3nd mac frame: len=466, ATS, ICV, padding into 4th to 5th PB
- ***********************************************************************/
-
- memset(&job1, '\0', sizeof(job1));
- job1.next = &job2;
- job1.data_addr = frame_buffer;
- job1.header_len = 6;
- job1.data_len = MAC_FRAME_MAX_LEN;
- job1.first_pb_desc = pb_first;
- job1.first_pb_offset = START_OFFSET;
- job1.segment_len = 512;
- job1.direction = 0;
- job1.crc_reset = 1;
- job1.crc_store = 1;
- job1.job_it = 1;
- job1.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
- job1.mf_header1 = (((job1.data_len + 4 - 1) << 2) | 0x02) | (ats << 16); /* Payload + ATS */
- job1.mf_header2 = (ats >> 16);
-
- memset(&job2, '\0', sizeof(job2));
- job2.next = &job3;
- job2.data_addr = frame_buffer + job1.data_len;
- job2.header_len = 6;
- job2.data_len = MAC_FRAME_MIN_LEN;
- job2.first_pb_desc = pb_first->next->next->next; /* 4th PB */
- job2.first_pb_offset = (START_OFFSET + job1.data_len + 10) % 512;
- job2.segment_len = 512;
- job2.direction = 0;
- job2.crc_reset = 1;
- job2.crc_store = 1;
- job2.job_it = 0;
- job2.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
- job2.mf_header1 = (((job2.data_len + 4 - 1) << 2) | 0x02) | (ats << 16); /* Payload + ATS */
- job2.mf_header2 = (ats >> 16);
-
- memset(&job3, '\0', sizeof(job3));
- job3.next = NULL;
- job3.data_addr = frame_buffer + job1.data_len + job2.data_len;
- job3.header_len = 6;
- job3.data_len = sizeof(frame_buffer) - MAC_FRAME_MAX_LEN - MAC_FRAME_MIN_LEN;
- job3.first_pb_desc = pb_first->next->next->next; /* 4th PB */
- job3.first_pb_offset = (START_OFFSET + job1.data_len + 10 + job2.data_len + 10) % 512;
- job3.segment_len = 512;
- job3.last = 1;
- job3.direction = 0;
- job3.crc_reset = 1;
- job3.crc_store = 1;
- job3.append_zero = 1;
- job3.job_it = 1;
- job3.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
- job3.mf_header1 = (((job3.data_len + 4 - 1) << 2) | 0x02) | (ats << 16); /* Payload + ATS */
- job3.mf_header2 = (ats >> 16);
-
- test_begin(t, "segmentation of 3 frames")
- {
- phy_bridgedma_start(bridgedma_ctx, &job1, &job3);
-
- /* 1st job */
- test_fail_unless(
- (bridgedma_ctx->job_current == &job1)
- && bridgedma_ctx->status.running
- && !bridgedma_ctx->status.stop
- );
-
- /* 2nd job */
- test_fail_unless(
- (bridgedma_ctx->job_current == &job2)
- && bridgedma_ctx->status.running
- && !bridgedma_ctx->status.stop
- );
-
- /* 3rd job */
- test_fail_unless(
- (bridgedma_ctx->job_current == &job3)
- && bridgedma_ctx->status.running
- && !bridgedma_ctx->status.stop
- );
-
- /* check final status */
- test_fail_unless(
- !bridgedma_ctx->status.ahb_response_error
- && !bridgedma_ctx->status.running
- && bridgedma_ctx->status.stop
- );
-
- /* check pb content */
- /* check 1st mac frame into PB */
- pb_current = pb_first;
- data_cnt = START_OFFSET;
- payload_cnt = 0;
- crc_current = crc_compute_begin(&crc_ctx);
- mf_header = *((uint32_t *)(pb_current->data + data_cnt));
- test_fail_unless(
- ((mf_header & 0x0000ffff) == (((MAC_FRAME_MAX_LEN + 4 - 1) << 2) | 0x02))
- );
- data_cnt += 2;
- mf_header = *((uint32_t *)(pb_current->data + data_cnt));
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, (unsigned char *)&mf_header, 4);
- data_cnt += 4;
- test_fail_unless(
- !memcmp(pb_current->data + data_cnt, frame_buffer, 512 - data_cnt)
- );
- payload_cnt += 512 - data_cnt;
- data_cnt = 0;
- pb_current = pb_current->next;
- test_fail_unless(
- !memcmp(pb_current->data, frame_buffer + payload_cnt, 512)
- );
- payload_cnt += 512;
- pb_current = pb_current->next;
- test_fail_unless(
- !memcmp(pb_current->data, frame_buffer + payload_cnt, 512)
- );
- payload_cnt += 512;
- pb_current = pb_current->next;
- test_fail_unless(
- !memcmp(pb_current->data, frame_buffer + payload_cnt, MAC_FRAME_MAX_LEN - payload_cnt)
- );
- data_cnt = MAC_FRAME_MAX_LEN - payload_cnt;
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, frame_buffer, MAC_FRAME_MAX_LEN);
- test_fail_unless(
- (*((uint32_t *)(pb_current->data + data_cnt)) == crc_compute_end(&crc_ctx, crc_current))
- );
- payload_cnt = MAC_FRAME_MAX_LEN;
- data_cnt += 4;
-
- /* check 2nd mac frame into PB */
- crc_current = crc_compute_begin(&crc_ctx);
- mf_header = *((uint32_t *)(pb_current->data + data_cnt));
- test_fail_unless(
- ((mf_header & 0x0000ffff) == (((MAC_FRAME_MIN_LEN + 4 - 1) << 2) | 0x02))
- );
- data_cnt += 2;
- mf_header = *((uint32_t *)(pb_current->data + data_cnt));
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, (unsigned char *)&mf_header, 4);
- data_cnt += 4;
- test_fail_unless(
- !memcmp(pb_current->data + data_cnt, frame_buffer + payload_cnt, MAC_FRAME_MIN_LEN)
- );
- data_cnt += MAC_FRAME_MIN_LEN;
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, frame_buffer + MAC_FRAME_MAX_LEN, MAC_FRAME_MIN_LEN);
- test_fail_unless(
- (*((uint32_t *)(pb_current->data + data_cnt)) == crc_compute_end(&crc_ctx, crc_current))
- );
- payload_cnt += MAC_FRAME_MIN_LEN;
- data_cnt += 4;
-
- /* check 3rd mac frame into PB */
- crc_current = crc_compute_begin(&crc_ctx);
- mf_header = *((uint32_t *)(pb_current->data + data_cnt));
- test_fail_unless(
- ((mf_header & 0x0000ffff) == (((sizeof(frame_buffer) - MAC_FRAME_MAX_LEN - MAC_FRAME_MIN_LEN + 4 - 1) << 2) | 0x02))
- );
- data_cnt += 2;
- mf_header = *((uint32_t *)(pb_current->data + data_cnt));
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, (unsigned char *)&mf_header, 4);
- data_cnt += 4;
- test_fail_unless(
- !memcmp(pb_current->data + data_cnt, frame_buffer + payload_cnt, 512 - data_cnt)
- );
- payload_cnt += (512 - data_cnt);
- data_cnt = 0;
- pb_current = pb_current->next;
- test_fail_unless(
- !memcmp(pb_current->data, frame_buffer + payload_cnt, sizeof(frame_buffer) - payload_cnt)
- );
- data_cnt += sizeof(frame_buffer) - payload_cnt;
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, frame_buffer + MAC_FRAME_MAX_LEN + MAC_FRAME_MIN_LEN, sizeof(frame_buffer) - MAC_FRAME_MAX_LEN - MAC_FRAME_MIN_LEN);
- test_fail_unless(
- (*((uint32_t *)(pb_current->data + data_cnt)) == crc_compute_end(&crc_ctx, crc_current))
- );
- data_cnt += 4;
-
- /* check if there is a zeroed padding */
- {
- int i, total;
- for(i = data_cnt, total = 0; i < 512; i++)
- total |= (pb_current->data[i]);
- test_fail_unless(
- (total == 0)
- );
- }
- } test_end;
-
- /************************************************************
- * icv substitution + no ATS + no interrupt
- ************************************************************/
- memset(&job1, '\0', sizeof(job1));
- job1.next = NULL;
- job1.data_addr = frame_buffer;
- job1.header_len = 2;
- job1.data_len = 256;
- job1.first_pb_desc = pb_first;
- job1.first_pb_offset = 0;
- job1.segment_len = 512;
- job1.last = 1;
- job1.direction = 0;
- job1.crc_error = 1;
- job1.crc_reset = 1;
- job1.crc_store = 1;
- job1.append_zero = 1;
- job1.job_it = 0;
- job1.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
- job1.mf_header1 = ((job1.data_len - 1) << 2) | 0x01; /* Payload */
- bridgedma_ctx->icv_substitution = 0xdeadbeef;
- bridgedma_ctx->icv_current = 0;
-
- test_begin(t, "icv substitution + no ATS + no interrupt")
- {
- phy_bridgedma_start(bridgedma_ctx, &job1, &job1);
- pb_current = pb_first;
- test_fail_unless(
- (read(fd_in, msg_buffer, sizeof(sci_msg_hdr_t) + sizeof(netclock_msg_hdr_t)) == sizeof(sci_msg_hdr_t) + sizeof(netclock_msg_hdr_t))
- );
- /* check for no ats */
- mf_header = *((uint32_t *)(pb_current->data));
- test_fail_unless(
- ((mf_header & 0x0000ffff) == ((((unsigned int)job1.data_len - 1) << 2) | 0x01))
- && !memcmp(pb_current->data + 2, frame_buffer, 256)
- );
- /* check for icv substitution */
- mf_header = *((uint32_t *)(pb_current->data + 2 + 256));
- test_fail_unless(
- (mf_header == 0xdeadbeef)
- );
-
- } test_end;
-
- /***************************************************************
- * CRC reset !!!!!!!!!!!!!!!!
- ***************************************************************/
- /* not made yet */
-
- /***************************************************************
- * no ATS + no ICV store + no append zero
- ***************************************************************/
- _buffer_random_fill(pb_first->data, 512);
-
- memset(&job1, '\0', sizeof(job1));
- job1.next = NULL;
- job1.data_addr = frame_buffer;
- job1.header_len = 2;
- job1.data_len = 256;
- job1.first_pb_desc = pb_first;
- job1.first_pb_offset = 0;
- job1.segment_len = 512;
- job1.last = 1;
- job1.direction = 0;
- job1.crc_error = 1;
- job1.crc_reset = 1;
- job1.crc_store = 0;
- job1.append_zero = 0;
- job1.job_it = 1;
- job1.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
- job1.mf_header1 = ((job1.data_len - 1) << 2) | 0x01; /* Payload */
- *(uint32_t *)(pb_first->data + 256 +2) = 0xdeadbeef;
-
- test_begin(t, "no icv store + no append zero for padding")
- {
- int i, total;
- phy_bridgedma_start(bridgedma_ctx, &job1, &job1);
- test_fail_unless(
- (read(fd_in, msg_buffer, sizeof(sci_msg_hdr_t) + sizeof(netclock_msg_hdr_t)) == sizeof(sci_msg_hdr_t) + sizeof(netclock_msg_hdr_t))
- );
- /* check for no icv */
- test_fail_unless(
- (*(uint32_t *)(pb_first->data + 256 +2) == 0xdeadbeef)
- );
- /* check no zero padding */
- for(i = 256 + 2 + 4, total = 0; i < 512; i++)
- {
- total |= pb_first->data[i];
- }
- test_fail_unless(
- (total != 0)
- );
- } test_end;
-
- blk_release_desc_range(pb_first, pb_last);
-
- return;
-}
-
-struct reassembly_cb_data
-{
- phy_bridgedma_job_t *job;
-};
-
-static bool _bridgedma_reassembly_cb(void *data, uint32_t status)
-{
- return 0;
-}
-
-void bridgedma_reassembly_test_case(test_t t)
-{
- phy_bridgedma_job_t job1, job2, job3;
- phy_bridgedma_t *bridgedma_ctx;
- blk_t *pb_first, *pb_last, *pb_current;
- struct reassembly_cb_data bridgedma_data;
- sci_msg_hdr_t *sci_hdr;
- netclock_msg_hdr_t *netclock_hdr;
- unsigned char msg_buffer[256];
- int fd_in, fd_out, data_cnt, payload_cnt;
- tick_t end_of_dma_tck, max_end_of_dma_tck, min_end_of_dma_tck;
- u32 enc_tab[256];
- crc_t crc_ctx;
- unsigned long crc_current;
-
- test_case_begin(t, "reassembly");
-
- bridgedma_ctx = phy_bridgedma_init(&bridgedma_data, _bridgedma_reassembly_cb, _bridgedma_deffered_cb);
-
- pb_first = blk_alloc_desc_range(4, &pb_last);
- _buffer_random_fill(frame_buffer, sizeof(frame_buffer));
- 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);
-
- /***********************************************************************
- * simple reassembly from 3 mac frames into 5 PBs
- * 1st mac frame: len=1024, mac-offset=1536, pb-offset=128, ATS, ICV into 1st to 3rd PB
- * 2nd : len=512, no-ATS, ICV into 3rd to 4th pb
- * 3rd : len=256, no-ATS, ICV, padding into 4th PB
- ***********************************************************************/
- pb_current = pb_first;
- data_cnt = START_OFFSET;
- payload_cnt = 0;
- crc_current = crc_compute_begin(&crc_ctx);
- *(uint16_t *)(pb_current->data + data_cnt) = ((1024 + 4 - 1) << 2) | 0x02;
- data_cnt += 2;
- *(uint32_t *)(pb_current->data + data_cnt) = time(NULL);
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, pb_current->data + data_cnt, 4);
- data_cnt += 4;
- memcpy(pb_current->data + data_cnt, frame_buffer, 512 - data_cnt);
- payload_cnt += 512 - data_cnt;
- pb_current = pb_current->next;
- memcpy(pb_current->data, frame_buffer + payload_cnt, 512);
- payload_cnt += 512;
- pb_current = pb_current->next;
- memcpy(pb_current->data, frame_buffer + payload_cnt, 1024 - payload_cnt);
- data_cnt = 1024 - payload_cnt;
- payload_cnt = 1024;
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, frame_buffer, 1024);
- *(uint32_t *)(pb_current->data + data_cnt) = crc_compute_end(&crc_ctx, crc_current);
- data_cnt += 4;
-
- crc_current = crc_compute_begin(&crc_ctx);
- *(uint16_t *)(pb_current->data + data_cnt) = ((512 - 1) << 2) | 0x01;
- data_cnt += 2;
- memcpy(pb_current->data + data_cnt, frame_buffer + payload_cnt, 512 - data_cnt);
- payload_cnt += 512 - data_cnt;
- pb_current = pb_current->next;
- memcpy(pb_current->data, frame_buffer + payload_cnt, 1024 + 512 - payload_cnt);
- data_cnt = 1024 + 512 - payload_cnt;
- payload_cnt = 1024 + 512;
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, frame_buffer + 1024, 512);
- *(uint32_t *)(pb_current->data + data_cnt) = crc_compute_end(&crc_ctx, crc_current);
- data_cnt += 4;
-
- crc_current = crc_compute_begin(&crc_ctx);
- *(uint16_t *)(pb_current->data + data_cnt) = ((256 - 1) << 2) | 0x01;
- data_cnt += 2;
- memcpy(pb_current->data + data_cnt, frame_buffer + payload_cnt, 256);
- payload_cnt += 256;
- data_cnt += 256;
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, frame_buffer + 1024 + 512, 256);
- *(uint32_t *)(pb_current->data + data_cnt) = crc_compute_end(&crc_ctx, crc_current);
- data_cnt += 4;
-
- memset(pb_current->data + data_cnt, '\0', 512 - data_cnt);
-
- /* prepare jobs */
- memset(&job1, '\0', sizeof(job1));
- job1.next = &job2;
- job1.data_addr = eth_buffer + 1536;
- job1.header_len = 6;
- job1.data_len = 1024;
- job1.first_pb_desc = pb_first;
- job1.first_pb_offset = START_OFFSET;
- job1.segment_len = 512;
- job1.direction = 1;
- job1.crc_reset = 1;
- job1.crc_store = 1;
- job1.job_it = 0;
- job1.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
-
- memset(&job2, '\0', sizeof(job2));
- job2.next = &job3;
- job2.data_addr = eth_buffer + 512;
- job2.header_len = 2;
- job2.data_len = 512;
- job2.first_pb_desc = pb_first->next->next; /* 3rd PB */
- job2.first_pb_offset = (START_OFFSET + job1.data_len + 10) % 512;
- job2.segment_len = 512;
- job2.direction = 1;
- job2.crc_reset = 1;
- job3.crc_store = 1;
- job2.job_it = 1;
- job2.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
-
- memset(&job3, '\0', sizeof(job3));
- job3.next = NULL;
- job3.data_addr = eth_buffer + 1024;
- job3.header_len = 2;
- job3.data_len = 256;
- job3.first_pb_desc = pb_first->next->next->next; /* 4th PB */
- job3.first_pb_offset = (START_OFFSET + job1.data_len + 10 + job2.data_len + 6) % 512;
- job3.segment_len = 512;
- job3.last = 1;
- job3.direction = 1;
- job3.crc_reset = 1;
- job3.crc_store = 1;
- job3.job_it = 1;
- job3.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
-
- test_begin(t, "reassembly of 3 frames")
- {
- phy_bridgedma_start(bridgedma_ctx, &job1, &job3);
-
- /* check job1 */
- test_fail_unless(
- (bridgedma_ctx->job_current == &job1)
- && bridgedma_ctx->status.running
- && !bridgedma_ctx->status.stop
- );
-
- /* check job2 */
- test_fail_unless(
- (bridgedma_ctx->job_current == &job2)
- && bridgedma_ctx->status.running
- && !bridgedma_ctx->status.stop
- );
-
- /* check job3 */
- test_fail_unless(
- (bridgedma_ctx->job_current == &job3)
- && bridgedma_ctx->status.running
- && !bridgedma_ctx->status.stop
- );
-
- /* check the eth_buffer content */
- test_fail_unless(
- !memcmp(eth_buffer + 1536, frame_buffer, 512)
- && !memcmp(eth_buffer, frame_buffer + 512, 512)
- );
- test_fail_unless(
- !memcmp(eth_buffer + 512, frame_buffer + 1024, 512)
- );
- test_fail_unless(
- !memcmp(eth_buffer + 1024, frame_buffer + 1536, 256)
- );
-
- /* check status */
- test_fail_unless(
- !job1.crc_error
- && !job2.crc_error
- && !job3.crc_error
- && !bridgedma_ctx->status.ahb_response_error
- && !bridgedma_ctx->status.running
- && bridgedma_ctx->status.stop
- );
- } test_end;
-
- /****************************************************************
- * bad ICV detected
- ****************************************************************/
- *(uint16_t *)(pb_first->data) = ((256 - 1) << 2) | 0x01;
- memcpy(pb_first->data + 2, frame_buffer, 256);
- *(uint32_t *)(pb_current->data + 2 + 256) = 0xdeadbeef;
- memset(&job1, '\0', sizeof(job1));
-
- job1.next = NULL;
- job1.data_addr = eth_buffer;
- job1.header_len = 2;
- job1.data_len = 256;
- job1.first_pb_desc = pb_first;
- job1.first_pb_offset = 0;
- job1.segment_len = 512;
- job1.direction = 1;
- job1.crc_reset = 1;
- job1.crc_store = 1;
- job1.job_it = 0;
- job1.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
-
- test_begin(t, "bad ICV")
- {
- phy_bridgedma_start(bridgedma_ctx, &job1, &job1);
- test_fail_unless(
- (read(fd_in, msg_buffer, sizeof(sci_msg_hdr_t) + sizeof(netclock_msg_hdr_t)) == sizeof(sci_msg_hdr_t) + sizeof(netclock_msg_hdr_t))
- );
-
- test_fail_unless(
- job1.crc_error
- && !bridgedma_ctx->status.ahb_response_error
- && !bridgedma_ctx->status.running
- && bridgedma_ctx->status.stop
- );
-
- } test_end;
-
- /**************************************************************************/
- /* 2 continuous jobs for the same mac frame */
- /* 2nd job has header_len=0 and doesn't reset the current icv computation */
- /* getting 1024 bytes of data from 3 PBs, offset=128, no ATS */
- /**************************************************************************/
- pb_current = pb_first;
- data_cnt = START_OFFSET;
- payload_cnt = 0;
- crc_current = crc_compute_begin(&crc_ctx);
- *(uint16_t *)(pb_current->data + data_cnt) = ((1024 + 4 - 1) << 2) | 0x01;
- data_cnt += 2;
- memcpy(pb_current->data + data_cnt, frame_buffer, 512 - data_cnt);
- payload_cnt += 512 - data_cnt;
- pb_current = pb_current->next;
- memcpy(pb_current->data, frame_buffer + payload_cnt, 512);
- payload_cnt += 512;
- pb_current = pb_current->next;
- memcpy(pb_current->data, frame_buffer + payload_cnt, 1024 - payload_cnt);
- data_cnt = 1024 - payload_cnt;
- payload_cnt = 1024;
- crc_current = crc_compute_continue_block(&crc_ctx, crc_current, frame_buffer, 1024);
- *(uint32_t *)(pb_current->data + data_cnt) = crc_compute_end(&crc_ctx, crc_current);
- data_cnt += 4;
- memset(pb_current->data + data_cnt, '\0', 512 - data_cnt); // padding
-
- /* prepare jobs */
- memset(&job1, '\0', sizeof(job1));
- job1.next = &job2;
- job1.data_addr = eth_buffer;
- job1.header_len = 2;
- job1.data_len = 256;
- job1.first_pb_desc = pb_first;
- job1.first_pb_offset = START_OFFSET;
- job1.segment_len = 512;
- job1.direction = 1;
- job1.crc_reset = 1;
- job1.crc_store = 0;
- job1.job_it = 0;
- job1.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
-
- memset(&job2, '\0', sizeof(job1));
- job2.next = NULL;
- job2.data_addr = eth_buffer + 256;
- job2.header_len = 0;
- job2.data_len = 1024 - 256;
- job2.first_pb_desc = pb_first;
- job2.first_pb_offset = START_OFFSET + 2 + 256;
- job2.segment_len = 512;
- job2.direction = 1;
- job2.crc_reset = 0;
- job2.crc_store = 1;
- job2.job_it = 0;
- job2.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
-
- test_begin(t, "2 jobs for 1 mac frame")
- {
- phy_bridgedma_start(bridgedma_ctx, &job1, &job2);
- /* 1st job */
- test_fail_unless(
- (read(fd_in, msg_buffer, sizeof(sci_msg_hdr_t) + sizeof(netclock_msg_hdr_t)) == sizeof(sci_msg_hdr_t) + sizeof(netclock_msg_hdr_t))
- );
-
- /* 2nd job */
- test_fail_unless(
- (read(fd_in, msg_buffer, sizeof(sci_msg_hdr_t) + sizeof(netclock_msg_hdr_t)) == sizeof(sci_msg_hdr_t) + sizeof(netclock_msg_hdr_t))
- );
-
- test_fail_unless(
- !memcmp(eth_buffer, frame_buffer, 1024)
- );
-
- test_fail_unless(
- !job2.crc_error
- && !bridgedma_ctx->status.ahb_response_error
- && !bridgedma_ctx->status.running
- && bridgedma_ctx->status.stop
- );
- } test_end;
-
- blk_release_desc_range(pb_first, pb_last);
-}
-
-#if 1
-/*************************************************************************************
- * ticket #3 fixing test unit
- * description: segmentation of a 1470 bytes length frame into 3 PBs
- * then reassembly of them
- * - during reassembly, bridge try to get a 4th unexisting PB et raise an assert failure
- * ***********************************************************************************/
-unsigned char ticket_3_packet[] __attribute__((aligned(2048))) =
-{ 0xd4, 0xc3, 0xb2, 0xa1, 0x02, 0x00, 0x04, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00,
- 0x00, 0x01, 0x00, 0x00, 0x00, 0x9c, 0x2f, 0x9f, 0x46, 0xd1, 0x78,
- 0x02, 0x00, 0x96, 0x05, 0x00, 0x00, 0x96, 0x05, 0x00, 0x00, 0x08,
- 0x00, 0x27, 0x52, 0x20, 0x4c, 0x52, 0x54, 0x00, 0x12, 0x35, 0x02,
- 0x08, 0x00, 0x45, 0x08, 0x05, 0x88, 0x00, 0x6e, 0x00, 0x00, 0x40,
- 0x06, 0x15, 0xf1, 0xd1, 0x55, 0x81, 0xa5, 0x0a, 0x00, 0x02, 0x0f,
- 0x00, 0x50, 0x04, 0x17, 0x01, 0x76, 0x1c, 0xf4, 0xc2, 0xcc, 0x6e,
- 0x38, 0x50, 0x18, 0x22, 0x38, 0xe2, 0xf1, 0x00, 0x00, 0x7e, 0x94,
- 0xbd, 0x94, 0x2c, 0x97, 0x22, 0xd4, 0x84, 0x34, 0x0c, 0x8c, 0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e, 0x1c,
- 0x5f, 0x93, 0xd9, 0x01, 0x9c, 0x08, 0xa9, 0xc8, 0xab, 0x23, 0xe7,
- 0xde, 0xaf, 0x44, 0x17, 0x82, 0xe3, 0x73, 0x97, 0xab, 0x77, 0xc9,
- 0x11, 0x25, 0xd8, 0x82, 0x49, 0x29, 0xfd, 0x36, 0x55, 0x0e, 0x03,
- 0x17, 0xae, 0xa0, 0x8b, 0x4f, 0x26, 0x8d, 0xe5, 0x77, 0x8a, 0x43,
- 0x3d, 0x7c, 0xca, 0x75, 0x8e, 0xd8, 0xd8, 0x45, 0xd8, 0x97, 0x46,
- 0xce, 0x0c, 0x02, 0x80, 0x3a, 0x20, 0xe1, 0x63, 0xa2, 0x28, 0xb7,
- 0xac, 0xd2, 0x28, 0xe5, 0x35, 0xf4, 0xc6, 0x2f, 0x1f, 0x85, 0xff,
- 0xde, 0xac, 0xcc, 0x79, 0xbf, 0xe6, 0xa6, 0x3c, 0x57, 0xdb, 0x88,
- 0x9c, 0x19, 0x5a, 0x01, 0x25, 0x0b, 0x31, 0x0e, 0xf5, 0xce, 0x7a,
- 0x51, 0xc8, 0xb0, 0x97, 0x3e, 0xd3, 0xf3, 0x70, 0xf2, 0xc1, 0xb6,
- 0xf3, 0x1f, 0xed, 0x35, 0x17, 0x11, 0xfe, 0x15, 0x00, 0x00};
-unsigned int ticket_3_packet_len = 1470;
-
-void bridgedma_ticket_3(test_t t)
-{
- phy_bridgedma_job_t job;
- phy_bridgedma_t *bridgedma_ctx;
- blk_t *pb_first, *pb_last;
- struct reassembly_cb_data bridgedma_data;
- unsigned long ats = 0x12345678;
- sci_msg_hdr_t *sci_hdr;
- netclock_msg_hdr_t *netclock_hdr;
- unsigned char msg_buffer[256];
- int fd_in, fd_out;
-
- test_case_begin(t, "ticket #3");
-
- bridgedma_ctx = phy_bridgedma_init(&bridgedma_data, _bridgedma_reassembly_cb, _bridgedma_deffered_cb);
-#ifdef STATION_SOCK
- fd_in = my_station.sock_pair_fd;
- fd_out = my_station.sock_pair_fd;
-#else /* STATION_SOCK */
- fd_in = open(bridgedma_ctx->station->pipe_out_name, O_RDONLY);
- fd_out = open(bridgedma_ctx->station->pipe_in_name, O_WRONLY);
-#endif /* STATION_SOCK */
-
- pb_first = blk_alloc_desc_range(3, &pb_last);
-
- /* prepare job for fragmentation */
- //memcpy(frame_buffer, ticket_3_packet, ticket_3_packet_len);
- memset(&job, '\0', sizeof(job));
- job.next = NULL;
- job.data_addr = ticket_3_packet;
- job.header_len = 6;
- job.data_len = ticket_3_packet_len;
- job.first_pb_desc = pb_first;
- job.first_pb_offset = 0;
- job.segment_len = 512;
- job.direction = 0;
- job.crc_reset = 1;
- job.crc_store = 1;
- job.job_it = 0;
- job.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
- job.mf_header1 = (((job.data_len + 4 - 1) << 2) | 0x02) | (ats >> 16); /* Payload + ATS */
- job.mf_header2 = (ats << 16);
-
- test_begin(t, "segmentation")
- {
- phy_bridgedma_start(bridgedma_ctx, &job, &job);
- test_fail_unless(
- bridgedma_ctx->status.running
- && !bridgedma_ctx->status.stop
- );
- } test_end;
-
-
- /* reassembly: prepare jobs */
- memset(&job, '\0', sizeof(job));
- job.next = NULL;
- job.data_addr = frame_buffer;
- job.header_len = 6;
- job.data_len = ticket_3_packet_len;
- job.first_pb_desc = pb_first;
- job.first_pb_offset = 0;
- job.segment_len = 512;
- job.direction = 1;
- job.crc_reset = 1;
- job.crc_store = 1;
- job.job_it = 0;
- job.eth_buffer_mask = 0x1fffff0; /* 2048 bytes mask */
-
- test_begin(t, "reassembly of 3 frames")
- {
- phy_bridgedma_start(bridgedma_ctx, &job, &job);
- test_fail_unless(
- bridgedma_ctx->status.running
- && !bridgedma_ctx->status.stop
- );
-
- /* check the buffer content */
- test_fail_unless(
- !memcmp(frame_buffer, ticket_3_packet, ticket_3_packet_len)
- );
- } test_end;
-
- blk_release_desc_range(pb_first, pb_last);
-
-}
-#endif /* 0 */
-
-void bridgedma_test_suite(test_t t)
-{
- test_suite_begin(t, "bridgedma");
-
- station_init (&my_station);
- station_log_set_level(&my_station, STATION_LOG_DEBUG);
- station_log_set_mask(&my_station, STATION_LOGTYPE_ALL);
- my_station.pipe_log_fd = 1;
-
- bridgedma_init_test_case(t);
- bridgedma_pb_data_add_test_case(t);
- bridgedma_segmentation_test_case(t);
- bridgedma_reassembly_test_case(t);
- bridgedma_ticket_3(t);
-
- station_down(&my_station);
-}
diff --git a/cesar/hal/phy/test/bridgedma-soft/synth-Config b/cesar/hal/phy/test/bridgedma-soft/synth-Config
deleted file mode 100644
index ddad644109..0000000000
--- a/cesar/hal/phy/test/bridgedma-soft/synth-Config
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_BRIDGEDMA_SOFT = y
diff --git a/cesar/hal/phy/test/bridgedma-soft/synth-Makefile b/cesar/hal/phy/test/bridgedma-soft/synth-Makefile
deleted file mode 100644
index 0018bbd7ca..0000000000
--- a/cesar/hal/phy/test/bridgedma-soft/synth-Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-BASE = ../../../..
-
-ECOS = y
-
-TARGET_PROGRAMS = test-bridgedma-proto \
- test-bridgedma-proto-tx \
- test-bridgedma-proto-rx \
- test-bridgedma-proto-crc
-
-test-bridgedma-proto_SOURCES = bridgedma-init-test.c
-test-bridgedma-proto_MODULES = hal/phy lib
-
-test-bridgedma-proto-tx_SOURCES = bridgedma-tx-test.c
-test-bridgedma-proto-tx_MODULES = hal/phy lib
-
-test-bridgedma-proto-rx_SOURCES = bridgedma-rx-test.c
-test-bridgedma-proto-rx_MODULES = hal/phy lib
-
-test-bridgedma-proto-crc_SOURCES = bridgedma-crc-test.c
-test-bridgedma-proto-crc_MODULES = hal/phy lib
-
-
-hal_phy_MODULE_SOURCES = bridgedma_soft.c
-VARIANT = synth
-
-include $(BASE)/common/make/top.mk
diff --git a/cesar/hal/phy/test/bridgedma-soft/synth-ecos.ecc.sh b/cesar/hal/phy/test/bridgedma-soft/synth-ecos.ecc.sh
deleted file mode 100644
index 8253d98c9a..0000000000
--- a/cesar/hal/phy/test/bridgedma-soft/synth-ecos.ecc.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-config=${1:-ecos-gen.ecc}
-ecosconfig --config=$config new linux default
-cat >> $config <<EOF
-EOF
-ecosconfig --config=$config check