rt-thread-official/bsp/swm320/libraries/SWM320_StdPeriph_Driver/SWM320_sdram.h

82 lines
2.3 KiB
C
Raw Normal View History

2021-02-18 13:29:12 +08:00
#ifndef __SWM320_SDRAM_H__
#define __SWM320_SDRAM_H__
2021-05-06 10:42:41 +08:00
typedef struct
{
uint8_t CellSize; // SDRAM颗粒的容量SDRAM_CELLSIZE_16Mb、SDRAM_CELLSIZE_64Mb、SDRAM_CELLSIZE_128Mb、SDRAM_CELLSIZE_256Mb
uint8_t CellBank; // SDRAM颗粒有几个bankSDRAM_CELLBANK_2、SDRAM_CELLBANK_4
uint8_t CellWidth; // SDRAM颗粒的位宽SDRAM_CELLWIDTH_16、SDRAM_CELLWIDTH_32
uint8_t CASLatency; // 列地址到有效数据输出间隔SDRAM_CASLATENCY_2、SDRAM_CASLATENCY_3
uint8_t TimeTMRD; // MRS to New Command
uint8_t TimeTRRD; // Activate to activate on different banks
uint8_t TimeTRAS; // Self refresh time最小Self-refresh周期
uint8_t TimeTRC; // Row cycle delayRefresh命令到Activate命令间延时也是两个连续Refresh命令间延时
uint8_t TimeTRCD; // Row to column delay行地址到列地址间延时也即Activate命令到读写命令间延时
uint8_t TimeTRP; // Row precharge delayPrecharge命令到另一个命令间延时
2021-02-18 13:29:12 +08:00
} SDRAM_InitStructure;
2021-05-06 10:42:41 +08:00
#define SDRAM_CELLSIZE_16Mb 3
#define SDRAM_CELLSIZE_64Mb 0
#define SDRAM_CELLSIZE_128Mb 1
#define SDRAM_CELLSIZE_256Mb 2
#define SDRAM_CELLBANK_2 0
#define SDRAM_CELLBANK_4 1
#define SDRAM_CELLWIDTH_16 0
#define SDRAM_CELLWIDTH_32 1
#define SDRAM_CASLATENCY_2 2
#define SDRAM_CASLATENCY_3 3
#define SDRAM_TMRD_3 3
#define SDRAM_TMRD_4 4
#define SDRAM_TMRD_5 5
#define SDRAM_TMRD_6 6
#define SDRAM_TMRD_7 7
#define SDRAM_TRRD_2 2
#define SDRAM_TRRD_3 3
#define SDRAM_TRAS_2 2
#define SDRAM_TRAS_3 3
#define SDRAM_TRAS_4 4
#define SDRAM_TRAS_5 5
#define SDRAM_TRAS_6 6
#define SDRAM_TRAS_7 7
#define SDRAM_TRC_2 2
#define SDRAM_TRC_3 3
#define SDRAM_TRC_4 4
#define SDRAM_TRC_5 5
#define SDRAM_TRC_6 6
#define SDRAM_TRC_7 7
#define SDRAM_TRC_8 8
#define SDRAM_TRC_9 9
#define SDRAM_TRC_10 10
#define SDRAM_TRC_11 11
#define SDRAM_TRC_12 12
#define SDRAM_TRC_13 13
#define SDRAM_TRC_14 14
#define SDRAM_TRC_15 15
#define SDRAM_TRCD_3 3
#define SDRAM_TRCD_4 4
#define SDRAM_TRCD_5 5
#define SDRAM_TRCD_6 6
#define SDRAM_TRCD_7 7
#define SDRAM_TRP_3 3
#define SDRAM_TRP_4 4
#define SDRAM_TRP_5 5
#define SDRAM_TRP_6 6
#define SDRAM_TRP_7 7
void SDRAM_Init(SDRAM_InitStructure *initStruct);
2021-02-18 13:29:12 +08:00
void SDRAM_Enable(void);
void SDRAM_Disable(void);
#endif //__SWM320_SDRAM_H__