camogm_read.h 2.41 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/** @file camogm_read.h
 * @brief Provides reading data written to raw device storage and saving the data to a device with file system.
 * @copyright  Copyright (C) 2016 Elphel, Inc.
 *
 * <b>License:</b>
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef _CAMOGM_READ_H
#define _CAMOGM_READ_H

#include "camogm.h"

22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
/**
 * @struct disk_index
 * @brief Contains a single entry into disk index directory. Each node in
 * the disk index directory corresponds to a file in the raw device buffer and
 * hold its starting offset, sensor port number, time stamp and file size.
 * @var disk_index::next
 * Pointer to the next index node
 * @var disk_index::prev
 * Pointer to the previous disk index node
 * @var disk_index::rawtime
 * Time stamp in UNIX format
 * @var disk_index::usec
 * The microsecond part of the time stamp
 * @var disk_index::port
 * The sensor port number this frame was captured from
 * @var disk_index::f_size
 * File size in bytes
 * @var disk_index::f_offset
 * The offset of the file start in the raw device buffer (in bytes)
 */
42 43 44 45
struct disk_index {
	struct disk_index *next;
	struct disk_index *prev;
	time_t rawtime;
46
	unsigned int usec;
47 48 49 50 51
	uint32_t port;
	size_t f_size;
	uint64_t f_offset;
};

52 53 54 55 56 57 58 59 60 61
/**
 * @struct disk_idir
 * @brief Contains pointers to disk index directory
 * @var disk_idir::head
 * Pointer to the first node of disk index directory
 * @var disk_idir::tail
 * Pointer to the last node of disk index directory
 * @var disk_idir::size
 * The number of nodes in disk index directory
 */
62 63 64 65 66 67
struct disk_idir {
	struct disk_index *head;
	struct disk_index *tail;
	size_t size;
};

68 69 70 71 72 73 74 75
/**
 * @struct range
 * @brief Container for offsets in raw device buffer
 * @var range::from
 * Starting offset
 * @var range::to
 * Ending offset
 */
76 77 78 79 80
struct range {
	uint64_t from;
	uint64_t to;
};

81
void *reader(void *arg);
82 83

#endif /* _CAMOGM_READ_H */