static int32_t sprdfb_dsi_gen_write(uint8_t *param, uint16_t param_length)
{
	dsih_error_t result;
	result = mipi_dsih_gen_wr_cmd(&(dsi_ctx.dsi_inst), 0, param, param_length);
	if(OK != result){
		FB_PRINT("sprdfb: [%s] error (%d)\n", __FUNCTION__, result);
		return -1;
	}
	return 0;
}
示例#2
0
/**
 * Send a DCS write command
 * @param instance pointer to structure holding the DSI Host core information
 * @param vc destination virtual channel
 * @param params byte array of command parameters, including the
 * command itself
 * @param param_length length of the above array
 * @return error code
 */
dsih_error_t mipi_dsih_dcs_wr_cmd(dsih_ctrl_t * instance, uint8_t vc, uint8_t* params, uint16_t param_length)
{
	int type = 0;
	uint8_t packet_type = 0;
	if (instance == 0)
	{
		return ERR_DSI_INVALID_INSTANCE;
	}
	if (instance->status != INITIALIZED)
	{
		return ERR_DSI_INVALID_INSTANCE;
	}
	if (params == 0)
	{
		return ERR_DSI_OUT_OF_BOUND;
	}

	if (param_length > 2)
		type = 2;
	switch (params[type])
	{
		case 0x39:
		case 0x38:
		case 0x34:
		case 0x29:
		case 0x28:
		case 0x21:
		case 0x20:
		case 0x13:
		case 0x12:
		case 0x11:
		case 0x10:
		case 0x01:
		case 0x00:
			packet_type = 0x05; /* DCS short write no param */
			break;
		case 0x3A:
		case 0x36:
		case 0x35:
		case 0x26:
			packet_type = 0x15; /* DCS short write 1 param */
			break;
		case 0x44:
		case 0x3C:
		case 0x37:
		case 0x33:
		case 0x30:
		case 0x2D:
		case 0x2C:
		case 0x2B:
		case 0x2A:
			packet_type = 0x39; /* DCS long write/write_LUT command packet */
			break;
		default:
			if (instance->log_error != 0)
			{
				instance->log_error("invalid DCS command");
			}
			return ERR_DSI_INVALID_COMMAND;
	}
	return mipi_dsih_gen_wr_cmd(instance, vc, packet_type, params, param_length);
}