/* Read data from SPI Flash by Page Read mode.  */
void SPIM_DMA_Read(uint32_t u32Addr, int is4ByteAddr, uint32_t u32NRx, uint8_t pu8RxBuf[], uint32_t u32RdCmd, int isSync)
/* Read data from SPI Flash by Page Read mode.  */
void SPIM_DMA_Read(uint32_t u32Addr, int is4ByteAddr, uint32_t u32NRx, uint8_t pu8RxBuf[], uint32_t u32RdCmd, int isSync)
{
    uint32_t u32TimeOutCount = SystemCoreClock;
    g_SPIM_i32ErrCode = 0;
    SPIM_SET_OPMODE(SPIM_CTL0_OPMODE_PAGEREAD);
    SPIM_SET_SPIM_MODE(u32RdCmd);
    SPIM_SET_4BYTE_ADDR_EN(is4ByteAddr);
    SPIM->SRAMADDR = (uint32_t) pu8RxBuf;
    SPIM->DMACNT = u32NRx;
    SPIM->FADDR = u32Addr;
    SPIM_SET_GO();
    if (isSync)
    {
        SPIM_WAIT_FREE()
        {
            if (--u32TimeOutCount == 0)
            {
                g_SPIM_i32ErrCode = SPIM_TIMEOUT_ERR;
                break;
            }
        }
    }
}