⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csl_cfcaux.h

📁 dsp在音频处理中的运用
💻 H
📖 第 1 页 / 共 2 页
字号:
           /* All CS configurations for CompactFlash access are disabled */
           cs = CSL_CFC_CS_NONE;
        }
        
    return cs ;
}

/** ============================================================================
 *   @n@b CSL_cfcGetCardResetStatus
 *
 *   @b Description
 *   @n This function query's the reset status of the CompactFlash card.
 *
 *   @b Arguments
 *   @verbatim
        hCfc            Handle to the CFC instance
     @endverbatim
 *
 *   <b> Return Value </b>  CSL_CfcCardResetStatus
 *   @li                    CSL_CFC_CF_RESET_ON    - Card is held in reset.
 *   @li                    CSL_CFC_CF_RESET_OFF   - Card is not in reset.
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *    @n Returns the the reset status of the CompactFlash card.
 *
 *   @b Modifies
 *   @n  None
 *
 *   @b Example
 *   @verbatim
        CSL_CfcHandle           hCfc;
        CSL_CfcCardResetStatus  resetStat;
        
        ...
                                        
        resetStat = CSL_cfcGetCardResetStatus (hCfc);
        
        ...
        
     @endverbatim
 * ===========================================================================
 */
 
static inline
CSL_CfcCardResetStatus CSL_cfcGetCardResetStatus(
    CSL_CfcHandle hCfc
)
{

     Uint16                  cfResetStatus;
     CSL_CfcCardResetStatus  resetStat;
     
    /* Get value of card reset bit from the register CF_CONTROL_REG */
    cfResetStatus = CSL_FEXT(hCfc->regs->CNTRL_REG, CFC_CNTRL_REG_CARD_RESET);
            
     if (cfResetStatus == CSL_CFC_CNTRL_REG_CARD_RESET_ON)
      {
         /* Card is held in reset */
         resetStat = CSL_CFC_CF_RESET_ON;
      }
     else
      {
         /* Card is not in reset */
         resetStat = CSL_CFC_CF_RESET_OFF;
      }

     return resetStat ;
}

/**
 *  Hardware Control Functions of CFC
 */
 
/** ============================================================================
 *   @n@b CSL_cfcConfigCs
 *
 *   @b Description
 *   @n This function configures the Chip Select for CompactFlash access 
 *      according to the values supplied in the parameter chipSelect. 
 *
 *   @b Arguments
 *   @verbatim
            hCfc            Handle to CFC instance
 
            chipSelect      Chip select configuration
 
     @endverbatim
 *
 *   <b> Return Value </b> 
 *   @n  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  Register CF_CFG_REG is initialized
 *
 *   @b  Modifies
 *   @n  Register CF_CFG_REG
 *
 *   @b  Example
 *   @verbatim
            CSL_Status          status;
            CSL_CfcCs           chipSelect = CSL_CFC_CS_1;
            CSL_CfcHandle       hCfc;

            ...
            
            status = CSL_cfcConfigCs (hCfc, chipSelect);

            ...
            
     @endverbatim
 * =============================================================================
 */

static inline
void CSL_cfcConfigCs (
    CSL_CfcHandle       hCfc,
    CSL_CfcCs           chipSelect
)
{
    
    switch (chipSelect)
    {
        case CSL_CFC_CS_0:

            /* Reset the CS0 bit and all other bits should be set */
            hCfc->regs->CFG_REG1 = CSL_CFC_CFG_REG1_RESETVAL;
            CSL_FINST(hCfc->regs->CFG_REG1, CFC_CFG_REG1_CS0_CFG, ENABLED);

            break;

        case CSL_CFC_CS_1:

            /* Reset the CS1 bit and all other bits should be set */
            hCfc->regs->CFG_REG1 = CSL_CFC_CFG_REG1_RESETVAL;
            CSL_FINST(hCfc->regs->CFG_REG1, CFC_CFG_REG1_CS1_CFG, ENABLED);

            break;

        case CSL_CFC_CS_2:

            /* Reset the CS2 bit and all other bits should be set */
            hCfc->regs->CFG_REG1 = CSL_CFC_CFG_REG1_RESETVAL;
            CSL_FINST(hCfc->regs->CFG_REG1, CFC_CFG_REG1_CS2_CFG, ENABLED);
            
            break;

        case CSL_CFC_CS_3:

            /* Reset the CS3 bit and all other bits should be set */
            hCfc->regs->CFG_REG1 = CSL_CFC_CFG_REG1_RESETVAL;
            CSL_FINST(hCfc->regs->CFG_REG1, CFC_CFG_REG1_CS3_CFG, ENABLED);
            
            break;

        case CSL_CFC_CS_NONE:

            /* Set all bits */
            hCfc->regs->CFG_REG1 = CSL_CFC_CFG_REG1_RESETVAL;

            break;

        default:

            /* Unexpected parameters */
            return;
    }

    return ;

}

/** ============================================================================
 *   @n@b CSL_cfcResetConfigCs
 *
 *   @b Description
 *   @n This function resets the chip select configurations.
 *
 *   @b Arguments
 *   @verbatim
        hCfc            Handle to the CFC instance
     @endverbatim
 *
 *   <b> Return Value </b>
 *   @n  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  The chip select configurations is reset.
 *
 *   @b Modifies
 *   @n  The CFC Config Register
 *
 *   @b Example
 *   @verbatim
         CSL_CfcHandle     hCfc;
         
         ...
         
         CSL_cfcResetConfigCs  (hCfc);
         
         ...
         
     @endverbatim
 * ===========================================================================
 */ 

static inline
void CSL_cfcResetConfigCs (
    CSL_CfcHandle       hCfc
)
{
    hCfc->regs->CFG_REG1 = CSL_CFC_CFG_REG1_RESETVAL;
}

/** ============================================================================
 *   @n@b CSL_cfcResetOn
 *
 *   @b Description
 *   @n This function clears CARD_RESET bit in CFC_CONTROL_REG.
 *
 *   @b Arguments
 *   @verbatim

            hCfc            Handle to the CFC instance
 
     @endverbatim
 *
 *   <b> Return Value </b>
 *   @n  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  The CompactFlash is held in reset.
 *
 *   @b Modifies
 *   @n  The CFC Control Register
 *
 *   @b Example
 *   @verbatim
         CSL_CfcHandle     hCfc;
         
         ...
         
         CSL_cfcResetOn (hCfc);
         
         ...
         
     @endverbatim
 * ===========================================================================
 */ 

static inline
void CSL_cfcResetOn (
    CSL_CfcHandle       hCfc
)
{
    CSL_FINST (hCfc->regs->CNTRL_REG, CFC_CNTRL_REG_CARD_RESET, ON);
}

/** ============================================================================
 *   @n@b CSL_cfcResetOff
 *
 *   @b Description
 *   @n This function sets CARD_RESET bit in CFC_CONTROL_REG.
 *
 *   @b Arguments
 *   @verbatim

            hCfc            Handle to the CFC instance
 
     @endverbatim
 *
 *   <b> Return Value </b>
 *   @n  None
 *
 *   <b> Pre Condition </b>
 *   @n  None
 *
 *   <b> Post Condition </b>
 *   @n  The CompactFlash is not in reset.
 *
 *   @b Modifies
 *   @n  The CFC Control Register
 *
 *   @b Example
 *   @verbatim
        CSL_CfcHandle     hCfc;
        
        ...
        
        CSL_cfcResetOff (hCfc);
        
        ...
         
     @endverbatim
 * ===========================================================================
 */ 

static inline
void CSL_cfcResetOff (
    CSL_CfcHandle       hCfc
)
{
    CSL_FINST (hCfc->regs->CNTRL_REG, CFC_CNTRL_REG_CARD_RESET, OFF);
}

#ifdef __cplusplus
  }
#endif


#endif  /* _CSL_CFCAUX_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -