#ifndef cp_beacon_beacons_h #define cp_beacon_beacons_h /* Cesar project {{{ * * Copyright (C) 2008 Spidcom * * <<>> * * }}} */ /** * \file cp/beacon/beacons.h * \brief CP Beacon module * \ingroup cp_beacon * */ #include #include #include "cp/beacon/forward.h" #include "interface/interface.h" #include "mac/ca/ca.h" #include "mac/pbproc/pbproc.h" #include "mac/common/store.h" #include "hal/phy/phy.h" #include "hal/timer/timer.h" #include "cp/station/station.h" #include "cp/secu/secu.h" #include "cp/cco/cco.h" /** Call back used when the timer calls the beacon modules. * This will be use to provide the data to the CP. * The CP shall keep the event to request the beacon to process by calling the * right function. * * \param user_data the data registered in the callback. */ typedef void (*cp_beacon_timer_cb_t) (void *user_data); enum cp_beacon_type { CP_BEACON_CENTRAL_BEACON, CP_BEACON_DISCOVER_BEACON, CP_BEACON_PROXY_BACON }; /** Init the beacons module. * \param ctx the CP context. * * The Beacon module will need the following context to work : * - interface the interface context. * - phy the phy context. * - sta the station context. * - secu the control plane security layer context. * - ca the Channel Access context. * - mac_store mac_store. * - pbproc pbproc. * - cco the cco context. * - cb the function to call back when the module is awake by the * timer. * \return the beacon context. */ cp_beacon_t * cp_beacon_init(cp_t *ctx); /** Initialise the beacon timer function call back. * \param ctx the cp context. * \param user_data a data register to call back. * \param cb the function to call. */ void cp_beacon_init_timer_callback (cp_t *ctx, void *user_data, cp_beacon_timer_cb_t cb); /** Uninit the beacon module * \param ctx the cp context. */ void cp_beacon_uninit(cp_t *ctx); /** Compute the AC line frequency from the PRATIC register. * \param ctx cp context. */ void cp_beacon_acl_frequency_detection (cp_t *ctx); /** Send a beacon when the STA is acting as a CCo. * \param ctx the cp context. * \param beacon_type beacon type. */ void cp_beacon_cco_send_beacon (cp_t *ctx, uint beacon_type); /** Generate the central beacon when the STA acts as a CCo. * \param ctx the cp context. */ extern inline void cp_beacon_cco_send_central_beacon (cp_t *ctx) { dbg_assert (ctx); cp_beacon_cco_send_beacon (ctx, CP_BEACON_CENTRAL_BEACON); } /** Generate the discover beacon when the STA acts as a UCCo. * \param ctx the beacon context. */ extern inline void cp_beacon_cco_send_discover_beacon (cp_t *ctx) { dbg_assert (ctx); cp_beacon_cco_send_beacon (ctx, CP_BEACON_DISCOVER_BEACON); } #endif /* cp_beacon_beacons_h */