forked from ethersex/ethersex
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.h
164 lines (133 loc) · 4.56 KB
/
config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/*
*
* (c) by Alexander Neumann <[email protected]>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (either version 2 or
* version 3) as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* For more information on the GPL, please go to:
* http://www.gnu.org/copyleft/gpl.html
*/
#ifndef _CONFIG_H
#define _CONFIG_H
#include <avr/version.h>
#include <avr/io.h>
/* check for avr-libc version */
#if __AVR_LIBC_VERSION__ < 10404UL
#error "newer libc version (>= 1.4.4) needed!"
#endif
/* check if cpu speed is defined */
#ifndef F_CPU
#error "please define F_CPU!"
#endif
/* network controller hardware bug defines */
#define ENC28J60_REV4_WORKAROUND
#define ENC28J60_REV5_WORKAROUND
/* global version defines */
#if VERSION_STRING_CHOICE == USE_BUILDDATE_VERSION
#define VERSION_STRING __DATE__ " " __TIME__
#else
#if VERSION_STRING_CHOICE == USE_GIT_VERSION
#define VERSION_STRING VERSION_GIT
#else
#if VERSION_STRING_CHOICE == USE_RELEASE_VERSION
#define xstr_(s) str_(s)
#define str_(s) #s
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_STRING xstr_(VERSION_MAJOR)"."xstr_(VERSION_MINOR)VERSION_GIT
#else
#warning No Version choosen
#endif
#endif
#endif
/* configure duplex mode */
#define NET_FULL_DUPLEX 0
/* configure main callback function for uip */
#define UIP_APPCALL if (uip_conn->callback != NULL) uip_conn->callback
#define UIP_UDP_APPCALL if (uip_udp_conn->callback) uip_udp_conn->callback
/* onewire support */
#define ONEWIRE_PARASITE
/* rc5 support */
#define RC5_QUEUE_LENGTH 10
/* bootloader config */
#define CONF_BOOTLOAD_DELAY 250 /* five seconds */
/* rfm12 config */
#define RFM12_FREQ_433920 433920
#define RFM12_FREQ_869775 869775
#define RFM12_FREQ_869800 869800
#define RFM12_FREQ_869825 869825
#define RFM12_FREQ_869850 869850
#define RFM12_FREQ_869875 869875
#define RFM12_FREQ_869900 869900
#define RFM12_FREQ_869925 869925
#include "autoconf.h"
/* Include pinning.c as output of m4 scripts in pinning sub-directory.
Have a look there for MCU specific configuration options. */
#include "pinning.c"
/* use watchdog only when not debugging */
#ifndef DEBUG
# define USE_WATCHDOG
#endif
/* macros */
#ifdef USE_WATCHDOG
# include <avr/wdt.h>
# define wdt_kick() wdt_reset()
#else
# define wdt_kick()
#endif
/* Map the IP address configuration to use in network.c
(and that is assigned to the primary stack). */
#ifdef ENC28J60_SUPPORT
# define set_CONF_ETHERRAPE_MAC(ip) set_CONF_ENC_MAC(ip)
# define set_CONF_ETHERRAPE_IP(ip) set_CONF_ENC_IP(ip)
# define set_CONF_ETHERRAPE_IP4_NETMASK(ip) set_CONF_ENC_IP4_NETMASK(ip)
# define CONF_ETHERRAPE_MAC CONF_ENC_MAC
#elif defined (RFM12_IP_SUPPORT)
# define set_CONF_ETHERRAPE_IP(ip) set_CONF_RFM12_IP(ip)
# define set_CONF_ETHERRAPE_IP4_NETMASK(ip) set_CONF_RFM12_IP4_NETMASK(ip)
#elif defined (ZBUS_SUPPORT)
# define set_CONF_ETHERRAPE_IP(ip) set_CONF_ZBUS_IP(ip)
# define set_CONF_ETHERRAPE_IP4_NETMASK(ip) set_CONF_ZBUS_IP4_NETMASK(ip)
#elif defined (USB_NET_SUPPORT)
# define set_CONF_ETHERRAPE_IP(ip) set_CONF_USB_NET_IP(ip)
# define set_CONF_ETHERRAPE_IP4_NETMASK(ip) set_CONF_USB_NET_IP4_NETMASK(ip)
#endif
/* ADC Reference Flags */
#define ADC_AREF 0
#define ADC_AVCC 0x40
#define ADC_1_1 0x80
#define ADC_2_56 0xC0
/* Figure out whether we need access to EEPROM:
- ECMD without TEENSY (IP address configuration etc.)
- BOOTP with to-EEPROM-feature
- STELLA with eeprom load/write support */
#if (defined(ECMD_PARSER_SUPPORT) && (!defined(TEENSY_SUPPORT))) \
|| (defined(BOOTP_SUPPORT) && defined(BOOTP_TO_EEPROM_SUPPORT)) \
|| defined(STELLA_EEPROM)
# define EEPROM_SUPPORT 1
#endif
/* Figure out whether we need CRC_SUPPORT: */
#if defined(EEPROM_SUPPORT) \
|| defined(ONEWIRE_SUPPORT) \
|| defined(VFS_INLINE_SUPPORT) \
|| defined(TFTP_SUPPORT)
# define CRC_SUPPORT 1
#endif
#if defined(VFS_SUPPORT) && defined(VFS_INLINE_SUPPORT) \
&& !defined(VFS_SD_SUPPORT) && !defined(VFS_DF_SUPPORT) \
&& !defined(VFS_EEPROM_RAW_SUPPORT) \
&& !defined(VFS_DC3840_SUPPORT)
# define VFS_TEENSY 1
#endif
#endif /* _CONFIG_H */