diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2017-08-16 22:41:23 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2017-08-16 22:41:23 +0200 |
commit | 70350338f84596c1c5f42697774250773be52da1 (patch) | |
tree | 2c6bb54716b2415178f63555c46d1f53dfa6cdf5 /reader.c | |
parent | 4d6036156fc5d00b8d627195e4e9092445f1412c (diff) | |
download | ipecamera-70350338f84596c1c5f42697774250773be52da1.tar.gz ipecamera-70350338f84596c1c5f42697774250773be52da1.tar.bz2 ipecamera-70350338f84596c1c5f42697774250773be52da1.tar.xz ipecamera-70350338f84596c1c5f42697774250773be52da1.zip |
Support HighFlex-based ipecamera
Diffstat (limited to 'reader.c')
-rw-r--r-- | reader.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -61,12 +61,9 @@ int ipecamera_compute_buffer_size(ipecamera_t *ctx, ipecamera_format_t format, s switch (format) { case IPECAMERA_FORMAT_CMOSIS: - max_channels = CMOSIS_MAX_CHANNELS; - line_size = (1 + CMOSIS_PIXELS_PER_CHANNEL) * 32; - break; case IPECAMERA_FORMAT_CMOSIS20: - max_channels = CMOSIS20_MAX_CHANNELS; - line_size = (1 + CMOSIS20_PIXELS_PER_CHANNEL) * 32 / 2; + max_channels = CMOSIS_MAX_CHANNELS; + line_size = ctx->data_line_size; break; default: pcilib_warning("Unsupported version (%u) of frame format...", format); @@ -92,6 +89,7 @@ int ipecamera_compute_buffer_size(ipecamera_t *ctx, ipecamera_format_t format, s static int ipecamera_parse_header(ipecamera_t *ctx, ipecamera_payload_t *buf, size_t buf_size) { + int err; int last = buf[0] & 1; int version = (buf[0] >> 1) & 7; size_t size = 0, n_lines; @@ -129,7 +127,9 @@ static int ipecamera_parse_header(ipecamera_t *ctx, ipecamera_payload_t *buf, si } size += CMOSIS_FRAME_HEADER_SIZE; - ipecamera_compute_buffer_size(ctx, format, size, n_lines); + + err = ipecamera_compute_buffer_size(ctx, format, size, n_lines); + if (err) return 0; // Returns total size of found headers or 0 on the error return size; @@ -348,7 +348,7 @@ void *ipecamera_reader_thread(void *user) { if ((!err)&&(value&0x2FFFFFFF)) { pcilib_warning("Camera stuck in busy, trying to recover..."); GET_REG(control_reg, saved); - SET_REG(control_reg, IPECAMERA_IDLE); + SET_REG(control_reg, IPECAMERA_IDLE|(saved&0xFFFF0000)); while ((value&0x2FFFFFFF)&&(ctx->run_reader)) { usleep(IPECAMERA_NOFRAME_SLEEP); } |