📄 csl_emifhwcontrol.c
字号:
/* ============================================================================
* Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005
*
* Use of this software is controlled by the terms and conditions found in the
* license agreement under which this software has been supplied.
* ===========================================================================
*/
/** @file csl_emifHwControl.c
*
* @brief File for functional layer of CSL API @a CSL_emifHwControl()
*
* Path: \\(CSLPATH)\\ipmodules\\emifs\\src
*
* Description
* - The @a CSL_emifHwControl() function definition & it's associated
* functions
*
* Modification 1
* - Modified on: 23/6/2004
* - Reason: created the sources
*
* @date 23rd June, 2004
* @author Santosh Narayanan.
*
*/
/* =============================================================================
* Revision History
* ===============
* 30-Aug-2004 brn Updated for the new CSL architecture
* 11-Oct-2004 brn Updated with the code review comments
* =============================================================================
*/
#include <csl_emif.h>
#include <csl_emifAux.h>
/** ============================================================================
* @n@b CSL_emifHwControl
*
* @b Description
* @n Control operations for the EMIF. For a particular control operation, the
* pointer to the corresponding data type needs to be passed as argument
* HwControl function Call. All the arguments (Structure elements included)
* passed to the HwControl function are inputs. For the list of commands
* supported and argument type that can be @a void* casted & passed with a
* particular command refer to @a CSL_EmifHwControlCmd.
*
*
* @b Arguments
* @verbatim
hEmif Handle to the EMIF instance
cmd Operation to be performed on the EMIF
arg Argument specific to the command
@endverbatim
*
* <b> Return Value </b> CSL_Status
* @li CSL_SOK - Command execution successful.
* @li CSL_ESYS_BADHANDLE - Invalid handle
* @li CSL_ESYS_INVCMD - Invalid command
*
* <b> Pre Condition </b>
* @n None
*
* <b> Post Condition </b>
* @n Registers of the EMIF instance are configured according to the command
* and the command arguments. The command determines which registers are
* modified.
*
* @b Modifies
* @n Registers determined by the command
*
* <b> Usage Constraints: </b>
* Both @a CSL_emifInit() and @a CSL_emifOpen() must be called successfully
* in that order before @a CSL_emifHwControl() can be called. For the
* argument type that can be @a void* casted & passed with a particular command
* refer to @a CSL_EmifHwControlCmd
*
* @b Example:
* @verbatim
CSL_EmifHandle hEmif;
CSL_Status status;
...
status = CSL_emifHwControl(hEmif,
CSL_EMIF_CMD_START,
&command);
@endverbatim
*
*
* ============================================================================
*/
#pragma CODE_SECTION (CSL_emifHwControl, ".text:csl_section:emif");
CSL_Status CSL_emifHwControl (
/** Pointer to the object that holds reference to the
* instance of EMIF requested after the call
*/
CSL_EmifHandle hEmif,
/** The command to this API indicates the action to be taken */
CSL_EmifHwControlCmd cmd,
/** An optional argument @a void* casted */
void *arg
)
{
CSL_Status status = CSL_SOK;
if(hEmif == NULL) {
status = CSL_ESYS_BADHANDLE;
return status;
}
switch(cmd) {
case CSL_EMIF_CMD_SET_DDR_REF_THRESH:
CSL_emifDdrRefThresh (hEmif, (*(Uint16*)arg));
break;
case CSL_EMIF_CMD_REF_RATE:
CSL_emifRefRate (hEmif, (*(Uint16*)arg));
break;
case CSL_EMIF_CMD_SET_DDR_TAPV:
CSL_emifDdrTapv (hEmif, (*(Uint16*)arg));
break;
case CSL_EMIF_CMD_DDR_TRAIN:
CSL_emifDdrTraIn (hEmif, (*(Uint16*)arg));
break;
case CSL_EMIF_CMD_LT_ENABLE:
CSL_emifLtEnable (hEmif);
break;
case CSL_EMIF_CMD_LT_DISABLE:
CSL_emifLtDisable (hEmif);
break;
case CSL_EMIF_CMD_AT_ENABLE:
CSL_emifAtEnable (hEmif);
break;
case CSL_EMIF_CMD_AT_DISABLE:
CSL_emifAtDisable (hEmif);
break;
case CSL_EMIF_CMD_IO_CONTROL:
CSL_emifIoCtrl (hEmif, (*(Uint16*)arg));
break;
case CSL_EMIF_CMD_CS5_ECC_START:
CSL_emifCS5EccStart (hEmif);
break;
case CSL_EMIF_CMD_CS4_ECC_START:
CSL_emifCS4EccStart (hEmif);
break;
case CSL_EMIF_CMD_CS3_ECC_START:
CSL_emifCS3EccStart (hEmif);
break;
case CSL_EMIF_CMD_CS2_ECC_START:
CSL_emifCS2EccStart (hEmif);
break;
case CSL_EMIF_CMD_CS5_NAND_ENABLE:
CSL_emifCS5NandEnable (hEmif);
break;
case CSL_EMIF_CMD_CS5_NAND_DISABLE:
CSL_emifCS5NandDisable (hEmif);
break;
case CSL_EMIF_CMD_CS4_NAND_ENABLE:
CSL_emifCS4NandEnable (hEmif);
break;
case CSL_EMIF_CMD_CS4_NAND_DISABLE:
CSL_emifCS4NandDisable (hEmif);
break;
case CSL_EMIF_CMD_CS3_NAND_ENABLE:
CSL_emifCS3NandEnable (hEmif);
break;
case CSL_EMIF_CMD_CS3_NAND_DISABLE:
CSL_emifCS3NandDisable (hEmif);
break;
case CSL_EMIF_CMD_CS2_NAND_ENABLE:
CSL_emifCS2NandEnable (hEmif);
break;
case CSL_EMIF_CMD_CS2_NAND_DISABLE:
CSL_emifCS2NandDisable (hEmif);
break;
default:
status = CSL_ESYS_INVCMD ;
break;
}
return status;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -