Esempio n. 1
0
void ipc_rfs_send_io_confirm_for_nv_read_item(struct ipc_client *client, struct ipc_message_info *info)
{
    struct ipc_rfs_io *rfs_io = (struct ipc_rfs_io *) info->data;
    struct ipc_rfs_io_confirm *rfs_io_conf;
    void *rfs_data;
    int rc;

    if (rfs_io == NULL)
    {
        ipc_client_log(client, "ERROR: Request message is invalid: aseq = %i", info->aseq);
        return;
    }

    rfs_io_conf = malloc(rfs_io->length + sizeof(struct ipc_rfs_io_confirm));
    memset(rfs_io_conf, 0, rfs_io->length + sizeof(struct ipc_rfs_io_confirm));
    rfs_data = rfs_io_conf + sizeof(struct ipc_rfs_io_confirm);

    ipc_client_log(client, "Asked to read 0x%x bytes at offset 0x%x", rfs_io->length, rfs_io->offset);
    rc = nv_data_read(client, rfs_io->offset, rfs_io->length, rfs_data);

#ifdef DEBUG
    ipc_client_log(client, "Read rfs_data dump:");
    ipc_client_hex_dump(client, rfs_data, rfs_io->length);
#endif

    ipc_client_log(client, "Preparing RFS IO Confirm message (rc is %d)", rc);
    rfs_io_conf->confirm = rc < 0 ? 0 : 1;
    rfs_io_conf->offset = rfs_io->offset;
    rfs_io_conf->length = rfs_io->length;

    ipc_client_send(client, IPC_RFS_NV_READ_ITEM, 0, (unsigned char*) rfs_io_conf,
                    rfs_io->length + sizeof(struct ipc_rfs_io_confirm), info->aseq);
    free(rfs_io_conf);
}
Esempio n. 2
0
void ipc_rfs_nv_read_item(struct ipc_message_info *info)
{
	struct ipc_rfs_io *rfs_io = (struct ipc_rfs_io *) info->data;
	struct ipc_rfs_io_confirm *rfs_io_conf;
	struct ipc_client *ipc_client;
	void *rfs_data;
	int rc;

	ipc_client = ((struct ipc_client_object *) ipc_rfs_client->object)->ipc_client;

	if(rfs_io == NULL) {
		LOGE("Error: NULL rfs_io");
		return;
	}

	rfs_io_conf = malloc(rfs_io->length + sizeof(struct ipc_rfs_io_confirm));
	memset(rfs_io_conf, 0, rfs_io->length + sizeof(struct ipc_rfs_io_confirm));
	rfs_data = rfs_io_conf + sizeof(struct ipc_rfs_io_confirm);

	LOGD("Asked to read 0x%x bytes at offset 0x%x", rfs_io->length, rfs_io->offset);
	rc = nv_data_read(ipc_client, rfs_io->offset, rfs_io->length, rfs_data);

	LOGD("Read rfs_data dump:");
	hex_dump(rfs_data, rfs_io->length > 0x100 ? 0x100 : rfs_io->length);

	LOGD("Sending RFS IO Confirm message (rc is %d)", rc);
	rfs_io_conf->confirm = rc < 0 ? 0 : 1;
	rfs_io_conf->offset = rfs_io->offset;
	rfs_io_conf->length = rfs_io->length;

	ipc_rfs_send(IPC_RFS_NV_READ_ITEM, rfs_io_conf, rfs_io->length + sizeof(struct ipc_rfs_io_confirm), info->aseq);

	free(rfs_io_conf);
}