#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include "pal.h"
#include "return_val.h"
#include "tal.h"
#include "ieee_const.h"
#include "tal_constants.h"
#include "tal_slotted_csma.h"
#include "tal_pib.h"
#include "at86rf231.h"
#include "tal_internal.h"
#include "tal_tx.h"
#include "tal_irq_handler.h"
#include "mac_build_config.h"
Macros | |
#define | ACK_FRAME (0x02) |
#define | ACK_FRAME_LEN (0x05) |
#define | CCA_GUARD_DURATION_US |
#define | CONVERT_OCTETS_TO_SYM(octets) (2 * octets) |
#define | CSMA_BEACON_LOSS_GUARD_TIME_US (2000) |
#define | PRE_BEACON_GUARD_TIME_US (1000) |
Functions | |
static void | beacon_loss_timer_cb (void *parameter) |
Handler for beacon loss timer. More... | |
uint16_t | calc_frame_transmit_duration (uint8_t *phy_frame) |
Calculates the entire transaction duration. More... | |
static void | calculate_transaction_duration (void) |
Calculates the entire transaction duration. More... | |
static void | cca_timer_handler_cb (void *parameter) |
CCA timer callback. More... | |
static bool | check_beacon_reception (void) |
Checks if node is receiving beacons. More... | |
static void | csma_backoff_calculation (void) |
Calculates backoff duration and handles the start of the CCA. More... | |
static void | csma_param_init (void) |
Initializes CSMA variables. More... | |
static uint8_t | perform_cca_twice (void) |
Performs CCA twice. More... | |
static void | send_frame_at_next_backoff_boundary (void) |
Sends the frame at the next backoff boundary. More... | |
bool | slotted_csma_start (bool perform_frame_retry) |
Starts slotted CSMA. More... | |
void | slotted_csma_state_handling (void) |
State machine handling slotted CSMA. More... | |
static void | start_beacon_loss_timer (void) |
Starts the beacon loss timer. More... | |
static void | tx_done (retval_t status) |
Finalizes the CSMA procedure. More... | |
Variables | |
static uint8_t | BE |
static uint32_t | cca_starttime_us |
static uint8_t | NB |
static uint8_t | number_of_tx_retries |
static uint8_t | remaining_backoff_periods |
static uint8_t | transaction_duration_periods |