#ifndef bsu_bsu_h #define bsu_bsu_h /* Cesar project {{{ * * Copyright (C) 2010 Spidcom * * <<>> * * }}} */ /** * \file bsu/bsu.h * \brief Beacon Scheduler Updater * \ingroup bsu * * BSU is responsible for computing the Channel Access schedules and send * beacons. */ #include "bsu/aclf/aclf.h" #include "mac/pbproc/pbproc.h" #include "mac/sar/sar.h" #include "hal/timer/timer.h" #include "bsu/beacon/beacon.h" #include "bsu/beacon/defs.h" /** Forward declaration. */ typedef struct bsu_t bsu_t; typedef struct bsu_avln_t bsu_avln_t; typedef struct bsu_avln_ntb_t bsu_avln_ntb_t; enum bsu_update_sta_type_t { BSU_UPDATE_STA_TYPE_STA, BSU_UPDATE_STA_TYPE_CCO, BSU_UPDATE_STA_TYPE_NB }; typedef enum bsu_update_sta_type_t bsu_update_sta_type_t; /** Function to call on beacon reception or beacon sending. * \param ctx upper layer context. * \param beacon the beacon sent or received. * \warn the upper layer is responsible for releasing the reference on the * beacon. */ typedef void (*bsu_beacon_processed_t) (void *ctx, bsu_beacon_t *beacon); BEGIN_DECLS /** * Initialise the module. * \param aclf the ACLF module context. * \param mac_config the mac config structure pointer. * \param phy the PHY context. * \param mac_store the mac store database. * \param ca the channel access context. * \param sar the SAR context. * \param timer hal timer to awake the module. * \param pbproc the pbprocessing context. * \return the context. */ bsu_t * bsu_init (bsu_aclf_t *aclf, mac_config_t *mac_config, phy_t *phy, mac_store_t *mac_store, ca_t *ca, sar_t *sar, hal_timer_t *timer, pbproc_t *pbproc); /** * Initialise the beacon callback to send to upper layer. * \param cb the function to call. * \param ul the upper layer user data. */ void bsu_init_beacon_cb (bsu_beacon_processed_t cb, void *cb_ud); /** * Uninitialise the module. * \param the ctx module. */ void bsu_uninit (bsu_t *ctx); /** * Update the data beacon for the bsu. * \param beacon the beacon data to send a central beacon. * \param sta true if the station acts as a STA. */ void bsu_update (bsu_beacon_t *beacon, bsu_update_sta_type_t sta); /** * Update the tracking AVLN's identification. * \param nid the NID to track. * \param snid the SNID to track. * \param tei the TEI to track. * \param mac the CCo's mac address if present, MAC_ZERO otherwise. */ void bsu_track_avln (u64 nid, u16 snid, u8 tei, mac_t mac); /** * Un-track an AVLN. */ void bsu_untrack_avln (void); /** * BSU power function * \param snid the snid to be used in schedules during the power one * procedure. * To be called after the first bsu_update and before bsu_activate. */ void bsu_power_on (u8 snid); /** * Activates the BSU. * \param status true to activate, false otherwise. */ void bsu_activate (bool status); /** * Get the current NEK index. * \return the current NEK index. */ uint bsu_nek_index_current (void); /** * Get the next NEK index. * \return the current NEK index. */ uint bsu_nek_index_next (void); /** * Update discover info beacon entry. * \param discover the discover info beacon entry. */ void bsu_update_discover_info (bsu_beacon_bmi_discover_info_t *discover); /** * Update nid. * \param nid the nid. */ void bsu_update_nid (u64 nid); /** * Remove an AVLN. * \param nid the NID of the AVLN. * \param snid the SNID of the AVLN. * \param mac the CCo's mac address. * * The AVLNs are static object do not release it. */ void bsu_avln_remove (u64 nid, u8 snid, mac_t mac); END_DECLS #endif /* bsu_bsu_h */