summaryrefslogtreecommitdiff
path: root/cesar/test_general/maximus
diff options
context:
space:
mode:
authorjelisavcic2009-09-29 09:50:27 +0000
committerjelisavcic2009-09-29 09:50:27 +0000
commit3d25141eadb918b3307481475d6df5d096cf740d (patch)
tree14249d1ea2eb8a16a968a9bce34f239291bfa27a /cesar/test_general/maximus
parent61aa3a62b100a5634a1dc67d3523a8bc07ace2b5 (diff)
[CESAR][MAC][PBPROC+CA][EOC]
* Update for sending beacons. All sendings are in FC_AV mode. Remove hybrid from EOC. * Update mfs_get to use heap in SPC_CENTRAL sched period. * Update ca test to avoid testing allocations. * Add new python test to test sending and reception of beacon. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@5806 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/test_general/maximus')
-rw-r--r--cesar/test_general/maximus/integration/sar-pbproc-eoc/src/station.c121
-rw-r--r--cesar/test_general/maximus/integration/sar-pbproc-eoc/test_eoc_2sta.py2
-rw-r--r--cesar/test_general/maximus/integration/sar-pbproc-eoc/test_eoc_2sta_bc.py154
3 files changed, 276 insertions, 1 deletions
diff --git a/cesar/test_general/maximus/integration/sar-pbproc-eoc/src/station.c b/cesar/test_general/maximus/integration/sar-pbproc-eoc/src/station.c
index d8cd39e8e2..f99a9e2888 100644
--- a/cesar/test_general/maximus/integration/sar-pbproc-eoc/src/station.c
+++ b/cesar/test_general/maximus/integration/sar-pbproc-eoc/src/station.c
@@ -578,6 +578,8 @@ void station_test_discover (station_test_t *ctx, uint *tei,
// ---------------------------- Function calls -----------------------------
+void
+tx_beacon_uninit (void);
/** Uninitialise the function
*/
@@ -591,6 +593,8 @@ int fc_station_uninit (fcall_ctx_t *fcall, fcall_param_t **param,
for (i = MAC_TEI_STA_MIN; MAC_TEI_IS_STA (i); i++)
sar_sta_remove (station_test.sar, i);
+ tx_beacon_uninit();
+
sar_uninit (station_test.sar);
pbproc_uninit (station_test.pbproc);
mac_store_uninit (station_test.mac_store);
@@ -924,6 +928,15 @@ int fc_station_init_config (fcall_ctx_t *fcall, fcall_param_t **param,
return true;
}
+/**
+ * Configure type of MFS-s used in script: 0 ordinary (CSMA), 1 (TDMA)
+ * Configure allocations in beacon period.
+ *
+ * \param fcall the fcall context.
+ * \param param the fcall param
+ * \param msg the message
+ * \param data anything
+ */
int fc_station_init_config_bt (fcall_ctx_t *fcall, fcall_param_t **param,
sci_msg_t **msg, void *data)
{
@@ -1019,6 +1032,105 @@ int fc_sar_msdu_add (fcall_ctx_t *fcall, fcall_param_t **param,
return true;
}
+mfs_tx_t * beacon_mfs = NULL;
+u32 user_data;
+
+/**
+ * Stub to inform that beacon is received.
+ *
+ */
+void
+cp_beacon_add (void *user_data, pb_beacon_t *beacon,
+ pbproc_rx_beacon_params_t *params);
+
+/**
+ * Init parameters for beacon sending and receiving.
+ *
+ */
+void
+tx_beacon_init (void)
+{
+ beacon_mfs = blk_alloc ();
+ mfs_tx_init (beacon_mfs, true, false, MAC_LID_SPC_CENTRAL,
+ MAC_TEI_BCAST);
+ beacon_mfs->beacon = true;
+
+ ca_mfs_update(pbproc_get_ca (station_test.pbproc), beacon_mfs);
+
+ sar_init_beacon_cb (station_test.sar, &user_data, cp_beacon_add);
+
+}
+
+/**
+ * Remove allocated beacon mfs.
+ *
+ */
+void
+tx_beacon_uninit (void)
+{
+ if (beacon_mfs)
+ {
+ ca_mfs_remove(pbproc_get_ca (station_test.pbproc), beacon_mfs);
+ blk_release(beacon_mfs);
+ }
+}
+
+/**
+ * Insert beacon. Insert one fake PB into mfs and update mfs heap.
+ * due to priority beacon mfs will be first to send in SCP_CENTRAL part to
+ * send one PB (beacon) to network.
+ *
+ */
+void
+tx_beacon_insert (void)
+{
+ pb_beacon_t *pb = PARENT_OF (pb_beacon_t, blk, blk_alloc_desc ());
+ pbproc_tx_beacon_params_t params = {
+ { 0x0123, 0x4242, 0xabab, 0x5555 }, pb->data + 123
+ };
+ pbproc_mfs_beacon_prepare (station_test.pbproc, beacon_mfs, pb, &params);
+ /* insert into list of mfs-s. */
+ ca_mfs_update(pbproc_get_ca (station_test.pbproc), beacon_mfs);
+}
+
+/**
+ * Interface: Call beacon init function.
+ *
+ * \param fcall the fcall context.
+ * \param param the fcall param
+ * \param msg the message
+ * \param data anything
+ */
+int fc_station_init_config_bc (fcall_ctx_t *fcall, fcall_param_t **param,
+ sci_msg_t **msg, void *data)
+{
+
+ tx_beacon_init();
+
+ fcall_param_reset (*param);
+
+ return true;
+}
+
+/**
+ * Interface: Call beacon insert function.
+ *
+ * \param fcall the fcall context.
+ * \param param the fcall param
+ * \param msg the message
+ * \param data anything
+ */
+int fc_station_init_config_bc_insert (fcall_ctx_t *fcall, fcall_param_t **param,
+ sci_msg_t **msg, void *data)
+{
+
+ tx_beacon_insert();
+
+ fcall_param_reset (*param);
+
+ return true;
+}
+
/**
* Provide to the STA using the parameters of the function call the station
* use for the test. Each STA shall known the TEI of the others present in the
@@ -1163,7 +1275,8 @@ cp_mme_recv (void *user_data, mfs_rx_t *mfs, u8 *buffer, uint length,
* \param beacon the beacon freshly received.
*/
void
-cp_beacon_add (void *user_data, pb_beacon_t *beacon)
+cp_beacon_add (void *user_data, pb_beacon_t *beacon,
+ pbproc_rx_beacon_params_t *params)
{
printf ("/*************************************************/\n");
printf ("/ STATION : %d Receive a beacon ********/\n",
@@ -1265,6 +1378,12 @@ cyg_user_start (void)
fcall_register (my_station.fcall, "fc_station_init_num_station",
&fc_station_init_num_station, NULL);
+ fcall_register (my_station.fcall, "fc_station_init_config_bc_insert",
+ &fc_station_init_config_bc_insert, NULL);
+
+ fcall_register (my_station.fcall, "fc_station_init_config_bc",
+ &fc_station_init_config_bc, NULL);
+
sar_init_data_context (station_test.sar, station_test.sar);
sar_init_mme_context (station_test.sar, station_test.sar);
diff --git a/cesar/test_general/maximus/integration/sar-pbproc-eoc/test_eoc_2sta.py b/cesar/test_general/maximus/integration/sar-pbproc-eoc/test_eoc_2sta.py
index b683f3605f..2823d2b6ac 100644
--- a/cesar/test_general/maximus/integration/sar-pbproc-eoc/test_eoc_2sta.py
+++ b/cesar/test_general/maximus/integration/sar-pbproc-eoc/test_eoc_2sta.py
@@ -94,6 +94,8 @@ f = open ('../../packet1','r')
fc1.add_param ("buffer", f.read())
fc1.send()
+
+
maximus.wait (10000000)
fc1 = maximus.create_fcall ("fc_station_link_remove")
diff --git a/cesar/test_general/maximus/integration/sar-pbproc-eoc/test_eoc_2sta_bc.py b/cesar/test_general/maximus/integration/sar-pbproc-eoc/test_eoc_2sta_bc.py
new file mode 100644
index 0000000000..6c104338f6
--- /dev/null
+++ b/cesar/test_general/maximus/integration/sar-pbproc-eoc/test_eoc_2sta_bc.py
@@ -0,0 +1,154 @@
+#!/usr/bin/env python
+
+import sys
+sys.path.append('../../../../maximus/python/obj');
+
+from interface import *
+from string import *
+from struct import *
+
+maximus = Maximus()
+maximus.init (sys.argv + ['-e', './obj/sar-pbproc.elf'])
+
+# TEI of station 1 will be 1
+station1 = maximus.create_sta()
+#station1.debug()
+
+# TEI of station 2 will be 5
+station2 = maximus.create_sta()
+#station2.debug()
+
+fc1 = maximus.create_fcall ("fc_station_config_bt")
+fc1.set_sta (station1)
+fc1.add_param_ushort ("beacon_alloc_type", 1)
+fc1.add_param_ushort ("mfs_cfp", 1)
+fc1.send()
+
+fc1 = maximus.create_fcall ("fc_station_init_config")
+fc1.set_sta (station1)
+fc1.add_param_ushort ("snid", 1)
+fc1.add_param_ushort ("tei", 1)
+fc1.add_param_ushort ("auto_sched", 1)
+fc1.send()
+
+fc1 = maximus.create_fcall ("fc_station_init_config_bc")
+fc1.set_sta (station1)
+fc1.send()
+
+fc2 = maximus.create_fcall ("fc_station_init_config_bc")
+fc2.set_sta (station2)
+fc2.send()
+
+fc2 = maximus.create_fcall ("fc_station_config_bt")
+fc2.set_sta (station2)
+fc2.add_param_ushort ("beacon_alloc_type", 1)
+fc2.add_param_ushort ("mfs_cfp", 1)
+fc2.send()
+
+fc2 = maximus.create_fcall ("fc_station_init_config")
+fc2.set_sta (station2)
+fc2.add_param_ushort ("snid", 1)
+fc2.add_param_ushort ("tei", 5)
+fc2.add_param_ushort ("auto_sched", 1)
+fc2.send()
+
+fc1 = maximus.create_fcall ("fc_station_link_add")
+fc1.set_sta (station1)
+fc1.add_param_ushort ("type", 1)
+fc1.add_param_ushort ("bcast", 0)
+fc1.add_param_ushort ("mme", 0)
+fc1.add_param_ushort ("lid", 1)
+fc1.add_param_ushort ("tei", 5)
+fc1.send()
+
+fc2 = maximus.create_fcall ("fc_station_link_add")
+fc2.set_sta (station2)
+fc2.add_param_ushort ("type", 0)
+fc2.add_param_ushort ("bcast", 0)
+fc2.add_param_ushort ("mme", 0)
+fc2.add_param_ushort ("lid", 1)
+fc2.add_param_ushort ("tei", 1)
+fc2.send()
+
+fc2 = maximus.create_fcall ("fc_sar_data_buffer_add")
+fc2.set_sta (station2)
+fc2.send()
+
+fc2 = maximus.create_fcall ("fc_sar_data_buffer_add")
+fc2.set_sta (station2)
+fc2.send()
+
+fc1 = maximus.create_fcall ("fc_sar_msdu_add")
+fc1.set_sta (station1)
+fc1.add_param_ushort ("tei", 5)
+fc1.add_param_ushort ("lid", 1)
+fc1.add_param_ushort ("bcast", 0)
+fc1.add_param_ushort ("mme", 0)
+fc1.add_param_ushort ("length", 106)
+f = open ('../../packet1','r')
+fc1.add_param ("buffer", f.read())
+fc1.send()
+
+maximus.wait (10000)
+
+fc1 = maximus.create_fcall ("fc_sar_msdu_add")
+fc1.set_sta (station1)
+fc1.add_param_ushort ("tei", 5)
+fc1.add_param_ushort ("lid", 1)
+fc1.add_param_ushort ("bcast", 0)
+fc1.add_param_ushort ("mme", 0)
+fc1.add_param_ushort ("length", 106)
+f = open ('../../packet1','r')
+fc1.add_param ("buffer", f.read())
+fc1.send()
+
+for x in range(1, 5):
+ maximus.wait (990000)
+ fc1 = maximus.create_fcall ("fc_station_init_config_bc_insert")
+ fc1.set_sta (station1)
+ fc1.send()
+
+maximus.wait (100000)
+
+fc1 = maximus.create_fcall ("fc_station_link_remove")
+fc1.set_sta (station1)
+fc1.add_param_ushort ("type", 1)
+fc1.add_param_ushort ("bcast", 0)
+fc1.add_param_ushort ("mme", 0)
+fc1.add_param_ushort ("lid", 1)
+fc1.add_param_ushort ("tei", 5)
+fc1.send()
+
+fc2 = maximus.create_fcall ("fc_station_link_remove")
+fc2.set_sta (station2)
+fc2.add_param_ushort ("type", 0)
+fc2.add_param_ushort ("bcast", 0)
+fc2.add_param_ushort ("mme", 0)
+fc2.add_param_ushort ("lid", 1)
+fc2.add_param_ushort ("tei", 1)
+fc2.send()
+
+maximus.wait(10000)
+
+print "\n************ STATION 1 TRACE ***************\n"
+fc1 = maximus.create_fcall ("fc_sar_print_trace")
+fc1.set_sta(station1)
+fc1.send();
+
+fc1 = maximus.create_fcall ("fc_station_uninit")
+fc1.set_sta(station1)
+fc1.send();
+
+station1.remove()
+
+
+print "\n************ STATION 2 TRACE ***************\n"
+fc1 = maximus.create_fcall ("fc_sar_print_trace")
+fc1.set_sta(station2)
+fc1.send();
+
+fc1 = maximus.create_fcall ("fc_station_uninit")
+fc1.set_sta(station2)
+fc1.send();
+
+station2.remove()