csl_cfc.h

来自「dsp在音频处理中的运用」· C头文件 代码 · 共 688 行 · 第 1/2 页

H
688
字号
/** ============================================================================
 *   @file  csl_cfc.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
 *  ===============
 *  15-May-2004 sks File Created.
 *
 * =============================================================================
 */

#ifndef _CSL_CFC_H_
#define _CSL_CFC_H_

#ifdef __cplusplus
extern "C" {
#endif


#include <csl.h>
#include <cslr_cfc.h>

/**************************************************************************\
* CompactFlash Controller global macro declarations
\**************************************************************************/


/**************************************************************************\
* CompactFlash Controller global typedef declarations
\**************************************************************************/

/**
 * These enumeration values specify the various possible chip select 
 * configurations that can be used by the CompactFlash Controller.  
 */
typedef enum {

    /** Represents chip select 0 configuration bit of register CF_CFG_REG */
    CSL_CFC_CS_0    = 0,
    
    /** Represents chip select 1 configuration bit of register CF_CFG_REG */
    CSL_CFC_CS_1    = 1,
    
    /** Represents chip select 2 configuration bit of register CF_CFG_REG */
    CSL_CFC_CS_2    = 2,
    
    /** Represents chip select 3 configuration bit of register CF_CFG_REG */
    CSL_CFC_CS_3    = 3,
    
    /** 
     *  Represents that chip select for CompactFlash access is not configured. 
     */

    CSL_CFC_CS_NONE = 4

} CSL_CfcCs;

/**
 *  Status query commands that are supported by the CompactFlash CSL.
 */
typedef enum {

    /**<
     * @brief   Gets the status of last read access
     * @param   CSL_CfcRdWrStatus *
     */
     
    CSL_CFC_QUERY_LAST_RD_ACC_STAT    = 0,

    /**<
     * @brief   Gets the status of the last write access
     * @param   CSL_CfcRdWrStatus *
     */
     
    CSL_CFC_QUERY_LAST_WR_ACC_STAT    = 1,

    /**<
     * @brief   Gets the status of CompactFlash card connection
     * @param   CSL_CfcCardConnStat *
     */
     
    CSL_CFC_QUERY_CF_CONNECTION     = 2,

    /**<
     * @brief   Gets the chip select configuration for the CompactFlash card
     *          access
     *
     * @param   CSL_CfcCs *
     */
     
    CSL_CFC_QUERY_CS_CFG            = 3,

    /**<
     * @brief   Gets the reset status of the CompactFlash card
     * @param   CSL_CfcCardResetStatus *
     */
     
    CSL_CFC_QUERY_CARDRESET_STAT    = 4 

} CSL_CfcHwStatusQuery;


/**
 * The hardware control commands that are supported by the CompactFlash 
 * Controller CSL.
 */
 
typedef enum {
    /**<
     * @brief   Configures the chip select for the CFC
     * @param   CSL_CfcCs *
     */
     
    CSL_CFC_CMD_CONFIG_CS       = 0,
    
    /**<
     * @brief   Resets the previous chip select configuration
     * @param   None
     */
     
    CSL_CFC_CMD_RESET_CONFIG_CS = 1,    

    /**<
     * @brief   Resets the CompactFlash card
     * @param   None
     */
     
    CSL_CFC_CMD_RESET_ON        = 2,

    /**<
     * @brief   Bring the CompactFlash card out of reset
     * @param   None
     */

    CSL_CFC_CMD_RESET_OFF  = 3 
 
 } CSL_CfcHwControlCmd;

    
/**
 * The object of this enumeration type is used in calls to function 
 * CSL_cfcGetHwStatus to get response for the queries 
 * CSL_CFC_QUERY_LT_RD_ACC_STAT and CSL_CFC_QUERY_LT_WR_ACC_STAT.
 */
typedef enum {

    /** This enumeration value tells that last Read/Write access was good. */
    CSL_CFC_LT_ACC_GOOD = 0,

    /** This enumeration value tells that last Read/Write access was bad. */
    CSL_CFC_LT_ACC_BAD  = 1

} CSL_CfcRdWrStatus; 


/**
 *  These enumeration values are used to convey the CF card connection status. 
 *  Pointer to an object of this type is passed as an argument to the API 
 *  CSL_cfcGetHwStatus for status query CSL_CFC_QUERY_CF_CONNECTION.
 */
typedef enum {

    /** Represents that CF card is correctly connected. */
    CSL_CFC_CARD_CONNECTED      = 0,

    /** 
     *  Represents that CF card is either not present or not connected 
     *  properly. 
     */
    CSL_CFC_CARD_DISCONNECTED   = 1

} CSL_CfcCardConnStat;


/**
 *  These enumeration values are used to convey the CompactFlash card 
 *  reset status. Pointer to an object of this enumeration type is 
 *  passed as an argument to the API CSL_cfcGetHwStatus for the status 
 *  query CSL_CFC_QUERY_CARDRESET_STAT.
 */
typedef enum {

    /** Represents that CF card is held in reset. */
    CSL_CFC_CF_RESET_ON    = 0,

    /** Represents that CF card is out of reset. */
    CSL_CFC_CF_RESET_OFF       = 1

} CSL_CfcCardResetStatus;

/** 
 *  The default value for CSL_CfcHwSetup structure 
 *  CS Configuration - CS_2 is active
 *  Card reset       - TRUE
 */
#define CSL_CFC_HWSETUP_DEFAULTS {  \
            CSL_CFC_CS_2,           \
            TRUE                    \
}


/**
 *  This structure is used to provide configuration information for 
 *  CompactFlash Controller. A variable of this structure type is 
 *  used as an argument in calls to functions CSL_cfcHwSetup 
 *  and CSL_cfcOpen.
 */
typedef struct CSL_CfcHwSetup {
    
    /** 
     *  The chip select configuration to be enabled in the register 
     *  CF_CFG_REG. 
     */
    CSL_CfcCs               chipSelect;

    /** Indicates whether to reset the CompactFlash card. */
    Bool                    cfReset;

} CSL_CfcHwSetup;

/**
 * The config-structure
 *
 * Used to configure the CFC using CSL_cfcHwSetupRaw(..)
 */
typedef struct  {

   /** CFC configuration register */
    Uint16 CFG_REG1;

    /** CFC control register */
    Uint16 CNTRL_REG;
    
} CSL_CfcConfig;

/** Default Values for Config structure */
#define CSL_CFC_CONFIG_DEFAULTS {	\
    CSL_CFC_CFG_REG1_RESETVAL, \
    CSL_CFC_CNTRL_REG_RESETVAL \
}

/** This will have the base-address information for the peripheral
 *  instance
 */
typedef struct {
	/** Base-address of the Configuration registers of the peripheral
	 */
	CSL_CfcRegsOvly	regs;
	
} CSL_CfcBaseAddress;

/** Module specific parameters. Present implementation doesn't have
 *  any module specific parameters.
 */
typedef struct {
	/** Bit mask to be used for module specific parameters.
     *  The below declaration is just a place-holder for future
 	 *  implementation.
	 */
	CSL_BitMask16   flags;
	
} CSL_CfcParam;

/** Module specific context information. Present implementation doesn't
 *  have any Context information.
 */
typedef struct {
	/** Context information of CFC.
     *  The below declaration is just a place-holder for future
 	 *  implementation.
 	 */
    Uint16	contextInfo;
    
} CSL_CfcContext;

/**
 *  This structure is used to store information about an instance of 
 *  the CompactFlash Controller. The structure is passed as a parameter
 *  to function CSL_cfcOpen. The function initializes the members 
 *  of the structure. The structure contains a member named regs, which 
 *  points to register overlay structure for the CompactFlash Controller 
 *  CSL. Through this member (regs) the CompactFlash controller registers 
 *  are accessed. It is the responsibility of the application to allocate 
 *  space for instance of this structure.
 *  When function CSL_cfcOpen is invoked, pointer to this object 
 *  structure is returned. This pointer is referred as the handle to the 
 *  instance. All the other CSL functions use this handle in order to access
 *  the instance.
 */
 
typedef struct CSL_CfcObj {
    /**  Instance number of CompactFlash Controller. */
    CSL_InstNum              perNum;

    /** CompactFlash Controller register overlay structure. */                                            
    CSL_CfcRegsOvly         regs;

} CSL_CfcObj;


/** 
 *  This data type is defined as a pointer to an object of type 
 *  CSL_CfcObj. The data type is used to identify an opened 
 *  instance of CompactFlash Controller.
 */
typedef struct CSL_CfcObj*   CSL_CfcHandle;

/******************************************************************************\
*  Global function declarations
\******************************************************************************/

/*
 * =============================================================================
 *   @func   CSL_cfcInit
 *
 *   @desc
 *     This is the initialization function for the CompactFlash Controller CSL.
 *     The function must be called before calling any other API from this CSL.
 *     This function is idem-potent. Currently this functions just returns
 *     status CSL_SOK, without doing anything.
 *
 *   @arg pContext
 *		  Context information to CFC
 *
 *   @ret  CSL_Status
 *         CSL_SOK - Always returned
 *
 *   @eg

⌨️ 快捷键说明

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