Wykres commitów

36 Commity (f5f9edf6457624bf32e71b0c2fdcfbfa5d5753a6)

Autor SHA1 Wiadomość Data
Jim Mussared f5f9edf645 all: Rename UMODULE to MODULE in preprocessor/Makefile vars.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:54:11 +10:00
Jim Mussared 7f5d5c7271 all: Rename mod_umodule*, ^umodule* to remove the "u" prefix.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:54:07 +10:00
Jim Mussared 1bf2dcb15e all: Rename mp_umodule*, mp_module_umodule* to remove the "u" prefix.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:54:04 +10:00
Jim Mussared 30628d1bb7 all: Rename MP_QSTR_umodule to MP_QSTR_module everywhere.
This renames the builtin-modules, such that help('modules') and printing
the module object will show "module" rather than "umodule".

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:53:57 +10:00
Jim Mussared 5f8f32f917 extmod/modnetwork: Use a type protocol to implement NIC functions.
This was previously implemented by adding additional members to the
mp_obj_type_t defined for each NIC, which is difficult to do cleanly with
the new object type slots mechanism. The way this works is also not
supported on GCC 8.x and below.

Instead replace it with the type protocol, which is a much simpler way of
achieving the same thing.

This affects the WizNet (in non-LWIP mode) and Nina NIC drivers.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-12-15 17:40:06 +11:00
Damien George a513558e3a extmod: Add and reorganise compilation guards and includes.
To reduce dependencies on header files when extmod components are disabled.

Signed-off-by: Damien George <damien.p.george@gmail.com>
2022-11-11 16:24:32 +11:00
Jim Mussared 94beeabd2e py/obj: Convert make_new into a mp_obj_type_t slot.
Instead of being an explicit field, it's now a slot like all the other
methods.

This is a marginal code size improvement because most types have a make_new
(100/138 on PYBV11), however it improves consistency in how types are
declared, removing the special case for make_new.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19 19:06:15 +10:00
Jim Mussared 9dce82776d all: Remove unnecessary locals_dict cast.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19 19:06:01 +10:00
Jim Mussared 662b9761b3 all: Make all mp_obj_type_t defs use MP_DEFINE_CONST_OBJ_TYPE.
In preparation for upcoming rework of mp_obj_type_t layout.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-09-19 19:06:01 +10:00
Jim Mussared 8a0ee5a5c0 py/objstr: Split mp_obj_str_from_vstr into bytes/str versions.
Previously the desired output type was specified.  Now make the type part
of the function name.  Because this function is used in a few places this
saves code size due to smaller call-site.

This makes `mp_obj_new_str_type_from_vstr` a private function of objstr.c
(which is almost the only place where the output type isn't a compile-time
constant).

This saves ~140 bytes on PYBV11.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-26 16:43:55 +10:00
iabdalkader a4eef90b22 extmod/modusocket: Fix polling of closed sockets.
Unbound sockets in NEW state should return HUP|WR when polled, and return
NVAL when in CLOSED state.
2022-06-08 14:15:01 +10:00
iabdalkader 70bf6ab6fb extmod/modusocket: Add socket state to track new/listening/conn/closed. 2022-06-08 14:13:59 +10:00
Damien George efe23aca71 all: Remove third argument to MP_REGISTER_MODULE.
It's no longer needed because this macro is now processed after
preprocessing the source code via cpp (in the qstr extraction stage), which
means unused MP_REGISTER_MODULE's are filtered out by the preprocessor.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 16:31:37 +10:00
iabdalkader edf41d2bf8 extmod/modusocket: Add sendall function. 2022-05-25 00:19:41 +10:00
iabdalkader b9d2f1e844 extmod/modusocket: Add timeout and callback to socket object. 2022-05-25 00:19:41 +10:00
iabdalkader 6841fecbb2 extmod/modusocket: Fix socket_make_new argument parsing. 2022-05-25 00:19:40 +10:00
iabdalkader 3438e80060 extmod/modusocket: Add support for socket events callback.
Add support for the special sockopt 20.
2022-05-25 00:18:33 +10:00
iabdalkader fc1f876175 extmod/modusocket: Add socket type print function. 2022-05-25 00:18:28 +10:00
iabdalkader eb957b0c95 extmod/modusocket: Fix errcode returned from socket read/write.
Drivers should ensure a positive errcode is returned from read/write.
2022-05-25 00:18:18 +10:00
iabdalkader 6136c7644a extmod/modusocket: Bind unconnected socket to default NIC in setsockopt.
Bind socket to default NIC if setsockopt is called before the socket is
bound, to allow setting SO_REUSEADDR before calling socket_bind().

Fixes issue #8653.
2022-05-25 00:16:32 +10:00
iabdalkader 7b4147dd0b extmod/modusocket: Fix polling of a new socket.
New sockets should return HUP and WR when polled, following modlwip.
2022-05-25 00:12:42 +10:00
Jim Mussared 75efb3267c extmod: Revert accidental usocket->socket rename.
The registration of the usocket module was accidentally changed to socket
in moving to MP_REGISTER_MODULE in bb794f05b7
2022-05-24 00:43:44 +10:00
Jim Mussared bb794f05b7 extmod: Make port-included extmod modules use MP_REGISTER_MODULES.
_onewire, socket, and network were previously added by the port rather
than objmodule.c.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-05-18 20:49:12 +10:00
Damien George aab005c75b extmod/modusocket: Provide config macro for socket.listen backlog deflt.
To make it possible to change this value for any given port or board.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-11 15:28:56 +10:00
Jon Bjarni Bjarnason 919f696ad2 extmod/modusocket: Implement optional socket.listen backlog argument.
This follows the CPython change: https://bugs.python.org/issue21455

Socket listen backlog defaults to 2 if not given, based on most bare metal
targets not having many resources for a large backlog.  On UNIX it defaults
to SOMAXCONN or 128, whichever is less.
2022-04-11 15:26:47 +10:00
Damien George 9438fb7321 extmod/modusocket: Support additional args to getaddrinfo.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-21 13:40:06 +11:00
iabdalkader a63875d5ad extmod/modusocket: Create new sockets in blocking mode.
To conform with CPython and other MicroPython ports.
2022-01-21 13:34:56 +11:00
iabdalkader 155eb1361e extmod/modusocket: Add makefile() method and common socket options. 2022-01-21 13:34:06 +11:00
iabdalkader b23178a9c0 extmod/modusocket: Make setsockopt return if NIC is not connected. 2022-01-21 13:32:09 +11:00
iabdalkader 842da93011 extmod/modusocket: Initialise accepted socket state. 2022-01-12 14:37:32 +11:00
iabdalkader 67420de4f4 extmod/modusocket: Allow setting timeout on unbound sockets.
For an extended state socket, if settimeout() is called before a NIC is
bound, save the timeout until the NIC is bound.
2022-01-12 14:36:55 +11:00
iabdalkader 38f8e852e0 rp2: Add framework for networking.
MICROPY_PY_NETWORK and MICROPY_PY_USOCKET need to be enabled by a board to
get networking.  No NICs have yet been defined.
2021-09-19 23:20:13 +10:00
iabdalkader d9749f90ad extmod/modnetwork: Remove modnetwork socket u_state member.
To simplify the socket state.

The CC3K driver (see drivers/cc3000/inc/socket.h and src/socket.c) has
socket() returning an INT16 so there is now enough room to store it
directly in the fileno member.
2021-09-15 11:29:02 +10:00
iabdalkader c13e25c329 extmod/modusocket: Add read/write stream methods to socket object.
Following other socket implementations.
2021-09-15 01:28:37 +10:00
iabdalkader e7429389a6 extmod/modnetwork: Add extended socket state. 2021-09-15 01:26:23 +10:00
iabdalkader 7aab0dc5d8 extmod: Move modnetwork and modusocket from stm32 to extmod.
So they can be used by other ports.
2021-09-15 01:25:12 +10:00