summaryrefslogtreecommitdiff
path: root/mac/sar/test/maximus_test
diff options
context:
space:
mode:
authorlaranjeiro2007-09-04 16:04:51 +0000
committerlaranjeiro2007-09-04 16:04:51 +0000
commit3bc3a35ca3ca24dcea3fb09ca6ab00b2a5b84bbe (patch)
tree8d9c88dd5ebb542c8c31996486196ef0a91c284c /mac/sar/test/maximus_test
parentd088b810ca6770edeb1d5d1602c62a86bae5b745 (diff)
Update the SAR with the new header write system. see sar_mf.h.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@658 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'mac/sar/test/maximus_test')
-rw-r--r--mac/sar/test/maximus_test/maximus_rea/Makefile13
-rw-r--r--mac/sar/test/maximus_test/maximus_rea/ecos.ecc.sh104
-rw-r--r--mac/sar/test/maximus_test/maximus_rea/src/Maximus_rea.cpp66
-rw-r--r--mac/sar/test/maximus_test/maximus_rea/src/station_rea.c379
-rw-r--r--mac/sar/test/maximus_test/maximus_seg/src/station_sar_seg_test.c5
5 files changed, 565 insertions, 2 deletions
diff --git a/mac/sar/test/maximus_test/maximus_rea/Makefile b/mac/sar/test/maximus_test/maximus_rea/Makefile
new file mode 100644
index 0000000000..f30d1cd451
--- /dev/null
+++ b/mac/sar/test/maximus_test/maximus_rea/Makefile
@@ -0,0 +1,13 @@
+BASE = ../../../../..
+
+ECOS = y
+
+HOST_PROGRAMS = Maximus_rea
+Maximus_rea_SOURCES = Maximus_rea.cpp
+Maximus_rea_MODULES = maximus
+
+TARGET_PROGRAMS = station_rea
+station_rea_SOURCES = station_rea.c
+station_rea_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/maximus_rea/ecos.ecc.sh b/mac/sar/test/maximus_test/maximus_rea/ecos.ecc.sh
new file mode 100644
index 0000000000..19597e4621
--- /dev/null
+++ b/mac/sar/test/maximus_test/maximus_rea/ecos.ecc.sh
@@ -0,0 +1,104 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new maximus default
+cat >> $config <<'EOF'
+cdl_option CYGPKG_HAL_MAXIMUS_CFLAGS_ADD {
+ user_value "-I\$(BASE) -I\$(OBJ_DIR)/inc"
+ # value_source user
+ # Default value: "-I\$(REPOSITORY)/../.."
+}
+cdl_option CYGBLD_GLOBAL_CFLAGS {
+ user_value "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority -finline"
+ # value_source user
+ # Default value: "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority"
+}
+cdl_option CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT {
+ user_value 0
+ inferred_value 0
+}
+cdl_option CYGBLD_ISO_CTYPE_HEADER {
+ inferred_value 1 <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/maximus_rea/src/Maximus_rea.cpp b/mac/sar/test/maximus_test/maximus_rea/src/Maximus_rea.cpp
new file mode 100644
index 0000000000..2add3bb74c
--- /dev/null
+++ b/mac/sar/test/maximus_test/maximus_rea/src/Maximus_rea.cpp
@@ -0,0 +1,66 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file Maximus_rea.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;
+
+void station_cb (Msg &msg)
+{
+ unsigned long qte;
+
+ /** Get the quantity of PBs generated **/
+ qte = msg.bind_param<unsigned long> ("qte");
+
+ cout << "Qte of pbs for the packet : "<< qte << endl;
+}
+
+int main (int argc, char *argv[])
+{
+ Maximus maximus;
+
+ maximus.init (argc, argv);
+
+ Sta stationA = maximus.create_sta ();
+
+ //create the function call
+ Msg fc = maximus.create_fc ("reassembly");
+
+ fc.set_cb (&station_cb);
+ fc.set_sta (stationA);
+
+ fc.send_async ();
+
+ /* Wait during 10000 ticks before terminating the program. */
+ maximus.wait (10000);
+ return 0;
+}
diff --git a/mac/sar/test/maximus_test/maximus_rea/src/station_rea.c b/mac/sar/test/maximus_test/maximus_rea/src/station_rea.c
new file mode 100644
index 0000000000..c5c2e493cf
--- /dev/null
+++ b/mac/sar/test/maximus_test/maximus_rea/src/station_rea.c
@@ -0,0 +1,379 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file station_rea.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 <stdio.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"
+
+extern station_ctx_t my_station;
+
+mfs_tx_t *mfs;
+
+unsigned char packet1[] = { 0xd4, 0xc3, 0xb2, 0xa1, 0x02, 0x00, 0x04, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x99, 0x32, 0x97, 0x46, 0x3e, 0xc3,
+ 0x07, 0x00, 0x42, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x52,
+ 0x54, 0x00, 0x12, 0x35, 0x02, 0x08, 0x00, 0x27, 0x52, 0x20, 0x4c,
+ 0x08, 0x00, 0x45, 0x00, 0x00, 0x34, 0x04, 0x4e, 0x40, 0x00, 0x40,
+ 0x06, 0x17, 0x19, 0x0a, 0x00, 0x02, 0x0f, 0xcb, 0x79, 0x47, 0xd5,
+ 0x04, 0x1b, 0x00, 0x50, 0x28, 0x6b, 0xbc, 0xba, 0x00, 0x00, 0x00,
+ 0x00, 0x80, 0x02, 0xfa, 0xf0, 0x6b, 0x39, 0x00, 0x00, 0x02, 0x04,
+ 0x05, 0xb4, 0x01, 0x03, 0x03, 0x00, 0x01, 0x01, 0x04, 0x02 };
+unsigned int packet1_len = 106;
+
+unsigned char packet2[] = { 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,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0x37, 0x72, 0x8b, 0x0f, 0x40, 0x2c, 0x48, 0x3e, 0xdd, 0x64, 0xdf,
+ 0x81, 0x98, 0x2f, 0xa9, 0x68, 0x85, 0x82, 0xbb, 0xcc, 0x6e, 0xf5,
+ 0x6f, 0x4e, 0xc7, 0x10, 0x83, 0x91, 0xfa, 0x10, 0xe7, 0x70, 0x31,
+ 0x2e, 0x0f, 0x19, 0x11, 0x3c, 0xe2, 0x8e, 0x2c, 0x9b, 0x3e, 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 packet2_len = 1470;
+
+u8 buffer[2048] __attribute__((aligned(2048)));
+
+/**
+ * Get the request from the simulator and segment the packet.
+ */
+int reassembly (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;
+ bool debug = true;
+
+ printf ("Station function call\n");
+ diag_write_string ("reassembly\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;
+
+ if (debug)
+ {
+ printf ("Print the PB data\n");
+ printf ("MF1 type : %d\n", mf_get_type(pb_head, 0));
+ printf ("MF1 length : %d\n", mf_get_length (pb_head, 0, false));
+ printf ("MF1 ats : %x\n", mf_get_ats (pb_head, 0));
+
+ printf ("MF1 header1 : %x\n", *((u32*)pb_head->data) );
+ }
+
+ // 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;
+
+ rx_params.lid = 0x1;
+ rx_params.tei = 0x1;
+ rx_params.bcast = false;
+ rx_params.date = 0x1234578;
+ 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, buffer);
+ sar_launch (0);
+
+ diag_write_string ("reassembly done\n");
+
+ return 0;
+}
+
+void sar_mfs_expired_cb (void *user, mfs_t *mfs)
+{
+
+}
+
+/** Implement the bidge_dma interuption of the SAR to send the PBs from the
+ * MFS **/
+bool bridge_dma_interruption_station (void *user, u32 status_word)
+{
+// static fcall_param_t return_param;
+// static sci_msg_t return_msg;
+// static unsigned char return_buffer[1024];
+// unsigned short *return_msg_id = (unsigned short *) user;
+//
+// u8 pb_nb;
+// u8 i;
+// unsigned char value [2];
+// unsigned char name [10];
+//
+// pb_t *pb;
+//
+// dbg_assert (mfs);
+// dbg_assert (mfs->head);
+//
+// /** init structures **/
+// fcall_param_init (&return_param, "seg_done", *return_msg_id);
+// sci_msg_init (&return_msg, return_buffer, 1024);
+//
+// /** reset the param list **/
+// fcall_param_reset (&return_param);
+//
+// /** get the number of PBs in the MFS **/
+// dbg_assert (mfs);
+// dbg_assert (mfs->head);
+// pb_nb = mf_get_quantity_of_pb (mfs->head, 0);
+//
+// fcall_param_add (&return_param, &return_msg, "qte", sizeof(u8), &pb_nb);
+//
+// pb = mfs->head;
+// for (i = 0; i < pb_nb; i++)
+// {
+// sprintf (value, "%d", i);
+// strcpy (name, "pb");
+// strcat (name, value);
+//
+// fcall_param_add (&return_param, &return_msg, (char *)value, 512,
+// (unsigned char *) pb->data);
+// }
+//
+// /* return */
+// fcall_return (my_station.fcall, &return_param, &return_msg);
+
+ diag_write_string ("Hello\n");
+
+ return true;
+}
+
+int main (void)
+{
+ sar_reassembly_ctx_t *data_ctx;
+ sar_reassembly_ctx_t *mme_ctx;
+
+ 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, "reassembly", &reassembly, NULL);
+
+ //initialize the sar
+ sar_initialize ();
+ sar_init_mac_store (&sar_ctx, mac_store_init ());
+ sar_init_mme_context (&sar_ctx, &sar_ctx);
+ sar_init_data_context (&sar_ctx, &sar_ctx);
+ sar_init_measure_context (&sar_ctx, &sar_ctx);
+
+ sar_init_expiration (&sar_ctx, sar_mfs_expired_cb);
+ sar_init_measurement_cb (&sar_ctx, test_sar_rx_pb_measurement_cb);
+
+ sar_ctx.bridgedma_ctx = phy_bridgedma_init (NULL,
+ bridge_dma_interruption_station, bridge_dma_deffered_interruption);
+
+ 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);
+
+ mac_store_sta_add (sar_ctx.expiration.mfs_store, 0x1);
+
+ return 0;
+}
diff --git a/mac/sar/test/maximus_test/maximus_seg/src/station_sar_seg_test.c b/mac/sar/test/maximus_test/maximus_seg/src/station_sar_seg_test.c
index 8379afaf7e..54ab2a7013 100644
--- a/mac/sar/test/maximus_test/maximus_seg/src/station_sar_seg_test.c
+++ b/mac/sar/test/maximus_test/maximus_seg/src/station_sar_seg_test.c
@@ -195,13 +195,14 @@ unsigned char packet2[] =
0xf3, 0x1f, 0xed, 0x35, 0x17, 0x11, 0xfe, 0x15, 0x00, 0x00};
unsigned int packet2_len = 1470;
+u8 buffer[2048] __attribute__((aligned(2048)));
+
/**
* 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 buffer[2048] __attribute__((aligned(2048)));
// u16 packet_length;
// u16 type_length;
// u16 ats_confounder;
@@ -237,7 +238,7 @@ int segmentation (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg,
memcpy (buffer, packet2, packet2_len);
/** Add the msdu to segment **/
- sar_msdu_add (NULL, buffer, 0x8000 | packet2_len, 0x12345678, mfs);
+ sar_msdu_add (&sar_ctx, buffer, 2, packet2_len, 0x12345678, mfs);
fcall_param_set_async (*param, 1);
ayncrhonous_msg_id = (*param)->msg_id;