summaryrefslogtreecommitdiff
path: root/cesar/tools/sniffer_phy
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/tools/sniffer_phy')
-rw-r--r--cesar/tools/sniffer_phy/src/lowlevel.c50
1 files changed, 43 insertions, 7 deletions
diff --git a/cesar/tools/sniffer_phy/src/lowlevel.c b/cesar/tools/sniffer_phy/src/lowlevel.c
index 73a576cf1f..1b79f412f0 100644
--- a/cesar/tools/sniffer_phy/src/lowlevel.c
+++ b/cesar/tools/sniffer_phy/src/lowlevel.c
@@ -20,6 +20,8 @@
#include "hal/arch/arch.h"
#include "lib/slist.h"
#include "mac/pbproc/inc/fc.h"
+#include "mac/common/timings.h"
+#include "mac/common/defs.h"
#include "inc/context.h"
@@ -41,13 +43,12 @@ static void ARCH_ILRAM
lowlevel_fc_analyse (sniffer_phy_t *ctx, const u32 *fc_av,
lowlevel_mpdu_t *mpdu)
{
+ static const uint symbol_tck[] ARCH_DLRAM_DATA = {
+ MAC_DX417_TCK, MAC_DX567_TCK, MAC_DX3534_TCK };
pbproc_fc_t *fc = (pbproc_fc_t *) fc_av;
- if (!fc_av
- || ctx->lowlevel.pool_size <= 1)
- {
- mpdu->pb_nb = 0;
- }
- else
+ mpdu->pb_nb = 0;
+ /* CRC OK and enough pool? */
+ if (fc_av && ctx->lowlevel.pool_size > 1)
{
/* Decode FC. */
switch (fc->generic.dt_av)
@@ -58,8 +59,43 @@ lowlevel_fc_analyse (sniffer_phy_t *ctx, const u32 *fc_av,
mpdu->tm =
&ctx->lowlevel.tonemask_info->tonemap_robo[PHY_MOD_MINI_ROBO];
break;
+ case PBPROC_FC_DT_SOF:
+ /* Only decode SOF with unencrypted ROBO payload. */
+ if (fc->sof.eks != MAC_EKS_CLEAR
+ || fc->sof.num_sym == 0
+ || fc->sof.tmi_av >= PHY_MOD_ROBO_NB)
+ break;
+ mpdu->pb_size = fc->sof.pbsz ? PHY_PB_SIZE_136 : PHY_PB_SIZE_520;
+ mpdu->tm =
+ &ctx->lowlevel.tonemask_info->tonemap_robo[fc->sof.tmi_av];
+ /* Only one PB136 allowed per frame. */
+ if (mpdu->pb_size == PHY_PB_SIZE_136)
+ {
+ mpdu->pb_nb = 1;
+ }
+ else
+ {
+ /* Compute number of symbols. */
+ uint fl_tck = MAC_FL_TO_TCK (fc->sof.fl_av);
+ uint rifs_tck = MAC_RIFS_DEFAULT_TCK;
+ if (fc->sof.mpdu_cnt)
+ rifs_tck = MAC_BIFS_TCK;
+ uint symb_nb;
+ if (fc->sof.num_sym == 1)
+ symb_nb = 1;
+ else if (fc->sof.num_sym == 2)
+ symb_nb = 2;
+ else
+ symb_nb = ((fl_tck - rifs_tck - 2 * MAC_DX567_TCK)
+ / symbol_tck[mpdu->tm->gil] + 2);
+ /* Compute number of PB. */
+ uint bits_per_pb = mpdu->tm->bits_per_pb[PHY_PB_SIZE_520];
+ mpdu->pb_nb = ((symb_nb - 1) * mpdu->tm->bits_per_symbol
+ + bits_per_pb) / bits_per_pb;
+ }
+ break;
default:
- mpdu->pb_nb = 0;
+ break;
}
/* Adjust PB and symbol number. */
mpdu->pb_nb = MIN (mpdu->pb_nb, ctx->lowlevel.pool_size - 1);