| 1 |
/* |
| 2 |
* Copyright 2010-2011 Christian Lamparter <[email protected]> |
| 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 |
/* These macros are already defined as part of newlib's sys/cdefs.h. |
| 22 |
* However they are not part of standard libc which is used to compile |
| 23 |
* the host tools. For now, simply add them here. |
| 24 |
*/ |
| 25 |
#define __packed __attribute__((packed)) |
| 26 |
#define __unused __attribute__((unused)) |
| 27 |
#define __aligned(x) __attribute__((aligned(x))) |
| 28 |
|
| 29 |
#include <linux/types.h> |
| 30 |
#include "compiler.h" |
| 31 |
#include "fwdesc.h" |
| 32 |
#include "list.h" |
| 33 |
|
| 34 |
struct carlfw; |
| 35 |
|
| 36 |
void carlfw_release(struct carlfw *fw); |
| 37 |
struct carlfw *carlfw_load(const char *basename); |
| 38 |
int carlfw_store(struct carlfw *fw); |
| 39 |
void *carlfw_find_desc(struct carlfw *fw, |
| 40 |
const uint8_t descid[4], const unsigned int len, |
| 41 |
const uint8_t compatible_revision); |
| 42 |
|
| 43 |
int carlfw_desc_add_tail(struct carlfw *fw, |
| 44 |
const struct carl9170fw_desc_head *desc); |
| 45 |
|
| 46 |
int carlfw_desc_add(struct carlfw *fw, |
| 47 |
const struct carl9170fw_desc_head *desc, |
| 48 |
struct carl9170fw_desc_head *prev, |
| 49 |
struct carl9170fw_desc_head *next); |
| 50 |
|
| 51 |
void *carlfw_desc_mod_len(struct carlfw *fw, |
| 52 |
struct carl9170fw_desc_head *desc, |
| 53 |
size_t len); |
| 54 |
|
| 55 |
int carlfw_desc_add_before(struct carlfw *fw, |
| 56 |
const struct carl9170fw_desc_head *desc, |
| 57 |
struct carl9170fw_desc_head *pos); |
| 58 |
|
| 59 |
void carlfw_desc_unlink(struct carlfw *fw, |
| 60 |
struct carl9170fw_desc_head *desc); |
| 61 |
|
| 62 |
void carlfw_desc_del(struct carlfw *fw, |
| 63 |
struct carl9170fw_desc_head *entry); |
| 64 |
|
| 65 |
void *carlfw_desc_next(struct carlfw *fw, |
| 66 |
struct carl9170fw_desc_head *pos); |
| 67 |
|
| 68 |
void *carlfw_mod_tailroom(struct carlfw *fw, ssize_t len); |
| 69 |
void *carlfw_mod_headroom(struct carlfw *fw, ssize_t len); |
| 70 |
|
| 71 |
void *carlfw_get_fw(struct carlfw *fw, size_t *len); |
| 72 |
|
| 73 |
unsigned int carlfw_get_descs_num(struct carlfw *fw); |
| 74 |
unsigned int carlfw_get_descs_size(struct carlfw *fw); |
| 75 |
#endif /* __CARLFW_H */ |