Setting up repository
[linux-libre-firmware.git] / carl9170fw / tools / lib / carlfw.h
1 /*
2  * Copyright 2010-2011 Christian Lamparter <chunkeey@googlemail.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17
18 #ifndef __CARLFW_H
19 #define __CARLFW_H
20
21 #include <linux/types.h>
22 #include "compiler.h"
23 #include "fwdesc.h"
24 #include "list.h"
25
26 struct carlfw;
27
28 void carlfw_release(struct carlfw *fw);
29 struct carlfw *carlfw_load(const char *basename);
30 int carlfw_store(struct carlfw *fw);
31 void *carlfw_find_desc(struct carlfw *fw,
32         const uint8_t descid[4], const unsigned int len,
33         const uint8_t compatible_revision);
34
35 int carlfw_desc_add_tail(struct carlfw *fw,
36                          const struct carl9170fw_desc_head *desc);
37
38 int carlfw_desc_add(struct carlfw *fw,
39                     const struct carl9170fw_desc_head *desc,
40                     struct carl9170fw_desc_head *prev,
41                     struct carl9170fw_desc_head *next);
42
43 void *carlfw_desc_mod_len(struct carlfw *fw,
44                           struct carl9170fw_desc_head *desc,
45                           size_t len);
46
47 int carlfw_desc_add_before(struct carlfw *fw,
48                            const struct carl9170fw_desc_head *desc,
49                            struct carl9170fw_desc_head *pos);
50
51 void carlfw_desc_unlink(struct carlfw *fw,
52                         struct carl9170fw_desc_head *desc);
53
54 void carlfw_desc_del(struct carlfw *fw,
55                      struct carl9170fw_desc_head *entry);
56
57 void *carlfw_desc_next(struct carlfw *fw,
58                        struct carl9170fw_desc_head *pos);
59
60 void *carlfw_mod_tailroom(struct carlfw *fw, ssize_t len);
61 void *carlfw_mod_headroom(struct carlfw *fw, ssize_t len);
62
63 void *carlfw_get_fw(struct carlfw *fw, size_t *len);
64
65 unsigned int carlfw_get_descs_num(struct carlfw *fw);
66 unsigned int carlfw_get_descs_size(struct carlfw *fw);
67 #endif /* __CARLFW_H */