📄 csl_emiffaux.h
字号:
#ifndef _CSL_EMIFFAUX_H
#define _CSL_EMIFFAUX_H
#include <cslr_emiff.h>
#include <csl_emiff.h>
#ifdef __cplusplus
extern "C" {
#endif
static inline
void
CSL_emiffSendSdramCommand (
CSL_EmiffHandle hEmiff,
CSL_EmiffSdramCmd cmd
)
{
/* Send manual command to SDRAM by writing into MCR */
hEmiff->regs->MCR = cmd & 0xf ;
}
static inline
void
CSL_emiffDeepPowerDownEnable (
CSL_EmiffHandle hEmiff
)
{
/* Local copy of Configuration Register */
register Uint32 _emiff_cr;
/* Local copy of Configuration Register2 */
register Uint32 _emiff_cr2;
/* Set EMIFF for deep sleep entry (deep power down mode)*/
/* Read the register value to the local copy */
_emiff_cr = hEmiff->regs->CR;
_emiff_cr2 = hEmiff->regs->CR2;
/* Disable clock to External SDRAM */
CSL_FINS(_emiff_cr,EMIFF_CR_CLK, CSL_EMIFF_SDRAMCLOCKEN_DISABLE);
/* Put the SDRAM into power down mode */
CSL_FINS(_emiff_cr,EMIFF_CR_PWD, CSL_EMIFF_SDRAMPWRDOWNEN_ENABLE);
/* Put SDRAM in self refresh mode. Call the function again with
EMIFF_SDRAM_CONFIG_SELFREFRESH_DISABLE command to get it out of
self refresh mode. */
CSL_FINS(_emiff_cr,EMIFF_CR_SLRF, CSL_EMIFF_SDRAMSELFREFRESHEN_ENABLE);
/* Place the SDRAM into self refresh when in standby mode */
CSL_FINS(_emiff_cr2,EMIFF_CR2_RFSTDBY, CSL_EMIFF_SDRAMSELFREFRESHSTANDBY_YES);
/* Enable auto clock mode(suspend internal clocks when idle) */
CSL_FINS(_emiff_cr2,EMIFF_CR2_AUTOCLK, CSL_EMIFF_SDRAMAUTOCLOCKEN_ENABLE);
/* Write the value of local copy into the register */
hEmiff->regs->CR = _emiff_cr ;
hEmiff->regs->CR2 = _emiff_cr2 ;
}
static inline
void
CSL_emiffGetAbortStatus (
CSL_EmiffHandle hEmiff,
CSL_EmiffAbortStatus * pAbortStatus
)
{
/* Local copy of ATR */
register Uint32 _emiff_atr;
/* Get Abort Address */
pAbortStatus->abortAddress = (Uint32)hEmiff->regs->AAR;
/* Read the register value to the local copy */
_emiff_atr = hEmiff->regs->ATR;
/* Get Host Id of Aborted Transaction */
pAbortStatus->abortHostId = (Uint16)CSL_FEXT(_emiff_atr,EMIFF_ATR_HOSTID);
/* Abort flag is 1 if Abort has occured */
pAbortStatus->abortFlag = (Bool)CSL_FEXT(_emiff_atr,EMIFF_ATR_ABFLAG);
}
static inline
void
CSL_emiffGetDllStatus (
CSL_EmiffHandle hEmiff,
CSL_EmiffDllStatus * pDllStatus
)
{
/* Local copy of DURDSR */
register Uint32 _emiff_durdsr;
/* Local copy of DLRDSR */
register Uint32 _emiff_dlrdsr;
/* Local copy of DWRTSR */
register Uint32 _emiff_dwrtsr;
/* Read the register value to the local copy */
_emiff_durdsr = hEmiff->regs->DURDSR;
_emiff_dlrdsr = hEmiff->regs->DLRDSR;
_emiff_dwrtsr = hEmiff->regs->DWRTSR;
/* Get DLL counter value for Upper Read Byte */
pDllStatus->dllUrdCount = CSL_FEXT(_emiff_durdsr,EMIFF_DURDSR_DLLCNT);
/* Get DLL lock status for Upper Read Byte */
pDllStatus->dllUrdLock = (Bool)CSL_FEXT(_emiff_durdsr,EMIFF_DURDSR_LOCK);
/* Get DLL counter overflow status for Upper Read Byte */
pDllStatus->dllUrdOverFlow = (Bool)CSL_FEXT(_emiff_durdsr,EMIFF_DURDSR_OVF);
/* Get DLL counter Underflow status for Upper Read Byte */
pDllStatus->dllUrdUnderFlow = (Bool)CSL_FEXT(_emiff_durdsr,EMIFF_DURDSR_UDF);
/* Get DLL counter value for Lower Read Byte */
pDllStatus->dllLrdCount = CSL_FEXT(_emiff_dlrdsr,EMIFF_DLRDSR_DLLCNT);
/* Get DLL lock status for Lower Read Byte */
pDllStatus->dllLrdLock = (Bool)CSL_FEXT(_emiff_dlrdsr,EMIFF_DLRDSR_LOCK);
/* Get DLL counter overflow status for Lower Read Byte */
pDllStatus->dllLrdOverFlow = (Bool)CSL_FEXT(_emiff_dlrdsr,EMIFF_DLRDSR_OVF);
/* Get DLL counter Underflow status for Lower Read Byte */
pDllStatus->dllLrdUnderFlow = (Bool)CSL_FEXT(_emiff_dlrdsr,EMIFF_DLRDSR_UDF);
/* Get DLL counter value for Write */
pDllStatus->dllWrtCount = CSL_FEXT(_emiff_dwrtsr,EMIFF_DWRTSR_DLLCNT);
/* Get DLL lock status for Write */
pDllStatus->dllWrtLock = (Bool)CSL_FEXT(_emiff_dwrtsr,EMIFF_DWRTSR_LOCK);
/* Get DLL counter overflow status for Write */
pDllStatus->dllWrtOverFlow = (Bool)CSL_FEXT(_emiff_dwrtsr,EMIFF_DWRTSR_OVF);
/* Get DLL counter Underflow status for Write */
pDllStatus->dllWrtUnderFlow = (Bool)CSL_FEXT(_emiff_dwrtsr,EMIFF_DWRTSR_UDF);
}
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -