summaryrefslogtreecommitdiff
path: root/cesar/mac/common
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/mac/common')
-rw-r--r--cesar/mac/common/ntb.h6
-rw-r--r--cesar/mac/common/src/ntb.c17
-rw-r--r--cesar/mac/common/test/ntb/src/test_ntb.c13
-rw-r--r--cesar/mac/common/test/ntb/src/test_ntb_phy_unstub.c7
4 files changed, 10 insertions, 33 deletions
diff --git a/cesar/mac/common/ntb.h b/cesar/mac/common/ntb.h
index f713d54cfc..2a0c8ae599 100644
--- a/cesar/mac/common/ntb.h
+++ b/cesar/mac/common/ntb.h
@@ -14,7 +14,6 @@
*
*/
-#include "hal/phy/forward.h"
#include "mac/common/config.h"
/** Convert a NTB date to a Date. */
@@ -22,8 +21,6 @@
struct mac_ntb_t
{
- /** Phy context. */
- phy_t *phy;
/** mac config context. */
mac_config_t *mac_config;
};
@@ -34,11 +31,10 @@ extern mac_ntb_t ntb_global;
/**
* Initialize the ntb context.
*
- * \param phy the phy context.
* \param mac_config the mac config context.
*/
void
-mac_ntb_init (phy_t *phy, mac_config_t *mac_config);
+mac_ntb_init (mac_config_t *mac_config);
/**
* Uninitialize the ntb context.
diff --git a/cesar/mac/common/src/ntb.c b/cesar/mac/common/src/ntb.c
index 30d2429c3b..81c7a1b956 100644
--- a/cesar/mac/common/src/ntb.c
+++ b/cesar/mac/common/src/ntb.c
@@ -18,23 +18,20 @@
#include "mac/common/ntb.h"
u32
-phy_date (phy_t *ctx) __attribute__((weak));
+phy_date (void) __attribute__((weak));
mac_ntb_t ntb_global;
/**
* Initialize the ntb context.
*
- * \param phy the phy context.
* \param mac_config the mac config context.
*/
void
-mac_ntb_init (phy_t *phy, mac_config_t *mac_config)
+mac_ntb_init (mac_config_t *mac_config)
{
- dbg_assert(phy);
dbg_assert(mac_config);
- ntb_global.phy = phy;
ntb_global.mac_config = mac_config;
}
@@ -55,10 +52,9 @@ mac_ntb_uninit (void)
u32
mac_ntb (void)
{
- dbg_assert (ntb_global.phy);
dbg_assert (ntb_global.mac_config);
- return phy_date (ntb_global.phy) + ntb_global.mac_config->ntb_offset_tck;
+ return phy_date () + ntb_global.mac_config->ntb_offset_tck;
}
/**
@@ -69,23 +65,20 @@ mac_ntb (void)
u32
mac_date (void)
{
- dbg_assert (ntb_global.phy);
dbg_assert (ntb_global.mac_config);
- return phy_date (ntb_global.phy);
+ return phy_date ();
}
/**
* Create a phy_date weak function to do not have to include the phy on test
* when it is not necessary.
*
- * \param phy the phy context.
* \return the phy date.
*/
u32
-phy_date (phy_t *phy)
+phy_date (void)
{
return 42;
}
-
diff --git a/cesar/mac/common/test/ntb/src/test_ntb.c b/cesar/mac/common/test/ntb/src/test_ntb.c
index eb7e6570de..305b1ef145 100644
--- a/cesar/mac/common/test/ntb/src/test_ntb.c
+++ b/cesar/mac/common/test/ntb/src/test_ntb.c
@@ -14,24 +14,19 @@
#include "common/std.h"
#include "lib/test.h"
-#include "lib/blk.h"
#include "mac/common/ntb.h"
#include "mac/common/config.h"
-#include "hal/phy/phy.h"
int main (void)
{
test_t test;
-
+
mac_config_t mac_config;
- phy_t *phy;
test_init(test, 0, NULL);
- phy = blk_alloc();
-
- mac_ntb_init(phy, &mac_config);
+ mac_ntb_init(&mac_config);
mac_config.ntb_offset_tck = 10;
test_begin(test, "test ntb")
@@ -41,15 +36,13 @@ int main (void)
test_end;
mac_ntb_uninit();
- blk_release(phy);
test_result (test);
return test_nb_failed (test) == 0 ? 0 : 1;
}
u32
-phy_date (phy_t *phy)
+phy_date (void)
{
- dbg_assert(phy);
return 52;
}
diff --git a/cesar/mac/common/test/ntb/src/test_ntb_phy_unstub.c b/cesar/mac/common/test/ntb/src/test_ntb_phy_unstub.c
index 2fbc005081..de06d6f617 100644
--- a/cesar/mac/common/test/ntb/src/test_ntb_phy_unstub.c
+++ b/cesar/mac/common/test/ntb/src/test_ntb_phy_unstub.c
@@ -14,7 +14,6 @@
#include "common/std.h"
#include "lib/test.h"
-#include "lib/blk.h"
#include "mac/common/ntb.h"
#include "mac/common/config.h"
@@ -24,13 +23,10 @@ int main (void)
test_t test;
mac_config_t mac_config;
- phy_t *phy;
test_init(test, 0, NULL);
- phy = blk_alloc();
-
- mac_ntb_init (phy, &mac_config);
+ mac_ntb_init (&mac_config);
mac_config.ntb_offset_tck = 10;
test_begin(test, "test ntb")
@@ -40,7 +36,6 @@ int main (void)
test_end;
mac_ntb_uninit();
- blk_release (phy);
test_result (test);
return test_nb_failed (test) == 0 ? 0 : 1;
}