|
RocketLogger 2.1.2
|
Include dependency graph for pru.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | pru_control |
| struct | pru_data |
| struct | pru_buffer |
Macros | |
| #define | PRU_BINARY_FILE "/lib/firmware/rocketlogger.bin" |
| PRU binary file location. More... | |
| #define | PRU_DIGITAL_SIZE 4 |
| Overall size of FRU digital channels in bytes. More... | |
| #define | PRU_SAMPLE_SIZE 4 |
| Size of PRU channel data in bytes. More... | |
| #define | PRU_BUFFER_STATUS_SIZE 4 |
| Size of PRU buffer status in bytes. More... | |
| #define | PRU_DIGITAL_INPUT_MASK 0x3F |
| #define | PRU_DIGITAL_INPUT1_MASK 0x01 |
| #define | PRU_DIGITAL_INPUT2_MASK 0x02 |
| #define | PRU_DIGITAL_INPUT3_MASK 0x04 |
| #define | PRU_DIGITAL_INPUT4_MASK 0x08 |
| #define | PRU_DIGITAL_INPUT5_MASK 0x10 |
| #define | PRU_DIGITAL_INPUT6_MASK 0x20 |
| #define | PRU_DIGITAL_I1L_VALID_MASK 0x40 |
| #define | PRU_DIGITAL_I2L_VALID_MASK 0x80 |
| #define | PRU_TIMEOUT_US 2000000 |
| PRU time out in micro seconds. More... | |
Typedefs | |
| typedef enum pru_state | pru_state_t |
| typedef struct pru_control | pru_control_t |
| typedef struct pru_data | pru_data_t |
| typedef struct pru_buffer | pru_buffer_t |
Enumerations | |
| enum | pru_state { PRU_STATE_OFF = 0x00 , PRU_STATE_SAMPLE_FINITE = 0x01 , PRU_STATE_SAMPLE_CONTINUOUS = 0x03 } |
Functions | |
| int | pru_init (void) |
| void | pru_deinit (void) |
| int | pru_control_init (pru_control_t *const pru_control, rl_config_t const *const config, uint32_t aggregates) |
| int | pru_set_state (pru_state_t state) |
| int | pru_sample (FILE *data_file, FILE *ambient_file, rl_config_t const *const config) |
| void | pru_stop (void) |
| #define PRU_BINARY_FILE "/lib/firmware/rocketlogger.bin" |
PRU binary file location.
Copyright (c) 2016-2020, ETH Zurich, Computer Engineering Group 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.
| #define PRU_BUFFER_STATUS_SIZE 4 |
| #define PRU_DIGITAL_INPUT_MASK 0x3F |
| #define PRU_DIGITAL_SIZE 4 |
| typedef struct pru_buffer pru_buffer_t |
| typedef struct pru_control pru_control_t |
| typedef struct pru_data pru_data_t |
| typedef enum pru_state pru_state_t |
| enum pru_state |
| int pru_control_init | ( | pru_control_t *const | pru_control, |
| rl_config_t const *const | config, | ||
| uint32_t | aggregates | ||
| ) |
PRU data structure initialization.
| pru_control | PRU data structure to initialize |
| config | Current measurement configuration |
| aggregates | Number of samples to aggregate for sampling rates smaller than the minimal ADC rate (set 1 for no aggregates) |
Definition at line 80 of file pru.c.
References pru_control::buffer0_addr, pru_control::buffer1_addr, pru_control::buffer_length, PRU_BUFFER_STATUS_SIZE, PRU_DIGITAL_SIZE, PRU_SAMPLE_SIZE, PRU_STATE_SAMPLE_CONTINUOUS, PRU_STATE_SAMPLE_FINITE, RL_CHANNEL_COUNT, RL_SAMPLE_RATE_MIN, pru_control::sample_limit, rl_config::sample_limit, pru_control::sample_rate, rl_config::sample_rate, pru_control::state, SUCCESS, and rl_config::update_rate.
Referenced by pru_sample().
| void pru_deinit | ( | void | ) |
Shutdown PRU and deinitialize PRU driver.
Halt the PRU, unmap PRU shared memory and disable PRU interrupts.
Definition at line 74 of file pru.c.
Referenced by hw_deinit().
| int pru_init | ( | void | ) |
Initialize PRU driver.
Map PRU shared memory and enable PRU interrupts.
Copyright (c) 2016-2020, ETH Zurich, Computer Engineering Group 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 57 of file pru.c.
References ERROR, rl_log(), RL_LOG_ERROR, and SUCCESS.
Referenced by hw_init().
Here is the call graph for this function:| int pru_sample | ( | FILE * | data_file, |
| FILE * | ambient_file, | ||
| rl_config_t const *const | config | ||
| ) |
Main PRU sampling routine.
Configures and runs the actual RocketLogger measurements.
| data_file | Data file to write to |
| ambient_file | Ambient file to write to |
| config | Current measurement configuration |
Definition at line 130 of file pru.c.
References rl_config::ambient_enable, rl_config::background_enable, pru_control::buffer0_addr, pru_control::buffer1_addr, rl_status::buffer_count, pru_control::buffer_length, rl_file_header::channel, pru_data::channel_analog, rl_file_lead_in::channel_bin_count, rl_file_lead_in::channel_count, pru_data::channel_digital, create_time_stamp(), pru_buffer::data, rl_file_lead_in::data_block_count, rl_status::disk_use_rate, div_ceil(), ERROR, rl_status::error, rl_config::file_enable, rl_config::file_format, rl_config::file_name, rl_config::file_size, pru_buffer::index, rl_config::interactive_enable, rl_file_header::lead_in, meter_deinit(), meter_init(), meter_print_buffer(), rl_timestamp::nsec, rl_calibration::offsets, PRU_BINARY_FILE, PRU_BUFFER_STATUS_SIZE, pru_control_init(), PRU_DIGITAL_SIZE, PRU_SAMPLE_SIZE, PRU_STATE_OFF, pru_stop(), PRU_TIMEOUT_US, RL_CHANNEL_COUNT, rl_file_add_ambient_block(), rl_file_add_data_block(), RL_FILE_AMBIENT_DATA_BLOCK_SIZE, RL_FILE_FORMAT_CSV, RL_FILE_FORMAT_RLD, rl_file_get_ambient_file_name(), rl_file_setup_ambient_header(), rl_file_setup_ambient_lead_in(), rl_file_setup_data_header(), rl_file_setup_data_lead_in(), rl_file_store_header_bin(), rl_file_store_header_csv(), rl_file_update_header_bin(), rl_file_update_header_csv(), rl_log(), RL_LOG_ERROR, RL_LOG_INFO, RL_LOG_WARNING, rl_pid_set(), RL_SAMPLE_RATE_MIN, RL_SENSOR_SAMPLE_RATE, rl_socket_handle_data(), rl_status_write(), rl_status::sample_count, rl_file_lead_in::sample_count, pru_control::sample_limit, rl_config::sample_limit, rl_config::sample_rate, rl_status::sampling, rl_calibration::scales, rl_timestamp::sec, rl_status::sensor_available, rl_status::sensor_count, SENSOR_REGISTRY_SIZE, sensors_read(), pru_control::state, SUCCESS, rl_config::update_rate, and rl_config::web_enable.
Referenced by hw_sample().
Here is the call graph for this function:| int pru_set_state | ( | pru_state_t | state | ) |
Write a new state to the PRU shared memory.
| state | The PRU state to write |
Definition at line 122 of file pru.c.
Referenced by pru_stop().
| void pru_stop | ( | void | ) |
Stop running PRU measurements.
pru_deinit. Definition at line 619 of file pru.c.
References rl_status::error, pru_set_state(), PRU_STATE_OFF, and PRU_TIMEOUT_US.
Referenced by hw_deinit(), and pru_sample().
Here is the call graph for this function: