csl_mmcsdaux.h
来自「dsp在音频处理中的运用」· C头文件 代码 · 共 635 行 · 第 1/2 页
H
635 行
)
{
hMmcsd->regs->BLEN = blkSize;
}
static inline
void CSL_mmcsdSetNumBlks(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* suspend or resume command */
Uint16 numBlks
)
{
hMmcsd->regs->NBLK = numBlks;
}
static inline
void CSL_mmcsdSetSdBusWidth(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* suspend or resume command */
CSL_MmcsdBusWidth busWidth
)
{
CSL_FINS(hMmcsd->regs->CON, MMCSD_CON_DW, busWidth);
}
static inline
void CSL_mmcsdSdioRdWait(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* suspend or resume command */
CSL_MmcsdSdioRw rwReq
)
{
CSL_FINS(hMmcsd->regs->SDIO, MMCSD_SDIO_RW, rwReq);
}
static inline
void CSL_mmcsdSetInt(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
CSL_MmcsdHwControlCmd cmd,
Uint16 intVal
)
{
if (CSL_MMCSD_CMD_INT_ENABLE == cmd) {
hMmcsd->regs->IE |= intVal;
} else if (CSL_MMCSD_CMD_INT_DISABLE == cmd) {
hMmcsd->regs->IE &= ~intVal;
}
}
static inline
void CSL_mmcsdClrEvt(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* suspend or resume command */
Uint16 evtVal
)
{
hMmcsd->regs->STAT = evtVal;
}
static inline
void CSL_mmcsdSetDma(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
CSL_MmcsdHwControlCmd cmd,
Uint16 dmaVal
)
{
if (CSL_MMCSD_CMD_DMA_ENABLE == cmd) {
hMmcsd->regs->BUF |= dmaVal & (CSL_MMCSD_BUF_TXDE_MASK |
CSL_MMCSD_BUF_RXDE_MASK);
} else if (CSL_MMCSD_CMD_DMA_DISABLE == cmd) {
hMmcsd->regs->BUF &= ~(dmaVal & (CSL_MMCSD_BUF_TXDE_MASK |
CSL_MMCSD_BUF_RXDE_MASK));
}
}
static inline
void CSL_mmcsdSdioStopCore(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd
)
{
CSL_FINST(hMmcsd->regs->IOSR, MMCSD_IOSR_STOP, STOPDAT);
}
static inline
void CSL_mmcsdSdioFifoReadMode(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd
)
{
CSL_FINST(hMmcsd->regs->IOSR, MMCSD_IOSR_SAVE, SAVE);
}
static inline
void CSL_mmcsdHwSetupCommon(
CSL_MmcsdHandle hMmcsd,
CSL_MmcsdHwSetupCommon *commonPtr
)
{
Uint16 temp;
CSL_MmcsdRegsOvly regsPtr = hMmcsd->regs;
/* fill up the fields in CON register from the structure */
temp = regsPtr->CON;
CSL_FINS(temp, MMCSD_CON_MODE, commonPtr->mode);
CSL_FINS(temp, MMCSD_CON_ENDIAN, commonPtr->endianness);
CSL_FINS(temp, MMCSD_CON_CLKDIV, commonPtr->clkDiv);
regsPtr->CON = temp;
/* fill up the fields in datTmout register from the structure */
regsPtr->CTO = commonPtr->cmdTmout;
/* fill up the fields in cmdTmout register from the structure */
regsPtr->DTO = commonPtr->datTmout;
CSL_FINS(hMmcsd->regs->SDIO, MMCSD_SDIO_XDTS, (commonPtr->mode >> 2));
}
static inline
void CSL_mmcsdHwSetupFifo(
CSL_MmcsdHandle hMmcsd,
CSL_MmcsdHwSetupFifo *fifoPtr
)
{
Uint16 temp;
/* fill up the fields in BUF register from the structure */
temp = hMmcsd->regs->BUF;
CSL_FINS(temp, MMCSD_BUF_AFL, fifoPtr->almostFull);
CSL_FINS(temp, MMCSD_BUF_AEL, fifoPtr->almostEmpty);
hMmcsd->regs->BUF = temp;
}
static inline
void CSL_mmcsdHwSetupSdio(
CSL_MmcsdHandle hMmcsd,
CSL_MmcsdHwSetupSdio *sdioPtr
)
{
Uint16 temp;
/* fill up the fields in SDIO register from the structure */
temp = hMmcsd->regs->SDIO;
CSL_FINSR(temp, 15, 12, CSL_FEXTR(sdioPtr->errorEn, 15, 12));
CSL_FINS(temp, MMCSD_SDIO_IWE, sdioPtr->wkupMod);
CSL_FINSR(temp, 11, 10, CSL_FEXTR(sdioPtr->cdDetect, 11, 10));
CSL_FINSR(temp, 2, 2, CSL_FEXTR(sdioPtr->cdDetect, 2, 2));
CSL_FINS(temp, MMCSD_SDIO_RWE, sdioPtr->rwEn);
CSL_FINS(temp, MMCSD_SDIO_DPE, sdioPtr->prescaleEn);
CSL_FINS(temp, MMCSD_SDIO_DCR4, sdioPtr->dcr4);
CSL_FINS(temp, MMCSD_SDIO_IRQE, sdioPtr->sdioIntEn);
hMmcsd->regs->SDIO = temp;
}
static inline
void CSL_mmcsdGetHwSetupCommon(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
CSL_MmcsdHwSetupCommon *commonPtr
)
{
Uint16 temp;
CSL_MmcsdRegsOvly regsPtr = hMmcsd->regs;
/* fill information from CON register into the structure */
temp = regsPtr->CON;
commonPtr->endianness = (CSL_MmcsdEndian)
(CSL_FEXT(temp, MMCSD_CON_ENDIAN));
commonPtr->clkDiv = CSL_FEXT(temp, MMCSD_CON_CLKDIV);
/* fill information from CTO register into the structure */
commonPtr->cmdTmout = regsPtr->CTO;
/* fill information from DTO register into the structure */
commonPtr->datTmout = regsPtr->DTO;
commonPtr->mode = (CSL_MmcsdMode)
((CSL_FEXT(hMmcsd->regs->SDIO, MMCSD_SDIO_XDTS) << 2) |
CSL_FEXT(temp, MMCSD_CON_MODE));
}
static inline
void CSL_mmcsdGetHwSetupFifo(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
CSL_MmcsdHwSetupFifo *fifoPtr
)
{
Uint16 temp;
temp = hMmcsd->regs->BUF;
/* fill information from BUF register into the structure */
fifoPtr->almostFull = CSL_FEXT(temp, MMCSD_BUF_AFL);
fifoPtr->almostEmpty = CSL_FEXT(temp, MMCSD_BUF_AEL);
}
static inline
void CSL_mmcsdGetHwSetupSdio(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
CSL_MmcsdHwSetupSdio *sdioPtr
)
{
Uint16 temp;
/* fill information from SDIO register into the structure */
temp = hMmcsd->regs->SDIO;
sdioPtr->errorEn = (CSL_MMCSD_SDIO_C12E_MASK |
CSL_MMCSD_SDIO_C13E_MASK |
CSL_MMCSD_SDIO_C14E_MASK |
CSL_MMCSD_SDIO_C5E_MASK) & temp;
sdioPtr->wkupMod = CSL_MMCSD_SDIO_IWE_MASK & temp;
sdioPtr->cdDetect = (CSL_MMCSD_SDIO_CDE_MASK |
CSL_MMCSD_SDIO_D3PS_MASK |
CSL_MMCSD_SDIO_D3ES_MASK) & temp;
sdioPtr->rwEn = (CSL_MmcsdSdioRwEn)
(CSL_FEXT(temp, MMCSD_SDIO_RWE));
sdioPtr->prescaleEn = (CSL_MmcsdSdioPrescale)
(CSL_FEXT(temp, MMCSD_SDIO_DPE));
sdioPtr->dcr4 = (CSL_MmcsdSdioDcr4)
(CSL_FEXT(temp, MMCSD_SDIO_DCR4));
sdioPtr->sdioIntEn = (CSL_MmcsdSdioIntEn)
(CSL_FEXT(temp, MMCSD_SDIO_IRQE));
}
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?