|
RocketLogger
1.1
|
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | time_stamp |
Macros | |
| #define | MAC_ADDRESS_LENGTH 6 |
| MAC address length in bytes. More... | |
Functions | |
| int | is_current (int index) |
| int | is_low_current (int index) |
| int | count_channels (int channels[NUM_CHANNELS]) |
| int | read_status (struct rl_status *status) |
| int | write_status (struct rl_status *status) |
| int | ceil_div (int n, int d) |
| void | sig_handler (int signo) |
| int | read_file_value (char filename[]) |
| void | create_time_stamp (struct time_stamp *time_real, struct time_stamp *time_monotonic) |
| void | get_mac_addr (uint8_t mac_address[MAC_ADDRESS_LENGTH]) |
| #define MAC_ADDRESS_LENGTH 6 |
MAC address length in bytes.
Copyright (c) 2016-2017, 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 39 of file util.h.
Referenced by file_store_header_csv(), and get_mac_addr().
| int ceil_div | ( | int | n, |
| int | d | ||
| ) |
Integer division with ceiling.
| n | Numerator |
| d | Denominator |
Definition at line 163 of file util.c.
Referenced by pru_sample().
| int count_channels | ( | int | channels[NUM_CHANNELS] | ) |
Counts the number of channels sampled.
| channels | Channel array. |
Definition at line 79 of file util.c.
References CHANNEL_ENABLED, and NUM_CHANNELS.
Referenced by file_handle_data(), file_setup_lead_in(), meter_print_buffer(), pru_sample(), and web_handle_data().
| void create_time_stamp | ( | struct time_stamp * | timestamp_realtime, |
| struct time_stamp * | timestamp_monotonic | ||
| ) |
Create time stamps (real and monotonic)
| timestamp_realtime | Pointer to time_stamp struct |
| timestamp_monotonic | Pointer to time_stamp struct |
Definition at line 222 of file util.c.
References ERROR, time_stamp::nsec, rl_log(), and time_stamp::sec.
Referenced by ambient_setup_lead_in(), file_setup_lead_in(), and pru_sample().
Here is the call graph for this function:| void get_mac_addr | ( | uint8_t | mac_address[MAC_ADDRESS_LENGTH] | ) |
Get MAC address of device
| mac_address | Empty array with size MAC_ADDRESS_LENGTH |
Definition at line 247 of file util.c.
References MAC_ADDRESS_FILE, and MAC_ADDRESS_LENGTH.
Referenced by ambient_setup_lead_in(), and file_setup_lead_in().
| int is_current | ( | int | index | ) |
Copyright (c) 2016-2017, 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. Checks if channel is a current channel.
| index | Index of channel in array. |
Definition at line 52 of file util.c.
References I1H_INDEX, I1L_INDEX, I2H_INDEX, and I2L_INDEX.
Referenced by file_setup_channels(), and meter_print_buffer().
| int is_low_current | ( | int | index | ) |
Checks if channel is a low range current channel.
| index | Index of channel in array. |
Definition at line 66 of file util.c.
References I1L_INDEX, and I2L_INDEX.
Referenced by file_setup_channels().
| int read_file_value | ( | char | filename[] | ) |
Read a single integer from file.
| filename | Path to file. |
Definition at line 201 of file util.c.
References ERROR, FAILURE, and rl_log().
Referenced by pru_data_setup(), pru_map_memory(), pru_sample(), and pru_unmap_memory().
Here is the call graph for this function:| int read_status | ( | struct rl_status * | status | ) |
Reads the status of the running measurement from shared memory.
| status | Pointer to struct array. |
Definition at line 94 of file util.c.
References ERROR, FAILURE, rl_log(), SHMEM_PERMISSIONS, SHMEM_STATUS_KEY, and SUCCESS.
Referenced by rl_get_status(), and rl_read_status().
Here is the call graph for this function:| void sig_handler | ( | int | signo | ) |
Signal handler to catch stop signals.
| signo | Signal type. |
Definition at line 177 of file util.c.
References rl_status::sampling, SAMPLING_OFF, and status.
Referenced by rl_start().
| int write_status | ( | struct rl_status * | status | ) |
Writes the status to the shared memory.
| status | Pointer to struct array. |
Definition at line 128 of file util.c.
References ERROR, FAILURE, rl_log(), SHMEM_PERMISSIONS, SHMEM_STATUS_KEY, status, and SUCCESS.
Referenced by hw_close(), hw_init(), and pru_sample().
Here is the call graph for this function: