summaryrefslogtreecommitdiff
path: root/mac/sar/test/maximus_test/src
diff options
context:
space:
mode:
authorlaranjeiro2007-11-20 13:17:49 +0000
committerlaranjeiro2007-11-20 13:17:49 +0000
commit3afe7363806c0958a3f83870c95bd907e135e4bb (patch)
tree2a33b16d0704e1b6126b62f0c7a71fecfefd7cd0 /mac/sar/test/maximus_test/src
parentb27b7831dea1f7fcdc4afdab78f38c70bacf453c (diff)
Modified the Sta_sar.c file to run under maximus. (does not work).
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1022 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'mac/sar/test/maximus_test/src')
-rw-r--r--mac/sar/test/maximus_test/src/Sta_sar.c142
1 files changed, 76 insertions, 66 deletions
diff --git a/mac/sar/test/maximus_test/src/Sta_sar.c b/mac/sar/test/maximus_test/src/Sta_sar.c
index 8b5b04d78b..9e0afbee02 100644
--- a/mac/sar/test/maximus_test/src/Sta_sar.c
+++ b/mac/sar/test/maximus_test/src/Sta_sar.c
@@ -56,8 +56,10 @@
#include "host/station.h"
#include "mac/sar/sar.h"
+#include "mac/sar/inc/sar_context.h"
+#include "mac/sar/inc/sar.h"
+#include "mac/sar/inc/sar_job_mfs.h"
-#include "mac/sar/test/inc/segmentation_unit_test_function.h"
#include "mac/sar/test/inc/reassembly_unit_test_functions.h"
#include "mac/sar/test/inc/eth_packets.h"
@@ -122,6 +124,9 @@ bool bridge_dma_interruption_rea (sar_job_mfs_t *sar_job);
*/
u16 mix_up_pbs (pb_t **first, pb_t **last);
+sar_t *sar_ctx;
+mac_store_t *mac_store;
+
extern station_ctx_t my_station;
unsigned short msg_id;
@@ -148,10 +153,19 @@ bool log_seg_info;
/** Print all the logs of the reassembly*/
bool log_rea_info;
+void sar_segmentation_done (void *user, u8* buffer)
+{
+
+}
+
+void sar_complete_reassembly_done (void *user, u8* buffer, uint length,
+ mfs_rx_t *mfs)
+{
+
+}
+
int main (void)
{
- sar_reassembly_ctx_t *data_ctx;
- sar_reassembly_ctx_t *mme_ctx;
int i;
debug_info = false;
@@ -183,28 +197,24 @@ int main (void)
fcall_register (my_station.fcall, "reassembly", &reassembly, NULL);
fcall_register (my_station.fcall, "activate_logs", &activate_logs, NULL);
- sar_initialize ();
- sar_init_mac_store (&sar_ctx, mac_store_init ());
+ mac_store = mac_store_init ();
+ sar_ctx = sar_init (mac_store);
- 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_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_measurement_cb (sar_ctx, NULL);
- sar_init_segmentation_data_cb (&sar_ctx, sar_segmentation_done);
- sar_init_segmentation_mme_cb (&sar_ctx, sar_segmentation_done);
+ 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, ce_measurements);
- sar_init_noise_cb (&sar_ctx, test_sar_rx_noise_cb);
+ sar_init_reassembly_data_cb (sar_ctx, sar_complete_reassembly_done);
+ sar_init_segmentation_mme_cb (sar_ctx, sar_segmentation_done);
+ sar_init_reassembly_mme_cb (sar_ctx, sar_complete_reassembly_done);
+ sar_init_measurement_cb (sar_ctx, ce_measurements);
- sar_ctx.bridgedma_ctx = phy_bridgedma_init (NULL,
+ sar_ctx->bridgedma_ctx = phy_bridgedma_init (NULL,
bridge_dma_interruption_station, bridge_dma_deffered_interruption);
return 0;
@@ -252,7 +262,7 @@ void fill_mac_store (bool tx, sar_max_job_t *job_curr)
mfs_tx_t *mfs;
if (MAC_TEI_IS_STA (job_curr->tei_dest))
{
- sta = mac_store_sta_get (sar_ctx.expiration.mfs_store,
+ sta = mac_store_sta_get (sar_ctx->expiration.mfs_store,
job_curr->tei_dest);
}
@@ -266,7 +276,7 @@ void fill_mac_store (bool tx, sar_max_job_t *job_curr)
}
/* Add the sta to the mac store */
- mac_store_sta_add (sar_ctx.expiration.mfs_store,
+ mac_store_sta_add (sar_ctx->expiration.mfs_store,
job_curr->tei_dest);
if (log_init_info)
@@ -278,13 +288,13 @@ void fill_mac_store (bool tx, sar_max_job_t *job_curr)
/* Add the MFS to the mac store */
if (job_curr->lid != MAC_LID_NONE)
{
- mfs = mac_store_mfs_add_tx (sar_ctx.expiration.mfs_store,
+ mfs = mac_store_mfs_add_tx (sar_ctx->expiration.mfs_store,
job_curr->bcast, false, job_curr->lid,
job_curr->tei_dest, &added);
}
else
{
- mfs = mac_store_mfs_add_tx (sar_ctx.expiration.mfs_store,
+ mfs = mac_store_mfs_add_tx (sar_ctx->expiration.mfs_store,
job_curr->bcast, true, job_curr->lid,
job_curr->tei_dest, &added);
}
@@ -298,13 +308,13 @@ void fill_mac_store (bool tx, sar_max_job_t *job_curr)
/* Get the MFS from the Store */
if (job_curr->lid != MAC_LID_NONE)
{
- mfs= mac_store_mfs_get_tx (sar_ctx.expiration.mfs_store,
+ mfs= mac_store_mfs_get_tx (sar_ctx->expiration.mfs_store,
job_curr->bcast, false, job_curr->lid,
job_curr->tei_dest);
}
else
{
- mfs = mac_store_mfs_get_tx (sar_ctx.expiration.mfs_store,
+ mfs = mac_store_mfs_get_tx (sar_ctx->expiration.mfs_store,
job_curr->bcast, true, job_curr->lid,
job_curr->tei_dest);
}
@@ -320,7 +330,7 @@ void fill_mac_store (bool tx, sar_max_job_t *job_curr)
job_curr->bcast);
}
- mfs = mac_store_mfs_add_tx (sar_ctx.expiration.mfs_store,
+ mfs = mac_store_mfs_add_tx (sar_ctx->expiration.mfs_store,
job_curr->bcast, false, job_curr->lid,
job_curr->tei_dest, &added);
dbg_assert (added);
@@ -329,7 +339,7 @@ void fill_mac_store (bool tx, sar_max_job_t *job_curr)
mfs->tail = NULL;
// add the mfs to the sar expiration
- sar_mfs_add (&sar_ctx, (mfs_t *) mfs);
+ sar_mfs_add (sar_ctx, (mfs_t *) mfs);
}
}
}
@@ -346,7 +356,7 @@ void fill_mac_store (bool tx, sar_max_job_t *job_curr)
job_curr->tei_src);
}
/* Add the sta to the store */
- mac_store_sta_add (sar_ctx.expiration.mfs_store,
+ mac_store_sta_add (sar_ctx->expiration.mfs_store,
job_curr->tei_src);
if (log_init_info)
@@ -358,13 +368,14 @@ void fill_mac_store (bool tx, sar_max_job_t *job_curr)
}
/* Add the mfs to the store */
- mfs = mac_store_mfs_add_rx (sar_ctx.expiration.mfs_store, false,
+ mfs = mac_store_mfs_add_rx (sar_ctx->expiration.mfs_store, false,
false, job_curr->lid, job_curr->tei_src, &added);
dbg_assert (added);
/* Add the mfs to the SAR expiration */
- mfs->common.expiration_ntb = phy_date (sar_ctx.phy_ctx) + 100;
- sar_mfs_add (&sar_ctx, (mfs_t *) mfs);
+ mfs->common.expiration_ntb = pbproc_get_ntb (sar_ctx->pbproc_ctx)
+ + 100;
+ sar_mfs_add (sar_ctx, (mfs_t *) mfs);
if (log_init_info)
{
@@ -374,13 +385,14 @@ void fill_mac_store (bool tx, sar_max_job_t *job_curr)
diag_printf ("[INIT-REA] Add the mme MFS to SAR expiration mechanism\n");
}
/* Add the MME MFS to the store */
- mfs = mac_store_mfs_add_rx (sar_ctx.expiration.mfs_store, false,
+ mfs = mac_store_mfs_add_rx (sar_ctx->expiration.mfs_store, false,
true, MAC_LID_NONE, job_curr->tei_src, &added);
dbg_assert (added);
/* Add the mfs to the sar expiration */
- mfs->common.expiration_ntb = phy_date (sar_ctx.phy_ctx) + 100;
- sar_mfs_add (&sar_ctx, (mfs_t *) mfs);
+ mfs->common.expiration_ntb = pbproc_get_ntb (sar_ctx->pbproc_ctx)
+ + 100;
+ sar_mfs_add (sar_ctx, (mfs_t *) mfs);
}
else
{
@@ -390,7 +402,7 @@ void fill_mac_store (bool tx, sar_max_job_t *job_curr)
mfs_rx_t * mfs;
/* Add the mfs to the store */
- mfs = mac_store_mfs_get_rx (sar_ctx.expiration.mfs_store,
+ mfs = mac_store_mfs_get_rx (sar_ctx->expiration.mfs_store,
job_curr->bcast, false, job_curr->lid,
job_curr->tei_src);
@@ -404,19 +416,19 @@ void fill_mac_store (bool tx, sar_max_job_t *job_curr)
diag_printf ("[INIT-REA] Add the data MFS to SAR expiration mechanism\n");
}
/* Add the mfs to the store */
- mfs = mac_store_mfs_add_rx (sar_ctx.expiration.mfs_store,
- job_curr->bcast, false, job_curr->lid,
- job_curr->tei_src, &added);
+ mfs = mac_store_mfs_add_rx (
+ sar_ctx->expiration.mfs_store, job_curr->bcast,
+ false, job_curr->lid, job_curr->tei_src, &added);
dbg_assert (added);
/* Add the mfs to the SAR expiration */
- mfs->common.expiration_ntb = phy_date (sar_ctx.phy_ctx)
- + 100;
- sar_mfs_add (&sar_ctx, (mfs_t *) mfs);
+ mfs->common.expiration_ntb
+ = pbproc_get_ntb (sar_ctx->pbproc_ctx) + 100;
+ sar_mfs_add (sar_ctx, (mfs_t *) mfs);
}
/* Verifies the MME mfs */
- mfs = mac_store_mfs_get_rx (sar_ctx.expiration.mfs_store,
+ mfs = mac_store_mfs_get_rx (sar_ctx->expiration.mfs_store,
job_curr->bcast, true, MAC_LID_NONE,
job_curr->tei_src);
@@ -431,15 +443,15 @@ void fill_mac_store (bool tx, sar_max_job_t *job_curr)
}
/* Add the MME MFS to the store */
- mfs = mac_store_mfs_add_rx (sar_ctx.expiration.mfs_store,
- job_curr->bcast, true, MAC_LID_NONE,
- job_curr->tei_src, &added);
+ mfs = mac_store_mfs_add_rx (
+ sar_ctx->expiration.mfs_store, job_curr->bcast,
+ true, MAC_LID_NONE, job_curr->tei_src, &added);
dbg_assert (added);
/* Add the mfs to the sar expiration */
- mfs->common.expiration_ntb = phy_date (sar_ctx.phy_ctx)
- + 100;
- sar_mfs_add (&sar_ctx, (mfs_t *) mfs);
+ mfs->common.expiration_ntb
+ = pbproc_get_ntb (sar_ctx->pbproc_ctx) + 100;
+ sar_mfs_add (sar_ctx, (mfs_t *) mfs);
}
}
}
@@ -569,7 +581,7 @@ int segmentation (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg,
else
mme = false;
- mfs = mac_store_mfs_get_tx (sar_ctx.expiration.mfs_store,
+ mfs = mac_store_mfs_get_tx (sar_ctx->expiration.mfs_store,
job_curr->bcast, mme, job_curr->lid, job_curr->tei_dest);
if (log_init_info)
@@ -587,9 +599,8 @@ int segmentation (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg,
diag_printf ("[SEG] bcast : %d\n", mfs->common.bcast);
}
- sar_msdu_add (&sar_ctx, packets[job_curr->packet_id],
- job_curr->mf_type, packets_len[job_curr->packet_id],
- 0x12345678, mfs);
+ sar_msdu_add (sar_ctx, packets[job_curr->packet_id],
+ packets_len[job_curr->packet_id], 0x12345678, mfs);
/** Launch the SAR to segment the msdu **/
sar_launch (0);
@@ -692,7 +703,7 @@ int reassembly (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg,
else
mme = false;
- mfs = mac_store_mfs_get_rx (sar_ctx.expiration.mfs_store,
+ mfs = mac_store_mfs_get_rx (sar_ctx->expiration.mfs_store,
sar_max_job_curr->bcast, mme, lid, tei_src);
/* Getting the PBs from Maximus */
@@ -759,8 +770,8 @@ int reassembly (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg,
diag_printf ("[REA] **** Mixing the PBs **** \n");
}
- mix_up_pbs(&pb_head, &pb_tail);
-
+ mix_up_pbs (&pb_head, &pb_tail);
+
if (log_rea_info)
{
pb_t *pb_curr;
@@ -770,10 +781,10 @@ int reassembly (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg,
diag_printf ("[DEBUG - TX] @ : %p\n", pb_curr);
diag_printf ("[DEBUG - RX] ssn : %d\n", pb_curr->header.ssn);
}
-
+
diag_printf ("[REA] **** PBs Mixed **** \n");
}
-
+
rx_params.tei = tei_src;
rx_params.lid = lid;
rx_params.bcast = sar_max_job_curr->bcast;
@@ -803,18 +814,18 @@ int reassembly (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg,
{
diag_printf ("[REA] buffer added : %p\n", sar_buffer);
}
- sar_buffer_add (&sar_ctx.data_ctx, sar_buffer);
+ sar_buffer_add_data (sar_ctx, sar_buffer);
sar_launch (0);
}
-
+
if (mfs && mfs->common.mme)
{
- sar_mpdu_add (&sar_ctx, NULL, (mfs_t *) mfs, &rx_params, pb_head,
+ sar_mpdu_add (sar_ctx, NULL, (mfs_t *) mfs, &rx_params, pb_head,
pb_tail, pb_nb, NULL);
}
else if (mfs)
{
- sar_mpdu_add (&sar_ctx, (mfs_t *)mfs, NULL, &rx_params, pb_head,
+ sar_mpdu_add (sar_ctx, (mfs_t *)mfs, NULL, &rx_params, pb_head,
pb_tail, pb_nb, NULL);
}
@@ -841,7 +852,7 @@ bool bridge_dma_interruption_station (void *user, u32 status_word)
{
sar_job_mfs_t *sar_job;
- sar_job = bridge_dma_get_head (&sar_ctx.bridge_dma_jobs);
+ sar_job = bridge_dma_get_head (&sar_ctx->bridge_dma_jobs);
dbg_assert (sar_job);
if (sar_job->job.direction == 0)
@@ -944,7 +955,7 @@ bool bridge_dma_interruption_seg (sar_job_mfs_t *sar_job)
}
/** Get the MFS */
- mfs = mac_store_mfs_get_tx (sar_ctx.expiration.mfs_store,
+ mfs = mac_store_mfs_get_tx (sar_ctx->expiration.mfs_store,
mfs_is_bcast, mfs_is_mme, lid, tei_dest);
/** init structures **/
@@ -962,8 +973,7 @@ bool bridge_dma_interruption_seg (sar_job_mfs_t *sar_job)
fcall_param_add (&return_param, &return_msg, "type", 4* sizeof(u8),
(unsigned char *) "SEG");
- for (_pb_qte = 0, i = 0, pb_curr = mfs->head; pb_curr; i++,
- _pb_qte ++)
+ for (_pb_qte = 0, i = 0, pb_curr = mfs->head; pb_curr; i++, _pb_qte ++)
{
sprintf (value, "%d", i);