diff --git a/Makefile b/Makefile
index 35f90a8..c9cc5d0 100644
--- a/Makefile
+++ b/Makefile
@@ -62,7 +62,6 @@ PROJECT_INCLUDE_DIRS += $(TICDECODECPP)/include
BSP_ASM_FILES += $(VENDOR_ROOT)/Drivers/CMSIS/Device/ST/STM32F7xx/Source/Templates/gcc/startup_stm32f769xx.s
#BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/CMSIS/Device/ST/STM32F7xx/Source/Templates/system_stm32f7xx.c # We already have a (different) copy in src/
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/BSP/STM32F769I-Discovery/stm32f769i_discovery.c
-BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/BSP/STM32F769I-Discovery/stm32f769i_discovery_audio.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/BSP/STM32F769I-Discovery/stm32f769i_discovery_lcd.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/BSP/STM32F769I-Discovery/stm32f769i_discovery_ts.c
BSP_SRC_FILES += $(VENDOR_ROOT)/Drivers/BSP/STM32F769I-Discovery/stm32f769i_discovery_sd.c
diff --git a/src/hal/Stm32LcdDriver.cpp b/src/hal/Stm32LcdDriver.cpp
index eb42b32..fee0310 100644
--- a/src/hal/Stm32LcdDriver.cpp
+++ b/src/hal/Stm32LcdDriver.cpp
@@ -76,8 +76,9 @@ void HAL_DSI_EndOfRefreshCallback(DSI_HandleTypeDef *hdsi) {
*/
void LTDC_Init(LTDC_HandleTypeDef* hltdc) {
/* DeInit */
+ hltdc->Instance = LTDC;
HAL_LTDC_DeInit(hltdc);
-
+
/* LTDC Config */
/* Timing and polarity */
hltdc->Init.HorizontalSync = HSYNC;
@@ -88,12 +89,12 @@ void LTDC_Init(LTDC_HandleTypeDef* hltdc) {
hltdc->Init.AccumulatedActiveW = HSYNC+HBP+HACT;
hltdc->Init.TotalHeigh = VSYNC+VBP+VACT+VFP;
hltdc->Init.TotalWidth = HSYNC+HBP+HACT+HFP;
-
+
/* background value */
hltdc->Init.Backcolor.Blue = 0;
hltdc->Init.Backcolor.Green = 0;
hltdc->Init.Backcolor.Red = 0;
-
+
/* Polarity */
hltdc->Init.HSPolarity = LTDC_HSPOLARITY_AL;
hltdc->Init.VSPolarity = LTDC_VSPOLARITY_AL;
@@ -115,7 +116,7 @@ void LTDC_Init(LTDC_HandleTypeDef* hltdc) {
* @retval LCD state
*/
static uint8_t LCD_Init(DSI_HandleTypeDef* hdsi, LTDC_HandleTypeDef* hltdc) {
- static DSI_PHY_TimerTypeDef PhyTimings;
+ static DSI_PHY_TimerTypeDef PhyTimings;
static DSI_CmdCfgTypeDef CmdCfg;
static DSI_LPCmdTypeDef LPCmd;
static DSI_PLLInitTypeDef dsiPllInit;
@@ -124,7 +125,7 @@ static uint8_t LCD_Init(DSI_HandleTypeDef* hdsi, LTDC_HandleTypeDef* hltdc) {
/* Toggle Hardware Reset of the DSI LCD using
* its XRES signal (active low) */
BSP_LCD_Reset();
-
+
/* Call first MSP Initialize only in case of first initialization
* This will set IP blocks LTDC, DSI and DMA2D
* - out of reset
@@ -132,7 +133,7 @@ static uint8_t LCD_Init(DSI_HandleTypeDef* hdsi, LTDC_HandleTypeDef* hltdc) {
* - NVIC IRQ related to IP blocks enabled
*/
BSP_LCD_MspInit();
-
+
/* LCD clock configuration */
/* PLLSAI_VCO Input = HSE_VALUE/PLL_M = 1 Mhz */
/* PLLSAI_VCO Output = PLLSAI_VCO Input * PLLSAIN = 417 Mhz */
@@ -143,12 +144,12 @@ static uint8_t LCD_Init(DSI_HandleTypeDef* hdsi, LTDC_HandleTypeDef* hltdc) {
PeriphClkInitStruct.PLLSAI.PLLSAIR = 5;
PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2;
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
-
+
/* Base address of DSI Host/Wrapper registers to be set before calling De-Init */
hdsi->Instance = DSI;
-
+
HAL_DSI_DeInit(hdsi);
-
+
dsiPllInit.PLLNDIV = 100;
dsiPllInit.PLLIDF = DSI_PLL_IN_DIV5;
dsiPllInit.PLLODF = DSI_PLL_OUT_DIV1;
@@ -156,7 +157,7 @@ static uint8_t LCD_Init(DSI_HandleTypeDef* hdsi, LTDC_HandleTypeDef* hltdc) {
hdsi->Init.NumberOfLanes = DSI_TWO_DATA_LANES;
hdsi->Init.TXEscapeCkdiv = 0x4;
HAL_DSI_Init(hdsi, &(dsiPllInit));
-
+
/* Configure the DSI for Command mode */
CmdCfg.VirtualChannelID = 0;
CmdCfg.HSPolarity = DSI_HSYNC_ACTIVE_HIGH;
@@ -170,7 +171,7 @@ static uint8_t LCD_Init(DSI_HandleTypeDef* hdsi, LTDC_HandleTypeDef* hltdc) {
CmdCfg.AutomaticRefresh = DSI_AR_DISABLE;
CmdCfg.TEAcknowledgeRequest = DSI_TE_ACKNOWLEDGE_ENABLE;
HAL_DSI_ConfigAdaptedCommandMode(hdsi, &CmdCfg);
-
+
LPCmd.LPGenShortWriteNoP = DSI_LP_GSW0P_ENABLE;
LPCmd.LPGenShortWriteOneP = DSI_LP_GSW1P_ENABLE;
LPCmd.LPGenShortWriteTwoP = DSI_LP_GSW2P_ENABLE;
@@ -198,12 +199,12 @@ static uint8_t LCD_Init(DSI_HandleTypeDef* hdsi, LTDC_HandleTypeDef* hltdc) {
PhyTimings.DataLaneMaxReadTime = 0;
PhyTimings.StopWaitTime = 10;
HAL_DSI_ConfigPhyTimer(hdsi, &PhyTimings);
-
+
/* Initialize the OTM8009A LCD Display IC Driver (KoD LCD IC Driver)
* depending on configuration set in 'hdsivideo_handle'.
*/
OTM8009A_Init(OTM8009A_COLMOD_RGB888, LCD_ORIENTATION_LANDSCAPE);
-
+
LPCmd.LPGenShortWriteNoP = DSI_LP_GSW0P_DISABLE;
LPCmd.LPGenShortWriteOneP = DSI_LP_GSW1P_DISABLE;
LPCmd.LPGenShortWriteTwoP = DSI_LP_GSW2P_DISABLE;
@@ -216,7 +217,7 @@ static uint8_t LCD_Init(DSI_HandleTypeDef* hdsi, LTDC_HandleTypeDef* hltdc) {
LPCmd.LPDcsShortReadNoP = DSI_LP_DSR0P_DISABLE;
LPCmd.LPDcsLongWrite = DSI_LP_DLW_DISABLE;
HAL_DSI_ConfigCommand(hdsi, &LPCmd);
-
+
HAL_DSI_ConfigFlowControl(hdsi, DSI_FLOW_CONTROL_BTA);
/* Send Display Off DCS Command to display */
@@ -225,11 +226,11 @@ static uint8_t LCD_Init(DSI_HandleTypeDef* hdsi, LTDC_HandleTypeDef* hltdc) {
DSI_DCS_SHORT_PKT_WRITE_P1,
OTM8009A_CMD_DISPOFF,
0x00);
-
+
/* Refresh the display */
HAL_DSI_Refresh(hdsi);
-
- return LCD_OK;
+
+ return LCD_OK;
}
} // extern "C"
@@ -266,16 +267,10 @@ bool Stm32LcdDriver::start() {
this->displayState = SwitchToDraftIsPending;
HAL_DSI_Refresh(&(this->hdsi));
- BSP_LED_On(LED_RED);
- // Currently hanging here...
while (this->displayState == SwitchToDraftIsPending); /* Wait until the LCD displays the draft framebuffer */
- HAL_Delay(250);
- BSP_LED_Off(LED_RED);
- BSP_LED_On(LED_GREEN);
- HAL_Delay(250);
- BSP_LED_Off(LED_GREEN);
+ /* Send Display On DCS Command to display */
HAL_DSI_ShortWrite(&(this->hdsi),
0,
DSI_DCS_SHORT_PKT_WRITE_P1,
diff --git a/src/hal/stm32f4xx_hal_msp.c.old b/src/hal/stm32f4xx_hal_msp.c.old
deleted file mode 100644
index 3e30cea..0000000
--- a/src/hal/stm32f4xx_hal_msp.c.old
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- ******************************************************************************
- * @file LCD_DSI/LCD_DSI_CmdMode_DoubleBuffering/Src/stm32f4xx_hal_msp.c
- * @author MCD Application Team
- * @brief HAL MSP module.
- ******************************************************************************
- * @attention
- *
- * Copyright (c) 2017 STMicroelectronics.
- * All rights reserved.
- *
- * This software is licensed under terms that can be found in the LICENSE file
- * in the root directory of this software component.
- * If no LICENSE file comes with this software, it is provided AS-IS.
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "main.h"
-
-/** @addtogroup STM32F4xx_HAL_Examples
- * @{
- */
-
-/** @defgroup HAL_MSP
- * @brief HAL MSP module.
- * @{
- */
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-/* Private functions ---------------------------------------------------------*/
-
-/** @defgroup HAL_MSP_Private_Functions
- * @{
- */
-
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
diff --git a/src/lcd.c.old b/src/lcd.c.old
deleted file mode 100644
index d5613d6..0000000
--- a/src/lcd.c.old
+++ /dev/null
@@ -1,194 +0,0 @@
-/**
- ******************************************************************************
- * @file BSP/Src/lcd.c
- * @author MCD Application Team
- * @brief This example code shows how to use LCD drawing features.
- ******************************************************************************
- * @attention
- *
- *
© Copyright (c) 2016 STMicroelectronics.
- * All rights reserved.
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "main.h"
-
-/** @addtogroup STM32F7xx_HAL_Examples
- * @{
- */
-
-/** @addtogroup BSP
- * @{
- */
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-#define LCD_FEATURES_NUM 3
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-static uint8_t LCD_Feature = 0;
-/* Private function prototypes -----------------------------------------------*/
-static void LCD_SetHint(void);
-static void LCD_Show_Feature(uint8_t feature);
-/* Private functions ---------------------------------------------------------*/
-
-/**
- * @brief LCD demo
- * @param None
- * @retval None
- */
-void LCD_demo (void)
-{
- LCD_SetHint();
- LCD_Feature = 0;
- LCD_Show_Feature (LCD_Feature);
-
- while (1)
- {
-
- if(CheckForUserInput() > 0)
- {
- if(++LCD_Feature < LCD_FEATURES_NUM)
- {
- LCD_Show_Feature (LCD_Feature);
- }
- else
- {
- return;
- }
- }
- HAL_Delay(100);
- }
-}
-
-/**
- * @brief Display LCD demo hint
- * @param None
- * @retval None
- */
-static void LCD_SetHint(void)
-{
- /* Clear the LCD */
- BSP_LCD_Clear(LCD_COLOR_WHITE);
-
- /* Set LCD Demo description */
- BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
- BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), 80);
- BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
- BSP_LCD_SetBackColor(LCD_COLOR_BLUE);
- BSP_LCD_SetFont(&Font24);
- BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"LCD", CENTER_MODE);
- BSP_LCD_SetFont(&Font12);
- BSP_LCD_DisplayStringAt(0, 30, (uint8_t *)"This example shows the different", CENTER_MODE);
- BSP_LCD_DisplayStringAt(0, 45, (uint8_t *)"LCD Features, use User button to display", CENTER_MODE);
- BSP_LCD_DisplayStringAt(0, 60, (uint8_t *)"next page", CENTER_MODE);
-
- /* Set the LCD Text Color */
- BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
- BSP_LCD_DrawRect(10, 90, BSP_LCD_GetXSize() - 20, BSP_LCD_GetYSize()- 100);
- BSP_LCD_DrawRect(11, 91, BSP_LCD_GetXSize() - 22, BSP_LCD_GetYSize()- 102);
- }
-
-/**
- * @brief Show LCD Features
- * @param feature : feature index
- * @retval None
- */
-static void LCD_Show_Feature(uint8_t feature)
-{
- Point Points[]= {{20, 150}, {80, 150}, {80, 200}};
- Point Points2[3];
-
- Points2[0].X = BSP_LCD_GetXSize() - 80;
- Points2[0].Y = 150;
- Points2[1].X = BSP_LCD_GetXSize() - 20;
- Points2[1].Y = 150;
- Points2[2].X = BSP_LCD_GetXSize() - 20;
- Points2[2].Y = 200;
-
- BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
- BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
- BSP_LCD_FillRect(12, 92, BSP_LCD_GetXSize() - 24, BSP_LCD_GetYSize()- 104);
- BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
-
- switch (feature)
- {
- case 0:
- /* Text Feature */
-
- BSP_LCD_DisplayStringAt(14, 100, (uint8_t *)"Left aligned Text", LEFT_MODE);
- BSP_LCD_DisplayStringAt(0, 115, (uint8_t *)"Center aligned Text", CENTER_MODE);
- BSP_LCD_DisplayStringAt(14, 130, (uint8_t*)"Right aligned Text", RIGHT_MODE);
- BSP_LCD_SetFont(&Font24);
- BSP_LCD_DisplayStringAt(14, 180, (uint8_t *)"Font24", LEFT_MODE);
- BSP_LCD_SetFont(&Font20);
- BSP_LCD_DisplayStringAt(BSP_LCD_GetXSize()/2 -20, 180, (uint8_t *)"Font20", LEFT_MODE);
- BSP_LCD_SetFont(&Font16);
- BSP_LCD_DisplayStringAt(BSP_LCD_GetXSize() - 80, 184, (uint8_t *)"Font16", LEFT_MODE);
- break;
-
- case 1:
-
- /* Draw misc. Shapes */
- BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
- BSP_LCD_DrawRect(20, 100, 60 , 40);
- BSP_LCD_FillRect(100, 100, 60 , 40);
-
- BSP_LCD_SetTextColor(LCD_COLOR_GRAY);
- BSP_LCD_DrawCircle(BSP_LCD_GetXSize() - 120, 120, 20);
- BSP_LCD_FillCircle(BSP_LCD_GetXSize() - 40, 120, 20);
-
- BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
- BSP_LCD_DrawPolygon(Points, 3);
-
- BSP_LCD_SetTextColor(LCD_COLOR_RED);
- BSP_LCD_DrawEllipse(130, 170, 30, 20);
- BSP_LCD_FillEllipse(200, 170, 30, 20);
-
- BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
- BSP_LCD_DrawHLine(20, BSP_LCD_GetYSize() - 30, BSP_LCD_GetXSize() / 5);
- BSP_LCD_DrawLine (100, BSP_LCD_GetYSize() - 20, 230, BSP_LCD_GetYSize()- 50);
- BSP_LCD_DrawLine (100, BSP_LCD_GetYSize()- 50, 230, BSP_LCD_GetYSize()- 20);
-
- BSP_LCD_SetTextColor(LCD_COLOR_GREEN);
- BSP_LCD_FillPolygon(Points2, 3);
- break;
-
- case 2:
- /* Draw Bitmap */
- BSP_LCD_DrawBitmap(20, 100, (uint8_t *)stlogo);
- HAL_Delay(500);
-
- BSP_LCD_DrawBitmap(BSP_LCD_GetXSize()/2 - 40, 100, (uint8_t *)stlogo);
- HAL_Delay(500);
-
- BSP_LCD_DrawBitmap(BSP_LCD_GetXSize()-100, 100, (uint8_t *)stlogo);
- HAL_Delay(500);
-
- BSP_LCD_DrawBitmap(20, BSP_LCD_GetYSize()- 80, (uint8_t *)stlogo);
- HAL_Delay(500);
-
- BSP_LCD_DrawBitmap(BSP_LCD_GetXSize()/2 - 40, BSP_LCD_GetYSize()- 80, (uint8_t *)stlogo);
- HAL_Delay(500);
-
- BSP_LCD_DrawBitmap(BSP_LCD_GetXSize()-100, BSP_LCD_GetYSize()- 80, (uint8_t *)stlogo);
- HAL_Delay(500);
- break;
- }
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/src/sdram.c.old b/src/sdram.c.old
deleted file mode 100644
index 82af8e5..0000000
--- a/src/sdram.c.old
+++ /dev/null
@@ -1,289 +0,0 @@
-/**
- ******************************************************************************
- * @file BSP/Src/sdram.c
- * @author MCD Application Team
- * @brief This example code shows how to use the SDRAM Driver
- ******************************************************************************
- * @attention
- *
- * © Copyright (c) 2016 STMicroelectronics.
- * All rights reserved.
- *
- * This software component is licensed by ST under BSD 3-Clause license,
- * the "License"; You may not use this file except in compliance with the
- * License. You may obtain a copy of the License at:
- * opensource.org/licenses/BSD-3-Clause
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "main.h"
-
-/** @addtogroup STM32F7xx_HAL_Examples
- * @{
- */
-
-/** @addtogroup BSP
- * @{
- */
-
-/* Private typedef -----------------------------------------------------------*/
-/* Private define ------------------------------------------------------------*/
-#define BUFFER_SIZE ((uint32_t)0x0100)
-#define WRITE_READ_ADDR ((uint32_t)0x0800)
-
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Buffer location should aligned to cache line size (32 bytes) */
-ALIGN_32BYTES (uint32_t sdram_aTxBuffer[BUFFER_SIZE]);
-ALIGN_32BYTES (uint32_t sdram_aRxBuffer[BUFFER_SIZE]);
-/* Private function prototypes -----------------------------------------------*/
-static void SDRAM_SetHint(void);
-static void SDRAM_DMA_SetHint(void);
-static void Fill_Buffer(uint32_t *pBuffer, uint32_t uwBufferLenght, uint32_t uwOffset);
-static uint8_t Buffercmp(uint32_t* pBuffer1, uint32_t* pBuffer2, uint16_t BufferLength);
-/* Private functions ---------------------------------------------------------*/
-
-/**
- * @brief SDRAM Demo
- * @param None
- * @retval None
- */
-void SDRAM_demo (void)
-{
- SDRAM_SetHint();
-
- /* SDRAM device configuration */
- if(BSP_SDRAM_Init() != SDRAM_OK)
- {
- BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SDRAM Initialization : FAILED.", LEFT_MODE);
- BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SDRAM Test Aborted.", LEFT_MODE);
- }
- else
- {
- BSP_LCD_DisplayStringAt(20, 100, (uint8_t *)"SDRAM Initialization : OK.", LEFT_MODE);
- }
- /* Fill the buffer to write */
- Fill_Buffer(sdram_aTxBuffer, BUFFER_SIZE, 0xA244250F);
-
- /* Write data to the SDRAM memory */
- if(BSP_SDRAM_WriteData(SDRAM_WRITE_READ_ADDR + WRITE_READ_ADDR, sdram_aTxBuffer, BUFFER_SIZE) != SDRAM_OK)
- {
- BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SDRAM WRITE : FAILED.", LEFT_MODE);
- BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SDRAM Test Aborted.", LEFT_MODE);
- }
- else
- {
- BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SDRAM WRITE : OK.", LEFT_MODE);
- }
-
- /* Read back data from the SDRAM memory */
- if(BSP_SDRAM_ReadData(SDRAM_WRITE_READ_ADDR + WRITE_READ_ADDR, sdram_aRxBuffer, BUFFER_SIZE) != SDRAM_OK)
- {
- BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SDRAM READ : FAILED.", LEFT_MODE);
- BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SDRAM Test Aborted.", LEFT_MODE);
- }
- else
- {
- BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SDRAM READ : OK.", LEFT_MODE);
- }
-
- if(Buffercmp(sdram_aTxBuffer, sdram_aRxBuffer, BUFFER_SIZE) > 0)
- {
- BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SDRAM COMPARE : FAILED.", LEFT_MODE);
- BSP_LCD_DisplayStringAt(20, 160, (uint8_t *)"SDRAM Test Aborted.", LEFT_MODE);
- }
- else
- {
- BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SDRAM Test : OK.", LEFT_MODE);
- }
-
- while (1)
- {
- if(CheckForUserInput() > 0)
- {
- return;
- }
- }
-}
-
-/**
- * @brief SDRAM DMA Demo
- * @param None
- * @retval None
- */
-void SDRAM_DMA_demo (void)
-{
-
- SDRAM_DMA_SetHint();
-
- /* SDRAM device configuration */
- if(BSP_SDRAM_Init() != SDRAM_OK)
- {
- BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SDRAM Initialization : FAILED.", LEFT_MODE);
- BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SDRAM Test Aborted.", LEFT_MODE);
- }
- else
- {
- BSP_LCD_DisplayStringAt(20, 100, (uint8_t *)"SDRAM Initialization : OK.", LEFT_MODE);
- }
- /* Fill the buffer to write */
- Fill_Buffer(sdram_aTxBuffer, BUFFER_SIZE, 0xA244250F);
-
- /* Write data to the SDRAM memory */
- if(BSP_SDRAM_WriteData_DMA(SDRAM_WRITE_READ_ADDR + WRITE_READ_ADDR, sdram_aTxBuffer, BUFFER_SIZE) != SDRAM_OK)
- {
- BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SDRAM WRITE : FAILED.", LEFT_MODE);
- BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SDRAM Test Aborted.", LEFT_MODE);
- }
- else
- {
- BSP_LCD_DisplayStringAt(20, 115, (uint8_t *)"SDRAM WRITE : OK.", LEFT_MODE);
- }
-
- /* Read back data from the SDRAM memory */
- if(BSP_SDRAM_ReadData_DMA(SDRAM_WRITE_READ_ADDR + WRITE_READ_ADDR, sdram_aRxBuffer, BUFFER_SIZE) != SDRAM_OK)
- {
- BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SDRAM READ : FAILED.", LEFT_MODE);
- BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SDRAM Test Aborted.", LEFT_MODE);
- }
- else
- {
- BSP_LCD_DisplayStringAt(20, 130, (uint8_t *)"SDRAM READ : OK.", LEFT_MODE);
- }
-
- if(Buffercmp(sdram_aTxBuffer, sdram_aRxBuffer, BUFFER_SIZE) > 0)
- {
- BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SDRAM COMPARE : FAILED.", LEFT_MODE);
- BSP_LCD_DisplayStringAt(20, 160, (uint8_t *)"SDRAM Test Aborted.", LEFT_MODE);
- }
- else
- {
- BSP_LCD_DisplayStringAt(20, 145, (uint8_t *)"SDRAM Test : OK.", LEFT_MODE);
- }
-
- while (1)
- {
- if(CheckForUserInput() > 0)
- {
- SdramTest = 0;
- return;
- }
- }
-}
-
-/**
- * @brief Display SDRAM Demo Hint
- * @param None
- * @retval None
- */
-static void SDRAM_SetHint(void)
-{
- /* Clear the LCD */
- BSP_LCD_Clear(LCD_COLOR_WHITE);
-
- /* Set LCD Demo description */
- BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
- BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), 80);
- BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
- BSP_LCD_SetBackColor(LCD_COLOR_BLUE);
- BSP_LCD_SetFont(&Font24);
- BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"SDRAM", CENTER_MODE);
- BSP_LCD_SetFont(&Font12);
- BSP_LCD_DisplayStringAt(0, 30, (uint8_t *)"This example shows how to write", CENTER_MODE);
- BSP_LCD_DisplayStringAt(0, 45, (uint8_t *)"and read data on SDRAM", CENTER_MODE);
-
- /* Set the LCD Text Color */
- BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
- BSP_LCD_DrawRect(10, 90, BSP_LCD_GetXSize() - 20, BSP_LCD_GetYSize()- 100);
- BSP_LCD_DrawRect(11, 91, BSP_LCD_GetXSize() - 22, BSP_LCD_GetYSize()- 102);
-
- BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
- BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
- }
-
-/**
- * @brief Display SDRAM DMA Demo Hint
- * @param None
- * @retval None
- */
-static void SDRAM_DMA_SetHint(void)
-{
- /* Clear the LCD */
- BSP_LCD_Clear(LCD_COLOR_WHITE);
-
- /* Set LCD Demo description */
- BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
- BSP_LCD_FillRect(0, 0, BSP_LCD_GetXSize(), 80);
- BSP_LCD_SetTextColor(LCD_COLOR_WHITE);
- BSP_LCD_SetBackColor(LCD_COLOR_BLUE);
- BSP_LCD_SetFont(&Font24);
- BSP_LCD_DisplayStringAt(0, 0, (uint8_t *)"SDRAM DMA", CENTER_MODE);
- BSP_LCD_SetFont(&Font12);
- BSP_LCD_DisplayStringAt(0, 30, (uint8_t *)"This example shows how to write", CENTER_MODE);
- BSP_LCD_DisplayStringAt(0, 45, (uint8_t *)"and read data on SDRAM in DMA mode", CENTER_MODE);
-
- /* Set the LCD Text Color */
- BSP_LCD_SetTextColor(LCD_COLOR_BLUE);
- BSP_LCD_DrawRect(10, 90, BSP_LCD_GetXSize() - 20, BSP_LCD_GetYSize()- 100);
- BSP_LCD_DrawRect(11, 91, BSP_LCD_GetXSize() - 22, BSP_LCD_GetYSize()- 102);
-
- BSP_LCD_SetTextColor(LCD_COLOR_BLACK);
- BSP_LCD_SetBackColor(LCD_COLOR_WHITE);
- }
-
-/**
- * @brief Fills buffer with user predefined data.
- * @param pBuffer: pointer on the buffer to fill
- * @param uwBufferLenght: size of the buffer to fill
- * @param uwOffset: first value to fill on the buffer
- * @retval None
- */
-static void Fill_Buffer(uint32_t *pBuffer, uint32_t uwBufferLenght, uint32_t uwOffset)
-{
- uint32_t tmpIndex = 0;
-
- /* Put in global buffer different values */
- for (tmpIndex = 0; tmpIndex < uwBufferLenght; tmpIndex++ )
- {
- pBuffer[tmpIndex] = tmpIndex + uwOffset;
- }
-
- /* Clean Data Cache to update the content of the SRAM */
- SCB_CleanDCache_by_Addr((uint32_t*)pBuffer, uwBufferLenght*4);
-}
-
-/**
- * @brief Compares two buffers.
- * @param pBuffer1, pBuffer2: buffers to be compared.
- * @param BufferLength: buffer's length
- * @retval 1: pBuffer identical to pBuffer1
- * 0: pBuffer differs from pBuffer1
- */
-static uint8_t Buffercmp(uint32_t* pBuffer1, uint32_t* pBuffer2, uint16_t BufferLength)
-{
- /* Invalidate Data Cache to get the updated content of the SRAM*/
- SCB_InvalidateDCache_by_Addr((uint32_t *)pBuffer2, BufferLength*4);
-
- while (BufferLength--)
- {
- if (*pBuffer1 != *pBuffer2)
- {
- return 1;
- }
-
- pBuffer1++;
- pBuffer2++;
- }
-
- return 0;
-}
-/**
- * @}
- */
-
-/**
- * @}
- */
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/src/stm32f4xx_it.c.old b/src/stm32f4xx_it.c.old
deleted file mode 100644
index 7e22ac6..0000000
--- a/src/stm32f4xx_it.c.old
+++ /dev/null
@@ -1,187 +0,0 @@
-/**
- ******************************************************************************
- * @file LCD_DSI/LCD_DSI_CmdMode_DoubleBuffering/Src/stm32f4xx_it.c
- * @author MCD Application Team
- * @brief Main Interrupt Service Routines.
- * This file provides template for all exceptions handler and
- * peripherals interrupt service routine.
- ******************************************************************************
- * @attention
- *
- * Copyright (c) 2017 STMicroelectronics.
- * All rights reserved.
- *
- * This software is licensed under terms that can be found in the LICENSE file
- * in the root directory of this software component.
- * If no LICENSE file comes with this software, it is provided AS-IS.
- *
- ******************************************************************************
- */
-
-/* Includes ------------------------------------------------------------------*/
-#include "main.h"
-#include "stm32f4xx_it.h"
-
-/** @addtogroup STM32F4xx_HAL_Examples
- * @{
- */
-
-/** @addtogroup LCD_DSI_Video_OneLayer
- * @{
- */
-
-/* Private typedef -----------------------------------------------------------*/
-LTDC_HandleTypeDef* get_hltdc(void); // C-linkage exported getter for hltdc handler
-DSI_HandleTypeDef* get_hdsi(void); // C-linkage exported getter for hdsi handler
-/* Private define ------------------------------------------------------------*/
-/* Private macro -------------------------------------------------------------*/
-/* Private variables ---------------------------------------------------------*/
-/* Private function prototypes -----------------------------------------------*/
-extern UART_HandleTypeDef* get_huart6(void);
-/* Private functions ---------------------------------------------------------*/
-
-/******************************************************************************/
-/* Cortex-M4 Processor Exceptions Handlers */
-/******************************************************************************/
-
-/**
- * @brief This function handles NMI exception.
- * @param None
- * @retval None
- */
-void NMI_Handler(void)
-{
-}
-
-/**
- * @brief This function handles Hard Fault exception.
- * @param None
- * @retval None
- */
-void HardFault_Handler(void)
-{
- /* Go to infinite loop when Hard Fault exception occurs */
- while (1)
- {
- }
-}
-
-/**
- * @brief This function handles Memory Manage exception.
- * @param None
- * @retval None
- */
-void MemManage_Handler(void)
-{
- /* Go to infinite loop when Memory Manage exception occurs */
- while (1)
- {
- }
-}
-
-/**
- * @brief This function handles Bus Fault exception.
- * @param None
- * @retval None
- */
-void BusFault_Handler(void)
-{
- /* Go to infinite loop when Bus Fault exception occurs */
- while (1)
- {
- }
-}
-
-/**
- * @brief This function handles Usage Fault exception.
- * @param None
- * @retval None
- */
-void UsageFault_Handler(void)
-{
- /* Go to infinite loop when Usage Fault exception occurs */
- while (1)
- {
- }
-}
-
-/**
- * @brief This function handles SVCall exception.
- * @param None
- * @retval None
- */
-void SVC_Handler(void)
-{
-}
-
-/**
- * @brief This function handles Debug Monitor exception.
- * @param None
- * @retval None
- */
-void DebugMon_Handler(void)
-{
-}
-
-/**
- * @brief This function handles PendSVC exception.
- * @param None
- * @retval None
- */
-void PendSV_Handler(void)
-{
-}
-
-/**
- * @brief This function handles SysTick Handler.
- * @param None
- * @retval None
- */
-void SysTick_Handler(void)
-{
- HAL_IncTick();
-}
-
-/******************************************************************************/
-/* STM32F4xx Peripherals Interrupt Handlers */
-/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
-/* available peripheral interrupt handler's name please refer to the startup */
-/* file (startup_stm32f4xx.s). */
-/******************************************************************************/
-
-/**
- * @brief This function handles USART1 global interrupt.
- */
-void USART6_IRQHandler(void)
-{
- UART_HandleTypeDef* huart6_ptr = get_huart6();
- HAL_UART_IRQHandler(huart6_ptr);
-}
-
-/**
- * @brief This function handles LTDC interrupt request.
- * @param None
- * @retval None
- */
-void LTDC_IRQHandler(void)
-{
- HAL_LTDC_IRQHandler(get_hltdc());
-}
-
-/**
- * @brief This function handles DSI Handler.
- * @param None
- * @retval None
- */
-void DSI_IRQHandler(void)
-{
- HAL_DSI_IRQHandler(get_hdsi());
-}
-
-/**
- * @}
- */
-
-/**
- * @}
- */
diff --git a/src/system_stm32f4xx.c.old b/src/system_stm32f4xx.c.old
deleted file mode 100644
index cf8ea07..0000000
--- a/src/system_stm32f4xx.c.old
+++ /dev/null
@@ -1,433 +0,0 @@
-/**
- ******************************************************************************
- * @file system_stm32f4xx.c
- * @author MCD Application Team
- * @brief CMSIS Cortex-M4 Device Peripheral Access Layer System Source File.
- *
- * This file provides two functions and one global variable to be called from
- * user application:
- * - SystemInit(): This function is called at startup just after reset and
- * before branch to main program. This call is made inside
- * the "startup_stm32f4xx.s" file.
- *
- * - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
- * by the user application to setup the SysTick
- * timer or configure other parameters.
- *
- * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
- * be called whenever the core clock is changed
- * during program execution.
- *
- *
- ******************************************************************************
- * @attention
- *
- * Copyright (c) 2017 STMicroelectronics.
- * All rights reserved.
- *
- * This software is licensed under terms that can be found in the LICENSE file
- * in the root directory of this software component.
- * If no LICENSE file comes with this software, it is provided AS-IS.
- *
- ******************************************************************************
- */
-
-/** @addtogroup CMSIS
- * @{
- */
-
-/** @addtogroup stm32f4xx_system
- * @{
- */
-
-/** @addtogroup STM32F4xx_System_Private_Includes
- * @{
- */
-
-
-#include "stm32f4xx.h"
-
-#if !defined (HSE_VALUE)
-#if defined(USE_STM32469I_DISCO_REVA)
- #define HSE_VALUE ((uint32_t)25000000) /*!< Default value of the External oscillator in Hz */
-#else
- #define HSE_VALUE ((uint32_t)8000000) /*!< Default value of the External oscillator in Hz */
-#endif /* USE_STM32469I_DISCO_REVA */
-#endif /* HSE_VALUE */
-
-#if !defined (HSI_VALUE)
- #define HSI_VALUE ((uint32_t)16000000) /*!< Value of the Internal oscillator in Hz*/
-#endif /* HSI_VALUE */
-
-/**
- * @}
- */
-
-/** @addtogroup STM32F4xx_System_Private_TypesDefinitions
- * @{
- */
-
-/**
- * @}
- */
-
-/** @addtogroup STM32F4xx_System_Private_Defines
- * @{
- */
-
-/************************* Miscellaneous Configuration ************************/
-/*!< Uncomment the following line if you need to use external SDRAM mounted
- on DK as data memory */
-/* #define DATA_IN_ExtSDRAM */
-
-/*!< Uncomment the following line if you need to relocate your vector Table in
- Internal SRAM. */
-/* #define VECT_TAB_SRAM */
-#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field.
- This value must be a multiple of 0x200. */
-/******************************************************************************/
-
-/**
- * @}
- */
-
-/** @addtogroup STM32F4xx_System_Private_Macros
- * @{
- */
-
-/**
- * @}
- */
-
-/** @addtogroup STM32F4xx_System_Private_Variables
- * @{
- */
- /* This variable is updated in three ways:
- 1) by calling CMSIS function SystemCoreClockUpdate()
- 2) by calling HAL API function HAL_RCC_GetHCLKFreq()
- 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
- Note: If you use this function to configure the system clock; then there
- is no need to call the 2 first functions listed above, since SystemCoreClock
- variable is updated automatically.
- */
-uint32_t SystemCoreClock = 16000000;
-const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9};
-const uint8_t APBPrescTable[8] = {0, 0, 0, 0, 1, 2, 3, 4};
-/**
- * @}
- */
-
-/** @addtogroup STM32F4xx_System_Private_FunctionPrototypes
- * @{
- */
-
-#if defined (DATA_IN_ExtSDRAM)
- static void SystemInit_ExtMemCtl(void);
-#endif /* DATA_IN_ExtSDRAM */
-
-/**
- * @}
- */
-
-/** @addtogroup STM32F4xx_System_Private_Functions
- * @{
- */
-
-/**
- * @brief Setup the microcontroller system
- * Initialize the FPU setting, vector table location and External memory
- * configuration.
- * @param None
- * @retval None
- */
-void SystemInit(void)
-{
- /* FPU settings ------------------------------------------------------------*/
- #if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
- SCB->CPACR |= ((3UL << 10*2)|(3UL << 11*2)); /* set CP10 and CP11 Full Access */
- #endif
- /* Reset the RCC clock configuration to the default reset state ------------*/
- /* Set HSION bit */
- RCC->CR |= (uint32_t)0x00000001;
-
- /* Reset CFGR register */
- RCC->CFGR = 0x00000000;
-
- /* Reset HSEON, CSSON and PLLON bits */
- RCC->CR &= (uint32_t)0xFEF6FFFF;
-
- /* Reset PLLCFGR register */
- RCC->PLLCFGR = 0x24003010;
-
- /* Reset HSEBYP bit */
- RCC->CR &= (uint32_t)0xFFFBFFFF;
-
- /* Disable all interrupts */
- RCC->CIR = 0x00000000;
-
-#if defined (DATA_IN_ExtSDRAM)
- SystemInit_ExtMemCtl();
-#endif /* DATA_IN_ExtSDRAM */
-
- /* Configure the Vector Table location add offset address ------------------*/
-#ifdef VECT_TAB_SRAM
- SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
-#else
- SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
-#endif
-}
-
-/**
- * @brief Update SystemCoreClock variable according to Clock Register Values.
- * The SystemCoreClock variable contains the core clock (HCLK), it can
- * be used by the user application to setup the SysTick timer or configure
- * other parameters.
- *
- * @note Each time the core clock (HCLK) changes, this function must be called
- * to update SystemCoreClock variable value. Otherwise, any configuration
- * based on this variable will be incorrect.
- *
- * @note - The system frequency computed by this function is not the real
- * frequency in the chip. It is calculated based on the predefined
- * constant and the selected clock source:
- *
- * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
- *
- * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
- *
- * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
- * or HSI_VALUE(*) multiplied/divided by the PLL factors.
- *
- * (*) HSI_VALUE is a constant defined in stm32f4xx_hal_conf.h file (default value
- * 16 MHz) but the real value may vary depending on the variations
- * in voltage and temperature.
- *
- * (**) HSE_VALUE is a constant defined in stm32f4xx_hal_conf.h file (its value
- * depends on the application requirements), user has to ensure that HSE_VALUE
- * is same as the real frequency of the crystal used. Otherwise, this function
- * may have wrong result.
- *
- * - The result of this function could be not correct when using fractional
- * value for HSE crystal.
- *
- * @param None
- * @retval None
- */
-void SystemCoreClockUpdate(void)
-{
- uint32_t tmp = 0, pllvco = 0, pllp = 2, pllsource = 0, pllm = 2;
-
- /* Get SYSCLK source -------------------------------------------------------*/
- tmp = RCC->CFGR & RCC_CFGR_SWS;
-
- switch (tmp)
- {
- case 0x00: /* HSI used as system clock source */
- SystemCoreClock = HSI_VALUE;
- break;
- case 0x04: /* HSE used as system clock source */
- SystemCoreClock = HSE_VALUE;
- break;
- case 0x08: /* PLL used as system clock source */
-
- /* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N
- SYSCLK = PLL_VCO / PLL_P
- */
- pllsource = (RCC->PLLCFGR & RCC_PLLCFGR_PLLSRC) >> 22;
- pllm = RCC->PLLCFGR & RCC_PLLCFGR_PLLM;
-
- if (pllsource != 0)
- {
- /* HSE used as PLL clock source */
- pllvco = (HSE_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
- }
- else
- {
- /* HSI used as PLL clock source */
- pllvco = (HSI_VALUE / pllm) * ((RCC->PLLCFGR & RCC_PLLCFGR_PLLN) >> 6);
- }
-
- pllp = (((RCC->PLLCFGR & RCC_PLLCFGR_PLLP) >>16) + 1 ) *2;
- SystemCoreClock = pllvco/pllp;
- break;
- default:
- SystemCoreClock = HSI_VALUE;
- break;
- }
- /* Compute HCLK frequency --------------------------------------------------*/
- /* Get HCLK prescaler */
- tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> 4)];
- /* HCLK frequency */
- SystemCoreClock >>= tmp;
-}
-
-#if defined (DATA_IN_ExtSDRAM)
-/**
- * @brief Setup the external memory controller.
- * Called in startup_stm32f4xx.s before jump to main.
- * This function configures the external memories (SRAM/SDRAM)
- * This SRAM/SDRAM will be used as program data memory (including heap and stack).
- * @param None
- * @retval None
- */
-void SystemInit_ExtMemCtl(void)
-{
- register uint32_t tmpreg = 0, timeout = 0xFFFF;
- register __IO uint32_t index;
-
- /* Enable GPIOC, GPIOD, GPIOE, GPIOF, GPIOG, GPIOH, and GPIOI interface
- clock */
- RCC->AHB1ENR |= 0x000001FC;
-
- /* Connect PCx pins to FMC Alternate function */
- GPIOC->AFR[0] = 0x0000000C;
- GPIOC->AFR[1] = 0x00000000;
- /* Configure PCx pins in Alternate function mode */
- GPIOC->MODER = 0x00000002;
- /* Configure PCx pins speed to 100 MHz */
- GPIOC->OSPEEDR = 0x00000003;
- /* Configure PCx pins Output type to push-pull */
- GPIOC->OTYPER = 0x00000000;
- /* No pull-up, pull-down for PCx pins */
- GPIOC->PUPDR = 0x00000000;
-
- /* Connect PDx pins to FMC Alternate function */
- GPIOD->AFR[0] = 0x000000CC;
- GPIOD->AFR[1] = 0xCC000CCC;
- /* Configure PDx pins in Alternate function mode */
- GPIOD->MODER = 0xA02A000A;
- /* Configure PDx pins speed to 100 MHz */
- GPIOD->OSPEEDR = 0xF03F000F;
- /* Configure PDx pins Output type to push-pull */
- GPIOD->OTYPER = 0x00000000;
- /* No pull-up, pull-down for PDx pins */
- GPIOD->PUPDR = 0x00000000;
-
- /* Connect PEx pins to FMC Alternate function */
- GPIOE->AFR[0] = 0xC00000CC;
- GPIOE->AFR[1] = 0xCCCCCCCC;
- /* Configure PEx pins in Alternate function mode */
- GPIOE->MODER = 0xAAAA800A;
- /* Configure PEx pins speed to 100 MHz */
- GPIOE->OSPEEDR = 0xFFFFC00F;
- /* Configure PEx pins Output type to push-pull */
- GPIOE->OTYPER = 0x00000000;
- /* No pull-up, pull-down for PEx pins */
- GPIOE->PUPDR = 0x00000000;
-
- /* Connect PFx pins to FMC Alternate function */
- GPIOF->AFR[0] = 0x00CCCCCC;
- GPIOF->AFR[1] = 0xCCCCC000;
- /* Configure PFx pins in Alternate function mode */
- GPIOF->MODER = 0xAA800AAA;
- /* Configure PFx pins speed to 100 MHz */
- GPIOF->OSPEEDR = 0xFFC00FFF;
- /* Configure PFx pins Output type to push-pull */
- GPIOF->OTYPER = 0x00000000;
- /* No pull-up, pull-down for PFx pins */
- GPIOF->PUPDR = 0x00000000;
-
- /* Connect PGx pins to FMC Alternate function */
- GPIOG->AFR[0] = 0x00CC00CC;
- GPIOG->AFR[1] = 0xC000000C;
- /* Configure PGx pins in Alternate function mode */
- GPIOG->MODER = 0x80020A0A;
- /* Configure PGx pins speed to 100 MHz */
- GPIOG->OSPEEDR = 0xC0030F0F;
- /* Configure PGx pins Output type to push-pull */
- GPIOG->OTYPER = 0x00000000;
- /* No pull-up, pull-down for PGx pins */
- GPIOG->PUPDR = 0x00000000;
-
- /* Connect PHx pins to FMC Alternate function */
- GPIOH->AFR[0] = 0x0000CC00;
- GPIOH->AFR[1] = 0xCCCCCCCC;
- /* Configure PHx pins in Alternate function mode */
- GPIOH->MODER = 0xAAAA00A0;
- /* Configure PHx pins speed to 100 MHz */
- GPIOH->OSPEEDR = 0xFFFF00F0;
- /* Configure PHx pins Output type to push-pull */
- GPIOH->OTYPER = 0x00000000;
- /* No pull-up, pull-down for PHx pins */
- GPIOH->PUPDR = 0x00000000;
-
- /* Connect PIx pins to FMC Alternate function */
- GPIOI->AFR[0] = 0xCCCCCCCC;
- GPIOI->AFR[1] = 0x00000CC0;
- /* Configure PIx pins in Alternate function mode */
- GPIOI->MODER = 0x0028AAAA;
- /* Configure PIx pins speed to 100 MHz */
- GPIOI->OSPEEDR = 0x003CFFFF;
- /* Configure PIx pins Output type to push-pull */
- GPIOI->OTYPER = 0x00000000;
- /* No pull-up, pull-down for PIx pins */
- GPIOI->PUPDR = 0x00000000;
-
- /* FMC Configuration */
- /* Enable the FMC interface clock */
- RCC->AHB3ENR |= 0x00000001;
-
- /* Configure and enable SDRAM bank2 */
- FMC_Bank5_6->SDCR[0] = 0x000019E4;
- FMC_Bank5_6->SDTR[0] = 0x01115351;
-
- /* SDRAM initialization sequence */
- /* Clock enable command */
- FMC_Bank5_6->SDCMR = 0x00000011;
- tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
- while((tmpreg != 0) && (timeout-- > 0))
- {
- tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
- }
-
- /* Delay */
- for (index = 0; index<1000; index++);
-
- /* PALL command */
- FMC_Bank5_6->SDCMR = 0x00000012;
- tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
- timeout = 0xFFFF;
- while((tmpreg != 0) && (timeout-- > 0))
- {
- tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
- }
-
- /* Auto refresh command */
- FMC_Bank5_6->SDCMR = 0x000000F3;
- tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
- timeout = 0xFFFF;
- while((tmpreg != 0) && (timeout-- > 0))
- {
- tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
- }
-
- /* MRD register program */
- FMC_Bank5_6->SDCMR = 0x00046014;
- tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
- timeout = 0xFFFF;
- while((tmpreg != 0) && (timeout-- > 0))
- {
- tmpreg = FMC_Bank5_6->SDSR & 0x00000020;
- }
-
- /* Set refresh count */
- tmpreg = FMC_Bank5_6->SDRTR;
- FMC_Bank5_6->SDRTR = (tmpreg | (0x0000056A<<1));
-
- /* Disable write protection */
- tmpreg = FMC_Bank5_6->SDCR[0];
- FMC_Bank5_6->SDCR[0] = (tmpreg & 0xFFFFFDFF);
-}
-#endif /* DATA_IN_ExtSDRAM */
-
-/**
- * @}
- */
-
-/**
- * @}
- */
-
-/**
- * @}
- */