csl_mmcsdaux.h
来自「dsp在音频处理中的运用」· C头文件 代码 · 共 635 行 · 第 1/2 页
H
635 行
#ifndef _CSL_MMCSDAUX_H_
#define _CSL_MMCSDAUX_H_
#include <csl_mmcsd.h>
#ifdef __cplusplus
extern "C" {
#endif
static inline
void CSL_mmcsdGetRevision(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
CSL_MmcsdRevision *rev
)
{
*rev = (CSL_MmcsdRevision)(hMmcsd->regs->REV);
}
static inline
void CSL_mmcsdGetResetStatus(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
CSL_MmcsdResetStat *resetStat
)
{
*resetStat = (CSL_MmcsdResetStat)CSL_FEXT(hMmcsd->regs->SYSS,
MMCSD_SYSS_SRST);
}
static inline
void CSL_mmcsdGetCmdSent(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
CSL_MmcsdCmd *cmd
)
{
CSL_MmcsdRegsOvly handle = hMmcsd->regs;
/* fetch information from CMD into the structure */
cmd->cmdType = (CSL_MmcsdCmdType)handle->CMD;
/* fetch information from ARGL & ARGH registers into the structure */
cmd->arg = ((Uint32)(handle->ARGL) | ((Uint32)(handle->ARGH) << 16));
}
static inline
void CSL_mmcsdGetResp(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* This is the placeholder for the response of the last command sent */
CSL_MmcsdResponse *response
)
{
CSL_MmcsdRegsOvly handle = hMmcsd->regs;
int i;
/* fetch the response from the response registers */
for (i = 0; i < 8; i++) {
response->response[i] = handle->MmcsdResponseRegs[i].RSP;
}
}
static inline
void CSL_mmcsdGetPwrStatus(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* This is the placeholder for the response of the last command sent */
CSL_MmcsdPwrStat *pwrStat
)
{
*pwrStat = (CSL_MmcsdPwrStat)(CSL_FEXT(hMmcsd->regs->CON,
MMCSD_CON_POWER));
}
static inline
void CSL_mmcsdGetSdBusWidth(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* This is the placeholder for the response of the last command sent */
CSL_MmcsdBusWidth *busWidth
)
{
*busWidth = (CSL_MmcsdBusWidth)(CSL_FEXT(hMmcsd->regs->CON,
MMCSD_CON_DW));
}
static inline
void CSL_mmcsdGetNumBlks(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* This is the placeholder for the response of the last command sent */
Uint16 *numBlks
)
{
*numBlks = (Uint16)(hMmcsd->regs->NBLK);
}
static inline
void CSL_mmcsdGetEvtStatus(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* This is the placeholder for the response of the last command sent */
Uint16 *evtStatus
)
{
*evtStatus = (Uint16)(hMmcsd->regs->STAT);
}
static inline
void CSL_mmcsdGetIntEnabled(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* This is the placeholder for the response of the last command sent */
Uint16 *intEnabled
)
{
*intEnabled = hMmcsd->regs->IE;
}
static inline
void CSL_mmcsdGetDmaEnabled(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* This is the placeholder for the response of the last command sent */
Uint16 *dmaEnabled
)
{
*dmaEnabled = (Uint16)(hMmcsd->regs->BUF &
(CSL_MMCSD_BUF_TXDE_MASK |
CSL_MMCSD_BUF_RXDE_MASK));
}
static inline
void CSL_mmcsdReset(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd
)
{
/* set the reset bit */
CSL_FINST(hMmcsd->regs->SYSC, MMCSD_SYSC_SRST, RESET);
}
static inline
void CSL_mmcsdSendInitSeq(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd
)
{
hMmcsd->regs->CMD = CSL_FMKT(MMCSD_CMD_DDIR, RESETVAL) |
CSL_FMKT(MMCSD_CMD_SHR, RESETVAL) |
CSL_FMKT(MMCSD_CMD_TYPE, RESETVAL) |
CSL_FMKT(MMCSD_CMD_BUSY, RESETVAL) |
CSL_FMKT(MMCSD_CMD_RSP, RESETVAL) |
CSL_FMKT(MMCSD_CMD_INAB, INIT) |
CSL_FMKT(MMCSD_CMD_ODTO, RESETVAL) |
CSL_FMKT(MMCSD_CMD_INDX, RESETVAL);
}
static inline
void CSL_mmcsdRead(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* number of words to transfer to/from buffer */
Uint16 numWords,
/* pointer to a buffer with sufficiently allocated space */
Uint16 *buf
)
{
CSL_MmcsdRegsOvly regsPtr = hMmcsd->regs;
/* read the data into buffer from the MMCSD fifo */
while (numWords--) {
*buf = regsPtr->DATA;
buf++;
}
}
static inline
void CSL_mmcsdWrite(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* number of words to transfer to/from buffer */
Uint16 numWords,
/* pointer to a buffer with sufficiently allocated space */
Uint16 *buf
)
{
CSL_MmcsdRegsOvly regsPtr = hMmcsd->regs;
/* write the data from buffer into the MMCSD fifo */
while (numWords--) {
regsPtr->DATA = *buf;
buf++;
}
}
static inline
void CSL_mmcsdSendCmd(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* commands specified in CSL_MmcsdCmdType */
CSL_MmcsdCmdType cmdType,
/* an optional 32-bit argument */
Uint32 arg
)
{
CSL_MmcsdRegsOvly regsPtr = hMmcsd->regs;
/* split the argument into 2 & write it into ARGL &
* ARGH registers */
regsPtr->ARGL = (Uint16)(arg & 0xFFFF);
regsPtr->ARGH = (Uint16)((arg >> 16) & 0xFFFF);
/* write the command in CMD register; this starts the
* command execution to MMC card */
regsPtr->CMD = cmdType;
}
static inline
void CSL_mmcsdSdioSuspResume(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* suspend or resume command */
Uint16 srCmd
)
{
Uint16 temp = hMmcsd->regs->IOSR;
/* write the suspend/resume bits of IOSR */
CSL_FINS(temp, MMCSD_IOSR_SUSP, CSL_FEXT(srCmd, MMCSD_IOSR_SUSP));
CSL_FINS(temp, MMCSD_IOSR_RESU, CSL_FEXT(srCmd, MMCSD_IOSR_RESU));
hMmcsd->regs->IOSR = temp;
}
static inline
void CSL_mmcsdPwrStat(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* suspend or resume command */
CSL_MmcsdPwrStat pwrStat
)
{
CSL_FINS(hMmcsd->regs->CON, MMCSD_CON_POWER, pwrStat);
}
static inline
void CSL_mmcsdSetBlkSize(
/* pointer to the object that holds reference to the
* instance of MMCSD requested after the call */
CSL_MmcsdHandle hMmcsd,
/* suspend or resume command */
Uint16 blkSize
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?