summaryrefslogtreecommitdiff
path: root/cesar
diff options
context:
space:
mode:
Diffstat (limited to 'cesar')
-rw-r--r--cesar/hal/phy/test/phy/doc/test_phy.txt11
-rw-r--r--cesar/hal/phy/test/phy/py/test_phy/test_phy.py3
-rw-r--r--cesar/hal/phy/test/phy/src/gen.c6
-rw-r--r--cesar/hal/phy/test/phy/src/test_phy.c25
4 files changed, 43 insertions, 2 deletions
diff --git a/cesar/hal/phy/test/phy/doc/test_phy.txt b/cesar/hal/phy/test/phy/doc/test_phy.txt
index 353078754f..6b0f3cdd28 100644
--- a/cesar/hal/phy/test/phy/doc/test_phy.txt
+++ b/cesar/hal/phy/test/phy/doc/test_phy.txt
@@ -518,6 +518,17 @@ header (uint)
data (string)
128 or 512 byte of data.
+TestPhy.zero_pb
+--------------
+
+Override auto-generated PB with zeros.
+
+Parameters
+~~~~~~~~~~
+
+n (uint)
+ PB number to change.
+
TestPhy.chandata
----------------
diff --git a/cesar/hal/phy/test/phy/py/test_phy/test_phy.py b/cesar/hal/phy/test/phy/py/test_phy/test_phy.py
index 6969190a07..686fceb350 100644
--- a/cesar/hal/phy/test/phy/py/test_phy/test_phy.py
+++ b/cesar/hal/phy/test/phy/py/test_phy/test_phy.py
@@ -98,6 +98,9 @@ class TestPhy:
def set_pb (self, **args):
self.create_fcall ('test_phy_set_pb', **args).send (self.sta)
+ def zero_pb (self, **args):
+ self.create_fcall ('test_phy_zero_pb', **args).send (self.sta)
+
def chandata (self, **args):
m = self.create_fcall ('test_phy_chandata', **args).send (self.sta)
return m.bind_param ('chandata')
diff --git a/cesar/hal/phy/test/phy/src/gen.c b/cesar/hal/phy/test/phy/src/gen.c
index f51edffa91..64fbf29131 100644
--- a/cesar/hal/phy/test/phy/src/gen.c
+++ b/cesar/hal/phy/test/phy/src/gen.c
@@ -94,7 +94,6 @@ gen_replace_data_blk (gen_t *ctx, uint n, u32 header, u32 *data, uint size)
{
uint i;
dbg_assert (ctx);
- dbg_assert_ptr (data);
dbg_assert (size == MAC_PB520_BYTES || size == MAC_PB136_BYTES);
/* Generate missing blocks. */
gen_data_blk_cached (ctx, n + 1, NULL);
@@ -103,6 +102,9 @@ gen_replace_data_blk (gen_t *ctx, uint n, u32 header, u32 *data, uint size)
for (i = 0; i < n; i++)
p = &PARENT_OF (phy_pb_t, blk, p->blk.next)->pb_tx;
p->header = header;
- memcpy (p->blk.data, data, size);
+ if (data)
+ memcpy (p->blk.data, data, size);
+ else
+ memset (p->blk.data, 0, size);
}
diff --git a/cesar/hal/phy/test/phy/src/test_phy.c b/cesar/hal/phy/test/phy/src/test_phy.c
index 5e7757580e..75a6d3d70a 100644
--- a/cesar/hal/phy/test/phy/src/test_phy.c
+++ b/cesar/hal/phy/test/phy/src/test_phy.c
@@ -480,6 +480,29 @@ test_phy_set_pb_fcall (fcall_ctx_t *fcall, fcall_param_t **param,
}
static int
+test_phy_zero_pb_fcall (fcall_ctx_t *fcall, fcall_param_t **param,
+ sci_msg_t **msg, void *data)
+{
+ dbg_assert (fcall);
+ dbg_assert (param && *param);
+ dbg_assert (msg && *msg);
+ test_phy_t *ctx = (void *) data;
+ dbg_assert (ctx);
+ /* If a call is pending, this is an error. */
+ if (ctx->fcall)
+ return -1;
+ /* Decode. */
+ uint n;
+ if (!fcall_param_bind_long_helper ("n", n))
+ return -1;
+ /* Use it. */
+ gen_replace_data_blk (&ctx->gen, n, 0, NULL, MAC_PB520_BYTES);
+ /* Return. */
+ fcall_param_reset (*param);
+ return 0;
+}
+
+static int
test_phy_chandata_fcall (fcall_ctx_t *fcall, fcall_param_t **param,
sci_msg_t **msg, void *data)
{
@@ -691,6 +714,8 @@ cyg_user_start (void)
test_phy_set_freqerror_fcall, &test_phy_global);
fcall_register (fcall, "test_phy_set_pb",
test_phy_set_pb_fcall, &test_phy_global);
+ fcall_register (fcall, "test_phy_zero_pb",
+ test_phy_zero_pb_fcall, &test_phy_global);
fcall_register (fcall, "test_phy_chandata", test_phy_chandata_fcall,
&test_phy_global);
test_phy_burst_init (&test_phy_global, fcall);