|
RocketLogger
1.1.5
|
#include <stdint.h>#include <sys/ipc.h>#include <sys/shm.h>#include "pru.h"#include "sem.h"#include "types.h"#include "web.h"
Include dependency graph for web.c:Go to the source code of this file.
Functions | |
| struct web_shm * | web_create_shm (void) |
| struct web_shm * | web_open_shm (void) |
| void | web_buffer_reset (struct ringbuffer *buffer, int element_size, int length) |
| void | web_buffer_add (struct ringbuffer *buffer, int64_t *data) |
| int64_t * | web_buffer_get (struct ringbuffer *buffer, int num) |
| void | web_merge_currents (uint8_t *valid, int64_t *dest, int64_t *src, struct rl_conf *conf) |
| void | web_handle_data (struct web_shm *web_data_ptr, int sem_id, void *buffer_addr, uint32_t sample_data_size, uint32_t samples_count, struct time_stamp *timestamp_realtime, struct rl_conf *conf) |
| void web_buffer_add | ( | struct ringbuffer * | buffer, |
| int64_t * | data | ||
| ) |
Add element to ring buffer
| buffer | Pointer to ring buffer |
| data | Pointer to data array to add |
Definition at line 113 of file web.c.
References ringbuffer::data, ringbuffer::element_size, ringbuffer::filled, ringbuffer::head, and ringbuffer::length.
Referenced by web_handle_data().
| int64_t* web_buffer_get | ( | struct ringbuffer * | buffer, |
| int | num | ||
| ) |
Get pointer to a specific element of a ringbuffer
| buffer | Pointer to ring buffer |
| num | Element number (0 corresponds to the newest element) |
Definition at line 129 of file web.c.
References ringbuffer::data, ringbuffer::element_size, ringbuffer::head, and ringbuffer::length.
Referenced by print_data().
| void web_buffer_reset | ( | struct ringbuffer * | buffer, |
| int | element_size, | ||
| int | length | ||
| ) |
Reset web data ring buffer
| buffer | Pointer to ring buffer to reset |
| element_size | Desired element size in bytes |
| length | Buffer length in elements |
Definition at line 101 of file web.c.
References ringbuffer::element_size, ringbuffer::filled, ringbuffer::head, and ringbuffer::length.
Referenced by pru_sample().
| struct web_shm* web_create_shm | ( | void | ) |
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. Create shared memory for data exchange with web server
Definition at line 47 of file web.c.
References ERROR, rl_log(), SHMEM_DATA_KEY, SHMEM_PERMISSIONS, and web_data.
Referenced by pru_sample().
Here is the call graph for this function:| void web_handle_data | ( | struct web_shm * | web_data_ptr, |
| int | sem_id, | ||
| void * | buffer_addr, | ||
| uint32_t | sample_data_size, | ||
| uint32_t | samples_count, | ||
| struct time_stamp * | timestamp_realtime, | ||
| struct rl_conf * | conf | ||
| ) |
Process the data buffer for the web interface
| web_data_ptr | Pointer to shared web data |
| sem_id | ID of semaphores for shared web data |
| buffer_addr | Pointer to buffer to handle |
| sample_data_size | Size of samples to read |
| samples_count | Number of samples to read |
| timestamp_realtime | time_stamp with realtime clock value |
| conf | Current rl_conf configuration. |
Definition at line 201 of file web.c.
References BINARY_MASK, BUF100_INDEX, BUF10_INDEX, BUF1_INDEX, web_shm::buffer, BUFFER100_SIZE, BUFFER10_SIZE, BUFFER1_SIZE, calibration, CHANNEL_ENABLED, rl_conf::channels, count_channels(), DATA_SEM, rl_conf::digital_inputs, DIGITAL_INPUTS_ENABLED, rl_conf::enable_web_server, I1L_INDEX, I2L_INDEX, time_stamp::nsec, num_channels, web_shm::num_channels, NUM_CHANNELS, NUM_DIGITAL_INPUTS, NUM_I_CHANNELS, rl_calibration::offsets, PRU_DIG_SIZE, rl_log(), RL_RUNNING, rl_calibration::scales, time_stamp::sec, SEM_WRITE_TIME_OUT, set_sem(), rl_status::state, status, web_shm::time, TIME_OUT, VALID_MASK, wait_sem(), WARNING, web_buffer_add(), web_data, web_merge_currents(), and WEB_RING_BUFFER_COUNT.
Referenced by pru_sample().
Here is the call graph for this function:| void web_merge_currents | ( | uint8_t * | valid, |
| int64_t * | dest, | ||
| int64_t * | src, | ||
| struct rl_conf * | conf | ||
| ) |
Merge high/low currents for web interface
| valid | Valid information of low range current channels |
| dest | Pointer to destination array |
| src | Pointer to source array |
| conf | Pointer to current rl_conf configuration |
Definition at line 143 of file web.c.
References CHANNEL_ENABLED, rl_conf::channels, H_L_SCALE, I1H_INDEX, I1L_INDEX, I2H_INDEX, I2L_INDEX, V1_INDEX, V2_INDEX, V3_INDEX, and V4_INDEX.
Referenced by web_handle_data().
| struct web_shm* web_open_shm | ( | void | ) |
Open existing shared memory for data exchange with web server
Definition at line 73 of file web.c.
References ERROR, rl_log(), SHMEM_DATA_KEY, SHMEM_PERMISSIONS, and web_data.
Referenced by main().
Here is the call graph for this function: