Rename session_dev_id to cb_data everywhere.

We use 'cb_data' in all drivers these days, make the few remaining ones
that use 'session_dev_id' consistent.
This commit is contained in:
Uwe Hermann 2013-02-07 09:11:26 +01:00
parent 6fab7b8f53
commit 3e9b7f9c77
9 changed files with 25 additions and 26 deletions

View File

@ -940,7 +940,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
logic.length = tosend * sizeof(uint16_t);
logic.unitsize = 2;
logic.data = samples + sent;
sr_session_send(devc->session_dev_id, &packet);
sr_session_send(devc->cb_data, &packet);
sent += tosend;
}
@ -983,7 +983,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
logic.length = tosend * sizeof(uint16_t);
logic.unitsize = 2;
logic.data = samples;
sr_session_send(devc->session_dev_id, &packet);
sr_session_send(devc->cb_data, &packet);
sent += tosend;
}
@ -991,7 +991,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
/* Only send trigger if explicitly enabled. */
if (devc->use_triggers) {
packet.type = SR_DF_TRIGGER;
sr_session_send(devc->session_dev_id, &packet);
sr_session_send(devc->cb_data, &packet);
}
}
@ -1004,7 +1004,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
logic.length = tosend * sizeof(uint16_t);
logic.unitsize = 2;
logic.data = samples + sent;
sr_session_send(devc->session_dev_id, &packet);
sr_session_send(devc->cb_data, &packet);
}
*lastsample = samples[n - 1];
@ -1052,7 +1052,7 @@ static int receive_data(int fd, int revents, void *cb_data)
if (devc->state.chunks_downloaded >= numchunks) {
/* End of samples. */
packet.type = SR_DF_END;
sr_session_send(devc->session_dev_id, &packet);
sr_session_send(devc->cb_data, &packet);
devc->state.state = SIGMA_IDLE;
@ -1357,7 +1357,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
gettimeofday(&devc->start_tv, 0);
sigma_set_register(WRITE_MODE, 0x0d, devc);
devc->session_dev_id = cb_data;
devc->cb_data = cb_data;
/* Send header packet to the session bus. */
std_session_send_df_header(cb_data, DRIVER_LOG_DOMAIN);

View File

@ -196,7 +196,7 @@ struct dev_context {
struct sigma_trigger trigger;
int use_triggers;
struct sigma_state state;
void *session_dev_id;
void *cb_data;
};
#endif

View File

@ -100,7 +100,7 @@ static GSList *hw_scan(GSList *options)
devc->cur_samplerate = SR_MHZ(100); /* 100MHz == max. samplerate */
devc->limit_msec = 0;
devc->limit_samples = 0;
devc->session_dev_id = NULL;
devc->cb_data = NULL;
memset(devc->mangled_buf, 0, BS);
devc->final_buf = NULL;
devc->trigger_pattern = 0x00; /* Value irrelevant, see trigger_mask. */
@ -449,7 +449,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
sr_dbg("Hardware acquisition started successfully.");
devc->session_dev_id = cb_data;
devc->cb_data = cb_data;
/* Send header packet to the session bus. */
std_session_send_df_header(cb_data, DRIVER_LOG_DOMAIN);

View File

@ -488,7 +488,7 @@ SR_PRIV void send_block_to_session_bus(struct dev_context *devc, int block)
logic.length = BS;
logic.unitsize = 1;
logic.data = devc->final_buf + (block * BS);
sr_session_send(devc->session_dev_id, &packet);
sr_session_send(devc->cb_data, &packet);
return;
}
@ -511,7 +511,7 @@ SR_PRIV void send_block_to_session_bus(struct dev_context *devc, int block)
logic.length = trigger_point;
logic.unitsize = 1;
logic.data = devc->final_buf + (block * BS);
sr_session_send(devc->session_dev_id, &packet);
sr_session_send(devc->cb_data, &packet);
}
/* Send the SR_DF_TRIGGER packet to the session bus. */
@ -519,7 +519,7 @@ SR_PRIV void send_block_to_session_bus(struct dev_context *devc, int block)
(block * BS) + trigger_point);
packet.type = SR_DF_TRIGGER;
packet.payload = NULL;
sr_session_send(devc->session_dev_id, &packet);
sr_session_send(devc->cb_data, &packet);
/* If at least one sample is located after the trigger... */
if (trigger_point < (BS - 1)) {
@ -532,6 +532,6 @@ SR_PRIV void send_block_to_session_bus(struct dev_context *devc, int block)
logic.length = BS - trigger_point;
logic.unitsize = 1;
logic.data = devc->final_buf + (block * BS) + trigger_point;
sr_session_send(devc->session_dev_id, &packet);
sr_session_send(devc->cb_data, &packet);
}
}

View File

@ -64,8 +64,7 @@ struct dev_context {
/** The current sampling limit (in number of samples). */
uint64_t limit_samples;
/** TODO */
void *session_dev_id;
void *cb_data;
/**
* A buffer containing some (mangled) samples from the device.

View File

@ -79,7 +79,7 @@ struct dev_context {
GIOChannel *channels[2];
uint8_t sample_generator;
uint64_t samples_counter;
void *session_dev_id;
void *cb_data;
int64_t starttime;
};
@ -371,7 +371,7 @@ static int receive_data(int fd, int revents, void *cb_data)
logic.length = sending_now;
logic.unitsize = 1;
logic.data = buf;
sr_session_send(devc->session_dev_id, &packet);
sr_session_send(devc->cb_data, &packet);
devc->samples_counter += sending_now;
}
@ -398,7 +398,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
}
devc->sample_generator = default_pattern;
devc->session_dev_id = cb_data;
devc->cb_data = cb_data;
devc->samples_counter = 0;
/*
@ -455,7 +455,7 @@ static int hw_dev_acquisition_stop(struct sr_dev_inst *sdi, void *cb_data)
/* Send last packet. */
packet.type = SR_DF_END;
sr_session_send(devc->session_dev_id, &packet);
sr_session_send(devc->cb_data, &packet);
return SR_OK;
}

View File

@ -688,7 +688,7 @@ static void finish_acquisition(struct dev_context *devc)
/* Terminate session. */
packet.type = SR_DF_END;
sr_session_send(devc->session_dev_id, &packet);
sr_session_send(devc->cb_data, &packet);
/* Remove fds from polling. */
lupfd = libusb_get_pollfds(drvc->sr_ctx->libusb_ctx);
@ -820,7 +820,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
*/
packet.type = SR_DF_TRIGGER;
packet.payload = NULL;
sr_session_send(devc->session_dev_id, &packet);
sr_session_send(devc->cb_data, &packet);
/*
* Send the samples that triggered it,
@ -831,7 +831,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
logic.unitsize = sizeof(*devc->trigger_buffer);
logic.length = devc->trigger_stage * logic.unitsize;
logic.data = devc->trigger_buffer;
sr_session_send(devc->session_dev_id, &packet);
sr_session_send(devc->cb_data, &packet);
devc->trigger_stage = TRIGGER_FIRED;
break;
@ -861,7 +861,7 @@ static void receive_transfer(struct libusb_transfer *transfer)
logic.length = transfer->actual_length - trigger_offset_bytes;
logic.unitsize = sample_width;
logic.data = cur_buf + trigger_offset_bytes;
sr_session_send(devc->session_dev_id, &packet);
sr_session_send(devc->cb_data, &packet);
devc->num_samples += cur_sample_count;
if (devc->limit_samples &&
@ -943,7 +943,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
return SR_ERR;
}
devc->session_dev_id = cb_data;
devc->cb_data = cb_data;
devc->num_samples = 0;
devc->empty_transfer_count = 0;

View File

@ -95,7 +95,7 @@ struct dev_context {
int submitted_transfers;
int empty_transfer_count;
void *session_dev_id;
void *cb_data;
struct sr_usb_dev_inst *usb;

View File

@ -123,7 +123,7 @@ struct dev_context {
double dso_trigger_voltage;
uint16_t dso_trigger_width;
struct mso_prototrig protocol_trigger;
void *session_dev_id;
void *cb_data;
uint16_t buffer_n;
char buffer[4096];
};