nes-proj/arch/cpu/simplelink-cc13xx-cc26xx/rf-settings/cc13x2/ble-tx-power.c

152 lines
7.2 KiB
C

/*
* Copyright (c) 2018, Texas Instruments Incorporated - http://www.ti.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* \addtogroup cc13xx-cc26xx-rf-tx-power
* @{
*
* \file
* Source file for ble-mode TX power tables for CC13x2.
* \author
* Edvard Pettersen <e.pettersen@ti.com>
*/
/*---------------------------------------------------------------------------*/
#include "contiki.h"
/*---------------------------------------------------------------------------*/
#include "rf/tx-power.h"
/*---------------------------------------------------------------------------*/
/*
* TX Power table for CC1352R
* The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments:
* RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient)
* See the Technical Reference Manual for further details about the "txPower" Command field.
* The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise.
*/
tx_power_table_t rf_ble_tx_power_table_cc1352r[] =
{
{ -21, RF_TxPowerTable_DEFAULT_PA_ENTRY( 7, 3, 0, 3) },
{ -18, RF_TxPowerTable_DEFAULT_PA_ENTRY( 9, 3, 0, 3) },
{ -15, RF_TxPowerTable_DEFAULT_PA_ENTRY( 8, 2, 0, 6) },
{ -12, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 2, 0, 8) },
{ -10, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 2, 0, 11) },
{ -9, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 2, 0, 5) },
{ -6, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 1, 0, 16) },
{ -5, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 1, 0, 17) },
{ -3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 1, 0, 20) },
{ 0, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 1, 0, 26) },
{ 1, RF_TxPowerTable_DEFAULT_PA_ENTRY(28, 1, 0, 28) },
{ 2, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 0, 0, 34) },
{ 3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 0, 0, 42) },
{ 4, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 0, 0, 54) },
{ 5, RF_TxPowerTable_DEFAULT_PA_ENTRY(30, 0, 0, 74) },
RF_TxPowerTable_TERMINATION_ENTRY
};
/*---------------------------------------------------------------------------*/
/*
* TX Power table for CC1352P with default PA
* The RF_TxPowerTable_DEFAULT_PA_ENTRY macro is defined in RF.h and requires the following arguments:
* RF_TxPowerTable_DEFAULT_PA_ENTRY(bias, gain, boost coefficient)
* See the Technical Reference Manual for further details about the "txPower" Command field.
* The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise.
*/
tx_power_table_t rf_ble_tx_power_table_cc1352p_dpa[] =
{
{ -21, RF_TxPowerTable_DEFAULT_PA_ENTRY( 7, 3, 0, 3) },
{ -18, RF_TxPowerTable_DEFAULT_PA_ENTRY( 9, 3, 0, 3) },
{ -15, RF_TxPowerTable_DEFAULT_PA_ENTRY( 8, 2, 0, 6) },
{ -12, RF_TxPowerTable_DEFAULT_PA_ENTRY(10, 2, 0, 8) },
{ -10, RF_TxPowerTable_DEFAULT_PA_ENTRY(12, 2, 0, 11) },
{ -9, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 2, 0, 5) },
{ -6, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 1, 0, 16) },
{ -5, RF_TxPowerTable_DEFAULT_PA_ENTRY(14, 1, 0, 17) },
{ -3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 1, 0, 20) },
{ 0, RF_TxPowerTable_DEFAULT_PA_ENTRY(25, 1, 0, 26) },
{ 1, RF_TxPowerTable_DEFAULT_PA_ENTRY(28, 1, 0, 28) },
{ 2, RF_TxPowerTable_DEFAULT_PA_ENTRY(13, 0, 0, 34) },
{ 3, RF_TxPowerTable_DEFAULT_PA_ENTRY(17, 0, 0, 42) },
{ 4, RF_TxPowerTable_DEFAULT_PA_ENTRY(22, 0, 0, 54) },
{ 5, RF_TxPowerTable_DEFAULT_PA_ENTRY(30, 0, 0, 74) },
RF_TxPowerTable_TERMINATION_ENTRY
};
/*---------------------------------------------------------------------------*/
/*
* TX Power table for CC1352P with high PA
* The RF_TxPowerTable_HIGH_PA_ENTRY macro is defined in RF.h and requires the following arguments:
* RF_TxPowerTable_HIGH_PA_ENTRY(bias, ibboost, boost, coefficient, ldoTrim)
* See the Technical Reference Manual for further details about the "txPower" Command field.
* The PA settings require the CCFG_FORCE_VDDR_HH = 0 unless stated otherwise.
*/
tx_power_table_t rf_ble_tx_power_table_cc1352p_hpa[] =
{
{ 0, RF_TxPowerTable_HIGH_PA_ENTRY(29, 0, 1, 17, 1) },
{ 3, RF_TxPowerTable_HIGH_PA_ENTRY(39, 0, 1, 20, 1) },
{ 6, RF_TxPowerTable_HIGH_PA_ENTRY(46, 0, 1, 26, 7) },
{ 9, RF_TxPowerTable_HIGH_PA_ENTRY(40, 0, 1, 39, 41) },
{ 10, RF_TxPowerTable_HIGH_PA_ENTRY(23, 2, 1, 65, 5) },
{ 11, RF_TxPowerTable_HIGH_PA_ENTRY(24, 2, 1, 29, 7) },
{ 12, RF_TxPowerTable_HIGH_PA_ENTRY(19, 2, 1, 16, 25) },
{ 13, RF_TxPowerTable_HIGH_PA_ENTRY(27, 2, 1, 19, 13) },
{ 14, RF_TxPowerTable_HIGH_PA_ENTRY(24, 2, 1, 19, 27) },
{ 15, RF_TxPowerTable_HIGH_PA_ENTRY(23, 2, 1, 20, 39) },
{ 16, RF_TxPowerTable_HIGH_PA_ENTRY(34, 2, 1, 26, 23) },
{ 17, RF_TxPowerTable_HIGH_PA_ENTRY(38, 2, 1, 33, 25) },
{ 18, RF_TxPowerTable_HIGH_PA_ENTRY(30, 2, 1, 37, 53) },
{ 19, RF_TxPowerTable_HIGH_PA_ENTRY(36, 2, 1, 57, 59) },
{ 20, RF_TxPowerTable_HIGH_PA_ENTRY(56, 2, 1, 45, 63) },
RF_TxPowerTable_TERMINATION_ENTRY
};
/*---------------------------------------------------------------------------*/
tx_power_table_t rf_ble_tx_power_table_empty[] =
{
RF_TxPowerTable_TERMINATION_ENTRY
};
/*---------------------------------------------------------------------------*/
/* TX power table, based on which board is used. */
#if defined(DEVICE_CC1352R)
#define TX_POWER_TABLE rf_ble_tx_power_table_cc1352r
#elif defined(DEVICE_CC1352P)
#if RF_TXPOWER_HIGH_PA
#define TX_POWER_TABLE rf_ble_tx_power_table_cc1352p_hpa
#else
#define TX_POWER_TABLE rf_ble_tx_power_table_cc1352p_dpa
#endif
#else
#define TX_POWER_TABLE rf_ble_tx_power_table_empty
#endif
/*
* Define symbols for both the TX power table and its size. The TX power
* table size is with one less entry by excluding the termination entry.
*/
tx_power_table_t *const ble_tx_power_table = TX_POWER_TABLE;
const size_t ble_tx_power_table_size = (sizeof(TX_POWER_TABLE) / sizeof(TX_POWER_TABLE[0])) - 1;
/*---------------------------------------------------------------------------*/