drv_sdram.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * File : drv_sdram.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2016 RT-Thread Develop Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2016-08-20 xuzhuoyi The first version for STM32F42x
  13. */
  14. /* Define to prevent recursive inclusion -------------------------------------*/
  15. #ifndef __DRV_SDRAM_H
  16. #define __DRV_SDRAM_H
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /* Includes ------------------------------------------------------------------*/
  21. #include <rtthread.h>
  22. #include <board.h>
  23. #define SDRAM_BANK_ADDR ((uint32_t)0XC0000000)
  24. /* #define SDRAM_MEMORY_WIDTH FMC_SDRAM_MEM_BUS_WIDTH_8 */
  25. #define SDRAM_MEMORY_WIDTH FMC_SDRAM_MEM_BUS_WIDTH_16
  26. #define SDCLOCK_PERIOD FMC_SDRAM_CLOCK_PERIOD_2
  27. /* #define SDCLOCK_PERIOD FMC_SDRAM_CLOCK_PERIOD_3 */
  28. #define SDRAM_TIMEOUT ((uint32_t)0xFFFF)
  29. #define SDRAM_MODEREG_BURST_LENGTH_1 ((uint16_t)0x0000)
  30. #define SDRAM_MODEREG_BURST_LENGTH_2 ((uint16_t)0x0001)
  31. #define SDRAM_MODEREG_BURST_LENGTH_4 ((uint16_t)0x0002)
  32. #define SDRAM_MODEREG_BURST_LENGTH_8 ((uint16_t)0x0004)
  33. #define SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL ((uint16_t)0x0000)
  34. #define SDRAM_MODEREG_BURST_TYPE_INTERLEAVED ((uint16_t)0x0008)
  35. #define SDRAM_MODEREG_CAS_LATENCY_2 ((uint16_t)0x0020)
  36. #define SDRAM_MODEREG_CAS_LATENCY_3 ((uint16_t)0x0030)
  37. #define SDRAM_MODEREG_OPERATING_MODE_STANDARD ((uint16_t)0x0000)
  38. #define SDRAM_MODEREG_WRITEBURST_MODE_PROGRAMMED ((uint16_t)0x0000)
  39. #define SDRAM_MODEREG_WRITEBURST_MODE_SINGLE ((uint16_t)0x0200)
  40. #define BUFFER_SIZE ((uint32_t)0x0100)
  41. #define WRITE_READ_ADDR ((uint32_t)0x0800)
  42. #define REFRESH_COUNT ((uint32_t)0x02AB) /* SDRAM refresh counter (90MHz SD clock) */
  43. /**
  44. * @}
  45. */
  46. /** @defgroup STM32429I_DISCO_SDRAM_Exported_Functions
  47. * @{
  48. */
  49. void SDRAM_Init(void);
  50. void SDRAM_GPIOConfig(void);
  51. void SDRAM_InitSequence(void);
  52. void SDRAM_WriteBuffer(uint32_t* pBuffer, uint32_t uwWriteAddress, uint32_t uwBufferSize);
  53. void SDRAM_ReadBuffer(uint32_t* pBuffer, uint32_t uwReadAddress, uint32_t uwBufferSize);
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif