KugleFirmware/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_flash.c
/**
  * @brief  Set the specific FLASH error flag.
  * @retval None
  */
@brief  Set the specific FLASH error flag.
@retval None
@brief Set the specific FLASH error flag . @retval None
static void FLASH_SetErrorCode(uint32_t Bank)
{  
  pFlash.ErrorCode = HAL_FLASH_ERROR_NONE;
  if(Bank == FLASH_BANK_1)
  {
    if(__HAL_FLASH_GET_FLAG_BANK1(FLASH_FLAG_WRPERR_BANK1))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_WRP_BANK1;
    }
    if(__HAL_FLASH_GET_FLAG_BANK1(FLASH_FLAG_PGSERR_BANK1))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_PGS_BANK1;
    }
    if(__HAL_FLASH_GET_FLAG_BANK1(FLASH_FLAG_STRBER_BANK1R))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_STRB_BANK1;
    }
    if(__HAL_FLASH_GET_FLAG_BANK1(FLASH_FLAG_INCERR_BANK1))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_INC_BANK1;
    }
    if(__HAL_FLASH_GET_FLAG_BANK1(FLASH_FLAG_OPERR_BANK1))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_OPE_BANK1;
    }
    if(__HAL_FLASH_GET_FLAG_BANK1(FLASH_FLAG_RDPERR_BANK1))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_RDP_BANK1;
    }
    if(__HAL_FLASH_GET_FLAG_BANK1(FLASH_FLAG_RDSERR_BANK1))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_RDS_BANK1;
    }
    if(__HAL_FLASH_GET_FLAG_BANK1(FLASH_FLAG_SNECCE_BANK1RR))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_SNECC_BANK1;
    }
    if(__HAL_FLASH_GET_FLAG_BANK1(FLASH_FLAG_DBECCE_BANK1RR))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_DBECC_BANK1;
    }  
  }
  else if(Bank == FLASH_BANK_2)
  {
    if(__HAL_FLASH_GET_FLAG_BANK2(FLASH_FLAG_WRPERR_BANK2))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_WRP_BANK2;
    }
    if(__HAL_FLASH_GET_FLAG_BANK2(FLASH_FLAG_PGSERR_BANK2))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_PGS_BANK2;
    }
    if(__HAL_FLASH_GET_FLAG_BANK2(FLASH_FLAG_STRBER_BANK2R))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_STRB_BANK2;
    }
    if(__HAL_FLASH_GET_FLAG_BANK2(FLASH_FLAG_INCERR_BANK2))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_INC_BANK2;
    }
    if(__HAL_FLASH_GET_FLAG_BANK2(FLASH_FLAG_OPERR_BANK2))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_OPE_BANK2;
    }
    if(__HAL_FLASH_GET_FLAG_BANK1(FLASH_FLAG_RDPERR_BANK2))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_RDP_BANK2;
    }
    if(__HAL_FLASH_GET_FLAG_BANK1(FLASH_FLAG_RDSERR_BANK2))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_RDS_BANK2;
    }
    if(__HAL_FLASH_GET_FLAG_BANK1(FLASH_FLAG_SNECCE_BANK2RR))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_SNECC_BANK2;
    }
    if(__HAL_FLASH_GET_FLAG_BANK2(FLASH_FLAG_DBECCE_BANK2RR))
    {
      pFlash.ErrorCode |= HAL_FLASH_ERROR_DBECC_BANK2;
    }  
  }
}
static void FLASH_SetErrorCode ( uint32_t Bank ) { pFlash . ErrorCode = HAL_FLASH_ERROR_NONE ; if ( Bank == FLASH_BANK_1 ) { if ( __HAL_FLASH_GET_FLAG_BANK1 ( FLASH_FLAG_WRPERR_BANK1 ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_WRP_BANK1 ; } if ( __HAL_FLASH_GET_FLAG_BANK1 ( FLASH_FLAG_PGSERR_BANK1 ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_PGS_BANK1 ; } if ( __HAL_FLASH_GET_FLAG_BANK1 ( FLASH_FLAG_STRBER_BANK1R ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_STRB_BANK1 ; } if ( __HAL_FLASH_GET_FLAG_BANK1 ( FLASH_FLAG_INCERR_BANK1 ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_INC_BANK1 ; } if ( __HAL_FLASH_GET_FLAG_BANK1 ( FLASH_FLAG_OPERR_BANK1 ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_OPE_BANK1 ; } if ( __HAL_FLASH_GET_FLAG_BANK1 ( FLASH_FLAG_RDPERR_BANK1 ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_RDP_BANK1 ; } if ( __HAL_FLASH_GET_FLAG_BANK1 ( FLASH_FLAG_RDSERR_BANK1 ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_RDS_BANK1 ; } if ( __HAL_FLASH_GET_FLAG_BANK1 ( FLASH_FLAG_SNECCE_BANK1RR ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_SNECC_BANK1 ; } if ( __HAL_FLASH_GET_FLAG_BANK1 ( FLASH_FLAG_DBECCE_BANK1RR ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_DBECC_BANK1 ; } } else if ( Bank == FLASH_BANK_2 ) { if ( __HAL_FLASH_GET_FLAG_BANK2 ( FLASH_FLAG_WRPERR_BANK2 ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_WRP_BANK2 ; } if ( __HAL_FLASH_GET_FLAG_BANK2 ( FLASH_FLAG_PGSERR_BANK2 ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_PGS_BANK2 ; } if ( __HAL_FLASH_GET_FLAG_BANK2 ( FLASH_FLAG_STRBER_BANK2R ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_STRB_BANK2 ; } if ( __HAL_FLASH_GET_FLAG_BANK2 ( FLASH_FLAG_INCERR_BANK2 ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_INC_BANK2 ; } if ( __HAL_FLASH_GET_FLAG_BANK2 ( FLASH_FLAG_OPERR_BANK2 ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_OPE_BANK2 ; } if ( __HAL_FLASH_GET_FLAG_BANK1 ( FLASH_FLAG_RDPERR_BANK2 ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_RDP_BANK2 ; } if ( __HAL_FLASH_GET_FLAG_BANK1 ( FLASH_FLAG_RDSERR_BANK2 ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_RDS_BANK2 ; } if ( __HAL_FLASH_GET_FLAG_BANK1 ( FLASH_FLAG_SNECCE_BANK2RR ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_SNECC_BANK2 ; } if ( __HAL_FLASH_GET_FLAG_BANK2 ( FLASH_FLAG_DBECCE_BANK2RR ) ) { pFlash . ErrorCode |= HAL_FLASH_ERROR_DBECC_BANK2 ; } } }
@brief  Set the specific FLASH error flag.
@brief Set the specific FLASH error flag .