Xingyu Li

Some WinCE NAND driver testbench code -blog archive

Discussion created by Xingyu Li Employee on Mar 17, 2011

Here is a testbench file, one can embed it into Fmd to do a test:

 

PVOID FMD_Init(LPCTSTR lpActiveReg, PPCI_REG_INFO pRegIn, PPCI_REG_INFO pRegOut)
{
    DWORD i;
    PVOID pResult;
   
    UNREFERENCED_PARAMETER(lpActiveReg);
    UNREFERENCED_PARAMETER(pRegIn);
    UNREFERENCED_PARAMETER(pRegOut);
   
    // 0. Setup global variables. Also may add more software logic here in future
    memset(&g_FlashInfoExt, 0, sizeof(g_FlashInfoExt));
    BSPNAND_GetFlashInfo(&g_FlashInfoExt);
   
    // 1. initial NFC hardware
    pResult = CSPNAND_Init(&g_FlashInfoExt);
    if(pResult == NULL)
    {
        goto cleanUp;
    }
   
    // 2. initial nand chip and verify nand id
    for(i = 0; i < g_FlashInfoExt.NumberOfChip; i++)
    {
        CSPNAND_Reset(i);
        if(CSPNAND_ReadID(i) != g_FlashInfoExt.NANDIDCode)
        {
            pResult = NULL;
            goto cleanUp;
        }
    }

    if(g_FlashInfoExt.ILSupport && CSPNAND_ILSupport())
    {
        //silicon supports interleave mode & bsp needs interleave mode
        g_bInterLeaveMode = TRUE;
    }

    NANDOperationTest();
    if(!BBT_Init())
    {
        RETAILMSG(TRUE, (TEXT("InitializeBBT Fail\r\n")));
    }

cleanUp:
    return pResult;
}

nandtest.cpp

Outcomes