/* @ Funciton: NF_EraseBlock Parameter: block (max: 2048) Return: 0: Flash Operation OK 1: Flash Operation NG  */
int NF_EraseBlock(unsigned int block)
/* @ Funciton: NF_EraseBlock Parameter: block (max: 2048) Return: 0: Flash Operation OK 1: Flash Operation NG  */
int NF_EraseBlock(unsigned int block)
{
    rt_uint32_t blockPage;
    trace_log("Erase block %d: ", block);
    NF_Init();
    blockPage = (block << 5);
    NF_OE_L();
    NF_DATA_OUT();
    NF_CMD(NAND_CMD_ERASE1);
    NF_ADDR(blockPage & 0xff);
    NF_ADDR((blockPage >> 8) & 0xff);
    NF_CMD(NAND_CMD_ERASE2);
    if(NF_ReadStatus())
    {
        NF_Reset();
        NF_OE_H();
        NF_UnInit();
        trace_log("Failed\n");
        rt_kprintf("erase block failed\n");
        return FLASH_NG;
    }
    NF_OE_H();
    NF_UnInit();
    trace_log("OK\n");
    return FLASH_OK;
}