Commit 8ed58a73 authored by Alessandro Rubini's avatar Alessandro Rubini

general: remove unneeded CONFIG_ dependencies

* library files can be built even if not used (this gets us more build-time
testing, as for example I usually build with no IP support).

* Some ifdefs are not needed, use HAS_IP instead. This adds a few
bytes to some configurations (not all, can't tell why), but I find it
acceptable.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 53ac0936
......@@ -52,5 +52,10 @@ int board_update(void);
#define BOARD_MAX_CHAN_AUX 2
#define BOARD_MAX_PTRACKERS 1
#ifdef CONFIG_IP
#define HAS_IP 1
#else
#define HAS_IP 0
#endif
#endif /* __BOARD_WRC_H */
......@@ -2,4 +2,4 @@ obj-y += lib/util.o lib/atoi.o
obj-y += lib/usleep.o
obj-$(CONFIG_WR_NODE) += lib/net.o
obj-$(CONFIG_IP) += lib/arp.o lib/icmp.o lib/ipv4.o lib/bootp.o
obj-$(CONFIG_WR_NODE) += lib/arp.o lib/icmp.o lib/ipv4.o lib/bootp.o
......@@ -90,9 +90,6 @@ void wrc_mon_gui(void)
int aux_stat;
uint64_t sec;
uint32_t nsec;
#ifdef CONFIG_IP
uint8_t ip[4];
#endif
struct wr_servo_state *s =
&((struct wr_data *)ppi->ext_data)->servo_state;
int64_t crtt;
......@@ -155,14 +152,17 @@ void wrc_mon_gui(void)
cprintf(C_GREEN, "Calibrated ");
else
cprintf(C_RED, "Uncalibrated ");
#ifdef CONFIG_IP
cprintf(C_WHITE, "\nIPv4: ");
getIP(ip);
if (needIP)
cprintf(C_RED, "BOOTP running");
else
cprintf(C_GREEN, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
#endif
if (HAS_IP) {
uint8_t ip[4];
cprintf(C_WHITE, "\nIPv4: ");
getIP(ip);
if (needIP)
cprintf(C_RED, "BOOTP running");
else
cprintf(C_GREEN, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
}
if (wrc_mon_status() == 0)
return;
......
......@@ -90,10 +90,10 @@ static void wrc_initialize(void)
calib_t24p(WRC_MODE_MASTER, &cal_phase_transition);
spll_very_init();
#ifdef CONFIG_IP
ipv4_init();
arp_init();
#endif
if (HAS_IP) {
ipv4_init();
arp_init();
}
}
#define LINK_WENT_UP 1
......@@ -199,18 +199,16 @@ int main(void)
}
switch (l_status) {
#ifdef CONFIG_IP
case LINK_WENT_UP:
needIP = 1;
break;
#endif
case LINK_UP:
update_rx_queues();
#ifdef CONFIG_IP
ipv4_poll();
arp_poll();
#endif
if (HAS_IP) {
ipv4_poll();
arp_poll();
}
break;
case LINK_WENT_DOWN:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment