xref: /btstack/port/renesas-tb-s1ja-cc256x/template/btstack_example/synergy/ssp/src/bsp/mcu/all/bsp_feature.h (revision 3b5c872a8c45689e8cc17891f01530f5aa5e911c)
1 /***********************************************************************************************************************
2  * Copyright [2015-2017] Renesas Electronics Corporation and/or its licensors. All Rights Reserved.
3  *
4  * This file is part of Renesas SynergyTM Software Package (SSP)
5  *
6  * The contents of this file (the "contents") are proprietary and confidential to Renesas Electronics Corporation
7  * and/or its licensors ("Renesas") and subject to statutory and contractual protections.
8  *
9  * This file is subject to a Renesas SSP license agreement. Unless otherwise agreed in an SSP license agreement with
10  * Renesas: 1) you may not use, copy, modify, distribute, display, or perform the contents; 2) you may not use any name
11  * or mark of Renesas for advertising or publicity purposes or in connection with your use of the contents; 3) RENESAS
12  * MAKES NO WARRANTY OR REPRESENTATIONS ABOUT THE SUITABILITY OF THE CONTENTS FOR ANY PURPOSE; THE CONTENTS ARE PROVIDED
13  * "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
14  * PARTICULAR PURPOSE, AND NON-INFRINGEMENT; AND 4) RENESAS SHALL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, OR
15  * CONSEQUENTIAL DAMAGES, INCLUDING DAMAGES RESULTING FROM LOSS OF USE, DATA, OR PROJECTS, WHETHER IN AN ACTION OF
16  * CONTRACT OR TORT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE CONTENTS. Third-party contents
17  * included in this file may be subject to different terms.
18  **********************************************************************************************************************/
19 /***********************************************************************************************************************
20 * File Name    : bsp_feature.h
21 * Description  : Provides feature information that varies by MCU and is not available in the factory flash.
22 ***********************************************************************************************************************/
23 
24 /*******************************************************************************************************************//**
25  * @ingroup BSP_MCU_COMMON
26  * @defgroup BSP_FEATURE Module specific feature overrides
27  *
28  * This group contains lookup functions that provide MCU specific feature information that is not available in the
29  * factory flash.
30  *
31  * @{
32  **********************************************************************************************************************/
33 
34 #ifndef BSP_FEATURE_H_
35 #define BSP_FEATURE_H_
36 
37 /***********************************************************************************************************************
38 Includes   <System Includes> , "Project Includes"
39 ***********************************************************************************************************************/
40 #include <stdint.h>
41 
42 /***********************************************************************************************************************
43 Macro definitions
44 ***********************************************************************************************************************/
45 
46 /***********************************************************************************************************************
47 Typedef definitions
48 ***********************************************************************************************************************/
49 /** SCI MCU specific features. */
50 typedef struct st_bsp_feature_sci
51 {
52     uint8_t     clock;   ///< Which clock the SCI is connected to
53 } bsp_feature_sci_t;
54 
55 /** RSPI MCU specific features. */
56 typedef struct st_bsp_feature_rspi
57 {
58     uint8_t     clock;   ///< Which clock the RSPI is connected to
59     uint8_t     has_ssl_level_keep        : 1;
60     uint8_t     swap                      : 1;
61 } bsp_feature_rspi_t;
62 
63 /** LVD MCU specific features. */
64 typedef struct st_bsp_feature_lvd
65 {
66     uint8_t     monitor_1_low_threshold; ///< Monitor 1 lowest valid voltage threshold
67     uint8_t     monitor_1_hi_threshold;  ///< Monitor 1 highest valid voltage threshold
68     uint8_t     monitor_2_low_threshold; ///< Monitor 2 lowest valid voltage threshold
69     uint8_t     monitor_2_hi_threshold;  ///< Monitor 2 highest valid voltage threshold
70     uint32_t    has_digital_filter : 1;  ///< Whether or not LVD has a digital filter
71     uint32_t    negation_delay_clock;    ///< Clock required for LVD signal negation delay after reset
72 } bsp_feature_lvd_t;
73 
74 /** ACMPHS MCU specific features. */
75 typedef struct st_bsp_feature_acmphs
76 {
77     uint32_t     min_wait_time_us;        ///< Minimum stabilization wait time in microseconds
78 } bsp_feature_acmphs_t;
79 
80 /** ADC MCU specific features. */
81 typedef struct st_bsp_feature_adc
82 {
83     uint8_t     has_sample_hold_reg       : 1;   ///< Whether or not sample and hold registers are present
84     uint8_t     group_b_sensors_allowed   : 1;   ///< Whether or not sensors are allowed on group b
85     uint8_t     sensors_exclusive         : 1;   ///< Whether or not sensors can be used with other sensors/channels
86     uint8_t     tsn_calibration_available : 1;   ///< Identify if the TSN calibration data is available
87     uint8_t     tsn_control_available     : 1;   ///< Identify if the TSN control register is available
88     int16_t     tsn_slope;                     ///< TSN slope in micro-volts/°C
89     uint32_t    sensor_min_sampling_time;      ///< The minimum sampling time required by the on-chip temperature and voltage sensor in nsec
90     uint32_t    clock_source;                  ///< The conversion clock used by the ADC peripheral
91     uint8_t     addition_supported        : 1; ///< Whether addition is supported or not in this MCU
92     uint8_t     calibration_reg_available : 1; ///< Whether CALEXE register is available
93     uint8_t     reference_voltage         : 1 ;///< Whether external or internal ref voltage
94 } bsp_feature_adc_t;
95 
96 /** CAN MCU specific features. */
97 typedef struct st_bsp_feature_can
98 {
99     uint8_t     mclock_only             : 1;   ///< Whether or not MCLK is the only valid clock
100     uint8_t     check_pclkb_ratio       : 1;   ///< Whether clock:PCLKB must be 2:1
101     uint8_t     clock;                         ///< Which clock to compare PCLKB to
102 } bsp_feature_can_t;
103 
104 
105 /** DAC MCU specific features. */
106 typedef struct st_bsp_feature_dac
107 {
108     uint8_t     has_davrefcr            : 1;   ///< Whether or not DAC has DAVREFCR register
109     uint8_t     has_chargepump          : 1;   ///< Whether or not DAC has DAPC register
110 } bsp_feature_dac_t;
111 
112 
113 /** FLASH LP MCU specific features. */
114 typedef struct st_bsp_feature_flash_lp
115 {
116     uint8_t     flash_clock_src;              ///< Source clock for Flash (ie. FCLK or ICLK)
117     uint8_t     flash_cf_macros;              ///< Number of implemented code flash hardware macros
118     uint32_t    cf_macro_size;                ///< The size of the implemented Code Flash macro
119 } bsp_feature_flash_lp;
120 
121 /** FLASH HP MCU specific features. */
122 typedef struct st_bsp_feature_flash_hp
123 {
124     uint8_t     cf_block_size_write;          ///< Code Flash Block size write.
125 } bsp_feature_flash_hp;
126 
127 
128 /** CTSU MCU specific features. */
129 typedef struct st_bsp_feature_ctsu
130 {
131     uint8_t ctsucr0_mask;                      ///< Mask of valid bits in CTSUCR0
132     uint8_t ctsucr1_mask;                      ///< Mask of valid bits in CTSUCR1
133     uint8_t ctsumch0_mask;                     ///< Mask of valid bits in CTSUMCH0
134     uint8_t ctsumch1_mask;                     ///< Mask of valid bits in CTSUMCH1
135     uint8_t ctsuchac_register_count;           ///< Number of CTSUCHAC registers
136     uint8_t ctsuchtrc_register_count;          ///< Number of CTSUCHTRC registers
137 } bsp_feature_ctsu_t;
138 
139 /** I/O port MCU specific features. */
140 typedef struct st_bsp_feature_ioport
141 {
142     uint8_t     has_ethernet            : 1;   ///< Whether or not MCU has Ethernet port configurations
143     uint8_t     has_vbatt_pins          : 1;   ///< Whether or not MCU has pins on vbatt domain
144 } bsp_feature_ioport_t;
145 
146 /** CGC MCU specific features. */
147 typedef struct st_bsp_feature_cgc
148 {
149     uint32_t    high_speed_freq_hz;            ///< Frequency above which high speed mode must be used
150     uint32_t    middle_speed_max_freq_hz;      ///< Max frequency for middle speed, 0 indicates not available
151     uint32_t    low_speed_max_freq_hz;         ///< Max frequency for low speed, 0 indicates not available
152     uint32_t    low_voltage_max_freq_hz;       ///< Max frequency for low voltage, 0 indicates not available
153     uint32_t    low_speed_pclk_div_min;        ///< Minimum divisor for peripheral clocks when using oscillator stop detect
154     uint32_t    low_voltage_pclk_div_min;       ///< Minimum divisor for peripheral clocks when using oscillator stop detect
155     uint32_t    hoco_freq_hz;                  ///< HOCO frequency
156     uint32_t    main_osc_freq_hz;              ///< Main oscillator frequency
157     uint8_t     modrv_mask;                    ///< Mask for MODRV in MOMCR
158     uint8_t     modrv_shift;                   ///< Offset of lowest bit of MODRV in MOMCR
159     uint8_t     sodrv_mask;                    ///< Mask for SODRV in SOMCR
160     uint8_t     sodrv_shift;                   ///< Offset of lowest bit of SODRV in SOMCR
161     uint8_t     pll_div_max;                   ///< Maximum PLL divisor
162     uint8_t     pll_mul_min;                   ///< Minimum PLL multiplier
163     uint8_t     pll_mul_max;                   ///< Maximum PLL multiplier
164     uint8_t     mainclock_drive;               ///< Main clock drive capacity
165     uint32_t    iclk_div                : 4;   ///< ICLK divisor
166     uint32_t    pllccr_type             : 2;   ///< 0: No PLL, 1: PLLCCR, 2: PLLCCR2
167     uint32_t    pll_src_configurable    : 1;   ///< Whether or not PLL clock source is configurable
168     uint32_t    has_subosc_speed        : 1;   ///< Whether or not MCU has subosc speed mode
169     uint32_t    has_lcd_clock           : 1;   ///< Whether or not MCU has LCD clock
170     uint32_t    has_sdram_clock         : 1;   ///< Whether or not MCU has SDRAM clock
171     uint32_t    has_usb_clock_div       : 1;   ///< Whether or not MCU has USB clock divisor
172     uint32_t    has_pclka               : 1;   ///< Whether or not MCU has PCLKA clock
173     uint32_t    has_pclkb               : 1;   ///< Whether or not MCU has PCLKB clock
174     uint32_t    has_pclkc               : 1;   ///< Whether or not MCU has PCLKC clock
175     uint32_t    has_pclkd               : 1;   ///< Whether or not MCU has PCLKD clock
176     uint32_t    has_fclk                : 1;   ///< Whether or not MCU has FCLK clock
177     uint32_t    has_bclk                : 1;   ///< Whether or not MCU has BCLK clock
178     uint32_t    has_sdadc_clock         : 1;   ///< Whether or not MCU has SDADC clock
179 } bsp_feature_cgc_t;
180 
181 /** OPAMP MCU specific features. */
182 typedef struct st_bsp_feature_opamp
183 {
184     uint16_t    min_wait_time_lp_us;           ///< Minimum wait time in low power mode
185     uint16_t    min_wait_time_ms_us;           ///< Minimum wait time in middle speed mode
186     uint16_t    min_wait_time_hs_us;           ///< Minimum wait time in high speed mode
187 } bsp_feature_opamp_t;
188 
189 /** SDHI MCU specific features. */
190 typedef struct st_bsp_feature_sdhi
191 {
192     uint32_t    has_card_detection      : 1;   ///< Whether or not MCU has card detection
193     uint32_t    supports_8_bit_mmc      : 1;   ///< Whether or not MCU supports 8-bit MMC
194     uint32_t    max_clock_frequency;           ///< Maximum clock rate supported by the peripheral
195 } bsp_feature_sdhi_t;
196 
197 /** SSI MCU specific features. */
198 typedef struct st_bsp_feature_ssi
199 {
200     uint8_t     fifo_num_stages;               ///< Number of FIFO stages on this MCU
201 } bsp_feature_ssi_t;
202 
203 /** DMAC MCU specific features. */
204 typedef struct st_bsp_feature_icu
205 {
206     uint8_t     has_ir_flag            : 1;   ///< Whether or not MCU has IR flag in DELSRn register
207 } bsp_feature_icu_t;
208 
209 /** LPMV2 MCU specific features. */
210 typedef struct st_bsp_feature_lpmv2
211 {
212     uint8_t     has_dssby              : 1;   ///< Whether or not MCU has Deep software standby mode
213 }bsp_feature_lpmv2_t;
214 
215 /***********************************************************************************************************************
216 Exported global variables (to be accessed by other files)
217 ***********************************************************************************************************************/
218 /*******************************************************************************************************************//**
219  * Get MCU specific SCI features.
220  * @param[out] p_sci_feature  Pointer to structure to store SCI features.
221  **********************************************************************************************************************/
222 void R_BSP_FeatureSciGet(bsp_feature_sci_t * p_sci_feature);
223 
224 /*******************************************************************************************************************//**
225  * Get MCU specific RSPI features.
226  * @param[out] p_rspi_feature  Pointer to structure to store RSPI features.
227  **********************************************************************************************************************/
228 void R_BSP_FeatureRspiGet(bsp_feature_rspi_t * p_rspi_feature);
229 
230 /*******************************************************************************************************************//**
231  * Get MCU specific LVD features.
232  * @param[out] p_lvd_feature  Pointer to structure to store LVD features.
233  **********************************************************************************************************************/
234 void R_BSP_FeatureLvdGet(bsp_feature_lvd_t * p_lvd_feature);
235 
236 /*******************************************************************************************************************//**
237  * Get MCU specific ACMPHS features
238  * @param[out] p_acmphs_feature  Pointer to structure to store ACMPHS features.
239  **********************************************************************************************************************/
240 void R_BSP_FeatureAcmphsGet(bsp_feature_acmphs_t * p_acmphs_feature);
241 
242 /*******************************************************************************************************************//**
243  * Get MCU specific ADC features
244  * @param[out] p_adc_feature  Pointer to structure to store ADC features.
245  **********************************************************************************************************************/
246 void R_BSP_FeatureAdcGet(bsp_feature_adc_t * p_adc_feature);
247 
248 /*******************************************************************************************************************//**
249  * Get MCU specific CTSU features
250  * @param[out] p_ctsu_feature  Pointer to structure to store CTSU features.
251  **********************************************************************************************************************/
252 void R_BSP_FeatureCtsuGet(bsp_feature_ctsu_t * p_ctsu_feature);
253 
254 /*******************************************************************************************************************//**
255  * Get MCU specific I/O port features
256  * @param[out] p_ioport_feature  Pointer to structure to store I/O port features.
257  **********************************************************************************************************************/
258 void R_BSP_FeatureIoportGet(bsp_feature_ioport_t * p_ioport_feature);
259 
260 /*******************************************************************************************************************//**
261  * Get MCU specific CGC features
262  * @param[out] pp_cgc_feature  Pointer to structure to store pointer to CGC features.
263  **********************************************************************************************************************/
264 void R_BSP_FeatureCgcGet(bsp_feature_cgc_t const ** pp_cgc_feature);
265 
266 /*******************************************************************************************************************//**
267  * Get MCU specific CAN features
268  * @param[out] p_can_feature  Pointer to structure to store CAN features.
269  **********************************************************************************************************************/
270 void R_BSP_FeatureCanGet(bsp_feature_can_t * p_can_feature);
271 
272 /*******************************************************************************************************************//**
273  * Get MCU specific DAC features
274  * @param[out] p_dac_feature  Pointer to structure to store DAC features.
275  **********************************************************************************************************************/
276 void R_BSP_FeatureDacGet(bsp_feature_dac_t * p_dac_feature);
277 
278 /*******************************************************************************************************************//**
279  * Get MCU specific FLASH LP features
280  * @param[out] p_flash_lp_feature  Pointer to structure to store Flash LP features.
281  **********************************************************************************************************************/
282 void R_BSP_FeatureFlashLpGet(bsp_feature_flash_lp * p_flash_lp_feature);
283 
284 /*******************************************************************************************************************//**
285  * Get MCU specific OPAMP features
286  * @param[out] p_opamp_feature  Pointer to structure to store OPAMP features.
287  **********************************************************************************************************************/
288 void R_BSP_FeatureOpampGet(bsp_feature_opamp_t * const p_opamp_feature);
289 
290 /*******************************************************************************************************************//**
291  * Get MCU specific SDHI features
292  * @param[out] p_sdhi_feature  Pointer to structure to store SDHI features.
293  **********************************************************************************************************************/
294 void R_BSP_FeatureSdhiGet(bsp_feature_sdhi_t * p_sdhi_feature);
295 
296 /*******************************************************************************************************************//**
297  * Get MCU specific SSI features
298  * @param[out] p_ssi_feature  Pointer to structure to store SSI features.
299  **********************************************************************************************************************/
300 void R_BSP_FeatureSsiGet(bsp_feature_ssi_t * p_ssi_feature);
301 
302 /*******************************************************************************************************************//**
303  * Get MCU specific DMAC features
304  * @param[out] p_icu_feature  Pointer to structure to store DMAC features.
305  **********************************************************************************************************************/
306 void R_BSP_FeatureICUGet(bsp_feature_icu_t * p_icu_feature);
307 
308 /*******************************************************************************************************************//**
309  * Get MCU specific LPMV2 features
310  * @param[out] p_lpmv2_feature  Pointer to structure to store LPMV2 features.
311  **********************************************************************************************************************/
312 void R_BSP_FeatureLPMV2Get(bsp_feature_lpmv2_t * p_lpmv2_feature);
313 
314 #endif // BSP_FEATURE_H_
315 
316 /** @} (end defgroup BSP_FEATURE) */
317 
318