2 * @file frescan_servers.h
4 * @brief FRESCAN sporadic servers
15 * This file contains the FRESCAN sporadic servers that allow to isolate
16 * different streams of data by assigning them a budget and replenishment
21 //----------------------------------------------------------------------
22 // Copyright (C) 2006 - 2009 by the FRESCOR consortium:
24 // Universidad de Cantabria, SPAIN
25 // University of York, UK
26 // Scuola Superiore Sant'Anna, ITALY
27 // Kaiserslautern University, GERMANY
28 // Univ. Politecnica Valencia, SPAIN
29 // Czech Technical University in Prague, CZECH REPUBLIC
31 // Thales Communication S.A. FRANCE
32 // Visual Tools S.A. SPAIN
33 // Rapita Systems Ltd UK
36 // See http://www.frescor.org
38 // The FRESCOR project (FP6/2005/IST/5-034026) is funded
39 // in part by the European Union Sixth Framework Programme
40 // The European Union is not liable of any use that may be
44 // based on previous work (FSF) done in the FIRST project
46 // Copyright (C) 2005 Mälardalen University, SWEDEN
47 // Scuola Superiore S.Anna, ITALY
48 // Universidad de Cantabria, SPAIN
49 // University of York, UK
51 // This file is part of FNA (Frescor Network Adaptation)
53 // FNA is free software; you can redistribute it and/or modify it
54 // under terms of the GNU General Public License as published by the
55 // Free Software Foundation; either version 2, or (at your option) any
56 // later version. FNA is distributed in the hope that it will be
57 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
58 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
59 // General Public License for more details. You should have received a
60 // copy of the GNU General Public License along with FNA; see file
61 // COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,
62 // Cambridge, MA 02139, USA.
64 // As a special exception, including FNA header files in a file,
65 // instantiating FNA generics or templates, or linking other files
66 // with FNA objects to produce an executable application, does not
67 // by itself cause the resulting executable application to be covered
68 // by the GNU General Public License. This exception does not
69 // however invalidate any other reasons why the executable file might be
70 // covered by the GNU Public License.
71 // -----------------------------------------------------------------------
75 #ifndef _MARTE_FRESCAN_SERVERS_H_
76 #define _MARTE_FRESCAN_SERVERS_H_
78 #include "frescan_types.h"
81 * frescan_servers_init() - initialize server structures
83 * @net: the network instance
86 extern int frescan_servers_init(frescan_network_t net);
89 * frescan_servers_create() - create a sporadic server
91 * @net: the network instance
92 * @params: the parameters for the server
93 * @id: the identificator for the server as a return value
97 extern int frescan_servers_create(frescan_network_t net,
98 const frescan_server_params_t *params,
102 * frescan_servers_set_perceived() - update a sporadic server perceived data
104 * @net: the network instance
105 * @params: the parameters for the server
106 * @id: the identificator for the server
110 extern int frescan_servers_set_perceived(frescan_network_t net,
111 const frescan_server_params_t *params,
115 * frescan_servers_commit_perceived() - commit sporadic server perceived data
117 * @net: the network instance
118 * @params: the parameters for the server
119 * @id: the identificator for the server
123 extern int frescan_servers_commit_perceived(frescan_network_t net,
127 * frescan_servers_update() - update a sporadic server data
129 * It is similar to call 'frescan_servers_set_perceived' and then
130 * 'frescan_servers_commit_perceived'
132 * @net: the network instance
133 * @params: the parameters for the server
134 * @id: the identificator for the server
138 extern int frescan_servers_update(frescan_network_t net,
139 const frescan_server_params_t *params,
143 * frescan_servers_destroy() - delete a sporadic server
145 * @net: the network instance
146 * @id: the identificator for the server
150 extern int frescan_servers_destroy(frescan_network_t net, frescan_ss_t id);
153 * frescan_servers_get_data() - get a sporadic server data
155 * @net: the network instance
156 * @params: the parameters of the server
157 * @id: the identificator for the server
161 extern int frescan_servers_get_data(frescan_network_t net,
162 frescan_server_params_t *params,
166 * frescan_servers_get_current_budget() - get the current sporadic server budget
168 * @net: the network instance
169 * @id: the identificator for the server
170 * @current_budget: the current budget of the server
174 extern int frescan_servers_get_current_budget(frescan_network_t net,
176 frescan_budget_t *current_budget);
179 * frescan_servers_get_highest_prio() - get the server with highest priority
181 * @net: the network instance
182 * @id: the identificator for the server
183 * @prio: the priority of that server
185 * If "id" is returned with a value of FRESCAN_MX_IDS,
186 * there are no active servers.
187 * NOTE: id=FRESCAN_MX_IDS is the identifier for fixed priority messages
191 extern int frescan_servers_get_highest_prio(frescan_network_t net,
193 frescan_prio_t *prio);
196 * frescan_servers_frame_sent() - hook to control the server budget and prio
198 * @net: the network instance
199 * @id: the identificator for the server
200 * @packet: the packet sent (with its timestamp)
202 * This function is called when a frame has been effectively sent through the
203 * CAN bus and that frame is associated to a certain server. The function
204 * decreases the capacity of the server and sets the priority to background
205 * in case the budget is exhausted.
207 * NOTE: the replenishment operation is programmed using the corresponding
208 * function at frescan_servers_replenishments module
211 extern int frescan_servers_frame_sent(frescan_network_t net,
213 frescan_packet_t *packet);
215 #endif // _MARTE_FRESCAN_SERVERS_H_