summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xce/inc/cei.h14
-rwxr-xr-xce/src/rx.c10
-rwxr-xr-xce/test/common/src/print_utils.c2
-rw-r--r--ce/test/common/tonemap_utils.h6
-rwxr-xr-xce/test/rx/src/test_rx.c8
-rwxr-xr-xce/test/rx/src/test_sar_integration.c14
-rwxr-xr-xce/test/tx/src/test_tx.c14
-rw-r--r--mac/common/src/tonemap.c12
-rw-r--r--mac/common/src/tonemask.c1
-rw-r--r--mac/common/tonemap.h58
-rw-r--r--mac/pbproc/inc/fc.h34
-rw-r--r--mac/pbproc/inc/prep_mpdu.h3
-rw-r--r--mac/pbproc/src/fsm_rx_data.c117
-rw-r--r--mac/pbproc/src/fsm_tx_data.c10
-rw-r--r--mac/pbproc/src/prep_mpdu.c113
-rw-r--r--mac/pbproc/src/trace.c2
-rw-r--r--mac/pbproc/test/maximus/Makefile2
-rw-r--r--mac/pbproc/test/maximus/inc/msg.h1
-rw-r--r--mac/pbproc/test/maximus/inc/set_tonemap.h23
-rw-r--r--mac/pbproc/test/maximus/py/host_test_pbproc.py5
-rw-r--r--mac/pbproc/test/maximus/py/test_pbproc.py5
-rw-r--r--mac/pbproc/test/maximus/src/set_tonemap.c105
-rw-r--r--mac/pbproc/test/maximus/src/test_pbproc.c15
-rw-r--r--mac/pbproc/test/pbproc/inc/utils.h6
-rw-r--r--mac/pbproc/test/pbproc/src/prep_mpdu.c85
-rw-r--r--mac/pbproc/test/pbproc/src/utils.c33
26 files changed, 567 insertions, 131 deletions
diff --git a/ce/inc/cei.h b/ce/inc/cei.h
index b97398a3ce..b9b1a3d90a 100755
--- a/ce/inc/cei.h
+++ b/ce/inc/cei.h
@@ -168,7 +168,7 @@ cei_tonemaps_to_mme (cei_param_t *param, u8 *dest_buffer, u8 *mask)
STREAM_WRITE (w_ptr, tms->rifs_av_g2_sym_tck / MAC_TCK_PER_FL, 8);
STREAM_WRITE(w_ptr, respt, 8);
STREAM_WRITE(w_ptr, tms->max_tm, 8);
- STREAM_WRITE(w_ptr, tms->cp_tmi_av, 8);
+ STREAM_WRITE(w_ptr, tms->default_tmi, 8);
STREAM_WRITE(w_ptr, (u8)tms->scl_cp, 8);
STREAM_WRITE(w_ptr, (u8)tms->scl_cfp, 8);
STREAM_WRITE(w_ptr, valid_tm_list_lg, 8);
@@ -182,7 +182,7 @@ cei_tonemaps_to_mme (cei_param_t *param, u8 *dest_buffer, u8 *mask)
for (i=0; i<(int)intervals->intervals_nb; i++)
{
STREAM_WRITE(w_ptr, intervals->interval[i].end_offset_atu, 16);
- STREAM_WRITE(w_ptr, intervals->interval[i].tmi_av, 8);
+ STREAM_WRITE(w_ptr, intervals->interval[i].tmi, 8);
}
new_tmi = param->new_tmi;
if(new_tmi != TONEMAP_INDEX_NULL)
@@ -242,7 +242,7 @@ cei_decoding (tonemaps_t *tms, int mm_type, u8 *mm_entry, u8 *mask)
int entry_nb;
int mod; //modulation
int codage;
- int tmp_cp_tmi_av;
+ int tmp_default_tmi;
bitstream_t stream_reader;
bitstream_t stream_writer;
uint read;
@@ -260,7 +260,7 @@ cei_decoding (tonemaps_t *tms, int mm_type, u8 *mm_entry, u8 *mask)
bitstream_access (&stream_reader, &read, 8);
tms->max_tm = read;
bitstream_access (&stream_reader, &read, 8);
- tmp_cp_tmi_av = read;
+ tmp_default_tmi = read;
bitstream_access (&stream_reader, &read, 8);
tms->scl_cp = read;
bitstream_access (&stream_reader, &read, 8);
@@ -295,9 +295,9 @@ cei_decoding (tonemaps_t *tms, int mm_type, u8 *mm_entry, u8 *mask)
//intervals->interval[i].end_offset_atu += READ_U8;
bitstream_access (&stream_reader, &read, 16);
intervals->interval[i].end_offset_atu = read;
- //intervals->interval[i].tmi_av = READ_U8;
+ //intervals->interval[i].tmi = READ_U8;
bitstream_access (&stream_reader, &read, 8);
- intervals->interval[i].tmi_av = read;
+ intervals->interval[i].tmi = read;
}
bitstream_access (&stream_reader, &new_tmi, 8);
@@ -382,7 +382,7 @@ cei_decoding (tonemaps_t *tms, int mm_type, u8 *mm_entry, u8 *mask)
// ATOMIC switch intervals
tms->intervals = intervals;
// ATOMIC set tonemap default;
- tms->cp_tmi_av = tmp_cp_tmi_av;
+ tms->default_tmi = tmp_default_tmi;
return (tonemaps_valid_status);
}
#endif
diff --git a/ce/src/rx.c b/ce/src/rx.c
index e7a49da84c..e08d2bd85c 100755
--- a/ce/src/rx.c
+++ b/ce/src/rx.c
@@ -120,7 +120,7 @@ compute_scf (void)
{
sta = mac_store_sta_get(ctx.mac_store_ctx, ctx.sound_param.stei);
tms = sta->rx_tonemaps;
- if (tms->cp_tmi_av != TONEMAP_INDEX_NULL)
+ if (tms->default_tmi != TONEMAP_INDEX_NULL)
{
ret = true;
}
@@ -157,7 +157,7 @@ rxce_compute_measurement (void)
sta_t *ssta = mac_store_sta_get (ctx.mac_store_ctx, rx_params->tei);
dbg_assert (ssta);
//cyg_thread_delay (1);
- if ( ssta->rx_tonemaps->cp_tmi_av == TONEMAP_INDEX_NULL ) // no default_tonemap
+ if ( ssta->rx_tonemaps->default_tmi == TONEMAP_INDEX_NULL ) // no default_tonemap
{
rxce_initial (ssta, frame_measurement);
}
@@ -183,11 +183,11 @@ rxce_initial (sta_t *ssta, frame_measurement_t *frame_measurement)
if (ssta->rxce.measurement_computed_nb >= FRAME_NB_TO_COMPUTE_IN_INITIAL_STEP)
{
//my_print ("swapping temporary tonemap to default\n");
- tms->cp_tmi_av = tonemap_set_first_free (tms, ssta->rxce.tm_in_build);
+ tms->default_tmi = tonemap_set_first_free (tms, ssta->rxce.tm_in_build);
ssta->rxce.tm_in_build = NULL;
cei_param_t cei_param;
cei_param.tms = tms;
- cei_param.new_tmi = tms->cp_tmi_av;
+ cei_param.new_tmi = tms->default_tmi;
cei_param.old_tmi = 0;
cei_param.priority = CEI_PRIORITY;
cei_param.dtei = ssta->tei;
@@ -210,7 +210,7 @@ rxce_initial (sta_t *ssta, frame_measurement_t *frame_measurement)
ssta->rxce.unstable_ROBO_nb++; // else stable_nonROBO_nb
//TODO manage_interval (tms, frame_measurement);
}
- //if (ssta->rx_tonemaps->cp_tmi_av != NULL_TONEMAP_INDEX ) print_tonemap (ssta->rx_tonemaps->tm[ssta->rx_tonemaps->cp_tmi_av]);
+ //if (ssta->rx_tonemaps->default_tmi != NULL_TONEMAP_INDEX ) print_tonemap (ssta->rx_tonemaps->tm[ssta->rx_tonemaps->default_tmi]);
}
void
diff --git a/ce/test/common/src/print_utils.c b/ce/test/common/src/print_utils.c
index db2e0c7029..9301033410 100755
--- a/ce/test/common/src/print_utils.c
+++ b/ce/test/common/src/print_utils.c
@@ -93,7 +93,7 @@ ce_print_tonemaps (tonemaps_t *tms)
ce_print ("MAX_FL_AV = %x ",tms->max_fl_av);
ce_print ("RIFS %x:%x:%x ",tms->rifs_av_one_sym_tck, tms->rifs_av_two_sym_tck, tms->rifs_av_g2_sym_tck);
ce_print ("MAX_TM = %x ",tms->max_tm);
- ce_print ("Default_tmi = %x ",tms->cp_tmi_av);
+ ce_print ("Default_tmi = %x ",tms->default_tmi);
ce_print ("scl_cp = %x ",tms->scl_cp);
ce_print ("scl_cfp = %x ",tms->scl_cfp);
ce_print ("expir = %x ",tms->expiration_date);
diff --git a/ce/test/common/tonemap_utils.h b/ce/test/common/tonemap_utils.h
index 2aeb186868..a1322588b8 100644
--- a/ce/test/common/tonemap_utils.h
+++ b/ce/test/common/tonemap_utils.h
@@ -27,7 +27,7 @@ create_tm (tonemaps_t *tms, u8 *mask, uint tmi, uint max_rnd, uint offset)
{
int i;
bitstream_t stream;
- tms->cp_tmi_av = 0;
+ tms->default_tmi = 0;
tms->tm[tmi] = tonemap_alloc ();
tms->tm[tmi]->cpf = 1;
tms->tm[tmi]->fecrate = 2;
@@ -85,7 +85,7 @@ compare_tonemaps (test_t t, tonemaps_t *tms1, tonemaps_t *tms2, u8 *mask)
test_fail_if (tms1->rifs_av_two_sym_tck != tms2->rifs_av_two_sym_tck);
test_fail_if (tms1->rifs_av_g2_sym_tck != tms2->rifs_av_g2_sym_tck);
test_fail_if (tms1->max_tm != tms2->max_tm);
- test_fail_if (tms1->cp_tmi_av != tms2->cp_tmi_av);
+ test_fail_if (tms1->default_tmi != tms2->default_tmi);
test_fail_if (tms1->scl_cp != tms2->scl_cp);
test_fail_if (tms1->scl_cfp != tms2->scl_cfp);
@@ -126,7 +126,7 @@ compare_tonemaps (test_t t, tonemaps_t *tms1, tonemaps_t *tms2, u8 *mask)
tonemap_interval_t tmi1=intervals1->interval[j];
tonemap_interval_t tmi2=intervals2->interval[j];
test_fail_if ( tmi1.end_offset_atu != tmi2.end_offset_atu );
- test_fail_if ( tmi1.tmi_av != tmi2.tmi_av );
+ test_fail_if ( tmi1.tmi != tmi2.tmi );
}
}
else test_fail_if (tms1->tm[i] != tms2->tm[i]);
diff --git a/ce/test/rx/src/test_rx.c b/ce/test/rx/src/test_rx.c
index f80e78ff00..a569c0e781 100755
--- a/ce/test/rx/src/test_rx.c
+++ b/ce/test/rx/src/test_rx.c
@@ -196,18 +196,18 @@ frame_process (cyg_addrword_t data)
frame->noise = noise;
frame_new (frame);
nb_frame++;
- test_fail_if (status.sta->rxce.stable_ROBO_nb<FRAME_NB_TO_COMPUTE_IN_INITIAL_STEP && status.sta->rx_tonemaps->cp_tmi_av != TONEMAP_INDEX_NULL);
- test_fail_if (status.sta->rxce.stable_ROBO_nb>FRAME_NB_TO_COMPUTE_IN_INITIAL_STEP && status.sta->rx_tonemaps->cp_tmi_av == TONEMAP_INDEX_NULL);
+ test_fail_if (status.sta->rxce.stable_ROBO_nb<FRAME_NB_TO_COMPUTE_IN_INITIAL_STEP && status.sta->rx_tonemaps->default_tmi != TONEMAP_INDEX_NULL);
+ test_fail_if (status.sta->rxce.stable_ROBO_nb>FRAME_NB_TO_COMPUTE_IN_INITIAL_STEP && status.sta->rx_tonemaps->default_tmi == TONEMAP_INDEX_NULL);
blk_release (frame);
//blk_release (rx_params);
} while (!pbproc_send_scf ());
bitstream_t stream;
- bitstream_init (&stream, status.sta->rx_tonemaps->tm[status.sta->rx_tonemaps->cp_tmi_av]->tmdma_desc_head->data, BLK_SIZE, BITSTREAM_READ);
+ bitstream_init (&stream, status.sta->rx_tonemaps->tm[status.sta->rx_tonemaps->default_tmi]->tmdma_desc_head->data, BLK_SIZE, BITSTREAM_READ);
for (j=0; j<PHY_CARRIER_NB; j++)
{
if (j==1024)
{
- bitstream_init (&stream, status.sta->rx_tonemaps->tm[status.sta->rx_tonemaps->cp_tmi_av]->tmdma_desc_head->next->data, BLK_SIZE, BITSTREAM_READ);
+ bitstream_init (&stream, status.sta->rx_tonemaps->tm[status.sta->rx_tonemaps->default_tmi]->tmdma_desc_head->next->data, BLK_SIZE, BITSTREAM_READ);
}
uint mod;
bitstream_access (&stream, &mod, 4);
diff --git a/ce/test/rx/src/test_sar_integration.c b/ce/test/rx/src/test_sar_integration.c
index 2cc0e4e5e7..6b109cca2b 100755
--- a/ce/test/rx/src/test_sar_integration.c
+++ b/ce/test/rx/src/test_sar_integration.c
@@ -156,7 +156,7 @@ frame_process (cyg_addrword_t data)
cyg_thread_delay (1); //rxce can process
test_begin (test, "check rxce status")
{
- test_fail_if (sta->rx_tonemaps->cp_tmi_av != TONEMAP_INDEX_NULL);
+ test_fail_if (sta->rx_tonemaps->default_tmi != TONEMAP_INDEX_NULL);
test_fail_if (!sta->rxce.tm_in_build);
} test_end;
END (sar_ctx, sta, ca);
@@ -171,7 +171,7 @@ frame_process (cyg_addrword_t data)
cyg_thread_delay (1); //rxce can process
test_begin (test, "check rxce status")
{
- test_fail_if (sta->rx_tonemaps->cp_tmi_av != TONEMAP_INDEX_NULL);
+ test_fail_if (sta->rx_tonemaps->default_tmi != TONEMAP_INDEX_NULL);
test_fail_if (!sta->rxce.tm_in_build);
} test_end;
END (sar_ctx, sta, ca);
@@ -186,7 +186,7 @@ frame_process (cyg_addrword_t data)
cyg_thread_delay (1); //rxce can process
test_begin (test, "check rxce status")
{
- test_fail_if (sta->rx_tonemaps->cp_tmi_av != TONEMAP_INDEX_NULL);
+ test_fail_if (sta->rx_tonemaps->default_tmi != TONEMAP_INDEX_NULL);
test_fail_if (!sta->rxce.tm_in_build);
} test_end;
END (sar_ctx, sta, ca);
@@ -203,7 +203,7 @@ frame_process (cyg_addrword_t data)
{
run_one_reassembly (sar_ctx, 0);
cyg_thread_delay (1); //rxce can process
- tmi_null = sta->rx_tonemaps->cp_tmi_av == TONEMAP_INDEX_NULL;
+ tmi_null = sta->rx_tonemaps->default_tmi == TONEMAP_INDEX_NULL;
tmp_exists = (int) sta->rxce.tm_in_build;
test_fail_if (n<FRAME_NB_TO_COMPUTE_IN_INITIAL_STEP && !tmi_null);
test_fail_if (n<FRAME_NB_TO_COMPUTE_IN_INITIAL_STEP && !tmp_exists);
@@ -230,7 +230,7 @@ frame_process (cyg_addrword_t data)
{
cyg_thread_delay (1); //rxce can process
uint frame_nb = sta->rxce.measurement_computed_nb-1;
- tmi_null = sta->rx_tonemaps->cp_tmi_av == TONEMAP_INDEX_NULL;
+ tmi_null = sta->rx_tonemaps->default_tmi == TONEMAP_INDEX_NULL;
tmp_exists = (int) sta->rxce.tm_in_build;
//my_print ("%d, tmi_null=%d, tmp_exists=%d\n",frame_nb, tmi_null, tmp_exists);
test_fail_if (frame_nb<FRAME_NB_TO_COMPUTE_IN_INITIAL_STEP && !tmi_null);
@@ -243,7 +243,7 @@ frame_process (cyg_addrword_t data)
{
cyg_thread_delay (1); //rxce can process
uint frame_nb = sta->rxce.measurement_computed_nb-1;
- tmi_null = sta->rx_tonemaps->cp_tmi_av == TONEMAP_INDEX_NULL;
+ tmi_null = sta->rx_tonemaps->default_tmi == TONEMAP_INDEX_NULL;
tmp_exists = (int) sta->rxce.tm_in_build;
//my_print ("%d, tmi_null=%d, tmp_exists=%d\n",frame_nb, tmi_null, tmp_exists);
test_fail_if (frame_nb<FRAME_NB_TO_COMPUTE_IN_INITIAL_STEP && !tmi_null);
@@ -256,7 +256,7 @@ frame_process (cyg_addrword_t data)
{
cyg_thread_delay (1); //rxce can process
uint frame_nb = sta->rxce.measurement_computed_nb-1;
- tmi_null = sta->rx_tonemaps->cp_tmi_av == TONEMAP_INDEX_NULL;
+ tmi_null = sta->rx_tonemaps->default_tmi == TONEMAP_INDEX_NULL;
tmp_exists = (int) sta->rxce.tm_in_build;
//my_print ("%d, tmi_null=%d, tmp_exists=%d\n",frame_nb, tmi_null, tmp_exists);
test_fail_if (frame_nb<FRAME_NB_TO_COMPUTE_IN_INITIAL_STEP && !tmi_null);
diff --git a/ce/test/tx/src/test_tx.c b/ce/test/tx/src/test_tx.c
index 731d148809..2314f818b3 100755
--- a/ce/test/tx/src/test_tx.c
+++ b/ce/test/tx/src/test_tx.c
@@ -46,12 +46,12 @@ main (int argc, char **argv)
u8 RIFS3 = MAC_RIFS_AV_G2_SYM_FL;
u8 RESPT = 0;
u8 MAXTM = TONEMAP_INDEX_NB;
- u8 CP_TMI_AV = 0x04;
+ u8 DEFAULT_TMI = 0x04;
u8 SCL = 0x0;
u8 TM_VALID_NB = 0x1;
- u8 TMI_VALID0 = CP_TMI_AV;
+ u8 TMI_VALID0 = DEFAULT_TMI;
u8 NINT = 0;
- u8 NEW_TMI = CP_TMI_AV;
+ u8 NEW_TMI = DEFAULT_TMI;
u8 CPF = 1;
u8 FEC = 0;
u8 GI = 0;
@@ -66,7 +66,7 @@ main (int argc, char **argv)
bitstream_access (writer, &RIFS3, 8);
bitstream_access (writer, &RESPT, 8);
bitstream_access (writer, &MAXTM, 8);
- bitstream_access (writer, &CP_TMI_AV, 8);
+ bitstream_access (writer, &DEFAULT_TMI, 8);
bitstream_access (writer, &SCL, 8);
bitstream_access (writer, &SCL, 8);
bitstream_access (writer, &TM_VALID_NB, 8);
@@ -104,17 +104,17 @@ main (int argc, char **argv)
test_fail_if (sta->tx_tonemaps->rifs_av_two_sym_tck != MAC_RIFS_AV_TWO_SYM_TCK);
test_fail_if (sta->tx_tonemaps->rifs_av_g2_sym_tck != MAC_RIFS_AV_G2_SYM_TCK);
test_fail_if (sta->tx_tonemaps->max_tm != MAXTM);
- test_fail_if (sta->tx_tonemaps->cp_tmi_av != CP_TMI_AV);
+ test_fail_if (sta->tx_tonemaps->default_tmi != DEFAULT_TMI);
test_fail_if (sta->tx_tonemaps->scl_cp != SCL);
test_fail_if (sta->tx_tonemaps->scl_cfp != SCL);
int nint = tonemap_valid_nb (sta->tx_tonemaps);
test_fail_if (nint != TM_VALID_NB);
u8 *mask = (mac_config.tonemask_info.tonemask);
u8 tmp[PHY_CARRIER_NB];
- u8 *tm_data = sta->tx_tonemaps->tm[CP_TMI_AV-4]->tmdma_desc_head->data;
+ u8 *tm_data = sta->tx_tonemaps->tm[DEFAULT_TMI-4]->tmdma_desc_head->data;
for (i=0; i<PHY_CARRIER_NB; i++)
{
- if (i==1024) tm_data = sta->tx_tonemaps->tm[CP_TMI_AV-4]->tmdma_desc_head->next->data;
+ if (i==1024) tm_data = sta->tx_tonemaps->tm[DEFAULT_TMI-4]->tmdma_desc_head->next->data;
uint n1 = (uint) *tm_data++;
uint n2 = n1>>4;
n1 = n1&0xF;
diff --git a/mac/common/src/tonemap.c b/mac/common/src/tonemap.c
index 3eedb305b3..e016a3e8f4 100644
--- a/mac/common/src/tonemap.c
+++ b/mac/common/src/tonemap.c
@@ -92,19 +92,21 @@ tonemaps_alloc ()
{
int i;
tonemaps_t *tms = (tonemaps_t *) blk_alloc_zero ();
- tms->max_fl_av = MAC_MAX_FL_MAX_FL;
- tms->rifs_av_one_sym_tck = MAC_RIFS_AV_ONE_SYM_TCK;
- tms->rifs_av_two_sym_tck = MAC_RIFS_AV_TWO_SYM_TCK;
- tms->rifs_av_g2_sym_tck = MAC_RIFS_AV_G2_SYM_TCK;
+ tms->max_fl_av = MAC_MAX_FL_MIN_FL;
+ tms->rifs_av_one_sym_tck = MAC_RIFS_DEFAULT_TCK;
+ tms->rifs_av_two_sym_tck = MAC_RIFS_DEFAULT_TCK;
+ tms->rifs_av_g2_sym_tck = MAC_RIFS_DEFAULT_TCK;
tms->max_tm = TONEMAP_INDEX_NB;
- tms->cp_tmi_av = TONEMAP_INDEX_NULL;
+ tms->default_tmi = TONEMAP_INDEX_INITIAL_START;
tms->scl_cp = 0;
tms->scl_cfp = 0;
// todo : expiration_date
tms->expiration_date = 0xFFFFFFFF;
for (i=0; i<TONEMAP_INDEX_NB; i++)
tms->tm[i] = NULL;
+ tms->tm_sound_complete_bitmap = 0;
tms->intervals = tms->swap_intervals;
+ tms->intervals->intervals_nb = 0;
return (tms);
}
diff --git a/mac/common/src/tonemask.c b/mac/common/src/tonemask.c
index 4058d0592a..656f6903cd 100644
--- a/mac/common/src/tonemask.c
+++ b/mac/common/src/tonemask.c
@@ -63,7 +63,6 @@ tonemask_update (tonemask_info_t *ti)
for (m = PHY_MOD_ROBO; m < PHY_MOD_ROBO_NB; m++)
{
tonemap_t *tm = &ti->tonemap_robo[m];
- tm->present = true;
tm->strict = false;
tm->cpf = true;
tm->fecrate = PHY_FEC_RATE_1_2;
diff --git a/mac/common/tonemap.h b/mac/common/tonemap.h
index 95c3920fec..00651c9167 100644
--- a/mac/common/tonemap.h
+++ b/mac/common/tonemap.h
@@ -18,26 +18,41 @@
#include "hal/phy/defs.h"
#include "lib/blk.h"
-#define TONEMAP_INDEX_NB 32
+/** Tonemap indexes (TMI). */
+enum tonemap_index_t
+{
+ /** Number of possible TMI (including, the first four). */
+ TONEMAP_INDEX_NB = 32,
+ /** Invalid index. */
+ TONEMAP_INDEX_NULL = 32,
+ /** Initial state for a tonemap set. */
+ TONEMAP_INDEX_INITIAL_START = 0xfd,
+ /** Error state for a tonemap set. */
+ TONEMAP_INDEX_INITIAL_ERROR = 0xfc,
+ /** SOUND complete state for a tonemap set. */
+ TONEMAP_INDEX_INITIAL_SOUND_COMPLETE = 0xf0,
+ /** Unavailable interval. */
+ TONEMAP_INDEX_INTERVAL_UNAVAILABLE = 0xfe,
+ /** Unusable interval. */
+ TONEMAP_INDEX_INTERVAL_UNUSABLE = 0xff,
+ /** SOUND complete state for an interval. */
+ TONEMAP_INDEX_INTERVAL_SOUND_COMPLETE = 0xf0,
+};
+
+/** Maximum number of tonemap intervals. */
#define TONEMAP_INTERVAL_NB 32
-#define TONEMAP_INDEX_NULL TONEMAP_INDEX_NB
/** Maximum number of bits per symbol with the best possible tonemask and
* modulation. */
#define TONEMAP_BITS_PER_SYMBOL_MAX (10 * PHY_CARRIER_NB)
-
-
-
/** Define a tone map interval. */
struct tonemap_interval_t
{
/** Interval end offset. */
u16 end_offset_atu;
- /** Interval TMI_AV, 0-31. 0xff for unusable, 0xfe for unavailable. */
- u8 tmi_av;
- /** Sound emission completed. */
- bool sound_complete;
+ /** Interval TMI, 0-31, unavailable, unusable or sound complete. */
+ u8 tmi;
};
typedef struct tonemap_interval_t tonemap_interval_t;
@@ -55,9 +70,6 @@ typedef struct tonemap_intervals_t tonemap_intervals_t;
/** Define a tone map. */
struct tonemap_t
{
- /** Present, can be false if a tone map is defined valid, but was not
- * received. */
- bool present;
/** Does interval rules must be strictly enforced for this tone map. Non
* strict can be used if phy rate at the FEC input is less than 15Mbps. */
bool strict;
@@ -74,8 +86,6 @@ struct tonemap_t
blk_t *tmdma_desc_head;
/** Number of bits per data symbol. */
uint bits_per_symbol;
- /** number of carrier bit loading entry if encoded **/
- uint data_length;
/** \todo add member to speed up tone map related computations. */
/**
@@ -101,8 +111,9 @@ struct tonemaps_t
uint rifs_av_g2_sym_tck;
/** Maximum tone maps the receiver can support on this channel. */
uint max_tm;
- /** Default TMI_AV for contention period, 0-31. */
- uint cp_tmi_av;
+ /** Default TMI for contention period, 0-31, start, error or sound
+ * complete. */
+ uint default_tmi;
/** Use default tone map instead of sending sound in CP. */
bool scl_cp;
/** Use default tone map instead of sending sound in CFP. */
@@ -111,15 +122,16 @@ struct tonemaps_t
u32 expiration_date;
/** Defined tone maps or NULL if invalid. */
tonemap_t *tm[TONEMAP_INDEX_NB];
-
- /** Pointer to the valid set of interval used by PBproc.*/
+ /** SOUND complete bitmap for tone maps. If the tone map is not valid, a
+ * one in the bitmap means that sound is complete for this tone map. */
+ u32 tm_sound_complete_bitmap;
+ /** Pointer to the valid set of intervals used by the PBProc. */
tonemap_intervals_t *intervals;
- /** One is the set of intervals used by the pbproc.
- * The other is modifiable by the CE.
- * It can atomically be swapped by CE thanks to previous intervals pointer.
- */
+ /** One is the set of intervals used by the PBProc. The other is
+ * modifiable by the CE.
+ * It can atomically be swapped by the CE thanks to previous intervals
+ * pointer. */
tonemap_intervals_t swap_intervals[2];
-
};
typedef struct tonemaps_t tonemaps_t;
diff --git a/mac/pbproc/inc/fc.h b/mac/pbproc/inc/fc.h
index fb5b99ba65..76f551686b 100644
--- a/mac/pbproc/inc/fc.h
+++ b/mac/pbproc/inc/fc.h
@@ -178,6 +178,29 @@ struct pbproc_fc_sof_t
};
typedef struct pbproc_fc_sof_t pbproc_fc_sof_t;
+/** SACK Type. */
+enum pbproc_fc_sackt_t
+{
+ PBPROC_FC_SACKT_MIXED = 0,
+ PBPROC_FC_SACKT_MIXED_COMPRESSED = 1,
+ PBPROC_FC_SACKT_NOT_RECEIVED = 2,
+ PBPROC_FC_SACKT_UNIFORM = 3,
+};
+
+/** Uniform SACK information. */
+enum pbproc_fc_sacki_uniform_t
+{
+ PBPROC_FC_SACKI_UNIFORM_ALL_ERROR = 0,
+ PBPROC_FC_SACKI_UNIFORM_ALL_OK = 1,
+ PBPROC_FC_SACKI_UNIFORM_NOT_AVAILABLE = 2,
+ PBPROC_FC_SACKI_UNIFORM_TMI_DEFAULT_ROBO = 3,
+ PBPROC_FC_SACKI_UNIFORM_TMI_DEFAULT_RESTART = 4,
+ PBPROC_FC_SACKI_UNIFORM_TMI_RESTART = 5,
+ PBPROC_FC_SACKI_UNIFORM_NEK_ERROR = 6,
+ PBPROC_FC_SACKI_UNIFORM_NB
+};
+
+/** Maximum number of bits in a SACK. */
#define PBPROC_FC_SACK_SACKI_BITS 72
/** Selective Acknowledgment frame control. */
@@ -267,6 +290,17 @@ struct pbproc_fc_rts_cts_t
};
typedef struct pbproc_fc_rts_cts_t pbproc_fc_rts_cts_t;
+/** Sound reason code. */
+enum pbproc_fc_sound_reason_code_t
+{
+ PBPROC_FC_SRC_TMI_MIN = 0x04,
+ PBPROC_FC_SRC_TMI_MAX = 0x1f,
+ PBPROC_FC_SRC_ERROR = 0xfc,
+ PBPROC_FC_SRC_INITIAL = 0xfd,
+ PBPROC_FC_SRC_INTERVAL_UNAVAILABLE = 0xfe,
+ PBPROC_FC_SRC_INTERVAL_UNUSABLE = 0xff,
+};
+
/** Sound frame control. */
struct pbproc_fc_sound_t
{
diff --git a/mac/pbproc/inc/prep_mpdu.h b/mac/pbproc/inc/prep_mpdu.h
index b7978be2c5..723a39eb7e 100644
--- a/mac/pbproc/inc/prep_mpdu.h
+++ b/mac/pbproc/inc/prep_mpdu.h
@@ -79,6 +79,9 @@ struct pbproc_prep_mpdu_t
/** Number of reserved combined MFS segment from MFS still to be
* queued. */
uint combined_seg_nb_reserved;
+ /** Number of pending segments, if no new segment is available, they will
+ * be sent as PB null. */
+ uint seg_nb_pending;
/** First PB. */
pb_t *head;
/** Last PB. */
diff --git a/mac/pbproc/src/fsm_rx_data.c b/mac/pbproc/src/fsm_rx_data.c
index f3badb93d7..0f258870de 100644
--- a/mac/pbproc/src/fsm_rx_data.c
+++ b/mac/pbproc/src/fsm_rx_data.c
@@ -18,6 +18,19 @@
#include "hal/phy/pbdma.h"
+/**
+ * Give up reception and prepare a SACK to signal the problem.
+ * \param ctx pbproc context
+ * \param rx_date start of preamble date
+ * \param sof SOF FC
+ * \param sacki_uniform uniform SACK information
+ *
+ * Go back to IDLE.
+ */
+static void
+pbproc_frda_error_sack (pbproc_t *ctx, u32 rx_date,
+ const pbproc_fc_sof_t *sof, uint sacki_uniform);
+
void
pbproc_frda_init (pbproc_t *ctx)
{
@@ -42,27 +55,54 @@ pbproc_frda__handle (pbproc_t *ctx, u32 rx_date, const pbproc_fc_sof_t *sof)
dbg_assert (sof->eks == 0xf);
dbg_assert (sof->pbsz == false);
dbg_assert (sof->num_sym != 0);
- dbg_assert (sof->tmi_av == PHY_MOD_ROBO);
dbg_assert (sof->burst_cnt == 0);
dbg_assert (sof->bbf == false);
dbg_assert (sof->dcppcf == false);
dbg_assert (sof->mnbf == false);
dbg_assert (sof->rsr == false);
/* Get tonemap. */
- tonemap_t *tm = &ctx->config->tonemask_info.tonemap_robo[PHY_MOD_ROBO];
- uint rifs_tck = MAC_RIFS_DEFAULT_TCK;
+ uint tmi = sof->tmi_av;
+ tonemap_t *tm;
+ uint rifs_tck;
+ if (tmi < PHY_MOD_ROBO_NB)
+ {
+ tm = &ctx->config->tonemask_info.tonemap_robo[tmi];
+ rifs_tck = MAC_RIFS_DEFAULT_TCK;
+ }
+ else if (tmi < TONEMAP_INDEX_NB)
+ {
+ sta_t *sta = mac_store_sta_get (ctx->store, sof->stei);
+ if (sta)
+ {
+ tm = sta->rx_tonemaps->tm[tmi];
+ rifs_tck = MAC_RIFS_DEFAULT_TCK; /* TODO: choose a smaller one. */
+ if (!tm)
+ pbproc_frda_error_sack (ctx, rx_date, sof,
+ PBPROC_FC_SACKI_UNIFORM_TMI_RESTART);
+ blk_release (sta);
+ }
+ else
+ pbproc_frda_error_sack (ctx, rx_date, sof,
+ PBPROC_FC_SACKI_UNIFORM_TMI_RESTART);
+ }
+ else
+ pbproc_frda_error_sack (ctx, rx_date, sof,
+ PBPROC_FC_SACKI_UNIFORM_TMI_RESTART);
uint fl_tck = MAC_FL_TO_TCK (sof->fl_av);
uint symb_nb;
- if (fl_tck - rifs_tck <= MAC_DX567_TCK)
+ if (sof->num_sym == 1)
symb_nb = 1;
- else if (fl_tck - rifs_tck <= 2 * MAC_DX567_TCK)
+ else if (sof->num_sym == 2)
symb_nb = 2;
else
symb_nb = ((fl_tck - rifs_tck - 2 * MAC_DX567_TCK
+ ctx->symbol_tck[tm->gil] - 1) / ctx->symbol_tck[tm->gil]
+ 2);
- uint pb_nb = symb_nb * tm->bits_per_symbol
- / tonemap_bits_per_pb (tm->fecrate, PHY_PB_SIZE_520);
+ uint bits_per_pb = tonemap_bits_per_pb (tm->fecrate, PHY_PB_SIZE_520);
+ /* To take into account that there is only one segment in the last
+ * symbol, here is the trick: */
+ uint pb_nb = ((symb_nb - 1) * tm->bits_per_symbol + bits_per_pb - 1)
+ / bits_per_pb;
/* First thing to do: unblock the hardware. */
phy_rx_prepare (ctx->phy, false, PHY_MOD_ROBO, PHY_FEC_RATE_NONE,
PHY_PB_SIZE_NONE, PHY_GIL_NB, 0, symb_nb);
@@ -120,8 +160,8 @@ pbproc_frda__rx_data_wack__access (pbproc_t *ctx)
void
pbproc_frda__rx_data_wack_last_pb__access (pbproc_t *ctx)
{
- const bool hybrid = ctx->alloc.hybrid;
dbg_assert (ctx);
+ const bool hybrid = ctx->alloc.hybrid;
/* Prepare SACKD. */
bool all_ok = !ctx->pbdma_status.pb_crc_error;
if (!all_ok)
@@ -151,19 +191,19 @@ pbproc_frda__rx_data_wack_last_pb__access (pbproc_t *ctx)
/* Fill SACKD. */
if (all_ok)
{
- fc.sackt0 = 0x3;
- fc.sacki[0] = 0x1;
+ fc.sackt0 = PBPROC_FC_SACKT_UNIFORM;
+ fc.sacki[0] = PBPROC_FC_SACKI_UNIFORM_ALL_OK;
}
else if (ctx->recv_mpdu.sacki_enc.sis < ctx->recv_mpdu.pb_nb)
{
- fc.sackt0 = 0x1;
+ fc.sackt0 = PBPROC_FC_SACKT_MIXED_COMPRESSED;
fc.sacki[0] = ctx->recv_mpdu.sacki_enc.si[0];
fc.sacki[1] = ctx->recv_mpdu.sacki_enc.si[1];
fc.sacki_last = ctx->recv_mpdu.sacki_enc.si[2];
}
else
{
- fc.sackt0 = 0x0;
+ fc.sackt0 = PBPROC_FC_SACKT_MIXED;
const volatile u32 *crc_bmp = phy_pbdma_get_crc_bitmap (ctx->phy);
fc.sacki[0] = crc_bmp[0];
fc.sacki[1] = crc_bmp[1];
@@ -224,3 +264,56 @@ pbproc_frda__rx_burst__access (pbproc_t *ctx)
dbg_assert (0);
}
+static void
+pbproc_frda_error_sack (pbproc_t *ctx, u32 rx_date,
+ const pbproc_fc_sof_t *sof, uint sacki_uniform)
+{
+ dbg_assert (ctx);
+ dbg_assert (sof);
+ dbg_assert (sacki_uniform < PBPROC_FC_SACKI_UNIFORM_NB);
+ /* First thing to do: unblock the hardware. */
+ phy_rx_prepare_short (ctx->phy);
+ /* Prepare SACKD. */
+ const bool hybrid = ctx->alloc.hybrid;
+ /* SACK FC. */
+ pbproc_fc_sack_t fc;
+ fc.dt_av = PBPROC_FC_DT_SACK;
+ fc.access = false;
+ fc.snid = ctx->config->snid;
+ fc.dtei = sof->stei;
+ fc.cfs = sof->cfs;
+ fc.bdf = false;
+ fc.svn = 0;
+ fc.rrtf = 0;
+ fc.mfs_rsp_data = PBPROC_FC_MFS_RSP_ACK;
+ fc.mfs_rsp_mgmt = PBPROC_FC_MFS_RSP_ACK;
+ fc.sackt3 = 0;
+ fc.sackt2 = 0;
+ fc.sackt1 = 0;
+ fc.sackt0 = PBPROC_FC_SACKT_UNIFORM;
+ fc.sacki[0] = sacki_uniform;
+ fc.sacki[1] = 0;
+ fc.sacki_last = 0;
+ /* RX window size. */
+ if (MAC_LID_IS_PLID (ctx->recv_mpdu.rx_params.lid))
+ {
+ fc.sacki_last |= 0 << 4; /* TODO: RX window size. */
+ }
+ /* Send it. */
+ phy_tx_param_short (ctx->phy,
+ PHY_FC_MODE (hybrid, ctx->config->fc_symbols_nb));
+ if (hybrid)
+ phy_tx_fc10 (ctx->phy, 0);
+ uint ack_date = rx_date + ctx->times[hybrid].pre_fcs_tck
+ + MAC_FL_TO_TCK (sof->fl_av);
+ phy_tx_frame (ctx->phy, ack_date, false, false,
+ PARENT_OF (pbproc_fc_t, sack, &fc)->words);
+ /* Wait until completion. */
+ ca_access_vcs_restart (ctx->ca, ack_date,
+ ctx->times[hybrid].pre_fcs_tck + MAC_CIFS_TCK,
+ PBPROC_ANTICIP_TCK, false);
+ phy_rx_activate (ctx->phy, false, ack_date
+ + ctx->times[hybrid].pre_fcs_tck + MAC_CIFS_TCK, true);
+ pbproc_fsm_change_state (ctx, PBPROC_FSM_STATE_IDLE);
+}
+
diff --git a/mac/pbproc/src/fsm_tx_data.c b/mac/pbproc/src/fsm_tx_data.c
index e2ecde70b8..dec497dac9 100644
--- a/mac/pbproc/src/fsm_tx_data.c
+++ b/mac/pbproc/src/fsm_tx_data.c
@@ -124,7 +124,7 @@ pbproc_ftda__tx_wait_access_conf__access_conf (pbproc_t *ctx)
{
/* Without ACK. */
phy_pbdma_update (ctx->phy, ctx->prep_mpdu.main_seg_nb,
- ctx->prep_mpdu.main_seg_nb);
+ ctx->prep_mpdu.pb_nb_total);
pbproc_fsm_change_state (ctx, PBPROC_FSM_STATE_TX_WAIT_TX_END);
}
}
@@ -149,13 +149,13 @@ pbproc_ftda__tx_wait_sackd__rx_fc (pbproc_t *ctx, u32 rx_date,
{
phy_rx_prepare_short (ctx->phy);
/* Handle SACKD. */
- if (fc_av->sack.sackt0 == 0x00)
+ if (fc_av->sack.sackt0 == PBPROC_FC_SACKT_MIXED)
{
pbproc_prep_mpdu_ack_bitmap (
ctx, fc_av->sack.sacki, 0, PBPROC_FC_SACK_SACKI_BITS
- (MAC_LID_IS_PLID (prep->main_mfs->common.lid) ? 4 : 0));
}
- else if (fc_av->sack.sackt0 == 0x01)
+ else if (fc_av->sack.sackt0 == PBPROC_FC_SACKT_MIXED_COMPRESSED)
{
u32 si[3];
si[0] = fc_av->sack.sacki[0];
@@ -165,14 +165,14 @@ pbproc_ftda__tx_wait_sackd__rx_fc (pbproc_t *ctx, u32 rx_date,
ctx, si, PBPROC_FC_SACK_SACKI_BITS
- (MAC_LID_IS_PLID (prep->main_mfs->common.lid) ? 4 : 0));
}
- else if (fc_av->sack.sackt0 == 0x10)
+ else if (fc_av->sack.sackt0 == PBPROC_FC_SACKT_NOT_RECEIVED)
{
pbproc_prep_mpdu_cancel (ctx);
}
else
{
uint sacki = fc_av->sack.sacki[0] & 0xf;
- if (sacki == 0x1)
+ if (sacki == PBPROC_FC_SACKI_UNIFORM_ALL_OK)
pbproc_prep_mpdu_ack_all (ctx);
else
pbproc_prep_mpdu_cancel (ctx);
diff --git a/mac/pbproc/src/prep_mpdu.c b/mac/pbproc/src/prep_mpdu.c
index 395d288e26..146b737c48 100644
--- a/mac/pbproc/src/prep_mpdu.c
+++ b/mac/pbproc/src/prep_mpdu.c
@@ -131,6 +131,7 @@ pbproc_prep_beacon (pbproc_t *ctx)
/* Ok, ready to go! */
prep->main_mfs = mfs;
prep->combined_mfs = NULL;
+ prep->seg_nb_pending = 0;
prep->valid = true;
}
@@ -180,32 +181,61 @@ pbproc_prep_mpdu (pbproc_t *ctx)
prep->tx_date = access->access_date;
access_duration_tck = access->duration_tck;
}
- /* Find tonemap. */
+ /* Prepare tonemap. */
access_data_offset_tck = prep->tx_date - access->beacon_period_start_date
+ times->pre_fcs_tck;
uint tm_data_max_tck;
uint tmi;
+ uint sound_reason_code = 0;
tonemap_t *tm;
uint max_fl_tck;
uint rifs_av_one_sym_tck, rifs_av_two_sym_tck, rifs_av_g2_sym_tck;
- /* TODO: for the moment, only ROBO modes. */
- if (1)
- {
- /* No limit on tonemap validity. */
- tm_data_max_tck = access_duration_tck;
- prep->mod = PHY_MOD_ROBO;
- tmi = PHY_MOD_ROBO;
- tm = &ctx->config->tonemask_info.tonemap_robo[prep->mod];
- max_fl_tck = times->max_fl_tck;
- rifs_av_one_sym_tck = MAC_RIFS_DEFAULT_TCK;
- rifs_av_two_sym_tck = MAC_RIFS_DEFAULT_TCK;
- rifs_av_g2_sym_tck = MAC_RIFS_DEFAULT_TCK;
- }
- else
+ /* Assume non adapted ROBO mode. No limit on tonemap validity. */
+ tm_data_max_tck = access_duration_tck;
+ tmi = PHY_MOD_ROBO;
+ tm = &ctx->config->tonemask_info.tonemap_robo[prep->mod];
+ max_fl_tck = times->max_fl_tck;
+ rifs_av_one_sym_tck = MAC_RIFS_DEFAULT_TCK;
+ rifs_av_two_sym_tck = MAC_RIFS_DEFAULT_TCK;
+ rifs_av_g2_sym_tck = MAC_RIFS_DEFAULT_TCK;
+ /* Find tonemap. */
+ if (MAC_TEI_IS_STA (prep->dtei))
{
- /* TODO. */
- dbg_assert (false);
+ sta_t *sta = mac_store_sta_get (ctx->store, prep->dtei);
+ if (sta)
+ {
+ tonemaps_t *tms = sta->tx_tonemaps;
+ uint default_tmi = tms->default_tmi;
+ if (default_tmi == TONEMAP_INDEX_INITIAL_START)
+ sound_reason_code = PBPROC_FC_SRC_INITIAL;
+ else if (default_tmi == TONEMAP_INDEX_INITIAL_ERROR)
+ sound_reason_code = PBPROC_FC_SRC_ERROR;
+ else if (default_tmi == TONEMAP_INDEX_INITIAL_SOUND_COMPLETE)
+ /* ROBO */;
+ else
+ {
+ tmi = default_tmi;
+ /* TODO: no interval lookup for the moment. */
+ if (tmi >= PHY_MOD_ROBO_NB)
+ {
+ tm = tms->tm[tmi];
+ if (!access->hybrid && access->cfp)
+ max_fl_tck = MAC_FL_TO_TCK (tms->max_fl_av);
+ rifs_av_one_sym_tck = tms->rifs_av_one_sym_tck;
+ rifs_av_two_sym_tck = tms->rifs_av_two_sym_tck;
+ rifs_av_g2_sym_tck = tms->rifs_av_g2_sym_tck;
+ }
+ else
+ {
+ tm = &ctx->config->tonemask_info.tonemap_robo[tmi];
+ }
+ }
+ blk_release (sta);
+ }
}
+ /* TODO: handle SOUND. */
+ /* Prepare parameters. */
+ prep->mod = tmi < PHY_MOD_ROBO_NB ? tmi : PHY_MOD_TM;
prep->fecrate = tm->fecrate;
prep->pb_size = PHY_PB_SIZE_520;
prep->gil = tm->gil;
@@ -216,10 +246,12 @@ pbproc_prep_mpdu (pbproc_t *ctx)
uint bits_per_pb;
/* TODO: implement late segment addition. */
max_seg_nb = mfs->seg_nb;
- /* TODO: do not put more than one segment in the last symbol. Add one
- * symbol if this arise. */
bits_per_pb = tonemap_bits_per_pb (tm->fecrate, PHY_PB_SIZE_520);
- max_symb_nb = (max_seg_nb * bits_per_pb + tm->bits_per_symbol - 1)
+ /* Do not put more than one segment in the last symbol. Add one symbol if
+ * this arise. */
+ uint ba = tm->bits_per_symbol > bits_per_pb
+ ? tm->bits_per_symbol - bits_per_pb : 0;
+ max_symb_nb = (max_seg_nb * bits_per_pb + ba + tm->bits_per_symbol - 1)
/ tm->bits_per_symbol;
/* Can we fit more than two symbols? */
if (max_symb_nb > 2
@@ -258,11 +290,26 @@ pbproc_prep_mpdu (pbproc_t *ctx)
/* Can not fit anything. */
max_symb_nb = 0;
}
- max_seg_nb = max_symb_nb * tm->bits_per_symbol / bits_per_pb;
+ uint old_max_seg_nb = max_seg_nb;
+ /* Do not put more than one segment in the last symbol. Remove one or two
+ * segments if this arise. */
+ if (bits_per_pb >= tm->bits_per_symbol)
+ max_seg_nb = max_symb_nb * tm->bits_per_symbol / bits_per_pb;
+ else
+ max_seg_nb = ((max_symb_nb - 1) * tm->bits_per_symbol
+ + bits_per_pb - 1) / bits_per_pb;
+ /* Add pending segment if not enough segments are available. */
+ if (old_max_seg_nb < max_seg_nb)
+ {
+ prep->seg_nb_pending = max_seg_nb - old_max_seg_nb;
+ max_seg_nb = old_max_seg_nb;
+ }
+ else
+ prep->seg_nb_pending = 0;
/* Compute symbol number. */
uint data_tck, rifs_tck;
- uint symb_nb = (max_seg_nb * bits_per_pb + tm->bits_per_symbol - 1)
- / tm->bits_per_symbol;
+ uint symb_nb = ((max_seg_nb + prep->seg_nb_pending) * bits_per_pb
+ + tm->bits_per_symbol - 1) / tm->bits_per_symbol;
if (symb_nb > 2)
{
data_tck = MAC_PAYLOAD_TCK (symb_nb, ctx->symbol_tck[tm->gil]);
@@ -382,7 +429,7 @@ pbproc_prep_mpdu (pbproc_t *ctx)
/* Prepare PB chain, simple one. */
prep->head = prep->main_head;
prep->tail = prep->main_tail;
- prep->pb_nb_total = max_seg_nb;
+ prep->pb_nb_total = max_seg_nb + prep->seg_nb_pending;
/* No AES for the moment. */
prep->bypass_aes = true;
/* Ok, ready to go! */
@@ -411,7 +458,7 @@ pbproc_prep_mpdu_chain (pbproc_t *ctx)
/* Chain remaining PB. */
pb_t *seg, *head, *tail;
dbg_assert (prep->main_seg_nb + prep->main_seg_nb_reserved
- == prep->pb_nb_total);
+ + prep->seg_nb_pending == prep->pb_nb_total);
/* Get head and tail. */
seg = prep->main_mfs->head;
head = seg;
@@ -455,6 +502,7 @@ pbproc_prep_mpdu_cancel (pbproc_t *ctx)
dbg_invalid_ptr (prep->head);
dbg_invalid_ptr (prep->tail);
prep->pb_nb_total = 0;
+ prep->seg_nb_pending = 0;
/* Change MFS. */
mfs_tx_t *mfs = prep->main_mfs;
if (mfs->head)
@@ -492,13 +540,15 @@ pbproc_prep_mpdu_ack_all (pbproc_t *ctx)
dbg_assert (!prep->combined_mfs);
dbg_assert_ptr (prep->head);
dbg_assert_ptr (prep->tail);
- dbg_assert (prep->pb_nb_total == prep->main_seg_nb);
+ dbg_assert (prep->pb_nb_total == prep->main_seg_nb
+ + prep->seg_nb_pending);
/* Acknowledge everything. */
blk_release_desc_range (&prep->head->blk, &prep->tail->blk);
/* Unset prepared MPDU. */
dbg_invalid_ptr (prep->head);
dbg_invalid_ptr (prep->tail);
prep->pb_nb_total = 0;
+ prep->seg_nb_pending = 0;
dbg_invalid_ptr (prep->main_head);
dbg_invalid_ptr (prep->main_tail);
prep->main_seg_nb = prep->main_seg_nb_reserved = 0;
@@ -527,7 +577,8 @@ pbproc_prep_mpdu_ack_bitmap (pbproc_t *ctx, const u32 *bmp,
dbg_assert (!prep->combined_mfs);
dbg_assert_ptr (prep->head);
dbg_assert_ptr (prep->tail);
- dbg_assert (prep->pb_nb_total == prep->main_seg_nb);
+ dbg_assert (prep->pb_nb_total == prep->main_seg_nb
+ + prep->seg_nb_pending);
/* Read bitmap and collect acknowledged PB. */
uint bmpsw = bmps / 32;
uint bmpsb = bmps % 32;
@@ -588,6 +639,7 @@ pbproc_prep_mpdu_ack_bitmap (pbproc_t *ctx, const u32 *bmp,
dbg_invalid_ptr (prep->head);
dbg_invalid_ptr (prep->tail);
prep->pb_nb_total = 0;
+ prep->seg_nb_pending = 0;
dbg_invalid_ptr (prep->main_head);
dbg_invalid_ptr (prep->main_tail);
prep->main_seg_nb = prep->main_seg_nb_reserved = 0;
@@ -675,13 +727,17 @@ pbproc_prep_mpdu_ack_encoded (pbproc_t *ctx, u32 si[3], uint sil)
dbg_assert (!prep->combined_mfs);
dbg_assert_ptr (prep->head);
dbg_assert_ptr (prep->tail);
- dbg_assert (prep->pb_nb_total == prep->main_seg_nb);
+ dbg_assert (prep->pb_nb_total == prep->main_seg_nb
+ + prep->seg_nb_pending);
/* Uncompress. */
pbproc_prep_mpdu_ack_encoded_t enc =
{
NULL, NULL, 0, NULL, NULL, NULL, 0
};
enc.p = prep->main_head;
+ /* TODO: may cause problem with PB null and burst. There is more PB than
+ * segments and the PB count must be used in order to advance to the right
+ * bit for the next MPDU. */
pbproc_sacki_dec_process (si, sil, prep->main_seg_nb, &enc,
pbproc_prep_mpdu_ack_encoded_nok_cb);
dbg_assert (enc.p_i == prep->main_seg_nb);
@@ -708,6 +764,7 @@ pbproc_prep_mpdu_ack_encoded (pbproc_t *ctx, u32 si[3], uint sil)
dbg_invalid_ptr (prep->head);
dbg_invalid_ptr (prep->tail);
prep->pb_nb_total = 0;
+ prep->seg_nb_pending = 0;
dbg_invalid_ptr (prep->main_head);
dbg_invalid_ptr (prep->main_tail);
prep->main_seg_nb = prep->main_seg_nb_reserved = 0;
diff --git a/mac/pbproc/src/trace.c b/mac/pbproc/src/trace.c
index ed440376be..f2695fd595 100644
--- a/mac/pbproc/src/trace.c
+++ b/mac/pbproc/src/trace.c
@@ -99,7 +99,7 @@ pbproc_trace_format_pbdma_status (char *text, uint text_size, int data)
phy_pbdma_status_t status = PHY_PBDMA_STATUS (data);
if (status.pb_null)
{
- int r = snprintf (t, text_size - s, "N%u", data);
+ int r = snprintf (t, text_size - s, "N%u", status.null_pb_index);
if (r >= (int) (text_size - s))
return -1;
s += r;
diff --git a/mac/pbproc/test/maximus/Makefile b/mac/pbproc/test/maximus/Makefile
index b49fcd802d..2abbf462c8 100644
--- a/mac/pbproc/test/maximus/Makefile
+++ b/mac/pbproc/test/maximus/Makefile
@@ -4,7 +4,7 @@ ECOS = y
TARGET_PROGRAMS = test_pbproc
test_pbproc_SOURCES = test_pbproc.c get_seg.c add_seg.c prepare_beacon.c \
- add_beacon_period.c
+ add_beacon_period.c set_tonemap.c
test_pbproc_MODULES = hal/phy/maximus host lib mac/pbproc mac/ca mac/common
include $(BASE)/common/make/top.mk
diff --git a/mac/pbproc/test/maximus/inc/msg.h b/mac/pbproc/test/maximus/inc/msg.h
index e711ca19f5..bd7ed8958a 100644
--- a/mac/pbproc/test/maximus/inc/msg.h
+++ b/mac/pbproc/test/maximus/inc/msg.h
@@ -18,6 +18,7 @@
#include "inc/prepare_beacon.h"
#include "inc/get_seg.h"
#include "inc/add_beacon_period.h"
+#include "inc/set_tonemap.h"
/** Test PBProc messages identifiers. */
enum test_pbproc_msg_id_t
diff --git a/mac/pbproc/test/maximus/inc/set_tonemap.h b/mac/pbproc/test/maximus/inc/set_tonemap.h
new file mode 100644
index 0000000000..36fadbef99
--- /dev/null
+++ b/mac/pbproc/test/maximus/inc/set_tonemap.h
@@ -0,0 +1,23 @@
+#ifndef inc_set_tonemap_h
+#define inc_set_tonemap_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file inc/set_tonemap.h
+ * \brief Set tonemap fcall.
+ * \ingroup test
+ */
+
+BEGIN_DECLS
+
+void
+test_pbproc_set_tonemap_init (test_pbproc_t *ctx);
+
+END_DECLS
+
+#endif /* inc_set_tonemap_h */
diff --git a/mac/pbproc/test/maximus/py/host_test_pbproc.py b/mac/pbproc/test/maximus/py/host_test_pbproc.py
index 1c6468585d..e0c623042b 100644
--- a/mac/pbproc/test/maximus/py/host_test_pbproc.py
+++ b/mac/pbproc/test/maximus/py/host_test_pbproc.py
@@ -33,7 +33,7 @@ t2.add_beacon_period (start_date = 2 * bp_tck, glid = 0xff, coex = 2)
t1.add_seg (mme = False, lid = 0, tei = 2, seg_nb = 16, gen = 0)
t1.add_seg (mme = True, lid = 0, tei = 2, seg_nb = 16, gen = 0)
t1.add_seg (mme = False, lid = 1, tei = 2, seg_nb = 10, gen = 0)
-t2.rx_seg_refill (seg_nb = 42 + 5)
+t2.rx_seg_refill (seg_nb = 42 + 5 + 5)
t2.activate ()
t1.activate ()
@@ -51,6 +51,9 @@ bp = 0
while not stop:
bp += 1
maximus.wait (bp_tck)
+ if bp == 1:
+ t2.set_tonemap (RX, tei = 1, tmi = 5, bits = 10)
+ t1.set_tonemap (TX, tei = 2, tmi = 5, bits = 10)
t1.prepare_beacon (start_date = (bp + 2) * bp_tck, lid = 0xfd)
t1.add_beacon_period (start_date = (bp + 2) * bp_tck, glid = 0xff,
coex = 2)
diff --git a/mac/pbproc/test/maximus/py/test_pbproc.py b/mac/pbproc/test/maximus/py/test_pbproc.py
index f2daa2ec73..3025494913 100644
--- a/mac/pbproc/test/maximus/py/test_pbproc.py
+++ b/mac/pbproc/test/maximus/py/test_pbproc.py
@@ -1,3 +1,5 @@
+RX = False
+TX = True
class TestPBProc:
"""PBProc test wrapper."""
@@ -51,6 +53,9 @@ class TestPBProc:
def add_beacon_period (self, **args):
self.create_fcall ('add_beacon_period', **args).send (self.sta)
+ def set_tonemap (self, tx, **args):
+ self.create_fcall ('set_tonemap', tx = tx, **args).send (self.sta)
+
def activate (self, activate = True):
self.create_fcall ('activate', activate = activate).send (self.sta)
diff --git a/mac/pbproc/test/maximus/src/set_tonemap.c b/mac/pbproc/test/maximus/src/set_tonemap.c
new file mode 100644
index 0000000000..7e7f0b60f8
--- /dev/null
+++ b/mac/pbproc/test/maximus/src/set_tonemap.c
@@ -0,0 +1,105 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/set_tonemap.c
+ * \brief Set tonemap fcall.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "host/fcall.h"
+#include "mac/common/store.h"
+
+#include "inc/test_pbproc.h"
+#include "inc/set_tonemap.h"
+#include "inc/context.h"
+
+#include <string.h>
+
+static int
+test_pbproc_set_tonemap_fcall (fcall_ctx_t *fcall,
+ fcall_param_t **param, sci_msg_t **msg,
+ void *data);
+
+void
+test_pbproc_set_tonemap_init (test_pbproc_t *ctx)
+{
+ dbg_assert (ctx);
+ fcall_register (my_station.fcall, "set_tonemap",
+ test_pbproc_set_tonemap_fcall, ctx);
+}
+
+static void
+test_pbproc_set_tonemap (test_pbproc_t *ctx, bool tx, uint tei, uint tmi,
+ uint bits)
+{
+ dbg_assert (ctx);
+ dbg_assert (MAC_TEI_IS_STA (tei));
+ dbg_assert (tmi < TONEMAP_INDEX_NB);
+ /* Create/get STA. */
+ mac_store_sta_add (ctx->store, tei);
+ sta_t *sta = mac_store_sta_get (ctx->store, tei);
+ dbg_assert (sta);
+ tonemaps_t *tms = tx ? sta->tx_tonemaps : sta->rx_tonemaps;
+ /* Release any older tonemap. */
+ if (tms->tm[tmi])
+ tonemap_release (tms, tmi);
+ /* Create the new tonemap. */
+ if (tmi >= PHY_MOD_ROBO_NB)
+ {
+ /* Create a tonemap. */
+ tonemap_t *tm = tonemap_alloc ();
+ tms->tm[tmi] = tm;
+ tm->strict = false;
+ tm->cpf = true;
+ tm->fecrate = PHY_FEC_RATE_16_21;
+ tm->gil = PHY_GIL_417;
+ tm->bits_per_symbol = bits * ctx->config.tonemask_info.carrier_nb;
+ tm->ble = tonemap_ble (tm->bits_per_symbol, tm->fecrate,
+ CONST_UF32 (0.0), tm->gil);
+ /* Fill tonemap. */
+ static const u8 tm_data[] = {
+ 0x00, 0x11, 0x22, 0x33, 0x44, 0, 0x55, 0, 0x66, 0, 0x77
+ };
+ dbg_assert (bits < COUNT (tm_data) && tm_data[bits]);
+ memset (tm->tmdma_desc_head->data, tm_data[bits], BLK_SIZE);
+ memset (tm->tmdma_desc_head->next->data, tm_data[bits], BLK_SIZE / 2);
+ }
+ /* Done. */
+ tms->default_tmi = tmi;
+ blk_release (sta);
+}
+
+static int
+test_pbproc_set_tonemap_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_pbproc_t *ctx = (void *) data;
+ dbg_assert (ctx);
+ /* Read message. */
+ bool tx;
+ uint tei, tmi, bits = 0;
+ if (!test_pbproc_fcall_bind ("tx", tx))
+ return -1;
+ if (!test_pbproc_fcall_bind_long ("tei", tei))
+ return -1;
+ if (!test_pbproc_fcall_bind_long ("tmi", tmi))
+ return -1;
+ if (!test_pbproc_fcall_bind_long ("bits", bits) && tmi >= PHY_MOD_ROBO_NB)
+ return -1;
+ /* Add beacon period. */
+ test_pbproc_set_tonemap (ctx, tx, tei, tmi, bits);
+ /* Return. */
+ fcall_param_reset (*param);
+ return 0;
+}
+
diff --git a/mac/pbproc/test/maximus/src/test_pbproc.c b/mac/pbproc/test/maximus/src/test_pbproc.c
index 33a96cdb26..6e8b06bbb1 100644
--- a/mac/pbproc/test/maximus/src/test_pbproc.c
+++ b/mac/pbproc/test/maximus/src/test_pbproc.c
@@ -54,7 +54,19 @@ test_pbproc_rx_cb (void *user, mfs_t *mfs, mfs_t *mfs_mme,
}
else
dbg_assert (pb_first == NULL && pb_last == NULL);
- ctx->rx_pb_nb += pb_nb;
+ uint pb_null = 0, pb_valid = 0;
+ pb_t *pb, *pbl;
+ for (pb = pb_first, pbl = NULL;
+ pbl != pb_last;
+ pbl = pb, pb = pb->next)
+ {
+ if (pb->header.vpbf)
+ pb_valid++;
+ else
+ pb_null++;
+ }
+ dbg_assert (pb_valid + pb_null == pb_nb);
+ ctx->rx_pb_nb += pb_valid;
if (ctx->rx_cb)
ctx->rx_cb (user, mfs, mfs_mme, rx_params, pb_first, pb_last, pb_nb,
chandata_first);
@@ -200,6 +212,7 @@ test_pbproc_init (test_pbproc_t *ctx)
test_pbproc_prepare_beacon_init (ctx);
test_pbproc_get_seg_init (ctx);
test_pbproc_add_beacon_period_init (ctx);
+ test_pbproc_set_tonemap_init (ctx);
fcall_register (my_station.fcall, "activate", test_pbproc_activate_fcall,
ctx);
fcall_register (my_station.fcall, "set_config",
diff --git a/mac/pbproc/test/pbproc/inc/utils.h b/mac/pbproc/test/pbproc/inc/utils.h
index 9969345b6d..4bd80873c8 100644
--- a/mac/pbproc/test/pbproc/inc/utils.h
+++ b/mac/pbproc/test/pbproc/inc/utils.h
@@ -13,6 +13,8 @@
* \ingroup test
*/
#include "mac/common/mfs.h"
+#include "mac/common/tonemap.h"
+#include "inc/test_pbproc.h"
BEGIN_DECLS
@@ -22,6 +24,10 @@ utils_mfs_tx_prepare (bool bcast, bool mme, uint lid, uint tei, uint seg_nb);
void
utils_mfs_tx_cleanup (mfs_tx_t *mfs);
+tonemap_t *
+utils_sta_tx_prepare_default_tonemap (test_pbproc_t *tp, uint tei, uint tmi,
+ uint tm_mod);
+
END_DECLS
#endif /* inc_utils_h */
diff --git a/mac/pbproc/test/pbproc/src/prep_mpdu.c b/mac/pbproc/test/pbproc/src/prep_mpdu.c
index cf034b21d7..74d596c944 100644
--- a/mac/pbproc/test/pbproc/src/prep_mpdu.c
+++ b/mac/pbproc/test/pbproc/src/prep_mpdu.c
@@ -23,11 +23,19 @@
void
prep_mpdu_test (test_t t, test_pbproc_t *tp, u32 date, bool bcast,
uint mfs_seg_nb, uint duration_tck, uint symb_nb,
- uint main_seg_nb_total, u64 crc_error, u64 encoded_sack)
+ uint main_seg_nb_total, uint seg_nb_pending, u64 crc_error,
+ u64 encoded_sack, uint tmi, uint tm_mod)
{
const uint dtei = (bcast ? MAC_TEI_BCAST : 2), lid = 0;
pb_t *seg;
test_within (t);
+ tonemap_t *tm = &tp->config.tonemask_info.tonemap_robo[PHY_MOD_ROBO];
+ /* Prepare tone map. */
+ if (tmi != PHY_MOD_ROBO)
+ tm = utils_sta_tx_prepare_default_tonemap (tp, dtei, tmi, tm_mod);
+ uint dx = tm->gil == PHY_GIL_417 ? MAC_DX417_TCK
+ : (tm->gil == PHY_GIL_567 ? MAC_DX567_TCK
+ : MAC_DX3534_TCK);
/* Create an MFS. */
mfs_tx_t *mfs = utils_mfs_tx_prepare (bcast, false, lid, dtei,
mfs_seg_nb);
@@ -59,6 +67,7 @@ prep_mpdu_test (test_t t, test_pbproc_t *tp, u32 date, bool bcast,
test_fail_unless (prep->combined_mfs == NULL);
test_fail_unless (prep->main_seg_nb == 0);
test_fail_unless (prep->main_seg_nb_reserved == 0);
+ test_fail_unless (prep->seg_nb_pending == 0);
test_fail_unless (prep->pb_nb_total == 0);
}
else
@@ -67,11 +76,11 @@ prep_mpdu_test (test_t t, test_pbproc_t *tp, u32 date, bool bcast,
test_fail_unless (prep->main_mfs == mfs);
test_fail_unless (prep->combined_mfs == NULL);
test_fail_unless (prep->fc_mode == PHY_FC_MODE_AV_1);
- test_fail_unless (prep->mod == PHY_MOD_ROBO);
- test_fail_unless (prep->fecrate == PHY_FEC_RATE_1_2);
+ test_fail_unless (prep->mod == tmi);
+ test_fail_unless (prep->fecrate == tm->fecrate);
test_fail_unless (prep->pb_size == PHY_PB_SIZE_520);
- test_fail_unless (prep->gil == PHY_GIL_417);
- test_fail_unless (prep->tonemap == NULL);
+ test_fail_unless (prep->gil == tm->gil);
+ test_fail_unless (prep->tonemap == tm->tmdma_desc_head);
test_fail_unless (prep->main_head == seg_first);
test_fail_unless (prep->head == seg_first);
uint main_seg_nb = MIN (main_seg_nb_total, 4u);
@@ -83,9 +92,11 @@ prep_mpdu_test (test_t t, test_pbproc_t *tp, u32 date, bool bcast,
test_fail_unless (prep->main_tail == seg);
test_fail_unless (prep->tail == seg);
test_fail_unless (prep->main_seg_nb_reserved == main_seg_nb_reserved);
- test_fail_unless (prep->pb_nb_total == main_seg_nb_total);
+ test_fail_unless (prep->seg_nb_pending == seg_nb_pending);
+ test_fail_unless (prep->pb_nb_total == main_seg_nb_total +
+ seg_nb_pending);
test_fail_unless (prep->flp_tck == MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
- + MAC_PAYLOAD_TCK (symb_nb, MAC_DX417_TCK)
+ + MAC_PAYLOAD_TCK (symb_nb, dx)
+ MAC_RIFS_DEFAULT_TCK);
test_fail_unless (prep->bypass_aes);
/* Check FC. */
@@ -101,13 +112,12 @@ prep_mpdu_test (test_t t, test_pbproc_t *tp, u32 date, bool bcast,
test_fail_unless (fc.eks == 0xf);
test_fail_unless (fc.ppb == pbproc_fc_pbb (mfs_seg_nb
- main_seg_nb_total));
- test_fail_unless (fc.ble == tp->config.tonemask_info
- .tonemap_robo[PHY_MOD_ROBO].ble);
+ test_fail_unless (fc.ble == tm->ble);
test_fail_unless (!fc.pbsz);
test_fail_unless (fc.num_sym == MIN (main_seg_nb_total, 3u));
- test_fail_unless (fc.tmi_av == PHY_MOD_ROBO);
+ test_fail_unless (fc.tmi_av == tmi);
test_fail_unless (fc.fl_av ==
- ((MAC_PAYLOAD_TCK (symb_nb, MAC_DX417_TCK)
+ ((MAC_PAYLOAD_TCK (symb_nb, dx)
+ MAC_RIFS_DEFAULT_TCK)
/ MAC_TCK_PER_FL));
test_fail_unless (fc.mpdu_cnt == 0);
@@ -133,7 +143,9 @@ prep_mpdu_test (test_t t, test_pbproc_t *tp, u32 date, bool bcast,
test_fail_unless (prep->head == seg_first);
test_fail_unless (prep->main_seg_nb == main_seg_nb_total);
test_fail_unless (prep->main_seg_nb_reserved == 0);
- test_fail_unless (prep->pb_nb_total == main_seg_nb_total);
+ test_fail_unless (prep->seg_nb_pending == seg_nb_pending);
+ test_fail_unless (prep->pb_nb_total == main_seg_nb_total +
+ seg_nb_pending);
for (seg = seg_first, i = 1; i < main_seg_nb_total;
seg = seg->next, i++)
;
@@ -187,6 +199,8 @@ prep_mpdu_test (test_t t, test_pbproc_t *tp, u32 date, bool bcast,
}
/* Cleanup. */
utils_mfs_tx_cleanup (mfs);
+ if (tmi != PHY_MOD_ROBO)
+ dbg_check (mac_store_sta_remove (tp->store, dtei));
}
void
@@ -202,7 +216,7 @@ prep_mpdu_basic_test_case (test_t t)
+ MAC_PAYLOAD_TCK (91, MAC_DX417_TCK)
+ MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
+ MAC_FC_AV_TCK,
- 91, 5, (u64) -1ll, 0);
+ 91, 5, 0, (u64) -1ll, 0, PHY_MOD_ROBO, 0);
} test_end;
test_begin (t, "robo unicast data limit seg")
{
@@ -211,7 +225,7 @@ prep_mpdu_basic_test_case (test_t t)
+ MAC_PAYLOAD_TCK (91, MAC_DX417_TCK)
+ MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
+ MAC_FC_AV_TCK,
- 55, 3, (u64) -1ll, 0);
+ 55, 3, 0, (u64) -1ll, 0, PHY_MOD_ROBO, 0);
} test_end;
test_begin (t, "robo unicast data limit dur zero")
{
@@ -220,7 +234,7 @@ prep_mpdu_basic_test_case (test_t t)
+ MAC_PAYLOAD_TCK (16, MAC_DX417_TCK)
+ MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
+ MAC_FC_AV_TCK,
- 0, 0, (u64) -1ll, 0);
+ 0, 0, 0, (u64) -1ll, 0, PHY_MOD_ROBO, 0);
} test_end;
test_begin (t, "robo multicast data limit dur")
{
@@ -229,7 +243,7 @@ prep_mpdu_basic_test_case (test_t t)
+ MAC_PAYLOAD_TCK (91, MAC_DX417_TCK)
+ MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
+ MAC_FC_AV_TCK,
- 91, 5, (u64) -1ll, 0);
+ 91, 5, 0, (u64) -1ll, 0, PHY_MOD_ROBO, 0);
} test_end;
test_begin (t, "acked all")
{
@@ -238,7 +252,7 @@ prep_mpdu_basic_test_case (test_t t)
+ MAC_PAYLOAD_TCK (91, MAC_DX417_TCK)
+ MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
+ MAC_FC_AV_TCK,
- 91, 5, 0, 0);
+ 91, 5, 0, 0, 0, PHY_MOD_ROBO, 0);
} test_end;
test_begin (t, "acked bitmap")
{
@@ -247,7 +261,7 @@ prep_mpdu_basic_test_case (test_t t)
+ MAC_PAYLOAD_TCK (91, MAC_DX417_TCK)
+ MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
+ MAC_FC_AV_TCK,
- 91, 5, 0x15, 0);
+ 91, 5, 0, 0x15, 0, PHY_MOD_ROBO, 0);
} test_end;
test_begin (t, "acked encoded bitmap")
{
@@ -256,7 +270,40 @@ prep_mpdu_basic_test_case (test_t t)
+ MAC_PAYLOAD_TCK (91, MAC_DX417_TCK)
+ MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
+ MAC_FC_AV_TCK,
- 91, 5, 0x15, 0x6f);
+ 91, 5, 0, 0x15, 0x6f, PHY_MOD_ROBO, 0);
+ } test_end;
+ test_begin (t, "tm unicast data limit dur")
+ {
+ prep_mpdu_test (t, &tp, 0, false, 30,
+ MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
+ + MAC_PAYLOAD_TCK (10, MAC_DX417_TCK)
+ + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
+ + MAC_FC_AV_TCK,
+ 10, 10, 0, (u64) -1ll, 0, PHY_MOD_TM, 6);
+ prep_mpdu_test (t, &tp, 0, false, 30,
+ MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
+ + MAC_PAYLOAD_TCK (10, MAC_DX417_TCK)
+ + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
+ + MAC_FC_AV_TCK,
+ 10, 16, 0, (u64) -1ll, 0, PHY_MOD_TM, 10);
+ } test_end;
+ test_begin (t, "tm unicast data limit seg with null")
+ {
+ prep_mpdu_test (t, &tp, 0, false, 13,
+ MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
+ + MAC_PAYLOAD_TCK (9, MAC_DX417_TCK)
+ + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
+ + MAC_FC_AV_TCK,
+ 9, 13, 1, (u64) -1ll, 0, PHY_MOD_TM, 10);
+ } test_end;
+ test_begin (t, "tm unicast data limit dur")
+ {
+ prep_mpdu_test (t, &tp, 0, false, 13,
+ MAC_PREAMBLE_TCK + MAC_FC_AV_TCK
+ + MAC_PAYLOAD_TCK (8, MAC_DX417_TCK)
+ + MAC_RIFS_DEFAULT_TCK + MAC_PREAMBLE_TCK
+ + MAC_FC_AV_TCK,
+ 8, 12, 0, (u64) -1ll, 0, PHY_MOD_TM, 10);
} test_end;
test_pbproc_uninit (&tp);
}
diff --git a/mac/pbproc/test/pbproc/src/utils.c b/mac/pbproc/test/pbproc/src/utils.c
index 7eda178057..f75651c889 100644
--- a/mac/pbproc/test/pbproc/src/utils.c
+++ b/mac/pbproc/test/pbproc/src/utils.c
@@ -61,3 +61,36 @@ utils_mfs_tx_cleanup (mfs_tx_t *mfs)
blk_release (mfs);
}
+tonemap_t *
+utils_sta_tx_prepare_default_tonemap (test_pbproc_t *tp, uint tei, uint tmi,
+ uint tm_mod)
+{
+ dbg_assert (tmi < TONEMAP_INDEX_NB);
+ mac_store_sta_add (tp->store, tei);
+ sta_t *sta = mac_store_sta_get (tp->store, tei);
+ dbg_assert (sta);
+ sta->tx_tonemaps->default_tmi = tmi;
+ tonemap_t *tm = NULL;
+ if (tmi >= PHY_MOD_ROBO_NB)
+ {
+ /* Create a tonemap. */
+ tm = tonemap_alloc ();
+ sta->tx_tonemaps->tm[tmi] = tm;
+ tm->strict = false;
+ tm->cpf = true;
+ tm->fecrate = PHY_FEC_RATE_16_21;
+ tm->gil = PHY_GIL_417;
+ tm->bits_per_symbol = tm_mod * tp->config.tonemask_info.carrier_nb;
+ tm->ble = tonemap_ble (tm->bits_per_symbol, tm->fecrate,
+ CONST_UF32 (0.0), tm->gil);
+ /* Do not fill tonemap, unused. */
+ }
+ else
+ {
+ /* Use a ROBO one. */
+ tm = &tp->config.tonemask_info.tonemap_robo[tmi];
+ }
+ blk_release (sta);
+ return tm;
+}
+