carl9170 firmware: import 1.7.0
[carl9170fw.git] / carlfw / include / config.h
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License along
13  * with this program; if not, write to the Free Software Foundation, Inc.,
14  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15  */
16
17 #include "generated/autoconf.h"
18 #include "version.h"
19 #include "types.h"
20 #include "compiler.h"
21 #include "fwcmd.h"
22
23 #ifndef __CARL9170FW_CONFIG_H
24 #define __CARL9170FW_CONFIG_H
25
26 #define __CARL9170FW__
27
28 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
29
30 #if GCC_VERSION < 40400
31 # error "This firmware will not work if it is compiled with gcc versions < 4.4"
32 # error "See: http://gcc.gnu.org/gcc-4.4/changes.html / Caveats No. 4"
33 #endif
34
35 #if ((defined CONFIG_CARL9170FW_PRINTF) &&              \
36      (!defined CONFIG_CARL9170FW_DEBUG_USB) &&          \
37     (!defined CONFIG_CARL9170FW_DEBUG_UART))
38 # warning "You have disabled all debug message transports."
39 # warning "However CONFIG_CARL9170FW_PRINTF is still set..."
40 # warning "Which is a waste of firmware space, if you ask me."
41 #endif
42
43 #define CARL9170_TX_STATUS_NUM          (CARL9170_RSP_TX_STATUS_NUM)
44 #define CARL9170_INT_RQ_CACHES          16
45 #define AR9170_INT_MAGIC_HEADER_SIZE    12
46 #define CARL9170_USB_WATCHDOG_TRIGGER_THRESHOLD 4
47 #define CARL9170_TBTT_DELTA             (CARL9170_PRETBTT_KUS + 1)
48
49 #define CARL9170_GPIO_MASK              (AR9170_GPIO_PORT_WPS_BUTTON_PRESSED)
50
51 #ifdef CONFIG_CARL9170FW_VIFS_NUM
52 #define CARL9170_INTF_NUM               (1 + CONFIG_CARL9170FW_VIFS_NUM)
53 #else
54 #define CARL9170_INTF_NUM               (1)
55 #endif /* CONFIG_CARL9170FW_VIFS_NUM */
56
57 #if ((defined CONFIG_CARL9170FW_DEBUG) ||       \
58      (defined CONFIG_CARL9170FW_LOOPBACK))
59 #define CARL9170FW_UNUSABLE     y
60 #endif
61
62 static inline void __config_check(void)
63 {
64         BUILD_BUG_ON(!CARL9170_TX_STATUS_NUM);
65         BUILD_BUG_ON(CARL9170_USB_WATCHDOG_TRIGGER_THRESHOLD < 2);
66         BUILD_BUG_ON(CARL9170_INTF_NUM < 1);
67
68 #ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ
69         BUILD_BUG_ON(!CONFIG_CARL9170FW_BACK_REQS_NUM);
70 #endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */
71 }
72
73 #endif /* __CARL9170FW_CONFIG_H */