This file supports the TAL PIB attributes by providing 4g specific information.
Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include "pal.h"
#include "return_val.h"
#include "tal.h"
#include "ieee_const.h"
#include "tal_config.h"
#include "tal_pib.h"
#include "tal_internal.h"
#include "ieee_154g.h"
#define CCA_OFFSET 10 |
#define CH_SPAC_FSK_MOD_1 200000 /* Hz */ |
#define CH_SPAC_FSK_MOD_2 400000 /* Hz */ |
#define CH_SPAC_FSK_MOD_3 400000 /* Hz */ |
#define CH_SPAC_FSK_MOD_4 600000 /* Hz */ |
#define CH_SPAC_FSK_TABLE |
#define CH_SPAC_OFDM_OPT_1 1200000 /* Hz */ |
#define CH_SPAC_OFDM_OPT_2 800000 /* Hz */ |
#define CH_SPAC_OFDM_OPT_3 400000 /* Hz */ |
#define CH_SPAC_OFDM_OPT_4 200000 /* Hz */ |
#define CH_SPAC_OFDM_TABLE |
#define FK_CCA_THRES_FEC_OFFSET 6 /* dBm */ |
Referenced by get_cca_thres().
#define FPGA_CCA_THRES_VALUE -105 |
#define FSK_CCA_THRES_100_KBIT (-88 + CCA_OFFSET) /* dBm */ |
#define FSK_CCA_THRES_150_KBIT (-86 + CCA_OFFSET) /* dBm */ |
#define FSK_CCA_THRES_200_KBIT (-85 + CCA_OFFSET) /* dBm */ |
#define FSK_CCA_THRES_300_KBIT (-83 + CCA_OFFSET) /* dBm */ |
#define FSK_CCA_THRES_400_KBIT (-82 + CCA_OFFSET) /* dBm */ |
#define FSK_CCA_THRES_50_KBIT (-91 + CCA_OFFSET) /* dBm */ |
#define FSK_CCA_THRES_DATA_TYPE int8_t |
#define FSK_CCA_THRES_TABLE |
#define FSK_CCA_THRES_TABLE_SIZE 6 |
#define FSK_CH_CENTER_FREQ0_MAP |
#define FSK_CH_CENTER_FREQ0_MAP_COL_SIZE 5 |
#define FSK_CH_CENTER_FREQ0_MAP_ROW_SIZE 7 |
Referenced by get_fsk_freq_f0(), and get_sun_max_ch_no().
#define FSK_PROCESSING_DELAY_ACK_TABLE_DATA_TYPE uint8_t |
#define FSK_PROCESSING_DELAY_ACK_TABLE_ROW_SIZE 6 |
#define FSK_PROCESSING_DELAY_ACK_TIMING |
#define FSK_PROCESSING_DELAY_ACK_TIMING_AUTO_MODES |
#define FSK_SYM_RATE_TABLE |
#define FSK_SYM_RATE_TABLE_DATA_TYPE uint8_t |
#define FSK_SYM_RATE_TABLE_SIZE 6 |
#define FSK_TOTAL_CHANNELS_MAP |
#define FSK_TOTAL_CHANNELS_MAP_COL_SIZE 5 |
#define FSK_TOTAL_CHANNELS_MAP_ROW_SIZE 7 |
#define LEG_OQPSK_CH_CENTER_FREQ0_MAP |
#define LEG_OQPSK_CH_CENTER_FREQ0_MAP_COL_SIZE 3 |
#define LEG_OQPSK_CH_CENTER_FREQ0_MAP_ROW_SIZE 3 |
Referenced by get_leg_oqpsk_freq_f0().
#define OFDM_CCA_THRES_TABLE |
#define OFDM_CCA_THRES_TABLE_COL_SIZE 4 |
#define OFDM_CCA_THRES_TABLE_DATA_TYPE int8_t |
#define OFDM_CCA_THRES_TABLE_ROW_SIZE 7 |
#define OFDM_CH_CENTER_FREQ0_MAP |
#define OFDM_CH_CENTER_FREQ0_MAP_COL_SIZE 5 |
#define OFDM_CH_CENTER_FREQ0_MAP_ROW_SIZE 7 |
Referenced by get_ofdm_freq_f0(), and get_sun_max_ch_no().
#define OFDM_DATA_RATE_TABLE |
#define OFDM_DATA_RATE_TABLE_COL_SIZE 4 |
#define OFDM_DATA_RATE_TABLE_DATA_TYPE uint16_t |
#define OFDM_DATA_RATE_TABLE_ROW_SIZE 7 |
#define OFDM_PROCESSING_DELAY_ACK_TIMING_TABLE |
#define OFDM_PROCESSING_DELAY_ACK_TIMING_TABLE_COL_SIZE 4 |
#define OFDM_PROCESSING_DELAY_ACK_TIMING_TABLE_DATA_TYPE uint8_t |
#define OFDM_PROCESSING_DELAY_ACK_TIMING_TABLE_ROW_SIZE 7 |
#define OFDM_TOTAL_CHANNELS_MAP |
#define OFDM_TOTAL_CHANNELS_MAP_COL_SIZE 5 |
#define OFDM_TOTAL_CHANNELS_MAP_ROW_SIZE 7 |
#define OQPSK_ACK_TIMING_OFFSET_TABLE |
#define OQPSK_ACK_TIMING_OFFSET_TABLE_DATA_TYPE uint8_t |
#define OQPSK_ACK_TIMING_OFFSET_TABLE_SIZE 4 |
#define OQPSK_CCA_DURATION_TABLE |
#define OQPSK_CCA_DURATION_TABLE_DATA_TYPE uint8_t |
#define OQPSK_CCA_DURATION_TABLE_SIZE 4 |
#define OQPSK_CCA_THRES (-90) /* dBm */ |
Referenced by get_cca_thres().
#define OQPSK_CH_CENTER_FREQ0_MAP |
#define OQPSK_CH_CENTER_FREQ0_MAP_COL_SIZE 3 |
#define OQPSK_CH_CENTER_FREQ0_MAP_ROW_SIZE 7 |
Referenced by get_oqpsk_freq_f0(), and get_sun_max_ch_no().
#define OQPSK_CH_SPAC_TABLE |
#define OQPSK_CH_SPAC_TABLE_COL_SIZE 2 |
#define OQPSK_CH_SPAC_TABLE_DATA_TYPE uint32_t |
#define OQPSK_CH_SPAC_TABLE_ROW_SIZE 7 |
#define OQPSK_CHIP_RATE_FREQ_TABLE |
#define OQPSK_CHIP_RATE_FREQ_TABLE_COL_SIZE 2 |
#define OQPSK_CHIP_RATE_FREQ_TABLE_DATA_TYPE uint16_t |
#define OQPSK_CHIP_RATE_FREQ_TABLE_ROW_SIZE 7 |
Referenced by get_oqpsk_chip_rate().
#define OQPSK_CHIP_RATE_TABLE |
#define OQPSK_CHIP_RATE_TABLE_DATA_TYPE uint8_t |
#define OQPSK_CHIP_RATE_TABLE_SIZE 4 |
#define OQPSK_EU_863_FREQ_TABLE 868300000, 868950000, 869525000 |
#define OQPSK_EU_863_FREQ_TABLE_DATA_TYPE uint32_t |
#define OQPSK_EU_863_FREQ_TABLE_SIZE 3 |
#define OQPSK_SHR_DURATION_TABLE |
#define OQPSK_SHR_DURATION_TABLE_DATA_TYPE uint8_t |
#define OQPSK_SHR_DURATION_TABLE_SIZE 4 |
#define OQPSK_SYMBOL_DURATION_TABLE |
#define OQPSK_SYMBOL_DURATION_TABLE_DATA_TYPE uint16_t |
#define OQPSK_SYMBOL_DURATION_TABLE_SIZE 4 |
#define OQPSK_SYMBOL_LENGTH_TABLE |
#define OQPSK_SYMBOL_LENGTH_TABLE_DATA_TYPE uint8_t |
#define OQPSK_SYMBOL_LENGTH_TABLE_SIZE 4 |
#define OQPSK_TOTAL_CHANNELS_MAP |
#define OQPSK_TOTAL_CHANNELS_MAP_COL_SIZE 2 |
#define OQPSK_TOTAL_CHANNELS_MAP_ROW_SIZE 7 |
uint16_t calculate_cca_duration_us | ( | trx_id_t | trx_id | ) |
Gets CCA duration.
trx_id | Transceiver identifier |
References tal_pib.
Referenced by get_cca_duration_us(), and tal_pib_set().
uint16_t ceiling_sym | ( | trx_id_t | trx_id, |
uint16_t | duration_us | ||
) |
Implements the ceiling function for symbols.
Returns the smallest integer value in symbols greater or equal to its argument value see section 9.2, pg. 43
trx_id | Transceiver identifier |
duration_us | Symbol duration in us |
References tal_pib.
Referenced by get_AckTiming_us(), and get_AckWaitDuration_us().
FLASH_DECLARE | ( | OQPSK_SYMBOL_DURATION_TABLE_DATA_TYPE | oqpsk_sym_duration_table[OQPSK_SYMBOL_DURATION_TABLE_SIZE] | ) |
FLASH_DECLARE | ( | OQPSK_CCA_DURATION_TABLE_DATA_TYPE | oqpsk_cca_dur_table[OQPSK_CCA_DURATION_TABLE_SIZE] | ) |
FLASH_DECLARE | ( | OQPSK_SHR_DURATION_TABLE_DATA_TYPE | oqpsk_shr_duration_table[OQPSK_SHR_DURATION_TABLE_SIZE] | ) |
FLASH_DECLARE | ( | OQPSK_SYMBOL_LENGTH_TABLE_DATA_TYPE | oqpsk_sym_len_table[OQPSK_SYMBOL_LENGTH_TABLE_SIZE] | ) |
FLASH_DECLARE | ( | OQPSK_CHIP_RATE_TABLE_DATA_TYPE | oqpsk_chip_rate_table[OQPSK_CHIP_RATE_TABLE_SIZE] | ) |
FLASH_DECLARE | ( | OQPSK_ACK_TIMING_OFFSET_TABLE_DATA_TYPE | oqpsk_ack_timing_offset_table[OQPSK_ACK_TIMING_OFFSET_TABLE_SIZE] | ) |
FLASH_DECLARE | ( | uint32_t | oqpsk_freq0_map[OQPSK_CH_CENTER_FREQ0_MAP_ROW_SIZE][OQPSK_CH_CENTER_FREQ0_MAP_COL_SIZE] | ) |
FLASH_DECLARE | ( | uint32_t | leg_oqpsk_freq0_map[LEG_OQPSK_CH_CENTER_FREQ0_MAP_ROW_SIZE][LEG_OQPSK_CH_CENTER_FREQ0_MAP_COL_SIZE] | ) |
FLASH_DECLARE | ( | OQPSK_CH_SPAC_TABLE_DATA_TYPE | oqpsk_ch_spac_table[OQPSK_CH_SPAC_TABLE_ROW_SIZE][OQPSK_CH_SPAC_TABLE_COL_SIZE] | ) |
FLASH_DECLARE | ( | uint32_t | oqpsk_max_ch_map[OQPSK_TOTAL_CHANNELS_MAP_ROW_SIZE][OQPSK_TOTAL_CHANNELS_MAP_COL_SIZE] | ) |
FLASH_DECLARE | ( | OQPSK_CHIP_RATE_FREQ_TABLE_DATA_TYPE | oqpsk_chip_rate_freq_table[OQPSK_CHIP_RATE_FREQ_TABLE_ROW_SIZE][OQPSK_CHIP_RATE_FREQ_TABLE_COL_SIZE] | ) |
FLASH_DECLARE | ( | uint32_t | ofdm_freq0_map[OFDM_CH_CENTER_FREQ0_MAP_ROW_SIZE][OFDM_CH_CENTER_FREQ0_MAP_COL_SIZE] | ) |
FLASH_DECLARE | ( | uint32_t | ofdm_max_ch_map[OFDM_TOTAL_CHANNELS_MAP_ROW_SIZE][OFDM_TOTAL_CHANNELS_MAP_COL_SIZE] | ) |
FLASH_DECLARE | ( | uint32_t | ofdm_ch_spacing_table[] | ) | = { CH_SPAC_FSK_TABLE } |
FLASH_DECLARE | ( | OFDM_CCA_THRES_TABLE_DATA_TYPE | ofdm_cca_thres[OFDM_CCA_THRES_TABLE_ROW_SIZE][OFDM_CCA_THRES_TABLE_COL_SIZE] | ) |
FLASH_DECLARE | ( | OFDM_DATA_RATE_TABLE_DATA_TYPE | ofdm_data_rate_table[OFDM_DATA_RATE_TABLE_ROW_SIZE][OFDM_DATA_RATE_TABLE_COL_SIZE] | ) |
FLASH_DECLARE | ( | OFDM_PROCESSING_DELAY_ACK_TIMING_TABLE_DATA_TYPE | ofdm_processing_delay_ack_timing[OFDM_PROCESSING_DELAY_ACK_TIMING_TABLE_COL_SIZE][OFDM_PROCESSING_DELAY_ACK_TIMING_TABLE_ROW_SIZE] | ) |
FLASH_DECLARE | ( | uint32_t | fsk_freq0_map[FSK_CH_CENTER_FREQ0_MAP_ROW_SIZE][FSK_CH_CENTER_FREQ0_MAP_COL_SIZE] | ) |
FLASH_DECLARE | ( | uint32_t | fsk_max_ch_map[FSK_TOTAL_CHANNELS_MAP_ROW_SIZE][FSK_TOTAL_CHANNELS_MAP_COL_SIZE] | ) |
FLASH_DECLARE | ( | FSK_SYM_RATE_TABLE_DATA_TYPE | fsk_sym_rate_table[FSK_SYM_RATE_TABLE_SIZE] | ) |
FLASH_DECLARE | ( | FSK_CCA_THRES_DATA_TYPE | fsk_cca_thres_table[FSK_CCA_THRES_TABLE_SIZE] | ) |
FLASH_DECLARE | ( | FSK_PROCESSING_DELAY_ACK_TABLE_DATA_TYPE | fsk_processing_delay_ack_timing[FSK_PROCESSING_DELAY_ACK_TABLE_ROW_SIZE] | ) |
uint16_t get_AckTiming_us | ( | trx_id_t | trx_id | ) |
Gets the ACK timing in us.
trx_id | Transceiver identifier |
References aMinTurnaroundTimeSUNPHY, aTurnaroundTime, ceiling_sym(), FSK, LEG_OQPSK, OFDM, OQPSK, PGM_READ_BYTE, and tal_pib.
Referenced by calculate_pib_values().
uint16_t get_AckWaitDuration_us | ( | trx_id_t | trx_id | ) |
Gets the AckWaitDuration in us.
trx_id | Transceiver identifier |
References aMinTurnaroundTimeSUNPHY, ceiling_sym(), F4FSK, FSK, LEG_OQPSK, OFDM, OQPSK, oqpsk_ack_psdu_duration_sym(), phr_duration_sym(), shr_duration_sym(), and tal_pib.
Referenced by calculate_pib_values().
uint16_t get_cca_duration_us | ( | trx_id_t | trx_id | ) |
Gets the CCA duration in us.
trx_id | Transceiver identifier |
References calculate_cca_duration_us(), FSK, JAPAN_920, LEG_OQPSK, OFDM, OQPSK, PGM_READ_BYTE, and tal_pib.
Referenced by calculate_pib_values().
int8_t get_cca_thres | ( | trx_id_t | trx_id | ) |
Gets the CCA threshold.
trx_id | Transceiver identifier |
References FK_CCA_THRES_FEC_OFFSET, FSK, LEG_OQPSK, OFDM, OQPSK, OQPSK_CCA_THRES, PGM_READ_BYTE, and tal_pib.
Referenced by calculate_pib_values().
float get_data_rate | ( | trx_id_t | trx_id | ) |
Gets PSDU data rate.
trx_id | Transceiver identifier |
References CHIP_RATE_1000, F4FSK, FSK, LEG_OQPSK, OFDM, OQPSK, oqpsk_get_chip_rate(), oqpsk_spreading(), PGM_READ_BYTE, PGM_READ_WORD, and tal_pib.
Referenced by calculate_pib_values().
void get_fsk_freq_f0 | ( | trx_id_t | trx_id, |
sun_freq_band_t | freq_band, | ||
fsk_op_mode_t | option, | ||
uint32_t * | freq, | ||
uint32_t * | spacing | ||
) |
Gets the FSK center frequency F0.
[in] | trx_id | Transceiver identifier |
[in] | freq_band | Frequency band |
[in] | option | FSK operating mode |
[out] | freq | Pointer to frequency F0 |
[out] | spacing | Pointer to Channel spacing |
References FSK_CH_CENTER_FREQ0_MAP_ROW_SIZE, and PGM_READ_DWORD.
Referenced by perf_set_sun_page().
void get_leg_oqpsk_freq_f0 | ( | trx_id_t | trx_id, |
sun_freq_band_t | freq_band, | ||
uint32_t * | freq, | ||
uint32_t * | spacing | ||
) |
Gets the Legacy OQPSK center frequency F0.
[in] | trx_id | Transceiver identifier |
[in] | freq_band | Frequency band |
[out] | freq | Pointer to frequency F0 |
[out] | spacing | Pointer to Channel spacing |
References LEG_OQPSK_CH_CENTER_FREQ0_MAP_ROW_SIZE, and PGM_READ_DWORD.
Referenced by perf_set_sun_page().
void get_ofdm_freq_f0 | ( | trx_id_t | trx_id, |
sun_freq_band_t | freq_band, | ||
ofdm_option_t | option, | ||
uint32_t * | freq, | ||
uint32_t * | spacing | ||
) |
Gets the OFDM center frequency F0.
[in] | trx_id | Transceiver identifier |
[in] | freq_band | Frequency band |
[in] | option | OFDM option |
[out] | freq | Pointer to frequency F0 |
[out] | spacing | Pointer to Channel spacing |
References OFDM_CH_CENTER_FREQ0_MAP_ROW_SIZE, and PGM_READ_DWORD.
Referenced by perf_set_sun_page().
oqpsk_chip_rate_t get_oqpsk_chip_rate | ( | trx_id_t | trx_id, |
sun_freq_band_t | freq_band | ||
) |
Gets the OQPSK Chiprate.
[in] | trx_id | Transceiver identifier |
[in] | freq_band | Frequency band |
References CHIP_RATE_100, CHIP_RATE_1000, CHIP_RATE_200, CHIP_RATE_2000, OQPSK_CHIP_RATE_FREQ_TABLE_ROW_SIZE, and PGM_READ_WORD.
void get_oqpsk_freq_f0 | ( | trx_id_t | trx_id, |
sun_freq_band_t | freq_band, | ||
uint32_t * | freq, | ||
uint32_t * | spacing | ||
) |
Gets the OQPSK center frequency F0.
[in] | trx_id | Transceiver identifier |
[in] | freq_band | Frequency band |
[out] | freq | Pointer to frequency F0 |
[out] | spacing | Pointer to Channel spacing |
References EU_863, OQPSK_CH_CENTER_FREQ0_MAP_ROW_SIZE, and PGM_READ_DWORD.
Referenced by perf_set_sun_page().
uint16_t get_sun_max_ch_no | ( | trx_id_t | trx_id | ) |
Gets Maximum no of channel supported by each modulation.
[in] | trx_id | Transceiver identifier |
References FSK, FSK_CH_CENTER_FREQ0_MAP_ROW_SIZE, OFDM, OFDM_CH_CENTER_FREQ0_MAP_ROW_SIZE, OQPSK, OQPSK_CH_CENTER_FREQ0_MAP_ROW_SIZE, PGM_READ_DWORD, and tal_pib.
Referenced by apply_channel_settings(), and set_channel_app().
Gets ACK duration.
trx_id | Transceiver identifier |
The lowest 16bits contain the lowest supported channel number and the highest 16bits contains the highest supported channel number.
[in] | trx_id | Transceiver identifier |
[out] | value | Pointer to tuple (32bits) storage location |
References CHINA_470, CHINA_780, FSK, LEG_OQPSK, MAC_INVALID_PARAMETER, MAC_SUCCESS, MAC_UNSUPPORTED_ATTRIBUTE, OFDM, OQPSK, RF09, status, tal_pib, and US_915.
Referenced by calculate_pib_values(), init_tal_pib(), set_phy_based_on_channel_page(), and tal_pib_set().
|
static |
Gets the PSDU duration for MR-OQPSK.
pg. 119, section 18.3.2.14
trx_id | Transceiver identifier |
References oqpsk_spreading(), PGM_READ_BYTE, tal_pib, and temp.
Referenced by get_AckWaitDuration_us().
|
static |
Gets the MR-OQPSK chip rate.
table 166, pg. 101
trx_id | Transceiver identifier |
References PGM_READ_BYTE, and tal_pib.
Referenced by get_data_rate().
|
static |
Gets the MR-OQPSK spreading.
chip_rate | Chip rate |
rate_mode | Rate mode |
References CHIP_RATE_100, CHIP_RATE_1000, CHIP_RATE_200, CHIP_RATE_2000, and OQPSK_RATE_MOD_4.
Referenced by get_data_rate(), and oqpsk_ack_psdu_duration_sym().
uint8_t phr_duration_sym | ( | trx_id_t | trx_id | ) |
Gets the PHR duration.
see pg. 46
trx_id | Transceiver identifier |
References FSK, LEG_OQPSK, OFDM, OFDM_OPT_1, OFDM_OPT_2, OQPSK, and tal_pib.
Referenced by get_AckWaitDuration_us().
uint8_t shr_duration_sym | ( | trx_id_t | trx_id | ) |
Gets the SHR duration.
trx_id | Transceiver identifier |
References FSK, LEG_OQPSK, OFDM, OQPSK, PGM_READ_BYTE, and tal_pib.
Referenced by get_AckWaitDuration_us().
uint16_t tal_get_symbol_duration_us | ( | trx_id_t | trx_id | ) |
Gets the symbol duration in us.
trx_id | Transceiver identifier |
References FSK, LEG_OQPSK, OFDM, OQPSK, PGM_READ_WORD, and tal_pib.
Referenced by calculate_pib_values().