|
RocketLogger
1.1.5
|
#include <stdint.h>#include <stdio.h>#include <time.h>#include "pru.h"#include "util.h"#include "file_handling.h"
Include dependency graph for file_handling.c:Go to the source code of this file.
Functions | |
| void | file_setup_lead_in (struct rl_file_lead_in *lead_in, struct rl_conf *conf) |
| void | file_setup_channels (struct rl_file_header *file_header, struct rl_conf *conf) |
| void | file_setup_header (struct rl_file_header *file_header, struct rl_conf *conf, char *comment) |
| void | file_store_header_bin (FILE *data_file, struct rl_file_header *file_header) |
| void | file_store_header_csv (FILE *data_file, struct rl_file_header *file_header) |
| void | file_update_header_bin (FILE *data_file, struct rl_file_header *file_header) |
| void | file_update_header_csv (FILE *data_file, struct rl_file_header *file_header) |
| void | file_handle_data (FILE *data_file, void *buffer_addr, uint32_t sample_data_size, uint32_t samples_count, struct time_stamp *timestamp_realtime, struct time_stamp *timestamp_monotonic, struct rl_conf *conf) |
Variables | |
| const char * | channel_names [NUM_CHANNELS] |
| Channel names. More... | |
| const char * | digital_input_names [NUM_DIGITAL_INPUTS] |
| Digital input names. More... | |
| const char * | valid_info_names [NUM_I_CHANNELS] = {"I1L_valid", "I2L_valid"} |
| Valid channel names. More... | |
| int | i1l_valid_channel = 0 |
| Global variable to determine i1l valid channel. More... | |
| int | i2l_valid_channel = 0 |
| Global variable to determine i2l valid channel. More... | |
| void file_handle_data | ( | FILE * | data_file, |
| void * | buffer_addr, | ||
| uint32_t | sample_data_size, | ||
| uint32_t | samples_count, | ||
| struct time_stamp * | timestamp_realtime, | ||
| struct time_stamp * | timestamp_monotonic, | ||
| struct rl_conf * | conf | ||
| ) |
Handle a data buffer, dependent on current configuration
| data_file | File pointer to data file |
| buffer_addr | Pointer to buffer to handle |
| sample_data_size | Data size of the samples in bytes |
| samples_count | Number of samples to read |
| timestamp_realtime | time_stamp with realtime clock value |
| timestamp_monotonic | time_stamp with monotonic clock value |
| conf | Current rl_conf configuration. |
Definition at line 364 of file file_handling.c.
References AGGREGATE_AVERAGE, AGGREGATE_DOWNSAMPLE, AGGREGATE_NONE, rl_conf::aggregation, BIN, BINARY_MASK, calibration, CHANNEL_ENABLED, rl_conf::channels, count_channels(), CSV, CSV_DELIMITER, rl_conf::digital_inputs, DIGITAL_INPUTS_ENABLED, ERROR, rl_conf::file_format, I1L_INDEX, I2L_INDEX, MIN_ADC_RATE, NO_FILE, time_stamp::nsec, num_channels, NUM_CHANNELS, NUM_DIGITAL_INPUTS, rl_calibration::offsets, PRU_DIG_SIZE, rl_log(), rl_conf::sample_rate, rl_calibration::scales, time_stamp::sec, and VALID_MASK.
Referenced by pru_sample().
Here is the call graph for this function:| void file_setup_channels | ( | struct rl_file_header * | file_header, |
| struct rl_conf * | conf | ||
| ) |
Set up channel information for file header with current configuration
| file_header | Pointer to rl_file_header struct to set up |
| conf | Pointer to current rl_conf struct |
Definition at line 106 of file file_handling.c.
References rl_file_header::channel, rl_file_lead_in::channel_bin_count, rl_file_lead_in::channel_count, CHANNEL_ENABLED, channel_names, rl_file_channel::channel_scale, rl_conf::channels, rl_file_channel::data_size, digital_input_names, rl_conf::digital_inputs, DIGITAL_INPUTS_ENABLED, I1L_INDEX, i1l_valid_channel, I2L_INDEX, i2l_valid_channel, is_current(), is_low_current(), rl_file_header::lead_in, rl_file_channel::name, NO_VALID_DATA, NUM_CHANNELS, NUM_DIGITAL_INPUTS, RL_SCALE_NANO, RL_SCALE_NONE, RL_SCALE_TEN_NANO, RL_SCALE_TEN_PICO, RL_UNIT_AMPERE, RL_UNIT_BINARY, RL_UNIT_RANGE_VALID, RL_UNIT_VOLT, rl_file_channel::unit, rl_file_channel::valid_data_channel, and valid_info_names.
Referenced by file_setup_header().
Here is the call graph for this function:| void file_setup_header | ( | struct rl_file_header * | file_header, |
| struct rl_conf * | conf, | ||
| char * | comment | ||
| ) |
Set up file header with current configuration
| file_header | Pointer to rl_file_header to set up |
| conf | Pointer to current rl_conf struct |
| comment | The comment stored in the file header or NULL for default |
Definition at line 186 of file file_handling.c.
References rl_file_header::comment, and file_setup_channels().
Referenced by pru_sample().
Here is the call graph for this function:| void file_setup_lead_in | ( | struct rl_file_lead_in * | lead_in, |
| struct rl_conf * | conf | ||
| ) |
Set up file header lead-in with current configuration
| lead_in | Pointer to rl_file_lead_in struct to set up |
| conf | Pointer to current rl_conf struct |
Definition at line 60 of file file_handling.c.
References rl_file_lead_in::channel_bin_count, rl_file_lead_in::channel_count, CHANNEL_ENABLED, rl_conf::channels, rl_file_lead_in::comment_length, count_channels(), create_time_stamp(), rl_file_lead_in::data_block_count, rl_file_lead_in::data_block_size, rl_conf::digital_inputs, DIGITAL_INPUTS_ENABLED, rl_file_lead_in::file_version, get_mac_addr(), rl_file_lead_in::header_length, I1L_INDEX, i1l_valid_channel, I2L_INDEX, i2l_valid_channel, rl_file_lead_in::mac_address, rl_file_lead_in::magic, NUM_DIGITAL_INPUTS, RL_FILE_COMMENT_ALIGNMENT_BYTES, RL_FILE_MAGIC, RL_FILE_VERSION, rl_file_lead_in::sample_count, rl_file_lead_in::sample_rate, rl_conf::sample_rate, rl_file_lead_in::start_time, and rl_conf::update_rate.
Referenced by pru_sample().
Here is the call graph for this function:| void file_store_header_bin | ( | FILE * | data_file, |
| struct rl_file_header * | file_header | ||
| ) |
Store file header to file (in binary format)
| data | File pointer to data file |
| file_header | Pointer to rl_file_header struct |
Definition at line 205 of file file_handling.c.
References rl_file_lead_in::channel_bin_count, rl_file_lead_in::channel_count, rl_file_header::comment, rl_file_lead_in::comment_length, rl_file_lead_in::header_length, rl_file_header::lead_in, and RL_FILE_COMMENT_ALIGNMENT_BYTES.
Referenced by pru_sample().
| void file_store_header_csv | ( | FILE * | data_file, |
| struct rl_file_header * | file_header | ||
| ) |
Store file header to file (in CSV format)
| data_file | File pointer to data file |
| file_header | Pointer to rl_file_header struct |
Definition at line 248 of file file_handling.c.
References rl_file_header::channel, rl_file_lead_in::channel_bin_count, rl_file_lead_in::channel_count, rl_file_channel::channel_scale, rl_file_header::comment, rl_file_lead_in::data_block_count, rl_file_lead_in::data_block_size, rl_file_lead_in::file_version, rl_file_header::lead_in, rl_file_lead_in::mac_address, MAC_ADDRESS_LENGTH, rl_file_channel::name, RL_SCALE_MICRO, RL_SCALE_MILLI, RL_SCALE_NANO, RL_SCALE_TEN_NANO, RL_SCALE_TEN_PICO, RL_UNIT_AMPERE, RL_UNIT_VOLT, rl_file_lead_in::sample_count, rl_file_lead_in::sample_rate, time_stamp::sec, rl_file_lead_in::start_time, and rl_file_channel::unit.
Referenced by pru_sample().
| void file_update_header_bin | ( | FILE * | data_file, |
| struct rl_file_header * | file_header | ||
| ) |
Update file with new header lead-in (to write current sample count) in binary format
| data_file | File pointer to data file |
| file_header | Pointer to rl_file_header struct |
Definition at line 321 of file file_handling.c.
References rl_file_header::lead_in.
Referenced by pru_sample().
| void file_update_header_csv | ( | FILE * | data_file, |
| struct rl_file_header * | file_header | ||
| ) |
Update file with new header lead-in (to write current sample count) in CSV format
| data_file | File pointer to data file |
| file_header | Pointer to rl_file_header struct |
Definition at line 338 of file file_handling.c.
References rl_file_lead_in::data_block_count, rl_file_lead_in::data_block_size, rl_file_lead_in::file_version, rl_file_header::lead_in, and rl_file_lead_in::sample_count.
Referenced by pru_sample().
| const char* channel_names[NUM_CHANNELS] |
Channel names.
Copyright (c) 2016-2019, Swiss Federal Institute of Technology (ETH Zurich) All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition at line 42 of file file_handling.c.
Referenced by file_setup_channels(), and meter_print_buffer().
| const char* digital_input_names[NUM_DIGITAL_INPUTS] |
Digital input names.
Definition at line 45 of file file_handling.c.
Referenced by file_setup_channels(), and meter_print_buffer().
| int i1l_valid_channel = 0 |
Global variable to determine i1l valid channel.
Definition at line 51 of file file_handling.c.
Referenced by file_setup_channels(), and file_setup_lead_in().
| int i2l_valid_channel = 0 |
Global variable to determine i2l valid channel.
Definition at line 53 of file file_handling.c.
Referenced by file_setup_channels(), and file_setup_lead_in().
| const char* valid_info_names[NUM_I_CHANNELS] = {"I1L_valid", "I2L_valid"} |
Valid channel names.
Range valid information names.
Definition at line 48 of file file_handling.c.
Referenced by file_setup_channels().