summaryrefslogtreecommitdiff
path: root/cesar/mac/pbproc/src/fsm_handle_fc.c
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/mac/pbproc/src/fsm_handle_fc.c')
-rw-r--r--cesar/mac/pbproc/src/fsm_handle_fc.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/cesar/mac/pbproc/src/fsm_handle_fc.c b/cesar/mac/pbproc/src/fsm_handle_fc.c
index 3db4e5d467..bf149db18f 100644
--- a/cesar/mac/pbproc/src/fsm_handle_fc.c
+++ b/cesar/mac/pbproc/src/fsm_handle_fc.c
@@ -42,6 +42,15 @@ static void
pbproc_fhfc_sof (pbproc_t *ctx, u32 rx_date, const pbproc_fc_t *fc_av);
/**
+ * Handle RSOF FC.
+ * \param ctx pbproc context
+ * \param rx_date start of preamble date
+ * \param fc_av generic FC
+ */
+static void
+pbproc_fhfc_rsof (pbproc_t *ctx, u32 rx_date, const pbproc_fc_t * fc_av);
+
+/**
* Handle RTS/CTS.
* \param ctx pbproc context
* \param rx_date start of preamble date
@@ -128,6 +137,9 @@ pbproc_fhfc_handle_fc (pbproc_t *ctx, u32 rx_date, const pbproc_fc_t *fc_av)
case PBPROC_FC_DT_SOF:
pbproc_fhfc_sof (ctx, rx_date, fc_av);
break;
+ case PBPROC_FC_DT_RSOF:
+ pbproc_fhfc_rsof (ctx, rx_date, fc_av);
+ break;
case PBPROC_FC_DT_SACK:
pbproc_fhfc_ignore (ctx, rx_date, ctx->times.pre_fcs_tck
+ MAC_CIFS_TCK);
@@ -218,6 +230,15 @@ pbproc_fhfc_parse_sof (pbproc_t *ctx, const pbproc_fc_t *fc_av)
return fc_ok;
}
+static bool ARCH_ILRAM
+pbproc_fhfc_parse_rsof (pbproc_t *ctx, const pbproc_fc_t *fc_av)
+{
+ bool fc_ok = false;
+ /* For the moment, this function returns an error everytime because we do
+ * not handle RSOFs. So they will be processed as frames not for us. */
+ return fc_ok;
+}
+
static void ARCH_ILRAM
pbproc_fhfc_sof (pbproc_t *ctx, u32 rx_date, const pbproc_fc_t *fc_av)
{
@@ -245,6 +266,27 @@ pbproc_fhfc_sof (pbproc_t *ctx, u32 rx_date, const pbproc_fc_t *fc_av)
}
}
+static void ARCH_ILRAM
+pbproc_fhfc_rsof (pbproc_t *ctx, u32 rx_date, const pbproc_fc_t *fc_av)
+{
+ if (pbproc_fhfc_parse_rsof (ctx, fc_av))
+ {
+ pbproc_frda__handle (ctx, rx_date);
+ }
+ else
+ {
+ /* Not for us. We have to wait for next frame, as we do not know if
+ * it will be a SACK or a SOF. */
+ ctx->stats.rx_nfu++;
+ phy_rx_prepare_short (ctx->phy);
+ u32 next_date = rx_date + ctx->times.pre_fcs_tck
+ + PBPROC_FC_RSOF_FL_AV_TO_TCK (fc_av->rsof.rsof_fl_av);
+ ca_access_vcs_restart_eifs (ctx->ca, next_date);
+ phy_rx_activate (ctx->phy, false, next_date, true);
+ pbproc_fsm_change_state (ctx, PBPROC_FSM_STATE_IDLE);
+ }
+}
+
static __attribute__ ((noinline)) void
pbproc_fhfc_rts_cts (pbproc_t *ctx, u32 rx_date,
const pbproc_fc_rts_cts_t *fc)