1 // -----------------------------------------------------------------------
2 // Copyright (C) 2006 - 2007 FRESCOR consortium partners:
4 // Universidad de Cantabria, SPAIN
5 // University of York, UK
6 // Scuola Superiore Sant'Anna, ITALY
7 // Kaiserslautern University, GERMANY
8 // Univ. Politécnica Valencia, SPAIN
9 // Czech Technical University in Prague, CZECH REPUBLIC
11 // Thales Communication S.A. FRANCE
12 // Visual Tools S.A. SPAIN
13 // Rapita Systems Ltd UK
16 // See http://www.frescor.org for a link to partners' websites
18 // FRESCOR project (FP6/2005/IST/5-034026) is funded
19 // in part by the European Union Sixth Framework Programme
20 // The European Union is not liable of any use that may be
24 // This file is part of FRSH Implementation
26 // FRSH API is free software; you can redistribute it and/or modify
27 // it under the terms of the GNU General Public License as published by
28 // the Free Software Foundation; either version 2, or (at your option)
31 // FRSH API is distributed in the hope that it will be useful, but
32 // WITHOUT ANY WARRANTY; without even the implied warranty of
33 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
34 // General Public License for more details.
36 // You should have received a copy of the GNU General Public License
37 // distributed with FRSH API; see file COPYING. If not, write to the
38 // Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
41 // As a special exception, if you include this header file into source
42 // files to be compiled, this header file does not by itself cause
43 // the resulting executable to be covered by the GNU General Public
44 // License. This exception does not however invalidate any other
45 // reasons why the executable file might be covered by the GNU General
47 // -----------------------------------------------------------------------
48 //==============================================
49 // ******** ******* ******** ** **
50 // **///// /**////** **////// /** /**
51 // ** /** /** /** /** /**
52 // ******* /******* /********* /**********
53 // **//// /**///** ////////** /**//////**
54 // ** /** //** /** /** /**
55 // ** /** //** ******** /** /**
56 // // // // //////// // //
58 // FRSH(FRescor ScHeduler), pronounced "fresh"
59 //==============================================
62 // This header file defines the interface to a pair of functions used
63 // to manage a sinly linked list that is used to find free cells in
64 // some external table.
66 // Parallel to the external table, there is a table of indexes
67 // organized as a singly linked list; it is the free list. A separate
68 // index, free_cell, indicates which is the first element of the sibly
69 // linked list. The list is terminated with an index of -1.
81 * Initialize a free list adding all the cells to the list of free cells
82 * The size of the list is specified by size.
83 * Returns: 0 if successful
84 * FRSH_ERR_NO_SPACE if there is not enough memory available
86 int frsh_freelist_init(frsh_freelist_t *list, int size);
89 * Obtain the index of a free cell from the free list specified by list
90 * the cell is removed from the list
91 * Returns the index to the requested cell, or -1 if there are no free cells
93 int frsh_freelist_alloc(frsh_freelist_t *list);
97 * Deallocate the cell specified by index cell adding it to the list
98 * of free cells specified by list
99 * Returns 0 if successful, or -1 if the cell was already free
101 int frsh_freelist_free(frsh_freelist_t *list, int cell);
103 #endif // FRSH_FREELIST