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); ...@@ -52,5 +52,10 @@ int board_update(void);
#define BOARD_MAX_CHAN_AUX 2 #define BOARD_MAX_CHAN_AUX 2
#define BOARD_MAX_PTRACKERS 1 #define BOARD_MAX_PTRACKERS 1
#ifdef CONFIG_IP
#define HAS_IP 1
#else
#define HAS_IP 0
#endif
#endif /* __BOARD_WRC_H */ #endif /* __BOARD_WRC_H */
...@@ -2,4 +2,4 @@ obj-y += lib/util.o lib/atoi.o ...@@ -2,4 +2,4 @@ obj-y += lib/util.o lib/atoi.o
obj-y += lib/usleep.o obj-y += lib/usleep.o
obj-$(CONFIG_WR_NODE) += lib/net.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) ...@@ -90,9 +90,6 @@ void wrc_mon_gui(void)
int aux_stat; int aux_stat;
uint64_t sec; uint64_t sec;
uint32_t nsec; uint32_t nsec;
#ifdef CONFIG_IP
uint8_t ip[4];
#endif
struct wr_servo_state *s = struct wr_servo_state *s =
&((struct wr_data *)ppi->ext_data)->servo_state; &((struct wr_data *)ppi->ext_data)->servo_state;
int64_t crtt; int64_t crtt;
...@@ -155,14 +152,17 @@ void wrc_mon_gui(void) ...@@ -155,14 +152,17 @@ void wrc_mon_gui(void)
cprintf(C_GREEN, "Calibrated "); cprintf(C_GREEN, "Calibrated ");
else else
cprintf(C_RED, "Uncalibrated "); cprintf(C_RED, "Uncalibrated ");
#ifdef CONFIG_IP
cprintf(C_WHITE, "\nIPv4: "); if (HAS_IP) {
getIP(ip); uint8_t ip[4];
if (needIP)
cprintf(C_RED, "BOOTP running"); cprintf(C_WHITE, "\nIPv4: ");
else getIP(ip);
cprintf(C_GREEN, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); if (needIP)
#endif 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) if (wrc_mon_status() == 0)
return; return;
......
...@@ -90,10 +90,10 @@ static void wrc_initialize(void) ...@@ -90,10 +90,10 @@ static void wrc_initialize(void)
calib_t24p(WRC_MODE_MASTER, &cal_phase_transition); calib_t24p(WRC_MODE_MASTER, &cal_phase_transition);
spll_very_init(); spll_very_init();
#ifdef CONFIG_IP if (HAS_IP) {
ipv4_init(); ipv4_init();
arp_init(); arp_init();
#endif }
} }
#define LINK_WENT_UP 1 #define LINK_WENT_UP 1
...@@ -199,18 +199,16 @@ int main(void) ...@@ -199,18 +199,16 @@ int main(void)
} }
switch (l_status) { switch (l_status) {
#ifdef CONFIG_IP
case LINK_WENT_UP: case LINK_WENT_UP:
needIP = 1; needIP = 1;
break; break;
#endif
case LINK_UP: case LINK_UP:
update_rx_queues(); update_rx_queues();
#ifdef CONFIG_IP if (HAS_IP) {
ipv4_poll(); ipv4_poll();
arp_poll(); arp_poll();
#endif }
break; break;
case LINK_WENT_DOWN: 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