| 168 | static void free_temp_buffer(struct session_vdev *vdev); |
| 169 | |
| 170 | static 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 | |
| 208 | static int close_archive(struct session_vdev *vdev) |
| 209 | { |