Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions drivers/ra/README
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ License Link:
https://opensource.org/licenses/BSD-3-Clause

Patch List:
Remove the DTC setting override in SCI B UART
Impacted files:
drivers/ra/fsp/src/r_sci_b_uart/r_sci_b_uart.c

* Remove the DTC setting override in SCI B UART
Impacted files:
drivers/ra/fsp/src/r_sci_b_uart/r_sci_b_uart.c

* Remove the DTC setting override in SCI UART
Impacted files:
drivers/ra/fsp/src/r_sci_uart/r_sci_uart.c
18,012 changes: 18,012 additions & 0 deletions drivers/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/R7FA2L1AB.h

Large diffs are not rendered by default.

23,151 changes: 23,151 additions & 0 deletions drivers/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/R7FA4E2B9.h

Large diffs are not rendered by default.

20,093 changes: 20,093 additions & 0 deletions drivers/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/R7FA4M1AB.h

Large diffs are not rendered by default.

21,176 changes: 21,176 additions & 0 deletions drivers/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/R7FA4M2AD.h

Large diffs are not rendered by default.

21,312 changes: 21,312 additions & 0 deletions drivers/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/R7FA4M3AF.h

Large diffs are not rendered by default.

19,825 changes: 19,825 additions & 0 deletions drivers/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/R7FA4W1AD.h

Large diffs are not rendered by default.

21,823 changes: 21,823 additions & 0 deletions drivers/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/R7FA6E10F.h

Large diffs are not rendered by default.

23,439 changes: 23,439 additions & 0 deletions drivers/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/R7FA6E2BB.h

Large diffs are not rendered by default.

22,426 changes: 22,426 additions & 0 deletions drivers/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/R7FA6M1AD.h

Large diffs are not rendered by default.

25,410 changes: 25,410 additions & 0 deletions drivers/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/R7FA6M2AF.h

Large diffs are not rendered by default.

29,045 changes: 29,045 additions & 0 deletions drivers/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/R7FA6M3AH.h

Large diffs are not rendered by default.

24,430 changes: 24,430 additions & 0 deletions drivers/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/R7FA6M4AF.h

Large diffs are not rendered by default.

28,410 changes: 28,410 additions & 0 deletions drivers/ra/fsp/src/bsp/cmsis/Device/RENESAS/Include/R7FA6M5BH.h

Large diffs are not rendered by default.

632 changes: 632 additions & 0 deletions drivers/ra/fsp/src/bsp/mcu/ra2l1/bsp_elc.h

Large diffs are not rendered by default.

441 changes: 441 additions & 0 deletions drivers/ra/fsp/src/bsp/mcu/ra2l1/bsp_feature.h

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions drivers/ra/fsp/src/bsp/mcu/ra2l1/bsp_feature_gen.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
*
* SPDX-License-Identifier: BSD-3-Clause
*/

#ifndef BSP_FEATURE_GEN_H
#define BSP_FEATURE_GEN_H

/***********************************************************************************************************************
* Includes <System Includes> , "Project Includes"
**********************************************************************************************************************/

/***********************************************************************************************************************
* Macro definitions
**********************************************************************************************************************/

/***********************************************************************************************************************
* Typedef definitions
**********************************************************************************************************************/

/***********************************************************************************************************************
* Exported global variables (to be accessed by other files)
**********************************************************************************************************************/

/***********************************************************************************************************************
* Private global variables and functions
**********************************************************************************************************************/

// *UNCRUSTIFY-OFF*
#define BSP_FEATURE_GPT_AD_DIRECT_START_CHANNEL_MASK (0)
#define BSP_FEATURE_GPT_AD_DIRECT_START_SUPPORTED (0)
#define BSP_FEATURE_GPT_GPTE_CHANNEL_MASK (0)
#define BSP_FEATURE_GPT_GPTE_SUPPORTED (0)
#define BSP_FEATURE_GPT_GPTEH_CHANNEL_MASK (0)
#define BSP_FEATURE_GPT_GPTEH_SUPPORTED (0)
#define BSP_FEATURE_GPT_OPS_CHANNEL_MASK (0)
#define BSP_FEATURE_GPT_OPS_SUPPORTED (0)
// *UNCRUSTIFY-ON*
#endif
45 changes: 45 additions & 0 deletions drivers/ra/fsp/src/bsp/mcu/ra2l1/bsp_mcu_info.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
*
* SPDX-License-Identifier: BSD-3-Clause
*/

/*******************************************************************************************************************//**
* @ingroup BSP_MCU
* @defgroup BSP_MCU_RA2L1 RA2L1
* @includedoc config_bsp_ra2l1_fsp.html
* @{
**********************************************************************************************************************/

#ifndef BSP_MCU_INFO_H
#define BSP_MCU_INFO_H

/***********************************************************************************************************************
* Includes <System Includes> , "Project Includes"
**********************************************************************************************************************/

/* BSP MCU Specific Includes. */
#include "bsp_elc.h"
#include "bsp_feature.h"
#include "bsp_power.h"

/***********************************************************************************************************************
* Macro definitions
**********************************************************************************************************************/

/***********************************************************************************************************************
* Typedef definitions
**********************************************************************************************************************/
typedef icu_event_t bsp_interrupt_event_t;

/***********************************************************************************************************************
* Exported global variables
**********************************************************************************************************************/

/***********************************************************************************************************************
* Exported global functions (to be accessed by other files)
**********************************************************************************************************************/

#endif

/** @} (end defgroup BSP_MCU_RA2L1) */
156 changes: 156 additions & 0 deletions drivers/ra/fsp/src/bsp/mcu/ra2l1/bsp_power.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
/*
* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
*
* SPDX-License-Identifier: BSD-3-Clause
*/

/***********************************************************************************************************************
* Includes <System Includes> , "Project Includes"
**********************************************************************************************************************/
#include <stdint.h>
#include "bsp_api.h"

#if BSP_PRV_POWER_USE_DCDC

/***********************************************************************************************************************
* Macro definitions
**********************************************************************************************************************/
#define BSP_PRV_LDO_STABILIZATION_TIME_US (60U)

/***********************************************************************************************************************
* Typedef definitions
**********************************************************************************************************************/

/***********************************************************************************************************************
* Switch from DCDC to LDO. Requires LPM register protection and interrupts to be disabled.
*
* This function follows the procedure given in the RA2L1 User's Manual (R01UH0853EJ0100) Section 10.5.1 (4) "Switching
* from High-speed/Middle-speed mode (DCDC power mode) to High-speed/Middle-speed mode (LDO power mode)"
**********************************************************************************************************************/
static inline void bsp_power_dcdc_disable (bsp_power_mode_t mode)
{
/* Save all module stop bits, then stop all peripherals. */
uint32_t mstpcrb = R_MSTP->MSTPCRB;
R_MSTP->MSTPCRB = UINT32_MAX;
uint32_t mstpcrc = R_MSTP->MSTPCRC;
R_MSTP->MSTPCRC = UINT32_MAX;
uint32_t mstpcrd = R_MSTP->MSTPCRD;
R_MSTP->MSTPCRD = UINT32_MAX;

/* Switch to LDO. */
R_SYSTEM->DCDCCTL = (uint8_t) mode;

/* Wait for LDO to stabilize. */
R_BSP_SoftwareDelay(BSP_PRV_LDO_STABILIZATION_TIME_US, BSP_DELAY_UNITS_MICROSECONDS);

/* Restore all module stop bits. */
R_MSTP->MSTPCRB = mstpcrb;
R_MSTP->MSTPCRC = mstpcrc;
R_MSTP->MSTPCRD = mstpcrd;
}

/***********************************************************************************************************************
* Switch from LDO to DCDC. Requires LPM register protection and interrupts to be disabled.
*
* This function follows the procedure given in the RA2L1 User's Manual (R01UH0853EJ0100) Section 10.5.1 (3) "Switching
* from the High-Speed/Middle-Speed mode (LDO power mode) to the High-speed/Middle speed mode (DCDC power mode)"
**********************************************************************************************************************/
static inline void bsp_power_dcdc_enable (void)
{
/* Enable DCDC IO buffer. */
uint8_t dcdcctl = R_SYSTEM->DCDCCTL | R_SYSTEM_DCDCCTL_STOPZA_Msk;
R_SYSTEM->DCDCCTL = dcdcctl;

/* Turn on DCDC Vref. */
R_SYSTEM->DCDCCTL = dcdcctl & (uint8_t) (~R_SYSTEM_DCDCCTL_PD_Msk);

/* Wait for Vref to stabilize. */
R_BSP_SoftwareDelay(10, BSP_DELAY_UNITS_MICROSECONDS);

/* Switch DCDC Vref to low-power mode. */
R_SYSTEM->DCDCCTL = 0x10;

/* Wait for Vref to stabilize. */
R_BSP_SoftwareDelay(10, BSP_DELAY_UNITS_MICROSECONDS);

/* Turn off LDO and turn on DCDC. */
R_SYSTEM->DCDCCTL = 0x11;

/* Wait for DCDC to stabilize. */
R_BSP_SoftwareDelay(2, BSP_DELAY_UNITS_MICROSECONDS);

/* Enable DCDC overcurrent protection. */
R_SYSTEM->DCDCCTL = 0x13;
}

/*******************************************************************************************************************//**
* @addtogroup BSP_MCU_RA2L1
* @{
**********************************************************************************************************************/

/*******************************************************************************************************************//**
* Select either the LDO or DCDC regulator and/or update the MCU supply voltage range. Returns the previously selected
* mode.
*
* @note DCDC mode has the following limitations:
* - Supply voltage must be 2.4V or greater
* - Low- and Subosc-speed modes are not available
* - Software Standby is not available
* Ensure these limitations are respected before entering DCDC mode. If supply voltage may drop below 2.4V during
* operation, configure a LVD channel to interrupt or reset the MCU near this threshold to switch back to the LDO.
*
* @note Switching to DCDC mode temporarily disables all interrupts and blocks for 22 microseconds; switching to LDO
* from DCDC temporarily disables all peripherals and interrupts and blocks for 60 microseconds.
*
* @note If the supply voltage falls outside the range originally specified when starting the DCDC regulator, call this
* function again with the updated supply voltage.
*
* @return The previously selected power mode.
**********************************************************************************************************************/
bsp_power_mode_t R_BSP_PowerModeSet (bsp_power_mode_t mode)
{
/* Get current mode to return to caller. */
bsp_power_mode_t previous_mode = R_SYSTEM->DCDCCTL & R_SYSTEM_DCDCCTL_DCDCON_Msk ?
(bsp_power_mode_t) R_SYSTEM->VCCSEL : BSP_POWER_MODE_LDO;

/* Enable writing to Low Power Mode registers. */
R_BSP_RegisterProtectDisable(BSP_REG_PROTECT_OM_LPC_BATT);

/* Set VCCSEL if a DCDC mode is selected. */
bool dcdc_mode = mode < BSP_POWER_MODE_LDO;
if (dcdc_mode)
{
/* Set supply voltage range. */
R_SYSTEM->VCCSEL = (uint8_t) mode;
}

/* Only change mode if the specified mode is not already set. */
if (dcdc_mode != (previous_mode < BSP_POWER_MODE_LDO))
{
/* Enter critical section to prevent any peripheral or power mode changes while transitioning. */
FSP_CRITICAL_SECTION_DEFINE;
FSP_CRITICAL_SECTION_ENTER;

if (mode >= BSP_POWER_MODE_LDO)
{
bsp_power_dcdc_disable(mode);
}
else
{
bsp_power_dcdc_enable();
}

FSP_CRITICAL_SECTION_EXIT;
}

/* Disable writing to Low Power Mode registers. */
R_BSP_RegisterProtectEnable(BSP_REG_PROTECT_OM_LPC_BATT);

return previous_mode;
}

/*******************************************************************************************************************//**
* @} (end addtogroup BSP_MCU_RA2L1)
**********************************************************************************************************************/

#endif /* BSP_PRV_POWER_USE_DCDC */
61 changes: 61 additions & 0 deletions drivers/ra/fsp/src/bsp/mcu/ra2l1/bsp_power.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
* Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates
*
* SPDX-License-Identifier: BSD-3-Clause
*/

#ifndef BSP_POWER_H
#define BSP_POWER_H

/** Common macro for FSP header files. There is also a corresponding FSP_FOOTER macro at the end of this file. */
FSP_HEADER

/*******************************************************************************************************************//**
* @addtogroup BSP_MCU_RA2L1
* @{
**********************************************************************************************************************/

/***********************************************************************************************************************
* Macro definitions
**********************************************************************************************************************/
#if BSP_FEATURE_BSP_HAS_DCDC_REGULATOR
#define BSP_PRV_POWER_USE_DCDC (BSP_CFG_DCDC_ENABLE)
#else
#define BSP_PRV_POWER_USE_DCDC (0)
#endif

#define BSP_PRV_POWER_DCDC_DISABLE (0)
#define BSP_PRV_POWER_DCDC_MANUAL (1)
#define BSP_PRV_POWER_DCDC_STARTUP (2)

/***********************************************************************************************************************
* Typedef definitions
**********************************************************************************************************************/

/** Voltage regulator mode */
typedef enum e_bsp_power_mode_t
{
BSP_POWER_MODE_DCDC_2V4_TO_2V7 = 3, ///< DCDC mode; 2.4V to 2.7V supply
BSP_POWER_MODE_DCDC_2V7_TO_3V6 = 0, ///< DCDC mode; 2.7V to 3.6V supply
BSP_POWER_MODE_DCDC_3V6_TO_4V5 = 1, ///< DCDC mode; 3.6V to 4.5V supply
BSP_POWER_MODE_DCDC_4V5_TO_5V5 = 2, ///< DCDC mode; 4.5V to 5.5V supply

BSP_POWER_MODE_LDO = 0x90, ///< LDO mode
BSP_POWER_MODE_LDO_BOOST = 0xB0 // Alternate DCDCCTL value for entering subclock and low-power modes
// (see RA2L1 User's Manual (R01UH0853EJ0100) Section 10.5.1 (5))
} bsp_power_mode_t;

/***********************************************************************************************************************
* Exported global functions (to be accessed by other files)
**********************************************************************************************************************/

bsp_power_mode_t R_BSP_PowerModeSet(bsp_power_mode_t mode);

/*******************************************************************************************************************//**
* @} (end addtogroup BSP_MCU_RA2L1)
**********************************************************************************************************************/

/** Common macro for FSP header files. There is also a corresponding FSP_HEADER macro at the top of this file. */
FSP_FOOTER

#endif
Loading