Microchip® Advanced Software Framework

tal.h File Reference

This file contains TAL API function declarations.

Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.

#include <stdint.h>
#include <stdbool.h>
#include "pal.h"
#include "tal_config.h"
#include "tal_generic.h"
#include "bmm.h"
#include "stack_config.h"
#include "return_val.h"
#include "tal_types.h"
#include "mac_build_config.h"
#include "qmm.h"
#include "tal_multi_trx.h"

Data Structures

struct  frame_info_tag
 Globally used frame information structure. More...
 
struct  tal_pib_tag
 

Macros

#define BAND_2400   (1)
 2.4 GHz (channels 11 through 26) More...
 
#define BAND_900   (0)
 868 / 910 MHz (channels 0 through 10) using BPSK More...
 
#define BAND_MULTIPLE   (2)
 450 / 900 MHz and 2.4 GHz - Multiple band support More...
 
#define mac_i_pan_coordinator   (0x0B)
 Attribute id of mac_i_pan_coordinator PIB. More...
 
#define MAX_CHANNEL   (26)
 Maximum channel. More...
 
#define MAX_FRAME_DURATION
 Maximum number of symbols in a frame for the current PHY. More...
 
#define MAX_SYMBOL_TIME   (0x0FFFFFFF)
 The maximum time in symbols for a 32 bit timer. More...
 
#define MIN_CHANNEL   (11)
 Minimum channel. More...
 
#define NO_OF_SYMBOLS_PREAMBLE_SFD
 Number of symbols forming the synchronization header (SHR) for the current PHY. More...
 
#define NO_SYMBOLS_PREAMBLE   (8)
 Number of symbols included in the preamble. More...
 
#define NO_SYMBOLS_SFD   (2)
 Number of symbols included in the SFD field. More...
 
#define NUM_TRX   1
 
#define RF_BAND   BAND_2400
 RF band. More...
 
#define SYMBOL_MASK   (0x0FFFFFFF)
 Symbol mask for ignoring most significant nibble. More...
 
#define SYMBOLS_PER_OCTET   (2)
 Symbols per octet. More...
 
#define TAL_BIT_MASK(ADDR, MASK, POS)   MASK
 Get bit mask from sub register definition. More...
 
#define TAL_BIT_POS(ADDR, MASK, POS)   POS
 Get bit position from sub register definition. More...
 
#define TAL_CONVERT_SYMBOLS_TO_US(trx_id, symbols)
 
#define TAL_GET_BEACON_INTERVAL_TIME(BO)   ((1UL * aBaseSuperframeDuration) << (BO))
 Beacon Interval time in symbols. More...
 
#define TAL_GET_SUPERFRAME_DURATION_TIME(SO)   ((1UL * aBaseSuperframeDuration) << (SO))
 Superframe Duration time in symbols. More...
 
#define VALID_CHANNEL_MASK   (0x07FFF800UL)
 Valid channel masks for scanning. More...
 

Typedefs

typedef enum csma_mode_tag csma_mode_t
 CSMA Mode supported by transceiver. More...
 
typedef struct frame_info_tag frame_info_t
 Globally used frame information structure. More...
 
typedef enum sleep_mode_tag sleep_mode_t
 Sleep Mode supported by transceiver. More...
 
typedef __PACK__DATA__ struct
tal_pib_tag 
tal_pib_t
 

Enumerations

enum  csma_mode_tag {
  NO_CSMA_NO_IFS,
  NO_CSMA_WITH_IFS,
  CSMA_UNSLOTTED,
  CSMA_SLOTTED
}
 CSMA Mode supported by transceiver. More...
 
enum  SHORTENUM {
  ASSOCIATIONREQUEST = (0x01),
  ASSOCIATIONRESPONSE,
  DISASSOCIATIONNOTIFICATION,
  DATAREQUEST,
  PANIDCONFLICTNOTIFICAION,
  ORPHANNOTIFICATION,
  BEACONREQUEST,
  COORDINATORREALIGNMENT,
  GTSREQUEST,
  ORPHANREALIGNMENT,
  BEACON_MESSAGE,
  DATAREQUEST_IMPL_POLL,
  NULL_FRAME,
  MCPS_MESSAGE,
  DISCOVERY_REQUEST = 0x01,
  DISCOVERY_RESPONSE = 0x02,
  PAIR_REQUEST = 0x03,
  PAIR_RESPONSE = 0x04,
  UNPAIR_REQUEST = 0x05,
  KEY_SEED = 0x06,
  PING_REQUEST = 0x07,
  PING_RESPONSE = 0x08
}
 MAC Message types. More...
 
enum  sleep_mode_tag {
  SLEEP_MODE_1,
  DEEP_SLEEP_MODE
}
 Sleep Mode supported by transceiver. More...
 

Functions

static uint32_t tal_add_time_symbols (uint32_t a, uint32_t b)
 Adds two time values. More...
 
void tal_generate_rand_seed (void)
 Generates a 16-bit random number used as initial seed for srand() More...
 
retval_t tal_init (void)
 Initializes the TAL. More...
 
static uint32_t tal_sub_time_symbols (uint32_t a, uint32_t b)
 Subtract two time values. More...
 
void tal_task (void)
 TAL task handling. More...
 

Variables

tal_pib_t tal_pib [NUM_TRX]
 TAL PIBs. More...
 

#define BAND_2400   (1)

2.4 GHz (channels 11 through 26)

#define BAND_900   (0)

868 / 910 MHz (channels 0 through 10) using BPSK

#define BAND_MULTIPLE   (2)

450 / 900 MHz and 2.4 GHz - Multiple band support

#define mac_i_pan_coordinator   (0x0B)

Attribute id of mac_i_pan_coordinator PIB.

Referenced by mlme_start_request(), tal_pib_get(), and tal_pib_set().

#define MAX_CHANNEL   (26)

Maximum channel.

Referenced by per_mode_initiator_ed_end_cb(), and start_ed_scan().

#define MAX_FRAME_DURATION
Value:
#define aMaxPHYPacketSize
Maximum size of PHY packet.
Definition: ieee_const.h:81
#define NO_OF_SYMBOLS_PREAMBLE_SFD
Number of symbols forming the synchronization header (SHR) for the current PHY.
Definition: tal.h:839
#define SYMBOLS_PER_OCTET
Symbols per octet.
Definition: tal.h:777

Maximum number of symbols in a frame for the current PHY.

This value is the base for the PHY PIB attribute phyMaxFrameDuration.

Referenced by apply_channel_page_configuration(), and recalc_macMaxFrameTotalWaitTime().

#define MAX_SYMBOL_TIME   (0x0FFFFFFF)

The maximum time in symbols for a 32 bit timer.

Referenced by tal_sub_time_symbols().

#define MIN_CHANNEL   (11)

Minimum channel.

Referenced by per_mode_initiator_ed_end_cb(), and start_ed_scan().

#define NO_OF_SYMBOLS_PREAMBLE_SFD
Value:
#define NO_SYMBOLS_PREAMBLE
Number of symbols included in the preamble.
Definition: tal.h:779
#define NO_SYMBOLS_SFD
Number of symbols included in the SFD field.
Definition: tal.h:781

Number of symbols forming the synchronization header (SHR) for the current PHY.

This value is the base for the PHY PIB attribute phySHRDuration.

Referenced by apply_channel_page_configuration().

#define NO_SYMBOLS_PREAMBLE   (8)

Number of symbols included in the preamble.

#define NO_SYMBOLS_SFD   (2)

Number of symbols included in the SFD field.

#define RF_BAND   BAND_2400

RF band.

#define SYMBOL_MASK   (0x0FFFFFFF)

Symbol mask for ignoring most significant nibble.

Referenced by tal_add_time_symbols(), and tal_sub_time_symbols().

#define SYMBOLS_PER_OCTET   (2)
#define TAL_BIT_MASK (   ADDR,
  MASK,
  POS 
)    MASK

Get bit mask from sub register definition.

#define TAL_BIT_POS (   ADDR,
  MASK,
  POS 
)    POS

Get bit position from sub register definition.

#define TAL_CONVERT_SYMBOLS_TO_US (   trx_id,
  symbols 
)
#define TAL_GET_BEACON_INTERVAL_TIME (   BO)    ((1UL * aBaseSuperframeDuration) << (BO))
#define TAL_GET_SUPERFRAME_DURATION_TIME (   SO)    ((1UL * aBaseSuperframeDuration) << (SO))

Superframe Duration time in symbols.

Referenced by csma_backoff_calculation(), handle_gts_data_req(), mac_t_gts_cb(), and process_data_ind_not_transient().

#define VALID_CHANNEL_MASK   (0x07FFF800UL)

Valid channel masks for scanning.

typedef enum csma_mode_tag csma_mode_t

CSMA Mode supported by transceiver.

typedef struct frame_info_tag frame_info_t

Globally used frame information structure.

Sleep Mode supported by transceiver.

CSMA Mode supported by transceiver.

Enumerator
NO_CSMA_NO_IFS 
NO_CSMA_WITH_IFS 
CSMA_UNSLOTTED 
CSMA_SLOTTED 
enum SHORTENUM

MAC Message types.

Enumerator
ASSOCIATIONREQUEST 
ASSOCIATIONRESPONSE 
DISASSOCIATIONNOTIFICATION 
DATAREQUEST 
PANIDCONFLICTNOTIFICAION 
ORPHANNOTIFICATION 
BEACONREQUEST 
COORDINATORREALIGNMENT 
GTSREQUEST 
ORPHANREALIGNMENT 
BEACON_MESSAGE 
DATAREQUEST_IMPL_POLL 
NULL_FRAME 
MCPS_MESSAGE 
DISCOVERY_REQUEST 
DISCOVERY_RESPONSE 
PAIR_REQUEST 
PAIR_RESPONSE 
UNPAIR_REQUEST 
KEY_SEED 
PING_REQUEST 
PING_RESPONSE 

Sleep Mode supported by transceiver.

Enumerator
SLEEP_MODE_1 
DEEP_SLEEP_MODE 

static uint32_t tal_add_time_symbols ( uint32_t  a,
uint32_t  b 
)
inlinestatic

Adds two time values.

This function adds two time values

Parameters
aTime value 1
bTime value 2
Returns
value of a + b

References SYMBOL_MASK.

Referenced by check_beacon_reception(), csma_backoff_calculation(), process_data_ind_not_transient(), and tal_tx_frame().

static uint32_t tal_sub_time_symbols ( uint32_t  a,
uint32_t  b 
)
inlinestatic

Subtract two time values.

This function subtracts two time values taking care of roll over.

Parameters
aTime value 1
bTime value 2
Returns
value a - b

References MAX_SYMBOL_TIME, and SYMBOL_MASK.

Referenced by csma_backoff_calculation(), process_data_ind_not_transient(), and tal_tx_frame().

tal_pib_t tal_pib[NUM_TRX]

TAL PIBs.

Referenced by ack_timout_cb(), ack_transmission_done(), app_transmit_frame(), apply_channel_page_configuration(), apply_channel_settings(), build_data_frame(), calc_ch_page(), calculate_cca_duration_us(), calculate_pib_values(), cca_start(), ceiling_sym(), check_beacon_reception(), complete_rx_transaction(), conf_fsk(), conf_leg_oqpsk(), conf_ofdm(), conf_oqpsk(), conf_trx_modulation(), config_fsk_rpc(), config_phy(), configure_frame_sending(), configure_pibs(), configure_pkt_stream_frames(), configure_range_test_frame_sending(), continue_deferred_transmission(), csma_backoff_calculation(), csma_continue(), csma_param_init(), csma_start(), fsk_rfcfg(), get_AckTiming_us(), get_AckWaitDuration_us(), get_board_details(), get_cca_duration_us(), get_cca_thres(), get_data_rate(), get_node_info(), get_sun_max_ch_no(), get_supported_channels_tuple(), handle_ed_end_irq(), handle_gts_data_req(), handle_gts_sync_loss(), handle_ifs(), handle_incoming_frame(), handle_incoming_msg(), handle_received_frame_irq(), handle_rx_end_irq(), handle_tx_end_irq(), init_tal_pib(), limit_tx_pwr(), mac_coord_realignment_command_tx_success(), mac_gts_allocate(), mac_parse_bcn_gts_info(), mac_process_tal_data_ind(), mac_sleep_trans(), mac_t_gts_cb(), main(), mcps_data_request(), mlme_get(), mlme_gts_request(), mlme_start_request(), ofdm_rfcfg(), oqpsk_ack_psdu_duration_sym(), oqpsk_get_chip_rate(), oqpsk_rfcfg(), parse_mpdu(), per_mode_initiator_rx_cb(), per_mode_initiator_task(), per_mode_initiator_tx_done_cb(), per_mode_receptor_rx_cb(), perf_set_sun_page(), phr_duration_sym(), process_data_ind_not_transient(), process_incoming_frame(), recalc_macMaxFrameTotalWaitTime(), reset_gts_expiry(), send_frame(), send_peer_conf(), set_channel(), set_channel_app(), set_default_tx_pwr(), set_fsk_pibs(), set_phy_based_on_channel_page(), set_phy_frame_length(), set_sfd(), set_tx_pwr(), shr_duration_sym(), slotted_csma_start(), slotted_csma_state_handling(), start_ack_wait_timer(), start_backoff(), start_beacon_loss_timer(), start_ed_scan(), start_rpc(), stop_rpc(), tal_get_rssi_base_val(), tal_get_symbol_duration_us(), tal_init(), tal_pib_get(), tal_pib_set(), tal_rx_enable(), tal_set_tx_pwr(), tal_task(), tal_tx_frame(), tfa_continuous_tx_start(), tfa_pib_set(), transmit_frame(), tx_done_handling(), upload_frame(), usr_range_test_beacon_rsp(), usr_range_test_beacon_tx(), usr_range_test_marker_ind(), validate_tx_power(), and write_all_tal_pib_to_trx().