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

📄 flcustom.c

📁 电子盘DEMO板程序
💻 C
字号:
/******************************************************************************/
/*                                                                            */
/*  Copyright (C), 1995-2006, msystems Ltd. All rights reserved.              */
/*                                                                            */
/*  Redistribution and use in source and binary forms, with or without        */
/*  modification, are permitted provided that the following conditions are    */
/*  met:                                                                      */
/*  1. Redistributions of source code must retain the above copyright notice, */
/*     this list of conditions and the following disclaimer.                  */
/*  2. Redistributions in binary form must reproduce the above copyright      */
/*     notice, this list of conditions and the following disclaimer in the    */
/*     documentation and/or other materials provided with the distribution.   */
/*  3. Neither the name of msystems nor the names of its contributors may be  */
/*     used to endorse or promote products derived from this software without */
/*     specific prior written permission.                                     */
/*                                                                            */
/*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS       */
/*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED */
/*  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR             */
/*  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT      */
/*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,     */
/*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED  */
/*  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR    */
/*  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
/*  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING      */
/*  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS        */
/*  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.              */
/*                                                                            */
/******************************************************************************/
/*
 * $Log:   V:/PVCSDB/DiskOnChip/archives/DocDriver/TrueFFS BD/examples/lowlevel/flcustom.c-arc  $
 * 
 *    Rev 1.2   Sep 11 2006 13:42:40   yaniv.iarovici
 * Legal Header added
 * 
 *    Rev 1.1   Sep 03 2006 14:54:22   Yaniv.Iarovici
 * 1. Removed unused reference to MDOC_ACCESS_SPI.
 * 2. Relate to returned error code as DOCH_Error instead of flStatus.
 * 
 *    Rev 1.0   Aug 09 2006 17:49:32   Polina.Marimont
 * Initial revision.
 */



#include "flsystem.h"
#include "flcommon.h"
#include "flstdcmp.h"

#ifdef DOCH_FILE_SIMULATION
#include "sim_ram.h"
#endif /* DOCH_FILE_SIMULATION*/


/* environment variables */
#ifdef FL_ENVIRONMENT_VARS

unsigned char flUse8Bit;

/*-----------------------------------------------------------------------*/
/*                 f l s e t E n v V a r                                 */
/*                                                                       */
/*  Sets the value of all environment variables                          */
/*  Parameters : None                                                    */
/*-----------------------------------------------------------------------*/
void flSetEnvVar(void)
{
    flUse8Bit               = 1;
}

#endif /* FL_ENVIRONMENT_VARS */

/*-----------------------------------------------------------------------*/
/*           f l R e g i s t e r D o c h P a r a m s		             */
/*                                                                       */
/* DOCH socket registration routine.							         */
/*                                                                       */
/* This function is called by DochSDKInit per socket at initialization.  */
/*                                                                       */
/* Parameters:                                                           */
/*      None															 */
/*-----------------------------------------------------------------------*/
DOCH_Error flRegisterDochParams(void)
{
	DOCH_Error dochErr = DOCH_OK;
	FLBoolean bHalReg = FALSE;

#ifdef MDOC_ACCESS_NOR
	/* Step 0 - Register HAL    */
	/*==========================*/
	dochErr = flRegisterDOCH_Hal_NOR();
	if(dochErr != DOCH_OK)
    {
		DBG_PRINT_WRN(FLZONE_FULL,"DOCH registration failed.\r\n");
		return dochErr;
    }
	bHalReg = TRUE;
#endif /*MDOC_ACCESS_NOR*/

#ifdef MDOC_ACCESS_SPI
	if( bHalReg == FALSE )
	{
		dochErr = flRegisterDOCH_Hal_SPI();
		if(dochErr != flOK)
		{
			DBG_PRINT_WRN(FLZONE_API,"DOCH SPI registration failed.\r\n");
			return (FLStatus)dochErr;
		}
		dochErr = DochRegisterSocket(0);/* window does not matter */
		if(dochErr != DOCH_OK)
		{
			DBG_PRINT_WRN(FLZONE_FULL,"DOCH registration failed.\r\n");
		}
		bHalReg = TRUE;
	}
#endif /*MDOC_ACCESS_SPI*/

#ifdef DOCH_FILE_SIMULATION
	if( bHalReg == FALSE )
	{
		wRamSimulateDevice = DEF_DOCH_DEV_SIMULATE;
		pSimFileName = DEF_DOCH_SIMULATE_FILE_NAME;
		if (wRamSimulateDevice!=RAM_MTD_UNKNOWN)
		{
			dochErr=sim_setSizeByType(wRamSimulateDevice);
			if ((dochErr==DOCH_OK)&&(pSimFileName==NULL))
			{
				dochErr=sim_FileNameByType(wRamSimulateDevice);
			}
		}
		if( (pSimFileName!=NULL) &&((wRamSimulateDevice==RAM_MTD_UNKNOWN)||(dochErr==DOCH_OK)) )
		{
			dochErr = flRegisterDOCH_Hal_SIM();
		}
		bHalReg = TRUE;
	}
#endif /*DOCH_FILE_SIMULATION*/


	/* Step 1 - Register Socket */
	/*==========================*/
	dochErr = flRegisterDOCH3SOC(FL_DOC_ADDRESS);
	if(dochErr != flOK)
    {
		DBG_PRINT_WRN(FLZONE_FULL,"DOCH registration failed.\r\n");
    }
    return dochErr;
}/*flRegisterDochParams*/

/* end of file flcustom.c */


⌨️ 快捷键说明

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