#include <string.h> // memcpy
#include <drivers/can.h> // can_chip_t, can_frame_t
-#include <drivers/frescan.h> // frescan_init_params_t, frescan_send_params_t
+#include "frescan.h" // frescan_init_params_t, frescan_send_params_t
#include "frescan_queues.h" // init, enqueue, requeue
#include "frescan_data.h" // init, the_networks
#include "frescan_servers.h" // init, frame_sent
--- /dev/null
+/*!
+ * @file frescan.h
+ *
+ * @brief interface of the FRESCAN protocol
+ *
+ * @version 0.01
+ *
+ * @date 20-Feb-2008
+ *
+ * @author
+ * Daniel Sangorrin
+ *
+ * @comments
+ *
+ * This file contains the interface to the FRESCAN protocol
+ *
+ * @license
+ *
+ * See MaRTE OS license
+ *
+ */
+
+#ifndef _MARTE_FRESCAN_H_
+#define _MARTE_FRESCAN_H_
+
+#include <stdint.h> // uint8_t
+#include <stdbool.h> // bool
+#include <unistd.h> // size_t
+
+typedef uint8_t frescan_network_t;
+typedef uint8_t frescan_node_t;
+typedef uint8_t frescan_channel_t;
+typedef uint8_t frescan_prio_t;
+typedef uint8_t frescan_ss_t;
+typedef uint32_t frescan_budget_t;
+
+/**
+ * frescan_flags_t - frescan flags
+ *
+ * @FRESCAN_SS: send the message using sporadic servers
+ * @FRESCAN_FP: send the message using fixed priorities
+ * @FRESCAN_POLL: no buffer copy, only pointer and use the ID to poll status
+ * @FRESCAN_SYNC: no buffer copy, only pointer and block until it is sent
+ * @FRESCAN_ASYNC: use buffer copy and return immediately
+ */
+
+typedef enum {
+ FRESCAN_SS = 1<<4, // sporadic server
+ FRESCAN_FP = 1<<3, // fixed priorities
+ FRESCAN_POLL = 1<<2, // polling
+ FRESCAN_SYNC = 1<<1, // synchronous
+ FRESCAN_ASYNC = 1 // asynchronous
+} frescan_flags_t;
+
+/**
+ * frescan_send_params_t - send parameters
+ *
+ * @net: the network to use
+ * @to: the node where the message shoud be sent to
+ * @channel: the channel in 'to' where the message shoud be sent to
+ * @flags: the flags (see frescan_flags_t)
+ * @prio: the priority for the message if (flags & FRESCAN_FP)
+ * @ss: the sporadic server for the message if (flags & FRESCAN_SS)
+ */
+
+typedef struct {
+ frescan_network_t net;
+ frescan_node_t to;
+ frescan_channel_t channel;
+ frescan_flags_t flags;
+ union {
+ frescan_prio_t prio;
+ frescan_ss_t ss;
+ };
+} frescan_send_params_t;
+
+/**
+ * frescan_recv_params_t - receive parameters
+ *
+ * @net: the network to use
+ * @channel: the channel from which we want to extract a message
+ * @flags: FRESCAN_SYNC/ASYNC
+ */
+
+typedef struct {
+ frescan_network_t net;
+ frescan_channel_t channel;
+ frescan_flags_t flags;
+} frescan_recv_params_t;
+
+/**
+ * frescan_init_params_t - initialization parameters
+ *
+ * @net: network to initialize (minor number ie: /dev/can0 -> 0)
+ * @node: set the local node identificator
+ * @tx_fp_max_prio: maximum number of priorities for the fixed priority
+ * transmission queues. (prio = 0 .. max_prio - 1)
+ * @rx_num_of_channels: number of rx channels (0 .. rx_num_of_channels - 1)
+ * @rx_channel_max_prio: array (range rx_num_of_channels) saying the number
+ * of priorities for each channel. If this parameter is
+ * NULL tx_fp_max_prio will be used for all queues.
+ */
+
+typedef struct {
+ frescan_network_t net;
+ frescan_node_t node;
+ uint32_t tx_fp_max_prio;
+ uint32_t rx_num_of_channels;
+ uint32_t *rx_channel_max_prio;
+} frescan_init_params_t;
+
+/**
+ * frescan_init - initializes the network and the internal structures
+ *
+ * @params: the initialization parameters
+ */
+
+int frescan_init(frescan_init_params_t *params);
+
+/**
+ * frescan_send - send a message
+ *
+ * @params: the parameters needed by the protocol to send the message
+ * @msg: the message buffer
+ * @size: the size of the message
+ *
+ * This is one of the main functions of the protocol and it provides the
+ * means to send a message through the protocol stack.
+ */
+
+int frescan_send(const frescan_send_params_t *params,
+ const uint8_t *msg,
+ const size_t size);
+
+/**
+ * frescan_recv - receive a message
+ *
+ * @params: the parameters needed by the protocol to receive the message
+ * @msg: the message buffer
+ * @size: the size of the message buffer
+ * @recv_bytes: the number of bytes received
+ * @from: the node that sent the message
+ * @prio: the priority of the message
+ *
+ * This is one of the main functions of the protocol and it provides the
+ * means to receive a message through the protocol stack.
+ */
+
+int frescan_recv(const frescan_recv_params_t *params,
+ uint8_t *msg,
+ const size_t size,
+ size_t *recv_bytes,
+ frescan_node_t *from,
+ frescan_prio_t *prio);
+
+#endif // _MARTE_FRESCAN_H_
#define FRESCAN_BACKGROUND_PRIO 0
#define FRESCAN_MX_REPLY_OBJECTS 40
#define FRESCAN_REPL_THREAD_PRIO 60
+#define FRESCAN_MX_REQUESTS 40
#define FRESCAN_MLOCK_T unsigned
#define FRESCAN_CREATE_LOCK(l)
#include <misc/linux_list.h> // struct list_head
#include <misc/freelist.h> // freelist_t
-#include <drivers/frescan.h> // frescan_node_t, _prio_t, _budget_t
+#include "frescan.h" // frescan_node_t, _prio_t, _budget_t
#include "frescan_config.h" // FRESCAN_MLOCK_T, FRESCAN_MX_XXX
#include "frescan_packets.h" // frescan_packet_t
#include "frescan_servers_replenishments.h" // frescan_repl_op_t
extern freelist_t the_servers_pool_freelist[FRESCAN_MX_NETWORKS];
extern frescan_server_data_t the_active_servers[FRESCAN_MX_NETWORKS];
+/**
+ * frescan_contract_t
+ */
+
+typedef struct {
+ frescan_budget_t max_budget;
+ struct timespec min_period;
+ frescan_budget_t min_budget;
+ struct timespec max_period;
+ frescan_prio_t prio;
+} frescan_contract_t;
+
/**
* frescan_prio_queue_t - priority queue
*
#ifndef _MARTE_FRESCAN_HW_BUFFER_H_
#define _MARTE_FRESCAN_HW_BUFFER_H_
-#include <drivers/frescan.h>
+#include "frescan.h"
extern int frescan_hw_buffer_update(frescan_network_t net);
#define _MARTE_FRESCAN_PACKETS_H_
#include <stdint.h> // uint8_t ...
-#include <drivers/frescan.h> // frescan_flags_t
+#include "frescan.h" // frescan_flags_t
#include <misc/linux_list.h> // struct list_head
#include <drivers/can.h> // can_frame_t
#include <stdint.h> // uint8_t
#include <stdbool.h> // bool
-#include <drivers/frescan.h> // frescan_prio_t
+#include "frescan.h" // frescan_prio_t
#include "frescan_packets.h" // frescan_packet_t
#include "frescan_data.h"
--- /dev/null
+/*!
+ * @file frescan_reply_objects.h
+ *
+ * @brief FRESCAN reply objects
+ *
+ * This module contains the definition of the data object and operations to
+ * create a pool of objects, obtain the id of an unused object, wait upon it,
+ * signal it, and finish using it.
+ *
+ * @version 0.01
+ *
+ * @date 1-Apr-2008
+ *
+ * @author Daniel Sangorrin <daniel.sangorrin@unican.es>
+ *
+ */
+
+#include <misc/freelist.h>
+#include "frescan_reply_objects.h"
+#include "fosa_mutexes_and_condvars.h"
+#include "frescan_config.h"
+#include "frescan_debug.h"
+
+static bool is_initialized = false;
+
+/**
+ * the_reply_objects
+ *
+ * We will use a freelist to allocate and free the reply object. Reply objects
+ * are FOSA conditional variables (we can't use synchobjects because they are
+ * only for bound-workload) stored in an array together with their condition
+ * and a mutex variable to control the access and to be able to wait and
+ * signal the conditional variables. We could have used semaphores instead, but
+ * it would introduce a dependency on the OS because they are not in FOSA.
+ *
+ **/
+
+static fosa_mutex_t freelist_mutex;
+
+struct replyobj_t {
+ bool is_work_done;
+ fosa_cond_t cond;
+ fosa_mutex_t mutex;
+};
+
+static struct replyobj_t the_reply_objects[FRESCAN_MX_REPLY_OBJECTS];
+static freelist_t freelist;
+
+/**
+ * frescan_replyobjects_init()
+ *
+ * Init the freelist and its mutex. The conditional variables are not
+ * initialized here but when allocating a reply object. This can be more
+ * efficient for memory usage in some OS (not in MaRTE OS though).
+ *
+ **/
+
+int frescan_replyobjects_init(int max_ceiling)
+{
+ int err;
+
+ err = fosa_mutex_init(&freelist_mutex, max_ceiling);
+ if (err != 0) return err;
+
+ err = freelist_init(&freelist, FRESCAN_MX_REPLY_OBJECTS);
+ if (err != 0) return err;
+
+ is_initialized = true;
+ return 0;
+}
+
+/**
+ * frescan_replyobject_alloc()
+ *
+ * Allocate an reply object with the freelist_mutex locked and then initialize
+ * its cond variable, condition (predicate) and mutex. The ID of the allocated
+ * reply object represents the position in the array the_reply_objects.
+ *
+ **/
+
+int frescan_replyobject_alloc(frescan_robj_id_t *id, int ceiling)
+{
+ int err, pos;
+
+ DEBUG(FRESCAN_REPLYOBJ_ENABLE_DEBUG,
+ "allocating reply object, is_initialized=%d\n", is_initialized);
+
+ if (is_initialized == false) return -1;
+
+ err = fosa_mutex_lock(&freelist_mutex);
+ if (err != 0) return err;
+
+ pos = freelist_alloc(&freelist);
+ if (pos < 0) goto locked_error;
+
+ err = fosa_mutex_unlock(&freelist_mutex);
+ if (err != 0) return err;
+
+ err = fosa_cond_init(&the_reply_objects[pos].cond);
+ if (err != 0) return err;
+
+ the_reply_objects[pos].is_work_done = false;
+ *id = (unsigned int)pos;
+
+ err = fosa_mutex_init(&the_reply_objects[pos].mutex, ceiling);
+ if (err != 0) return err;
+
+ DEBUG(FRESCAN_REPLYOBJ_ENABLE_DEBUG,
+ "reply object allocated, id=%d\n", *id);
+
+ return 0;
+
+locked_error:
+ fosa_mutex_unlock(&freelist_mutex);
+ return pos;
+}
+
+/**
+ * frescan_replyobject_free()
+ *
+ * Destroy the cond variable and then free the replyobject
+ *
+ **/
+
+int frescan_replyobject_free(frescan_robj_id_t id)
+{
+ int err;
+
+ DEBUG(FRESCAN_REPLYOBJ_ENABLE_DEBUG,
+ "free reply id=%d, is_initialized=%d\n", id, is_initialized);
+
+ if (is_initialized == false) return -1;
+
+ err = fosa_mutex_lock(&freelist_mutex);
+ if (err != 0) return err;
+
+ err = freelist_free(&freelist, id);
+ if (err != 0) goto locked_error;
+
+ err = fosa_cond_destroy(&the_reply_objects[id].cond);
+ if (err != 0) return err;
+
+ err = fosa_mutex_destroy(&the_reply_objects[id].mutex);
+ if (err != 0) return err;
+
+ the_reply_objects[id].is_work_done = false;
+
+ err = fosa_mutex_unlock(&freelist_mutex);
+ if (err != 0) return err;
+
+ return 0;
+
+locked_error:
+ fosa_mutex_unlock(&freelist_mutex);
+ return err;
+}
+
+/**
+ * frescan_replyobject_signal()
+ *
+ * Signal the cond variable
+ *
+ **/
+
+int frescan_replyobject_signal(frescan_robj_id_t id)
+{
+ int err;
+
+ DEBUG(FRESCAN_REPLYOBJ_ENABLE_DEBUG,
+ "is_initialized=%d\n", is_initialized);
+ if (is_initialized == false) return -1;
+
+ DEBUG(FRESCAN_REPLYOBJ_ENABLE_DEBUG,
+ "taking mutex of the reply id=%d\n", id);
+ err = fosa_mutex_lock(&the_reply_objects[id].mutex);
+ if (err != 0) return err;
+
+ the_reply_objects[id].is_work_done = true;
+
+ DEBUG(FRESCAN_REPLYOBJ_ENABLE_DEBUG,
+ "signal the cond variable\n");
+ err = fosa_cond_signal(&the_reply_objects[id].cond);
+ if (err != 0) goto locked_error;
+
+ err = fosa_mutex_unlock(&the_reply_objects[id].mutex);
+ if (err != 0) return err;
+
+ return 0;
+
+locked_error:
+ ERROR("locked error %d\n", err);
+ fosa_mutex_unlock(&the_reply_objects[id].mutex);
+ return err;
+}
+
+/**
+ * frescan_replyobject_wait()
+ *
+ * Wait on the cond variable.
+ *
+ **/
+
+int frescan_replyobject_wait(frescan_robj_id_t id)
+{
+ int err;
+
+ if (is_initialized == false) return -1;
+
+ err = fosa_mutex_lock(&the_reply_objects[id].mutex);
+ if (err != 0) return err;
+
+ while (the_reply_objects[id].is_work_done == false) {
+ err = fosa_cond_wait(&the_reply_objects[id].cond,
+ &the_reply_objects[id].mutex);
+ if (err != 0) goto locked_error;
+ }
+
+ the_reply_objects[id].is_work_done = false;
+
+ err = fosa_mutex_unlock(&the_reply_objects[id].mutex);
+ if (err != 0) return err;
+
+ return 0;
+
+locked_error:
+ fosa_mutex_unlock(&the_reply_objects[id].mutex);
+ return err;
+}
+
+/**
+ * frescan_replyobject_timedwait()
+ *
+ * Wait on the cond variable with a timeout.
+ *
+ **/
+
+int frescan_replyobject_timedwait(frescan_robj_id_t id,
+ const struct timespec *abstime)
+{
+ int err;
+
+ if (is_initialized == false) return -1;
+
+ err = fosa_mutex_lock(&the_reply_objects[id].mutex);
+ if (err != 0) return err;
+
+ while (the_reply_objects[id].is_work_done == false) {
+ err = fosa_cond_timedwait(&the_reply_objects[id].cond,
+ &the_reply_objects[id].mutex,
+ abstime);
+ if (err != 0) goto locked_error;
+ }
+
+ the_reply_objects[id].is_work_done = false;
+
+ err = fosa_mutex_unlock(&the_reply_objects[id].mutex);
+ if (err != 0) return err;
+
+ return 0;
+
+locked_error:
+ fosa_mutex_unlock(&the_reply_objects[id].mutex);
+ return err;
+}
--- /dev/null
+/*!
+ * @file frescan_reply_objects.h
+ *
+ * @brief FRESCAN reply objects
+ *
+ * This module contains the definition of the data object and operations to
+ * create a pool of objects, obtain the id of an unused object, wait upon it,
+ * signal it, and finish using it.
+ *
+ * @version 0.01
+ *
+ * @date 1-Apr-2008
+ *
+ * @author Daniel Sangorrin <daniel.sangorrin@unican.es>
+ *
+ */
+
+#ifndef _FRESCAN_REPLY_OBJECTS_H_
+#define _FRESCAN_REPLY_OBJECTS_H_
+
+#include <time.h> /* for timespec */
+#include "fosa_opaque_types.h" /* for FOSA_ETIMEDOUT */
+
+typedef unsigned int frescan_robj_id_t; /* 0 .. MX_REPLY_OBJECTS-1 */
+#define FRESCAN_ETIMEDOUT FOSA_ETIMEDOUT
+
+extern int frescan_replyobjects_init(int max_ceiling);
+extern int frescan_replyobject_alloc(frescan_robj_id_t *id, int ceiling);
+extern int frescan_replyobject_free(frescan_robj_id_t id);
+extern int frescan_replyobject_signal(frescan_robj_id_t id);
+extern int frescan_replyobject_wait(frescan_robj_id_t id);
+extern int frescan_replyobject_timedwait(frescan_robj_id_t id,
+ const struct timespec *abstime);
+
+#endif // _FRESCAN_REPLY_OBJECTS_H_
--- /dev/null
+/*!
+ * @file frescan_requests_queue.c
+ *
+ * @brief FRESCAN requests queue
+ *
+ * This module contains an operation to create the queue, an operation to
+ * enqueue a message (with a request), and an operation to
+ * dequeue a message.
+ *
+ * @version 0.01
+ *
+ * @date 1-Apr-2008
+ *
+ * @author Daniel Sangorrin <daniel.sangorrin@unican.es>
+ *
+ */
+
+#include <misc/freelist.h>
+#include <misc/linux_list.h>
+#include "frescan.h"
+#include "frescan_requests_queue.h"
+#include "frescan_config.h"
+#include "fosa_mutexes_and_condvars.h"
+
+static bool is_initialized = false;
+
+/**
+ * the_requests_pool
+ *
+ * We will use a freelist to allocate and free the requests.
+ *
+ **/
+
+struct request_t {
+ frescan_req_type_t type;
+ frescan_robj_id_t reply;
+ frescan_contract_t *contract;
+ frescan_node_t src;
+ struct list_head request_list;
+ int pool_pos;
+};
+
+static fosa_mutex_t requests_mutex;
+static fosa_cond_t requests_cond;
+
+static struct request_t the_requests_pool[FRESCAN_MX_REQUESTS];
+static freelist_t freelist;
+static struct request_t the_requests_list;
+
+/**
+ * frescan_requests_init()
+ *
+ * Init the freelist, requests list, cond var and mutex.
+ *
+ **/
+
+int frescan_requests_init(int max_ceiling)
+{
+ int err;
+
+ err = fosa_mutex_init(&requests_mutex, max_ceiling);
+ if (err != 0) return err;
+
+ err = fosa_cond_init(&requests_cond);
+ if (err != 0) return err;
+
+ err = freelist_init(&freelist, FRESCAN_MX_REQUESTS);
+ if (err != 0) return err;
+
+ INIT_LIST_HEAD(&the_requests_list.request_list);
+
+ is_initialized = true;
+ return 0;
+}
+
+/**
+ * frescan_request_alloc()
+ *
+ * Allocate a request with the mutex locked
+ *
+ **/
+
+int frescan_request_alloc(frescan_request_id_t *id)
+{
+ int err, pos;
+
+ if (is_initialized == false) return -1;
+
+ err = fosa_mutex_lock(&requests_mutex);
+ if (err != 0) return err;
+
+ pos = freelist_alloc(&freelist);
+ if (pos < 0) goto locked_error;
+
+ err = fosa_mutex_unlock(&requests_mutex);
+ if (err != 0) return err;
+
+ *id = (unsigned int)pos;
+ the_requests_pool[*id].pool_pos = pos;
+
+ return 0;
+
+locked_error:
+ fosa_mutex_unlock(&requests_mutex);
+ return pos;
+}
+
+/**
+ * frescan_request_free()
+ *
+ * free the request from the pool
+ *
+ **/
+
+int frescan_request_free(frescan_request_id_t id)
+{
+ int err;
+
+ if (is_initialized == false) return -1;
+
+ err = fosa_mutex_lock(&requests_mutex);
+ if (err != 0) return err;
+
+ err = freelist_free(&freelist, id);
+ if (err != 0) goto locked_error;
+
+ err = fosa_mutex_unlock(&requests_mutex);
+ if (err != 0) return err;
+
+ return 0;
+
+locked_error:
+ fosa_mutex_unlock(&requests_mutex);
+ return err;
+}
+
+/**
+ * frescan_request_set_type()
+ *
+ **/
+
+int frescan_request_set_type(frescan_request_id_t id, frescan_req_type_t type)
+{
+ the_requests_pool[id].type = type;
+ return 0;
+}
+
+/**
+ * frescan_request_set_reply()
+ *
+ **/
+
+int frescan_request_set_reply(frescan_request_id_t id, frescan_robj_id_t reply)
+{
+ the_requests_pool[id].reply = reply;
+ return 0;
+}
+
+/**
+ * frescan_request_set_contract()
+ *
+ **/
+
+int frescan_request_set_contract(frescan_request_id_t id,
+ frescan_contract_t *contract)
+{
+ the_requests_pool[id].contract = contract;
+ return 0;
+}
+
+/**
+ * frescan_request_set_src()
+ *
+ **/
+
+int frescan_request_set_src(frescan_request_id_t id, frescan_node_t src)
+{
+ the_requests_pool[id].src = src;
+ return 0;
+}
+
+/**
+ * frescan_request_get_type()
+ *
+ **/
+
+int frescan_request_get_type(frescan_request_id_t id, frescan_req_type_t *type)
+{
+ *type = the_requests_pool[id].type;
+ return 0;
+}
+
+/**
+ * frescan_request_get_reply()
+ *
+ **/
+
+int frescan_request_get_reply(frescan_request_id_t id, frescan_robj_id_t *reply)
+{
+ *reply = the_requests_pool[id].reply;
+ return 0;
+}
+
+/**
+ * frescan_request_get_contract()
+ *
+ **/
+
+int frescan_request_get_contract(frescan_request_id_t id,
+ frescan_contract_t **contract)
+{
+ *contract = the_requests_pool[id].contract;
+ return 0;
+}
+
+/**
+ * frescan_request_get_src()
+ *
+ **/
+
+int frescan_request_get_src(frescan_request_id_t id, frescan_node_t *src)
+{
+ *src = the_requests_pool[id].src;
+ return 0;
+}
+
+/**
+ * frescan_requestqueue_enqueue()
+ *
+ **/
+
+int frescan_requestqueue_enqueue(frescan_request_id_t id)
+{
+ int err;
+
+ err = fosa_mutex_lock(&requests_mutex);
+ if (err != 0) return err;
+
+ list_add_tail(&the_requests_list.request_list,
+ &the_requests_pool[id].request_list);
+
+ err = fosa_cond_signal(&requests_cond);
+ if (err != 0) goto locked_error;
+
+ err = fosa_mutex_unlock(&requests_mutex);
+ if (err != 0) return err;
+
+ return 0;
+
+locked_error:
+ fosa_mutex_unlock(&requests_mutex);
+ return err;
+}
+
+/**
+ * frescan_requestqueue_dequeue()
+ *
+ **/
+
+int frescan_requestqueue_dequeue(frescan_request_id_t *id)
+{
+ int err;
+ struct list_head *pos;
+ struct request_t *request;
+
+ err = fosa_mutex_lock(&requests_mutex);
+ if (err != 0) return err;
+
+ while (list_empty(&the_requests_pool[*id].request_list)) {
+ err = fosa_cond_wait(&requests_cond, &requests_mutex);
+ if (err != 0) goto locked_error;
+ }
+
+ list_for_each(pos, &the_requests_pool[*id].request_list) {
+ request = list_entry(pos, struct request_t, request_list);
+ break;
+ }
+
+ list_del(&request->request_list);
+
+ *id = request->pool_pos;
+
+ err = fosa_mutex_unlock(&requests_mutex);
+ if (err != 0) return err;
+
+ return 0;
+
+locked_error:
+ fosa_mutex_unlock(&requests_mutex);
+ return err;
+}
--- /dev/null
+/*!
+ * @file frescan_requests_queue.h
+ *
+ * @brief FRESCAN requests queue
+ *
+ * This module contains an operation to create the queue, an operation to
+ * enqueue a message (with a request), and an operation to
+ * dequeue a message.
+ *
+ * @version 0.01
+ *
+ * @date 1-Apr-2008
+ *
+ * @author Daniel Sangorrin <daniel.sangorrin@unican.es>
+ *
+ */
+
+#ifndef _FRESCAN_REQUESTS_QUEUE_H_
+#define _FRESCAN_REQUESTS_QUEUE_H_
+
+#include "frescan_data.h" // frescan_contract_t
+#include "frescan_reply_objects.h" // frescan_robj_id_t
+
+typedef unsigned int frescan_request_id_t; /* 0 .. MX_REQUESTS */
+
+typedef enum {
+ FRESCAN_NEGOTIATE = 0, // Negotiate a contract
+ FRESCAN_RENEGOTIATE = 1, // Renegotiate a contract
+ FRESCAN_CANCEL = 2, // Cancel a contract
+ } frescan_req_type_t;
+
+extern int frescan_requests_init(int max_ceiling);
+
+extern int frescan_request_alloc(frescan_request_id_t *id);
+
+extern int frescan_request_free(frescan_request_id_t id);
+
+extern int frescan_request_set_type(frescan_request_id_t id,
+ frescan_req_type_t type);
+
+extern int frescan_request_set_reply(frescan_request_id_t id,
+ frescan_robj_id_t reply);
+
+extern int frescan_request_set_contract(frescan_request_id_t id,
+ frescan_contract_t *contract);
+
+extern int frescan_request_set_src(frescan_request_id_t id,
+ frescan_node_t src);
+
+extern int frescan_request_get_type(frescan_request_id_t id,
+ frescan_req_type_t *type);
+
+extern int frescan_request_get_reply(frescan_request_id_t id,
+ frescan_robj_id_t *reply);
+
+extern int frescan_request_get_contract(frescan_request_id_t id,
+ frescan_contract_t **contract);
+
+extern int frescan_request_get_src(frescan_request_id_t id,
+ frescan_node_t *src);
+
+extern int frescan_requestqueue_enqueue(frescan_request_id_t id);
+
+extern int frescan_requestqueue_dequeue(frescan_request_id_t *id);
+
+#endif // _FRESCAN_REQUESTS_QUEUE_H_
#ifndef _MARTE_FRESCAN_SERVERS_H_
#define _MARTE_FRESCAN_SERVERS_H_
-#include <drivers/frescan.h> // frescan_prio_t, frescan_ss_t
+#include "frescan.h" // frescan_prio_t, frescan_ss_t
#include "frescan_packets.h" // frescan_packet_t
#include <time.h> // struct timespec
#include "frescan_data.h"
#ifndef _MARTE_FRESCAN_SERVERS_REPLENISHMENTS_H_
#define _MARTE_FRESCAN_SERVERS_REPLENISHMENTS_H_
-#include <drivers/frescan.h> // frescan_network_t
+#include "frescan.h" // frescan_network_t
/**
* frescan_replenishments_init - init the replenishment structures and thread