/* Function: MX25_2READ Arguments: flash_address, 32 bit flash memory address target_address, buffer address to store returned data byte_length, length of returned data in byte unit Description: The 2READ instruction enable double throughput of Serial Flash in read mode Return Message: FlashAddressInvalid, FlashOperationSuccess  */
ReturnMsg MX25_2READ(uint32_t flash_address, uint8_t *target_address, uint32_t byte_length)
/* Function: MX25_2READ Arguments: flash_address, 32 bit flash memory address target_address, buffer address to store returned data byte_length, length of returned data in byte unit Description: The 2READ instruction enable double throughput of Serial Flash in read mode Return Message: FlashAddressInvalid, FlashOperationSuccess  */
ReturnMsg MX25_2READ(uint32_t flash_address, uint8_t *target_address, uint32_t byte_length)
{
    uint32_t index;
    uint8_t  addr_4byte_mode;
    uint8_t  dc;
    if( flash_address > FlashSize ) return FlashAddressInvalid;
    if( IsFlash4Byte() )
        addr_4byte_mode = TRUE;
    else
        addr_4byte_mode = FALSE;
    dc = GetDummyCycle( DUMMY_CONF_2READ );
    CS_Low();
    SendByte( FLASH_CMD_2READ, SIO );
    SendFlashAddr( flash_address, DIO, addr_4byte_mode );
    InsertDummyCycle( dc );
    for( index=0; index < byte_length; index++ )
    {
        *(target_address + index) = GetByte( DIO );
    }
    CS_High();
    return FlashOperationSuccess;
}