📄 csl_cfcaux.h
字号:
/** ============================================================================
* @file csl_cfcAux.h
*
* @path $(CSLPATH)\arm\cfc\inc
*
* @desc API header file for CompactFlash Controller CSL
*/
/* ============================================================================
* Copyright (c) Texas Instruments Inc 2002, 2003, 2004
*
* Use of this software is controlled by the terms and conditions found in the
* license agreement under which this software has been supplied.
* ===========================================================================
*/
/* @(#) PSP/CSL 3.00.01.00[5912] (2004-05-15) */
/* =============================================================================
* Revision History
* ===============
* 25-Jun-2004 Ru File Created.
*
* =============================================================================
*/
#ifndef _CSL_CFCAUX_H_
#define _CSL_CFCAUX_H_
#include <csl_cfc.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Status Query Functions of CFC
*/
/** ============================================================================
* @n@b CSL_cfcGetLastReadAccStat
*
* @b Description
* @n This function gets the status of last read access made to the
* CompactFlash card
*
* @b Arguments
* @verbatim
hCfc Handle to the CFC instance
@endverbatim
*
* <b> Return Value </b> CSL_CfcRdWrStatus
*
* @li CSL_CFC_LT_ACC_GOOD - Last read access was good
*
* @li CSL_CFC_LT_ACC_BAD - Last read access was bad.
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n Returns the status of the last read.
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_CfcHandle hCfc;
CSL_CfcRdWrStatus readStat;
...
readStat = CSL_cfcGetLastReadAccStat (hCfc);
...
@endverbatim
* ===========================================================================
*/
static inline
CSL_CfcRdWrStatus CSL_cfcGetLastReadAccStat (
CSL_CfcHandle hCfc
)
{
Uint16 rdStatus;
CSL_CfcRdWrStatus stat;
/*
* Get value of last read access bit from the register
* CF_STATUS_REG
*/
rdStatus = CSL_FEXT(hCfc->regs->STATUS_REG,
CFC_STATUS_REG_LAST_RD_ACCESS);
if (rdStatus == CSL_CFC_STATUS_REG_LAST_RD_ACCESS_OK)
{
/* Last read access was good */
stat = CSL_CFC_LT_ACC_GOOD;
}
else
{
/* Last read access was bad */
stat = CSL_CFC_LT_ACC_BAD;
}
return stat;
}
/** ============================================================================
* @n@b CSL_cfcGetLastWriteAccStat
*
* @b Description
* @n This function gets the status of last write access made to the
* CompactFlash card
*
* @b Arguments
* @verbatim
hCfc Handle to the CFC instance
@endverbatim
*
* <b> Return Value </b> CSL_CfcRdWrStatus
*
* @li CSL_CFC_LT_ACC_GOOD - Last write access was good
*
* @li CSL_CFC_LT_ACC_BAD - Last write access was bad.
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n Returns the status of the last write.
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_CfcHandle hCfc;
CSL_CfcRdWrStatus writeStat;
...
writeStat = CSL_cfcGetLastWriteAccStat (hCfc);
...
@endverbatim
* ===========================================================================
*/
static inline
CSL_CfcRdWrStatus CSL_cfcGetLastWriteAccStat (
CSL_CfcHandle hCfc
)
{
Uint16 wrStatus;
CSL_CfcRdWrStatus stat;
/*
* Get value of last write access bit from the register
* CF_STATUS_REG
*/
wrStatus = CSL_FEXT(hCfc->regs->STATUS_REG,
CFC_STATUS_REG_LAST_WR_ACCESS);
if (wrStatus == CSL_CFC_STATUS_REG_LAST_WR_ACCESS_OK)
{
/* Last write access was good */
stat = CSL_CFC_LT_ACC_GOOD;
}
else
{
/* Last write access was bad */
stat = CSL_CFC_LT_ACC_BAD;
}
return stat;
}
/** ============================================================================
* @n@b CSL_cfcGetCfConnection
*
* @b Description
* @n This function query's the status of CompactFlash card connection.
*
* @b Arguments
* @verbatim
hCfc Handle to the CFC instance
@endverbatim
*
* <b> Return Value </b> CSL_CfcCardConnStat
* @li CSL_CFC_CARD_CONNECTED - Card is connected.
* @li CSL_CFC_CARD_DISCONNECTED - Card is not connected.
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n Returns the status of the CompactFlash card connection.
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_CfcHandle hCfc;
CSL_CfcCardConnStat connStat;
...
connStat = CSL_cfcGetCfConnection (hCfc);
...
@endverbatim
* ===========================================================================
*/
static inline
CSL_CfcCardConnStat CSL_cfcGetCfConnection (
CSL_CfcHandle hCfc
)
{
Uint16 cfConnStatus;
CSL_CfcCardConnStat connStat;
/* Get value of card detect bit from the register CF_STATUS_REG */
cfConnStatus = CSL_FEXT(hCfc->regs->STATUS_REG,
CFC_STATUS_REG_CARD_DETECT);
if (cfConnStatus == CSL_CFC_STATUS_REG_CARD_DETECT_SUCCESSFUL)
{
connStat = CSL_CFC_CARD_CONNECTED;
}
else
{
connStat = CSL_CFC_CARD_DISCONNECTED;
}
return connStat;
}
/** ============================================================================
* @n@b CSL_cfcGetCsConfig
*
* @b Description
* @n This function query's the chip select configuration for CompactFlash
* card
*
* @b Arguments
* @verbatim
hCfc Handle to the CFC instance
@endverbatim
*
* <b> Return Value </b> CSL_CfcCs
*
* @li CSL_CFC_CS_0 - CS0 configuration is enabled.
*
* @li CSL_CFC_CS_1 - CS1 configuration is enabled.
*
* @li CSL_CFC_CS_2 - CS2 configuration is enabled.
*
* @li CSL_CFC_CS_3 - CS3 configuration is enabled.
*
* @li CSL_CFC_CS_NONE - All CS configurations are disabled.
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n Returns the chip select configuration.
*
* @b Modifies
* @n None
*
* @b Example
* @verbatim
CSL_CfcHandle hCfc;
CSL_CfcCs cs;
...
cs = CSL_cfcGetCsConfig (hCfc);
...
@endverbatim
* ===========================================================================
*/
static inline
CSL_CfcCs CSL_cfcGetCsConfig(
CSL_CfcHandle hCfc
)
{
Uint16 csCfg;
CSL_CfcCs cs;
/* Get value of register CF_CFG_REG */
csCfg = hCfc->regs->CFG_REG1;
if ( !(csCfg & CSL_CFC_CFG_REG1_CS0_CFG_MASK) )
{
/* CS0 configuration is enabled for CompactFlash access */
cs = CSL_CFC_CS_0;
}
else if ( !(csCfg & CSL_CFC_CFG_REG1_CS1_CFG_MASK) )
{
/* CS1 configuration is enabled for CompactFlash access */
cs = CSL_CFC_CS_1;
}
else if ( !(csCfg & CSL_CFC_CFG_REG1_CS2_CFG_MASK) )
{
/* CS2 configuration is enabled for CompactFlash access */
cs = CSL_CFC_CS_2;
}
else if ( !(csCfg & CSL_CFC_CFG_REG1_CS3_CFG_MASK) )
{
/* CS3 configuration is enabled for CompactFlash access */
cs = CSL_CFC_CS_3;
}
else
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -