targets/TARGET_STM/TARGET_STM32G4/flash_api.c
/**
  * @brief  Gets the bank of a given address
  * @param  Addr: Address of the FLASH Memory
  * @retval The bank of a given address
  */
@brief  Gets the bank of a given address
@param  Addr: Address of the FLASH Memory
@retval The bank of a given address
@brief Gets the bank of a given address @param Addr : Address of the FLASH Memory @retval The bank of a given address
static uint32_t GetBank(uint32_t Addr)
{
    uint32_t bank = 0;
#if defined(SYSCFG_MEMRMP_FB_MODE) && defined(FLASH_OPTR_DBANK)
    if (READ_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_FB_MODE) == 0) {
        if (Addr < (FLASH_BASE + FLASH_BANK_SIZE)) {
            bank = FLASH_BANK_1;
        } else {
            bank = FLASH_BANK_2;
        }
    } else {
        if (Addr < (FLASH_BASE + FLASH_BANK_SIZE)) {
            bank = FLASH_BANK_2;
        } else {
            bank = FLASH_BANK_1;
        }
    }
#else
    bank = FLASH_BANK_1;
#endif
    return bank;
}
static uint32_t GetBank ( uint32_t Addr ) { uint32_t bank = 0 ; #if defined ( SYSCFG_MEMRMP_FB_MODE ) && defined ( FLASH_OPTR_DBANK ) if ( READ_BIT ( SYSCFG -> MEMRMP , SYSCFG_MEMRMP_FB_MODE ) == 0 ) { if ( Addr < ( FLASH_BASE + FLASH_BANK_SIZE ) ) { bank = FLASH_BANK_1 ; } else { bank = FLASH_BANK_2 ; } } else { if ( Addr < ( FLASH_BASE + FLASH_BANK_SIZE ) ) { bank = FLASH_BANK_2 ; } else { bank = FLASH_BANK_1 ; } } #else bank = FLASH_BANK_1 ; #endif return bank ; }
@brief  Gets the bank of a given address
 @param  Addr: Address of the FLASH Memory
 @retval The bank of a given address
@brief Gets the bank of a given address @param Addr : Address of the FLASH Memory @retval The bank of a given address
/* No Bank swap */ /* Bank swap */