mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-26 03:16:18 +00:00
Fix that slipif used netif->num to pass parameters to slipif_init.
Use netif->state now, interpreted as u8_t port number (not a pointer any more!)
This commit is contained in:
parent
1fd56658b8
commit
ef758082ed
@ -10,6 +10,10 @@ with newer versions.
|
|||||||
|
|
||||||
++ Application changes:
|
++ Application changes:
|
||||||
|
|
||||||
|
* slipif: The way to pass serial port number has changed. netif->num is not
|
||||||
|
supported any more, netif->state is interpreted as an u8_t port number now
|
||||||
|
(it's not a POINTER to an u8_t any more!)
|
||||||
|
|
||||||
* The IPv6 implementation now supports address scopes. All addresses that have a scope according
|
* The IPv6 implementation now supports address scopes. All addresses that have a scope according
|
||||||
to the default policy (link-local unicast addresses, interface-local and link-local multicast
|
to the default policy (link-local unicast addresses, interface-local and link-local multicast
|
||||||
addresses) should now have a zone set on them before being passed to the core API, although
|
addresses) should now have a zone set on them before being passed to the core API, although
|
||||||
|
@ -124,7 +124,7 @@ slipif_output(struct netif *netif, struct pbuf *p)
|
|||||||
LWIP_ASSERT("netif->state != NULL", (netif->state != NULL));
|
LWIP_ASSERT("netif->state != NULL", (netif->state != NULL));
|
||||||
LWIP_ASSERT("p != NULL", (p != NULL));
|
LWIP_ASSERT("p != NULL", (p != NULL));
|
||||||
|
|
||||||
LWIP_DEBUGF(SLIP_DEBUG, ("slipif_output(%"U16_F"): sending %"U16_F" bytes\n", (u16_t)netif->num, p->tot_len));
|
LWIP_DEBUGF(SLIP_DEBUG, ("slipif_output: sending %"U16_F" bytes\n", p->tot_len));
|
||||||
priv = (struct slipif_priv *)netif->state;
|
priv = (struct slipif_priv *)netif->state;
|
||||||
|
|
||||||
/* Send pbuf out on the serial I/O device. */
|
/* Send pbuf out on the serial I/O device. */
|
||||||
@ -352,9 +352,7 @@ slipif_loop_thread(void *nf)
|
|||||||
* ERR_MEM if no memory could be allocated,
|
* ERR_MEM if no memory could be allocated,
|
||||||
* ERR_IF is serial line couldn't be opened
|
* ERR_IF is serial line couldn't be opened
|
||||||
*
|
*
|
||||||
* @note netif->num must contain the number of the serial port to open
|
* @note If netif->state is interpreted as an u8_t serial port number.
|
||||||
* (0 by default). If netif->state is != NULL, it is interpreted as an
|
|
||||||
* u8_t pointer pointing to the serial port number instead of netif->num.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
err_t
|
err_t
|
||||||
@ -363,7 +361,10 @@ slipif_init(struct netif *netif)
|
|||||||
struct slipif_priv *priv;
|
struct slipif_priv *priv;
|
||||||
u8_t sio_num;
|
u8_t sio_num;
|
||||||
|
|
||||||
LWIP_DEBUGF(SLIP_DEBUG, ("slipif_init: netif->num=%"U16_F"\n", (u16_t)netif->num));
|
/* netif->state contains serial port number */
|
||||||
|
sio_num = (u8_t)netif->state;
|
||||||
|
|
||||||
|
LWIP_DEBUGF(SLIP_DEBUG, ("slipif_init: netif->num=%"U16_F"\n", (u16_t)sio_num));
|
||||||
|
|
||||||
/* Allocate private data */
|
/* Allocate private data */
|
||||||
priv = (struct slipif_priv *)mem_malloc(sizeof(struct slipif_priv));
|
priv = (struct slipif_priv *)mem_malloc(sizeof(struct slipif_priv));
|
||||||
@ -381,12 +382,6 @@ slipif_init(struct netif *netif)
|
|||||||
#endif /* LWIP_IPV6 */
|
#endif /* LWIP_IPV6 */
|
||||||
netif->mtu = SLIP_MAX_SIZE;
|
netif->mtu = SLIP_MAX_SIZE;
|
||||||
|
|
||||||
/* netif->state or netif->num contain the port number */
|
|
||||||
if (netif->state != NULL) {
|
|
||||||
sio_num = *(u8_t*)netif->state;
|
|
||||||
} else {
|
|
||||||
sio_num = netif->num;
|
|
||||||
}
|
|
||||||
/* Try to open the serial port. */
|
/* Try to open the serial port. */
|
||||||
priv->sd = sio_open(sio_num);
|
priv->sd = sio_open(sio_num);
|
||||||
if (!priv->sd) {
|
if (!priv->sd) {
|
||||||
|
Loading…
Reference in New Issue
Block a user