]> rtime.felk.cvut.cz Git - frescor/fna.git/blobdiff - src_frescan/frescan_servers.h
added frescan sources
[frescor/fna.git] / src_frescan / frescan_servers.h
diff --git a/src_frescan/frescan_servers.h b/src_frescan/frescan_servers.h
new file mode 100644 (file)
index 0000000..e38622c
--- /dev/null
@@ -0,0 +1,137 @@
+/*!
+ * @file frescan_servers.h
+ *
+ * @brief FRESCAN sporadic servers
+ *
+ * @version 0.01
+ *
+ * @date 27-Feb-2008
+ *
+ * @author
+ *      Daniel Sangorrin
+ *
+ * @comments
+ *
+ * This file contains the FRESCAN sporadic servers that allow to isolate
+ * different streams of data by assigning them a budget and replenishment
+ * period.
+ *
+ * @license
+ *
+ * See MaRTE OS license
+ *
+ */
+
+#ifndef _MARTE_FRESCAN_SERVERS_H_
+#define _MARTE_FRESCAN_SERVERS_H_
+
+#include <drivers/frescan.h> // frescan_prio_t, frescan_ss_t
+#include "frescan_packets.h" // frescan_packet_t
+#include <time.h>            // struct timespec
+#include "frescan_data.h"
+
+/**
+ * frescan_servers_init() - initialize server structures
+ *
+ * @net: the network instance
+ */
+
+extern int frescan_servers_init(frescan_network_t net);
+
+/**
+ * frescan_servers_create() - create a sporadic server
+ *
+ * @net: the network instance
+ * @params: the parameters for the server
+ * @id: the identificator for the server as a return value
+ *
+ */
+
+extern int frescan_servers_create(frescan_network_t net,
+                                  const frescan_server_params_t *params,
+                                  frescan_ss_t *id);
+
+/**
+ * frescan_servers_update() - update a sporadic server data
+ *
+ * @net: the network instance
+ * @params: the parameters for the server
+ * @id: the identificator for the server
+ *
+ */
+
+extern int frescan_servers_update(frescan_network_t net,
+                                  const frescan_server_params_t *params,
+                                  frescan_ss_t id);
+
+/**
+ * frescan_servers_destroy() - delete a sporadic server
+ *
+ * @net: the network instance
+ * @id: the identificator for the server
+ *
+ */
+
+extern int frescan_servers_destroy(frescan_network_t net, frescan_ss_t id);
+
+/**
+ * frescan_servers_get_data() - get a sporadic server data
+ *
+ * @net: the network instance
+ * @params: the parameters of the server
+ * @id: the identificator for the server
+ *
+ */
+
+extern  int frescan_servers_get_data(frescan_network_t net,
+                                     frescan_server_params_t *params,
+                                     frescan_ss_t id);
+
+/**
+ * frescan_servers_get_current_budget() - get the current sporadic server budget
+ *
+ * @net: the network instance
+ * @id: the identificator for the server
+ * @current_budget: the current budget of the server
+ *
+ */
+
+extern int frescan_servers_get_current_budget(frescan_network_t net,
+                                              frescan_ss_t id,
+                                              frescan_budget_t *current_budget);
+
+/**
+ * frescan_servers_get_highest_prio() - get the server with highest priority
+ *
+ * @net: the network instance
+ * @id: the identificator for the server
+ * @prio: the priority of that server
+ *
+ * If "id" is returned with a value of FRESCAN_MX_IDS,
+ * there are no active servers.
+ * NOTE: id=FRESCAN_MX_IDS is the identifier for fixed priority messages
+ *
+ */
+
+extern int frescan_servers_get_highest_prio(frescan_network_t net,
+                                            frescan_ss_t *id,
+                                            frescan_prio_t *prio);
+
+/**
+ * frescan_servers_frame_sent() - hook to control the server budget and prio
+ *
+ * @net: the network instance
+ * @id: the identificator for the server
+ *
+ * This function is called when a frame has been effectively sent through the
+ * CAN bus and that frame is associated to a certain server. The function
+ * decreases the capacity of the server and sets the priority to background
+ * in case the budget is exhausted.
+ *
+ * NOTE: the replenishment operation is programmed using the corresponding
+ * function at frescan_servers_replenishments module
+ */
+
+extern int frescan_servers_frame_sent(frescan_network_t net, frescan_ss_t id);
+
+#endif // _MARTE_FRESCAN_SERVERS_H_