get data from Kernel driver
1st version of the json file with the header
This commit is contained in:
@@ -1,13 +1,68 @@
|
||||
/*
|
||||
*/
|
||||
* Copyright (c) 2024 Markus Lehr.
|
||||
*
|
||||
*
|
||||
* SPDX-License-Identifier: Owend property of Markus Lehr
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef RTS_INCLUDE_RTSMONITORINGTASK_H_
|
||||
#define RTS_INCLUDE_RTSMONITORINGTASK_H_
|
||||
|
||||
#include "RTSCoproHelper.h"
|
||||
#include "RTSMonFrame.h"
|
||||
#include <pthread.h>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <atomic>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/eventfd.h>
|
||||
#include <sys/poll.h>
|
||||
#include <fcntl.h>
|
||||
#include <regex.h>
|
||||
#include <sched.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <termios.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <error.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
#define NB_BUF 1
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int bufferId, eventfd;
|
||||
} rpmsg_sdb_ioctl_set_efd;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int bufferId;
|
||||
uint32_t size;
|
||||
} rpmsg_sdb_ioctl_get_data_size;
|
||||
|
||||
|
||||
struct vRCMDeviceData {
|
||||
uint32_t packageNo; //current package Number
|
||||
uint32_t packageCount; //complete package Number
|
||||
uint32_t dataQuantity; //number of uint32_t in data
|
||||
uint32_t data[]; //the data
|
||||
};
|
||||
|
||||
|
||||
class RTSMonitoringTask
|
||||
{
|
||||
@@ -15,13 +70,35 @@ private:
|
||||
/* data */
|
||||
//lock Element
|
||||
|
||||
//std::map<int, RTSMonFrame*> rtsMonFrames;
|
||||
pthread_t monThread;
|
||||
|
||||
|
||||
|
||||
/* The file descriptor used to manage our TTY over RPMSG */
|
||||
int mFdRpmsg[2] = {-1, -1};
|
||||
RTSCoproHelper coproHelper;
|
||||
/* The file descriptor used to manage our SDB over RPMSG */
|
||||
int mFdSdbRpmsg = -1;
|
||||
|
||||
std::map<int, RTSMonFrame*> rtsMonFrames;
|
||||
rpmsg_sdb_ioctl_get_data_size q_get_data_size;
|
||||
|
||||
pthread_t monThread;
|
||||
rpmsg_sdb_ioctl_set_efd q_set_efd;
|
||||
|
||||
int mefd[NB_BUF];
|
||||
void* mmappedData[NB_BUF];
|
||||
bool mfMappedData = false;
|
||||
struct pollfd mfds[NB_BUF];
|
||||
//uint8_t mDdrBuffAwaited = 1;
|
||||
uint32_t mNbUncompData=0;
|
||||
uint32_t mNbWrittenInFileData;
|
||||
uint32_t mNbUncompMB=0;
|
||||
uint32_t mNbPrevUncompMB=0;
|
||||
uint32_t mNbTty0Frame=0;
|
||||
char mByteBuffCpy[512];
|
||||
struct timeval tval_before, tval_after, tval_result;
|
||||
|
||||
std::atomic_bool mRunThread= true;
|
||||
|
||||
public:
|
||||
|
||||
@@ -30,13 +107,24 @@ public:
|
||||
|
||||
//static RTSMonitoringTask& Instance();
|
||||
bool Init();
|
||||
bool CreateMonitoring(int id, std::string name, int samplerate, int sampleperiod, int downtime, std::string status);
|
||||
//bool CreateMonitoring(int id, std::string name, int samplerate, int sampleperiod, int downtime, std::string status);
|
||||
bool LoadFW();
|
||||
bool Start();
|
||||
bool Stop();
|
||||
|
||||
int Open(std::string monfilename);
|
||||
bool Close();
|
||||
std::string Read();
|
||||
bool GetRunState();
|
||||
void SetRunState(bool runThread);
|
||||
|
||||
private:
|
||||
static void* Run(void *obj);
|
||||
bool Load();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* RTS_INCLUDE_RTSMONITORINGTASK_H_ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user