Microchip® Advanced Software Framework

tal_fe.c File Reference

This file handles the front-end configuration.

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 "tal_config.h"
#include "ieee_const.h"
#include "tal_internal.h"
#include "ieee_154g.h"
#include "tal_fe_fsk_params.h"

Macros

#define AGC_SETTLE_TABLE
 
#define AGC_SETTLE_TABLE_COL_SIZE   9
 
#define AGC_SETTLE_TABLE_ROW_SIZE   8
 
#define AGC_SETTLE_TABLE_TABLE_DATA_TYPE   uint8_t
 
#define bb_bit_read(reg)   trx_bit_read(reg)
 
#define bb_bit_write(reg, val)   trx_bit_write(reg, val)
 
#define bb_blk_write(reg, addr, len)   trx_write(reg, addr, len)
 
#define bb_reg_read(reg)   trx_reg_read(reg)
 
#define rf_bit_write(reg, val)   trx_bit_write(reg, val)
 
#define rf_blk_write(reg, addr, len)   trx_write(reg, addr, len)
 
#define rf_reg_write(reg, val)   trx_reg_write(reg, val)
 

Functions

 FLASH_DECLARE (AGC_SETTLE_TABLE_TABLE_DATA_TYPE agc_settle[AGC_SETTLE_TABLE_ROW_SIZE][AGC_SETTLE_TABLE_COL_SIZE])
 
 FLASH_DECLARE (uint8_t fsk_params_tbl[48][11])
 
 FLASH_DECLARE (uint8_t fsk_pe_tbl[3 *6])
 
retval_t fsk_rfcfg (fsk_mod_type_t mod_type, fsk_sym_rate_t srate, mod_idx_t mod_idx, trx_id_t trx_id)
 Configures RF according FSK. More...
 
static uint16_t get_agc_settling_period (uint8_t sr, uint8_t avgs, uint8_t agci)
 Gets the AGC settling period. More...
 
retval_t ofdm_rfcfg (ofdm_option_t ofdm_opt, trx_id_t trx_id)
 Configures RF according MR-OFDM. More...
 
retval_t oqpsk_rfcfg (oqpsk_chip_rate_t chip_rate, trx_id_t trx_id)
 Configures RF according MR-OQPSK. More...
 

#define AGC_SETTLE_TABLE
Value:
{ \
{1, 9, 8, 10, 9, 12, 11, 16, 15}, \
{2, 16, 14, 18, 16, 22, 20, 30, 28}, \
{3, 23, 20, 26, 23, 32, 29, 44, 41}, \
{4, 31, 27, 35, 31, 43, 39, 59, 55}, \
{5, 39, 34, 44, 39, 54, 49, 74, 69}, \
{6, 46, 40, 52, 46, 64, 58, 88, 82}, \
{8, 56, 53, 69, 61, 85, 77, 117, 109}, \
{10, 73, 63, 83, 73, 103, 93, 143, 133} \
}
#define AGC_SETTLE_TABLE_COL_SIZE   9
#define AGC_SETTLE_TABLE_ROW_SIZE   8

Referenced by get_agc_settling_period().

#define AGC_SETTLE_TABLE_TABLE_DATA_TYPE   uint8_t
#define bb_bit_read (   reg)    trx_bit_read(reg)

Referenced by ofdm_rfcfg().

#define bb_bit_write (   reg,
  val 
)    trx_bit_write(reg, val)

Referenced by ofdm_rfcfg(), and oqpsk_rfcfg().

#define bb_blk_write (   reg,
  addr,
  len 
)    trx_write(reg, addr, len)

Referenced by fsk_rfcfg().

#define bb_reg_read (   reg)    trx_reg_read(reg)
#define rf_bit_write (   reg,
  val 
)    trx_bit_write(reg, val)
#define rf_blk_write (   reg,
  addr,
  len 
)    trx_write(reg, addr, len)

Referenced by fsk_rfcfg(), ofdm_rfcfg(), and oqpsk_rfcfg().

#define rf_reg_write (   reg,
  val 
)    trx_reg_write(reg, val)

FLASH_DECLARE ( AGC_SETTLE_TABLE_TABLE_DATA_TYPE  agc_settle[AGC_SETTLE_TABLE_ROW_SIZE][AGC_SETTLE_TABLE_COL_SIZE])
FLASH_DECLARE ( uint8_t  fsk_params_tbl[48][11])
FLASH_DECLARE ( uint8_t  fsk_pe_tbl[3 *6])
retval_t fsk_rfcfg ( fsk_mod_type_t  mod_type,
fsk_sym_rate_t  srate,
mod_idx_t  mod_idx,
trx_id_t  trx_id 
)

Configures RF according FSK.

Parameters
mod_typeModulation order / type; i.e. F2FSK or F4FSK
srateSymbol rate
mod_idxModulation index
trx_idTransceiver identifier

References AGCC_AGCI_MASK, AGCC_AGCI_SHIFT, AGCC_AVGS_MASK, AGCC_AVGS_SHIFT, bb_blk_write, DEFAULT_TX_PWR_REG, FSKDM_EN_SHIFT, FSKDM_PE_SHIFT, get_agc_settling_period(), MAC_SUCCESS, PAC_PACUR_SHIFT, PAC_TXPWR_SHIFT, PGM_READ_BLOCK, PGM_READ_BYTE, RF09, RF_BASE_ADDR_OFFSET, rf_blk_write, RG_BBC0_FSKDM, RG_RF09_AGCC, RG_RF09_PAC, RG_RF09_RXBWC, RG_RF09_TXCUTC, RXDFE_SR_MASK, status, tal_pib, temp, trx_reg_write(), and TXDFE_DM_SHIFT.

Referenced by conf_fsk().

static uint16_t get_agc_settling_period ( uint8_t  sr,
uint8_t  avgs,
uint8_t  agci 
)
static

Gets the AGC settling period.

Parameters
srSample rate
avgsAGC average time in number of samples
agciAGC input

References AGC_SETTLE_TABLE_ROW_SIZE, and PGM_READ_BYTE.

Referenced by fsk_rfcfg(), ofdm_rfcfg(), and oqpsk_rfcfg().