# /space/home/slher/rel/Beken/v6_4_5/macsw/ip/lmac/src/chan/chan.h File Reference

MAC Channel Management module declarations. More...

`#include "co_int.h"`
`#include "co_bool.h"`
`#include "co_utils.h"`
`#include "mm_task.h"`
`#include "mm_timer.h"`

Go to the source code of this file.

## Data Structures
struct | chan_tbtt_tag
| Structure containing TBTT switch information. More...
struct | chan_switch_tag
| Structure containing scheduled channel switch information. More...
struct | chan_ctxt_tag
| Structure describing a channel context. More...
struct | chan_env_tag
| LMAC MAC Management Context. More...
## Defines
#define | CHAN_TRAF_CTXT_CNT (NX_CHAN_CTXT_CNT)
| Number of channel contexts for traffic.
#define | CHAN_CHAN_CTXT_CNT (CHAN_TRAF_CTXT_CNT + 1 + 1)
| Number of channel context (+1 for Scan and +1 for the Remain on Channel).
#define | CHAN_SCAN_CTXT_IDX (CHAN_TRAF_CTXT_CNT)
| Index of the Scan Channel Context.
#define | CHAN_ROC_CTXT_IDX (CHAN_SCAN_CTXT_IDX + 1)
| Index of the Remain on Channel Context.
#define | CHAN_CTXT_UNUSED (0xFF)
| Index of a Channel Context that is not linked with a VIF.
#define | CHAN_SWITCH_DELAY (4000 + phy_get_channel_switch_dur())
| Delay between the start of a channel switch procedure and the time the new channel should be active (in us).
## Enumerations
enum | chan_ctxt_status { CHAN_NOT_SCHEDULED = 0, CHAN_NOT_PROG, CHAN_GOTO_IDLE, CHAN_WAIT_NOA_CFM, CHAN_WAITING_END, CHAN_PRESENT, CHAN_SENDING_NOA }
| Channel Context State Machine. More...
enum | chan_tbtt_status { CHAN_TBTT_PROG = CO_BIT(0), CHAN_TBTT_WAIT_TO = CO_BIT(1), CHAN_TBTT_SKIPPED = CO_BIT(2), CHAN_TBTT_ALREADY_ADDED = CO_BIT(3), CHAN_TBTT_SCHEDULE_P2P_NOA = CO_BIT(4), CHAN_TBTT_P2P_NOA_TSF_UPDATE = CO_BIT(5), CHAN_TBTT_P2P_NOA_RESYNC = CO_BIT(6) }
| TBTT Switch State Machine. More...
enum | chan_env_status_bit { CHAN_ENV_ROC_WAIT_BIT = 0, CHAN_ENV_SCAN_WAIT_BIT, CHAN_ENV_ROC_BIT, CHAN_ENV_SCAN_BIT, CHAN_ENV_DELAY_PROG_BIT, CHAN_ENV_BCN_DETECT_BIT, CHAN_ENV_FIX_CTXT_PENDING_BIT }
| Channel Environment status bits (see chan_env.status). More...
## Functions
void | chan_init (void)
| MM Channel Module initialization function.
void | chan_scan_req (uint8_t band, uint16_t freq, int8_t pwr, uint32_t duration_us, uint8_t flags, uint8_t vif_index)
| Request to go to a specific channel for scanning.
uint8_t | chan_roc_req (struct mm_remain_on_channel_req const *req, ke_task_id_t taskid)
| Request to go to a specific channel for a given duration.
uint8_t | chan_ctxt_add (struct mac_chan_op const *chan_req, uint8_t *idx)
| Request to allocate a new channel context.
void | chan_ctxt_del (uint8_t idx)
| Free a previously allocated channel context.
void | chan_ctxt_link (uint8_t vif_idx, uint8_t chan_idx)
| Link a channel context to a VIF.
void | chan_ctxt_unlink (uint8_t vif_idx)
| Unlink the channel context from a VIF.
void | chan_ctxt_update (struct mm_chan_ctxt_update_req const *update)
| Request to update the parameters of a channel context.
void | chan_ctxt_sched (struct mm_chan_ctxt_sched_req const *sched_req, ke_task_id_t taskid)
| Request to schedule the switch to a channel context.
void | chan_ctxt_link_monitor (uint8_t chan_idx)
| Link a channel context to the monitor interface.
int | chan_tbtt_start (struct vif_info_tag *vif, uint32_t tbtt_time, uint32_t next_tbtt_time)
| Indicates that TBTT starts and provides date of the next TBTT.
void | chan_bcn_to_evt (struct vif_info_tag *vif)
| Indicates end of the TBTT window.
void | chan_tbtt_updated (struct vif_info_tag *vif)
| Called when TBTT timer has been updated after beacon reception.
void | chan_bcn_detect_start (struct vif_info_tag *vif)
| Start a Remain on Channel procedure (duration is the beacon interval) in order to catch the beacon sent by a peer AP device.
void | chan_p2p_absence_update (struct chan_ctxt_tag *ctxt, bool absence)
| Function used by the P2P module to notify the chan module about an update of presence status of a GO device.
bool | chan_is_on_channel (struct vif_info_tag *vif)
| Check if the VIF passed as parameter has currently access to the channel.
bool | chan_is_on_operational_channel (struct vif_info_tag *vif)
| Check if the VIF passed as parameter is currently on its operational channel.
bool | chan_is_tx_allowed (struct vif_info_tag *vif)
| Check if transmission is allowed on a vif's channel.
void | chan_update_tx_power (struct chan_ctxt_tag *ctxt)
| Update TX power for a channel context.
## Variables
struct chan_env_tag | chan_env
| MM Channel module context variable.

## Detailed Description

MAC Channel Management module declarations.

Copyright (C) RivieraWaves 2011-2019

Definition in file chan.h.