From 47501b582b51396cac7dc15a646e017f4e91e822 Mon Sep 17 00:00:00 2001
From: "Suren A. Chilingaryan" <csa@dside.dyndns.org>
Date: Tue, 24 Jul 2012 23:10:01 +0200
Subject: Read output_mode and adc_resolution from frame header

---
 src/ufodecode.c | 4 +++-
 src/ufodecode.h | 3 +++
 test/ipedec.c   | 2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/ufodecode.c b/src/ufodecode.c
index 43085d7..68b0da7 100644
--- a/src/ufodecode.c
+++ b/src/ufodecode.c
@@ -561,8 +561,10 @@ size_t ufo_decoder_decode_frame(UfoDecoder      *decoder,
             pos++;
 
             meta->frame_number = raw[pos++] & 0x1FFFFFF;
-            CHECK_VALUE(raw[pos] >> 24, 0x50);
+            CHECK_VALUE(raw[pos] >> 28, 0x5);
             meta->time_stamp = raw[pos++] & 0xFFFFFF;
+            meta->output_mode = (raw[pos] >> 24) & 0x3;
+            meta->adc_resolution = (raw[pos] >> 26) & 0x3
             break;
 
         default:
diff --git a/src/ufodecode.h b/src/ufodecode.h
index 7c2f098..228bec3 100644
--- a/src/ufodecode.h
+++ b/src/ufodecode.h
@@ -45,6 +45,9 @@ typedef struct {
     uint32_t        n_rows;
     uint8_t         n_skipped_rows;
     uint16_t        cmosis_start_address;
+    uint8_t         output_mode;
+    uint8_t         adc_resolution;
+
     union {
         uint32_t            bits;
         UfoDecoderStatus1   desc;
diff --git a/test/ipedec.c b/test/ipedec.c
index 56236ce..c9eceb3 100644
--- a/test/ipedec.c
+++ b/test/ipedec.c
@@ -51,6 +51,8 @@ print_meta_data (UfoDecoderMeta *meta)
 {
     printf("  frame_number    = %i\n", meta->frame_number);
     printf("  time_stamp      = %i\n", meta->time_stamp);
+    printf("  output_mode     = %i\n", meta->output_mode);
+    printf("  adc_resolution  = %i\n", meta->adc_resolution);
     printf("  n_rows          = %i\n", meta->n_rows);
     printf("  n_skipped_rows  = %i\n", meta->n_skipped_rows);
 
-- 
cgit v1.2.3