1 /*$Id: //dwh/bluetooth/DWC_ble154combo/firmware/rel/1.30a-SOW05Patchv6_2/firmware/public_inc/power_table.h#1 $*/
2 /**
3  ******************************************************************************
4  * @file    power_table.h
5  * @brief   This file contains APIs prototypes related to configuring the used power table and the external power amplifier (EPA) parameters
6  ******************************************************************************
7  * @copy
8  * This Synopsys DWC Bluetooth Low Energy Combo Link Layer/MAC software and
9  * associated documentation ( hereinafter the "Software") is an unsupported
10  * proprietary work of Synopsys, Inc. unless otherwise expressly agreed to in
11  * writing between Synopsys and you. The Software IS NOT an item of Licensed
12  * Software or a Licensed Product under any End User Software License Agreement
13  * or Agreement for Licensed Products with Synopsys or any supplement thereto.
14  * Synopsys is a registered trademark of Synopsys, Inc. Other names included in
15  * the SOFTWARE may be the trademarks of their respective owners.
16  *
17  * Synopsys MIT License:
18  * Copyright (c) 2020-Present Synopsys, Inc
19  *
20  * Permission is hereby granted, free of charge, to any person obtaining a copy of
21  * the Software), to deal in the Software without restriction, including without
22  * limitation the rights to use, copy, modify, merge, publish, distribute,
23  * sublicense, and/or sell copies of the Software, and to permit persons to whom
24  * the Software is furnished to do so, subject to the following conditions:
25  *
26  * The above copyright notice and this permission notice shall be included in all
27  * copies or substantial portions of the Software.
28  *
29  * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30  * IMPLIED, INCLUDING, BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31  * FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE ARISING FROM,
34  * OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  * */
37 
38 #ifndef POWER_TABLE_H_
39 #define POWER_TABLE_H_
40 
41 #include "common_types.h"
42 
43 /* Private typedef -----------------------------------------------------------*/
44 
45 typedef uint8_t (*epa_enable_cb_t)(uint8_t epa_enable);
46 
47 /**
48  * @brief Structure of one element of the power table.
49  */
50 typedef struct {
51 const uint8_t vddh_pa;			/* VDDHPA supply volatge level */
52 const uint8_t internal_pa_code; /* Internal PA code */
53 const uint8_t epa_bypass; 		/* External PA Bypass 1: enabled, 0 : disabled */
54 const int8_t tx_pwr; 			/* TX Power level in dBm. */
55 } power_table_entry;
56 
57 /**
58  * @brief Structure of the power table ID.
59  */
60 typedef struct _power_table_id_t{
61 	const power_table_entry *ptr_tx_power_table;	/* Pointer to the TX_Power table corresponding to the associated "power_table_id". */
62 	const uint8_t tx_power_levels_count;			/* Number of TX_Power levels in the selected power table. */
63 	const uint8_t g_vdd_ldo_value_1; 				/* Value to be set in PHY register (address: 0x63) to select the TX_Power mode */
64 	const uint8_t g_vdd_ldo_value_2;				/* Value to be set in PHY register (address: 0xEA) to select the TX_Power mode */
65 	const uint8_t power_table_id;					/* TX_Power table ID */
66 } power_table_id_t;
67 
68 
69 extern const power_table_id_t ll_tx_power_tables[];
70 extern const uint8_t num_of_supported_power_tables;
71 
72 
73 
74 /* APIs ----------------------------------------------------------------------*/
75 /** @ingroup power_control_functions
76  * @{
77  */
78 /**
79  * @brief	Used to initialize the EPA parameters. Called during the initialization.
80  * 			Note: If an EPA is in use, then a valid callback function shall be passed to LL FW, otherwise the LL FW returns error status.
81  *
82  * @param  use_epa : [in] 1: External PA exists. 0: There is no External PA.
83  * @param  cbk	   : [in] Callback function to actually enable and disable the EPA.
84  *
85  * @retval	Status : FW returns an error code, in case:
86  * 					 1. "use_epa" has wrong value
87  * 					 2. An EPA is in use and its enable callback function is set to NULL.
88  */
89 uint8_t ll_tx_pwr_if_epa_init(uint8_t use_epa, epa_enable_cb_t cbk);
90 
91 /**
92  * @brief Used to specify the used power table and its size based on the selected power mode.
93  *
94  * @param  tx_power_mode : [in] Parameter indicating the selected TX_Power mode
95  *
96  * @retval Status 		 : 0: SUCCESS. Otherwise: Error code.
97  */
98 uint8_t ll_tx_pwr_if_select_tx_power_mode(uint8_t tx_power_table_id);
99 
100 /**
101  * @}
102  */
103 
104 #endif /* POWER_TABLE_H_ */
105