1 /* 2 * Copyright (c) 2020 - 2024 Renesas Electronics Corporation and/or its affiliates 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 /*********************************************************************************************************************** 8 * Includes <System Includes> , "Project Includes" 9 **********************************************************************************************************************/ 10 #include "bsp_api.h" 11 12 /*********************************************************************************************************************** 13 * Macro definitions 14 **********************************************************************************************************************/ 15 #define BSP_SLAVE_STOP_SSTPCR_OFFSET_MASK (0xFFFFU << 16U) 16 #define BSP_SLAVE_STOP_REQ_POS_MASK (0xFFU << 8U) 17 #define BSP_SLAVE_STOP_ACK_POS_MASK (0xFFU) 18 19 /*********************************************************************************************************************** 20 * Typedef definitions 21 **********************************************************************************************************************/ 22 23 /*********************************************************************************************************************** 24 * Exported global variables (to be accessed by other files) 25 **********************************************************************************************************************/ 26 27 /*********************************************************************************************************************** 28 * Private global variables and functions 29 **********************************************************************************************************************/ 30 31 /*******************************************************************************************************************//** 32 * @addtogroup BSP_MCU 33 * 34 * @{ 35 **********************************************************************************************************************/ 36 #if BSP_FEATURE_BSP_SLAVE_STOP_SUPPORTED 37 38 /*******************************************************************************************************************//** 39 * Change the bus slaves from bus stop to normal operation in order to access to the AXI-type slave I/F safely 40 * 41 * @param[in] bus_slave to be released from bus stop state. 42 **********************************************************************************************************************/ R_BSP_SlaveStopRelease(bsp_bus_slave_t bus_slave)43void R_BSP_SlaveStopRelease (bsp_bus_slave_t bus_slave) 44 { 45 uint32_t req_pos; 46 uint32_t req_bit_msk; 47 uint32_t ack_pos; 48 uint32_t ack_bit_msk; 49 volatile uint32_t * p_reg; 50 51 p_reg = (uint32_t *) &R_SSC->SSTPCR4 + ((bus_slave & BSP_SLAVE_STOP_SSTPCR_OFFSET_MASK) >> 16U); 52 req_pos = (bus_slave & BSP_SLAVE_STOP_REQ_POS_MASK) >> 8U; 53 req_bit_msk = 1U << req_pos; 54 *p_reg &= ~req_bit_msk; 55 56 ack_pos = (bus_slave & BSP_SLAVE_STOP_ACK_POS_MASK); 57 ack_bit_msk = 1U << ack_pos; 58 59 FSP_HARDWARE_REGISTER_WAIT((*p_reg & ack_bit_msk) >> ack_pos, 0); 60 } 61 62 /*******************************************************************************************************************//** 63 * Stop the access to the bus slaves 64 * 65 * @param[in] bus_slave to be stoped 66 **********************************************************************************************************************/ R_BSP_SlaveStop(bsp_bus_slave_t bus_slave)67void R_BSP_SlaveStop (bsp_bus_slave_t bus_slave) 68 { 69 uint32_t req_pos; 70 uint32_t req_bit_msk; 71 uint32_t ack_pos; 72 uint32_t ack_bit_msk; 73 volatile uint32_t * p_reg; 74 75 p_reg = (uint32_t *) &R_SSC->SSTPCR4 + ((bus_slave & BSP_SLAVE_STOP_SSTPCR_OFFSET_MASK) >> 16U); 76 req_pos = (bus_slave & BSP_SLAVE_STOP_REQ_POS_MASK) >> 8U; 77 req_bit_msk = 1U << req_pos; 78 *p_reg |= req_bit_msk; 79 80 ack_pos = (bus_slave & BSP_SLAVE_STOP_ACK_POS_MASK); 81 ack_bit_msk = 1U << ack_pos; 82 83 FSP_HARDWARE_REGISTER_WAIT((*p_reg & ack_bit_msk) >> ack_pos, 1); 84 } 85 86 #endif 87 88 /** @} (end addtogroup BSP_MCU) */ 89