/* Read data with special length in master mode through the I2Cx peripheral under DW IP.  */
void I2C_MasterReadDW(I2C_TypeDef *I2Cx, u8 *pBuf, u8 len)
/* Read data with special length in master mode through the I2Cx peripheral under DW IP.  */
void I2C_MasterReadDW(I2C_TypeDef *I2Cx, u8 *pBuf, u8 len)
{
	u8 cnt = 0;
	assert_param(IS_I2C_ALL_PERIPH(I2Cx));
	for(cnt = 0; cnt < len; cnt++)
	{
		if(cnt >= len - 1)
		{
			I2Cx->IC_DATA_CMD = 0x0003 << 8;
		}
		else
		{
			I2Cx->IC_DATA_CMD = 0x0001 << 8;
		}
		if(cnt > 0)
		{			while((I2C_CheckFlagState(I2Cx, BIT_IC_STATUS_RFNE)) == 0);
			*pBuf++ = (u8)I2Cx->IC_DATA_CMD;
		}
	}
	while((I2C_CheckFlagState(I2Cx, BIT_IC_STATUS_RFNE)) == 0);
	*pBuf++ = (u8)I2Cx->IC_DATA_CMD;
}