2 * RouterBoot definitions
4 * Copyright (C) 2012 Gabor Juhos <juhosg@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
11 #ifndef _ATH79_ROUTERBOOT_H_
12 #define _ATH79_ROUTERBOOT_H_
15 unsigned int hard_cfg_offs
;
16 unsigned int hard_cfg_size
;
18 unsigned int soft_cfg_offs
;
20 const char *board_name
;
24 /* Bit definitions for hardware options */
25 #define RB_HW_OPT_UART_ABSENT BIT(0)
26 #define RB_HW_OPT_HAS_VOLTAGE BIT(1)
27 #define RB_HW_OPT_HAS_USB BIT(2)
28 #define RB_HW_OPT_HAS_ATTINY BIT(3)
29 #define RB_HW_OPT_NO_NAND BIT(14)
30 #define RB_HW_OPT_HAS_LCD BIT(15)
31 #define RB_HW_OPT_HAS_POE_OUT BIT(16)
32 #define RB_HW_OPT_HAS_uSD BIT(17)
33 #define RB_HW_OPT_HAS_SFP BIT(20)
34 #define RB_HW_OPT_HAS_WIFI BIT(21)
35 #define RB_HW_OPT_HAS_TS_FOR_ADC BIT(22)
36 #define RB_HW_OPT_HAS_PLC BIT(29)
39 rb_hw_option_match(const struct rb_info
*info
, u32 mask
, u32 val
)
41 return (info
->hw_options
& (val
| mask
)) == val
;
45 rb_has_hw_option(const struct rb_info
*info
, u32 mask
)
47 return rb_hw_option_match(info
, mask
, mask
);
50 #ifdef CONFIG_ATH79_ROUTERBOOT
51 const struct rb_info
*rb_init_info(void *data
, unsigned int size
);
52 void *rb_get_wlan_data(void);
53 void *rb_get_ext_wlan_data(u16 id
);
55 int routerboot_find_tag(u8
*buf
, unsigned int buflen
, u16 tag_id
,
56 u8
**tag_data
, u16
*tag_len
);
57 int routerboot_find_magic(u8
*buf
, unsigned int buflen
, u32
*offset
, bool hard
);
59 static inline const struct rb_info
*
60 rb_init_info(void *data
, unsigned int size
)
65 static inline void *rb_get_wlan_data(void)
70 static inline void *rb_get_wlan_data(u16 id
)
76 routerboot_find_tag(u8
*buf
, unsigned int buflen
, u16 tag_id
,
77 u8
**tag_data
, u16
*tag_len
)
83 routerboot_find_magic(u8
*buf
, unsigned int buflen
, u32
*offset
, bool hard
)
89 #endif /* _ATH79_ROUTERBOOT_H_ */