📄 mmcsd_evm.h
字号:
return E_PASS;
}
/**
\brief Set Data Width for SD
\param dataWidth Width of the data-line for SD, value of 0 is 1-data line and value of 1 is 4-data line
\return if success, \c E_PASS, else error code
*/
inline STATUS MMCSD_setDataWidth(MMCSD_DATA_BUS_WIDTH dataWidth) {
//MMCSD_FSET(MMCCTL, WIDTH, dataWidth) ;
CSL_FINS(CSL_MMCSD_0_REGS->MMCCTL, MMCSD_MMCCTL_WIDTH, dataWidth) ;
return E_PASS;
}
/**
\brief Get Status of the MMC/SD controller
Reads the values of the status registers into the parameters passed
\param status0 Contents of MMCST0 received is in this parameter
\param status1 Contents of MMCST1 received is in this parameter
\return if success, \c E_PASS, else error code
*/
inline STATUS MMCSD_getStatus(Uint16 * status0, Uint16* status1) {
//*status0 = MMCSD_RGET(MMCST0);
// *status1 = MMCSD_RGET(MMCST1);
*status0 =(Uint16)CSL_MMCSD_0_REGS->MMCST0;
*status1 =(Uint16)CSL_MMCSD_0_REGS->MMCST1;
return E_PASS;
}
/**
\brief Check Status of the MMC/SD controller
\param event status condition bits to be checked
\param timeOut 0 - no timeout; else timeout count for reading the status register MMCST0
\param operation exit condition, 0-AND all status condition should be statisfied, 1 - OR, either status condition should be satisfied
\return if success, \c E_PASS, else error code
*/
inline STATUS MMCSD_checkStatus( Uint16 event, int timeOut, int operation ) {
Uint16 status0, event_log=0;
STATUS ret_status=E_DEVICE;
if( timeOut ) {
do {
//status0 = MMCSD_RGET(MMCST0);
status0 =(Uint16)CSL_MMCSD_0_REGS->MMCST0;
if(status0&event) {
event_log |= (status0 & event);
}
if( operation==1 && event_log ) {
// 1 or more events have occured
ret_status=E_PASS;
break;
}
if( operation==0 && (event_log&event)==event ) {
// all events have occured
ret_status=E_PASS;
break;
}
timeOut--;
if( timeOut == 0 )
return E_TIMEOUT;
} while(1);
} else {
do {
//status0 = MMCSD_RGET(MMCST0);
status0 = CSL_MMCSD_0_REGS->MMCST0;
if(status0&event) {
event_log |= (status0 & event);
}
if( operation==1 && event_log ) {
// 1 or more events have occured
ret_status=E_PASS;
break;
}
if( operation==0 && (event_log&event)==event ) {
// all events have occured
ret_status=E_PASS;
break;
}
} while(1);
}
return ret_status;
}
/**
\brief To reset the FIFO controller
\return \c E_PASS, on completion
\see MMCSD_FIFCTL register
*/
inline Uint16 MMCSD_FIFOReset() {
CSL_FINS(CSL_MMCSD_0_REGS->MMCFIFOCTL,MMCSD_MMCFIFOCTL_FIFORST,1);
return E_PASS;
}
/**
\brief To set the FIFO transfer direction as transmit
\return \c E_PASS, on completion
\see MMCSD_FIFCTL register
*/
inline Uint16 MMCSD_FIFOTransmit() {
CSL_FINS(CSL_MMCSD_0_REGS->MMCFIFOCTL,MMCSD_MMCFIFOCTL_FIFODIR,1);
return E_PASS;
}
/**
\brief To set the FIFO transfer direction as receive
\return \c E_PASS, on completion
\see MMCSD_FIFOCTL register
*/
inline Uint16 MMCSD_FIFOReceive() {
CSL_FINS(CSL_MMCSD_0_REGS->MMCFIFOCTL,MMCSD_MMCFIFOCTL_FIFODIR,0);
return E_PASS;
}
/**
\brief To set the FIFO throshold level(Threshold value is in bytes)
\return \c E_PASS, on completion
\see MMCSD_FIFCTL register
*/
inline Uint16 MMCSD_FIFOThreshold(MMCSD_FIFOTHR_LEVEL thresholdlevel) {
if(thresholdlevel==MMCSD_FIFOLEVEL_16BYTES)
CSL_FINS(CSL_MMCSD_0_REGS->MMCFIFOCTL,MMCSD_MMCFIFOCTL_FIFOLEV,MMCSD_FIFOLEVEL_16BYTES);
else
CSL_FINS(CSL_MMCSD_0_REGS->MMCFIFOCTL,MMCSD_MMCFIFOCTL_FIFOLEV,MMCSD_FIFOLEVEL_32BYTES);
return E_PASS;
}
/**
\brief To read the FIFO status whether it is FULL or not
\return \c E_PASS, on completion
\see MMCSD_FIFCTL register
*/
inline Uint16 MMCSD_CheckFIFOIsFull() {
if(CSL_FEXT(CSL_MMCSD_0_REGS->MMCST1,MMCSD_MMCST1_FIFOFUL))
return E_PASS;
else
return E_FAIL;
}
/**
\brief To read the FIFO status whether it is EMPTY or not
\return \c E_PASS, on completion
\see MMCSD_FIFCTL register
*/
inline Uint16 MMCSD_CheckFIFOIsEmpty() {
if(CSL_FEXT(CSL_MMCSD_0_REGS->MMCST1,MMCSD_MMCST1_FIFOEMP))
return E_PASS;
else
return E_FAIL;
}
/**
\brief Clear Response from MMC/SD controller
\return \c E_PASS, on completion
\see MMCSD_getResponse
*/
inline STATUS MMCSD_clearResponse() {
CSL_FINS(CSL_MMCSD_0_REGS->MMCRSP01,MMCSD_MMCRSP01_MMCRSP0, 0);
CSL_FINS(CSL_MMCSD_0_REGS->MMCRSP01,MMCSD_MMCRSP01_MMCRSP1, 0);
CSL_FINS(CSL_MMCSD_0_REGS->MMCRSP23,MMCSD_MMCRSP23_MMCRSP2, 0);
CSL_FINS(CSL_MMCSD_0_REGS->MMCRSP23,MMCSD_MMCRSP23_MMCRSP3, 0);
CSL_FINS(CSL_MMCSD_0_REGS->MMCRSP45,MMCSD_MMCRSP45_MMCRSP4, 0);
CSL_FINS(CSL_MMCSD_0_REGS->MMCRSP45,MMCSD_MMCRSP45_MMCRSP5, 0);
CSL_FINS(CSL_MMCSD_0_REGS->MMCRSP67,MMCSD_MMCRSP67_MMCRSP6, 0);
CSL_FINS(CSL_MMCSD_0_REGS->MMCRSP67,MMCSD_MMCRSP67_MMCRSP7, 0);
CSL_FINS(CSL_MMCSD_0_REGS->MMCCIDX, MMCSD_MMCCIDX_CIDX, 0);
return E_PASS;
}
/*----- Function prototypes -----*/
STATUS MMCSD_setConfig(MMCSD_ConfigData * mmcsdConfig);
STATUS MMCSD_setIntMode(MMCSD_IntMode * mmcsdInt);
STATUS MMCSD_sendCmd(Uint32 command, Uint32 argument, Bool checkStatus, Uint16 statusBits);
STATUS MMCSD_getResponse(MMCSD_ResponseData * mmcsdResponse);
STATUS MMCSD_getCardStatus( MMCSD_ResponseData * mmcsdResponse, MMCSD_cardStatusReg *cardStatus );
STATUS MMCSD_getCardCID( MMCSD_ResponseData *mmcsdResponse, Uint16 *cardCID );
STATUS MMCSD_getCardCSD( MMCSD_ResponseData *mmcsdResponse, Uint16 *cardCSD, MMCSD_csdRegInfo *localCSDInfo );
STATUS MMCSD_readNWords( Uint32 *data, Uint32 numofBytes,Uint32 cardMemAddr,Bool dmaEnable );
STATUS MMCSD_writeNWords( Uint32 *data, Uint32 numofBytes,Uint32 cardMemAddr,Bool dmaEnable );
Uint16 MMC_StreamReadNWords(Uint32 *data, Uint32 numofBytes,Bool dmaEnable);
Uint16 MMC_StreamWriteNWords( Uint32 cardMemAddr,Uint32 *data, Uint32 numofBytes,Bool dmaEnable);
STATUS MMCSD_cardDetect(); ///< To be implemented later, if feature is supported
STATUS MMCSD_enableInterface(); ///< To be implemented later, if feature is supported
//STATUS MMCSD_EDMAWrite(Uint32 * srcBuff, Uint32 bcnt, Uint32 ccnt);
//STATUS MMCSD_EDMARead(Uint32 * dstBuff, Uint32 bcnt, Uint32 ccnt);
#endif /* _MMCSD_EVM270_H_ */
/*@}*/
/* Rev.No. Date/Time ECN No. Modifier */
/* ------- --------- ------- -------- */
/* 1 24 Jun 2004 14:41:02 1864 xjarlika */
/* */
/* Checking in MMCSD drv include and src files */
/********************************************************************/
/* Rev.No. Date/Time ECN No. Modifier */
/* ------- --------- ------- -------- */
/* 2 Jul 15:22:20 8 2049 xjarlika */
/* */
/* FIFOCTL renamed as MMCFIFOCTL */
/* Update due to Register Name Change */
/********************************************************************/
/* Rev.No. Date/Time ECN No. Modifier */
/* ------- --------- ------- -------- */
/* 3 13 Aug 2004 18:21:54 2296 xjarlika */
/* */
/* Updating MMCSD include and src file after inital testing on Hibari*/
/* Updating MMCSD include and src file after inital testing on Hibari*/
/********************************************************************/
/* Rev.No. Date/Time ECN No. Modifier */
/* ------- --------- ------- -------- */
/* 4 20 Aug 2004 11:18:18 2346 xjarlika */
/* */
/* Added EDMA functions to MMCSD library */
/********************************************************************/
/* Rev.No. Date/Time ECN No. Modifier */
/* ------- --------- ------- -------- */
/* 5 24 Aug 2004 14:45:32 2401 xjarlika */
/* */
/* Updating MMCSD drv include and src files after testing on Hibari */
/********************************************************************/
/* Rev.No. Date/Time ECN No. Modifier */
/* ------- --------- ------- -------- */
/* 6 14 Jan 2005 11:26:22 5878 xjarlika */
/* */
/* Updating after testing on Davinci QT */
/********************************************************************/
/* Rev.No. Date/Time ECN No. Modifier */
/* ------- --------- ------- -------- */
/* 7 Feb 09:53:44 4 6637 xjarlika */
/* */
/* Checking in after collecting firstcut thruput data for MMCSD */
/********************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -