/* Read data with special length in master mode through the I2Cx peripheral under in-house IP.  */
u8 I2C_MasterRead_Patch(I2C_TypeDef *I2Cx, u8 *pBuf, u8 len)
/* Read data with special length in master mode through the I2Cx peripheral under in-house IP.  */
u8 I2C_MasterRead_Patch(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;
		}		while((I2C_CheckFlagState(I2Cx, BIT_IC_STATUS_RFNE)) == 0) {
			if(I2C_GetRawINT(I2Cx) & BIT_IC_RAW_INTR_STAT_TX_ABRT) {
				DBG_8195A(" TX_ABRT\n");
				I2C_ClearAllINT(I2Cx);
				return cnt;
			}
		}
		*pBuf++ = (u8)I2Cx->IC_DATA_CMD;
	}
	return cnt;
}