Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
embedded-linux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Maul
embedded-linux
Commits
c11f0e91
Commit
c11f0e91
authored
5 months ago
by
Leon Bohnwagner
Browse files
Options
Downloads
Patches
Plain Diff
docs: update deprecated documentation
parent
36777756
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+10
-31
10 additions, 31 deletions
README.md
common/include/data.h
+6
-0
6 additions, 0 deletions
common/include/data.h
common/include/message.h
+12
-17
12 additions, 17 deletions
common/include/message.h
with
28 additions
and
48 deletions
README.md
+
10
−
31
View file @
c11f0e91
...
...
@@ -2,46 +2,25 @@
## Building
### Kernel Module
```
bash
cd
kernel
make
sudo
make
install
```
### Userspace
```
```
sh
mkdir
build
&&
cd
build
cmake ..
make
```
The binaries will be in:
-
`build/daemon/daemon`
The compiled binaries can be found in following directories:
-
`build/daemon/daemon`
(for the daemon binary)
-
`build/clients/*`
(for the client binaries)
-
`build/clients/*`
### Kernel module
```
sh
cd
kernel
make
```
## Communication
### Userspace
The client programs that aggregate the desired system data may send them to the daemon process.
This is done via a simple packet,
`daemon_measurement_t`
which is defined in
[
`common/include/protocol.h`
](
common/include/protocol.h
)
:
```
c
#define MAX_DAEMON_PACKET_SIZE PIPE_BUF
#define DAEMON_PACKET_HEADER_SIZE sizeof(uint8_t) + sizeof(uint16_t)
#define MAX_DAEMON_PACKET_DATA_SIZE MAX_DAEMON_PACKET_SIZE - DAEMON_PACKET_HEADER_SIZE
typedef
struct
{
uint8_t
measurement_id
;
uint16_t
size
;
uint8_t
data
[
MAX_DAEMON_PACKET_DATA_SIZE
];
}
daemon_measurement_t
;
```
The packet size equals to the size of
`PIPE_BUF`
(4096).
The communication to the deamon is implemented via a named pipe, the size ensure that the packet is atomic, i.e. it is written to the pipe in one go.
-
The first byte contains the measurement id, so the maximum number of different measurements client is 255.
-
The second and third bytes contain the size of the data in the packet.
-
All following bytes contain the data.
### Kernel module
This diff is collapsed.
Click to expand it.
common/include/data.h
+
6
−
0
View file @
c11f0e91
...
...
@@ -17,6 +17,12 @@ typedef s64 int64_t;
#include
<stdint.h>
#endif
/**
* typedef data_t - Structure for sending measurement messages to the kernel module.
* @sensor_id: The sensor ID of the system.
* @count: The number of measurement messages.
* @values: A pointer to an array of measurement messages.
*/
typedef
struct
data
{
uint8_t
sensor_id
;
uint8_t
count
;
...
...
This diff is collapsed.
Click to expand it.
common/include/message.h
+
12
−
17
View file @
c11f0e91
...
...
@@ -15,6 +15,9 @@ typedef s64 int64_t;
#include
<stdint.h>
#endif
/**
* enum message_data_type - Enum to define the data types used for measurement data.
*/
enum
message_data_type
{
INT8
,
UINT8
,
...
...
@@ -27,8 +30,15 @@ enum message_data_type {
FLOAT32
,
FLOAT64
};
/**
* typedef message_data_type_t - Alias for uint32_t representing the message data types.
*/
typedef
uint32_t
message_data_type_t
;
/**
* typedef message_data_t - Union to hold different types of measurement data.
*/
typedef
union
message_data
{
int8_t
int8
;
uint8_t
uint8
;
...
...
@@ -44,14 +54,9 @@ typedef union message_data {
/**
* typedef message_t - Structure to hold a message with a measurement.
* @measurement_id: The id of the measurement. Every sender should have a unique
* id.
* @daemon_measurement_datatype: Datatype of the data. All values in `data` must
* be of this type.
* @length: How many types of `datatype` are in `data`. Must not exceed
* (`length` * daemon_measurement_datatype_size(`datatype`)) >
* MAX_DAEMON_PACKET_DATA_SIZE.
* @data: The measurement data.
* @datatype: The data type of the data.
* @measurement_id: The id of the measurement. Every sender should have a unique id.
*/
typedef
struct
message
{
message_data_t
data
;
...
...
@@ -66,13 +71,3 @@ typedef struct message {
* Returns the size.
*/
size_t
message_data_type_size
(
message_data_type_t
type
);
/**
* message_check() - Check if a `message_t` is correct.
* @arg1: Message to check.
*
* Checks if the datatype size * length not exceeds MAX_DAEMON_PACKET_DATA_SIZE.
*
* Returns 0 on success, -1 on error.
*/
int
message_check
(
message_t
*
message
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment