概念

MIPI DCS: MIPI Display Command Set

DCS读取多个字节

DCS读取多个字节,需先通过MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE(0x37)设置要读取的最大字节数

//...
ret = mipi_dsi_set_maximum_return_packet_size(state, 2);
if (ret) {	
	printf("mipi_dsi_set_maximum_return_packet_size ,error=%d!!\n", ret);
	return ret;
}
ret = mipi_dsi_dcs_read(state, 0x04, &dwin_id[0], sizeof(dwin_id));
if (ret <= 0) {	
	printf("mipi_dsi_dcs_read ID[04h] ,error=%d!!\n", ret);
	return ret;
}
printf("mipi_dsi_dcs_read ID[04h]=%x, %x\n", dwin_id[0], dwin_id[1]);
//...

DSI帧业务类型:

/* MIPI DSI Processor-to-Peripheral transaction types */
enum {
	MIPI_DSI_V_SYNC_START				= 0x01,
	MIPI_DSI_V_SYNC_END				= 0x11,
	MIPI_DSI_H_SYNC_START				= 0x21,
	MIPI_DSI_H_SYNC_END				= 0x31,

	MIPI_DSI_COLOR_MODE_OFF				= 0x02,
	MIPI_DSI_COLOR_MODE_ON				= 0x12,
	MIPI_DSI_SHUTDOWN_PERIPHERAL			= 0x22,
	MIPI_DSI_TURN_ON_PERIPHERAL			= 0x32,

	MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM		= 0x03,
	MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM		= 0x13,
	MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM		= 0x23,

	MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM		= 0x04,
	MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM		= 0x14,
	MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM		= 0x24,

	MIPI_DSI_DCS_SHORT_WRITE			= 0x05,
	MIPI_DSI_DCS_SHORT_WRITE_PARAM			= 0x15,

	MIPI_DSI_DCS_READ				= 0x06,

	MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE		= 0x37,

	MIPI_DSI_END_OF_TRANSMISSION			= 0x08,

	MIPI_DSI_NULL_PACKET				= 0x09,
	MIPI_DSI_BLANKING_PACKET			= 0x19,
	MIPI_DSI_GENERIC_LONG_WRITE			= 0x29,
	MIPI_DSI_DCS_LONG_WRITE				= 0x39,

	MIPI_DSI_LOOSELY_PACKED_PIXEL_STREAM_YCBCR20	= 0x0c,
	MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR24		= 0x1c,
	MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16		= 0x2c,

	MIPI_DSI_PACKED_PIXEL_STREAM_30			= 0x0d,
	MIPI_DSI_PACKED_PIXEL_STREAM_36			= 0x1d,
	MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12		= 0x3d,

	MIPI_DSI_PACKED_PIXEL_STREAM_16			= 0x0e,
	MIPI_DSI_PACKED_PIXEL_STREAM_18			= 0x1e,
	MIPI_DSI_PIXEL_STREAM_3BYTE_18			= 0x2e,
	MIPI_DSI_PACKED_PIXEL_STREAM_24			= 0x3e,
};

帧类型

+ 短帧:4 bytes (固定)
+ 长帧:6~65541 bytes (可变)  

短帧结构

  • 帧头部(4个字节)
    • 数据标识(DI) 1个字节
    • 帧数据- 2个字节 (长度固定为2个字节)
    • 错误检测(ECC) 1个字节
  • 帧大小
    • 长度固定为4个字节

    长帧结构

  • 帧头部(4个字节)
    • 数据标识(DI) 1个字节
    • 数据计数- 2个字节 (数据填充的个数)
    • 错误检测(ECC) 1个字节
  • 数据填充(0~65535 字节)
    • 长度=WC*字节
  • 帧尾:校验和(2个字节)
  • 帧大小:
    • 4 + (0~65535) + 2 = 6 ~ 65541 字节

参考

https://blog.csdn.net/qq160816/article/details/19555957