csl_emifs.h
来自「dsp在音频处理中的运用」· C头文件 代码 · 共 880 行 · 第 1/2 页
H
880 行
* implementation. */ CSL_BitMask16 flags;} CSL_EmifsParam;/** @brief Module specific context information. Present implementation doesn't have * any Context information. */typedef struct { /** Context information of EMIFS. * The below declaration is just a place-holder for future * implementation. */ Uint16 contextInfo;} CSL_EmifsContext;/**************************************************************************\* EMIFS function declarations\**************************************************************************//** @brief Peripheral specific initialization function. * * This is the peripheral specific intialization function. This function is * idempotent in that calling it many times is same as calling it once. * This function initializes the CSL data structures, and doesn't touches * the hardware. * * <b> Usage Constraints: </b> * This function should be called before using any of the CSL APIs in the EMIFS * module. * * Note: As EMIFS doesn't have any context based information, currently, the function * just returns CSL_SOK. User is expected to pass NULL in the function call. * * @b Example: * @verbatim ... if (CSL_SOK != CSL_emifsInit(NULL)) { return; } @endverbatim * * @return returns the status of the operation * */CSL_Status CSL_emifsInit( /** EMIFS specific context information */ CSL_EmifsContext * pContext );/** @brief Opens the instance of EMIFS requested. * * The open call sets up the data structures for the particular instance of * EMIFS device. The device can be re-opened anytime after it has been normally * closed if so required. The handle returned by this call is input as an * essential argument for rest of the APIs described for this module. * * <b> Usage Constraints: </b> * EMIFS must be successfully initialized via @a CSL_emifsInit() before calling * this function. Memory for the @a CSL_emifsObj must be allocated outside * this call. This object must be retained while usage of this peripheral. * * @b Example: * @verbatim CSL_EmifsObj emifsObj; CSL_Status status; ... hEmifs = CSL_emifsOpen(&emifsObj, CSL_EMIFS_1, NULL, &status); @endverbatim * * @return returns a handle @a CSL_EmifsHandle to the requested instance of * EMIFS if the call is successful, otherwise, a @a NULL is returned. * */CSL_EmifsHandle CSL_emifsOpen ( /** Pointer to the object that holds reference to the * instance of EMIFS requested after the call */ CSL_EmifsObj* pEmifsObj, /** Instance of EMIFS to which a handle is requested */ CSL_InstNum emifsNum, /** Module specific parameters; * Currently there are none; the user should pass 'NULL' */ CSL_EmifsParam *pEmifsParam, /** This returns the status (success/errors) of the call. * Could be 'NULL' if the user does not want status information. */ CSL_Status *pStatus );/** * The Close call releases the resource and appropriate shared pins. * * <b> Usage Constraints: </b> * Both @a CSL_emifsInit() and @a CSL_emifsOpen() must be called successfully * in that order before CSL_emifsClose() can be called. * * @b Example: * @verbatim CSL_EmifsHandle myhEmifs ; CSL_EmifsObj emifsObj ; CSL_Status status; ....... myhEmifs = CSL_emifsOpen(&emifsObj, 0, CSL_EXCLUSIVE, NULL, status); if(myhEmifs != NULL) { // Your code goes here ....... ....... CSL_EmifsClose(myhEmifs); } @endverbatim * * @return returns the status of the operation (see @a CSL_Status) * Status is: * CSL_SOK, if close function succeeds. * CSL_ESYS_BADHANDLE, if the handle is not valid. * */CSL_Status CSL_emifsClose( /** Pointer to the object that holds reference to the * instance of EMIFS requested after the CSL_emifsOpen(...) call */ CSL_EmifsHandle hEmifs);/** * This function initializes the device registers with * the appropriate values provided through the HwSetup Data structure. * This function needs to be called only if the HwSetup Structure was * not previously passed through the Open call. * For information passed through the HwSetup Data structure refer * @a CSL_EmifsHwSetup. * * <b> Usage Constraints:</b> * Both @a CSL_emifsInit() and @a CSL_emifsOpen() must be called successfully * in that order before CSL_emifsHwSetup() can be called. The user has to * allocate space for & fill in the main setup structure appropriately before * calling this function * * @b Example: * @verbatim //EMIFF top level setup object CSL_EmifsHwSetup hwSetup; CSL_EmifsAbortStatus abortStatus; // Inititialize Consecutive Acces setup structure with some values CSL_EmifsConsecAccess consecAccess = {4, 3, 2, 1}; // Inititialize Dynamic Arbitration Priority Timeout structure with some values CSL_EmifsDynPriTimeout dynPriTimeout = {0x11, 0x22, 0x33}; //Initialize SDRAM config setup structure with default values CSL_EmifsChipConfig chipConfig[4] = { {1,2,3,4,5, CSL_EMIFS_WRT32ADDRMODE_CONST, 6, 7, CSL_EMIFS_ADVHOLD_2, CSL_EMIFS_BUSTRANSMODE_RDWRT, CSL_EMIFS_FLASHCLKDIV_4, CSL_EMIFS_DATARETIME_ON, CSL_EMIFS_DYNWAITSTATE_DISABLE, CSL_EMIFS_HANDSHAKEMODE_NONFULL }, {7,6,5,4,3, CSL_EMIFS_WRT32ADDRMODE_CONST, 2, 1, CSL_EMIFS_ADVHOLD_2, CSL_EMIFS_BUSTRANSMODE_RDONLY, CSL_EMIFS_FLASHCLKDIV_6, CSL_EMIFS_DATARETIME_OFF, CSL_EMIFS_DYNWAITSTATE_ENABLE, CSL_EMIFS_HANDSHAKEMODE_FULL }, {2,4,3,6,5, CSL_EMIFS_WRT32ADDRMODE_INCR, 1, 2, CSL_EMIFS_ADVHOLD_1, CSL_EMIFS_BUSTRANSMODE_RDWRT, CSL_EMIFS_FLASHCLKDIV_2, CSL_EMIFS_DATARETIME_OFF, CSL_EMIFS_DYNWAITSTATE_DISABLE, CSL_EMIFS_HANDSHAKEMODE_FULL }, {1,3,5,2,4, CSL_EMIFS_WRT32ADDRMODE_CONST, 3, 4, CSL_EMIFS_ADVHOLD_2, CSL_EMIFS_BUSTRANSMODE_RDWRT, CSL_EMIFS_FLASHCLKDIV_1, CSL_EMIFS_DATARETIME_ON, CSL_EMIFS_DYNWAITSTATE_DISABLE, CSL_EMIFS_HANDSHAKEMODE_NONFULL } }; CSL_EmifsBootConfig bootConfig[4] = {{CSL_EMIFS_BOOTRDMODE_PAGEMD4, CSL_EMIFS_DATABUSSIZE_32, CSL_EMIFS_ADBUSMUX_FALSE}, {CSL_EMIFS_BOOTRDMODE_PAGEMD8, CSL_EMIFS_DATABUSSIZE_16, CSL_EMIFS_ADBUSMUX_TRUE}, {CSL_EMIFS_BOOTRDMODE_PAGEMD16, CSL_EMIFS_DATABUSSIZE_32, CSL_EMIFS_ADBUSMUX_FALSE}, {CSL_EMIFS_BOOTRDMODE_TIACEROM, CSL_EMIFS_DATABUSSIZE_16, CSL_EMIFS_ADBUSMUX_TRUE} }; hwSetup.armBootMode = CSL_EMIFS_ARMBOOTMODE_CS3; hwSetup.consecAccess = &consecAccess ; hwSetup.dynPriTimeout = &dynPriTimeout; for(i = 0; i<CSL_EMIFS_MAX_CS; i++) { hwSetup.chipConfig[i] = &chipConfig[i]; hwSetup.bootConfig[i] = &bootConfig[i]; } //Obtain handle to EMIFF object hEmifs = CSL_emifsOpen(&emifsObj, CSL_EMIFS_0, CSL_EXCLUSIVE, NULL, &status); if(hEmifs != NULL) { // Setup EMIFS CSL_emifsHwSetup(hEmifs, &hwSetup); ...... ..... } @endverbatim * * @return Returns the status of the setup operation (see @a CSL_Status) * Status is: * CSL_SOK - successful completion of the setup * CSL_ESYS_INVPARAMS - hwSetup structure is not initialized. */CSL_Status CSL_emifsHwSetup( /** Pointer to the object that holds reference to the * instance of EMIFS requested after the call */ CSL_EmifsHandle hEmifs, /** Pointer to setup structure which contains the * information to program EMIFS to a useful state */ CSL_EmifsHwSetup *hwSetup);/** This function initializes the device registers with the register-values * provided through the Config Data structure. For information passed through * the Config Data structure refer to @a CSL_EmifsConfig. * * <b> Usage Constraints: </b> * The user has to allocate space for & fill in the main setup structure * appropriately before calling this function. * * @b Example: * @verbatim CSL_EmifsHandle hEmifs; CSL_EmifsConfig config; config.CR = 0x1234; config.OPR = 0x0078; .... .... .... CSL_emifsHwSetupRaw(hEmifs, &config); @endverbatim * * @return Returns the status of the setup operation * */ CSL_Status CSL_emifsHwSetupRaw( CSL_EmifsHandle hEmifs, CSL_EmifsConfig * setup);/** Gets the current hardware setup of EMIFS. The obtaining of setup through * this API is the reverse operation of @a CSL_emifsHwSetup() function. * * <b> Usage Constraints: </b> * Both @a CSL_emifsInit() and @a CSL_emifsOpen() must be called successfully * in that order before @a CSL_emifsGetHwSetup() can be called. The argument * is a setup structure which consists of pointers to sub-structures & so on. * Only those sub-structures which are required should be populated. The other * pointers must be set to NULL. * * @b Example: * @verbatim CSL_EmifsHwSetup setup; CSL_EmifsBootRdMode bootRdMode; bootRdMode = { CSL_EMIFS_BOOT_RDMODE_TI_BURST, CSL_EMIFS_ADBUS_MUX_FALSE, CSL_EMIFS_DATABUS_SIZE_16}; setup.consecAccess = {1,2,3,4} ; setup.dynPriTimeout = {10,20,30,40} ; //Don't want to modify anything in chip configurations setup.chipConfig[0] = NULL; setup.chipConfig[1] = NULL; setup.chipConfig[2] = NULL; setup.chipConfig[3] = NULL; setup.bootConfig[0] = &bootRdMode ; //Don't want to modify anything boot configurations corresponding to CS1, CS2, CS3 setup.bootConfig[1] = NULL ; setup.bootConfig[2] = NULL ; setup.bootConfig[3] = NULL ; CSL_emifsGetHwSetup(hEmifs, &etup); @endverbatim * * @return returns the status of the operation * */CSL_Status CSL_emifsGetHwSetup( /** pointer to the object that holds reference to the * instance of EMIFS requested after the call */ CSL_EmifsHandle hEmifs, /** the query to this API which indicates the status/setup * to be returned */ CSL_EmifsHwSetup *setup);/** * Control operations for the EMIFS. For a particular control * operation, the pointer to the corresponding data type needs * to be passed as argument in 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_EmifsHwControlCmd * * <b> Usage Constraints:</b> * Both @a CSL_emifsInit() and @a CSL_emifsOpen() must be called successfully * in that order before CSL_emifsHwControl() can be called. For the * argument type that can be @a void* casted & passed with a particular command * refer to @a CSL_EmifsHwControlCmd * * @b Example: * @verbatim CSL_EmifsHandle hEmifs; CSL_Status status; ... status = CSL_emifsHwControl(hEmifs, CSL_EMIFS_CMD_POWER_DOWN_ENABLE, NULL); @endverbatim * * @return Returns the status of the operation (see @a CSL_Status) * Status is: * CSL_SOK - successful completion of the operation. * CSL_ESYS_INVCMD - command passed is not a valid control command for EMIFS * */CSL_Status CSL_emifsHwControl( /** Pointer to the object that holds reference to the * instance of EMIFS requested after the call */ CSL_EmifsHandle hEmifs, /** The command to this API, which indicates the action to be taken */ CSL_EmifsHwControlCmd cmd, /** An optional argument @a void* casted */ void *voidPtr);/** * This function is used to read the current device configuration * and the value present in associated registers. User should allocate * memory for the said data type and pass its pointer as an unadorned * void* argument to the status query call. For details about the various * status queries supported and the associated data structure to record the * response, refer to @a CSL_EmifsHwStatusQuery. * * <b> Usage Constraints: </b> * Both @a CSL_emifsInit() and @a CSL_emifsOpen() must be called successfully * in that order before @a CSL_emifsGetHwStatus() can be called. For the * argument type that can be void* casted & passed with a particular command, * refer to @a CSL_EmifsHwStatusQuery * * @b Example: * @verbatim Code snippet to get EMIFS status CSL_EmifsHandle hEmifs; CSL_Status status; CSL_EmifsStatus emifsStatus ; CSL_EmifsAbortStatus abortStatus; status = CSL_EmifsGetHwStatus(hEmifs, CSL_EMIFS_QUERY_ABORT_STATUS, &abortStatus); @endverbatim * * @return Returns the status of the operation (see @a CSL_Status) * Status is: * CSL_SOK - successful completion of the query * CSL_ESYS_INVQUERY - query command not supported */CSL_Status CSL_emifsGetHwStatus( /** Pointer to the object that holds reference to the * instance of EMIFS requested after the call */ CSL_EmifsHandle hEmifs, /** The query to this API, which indicates the status * to be returned */ CSL_EmifsHwStatusQuery query, /** Placeholder to return the status; @a void* casted */ void *voidPtr);/** @brief Function to get the Base-address of the peripheral instance. * * This function is used for getting the base-address of the peripheral * instance. This function will be called inside the @ CSL_emifsOpen() * function call. * * Note: This function is open for re-implementing if the user wants to modify * the base address of the peripheral object to point to a different * location and there by allow CSL initiated write/reads into peripheral * MMR's go to an alternate location. Please refer the documentation for * more details. * * @b Example: * @verbatim CSL_Status status; CSL_EmifsBaseAddress baseAddress; ... status = CSL_emifsGetBaseAddress(CSL_EMIFS_1, NULL, &baseAddress); @endverbatim * * @return Returns the status of the operation (see @a CSL_Status) * */CSL_Status CSL_emifsGetBaseAddress( /** Instance number */ CSL_InstNum emifsNum, /** Module specific parameters */ CSL_EmifsParam * pEmifsParam, /** Base address details */ CSL_EmifsBaseAddress * pBaseAddress);#ifdef __cplusplus}#endif#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?