#ifndef hal_phy_access_h #define hal_phy_access_h /* Cesar project {{{ * * Copyright (C) 2007 Spidcom * * <<>> * * }}} */ /** * \file hal/phy/access.h * \brief HAL Phy ACCESS public interface. * \ingroup hal_phy * * The ACCESS hardware handle backoff procedure and ACCESS it timer. */ #include "hal/phy/forward.h" /** * ACCESS event callback. * \param user user data * \return true if a DSR is requested */ typedef bool (*phy_access_cb_t) (void *user); BEGIN_DECLS /** * Start the backoff procedure. * \param ctx phy context * \param date PRP start date * \param cap channel access priority * * Reset the backoff procedure hardware to start a new backoff procedure at * the given date with the given priority. */ void phy_access_backoff_start (phy_t *ctx, u32 date, uint cap); /** * Change the cap to a new one. * \param ctx phy context * \param cap the new channel access priority * * Update the hardware priority. */ void phy_access_backoff_update (phy_t *ctx, uint cap); /** * Return the number of slot counted. * \param ctx phy context * \return slot_count */ uint phy_access_backoff_slot_count (phy_t *ctx); /** * Return true if the PRP is won. * \param ctx phy context * \return true if CAP_sent == CAP_medium && CAP_mpdu >= CAP_medium */ bool phy_access_backoff_prp_won (phy_t *ctx); /** * Program the access timer to the given date. * \param ctx phy context * \param date timer expiration date * * ACCESS interrupt is disabled on preamble reception but not on PRP loss. */ void phy_access_timer_program (phy_t *ctx, u32 date); /** * Update the access timer date without restarting it if it was canceled. * \param ctx phy context * \param date timer expiration date * * This is useful if the access timer was canceled by hardware. */ void phy_access_timer_update (phy_t *ctx, u32 date); /** * Cancel the access timer. * \param ctx phy context */ void phy_access_timer_cancel (phy_t *ctx); END_DECLS #endif /* hal_phy_access_h */