@@ -116,8 +116,10 @@ static void Netif_Config(void)
116
116
netif_set_down (& gnetif );
117
117
}
118
118
119
+ #if LWIP_NETIF_LINK_CALLBACK
119
120
/* Set the link callback function, this function is called on change of link status */
120
121
netif_set_link_callback (& gnetif , ethernetif_update_config );
122
+ #endif /* LWIP_NETIF_LINK_CALLBACK */
121
123
}
122
124
123
125
void stm32_eth_init (const uint8_t * mac , const uint8_t * ip , const uint8_t * gw , const uint8_t * netmask )
@@ -132,7 +134,7 @@ void stm32_eth_init(const uint8_t *mac, const uint8_t *ip, const uint8_t *gw, co
132
134
if (ip != NULL ) {
133
135
IP_ADDR4 (& (gconfig .ipaddr ),ip [0 ],ip [1 ],ip [2 ],ip [3 ]);
134
136
} else {
135
- #ifdef LWIP_DHCP
137
+ #if LWIP_DHCP
136
138
ip_addr_set_zero_ip4 (& (gconfig .ipaddr ));
137
139
#else
138
140
IP_ADDR4 (& (gconfig .ipaddr ),IP_ADDR0 ,IP_ADDR1 ,IP_ADDR2 ,IP_ADDR3 );
@@ -142,7 +144,7 @@ void stm32_eth_init(const uint8_t *mac, const uint8_t *ip, const uint8_t *gw, co
142
144
if (gw != NULL ) {
143
145
IP_ADDR4 (& (gconfig .gw ),gw [0 ],gw [1 ],gw [2 ],gw [3 ]);
144
146
} else {
145
- #ifdef LWIP_DHCP
147
+ #if LWIP_DHCP
146
148
ip_addr_set_zero_ip4 (& (gconfig .gw ));
147
149
#else
148
150
IP_ADDR4 (& (gconfig .gw ),GW_ADDR0 ,GW_ADDR1 ,GW_ADDR2 ,GW_ADDR3 );
@@ -152,7 +154,7 @@ void stm32_eth_init(const uint8_t *mac, const uint8_t *ip, const uint8_t *gw, co
152
154
if (netmask != NULL ) {
153
155
IP_ADDR4 (& (gconfig .netmask ),netmask [0 ],netmask [1 ],netmask [2 ],netmask [3 ]);
154
156
} else {
155
- #ifdef LWIP_DHCP
157
+ #if LWIP_DHCP
156
158
ip_addr_set_zero_ip4 (& (gconfig .netmask ));
157
159
#else
158
160
IP_ADDR4 (& (gconfig .netmask ),NETMASK_ADDR0 ,NETMASK_ADDR1 ,NETMASK_ADDR2 ,NETMASK_ADDR3 );
@@ -189,9 +191,13 @@ void stm32_eth_scheduler(void) {
189
191
/* Handle LwIP timeouts */
190
192
sys_check_timeouts ();
191
193
194
+ #if LWIP_DHCP
192
195
stm32_DHCP_Periodic_Handle (& gnetif );
196
+ #endif /* LWIP_DHCP */
193
197
}
194
198
199
+ #if LWIP_DHCP
200
+
195
201
/**
196
202
* @brief Returns DHCP activation state
197
203
* @param None
@@ -337,6 +343,8 @@ uint8_t stm32_get_DHCP_state(void) {
337
343
return DHCP_state ;
338
344
}
339
345
346
+ #endif /* LWIP_DHCP */
347
+
340
348
/**
341
349
* @brief Converts IP address in readable format for user.
342
350
* @param None
@@ -384,6 +392,8 @@ uint32_t stm32_eth_get_dhcpaddr(void) {
384
392
return ip4_addr_get_u32 (& (dhcp -> server_ip_addr ));
385
393
}
386
394
395
+ #if LWIP_NETIF_LINK_CALLBACK
396
+
387
397
/**
388
398
* @brief This function notify user about link status changement.
389
399
* @param netif: the network interface
@@ -417,6 +427,8 @@ void ethernetif_notify_conn_changed(struct netif *netif)
417
427
}
418
428
}
419
429
430
+ #endif /* LWIP_NETIF_LINK_CALLBACK */
431
+
420
432
/**
421
433
* @brief Notify the User about the nework interface config status
422
434
* @param netif: the network interface
@@ -437,6 +449,8 @@ void User_notification(struct netif *netif)
437
449
}
438
450
}
439
451
452
+ #if LWIP_DNS
453
+
440
454
/**
441
455
* @brief Initializes DNS
442
456
* @param dnsaddr: DNS address
@@ -526,6 +540,8 @@ int8_t stm32_dns_gethostbyname(const char *hostname, uint32_t *ipaddr)
526
540
return ret ;
527
541
}
528
542
543
+ #endif /* LWIP_DNS */
544
+
529
545
/**
530
546
* @brief Converts a uint8_t IP address to a ip_addr_t address
531
547
* @param ipu8: pointer to an address to convert
@@ -665,6 +681,8 @@ uint16_t stm32_get_data(struct pbuf_data *data, uint8_t *buffer, size_t size)
665
681
return nb ;
666
682
}
667
683
684
+ #if LWIP_UDP
685
+
668
686
/**
669
687
* @brief This function is called when an UDP datagram has been received on
670
688
* the port UDP_PORT.
@@ -697,6 +715,10 @@ void udp_receive_callback(void *arg, struct udp_pcb *pcb, struct pbuf *p,
697
715
}
698
716
}
699
717
718
+ #endif /* LWIP_UDP */
719
+
720
+ #if LWIP_TCP
721
+
700
722
/**
701
723
* @brief Function called when TCP connection established
702
724
* @param arg: user supplied argument
@@ -946,6 +968,8 @@ static void tcp_connection_close(struct tcp_pcb *tpcb, struct tcp_struct *tcp)
946
968
tcp -> state = TCP_CLOSING ;
947
969
}
948
970
971
+ #endif /* LWIP_TCP */
972
+
949
973
#ifdef __cplusplus
950
974
}
951
975
#endif
0 commit comments