From d33f6214f15d1983c2fa7f54f42d2145e656fa22 Mon Sep 17 00:00:00 2001 From: Nick Moore Date: Thu, 4 Oct 2018 21:30:26 +1000 Subject: modify modnetwork and modusocket for circuitpython --- shared-module/network/__init__.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 shared-module/network/__init__.c (limited to 'shared-module/network') diff --git a/shared-module/network/__init__.c b/shared-module/network/__init__.c new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.3 From 9b36d33df142d4a3dd2c238799e227c05b537d95 Mon Sep 17 00:00:00 2001 From: Nick Moore Date: Tue, 9 Oct 2018 13:12:04 +1100 Subject: move random mac address function into network module --- shared-bindings/wiznet/wiznet5k.c | 18 +++------------- shared-module/network/__init__.c | 43 +++++++++++++++++++++++++++++++++++++++ shared-module/network/__init__.h | 28 +++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 15 deletions(-) create mode 100644 shared-module/network/__init__.h (limited to 'shared-module/network') diff --git a/shared-bindings/wiznet/wiznet5k.c b/shared-bindings/wiznet/wiznet5k.c index 967e7d0f4..558867264 100644 --- a/shared-bindings/wiznet/wiznet5k.c +++ b/shared-bindings/wiznet/wiznet5k.c @@ -40,7 +40,8 @@ #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/digitalio/DriveMode.h" #include "shared-bindings/busio/SPI.h" -#include "shared-bindings/random/__init__.h" + +#include "shared-module/network/__init__.h" #if MICROPY_PY_WIZNET5K @@ -336,19 +337,6 @@ STATIC mp_obj_t wiznet5k_socket_disconnect(mp_obj_t self_in) { } #endif -void create_random_mac_address(uint8_t *mac) { - uint32_t rb1 = shared_modules_random_getrandbits(24); - uint32_t rb2 = shared_modules_random_getrandbits(24); - // first octet has multicast bit (0) cleared and local bit (1) set - // everything else is just set randomly - mac[0] = ((uint8_t)(rb1 >> 16) & 0xfe) | 0x02; - mac[1] = (uint8_t)(rb1 >> 8); - mac[2] = (uint8_t)(rb1); - mac[3] = (uint8_t)(rb2 >> 16); - mac[4] = (uint8_t)(rb2 >> 8); - mac[5] = (uint8_t)(rb2); -} - /******************************************************************************/ // MicroPython bindings @@ -400,7 +388,7 @@ STATIC mp_obj_t wiznet5k_make_new(const mp_obj_type_t *type, size_t n_args, size .dns = {8, 8, 8, 8}, // Google public DNS .dhcp = NETINFO_STATIC, }; - create_random_mac_address(netinfo.mac); + network_module_create_random_mac_address(netinfo.mac); ctlnetwork(CN_SET_NETINFO, (void*)&netinfo); // seems we need a small delay after init diff --git a/shared-module/network/__init__.c b/shared-module/network/__init__.c index e69de29bb..7e3b7fd26 100644 --- a/shared-module/network/__init__.c +++ b/shared-module/network/__init__.c @@ -0,0 +1,43 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Nick Moore + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "py/mphal.h" + +#include "shared-bindings/random/__init__.h" + +void network_module_create_random_mac_address(uint8_t *mac) { + uint32_t rb1 = shared_modules_random_getrandbits(24); + uint32_t rb2 = shared_modules_random_getrandbits(24); + // first octet has multicast bit (0) cleared and local bit (1) set + // everything else is just set randomly + mac[0] = ((uint8_t)(rb1 >> 16) & 0xfe) | 0x02; + mac[1] = (uint8_t)(rb1 >> 8); + mac[2] = (uint8_t)(rb1); + mac[3] = (uint8_t)(rb2 >> 16); + mac[4] = (uint8_t)(rb2 >> 8); + mac[5] = (uint8_t)(rb2); +} + diff --git a/shared-module/network/__init__.h b/shared-module/network/__init__.h new file mode 100644 index 000000000..13f800fb0 --- /dev/null +++ b/shared-module/network/__init__.h @@ -0,0 +1,28 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Nick Moore + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +void network_module_create_random_mac_address(uint8_t *mac); + -- cgit v1.2.3 From 823ff779cacb2c940d1e9e742c66dd89223f97ad Mon Sep 17 00:00:00 2001 From: Nick Moore Date: Thu, 11 Oct 2018 14:02:18 +1100 Subject: network module c api into shared-module --- main.c | 2 +- shared-bindings/network/__init__.c | 32 +------------------- shared-bindings/network/__init__.h | 55 +--------------------------------- shared-bindings/socket/__init__.c | 2 +- shared-bindings/wiznet/__init__.c | 2 +- shared-bindings/wiznet/wiznet5k.c | 2 +- shared-module/network/__init__.c | 37 ++++++++++++++++++++++- shared-module/network/__init__.h | 60 ++++++++++++++++++++++++++++++++++++++ 8 files changed, 102 insertions(+), 90 deletions(-) (limited to 'shared-module/network') diff --git a/main.c b/main.c index f1c68d06a..c1379c571 100755 --- a/main.c +++ b/main.c @@ -55,7 +55,7 @@ #include "supervisor/serial.h" #ifdef MICROPY_PY_NETWORK -#include "shared-bindings/network/__init__.h" +#include "shared-module/network/__init__.h" #endif void do_str(const char *src, mp_parse_input_kind_t input_kind) { diff --git a/shared-bindings/network/__init__.c b/shared-bindings/network/__init__.c index f28d5265c..c5639b462 100644 --- a/shared-bindings/network/__init__.c +++ b/shared-bindings/network/__init__.c @@ -47,37 +47,7 @@ /// \module network - network configuration /// -/// This module provides network drivers and routing configuration. - -void network_module_init(void) { - mp_obj_list_init(&MP_STATE_PORT(mod_network_nic_list), 0); -} - -void network_module_deinit(void) { -} - -void network_module_register_nic(mp_obj_t nic) { - for (mp_uint_t i = 0; i < MP_STATE_PORT(mod_network_nic_list).len; i++) { - if (MP_STATE_PORT(mod_network_nic_list).items[i] == nic) { - // nic already registered - return; - } - } - // nic not registered so add to list - mp_obj_list_append(MP_OBJ_FROM_PTR(&MP_STATE_PORT(mod_network_nic_list)), nic); -} - -mp_obj_t network_module_find_nic(const uint8_t *ip) { - // find a NIC that is suited to given IP address - for (mp_uint_t i = 0; i < MP_STATE_PORT(mod_network_nic_list).len; i++) { - mp_obj_t nic = MP_STATE_PORT(mod_network_nic_list).items[i]; - // TODO check IP suitability here - //mod_network_nic_type_t *nic_type = (mod_network_nic_type_t*)mp_obj_get_type(nic); - return nic; - } - - nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, translate("no available NIC"))); -} +/// This module provides a registry of configured NICs. STATIC mp_obj_t network_route(void) { return MP_OBJ_FROM_PTR(&MP_STATE_PORT(mod_network_nic_list)); diff --git a/shared-bindings/network/__init__.h b/shared-bindings/network/__init__.h index b3fd657b6..4fe5e75a3 100644 --- a/shared-bindings/network/__init__.h +++ b/shared-bindings/network/__init__.h @@ -26,59 +26,6 @@ #ifndef MICROPY_INCLUDED_SHARED_BINDINGS_NETWORK___INIT___H #define MICROPY_INCLUDED_SHARED_BINDINGS_NETWORK___INIT___H -#define MOD_NETWORK_IPADDR_BUF_SIZE (4) - -#define MOD_NETWORK_AF_INET (2) -#define MOD_NETWORK_AF_INET6 (10) - -#define MOD_NETWORK_SOCK_STREAM (1) -#define MOD_NETWORK_SOCK_DGRAM (2) -#define MOD_NETWORK_SOCK_RAW (3) - -struct _mod_network_socket_obj_t; - -typedef struct _mod_network_nic_type_t { - mp_obj_type_t base; - - // API for non-socket operations - int (*gethostbyname)(mp_obj_t nic, const char *name, mp_uint_t len, uint8_t *ip_out); - - // API for socket operations; return -1 on error - int (*socket)(struct _mod_network_socket_obj_t *socket, int *_errno); - void (*close)(struct _mod_network_socket_obj_t *socket); - int (*bind)(struct _mod_network_socket_obj_t *socket, byte *ip, mp_uint_t port, int *_errno); - int (*listen)(struct _mod_network_socket_obj_t *socket, mp_int_t backlog, int *_errno); - int (*accept)(struct _mod_network_socket_obj_t *socket, struct _mod_network_socket_obj_t *socket2, byte *ip, mp_uint_t *port, int *_errno); - int (*connect)(struct _mod_network_socket_obj_t *socket, byte *ip, mp_uint_t port, int *_errno); - mp_uint_t (*send)(struct _mod_network_socket_obj_t *socket, const byte *buf, mp_uint_t len, int *_errno); - mp_uint_t (*recv)(struct _mod_network_socket_obj_t *socket, byte *buf, mp_uint_t len, int *_errno); - mp_uint_t (*sendto)(struct _mod_network_socket_obj_t *socket, const byte *buf, mp_uint_t len, byte *ip, mp_uint_t port, int *_errno); - mp_uint_t (*recvfrom)(struct _mod_network_socket_obj_t *socket, byte *buf, mp_uint_t len, byte *ip, mp_uint_t *port, int *_errno); - int (*setsockopt)(struct _mod_network_socket_obj_t *socket, mp_uint_t level, mp_uint_t opt, const void *optval, mp_uint_t optlen, int *_errno); - int (*settimeout)(struct _mod_network_socket_obj_t *socket, mp_uint_t timeout_ms, int *_errno); - int (*ioctl)(struct _mod_network_socket_obj_t *socket, mp_uint_t request, mp_uint_t arg, int *_errno); -} mod_network_nic_type_t; - -typedef struct _mod_network_socket_obj_t { - mp_obj_base_t base; - mp_obj_t nic; - mod_network_nic_type_t *nic_type; - union { - struct { - uint8_t domain; - uint8_t type; - int8_t fileno; - } u_param; - mp_uint_t u_state; - }; -} mod_network_socket_obj_t; - -extern const mod_network_nic_type_t mod_network_nic_type_wiznet5k; -extern const mod_network_nic_type_t mod_network_nic_type_cc3k; - -void network_module_init(void); -void network_module_deinit(void); -void network_module_register_nic(mp_obj_t nic); -mp_obj_t network_module_find_nic(const uint8_t *ip); +// nothing #endif // MICROPY_INCLUDED_SHARED_BINDINGS_NETWORK___INIT___H diff --git a/shared-bindings/socket/__init__.c b/shared-bindings/socket/__init__.c index 85796c5c4..f6949b4bf 100644 --- a/shared-bindings/socket/__init__.c +++ b/shared-bindings/socket/__init__.c @@ -35,7 +35,7 @@ #include "py/mperrno.h" #include "lib/netutils/netutils.h" -#include "shared-bindings/network/__init__.h" +#include "shared-module/network/__init__.h" //| :mod:`socket` --- TCP, UDP and RAW socket support //| ================================================= diff --git a/shared-bindings/wiznet/__init__.c b/shared-bindings/wiznet/__init__.c index fbdac3885..342cb1052 100644 --- a/shared-bindings/wiznet/__init__.c +++ b/shared-bindings/wiznet/__init__.c @@ -33,7 +33,7 @@ #include "py/runtime.h" #include "py/mphal.h" -#include "shared-bindings/network/__init__.h" +#include "shared-module/network/__init__.h" //| :mod:`wiznet` --- Support for WizNet hardware //| ============================================= diff --git a/shared-bindings/wiznet/wiznet5k.c b/shared-bindings/wiznet/wiznet5k.c index ccbd2b115..26e02fb67 100644 --- a/shared-bindings/wiznet/wiznet5k.c +++ b/shared-bindings/wiznet/wiznet5k.c @@ -36,7 +36,7 @@ #include "py/mphal.h" #include "lib/netutils/netutils.h" -#include "shared-bindings/network/__init__.h" +#include "shared-module/network/__init__.h" #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/digitalio/DriveMode.h" #include "shared-bindings/busio/SPI.h" diff --git a/shared-module/network/__init__.c b/shared-module/network/__init__.c index 7e3b7fd26..6a955a0c4 100644 --- a/shared-module/network/__init__.c +++ b/shared-module/network/__init__.c @@ -24,10 +24,46 @@ * THE SOFTWARE. */ +#include "py/objlist.h" +#include "py/runtime.h" #include "py/mphal.h" +#include "py/mperrno.h" #include "shared-bindings/random/__init__.h" +// mod_network_nic_list needs to be declared in mpconfigport.h + + +void network_module_init(void) { + mp_obj_list_init(&MP_STATE_PORT(mod_network_nic_list), 0); +} + +void network_module_deinit(void) { +} + +void network_module_register_nic(mp_obj_t nic) { + for (mp_uint_t i = 0; i < MP_STATE_PORT(mod_network_nic_list).len; i++) { + if (MP_STATE_PORT(mod_network_nic_list).items[i] == nic) { + // nic already registered + return; + } + } + // nic not registered so add to list + mp_obj_list_append(MP_OBJ_FROM_PTR(&MP_STATE_PORT(mod_network_nic_list)), nic); +} + +mp_obj_t network_module_find_nic(const uint8_t *ip) { + // find a NIC that is suited to given IP address + for (mp_uint_t i = 0; i < MP_STATE_PORT(mod_network_nic_list).len; i++) { + mp_obj_t nic = MP_STATE_PORT(mod_network_nic_list).items[i]; + // TODO check IP suitability here + //mod_network_nic_type_t *nic_type = (mod_network_nic_type_t*)mp_obj_get_type(nic); + return nic; + } + + nlr_raise(mp_obj_new_exception_msg(&mp_type_OSError, translate("no available NIC"))); +} + void network_module_create_random_mac_address(uint8_t *mac) { uint32_t rb1 = shared_modules_random_getrandbits(24); uint32_t rb2 = shared_modules_random_getrandbits(24); @@ -40,4 +76,3 @@ void network_module_create_random_mac_address(uint8_t *mac) { mac[4] = (uint8_t)(rb2 >> 8); mac[5] = (uint8_t)(rb2); } - diff --git a/shared-module/network/__init__.h b/shared-module/network/__init__.h index 13f800fb0..ce5b4e6d3 100644 --- a/shared-module/network/__init__.h +++ b/shared-module/network/__init__.h @@ -3,6 +3,7 @@ * * The MIT License (MIT) * + * Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2018 Nick Moore * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -26,3 +27,62 @@ void network_module_create_random_mac_address(uint8_t *mac); +#ifndef MICROPY_INCLUDED_SHARED_MODULE_NETWORK___INIT___H +#define MICROPY_INCLUDED_SHARED_MODULE_NETWORK___INIT___H + +#define MOD_NETWORK_IPADDR_BUF_SIZE (4) + +#define MOD_NETWORK_AF_INET (2) +#define MOD_NETWORK_AF_INET6 (10) + +#define MOD_NETWORK_SOCK_STREAM (1) +#define MOD_NETWORK_SOCK_DGRAM (2) +#define MOD_NETWORK_SOCK_RAW (3) + +struct _mod_network_socket_obj_t; + +typedef struct _mod_network_nic_type_t { + mp_obj_type_t base; + + // API for non-socket operations + int (*gethostbyname)(mp_obj_t nic, const char *name, mp_uint_t len, uint8_t *ip_out); + + // API for socket operations; return -1 on error + int (*socket)(struct _mod_network_socket_obj_t *socket, int *_errno); + void (*close)(struct _mod_network_socket_obj_t *socket); + int (*bind)(struct _mod_network_socket_obj_t *socket, byte *ip, mp_uint_t port, int *_errno); + int (*listen)(struct _mod_network_socket_obj_t *socket, mp_int_t backlog, int *_errno); + int (*accept)(struct _mod_network_socket_obj_t *socket, struct _mod_network_socket_obj_t *socket2, byte *ip, mp_uint_t *port, int *_errno); + int (*connect)(struct _mod_network_socket_obj_t *socket, byte *ip, mp_uint_t port, int *_errno); + mp_uint_t (*send)(struct _mod_network_socket_obj_t *socket, const byte *buf, mp_uint_t len, int *_errno); + mp_uint_t (*recv)(struct _mod_network_socket_obj_t *socket, byte *buf, mp_uint_t len, int *_errno); + mp_uint_t (*sendto)(struct _mod_network_socket_obj_t *socket, const byte *buf, mp_uint_t len, byte *ip, mp_uint_t port, int *_errno); + mp_uint_t (*recvfrom)(struct _mod_network_socket_obj_t *socket, byte *buf, mp_uint_t len, byte *ip, mp_uint_t *port, int *_errno); + int (*setsockopt)(struct _mod_network_socket_obj_t *socket, mp_uint_t level, mp_uint_t opt, const void *optval, mp_uint_t optlen, int *_errno); + int (*settimeout)(struct _mod_network_socket_obj_t *socket, mp_uint_t timeout_ms, int *_errno); + int (*ioctl)(struct _mod_network_socket_obj_t *socket, mp_uint_t request, mp_uint_t arg, int *_errno); +} mod_network_nic_type_t; + +typedef struct _mod_network_socket_obj_t { + mp_obj_base_t base; + mp_obj_t nic; + mod_network_nic_type_t *nic_type; + union { + struct { + uint8_t domain; + uint8_t type; + int8_t fileno; + } u_param; + mp_uint_t u_state; + }; +} mod_network_socket_obj_t; + +extern const mod_network_nic_type_t mod_network_nic_type_wiznet5k; +extern const mod_network_nic_type_t mod_network_nic_type_cc3k; + +void network_module_init(void); +void network_module_deinit(void); +void network_module_register_nic(mp_obj_t nic); +mp_obj_t network_module_find_nic(const uint8_t *ip); + +#endif // MICROPY_INCLUDED_SHARED_MODULE_NETWORK___INIT___H -- cgit v1.2.3 From a15f3361aa0182cbefe0aec7376ff56bdcb74aa4 Mon Sep 17 00:00:00 2001 From: Nick Moore Date: Tue, 16 Oct 2018 23:09:25 +1100 Subject: add mechanism for timer ticks in NICs --- ports/atmel-samd/background.c | 4 ++++ shared-module/network/__init__.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) (limited to 'shared-module/network') diff --git a/ports/atmel-samd/background.c b/ports/atmel-samd/background.c index f25ec7200..385f0c284 100644 --- a/ports/atmel-samd/background.c +++ b/ports/atmel-samd/background.c @@ -31,6 +31,7 @@ #include "usb_mass_storage.h" #include "shared-module/displayio/__init__.h" +#include "shared-module/network/__init__.h" volatile uint64_t last_finished_tick = 0; @@ -41,6 +42,9 @@ void run_background_tasks(void) { #ifdef CIRCUITPY_DISPLAYIO displayio_refresh_display(); #endif + #ifdef MICROPY_PY_NETWORK + network_module_background(); + #endif usb_msc_background(); usb_cdc_background(); last_finished_tick = ticks_ms; diff --git a/shared-module/network/__init__.c b/shared-module/network/__init__.c index 6a955a0c4..a674e8478 100644 --- a/shared-module/network/__init__.c +++ b/shared-module/network/__init__.c @@ -24,6 +24,8 @@ * THE SOFTWARE. */ +#include + #include "py/objlist.h" #include "py/runtime.h" #include "py/mphal.h" @@ -31,6 +33,8 @@ #include "shared-bindings/random/__init__.h" +#include "shared-module/network/__init__.h" + // mod_network_nic_list needs to be declared in mpconfigport.h @@ -41,6 +45,19 @@ void network_module_init(void) { void network_module_deinit(void) { } +void network_module_background(void) { + static uint32_t next_tick = 0; + uint32_t this_tick = ticks_ms; + if (this_tick < next_tick) return; + next_tick = this_tick + 1000; + + for (mp_uint_t i = 0; i < MP_STATE_PORT(mod_network_nic_list).len; i++) { + mp_obj_t nic = MP_STATE_PORT(mod_network_nic_list).items[i]; + mod_network_nic_type_t *nic_type = (mod_network_nic_type_t*)mp_obj_get_type(nic); + if (nic_type->timer_tick != NULL) nic_type->timer_tick(nic); + } +} + void network_module_register_nic(mp_obj_t nic) { for (mp_uint_t i = 0; i < MP_STATE_PORT(mod_network_nic_list).len; i++) { if (MP_STATE_PORT(mod_network_nic_list).items[i] == nic) { -- cgit v1.2.3 From 45974978efa7e81a5a2a46bfb9f8d3cf016b1cb4 Mon Sep 17 00:00:00 2001 From: Nick Moore Date: Tue, 16 Oct 2018 23:09:55 +1100 Subject: fixup --- shared-module/network/__init__.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'shared-module/network') diff --git a/shared-module/network/__init__.h b/shared-module/network/__init__.h index ce5b4e6d3..00a3c3957 100644 --- a/shared-module/network/__init__.h +++ b/shared-module/network/__init__.h @@ -61,6 +61,7 @@ typedef struct _mod_network_nic_type_t { int (*setsockopt)(struct _mod_network_socket_obj_t *socket, mp_uint_t level, mp_uint_t opt, const void *optval, mp_uint_t optlen, int *_errno); int (*settimeout)(struct _mod_network_socket_obj_t *socket, mp_uint_t timeout_ms, int *_errno); int (*ioctl)(struct _mod_network_socket_obj_t *socket, mp_uint_t request, mp_uint_t arg, int *_errno); + void (*timer_tick)(struct _mod_network_socket_obj_t *socket); } mod_network_nic_type_t; typedef struct _mod_network_socket_obj_t { @@ -82,6 +83,7 @@ extern const mod_network_nic_type_t mod_network_nic_type_cc3k; void network_module_init(void); void network_module_deinit(void); +void network_module_background(void); void network_module_register_nic(mp_obj_t nic); mp_obj_t network_module_find_nic(const uint8_t *ip); -- cgit v1.2.3