Factor common_hal_os_uname into os_uname() and remove common_hal_os_uname.
This commit is contained in:
parent
2f4cd7497d
commit
214c2f6dd8
16 changed files with 24 additions and 342 deletions
|
|
@ -15,32 +15,6 @@
|
||||||
|
|
||||||
// #include "peripherals/periph.h"
|
// #include "peripherals/periph.h"
|
||||||
|
|
||||||
static const qstr os_uname_info_fields[] = {
|
|
||||||
MP_QSTR_sysname, MP_QSTR_nodename,
|
|
||||||
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
|
|
||||||
};
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
static MP_DEFINE_ATTRTUPLE(
|
|
||||||
os_uname_info_obj,
|
|
||||||
os_uname_info_fields,
|
|
||||||
5,
|
|
||||||
(mp_obj_t)&os_uname_info_sysname_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_nodename_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_release_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_version_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_machine_obj
|
|
||||||
);
|
|
||||||
|
|
||||||
mp_obj_t common_hal_os_uname(void) {
|
|
||||||
return (mp_obj_t)&os_uname_info_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
|
bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
|
||||||
#if (HAS_TRNG)
|
#if (HAS_TRNG)
|
||||||
// todo (low prior): implement
|
// todo (low prior): implement
|
||||||
|
|
|
||||||
|
|
@ -16,32 +16,6 @@
|
||||||
#include "hal/include/hal_rand_sync.h"
|
#include "hal/include/hal_rand_sync.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const qstr os_uname_info_fields[] = {
|
|
||||||
MP_QSTR_sysname, MP_QSTR_nodename,
|
|
||||||
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
|
|
||||||
};
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
|
|
||||||
static MP_DEFINE_ATTRTUPLE(
|
|
||||||
os_uname_info_obj,
|
|
||||||
os_uname_info_fields,
|
|
||||||
5,
|
|
||||||
(mp_obj_t)&os_uname_info_sysname_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_nodename_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_release_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_version_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_machine_obj
|
|
||||||
);
|
|
||||||
|
|
||||||
mp_obj_t common_hal_os_uname(void) {
|
|
||||||
return (mp_obj_t)&os_uname_info_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
||||||
#ifdef SAM_D5X_E5X
|
#ifdef SAM_D5X_E5X
|
||||||
hri_mclk_set_APBCMASK_TRNG_bit(MCLK);
|
hri_mclk_set_APBCMASK_TRNG_bit(MCLK);
|
||||||
|
|
|
||||||
|
|
@ -10,33 +10,6 @@
|
||||||
#include "py/objtuple.h"
|
#include "py/objtuple.h"
|
||||||
#include "py/qstr.h"
|
#include "py/qstr.h"
|
||||||
|
|
||||||
static const qstr os_uname_info_fields[] = {
|
|
||||||
MP_QSTR_sysname, MP_QSTR_nodename,
|
|
||||||
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
|
|
||||||
};
|
|
||||||
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
|
|
||||||
static MP_DEFINE_ATTRTUPLE(
|
|
||||||
os_uname_info_obj,
|
|
||||||
os_uname_info_fields,
|
|
||||||
5,
|
|
||||||
(mp_obj_t)&os_uname_info_sysname_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_nodename_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_release_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_version_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_machine_obj
|
|
||||||
);
|
|
||||||
|
|
||||||
mp_obj_t common_hal_os_uname(void) {
|
|
||||||
return (mp_obj_t)&os_uname_info_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
|
bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,32 +10,6 @@
|
||||||
#include "py/objstr.h"
|
#include "py/objstr.h"
|
||||||
#include "py/objtuple.h"
|
#include "py/objtuple.h"
|
||||||
|
|
||||||
static const qstr os_uname_info_fields[] = {
|
|
||||||
MP_QSTR_sysname, MP_QSTR_nodename,
|
|
||||||
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
|
|
||||||
};
|
|
||||||
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
static MP_DEFINE_ATTRTUPLE(
|
|
||||||
os_uname_info_obj,
|
|
||||||
os_uname_info_fields,
|
|
||||||
5,
|
|
||||||
(mp_obj_t)&os_uname_info_sysname_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_nodename_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_release_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_version_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_machine_obj
|
|
||||||
);
|
|
||||||
|
|
||||||
mp_obj_t common_hal_os_uname(void) {
|
|
||||||
return (mp_obj_t)&os_uname_info_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,32 +15,6 @@
|
||||||
#include "esp_system.h"
|
#include "esp_system.h"
|
||||||
#include "esp_random.h"
|
#include "esp_random.h"
|
||||||
|
|
||||||
static const qstr os_uname_info_fields[] = {
|
|
||||||
MP_QSTR_sysname, MP_QSTR_nodename,
|
|
||||||
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
|
|
||||||
};
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
|
|
||||||
static MP_DEFINE_ATTRTUPLE(
|
|
||||||
os_uname_info_obj,
|
|
||||||
os_uname_info_fields,
|
|
||||||
5,
|
|
||||||
(mp_obj_t)&os_uname_info_sysname_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_nodename_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_release_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_version_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_machine_obj
|
|
||||||
);
|
|
||||||
|
|
||||||
mp_obj_t common_hal_os_uname(void) {
|
|
||||||
return (mp_obj_t)&os_uname_info_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
while (i < length) {
|
while (i < length) {
|
||||||
|
|
|
||||||
|
|
@ -12,32 +12,6 @@
|
||||||
|
|
||||||
#include "shared-bindings/os/__init__.h"
|
#include "shared-bindings/os/__init__.h"
|
||||||
|
|
||||||
static const qstr os_uname_info_fields[] = {
|
|
||||||
MP_QSTR_sysname, MP_QSTR_nodename,
|
|
||||||
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
|
|
||||||
};
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
|
|
||||||
static MP_DEFINE_ATTRTUPLE(
|
|
||||||
os_uname_info_obj,
|
|
||||||
os_uname_info_fields,
|
|
||||||
5,
|
|
||||||
(mp_obj_t)&os_uname_info_sysname_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_nodename_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_release_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_version_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_machine_obj
|
|
||||||
);
|
|
||||||
|
|
||||||
mp_obj_t common_hal_os_uname(void) {
|
|
||||||
return (mp_obj_t)&os_uname_info_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,31 +17,6 @@
|
||||||
#include "sdk/drivers/trng/fsl_trng.h"
|
#include "sdk/drivers/trng/fsl_trng.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const qstr os_uname_info_fields[] = {
|
|
||||||
MP_QSTR_sysname, MP_QSTR_nodename,
|
|
||||||
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
|
|
||||||
};
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
static MP_DEFINE_ATTRTUPLE(
|
|
||||||
os_uname_info_obj,
|
|
||||||
os_uname_info_fields,
|
|
||||||
5,
|
|
||||||
(mp_obj_t)&os_uname_info_sysname_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_nodename_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_release_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_version_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_machine_obj
|
|
||||||
);
|
|
||||||
|
|
||||||
mp_obj_t common_hal_os_uname(void) {
|
|
||||||
return (mp_obj_t)&os_uname_info_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
||||||
#if CIRCUITPY_RANDOM
|
#if CIRCUITPY_RANDOM
|
||||||
trng_config_t trngConfig;
|
trng_config_t trngConfig;
|
||||||
|
|
|
||||||
|
|
@ -17,32 +17,6 @@
|
||||||
|
|
||||||
#include "nrf_rng.h"
|
#include "nrf_rng.h"
|
||||||
|
|
||||||
static const qstr os_uname_info_fields[] = {
|
|
||||||
MP_QSTR_sysname, MP_QSTR_nodename,
|
|
||||||
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
|
|
||||||
};
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
static MP_DEFINE_ATTRTUPLE(
|
|
||||||
os_uname_info_obj,
|
|
||||||
os_uname_info_fields,
|
|
||||||
5,
|
|
||||||
(mp_obj_t)&os_uname_info_sysname_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_nodename_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_release_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_version_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_machine_obj
|
|
||||||
);
|
|
||||||
|
|
||||||
mp_obj_t common_hal_os_uname(void) {
|
|
||||||
return (mp_obj_t)&os_uname_info_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
||||||
#ifdef BLUETOOTH_SD
|
#ifdef BLUETOOTH_SD
|
||||||
uint8_t sd_en = 0;
|
uint8_t sd_en = 0;
|
||||||
|
|
|
||||||
|
|
@ -18,32 +18,6 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
static const qstr os_uname_info_fields[] = {
|
|
||||||
MP_QSTR_sysname, MP_QSTR_nodename,
|
|
||||||
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
|
|
||||||
};
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
|
|
||||||
static MP_DEFINE_ATTRTUPLE(
|
|
||||||
os_uname_info_obj,
|
|
||||||
os_uname_info_fields,
|
|
||||||
5,
|
|
||||||
(mp_obj_t)&os_uname_info_sysname_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_nodename_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_release_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_version_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_machine_obj
|
|
||||||
);
|
|
||||||
|
|
||||||
mp_obj_t common_hal_os_uname(void) {
|
|
||||||
return (mp_obj_t)&os_uname_info_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NIST Special Publication 800-90B (draft) recommends several extractors,
|
// NIST Special Publication 800-90B (draft) recommends several extractors,
|
||||||
// including the SHA hash family and states that if the amount of entropy input
|
// including the SHA hash family and states that if the amount of entropy input
|
||||||
// is twice the number of bits output from them, that output can be considered
|
// is twice the number of bits output from them, that output can be considered
|
||||||
|
|
|
||||||
|
|
@ -12,32 +12,6 @@
|
||||||
|
|
||||||
#include "shared-bindings/os/__init__.h"
|
#include "shared-bindings/os/__init__.h"
|
||||||
|
|
||||||
static const qstr os_uname_info_fields[] = {
|
|
||||||
MP_QSTR_sysname, MP_QSTR_nodename,
|
|
||||||
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
|
|
||||||
};
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
|
|
||||||
static MP_DEFINE_ATTRTUPLE(
|
|
||||||
os_uname_info_obj,
|
|
||||||
os_uname_info_fields,
|
|
||||||
5,
|
|
||||||
(mp_obj_t)&os_uname_info_sysname_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_nodename_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_release_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_version_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_machine_obj
|
|
||||||
);
|
|
||||||
|
|
||||||
mp_obj_t common_hal_os_uname(void) {
|
|
||||||
return (mp_obj_t)&os_uname_info_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,31 +35,6 @@
|
||||||
#include "peripherals/periph.h"
|
#include "peripherals/periph.h"
|
||||||
#define RNG_TIMEOUT 5
|
#define RNG_TIMEOUT 5
|
||||||
|
|
||||||
static const qstr os_uname_info_fields[] = {
|
|
||||||
MP_QSTR_sysname, MP_QSTR_nodename,
|
|
||||||
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
|
|
||||||
};
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
static MP_DEFINE_ATTRTUPLE(
|
|
||||||
os_uname_info_obj,
|
|
||||||
os_uname_info_fields,
|
|
||||||
5,
|
|
||||||
(mp_obj_t)&os_uname_info_sysname_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_nodename_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_release_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_version_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_machine_obj);
|
|
||||||
|
|
||||||
mp_obj_t common_hal_os_uname(void) {
|
|
||||||
return (mp_obj_t)&os_uname_info_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
|
bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -15,32 +15,6 @@
|
||||||
#include STM32_HAL_H
|
#include STM32_HAL_H
|
||||||
#include "peripherals/periph.h"
|
#include "peripherals/periph.h"
|
||||||
|
|
||||||
static const qstr os_uname_info_fields[] = {
|
|
||||||
MP_QSTR_sysname, MP_QSTR_nodename,
|
|
||||||
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
|
|
||||||
};
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
static MP_DEFINE_ATTRTUPLE(
|
|
||||||
os_uname_info_obj,
|
|
||||||
os_uname_info_fields,
|
|
||||||
5,
|
|
||||||
(mp_obj_t)&os_uname_info_sysname_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_nodename_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_release_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_version_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_machine_obj
|
|
||||||
);
|
|
||||||
|
|
||||||
mp_obj_t common_hal_os_uname(void) {
|
|
||||||
return (mp_obj_t)&os_uname_info_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define RNG_TIMEOUT 5
|
#define RNG_TIMEOUT 5
|
||||||
|
|
||||||
bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
|
bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) {
|
||||||
|
|
|
||||||
|
|
@ -13,32 +13,6 @@
|
||||||
|
|
||||||
#include <zephyr/random/random.h>
|
#include <zephyr/random/random.h>
|
||||||
|
|
||||||
static const qstr os_uname_info_fields[] = {
|
|
||||||
MP_QSTR_sysname, MP_QSTR_nodename,
|
|
||||||
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
|
|
||||||
};
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
|
|
||||||
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
|
|
||||||
|
|
||||||
static MP_DEFINE_ATTRTUPLE(
|
|
||||||
os_uname_info_obj,
|
|
||||||
os_uname_info_fields,
|
|
||||||
5,
|
|
||||||
(mp_obj_t)&os_uname_info_sysname_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_nodename_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_release_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_version_obj,
|
|
||||||
(mp_obj_t)&os_uname_info_machine_obj
|
|
||||||
);
|
|
||||||
|
|
||||||
mp_obj_t common_hal_os_uname(void) {
|
|
||||||
return (mp_obj_t)&os_uname_info_obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) {
|
||||||
#if !DT_HAS_CHOSEN(zephyr_entropy)
|
#if !DT_HAS_CHOSEN(zephyr_entropy)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -44,8 +44,30 @@
|
||||||
//| machine: str
|
//| machine: str
|
||||||
//|
|
//|
|
||||||
//|
|
//|
|
||||||
|
static const qstr os_uname_info_fields[] = {
|
||||||
|
MP_QSTR_sysname, MP_QSTR_nodename,
|
||||||
|
MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine
|
||||||
|
};
|
||||||
|
static const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_HW_MCU_NAME);
|
||||||
|
static const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_HW_MCU_NAME);
|
||||||
|
static const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING);
|
||||||
|
static const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE);
|
||||||
|
static const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME);
|
||||||
|
|
||||||
|
|
||||||
|
static MP_DEFINE_ATTRTUPLE(
|
||||||
|
os_uname_info_obj,
|
||||||
|
os_uname_info_fields,
|
||||||
|
5,
|
||||||
|
(mp_obj_t)&os_uname_info_sysname_obj,
|
||||||
|
(mp_obj_t)&os_uname_info_nodename_obj,
|
||||||
|
(mp_obj_t)&os_uname_info_release_obj,
|
||||||
|
(mp_obj_t)&os_uname_info_version_obj,
|
||||||
|
(mp_obj_t)&os_uname_info_machine_obj
|
||||||
|
);
|
||||||
|
|
||||||
static mp_obj_t os_uname(void) {
|
static mp_obj_t os_uname(void) {
|
||||||
return common_hal_os_uname();
|
return (mp_obj_t)&os_uname_info_obj;
|
||||||
}
|
}
|
||||||
static MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname);
|
static MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,6 @@
|
||||||
|
|
||||||
#include "py/objtuple.h"
|
#include "py/objtuple.h"
|
||||||
|
|
||||||
extern const mp_rom_obj_tuple_t common_hal_os_uname_info_obj;
|
|
||||||
|
|
||||||
mp_obj_t common_hal_os_uname(void);
|
|
||||||
void common_hal_os_chdir(const char *path);
|
void common_hal_os_chdir(const char *path);
|
||||||
mp_obj_t common_hal_os_getcwd(void);
|
mp_obj_t common_hal_os_getcwd(void);
|
||||||
mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_);
|
mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_);
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
#include "shared-bindings/os/__init__.h"
|
#include "shared-bindings/os/__init__.h"
|
||||||
|
|
||||||
// This provides all VFS related OS functions so that ports can share the code
|
// This provides all VFS related OS functions so that ports can share the code
|
||||||
// as needed. It does not provide uname.
|
// as needed.
|
||||||
|
|
||||||
// Version of mp_vfs_lookup_path that takes and returns uPy string objects.
|
// Version of mp_vfs_lookup_path that takes and returns uPy string objects.
|
||||||
static mp_vfs_mount_t *lookup_path(const char *path, mp_obj_t *path_out) {
|
static mp_vfs_mount_t *lookup_path(const char *path, mp_obj_t *path_out) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue