Wykres commitów

9 Commity (f694a6fa20652e327151ac537b79180930c54ca0)

Autor SHA1 Wiadomość Data
Damien George ce8262a164 stm32/modnetwork: Replace generic netif NIC polling with specific code.
It doesn't work to tie the polling of an underlying NIC driver (eg to check
the NIC for pending Ethernet frames) with its associated lwIP netif.  This
is because most NICs are implemented with IRQs and don't need polling,
because there can be multiple lwIP netif's per NIC driver, and because it
restricts the use of the netif->state variable.  Instead the NIC should
have its own specific way of processing incoming Ethernet frame.

This patch removes this generic NIC polling feature, and for the only
driver that uses it (Wiznet5k) replaces it with an explicit call to the
poll function (which could eventually be improved by using a proper
external interrupt).
2019-06-03 17:14:34 +10:00
Damien George c55709bf29 stm32/network_lan: Add high-level network.LAN interface to ETH driver. 2019-02-26 23:32:19 +11:00
Damien George 800871c0cb stm32/modnetwork: Change lwIP polling to be based on background systick. 2019-02-08 16:38:09 +11:00
Damien George 7d86ac6c01 stm32: Add network driver for Wiznet5k using MACRAW mode and lwIP.
The Wiznet5k series of chips support a MACRAW mode which allows the host to
send and receive Ethernet frames directly.  This can be hooked into the
lwIP stack to provide a full "socket" implementation using this Wiznet
Ethernet device.  This patch adds support for this feature.

To enable the feature one must add the following to mpconfigboard.mk, or
mpconfigport.mk:

    MICROPY_PY_WIZNET5K = 5500

and the following to mpconfigboard.h, or mpconfigport.h:

    #define MICROPY_PY_LWIP (1)

After wiring up the module (X5=CS, X4=RST), usage on a pyboard is:

    import time, network
    nic = network.WIZNET5K(pyb.SPI(1), pyb.Pin.board.X5, pyb.Pin.board.X4)
    nic.active(1)
    while not nic.isconnected():
        time.sleep_ms(50) # needed to poll the NIC
    print(nic.ifconfig())

Then use the socket module as usual.

Compared to using the built-in TCP/IP stack on the Wiznet module, some
performance is lost in MACRAW mode: with a lot of memory allocated to lwIP
buffers, lwIP gives Around 750,000 bytes/sec max TCP download, compared
with 1M/sec when using the TCP/IP stack on the Wiznet module.
2018-06-01 14:21:38 +10:00
Damien George d9f1ecece2 stm32/modnetwork: Provide generic implementation of ifconfig method.
All it needs is a lwIP netif to function.
2018-06-01 13:33:14 +10:00
Damien George 7437215ad7 stm32/modnetwork: Change base entry of NIC object from type to base.
mod_network_nic_type_t doesn't need to be an actual uPy type, it just needs
to be an object.
2018-06-01 13:31:28 +10:00
Damien George cda964198a stm32: Integrate lwIP as implementation of usocket module.
This patch allows to use lwIP as the implementation of the usocket module,
instead of the existing socket-multiplexer that delegates the entire TCP/IP
layer to the NIC itself.

This is disabled by default, and enabled by defining MICROPY_PY_LWIP to 1.

When enabled, the lwIP TCP/IP stack will be included in the build with
default settings for memory usage and performance (see
lwip_inc/lwipopts.h).  It is then up to a particular NIC to register itself
with lwIP using the standard lwIP netif API.
2018-05-21 17:36:06 +10:00
Damien George d966a33486 stm32: Change header include guards from STMHAL to STM32 to match dir. 2018-02-15 15:47:04 +11:00
Damien George 01dd7804b8 ports: Make new ports/ sub-directory and move all ports there.
This is to keep the top-level directory clean, to make it clear what is
core and what is a port, and to allow the repository to grow with new ports
in a sustainable way.
2017-09-06 13:40:51 +10:00