OpenWrt – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
4 | office | 1 | /* |
2 | * RouterBoot definitions |
||
3 | * |
||
4 | * Copyright (C) 2012 Gabor Juhos <juhosg@openwrt.org> |
||
5 | * |
||
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. |
||
9 | */ |
||
10 | |||
11 | #ifndef _ATH79_ROUTERBOOT_H_ |
||
12 | #define _ATH79_ROUTERBOOT_H_ |
||
13 | |||
14 | struct rb_info { |
||
15 | unsigned int hard_cfg_offs; |
||
16 | unsigned int hard_cfg_size; |
||
17 | void *hard_cfg_data; |
||
18 | unsigned int soft_cfg_offs; |
||
19 | |||
20 | const char *board_name; |
||
21 | u32 hw_options; |
||
22 | }; |
||
23 | |||
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) |
||
37 | |||
38 | static inline bool |
||
39 | rb_hw_option_match(const struct rb_info *info, u32 mask, u32 val) |
||
40 | { |
||
41 | return (info->hw_options & (val | mask)) == val; |
||
42 | } |
||
43 | |||
44 | static inline bool |
||
45 | rb_has_hw_option(const struct rb_info *info, u32 mask) |
||
46 | { |
||
47 | return rb_hw_option_match(info, mask, mask); |
||
48 | } |
||
49 | |||
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); |
||
54 | |||
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); |
||
58 | #else |
||
59 | static inline const struct rb_info * |
||
60 | rb_init_info(void *data, unsigned int size) |
||
61 | { |
||
62 | return NULL; |
||
63 | } |
||
64 | |||
65 | static inline void *rb_get_wlan_data(void) |
||
66 | { |
||
67 | return NULL; |
||
68 | } |
||
69 | |||
70 | static inline void *rb_get_wlan_data(u16 id) |
||
71 | { |
||
72 | return NULL; |
||
73 | } |
||
74 | |||
75 | static inline int |
||
76 | routerboot_find_tag(u8 *buf, unsigned int buflen, u16 tag_id, |
||
77 | u8 **tag_data, u16 *tag_len) |
||
78 | { |
||
79 | return -ENOENT; |
||
80 | } |
||
81 | |||
82 | static inline int |
||
83 | routerboot_find_magic(u8 *buf, unsigned int buflen, u32 *offset, bool hard) |
||
84 | { |
||
85 | return -ENOENT; |
||
86 | } |
||
87 | #endif |
||
88 | |||
89 | #endif /* _ATH79_ROUTERBOOT_H_ */ |