drake  1.0.0
include/drake/processor.h
Go to the documentation of this file.
00001 /*
00002  Copyright 2015 Nicolas Melot
00003 
00004  This file is part of Drake.
00005 
00006  Drake is free software: you can redistribute it and/or modify
00007  it under the terms of the GNU General Public License as published by
00008  the Free Software Foundation, either version 3 of the License, or
00009  (at your option) any later version.
00010 
00011  Drake is distributed in the hope that it will be useful,
00012  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  GNU General Public License for more details.
00015 
00016  You should have received a copy of the GNU General Public License
00017  along with Drake. If not, see <http://www.gnu.org/licenses/>.
00018 
00019 */
00020 
00021 
00022 #include <stddef.h>
00023 #include <drake/task.h>
00024 #include <drake/cross_link.h>
00025 
00026 #ifndef PROCESSOR_H
00027 #define PROCESSOR_H
00028 
00029 #define DRAKE_MAPPING_PROC_ID_CHAR_LENGTH 2
00030 #define DRAKE_MAPPING_NODE_CHAR_LENGTH 2
00031 #define DRAKE_MAPPING_SEPARATOR ':'
00032 
00034 typedef unsigned int processor_id;
00035 
00036 struct processor
00037 {
00038         // Number of tasks assigned to this processor. Never modify this value manually
00039         unsigned int handled_nodes;
00041         unsigned int node_capacity;
00043         processor_id id;
00045         array_t(cross_link_tp) *source;
00047         array_t(cross_link_tp) *sink;
00049         int inner_links;
00051         task_t ** task;
00052 };
00054 typedef struct processor processor_t;
00055 
00057 int drake_processor_insert_task(processor_t *proc, task_t *task);
00059 int drake_processor_remove_task(processor_t *proc, task_id task);
00061 size_t drake_processor_find_task(processor_t *proc, task_id task);
00062 
00064 #define STRUCT_T processor_t
00065 #include <pelib/structure.h>
00066 #define DONE_processor_t 1
00067 
00068 #endif // PROCESSOR_H