extmod/nimble: Use MP_REGISTER_ROOT_POINTER().

This uses MP_REGISTER_ROOT_POINTER() to register bluetooth_nimble_memory
and bluetooth_nimble_root_pointers and removes the same from all
mpconfigport.h.

Signed-off-by: David Lechner <david@pybricks.com>
pull/8922/head
David Lechner 2022-07-01 14:24:16 -05:00 zatwierdzone przez Damien George
rodzic 8fa6191f95
commit e531b72b56
5 zmienionych plików z 5 dodań i 41 usunięć

Wyświetl plik

@ -1966,4 +1966,9 @@ STATIC int ble_secret_store_delete(int obj_type, const union ble_store_key *key)
#endif // MICROPY_PY_BLUETOOTH_ENABLE_PAIRING_BONDING
#if !MICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY
MP_REGISTER_ROOT_POINTER(struct _mp_bluetooth_nimble_malloc_t *bluetooth_nimble_memory);
#endif
MP_REGISTER_ROOT_POINTER(struct _mp_bluetooth_nimble_root_pointers_t *bluetooth_nimble_root_pointers);
#endif // MICROPY_PY_BLUETOOTH && MICROPY_BLUETOOTH_NIMBLE

Wyświetl plik

@ -138,19 +138,11 @@
struct _machine_timer_obj_t;
#if MICROPY_BLUETOOTH_NIMBLE
struct mp_bluetooth_nimble_root_pointers_t;
#define MICROPY_PORT_ROOT_POINTER_BLUETOOTH_NIMBLE struct _mp_bluetooth_nimble_root_pointers_t *bluetooth_nimble_root_pointers;
#else
#define MICROPY_PORT_ROOT_POINTER_BLUETOOTH_NIMBLE
#endif
#define MICROPY_PORT_ROOT_POINTERS \
mp_obj_t machine_pin_irq_handler[40]; \
struct _machine_timer_obj_t *machine_timer_obj_head; \
struct _machine_i2s_obj_t *machine_i2s_obj[I2S_NUM_MAX]; \
mp_obj_t native_code_pointers; \
MICROPY_PORT_ROOT_POINTER_BLUETOOTH_NIMBLE
// type definitions for the specific machine

Wyświetl plik

@ -147,14 +147,6 @@
#define MICROPY_PORT_ROOT_POINTER_BLUETOOTH
#endif
#if MICROPY_BLUETOOTH_NIMBLE
struct _mp_bluetooth_nimble_root_pointers_t;
struct _mp_bluetooth_nimble_malloc_t;
#define MICROPY_PORT_ROOT_POINTER_BLUETOOTH_NIMBLE struct _mp_bluetooth_nimble_malloc_t *bluetooth_nimble_memory; struct _mp_bluetooth_nimble_root_pointers_t *bluetooth_nimble_root_pointers;
#else
#define MICROPY_PORT_ROOT_POINTER_BLUETOOTH_NIMBLE
#endif
// By default networking should include sockets, ssl, websockets, webrepl, dupterm.
#if MICROPY_PY_NETWORK
#ifndef MICROPY_PY_USOCKET
@ -238,7 +230,6 @@ extern const struct _mod_network_nic_type_t mod_network_nic_type_wiznet5k;
NETWORK_ROOT_POINTERS \
MICROPY_BOARD_ROOT_POINTERS \
MICROPY_PORT_ROOT_POINTER_BLUETOOTH \
MICROPY_PORT_ROOT_POINTER_BLUETOOTH_NIMBLE \
#define MP_STATE_PORT MP_STATE_VM

Wyświetl plik

@ -238,14 +238,6 @@ extern const struct _mod_network_nic_type_t mod_network_nic_type_cc3k;
#define MP_STATE_PORT MP_STATE_VM
#if MICROPY_BLUETOOTH_NIMBLE
struct _mp_bluetooth_nimble_root_pointers_t;
struct _mp_bluetooth_nimble_malloc_t;
#define MICROPY_PORT_ROOT_POINTER_BLUETOOTH_NIMBLE struct _mp_bluetooth_nimble_malloc_t *bluetooth_nimble_memory; struct _mp_bluetooth_nimble_root_pointers_t *bluetooth_nimble_root_pointers;
#else
#define MICROPY_PORT_ROOT_POINTER_BLUETOOTH_NIMBLE
#endif
#ifndef MICROPY_BOARD_ROOT_POINTERS
#define MICROPY_BOARD_ROOT_POINTERS
#endif
@ -283,9 +275,6 @@ struct _mp_bluetooth_nimble_malloc_t;
/* list of registered NICs */ \
mp_obj_list_t mod_network_nic_list; \
\
/* root pointers for sub-systems */ \
MICROPY_PORT_ROOT_POINTER_BLUETOOTH_NIMBLE \
\
/* root pointers defined by a board */ \
MICROPY_BOARD_ROOT_POINTERS \

Wyświetl plik

@ -290,19 +290,6 @@ static inline unsigned long mp_urandom_seed_init(void) {
#define MP_STATE_PORT MP_STATE_VM
#if MICROPY_PY_BLUETOOTH
#if MICROPY_BLUETOOTH_NIMBLE
struct _mp_bluetooth_nimble_root_pointers_t;
struct _mp_bluetooth_nimble_malloc_t;
#define MICROPY_BLUETOOTH_ROOT_POINTERS struct _mp_bluetooth_nimble_malloc_t *bluetooth_nimble_memory; struct _mp_bluetooth_nimble_root_pointers_t *bluetooth_nimble_root_pointers;
#endif
#else
#define MICROPY_BLUETOOTH_ROOT_POINTERS
#endif
#define MICROPY_PORT_ROOT_POINTERS \
MICROPY_BLUETOOTH_ROOT_POINTERS \
// We need to provide a declaration/definition of alloca()
// unless support for it is disabled.
#if !defined(MICROPY_NO_ALLOCA) || MICROPY_NO_ALLOCA == 0