summaryrefslogtreecommitdiff
path: root/maximus
diff options
context:
space:
mode:
authorburet2008-03-25 16:38:46 +0000
committerburet2008-03-25 16:38:46 +0000
commitc9f0ed5da20405bb5c363f09361c94f5ab90f1d3 (patch)
treed89050c251247e06403d81ffbf85809162d5722f /maximus
parent032d77cb2bd2a6f733841129e01e847136eba0bd (diff)
Maximus V2: develop a Python Cesar library to call Maximus duration functions located into the station.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1630 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'maximus')
-rwxr-xr-xmaximus/python/doc/fulminata_maximus_scenario_engine.odtbin345949 -> 343674 bytes
-rw-r--r--maximus/python/lib/cesar/maximus_dur.py97
-rw-r--r--maximus/python/test/test_lib_cesar.py330
-rw-r--r--maximus/python/test/test_station.py7
-rw-r--r--maximus/stationtest/Makefile31
-rw-r--r--maximus/stationtest/src/test_lib_cesar.c91
-rwxr-xr-xmaximus/test/test_python.sh1
7 files changed, 537 insertions, 20 deletions
diff --git a/maximus/python/doc/fulminata_maximus_scenario_engine.odt b/maximus/python/doc/fulminata_maximus_scenario_engine.odt
index e5f3c0328c..c1fd556c0b 100755
--- a/maximus/python/doc/fulminata_maximus_scenario_engine.odt
+++ b/maximus/python/doc/fulminata_maximus_scenario_engine.odt
Binary files differ
diff --git a/maximus/python/lib/cesar/maximus_dur.py b/maximus/python/lib/cesar/maximus_dur.py
new file mode 100644
index 0000000000..1c5e08232c
--- /dev/null
+++ b/maximus/python/lib/cesar/maximus_dur.py
@@ -0,0 +1,97 @@
+#! usr/bin/env python
+
+#print __name__
+
+from interface import *
+from maximus.station.sta import PHY_CARRIER_NB
+
+def maximus_dur_carrier_nb(maximus, station, tonemask):
+ """Counts the number of used carriers.
+ maximus - the Maximus object, already initialized
+ station - the destination station (note: you can use the method "get()" of the STA class)
+ tonemask - must be a bits field (note: you can use the method "get_tonemask()" of the STA class)
+ Returns number of carriers.
+ """
+ # Create and send a function call to call the following Maximus duration function:
+ # "uint maximus_dur_carrier_nb (const u8 *tonemask);"
+ rsp = maximus.create_fcall("maximus_dur_carrier_nb")\
+ .add_param("tonemask", tonemask)\
+ .send(station)
+ return rsp.bind_param_ulong("carrier_nb")
+
+def maximus_dur_bits_per_symbol(maximus, station, mod, tonemask, tonemap, carrier_nb):
+ """Computes the number of bits per OFDM symbol.
+ maximus - the Maximus object, already initialized
+ station - the destination station (note: you can use the method "get()" of the STA class)
+ mod - PHY modulation
+ tonemask - must be a bits field (note: you can use the method "get_tonemask()" of the STA class)
+ tonemap - must be a bits field or None for ROBO modes
+ carrier_nb - number of carriers for this tonemap
+ Returns the number of bits per OFDM symbol.
+ """
+ # Create and send a function call to call the following Maximus duration function:
+ # "uint maximus_dur_bits_per_symbol (phy_mod_t mod, const u8 *tonemask, const blk_t *tonemap, uint carrier_nb);"
+ if tonemap is None:
+ tonemap = ((PHY_CARRIER_NB + 1) / 2) * '\0'
+ rsp = maximus.create_fcall("maximus_dur_bits_per_symbol")\
+ .add_param_ulong("mod", mod)\
+ .add_param("tonemask", tonemask)\
+ .add_param("tonemap", tonemap)\
+ .add_param_ulong("carrier_nb", carrier_nb)\
+ .send(station)
+ return rsp.bind_param_ulong("bits_per_symbol")
+
+def maximus_dur_symbol_nb(maximus, station, fecrate, pb_size, bits_per_symbol, pb_nb):
+ """Computes the number of symbols for a given number of PB.
+ maximus - the Maximus object, already initialized
+ station - the destination station (note: you can use the method "get()" of the STA class)
+ fecrate - FEC encoding rate
+ pb_size - PB size
+ bits_per_symbol - number of bits per symbol
+ pb_nb - PB number
+ Returns the number of used symbols.
+ """
+ # Create and send a function call to call the following Maximus duration function:
+ # "uint maximus_dur_symbol_nb (phy_fecrate_t fecrate, phy_pb_size_t pb_size, uint bits_per_symbol, uint pb_nb);"
+ rsp = maximus.create_fcall("maximus_dur_symbol_nb")\
+ .add_param_ulong("fecrate", fecrate)\
+ .add_param_ulong("pb_size", pb_size)\
+ .add_param_ulong("bits_per_symbol", bits_per_symbol)\
+ .add_param_ulong("pb_nb", pb_nb)\
+ .send(station)
+ return rsp.bind_param_ulong("symbol_nb")
+
+def maximus_dur_data_tck(maximus, station, gil, symbol_nb):
+ """Computes the duration of the data part of a frame for a given number of symbols.
+ maximus - the Maximus object, already initialized
+ station - the destination station (note: you can use the method "get()" of the STA class)
+ gil - guard interval for third symbol and following symbols
+ symbol_nb - number of OFDM symbols
+ Returns the duration in ticks.
+ """
+ # Create and send a function call to call the following Maximus duration function:
+ # "uint maximus_dur_data_tck (phy_gil_t gil, uint symbol_nb);"
+ rsp = maximus.create_fcall("maximus_dur_data_tck")\
+ .add_param_ulong("gil", gil)\
+ .add_param_ulong("symbol_nb", symbol_nb)\
+ .send(station)
+ return rsp.bind_param_ulong("data_tck")
+
+def maximus_dur(maximus, station, tonemask, mod, tonemap, fecrate, pb_size, pb_nb, gil):
+ """Computes the duration of the data part of a frame.
+ maximus - the Maximus object, already initialized
+ station - the destination station (note: you can use the method "get()" of the STA class)
+ tonemask - must be a bits field (note: you can use the method "get_tonemask()" of the STA class)
+ mod - PHY modulation
+ tonemap - must be a bits field or None for ROBO modes
+ fecrate - FEC encoding rate
+ pb_size - PB size
+ pb_nb - PB number
+ gil - guard interval for third symbol and following symbols
+ Returns the duration in ticks.
+ """
+ return maximus_dur_data_tck(maximus, station, gil,\
+ maximus_dur_symbol_nb(maximus, station, fecrate, pb_size,\
+ maximus_dur_bits_per_symbol(maximus, station, mod, tonemask, tonemap,\
+ maximus_dur_carrier_nb(maximus, station, tonemask)),\
+ pb_nb))
diff --git a/maximus/python/test/test_lib_cesar.py b/maximus/python/test/test_lib_cesar.py
new file mode 100644
index 0000000000..9827f2d6de
--- /dev/null
+++ b/maximus/python/test/test_lib_cesar.py
@@ -0,0 +1,330 @@
+#! usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import startup, sys
+
+from maximus import *
+from interface import *
+from maximus_dur import *
+from sta_cesar import STACesar
+from maximus.station.sta import PHY_CARRIER_NB
+
+
+# LIB CESAR TEST
+
+# Create a Maximus instance
+m = Maximus()
+
+# Initialize Maximus with command line arguments
+m.init(sys.argv)
+
+# Create a Cesar station
+sta = STACesar(m, name="sta")
+
+carrier_nb = maximus_dur_carrier_nb(m, sta.get(), sta.get_tonemask())
+
+mod = 3 # PHY_MOD_TM
+tonemap = ''
+for i in range (0, PHY_CARRIER_NB):
+ tonemap += pack('B', 0x01)
+bits_per_symbol = maximus_dur_bits_per_symbol(m, sta.get(), mod, sta.get_tonemask(), tonemap, carrier_nb)
+
+fecrate = 0 # PHY_FEC_RATE_1_2
+pb_size = 1 # PHY_PB_SIZE_520
+pb_nb = 10
+symbol_nb = maximus_dur_symbol_nb(m, sta.get(), fecrate, pb_size, bits_per_symbol, pb_nb)
+
+gil = 2 # PHY_GIL_3534
+data_tck = maximus_dur_data_tck(m, sta.get(), gil, symbol_nb)
+
+if data_tck != maximus_dur(m, sta.get(), sta.get_tonemask(), mod, tonemap, fecrate, pb_size, pb_nb, gil):
+ print "maximus_dur_data_tck =", data_tck
+ print "maximus_dur =", maximus_dur(m, sta.get(), sta.get_tonemask(), mod, tonemap, fecrate, pb_size, pb_nb, gil)
+ raise Error("maximus_dur")
+
+m.create_fcall("uninit_ether").send(sta.get())
+sta.remove()
+
+
+# DOC TEST
+
+import doctest, maximus_dur, sta_cesar
+doctest.testmod(maximus_dur)
+doctest.testmod(sta_cesar)
+
+
+# UNIT TEST
+
+import unittest
+
+class TestMaximusDurFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.maximus = m
+ # Create station
+ self.station = STACesar(self.maximus)
+
+ def tearDown(self):
+ # Remove station
+ m.create_fcall("uninit_ether").send(self.station.get())
+ self.station.remove()
+
+ def test_maximus_dur_carrier_nb(self):
+ # Default tonemask
+ bits_ref = 917
+ bits = maximus_dur_carrier_nb(self.maximus, self.station.get(), self.station.get_tonemask())
+ self.assertEqual(bits, bits_ref)
+
+ def test_maximus_dur_bits_per_symbol(self):
+ # Number of bytes needed to define a tonemap
+ PHY_TONEMAP_SIZE = ((PHY_CARRIER_NB + 2 - 1) / 2)
+
+ # robo
+ self.assertEqual(maximus_dur_bits_per_symbol(self.maximus, self.station.get(), 0, # PHY_MOD_ROBO
+ self.station.get_tonemask(), None, 400), 200)
+ self.assertEqual(maximus_dur_bits_per_symbol(self.maximus, self.station.get(), 0, # PHY_MOD_ROBO
+ self.station.get_tonemask(), None, 403), 200)
+ self.assertEqual(maximus_dur_bits_per_symbol(self.maximus, self.station.get(), 1, # PHY_MOD_HS_ROBO
+ self.station.get_tonemask(), None, 400), 400)
+ self.assertEqual(maximus_dur_bits_per_symbol(self.maximus, self.station.get(), 1, # PHY_MOD_HS_ROBO
+ self.station.get_tonemask(), None, 401), 400)
+ self.assertEqual(maximus_dur_bits_per_symbol(self.maximus, self.station.get(), 2, # PHY_MOD_MINI_ROBO
+ self.station.get_tonemask(), None, 300), 120)
+
+ # tm
+ # Maximum modulations
+ tonemap = ''
+ for i in range (0, PHY_CARRIER_NB / 2):
+ if PHY_CARRIER_NB % 2 == 0:
+ tonemap += pack('B', 0x07)
+ else:
+ tonemap += pack('B', 0x77)
+ bits_ref = 917 * 10
+ bits = maximus_dur_bits_per_symbol(self.maximus, self.station.get(), 3, # PHY_MOD_TM
+ self.station.get_tonemask(), tonemap, 917)
+ self.assertEqual(bits, bits_ref)
+
+ def test_maximus_dur_symbol_nb(self):
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 0, # PHY_FEC_RATE_1_2
+ 0, # PHY_PB_SIZE_136
+ 136 * 8 * 2, 1), 1)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 1, # PHY_FEC_RATE_16_21
+ 0, # PHY_PB_SIZE_136
+ 136 * 8 / 16 * 21, 1), 1)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 0, # PHY_FEC_RATE_1_2
+ 1, # PHY_PB_SIZE_520
+ 520 * 8 * 2, 1), 1)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 1, # PHY_FEC_RATE_16_21
+ 1, # PHY_PB_SIZE_520
+ 520 * 8 / 16 * 21, 1), 1)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 0, # PHY_FEC_RATE_1_2
+ 0, # PHY_PB_SIZE_136
+ 136 * 2, 1), 8)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 1, # PHY_FEC_RATE_16_21
+ 0, # PHY_PB_SIZE_136
+ 136 / 16 * 21, 1), 9)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 0, # PHY_FEC_RATE_1_2
+ 1, # PHY_PB_SIZE_520
+ 520 * 2, 1), 8)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 1, # PHY_FEC_RATE_16_21
+ 1, # PHY_PB_SIZE_520
+ 520 / 16 * 21, 1), 9)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 0, # PHY_FEC_RATE_1_2
+ 1, # PHY_PB_SIZE_520
+ 520 * 8 * 2, 10), 10)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 1, # PHY_FEC_RATE_16_21
+ 1, # PHY_PB_SIZE_520
+ 520 * 8 / 16 * 21, 10), 10)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 0, # PHY_FEC_RATE_1_2
+ 1, # PHY_PB_SIZE_520
+ 2 * 520 * 8 * 2, 10), 5)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 1, # PHY_FEC_RATE_16_21
+ 1, # PHY_PB_SIZE_520
+ 2 * 520 * 8 / 16 * 21, 10), 5)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 0, # PHY_FEC_RATE_1_2
+ 1, # PHY_PB_SIZE_520
+ 2 * 520 * 8 * 2 - 10, 10), 6)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 1, # PHY_FEC_RATE_16_21
+ 1, # PHY_PB_SIZE_520
+ 2 * 520 * 8 / 16 * 21 - 10, 10), 6)
+
+ def test_maximus_dur_data_tck(self):
+ # Symbol with a 417 sample guard length (ticks)
+ MAC_DX417_TCK = (3489/3)
+ # Symbol with a 567 sample guard length (ticks)
+ MAC_DX567_TCK = (3639/3)
+ # Symbol with a 3534 sample guard length (ticks)
+ MAC_DX3534_TCK = (6606/3)
+
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 0, # PHY_GIL_417
+ 1), MAC_DX567_TCK)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 1, # PHY_GIL_567
+ 1), MAC_DX567_TCK)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 2, # PHY_GIL_3534
+ 1), MAC_DX567_TCK)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 0, # PHY_GIL_417
+ 2), MAC_DX567_TCK * 2)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 1, # PHY_GIL_567
+ 2), MAC_DX567_TCK * 2)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 2, # PHY_GIL_3534
+ 2), MAC_DX567_TCK * 2)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 0, # PHY_GIL_417
+ 3), MAC_DX567_TCK * 2 + MAC_DX417_TCK)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 1, # PHY_GIL_567
+ 3), MAC_DX567_TCK * 2 + MAC_DX567_TCK)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 2, # PHY_GIL_3534
+ 3), MAC_DX567_TCK * 2 + MAC_DX3534_TCK)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 0, # PHY_GIL_417
+ 4), MAC_DX567_TCK * 2 + MAC_DX417_TCK * 2)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 1, # PHY_GIL_567
+ 4), MAC_DX567_TCK * 2 + MAC_DX567_TCK * 2)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 2, # PHY_GIL_3534
+ 4), MAC_DX567_TCK * 2 + MAC_DX3534_TCK * 2)
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestMaximusDurFunctions)
+
+class TestSTACesarFunctions(unittest.TestCase):
+
+ def setUp(self):
+ # Create station
+ self.station = STACesar(m)
+
+ def tearDown(self):
+ # Remove station
+ m.create_fcall("uninit_ether").send(self.station.get())
+ self.station.remove()
+
+ def test_stop(self):
+ self.station.stop()
+
+ def test_set_name(self):
+ name = "Name of my station"
+ self.station.set_name(name)
+ self.assertEqual(self.station.get_name(), name)
+
+ def test_set_mme_buffer_nb(self):
+ mme_buffer_nb = 4
+ self.station.set_mme_buffer_nb(mme_buffer_nb)
+ self.assertEqual(self.station.get_mme_buffer_nb(), mme_buffer_nb)
+
+ def test_set_config_mode(self):
+ config_mode = 'fcall_process_drv'
+ self.station.set_config_mode(config_mode)
+ self.assertEqual(self.station.get_config_mode(), config_mode)
+
+ def test_set_config(self):
+ test_conf = Config()
+ test_conf.mac_address = (0x11, 0x22, 0x33, 0x44, 0x55, 0x66)
+ test_conf.cco_preference = True
+ self.station.set_config(test_conf)
+ self.assertEqual(self.station.get_config().mac_address, test_conf.mac_address)
+ self.assertEqual(self.station.get_config().cco_preference, test_conf.cco_preference)
+
+ def test_set_mac_address(self):
+ mac_address = (0x41, 0x42, 0x43, 0x44, 0x45, 0x46)
+ # Test with a Python tuple of 6 Python integers
+ self.station.set_mac_address((0x41, 0x42, 0x43, 0x44, 0x45, 0x46))
+ self.assertEqual(self.station.get_mac_address(), mac_address)
+ # Test with a Python long (decimal or hexadecimal value)
+ self.station.set_mac_address(0x414243444546)
+ self.assertEqual(self.station.get_mac_address(), mac_address)
+ # Test with a Python string of length equals to 6 octets
+ self.station.set_mac_address(pack(n + u64, 0x414243444546)[SIZE_OF_U16:])
+ self.assertEqual(self.station.get_mac_address(), mac_address)
+ # Test with a Python string of length equals to 17 octets ('XX:XX:XX:XX:XX:XX')
+ self.station.set_mac_address('41:42:43:44:45:46')
+ self.assertEqual(self.station.get_mac_address(), mac_address)
+
+ def test_set_cco_preference(self):
+ cco_preference = False
+ self.station.set_cco_preference(cco_preference)
+ self.assertEqual(self.station.get_cco_preference(), cco_preference)
+
+ def test_set_was_cco(self):
+ was_cco = True
+ self.station.set_was_cco(was_cco)
+ self.assertEqual(self.station.get_was_cco(), was_cco)
+
+ def test_set_npw(self):
+ npw = "This is the network password"
+ self.station.set_npw(npw)
+ self.assertEqual(self.station.get_npw(), npw)
+
+ def test_set_dpw(self):
+ dpw = "This is the device password"
+ self.station.set_dpw(dpw)
+ self.assertEqual(self.station.get_dpw(), dpw)
+
+ def test_set_m_sta_hfid(self):
+ m_sta_hfid = "This is the manufacturer sta hfid"
+ self.station.set_m_sta_hfid(m_sta_hfid)
+ self.assertEqual(self.station.get_m_sta_hfid(), m_sta_hfid)
+
+ def test_set_u_sta_hfid(self):
+ u_sta_hfid = "This is the user sta hfid"
+ self.station.set_u_sta_hfid(u_sta_hfid)
+ self.assertEqual(self.station.get_u_sta_hfid(), u_sta_hfid)
+
+ def test_set_avln_hfid(self):
+ avln_hfid = "This is the avln hfid"
+ self.station.set_avln_hfid(avln_hfid)
+ self.assertEqual(self.station.get_avln_hfid(), avln_hfid)
+
+ def test_set_sl(self):
+ sl = 0x02
+ self.station.set_sl(sl)
+ self.assertEqual(self.station.get_sl(), sl)
+
+ def test_set_snid(self):
+ snid = 0x02
+ self.station.set_snid(snid)
+ self.assertEqual(self.station.get_snid(), snid)
+
+ def test_set_tonemask(self):
+ tonemask = 85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535
+ self.station.set_tonemask(tonemask)
+ self.assertEqual(self.station.get_tonemask()[0 / 8], pack('B', 0)) # 74
+ self.assertEqual(self.station.get_tonemask()[11 / 8], pack('B', 0xf0)) # 85
+ self.assertEqual(self.station.get_tonemask()[345 / 8], pack('B', 0xfc)) # 419
+ self.assertEqual(self.station.get_tonemask()[495 / 8], pack('B', 0xff)) # 569
+ self.assertEqual(self.station.get_tonemask()[782 / 8], pack('B', 0x7f)) # 856
+ self.assertEqual(self.station.get_tonemask()[1069 / 8], pack('B', 0x3f)) # 1143
+ self.assertEqual(self.station.get_tonemask()[1070 / 8], pack('B', 0x3f)) # 1144
+ self.assertEqual(self.station.get_tonemask()[1155 / 8], pack('B', 0x00)) # 1229
+
+ def test_remove(self):
+ m.create_fcall("uninit_ether").send(self.station.get())
+ self.station.remove()
+ self.station = STACesar(m)
+
+ def test_deactivate(self):
+ self.station.deactivate()
+ self.station.activate()
+
+ def test_activate(self):
+ self.station.activate()
+
+ def test_debug(self):
+ self.station.debug()
+
+ def test_is_idle(self):
+ m.wait(1) # to process the system IDLE message coming from the station
+ self.assert_(self.station.is_idle())
+ self.station.deactivate()
+ self.assert_(not self.station.is_idle())
+ self.station.activate()
+
+ def test_get_station_id(self):
+ self.assertNotEqual(self.station.get_station_id(), 0)
+
+suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestSTACesarFunctions))
+
+try:
+ suite.addTest(doctest.DocTestSuite(maximus_dur))
+ suite.addTest(doctest.DocTestSuite(sta_cesar))
+except ValueError:
+ print "has no tests"
+
+if __name__ == '__main__':
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/maximus/python/test/test_station.py b/maximus/python/test/test_station.py
index 596d32de6c..14f55eb8e8 100644
--- a/maximus/python/test/test_station.py
+++ b/maximus/python/test/test_station.py
@@ -92,13 +92,6 @@ station_nb += 1
m.create_fcall("uninit_ether").send(sta9.get())
sta9.remove()
-# Create a Cesar station
-from sta_cesar import STACesar
-sta10 = STACesar(m, name="sta10")
-station_nb += 1
-m.create_fcall("uninit_ether").send(sta10.get())
-sta10.remove()
-
# Test with the maximum number of stations,
# which is limited by the maximum number of open file descriptors (1024)
station_max_nb = (1024 + (file_desc_nb - 1)) / file_desc_nb - station_nb * file_desc_nb
diff --git a/maximus/stationtest/Makefile b/maximus/stationtest/Makefile
index eff0aaffd4..ecb762c262 100644
--- a/maximus/stationtest/Makefile
+++ b/maximus/stationtest/Makefile
@@ -2,8 +2,12 @@ BASE = ../..
ECOS = y
-TARGET_PROGRAMS = hello_world one_thread exception threaddelay stationtest \
- test_send test_tx_rx test_cb test_ether test_station test_false_alarm
+TARGET_PROGRAMS = exception hello_world one_thread threaddelay \
+ stationtest \
+ test_cb test_ether test_false_alarm test_lib_cesar test_send test_station test_tx_rx
+
+exception_SOURCES = exception.c
+exception_MODULES = lib host
hello_world_SOURCES = hello_world.c
hello_world_MODULES = lib host
@@ -11,32 +15,33 @@ hello_world_MODULES = lib host
one_thread_SOURCES = one_thread.c
one_thread_MODULES = lib host
-exception_SOURCES = exception.c
-exception_MODULES = lib host
-
threaddelay_SOURCES = threaddelay.c
threaddelay_MODULES = lib host
stationtest_SOURCES = main_example.c
stationtest_MODULES = lib host hal/phy/maximus
-test_send_SOURCES = test_send.c
-test_send_MODULES = lib host hal/phy/maximus
-
-test_tx_rx_SOURCES = test_tx_rx.c
-test_tx_rx_MODULES = lib host hal/phy/maximus
-
test_cb_SOURCES = test_cb.c
test_cb_MODULES = lib host
test_ether_SOURCES = test_ether.c
test_ether_MODULES = lib host hal/hle/maximus
+test_false_alarm_SOURCES = test_false_alarm.c
+test_false_alarm_MODULES = lib host hal/phy/maximus
+
+cp_beacon_MODULE_SOURCES = beacon.c
+test_lib_cesar_SOURCES = test_lib_cesar.c
+test_lib_cesar_MODULES = lib host hal/hle/maximus cp/station/maximus hal/phy/maximus/dur/maximus
+
+test_send_SOURCES = test_send.c
+test_send_MODULES = lib host hal/phy/maximus
+
cp_beacon_MODULE_SOURCES = beacon.c
test_station_SOURCES = test_station.c
test_station_MODULES = lib host hal/hle/maximus cp/station/maximus
-test_false_alarm_SOURCES = test_false_alarm.c
-test_false_alarm_MODULES = lib host hal/phy/maximus
+test_tx_rx_SOURCES = test_tx_rx.c
+test_tx_rx_MODULES = lib host hal/phy/maximus
include $(BASE)/common/make/top.mk
diff --git a/maximus/stationtest/src/test_lib_cesar.c b/maximus/stationtest/src/test_lib_cesar.c
new file mode 100644
index 0000000000..317c5c0f97
--- /dev/null
+++ b/maximus/stationtest/src/test_lib_cesar.c
@@ -0,0 +1,91 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test_lib_cesar.c
+ * \brief station executable used for the test lib cesar program
+ * \ingroup
+ */
+
+#include "common/std.h"
+#include "host/station.h" // for 'station_ctx_t'
+#include "cp/station/maximus/inc/maximus_cp_station.h" // for 'maximus_cp_station_init()'
+#include "hal/phy/maximus/dur/maximus/inc/maximus_phy_dur.h" // for 'maximus_phy_dur_init()'
+#include "hal/hle/ipmbox.h"
+#include "hal/hle/defs.h" // for 'HLE_MSG_TYPE_...' and 'ipmbox_msg_hdr_t'
+#include "hal/hle/maximus/inc/maximus_ipmbox_ctx.h" // for 'ipmbox_t'
+#include "hal/hle/maximus/inc/maximus_interrupts.h" // for 'HAL_HLE_INTERRUPT_IPMBOX'
+#include "maximus/common/types/ethernet_types.h" // for 'ETHERNET_TYPE_...'
+
+extern station_ctx_t my_station;
+ipmbox_t *ctx;
+int user_data = 123;
+
+void ipmbox_rx_cb (void *user_data, u32 *first_msg, uint length)
+{
+ // Reset IT
+ maximus_pending_isrs &= (0 << HAL_HLE_INTERRUPT_IPMBOX);
+
+ ipmbox_msg_hdr_t *hdr = (ipmbox_msg_hdr_t *)&ctx->rx.mailbox[0];
+ if (HLE_MSG_TYPE_DATA == hdr->type)
+ {
+ /* When receiving an Ether SCI message of type MME REQ from Maximus,
+ * send the answer (an Ether SCI message of type MME CNF). */
+
+ uint data_length = (uint)(hdr->param >> 1);
+ memcpy(ctx->first_buffer->next->data, (u32 *)ctx->rx.mailbox[1], data_length);
+ char *data = (char *)ctx->first_buffer->next->data;
+ *(data + 15) = *(data + 15) + 1; // REQ => CNF
+ *(data + 19) = 0x01; // Success
+ memset(data + 20, '\0', data_length - 20);
+
+ // Release allocated buffer
+ hdr->type = HLE_MSG_TYPE_SEND_DONE;
+ ipmbox_tx (ctx, ctx->rx.mailbox, 2);
+
+ hdr->type = HLE_MSG_TYPE_DATA;
+ hdr->param |= 0x001;
+ ctx->rx.mailbox[1] = (u32)ctx->first_buffer->next->data;
+ ipmbox_tx (ctx, ctx->rx.mailbox, ctx->rx.length);
+ }
+
+ return;
+}
+
+int uninit_ether (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ // Uninitialize the HAL HLE ipmbox
+ ipmbox_uninit (ctx);
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+int main (void)
+{
+ station_log_set_level(&my_station, STATION_LOG_WARNING);
+ station_log_set_mask(&my_station, STATION_LOGTYPE_ALL);
+ my_station.pipe_log_fd = 1;
+
+ maximus_cp_station_init(&my_station);
+ maximus_phy_dur_init(&my_station);
+
+ // Initialize the HAL HLE ipmbox
+ ctx = ipmbox_init ((void *)&user_data, &ipmbox_rx_cb);
+
+ // Enable assertions on warnings
+ ctx->warning_assert = true;
+
+ // Activate ipmbox interruptions
+ ipmbox_activate (ctx, true);
+
+ fcall_register(my_station.fcall, "uninit_ether", (void*)&uninit_ether, NULL);
+
+ return 0;
+}
diff --git a/maximus/test/test_python.sh b/maximus/test/test_python.sh
index bf65807613..bd4b0e2395 100755
--- a/maximus/test/test_python.sh
+++ b/maximus/test/test_python.sh
@@ -19,6 +19,7 @@ python test/test_cli.py
python test/test_ethernet.py -e ../stationtest/obj/test_ether.elf -d false -t 2500000000
python test/test_fsm.py
python test/test_interface.py -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
+python test/test_lib_cesar.py -e ../stationtest/obj/test_lib_cesar.elf -d false -t 2500000000
python test/test_macframe.py -e ../stationtest/obj/test_send.elf -d false -t 2500000000
python test/test_mme.py -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
python test/test_result.py