summaryrefslogtreecommitdiff
path: root/mac/ca/ca.h
diff options
context:
space:
mode:
authorschodet2007-03-23 17:18:53 +0000
committerschodet2007-03-23 17:18:53 +0000
commita2c17d2b7b09a1401eb9bdd7d41ebade6e69cb31 (patch)
tree8d41a49fc1a991bcdee72c528ac8e18bd73551dd /mac/ca/ca.h
parent66aca88d7494c2e3c0453339dd324a3139b0e47f (diff)
Added ca.
Added backoff unit test (but no backoff yet). Added common. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@19 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'mac/ca/ca.h')
-rw-r--r--mac/ca/ca.h115
1 files changed, 115 insertions, 0 deletions
diff --git a/mac/ca/ca.h b/mac/ca/ca.h
new file mode 100644
index 0000000000..f28f4d8c06
--- /dev/null
+++ b/mac/ca/ca.h
@@ -0,0 +1,115 @@
+#ifndef mac_ca_ca_h
+#define mac_ca_ca_h
+/* Maria project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file mac/ca/ca.h
+ * \brief Channel Access public interface.
+ * \ingroup mac_ca
+ */
+#include "mac/common/mfs.h"
+
+/* Forward declarations. */
+typedef struct ca_t ca_t;
+
+/** Channel Access schedule entry. */
+struct ca_schedule_t
+{
+ /** Allocation end date. */
+ u32 end_date_tck;
+ /** GLID of this allocation. */
+ u8 glid;
+};
+typedef struct ca_schedule_t ca_schedule_t;
+
+/**
+ * Restart VCS.
+ * \param ctx ca context
+ * \param date current date
+ * \param length_fl VCS length
+ * \param anticipation_tck ACCESS event anticipation
+ *
+ * Restart the Virtual Carrier Sense timer for a given length. The ca layer
+ * will use its schedule to find the next transmit opportunity after the VCS
+ * expiration. The hardware will programmed with an anticipation in order to
+ * take extra computation depending on the current state into account.
+ */
+void
+ca_vcs_restart (ca_t *ctx, u32 date, uint length_fl, uint anticipation_tck);
+
+/**
+ * Program hardware ACCESS timer.
+ * \param ctx ca context
+ * \param date current date
+ * \param length_fl timer length
+ * \param anticipation_tck ACCESS event anticipation
+ *
+ * Program the hardware ACCESS timer, ignoring VCS. This can be used for
+ * responses or bursts where we know we have the medium access.
+ */
+void
+ca_vcs_access (ca_t *ctx, u32 date, uint length_fl, uint anticipation_tck);
+
+/**
+ * Update Channel Access after a MFS update.
+ * \param ctx ca context
+ * \param date current date
+ * \param mfs the updated MFS
+ *
+ * When a MFS is updated, this can change its priority. The Channel Access
+ * layer must update its priority queue and may change the MFS which was
+ * chosen for the next transmission.
+ */
+void
+ca_mfs_update (ca_t *ctx, u32 date, mfs_t *mfs);
+
+/**
+ * Update the Channel Access schedule.
+ * \param ctx ca context
+ * \param date current date
+ * \param schedule schedule elements table
+ * \param schedule_length number of schedule elements
+ *
+ * This is called after the beacon reception, or after expected beacon
+ * reception by an upper layer at least before end of CSMA region (first CSMA
+ * region is at least 1.5ms). The schedule is stored as a circular buffer and
+ * searched using dichotomy using absolute date in ticks.
+ */
+void
+ca_schedule_update (ca_t *ctx, u32 date,
+ ca_schedule_t *schedule, uint schedule_length);
+
+/**
+ * Update backoff after a deferral.
+ * \param ctx ca context
+ * \param slot_counter hardware slot counter value at the time of deferral
+ *
+ * If a FC is received after an ACCESS in CSMA, we did not get the medium.
+ * This is a backoff deferral. If we lost the PRP, this is not counted as a
+ * backoff deferral because backoff procedure is not entered.
+ *
+ * If a collision is inferred (no acknowledgement), this is also a backoff
+ * deferral.
+ *
+ * This function can be called in advance after an ACCESS event and cancelled
+ * with a ca_backoff_success later.
+ */
+void
+ca_backoff_deferred (ca_t *ctx, uint slot_counter);
+
+/**
+ * Update backoff after a success.
+ * \param ctx ca context
+ *
+ * Will reset the backoff procedure for the next transmission. This is called
+ * when the MPDU has been sent and no collision is inferred.
+ */
+void
+ca_backoff_success (ca_t *ctx);
+
+#endif /* mac_ca_ca_h */