Skip to content
Snippets Groups Projects
Commit 0a398d57 authored by Leon Bohnwagner's avatar Leon Bohnwagner :crab:
Browse files

docs: add file headers

parent f9bab998
Branches
No related tags found
No related merge requests found
/*
* cpu_temp.c - Reads CPU temperature and sends it via message queue
*
* This client reads the CPU temperature from
* `/sys/class/thermal/thermal_zone0/temp`, converts it, and sends it as a
* floating-point measurement using a message queue.
*
* Usage:
* ./cpu_temp <id> <delay_ms>
*
* Parameters:
* <id> - Unique identifier for the measurement
* <delay_ms> - Delay between measurements in milliseconds
*
* Example:
* ./cpu_temp 1 250
*/
#include "../../../common/include/measurement.h"
#include "../../../common/include/userspace_comm.h"
#include <errno.h>
......
/*
* dummy_client.c - Generates sine wave data and sends it via message queue
*
* This client simulates sensor data by generating a sine wave value and
* sending it as a floating-point measurement using a message queue.
*
* Usage:
* ./dummy <id> <delay_ms>
*
* Parameters:
* <id> - Unique identifier for the measurement
* <delay_ms> - Delay between measurements in milliseconds
*
* Example:
* ./dummy 1 250
*/
#include "../../../common/include/measurement.h"
#include "../../../common/include/userspace_comm.h"
#include <errno.h>
......
/*
* mem_usage.c - Reads memory usage and sends it via message queue
*
* This program reads memory information using the `sysinfo` system call,
* calculates the used memory, and sends it as an unsigned integer measurement
* via a message queue.
*
* Usage:
* ./mem_usage <id> <delay_ms>
*
* Parameters:
* <id> - Unique identifier for the measurement
* <delay_ms> - Delay between measurements in milliseconds
*
* Example:
* ./mem_usage 1 250
*/
#include "../../../common/include/measurement.h"
#include "../../../common/include/userspace_comm.h"
#include <errno.h>
......
/*
* measurement.h - Defines data structures and types for measurement handling
*
* This header file provides type definitions and structures for representing
* measurement data.
*/
#pragma once
#if defined(__KERNEL__)
......
/*
* userspace_comm.h - Message queue communication for sending userspace
* measurement data
*
* This header file provides functions and structures for message queue
* interprocess communication. It allows sending measurement data from userspace
* applications.
*/
#pragma once
#include "measurement.h"
......
/*
* measurement.c - Implementation of measurement functions
*
* This file provides the implementation of the functions declared in
* measurement.h.
*/
#include "../include/measurement.h"
size_t measurement_data_type_size(measurement_data_type_t type) {
......
/*
* userspace_comm.c - Implementation of message queue communication functions
*
* This file provides the implementation of the functions declared in
* userspace_comm.h.
*
*/
#include "../include/userspace_comm.h"
#include <sys/ipc.h>
#include <sys/msg.h>
......
/*
* receive.h - Message queue communication for receiving userspace measurement
* data
*
* This header file provides functions and structures for message queue
* interprocess communication. It allows receiving measurement data from
* userspace applications.
*/
#pragma once
#include "../../common/include/measurement.h"
......
/*
* send.h - Communication with the kernel device for measurement data
*
* This header file provides functions and structures to send measurement data
* to the kernel through the `/dev/sibyl` device.
*/
#pragma once
#include "../../common/include/measurement.h"
......
/*
* main.c - Daemon for receiving, processing, and sending measurement data
*
* This file implements a daemon that receives measurement data from a userspace
* message queue, processes the data, and sends it to the kernel via a character
* device.
*
* The daemon continuously runs in an infinite loop, receiving measurement data
* from userspace through a message queue. Upon receiving each measurement, it
* processes and compares the data with cached values to detect any updates or
* changes. If any updates are found, the daemon sends the new data to the
* kernel module.
*/
#include "../../common/include/measurement.h"
#include "../../common/include/userspace_comm.h"
#include "../include/receive.h"
......
/*
* receive.c - Implementation of message queue communication functions
*
* This file provides the implementation of the functions declared in
* receive.h.
*
*/
#include "../include/receive.h"
#include "../../common/include/measurement.h"
#include "../../common/include/userspace_comm.h"
......
/*
* send.c - Implementation for sending measurement data to the kernel
*
* This file provides the implementation of the functions declared in
* send.h.
*
*/
#include "../include/send.h"
#include <fcntl.h>
#include <unistd.h>
......
/*
* kmod.c - Kernel module for receiving, processing, and sending measurement
* data
*
* This kernel module provides functionality to communicate with userspace by
* receiving measurement data, preparing it for transmission, and sending it
* via GPIO pins at a specified baud rate. It integrates with a userspace
* application through a character device interface.
*
* The module operates in fixed time slots for data transmission, managed by a
* high-resolution timer. Upon receiving data from userspace, the module
* calculates a CRC checksum, prepares the data packet, and writes it into a
* send buffer. This data preparation occurs outside of the time slot but is
* triggered when new data is written to the device.
*
* The transmission itself happens in fixed time slots. The high-resolution
* timer triggers regular intervals, and during each time slot, when it's the
* systems turn, the data stored in the send buffer is transmitted bit-by-bit
* using GPIO, simulating UART-like communication with start and stop bits.
*/
#include "../common/include/measurement.h"
#include <linux/cdev.h>
#include <linux/crc32.h>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment