summaryrefslogtreecommitdiff
path: root/mac/sar/test/maximus_test
diff options
context:
space:
mode:
authorlaranjeiro2007-09-17 08:52:00 +0000
committerlaranjeiro2007-09-17 08:52:00 +0000
commit3e4a2e23e1ee516b784fc81a4010c8908fb50d1c (patch)
tree35e355fc279c96bf85b5a930aa393fa083672068 /mac/sar/test/maximus_test
parent09ff5bb0759bcb54a29d7b45583f18c8be49436b (diff)
Removing the old sar tests on maximus.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@711 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'mac/sar/test/maximus_test')
-rw-r--r--mac/sar/test/maximus_test/Makefile (renamed from mac/sar/test/maximus_test/max_sar_multiple_shoot/Makefile)2
-rw-r--r--mac/sar/test/maximus_test/ecos.ecc.sh (renamed from mac/sar/test/maximus_test/max_sar_multiple_shoot/ecos.ecc.sh)0
-rw-r--r--mac/sar/test/maximus_test/max_sar_multiple_shoot/src/Maximus_sar.cpp207
-rw-r--r--mac/sar/test/maximus_test/max_sar_one_shoot/Makefile13
-rw-r--r--mac/sar/test/maximus_test/max_sar_one_shoot/ecos.ecc.sh104
-rw-r--r--mac/sar/test/maximus_test/max_sar_one_shoot/src/Maximus_sar.cpp174
-rw-r--r--mac/sar/test/maximus_test/max_sar_one_shoot/src/Sta_sar.c646
-rw-r--r--mac/sar/test/maximus_test/src/Maximus_sar.cpp340
-rw-r--r--mac/sar/test/maximus_test/src/Sta_sar.c (renamed from mac/sar/test/maximus_test/max_sar_multiple_shoot/src/Sta_sar.c)0
9 files changed, 341 insertions, 1145 deletions
diff --git a/mac/sar/test/maximus_test/max_sar_multiple_shoot/Makefile b/mac/sar/test/maximus_test/Makefile
index 93f27e3f38..e8c6436776 100644
--- a/mac/sar/test/maximus_test/max_sar_multiple_shoot/Makefile
+++ b/mac/sar/test/maximus_test/Makefile
@@ -1,4 +1,4 @@
-BASE = ../../../../..
+BASE = ../../../..
ECOS = y
diff --git a/mac/sar/test/maximus_test/max_sar_multiple_shoot/ecos.ecc.sh b/mac/sar/test/maximus_test/ecos.ecc.sh
index 19597e4621..19597e4621 100644
--- a/mac/sar/test/maximus_test/max_sar_multiple_shoot/ecos.ecc.sh
+++ b/mac/sar/test/maximus_test/ecos.ecc.sh
diff --git a/mac/sar/test/maximus_test/max_sar_multiple_shoot/src/Maximus_sar.cpp b/mac/sar/test/maximus_test/max_sar_multiple_shoot/src/Maximus_sar.cpp
deleted file mode 100644
index aa0c51e282..0000000000
--- a/mac/sar/test/maximus_test/max_sar_multiple_shoot/src/Maximus_sar.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2007 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file Maximus_sar.c
- * \brief header of the segmentation test function on maximus.
- * \ingroup mac/sar/test/maximus_test/maximus/src
- *
- * Maximus selects a packet to segment in a raw of Ethernet packets.
- * This packet is split in packet of 1024 bytes long corresponding to the
- * maximum size of the maximus parameter.
- *
- * Maximus send the segmentation request and provide the parameters for the
- * segmentation module of the SAR.
- *
- * The Station take the parameters and reconstitute the packet to segment
- * ( simulate the CL or CP function ). It gives the data necessary for
- * the SAR to segment the packet.
- *
- * Once the segmentation is over, the Station answer the request by giving
- * back the PBs filled with the Ethernet packet.
- *
- * Maximus take the PBs and verify each byte comparing it with the Ethernet
- * packet data.
- */
-
-#include "maximus/common/interfaces/Maximus.h"
-#include "maximus/common/interfaces/Sta.h"
-#include "maximus/common/interfaces/Msg.h"
-#include <iostream> // for 'cout', 'cerr' and 'clog'
-using namespace std;
-
-#define debug_info true
-
-typedef unsigned char u8;
-typedef signed char s8;
-
-bool test_fail;
-unsigned char blk[5][1024];
-unsigned int blk_header[5];
-unsigned int nb_data_received;
-
-bool station1_rsp;
-bool station2_rsp;
-
-void station1_cb (Msg &msg);
-void station2_cb (Msg &msg);
-
-int main (int argc, char *argv[])
-{
- unsigned char lid;
- unsigned char tei;
- bool bcast;
- unsigned char packet;
- unsigned char mf_type;
- bool logs;
-
- test_fail = false;
- station1_rsp = false;
- station2_rsp = false;
-
- char value[3];
- char id[5];
- unsigned int i;
-
- Maximus maximus;
- maximus.init (argc, argv);
-
- Sta station1 = maximus.create_sta ();
- //station1.debug();
- Sta station2 = maximus.create_sta ();
- //station2.debug ();
-
- // activate the sta 1 logs
- Msg fc = maximus.create_fc ("activate_logs");
- logs = true;
- fc.add_param ("debug", sizeof(unsigned char), (unsigned char *) &logs);
- fc.send (station2);
- //fc.send (station1);
-
- //create the function call
- Msg fc_sta1 = maximus.create_fc ("segmentation");
-
- lid = 1;
- tei = 2;
- bcast = true;
- mf_type = 2;
- packet = 1;
-
- /* add the buffer address */
- fc_sta1.add_param ("lid", sizeof(unsigned char), (unsigned char*) &lid);
- fc_sta1.add_param ("tei", sizeof(unsigned char), (unsigned char*) &tei);
- fc_sta1.add_param ("packet", sizeof(unsigned char),
- (unsigned char*) &packet);
- fc_sta1.add_param ("bcast", sizeof(unsigned char),
- (unsigned char*) &bcast);
- fc_sta1.add_param ("mf_type", sizeof(unsigned char),
- (unsigned char*) &mf_type);
-
- fc_sta1.set_cb (&station1_cb);
- fc_sta1.send (station1);
-
- while (!station1_rsp)
- {
- maximus.process ();
- }
-
- if (test_fail)
- return 0;
-
- //create the function call
- Msg fc_sta2 = maximus.create_fc ("reassembly");
-
- tei = 1;
-
- /* add the buffer address */
- fc_sta2.add_param ("lid", sizeof(unsigned char), (unsigned char*) &lid);
- fc_sta2.add_param ("tei", sizeof(unsigned char), (unsigned char*) &tei);
- fc_sta2.add_param ("bcast", sizeof(unsigned char), (unsigned char*) &bcast);
- fc_sta2.add_param ("packet", sizeof(unsigned char),
- (unsigned char*) &packet);
- fc_sta2.add_param ("qte", sizeof(unsigned int),
- (unsigned char*) &nb_data_received);
-
- for (i = 0; i < nb_data_received; i++)
- {
- sprintf (value, "%d", i);
- strcpy (id, "pb");
- strcat (id, value);
-
- fc_sta2.add_param (id, 1024 * sizeof(unsigned char),
- (unsigned char*) blk[i]);
-
- strcpy (id, "pbh");
- strcat (id, value);
- fc_sta2.add_param (id, sizeof(unsigned int),
- (unsigned char*) &blk_header[i]);
- }
-
- fc_sta2.set_cb (&station2_cb);
- fc_sta2.send (station2);
-
- while (!station2_rsp)
- {
- maximus.process ();
- }
-
- maximus.wait (10000);
-
- return 0;
-}
-
-void station1_cb (Msg &msg)
-{
- char value[2];
- char id [5];
- unsigned int val;
- void *msg_return;
-
- char * buffer = new char [FUNCTION_CALL_PARAM_MAX_SIZE];
- unsigned long length = FUNCTION_CALL_PARAM_MAX_SIZE*sizeof(char);
-
- // Try to get the error message if the segmentation fail.
- msg_return = msg.bind_param ("type", length, (unsigned char * &) buffer);
-
- if (strcmp (buffer, "SEG") != 0)
- {
- test_fail = true;
- }
- else
- {
- nb_data_received = msg.bind_param<unsigned int> ("qte");
-
- for (val = 0; val < nb_data_received; val++)
- {
- sprintf (value, "%d", val);
-
- strcpy (id, "pb");
- strcat (id, value);
- msg_return = msg.bind_param (id, length,
- (unsigned char * &) buffer);
-
- if (msg_return != NULL)
- {
- memcpy (blk[val], buffer, 512);
- }
-
- strcpy (id, "pbh");
- strcat (id, value);
- blk_header[val] = msg.bind_param<unsigned int> (id);
- }
- }
-
- delete [] buffer;
- buffer = NULL;
-
- station1_rsp = true;
-}
-
-void station2_cb (Msg &msg)
-{
- station2_rsp = true;
-}
diff --git a/mac/sar/test/maximus_test/max_sar_one_shoot/Makefile b/mac/sar/test/maximus_test/max_sar_one_shoot/Makefile
deleted file mode 100644
index 93f27e3f38..0000000000
--- a/mac/sar/test/maximus_test/max_sar_one_shoot/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-BASE = ../../../../..
-
-ECOS = y
-
-HOST_PROGRAMS = Maximus_sar
-Maximus_sar_SOURCES = Maximus_sar.cpp
-Maximus_sar_MODULES = maximus
-
-TARGET_PROGRAMS = Sta_sar
-Sta_sar_SOURCES = Sta_sar.c
-Sta_sar_MODULES = lib mac/sar mac/common host hal/phy/maximus
-
-include $(BASE)/common/make/top.mk \ No newline at end of file
diff --git a/mac/sar/test/maximus_test/max_sar_one_shoot/ecos.ecc.sh b/mac/sar/test/maximus_test/max_sar_one_shoot/ecos.ecc.sh
deleted file mode 100644
index 19597e4621..0000000000
--- a/mac/sar/test/maximus_test/max_sar_one_shoot/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 <cyg/libc/i18n/ctype.inl>
-}
-cdl_option CYGBLD_ISO_ERRNO_CODES_HEADER {
- inferred_value 1 <cyg/error/codes.h>
-}
-cdl_option CYGBLD_ISO_ERRNO_HEADER {
- inferred_value 1 <cyg/error/errno.h>
-}
-cdl_option CYGBLD_ISO_STDIO_FILETYPES_HEADER {
- inferred_value 1 <cyg/libc/stdio/stdio.h>
-}
-cdl_option CYGBLD_ISO_STDIO_STREAMS_HEADER {
- inferred_value 1 <cyg/libc/stdio/stdio.h>
-}
-cdl_option CYGBLD_ISO_STDIO_FILEOPS_HEADER {
- inferred_value 1 <cyg/libc/stdio/stdio.h>
-}
-cdl_option CYGBLD_ISO_STDIO_FILEACCESS_HEADER {
- inferred_value 1 <cyg/libc/stdio/stdio.h>
-}
-cdl_option CYGBLD_ISO_STDIO_FORMATTED_IO_HEADER {
- inferred_value 1 <cyg/libc/stdio/stdio.h>
-}
-cdl_option CYGBLD_ISO_STDIO_CHAR_IO_HEADER {
- inferred_value 1 <cyg/libc/stdio/stdio.h>
-}
-cdl_option CYGBLD_ISO_STDIO_DIRECT_IO_HEADER {
- inferred_value 1 <cyg/libc/stdio/stdio.h>
-}
-cdl_option CYGBLD_ISO_STDIO_FILEPOS_HEADER {
- inferred_value 1 <cyg/libc/stdio/stdio.h>
-}
-cdl_option CYGBLD_ISO_STDIO_ERROR_HEADER {
- inferred_value 1 <cyg/libc/stdio/stdio.h>
-}
-cdl_option CYGBLD_ISO_STDLIB_STRCONV_HEADER {
- inferred_value 1 <cyg/libc/stdlib/atox.inl>
-}
-cdl_option CYGBLD_ISO_STDLIB_ABS_HEADER {
- inferred_value 1 <cyg/libc/stdlib/abs.inl>
-}
-cdl_option CYGBLD_ISO_STDLIB_DIV_HEADER {
- inferred_value 1 <cyg/libc/stdlib/div.inl>
-}
-cdl_option CYGBLD_ISO_STRERROR_HEADER {
- inferred_value 1 <cyg/error/strerror.h>
-}
-cdl_option CYGBLD_ISO_STRTOK_R_HEADER {
- inferred_value 1 <cyg/libc/string/string.h>
-}
-cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER {
- inferred_value 1 <cyg/libc/string/string.h>
-}
-cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER {
- inferred_value 1 <cyg/libc/string/bsdstring.h>
-}
-cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER {
- inferred_value 1 <cyg/libc/string/string.h>
-}
-cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER {
- inferred_value 1 <cyg/libc/string/string.h>
-}
-cdl_option CYGBLD_ISO_C_TIME_TYPES_HEADER {
- inferred_value 1 <cyg/libc/time/time.h>
-}
-cdl_option CYGBLD_ISO_C_CLOCK_FUNCS_HEADER {
- inferred_value 1 <cyg/libc/time/time.h>
-}
-cdl_option CYGBLD_ISO_SIGNAL_NUMBERS_HEADER {
- inferred_value 1 <cyg/libc/signals/signal.h>
-}
-cdl_option CYGBLD_ISO_SIGNAL_IMPL_HEADER {
- inferred_value 1 <cyg/libc/signals/signal.h>
-}
-cdl_option CYGBLD_ISO_SETJMP_HEADER {
- inferred_value 1 <cyg/libc/setjmp/setjmp.h>
-}
-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/mac/sar/test/maximus_test/max_sar_one_shoot/src/Maximus_sar.cpp b/mac/sar/test/maximus_test/max_sar_one_shoot/src/Maximus_sar.cpp
deleted file mode 100644
index dcced72b86..0000000000
--- a/mac/sar/test/maximus_test/max_sar_one_shoot/src/Maximus_sar.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2007 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file Maximus_sar.c
- * \brief header of the segmentation test function on maximus.
- * \ingroup mac/sar/test/maximus_test/maximus/src
- *
- * Maximus selects a packet to segment in a raw of Ethernet packets.
- * This packet is split in packet of 1024 bytes long corresponding to the
- * maximum size of the maximus parameter.
- *
- * Maximus send the segmentation request and provide the parameters for the
- * segmentation module of the SAR.
- *
- * The Station take the parameters and reconstitute the packet to segment
- * ( simulate the CL or CP function ). It gives the data necessary for
- * the SAR to segment the packet.
- *
- * Once the segmentation is over, the Station answer the request by giving
- * back the PBs filled with the Ethernet packet.
- *
- * Maximus take the PBs and verify each byte comparing it with the Ethernet
- * packet data.
- */
-
-#include "maximus/common/interfaces/Maximus.h"
-#include "maximus/common/interfaces/Sta.h"
-#include "maximus/common/interfaces/Msg.h"
-#include <iostream> // for 'cout', 'cerr' and 'clog'
-using namespace std;
-
-#define debug_info false
-
-#define launch_seg true
-#define launch_seg_debug false
-
-#define launch_rea true
-#define launch_rea_debug false
-
-unsigned char blk[3][1024]; // 3 PB received from the Segmentation STA, of with
-// the data and the header.
-
-bool test_fail;
-
-void stationA_cb (Msg &msg)
-{
- char value[2];
- char id [5];
- int val;
- void *msg_return;
-
- char * buffer = new char [FUNCTION_CALL_PARAM_MAX_SIZE];
- unsigned long length = FUNCTION_CALL_PARAM_MAX_SIZE*sizeof(char);
-
- if (debug_info)
- {
- cout << "Hello I'am the station_cb"<< endl;
- }
-
- // Try to get the error message if the segmentation fail.
- msg_return = msg.bind_param ("err", length, (unsigned char * &) buffer);
-
- if (msg_return)
- {
- cout << "The segmentation fail : "<< buffer << endl;
- test_fail = true;
- }
- else
- {
- val = 0;
- do
- {
- strcpy (id, "pb");
- sprintf (value, "%d", val);
- strcat (id, value);
-
- msg_return = msg.bind_param (id, length,
- (unsigned char * &) buffer);
-
- if (msg_return != NULL)
- {
- memcpy (blk[val], buffer, 516);
- }
- } while (val++, msg_return != NULL);
- }
-
- delete [] buffer;
- buffer = NULL;
-}
-
-int main (int argc, char *argv[])
-{
- unsigned char lid;
- unsigned char tei;
- unsigned int i;
- char value[2];
- char id [5];
-
- test_fail = false;
-
- Maximus maximus;
- maximus.init (argc, argv);
-
- if (launch_seg)
- {
- Sta stationA = maximus.create_sta ();
-
- //create the function call
- Msg fc = maximus.create_fc ("segmentation");
-
- lid = 1;
- tei = 1;
-
- /* add the buffer address */
- fc.add_param ("lid", sizeof(unsigned char), (unsigned char*) &lid);
- fc.add_param ("tei", sizeof(unsigned char), (unsigned char*) &tei);
-
- fc.set_cb (&stationA_cb);
- fc.set_sta (stationA);
-
- if (launch_seg_debug) stationA.debug ();
-
- fc.send_async ();
-
- /* Wait during 10000 ticks before terminating the program. */
- maximus.wait (10000);
- }
-
- if (test_fail)
- {
- return 0;
- }
-
- if (launch_rea)
- {
- Sta stationB = maximus.create_sta ();
- //create the function call
- Msg fc2 = maximus.create_fc ("reassembly");
- fc2.set_sta (stationB);
-
- if (launch_rea_debug) stationB.debug ();
-
- if (launch_seg)
- {
- /* Send the pb for a segmentation */
- for (i = 0; i < 3; i++)
- {
- sprintf (value, "%d", i);
- strcpy (id, "pb");
- strcat (id, value);
- fc2.add_param (id, 1024 * sizeof(unsigned char), blk[i]);
- if (debug_info && i == 0)
- printf ("Length : %d\n", *((unsigned short*)(blk[i]
- + sizeof(unsigned int))) >> 2);
- }
- }
- else
- {
- unsigned char val = 0;
- fc2.add_param ("NO", sizeof(unsigned char), &val);
- }
-
- fc2.send_async ();
-
- /* Wait during 10000 ticks before terminating the program. */
- maximus.wait (10000);
- }
- return 0;
-}
diff --git a/mac/sar/test/maximus_test/max_sar_one_shoot/src/Sta_sar.c b/mac/sar/test/maximus_test/max_sar_one_shoot/src/Sta_sar.c
deleted file mode 100644
index f90e9f1329..0000000000
--- a/mac/sar/test/maximus_test/max_sar_one_shoot/src/Sta_sar.c
+++ /dev/null
@@ -1,646 +0,0 @@
-/* Cesar project {{{
- *
- * Copyright (C) 2007 Spidcom
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file station_seg_test.c
- * \brief header of the segmentation test function on maximus.
- * \ingroup mac/sar/test/maximus_test/station/src
- *
- * Maximus selects a packet to segment in a raw of Ethernet packets.
- * This packet is split in packet of 1024 bytes long corresponding to the
- * maximum size of the maximus parameter.
- *
- * Maximus send the segmentation request and provide the parameters for the
- * segmentation module of the SAR.
- *
- * The Station take the parameters and reconstitute the packet to segment
- * ( simulate the CL or CP function ). It gives the data necessary for
- * the SAR to segment the packet.
- *
- * Once the segmentation is over, the Station answer the request by giving
- * back the PBs filled with the Ethernet packet.
- *
- * Maximus take the PBs and verify each byte comparing it with the Ethernet
- * packet data.
- */
-
-#include <cyg/infra/diag.h>
-#include <cyg/kernel/kapi.h>
-#include <errno.h>
-#include <string.h>
-#include "common/std.h"
-#include "host/station.h"
-
-#include "mac/sar/sar.h"
-
-#include "mac/sar/inc/segmentation_unit_test_function.h"
-#include "mac/sar/inc/reassembly_unit_test_functions.h"
-
-#include "mac/sar/test/inc/eth_packets.h"
-
-#define seg_debug_info false
-#define rea_debug_info true
-
-extern station_ctx_t my_station;
-
-mfs_tx_t *mfs;
-
-u8 sar_buffer[2048] __attribute__((aligned(2048)));
-unsigned short msg_id;
-
-int segmentation (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg,
- void *data);
-bool bridge_dma_interruption_station_seg (void *user, u32 status_word);
-
-int reassembly (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg,
- void *data);
-int reassembly_simu (fcall_ctx_t *fcall, fcall_param_t **param,
- sci_msg_t **msg, void *data);
-int reassembly_real (fcall_ctx_t *fcall, fcall_param_t **param,
- sci_msg_t **msg, void *data);
-
-bool bridge_dma_interruption_station_rea (void *user, u32 status_word);
-
-u16 mix_up_pbs (pb_t **first, pb_t **last);
-
-int main (void)
-{
- sar_reassembly_ctx_t *data_ctx;
- sar_reassembly_ctx_t *mme_ctx;
-
- if (ECOS)
- {
- printf ("Ecos is here\n");
- }
-
- station_log_set_level (&my_station, STATION_LOG_DEBUG);
- station_log_set_mask (&my_station, STATION_LOGTYPE_ALL);
- my_station.pipe_log_fd = 1;
-
- diag_write_string ("hello by SAR\n");
-
- // test function call
- fcall_register (my_station.fcall, "segmentation", &segmentation, NULL);
- fcall_register (my_station.fcall, "reassembly", &reassembly, NULL);
-
- //initialize the sar
- sar_initialize ();
- sar_init_mac_store (&sar_ctx, mac_store_init ());
-
- sar_init_measure_context (&sar_ctx, &sar_ctx);
- sar_init_mme_context (&sar_ctx, &sar_ctx);
- sar_init_data_context (&sar_ctx, &sar_ctx);
-
- sar_init_measurement_cb (&sar_ctx, NULL);
- sar_init_noise_cb (&sar_ctx, NULL);
-
- sar_init_segmentation_data_cb (&sar_ctx, sar_segmentation_done);
- sar_init_segmentation_mme_cb (&sar_ctx, sar_segmentation_done);
-
- data_ctx = sar_init_reassembly_data_cb (&sar_ctx,
- sar_complete_reassembly_done);
- sar_init_segmentation_mme_cb (&sar_ctx, sar_complete_segmentation_done);
- mme_ctx = sar_init_reassembly_mme_cb (&sar_ctx,
- sar_complete_reassembly_done);
- sar_init_measurement_cb (&sar_ctx, test_sar_rx_pb_measurement_cb);
- sar_init_noise_cb (&sar_ctx, test_sar_rx_noise_cb);
-
- u16 i;
- for (i = 0; i < packet2_len && false; i++)
- {
- if (i % 16== 0)
- printf ("\n");
- printf ("0x%02x ", packet2[i]);
- }
-
- mac_store_sta_add (sar_ctx.expiration.mfs_store, 0x1);
-
- return 0;
-}
-
-/**
- * Get the request from the simulator and segment the packet.
- */
-int segmentation (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg,
- void *data)
-{
- u8 lid;
- u8 tei;
- bool added;
- u32 i;
-
- /* init the bridge dma with the call back for the segmentation.
- *
- * In the real bridge dma funciton call back it is the same function for
- * both segmentation and reassembly.
- *
- * They are different only in this test, because the bridgedma callback
- * sends PBs to maximus.
- */
- sar_ctx.bridgedma_ctx = phy_bridgedma_init (NULL,
- bridge_dma_interruption_station_seg, bridge_dma_deffered_interruption);
-
- mfs = mac_store_mfs_add_tx (sar_ctx.expiration.mfs_store, false, false,
- 1, 1, &added);
- dbg_assert (&added);
-
- mfs->head = NULL;
- mfs->tail = NULL;
-
- sar_mfs_add (&sar_ctx, (mfs_t *) mfs);
-
- msg_id = (*param)->msg_id;
- fcall_param_bind (*param, *msg, "lid", sizeof(u8), &lid);
- fcall_param_bind (*param, *msg, "tei", sizeof(u8), &tei);
-
- if (seg_debug_info)
- {
- printf ("[Segmentation] lid : %d\n", lid);
- printf ("[Segmentation] tei : %d\n", tei);
- }
-
- fcall_param_set_async (*param, 1);
-
- /** Get the MFS from the store **/
- mfs = mac_store_mfs_get_tx (sar_ctx.expiration.mfs_store, false, false,
- lid, tei);
- dbg_assert (mfs);
-
- memcpy (sar_buffer, packet2, packet2_len);
-
- printf ("[Segmentation] Verifing the sar_buffer with the packet2 ...\n");
- for (i = 0; i < packet2_len && seg_debug_info; i++)
- {
- if (sar_buffer[i] != packet2[i])
- printf ("[Segmentation] Error data does not correspond \n");
- }
- printf ("[Segmentation] Verification ended\n");
-
- /** Add the msdu to segment **/
- sar_msdu_add (&sar_ctx, sar_buffer, 2, packet2_len - 1, 0x12345678, mfs);
-
- /** Launch the SAR to segment the msdu **/
- sar_launch (0);
-
- return 0;
-}
-
-/** Implement the bidge_dma interuption of the SAR to send the PBs from the
- * MFS **/
-bool bridge_dma_interruption_station_seg (void *user, u32 status_word)
-{
- static fcall_param_t return_param;
- static sci_msg_t return_msg;
- static unsigned char return_buffer[SCI_MSG_MAX_SIZE];
-
- u32 i;
- unsigned char value [2];
- unsigned char name [10];
-
- pb_t *pb;
- u8 pb_data[BLK_SIZE + sizeof(u32)];
-
- /** Variables for the segmentation test */
- u8 seg_buffer_test [2048];
- bool seg_test_fail;
-
- dbg_assert (mfs);
- dbg_assert (mfs->head);
-
- /** init structures **/
- fcall_param_init (&return_param, "seg_complete_done", msg_id);
- sci_msg_init (&return_msg, return_buffer, SCI_MSG_MAX_SIZE);
-
- /** reset the param list **/
- fcall_param_reset (&return_param);
-
- /** get the number of PBs in the MFS **/
- dbg_assert (mfs);
- dbg_assert (mfs->head);
-
- if (seg_debug_info)
- {
- printf ("[Segmentation] Verifying the PB data...\n");
- i = 0;
- for (pb = mfs->head; pb; pb = pb->next)
- {
- memcpy (seg_buffer_test + i, pb->data, BLK_SIZE);
- i += BLK_SIZE;
- }
-
- seg_test_fail = false;
- for (i = 0; i < packet2_len && !seg_test_fail; i++)
- {
- if (seg_buffer_test[i + 6] != packet2[i]&& i < packet2_len - 1)
- {
- printf ("[Segmentation] Error on seg : %d\n", i);
- seg_test_fail = true;
- }
- }
- printf ("[Segmentation] Verification of PB data ended\n");
- }
-
- if (seg_test_fail)
- {
- fcall_param_add (&return_param, &return_msg, "err", sizeof(u32),
- (unsigned char *) "seg fail");
-
- printf ("/***********************************************************/\n");
- printf (" :( [Segmentation] FAIL :(\n");
- printf ("/***********************************************************/\n");
- }
- else
- {
-
- for (i = 0, pb = mfs->head; pb; i++, pb = pb->next)
- {
- sprintf (value, "%d", i);
- strcpy (name, "pb");
- strcat (name, value);
-
- memcpy (pb_data, &pb->header, sizeof(u32));
- memcpy ((pb_data + sizeof(u32)), pb->data, BLK_SIZE);
-
- fcall_param_add (&return_param, &return_msg, (char *) name,
- BLK_SIZE+ sizeof(u32), (unsigned char *) pb_data);
- }
-
- printf ("/***********************************************************/\n");
- printf (" ^^ [Segmentation] SUCCESS ^^\n");
- printf ("/***********************************************************/\n");
-
- }
-
- /* return */
- fcall_return (my_station.fcall, &return_param, &return_msg);
-
- pb_free_range (mfs->head);
- sar_expiration_mfs_destroy (&sar_ctx.expiration, (mfs_t *) mfs);
-
- mac_store_sta_remove (sar_ctx.expiration.mfs_store, 0x1);
- mac_store_uninit (sar_ctx.expiration.mfs_store);
-
- return true;
-}
-
-int reassembly (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg,
- void *data)
-{
- u8 rea_buffer[3] = { 1, 1, 1 };
-
- fcall_param_bind (*param, *msg, "NO", 10 * sizeof(u8), rea_buffer);
-
- if (rea_buffer[0] == '\0')
- {
- return reassembly_simu (fcall, param, msg, data);
- }
- else
- {
- return reassembly_real (fcall, param, msg, data);
- }
-}
-
-int reassembly_simu (fcall_ctx_t *fcall, fcall_param_t **param,
- sci_msg_t **msg, void *data)
-{
- unsigned short ayncrhonous_msg_id = 0;
- pb_t *pb_head;
- pb_t *pb_tail;
- pbproc_rx_params_t rx_params;
- u16 offset;
-
- /* init the bridge dma with the call back for the segmentation.
- *
- * In the real bridge dma funciton call back it is the same function for
- * both segmentation and reassembly.
- *
- * They are different only in this test, because the bridgedma callback
- * sends PBs to maximus.
- */
- sar_ctx.bridgedma_ctx = phy_bridgedma_init (NULL,
- bridge_dma_interruption_station_rea, bridge_dma_deffered_interruption);
-
- printf ("/******************************************/\n");
- printf ("/* SIMULATION MODE */\n");
- printf ("/******************************************/\n");
-
- fcall_param_set_async (*param, 1);
- ayncrhonous_msg_id = (*param)->msg_id;
-
- /** allocate the pb */
- pb_head = (pb_t *) blk_alloc_desc_range (3, (blk_t **) &pb_tail);
- pb_tail->next = NULL;
-
- // had the MFH
- ((sar_mf_mfh_t*) pb_head->data)->type = 2;
- ((sar_mf_mfh_t*) pb_head->data)->length = packet2_len - 1;
- ((sar_mf_mfh_t*) pb_head->data)->ats = 0x1234;
-
- // had the ATS
- * ((u16*)pb_head->data + 4) = 0x5678;
-
- // had the payload
- offset = sizeof(u16) + sizeof(u32);
-
- memcpy (pb_head->data + offset, packet2, 506);
- memcpy (pb_head->next->data, packet2 + 506, BLK_SIZE);
- memcpy (pb_head->next->next->data, packet2 + 1018, 1470 - 1018);
- * (pb_head->next->next->data + 456) = 0x0;
-
- pb_head->header.mfbf = true;
- pb_head->header.mfbo = 0x0;
- pb_head->header.ssn = 0;
-
- pb_head->next->header.mfbf = false;
- pb_head->next->header.ssn = 1;
-
- pb_head->next->next->header.mfbf = false;
- pb_head->next->next->header.ssn = 2;
-
- // mix up the PBs
- printf ("[Reassembly] Modifying the PBs sequence...\n");
- mix_up_pbs (&pb_head, &pb_tail);
- printf ("[Reassembly] PBs sequence modified\n");
-
- rx_params.lid = 0x1;
- rx_params.tei = 0x1;
- rx_params.bcast = false;
- rx_params.date = 0x1234578;
-
- // First MF.
- sar_mpdu_add (&sar_ctx, NULL, NULL, &rx_params, pb_head, pb_tail, 3, NULL);
-
- /** Launch the SAR to segment the msdu **/
- sar_launch (0);
-
- /** Launch the bridge dma with the buffer*/
- sar_buffer_add (&sar_ctx.data_ctx, sar_buffer);
- sar_launch (0);
-
- return true;
-}
-
-/**
- * Get the request from the simulator and segment the packet.
- */
-int reassembly_real (fcall_ctx_t *fcall, fcall_param_t **param,
- sci_msg_t **msg, void *data)
-{
- pb_t *pb_first;
- pb_t *pb_last;
- pb_t *pb_curr;
- u32 i;
- u8 value[2];
- u8 id [5];
- u8 rea_buffer[1024];
- pbproc_rx_params_t rx_params;
-
- u8 rea_buffer_test[2048];
- bool rea_test_fail;
-
- /* init the bridge dma with the call back for the segmentation.
- *
- * In the real bridge dma funciton call back it is the same function for
- * both segmentation and reassembly.
- *
- * They are different only in this test, because the bridgedma callback
- * sends PBs to maximus.
- */
- sar_ctx.bridgedma_ctx = phy_bridgedma_init (NULL,
- bridge_dma_interruption_station_rea, bridge_dma_deffered_interruption);
-
- msg_id = (*param)->msg_id;
-
- pb_first = NULL;
- pb_curr = NULL;
- for (i = 0; i < 3; i++)
- {
- strcpy (id, "pb");
- sprintf (value, "%d", i);
- strcat (id, value);
-
- fcall_param_bind (*param, *msg, id, BLK_SIZE + sizeof(u32),
- rea_buffer);
-
- if (pb_curr == NULL)
- {
- pb_curr = (pb_t *) blk_alloc_desc ();
- pb_first = pb_curr;
- }
- else
- {
- pb_curr->next = (pb_t *) blk_alloc_desc ();
- pb_curr = pb_curr->next;
- }
-
- memcpy (&pb_curr->header, rea_buffer, sizeof(u32));
- memcpy (pb_curr->data, (rea_buffer + sizeof(u32)), BLK_SIZE);
- pb_curr->header.vpbf = true;
- }
-
- pb_last = pb_curr;
- pb_curr->next = NULL;
- fcall_param_set_async (*param, 1);
-
- if (rea_debug_info)
- {
- /* The Pbs are not mixed yet. This test verify if the data received are
- correct */
- printf ("[Reassembly] Testing the PBs received ...\n");
- i = 0;
- for (pb_curr = pb_first; pb_curr; pb_curr = pb_curr->next)
- {
- memcpy (rea_buffer_test + i, pb_curr->data, BLK_SIZE);
- i += BLK_SIZE;
- }
-
- rea_test_fail = false;
- for (i = 0; i < packet2_len && !rea_test_fail; i++)
- {
- if (rea_buffer_test[i + 6] != packet2[i]&& i < packet2_len - 1)
- {
- printf ("[Reassembly] Error on rea : %d\n", i);
- rea_test_fail = true;
- }
- }
-
- if (!rea_test_fail)
- {
- printf ("/***********************************/\n");
- printf ("[Reassembly] Data received correct\n");
- printf ("/***********************************/\n");
- }
- else
- {
- printf ("/************************************/\n");
- printf ("[Reassembly] Data received are corrupt\n");
- printf ("/************************************/\n");
- return 0;
- }
- }
-
- if (rea_debug_info)
- printf ("[Reassembly] MF length : %d\n", mf_get_length (pb_first, 0,
- false));
-
- // mix up the PBs
- printf ("[Reassembly] Modifying the PBs sequence...\n");
- mix_up_pbs (&pb_first, &pb_last);
- printf ("[Reassembly] PBs sequence modified\n");
-
- rx_params.lid = 0x1;
- rx_params.tei = 0x1;
- rx_params.bcast = false;
- rx_params.date = 100;
-
- sar_mpdu_add (&sar_ctx, NULL, NULL, &rx_params, pb_first, pb_last, 3,
- NULL);
- sar_launch (0);
-
- sar_buffer_add (&sar_ctx.data_ctx, sar_buffer);
- sar_launch (0);
-
- return true;
-}
-
-/** Implement the bidge_dma interuption of the SAR to send the PBs from the
- * MFS **/
-bool bridge_dma_interruption_station_rea (void *user, u32 status_word)
-{
- u32 i, j;
- bool error;
- sar_job_mfs_t *job;
- pb_t *pb_curr;
-
- if (rea_debug_info)
- {
- printf ("[Reassembly] Entering in bridge_dma_interruption_station_rea\n");
- }
-
- job = bridge_dma_get_head (&sar_ctx.bridge_dma_jobs);
- dbg_assert (job);
-
- error = false;
-
- if (rea_debug_info)
- {
- //verify the data of the buffer with the data in the PBs
- i = 0;
- j = 0;
- printf ("[Reassembly] Veryfing the bridge dma copy ...\n");
- for (pb_curr = (pb_t *)job->job.first_pb_desc; pb_curr; pb_curr
- = pb_curr->next)
- {
- if (pb_curr->header.ssn == 0)
- j = 6;
- else
- j = 0;
-
- for (i = 0; (i < packet2_len - 1) && !error; i++, j++)
- {
- if (j == BLK_SIZE)
- {
- j = 0;
- pb_curr = pb_curr->next;
- }
-
- if (job->job.data_addr[i] != pb_curr->data[j])
- {
- printf (
- "[Reassembly] Copy error : %d, buffer data : %x, pb data : %x\n",
- i, job->job.data_addr[i], pb_curr->data[j]);
- error = true;
- }
- }
- }
- printf ("[Reassembly] Veryfing the bridge dma copy ended\n");
- }
-
- printf ("[Reassembly] Veryfing the buffer with the ethernet packet...\n");
- for (i = 0; i < packet2_len && !error; i++)
- {
- if (job->job.data_addr[i] != packet2[i])
- error = true;
- }
- printf ("[Reassembly] Veryfication the buffer with the ethernet packet ended\n");
-
- if (error == true)
- {
- printf ("/***********************************/\n");
- printf (" :( [Reassembly] FAIL :(\n");
- printf ("/***********************************/\n");
- }
- else
- {
- printf ("/***********************************/\n");
- printf (" ^^ [Reassembly] SUCCESS ^^\n");
- printf ("/***********************************/\n");
- }
-
- pb_free_range ((pb_t *) job->job.first_pb_desc);
- job->mfs->rx.head = NULL;
- job->mfs->rx.tail = NULL;
- blk_release (job->mfs);
- blk_release (job);
-
- mfs_rx_t *mfs;
- mfs = mac_store_mfs_get_rx (sar_ctx.expiration.mfs_store, false, false,
- 0x1, 0x1);
- dbg_assert (mfs);
- sar_expiration_mfs_destroy (&sar_ctx.expiration, (mfs_t *) mfs);
-
- mac_store_sta_remove (sar_ctx.expiration.mfs_store, 0x1);
- mac_store_uninit (sar_ctx.expiration.mfs_store);
-
- return true;
-}
-
-u16 mix_up_pbs (pb_t **first, pb_t **last)
-{
- pb_t *list[100];
- u16 size;
- pb_t *head;
- pb_t *tmp;
- lib_rnd_t rnd_ctx1;
- lib_rnd_t rnd_ctx2;
- int i;
- u16 slot1;
- u16 slot2;
-
- lib_rnd_init (&rnd_ctx1, 123456);
- lib_rnd_init (&rnd_ctx2, 234567);
-
- //count the quantity of PBs.
- for (size = 0, head = *first; head != NULL; head = head->next, size++)
- {
- list[size] = head;
- }
- list[size] = NULL;
-
- // randomize the list
- for (i = 0; i < size; i++)
- {
- slot1 = lib_rnd32 (&rnd_ctx1) % size;
- slot2 = lib_rnd32 (&rnd_ctx2) % size;
-
- tmp = list[slot1];
- list[slot1] = list[slot2];
- list[slot2] = tmp;
- }
-
- //Chain the PB list
- for (i = 0; i < size - 1; i++)
- {
- list[i]->next = list[i+1];
- }
-
- *first = list[0];
- *last = list[size - 1];
- list[size - 1]->next = NULL;
-
- return size;
-}
diff --git a/mac/sar/test/maximus_test/src/Maximus_sar.cpp b/mac/sar/test/maximus_test/src/Maximus_sar.cpp
new file mode 100644
index 0000000000..8d425dccf9
--- /dev/null
+++ b/mac/sar/test/maximus_test/src/Maximus_sar.cpp
@@ -0,0 +1,340 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file Maximus_sar.c
+ * \brief header of the segmentation test function on maximus.
+ * \ingroup mac/sar/test/maximus_test/maximus/src
+ *
+ * Maximus selects a packet to segment in a raw of Ethernet packets.
+ * This packet is split in packet of 1024 bytes long corresponding to the
+ * maximum size of the maximus parameter.
+ *
+ * Maximus send the segmentation request and provide the parameters for the
+ * segmentation module of the SAR.
+ *
+ * The Station take the parameters and reconstitute the packet to segment
+ * ( simulate the CL or CP function ). It gives the data necessary for
+ * the SAR to segment the packet.
+ *
+ * Once the segmentation is over, the Station answer the request by giving
+ * back the PBs filled with the Ethernet packet.
+ *
+ * Maximus take the PBs and verify each byte comparing it with the Ethernet
+ * packet data.
+ */
+
+#include "maximus/common/interfaces/Maximus.h"
+#include "maximus/common/interfaces/Sta.h"
+#include "maximus/common/interfaces/Msg.h"
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+#define debug_info true
+
+typedef void (station_cb_t) (Msg &msg);
+
+/**
+ * The station 1 callback
+ *
+ * \param msg the message
+ */
+void station1_cb (Msg &msg);
+
+/**
+ * The station 2 callback
+ *
+ * \param msg the message
+ */
+void station2_cb (Msg &msg);
+
+/**
+ * Launch the segmentation process on the sta with the packet provided given by
+ * packet number.
+ *
+ * \param station the station on which the segmentation must be done
+ * \param sta_cb the callback to call once the bridge dma had finished to
+ * process a segmentation.
+ * \param lid the lid of the MFS.
+ * \param tei the tei of the destination sta
+ * \param bcast if it is a bcast message
+ * \param mf_type the type of the message, will be verified with the lid on the
+ * station.
+ * \param packet the packet row number of the Ethernet packet array in the sta,
+ * see the eth_packets.h in mac/sar/test/inc.
+ *
+ * \return a boolean set to true.
+ */
+bool segmentation (Sta *station, station_cb_t sta_cb, unsigned char lid,
+ unsigned char tei, bool bcast, unsigned char mf_type,
+ unsigned char packet);
+
+/**
+ * Launch the reassembly process on the sta with the packets previously
+ * segmented by another sta.
+ *
+ * \param station the station on which the segmentation must be done
+ * \param sta_cb the callback to call once the bridge dma had finished to
+ * process a reassembly.
+ * \param lid the lid of the MFS.
+ * \param tei the tei of the destination sta
+ * \param bcast if it is a bcast message
+ * \param mf_type the type of the message, will be verified with the lid on the
+ * station.
+ * \param packet the packet row number of the Ethernet packet array in the sta,
+ * see the eth_packets.h in mac/sar/test/inc.
+ *
+ * \return a boolean set to true.
+ */
+bool reassembly (Sta *station, station_cb_t sta_cb, unsigned char lid,
+ unsigned char tei, bool bcast, unsigned char mf_type,
+ unsigned char packet);
+
+/**
+ * Launch the test on one shoot mode.
+ *
+ * \param argc the quantity of arguments provided
+ * \param argv the char array containing the arguments
+ *
+ * \return the end value
+ */
+int one_shoot (int argc, char *argv[]);
+
+unsigned char blk[5][1024];
+unsigned int blk_header[5];
+unsigned int nb_data_received;
+
+bool station1_rsp;
+bool station2_rsp;
+bool test_fail;
+
+Maximus maximus;
+
+int main (int argc, char *argv[])
+{
+ return one_shoot(argc, argv);
+}
+
+/**
+ * Launch the test on one shoot mode.
+ *
+ * \param argc the quantity of arguments provided
+ * \param argv the char array containing the arguments
+ *
+ * \return the end value
+ */
+int one_shoot (int argc, char *argv[])
+{
+ unsigned char lid;
+ unsigned char tei;
+ bool bcast;
+ unsigned char mf_type;
+ unsigned char packet;
+ bool logs;
+
+ test_fail = false;
+ station1_rsp = false;
+ station2_rsp = false;
+
+ maximus.init (argc, argv);
+
+ Sta station1 = maximus.create_sta ();
+ //station1.debug();
+ Sta station2 = maximus.create_sta ();
+ //station2.debug ();
+
+ // activate the sta 1 logs
+ Msg fc = maximus.create_fc ("activate_logs");
+ logs = true;
+ fc.add_param ("debug", sizeof(unsigned char), (unsigned char *) &logs);
+ fc.send (station2);
+ //fc.send (station1);
+
+ lid = 1;
+ tei = 2;
+ bcast = true;
+ mf_type = 2;
+ packet = 0;
+ segmentation (&station1, station1_cb, lid, tei, bcast, mf_type, packet);
+
+ while (!station1_rsp)
+ {
+ maximus.process ();
+ }
+
+ if (test_fail)
+ return 0;
+
+ tei = 1;
+ reassembly (&station2, station2_cb, lid, tei, bcast, mf_type, packet);
+
+ while (!station2_rsp)
+ {
+ maximus.process ();
+ }
+
+ maximus.wait (10000);
+
+ return 0;
+}
+
+/**
+ * The station 1 callback
+ *
+ * \param msg the message
+ */
+void station1_cb (Msg &msg)
+{
+ char value[2];
+ char id [5];
+ unsigned int val;
+ void *msg_return;
+
+ char * buffer = new char [FUNCTION_CALL_PARAM_MAX_SIZE];
+ unsigned long length = FUNCTION_CALL_PARAM_MAX_SIZE*sizeof(char);
+
+ // Try to get the error message if the segmentation fail.
+ msg_return = msg.bind_param ("type", length, (unsigned char * &) buffer);
+
+ if (strcmp (buffer, "SEG") != 0)
+ {
+ test_fail = true;
+ }
+ else
+ {
+ nb_data_received = msg.bind_param<unsigned int> ("qte");
+
+ for (val = 0; val < nb_data_received; val++)
+ {
+ sprintf (value, "%d", val);
+
+ strcpy (id, "pb");
+ strcat (id, value);
+ msg_return = msg.bind_param (id, length,
+ (unsigned char * &) buffer);
+
+ if (msg_return != NULL)
+ {
+ memcpy (blk[val], buffer, 512);
+ }
+
+ strcpy (id, "pbh");
+ strcat (id, value);
+ blk_header[val] = msg.bind_param<unsigned int> (id);
+ }
+ }
+
+ delete [] buffer;
+ buffer = NULL;
+
+ station1_rsp = true;
+}
+
+/**
+ * The station 2 callback
+ *
+ * \param msg the message
+ */
+void station2_cb (Msg &msg)
+{
+ station2_rsp = true;
+}
+
+/**
+ * Launch the segmentation process on the sta with the packet provided given by
+ * packet number.
+ *
+ * \param station the station on which the segmentation must be done
+ * \param sta_cb the callback to call once the bridge dma had finished to
+ * process a segmentation.
+ * \param lid the lid of the MFS.
+ * \param tei the tei of the destination sta
+ * \param bcast if it is a bcast message
+ * \param mf_type the type of the message, will be verified with the lid on the
+ * station.
+ * \param packet the packet row number of the Ethernet packet array in the sta,
+ * see the eth_packets.h in mac/sar/test/inc.
+ *
+ * \return a boolean set to true.
+ */
+bool segmentation (Sta *station, station_cb_t sta_cb, unsigned char lid,
+ unsigned char tei, bool bcast, unsigned char mf_type,
+ unsigned char packet)
+{
+ //create the function call
+ Msg fc_sta = maximus.create_fc ("segmentation");
+
+ /* add the buffer address */
+ fc_sta.add_param ("lid", sizeof(unsigned char), &lid);
+ fc_sta.add_param ("tei", sizeof(unsigned char), &tei);
+ fc_sta.add_param ("packet", sizeof(unsigned char), &packet);
+ fc_sta.add_param ("bcast", sizeof(unsigned char), (unsigned char*) &bcast);
+ fc_sta.add_param ("mf_type", sizeof(unsigned char), &mf_type);
+
+ fc_sta.set_cb (sta_cb);
+ fc_sta.send (*station);
+
+ return true;
+}
+
+/**
+ * Launch the reassembly process on the sta with the packets previously
+ * segmented by another sta.
+ *
+ * \param station the station on which the segmentation must be done
+ * \param sta_cb the callback to call once the bridge dma had finished to
+ * process a reassembly.
+ * \param lid the lid of the MFS.
+ * \param tei the tei of the destination sta
+ * \param bcast if it is a bcast message
+ * \param mf_type the type of the message, will be verified with the lid on the
+ * station.
+ * \param packet the packet row number of the Ethernet packet array in the sta,
+ * see the eth_packets.h in mac/sar/test/inc.
+ *
+ * \return a boolean set to true.
+ */
+bool reassembly (Sta *station, station_cb_t sta_cb, unsigned char lid,
+ unsigned char tei, bool bcast, unsigned char mf_type,
+ unsigned char packet)
+{
+ char value[3];
+ char id[5];
+ unsigned int i;
+
+ //create the function call
+ Msg fc_sta = maximus.create_fc ("reassembly");
+
+ /* add the buffer address */
+ fc_sta.add_param ("lid", sizeof(unsigned char), &lid);
+ fc_sta.add_param ("tei", sizeof(unsigned char), &tei);
+ fc_sta.add_param ("bcast", sizeof(unsigned char), (unsigned char*) &bcast);
+ fc_sta.add_param ("packet", sizeof(unsigned char), &packet);
+ fc_sta.add_param ("qte", sizeof(unsigned int),
+ (unsigned char*) &nb_data_received);
+
+ for (i = 0; i < nb_data_received; i++)
+ {
+ sprintf (value, "%d", i);
+ strcpy (id, "pb");
+ strcat (id, value);
+
+ fc_sta.add_param (id, 1024 * sizeof(unsigned char),
+ (unsigned char*) blk[i]);
+
+ strcpy (id, "pbh");
+ strcat (id, value);
+ fc_sta.add_param (id, sizeof(unsigned int),
+ (unsigned char*) &blk_header[i]);
+ }
+
+ fc_sta.set_cb (sta_cb);
+ fc_sta.send (*station);
+
+ return true;
+}
+
diff --git a/mac/sar/test/maximus_test/max_sar_multiple_shoot/src/Sta_sar.c b/mac/sar/test/maximus_test/src/Sta_sar.c
index 38baad36be..38baad36be 100644
--- a/mac/sar/test/maximus_test/max_sar_multiple_shoot/src/Sta_sar.c
+++ b/mac/sar/test/maximus_test/src/Sta_sar.c