summaryrefslogtreecommitdiff
path: root/mac/ca/ca.h
diff options
context:
space:
mode:
authorschodet2007-05-21 09:23:38 +0000
committerschodet2007-05-21 09:23:38 +0000
commit7a63baa4741ffcf3884e9c271d776545709d3997 (patch)
tree08827dfcd63401820e295cf5cc183445575fcde9 /mac/ca/ca.h
parent5707e185d8280613064ef4d711d4edc07d21fd78 (diff)
Major ca update.
Added allocation functions. Added access functions drafts. Added general ca functions. Moved test_backoff to test_ca. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@139 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'mac/ca/ca.h')
-rw-r--r--mac/ca/ca.h72
1 files changed, 52 insertions, 20 deletions
diff --git a/mac/ca/ca.h b/mac/ca/ca.h
index 77338f304d..37e216beab 100644
--- a/mac/ca/ca.h
+++ b/mac/ca/ca.h
@@ -13,6 +13,9 @@
* \ingroup mac_ca
*/
#include "mac/common/mfs.h"
+#include "hal/phy/forward.h"
+#include "mac/common/config.h"
+#include "mac/common/store.h"
/* Forward declaration. */
typedef struct ca_t ca_t;
@@ -25,8 +28,11 @@ typedef struct ca_t ca_t;
* - the schedule for the future beacon period using the current persistent
* schedule for which we have no non-persistent schedule;
* - the persistent preview schedule, also without non-persistent schedule.
+ *
+ * Moreover, to update the schedules without altering the used ones, the upper
+ * layer may need four other schedules.
*/
-#define CA_SCHEDULE_NB 4
+#define CA_SCHEDULE_NB 8
/** Schedule maximum size.
* One transmitted schedule can have a maximum of 64 allocation entries, but
@@ -42,7 +48,8 @@ typedef struct ca_t ca_t;
/** Beacon period circular buffer size.
* Current schedule can be valid for 8 beacon periods. Preview schedule can
- * be valid after 7 period. */
+ * be valid after 7 period. An additional slot is required for the circular
+ * buffer function. */
#define CA_BEACON_PERIOD_NB 16
/** Beacon period entry. */
@@ -59,7 +66,7 @@ typedef struct ca_beacon_period_t ca_beacon_period_t;
struct ca_allocation_t
{
/** Allocation end date as an offset from the beacon period start. */
- u32 end_date:24;
+ u32 end_offset_tck:24;
/** GLID of this allocation.
* - 0xff: local CSMA allocation,
* - 0xfe: shared CSMA allocation,
@@ -74,7 +81,8 @@ typedef struct ca_allocation_t ca_allocation_t;
/** Channel Access schedule.
* It should contains allocations from the persistent schedule, the
- * non-persistent schedule and also entries for holes. */
+ * non-persistent schedule and also entries for holes. Consecutive shared
+ * CSMA allocations should be merged in one allocation by the upper layer. */
struct ca_schedule_t
{
/** Number of used allocations in this schedule. */
@@ -89,11 +97,16 @@ typedef struct ca_schedule_t ca_schedule_t;
struct ca_access_param_t
{
/** Scheduled MFS. */
- mfs_t *mfs;
+ mfs_tx_t *mfs;
+ /** Programmed ACCESS date. Does not include anticipation, but does
+ * include backoff. */
+ u32 access_date;
/** Available time. */
uint duration_tck;
- /** Did we play the contention game. */
- bool did_content;
+ /** Does it occurs during a contention free period? */
+ bool cfp:1;
+ /** Should it content for ACCESS? */
+ bool content:1;
};
typedef struct ca_access_param_t ca_access_param_t;
@@ -101,10 +114,11 @@ BEGIN_DECLS
/**
* Initialise ca and return its context.
+ * \param phy phy context
* \return ca context
*/
ca_t *
-ca_init (void);
+ca_init (phy_t *phy, mac_config_t *config, mac_store_t *store);
/**
* Uninitialise a ca context.
@@ -116,7 +130,7 @@ ca_uninit (ca_t *ctx);
/**
* Restart VCS.
* \param ctx ca context
- * \param date start date
+ * \param start_date VCS start date
* \param length_tck VCS length
* \param anticipation_tck ACCESS event anticipation
* \param eifs true if this is an EIFS
@@ -131,8 +145,8 @@ ca_uninit (ca_t *ctx);
* allocation.
*/
void
-ca_vcs_restart (ca_t *ctx, u32 date, uint length_tck, uint anticipation_tck,
- bool eifs);
+ca_access_vcs_restart (ca_t *ctx, u32 start_date, uint length_tck,
+ uint anticipation_tck, bool eifs);
/**
* Program hardware ACCESS timer.
@@ -144,13 +158,13 @@ ca_vcs_restart (ca_t *ctx, u32 date, uint length_tck, uint anticipation_tck,
* responses or bursts where we know we have the medium access.
*/
void
-ca_vcs_access (ca_t *ctx, u32 date, uint anticipation_tck);
+ca_access_program (ca_t *ctx, u32 date, uint anticipation_tck);
/**
* Update next ACCESS information for the given grant.
* \param ctx ca context
- * \param duration_tck grant duration
* \param mfs granted MFS or NULL for any MFS
+ * \param duration_tck grant duration
*
* Grants are given by CCo with RTS/CTS with immediate grant flag set, or by
* bidirectional bursts.
@@ -159,7 +173,7 @@ ca_vcs_access (ca_t *ctx, u32 date, uint anticipation_tck);
* information delivered when an ACCESS event occurs.
*/
void
-ca_grant (ca_t *ctx, uint duration_tck, mfs_t *mfs);
+ca_access_grant (ca_t *ctx, mfs_tx_t *mfs, uint duration_tck);
/**
* Get ACCESS parameters.
@@ -169,7 +183,7 @@ ca_grant (ca_t *ctx, uint duration_tck, mfs_t *mfs);
* This structure is valid just after the ACCESS event.
*/
const ca_access_param_t *
-ca_get_access_param (ca_t *ctx);
+ca_access_get_param (ca_t *ctx);
/**
* Update backoff after a deferral.
@@ -200,6 +214,24 @@ void
ca_backoff_success (ca_t *ctx);
/**
+ * Initialise Channel Access related parameters in an MFS TX.
+ * \param mfs the newly created MFS
+ *
+ * The MFS is not registered in the Channel Access queues.
+ */
+void
+ca_mfs_init (ca_t *ctx, mfs_tx_t *mfs);
+
+/**
+ * Uninitialise Channel Access related parameters in an MFS TX prior to
+ * deletion.
+ * \param ctx ca context
+ * \param mfs the MFS to be deleted
+ */
+void
+ca_mfs_uninit (ca_t *ctx, mfs_tx_t *mfs);
+
+/**
* Update Channel Access after a MFS update.
* \param ctx ca context
* \param mfs the updated MFS
@@ -209,7 +241,7 @@ ca_backoff_success (ca_t *ctx);
* chosen for the next transmission.
*/
void
-ca_mfs_update (ca_t *ctx, mfs_t *mfs);
+ca_mfs_update (ca_t *ctx, mfs_tx_t *mfs);
/**
* Retrieve a pointer to a schedule table entry.
@@ -220,7 +252,7 @@ ca_mfs_update (ca_t *ctx, mfs_t *mfs);
* This should only be done if the schedule is not currently used.
*/
ca_schedule_t *
-ca_schedule_get (ca_t *ctx, uint index);
+ca_alloc_get_schedule (ca_t *ctx, uint index);
/**
* Update the beacon periods.
@@ -233,9 +265,9 @@ ca_schedule_get (ca_t *ctx, uint index);
* could trigger an extra computation of the next access.
*/
void
-ca_beacon_periods_update (ca_t *ctx,
- ca_beacon_period_t *beacon_periods,
- uint beacon_periods_nb);
+ca_alloc_update_beacon_periods (ca_t *ctx,
+ ca_beacon_period_t *beacon_periods,
+ uint beacon_periods_nb);
END_DECLS