real_time/software/raspberry/superviseur-robot/tasks.h

108 lines
2.4 KiB
C
Raw Normal View History

2018-08-27 16:39:49 +02:00
/*
* Copyright (C) 2018 dimercur
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2018-08-27 16:39:49 +02:00
*/
/**
* \file functions.h
* \author PE.Hladik
* \version 1.0
* \date 06/06/2017
* \brief Miscellaneous functions used for destijl project.
2018-08-27 16:39:49 +02:00
*/
2018-12-19 09:15:42 +01:00
#ifndef __TASKS_H__
#define __TASKS_H__
2018-08-27 16:39:49 +02:00
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
#include <alchemy/task.h>
#include <alchemy/timer.h>
#include <alchemy/mutex.h>
#include <alchemy/sem.h>
#include <alchemy/queue.h>
#include "monitor.h"
#include "robot.h"
#include "image.h"
#include "message.h"
#include "server.h"
2018-08-27 16:39:49 +02:00
extern RT_TASK th_server;
extern RT_TASK th_sendToMon;
extern RT_TASK th_receiveFromMon;
extern RT_TASK th_openComRobot;
extern RT_TASK th_startRobot;
extern RT_TASK th_move;
extern RT_MUTEX mutex_robotStarted;
extern RT_MUTEX mutex_move;
extern RT_SEM sem_barrier;
extern RT_SEM sem_openComRobot;
extern RT_SEM sem_serverOk;
extern RT_SEM sem_startRobot;
extern RT_QUEUE q_messageToMon;
extern int etatCommMoniteur;
extern int robotStarted;
extern char robotMove;
2018-08-27 16:39:49 +02:00
extern int MSG_QUEUE_SIZE;
extern int PRIORITY_TSERVER;
extern int PRIORITY_TOPENCOMROBOT;
extern int PRIORITY_TMOVE;
extern int PRIORITY_TSENDTOMON;
extern int PRIORITY_TRECEIVEFROMMON;
extern int PRIORITY_TSTARTROBOT;
/**
* \brief Thread handling server communication.
*/
2018-08-27 16:39:49 +02:00
void f_server(void *arg);
/**
* \brief Thread handling communication to monitor.
*/
2018-08-27 16:39:49 +02:00
void f_sendToMon(void *arg);
/**
* \brief Thread handling communication from monitor.
*/
2018-08-27 16:39:49 +02:00
void f_receiveFromMon(void *arg);
/**
* \brief Thread handling opening of robot communication.
*/
2018-08-27 16:39:49 +02:00
void f_openComRobot(void * arg);
/**
* \brief Thread handling robot mouvements.
*/
2018-08-27 16:39:49 +02:00
void f_move(void *arg);
/**
* \brief Thread handling robot activation.
*/
2018-08-27 16:39:49 +02:00
void f_startRobot(void *arg);
#endif /* FUNCTIONS_H */