2022-06-09 17:34:24 +02:00
|
|
|
#include <pthread.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "simulateFlux.h"
|
2022-06-01 12:32:04 +02:00
|
|
|
#include "power.h"
|
2022-06-07 14:28:32 +02:00
|
|
|
#include "initialParameters.h"
|
2022-06-10 15:05:04 +02:00
|
|
|
#include "queue.h"
|
2022-06-01 12:32:04 +02:00
|
|
|
|
2022-06-10 10:10:28 +02:00
|
|
|
bool rawDataWriteFlag = 0, stopFlag = 0;
|
2022-06-09 17:34:24 +02:00
|
|
|
int nRow = 100000;
|
|
|
|
int nCol = 9;
|
|
|
|
double freqEch = 250;
|
|
|
|
|
2022-06-10 17:22:01 +02:00
|
|
|
Pqueue firstRawDataQueue;
|
2022-06-10 15:05:04 +02:00
|
|
|
|
2022-06-09 17:34:24 +02:00
|
|
|
int selectionCaptors[] = {1,2,3,4,5,6,7,8};
|
|
|
|
int sizeSelectionArray = 8;
|
2022-06-10 10:10:28 +02:00
|
|
|
|
2022-06-10 17:22:01 +02:00
|
|
|
int cptData = 0;
|
|
|
|
int cptFile = 1;
|
|
|
|
|
|
|
|
double period = 0;
|
|
|
|
double invTimeBandWidth = 0;
|
|
|
|
|
2022-06-13 15:03:51 +02:00
|
|
|
void *threadCalcul(void *vargp){
|
|
|
|
printf("start thread calcul\n");
|
|
|
|
Pqueue rawDataQueue = firstRawDataQueue;
|
|
|
|
while(queueGetNextE(rawDataQueue) != NULL){
|
|
|
|
printf("wile calcul\n");
|
|
|
|
//pthread_mutex_lock(&mutex);
|
|
|
|
power(queueGetTabChar(rawDataQueue),nRow,nCol,period,invTimeBandWidth);
|
|
|
|
/*remove(queueGetTabChar(rawDataQueue));
|
|
|
|
rawDataQueue = queueRmFrstE(rawDataQueue);*/
|
|
|
|
|
|
|
|
//pthread_mutex_unlock(&mutex);
|
|
|
|
}
|
|
|
|
}
|
2022-06-10 17:22:01 +02:00
|
|
|
|
2022-06-01 12:32:04 +02:00
|
|
|
int main(int argc , char** argv){
|
2022-06-09 17:34:24 +02:00
|
|
|
|
2022-06-10 17:22:01 +02:00
|
|
|
period = 1 / freqEch;
|
|
|
|
invTimeBandWidth = 1 /(nRow * period);
|
2022-06-13 15:03:51 +02:00
|
|
|
firstRawDataQueue = queueCreateEmpty(); // change this for create empty
|
2022-06-10 15:50:27 +02:00
|
|
|
|
2022-06-09 17:34:24 +02:00
|
|
|
pthread_t rawData;
|
|
|
|
pthread_create(&rawData , NULL, simulateFlux, (void *)&rawData);
|
2022-06-10 17:22:01 +02:00
|
|
|
|
2022-06-13 15:03:51 +02:00
|
|
|
pthread_t calcul;
|
|
|
|
pthread_create(&calcul , NULL, threadCalcul, (void *)&calcul);
|
2022-06-10 17:22:01 +02:00
|
|
|
|
2022-06-09 17:34:24 +02:00
|
|
|
pthread_exit(NULL);
|
2022-06-01 12:32:04 +02:00
|
|
|
}
|