MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / trans_data

Function trans_data

libsigrok4DSL/session_driver.c:170–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168static void free_temp_buffer(struct session_vdev *vdev);
169
170static int trans_data(const struct sr_dev_inst *sdi)
171{
172 // translate for old format
173 struct session_vdev *vdev = sdi->priv;
174 GSList *l;
175 struct sr_channel *probe;
176
177 assert(vdev->buf != NULL);
178 assert(vdev->logic_buf != NULL);
179 assert(CHUNKSIZE % UNITLEN == 0);
180
181 // int bytes = ceil(vdev->num_probes / 8.0);
182 int bytes = 2;
183 uint8_t *src_ptr = (uint8_t *)vdev->buf;
184 uint64_t *dest_ptr = (uint64_t *)vdev->logic_buf;
185
186 for (int k = 0; k < CHUNKSIZE / (UNITLEN * bytes); k++)
187 {
188 src_ptr = (uint8_t *)vdev->buf + (k * bytes * UNITLEN);
189 for (l = sdi->channels; l; l = l->next)
190 {
191 probe = l->data;
192 if (!probe->enabled)
193 continue;
194 uint64_t mask = 1ULL << probe->index;
195 uint64_t result = 0;
196 for (int j = 0; j < UNITLEN; j++)
197 {
198 if (*(uint64_t *)(src_ptr + j * bytes) & mask)
199 result += 1ULL << j;
200 }
201 *dest_ptr++ = result;
202 }
203 }
204
205 return SR_OK;
206}
207
208static int close_archive(struct session_vdev *vdev)
209{

Callers 1

receive_dataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected