summaryrefslogtreecommitdiffstats
path: root/ipecamera/reader.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2012-10-09 17:53:27 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2012-10-09 17:53:27 +0200
commit252524d32fea5fa63e49f500a1641a619946c036 (patch)
tree35bb37206fcd334d98b2937071d508de7008a467 /ipecamera/reader.c
parent63ef59492469c08e8d3c7d8a186e4a765eae87b0 (diff)
downloadpcitool-252524d32fea5fa63e49f500a1641a619946c036.tar.gz
pcitool-252524d32fea5fa63e49f500a1641a619946c036.tar.bz2
pcitool-252524d32fea5fa63e49f500a1641a619946c036.tar.xz
pcitool-252524d32fea5fa63e49f500a1641a619946c036.zip
Support both UFO4 and UFO5 frame formats
Diffstat (limited to 'ipecamera/reader.c')
-rw-r--r--ipecamera/reader.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/ipecamera/reader.c b/ipecamera/reader.c
index cf5fc5c..048f536 100644
--- a/ipecamera/reader.c
+++ b/ipecamera/reader.c
@@ -21,14 +21,22 @@
int ipecamera_compute_buffer_size(ipecamera_t *ctx, size_t lines) {
- const size_t line_size = (1 + IPECAMERA_PIXELS_PER_CHANNEL) * 32;
const size_t header_size = 8 * sizeof(ipecamera_payload_t);
const size_t footer_size = 8 * sizeof(ipecamera_payload_t);
- size_t raw_size, padded_blocks;
-
- raw_size = header_size + lines * line_size - 32 + footer_size;
- raw_size *= 16 / ctx->cmosis_outputs;
+ size_t line_size, raw_size, padded_blocks;
+
+
+ switch (ctx->firmware) {
+ case 4:
+ line_size = IPECAMERA_MAX_CHANNELS * (2 + IPECAMERA_PIXELS_PER_CHANNEL / 3) * sizeof(ipecamera_payload_t);
+ raw_size = header_size + lines * line_size + footer_size;
+ break;
+ default:
+ line_size = (1 + IPECAMERA_PIXELS_PER_CHANNEL) * 32;
+ raw_size = header_size + lines * line_size - 32 + footer_size;
+ raw_size *= 16 / ctx->cmosis_outputs;
+ }
padded_blocks = raw_size / IPECAMERA_DMA_PACKET_LENGTH + ((raw_size % IPECAMERA_DMA_PACKET_LENGTH)?1:0);