Exemplo n.º 1
0
T_S16 Fwl_FsInit(T_VOID)
{
    T_S16 ret = 0;
    T_FSCallback FSInitInfo;

    memset(&FSInitInfo, 0, sizeof(FSInitInfo));

    //AK_DEBUG_OUTPUT("Before Global_Initial()");
    FSInitInfo.fGetSecond = Fwl_GetSecond;
    FSInitInfo.fSetSecond = Fwl_SetSecond;
    FSInitInfo.fUniToAsc  = Fwl_UniStr2AnsiStr;
    FSInitInfo.fAscToUni  = Fwl_AnsiStr2UniStr;
#ifdef DEBUG
    FSInitInfo.fPrintf    = (F_Printf)AK_DEBUG_OUTPUT;
#else
#ifdef OS_ANYKA
    FSInitInfo.fPrintf   = AK_NULL;
#else
    FSInitInfo.fPrintf   = (F_Printf)AK_DEBUG_OUTPUT;
#endif
#endif

    /* Initialize the callback functions needed by MtdLib. Here VC may have several
       type-unmatched warnings, but it doesn't matter. */
    FSInitInfo.fGetChipId  = Fwl_FsGetChipChip;
    FSInitInfo.fMemCpy   = (F_MemCpy)memcpy;
    FSInitInfo.fMemSet   = (F_MemSet)memset;
    FSInitInfo.fMemMov   = (F_MemMov)memmove;
    FSInitInfo.fMemCmp   = (F_MemCmp)memcmp;
    FSInitInfo.fPrintf   = (F_Printf)AkDebugOutput;
    FSInitInfo.fRamAlloc = Fwl_RamAlloc;
    FSInitInfo.fRamFree  = Fwl_RamFree;
    FSInitInfo.fRamRealloc  = Fwl_RamRealloc;
    FSInitInfo.fSystemSleep = Fwl_SystemSleep;

#ifdef OS_ANYKA
    FSInitInfo.fSysRst  = (F_MtdSysRst1)Fwl_SystemReset;
#else
    FSInitInfo.fSysRst  = AK_NULL;
#endif

    FSInitInfo.fGetRand = (F_MtdGetRand1)Fwl_GetRand;
    FSInitInfo.fRandSeed = (F_MtdRandSeed1)Fwl_RandSeed;
    FSInitInfo.fCrtSem = Fwl_Create_Semaphore;
    FSInitInfo.fDelSem = Fwl_Delete_Semaphore;
    FSInitInfo.fObtSem = Fwl_Obtain_Semaphore;
    FSInitInfo.fRelSem = Fwl_Release_Semaphore;
    FS_InitCallBack(&FSInitInfo, 512);

#ifdef SUPPORT_SDCARD
    //TODO
    //for(i = 0; i < MMC_SD_MAX_NUM; i++)
    {
        Fwl_MountSD(MMC_SD_CARD);
    }
#endif

    return ret;
}
Exemplo n.º 2
0
BOOL CAKFS::Init(VOID)
{
    T_FSCallback mountinit;
	T_FSA_LIB_CALLBACK fsainit;

    mountinit.out = Test_OutStream;
    mountinit.in  = Test_InStream;
    mountinit.fGetSecond = Test_GetSecond;
    mountinit.fSetSecond = Test_SetSecond;    
    mountinit.fAscToUni  = AnsiStr2UniStr;
    mountinit.fUniToAsc  = UniStr2AnsiStr;
    mountinit.fRamAlloc  = Test_RamAlloc;
    mountinit.fRamRealloc = Test_RamRealloc;
    mountinit.fRamFree   = Test_RamFree;
    mountinit.fCrtSem    = Test_CrtSem;
    mountinit.fDelSem    = Test_DelSem;
    mountinit.fObtSem    = Test_ObtSem;
    mountinit.fRelSem    = Test_RelSem;
    mountinit.fMemCpy    = Test_Memcpy;
    mountinit.fMemSet    = Test_MemSet;
    mountinit.fMemMov    = Test_MemMov;
    mountinit.fMemCmp    = Test_MemCmp;

    mountinit.fPrintf    = Test_Printf;
    mountinit.fGetChipId = Test_GetChipType;
    mountinit.fSysRst    = NULL;  ///目前应该不用 
    mountinit.fRandSeed  = NULL;  //目前应该不用 
    mountinit.fGetRand   = NULL;  //目前应该不用 
    mountinit.fMountThead= NULL;  //目前应该不用 
    mountinit.fKillThead = NULL;  //目前应该不用 
    mountinit.fSystemSleep= fs_sys_sleep;

    //mount初始化
    if (FS_InitCallBack(&mountinit, 64))
	{		
		return FALSE;
	}
    
	fsainit.MemCmp       = Test_MemCmp;
	fsainit.MemCpy       = Test_Memcpy;
	fsainit.MemSet       = Test_MemSet;
	fsainit.MemMov       = Test_MemMov_FSA;
	fsainit.Printf       = Test_Printf;
	fsainit.RamAlloc     = Test_RamAlloc_FSA;
	fsainit.RamFree      = Test_RamFree_FSA;
	fsainit.GetImgMedium = Test_FSA_GetImgMedium;
	fsainit.fFs.FileClose = Fwl_FileClose;
	fsainit.fFs.FileOpen  = Fwl_FileOpen;
	fsainit.fFs.FileRead  = Fwl_FileRead;
	fsainit.fFs.FileSeek  = NULL;//Fwl_FileSeek;//目前应该不用 
	fsainit.fFs.FileWrite = Fwl_FileWrite;
	fsainit.fFs.FsMkDir   = Fwl_MkDir;
    
	//fsa初始化
	if (FSA_init(&fsainit) != FSA_SUCCESS)
	{
		return FALSE;
	}

	return TRUE;
}