Merge pull request #4 from adafruit/main

from main
This commit is contained in:
jposada202020 2021-04-27 17:02:09 -04:00 committed by GitHub
commit b4e05dac69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
378 changed files with 8675 additions and 4990 deletions

View File

@ -498,7 +498,7 @@ jobs:
id: idf-cache
with:
path: ${{ github.workspace }}/.idf_tools
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210415
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210422
- name: Clone IDF submodules
run: |
(cd $IDF_PATH && git submodule update --init)

2
.gitmodules vendored
View File

@ -113,7 +113,7 @@
url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git
[submodule "extmod/ulab"]
path = extmod/ulab
url = https://github.com/v923z/micropython-ulab
url = https://github.com/adafruit/circuitpython-ulab
[submodule "frozen/Adafruit_CircuitPython_ESP32SPI"]
path = frozen/Adafruit_CircuitPython_ESP32SPI
url = https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2013, 2014 Damien P. George
Copyright (c) 2013-2019 Damien P. George
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -886,10 +886,10 @@ uint16_t bleio_adapter_add_attribute(bleio_adapter_obj_t *adapter, mp_obj_t *att
uint16_t handle = (uint16_t)adapter->attributes->len;
mp_obj_list_append(adapter->attributes, attribute);
if (MP_OBJ_IS_TYPE(attribute, &bleio_service_type)) {
if (mp_obj_is_type(attribute, &bleio_service_type)) {
adapter->last_added_service_handle = handle;
}
if (MP_OBJ_IS_TYPE(attribute, &bleio_characteristic_type)) {
if (mp_obj_is_type(attribute, &bleio_characteristic_type)) {
adapter->last_added_characteristic_handle = handle;
}

View File

@ -33,15 +33,15 @@
bleio_uuid_obj_t *bleio_attribute_get_uuid(mp_obj_t *attribute) {
if (MP_OBJ_IS_TYPE(attribute, &bleio_characteristic_type)) {
if (mp_obj_is_type(attribute, &bleio_characteristic_type)) {
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute);
return characteristic->uuid;
}
if (MP_OBJ_IS_TYPE(attribute, &bleio_descriptor_type)) {
if (mp_obj_is_type(attribute, &bleio_descriptor_type)) {
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute);
return descriptor->uuid;
}
if (MP_OBJ_IS_TYPE(attribute, &bleio_service_type)) {
if (mp_obj_is_type(attribute, &bleio_service_type)) {
bleio_service_obj_t *service = MP_OBJ_TO_PTR(attribute);
return service->uuid;
}

View File

@ -213,9 +213,9 @@ bool bleio_characteristic_set_local_value(bleio_characteristic_obj_t *self, mp_b
self->value = mp_obj_new_bytes(bufinfo->buf, bufinfo->len);
if (MP_OBJ_IS_TYPE(self->observer, &bleio_characteristic_buffer_type)) {
if (mp_obj_is_type(self->observer, &bleio_characteristic_buffer_type)) {
bleio_characteristic_buffer_update(MP_OBJ_FROM_PTR(self->observer), bufinfo);
} else if (MP_OBJ_IS_TYPE(self->observer, &bleio_packet_buffer_type)) {
} else if (mp_obj_is_type(self->observer, &bleio_packet_buffer_type)) {
bleio_packet_buffer_update(MP_OBJ_FROM_PTR(self->observer), bufinfo);
} else {
return false;

View File

@ -644,7 +644,7 @@ void common_hal_bleio_connection_set_connection_interval(bleio_connection_intern
// mp_obj_t iterable = mp_getiter(service_uuids_whitelist, &iter_buf);
// mp_obj_t uuid_obj;
// while ((uuid_obj = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) {
// if (!MP_OBJ_IS_TYPE(uuid_obj, &bleio_uuid_type)) {
// if (!mp_obj_is_type(uuid_obj, &bleio_uuid_type)) {
// mp_raise_TypeError(translate("non-UUID found in service_uuids_whitelist"));
// }
// bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj);

View File

@ -539,7 +539,7 @@ void att_remove_connection(uint16_t conn_handle, uint8_t reason) {
.len = sizeof(zero),
};
if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_descriptor_type)) {
if (mp_obj_is_type(attribute_obj, &bleio_descriptor_type)) {
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute_obj);
if (bleio_uuid_get_uuid16_or_unknown(descriptor->uuid) == BLE_UUID_CCCD) {
common_hal_bleio_descriptor_set_value(descriptor, &zero_cccd_value);
@ -800,7 +800,7 @@ STATIC void process_find_info_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
// Fetch the uuid for the given attribute, which might be a characteristic or a descriptor.
bleio_uuid_obj_t *uuid;
if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
if (mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);
if (characteristic->handle != handle) {
// If the handles don't match, this is the characteristic definition attribute.
@ -971,7 +971,7 @@ void process_read_group_req(uint16_t conn_handle, uint16_t mtu, uint8_t dlen, ui
}
mp_obj_t *attribute_obj = bleio_adapter_get_attribute(&common_hal_bleio_adapter_obj, handle);
if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_service_type)) {
if (mp_obj_is_type(attribute_obj, &bleio_service_type)) {
bleio_service_obj_t *service = MP_OBJ_TO_PTR(attribute_obj);
// Is this a 16-bit or a 128-bit uuid? It must match in size with any previous attribute
@ -1083,7 +1083,7 @@ STATIC void process_read_or_read_blob_req(uint16_t conn_handle, uint16_t mtu, ui
size_t rsp_length = sizeof(rsp_t);
mp_obj_t *attribute_obj = bleio_adapter_get_attribute(&common_hal_bleio_adapter_obj, handle);
if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_service_type)) {
if (mp_obj_is_type(attribute_obj, &bleio_service_type)) {
if (offset) {
send_error(conn_handle, BT_ATT_ERR_ATTRIBUTE_NOT_LONG, handle, BT_ATT_ERR_INVALID_PDU);
return;
@ -1095,7 +1095,7 @@ STATIC void process_read_or_read_blob_req(uint16_t conn_handle, uint16_t mtu, ui
common_hal_bleio_uuid_pack_into(service->uuid, rsp->r.value);
rsp_length += sizeof_service_uuid;
} else if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
} else if (mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);
if (characteristic->decl_handle == handle) {
// Read characteristic declaration. Return properties, value handle, and uuid.
@ -1135,7 +1135,7 @@ STATIC void process_read_or_read_blob_req(uint16_t conn_handle, uint16_t mtu, ui
memcpy(rsp->r.value, bufinfo.buf + offset, value_length);
rsp_length += value_length;
}
} else if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_descriptor_type)) {
} else if (mp_obj_is_type(attribute_obj, &bleio_descriptor_type)) {
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute_obj);
mp_buffer_info_t bufinfo;
@ -1203,7 +1203,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
mp_obj_t *attribute_obj = bleio_adapter_get_attribute(&common_hal_bleio_adapter_obj, handle);
if (type_uuid == BLE_UUID_CHARACTERISTIC &&
MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
// Request is for characteristic declarations.
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);
@ -1250,7 +1250,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
rsp_length += data_length;
no_data = false;
} else if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_descriptor_type)) {
} else if (mp_obj_is_type(attribute_obj, &bleio_descriptor_type)) {
// See if request is for a descriptor value with a 16-bit UUID, such as the CCCD.
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute_obj);
if (bleio_uuid_get_uuid16_or_unknown(descriptor->uuid) == type_uuid) {
@ -1271,7 +1271,7 @@ STATIC void process_read_type_req(uint16_t conn_handle, uint16_t mtu, uint8_t dl
break;
}
} else if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
} else if (mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
// See if request is for a characteristic value with a 16-bit UUID.
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);
if (bleio_uuid_get_uuid16_or_unknown(characteristic->uuid) == type_uuid) {
@ -1359,7 +1359,7 @@ STATIC void process_write_req_or_cmd(uint16_t conn_handle, uint16_t mtu, uint8_t
mp_obj_t attribute_obj = bleio_adapter_get_attribute(&common_hal_bleio_adapter_obj, req->handle);
if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_characteristic_type)) {
if (mp_obj_is_type(attribute_obj, &bleio_characteristic_type)) {
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute_obj);
// Don't write the characteristic declaration.
@ -1377,7 +1377,7 @@ STATIC void process_write_req_or_cmd(uint16_t conn_handle, uint16_t mtu, uint8_t
// Just change the local value. Don't fire off notifications, etc.
bleio_characteristic_set_local_value(characteristic, &bufinfo);
} else if (MP_OBJ_IS_TYPE(attribute_obj, &bleio_descriptor_type)) {
} else if (mp_obj_is_type(attribute_obj, &bleio_descriptor_type)) {
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute_obj);
// Only CCCD's are writable.
if (bleio_uuid_get_uuid16_or_unknown(descriptor->uuid) != BLE_UUID_CCCD) {
@ -1427,7 +1427,7 @@ STATIC void process_prepare_write_req(uint16_t conn_handle, uint16_t mtu, uint8_
mp_obj_t *attribute = bleio_adapter_get_attribute(&common_hal_bleio_adapter_obj, handle);
if (!MP_OBJ_IS_TYPE(attribute, &bleio_characteristic_type)) {
if (!mp_obj_is_type(attribute, &bleio_characteristic_type)) {
send_error(conn_handle, BT_ATT_OP_PREPARE_WRITE_REQ, handle, BT_ATT_ERR_ATTRIBUTE_NOT_LONG);
return;
}

View File

@ -174,7 +174,7 @@ Match objects
Match objects as returned by `match()` and `search()` methods, and passed
to the replacement function in `sub()`.
.. method:: match.group([index])
.. method:: match.group(index)
Return matching (sub)string. *index* is 0 for entire match,
1 and above for each capturing group. Only numeric groups are supported.

View File

@ -15,6 +15,7 @@
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_uos_dupterm_obj);
#if MICROPY_PY_OS_DUPTERM
bool mp_uos_dupterm_is_builtin_stream(mp_const_obj_t stream);
int mp_uos_dupterm_rx_chr(void);
void mp_uos_dupterm_tx_strn(const char *str, size_t len);
void mp_uos_deactivate(size_t dupterm_idx, const char *msg, mp_obj_t exc);

View File

@ -13,7 +13,7 @@
static void check_not_unicode(const mp_obj_t arg) {
#if MICROPY_CPYTHON_COMPAT
if (MP_OBJ_IS_STR(arg)) {
if (mp_obj_is_str(arg)) {
mp_raise_TypeError(translate("a bytes-like object is required"));
}
#endif

View File

@ -118,13 +118,13 @@ STATIC void uctypes_struct_print(const mp_print_t *print, mp_obj_t self_in, mp_p
(void)kind;
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
const char *typen = "unk";
if (MP_OBJ_IS_TYPE(self->desc, &mp_type_dict)
if (mp_obj_is_type(self->desc, &mp_type_dict)
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
|| MP_OBJ_IS_TYPE(self->desc, &mp_type_ordereddict)
|| mp_obj_is_type(self->desc, &mp_type_ordereddict)
#endif
) {
typen = "STRUCT";
} else if (MP_OBJ_IS_TYPE(self->desc, &mp_type_tuple)) {
} else if (mp_obj_is_type(self->desc, &mp_type_tuple)) {
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(self->desc);
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(t->items[0]);
uint agg_type = GET_TYPE(offset, AGG_TYPE_BITS);
@ -195,14 +195,14 @@ STATIC mp_uint_t uctypes_struct_agg_size(mp_obj_tuple_t *t, int layout_type, mp_
}
STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_t *max_field_size) {
if (!MP_OBJ_IS_TYPE(desc_in, &mp_type_dict)
if (!mp_obj_is_type(desc_in, &mp_type_dict)
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
&& !MP_OBJ_IS_TYPE(desc_in, &mp_type_ordereddict)
&& !mp_obj_is_type(desc_in, &mp_type_ordereddict)
#endif
) {
if (MP_OBJ_IS_TYPE(desc_in, &mp_type_tuple)) {
if (mp_obj_is_type(desc_in, &mp_type_tuple)) {
return uctypes_struct_agg_size((mp_obj_tuple_t *)MP_OBJ_TO_PTR(desc_in), layout_type, max_field_size);
} else if (MP_OBJ_IS_SMALL_INT(desc_in)) {
} else if (mp_obj_is_small_int(desc_in)) {
// We allow sizeof on both type definitions and structures/structure fields,
// but scalar structure field is lowered into native Python int, so all
// type info is lost. So, we cannot say if it's scalar type description,
@ -216,9 +216,9 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
mp_uint_t total_size = 0;
for (mp_uint_t i = 0; i < d->map.alloc; i++) {
if (MP_MAP_SLOT_IS_FILLED(&d->map, i)) {
if (mp_map_slot_is_filled(&d->map, i)) {
mp_obj_t v = d->map.table[i].value;
if (MP_OBJ_IS_SMALL_INT(v)) {
if (mp_obj_is_small_int(v)) {
mp_uint_t offset = MP_OBJ_SMALL_INT_VALUE(v);
mp_uint_t val_type = GET_TYPE(offset, VAL_TYPE_BITS);
offset &= VALUE_MASK(VAL_TYPE_BITS);
@ -233,7 +233,7 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
total_size = offset + s;
}
} else {
if (!MP_OBJ_IS_TYPE(v, &mp_type_tuple)) {
if (!mp_obj_is_type(v, &mp_type_tuple)) {
syntax_error();
}
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(v);
@ -257,13 +257,13 @@ STATIC mp_uint_t uctypes_struct_size(mp_obj_t desc_in, int layout_type, mp_uint_
STATIC mp_obj_t uctypes_struct_sizeof(size_t n_args, const mp_obj_t *args) {
mp_obj_t obj_in = args[0];
mp_uint_t max_field_size = 0;
if (MP_OBJ_IS_TYPE(obj_in, &mp_type_bytearray)) {
if (mp_obj_is_type(obj_in, &mp_type_bytearray)) {
return mp_obj_len(obj_in);
}
int layout_type = LAYOUT_NATIVE;
// We can apply sizeof either to structure definition (a dict)
// or to instantiated structure
if (MP_OBJ_IS_TYPE(obj_in, &uctypes_struct_type)) {
if (mp_obj_is_type(obj_in, &uctypes_struct_type)) {
if (n_args != 1) {
mp_raise_TypeError(NULL);
}
@ -400,16 +400,16 @@ STATIC void set_aligned(uint val_type, void *p, mp_int_t index, mp_obj_t val) {
STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set_val) {
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
if (!MP_OBJ_IS_TYPE(self->desc, &mp_type_dict)
if (!mp_obj_is_type(self->desc, &mp_type_dict)
#if MICROPY_PY_COLLECTIONS_ORDEREDDICT
&& !MP_OBJ_IS_TYPE(self->desc, &mp_type_ordereddict)
&& !mp_obj_is_type(self->desc, &mp_type_ordereddict)
#endif
) {
mp_raise_TypeError(translate("struct: no fields"));
}
mp_obj_t deref = mp_obj_dict_get(self->desc, MP_OBJ_NEW_QSTR(attr));
if (MP_OBJ_IS_SMALL_INT(deref)) {
if (mp_obj_is_small_int(deref)) {
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(deref);
mp_uint_t val_type = GET_TYPE(offset, VAL_TYPE_BITS);
offset &= VALUE_MASK(VAL_TYPE_BITS);
@ -470,7 +470,7 @@ STATIC mp_obj_t uctypes_struct_attr_op(mp_obj_t self_in, qstr attr, mp_obj_t set
return MP_OBJ_NULL;
}
if (!MP_OBJ_IS_TYPE(deref, &mp_type_tuple)) {
if (!mp_obj_is_type(deref, &mp_type_tuple)) {
syntax_error();
}
@ -537,7 +537,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_ob
return MP_OBJ_NULL; // op not supported
} else {
// load / store
if (!MP_OBJ_IS_TYPE(self->desc, &mp_type_tuple)) {
if (!mp_obj_is_type(self->desc, &mp_type_tuple)) {
mp_raise_TypeError(translate("struct: cannot index"));
}
@ -588,7 +588,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_ob
} else if (agg_type == PTR) {
byte *p = *(void **)self->addr;
if (MP_OBJ_IS_SMALL_INT(t->items[1])) {
if (mp_obj_is_small_int(t->items[1])) {
uint val_type = GET_TYPE(MP_OBJ_SMALL_INT_VALUE(t->items[1]), VAL_TYPE_BITS);
return get_aligned(val_type, p, index);
} else {
@ -612,7 +612,7 @@ STATIC mp_obj_t uctypes_struct_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_obj_uctypes_struct_t *self = MP_OBJ_TO_PTR(self_in);
switch (op) {
case MP_UNARY_OP_INT:
if (MP_OBJ_IS_TYPE(self->desc, &mp_type_tuple)) {
if (mp_obj_is_type(self->desc, &mp_type_tuple)) {
mp_obj_tuple_t *t = MP_OBJ_TO_PTR(self->desc);
mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(t->items[0]);
uint agg_type = GET_TYPE(offset, AGG_TYPE_BITS);

View File

@ -88,12 +88,16 @@ STATIC mp_obj_t uhashlib_sha256_digest(mp_obj_t self_in) {
static void check_not_unicode(const mp_obj_t arg) {
#if MICROPY_CPYTHON_COMPAT
if (MP_OBJ_IS_STR(arg)) {
if (mp_obj_is_str(arg)) {
mp_raise_TypeError(translate("a bytes-like object is required"));
}
#endif
}
#if MICROPY_PY_UHASHLIB_SHA256
#include "crypto-algorithms/sha256.c"
#endif
STATIC mp_obj_t uhashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
mp_arg_check_num(n_args, kw_args, 0, 1, false);
mp_obj_hash_t *o = m_new_obj_var(mp_obj_hash_t, char, sizeof(CRYAL_SHA256_CTX));
@ -336,8 +340,4 @@ const mp_obj_module_t mp_module_uhashlib = {
.globals = (mp_obj_dict_t *)&mp_module_uhashlib_globals,
};
#if MICROPY_PY_UHASHLIB_SHA256
#include "crypto-algorithms/sha256.c"
#endif
#endif // MICROPY_PY_UHASHLIB

View File

@ -13,7 +13,7 @@
// the algorithm here is modelled on CPython's heapq.py
STATIC mp_obj_list_t *get_heap(mp_obj_t heap_in) {
if (!MP_OBJ_IS_TYPE(heap_in, &mp_type_list)) {
if (!mp_obj_is_type(heap_in, &mp_type_list)) {
mp_raise_TypeError(translate("heap must be a list"));
}
return MP_OBJ_TO_PTR(heap_in);

View File

@ -243,7 +243,7 @@ STATIC mp_obj_t _mod_ujson_load(mp_obj_t stream_obj, bool return_first_json) {
cur = S_CUR(s);
if (cur == '.' || cur == 'E' || cur == 'e') {
flt = true;
} else if (cur == '-' || unichar_isdigit(cur)) {
} else if (cur == '+' || cur == '-' || unichar_isdigit(cur)) {
// pass
} else {
break;

View File

@ -180,8 +180,19 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_urandom_uniform_obj, mod_urandom_uniform);
#endif // MICROPY_PY_URANDOM_EXTRA_FUNCS
#ifdef MICROPY_PY_URANDOM_SEED_INIT_FUNC
STATIC mp_obj_t mod_urandom___init__() {
mod_urandom_seed(MP_OBJ_NEW_SMALL_INT(MICROPY_PY_URANDOM_SEED_INIT_FUNC));
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mod_urandom___init___obj, mod_urandom___init__);
#endif
STATIC const mp_rom_map_elem_t mp_module_urandom_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_urandom) },
#ifdef MICROPY_PY_URANDOM_SEED_INIT_FUNC
{ MP_ROM_QSTR(MP_QSTR___init__), MP_ROM_PTR(&mod_urandom___init___obj) },
#endif
{ MP_ROM_QSTR(MP_QSTR_getrandbits), MP_ROM_PTR(&mod_urandom_getrandbits_obj) },
{ MP_ROM_QSTR(MP_QSTR_seed), MP_ROM_PTR(&mod_urandom_seed_obj) },
#if MICROPY_PY_URANDOM_EXTRA_FUNCS

View File

@ -1,5 +1,6 @@
// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)
// SPDX-FileCopyrightText: Copyright (c) 2014 Damien P. George
// SPDX-FileCopyrightText: Copyright (c) 2015-2017 Paul Sokolovsky
//
// SPDX-License-Identifier: MIT
@ -57,7 +58,7 @@ STATIC void poll_map_add(mp_map_t *poll_map, const mp_obj_t *obj, mp_uint_t obj_
STATIC mp_uint_t poll_map_poll(mp_map_t *poll_map, size_t *rwx_num) {
mp_uint_t n_ready = 0;
for (mp_uint_t i = 0; i < poll_map->alloc; ++i) {
if (!MP_MAP_SLOT_IS_FILLED(poll_map, i)) {
if (!mp_map_slot_is_filled(poll_map, i)) {
continue;
}
@ -91,7 +92,7 @@ STATIC mp_uint_t poll_map_poll(mp_map_t *poll_map, size_t *rwx_num) {
}
/// \function select(rlist, wlist, xlist[, timeout])
STATIC mp_obj_t select_select(uint n_args, const mp_obj_t *args) {
STATIC mp_obj_t select_select(size_t n_args, const mp_obj_t *args) {
// get array data from tuple/list arguments
size_t rwx_len[3];
mp_obj_t *r_array, *w_array, *x_array;
@ -135,7 +136,7 @@ STATIC mp_obj_t select_select(uint n_args, const mp_obj_t *args) {
list_array[2] = mp_obj_new_list(rwx_len[2], NULL);
rwx_len[0] = rwx_len[1] = rwx_len[2] = 0;
for (mp_uint_t i = 0; i < poll_map.alloc; ++i) {
if (!MP_MAP_SLOT_IS_FILLED(&poll_map, i)) {
if (!mp_map_slot_is_filled(&poll_map, i)) {
continue;
}
poll_obj_t *poll_obj = MP_OBJ_TO_PTR(poll_map.table[i].value);
@ -170,7 +171,7 @@ typedef struct _mp_obj_poll_t {
} mp_obj_poll_t;
/// \method register(obj[, eventmask])
STATIC mp_obj_t poll_register(uint n_args, const mp_obj_t *args) {
STATIC mp_obj_t poll_register(size_t n_args, const mp_obj_t *args) {
mp_obj_poll_t *self = MP_OBJ_TO_PTR(args[0]);
mp_uint_t flags;
if (n_args == 3) {
@ -246,7 +247,7 @@ STATIC mp_obj_t poll_poll(size_t n_args, const mp_obj_t *args) {
mp_obj_list_t *ret_list = MP_OBJ_TO_PTR(mp_obj_new_list(n_ready, NULL));
n_ready = 0;
for (mp_uint_t i = 0; i < self->poll_map.alloc; ++i) {
if (!MP_MAP_SLOT_IS_FILLED(&self->poll_map, i)) {
if (!mp_map_slot_is_filled(&self->poll_map, i)) {
continue;
}
poll_obj_t *poll_obj = MP_OBJ_TO_PTR(self->poll_map.table[i].value);
@ -289,7 +290,7 @@ STATIC mp_obj_t poll_iternext(mp_obj_t self_in) {
for (mp_uint_t i = self->iter_idx; i < self->poll_map.alloc; ++i) {
self->iter_idx++;
if (!MP_MAP_SLOT_IS_FILLED(&self->poll_map, i)) {
if (!mp_map_slot_is_filled(&self->poll_map, i)) {
continue;
}
poll_obj_t *poll_obj = MP_OBJ_TO_PTR(self->poll_map.table[i].value);

View File

@ -1,244 +0,0 @@
// Copyright (c) 2015-2017 Paul Sokolovsky
// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)
//
// SPDX-License-Identifier: MIT
#include <stdio.h>
#include <string.h>
#include "py/runtime.h"
#include "py/stream.h"
#include "supervisor/shared/translate.h"
#if MICROPY_PY_USSL && MICROPY_SSL_AXTLS
#include "ssl.h"
typedef struct _mp_obj_ssl_socket_t {
mp_obj_base_t base;
mp_obj_t sock;
SSL_CTX *ssl_ctx;
SSL *ssl_sock;
byte *buf;
uint32_t bytes_left;
} mp_obj_ssl_socket_t;
struct ssl_args {
mp_arg_val_t key;
mp_arg_val_t cert;
mp_arg_val_t server_side;
mp_arg_val_t server_hostname;
};
STATIC const mp_obj_type_t ussl_socket_type;
STATIC mp_obj_ssl_socket_t *socket_new(mp_obj_t sock, struct ssl_args *args) {
#if MICROPY_PY_USSL_FINALISER
mp_obj_ssl_socket_t *o = m_new_obj_with_finaliser(mp_obj_ssl_socket_t);
#else
mp_obj_ssl_socket_t *o = m_new_obj(mp_obj_ssl_socket_t);
#endif
o->base.type = &ussl_socket_type;
o->buf = NULL;
o->bytes_left = 0;
o->sock = sock;
uint32_t options = SSL_SERVER_VERIFY_LATER;
if (args->key.u_obj != mp_const_none) {
options |= SSL_NO_DEFAULT_KEY;
}
if ((o->ssl_ctx = ssl_ctx_new(options, SSL_DEFAULT_CLNT_SESS)) == NULL) {
mp_raise_OSError(MP_EINVAL);
}
if (args->key.u_obj != mp_const_none) {
size_t len;
const byte *data = (const byte *)mp_obj_str_get_data(args->key.u_obj, &len);
int res = ssl_obj_memory_load(o->ssl_ctx, SSL_OBJ_RSA_KEY, data, len, NULL);
if (res != SSL_OK) {
mp_raise_ValueError(translate("invalid key"));
}
data = (const byte *)mp_obj_str_get_data(args->cert.u_obj, &len);
res = ssl_obj_memory_load(o->ssl_ctx, SSL_OBJ_X509_CERT, data, len, NULL);
if (res != SSL_OK) {
mp_raise_ValueError(translate("invalid cert"));
}
}
if (args->server_side.u_bool) {
o->ssl_sock = ssl_server_new(o->ssl_ctx, (long)sock);
} else {
SSL_EXTENSIONS *ext = ssl_ext_new();
if (args->server_hostname.u_obj != mp_const_none) {
ext->host_name = (char *)mp_obj_str_get_str(args->server_hostname.u_obj);
}
o->ssl_sock = ssl_client_new(o->ssl_ctx, (long)sock, NULL, 0, ext);
int res = ssl_handshake_status(o->ssl_sock);
// Pointer to SSL_EXTENSIONS as being passed to ssl_client_new()
// is saved in ssl_sock->extensions.
// As of axTLS 2.1.3, extensions aren't used beyond the initial
// handshake, and that's pretty much how it's expected to be. So
// we allocate them on stack and reset the pointer after handshake.
if (res != SSL_OK) {
printf("ssl_handshake_status: %d\n", res);
ssl_display_error(res);
mp_raise_OSError(MP_EIO);
}
}
return o;
}
STATIC void socket_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_ssl_socket_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<_SSLSocket %p>", self->ssl_sock);
}
STATIC mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in);
if (o->ssl_sock == NULL) {
*errcode = EBADF;
return MP_STREAM_ERROR;
}
while (o->bytes_left == 0) {
mp_int_t r = ssl_read(o->ssl_sock, &o->buf);
if (r == SSL_OK) {
// SSL_OK from ssl_read() means "everything is ok, but there's
// no user data yet". So, we just keep reading.
continue;
}
if (r < 0) {
if (r == SSL_CLOSE_NOTIFY || r == SSL_ERROR_CONN_LOST) {
// EOF
return 0;
}
if (r == SSL_EAGAIN) {
r = MP_EAGAIN;
}
*errcode = r;
return MP_STREAM_ERROR;
}
o->bytes_left = r;
}
if (size > o->bytes_left) {
size = o->bytes_left;
}
memcpy(buf, o->buf, size);
o->buf += size;
o->bytes_left -= size;
return size;
}
STATIC mp_uint_t socket_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in);
if (o->ssl_sock == NULL) {
*errcode = EBADF;
return MP_STREAM_ERROR;
}
mp_int_t r = ssl_write(o->ssl_sock, buf, size);
if (r < 0) {
*errcode = r;
return MP_STREAM_ERROR;
}
return r;
}
STATIC mp_uint_t socket_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
mp_obj_ssl_socket_t *self = MP_OBJ_TO_PTR(o_in);
if (request == MP_STREAM_CLOSE && self->ssl_sock != NULL) {
ssl_free(self->ssl_sock);
ssl_ctx_free(self->ssl_ctx);
self->ssl_sock = NULL;
}
// Pass all requests down to the underlying socket
return mp_get_stream(self->sock)->ioctl(self->sock, request, arg, errcode);
}
STATIC mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
// Currently supports only blocking mode
(void)self_in;
if (!mp_obj_is_true(flag_in)) {
mp_raise_NotImplementedError(NULL);
}
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
STATIC const mp_rom_map_elem_t ussl_socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
{ MP_ROM_QSTR(MP_QSTR_setblocking), MP_ROM_PTR(&socket_setblocking_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_stream_close_obj) },
#if MICROPY_PY_USSL_FINALISER
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mp_stream_close_obj) },
#endif
};
STATIC MP_DEFINE_CONST_DICT(ussl_socket_locals_dict, ussl_socket_locals_dict_table);
STATIC const mp_stream_p_t ussl_socket_stream_p = {
MP_PROTO_IMPLEMENT(MP_QSTR_protocol_stream)
.read = socket_read,
.write = socket_write,
.ioctl = socket_ioctl,
};
STATIC const mp_obj_type_t ussl_socket_type = {
{ &mp_type_type },
// Save on qstr's, reuse same as for module
.name = MP_QSTR_ussl,
.print = socket_print,
.getiter = NULL,
.iternext = NULL,
.protocol = &ussl_socket_stream_p,
.locals_dict = (void *)&ussl_socket_locals_dict,
};
STATIC mp_obj_t mod_ssl_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// TODO: Implement more args
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_key, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
{ MP_QSTR_cert, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
{ MP_QSTR_server_side, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
{ MP_QSTR_server_hostname, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
};
// TODO: Check that sock implements stream protocol
mp_obj_t sock = pos_args[0];
struct ssl_args args;
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args,
MP_ARRAY_SIZE(allowed_args), allowed_args, (mp_arg_val_t *)&args);
return MP_OBJ_FROM_PTR(socket_new(sock, &args));
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mod_ssl_wrap_socket_obj, 1, mod_ssl_wrap_socket);
STATIC const mp_rom_map_elem_t mp_module_ssl_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ussl) },
{ MP_ROM_QSTR(MP_QSTR_wrap_socket), MP_ROM_PTR(&mod_ssl_wrap_socket_obj) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_ssl_globals, mp_module_ssl_globals_table);
const mp_obj_module_t mp_module_ussl = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t *)&mp_module_ssl_globals,
};
#endif // MICROPY_PY_USSL

View File

@ -1,330 +0,0 @@
// Copyright (c) 2016 Linaro Ltd.
// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)
//
// SPDX-License-Identifier: MIT
#include "py/mpconfig.h"
#if MICROPY_PY_USSL && MICROPY_SSL_MBEDTLS
#include <stdio.h>
#include <string.h>
#include <errno.h> // needed because mp_is_nonblocking_error uses system error codes
#include "py/runtime.h"
#include "py/stream.h"
// mbedtls_time_t
#include "mbedtls/platform.h"
#include "mbedtls/net.h"
#include "mbedtls/ssl.h"
#include "mbedtls/x509_crt.h"
#include "mbedtls/pk.h"
#include "mbedtls/entropy.h"
#include "mbedtls/ctr_drbg.h"
#include "mbedtls/debug.h"
typedef struct _mp_obj_ssl_socket_t {
mp_obj_base_t base;
mp_obj_t sock;
mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg;
mbedtls_ssl_context ssl;
mbedtls_ssl_config conf;
mbedtls_x509_crt cacert;
mbedtls_x509_crt cert;
mbedtls_pk_context pkey;
} mp_obj_ssl_socket_t;
struct ssl_args {
mp_arg_val_t key;
mp_arg_val_t cert;
mp_arg_val_t server_side;
mp_arg_val_t server_hostname;
};
STATIC const mp_obj_type_t ussl_socket_type;
#ifdef MBEDTLS_DEBUG_C
STATIC void mbedtls_debug(void *ctx, int level, const char *file, int line, const char *str) {
(void)ctx;
(void)level;
printf("DBG:%s:%04d: %s\n", file, line, str);
}
#endif
STATIC int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) {
mp_obj_t sock = *(mp_obj_t *)ctx;
const mp_stream_p_t *sock_stream = mp_get_stream(sock);
int err;
mp_uint_t out_sz = sock_stream->write(sock, buf, len, &err);
if (out_sz == MP_STREAM_ERROR) {
if (mp_is_nonblocking_error(err)) {
return MBEDTLS_ERR_SSL_WANT_WRITE;
}
return -err;
} else {
return out_sz;
}
}
STATIC int _mbedtls_ssl_recv(void *ctx, byte *buf, size_t len) {
mp_obj_t sock = *(mp_obj_t *)ctx;
const mp_stream_p_t *sock_stream = mp_get_stream(sock);
int err;
mp_uint_t out_sz = sock_stream->read(sock, buf, len, &err);
if (out_sz == MP_STREAM_ERROR) {
if (mp_is_nonblocking_error(err)) {
return MBEDTLS_ERR_SSL_WANT_READ;
}
return -err;
} else {
return out_sz;
}
}
STATIC mp_obj_ssl_socket_t *socket_new(mp_obj_t sock, struct ssl_args *args) {
// Verify the socket object has the full stream protocol
mp_get_stream_raise(sock, MP_STREAM_OP_READ | MP_STREAM_OP_WRITE | MP_STREAM_OP_IOCTL);
#if MICROPY_PY_USSL_FINALISER
mp_obj_ssl_socket_t *o = m_new_obj_with_finaliser(mp_obj_ssl_socket_t);
#else
mp_obj_ssl_socket_t *o = m_new_obj(mp_obj_ssl_socket_t);
#endif
o->base.type = &ussl_socket_type;
o->sock = sock;
int ret;
mbedtls_ssl_init(&o->ssl);
mbedtls_ssl_config_init(&o->conf);
mbedtls_x509_crt_init(&o->cacert);
mbedtls_x509_crt_init(&o->cert);
mbedtls_pk_init(&o->pkey);
mbedtls_ctr_drbg_init(&o->ctr_drbg);
#ifdef MBEDTLS_DEBUG_C
// Debug level (0-4)
mbedtls_debug_set_threshold(0);
#endif
mbedtls_entropy_init(&o->entropy);
const byte seed[] = "upy";
ret = mbedtls_ctr_drbg_seed(&o->ctr_drbg, mbedtls_entropy_func, &o->entropy, seed, sizeof(seed));
if (ret != 0) {
goto cleanup;
}
ret = mbedtls_ssl_config_defaults(&o->conf,
args->server_side.u_bool ? MBEDTLS_SSL_IS_SERVER : MBEDTLS_SSL_IS_CLIENT,
MBEDTLS_SSL_TRANSPORT_STREAM,
MBEDTLS_SSL_PRESET_DEFAULT);
if (ret != 0) {
goto cleanup;
}
mbedtls_ssl_conf_authmode(&o->conf, MBEDTLS_SSL_VERIFY_NONE);
mbedtls_ssl_conf_rng(&o->conf, mbedtls_ctr_drbg_random, &o->ctr_drbg);
#ifdef MBEDTLS_DEBUG_C
mbedtls_ssl_conf_dbg(&o->conf, mbedtls_debug, NULL);
#endif
ret = mbedtls_ssl_setup(&o->ssl, &o->conf);
if (ret != 0) {
goto cleanup;
}
if (args->server_hostname.u_obj != mp_const_none) {
const char *sni = mp_obj_str_get_str(args->server_hostname.u_obj);
ret = mbedtls_ssl_set_hostname(&o->ssl, sni);
if (ret != 0) {
goto cleanup;
}
}
mbedtls_ssl_set_bio(&o->ssl, &o->sock, _mbedtls_ssl_send, _mbedtls_ssl_recv, NULL);
if (args->key.u_obj != MP_OBJ_NULL) {
size_t key_len;
const byte *key = (const byte *)mp_obj_str_get_data(args->key.u_obj, &key_len);
// len should include terminating null
ret = mbedtls_pk_parse_key(&o->pkey, key, key_len + 1, NULL, 0);
assert(ret == 0);
size_t cert_len;
const byte *cert = (const byte *)mp_obj_str_get_data(args->cert.u_obj, &cert_len);
// len should include terminating null
ret = mbedtls_x509_crt_parse(&o->cert, cert, cert_len + 1);
assert(ret == 0);
ret = mbedtls_ssl_conf_own_cert(&o->conf, &o->cert, &o->pkey);
assert(ret == 0);
}
while ((ret = mbedtls_ssl_handshake(&o->ssl)) != 0) {
if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
printf("mbedtls_ssl_handshake error: -%x\n", -ret);
goto cleanup;
}
}
return o;
cleanup:
mbedtls_pk_free(&o->pkey);
mbedtls_x509_crt_free(&o->cert);
mbedtls_x509_crt_free(&o->cacert);
mbedtls_ssl_free(&o->ssl);
mbedtls_ssl_config_free(&o->conf);
mbedtls_ctr_drbg_free(&o->ctr_drbg);
mbedtls_entropy_free(&o->entropy);
if (ret == MBEDTLS_ERR_SSL_ALLOC_FAILED) {
mp_raise_OSError(MP_ENOMEM);
} else {
mp_raise_OSError(MP_EIO);
}
}
STATIC mp_obj_t mod_ssl_getpeercert(mp_obj_t o_in, mp_obj_t binary_form) {
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in);
if (!mp_obj_is_true(binary_form)) {
mp_raise_NotImplementedError(NULL);
}
const mbedtls_x509_crt *peer_cert = mbedtls_ssl_get_peer_cert(&o->ssl);
return mp_obj_new_bytes(peer_cert->raw.p, peer_cert->raw.len);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_ssl_getpeercert_obj, mod_ssl_getpeercert);
STATIC void socket_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
(void)kind;
mp_obj_ssl_socket_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "<_SSLSocket %p>", self);
}
STATIC mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errcode) {
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in);
int ret = mbedtls_ssl_read(&o->ssl, buf, size);
if (ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) {
// end of stream
return 0;
}
if (ret >= 0) {
return ret;
}
if (ret == MBEDTLS_ERR_SSL_WANT_READ) {
ret = MP_EWOULDBLOCK;
}
*errcode = ret;
return MP_STREAM_ERROR;
}
STATIC mp_uint_t socket_write(mp_obj_t o_in, const void *buf, mp_uint_t size, int *errcode) {
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(o_in);
int ret = mbedtls_ssl_write(&o->ssl, buf, size);
if (ret >= 0) {
return ret;
}
if (ret == MBEDTLS_ERR_SSL_WANT_WRITE) {
ret = MP_EWOULDBLOCK;
}
*errcode = ret;
return MP_STREAM_ERROR;
}
STATIC mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t flag_in) {
mp_obj_ssl_socket_t *o = MP_OBJ_TO_PTR(self_in);
mp_obj_t sock = o->sock;
mp_obj_t dest[3];
mp_load_method(sock, MP_QSTR_setblocking, dest);
dest[2] = flag_in;
return mp_call_method_n_kw(1, 0, dest);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
STATIC mp_uint_t socket_ioctl(mp_obj_t o_in, mp_uint_t request, uintptr_t arg, int *errcode) {
mp_obj_ssl_socket_t *self = MP_OBJ_TO_PTR(o_in);
if (request == MP_STREAM_CLOSE) {
mbedtls_pk_free(&self->pkey);
mbedtls_x509_crt_free(&self->cert);
mbedtls_x509_crt_free(&self->cacert);
mbedtls_ssl_free(&self->ssl);
mbedtls_ssl_config_free(&self->conf);
mbedtls_ctr_drbg_free(&self->ctr_drbg);
mbedtls_entropy_free(&self->entropy);
}
// Pass all requests down to the underlying socket
return mp_get_stream(self->sock)->ioctl(self->sock, request, arg, errcode);
}
STATIC const mp_rom_map_elem_t ussl_socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
{ MP_ROM_QSTR(MP_QSTR_setblocking), MP_ROM_PTR(&socket_setblocking_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_stream_close_obj) },
#if MICROPY_PY_USSL_FINALISER
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mp_stream_close_obj) },
#endif
{ MP_ROM_QSTR(MP_QSTR_getpeercert), MP_ROM_PTR(&mod_ssl_getpeercert_obj) },
};
STATIC MP_DEFINE_CONST_DICT(ussl_socket_locals_dict, ussl_socket_locals_dict_table);
STATIC const mp_stream_p_t ussl_socket_stream_p = {
MP_PROTO_IMPLEMENT(MP_QSTR_protocol_stream)
.read = socket_read,
.write = socket_write,
.ioctl = socket_ioctl,
};
STATIC const mp_obj_type_t ussl_socket_type = {
{ &mp_type_type },
// Save on qstr's, reuse same as for module
.name = MP_QSTR_ussl,
.print = socket_print,
.getiter = NULL,
.iternext = NULL,
.protocol = &ussl_socket_stream_p,
.locals_dict = (void *)&ussl_socket_locals_dict,
};
STATIC mp_obj_t mod_ssl_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// TODO: Implement more args
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_key, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_cert, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_server_side, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} },
{ MP_QSTR_server_hostname, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
};
// TODO: Check that sock implements stream protocol
mp_obj_t sock = pos_args[0];
struct ssl_args args;
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args,
MP_ARRAY_SIZE(allowed_args), allowed_args, (mp_arg_val_t *)&args);
return MP_OBJ_FROM_PTR(socket_new(sock, &args));
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mod_ssl_wrap_socket_obj, 1, mod_ssl_wrap_socket);
STATIC const mp_rom_map_elem_t mp_module_ssl_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ussl) },
{ MP_ROM_QSTR(MP_QSTR_wrap_socket), MP_ROM_PTR(&mod_ssl_wrap_socket_obj) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_ssl_globals, mp_module_ssl_globals_table);
const mp_obj_module_t mp_module_ussl = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t *)&mp_module_ssl_globals,
};
#endif // MICROPY_PY_USSL

View File

@ -126,7 +126,7 @@ STATIC mp_obj_t mod_utimeq_heappop(mp_obj_t heap_in, mp_obj_t list_ref) {
mp_raise_IndexError(translate("empty heap"));
}
mp_obj_list_t *ret = MP_OBJ_TO_PTR(list_ref);
if (!MP_OBJ_IS_TYPE(list_ref, &mp_type_list) || ret->len < 3) {
if (!mp_obj_is_type(list_ref, &mp_type_list) || ret->len < 3) {
mp_raise_TypeError(NULL);
}

10
extmod/moduwebsocket.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef MICROPY_INCLUDED_EXTMOD_MODUWEBSOCKET_H
#define MICROPY_INCLUDED_EXTMOD_MODUWEBSOCKET_H
#define FRAME_OPCODE_MASK 0x0f
enum {
FRAME_CONT, FRAME_TXT, FRAME_BIN,
FRAME_CLOSE = 0x8, FRAME_PING, FRAME_PONG
};
#endif // MICROPY_INCLUDED_EXTMOD_MODUWEBSOCKET_H

View File

@ -13,7 +13,7 @@
#ifdef MICROPY_PY_WEBREPL_DELAY
#include "py/mphal.h"
#endif
#include "extmod/modwebsocket.h"
#include "extmod/moduwebsocket.h"
#if MICROPY_PY_WEBREPL
@ -87,6 +87,15 @@ STATIC mp_obj_t webrepl_make_new(const mp_obj_type_t *type, size_t n_args, size_
return o;
}
STATIC void check_file_op_finished(mp_obj_webrepl_t *self) {
if (self->data_to_recv == 0) {
mp_stream_close(self->cur_file);
self->hdr_to_recv = sizeof(struct webrepl_file);
DEBUG_printf("webrepl: Finished file operation %d\n", self->hdr.type);
write_webrepl_resp(self->sock, 0);
}
}
STATIC int write_file_chunk(mp_obj_webrepl_t *self) {
const mp_stream_p_t *file_stream = mp_get_stream(self->cur_file);
byte readbuf[2 + 256];
@ -139,6 +148,7 @@ STATIC void handle_op(mp_obj_webrepl_t *self) {
if (self->hdr.type == PUT_FILE) {
self->data_to_recv = self->hdr.size;
check_file_op_finished(self);
} else if (self->hdr.type == GET_FILE) {
self->data_to_recv = 1;
}
@ -245,12 +255,7 @@ STATIC mp_uint_t _webrepl_read(mp_obj_t self_in, void *buf, mp_uint_t size, int
}
}
if (self->data_to_recv == 0) {
mp_stream_close(self->cur_file);
self->hdr_to_recv = sizeof(struct webrepl_file);
DEBUG_printf("webrepl: Finished file operation %d\n", self->hdr.type);
write_webrepl_resp(self->sock, 0);
}
check_file_op_finished(self);
#ifdef MICROPY_PY_WEBREPL_DELAY
// Some platforms may have broken drivers and easily gets

View File

@ -1,294 +0,0 @@
// Copyright (c) 2016 Paul Sokolovsky
// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)
//
// SPDX-License-Identifier: MIT
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "py/runtime.h"
#include "py/stream.h"
#include "extmod/modwebsocket.h"
#if MICROPY_PY_WEBSOCKET
enum { FRAME_HEADER, FRAME_OPT, PAYLOAD, CONTROL };
enum { BLOCKING_WRITE = 0x80 };
typedef struct _mp_obj_websocket_t {
mp_obj_base_t base;
mp_obj_t sock;
uint32_t msg_sz;
byte mask[4];
byte state;
byte to_recv;
byte mask_pos;
byte buf_pos;
byte buf[6];
byte opts;
// Copy of last data frame flags
byte ws_flags;
// Copy of current frame flags
byte last_flags;
} mp_obj_websocket_t;
STATIC mp_uint_t websocket_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode);
STATIC mp_obj_t websocket_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
mp_arg_check_num(n_args, kw_args, 1, 2, false);
mp_get_stream_raise(args[0], MP_STREAM_OP_READ | MP_STREAM_OP_WRITE | MP_STREAM_OP_IOCTL);
mp_obj_websocket_t *o = m_new_obj(mp_obj_websocket_t);
o->base.type = type;
o->sock = args[0];
o->state = FRAME_HEADER;
o->to_recv = 2;
o->mask_pos = 0;
o->buf_pos = 0;
o->opts = FRAME_TXT;
if (n_args > 1 && args[1] == mp_const_true) {
o->opts |= BLOCKING_WRITE;
}
return MP_OBJ_FROM_PTR(o);
}
STATIC mp_uint_t websocket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
mp_obj_websocket_t *self = MP_OBJ_TO_PTR(self_in);
const mp_stream_p_t *stream_p = mp_get_stream(self->sock);
while (1) {
if (self->to_recv != 0) {
mp_uint_t out_sz = stream_p->read(self->sock, self->buf + self->buf_pos, self->to_recv, errcode);
if (out_sz == 0 || out_sz == MP_STREAM_ERROR) {
return out_sz;
}
self->buf_pos += out_sz;
self->to_recv -= out_sz;
if (self->to_recv != 0) {
*errcode = MP_EAGAIN;
return MP_STREAM_ERROR;
}
}
switch (self->state) {
case FRAME_HEADER: {
// TODO: Split frame handling below is untested so far, so conservatively disable it
assert(self->buf[0] & 0x80);
// "Control frames MAY be injected in the middle of a fragmented message."
// So, they must be processed before data frames (and not alter
// self->ws_flags)
byte frame_type = self->buf[0];
self->last_flags = frame_type;
frame_type &= FRAME_OPCODE_MASK;
if ((self->buf[0] & FRAME_OPCODE_MASK) == FRAME_CONT) {
// Preserve previous frame type
self->ws_flags = (self->ws_flags & FRAME_OPCODE_MASK) | (self->buf[0] & ~FRAME_OPCODE_MASK);
} else {
self->ws_flags = self->buf[0];
}
// Reset mask in case someone will use "simplified" protocol
// without masks.
memset(self->mask, 0, sizeof(self->mask));
int to_recv = 0;
size_t sz = self->buf[1] & 0x7f;
if (sz == 126) {
// Msg size is next 2 bytes
to_recv += 2;
} else if (sz == 127) {
// Msg size is next 8 bytes
assert(0);
}
if (self->buf[1] & 0x80) {
// Next 4 bytes is mask
to_recv += 4;
}
self->buf_pos = 0;
self->to_recv = to_recv;
self->msg_sz = sz; // May be overridden by FRAME_OPT
if (to_recv != 0) {
self->state = FRAME_OPT;
} else {
if (frame_type >= FRAME_CLOSE) {
self->state = CONTROL;
} else {
self->state = PAYLOAD;
}
}
continue;
}
case FRAME_OPT: {
if ((self->buf_pos & 3) == 2) {
// First two bytes are message length
self->msg_sz = (self->buf[0] << 8) | self->buf[1];
}
if (self->buf_pos >= 4) {
// Last 4 bytes is mask
memcpy(self->mask, self->buf + self->buf_pos - 4, 4);
}
self->buf_pos = 0;
if ((self->last_flags & FRAME_OPCODE_MASK) >= FRAME_CLOSE) {
self->state = CONTROL;
} else {
self->state = PAYLOAD;
}
continue;
}
case PAYLOAD:
case CONTROL: {
mp_uint_t out_sz = 0;
if (self->msg_sz == 0) {
// In case message had zero payload
goto no_payload;
}
size_t sz = MIN(size, self->msg_sz);
out_sz = stream_p->read(self->sock, buf, sz, errcode);
if (out_sz == 0 || out_sz == MP_STREAM_ERROR) {
return out_sz;
}
sz = out_sz;
for (byte *p = buf; sz--; p++) {
*p ^= self->mask[self->mask_pos++ & 3];
}
self->msg_sz -= out_sz;
if (self->msg_sz == 0) {
byte last_state;
no_payload:
last_state = self->state;
self->state = FRAME_HEADER;
self->to_recv = 2;
self->mask_pos = 0;
self->buf_pos = 0;
// Handle control frame
if (last_state == CONTROL) {
byte frame_type = self->last_flags & FRAME_OPCODE_MASK;
if (frame_type == FRAME_CLOSE) {
static char close_resp[2] = {0x88, 0};
int err;
websocket_write(self_in, close_resp, sizeof(close_resp), &err);
return 0;
}
// DEBUG_printf("Finished receiving ctrl message %x, ignoring\n", self->last_flags);
continue;
}
}
if (out_sz != 0) {
return out_sz;
}
// Empty (data) frame received is not EOF
continue;
}
}
}
}
STATIC mp_uint_t websocket_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode) {
mp_obj_websocket_t *self = MP_OBJ_TO_PTR(self_in);
assert(size < 0x10000);
byte header[4] = {0x80 | (self->opts & FRAME_OPCODE_MASK)};
int hdr_sz;
if (size < 126) {
header[1] = size;
hdr_sz = 2;
} else {
header[1] = 126;
header[2] = size >> 8;
header[3] = size & 0xff;
hdr_sz = 4;
}
mp_obj_t dest[3];
if (self->opts & BLOCKING_WRITE) {
mp_load_method(self->sock, MP_QSTR_setblocking, dest);
dest[2] = mp_const_true;
mp_call_method_n_kw(1, 0, dest);
}
mp_uint_t out_sz = mp_stream_write_exactly(self->sock, header, hdr_sz, errcode);
if (*errcode == 0) {
out_sz = mp_stream_write_exactly(self->sock, buf, size, errcode);
}
if (self->opts & BLOCKING_WRITE) {
dest[2] = mp_const_false;
mp_call_method_n_kw(1, 0, dest);
}
if (*errcode != 0) {
return MP_STREAM_ERROR;
}
return out_sz;
}
STATIC mp_uint_t websocket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) {
mp_obj_websocket_t *self = MP_OBJ_TO_PTR(self_in);
switch (request) {
case MP_STREAM_CLOSE:
// TODO: Send close signaling to the other side, otherwise it's
// abrupt close (connection abort).
mp_stream_close(self->sock);
return 0;
case MP_STREAM_GET_DATA_OPTS:
return self->ws_flags & FRAME_OPCODE_MASK;
case MP_STREAM_SET_DATA_OPTS: {
int cur = self->opts & FRAME_OPCODE_MASK;
self->opts = (self->opts & ~FRAME_OPCODE_MASK) | (arg & FRAME_OPCODE_MASK);
return cur;
}
default:
*errcode = MP_EINVAL;
return MP_STREAM_ERROR;
}
}
STATIC const mp_rom_map_elem_t websocket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) },
{ MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) },
{ MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) },
{ MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) },
{ MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&mp_stream_ioctl_obj) },
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_stream_close_obj) },
};
STATIC MP_DEFINE_CONST_DICT(websocket_locals_dict, websocket_locals_dict_table);
STATIC const mp_stream_p_t websocket_stream_p = {
MP_PROTO_IMPLEMENT(MP_QSTR_protocol_stream)
.read = websocket_read,
.write = websocket_write,
.ioctl = websocket_ioctl,
};
STATIC const mp_obj_type_t websocket_type = {
{ &mp_type_type },
.name = MP_QSTR_websocket,
.make_new = websocket_make_new,
.protocol = &websocket_stream_p,
.locals_dict = (void *)&websocket_locals_dict,
};
STATIC const mp_rom_map_elem_t websocket_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_websocket) },
{ MP_ROM_QSTR(MP_QSTR_websocket), MP_ROM_PTR(&websocket_type) },
};
STATIC MP_DEFINE_CONST_DICT(websocket_module_globals, websocket_module_globals_table);
const mp_obj_module_t mp_module_websocket = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t *)&websocket_module_globals,
};
#endif // MICROPY_PY_WEBSOCKET

View File

@ -1,14 +0,0 @@
// SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)
//
// SPDX-License-Identifier: MIT
#ifndef MICROPY_INCLUDED_EXTMOD_MODWEBSOCKET_H
#define MICROPY_INCLUDED_EXTMOD_MODWEBSOCKET_H
#define FRAME_OPCODE_MASK 0x0f
enum {
FRAME_CONT, FRAME_TXT, FRAME_BIN,
FRAME_CLOSE = 0x8, FRAME_PING, FRAME_PONG
};
#endif // MICROPY_INCLUDED_EXTMOD_MODWEBSOCKET_H

@ -1 +1 @@
Subproject commit ef65415b5503ae71cc0a9064197f2e3fa5365d74
Subproject commit e3bf07cabb728ecfa2b78ea5e468179f94dbf933

View File

@ -11,6 +11,7 @@
#include "py/objtuple.h"
#include "py/objarray.h"
#include "py/stream.h"
#include "extmod/misc.h"
#include "lib/utils/interrupt_char.h"
#include "supervisor/shared/translate.h"
@ -39,6 +40,20 @@ int mp_uos_dupterm_rx_chr(void) {
continue;
}
#if MICROPY_PY_UOS_DUPTERM_BUILTIN_STREAM
if (mp_uos_dupterm_is_builtin_stream(MP_STATE_VM(dupterm_objs[idx]))) {
byte buf[1];
int errcode = 0;
const mp_stream_p_t *stream_p = mp_get_stream(MP_STATE_VM(dupterm_objs[idx]));
mp_uint_t out_sz = stream_p->read(MP_STATE_VM(dupterm_objs[idx]), buf, 1, &errcode);
if (errcode == 0 && out_sz != 0) {
return buf[0];
} else {
continue;
}
}
#endif
nlr_buf_t nlr;
if (nlr_push(&nlr) == 0) {
byte buf[1];
@ -79,6 +94,16 @@ void mp_uos_dupterm_tx_strn(const char *str, size_t len) {
if (MP_STATE_VM(dupterm_objs[idx]) == MP_OBJ_NULL) {
continue;
}
#if MICROPY_PY_UOS_DUPTERM_BUILTIN_STREAM
if (mp_uos_dupterm_is_builtin_stream(MP_STATE_VM(dupterm_objs[idx]))) {
int errcode = 0;
const mp_stream_p_t *stream_p = mp_get_stream(MP_STATE_VM(dupterm_objs[idx]));
stream_p->write(MP_STATE_VM(dupterm_objs[idx]), str, len, &errcode);
continue;
}
#endif
nlr_buf_t nlr;
if (nlr_push(&nlr) == 0) {
mp_stream_write(MP_STATE_VM(dupterm_objs[idx]), str, len, MP_STREAM_RW_WRITE);

View File

@ -207,7 +207,7 @@ mp_obj_t mp_vfs_umount(mp_obj_t mnt_in) {
mp_vfs_mount_t *vfs = NULL;
size_t mnt_len;
const char *mnt_str = NULL;
if (MP_OBJ_IS_STR(mnt_in)) {
if (mp_obj_is_str(mnt_in)) {
mnt_str = mp_obj_str_get_data(mnt_in, &mnt_len);
}
for (mp_vfs_mount_t **vfsp = &MP_STATE_VM(vfs_mount_table); *vfsp != NULL; vfsp = &(*vfsp)->next) {
@ -250,7 +250,7 @@ mp_obj_t mp_vfs_open(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args)
#if defined(MICROPY_VFS_POSIX) && MICROPY_VFS_POSIX
// If the file is an integer then delegate straight to the POSIX handler
if (MP_OBJ_IS_SMALL_INT(args[ARG_file].u_obj)) {
if (mp_obj_is_small_int(args[ARG_file].u_obj)) {
return mp_vfs_posix_file_open(&mp_type_textio, args[ARG_file].u_obj, args[ARG_mode].u_obj);
}
#endif

View File

@ -21,8 +21,8 @@
#include "supervisor/filesystem.h"
#include "supervisor/shared/translate.h"
#if _MAX_SS == _MIN_SS
#define SECSIZE(fs) (_MIN_SS)
#if FF_MAX_SS == FF_MIN_SS
#define SECSIZE(fs) (FF_MIN_SS)
#else
#define SECSIZE(fs) ((fs)->ssize)
#endif
@ -84,7 +84,7 @@ STATIC void verify_fs_writable(fs_user_mount_t *vfs) {
}
}
#if _FS_REENTRANT
#if FF_FS_REENTRANT
STATIC mp_obj_t fat_vfs_del(mp_obj_t self_in) {
mp_obj_fat_vfs_t *self = MP_OBJ_TO_PTR(self_in);
// f_umount only needs to be called to release the sync object
@ -99,8 +99,11 @@ STATIC mp_obj_t fat_vfs_mkfs(mp_obj_t bdev_in) {
fs_user_mount_t *vfs = MP_OBJ_TO_PTR(fat_vfs_make_new(&mp_fat_vfs_type, 1, &bdev_in, NULL));
// make the filesystem
uint8_t working_buf[_MAX_SS];
uint8_t working_buf[FF_MAX_SS];
FRESULT res = f_mkfs(&vfs->fatfs, FM_FAT | FM_SFD, 0, working_buf, sizeof(working_buf));
if (res == FR_MKFS_ABORTED) { // Probably doesn't support FAT16
res = f_mkfs(&vfs->fatfs, FM_FAT32, 0, working_buf, sizeof(working_buf));
}
if (res != FR_OK) {
mp_raise_OSError(fresult_to_errno_table[res]);
}
@ -377,7 +380,7 @@ STATIC mp_obj_t fat_vfs_statvfs(mp_obj_t vfs_in, mp_obj_t path_in) {
t->items[6] = MP_OBJ_NEW_SMALL_INT(0); // f_ffree
t->items[7] = MP_OBJ_NEW_SMALL_INT(0); // f_favail
t->items[8] = MP_OBJ_NEW_SMALL_INT(0); // f_flags
t->items[9] = MP_OBJ_NEW_SMALL_INT(_MAX_LFN); // f_namemax
t->items[9] = MP_OBJ_NEW_SMALL_INT(FF_MAX_LFN); // f_namemax
return MP_OBJ_FROM_PTR(t);
}
@ -397,7 +400,7 @@ STATIC mp_obj_t vfs_fat_mount(mp_obj_t self_in, mp_obj_t readonly, mp_obj_t mkfs
// check if we need to make the filesystem
FRESULT res = (self->flags & FSUSER_NO_FILESYSTEM) ? FR_NO_FILESYSTEM : FR_OK;
if (res == FR_NO_FILESYSTEM && mp_obj_is_true(mkfs)) {
uint8_t working_buf[_MAX_SS];
uint8_t working_buf[FF_MAX_SS];
res = f_mkfs(&self->fatfs, FM_FAT | FM_SFD, 0, working_buf, sizeof(working_buf));
}
if (res != FR_OK) {
@ -451,7 +454,7 @@ STATIC const mp_obj_property_t fat_vfs_label_obj = {
#endif
STATIC const mp_rom_map_elem_t fat_vfs_locals_dict_table[] = {
#if _FS_REENTRANT
#if FF_FS_REENTRANT
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&fat_vfs_del_obj) },
#endif
{ MP_ROM_QSTR(MP_QSTR_mkfs), MP_ROM_PTR(&fat_vfs_mkfs_obj) },

View File

@ -18,8 +18,8 @@
#include "lib/oofatfs/diskio.h"
#include "extmod/vfs_fat.h"
#if _MAX_SS == _MIN_SS
#define SECSIZE(fs) (_MIN_SS)
#if FF_MAX_SS == FF_MIN_SS
#define SECSIZE(fs) (FF_MIN_SS)
#else
#define SECSIZE(fs) ((fs)->ssize)
#endif
@ -34,7 +34,7 @@ STATIC fs_user_mount_t *disk_get_device(void *bdev) {
/*-----------------------------------------------------------------------*/
DRESULT disk_read(
bdev_t pdrv, /* Physical drive */
bdev_t pdrv, /* Physical drive nmuber (0..) */
BYTE *buff, /* Data buffer to store read data */
DWORD sector, /* Sector address (LBA) */
UINT count /* Number of sectors to read (1..128) */
@ -74,7 +74,7 @@ DRESULT disk_read(
/*-----------------------------------------------------------------------*/
DRESULT disk_write(
bdev_t pdrv, /* Physical drive */
bdev_t pdrv, /* Physical drive nmuber (0..) */
const BYTE *buff, /* Data to be written */
DWORD sector, /* Sector address (LBA) */
UINT count /* Number of sectors to write (1..128) */
@ -120,8 +120,8 @@ DRESULT disk_write(
/*-----------------------------------------------------------------------*/
DRESULT disk_ioctl(
bdev_t pdrv, /* Physical drive */
BYTE cmd, /* Control code */
bdev_t pdrv, /* Physical drive nmuber (0..) */
BYTE cmd, /* Control code */
void *buff /* Buffer to send/receive control data */
) {
fs_user_mount_t *vfs = disk_get_device(pdrv);
@ -198,7 +198,7 @@ DRESULT disk_ioctl(
} else {
*((WORD *)buff) = out_value;
}
#if _MAX_SS != _MIN_SS
#if FF_MAX_SS != FF_MIN_SS
// need to store ssize because we use it in disk_read/disk_write
vfs->fatfs.ssize = *((WORD *)buff);
#endif

View File

@ -110,7 +110,7 @@ STATIC mp_obj_t vfs_posix_open(mp_obj_t self_in, mp_obj_t path_in, mp_obj_t mode
&& (strchr(mode, 'w') != NULL || strchr(mode, 'a') != NULL || strchr(mode, '+') != NULL)) {
mp_raise_OSError(MP_EROFS);
}
if (!MP_OBJ_IS_SMALL_INT(path_in)) {
if (!mp_obj_is_small_int(path_in)) {
path_in = vfs_posix_get_path_obj(self, path_in);
}
return mp_vfs_posix_file_open(&mp_type_textio, path_in, mode_in);

View File

@ -74,7 +74,7 @@ mp_obj_t mp_vfs_posix_file_open(const mp_obj_type_t *type, mp_obj_t file_in, mp_
mp_obj_t fid = file_in;
if (MP_OBJ_IS_SMALL_INT(fid)) {
if (mp_obj_is_small_int(fid)) {
o->fd = MP_OBJ_SMALL_INT_VALUE(fid);
return MP_OBJ_FROM_PTR(o);
}

View File

@ -29,6 +29,10 @@
#define NETUTILS_IPV4ADDR_BUFSIZE 4
#define NETUTILS_TRACE_IS_TX (0x0001)
#define NETUTILS_TRACE_PAYLOAD (0x0002)
#define NETUTILS_TRACE_NEWLINE (0x0004)
typedef enum _netutils_endian_t {
NETUTILS_LITTLE,
NETUTILS_BIG,
@ -47,4 +51,6 @@ void netutils_parse_ipv4_addr(mp_obj_t addr_in, uint8_t *out_ip, netutils_endian
// puts IP in out_ip (which must take at least IPADDR_BUF_SIZE bytes).
mp_uint_t netutils_parse_inet_addr(mp_obj_t addr_in, uint8_t *out_ip, netutils_endian_t endian);
void netutils_ethernet_trace(const mp_print_t *print, size_t len, const uint8_t *buf, unsigned int flags);
#endif // MICROPY_INCLUDED_LIB_NETUTILS_NETUTILS_H

170
lib/netutils/trace.c Normal file
View File

@ -0,0 +1,170 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Damien P. George
*
* 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 "lib/netutils/netutils.h"
static uint32_t get_be16(const uint8_t *buf) {
return buf[0] << 8 | buf[1];
}
static uint32_t get_be32(const uint8_t *buf) {
return buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3];
}
static void dump_hex_bytes(const mp_print_t *print, size_t len, const uint8_t *buf) {
for (size_t i = 0; i < len; ++i) {
mp_printf(print, " %02x", buf[i]);
}
}
static const char *ethertype_str(uint16_t type) {
// A value between 0x0000 - 0x05dc (inclusive) indicates a length, not type
switch (type) {
case 0x0800:
return "IPv4";
case 0x0806:
return "ARP";
case 0x86dd:
return "IPv6";
default:
return NULL;
}
}
void netutils_ethernet_trace(const mp_print_t *print, size_t len, const uint8_t *buf, unsigned int flags) {
mp_printf(print, "[% 8d] ETH%cX len=%u", mp_hal_ticks_ms(), flags & NETUTILS_TRACE_IS_TX ? 'T' : 'R', len);
mp_printf(print, " dst=%02x:%02x:%02x:%02x:%02x:%02x", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
mp_printf(print, " src=%02x:%02x:%02x:%02x:%02x:%02x", buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]);
const char *ethertype = ethertype_str(buf[12] << 8 | buf[13]);
if (ethertype) {
mp_printf(print, " type=%s", ethertype);
} else {
mp_printf(print, " type=0x%04x", buf[12] << 8 | buf[13]);
}
if (len > 14) {
len -= 14;
buf += 14;
if (buf[-2] == 0x08 && buf[-1] == 0x00 && buf[0] == 0x45) {
// IPv4 packet
len = get_be16(buf + 2);
mp_printf(print, " srcip=%u.%u.%u.%u dstip=%u.%u.%u.%u",
buf[12], buf[13], buf[14], buf[15],
buf[16], buf[17], buf[18], buf[19]);
uint8_t prot = buf[9];
buf += 20;
len -= 20;
if (prot == 6) {
// TCP packet
uint16_t srcport = get_be16(buf);
uint16_t dstport = get_be16(buf + 2);
uint32_t seqnum = get_be32(buf + 4);
uint32_t acknum = get_be32(buf + 8);
uint16_t dataoff_flags = get_be16(buf + 12);
uint16_t winsz = get_be16(buf + 14);
mp_printf(print, " TCP srcport=%u dstport=%u seqnum=%u acknum=%u dataoff=%u flags=%x winsz=%u",
srcport, dstport, (unsigned)seqnum, (unsigned)acknum, dataoff_flags >> 12, dataoff_flags & 0x1ff, winsz);
buf += 20;
len -= 20;
if (dataoff_flags >> 12 > 5) {
mp_printf(print, " opts=");
size_t opts_len = ((dataoff_flags >> 12) - 5) * 4;
dump_hex_bytes(print, opts_len, buf);
buf += opts_len;
len -= opts_len;
}
} else if (prot == 17) {
// UDP packet
uint16_t srcport = get_be16(buf);
uint16_t dstport = get_be16(buf + 2);
mp_printf(print, " UDP srcport=%u dstport=%u", srcport, dstport);
len = get_be16(buf + 4);
buf += 8;
if ((srcport == 67 && dstport == 68) || (srcport == 68 && dstport == 67)) {
// DHCP
if (srcport == 67) {
mp_printf(print, " DHCPS");
} else {
mp_printf(print, " DHCPC");
}
dump_hex_bytes(print, 12 + 16 + 16 + 64, buf);
size_t n = 12 + 16 + 16 + 64 + 128;
len -= n;
buf += n;
mp_printf(print, " opts:");
switch (buf[6]) {
case 1:
mp_printf(print, " DISCOVER");
break;
case 2:
mp_printf(print, " OFFER");
break;
case 3:
mp_printf(print, " REQUEST");
break;
case 4:
mp_printf(print, " DECLINE");
break;
case 5:
mp_printf(print, " ACK");
break;
case 6:
mp_printf(print, " NACK");
break;
case 7:
mp_printf(print, " RELEASE");
break;
case 8:
mp_printf(print, " INFORM");
break;
}
}
} else {
// Non-UDP packet
mp_printf(print, " prot=%u", prot);
}
} else if (buf[-2] == 0x86 && buf[-1] == 0xdd && (buf[0] >> 4) == 6) {
// IPv6 packet
uint32_t h = get_be32(buf);
uint16_t l = get_be16(buf + 4);
mp_printf(print, " tclass=%u flow=%u len=%u nexthdr=%u hoplimit=%u", (unsigned)((h >> 20) & 0xff), (unsigned)(h & 0xfffff), l, buf[6], buf[7]);
mp_printf(print, " srcip=");
dump_hex_bytes(print, 16, buf + 8);
mp_printf(print, " dstip=");
dump_hex_bytes(print, 16, buf + 24);
buf += 40;
len -= 40;
}
if (flags & NETUTILS_TRACE_PAYLOAD) {
mp_printf(print, " data=");
dump_hex_bytes(print, len, buf);
}
}
if (flags & NETUTILS_TRACE_NEWLINE) {
mp_printf(print, "\n");
}
}

View File

@ -13,8 +13,6 @@
extern "C" {
#endif
/* Status of Disk Functions */
typedef BYTE DSTATUS;
@ -47,11 +45,11 @@ DRESULT disk_ioctl (void *drv, BYTE cmd, void* buff);
/* Command code for disk_ioctrl fucntion */
/* Generic command (Used by FatFs) */
#define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
#define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
#define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
#define CTRL_SYNC 0 /* Complete pending write process (needed at FF_FS_READONLY == 0) */
#define GET_SECTOR_COUNT 1 /* Get media size (needed at FF_USE_MKFS == 1) */
#define GET_SECTOR_SIZE 2 /* Get sector size (needed at FF_MAX_SS != FF_MIN_SS) */
#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at FF_USE_MKFS == 1) */
#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at FF_USE_TRIM == 1) */
#define IOCTL_INIT 5
#define IOCTL_STATUS 6

File diff suppressed because it is too large Load Diff

View File

@ -3,10 +3,10 @@
*/
/*----------------------------------------------------------------------------/
/ FatFs - Generic FAT file system module R0.12b /
/ FatFs - Generic FAT Filesystem module R0.13c /
/-----------------------------------------------------------------------------/
/
/ Copyright (C) 2016, ChaN, all right reserved.
/ Copyright (C) 2018, ChaN, all right reserved.
/
/ FatFs module is an open source software. Redistribution and use of FatFs in
/ source and binary forms, with or without modification, are permitted provided
@ -19,81 +19,93 @@
/ and any warranties related to this software are DISCLAIMED.
/ The copyright owner or contributors be NOT LIABLE for any damages caused
/ by use of this software.
/
/----------------------------------------------------------------------------*/
#ifndef _FATFS
#define _FATFS 68020 /* Revision ID */
#ifndef FF_DEFINED
#define FF_DEFINED 86604 /* Revision ID */
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include FFCONF_H /* FatFs configuration options */
/* This type MUST be 8-bit */
typedef uint8_t BYTE;
/* These types MUST be 16-bit */
typedef int16_t SHORT;
typedef uint16_t WORD;
typedef uint16_t WCHAR;
/* These types MUST be 16-bit or 32-bit */
typedef int INT;
typedef unsigned int UINT;
/* These types MUST be 32-bit */
typedef int32_t LONG;
typedef uint32_t DWORD;
/* This type MUST be 64-bit (Remove this for C89 compatibility) */
typedef uint64_t QWORD;
#include FFCONF_H /* FatFs configuration options */
#if _FATFS != _FFCONF
#if FF_DEFINED != FFCONF_DEF
#error Wrong configuration file (ffconf.h).
#endif
/* Integer types used for FatFs API */
#if defined(_WIN32) /* Main development platform */
#define FF_INTDEF 2
#include <windows.h>
typedef unsigned __int64 QWORD;
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) /* C99 or later */
#define FF_INTDEF 2
#include <stdint.h>
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
typedef unsigned char BYTE; /* char must be 8-bit */
typedef uint16_t WORD; /* 16-bit unsigned integer */
typedef uint16_t WCHAR; /* 16-bit unsigned integer */
typedef uint32_t DWORD; /* 32-bit unsigned integer */
typedef uint64_t QWORD; /* 64-bit unsigned integer */
#else /* Earlier than C99 */
#define FF_INTDEF 1
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
typedef unsigned char BYTE; /* char must be 8-bit */
typedef unsigned short WORD; /* 16-bit unsigned integer */
typedef unsigned short WCHAR; /* 16-bit unsigned integer */
typedef unsigned long DWORD; /* 32-bit unsigned integer */
#endif
/* Definitions of volume management */
#if _MULTI_PARTITION /* Multiple partition configuration */
#define LD2PT(fs) (fs->part) /* Get partition index */
#else /* Single partition configuration */
#define LD2PT(fs) 0 /* Find first valid partition or in SFD */
#if FF_STR_VOLUME_ID
#ifndef FF_VOLUME_STRS
extern const char* VolumeStr[FF_VOLUMES]; /* User defied volume ID */
#endif
#endif
/* Type of path name strings on FatFs API */
#if _LFN_UNICODE /* Unicode (UTF-16) string */
#if _USE_LFN == 0
#error _LFN_UNICODE must be 0 at non-LFN cfg.
#endif
#ifndef _INC_TCHAR
#define _INC_TCHAR
#if FF_USE_LFN && FF_LFN_UNICODE == 1 /* Unicode in UTF-16 encoding */
typedef WCHAR TCHAR;
#define _T(x) L ## x
#define _TEXT(x) L ## x
#endif
#else /* ANSI/OEM string */
#ifndef _INC_TCHAR
#elif FF_USE_LFN && FF_LFN_UNICODE == 2 /* Unicode in UTF-8 encoding */
typedef char TCHAR;
#define _T(x) u8 ## x
#define _TEXT(x) u8 ## x
#elif FF_USE_LFN && FF_LFN_UNICODE == 3 /* Unicode in UTF-32 encoding */
typedef DWORD TCHAR;
#define _T(x) U ## x
#define _TEXT(x) U ## x
#elif FF_USE_LFN && (FF_LFN_UNICODE < 0 || FF_LFN_UNICODE > 3)
#error Wrong FF_LFN_UNICODE setting
#else /* ANSI/OEM code in SBCS/DBCS */
typedef char TCHAR;
#define _T(x) x
#define _TEXT(x) x
#endif
#endif
/* Type of file size variables */
#if _FS_EXFAT
#if _USE_LFN == 0
#error LFN must be enabled when enable exFAT
#if FF_FS_EXFAT
#if FF_INTDEF != 2
#error exFAT feature wants C99 or later
#endif
typedef QWORD FSIZE_t;
#else
@ -102,39 +114,39 @@ typedef DWORD FSIZE_t;
/* File system object structure (FATFS) */
/* Filesystem object structure (FATFS) */
typedef struct {
void *drv; // block device underlying this filesystem
#if _MULTI_PARTITION /* Multiple partition configuration */
#if FF_MULTI_PARTITION /* Multiple partition configuration */
BYTE part; // Partition: 0:Auto detect, 1-4:Forced partition
#endif
BYTE fs_type; /* File system type (0:N/A) */
BYTE fs_type; /* Filesystem type (0:not mounted) */
BYTE n_fats; /* Number of FATs (1 or 2) */
BYTE wflag; /* win[] flag (b0:dirty) */
BYTE fsi_flag; /* FSINFO flags (b7:disabled, b0:dirty) */
WORD id; /* File system mount ID */
WORD id; /* Volume mount ID */
WORD n_rootdir; /* Number of root directory entries (FAT12/16) */
WORD csize; /* Cluster size [sectors] */
#if _MAX_SS != _MIN_SS
#if FF_MAX_SS != FF_MIN_SS
WORD ssize; /* Sector size (512, 1024, 2048 or 4096) */
#endif
#if _USE_LFN != 0
#if FF_USE_LFN
WCHAR* lfnbuf; /* LFN working buffer */
#endif
#if _FS_EXFAT
BYTE* dirbuf; /* Directory entry block scratchpad buffer */
#if FF_FS_EXFAT
BYTE* dirbuf; /* Directory entry block scratchpad buffer for exFAT */
#endif
#if _FS_REENTRANT
_SYNC_t sobj; /* Identifier of sync object */
#if FF_FS_REENTRANT
FF_SYNC_t sobj; /* Identifier of sync object */
#endif
#if !_FS_READONLY
#if !FF_FS_READONLY
DWORD last_clst; /* Last allocated cluster */
DWORD free_clst; /* Number of free clusters */
#endif
#if _FS_RPATH != 0
#if FF_FS_RPATH
DWORD cdir; /* Current directory start cluster (0:root) */
#if _FS_EXFAT
#if FF_FS_EXFAT
DWORD cdc_scl; /* Containing directory start cluster (invalid when cdir is 0) */
DWORD cdc_size; /* b31-b8:Size of containing directory, b7-b0: Chain status */
DWORD cdc_ofs; /* Offset in the containing directory (invalid when cdir is 0) */
@ -146,52 +158,56 @@ typedef struct {
DWORD fatbase; /* FAT base sector */
DWORD dirbase; /* Root directory base sector/cluster */
DWORD database; /* Data base sector */
#if FF_FS_EXFAT
DWORD bitbase; /* Allocation bitmap base sector */
#endif
DWORD winsect; /* Current sector appearing in the win[] */
BYTE win[_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */
BYTE win[FF_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */
} FATFS;
/* Object ID and allocation information (_FDID) */
/* Object ID and allocation information (FFOBJID) */
typedef struct {
FATFS* fs; /* Pointer to the owner file system object */
WORD id; /* Owner file system mount ID */
BYTE attr; /* Object attribute */
BYTE stat; /* Object chain status (b1-0: =0:not contiguous, =2:contiguous (no data on FAT), =3:got flagmented, b2:sub-directory stretched) */
DWORD sclust; /* Object start cluster (0:no cluster or root directory) */
FSIZE_t objsize; /* Object size (valid when sclust != 0) */
#if _FS_EXFAT
DWORD n_cont; /* Size of coutiguous part, clusters - 1 (valid when stat == 3) */
DWORD c_scl; /* Containing directory start cluster (valid when sclust != 0) */
DWORD c_size; /* b31-b8:Size of containing directory, b7-b0: Chain status (valid when c_scl != 0) */
DWORD c_ofs; /* Offset in the containing directory (valid when sclust != 0) */
FATFS* fs; /* Pointer to the hosting volume of this object */
WORD id; /* Hosting volume mount ID */
BYTE attr; /* Object attribute */
BYTE stat; /* Object chain status (b1-0: =0:not contiguous, =2:contiguous, =3:fragmented in this session, b2:sub-directory stretched) */
DWORD sclust; /* Object data start cluster (0:no cluster or root directory) */
FSIZE_t objsize; /* Object size (valid when sclust != 0) */
#if FF_FS_EXFAT
DWORD n_cont; /* Size of first fragment - 1 (valid when stat == 3) */
DWORD n_frag; /* Size of last fragment needs to be written to FAT (valid when not zero) */
DWORD c_scl; /* Containing directory start cluster (valid when sclust != 0) */
DWORD c_size; /* b31-b8:Size of containing directory, b7-b0: Chain status (valid when c_scl != 0) */
DWORD c_ofs; /* Offset in the containing directory (valid when file object and sclust != 0) */
#endif
#if _FS_LOCK != 0
UINT lockid; /* File lock ID origin from 1 (index of file semaphore table Files[]) */
#if FF_FS_LOCK
UINT lockid; /* File lock ID origin from 1 (index of file semaphore table Files[]) */
#endif
} _FDID;
} FFOBJID;
/* File object structure (FIL) */
typedef struct {
_FDID obj; /* Object identifier (must be the 1st member to detect invalid object pointer) */
FFOBJID obj; /* Object identifier (must be the 1st member to detect invalid object pointer) */
BYTE flag; /* File status flags */
BYTE err; /* Abort flag (error code) */
FSIZE_t fptr; /* File read/write pointer (Zeroed on file open) */
DWORD clust; /* Current cluster of fpter (invalid when fprt is 0) */
DWORD clust; /* Current cluster of fpter (invalid when fptr is 0) */
DWORD sect; /* Sector number appearing in buf[] (0:invalid) */
#if !_FS_READONLY
DWORD dir_sect; /* Sector number containing the directory entry */
BYTE* dir_ptr; /* Pointer to the directory entry in the win[] */
#if !FF_FS_READONLY
DWORD dir_sect; /* Sector number containing the directory entry (not used at exFAT) */
BYTE* dir_ptr; /* Pointer to the directory entry in the win[] (not used at exFAT) */
#endif
#if _USE_FASTSEEK
#if FF_USE_FASTSEEK
DWORD* cltbl; /* Pointer to the cluster link map table (nulled on open, set by application) */
#endif
#if !_FS_TINY
BYTE buf[_MAX_SS]; /* File private data read/write window */
#if !FF_FS_TINY
BYTE buf[FF_MAX_SS]; /* File private data read/write window */
#endif
} FIL;
@ -200,16 +216,16 @@ typedef struct {
/* Directory object structure (FF_DIR) */
typedef struct {
_FDID obj; /* Object identifier */
FFOBJID obj; /* Object identifier */
DWORD dptr; /* Current read/write offset */
DWORD clust; /* Current cluster */
DWORD sect; /* Current sector */
DWORD sect; /* Current sector (0:Read operation has terminated) */
BYTE* dir; /* Pointer to the directory item in the win[] */
BYTE fn[12]; /* SFN (in/out) {body[8],ext[3],status[1]} */
#if _USE_LFN != 0
#if FF_USE_LFN
DWORD blk_ofs; /* Offset of current entry block being processed (0xFFFFFFFF:Invalid) */
#endif
#if _USE_FIND
#if FF_USE_FIND
const TCHAR* pat; /* Pointer to the name matching pattern */
#endif
} FF_DIR;
@ -223,11 +239,11 @@ typedef struct {
WORD fdate; /* Modified date */
WORD ftime; /* Modified time */
BYTE fattrib; /* File attribute */
#if _USE_LFN != 0
TCHAR altname[13]; /* Altenative file name */
TCHAR fname[_MAX_LFN + 1]; /* Primary file name */
#if FF_USE_LFN
TCHAR altname[FF_SFN_BUF + 1];/* Altenative file name */
TCHAR fname[FF_LFN_BUF + 1]; /* Primary file name */
#else
TCHAR fname[13]; /* File name */
TCHAR fname[12 + 1]; /* File name */
#endif
} FILINFO;
@ -254,7 +270,7 @@ typedef enum {
FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */
FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */
FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */
FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > _FS_LOCK */
FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > FF_FS_LOCK */
FR_INVALID_PARAMETER /* (19) Given parameter is invalid */
} FRESULT;
@ -292,6 +308,7 @@ FRESULT f_mount (FATFS* fs); /* Mount/Unm
FRESULT f_umount (FATFS* fs); /* Unmount a logical drive */
FRESULT f_mkfs (FATFS *fs, BYTE opt, DWORD au, void* work, UINT len); /* Create a FAT volume */
FRESULT f_fdisk (void *pdrv, const DWORD* szt, void* work); /* Divide a physical drive into some partitions */
FRESULT f_setcp (WORD cp); /* Set current code page */
#define f_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize))
#define f_error(fp) ((fp)->err)
@ -299,6 +316,8 @@ FRESULT f_fdisk (void *pdrv, const DWORD* szt, void* work); /* Divide a
#define f_size(fp) ((fp)->obj.objsize)
#define f_rewind(fp) f_lseek((fp), 0)
#define f_rewinddir(dp) f_readdir((dp), 0)
#define f_rmdir(path) f_unlink(path)
#define f_unmount(path) f_mount(0, path, 0)
#ifndef EOF
#define EOF (-1)
@ -311,26 +330,27 @@ FRESULT f_fdisk (void *pdrv, const DWORD* szt, void* work); /* Divide a
/* Additional user defined functions */
/* RTC function */
#if !_FS_READONLY && !_FS_NORTC
#if !FF_FS_READONLY && !FF_FS_NORTC
DWORD get_fattime (void);
#endif
/* Unicode support functions */
#if _USE_LFN != 0 /* Unicode - OEM code conversion */
WCHAR ff_convert (WCHAR chr, UINT dir); /* OEM-Unicode bidirectional conversion */
WCHAR ff_wtoupper (WCHAR chr); /* Unicode upper-case conversion */
#if _USE_LFN == 3 /* Memory functions */
/* LFN support functions */
#if FF_USE_LFN >= 1 /* Code conversion (defined in unicode.c) */
WCHAR ff_oem2uni (WCHAR oem, WORD cp); /* OEM code to Unicode conversion */
WCHAR ff_uni2oem (DWORD uni, WORD cp); /* Unicode to OEM code conversion */
DWORD ff_wtoupper (DWORD uni); /* Unicode upper-case conversion */
#endif
#if FF_USE_LFN == 3 /* Dynamic memory allocation */
void* ff_memalloc (UINT msize); /* Allocate memory block */
void ff_memfree (void* mblock); /* Free memory block */
#endif
#endif
/* Sync functions */
#if _FS_REENTRANT
int ff_cre_syncobj (FATFS *fatfs, _SYNC_t* sobj); /* Create a sync object */
int ff_req_grant (_SYNC_t sobj); /* Lock sync object */
void ff_rel_grant (_SYNC_t sobj); /* Unlock sync object */
int ff_del_syncobj (_SYNC_t sobj); /* Delete a sync object */
#if FF_FS_REENTRANT
int ff_cre_syncobj (FATFS *fatfs, FF_SYNC_t* sobj); /* Create a sync object */
int ff_req_grant (FF_SYNC_t sobj); /* Lock sync object */
void ff_rel_grant (FF_SYNC_t sobj); /* Unlock sync object */
int ff_del_syncobj (FF_SYNC_t sobj); /* Delete a sync object */
#endif
@ -377,4 +397,4 @@ int ff_del_syncobj (_SYNC_t sobj); /* Delete a sync object */
}
#endif
#endif /* _FATFS */
#endif /* FF_DEFINED */

View File

@ -2,11 +2,11 @@
* This file is part of the MicroPython project, http://micropython.org/
*
* Original file from:
* FatFs - FAT file system module configuration file R0.12a (C)ChaN, 2016
* FatFs - FAT file system module configuration file R0.13c (C)ChaN, 2018
*
* The MIT License (MIT)
*
* SPDX-FileCopyrightText: Copyright (c) 2013-2017 Damien P. George
* SPDX-FileCopyrightText: Copyright (c) 2013-2019 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@ -30,73 +30,72 @@
#include "py/mpconfig.h"
/*---------------------------------------------------------------------------/
/ FatFs - FAT file system module configuration file
/ FatFs Functional Configurations
/---------------------------------------------------------------------------*/
#define _FFCONF 68020 /* Revision ID */
#define FFCONF_DEF 86604 /* Revision ID */
/*---------------------------------------------------------------------------/
/ Function Configurations
/---------------------------------------------------------------------------*/
#define _FS_READONLY 0
#define FF_FS_READONLY 0
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
/ Read-only configuration removes writing API functions, f_write(), f_sync(),
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
/ and optional writing functions as well. */
#define _FS_MINIMIZE 0
#define FF_FS_MINIMIZE 0
/* This option defines minimization level to remove some basic API functions.
/
/ 0: All basic functions are enabled.
/ 0: Basic functions are fully enabled.
/ 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename()
/ are removed.
/ 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1.
/ 3: f_lseek() function is removed in addition to 2. */
#define _USE_STRFUNC 0
/* This option switches string functions, f_gets(), f_putc(), f_puts() and
/ f_printf().
#define FF_USE_STRFUNC 0
/* This option switches string functions, f_gets(), f_putc(), f_puts() and f_printf().
/
/ 0: Disable string functions.
/ 1: Enable without LF-CRLF conversion.
/ 2: Enable with LF-CRLF conversion. */
#define _USE_FIND 0
#define FF_USE_FIND 0
/* This option switches filtered directory read functions, f_findfirst() and
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
#define _USE_MKFS 1
#define FF_USE_MKFS 1
/* This option switches f_mkfs() function. (0:Disable or 1:Enable) */
#define _USE_FASTSEEK 1
#define FF_USE_FASTSEEK 1
/* This option switches fast seek function. (0:Disable or 1:Enable) */
#define _USE_EXPAND 0
#define FF_USE_EXPAND 0
/* This option switches f_expand function. (0:Disable or 1:Enable) */
#define _USE_CHMOD 1
#define FF_USE_CHMOD 1
/* This option switches attribute manipulation functions, f_chmod() and f_utime().
/ (0:Disable or 1:Enable) Also _FS_READONLY needs to be 0 to enable this option. */
/ (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */
#ifdef MICROPY_FATFS_USE_LABEL
#define _USE_LABEL (MICROPY_FATFS_USE_LABEL)
#define FF_USE_LABEL (MICROPY_FATFS_USE_LABEL)
#else
#define _USE_LABEL 0
#define FF_USE_LABEL 0
#endif
/* This option switches volume label functions, f_getlabel() and f_setlabel().
/ (0:Disable or 1:Enable) */
#define _USE_FORWARD 0
#define FF_USE_FORWARD 0
/* This option switches f_forward() function. (0:Disable or 1:Enable) */
@ -105,14 +104,13 @@
/---------------------------------------------------------------------------*/
#ifdef MICROPY_FATFS_LFN_CODE_PAGE
#define _CODE_PAGE (MICROPY_FATFS_LFN_CODE_PAGE)
#define FF_CODE_PAGE MICROPY_FATFS_LFN_CODE_PAGE
#else
#define _CODE_PAGE 1
#define FF_CODE_PAGE 437
#endif
/* This option specifies the OEM code page to be used on the target system.
/ Incorrect setting of the code page can cause a file open failure.
/ Incorrect code page setting can cause a file open failure.
/
/ 1 - ASCII (No extended character. Non-LFN cfg. only)
/ 437 - U.S.
/ 720 - Arabic
/ 737 - Greek
@ -134,59 +132,77 @@
/ 936 - Simplified Chinese (DBCS)
/ 949 - Korean (DBCS)
/ 950 - Traditional Chinese (DBCS)
/ 0 - Include all code pages above and configured by f_setcp()
*/
#ifdef MICROPY_FATFS_ENABLE_LFN
#define _USE_LFN (MICROPY_FATFS_ENABLE_LFN)
#define FF_USE_LFN (MICROPY_FATFS_ENABLE_LFN)
#else
#define _USE_LFN 0
#define FF_USE_LFN 0
#endif
#ifdef MICROPY_FATFS_MAX_LFN
#define _MAX_LFN (MICROPY_FATFS_MAX_LFN)
#define FF_MAX_LFN (MICROPY_FATFS_MAX_LFN)
#else
#define _MAX_LFN 255
#define FF_MAX_LFN 255
#endif
/* The _USE_LFN switches the support of long file name (LFN).
/* The FF_USE_LFN switches the support for LFN (long file name).
/
/ 0: Disable support of LFN. _MAX_LFN has no effect.
/ 0: Disable LFN. FF_MAX_LFN has no effect.
/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
/ 2: Enable LFN with dynamic working buffer on the STACK.
/ 3: Enable LFN with dynamic working buffer on the HEAP.
/
/ To enable the LFN, Unicode handling functions (option/unicode.c) must be added
/ to the project. The working buffer occupies (_MAX_LFN + 1) * 2 bytes and
/ additional 608 bytes at exFAT enabled. _MAX_LFN can be in range from 12 to 255.
/ It should be set 255 to support full featured LFN operations.
/ To enable the LFN, ffunicode.c needs to be added to the project. The LFN function
/ requiers certain internal working buffer occupies (FF_MAX_LFN + 1) * 2 bytes and
/ additional (FF_MAX_LFN + 44) / 15 * 32 bytes when exFAT is enabled.
/ The FF_MAX_LFN defines size of the working buffer in UTF-16 code unit and it can
/ be in range of 12 to 255. It is recommended to be set 255 to fully support LFN
/ specification.
/ When use stack for the working buffer, take care on stack overflow. When use heap
/ memory for the working buffer, memory management functions, ff_memalloc() and
/ ff_memfree(), must be added to the project. */
/ ff_memfree() in ffsystem.c, need to be added to the project. */
#define _LFN_UNICODE 0
/* This option switches character encoding on the API. (0:ANSI/OEM or 1:UTF-16)
/ To use Unicode string for the path name, enable LFN and set _LFN_UNICODE = 1.
/ This option also affects behavior of string I/O functions. */
#define _STRF_ENCODE 3
/* When _LFN_UNICODE == 1, this option selects the character encoding ON THE FILE to
/ be read/written via string I/O functions, f_gets(), f_putc(), f_puts and f_printf().
#define FF_LFN_UNICODE 0
/* This option switches the character encoding on the API when LFN is enabled.
/
/ 0: ANSI/OEM
/ 1: UTF-16LE
/ 2: UTF-16BE
/ 3: UTF-8
/ 0: ANSI/OEM in current CP (TCHAR = char)
/ 1: Unicode in UTF-16 (TCHAR = WCHAR)
/ 2: Unicode in UTF-8 (TCHAR = char)
/ 3: Unicode in UTF-32 (TCHAR = DWORD)
/
/ This option has no effect when _LFN_UNICODE == 0. */
/ Also behavior of string I/O functions will be affected by this option.
/ When LFN is not enabled, this option has no effect. */
#define FF_LFN_BUF 255
#define FF_SFN_BUF 12
/* This set of options defines size of file name members in the FILINFO structure
/ which is used to read out directory items. These values should be suffcient for
/ the file names to read. The maximum possible length of the read file name depends
/ on character encoding. When LFN is not enabled, these options have no effect. */
#define FF_STRF_ENCODE 3
/* When FF_LFN_UNICODE >= 1 with LFN enabled, string I/O functions, f_gets(),
/ f_putc(), f_puts and f_printf() convert the character encoding in it.
/ This option selects assumption of character encoding ON THE FILE to be
/ read/written via those functions.
/
/ 0: ANSI/OEM in current CP
/ 1: Unicode in UTF-16LE
/ 2: Unicode in UTF-16BE
/ 3: Unicode in UTF-8
*/
#ifdef MICROPY_FATFS_RPATH
#define _FS_RPATH (MICROPY_FATFS_RPATH)
#define FF_FS_RPATH (MICROPY_FATFS_RPATH)
#else
#define _FS_RPATH 0
#define FF_FS_RPATH 0
#endif
/* This option configures support of relative path.
/* This option configures support for relative path.
/
/ 0: Disable relative path and remove related functions.
/ 1: Enable relative path. f_chdir() and f_chdrive() are available.
@ -198,53 +214,58 @@
/ Drive/Volume Configurations
/---------------------------------------------------------------------------*/
#define _VOLUMES 1
/* Number of volumes (logical drives) to be used. */
#define FF_VOLUMES 1
/* Number of volumes (logical drives) to be used. (1-10) */
#define _STR_VOLUME_ID 0
#define _VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3"
/* _STR_VOLUME_ID switches string support of volume ID.
/ When _STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive
/ number in the path name. _VOLUME_STRS defines the drive ID strings for each
/ logical drives. Number of items must be equal to _VOLUMES. Valid characters for
/ the drive ID strings are: A-Z and 0-9. */
#define FF_STR_VOLUME_ID 0
#define FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3"
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
/ logical drives. Number of items must not be less than FF_VOLUMES. Valid
/ characters for the volume ID strings are A-Z, a-z and 0-9, however, they are
/ compared in case-insensitive. If FF_STR_VOLUME_ID >= 1 and FF_VOLUME_STRS is
/ not defined, a user defined volume string table needs to be defined as:
/
/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",...
*/
#ifdef MICROPY_FATFS_MULTI_PARTITION
#define _MULTI_PARTITION (MICROPY_FATFS_MULTI_PARTITION)
#define FF_MULTI_PARTITION (MICROPY_FATFS_MULTI_PARTITION)
#else
#define _MULTI_PARTITION 0
#define FF_MULTI_PARTITION 0
#endif
/* This option switches support of multi-partition on a physical drive.
/* This option switches support for multiple volumes on the physical drive.
/ By default (0), each logical drive number is bound to the same physical drive
/ number and only an FAT volume found on the physical drive will be mounted.
/ When multi-partition is enabled (1), each logical drive number can be bound to
/ When this function is enabled (1), each logical drive number can be bound to
/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk()
/ funciton will be available. */
#define _MIN_SS 512
#define FF_MIN_SS 512
#ifdef MICROPY_FATFS_MAX_SS
#define _MAX_SS (MICROPY_FATFS_MAX_SS)
#define FF_MAX_SS (MICROPY_FATFS_MAX_SS)
#else
#define _MAX_SS 512
#define FF_MAX_SS 512
#endif
/* These options configure the range of sector size to be supported. (512, 1024,
/ 2048 or 4096) Always set both 512 for most systems, all type of memory cards and
/* This set of options configures the range of sector size to be supported. (512,
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
/ harddisk. But a larger value may be required for on-board flash memory and some
/ type of optical media. When _MAX_SS is larger than _MIN_SS, FatFs is configured
/ to variable sector size and GET_SECTOR_SIZE command must be implemented to the
/ disk_ioctl() function. */
/ type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is configured
/ for variable sector size mode and disk_ioctl() function needs to implement
/ GET_SECTOR_SIZE command. */
#define _USE_TRIM 0
/* This option switches support of ATA-TRIM. (0:Disable or 1:Enable)
#define FF_USE_TRIM 0
/* This option switches support for ATA-TRIM. (0:Disable or 1:Enable)
/ To enable Trim function, also CTRL_TRIM command should be implemented to the
/ disk_ioctl() function. */
#define _FS_NOFSINFO 0
#define FF_FS_NOFSINFO 0
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
/ option, and f_getfree() function at first time after volume mount will force
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
@ -261,44 +282,44 @@
/ System Configurations
/---------------------------------------------------------------------------*/
#define _FS_TINY 1
#define FF_FS_TINY 1
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
/ At the tiny configuration, size of file object (FIL) is reduced _MAX_SS bytes.
/ At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes.
/ Instead of private sector buffer eliminated from the file object, common sector
/ buffer in the file system object (FATFS) is used for the file data transfer. */
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */
#ifdef MICROPY_FATFS_EXFAT
#define _FS_EXFAT (MICROPY_FATFS_EXFAT)
#define FF_FS_EXFAT (MICROPY_FATFS_EXFAT)
#else
#define _FS_EXFAT 0
#define FF_FS_EXFAT 0
#endif
/* This option switches support of exFAT file system. (0:Disable or 1:Enable)
/ When enable exFAT, also LFN needs to be enabled. (_USE_LFN >= 1)
/ Note that enabling exFAT discards C89 compatibility. */
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1)
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
#ifdef MICROPY_FATFS_NORTC
#define _FS_NORTC (MICROPY_FATFS_NORTC)
#define FF_FS_NORTC (MICROPY_FATFS_NORTC)
#else
#define _FS_NORTC 0
#define FF_FS_NORTC 0
#endif
#define _NORTC_MON 1
#define _NORTC_MDAY 1
#define _NORTC_YEAR 2016
/* The option _FS_NORTC switches timestamp functiton. If the system does not have
/ any RTC function or valid timestamp is not needed, set _FS_NORTC = 1 to disable
/ the timestamp function. All objects modified by FatFs will have a fixed timestamp
/ defined by _NORTC_MON, _NORTC_MDAY and _NORTC_YEAR in local time.
/ To enable timestamp function (_FS_NORTC = 0), get_fattime() function need to be
/ added to the project to get current time form real-time clock. _NORTC_MON,
/ _NORTC_MDAY and _NORTC_YEAR have no effect.
/ These options have no effect at read-only configuration (_FS_READONLY = 1). */
#define FF_NORTC_MON 1
#define FF_NORTC_MDAY 1
#define FF_NORTC_YEAR 2018
/* The option FF_FS_NORTC switches timestamp functiton. If the system does not have
/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable
/ the timestamp function. Every object modified by FatFs will have a fixed timestamp
/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time.
/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be
/ added to the project to read current time form real-time clock. FF_NORTC_MON,
/ FF_NORTC_MDAY and FF_NORTC_YEAR have no effect.
/ These options have no effect at read-only configuration (FF_FS_READONLY = 1). */
#define _FS_LOCK 0
/* The option _FS_LOCK switches file lock function to control duplicated file open
/ and illegal operation to open objects. This option must be 0 when _FS_READONLY
#define FF_FS_LOCK 0
/* The option FF_FS_LOCK switches file lock function to control duplicated file open
/ and illegal operation to open objects. This option must be 0 when FF_FS_READONLY
/ is 1.
/
/ 0: Disable file lock function. To avoid volume corruption, application program
@ -309,41 +330,40 @@
#ifdef MICROPY_FATFS_REENTRANT
#define _FS_REENTRANT (MICROPY_FATFS_REENTRANT)
#define FF_FS_REENTRANT (MICROPY_FATFS_REENTRANT)
#else
#define _FS_REENTRANT 0
#define FF_FS_REENTRANT 0
#endif
// milliseconds
#ifdef MICROPY_FATFS_TIMEOUT
#define _FS_TIMEOUT (MICROPY_FATFS_TIMEOUT)
#define FF_FS_TIMEOUT (MICROPY_FATFS_TIMEOUT)
#else
#define _FS_TIMEOUT 1000
#define FF_FS_TIMEOUT 1000
#endif
#ifdef MICROPY_FATFS_SYNC_T
#define _SYNC_t MICROPY_FATFS_SYNC_T
#define FF_SYNC_t MICROPY_FATFS_SYNC_T
#else
#define _SYNC_t HANDLE
#define FF_SYNC_t HANDLE
#endif
/* The option _FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
/ module itself. Note that regardless of this option, file access to different
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
/ and f_fdisk() function, are always not re-entrant. Only file/directory access
/ to the same volume is under control of this function.
/
/ 0: Disable re-entrancy. _FS_TIMEOUT and _SYNC_t have no effect.
/ 0: Disable re-entrancy. FF_FS_TIMEOUT and FF_SYNC_t have no effect.
/ 1: Enable re-entrancy. Also user provided synchronization handlers,
/ ff_req_grant(), ff_rel_grant(), ff_del_syncobj() and ff_cre_syncobj()
/ function, must be added to the project. Samples are available in
/ option/syscall.c.
/
/ The _FS_TIMEOUT defines timeout period in unit of time tick.
/ The _SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
/ SemaphoreHandle_t and etc.. A header file for O/S definitions needs to be
/ The FF_FS_TIMEOUT defines timeout period in unit of time tick.
/ The FF_SYNC_t defines O/S dependent sync object type. e.g. HANDLE, ID, OS_EVENT*,
/ SemaphoreHandle_t and etc. A header file for O/S definitions needs to be
/ included somewhere in the scope of ff.h. */
/* #include <windows.h> // O/S definitions */
/*--- End of configuration options ---*/

View File

@ -1,33 +1,46 @@
/*------------------------------------------------------------------------*/
/* Unicode - Local code bidirectional converter (C)ChaN, 2015 */
/* (SBCS code pages) */
/* Unicode handling functions for FatFs R0.13c */
/*------------------------------------------------------------------------*/
/* 437 U.S.
/ 720 Arabic
/ 737 Greek
/ 771 KBL
/ 775 Baltic
/ 850 Latin 1
/ 852 Latin 2
/ 855 Cyrillic
/ 857 Turkish
/ 860 Portuguese
/ 861 Icelandic
/ 862 Hebrew
/ 863 Canadian French
/ 864 Arabic
/ 865 Nordic
/ 866 Russian
/ 869 Greek 2
/* This module will occupy a huge memory in the .const section when the /
/ FatFs is configured for LFN with DBCS. If the system has any Unicode /
/ utilitiy for the code conversion, this module should be modified to use /
/ that function to avoid silly memory consumption. /
/-------------------------------------------------------------------------*/
/*
/ Copyright (C) 2018, ChaN, all right reserved.
/
/ FatFs module is an open source software. Redistribution and use of FatFs in
/ source and binary forms, with or without modification, are permitted provided
/ that the following condition is met:
/
/ 1. Redistributions of source code must retain the above copyright notice,
/ this condition and the following disclaimer.
/
/ This software is provided by the copyright holder and contributors "AS IS"
/ and any warranties related to this software are DISCLAIMED.
/ The copyright owner or contributors be NOT LIABLE for any damages caused
/ by use of this software.
*/
#include "../ff.h"
#include "ff.h"
#if FF_USE_LFN /* This module will be blanked at non-LFN configuration */
#if FF_DEFINED != 86604 /* Revision ID */
#error Wrong include file (ff.h).
#endif
#define MERGE2(a, b) a ## b
#define CVTBL(tbl, cp) MERGE2(tbl, cp)
#if _CODE_PAGE == 437
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP437(0x80-0xFF) to Unicode conversion table */
/*------------------------------------------------------------------------*/
/* Code Conversion Tables */
/*------------------------------------------------------------------------*/
#if FF_CODE_PAGE == 437 || FF_CODE_PAGE == 0
static const WCHAR uc437[] = { /* CP437(U.S.) to Unicode conversion table */
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
@ -37,11 +50,9 @@ const WCHAR Tbl[] = { /* CP437(0x80-0xFF) to Unicode conversion table */
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 720
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP720(0x80-0xFF) to Unicode conversion table */
#endif
#if FF_CODE_PAGE == 720 || FF_CODE_PAGE == 0
static const WCHAR uc720[] = { /* CP720(Arabic) to Unicode conversion table */
0x0000, 0x0000, 0x00E9, 0x00E2, 0x0000, 0x00E0, 0x0000, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x0000, 0x0000, 0x0000,
0x0000, 0x0651, 0x0652, 0x00F4, 0x00A4, 0x0640, 0x00FB, 0x00F9, 0x0621, 0x0622, 0x0623, 0x0624, 0x00A3, 0x0625, 0x0626, 0x0627,
0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x00AB, 0x00BB,
@ -51,11 +62,9 @@ const WCHAR Tbl[] = { /* CP720(0x80-0xFF) to Unicode conversion table */
0x0636, 0x0637, 0x0638, 0x0639, 0x063A, 0x0641, 0x00B5, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, 0x0648, 0x0649, 0x064A,
0x2261, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, 0x0650, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 737
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP737(0x80-0xFF) to Unicode conversion table */
#endif
#if FF_CODE_PAGE == 737 || FF_CODE_PAGE == 0
static const WCHAR uc737[] = { /* CP737(Greek) to Unicode conversion table */
0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0,
0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8,
0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C3, 0x03C2, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8,
@ -65,11 +74,9 @@ const WCHAR Tbl[] = { /* CP737(0x80-0xFF) to Unicode conversion table */
0x03C9, 0x03AC, 0x03AD, 0x03AE, 0x03CA, 0x03AF, 0x03CC, 0x03CD, 0x03CB, 0x03CE, 0x0386, 0x0388, 0x0389, 0x038A, 0x038C, 0x038E,
0x038F, 0x00B1, 0x2265, 0x2264, 0x03AA, 0x03AB, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 771
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP771(0x80-0xFF) to Unicode conversion table */
#endif
#if FF_CODE_PAGE == 771 || FF_CODE_PAGE == 0
static const WCHAR uc771[] = { /* CP771(KBL) to Unicode conversion table */
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
@ -79,11 +86,9 @@ const WCHAR Tbl[] = { /* CP771(0x80-0xFF) to Unicode conversion table */
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
0x0118, 0x0119, 0x0116, 0x0117, 0x012E, 0x012F, 0x0160, 0x0161, 0x0172, 0x0173, 0x016A, 0x016B, 0x017D, 0x017E, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 775
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP775(0x80-0xFF) to Unicode conversion table */
#endif
#if FF_CODE_PAGE == 775 || FF_CODE_PAGE == 0
static const WCHAR uc775[] = { /* CP775(Baltic) to Unicode conversion table */
0x0106, 0x00FC, 0x00E9, 0x0101, 0x00E4, 0x0123, 0x00E5, 0x0107, 0x0142, 0x0113, 0x0156, 0x0157, 0x012B, 0x0179, 0x00C4, 0x00C5,
0x00C9, 0x00E6, 0x00C6, 0x014D, 0x00F6, 0x0122, 0x00A2, 0x015A, 0x015B, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x00A4,
0x0100, 0x012A, 0x00F3, 0x017B, 0x017C, 0x017A, 0x201D, 0x00A6, 0x00A9, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x0141, 0x00AB, 0x00BB,
@ -93,11 +98,9 @@ const WCHAR Tbl[] = { /* CP775(0x80-0xFF) to Unicode conversion table */
0x00D3, 0x00DF, 0x014C, 0x0143, 0x00F5, 0x00D5, 0x00B5, 0x0144, 0x0136, 0x0137, 0x013B, 0x013C, 0x0146, 0x0112, 0x0145, 0x2019,
0x00AD, 0x00B1, 0x201C, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x201E, 0x00B0, 0x2219, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 850
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP850(0x80-0xFF) to Unicode conversion table */
#endif
#if FF_CODE_PAGE == 850 || FF_CODE_PAGE == 0
static const WCHAR uc850[] = { /* CP850(Latin 1) to Unicode conversion table */
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
@ -107,11 +110,9 @@ const WCHAR Tbl[] = { /* CP850(0x80-0xFF) to Unicode conversion table */
0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 852
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP852(0x80-0xFF) to Unicode conversion table */
#endif
#if FF_CODE_PAGE == 852 || FF_CODE_PAGE == 0
static const WCHAR uc852[] = { /* CP852(Latin 2) to Unicode conversion table */
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x016F, 0x0107, 0x00E7, 0x0142, 0x00EB, 0x0150, 0x0151, 0x00EE, 0x0179, 0x00C4, 0x0106,
0x00C9, 0x0139, 0x013A, 0x00F4, 0x00F6, 0x013D, 0x013E, 0x015A, 0x015B, 0x00D6, 0x00DC, 0x0164, 0x0165, 0x0141, 0x00D7, 0x010D,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x0104, 0x0105, 0x017D, 0x017E, 0x0118, 0x0119, 0x00AC, 0x017A, 0x010C, 0x015F, 0x00AB, 0x00BB,
@ -121,11 +122,9 @@ const WCHAR Tbl[] = { /* CP852(0x80-0xFF) to Unicode conversion table */
0x00D3, 0x00DF, 0x00D4, 0x0143, 0x0144, 0x0148, 0x0160, 0x0161, 0x0154, 0x00DA, 0x0155, 0x0170, 0x00FD, 0x00DD, 0x0163, 0x00B4,
0x00AD, 0x02DD, 0x02DB, 0x02C7, 0x02D8, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x02D9, 0x0171, 0x0158, 0x0159, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 855
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP855(0x80-0xFF) to Unicode conversion table */
#endif
#if FF_CODE_PAGE == 855 || FF_CODE_PAGE == 0
static const WCHAR uc855[] = { /* CP855(Cyrillic) to Unicode conversion table */
0x0452, 0x0402, 0x0453, 0x0403, 0x0451, 0x0401, 0x0454, 0x0404, 0x0455, 0x0405, 0x0456, 0x0406, 0x0457, 0x0407, 0x0458, 0x0408,
0x0459, 0x0409, 0x045A, 0x040A, 0x045B, 0x040B, 0x045C, 0x040C, 0x045E, 0x040E, 0x045F, 0x040F, 0x044E, 0x042E, 0x044A, 0x042A,
0x0430, 0x0410, 0x0431, 0x0411, 0x0446, 0x0426, 0x0434, 0x0414, 0x0435, 0x0415, 0x0444, 0x0424, 0x0433, 0x0413, 0x00AB, 0x00BB,
@ -135,11 +134,9 @@ const WCHAR Tbl[] = { /* CP855(0x80-0xFF) to Unicode conversion table */
0x042F, 0x0440, 0x0420, 0x0441, 0x0421, 0x0442, 0x0422, 0x0443, 0x0423, 0x0436, 0x0416, 0x0432, 0x0412, 0x044C, 0x042C, 0x2116,
0x00AD, 0x044B, 0x042B, 0x0437, 0x0417, 0x0448, 0x0428, 0x044D, 0x042D, 0x0449, 0x0429, 0x0447, 0x0427, 0x00A7, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 857
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP857(0x80-0xFF) to Unicode conversion table */
#endif
#if FF_CODE_PAGE == 857 || FF_CODE_PAGE == 0
static const WCHAR uc857[] = { /* CP857(Turkish) to Unicode conversion table */
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x0131, 0x00C4, 0x00C5,
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x0130, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x015E, 0x015F,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x011E, 0x011F, 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
@ -149,11 +146,9 @@ const WCHAR Tbl[] = { /* CP857(0x80-0xFF) to Unicode conversion table */
0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x0000, 0x00D7, 0x00DA, 0x00DB, 0x00D9, 0x00EC, 0x00FF, 0x00AF, 0x00B4,
0x00AD, 0x00B1, 0x0000, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 860
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP860(0x80-0xFF) to Unicode conversion table */
#endif
#if FF_CODE_PAGE == 860 || FF_CODE_PAGE == 0
static const WCHAR uc860[] = { /* CP860(Portuguese) to Unicode conversion table */
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E3, 0x00E0, 0x00C1, 0x00E7, 0x00EA, 0x00CA, 0x00E8, 0x00CD, 0x00D4, 0x00EC, 0x00C3, 0x00C2,
0x00C9, 0x00C0, 0x00C8, 0x00F4, 0x00F5, 0x00F2, 0x00DA, 0x00F9, 0x00CC, 0x00D5, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x20A7, 0x00D3,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00D2, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
@ -163,11 +158,9 @@ const WCHAR Tbl[] = { /* CP860(0x80-0xFF) to Unicode conversion table */
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 861
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP861(0x80-0xFF) to Unicode conversion table */
#endif
#if FF_CODE_PAGE == 861 || FF_CODE_PAGE == 0
static const WCHAR uc861[] = { /* CP861(Icelandic) to Unicode conversion table */
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E6, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00D0, 0x00F0, 0x00DE, 0x00C4, 0x00C5,
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00FE, 0x00FB, 0x00DD, 0x00FD, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00C1, 0x00CD, 0x00D3, 0x00DA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
@ -177,11 +170,9 @@ const WCHAR Tbl[] = { /* CP861(0x80-0xFF) to Unicode conversion table */
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 862
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP862(0x80-0xFF) to Unicode conversion table */
#endif
#if FF_CODE_PAGE == 862 || FF_CODE_PAGE == 0
static const WCHAR uc862[] = { /* CP862(Hebrew) to Unicode conversion table */
0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
@ -191,11 +182,9 @@ const WCHAR Tbl[] = { /* CP862(0x80-0xFF) to Unicode conversion table */
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 863
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP863(0x80-0xFF) to Unicode conversion table */
#endif
#if FF_CODE_PAGE == 863 || FF_CODE_PAGE == 0
static const WCHAR uc863[] = { /* CP863(Canadian French) to Unicode conversion table */
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00C2, 0x00E0, 0x00B6, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x2017, 0x00C0,
0x00C9, 0x00C8, 0x00CA, 0x00F4, 0x00CB, 0x00CF, 0x00FB, 0x00F9, 0x00A4, 0x00D4, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x00DB, 0x0192,
0x00A6, 0x00B4, 0x00F3, 0x00FA, 0x00A8, 0x00BB, 0x00B3, 0x00AF, 0x00CE, 0x3210, 0x00AC, 0x00BD, 0x00BC, 0x00BE, 0x00AB, 0x00BB,
@ -205,11 +194,9 @@ const WCHAR Tbl[] = { /* CP863(0x80-0xFF) to Unicode conversion table */
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2219,
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 864
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP864(0x80-0xFF) to Unicode conversion table */
#endif
#if FF_CODE_PAGE == 864 || FF_CODE_PAGE == 0
static const WCHAR uc864[] = { /* CP864(Arabic) to Unicode conversion table */
0x00B0, 0x00B7, 0x2219, 0x221A, 0x2592, 0x2500, 0x2502, 0x253C, 0x2524, 0x252C, 0x251C, 0x2534, 0x2510, 0x250C, 0x2514, 0x2518,
0x03B2, 0x221E, 0x03C6, 0x00B1, 0x00BD, 0x00BC, 0x2248, 0x00AB, 0x00BB, 0xFEF7, 0xFEF8, 0x0000, 0x0000, 0xFEFB, 0xFEFC, 0x0000,
0x00A0, 0x00AD, 0xFE82, 0x00A3, 0x00A4, 0xFE84, 0x0000, 0x20AC, 0xFE8E, 0xFE8F, 0xFE95, 0xFE99, 0x060C, 0xFE9D, 0xFEA1, 0xFEA5,
@ -219,11 +206,9 @@ const WCHAR Tbl[] = { /* CP864(0x80-0xFF) to Unicode conversion table */
0x0640, 0xFED3, 0xFED7, 0xFEDB, 0xFEDF, 0xFEE3, 0xFEE7, 0xFEEB, 0xFEED, 0xFEEF, 0xFEF3, 0xFEBD, 0xFECC, 0xFECE, 0xFECD, 0xFEE1,
0xFE7D, 0x0651, 0xFEE5, 0xFEE9, 0xFEEC, 0xFEF0, 0xFEF2, 0xFED0, 0xFED5, 0xFEF5, 0xFEF6, 0xFEDD, 0xFED9, 0xFEF1, 0x25A0, 0x0000
};
#elif _CODE_PAGE == 865
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP865(0x80-0xFF) to Unicode conversion table */
#endif
#if FF_CODE_PAGE == 865 || FF_CODE_PAGE == 0
static const WCHAR uc865[] = { /* CP865(Nordic) to Unicode conversion table */
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
0x00C5, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00A4,
@ -233,11 +218,9 @@ const WCHAR Tbl[] = { /* CP865(0x80-0xFF) to Unicode conversion table */
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 866
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP866(0x80-0xFF) to Unicode conversion table */
#endif
#if FF_CODE_PAGE == 866 || FF_CODE_PAGE == 0
static const WCHAR uc866[] = { /* CP866(Russian) to Unicode conversion table */
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
@ -247,11 +230,9 @@ const WCHAR Tbl[] = { /* CP866(0x80-0xFF) to Unicode conversion table */
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040E, 0x045E, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 869
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP869(0x80-0xFF) to Unicode conversion table */
#endif
#if FF_CODE_PAGE == 869 || FF_CODE_PAGE == 0
static const WCHAR uc869[] = { /* CP869(Greek 2) to Unicode conversion table */
0x00B7, 0x00B7, 0x00B7, 0x00B7, 0x00B7, 0x00B7, 0x0386, 0x00B7, 0x00B7, 0x00AC, 0x00A6, 0x2018, 0x2019, 0x0388, 0x2015, 0x0389,
0x038A, 0x03AA, 0x038C, 0x00B7, 0x00B7, 0x038E, 0x03AB, 0x00A9, 0x038F, 0x00B2, 0x00B3, 0x03AC, 0x00A3, 0x03AD, 0x03AE, 0x03AF,
0x03CA, 0x0390, 0x03CC, 0x03CD, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x00BD, 0x0398, 0x0399, 0x00AB, 0x00BB,
@ -261,36 +242,32 @@ const WCHAR Tbl[] = { /* CP869(0x80-0xFF) to Unicode conversion table */
0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C3, 0x03C2, 0x03C4, 0x0384,
0x00AD, 0x00B1, 0x03C5, 0x03C6, 0x03C7, 0x00A7, 0x03C8, 0x0385, 0x00B0, 0x00A8, 0x03C9, 0x03CB, 0x03B0, 0x03CE, 0x25A0, 0x00A0
};
#endif
#if !_TBLDEF || !_USE_LFN
#error This file is not needed at current configuration. Remove from the project.
#endif
WCHAR ff_convert ( /* Converted character, Returns zero on error */
WCHAR chr, /* Character code to be converted */
UINT dir /* 0: Unicode to OEM code, 1: OEM code to Unicode */
/*------------------------------------------------------------------------*/
/* OEM <==> Unicode conversions for static code page configuration */
/* SBCS fixed code page */
/*------------------------------------------------------------------------*/
#if FF_CODE_PAGE != 0 && FF_CODE_PAGE < 900
WCHAR ff_uni2oem ( /* Returns OEM code character, zero on error */
DWORD uni, /* UTF-16 encoded character to be converted */
WORD cp /* Code page for the conversion */
)
{
WCHAR c;
WCHAR c = 0;
const WCHAR *p = CVTBL(uc, FF_CODE_PAGE);
if (chr < 0x80) { /* ASCII */
c = chr;
if (uni < 0x80) { /* ASCII? */
c = (WCHAR)uni;
} else {
if (dir) { /* OEM code to Unicode */
c = (chr >= 0x100) ? 0 : Tbl[chr - 0x80];
} else { /* Unicode to OEM code */
for (c = 0; c < 0x80; c++) {
if (chr == Tbl[c]) break;
}
} else { /* Non-ASCII */
if (uni < 0x10000 && cp == FF_CODE_PAGE) { /* Is it in BMP and valid code page? */
for (c = 0; c < 0x80 && uni != p[c]; c++) ;
c = (c + 0x80) & 0xFF;
}
}
@ -298,56 +275,314 @@ WCHAR ff_convert ( /* Converted character, Returns zero on error */
return c;
}
WCHAR ff_wtoupper ( /* Returns upper converted character */
WCHAR chr /* Unicode character to be upper converted (BMP only) */
WCHAR ff_oem2uni ( /* Returns Unicode character, zero on error */
WCHAR oem, /* OEM code to be converted */
WORD cp /* Code page for the conversion */
)
{
/* Compressed upper conversion table */
static const WCHAR cvt1[] = { /* U+0000 - U+0FFF */
WCHAR c = 0;
const WCHAR *p = CVTBL(uc, FF_CODE_PAGE);
if (oem < 0x80) { /* ASCII? */
c = oem;
} else { /* Extended char */
if (cp == FF_CODE_PAGE) { /* Is it a valid code page? */
if (oem < 0x100) c = p[oem - 0x80];
}
}
return c;
}
#endif
/*------------------------------------------------------------------------*/
/* OEM <==> Unicode conversions for static code page configuration */
/* DBCS fixed code page */
/*------------------------------------------------------------------------*/
#if FF_CODE_PAGE >= 900
WCHAR ff_uni2oem ( /* Returns OEM code character, zero on error */
DWORD uni, /* UTF-16 encoded character to be converted */
WORD cp /* Code page for the conversion */
)
{
const WCHAR *p;
WCHAR c = 0, uc;
UINT i = 0, n, li, hi;
if (uni < 0x80) { /* ASCII? */
c = (WCHAR)uni;
} else { /* Non-ASCII */
if (uni < 0x10000 && cp == FF_CODE_PAGE) { /* Is it in BMP and valid code page? */
uc = (WCHAR)uni;
p = CVTBL(uni2oem, FF_CODE_PAGE);
hi = sizeof CVTBL(uni2oem, FF_CODE_PAGE) / 4 - 1;
li = 0;
for (n = 16; n; n--) {
i = li + (hi - li) / 2;
if (uc == p[i * 2]) break;
if (uc > p[i * 2]) {
li = i;
} else {
hi = i;
}
}
if (n != 0) c = p[i * 2 + 1];
}
}
return c;
}
WCHAR ff_oem2uni ( /* Returns Unicode character, zero on error */
WCHAR oem, /* OEM code to be converted */
WORD cp /* Code page for the conversion */
)
{
const WCHAR *p;
WCHAR c = 0;
UINT i = 0, n, li, hi;
if (oem < 0x80) { /* ASCII? */
c = oem;
} else { /* Extended char */
if (cp == FF_CODE_PAGE) { /* Is it valid code page? */
p = CVTBL(oem2uni, FF_CODE_PAGE);
hi = sizeof CVTBL(oem2uni, FF_CODE_PAGE) / 4 - 1;
li = 0;
for (n = 16; n; n--) {
i = li + (hi - li) / 2;
if (oem == p[i * 2]) break;
if (oem > p[i * 2]) {
li = i;
} else {
hi = i;
}
}
if (n != 0) c = p[i * 2 + 1];
}
}
return c;
}
#endif
/*------------------------------------------------------------------------*/
/* OEM <==> Unicode conversions for dynamic code page configuration */
/*------------------------------------------------------------------------*/
#if FF_CODE_PAGE == 0
static const WORD cp_code[] = { 437, 720, 737, 771, 775, 850, 852, 855, 857, 860, 861, 862, 863, 864, 865, 866, 869, 0};
static const WCHAR* const cp_table[] = {uc437, uc720, uc737, uc771, uc775, uc850, uc852, uc855, uc857, uc860, uc861, uc862, uc863, uc864, uc865, uc866, uc869, 0};
WCHAR ff_uni2oem ( /* Returns OEM code character, zero on error */
DWORD uni, /* UTF-16 encoded character to be converted */
WORD cp /* Code page for the conversion */
)
{
const WCHAR *p;
WCHAR c = 0, uc;
UINT i, n, li, hi;
if (uni < 0x80) { /* ASCII? */
c = (WCHAR)uni;
} else { /* Non-ASCII */
if (uni < 0x10000) { /* Is it in BMP? */
uc = (WCHAR)uni;
p = 0;
if (cp < 900) { /* SBCS */
for (i = 0; cp_code[i] != 0 && cp_code[i] != cp; i++) ; /* Get conversion table */
p = cp_table[i];
if (p) { /* Is it valid code page ? */
for (c = 0; c < 0x80 && uc != p[c]; c++) ; /* Find OEM code in the table */
c = (c + 0x80) & 0xFF;
}
} else { /* DBCS */
switch (cp) { /* Get conversion table */
case 932 : p = uni2oem932; hi = sizeof uni2oem932 / 4 - 1; break;
case 936 : p = uni2oem936; hi = sizeof uni2oem936 / 4 - 1; break;
case 949 : p = uni2oem949; hi = sizeof uni2oem949 / 4 - 1; break;
case 950 : p = uni2oem950; hi = sizeof uni2oem950 / 4 - 1; break;
}
if (p) { /* Is it valid code page? */
li = 0;
for (n = 16; n; n--) { /* Find OEM code */
i = li + (hi - li) / 2;
if (uc == p[i * 2]) break;
if (uc > p[i * 2]) {
li = i;
} else {
hi = i;
}
}
if (n != 0) c = p[i * 2 + 1];
}
}
}
}
return c;
}
WCHAR ff_oem2uni ( /* Returns Unicode character, zero on error */
WCHAR oem, /* OEM code to be converted (DBC if >=0x100) */
WORD cp /* Code page for the conversion */
)
{
const WCHAR *p;
WCHAR c = 0;
UINT i, n, li, hi;
if (oem < 0x80) { /* ASCII? */
c = oem;
} else { /* Extended char */
p = 0;
if (cp < 900) { /* SBCS */
for (i = 0; cp_code[i] != 0 && cp_code[i] != cp; i++) ; /* Get table */
p = cp_table[i];
if (p) { /* Is it a valid CP ? */
if (oem < 0x100) c = p[oem - 0x80];
}
} else { /* DBCS */
switch (cp) {
case 932 : p = oem2uni932; hi = sizeof oem2uni932 / 4 - 1; break;
case 936 : p = oem2uni936; hi = sizeof oem2uni936 / 4 - 1; break;
case 949 : p = oem2uni949; hi = sizeof oem2uni949 / 4 - 1; break;
case 950 : p = oem2uni950; hi = sizeof oem2uni950 / 4 - 1; break;
}
if (p) {
li = 0;
for (n = 16; n; n--) {
i = li + (hi - li) / 2;
if (oem == p[i * 2]) break;
if (oem > p[i * 2]) {
li = i;
} else {
hi = i;
}
}
if (n != 0) c = p[i * 2 + 1];
}
}
}
return c;
}
#endif
/*------------------------------------------------------------------------*/
/* Unicode up-case conversion */
/*------------------------------------------------------------------------*/
DWORD ff_wtoupper ( /* Returns up-converted code point */
DWORD uni /* Unicode code point to be up-converted */
)
{
const WORD *p;
WORD uc, bc, nc, cmd;
static const WORD cvt1[] = { /* Compressed up conversion table for U+0000 - U+0FFF */
/* Basic Latin */
0x0061,0x031A,
/* Latin-1 Supplement */
0x00E0,0x0317, 0x00F8,0x0307, 0x00FF,0x0001,0x0178,
0x00E0,0x0317,
0x00F8,0x0307,
0x00FF,0x0001,0x0178,
/* Latin Extended-A */
0x0100,0x0130, 0x0132,0x0106, 0x0139,0x0110, 0x014A,0x012E, 0x0179,0x0106,
0x0100,0x0130,
0x0132,0x0106,
0x0139,0x0110,
0x014A,0x012E,
0x0179,0x0106,
/* Latin Extended-B */
0x0180,0x004D,0x0243,0x0181,0x0182,0x0182,0x0184,0x0184,0x0186,0x0187,0x0187,0x0189,0x018A,0x018B,0x018B,0x018D,0x018E,0x018F,0x0190,0x0191,0x0191,0x0193,0x0194,0x01F6,0x0196,0x0197,0x0198,0x0198,0x023D,0x019B,0x019C,0x019D,0x0220,0x019F,0x01A0,0x01A0,0x01A2,0x01A2,0x01A4,0x01A4,0x01A6,0x01A7,0x01A7,0x01A9,0x01AA,0x01AB,0x01AC,0x01AC,0x01AE,0x01AF,0x01AF,0x01B1,0x01B2,0x01B3,0x01B3,0x01B5,0x01B5,0x01B7,0x01B8,0x01B8,0x01BA,0x01BB,0x01BC,0x01BC,0x01BE,0x01F7,0x01C0,0x01C1,0x01C2,0x01C3,0x01C4,0x01C5,0x01C4,0x01C7,0x01C8,0x01C7,0x01CA,0x01CB,0x01CA,
0x01CD,0x0110, 0x01DD,0x0001,0x018E, 0x01DE,0x0112, 0x01F3,0x0003,0x01F1,0x01F4,0x01F4, 0x01F8,0x0128,
0x0222,0x0112, 0x023A,0x0009,0x2C65,0x023B,0x023B,0x023D,0x2C66,0x023F,0x0240,0x0241,0x0241, 0x0246,0x010A,
0x01CD,0x0110,
0x01DD,0x0001,0x018E,
0x01DE,0x0112,
0x01F3,0x0003,0x01F1,0x01F4,0x01F4,
0x01F8,0x0128,
0x0222,0x0112,
0x023A,0x0009,0x2C65,0x023B,0x023B,0x023D,0x2C66,0x023F,0x0240,0x0241,0x0241,
0x0246,0x010A,
/* IPA Extensions */
0x0253,0x0040,0x0181,0x0186,0x0255,0x0189,0x018A,0x0258,0x018F,0x025A,0x0190,0x025C,0x025D,0x025E,0x025F,0x0193,0x0261,0x0262,0x0194,0x0264,0x0265,0x0266,0x0267,0x0197,0x0196,0x026A,0x2C62,0x026C,0x026D,0x026E,0x019C,0x0270,0x0271,0x019D,0x0273,0x0274,0x019F,0x0276,0x0277,0x0278,0x0279,0x027A,0x027B,0x027C,0x2C64,0x027E,0x027F,0x01A6,0x0281,0x0282,0x01A9,0x0284,0x0285,0x0286,0x0287,0x01AE,0x0244,0x01B1,0x01B2,0x0245,0x028D,0x028E,0x028F,0x0290,0x0291,0x01B7,
/* Greek, Coptic */
0x037B,0x0003,0x03FD,0x03FE,0x03FF, 0x03AC,0x0004,0x0386,0x0388,0x0389,0x038A, 0x03B1,0x0311,
0x03C2,0x0002,0x03A3,0x03A3, 0x03C4,0x0308, 0x03CC,0x0003,0x038C,0x038E,0x038F, 0x03D8,0x0118,
0x037B,0x0003,0x03FD,0x03FE,0x03FF,
0x03AC,0x0004,0x0386,0x0388,0x0389,0x038A,
0x03B1,0x0311,
0x03C2,0x0002,0x03A3,0x03A3,
0x03C4,0x0308,
0x03CC,0x0003,0x038C,0x038E,0x038F,
0x03D8,0x0118,
0x03F2,0x000A,0x03F9,0x03F3,0x03F4,0x03F5,0x03F6,0x03F7,0x03F7,0x03F9,0x03FA,0x03FA,
/* Cyrillic */
0x0430,0x0320, 0x0450,0x0710, 0x0460,0x0122, 0x048A,0x0136, 0x04C1,0x010E, 0x04CF,0x0001,0x04C0, 0x04D0,0x0144,
0x0430,0x0320,
0x0450,0x0710,
0x0460,0x0122,
0x048A,0x0136,
0x04C1,0x010E,
0x04CF,0x0001,0x04C0,
0x04D0,0x0144,
/* Armenian */
0x0561,0x0426,
0x0000
0x0000 /* EOT */
};
static const WCHAR cvt2[] = { /* U+1000 - U+FFFF */
static const WORD cvt2[] = { /* Compressed up conversion table for U+1000 - U+FFFF */
/* Phonetic Extensions */
0x1D7D,0x0001,0x2C63,
/* Latin Extended Additional */
0x1E00,0x0196, 0x1EA0,0x015A,
0x1E00,0x0196,
0x1EA0,0x015A,
/* Greek Extended */
0x1F00,0x0608, 0x1F10,0x0606, 0x1F20,0x0608, 0x1F30,0x0608, 0x1F40,0x0606,
0x1F51,0x0007,0x1F59,0x1F52,0x1F5B,0x1F54,0x1F5D,0x1F56,0x1F5F, 0x1F60,0x0608,
0x1F00,0x0608,
0x1F10,0x0606,
0x1F20,0x0608,
0x1F30,0x0608,
0x1F40,0x0606,
0x1F51,0x0007,0x1F59,0x1F52,0x1F5B,0x1F54,0x1F5D,0x1F56,0x1F5F,
0x1F60,0x0608,
0x1F70,0x000E,0x1FBA,0x1FBB,0x1FC8,0x1FC9,0x1FCA,0x1FCB,0x1FDA,0x1FDB,0x1FF8,0x1FF9,0x1FEA,0x1FEB,0x1FFA,0x1FFB,
0x1F80,0x0608, 0x1F90,0x0608, 0x1FA0,0x0608, 0x1FB0,0x0004,0x1FB8,0x1FB9,0x1FB2,0x1FBC,
0x1FCC,0x0001,0x1FC3, 0x1FD0,0x0602, 0x1FE0,0x0602, 0x1FE5,0x0001,0x1FEC, 0x1FF2,0x0001,0x1FFC,
0x1F80,0x0608,
0x1F90,0x0608,
0x1FA0,0x0608,
0x1FB0,0x0004,0x1FB8,0x1FB9,0x1FB2,0x1FBC,
0x1FCC,0x0001,0x1FC3,
0x1FD0,0x0602,
0x1FE0,0x0602,
0x1FE5,0x0001,0x1FEC,
0x1FF3,0x0001,0x1FFC,
/* Letterlike Symbols */
0x214E,0x0001,0x2132,
/* Number forms */
0x2170,0x0210, 0x2184,0x0001,0x2183,
0x2170,0x0210,
0x2184,0x0001,0x2183,
/* Enclosed Alphanumerics */
0x24D0,0x051A, 0x2C30,0x042F,
0x24D0,0x051A,
0x2C30,0x042F,
/* Latin Extended-C */
0x2C60,0x0102, 0x2C67,0x0106, 0x2C75,0x0102,
0x2C60,0x0102,
0x2C67,0x0106, 0x2C75,0x0102,
/* Coptic */
0x2C80,0x0164,
/* Georgian Supplement */
@ -355,33 +590,38 @@ WCHAR ff_wtoupper ( /* Returns upper converted character */
/* Full-width */
0xFF41,0x031A,
0x0000
0x0000 /* EOT */
};
const WCHAR *p;
WCHAR bc, nc, cmd;
p = chr < 0x1000 ? cvt1 : cvt2;
for (;;) {
bc = *p++; /* Get block base */
if (!bc || chr < bc) break;
nc = *p++; cmd = nc >> 8; nc &= 0xFF; /* Get processing command and block size */
if (chr < bc + nc) { /* In the block? */
switch (cmd) {
case 0: chr = p[chr - bc]; break; /* Table conversion */
case 1: chr -= (chr - bc) & 1; break; /* Case pairs */
case 2: chr -= 16; break; /* Shift -16 */
case 3: chr -= 32; break; /* Shift -32 */
case 4: chr -= 48; break; /* Shift -48 */
case 5: chr -= 26; break; /* Shift -26 */
case 6: chr += 8; break; /* Shift +8 */
case 7: chr -= 80; break; /* Shift -80 */
case 8: chr -= 0x1C60; break; /* Shift -0x1C60 */
if (uni < 0x10000) { /* Is it in BMP? */
uc = (WORD)uni;
p = uc < 0x1000 ? cvt1 : cvt2;
for (;;) {
bc = *p++; /* Get the block base */
if (bc == 0 || uc < bc) break; /* Not matched? */
nc = *p++; cmd = nc >> 8; nc &= 0xFF; /* Get processing command and block size */
if (uc < bc + nc) { /* In the block? */
switch (cmd) {
case 0: uc = p[uc - bc]; break; /* Table conversion */
case 1: uc -= (uc - bc) & 1; break; /* Case pairs */
case 2: uc -= 16; break; /* Shift -16 */
case 3: uc -= 32; break; /* Shift -32 */
case 4: uc -= 48; break; /* Shift -48 */
case 5: uc -= 26; break; /* Shift -26 */
case 6: uc += 8; break; /* Shift +8 */
case 7: uc -= 80; break; /* Shift -80 */
case 8: uc -= 0x1C60; break; /* Shift -0x1C60 */
}
break;
}
break;
if (cmd == 0) p += nc; /* Skip table if needed */
}
if (!cmd) p += nc;
uni = uc;
}
return chr;
return uni;
}
#endif /* #if FF_USE_LFN */

View File

@ -1,17 +0,0 @@
#include "../ff.h"
#if _USE_LFN != 0
#if _CODE_PAGE == 932 /* Japanese Shift_JIS */
#include "cc932.c"
#elif _CODE_PAGE == 936 /* Simplified Chinese GBK */
#include "cc936.c"
#elif _CODE_PAGE == 949 /* Korean */
#include "cc949.c"
#elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */
#include "cc950.c"
#else /* Single Byte Character-Set */
#include "ccsbcs.c"
#endif
#endif

34
lib/utils/gchelper.h Normal file
View File

@ -0,0 +1,34 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Damien P. George
*
* 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.
*/
#ifndef MICROPY_INCLUDED_LIB_UTILS_GCHELPER_H
#define MICROPY_INCLUDED_LIB_UTILS_GCHELPER_H
#include <stdint.h>
uintptr_t gc_helper_get_sp(void);
uintptr_t gc_helper_get_regs_and_sp(uintptr_t *regs);
#endif // MICROPY_INCLUDED_LIB_UTILS_GCHELPER_H

61
lib/utils/gchelper_m0.s Normal file
View File

@ -0,0 +1,61 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2018 Damien P. George
*
* 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.
*/
.syntax unified
.cpu cortex-m0
.thumb
.section .text
.align 2
.global gc_helper_get_regs_and_sp
.type gc_helper_get_regs_and_sp, %function
@ uint gc_helper_get_regs_and_sp(r0=uint regs[10])
gc_helper_get_regs_and_sp:
@ store registers into given array
str r4, [r0, #0]
str r5, [r0, #4]
str r6, [r0, #8]
str r7, [r0, #12]
mov r1, r8
str r1, [r0, #16]
mov r1, r9
str r1, [r0, #20]
mov r1, r10
str r1, [r0, #24]
mov r1, r11
str r1, [r0, #28]
mov r1, r12
str r1, [r0, #32]
mov r1, r13
str r1, [r0, #36]
@ return the sp
mov r0, sp
bx lr
.size gc_helper_get_regs_and_sp, .-gc_helper_get_regs_and_sp

67
lib/utils/gchelper_m3.s Normal file
View File

@ -0,0 +1,67 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2013-2014 Damien P. George
*
* 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.
*/
.syntax unified
.cpu cortex-m3
.thumb
.section .text
.align 2
.global gc_helper_get_sp
.type gc_helper_get_sp, %function
@ uint gc_helper_get_sp(void)
gc_helper_get_sp:
@ return the sp
mov r0, sp
bx lr
.size gc_helper_get_sp, .-gc_helper_get_sp
.global gc_helper_get_regs_and_sp
.type gc_helper_get_regs_and_sp, %function
@ uint gc_helper_get_regs_and_sp(r0=uint regs[10])
gc_helper_get_regs_and_sp:
@ store registers into given array
str r4, [r0], #4
str r5, [r0], #4
str r6, [r0], #4
str r7, [r0], #4
str r8, [r0], #4
str r9, [r0], #4
str r10, [r0], #4
str r11, [r0], #4
str r12, [r0], #4
str r13, [r0], #4
@ return the sp
mov r0, sp
bx lr
.size gc_helper_get_regs_and_sp, .-gc_helper_get_regs_and_sp

View File

@ -29,7 +29,7 @@
#if MICROPY_KBD_EXCEPTION
int mp_interrupt_char;
int mp_interrupt_char = -1;
void mp_hal_set_interrupt_char(int c) {
if (c != -1) {

View File

@ -197,6 +197,7 @@ typedef struct _repl_t {
// will be added later.
// vstr_t line;
bool cont_line;
bool paste_mode;
} repl_t;
repl_t repl;
@ -207,6 +208,7 @@ STATIC int pyexec_friendly_repl_process_char(int c);
void pyexec_event_repl_init(void) {
MP_STATE_VM(repl_line) = vstr_new(32);
repl.cont_line = false;
repl.paste_mode = false;
// no prompt before printing friendly REPL banner or entering raw REPL
readline_init(MP_STATE_VM(repl_line), "");
if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
@ -226,6 +228,7 @@ STATIC int pyexec_raw_repl_process_char(int c) {
pyexec_mode_kind = PYEXEC_MODE_FRIENDLY_REPL;
vstr_reset(MP_STATE_VM(repl_line));
repl.cont_line = false;
repl.paste_mode = false;
pyexec_friendly_repl_process_char(CHAR_CTRL_B);
return 0;
} else if (c == CHAR_CTRL_C) {
@ -263,6 +266,32 @@ reset:
}
STATIC int pyexec_friendly_repl_process_char(int c) {
if (repl.paste_mode) {
if (c == CHAR_CTRL_C) {
// cancel everything
mp_hal_stdout_tx_str("\r\n");
goto input_restart;
} else if (c == CHAR_CTRL_D) {
// end of input
mp_hal_stdout_tx_str("\r\n");
int ret = parse_compile_execute(MP_STATE_VM(repl_line), MP_PARSE_FILE_INPUT, EXEC_FLAG_ALLOW_DEBUGGING | EXEC_FLAG_IS_REPL | EXEC_FLAG_SOURCE_IS_VSTR);
if (ret & PYEXEC_FORCED_EXIT) {
return ret;
}
goto input_restart;
} else {
// add char to buffer and echo
vstr_add_byte(MP_STATE_VM(repl_line), c);
if (c == '\r') {
mp_hal_stdout_tx_str("\r\n=== ");
} else {
char buf[1] = {c};
mp_hal_stdout_tx_strn(buf, 1);
}
return 0;
}
}
int ret = readline_process_char(c);
if (!repl.cont_line) {
@ -289,6 +318,12 @@ STATIC int pyexec_friendly_repl_process_char(int c) {
mp_hal_stdout_tx_str("\r\n");
vstr_clear(MP_STATE_VM(repl_line));
return PYEXEC_FORCED_EXIT;
} else if (ret == CHAR_CTRL_E) {
// paste mode
mp_hal_stdout_tx_str("\r\npaste mode; Ctrl-C to cancel, Ctrl-D to finish\r\n=== ");
vstr_reset(MP_STATE_VM(repl_line));
repl.paste_mode = true;
return 0;
}
if (ret < 0) {
@ -335,6 +370,7 @@ STATIC int pyexec_friendly_repl_process_char(int c) {
input_restart:
vstr_reset(MP_STATE_VM(repl_line));
repl.cont_line = false;
repl.paste_mode = false;
readline_init(MP_STATE_VM(repl_line), ">>> ");
return 0;
}
@ -450,7 +486,7 @@ friendly_repl_reset:
// do the user a favor and reenable interrupts.
if (query_irq() == IRQ_STATE_DISABLED) {
enable_irq(IRQ_STATE_ENABLED);
mp_hal_stdout_tx_str("PYB: enabling IRQs\r\n");
mp_hal_stdout_tx_str("MPY: enabling IRQs\r\n");
}
}
#endif
@ -541,20 +577,32 @@ int pyexec_file(const char *filename, pyexec_result_t *result) {
return parse_compile_execute(filename, MP_PARSE_FILE_INPUT, EXEC_FLAG_SOURCE_IS_FILENAME, result);
}
int pyexec_file_if_exists(const char *filename, pyexec_result_t *result) {
#if MICROPY_MODULE_FROZEN
if (mp_frozen_stat(filename) == MP_IMPORT_STAT_FILE) {
return pyexec_frozen_module(filename, result);
}
#endif
if (mp_import_stat(filename) != MP_IMPORT_STAT_FILE) {
return 1; // success (no file is the same as an empty file executing without fail)
}
return pyexec_file(filename, result);
}
#if MICROPY_MODULE_FROZEN
int pyexec_frozen_module(const char *name) {
int pyexec_frozen_module(const char *name, pyexec_result_t *result) {
void *frozen_data;
int frozen_type = mp_find_frozen_module(name, strlen(name), &frozen_data);
switch (frozen_type) {
#if MICROPY_MODULE_FROZEN_STR
case MP_FROZEN_STR:
return parse_compile_execute(frozen_data, MP_PARSE_FILE_INPUT, 0, NULL);
return parse_compile_execute(frozen_data, MP_PARSE_FILE_INPUT, 0, result);
#endif
#if MICROPY_MODULE_FROZEN_MPY
case MP_FROZEN_MPY:
return parse_compile_execute(frozen_data, MP_PARSE_FILE_INPUT, EXEC_FLAG_SOURCE_IS_RAW_CODE, NULL);
return parse_compile_execute(frozen_data, MP_PARSE_FILE_INPUT, EXEC_FLAG_SOURCE_IS_RAW_CODE, result);
#endif
default:

View File

@ -54,7 +54,8 @@ extern int pyexec_system_exit;
int pyexec_raw_repl(void);
int pyexec_friendly_repl(void);
int pyexec_file(const char *filename, pyexec_result_t *result);
int pyexec_frozen_module(const char *name);
int pyexec_file_if_exists(const char *filename, pyexec_result_t *result);
int pyexec_frozen_module(const char *name, pyexec_result_t *result);
void pyexec_event_repl_init(void);
int pyexec_event_repl_process_char(int c);
extern uint8_t pyexec_repl_active;

View File

@ -1207,6 +1207,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr "%q pada tidak valid"
@ -1277,6 +1278,11 @@ msgstr "Periode penangkapan tidak valid. Kisaran yang valid: 1 - 500"
msgid "Invalid channel count"
msgstr "Jumlah kanal tidak valid"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr ""
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr "Arah tidak valid."
@ -2155,6 +2161,14 @@ msgstr ""
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Untuk keluar, silahkan reset board tanpa "
@ -2347,10 +2361,6 @@ msgstr "Panjang nilai > max_length"
msgid "Version was invalid"
msgstr ""
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr "Fungsi Viper saat ini tidak mendukung lebih dari 4 argumen"
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr "Tegangan baca habis waktu"
@ -2436,11 +2446,6 @@ msgstr "sebuah objek menyerupai byte (bytes-like) dibutuhkan"
msgid "abort() called"
msgstr "abort() dipanggil"
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr "alamat %08x tidak selaras dengan %d bytes"
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr "alamat di luar batas"
@ -2449,6 +2454,10 @@ msgstr "alamat di luar batas"
msgid "addresses is empty"
msgstr "alamatnya kosong"
#: py/compile.c
msgid "annotation must be an identifier"
msgstr ""
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "arg berisi urutan kosong"
@ -2631,6 +2640,10 @@ msgstr "tidak dapat menetapkan ke ekspresi"
msgid "can't convert %q to %q"
msgstr ""
#: py/runtime.c
msgid "can't convert %q to int"
msgstr ""
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr ""
@ -2639,6 +2652,10 @@ msgstr ""
msgid "can't convert to %q"
msgstr ""
#: py/runtime.c
msgid "can't convert to int"
msgstr ""
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr ""
@ -2837,6 +2854,11 @@ msgstr ""
msgid "data must be of equal length"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr ""
@ -3042,8 +3064,8 @@ msgid "full"
msgstr ""
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgstr "fungsi tidak dapat mengambil argumen keyword"
msgid "function doesn't take keyword arguments"
msgstr ""
#: py/argcheck.c
#, c-format
@ -3097,6 +3119,10 @@ msgstr ""
msgid "generator ignored GeneratorExit"
msgstr ""
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr ""
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr ""
@ -3476,6 +3502,10 @@ msgstr ""
msgid "need more than %d values to unpack"
msgstr ""
#: py/modmath.c
msgid "negative factorial"
msgstr ""
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr ""
@ -3706,10 +3736,6 @@ msgstr ""
msgid "palette_index should be an int"
msgstr ""
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr "anotasi parameter haruse sebuah identifier"
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr ""
@ -3765,6 +3791,7 @@ msgstr ""
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -4148,7 +4175,7 @@ msgstr ""
msgid "unknown type"
msgstr "tipe tidak diketahui"
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr ""
@ -4287,6 +4314,18 @@ msgstr "zi harus berjenis float"
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid "Viper functions don't currently support more than 4 arguments"
#~ msgstr "Fungsi Viper saat ini tidak mendukung lebih dari 4 argumen"
#~ msgid "address %08x is not aligned to %d bytes"
#~ msgstr "alamat %08x tidak selaras dengan %d bytes"
#~ msgid "function does not take keyword arguments"
#~ msgstr "fungsi tidak dapat mengambil argumen keyword"
#~ msgid "parameter annotation must be an identifier"
#~ msgstr "anotasi parameter haruse sebuah identifier"
#~ msgid "Total data to write is larger than outgoing_packet_length"
#~ msgstr ""
#~ "Total data yang akan ditulis lebih besar daripada outgoing_packet_length"

View File

@ -733,14 +733,6 @@ msgid ""
"connection."
msgstr ""
#: py/persistentcode.c
msgid "Corrupt .mpy file"
msgstr ""
#: py/emitglue.c
msgid "Corrupt raw code"
msgstr ""
#: ports/cxd56/common-hal/camera/Camera.c
msgid "Could not initialize Camera"
msgstr ""
@ -1185,6 +1177,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr ""
@ -1255,6 +1248,11 @@ msgstr ""
msgid "Invalid channel count"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr ""
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr ""
@ -2114,6 +2112,14 @@ msgstr ""
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr ""
@ -2560,10 +2566,6 @@ msgstr ""
msgid "can only have up to 4 parameters to Xtensa assembly"
msgstr ""
#: py/persistentcode.c
msgid "can only save bytecode"
msgstr ""
#: py/objtype.c
msgid "can't add special method to already-subclassed class"
msgstr ""
@ -2791,6 +2793,11 @@ msgstr ""
msgid "data must be of equal length"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr ""
@ -3071,6 +3078,14 @@ msgstr ""
msgid "identifier redefined as nonlocal"
msgstr ""
#: py/persistentcode.c
msgid "incompatible .mpy file"
msgstr ""
#: py/persistentcode.c
msgid "incompatible native .mpy architecture"
msgstr ""
#: py/objstr.c
msgid "incomplete format"
msgstr ""
@ -3190,6 +3205,10 @@ msgstr ""
msgid "interval must be in range %s-%s"
msgstr ""
#: py/compile.c
msgid "invalid architecture"
msgstr ""
#: lib/netutils/netutils.c
msgid "invalid arguments"
msgstr ""
@ -3199,10 +3218,6 @@ msgstr ""
msgid "invalid bits_per_pixel %d, must be, 1, 4, 8, 16, 24, or 32"
msgstr ""
#: extmod/modussl_axtls.c
msgid "invalid cert"
msgstr ""
#: py/compile.c
msgid "invalid decorator"
msgstr ""
@ -3233,10 +3248,6 @@ msgstr ""
msgid "invalid hostname"
msgstr ""
#: extmod/modussl_axtls.c
msgid "invalid key"
msgstr ""
#: py/compile.c
msgid "invalid micropython decorator"
msgstr ""

View File

@ -1188,6 +1188,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr ""
@ -1258,6 +1259,11 @@ msgstr ""
msgid "Invalid channel count"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr ""
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr ""
@ -2117,6 +2123,14 @@ msgstr ""
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr ""
@ -2307,10 +2321,6 @@ msgstr ""
msgid "Version was invalid"
msgstr ""
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr ""
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr ""
@ -2390,11 +2400,6 @@ msgstr ""
msgid "abort() called"
msgstr ""
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr ""
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr ""
@ -2403,6 +2408,10 @@ msgstr ""
msgid "addresses is empty"
msgstr ""
#: py/compile.c
msgid "annotation must be an identifier"
msgstr ""
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr ""
@ -2585,6 +2594,10 @@ msgstr ""
msgid "can't convert %q to %q"
msgstr ""
#: py/runtime.c
msgid "can't convert %q to int"
msgstr ""
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr ""
@ -2593,6 +2606,10 @@ msgstr ""
msgid "can't convert to %q"
msgstr ""
#: py/runtime.c
msgid "can't convert to int"
msgstr ""
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr ""
@ -2791,6 +2808,11 @@ msgstr ""
msgid "data must be of equal length"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr ""
@ -2996,7 +3018,7 @@ msgid "full"
msgstr ""
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgid "function doesn't take keyword arguments"
msgstr ""
#: py/argcheck.c
@ -3051,6 +3073,10 @@ msgstr ""
msgid "generator ignored GeneratorExit"
msgstr ""
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr ""
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr ""
@ -3430,6 +3456,10 @@ msgstr ""
msgid "need more than %d values to unpack"
msgstr ""
#: py/modmath.c
msgid "negative factorial"
msgstr ""
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr ""
@ -3659,10 +3689,6 @@ msgstr ""
msgid "palette_index should be an int"
msgstr ""
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr ""
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr ""
@ -3718,6 +3744,7 @@ msgstr ""
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -4101,7 +4128,7 @@ msgstr ""
msgid "unknown type"
msgstr ""
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr ""

View File

@ -1208,6 +1208,7 @@ msgstr "Ungültiger %q"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr "Ungültiger %q Pin"
@ -1278,6 +1279,11 @@ msgstr "Ungültiger Aufnahmezeitraum. Gültiger Bereich: 1 - 500"
msgid "Invalid channel count"
msgstr "Ungültige Anzahl von Kanälen"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr ""
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr "Ungültige Richtung."
@ -2161,6 +2167,14 @@ msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr ""
"Zeitbeschränkung ist zu groß: Maximale Zeitbeschränkung ist %d Sekunden"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Zum beenden, resette bitte das board ohne "
@ -2355,10 +2369,6 @@ msgstr "Länge des Wertes > max_length"
msgid "Version was invalid"
msgstr ""
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr "Viper-Funktionen unterstützen derzeit nicht mehr als 4 Argumente"
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr "Zeitüberschreitung beim Lesen der Spannung"
@ -2449,11 +2459,6 @@ msgstr "ein Byte-ähnliches Objekt ist erforderlich"
msgid "abort() called"
msgstr "abort() wurde aufgerufen"
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr "Addresse %08x ist nicht an %d bytes ausgerichtet"
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr "Adresse außerhalb der Grenzen"
@ -2462,6 +2467,10 @@ msgstr "Adresse außerhalb der Grenzen"
msgid "addresses is empty"
msgstr "adresses ist leer"
#: py/compile.c
msgid "annotation must be an identifier"
msgstr ""
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "arg ist eine leere Sequenz"
@ -2646,6 +2655,10 @@ msgstr "kann keinem Ausdruck zuweisen"
msgid "can't convert %q to %q"
msgstr "kann %q nicht zu %q konvertieren"
#: py/runtime.c
msgid "can't convert %q to int"
msgstr ""
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr "Kann '%q' Objekt nicht implizit nach %q konvertieren"
@ -2654,6 +2667,10 @@ msgstr "Kann '%q' Objekt nicht implizit nach %q konvertieren"
msgid "can't convert to %q"
msgstr "kann nicht zu %q konvertieren"
#: py/runtime.c
msgid "can't convert to int"
msgstr "kann nicht nach int konvertieren"
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr "Kann nicht implizit nach str konvertieren"
@ -2860,6 +2877,11 @@ msgstr ""
msgid "data must be of equal length"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr ""
@ -3067,8 +3089,8 @@ msgid "full"
msgstr "voll"
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgstr "Funktion akzeptiert keine Schlüsselwort-Argumente"
msgid "function doesn't take keyword arguments"
msgstr ""
#: py/argcheck.c
#, c-format
@ -3124,6 +3146,10 @@ msgstr "Generator läuft bereits"
msgid "generator ignored GeneratorExit"
msgstr "Generator ignoriert GeneratorExit"
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr ""
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr "graphic muss 2048 Byte lang sein"
@ -3509,6 +3535,10 @@ msgstr "native Ausbeute (yield)"
msgid "need more than %d values to unpack"
msgstr "Zum Entpacken sind mehr als %d Werte erforderlich"
#: py/modmath.c
msgid "negative factorial"
msgstr ""
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr "negative Potenz ohne Gleitkomma (float) Unterstützung"
@ -3742,10 +3772,6 @@ msgstr "Die Palette muss 32 Byte lang sein"
msgid "palette_index should be an int"
msgstr "palette_index sollte ein int sein"
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr "parameter annotation muss ein identifier sein"
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr "Die Parameter müssen Register der Reihenfolge a2 bis a5 sein"
@ -3801,6 +3827,7 @@ msgstr "pow () mit 3 Argumenten erfordert Integer"
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -4191,7 +4218,7 @@ msgstr "Unbekannter Formatcode '%c' für Objekt vom Typ '%q'"
msgid "unknown type"
msgstr "unbekannter Typ"
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr "unbekannter Typ '%q'"
@ -4330,6 +4357,18 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid "Viper functions don't currently support more than 4 arguments"
#~ msgstr "Viper-Funktionen unterstützen derzeit nicht mehr als 4 Argumente"
#~ msgid "address %08x is not aligned to %d bytes"
#~ msgstr "Addresse %08x ist nicht an %d bytes ausgerichtet"
#~ msgid "function does not take keyword arguments"
#~ msgstr "Funktion akzeptiert keine Schlüsselwort-Argumente"
#~ msgid "parameter annotation must be an identifier"
#~ msgstr "parameter annotation muss ein identifier sein"
#~ msgid "Total data to write is larger than outgoing_packet_length"
#~ msgstr ""
#~ "Die Gesamtzahl der zu schreibenden Daten ist größer als "
@ -4563,9 +4602,6 @@ msgstr ""
#~ msgid "can't convert to float"
#~ msgstr "kann nicht nach float konvertieren"
#~ msgid "can't convert to int"
#~ msgstr "kann nicht nach int konvertieren"
#~ msgid "object '%s' is not a tuple or list"
#~ msgstr "Objekt '%s' ist weder tupel noch list"

View File

@ -1185,6 +1185,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr ""
@ -1255,6 +1256,11 @@ msgstr ""
msgid "Invalid channel count"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr ""
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr ""
@ -2114,6 +2120,14 @@ msgstr ""
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr ""
@ -2304,10 +2318,6 @@ msgstr ""
msgid "Version was invalid"
msgstr ""
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr ""
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr ""
@ -2387,11 +2397,6 @@ msgstr ""
msgid "abort() called"
msgstr ""
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr ""
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr ""
@ -2400,6 +2405,10 @@ msgstr ""
msgid "addresses is empty"
msgstr ""
#: py/compile.c
msgid "annotation must be an identifier"
msgstr ""
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr ""
@ -2582,6 +2591,10 @@ msgstr ""
msgid "can't convert %q to %q"
msgstr ""
#: py/runtime.c
msgid "can't convert %q to int"
msgstr ""
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr ""
@ -2590,6 +2603,10 @@ msgstr ""
msgid "can't convert to %q"
msgstr ""
#: py/runtime.c
msgid "can't convert to int"
msgstr ""
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr ""
@ -2788,6 +2805,11 @@ msgstr ""
msgid "data must be of equal length"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr ""
@ -2993,7 +3015,7 @@ msgid "full"
msgstr ""
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgid "function doesn't take keyword arguments"
msgstr ""
#: py/argcheck.c
@ -3048,6 +3070,10 @@ msgstr ""
msgid "generator ignored GeneratorExit"
msgstr ""
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr ""
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr ""
@ -3427,6 +3453,10 @@ msgstr ""
msgid "need more than %d values to unpack"
msgstr ""
#: py/modmath.c
msgid "negative factorial"
msgstr ""
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr ""
@ -3656,10 +3686,6 @@ msgstr ""
msgid "palette_index should be an int"
msgstr ""
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr ""
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr ""
@ -3715,6 +3741,7 @@ msgstr ""
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -4098,7 +4125,7 @@ msgstr ""
msgid "unknown type"
msgstr ""
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr ""

View File

@ -1202,6 +1202,7 @@ msgstr "Invalid %q"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr "Invalid %q pin"
@ -1272,6 +1273,11 @@ msgstr "Invalid capture period. Valid range: 1 - 500"
msgid "Invalid channel count"
msgstr "Invalid channel count"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr ""
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr "Invalid direction."
@ -2151,6 +2157,14 @@ msgstr "Time is in the past."
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr "Timeout is too long: Maximum timeout length is %d seconds"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "To exit, please reset the board without "
@ -2343,10 +2357,6 @@ msgstr "Value length > max_length"
msgid "Version was invalid"
msgstr "Version was invalid"
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr "Viper functions don't currently support more than 4 arguments"
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr "Voltage read timed out"
@ -2431,11 +2441,6 @@ msgstr "a bytes-like object is required"
msgid "abort() called"
msgstr "abort() called"
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr "address %08x is not aligned to %d bytes"
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr "address out of bounds"
@ -2444,6 +2449,10 @@ msgstr "address out of bounds"
msgid "addresses is empty"
msgstr "addresses is empty"
#: py/compile.c
msgid "annotation must be an identifier"
msgstr ""
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "arg is an empty sequence"
@ -2626,6 +2635,10 @@ msgstr "Can't assign to expression"
msgid "can't convert %q to %q"
msgstr "Can't convert %q to %q"
#: py/runtime.c
msgid "can't convert %q to int"
msgstr ""
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr "Can't convert '%q' object to %q implicitly"
@ -2634,6 +2647,10 @@ msgstr "Can't convert '%q' object to %q implicitly"
msgid "can't convert to %q"
msgstr "Can't convert to %q"
#: py/runtime.c
msgid "can't convert to int"
msgstr ""
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr "Can't convert to str implicitly"
@ -2834,6 +2851,11 @@ msgstr "cata must be iterable"
msgid "data must be of equal length"
msgstr "cata must be of equal length"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr "cata type not understood"
@ -3040,8 +3062,8 @@ msgid "full"
msgstr "full"
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgstr "function does not take keyword arguments"
msgid "function doesn't take keyword arguments"
msgstr ""
#: py/argcheck.c
#, c-format
@ -3095,6 +3117,10 @@ msgstr "generator already executing"
msgid "generator ignored GeneratorExit"
msgstr "generator ignored GeneratorExit"
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr ""
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr "graphic must be 2048 bytes long"
@ -3475,6 +3501,10 @@ msgstr "native yield"
msgid "need more than %d values to unpack"
msgstr "need more than %d values to unpack"
#: py/modmath.c
msgid "negative factorial"
msgstr ""
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr "negative power with no float support"
@ -3704,10 +3734,6 @@ msgstr "palette must be 32 bytes long"
msgid "palette_index should be an int"
msgstr "palette_index should be an int"
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr "parameter annotation must be an identifier"
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr "parameters must be registers in sequence a2 to a5"
@ -3763,6 +3789,7 @@ msgstr "pow() with 3 arguments requires integers"
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -4148,7 +4175,7 @@ msgstr "unknown format code '%c' for object of type '%q'"
msgid "unknown type"
msgstr "unknown type"
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr "unknown type '%q'"
@ -4287,6 +4314,18 @@ msgstr "zi must be of float type"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi must be of shape (n_section, 2)"
#~ msgid "Viper functions don't currently support more than 4 arguments"
#~ msgstr "Viper functions don't currently support more than 4 arguments"
#~ msgid "address %08x is not aligned to %d bytes"
#~ msgstr "address %08x is not aligned to %d bytes"
#~ msgid "function does not take keyword arguments"
#~ msgstr "function does not take keyword arguments"
#~ msgid "parameter annotation must be an identifier"
#~ msgstr "parameter annotation must be an identifier"
#~ msgid "Total data to write is larger than outgoing_packet_length"
#~ msgstr "Total data to write is larger than outgoing_packet_length"

View File

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-04-15 14:26+0000\n"
"PO-Revision-Date: 2021-04-25 18:43+0000\n"
"Last-Translator: Alvaro Figueroa <alvaro@greencore.co.cr>\n"
"Language-Team: \n"
"Language: es\n"
@ -16,7 +16,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.6-dev\n"
"X-Generator: Weblate 4.7-dev\n"
#: main.c
msgid ""
@ -1219,6 +1219,7 @@ msgstr "%q inválido"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr "Pin %q inválido"
@ -1289,6 +1290,11 @@ msgstr "Inválido periodo de captura. Rango válido: 1 - 500"
msgid "Invalid channel count"
msgstr "Cuenta de canales inválida"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr "data_count inválido %d"
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr "Dirección inválida."
@ -2180,6 +2186,14 @@ msgstr ""
"Tiempo de espera demasiado largo: El tiempo máximo de espera es de %d "
"segundos"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr "Tiempo de espera agotado esperado por DRDY"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr "Tiempo de espera agotado esperando por VSYNC"
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Para salir, por favor reinicia la tarjeta sin "
@ -2199,7 +2213,7 @@ msgstr "Muchos displays"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Total data to write is larger than %q"
msgstr ""
msgstr "La cantidad total de datos es mas grande que %q"
#: py/obj.c
msgid "Traceback (most recent call last):\n"
@ -2372,10 +2386,6 @@ msgstr "Tamaño de valor > max_length"
msgid "Version was invalid"
msgstr "La versión era invalida"
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr "funciones Viper no soportan por el momento, más de 4 argumentos"
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr "Tiempo de espera agotado para lectura de voltaje"
@ -2464,11 +2474,6 @@ msgstr "se requiere un objeto bytes-like"
msgid "abort() called"
msgstr "se llamó abort()"
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr "la dirección %08x no esta alineada a %d bytes"
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr "address fuera de límites"
@ -2477,6 +2482,10 @@ msgstr "address fuera de límites"
msgid "addresses is empty"
msgstr "addresses esta vacío"
#: py/compile.c
msgid "annotation must be an identifier"
msgstr "la anotación debe ser un identificador"
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "argumento es una secuencia vacía"
@ -2659,6 +2668,10 @@ msgstr "no se puede asignar a la expresión"
msgid "can't convert %q to %q"
msgstr "no puede convertir %q a %q"
#: py/runtime.c
msgid "can't convert %q to int"
msgstr "no se puede convertir %q a int"
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr "no se puede convertir el objeto '%q' a %q implícitamente"
@ -2667,6 +2680,10 @@ msgstr "no se puede convertir el objeto '%q' a %q implícitamente"
msgid "can't convert to %q"
msgstr "no puede convertir a %q"
#: py/runtime.c
msgid "can't convert to int"
msgstr "no se puede convertir a int"
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr "no se puede convertir a str implícitamente"
@ -2870,6 +2887,11 @@ msgstr "los datos deben permitir iteración"
msgid "data must be of equal length"
msgstr "los datos deben ser de igual tamaño"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr "pin de datos #%d en uso"
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr "tipo de dato no comprendido"
@ -3077,8 +3099,8 @@ msgid "full"
msgstr "lleno"
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgstr "la función no tiene argumentos por palabra clave"
msgid "function doesn't take keyword arguments"
msgstr "la función no toma argumentos de tipo keyword"
#: py/argcheck.c
#, c-format
@ -3132,6 +3154,10 @@ msgstr "generador ya se esta ejecutando"
msgid "generator ignored GeneratorExit"
msgstr "generador ignorado GeneratorExit"
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr "el generador genero StopIteration"
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr "graphic debe ser 2048 bytes de largo"
@ -3192,7 +3218,7 @@ msgstr "ensamblador en línea debe ser una función"
#: extmod/ulab/code/ndarray.c
msgid "input and output shapes are not compatible"
msgstr "Formas de entrada y salida no son compactibles"
msgstr "Formas de entrada y salida no son compatibles"
#: extmod/ulab/code/ulab_create.c
msgid "input argument must be an integer, a tuple, or a list"
@ -3515,6 +3541,10 @@ msgstr "yield nativo"
msgid "need more than %d values to unpack"
msgstr "necesita más de %d valores para descomprimir"
#: py/modmath.c
msgid "negative factorial"
msgstr "factorial negativo"
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr "potencia negativa sin float support"
@ -3747,10 +3777,6 @@ msgstr "palette debe ser 32 bytes de largo"
msgid "palette_index should be an int"
msgstr "palette_index deberia ser un int"
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr "parámetro de anotación debe ser un identificador"
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr "los parámetros deben ser registros en secuencia de a2 a a5"
@ -3806,6 +3832,7 @@ msgstr "pow() con 3 argumentos requiere enteros"
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -3833,7 +3860,7 @@ msgstr "presionando ambos botones al inicio.\n"
#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h
msgid "pressing the left button at start up\n"
msgstr ""
msgstr "presione el botón izquierdo al arranque\n"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "pull masks conflict with direction masks"
@ -4192,7 +4219,7 @@ msgstr "formato de código desconocicdo '%c' para objeto de tipo '%q'"
msgid "unknown type"
msgstr "tipo desconocido"
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr "tipo desconocido '%q'"
@ -4331,6 +4358,18 @@ msgstr "zi debe ser de tipo flotante"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi debe ser una forma (n_section,2)"
#~ msgid "Viper functions don't currently support more than 4 arguments"
#~ msgstr "funciones Viper no soportan por el momento, más de 4 argumentos"
#~ msgid "address %08x is not aligned to %d bytes"
#~ msgstr "la dirección %08x no esta alineada a %d bytes"
#~ msgid "function does not take keyword arguments"
#~ msgstr "la función no tiene argumentos por palabra clave"
#~ msgid "parameter annotation must be an identifier"
#~ msgstr "parámetro de anotación debe ser un identificador"
#~ msgid "Total data to write is larger than outgoing_packet_length"
#~ msgstr ""
#~ "Los datos totales a escribir son más grandes que outgoing_packet_length"
@ -4626,9 +4665,6 @@ msgstr "zi debe ser una forma (n_section,2)"
#~ msgid "can't convert to float"
#~ msgstr "no se puede convertir a float"
#~ msgid "can't convert to int"
#~ msgstr "no se puede convertir a int"
#~ msgid "object '%s' is not a tuple or list"
#~ msgstr "el objeto '%s' no es una tupla o lista"

View File

@ -1200,6 +1200,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr "Mali ang %q pin"
@ -1270,6 +1271,11 @@ msgstr ""
msgid "Invalid channel count"
msgstr "Maling bilang ng channel"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr ""
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr "Mali ang direksyon."
@ -2134,6 +2140,14 @@ msgstr ""
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Para lumabas, paki-reset ang board na wala ang "
@ -2326,12 +2340,6 @@ msgstr ""
msgid "Version was invalid"
msgstr ""
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr ""
"Ang mga function ng Viper ay kasalukuyang hindi sumusuporta sa higit sa 4 na "
"argumento"
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr ""
@ -2417,11 +2425,6 @@ msgstr "a bytes-like object ay kailangan"
msgid "abort() called"
msgstr "abort() tinawag"
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr "address %08x ay hindi pantay sa %d bytes"
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr "wala sa sakop ang address"
@ -2430,6 +2433,10 @@ msgstr "wala sa sakop ang address"
msgid "addresses is empty"
msgstr "walang laman ang address"
#: py/compile.c
msgid "annotation must be an identifier"
msgstr ""
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "arg ay walang laman na sequence"
@ -2614,6 +2621,10 @@ msgstr "hindi ma i-assign sa expression"
msgid "can't convert %q to %q"
msgstr ""
#: py/runtime.c
msgid "can't convert %q to int"
msgstr ""
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr "hindi maaaring i-convert ang '%q' na bagay sa %q nang walang pahiwatig"
@ -2622,6 +2633,10 @@ msgstr "hindi maaaring i-convert ang '%q' na bagay sa %q nang walang pahiwatig"
msgid "can't convert to %q"
msgstr ""
#: py/runtime.c
msgid "can't convert to int"
msgstr "hindi ma-convert sa int"
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr "hindi ma i-convert sa string ng walang pahiwatig"
@ -2825,6 +2840,11 @@ msgstr ""
msgid "data must be of equal length"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr ""
@ -3035,8 +3055,8 @@ msgid "full"
msgstr "puno"
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgstr "ang function ay hindi kumukuha ng mga argumento ng keyword"
msgid "function doesn't take keyword arguments"
msgstr ""
#: py/argcheck.c
#, c-format
@ -3091,6 +3111,10 @@ msgstr "insinasagawa na ng generator"
msgid "generator ignored GeneratorExit"
msgstr "hindi pinansin ng generator ang GeneratorExit"
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr ""
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr "graphic ay dapat 2048 bytes ang haba"
@ -3474,6 +3498,10 @@ msgstr "native yield"
msgid "need more than %d values to unpack"
msgstr "kailangan ng higit sa %d na halaga upang i-unpack"
#: py/modmath.c
msgid "negative factorial"
msgstr ""
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr "negatibong power na walang float support"
@ -3704,10 +3732,6 @@ msgstr "ang palette ay dapat 32 bytes ang haba"
msgid "palette_index should be an int"
msgstr "palette_index ay dapat na int"
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr "parameter annotation ay dapat na identifier"
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr "ang mga parameter ay dapat na nagrerehistro sa sequence a2 hanggang a5"
@ -3764,6 +3788,7 @@ msgstr "pow() na may 3 argumento kailangan ng integers"
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -4151,7 +4176,7 @@ msgstr ""
msgid "unknown type"
msgstr "hindi malaman ang type (unknown type)"
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr "hindi malaman ang type '%q'"
@ -4292,6 +4317,20 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid "Viper functions don't currently support more than 4 arguments"
#~ msgstr ""
#~ "Ang mga function ng Viper ay kasalukuyang hindi sumusuporta sa higit sa 4 "
#~ "na argumento"
#~ msgid "address %08x is not aligned to %d bytes"
#~ msgstr "address %08x ay hindi pantay sa %d bytes"
#~ msgid "function does not take keyword arguments"
#~ msgstr "ang function ay hindi kumukuha ng mga argumento ng keyword"
#~ msgid "parameter annotation must be an identifier"
#~ msgstr "parameter annotation ay dapat na identifier"
#~ msgid "buffer must be a bytes-like object"
#~ msgstr "buffer ay dapat bytes-like object"
@ -4369,9 +4408,6 @@ msgstr ""
#~ msgid "can't convert to float"
#~ msgstr "hindi ma-convert sa float"
#~ msgid "can't convert to int"
#~ msgstr "hindi ma-convert sa int"
#~ msgid "object '%s' is not a tuple or list"
#~ msgstr "object '%s' ay hindi tuple o list"

View File

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-04-20 16:02+0000\n"
"PO-Revision-Date: 2021-04-24 14:29+0000\n"
"Last-Translator: Hugo Dahl <hugo@code-jedi.com>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
@ -1231,6 +1231,7 @@ msgstr "%q invalide"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr "Broche invalide pour '%q'"
@ -1301,6 +1302,11 @@ msgstr "Période de capture invalide. Portée valide : 1 à 500"
msgid "Invalid channel count"
msgstr "Nombre de canaux invalide"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr "data_count invalide %d"
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr "Direction invalide."
@ -2191,6 +2197,14 @@ msgstr "L'heure est dans le passé."
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr "Le délai est trop long : le délai maximal est de %d secondes"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr "Délais expiré en attandant DRDY"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr "Délais expiré en attandant VSYNC"
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Pour quitter, SVP redémarrez la carte sans "
@ -2210,7 +2224,7 @@ msgstr "Trop d'affichages"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Total data to write is larger than %q"
msgstr ""
msgstr "Quantité de données à écrire est plus que %q"
#: py/obj.c
msgid "Traceback (most recent call last):\n"
@ -2387,11 +2401,6 @@ msgstr "Longueur de la valeur > max_length"
msgid "Version was invalid"
msgstr "Version est invalide"
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr ""
"les fonctions de Viper ne supportent pas plus de 4 arguments actuellement"
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr "La lecture de la tension a expiré"
@ -2480,11 +2489,6 @@ msgstr "un objet 'bytes-like' est requis"
msgid "abort() called"
msgstr "abort() appelé"
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr "l'adresse %08x n'est pas alignée sur %d octets"
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr "adresse hors limites"
@ -2493,6 +2497,10 @@ msgstr "adresse hors limites"
msgid "addresses is empty"
msgstr "adresses vides"
#: py/compile.c
msgid "annotation must be an identifier"
msgstr "l'annotation doit être un identificateur"
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "l'argument est une séquence vide"
@ -2676,6 +2684,10 @@ msgstr "ne peut pas assigner à une expression"
msgid "can't convert %q to %q"
msgstr "impossible de convertir %q en %q"
#: py/runtime.c
msgid "can't convert %q to int"
msgstr "ne peut convertir %q à int"
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr "impossible de convertir l'objet '%q' en '%q' implicitement"
@ -2684,6 +2696,10 @@ msgstr "impossible de convertir l'objet '%q' en '%q' implicitement"
msgid "can't convert to %q"
msgstr "impossible de convertir en %q"
#: py/runtime.c
msgid "can't convert to int"
msgstr "ne peut convertir en entier 'int'"
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr "impossible de convertir en chaine 'str' implicitement"
@ -2891,6 +2907,11 @@ msgstr "les données doivent être les objets iterables"
msgid "data must be of equal length"
msgstr "les données doivent être de longueur égale"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr "broche de donnée #%d utilisée"
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr "le type de donnée n'est pas reconnu"
@ -3101,8 +3122,8 @@ msgid "full"
msgstr "plein"
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgstr "la fonction ne prend pas d'arguments nommés"
msgid "function doesn't take keyword arguments"
msgstr "la fonction n'accepte pas de paramètre nommés"
#: py/argcheck.c
#, c-format
@ -3156,6 +3177,10 @@ msgstr "générateur déjà en cours d'exécution"
msgid "generator ignored GeneratorExit"
msgstr "le générateur a ignoré GeneratorExit"
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr "générateur (generator) à surlevé StopIteration"
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr "graphic doit être long de 2048 octets"
@ -3540,6 +3565,10 @@ msgstr "'yield' natif"
msgid "need more than %d values to unpack"
msgstr "nécessite plus de %d valeurs à dégrouper"
#: py/modmath.c
msgid "negative factorial"
msgstr "factoriel négatif"
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr "puissance négative sans support des nombres à virgule flottante"
@ -3773,10 +3802,6 @@ msgstr "la palette doit être longue de 32 octets"
msgid "palette_index should be an int"
msgstr "palette_index devrait être un entier 'int'"
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr "l'annotation du paramètre doit être un identifiant"
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr "les paramètres doivent être des registres dans la séquence a2 à a5"
@ -3833,6 +3858,7 @@ msgstr "pow() avec 3 arguments nécessite des entiers"
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -4219,7 +4245,7 @@ msgstr "code de formatage inconnu '%c' pour objet de type '%q'"
msgid "unknown type"
msgstr "type inconnu"
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr "type '%q' inconnu"
@ -4358,6 +4384,19 @@ msgstr "zi doit être de type float"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi doit être de forme (n_section, 2)"
#~ msgid "Viper functions don't currently support more than 4 arguments"
#~ msgstr ""
#~ "les fonctions de Viper ne supportent pas plus de 4 arguments actuellement"
#~ msgid "address %08x is not aligned to %d bytes"
#~ msgstr "l'adresse %08x n'est pas alignée sur %d octets"
#~ msgid "function does not take keyword arguments"
#~ msgstr "la fonction ne prend pas d'arguments nommés"
#~ msgid "parameter annotation must be an identifier"
#~ msgstr "l'annotation du paramètre doit être un identifiant"
#~ msgid "Total data to write is larger than outgoing_packet_length"
#~ msgstr ""
#~ "Le nombre total de données à écrire est supérieur à outgoing_packet_length"
@ -4655,9 +4694,6 @@ msgstr "zi doit être de forme (n_section, 2)"
#~ msgid "can't convert to float"
#~ msgstr "ne peut convertir en nombre à virgule flottante 'float'"
#~ msgid "can't convert to int"
#~ msgstr "ne peut convertir en entier 'int'"
#~ msgid "object '%s' is not a tuple or list"
#~ msgstr "l'objet '%s' n'est pas un tuple ou une liste"

View File

@ -1185,6 +1185,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr ""
@ -1255,6 +1256,11 @@ msgstr ""
msgid "Invalid channel count"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr ""
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr ""
@ -2114,6 +2120,14 @@ msgstr ""
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr ""
@ -2304,10 +2318,6 @@ msgstr ""
msgid "Version was invalid"
msgstr ""
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr ""
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr ""
@ -2387,11 +2397,6 @@ msgstr ""
msgid "abort() called"
msgstr ""
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr ""
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr ""
@ -2400,6 +2405,10 @@ msgstr ""
msgid "addresses is empty"
msgstr ""
#: py/compile.c
msgid "annotation must be an identifier"
msgstr ""
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr ""
@ -2582,6 +2591,10 @@ msgstr ""
msgid "can't convert %q to %q"
msgstr ""
#: py/runtime.c
msgid "can't convert %q to int"
msgstr ""
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr ""
@ -2590,6 +2603,10 @@ msgstr ""
msgid "can't convert to %q"
msgstr ""
#: py/runtime.c
msgid "can't convert to int"
msgstr ""
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr ""
@ -2788,6 +2805,11 @@ msgstr ""
msgid "data must be of equal length"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr ""
@ -2993,7 +3015,7 @@ msgid "full"
msgstr ""
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgid "function doesn't take keyword arguments"
msgstr ""
#: py/argcheck.c
@ -3048,6 +3070,10 @@ msgstr ""
msgid "generator ignored GeneratorExit"
msgstr ""
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr ""
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr ""
@ -3427,6 +3453,10 @@ msgstr ""
msgid "need more than %d values to unpack"
msgstr ""
#: py/modmath.c
msgid "negative factorial"
msgstr ""
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr ""
@ -3656,10 +3686,6 @@ msgstr ""
msgid "palette_index should be an int"
msgstr ""
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr ""
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr ""
@ -3715,6 +3741,7 @@ msgstr ""
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -4098,7 +4125,7 @@ msgstr ""
msgid "unknown type"
msgstr ""
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr ""

View File

@ -1209,6 +1209,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr "Pin %q non valido"
@ -1281,6 +1282,11 @@ msgstr "periodo di cattura invalido. Zona valida: 1 - 500"
msgid "Invalid channel count"
msgstr "Argomento non valido"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr ""
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr "Direzione non valida."
@ -2155,6 +2161,14 @@ msgstr ""
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Per uscire resettare la scheda senza "
@ -2347,10 +2361,6 @@ msgstr ""
msgid "Version was invalid"
msgstr ""
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr "Le funzioni Viper non supportano più di 4 argomenti al momento"
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr ""
@ -2430,11 +2440,6 @@ msgstr "un oggetto byte-like è richiesto"
msgid "abort() called"
msgstr "abort() chiamato"
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr "l'indirizzo %08x non è allineato a %d bytes"
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr "indirizzo fuori limite"
@ -2443,6 +2448,10 @@ msgstr "indirizzo fuori limite"
msgid "addresses is empty"
msgstr "gli indirizzi sono vuoti"
#: py/compile.c
msgid "annotation must be an identifier"
msgstr ""
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "l'argomento è una sequenza vuota"
@ -2629,6 +2638,10 @@ msgstr "impossibile assegnare all'espressione"
msgid "can't convert %q to %q"
msgstr ""
#: py/runtime.c
msgid "can't convert %q to int"
msgstr ""
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr "impossibile convertire l'oggetto '%q' implicitamente in %q"
@ -2637,6 +2650,10 @@ msgstr "impossibile convertire l'oggetto '%q' implicitamente in %q"
msgid "can't convert to %q"
msgstr ""
#: py/runtime.c
msgid "can't convert to int"
msgstr "non è possibile convertire a int"
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr "impossibile convertire a stringa implicitamente"
@ -2837,6 +2854,11 @@ msgstr ""
msgid "data must be of equal length"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr ""
@ -3046,8 +3068,8 @@ msgid "full"
msgstr "pieno"
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgstr "la funzione non prende argomenti nominati"
msgid "function doesn't take keyword arguments"
msgstr ""
#: py/argcheck.c
#, c-format
@ -3102,6 +3124,10 @@ msgstr ""
msgid "generator ignored GeneratorExit"
msgstr ""
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr ""
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr "graphic deve essere lunga 2048 byte"
@ -3486,6 +3512,10 @@ msgstr "yield nativo"
msgid "need more than %d values to unpack"
msgstr "necessari più di %d valori da scompattare"
#: py/modmath.c
msgid "negative factorial"
msgstr ""
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr "potenza negativa senza supporto per float"
@ -3720,10 +3750,6 @@ msgstr "la palette deve essere lunga 32 byte"
msgid "palette_index should be an int"
msgstr "palette_index deve essere un int"
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr ""
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr "parametri devono essere i registri in sequenza da a2 a a5"
@ -3781,6 +3807,7 @@ msgstr "pow() con 3 argomenti richiede interi"
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -4168,7 +4195,7 @@ msgstr ""
msgid "unknown type"
msgstr "tipo sconosciuto"
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr "tipo '%q' sconosciuto"
@ -4309,6 +4336,15 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid "Viper functions don't currently support more than 4 arguments"
#~ msgstr "Le funzioni Viper non supportano più di 4 argomenti al momento"
#~ msgid "address %08x is not aligned to %d bytes"
#~ msgstr "l'indirizzo %08x non è allineato a %d bytes"
#~ msgid "function does not take keyword arguments"
#~ msgstr "la funzione non prende argomenti nominati"
#~ msgid "Attempted heap allocation when MicroPython VM not running."
#~ msgstr "Provo l'allocazione quando MicroPython VM non è attivo."
@ -4386,9 +4422,6 @@ msgstr ""
#~ msgid "can't convert to float"
#~ msgstr "non è possibile convertire a float"
#~ msgid "can't convert to int"
#~ msgstr "non è possibile convertire a int"
#~ msgid "object '%s' is not a tuple or list"
#~ msgstr "oggetto '%s' non è una tupla o una lista"

View File

@ -1198,6 +1198,7 @@ msgstr "不正な %q"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr "不正な%qピン"
@ -1268,6 +1269,11 @@ msgstr "不正なキャプチャ周期。有効な周期は1-500"
msgid "Invalid channel count"
msgstr "不正なチャンネル数"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr ""
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr "不正な方向"
@ -2136,6 +2142,14 @@ msgstr ""
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr "タイムアウトが長すぎです。最大のタイムアウト長は%d秒"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr ""
@ -2327,10 +2341,6 @@ msgstr ""
msgid "Version was invalid"
msgstr ""
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr ""
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr "電圧読み取りがタイムアウト"
@ -2410,11 +2420,6 @@ msgstr "bytes-likeオブジェクトが必要"
msgid "abort() called"
msgstr "abort()が呼ばれました"
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr ""
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr "アドレスが範囲外"
@ -2423,6 +2428,10 @@ msgstr "アドレスが範囲外"
msgid "addresses is empty"
msgstr ""
#: py/compile.c
msgid "annotation must be an identifier"
msgstr ""
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr ""
@ -2605,6 +2614,10 @@ msgstr "式には代入できません"
msgid "can't convert %q to %q"
msgstr "%qを%qに変換できません"
#: py/runtime.c
msgid "can't convert %q to int"
msgstr ""
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr "オブジェクト '%q' を %q に暗黙に変換できません"
@ -2613,6 +2626,10 @@ msgstr "オブジェクト '%q' を %q に暗黙に変換できません"
msgid "can't convert to %q"
msgstr "%q に変換できません"
#: py/runtime.c
msgid "can't convert to int"
msgstr ""
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr ""
@ -2813,6 +2830,11 @@ msgstr "dataはイテレート可能でなければなりません"
msgid "data must be of equal length"
msgstr "dataは同じ長さでなければなりません"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr ""
@ -3020,7 +3042,7 @@ msgid "full"
msgstr ""
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgid "function doesn't take keyword arguments"
msgstr ""
#: py/argcheck.c
@ -3075,6 +3097,10 @@ msgstr ""
msgid "generator ignored GeneratorExit"
msgstr ""
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr ""
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr "graphicは2048バイトでなければなりません"
@ -3455,6 +3481,10 @@ msgstr ""
msgid "need more than %d values to unpack"
msgstr "アンパックする値は%d個では足りません"
#: py/modmath.c
msgid "negative factorial"
msgstr ""
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr ""
@ -3684,10 +3714,6 @@ msgstr "パレットの長さは32バイトでなければなりません"
msgid "palette_index should be an int"
msgstr "palette_indexには整数が必要"
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr "引数アノテーションは識別子でなければなりません"
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr ""
@ -3745,6 +3771,7 @@ msgstr "pow()の第3引数には整数が必要"
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -4129,7 +4156,7 @@ msgstr "型'%q'のオブジェクトに対する不明な書式コード'%c'"
msgid "unknown type"
msgstr "不明な型"
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr "不明な型 '%q'"
@ -4268,6 +4295,9 @@ msgstr "ziはfloat値でなければなりません"
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid "parameter annotation must be an identifier"
#~ msgstr "引数アノテーションは識別子でなければなりません"
#~ msgid "buffer must be a bytes-like object"
#~ msgstr "バッファはbytes-likeオブジェクトでなければなりません"

View File

@ -1188,6 +1188,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr ""
@ -1258,6 +1259,11 @@ msgstr ""
msgid "Invalid channel count"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr ""
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr ""
@ -2117,6 +2123,14 @@ msgstr ""
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr ""
@ -2308,10 +2322,6 @@ msgstr ""
msgid "Version was invalid"
msgstr ""
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr ""
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr ""
@ -2391,11 +2401,6 @@ msgstr ""
msgid "abort() called"
msgstr ""
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr ""
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr ""
@ -2404,6 +2409,10 @@ msgstr ""
msgid "addresses is empty"
msgstr ""
#: py/compile.c
msgid "annotation must be an identifier"
msgstr ""
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr ""
@ -2586,6 +2595,10 @@ msgstr ""
msgid "can't convert %q to %q"
msgstr ""
#: py/runtime.c
msgid "can't convert %q to int"
msgstr ""
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr ""
@ -2594,6 +2607,10 @@ msgstr ""
msgid "can't convert to %q"
msgstr ""
#: py/runtime.c
msgid "can't convert to int"
msgstr ""
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr ""
@ -2792,6 +2809,11 @@ msgstr ""
msgid "data must be of equal length"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr ""
@ -2997,7 +3019,7 @@ msgid "full"
msgstr "완전한(full)"
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgid "function doesn't take keyword arguments"
msgstr ""
#: py/argcheck.c
@ -3052,6 +3074,10 @@ msgstr ""
msgid "generator ignored GeneratorExit"
msgstr ""
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr ""
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr ""
@ -3431,6 +3457,10 @@ msgstr ""
msgid "need more than %d values to unpack"
msgstr ""
#: py/modmath.c
msgid "negative factorial"
msgstr ""
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr ""
@ -3660,10 +3690,6 @@ msgstr ""
msgid "palette_index should be an int"
msgstr ""
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr ""
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr ""
@ -3719,6 +3745,7 @@ msgstr ""
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -4102,7 +4129,7 @@ msgstr ""
msgid "unknown type"
msgstr ""
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr ""

View File

@ -1199,6 +1199,7 @@ msgstr "Ongeldige %q"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr "Ongeldige %q pin"
@ -1269,6 +1270,11 @@ msgstr "Ongeldige vastlegging periode. Geldig bereik: 1 - 500"
msgid "Invalid channel count"
msgstr "Ongeldige kanaal aantallen"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr ""
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr "Ongeldige richting."
@ -2154,6 +2160,14 @@ msgstr "Tijdstip ligt in het verleden."
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr "Time-out is te lang. Maximale time-out lengte is %d seconden"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Om te beëindigen, reset het bord zonder "
@ -2346,10 +2360,6 @@ msgstr "Waarde length > max_length"
msgid "Version was invalid"
msgstr ""
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr "Viper-functies ondersteunen momenteel niet meer dan 4 argumenten"
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr "Voltage lees time-out"
@ -2438,11 +2448,6 @@ msgstr "een bytes-achtig object is vereist"
msgid "abort() called"
msgstr "abort() aangeroepen"
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr "adres %08x is niet afgestemd op %d bytes"
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr "adres buiten bereik"
@ -2451,6 +2456,10 @@ msgstr "adres buiten bereik"
msgid "addresses is empty"
msgstr "adressen zijn leeg"
#: py/compile.c
msgid "annotation must be an identifier"
msgstr ""
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "arg is een lege sequentie"
@ -2634,6 +2643,10 @@ msgstr "kan niet toewijzen aan expressie"
msgid "can't convert %q to %q"
msgstr "kan %q niet naar %q converteren"
#: py/runtime.c
msgid "can't convert %q to int"
msgstr ""
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr "kan '%q' object niet omzetten naar %q impliciet"
@ -2642,6 +2655,10 @@ msgstr "kan '%q' object niet omzetten naar %q impliciet"
msgid "can't convert to %q"
msgstr "kan niet naar %q converteren"
#: py/runtime.c
msgid "can't convert to int"
msgstr "kan niet omzetten naar int"
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr "kan niet omzetten naar str impliciet"
@ -2841,6 +2858,11 @@ msgstr "data moet itereerbaar zijn"
msgid "data must be of equal length"
msgstr "data moet van gelijke lengte zijn"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr ""
@ -3048,8 +3070,8 @@ msgid "full"
msgstr "vol"
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgstr "functie accepteert geen keyword argumenten"
msgid "function doesn't take keyword arguments"
msgstr ""
#: py/argcheck.c
#, c-format
@ -3104,6 +3126,10 @@ msgstr "generator wordt al uitgevoerd"
msgid "generator ignored GeneratorExit"
msgstr "generator negeerde GeneratorExit"
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr ""
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr "graphic moet 2048 bytes lang zijn"
@ -3486,6 +3512,10 @@ msgstr "natuurlijke opbrengst (native yield)"
msgid "need more than %d values to unpack"
msgstr "Om uit te pakken zijn meer dan %d waarden vereist"
#: py/modmath.c
msgid "negative factorial"
msgstr ""
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr "negatieve macht terwijl er geen ondersteuning is voor float"
@ -3715,10 +3745,6 @@ msgstr "palette moet 32 bytes lang zijn"
msgid "palette_index should be an int"
msgstr "palette_index moet een int zijn"
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr "parameter annotatie moet een identifier zijn"
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr "parameters moeten registers zijn in de volgorde a2 tot a5"
@ -3775,6 +3801,7 @@ msgstr "pow() met 3 argumenten vereist integers"
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -4160,7 +4187,7 @@ msgstr "onbekende formaatcode '%c' voor object van type '%q'"
msgid "unknown type"
msgstr "onbekend type"
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr "onbekend type '%q'"
@ -4299,6 +4326,18 @@ msgstr "zi moet van type float zijn"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi moet vorm (n_section, 2) hebben"
#~ msgid "Viper functions don't currently support more than 4 arguments"
#~ msgstr "Viper-functies ondersteunen momenteel niet meer dan 4 argumenten"
#~ msgid "address %08x is not aligned to %d bytes"
#~ msgstr "adres %08x is niet afgestemd op %d bytes"
#~ msgid "function does not take keyword arguments"
#~ msgstr "functie accepteert geen keyword argumenten"
#~ msgid "parameter annotation must be an identifier"
#~ msgstr "parameter annotatie moet een identifier zijn"
#~ msgid "Total data to write is larger than outgoing_packet_length"
#~ msgstr "Totale data om te schrijven is groter dan outgoing_packet_length"
@ -4569,9 +4608,6 @@ msgstr "zi moet vorm (n_section, 2) hebben"
#~ msgid "can't convert to float"
#~ msgstr "kan niet omzetten naar float"
#~ msgid "can't convert to int"
#~ msgstr "kan niet omzetten naar int"
#~ msgid "object '%s' is not a tuple or list"
#~ msgstr "object '%s' is geen tuple of lijst"

View File

@ -1198,6 +1198,7 @@ msgstr "Nieprawidłowe %q"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr "Zła nóżka %q"
@ -1268,6 +1269,11 @@ msgstr "Zły okres. Poprawny zakres to: 1 - 500"
msgid "Invalid channel count"
msgstr "Zła liczba kanałów"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr ""
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr "Nieprawidłowy kierunek."
@ -2127,6 +2133,14 @@ msgstr ""
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "By wyjść, proszę zresetować płytkę bez "
@ -2317,10 +2331,6 @@ msgstr ""
msgid "Version was invalid"
msgstr ""
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr "Funkcje Viper nie obsługują obecnie więcej niż 4 argumentów"
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr ""
@ -2406,11 +2416,6 @@ msgstr "wymagany obiekt typu bytes"
msgid "abort() called"
msgstr "Wywołano abort()"
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr "adres %08x nie jest wyrównany do %d bajtów"
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr "adres poza zakresem"
@ -2419,6 +2424,10 @@ msgstr "adres poza zakresem"
msgid "addresses is empty"
msgstr "adres jest pusty"
#: py/compile.c
msgid "annotation must be an identifier"
msgstr ""
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "arg jest puste"
@ -2601,6 +2610,10 @@ msgstr "przypisanie do wyrażenia"
msgid "can't convert %q to %q"
msgstr "nie można dokonać konwersji %q na %q"
#: py/runtime.c
msgid "can't convert %q to int"
msgstr ""
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr "nie można automatycznie skonwertować '%q' do '%q'"
@ -2609,6 +2622,10 @@ msgstr "nie można automatycznie skonwertować '%q' do '%q'"
msgid "can't convert to %q"
msgstr ""
#: py/runtime.c
msgid "can't convert to int"
msgstr "nie można skonwertować do int"
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr "nie można automatycznie skonwertować do str"
@ -2807,6 +2824,11 @@ msgstr ""
msgid "data must be of equal length"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr ""
@ -3013,8 +3035,8 @@ msgid "full"
msgstr "pełny"
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgstr "funkcja nie bierze argumentów nazwanych"
msgid "function doesn't take keyword arguments"
msgstr ""
#: py/argcheck.c
#, c-format
@ -3068,6 +3090,10 @@ msgstr "generator już się wykonuje"
msgid "generator ignored GeneratorExit"
msgstr "generator zignorował GeneratorExit"
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr ""
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr "graphic musi mieć 2048 bajtów długości"
@ -3447,6 +3473,10 @@ msgstr "natywny yield"
msgid "need more than %d values to unpack"
msgstr "potrzeba więcej niż %d do rozpakowania"
#: py/modmath.c
msgid "negative factorial"
msgstr ""
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr "ujemna potęga, ale brak obsługi liczb zmiennoprzecinkowych"
@ -3676,10 +3706,6 @@ msgstr "paleta musi mieć 32 bajty długości"
msgid "palette_index should be an int"
msgstr "palette_index powinien być całkowity"
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr "anotacja parametru musi być identyfikatorem"
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr "parametry muszą być rejestrami w kolejności a2 do a5"
@ -3736,6 +3762,7 @@ msgstr "trzyargumentowe pow() wymaga liczb całkowitych"
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -4120,7 +4147,7 @@ msgstr ""
msgid "unknown type"
msgstr "zły typ"
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr "zły typ '%q'"
@ -4259,6 +4286,18 @@ msgstr ""
msgid "zi must be of shape (n_section, 2)"
msgstr ""
#~ msgid "Viper functions don't currently support more than 4 arguments"
#~ msgstr "Funkcje Viper nie obsługują obecnie więcej niż 4 argumentów"
#~ msgid "address %08x is not aligned to %d bytes"
#~ msgstr "adres %08x nie jest wyrównany do %d bajtów"
#~ msgid "function does not take keyword arguments"
#~ msgstr "funkcja nie bierze argumentów nazwanych"
#~ msgid "parameter annotation must be an identifier"
#~ msgstr "anotacja parametru musi być identyfikatorem"
#~ msgid "buffer must be a bytes-like object"
#~ msgstr "bufor mysi być typu bytes"
@ -4400,9 +4439,6 @@ msgstr ""
#~ msgid "can't convert to float"
#~ msgstr "nie można skonwertować do float"
#~ msgid "can't convert to int"
#~ msgstr "nie można skonwertować do int"
#~ msgid "object '%s' is not a tuple or list"
#~ msgstr "obiekt '%s' nie jest krotką ani listą"

View File

@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-04-19 21:50+0000\n"
"PO-Revision-Date: 2021-04-25 18:43+0000\n"
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
"Language-Team: \n"
"Language: pt_BR\n"
@ -1222,6 +1222,7 @@ msgstr "%q Inválido"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr "Pino do %q inválido"
@ -1292,6 +1293,11 @@ msgstr "O período de captura é inválido. O intervalo válido é: 1 - 500"
msgid "Invalid channel count"
msgstr "A contagem do canal é inválido"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr "data_count %d inválido"
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr "Direção inválida."
@ -2186,6 +2192,14 @@ msgstr ""
"O tempo limite é long demais: O comprimento máximo do tempo limite é de %d "
"segundos"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr "Esgotou-se o tempo limite de espera pelo DRDY"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr "Esgotou-se o tempo de espera pelo VSYNC"
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Para sair, por favor, reinicie a placa sem "
@ -2205,7 +2219,7 @@ msgstr "Exibições demais"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Total data to write is larger than %q"
msgstr ""
msgstr "O total dos dados que serão escritos é maior do que %q"
#: py/obj.c
msgid "Traceback (most recent call last):\n"
@ -2378,10 +2392,6 @@ msgstr "O comprimento do valor é > max_length"
msgid "Version was invalid"
msgstr "A versão era inválida"
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr "Atualmente, as funções do Viper não suportam mais de 4 argumentos"
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr "O tempo limite de leitura da tensão expirou"
@ -2471,11 +2481,6 @@ msgstr "é necessário objetos tipo bytes"
msgid "abort() called"
msgstr "abort() chamado"
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr "endereço %08x não está alinhado com %d bytes"
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr "endereço fora dos limites"
@ -2484,6 +2489,10 @@ msgstr "endereço fora dos limites"
msgid "addresses is empty"
msgstr "os endereços estão vazios"
#: py/compile.c
msgid "annotation must be an identifier"
msgstr "a anotação deve ser um identificador"
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "o arg é uma sequência vazia"
@ -2666,6 +2675,10 @@ msgstr "a expressão não pode ser atribuída"
msgid "can't convert %q to %q"
msgstr "não é possível converter %q para %q"
#: py/runtime.c
msgid "can't convert %q to int"
msgstr "Não é possível converter %q para int"
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr "não é possível converter implicitamente o objeto '%q' para %q"
@ -2674,6 +2687,10 @@ msgstr "não é possível converter implicitamente o objeto '%q' para %q"
msgid "can't convert to %q"
msgstr "não é possível converter para %q"
#: py/runtime.c
msgid "can't convert to int"
msgstr "não é possível converter para int"
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr "não é possível converter implicitamente para str"
@ -2878,6 +2895,11 @@ msgstr "os dados devem ser iteráveis"
msgid "data must be of equal length"
msgstr "os dados devem ser de igual comprimento"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr "o pino de dados #%d está em uso"
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr "o tipo do dado não foi compreendido"
@ -3086,8 +3108,8 @@ msgid "full"
msgstr "cheio"
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgstr "função não aceita argumentos de palavras-chave"
msgid "function doesn't take keyword arguments"
msgstr "a função não aceita palavras-chave como argumentos"
#: py/argcheck.c
#, c-format
@ -3141,6 +3163,10 @@ msgstr "o gerador já está em execução"
msgid "generator ignored GeneratorExit"
msgstr "ignorando o gerador GeneratorExit"
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr "gerador StopIteration elevado"
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr "o gráfico deve ter 2048 bytes de comprimento"
@ -3526,6 +3552,10 @@ msgstr "rendimento nativo"
msgid "need more than %d values to unpack"
msgstr "precisa de mais de %d valores para desempacotar"
#: py/modmath.c
msgid "negative factorial"
msgstr "fatorial negativo"
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr "potência negativa sem suporte de flutuação"
@ -3760,10 +3790,6 @@ msgstr "a paleta deve ter 32 bytes de comprimento"
msgid "palette_index should be an int"
msgstr "palette_index deve ser um int"
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr "a anotação do parâmetro deve ser um identificador"
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr "os parâmetros devem ser registradores na sequência a2 até a5"
@ -3819,6 +3845,7 @@ msgstr "o pow() com 3 argumentos requer números inteiros"
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -4204,7 +4231,7 @@ msgstr "o formato do código '%c' é desconhecido para o objeto do tipo '%q'"
msgid "unknown type"
msgstr "tipo desconhecido"
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr "tipo desconhecido '%q'"
@ -4343,6 +4370,18 @@ msgstr "zi deve ser de um tipo float"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi deve estar na forma (n_section, 2)"
#~ msgid "Viper functions don't currently support more than 4 arguments"
#~ msgstr "Atualmente, as funções do Viper não suportam mais de 4 argumentos"
#~ msgid "address %08x is not aligned to %d bytes"
#~ msgstr "endereço %08x não está alinhado com %d bytes"
#~ msgid "function does not take keyword arguments"
#~ msgstr "função não aceita argumentos de palavras-chave"
#~ msgid "parameter annotation must be an identifier"
#~ msgstr "a anotação do parâmetro deve ser um identificador"
#~ msgid "Total data to write is larger than outgoing_packet_length"
#~ msgstr ""
#~ "O total dos dados que serão gravados é maior que outgoing_packet_length"
@ -4665,9 +4704,6 @@ msgstr "zi deve estar na forma (n_section, 2)"
#~ msgid "can't convert to float"
#~ msgstr "não é possível converter para float"
#~ msgid "can't convert to int"
#~ msgstr "não é possível converter para int"
#~ msgid "object '%s' is not a tuple or list"
#~ msgstr "o objeto '%s' não é uma tupla ou uma lista"

View File

@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-04-19 21:50+0000\n"
"PO-Revision-Date: 2021-04-24 14:29+0000\n"
"Last-Translator: Jonny Bergdahl <jonny@bergdahl.it>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: sv\n"
@ -1206,6 +1206,7 @@ msgstr "Ogiltig %q"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr "Ogiltig %q-pinne"
@ -1276,6 +1277,11 @@ msgstr "Ogiltig inspelningsperiod. Giltigt intervall: 1 - 500"
msgid "Invalid channel count"
msgstr "Ogiltigt kanalantal"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr "Ogiltig data_count %d"
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr "Ogiltig riktning."
@ -2160,6 +2166,14 @@ msgstr "Tid har passerats."
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr "Åtgärden tog för lång tid: Max väntetid är %d sekunder"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr "Timeout i väntan på DRDY"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr "Timeout i väntan på VSYNC"
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "För att avsluta, gör reset på kortet utan "
@ -2179,7 +2193,7 @@ msgstr "För många displayer"
#: ports/nrf/common-hal/_bleio/PacketBuffer.c
msgid "Total data to write is larger than %q"
msgstr ""
msgstr "Totala data att skriva är större än %q"
#: py/obj.c
msgid "Traceback (most recent call last):\n"
@ -2352,10 +2366,6 @@ msgstr "Värdets längd > max_length"
msgid "Version was invalid"
msgstr "Versionen var ogiltig"
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr "Viper-funktioner stöder för närvarande inte mer än fyra argument"
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr "Avläsning av spänning tog för lång tid"
@ -2441,11 +2451,6 @@ msgstr "ett bytesliknande objekt krävs"
msgid "abort() called"
msgstr "abort() anropad"
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr "adressen %08x är inte justerad till %d byte"
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr "adress utanför gränsen"
@ -2454,6 +2459,10 @@ msgstr "adress utanför gränsen"
msgid "addresses is empty"
msgstr "adresserna är tomma"
#: py/compile.c
msgid "annotation must be an identifier"
msgstr "Annoteringen måste vara en identifierare"
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "arg är en tom sekvens"
@ -2636,6 +2645,10 @@ msgstr "kan inte tilldela uttryck"
msgid "can't convert %q to %q"
msgstr "kan inte konvertera %q till %q"
#: py/runtime.c
msgid "can't convert %q to int"
msgstr "kan inte konvertera %q till int"
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr "kan inte konvertera '%q' objekt implicit till %q"
@ -2644,6 +2657,10 @@ msgstr "kan inte konvertera '%q' objekt implicit till %q"
msgid "can't convert to %q"
msgstr "kan inte konvertera till %q"
#: py/runtime.c
msgid "can't convert to int"
msgstr "kan inte konvertera till int"
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr "kan inte implicit konvertera till str"
@ -2844,6 +2861,11 @@ msgstr "data måste vara itererbar"
msgid "data must be of equal length"
msgstr "data måste vara av samma längd"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr "data pin #%d används redan"
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr "datatyp inte förstådd"
@ -3052,7 +3074,7 @@ msgid "full"
msgstr "full"
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgid "function doesn't take keyword arguments"
msgstr "funktionen tar inte nyckelordsargument"
#: py/argcheck.c
@ -3107,6 +3129,10 @@ msgstr "generatorn kör redan"
msgid "generator ignored GeneratorExit"
msgstr "generatorn ignorerade GeneratorExit"
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr "generator kastade StopIteration"
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr "graphic måste vara 2048 byte lång"
@ -3489,6 +3515,10 @@ msgstr "native yield"
msgid "need more than %d values to unpack"
msgstr "behöver mer än %d värden för att packa upp"
#: py/modmath.c
msgid "negative factorial"
msgstr "negativ faktoriell"
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr "negativ exponent utan stöd för flyttal"
@ -3718,10 +3748,6 @@ msgstr "palette måste vara 32 bytes lång"
msgid "palette_index should be an int"
msgstr "palette_index ska vara en int"
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr "parametern annotation måste vara en identifierare"
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr "parametrarna måste registreras i följd a2-a5"
@ -3778,6 +3804,7 @@ msgstr "pow() med 3 argument kräver heltal"
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -4163,7 +4190,7 @@ msgstr "okänd formatkod '%c' för objekt av typ '%q'"
msgid "unknown type"
msgstr "okänd typ"
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr "okänd typ '%q'"
@ -4302,6 +4329,18 @@ msgstr "zi måste vara av typ float"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi måste vara i formen (n_section, 2)"
#~ msgid "Viper functions don't currently support more than 4 arguments"
#~ msgstr "Viper-funktioner stöder för närvarande inte mer än fyra argument"
#~ msgid "address %08x is not aligned to %d bytes"
#~ msgstr "adressen %08x är inte justerad till %d byte"
#~ msgid "function does not take keyword arguments"
#~ msgstr "funktionen tar inte nyckelordsargument"
#~ msgid "parameter annotation must be an identifier"
#~ msgstr "parametern annotation måste vara en identifierare"
#~ msgid "Total data to write is larger than outgoing_packet_length"
#~ msgstr "Total data som ska skrivas är större än outgoing_packet_length"
@ -4604,9 +4643,6 @@ msgstr "zi måste vara i formen (n_section, 2)"
#~ msgid "can't convert to float"
#~ msgstr "kan inte konvertera till float"
#~ msgid "can't convert to int"
#~ msgstr "kan inte konvertera till int"
#~ msgid "object '%s' is not a tuple or list"
#~ msgstr "objektet '%s' är inte en tupel eller lista"

View File

@ -1208,6 +1208,7 @@ msgstr "wú xiào %q"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#: ports/mimxrt10xx/common-hal/busio/UART.c
msgid "Invalid %q pin"
msgstr "Wúxiào de %q yǐn jiǎo"
@ -1278,6 +1279,11 @@ msgstr "Wúxiào de bǔhuò zhōuqí. Yǒuxiào fànwéi: 1-500"
msgid "Invalid channel count"
msgstr "Wúxiào de tōngdào jìshù"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "Invalid data_count %d"
msgstr ""
#: shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid direction."
msgstr "Wúxiào de fāngxiàng."
@ -2157,6 +2163,14 @@ msgstr "shí jiān yǐ jīng guò qù."
msgid "Timeout is too long: Maximum timeout length is %d seconds"
msgstr "Chāoshí shíjiān tài zhǎng: Zuìdà chāoshí shíjiān wèi%d miǎo"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for DRDY"
msgstr ""
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
msgid "Timeout waiting for VSYNC"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "To exit, please reset the board without "
msgstr "Yào tuìchū, qǐng chóng zhì bǎnkuài ér bùyòng "
@ -2349,10 +2363,6 @@ msgstr "Zhí chángdù > zuìdà chángdù"
msgid "Version was invalid"
msgstr "bǎn běn wú xiào"
#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr "Viper hánshù mùqián bù zhīchí chāoguò 4 gè cānshù"
#: ports/stm/common-hal/microcontroller/Processor.c
msgid "Voltage read timed out"
msgstr "Diànyā dòu qǔ chāoshí"
@ -2439,11 +2449,6 @@ msgstr "xūyào yīgè zì jié lèi duìxiàng"
msgid "abort() called"
msgstr "zhōngzhǐ () diàoyòng"
#: extmod/machine_mem.c
#, c-format
msgid "address %08x is not aligned to %d bytes"
msgstr "wèi zhǐ %08x wèi yǔ %d wèi yuán zǔ duìqí"
#: shared-bindings/i2cperipheral/I2CPeripheral.c
msgid "address out of bounds"
msgstr "dìzhǐ chāochū biānjiè"
@ -2452,6 +2457,10 @@ msgstr "dìzhǐ chāochū biānjiè"
msgid "addresses is empty"
msgstr "dìzhǐ wèi kōng"
#: py/compile.c
msgid "annotation must be an identifier"
msgstr ""
#: py/modbuiltins.c
msgid "arg is an empty sequence"
msgstr "cānshù shì yīgè kōng de xùliè"
@ -2634,6 +2643,10 @@ msgstr "bùnéng fēnpèi dào biǎodá shì"
msgid "can't convert %q to %q"
msgstr "Wúfǎ jiāng %q zhuǎnhuàn wèi %q"
#: py/runtime.c
msgid "can't convert %q to int"
msgstr ""
#: py/objstr.c
msgid "can't convert '%q' object to %q implicitly"
msgstr "wúfǎ jiāng '%q' duìxiàng zhuǎnhuàn wèi %q yǐn hán"
@ -2642,6 +2655,10 @@ msgstr "wúfǎ jiāng '%q' duìxiàng zhuǎnhuàn wèi %q yǐn hán"
msgid "can't convert to %q"
msgstr "wúfǎ zhuǎnhuàn wèi %q"
#: py/runtime.c
msgid "can't convert to int"
msgstr "bùnéng zhuǎnhuàn wèi int"
#: py/objstr.c
msgid "can't convert to str implicitly"
msgstr "bùnéng mò shì zhuǎnhuàn wèi str"
@ -2844,6 +2861,11 @@ msgstr "shùjù bìxū shì kě diédài de"
msgid "data must be of equal length"
msgstr "shùjù chángdù bìxū xiāngděng"
#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c
#, c-format
msgid "data pin #%d in use"
msgstr ""
#: extmod/ulab/code/ndarray.c
msgid "data type not understood"
msgstr "wèi lǐ jiě de shù jù lèi xíng"
@ -3051,8 +3073,8 @@ msgid "full"
msgstr "chōngfèn"
#: py/argcheck.c
msgid "function does not take keyword arguments"
msgstr "hánshù méiyǒu guānjiàn cí cānshù"
msgid "function doesn't take keyword arguments"
msgstr ""
#: py/argcheck.c
#, c-format
@ -3106,6 +3128,10 @@ msgstr "shēngchéng qì yǐjīng zhíxíng"
msgid "generator ignored GeneratorExit"
msgstr "shēngchéng qì hūlüè shēngchéng qì tuìchū"
#: py/objgenerator.c
msgid "generator raised StopIteration"
msgstr ""
#: shared-bindings/_stage/Layer.c
msgid "graphic must be 2048 bytes long"
msgstr "túxíng bìxū wèi 2048 zì jié"
@ -3486,6 +3512,10 @@ msgstr "yuán chǎn"
msgid "need more than %d values to unpack"
msgstr "xūyào chāoguò%d de zhí cáinéng jiědú"
#: py/modmath.c
msgid "negative factorial"
msgstr ""
#: py/objint_longlong.c py/objint_mpz.c py/runtime.c
msgid "negative power with no float support"
msgstr "méiyǒu fú diǎn zhīchí de xiāojí gōnglǜ"
@ -3715,10 +3745,6 @@ msgstr "yánsè bìxū shì 32 gè zì jié"
msgid "palette_index should be an int"
msgstr "yánsè suǒyǐn yīnggāi shì yīgè zhěngshù"
#: py/compile.c
msgid "parameter annotation must be an identifier"
msgstr "cānshù zhùshì bìxū shì biāozhì fú"
#: py/emitinlinextensa.c
msgid "parameters must be registers in sequence a2 to a5"
msgstr "cānshù bìxū shì xùliè a2 zhì a5 de dēngjì shù"
@ -3774,6 +3800,7 @@ msgstr "pow() yǒu 3 cānshù xūyào zhěngshù"
#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/artisense_rd00/mpconfigboard.h
#: ports/esp32s2/boards/atmegazero_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
#: ports/esp32s2/boards/espressif_saola_1_wroom/mpconfigboard.h
@ -4159,7 +4186,7 @@ msgstr "lèixíng '%q' de duìxiàng de wèizhī géshì dàimǎ '%c'"
msgid "unknown type"
msgstr "wèizhī lèixíng"
#: py/emitnative.c
#: py/compile.c
msgid "unknown type '%q'"
msgstr "wèizhī lèixíng '%q'"
@ -4298,6 +4325,18 @@ msgstr "zi bìxū wèi fú diǎn xíng"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)"
#~ msgid "Viper functions don't currently support more than 4 arguments"
#~ msgstr "Viper hánshù mùqián bù zhīchí chāoguò 4 gè cānshù"
#~ msgid "address %08x is not aligned to %d bytes"
#~ msgstr "wèi zhǐ %08x wèi yǔ %d wèi yuán zǔ duìqí"
#~ msgid "function does not take keyword arguments"
#~ msgstr "hánshù méiyǒu guānjiàn cí cānshù"
#~ msgid "parameter annotation must be an identifier"
#~ msgstr "cānshù zhùshì bìxū shì biāozhì fú"
#~ msgid "Total data to write is larger than outgoing_packet_length"
#~ msgstr "Yào xiě rù de zǒng shùjù dàyú outgoing_packet_length"
@ -4574,9 +4613,6 @@ msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)"
#~ msgid "can't convert to float"
#~ msgstr "bùnéng zhuǎnhuàn wèi fú diǎn"
#~ msgid "can't convert to int"
#~ msgstr "bùnéng zhuǎnhuàn wèi int"
#~ msgid "object '%s' is not a tuple or list"
#~ msgstr "duìxiàng '%s' bùshì yuán zǔ huò lièbiǎo"

4
main.c
View File

@ -60,6 +60,7 @@
#include "supervisor/shared/translate.h"
#include "supervisor/shared/workflow.h"
#include "supervisor/usb.h"
#include "supervisor/workflow.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Processor.h"
@ -188,7 +189,10 @@ STATIC void stop_mp(void) {
#endif
background_callback_reset();
#if CIRCUITPY_USB
usb_background();
#endif
gc_deinit();
}

View File

@ -13,6 +13,8 @@ override undefine MICROPY_FORCE_32BIT
override undefine CROSS_COMPILE
override undefine FROZEN_DIR
override undefine FROZEN_MPY_DIR
override undefine USER_C_MODULES
override undefine SRC_MOD
override undefine BUILD
override undefine PROG
endif

View File

@ -122,9 +122,6 @@ void gc_collect(void) {
// GC stack (and regs because we captured them)
void **regs_ptr = (void **)(void *)&regs;
gc_collect_root(regs_ptr, ((mp_uint_t)MP_STATE_THREAD(stack_top) - (mp_uint_t)&regs) / sizeof(mp_uint_t));
#if MICROPY_EMIT_NATIVE
mp_unix_mark_exec();
#endif
gc_collect_end();
}

View File

@ -13,6 +13,7 @@
#include "py/runtime.h"
#include "py/gc.h"
#include "py/stackctrl.h"
#include "genhdr/mpversion.h"
#ifdef _WIN32
#include "fmode.h"
#endif
@ -46,9 +47,7 @@ STATIC int compile_and_save(const char *file, const char *output_file, const cha
}
#if MICROPY_PY___FILE__
if (input_kind == MP_PARSE_FILE_INPUT) {
mp_store_global(MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name));
}
mp_store_global(MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name));
#endif
mp_parse_tree_t parse_tree = mp_parse(lex, MP_PARSE_FILE_INPUT);
@ -77,20 +76,22 @@ STATIC int compile_and_save(const char *file, const char *output_file, const cha
STATIC int usage(char **argv) {
printf(
"usage: %s [<opts>] [-X <implopt>] <input filename>\n"
"Options:\n"
"-o : output file for compiled bytecode (defaults to input with .mpy extension)\n"
"-s : source filename to embed in the compiled bytecode (defaults to input file)\n"
"-v : verbose (trace various operations); can be multiple\n"
"-O[N] : apply bytecode optimizations of level N\n"
"\n"
"Target specific options:\n"
"-msmall-int-bits=number : set the maximum bits used to encode a small-int\n"
"-mno-unicode : don't support unicode in compiled strings\n"
"-mcache-lookup-bc : cache map lookups in the bytecode\n"
"\n"
"Implementation specific options:\n", argv[0]
);
"usage: %s [<opts>] [-X <implopt>] <input filename>\n"
"Options:\n"
"--version : show version information\n"
"-o : output file for compiled bytecode (defaults to input with .mpy extension)\n"
"-s : source filename to embed in the compiled bytecode (defaults to input file)\n"
"-v : verbose (trace various operations); can be multiple\n"
"-O[N] : apply bytecode optimizations of level N\n"
"\n"
"Target specific options:\n"
"-msmall-int-bits=number : set the maximum bits used to encode a small-int\n"
"-mno-unicode : don't support unicode in compiled strings\n"
"-mcache-lookup-bc : cache map lookups in the bytecode\n"
"-march=<arch> : set architecture for native emitter; x86, x64, armv6, armv7m, xtensa\n"
"\n"
"Implementation specific options:\n", argv[0]
);
int impl_opts_cnt = 0;
printf(
" emit={bytecode,native,viper} -- set the default code emitter\n"
@ -172,6 +173,15 @@ MP_NOINLINE int main_(int argc, char **argv) {
mp_dynamic_compiler.small_int_bits = 31;
mp_dynamic_compiler.opt_cache_map_lookup_in_bytecode = 0;
mp_dynamic_compiler.py_builtins_str_unicode = 1;
#if defined(__i386__)
mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_X86;
#elif defined(__x86_64__)
mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_X64;
#elif defined(__arm__) && !defined(__thumb2__)
mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_ARMV6;
#else
mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_NONE;
#endif
const char *input_file = NULL;
const char *output_file = NULL;
@ -182,6 +192,10 @@ MP_NOINLINE int main_(int argc, char **argv) {
if (argv[a][0] == '-') {
if (strcmp(argv[a], "-X") == 0) {
a += 1;
} else if (strcmp(argv[a], "--version") == 0) {
printf("MicroPython " MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE
"; mpy-cross emitting mpy v" MP_STRINGIFY(MPY_VERSION) "\n");
return 0;
} else if (strcmp(argv[a], "-v") == 0) {
mp_verbose_flag++;
} else if (strncmp(argv[a], "-O", 2) == 0) {
@ -220,6 +234,21 @@ MP_NOINLINE int main_(int argc, char **argv) {
mp_dynamic_compiler.py_builtins_str_unicode = 0;
} else if (strcmp(argv[a], "-municode") == 0) {
mp_dynamic_compiler.py_builtins_str_unicode = 1;
} else if (strncmp(argv[a], "-march=", sizeof("-march=") - 1) == 0) {
const char *arch = argv[a] + sizeof("-march=") - 1;
if (strcmp(arch, "x86") == 0) {
mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_X86;
} else if (strcmp(arch, "x64") == 0) {
mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_X64;
} else if (strcmp(arch, "armv6") == 0) {
mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_ARMV6;
} else if (strcmp(arch, "armv7m") == 0) {
mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_ARMV7M;
} else if (strcmp(arch, "xtensa") == 0) {
mp_dynamic_compiler.native_arch = MP_NATIVE_ARCH_XTENSA;
} else {
return usage(argv);
}
} else {
return usage(argv);
}

View File

@ -9,13 +9,15 @@
#define MICROPY_PERSISTENT_CODE_LOAD (0)
#define MICROPY_PERSISTENT_CODE_SAVE (1)
#define MICROPY_EMIT_X64 (0)
#define MICROPY_EMIT_X86 (0)
#define MICROPY_EMIT_THUMB (0)
#define MICROPY_EMIT_INLINE_THUMB (0)
#define MICROPY_EMIT_INLINE_THUMB_ARMV7M (0)
#define MICROPY_EMIT_INLINE_THUMB_FLOAT (0)
#define MICROPY_EMIT_ARM (0)
#define MICROPY_EMIT_X64 (1)
#define MICROPY_EMIT_X86 (1)
#define MICROPY_EMIT_THUMB (1)
#define MICROPY_EMIT_INLINE_THUMB (1)
#define MICROPY_EMIT_INLINE_THUMB_ARMV7M (1)
#define MICROPY_EMIT_INLINE_THUMB_FLOAT (1)
#define MICROPY_EMIT_ARM (1)
#define MICROPY_EMIT_XTENSA (1)
#define MICROPY_EMIT_INLINE_XTENSA (1)
#define MICROPY_DYNAMIC_COMPILER (1)
#define MICROPY_COMP_CONST_FOLDING (1)
@ -134,10 +136,6 @@ typedef long mp_off_t;
#define MP_PLAT_PRINT_STRN(str, len) (void)0
#ifndef MP_NOINLINE
#define MP_NOINLINE __attribute__((noinline))
#endif
// We need to provide a declaration/definition of alloca()
#ifdef __FreeBSD__
#include <stdlib.h>

View File

@ -302,18 +302,7 @@ SRC_C += \
eic_handler.c \
fatfs_port.c \
freetouch/adafruit_ptc.c \
lib/libc/string0.c \
lib/mp-readline/readline.c \
lib/oofatfs/ff.c \
lib/oofatfs/option/ccsbcs.c \
lib/timeutils/timeutils.c \
lib/tinyusb/src/portable/microchip/samd/dcd_samd.c \
lib/utils/buffer_helper.c \
lib/utils/context_manager_helpers.c \
lib/utils/interrupt_char.c \
lib/utils/pyexec.c \
lib/utils/stdout_helpers.c \
lib/utils/sys_stdio_mphal.c \
mphalport.c \
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/adc.c \
peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/cache.c \
@ -331,7 +320,6 @@ SRC_C += \
peripherals/samd/sercom.c \
peripherals/samd/timers.c \
reset.c \
supervisor/shared/memory.c \
timer_handler.c \
ifeq ($(CIRCUITPY_SDIOIO),1)
@ -390,6 +378,7 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_SHARED_MODULE_EXPANDED:.c=.o))
ifeq ($(INTERNAL_LIBM),1)
OBJ += $(addprefix $(BUILD)/, $(SRC_LIBM:.c=.o))
endif
OBJ += $(addprefix $(BUILD)/, $(SRC_CIRCUITPY_COMMON:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))

View File

@ -45,7 +45,15 @@ static volatile bool audio_dma_pending[AUDIO_DMA_CHANNEL_COUNT];
static bool audio_dma_allocated[AUDIO_DMA_CHANNEL_COUNT];
uint8_t audio_dma_allocate_channel(void) {
uint8_t find_sync_event_channel_raise() {
uint8_t event_channel = find_sync_event_channel();
if (event_channel >= EVSYS_SYNCH_NUM) {
mp_raise_RuntimeError(translate("All sync event channels in use"));
}
return event_channel;
}
uint8_t dma_allocate_channel(void) {
uint8_t channel;
for (channel = 0; channel < AUDIO_DMA_CHANNEL_COUNT; channel++) {
if (!audio_dma_allocated[channel]) {
@ -56,7 +64,7 @@ uint8_t audio_dma_allocate_channel(void) {
return channel; // i.e., return failure
}
void audio_dma_free_channel(uint8_t channel) {
void dma_free_channel(uint8_t channel) {
assert(channel < AUDIO_DMA_CHANNEL_COUNT);
assert(audio_dma_allocated[channel]);
audio_dma_disable_channel(channel);
@ -180,7 +188,7 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
bool output_signed,
uint32_t output_register_address,
uint8_t dma_trigger_source) {
uint8_t dma_channel = audio_dma_allocate_channel();
uint8_t dma_channel = dma_allocate_channel();
if (dma_channel >= AUDIO_DMA_CHANNEL_COUNT) {
return AUDIO_DMA_DMA_BUSY;
}
@ -230,11 +238,7 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
// We're likely double buffering so set up the block interrupts.
turn_on_event_system();
dma->event_channel = find_sync_event_channel();
if (dma->event_channel >= EVSYS_SYNCH_NUM) {
mp_raise_RuntimeError(translate("All sync event channels in use"));
}
dma->event_channel = find_sync_event_channel_raise();
init_event_channel_interrupt(dma->event_channel, CORE_GCLK, EVSYS_ID_GEN_DMAC_CH_0 + dma_channel);
// We keep the audio_dma_t for internal use and the sample as a root pointer because it
@ -302,7 +306,7 @@ void audio_dma_stop(audio_dma_t *dma) {
disable_event_channel(dma->event_channel);
MP_STATE_PORT(playing_audio)[channel] = NULL;
audio_dma_state[channel] = NULL;
audio_dma_free_channel(dma->dma_channel);
dma_free_channel(dma->dma_channel);
}
dma->dma_channel = AUDIO_DMA_CHANNEL_COUNT;
}

View File

@ -66,8 +66,8 @@ uint8_t audiosample_channel_count(mp_obj_t sample_obj);
void audio_dma_init(audio_dma_t *dma);
void audio_dma_reset(void);
uint8_t audio_dma_allocate_channel(void);
void audio_dma_free_channel(uint8_t channel);
uint8_t dma_allocate_channel(void);
void dma_free_channel(uint8_t channel);
// This sets everything up but doesn't start the timer.
// Sample is the python object for the sample to play.
@ -97,4 +97,6 @@ bool audio_dma_get_paused(audio_dma_t *dma);
void audio_dma_background(void);
uint8_t find_sync_event_channel_raise(void);
#endif // MICROPY_INCLUDED_ATMEL_SAMD_AUDIO_DMA_H

View File

@ -37,4 +37,5 @@ bool board_requests_safe_mode(void) {
}
void reset_board(void) {
board_reset_user_neopixels(&pin_PA15, 2);
}

View File

@ -37,4 +37,5 @@ bool board_requests_safe_mode(void) {
}
void reset_board(void) {
board_reset_user_neopixels(&pin_PA06, 2);
}

View File

@ -12,28 +12,16 @@ LONGINT_IMPL = MPZ
CIRCUITPY_BITBANGIO = 0
CIRCUITPY_BITMAPTOOLS = 0
CIRCUITPY_BUSDEVICE = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_COUNTIO = 0
CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_MSGPACK = 0
# supersized, not ultra-supersized
CIRCUITPY_VECTORIO = 0
CIRCUITPY_BUSDEVICE = 0
CFLAGS_INLINE_LIMIT = 60
CFLAGS_INLINE_LIMIT = 35
SUPEROPT_GC = 0
SUPEROPT_VM = 0
CFLAGS_BOARD = --param max-inline-insns-auto=15
ifeq ($(TRANSLATION), ja)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 35
endif
ifeq ($(TRANSLATION), zh_Latn_pinyin)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 35
endif
ifeq ($(TRANSLATION), de_DE)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 35
SUPEROPT_VM = 0
endif

View File

@ -19,7 +19,9 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA23) },
{ MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_DOTSTAR_DATA), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_DOTSTAR_CLOCK), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },

View File

@ -11,3 +11,4 @@ EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ, GD25Q64C"
LONGINT_IMPL = MPZ
CIRCUITPY_SDIOIO = 1
CIRCUITPY_IMAGECAPTURE = 1

View File

@ -17,6 +17,7 @@ CIRCUITPY_COUNTIO = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_GAMEPAD = 0
CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_MSGPACK = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_COUNTIO = 0

View File

@ -19,6 +19,7 @@ CIRCUITPY_COUNTIO = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_GAMEPAD = 0
CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_MSGPACK = 0
CIRCUITPY_RTC = 0
# too itsy bitsy for all of displayio
CIRCUITPY_VECTORIO = 0

View File

@ -37,7 +37,10 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) },
{ MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_DOTSTAR_DATA), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_DOTSTAR_CLOCK), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },

View File

@ -34,7 +34,10 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB23) },
{ MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PB03) },
{ MP_ROM_QSTR(MP_QSTR_DOTSTAR_DATA), MP_ROM_PTR(&pin_PB03) },
{ MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PB02) },
{ MP_ROM_QSTR(MP_QSTR_DOTSTAR_CLOCK), MP_ROM_PTR(&pin_PB02) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },

View File

@ -17,6 +17,7 @@ CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_MSGPACK = 0
CIRCUITPY_VECTORIO = 0
CIRCUITPY_BUSDEVICE = 0
MICROPY_PY_ASYNC_AWAIT = 0
SUPEROPT_GC = 0
SUPEROPT_VM = 0

View File

@ -37,4 +37,5 @@ bool board_requests_safe_mode(void) {
}
void reset_board(void) {
board_reset_user_neopixels(&pin_PA05, 4);
}

View File

@ -21,6 +21,7 @@ CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_NEOPIXEL_WRITE = 0
CIRCUITPY_PIXELBUF = 0
CIRCUITPY_PS2IO = 0
CIRCUITPY_PULSEIO = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_SAMD = 0

View File

@ -4,6 +4,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_REMOTEIN), MP_ROM_PTR(&pin_PA28) },
{ MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_DOTSTAR_DATA), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_DOTSTAR_CLOCK), MP_ROM_PTR(&pin_PA01) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -42,7 +42,10 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_DOTSTAR_DATA), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_DOTSTAR_CLOCK), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },

View File

@ -18,6 +18,7 @@ CIRCUITPY_COUNTIO = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_MSGPACK = 0
CIRCUITPY_VECTORIO = 0
SUPEROPT_GC = 0
SUPEROPT_VM = 0

View File

@ -12,9 +12,10 @@ LONGINT_IMPL = NONE
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_BITMAPTOOLS = 0
CIRCUITPY_BUSDEVICE = 0
CIRCUITPY_FREQUENCYIO = 0
CIRCUITPY_GAMEPAD = 0
CIRCUITPY_BUSDEVICE = 0
CIRCUITPY_MSGPACK = 0
SUPEROPT_GC = 0
SUPEROPT_VM = 0

View File

@ -13,8 +13,9 @@ LONGINT_IMPL = MPZ
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_AUDIOBUSIO = 0
CIRCUITPY_BITMAPTOOLS = 0
CIRCUITPY_VECTORIO = 0
CIRCUITPY_BUSDEVICE = 0
CIRCUITPY_MSGPACK = 0
CIRCUITPY_VECTORIO = 0
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar

View File

@ -19,6 +19,7 @@ CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_MSGPACK = 0
CIRCUITPY_VECTORIO = 0
CIRCUITPY_BUSDEVICE = 0
MICROPY_PY_ASYNC_AWAIT = 0
SUPEROPT_GC = 0
SUPEROPT_VM = 0

View File

@ -38,7 +38,9 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA27) },
{ MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PB03) },
{ MP_ROM_QSTR(MP_QSTR_DOTSTAR_DATA), MP_ROM_PTR(&pin_PB03) },
{ MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PB02) },
{ MP_ROM_QSTR(MP_QSTR_DOTSTAR_CLOCK), MP_ROM_PTR(&pin_PB02) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
};

View File

@ -26,7 +26,10 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_DOTSTAR_DATA), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_DOTSTAR_CLOCK), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },

View File

@ -20,18 +20,8 @@ CIRCUITPY_I2CPERIPHERAL = 0
MICROPY_PY_ASYNC_AWAIT = 0
SUPEROPT_GC = 0
SUPEROPT_VM = 0
CFLAGS_INLINE_LIMIT = 35
CFLAGS_BOARD = --param max-inline-insns-auto=15
ifeq ($(TRANSLATION), zh_Latn_pinyin)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 35
endif
ifeq ($(TRANSLATION), ja)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 35
endif
ifeq ($(TRANSLATION), de_DE)
RELEASE_NEEDS_CLEAN_BUILD = 1
CFLAGS_INLINE_LIMIT = 35
SUPEROPT_VM = 0
endif

View File

@ -26,7 +26,10 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_PA10) },
{ MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_DOTSTAR_DATA), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_DOTSTAR_CLOCK), MP_ROM_PTR(&pin_PA01) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },

View File

@ -367,11 +367,8 @@ static uint16_t filter_sample(uint32_t pdm_samples[4]) {
// output_buffer_length is the number of slots, not the number of bytes.
uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* self,
uint16_t* output_buffer, uint32_t output_buffer_length) {
uint8_t dma_channel = audio_dma_allocate_channel();
uint8_t event_channel = find_sync_event_channel();
if (event_channel >= EVSYS_SYNCH_NUM) {
mp_raise_RuntimeError(translate("All sync event channels in use"));
}
uint8_t dma_channel = dma_allocate_channel();
uint8_t event_channel = find_sync_event_channel_raise();
// We allocate two buffers on the stack to use for double buffering.
const uint8_t samples_per_buffer = SAMPLES_PER_BUFFER;
@ -476,7 +473,7 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se
}
disable_event_channel(event_channel);
audio_dma_free_channel(dma_channel);
dma_free_channel(dma_channel);
// Turn off serializer, but leave clock on, to avoid mic startup delay.
i2s_set_serializer_enable(self->serializer, false);

View File

@ -0,0 +1,198 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Jeff Epler for Adafruit Industries
*
* 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/obj.h"
#include "py/runtime.h"
#include "lib/utils/context_manager_helpers.h"
#include "lib/utils/interrupt_char.h"
#include "shared-bindings/imagecapture/ParallelImageCapture.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "common-hal/imagecapture/ParallelImageCapture.h"
#include "hal/include/hal_gpio.h"
#include "atmel_start_pins.h"
#include "audio_dma.h"
#include "samd/clocks.h"
#include "samd/events.h"
#define GPIO_PIN_FUNCTION_PCC (GPIO_PIN_FUNCTION_K)
#define PIN_PCC_D0 (PIN_PA16)
#define PIN_PCC_DEN1 (PIN_PA12)
#define PIN_PCC_DEN2 (PIN_PA13)
#define PIN_PCC_CLK (PIN_PA14)
void common_hal_imagecapture_parallelimagecapture_construct(imagecapture_parallelimagecapture_obj_t *self,
const mcu_pin_obj_t *data0,
const mcu_pin_obj_t *data_clock,
const mcu_pin_obj_t *vertical_sync,
const mcu_pin_obj_t *horizontal_reference,
int data_count)
{
if (data0->number != PIN_PCC_D0) {
mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_data0);
}
// The peripheral supports 8, 10, 12, or 14 data bits, but the code only supports 8 at present
if (data_count != 8)
{
mp_raise_ValueError_varg(translate("Invalid data_count %d"), data_count);
}
if (vertical_sync && vertical_sync->number != PIN_PCC_DEN1) {
mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_vsync);
}
if (horizontal_reference && horizontal_reference->number != PIN_PCC_DEN2) {
mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_href);
}
if (data_clock->number != PIN_PCC_CLK) {
mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_data_clock);
}
// technically, 0 was validated as free already but check again
for (int i=0; i<data_count; i++) {
if (!pin_number_is_free(data0->number + i)) {
mp_raise_ValueError_varg(translate("data pin #%d in use"), i);
}
}
PCC->MR.bit.PCEN = 0; // Make sure PCC is disabled before setting MR reg
PCC->IDR.reg = 0b1111; // Disable all PCC interrupts
MCLK->APBDMASK.bit.PCC_ = 1; // Enable PCC clock
// Accumulate 4 bytes into RHR register (two 16-bit pixels)
PCC->MR.reg = PCC_MR_CID(0x1) | // Clear on falling DEN1 (VSYNC)
PCC_MR_ISIZE(0x0) | // Input data bus is 8 bits
PCC_MR_DSIZE(0x2); // "4 data" at a time (accumulate in RHR)
PCC->MR.bit.PCEN = 1; // Enable PCC
// Now we know we can allocate all pins
self->data_count = data_count;
self->vertical_sync = vertical_sync ? vertical_sync->number : NO_PIN;
self->horizontal_reference = horizontal_reference ? horizontal_reference->number : NO_PIN;
gpio_set_pin_direction(PIN_PCC_CLK, GPIO_DIRECTION_IN);
gpio_set_pin_pull_mode(PIN_PCC_CLK, GPIO_PULL_OFF);
gpio_set_pin_function(PIN_PCC_CLK, GPIO_PIN_FUNCTION_PCC);
//claim_pin_number(PIN_PCC_CLK);
if (vertical_sync) {
gpio_set_pin_direction(PIN_PCC_DEN1, GPIO_DIRECTION_IN);
gpio_set_pin_pull_mode(PIN_PCC_DEN1, GPIO_PULL_OFF);
gpio_set_pin_function(PIN_PCC_DEN1, GPIO_PIN_FUNCTION_PCC); // VSYNC
//claim_pin_number(PIN_PCC_DEN1);
}
if (horizontal_reference) {
gpio_set_pin_direction(PIN_PCC_DEN2, GPIO_DIRECTION_IN);
gpio_set_pin_pull_mode(PIN_PCC_DEN2, GPIO_PULL_OFF);
gpio_set_pin_function(PIN_PCC_DEN2, GPIO_PIN_FUNCTION_PCC); // HSYNC
//claim_pin_number(PIN_PCC_DEN2);
}
for (int i=0; i<data_count; i++) {
gpio_set_pin_direction(PIN_PCC_D0+i, GPIO_DIRECTION_IN);
gpio_set_pin_pull_mode(PIN_PCC_D0+i, GPIO_PULL_OFF);
gpio_set_pin_function(PIN_PCC_D0+i, GPIO_PIN_FUNCTION_PCC);
//claim_pin_number(PIN_PCC_D0+i);
}
}
void common_hal_imagecapture_parallelimagecapture_deinit(imagecapture_parallelimagecapture_obj_t *self)
{
if (common_hal_imagecapture_parallelimagecapture_deinited(self)) {
return;
}
reset_pin_number(self->vertical_sync);
reset_pin_number(self->horizontal_reference);
reset_pin_number(PIN_PCC_CLK);
for (int i=0; i<self->data_count; i++) {
reset_pin_number(PIN_PCC_D0 + i);
}
self->data_count = 0;
}
bool common_hal_imagecapture_parallelimagecapture_deinited(imagecapture_parallelimagecapture_obj_t *self)
{
return self->data_count == 0;
}
static void setup_dma(DmacDescriptor* descriptor, size_t count, uint32_t *buffer) {
descriptor->BTCTRL.reg = DMAC_BTCTRL_VALID |
DMAC_BTCTRL_BLOCKACT_NOACT |
DMAC_BTCTRL_EVOSEL_BLOCK |
DMAC_BTCTRL_DSTINC |
DMAC_BTCTRL_BEATSIZE_WORD;
descriptor->BTCNT.reg = count;
descriptor->DSTADDR.reg = (uint32_t)buffer + 4*count;
descriptor->SRCADDR.reg = (uint32_t)&PCC->RHR.reg;
descriptor->DESCADDR.reg = 0;
}
#include <string.h>
void common_hal_imagecapture_parallelimagecapture_capture(imagecapture_parallelimagecapture_obj_t *self, void *buffer, size_t bufsize)
{
uint8_t dma_channel = dma_allocate_channel();
uint32_t *dest = buffer;
size_t count = bufsize / 4; // PCC receives 4 bytes (2 pixels) at a time
turn_on_event_system();
setup_dma(dma_descriptor(dma_channel), count, dest);
dma_configure(dma_channel, PCC_DMAC_ID_RX, true);
if (self->vertical_sync) {
const volatile uint32_t *vsync_reg = &PORT->Group[(self->vertical_sync / 32)].IN.reg;
uint32_t vsync_bit = 1 << (self->vertical_sync % 32);
while (*vsync_reg & vsync_bit)
{
// Wait for VSYNC low (frame end)
RUN_BACKGROUND_TASKS;
// Allow user to break out of a timeout with a KeyboardInterrupt.
if (mp_hal_is_interrupted()) {
dma_free_channel(dma_channel);
return;
}
}
}
dma_enable_channel(dma_channel);
while (DMAC->Channel[dma_channel].CHCTRLA.bit.ENABLE) {
RUN_BACKGROUND_TASKS;
if (mp_hal_is_interrupted()) {
break;
}
}
dma_disable_channel(dma_channel);
dma_free_channel(dma_channel);
}

View File

@ -0,0 +1,34 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Jeff Epler for Adafruit Industries
*
* 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.
*/
#pragma once
#include "shared-bindings/imagecapture/ParallelImageCapture.h"
struct imagecapture_parallelimagecapture_obj {
mp_obj_base_t base;
uint8_t data_pin, data_clock, vertical_sync, horizontal_reference, data_count;
};

View File

@ -137,7 +137,7 @@ void pulsein_interrupt_handler(uint8_t channel) {
void pulsein_reset() {
#ifdef SAMD21
rtc_end_pulsein();
rtc_end_pulse();
#endif
refcount = 0;
pulsein_tc_index = 0xff;
@ -236,7 +236,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self,
// Set config will enable the EIC.
pulsein_set_config(self, true);
#ifdef SAMD21
rtc_start_pulsein();
rtc_start_pulse();
#endif
}
@ -250,7 +250,7 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) {
return;
}
#ifdef SAMD21
rtc_end_pulsein();
rtc_end_pulse();
#endif
set_eic_handler(self->channel, EIC_HANDLER_NO_INTERRUPT);
turn_off_eic_channel(self->channel);

View File

@ -51,8 +51,8 @@ void pulsein_reset(void);
void pulsein_interrupt_handler(uint8_t channel);
void pulsein_timer_interrupt_handler(uint8_t index);
#ifdef SAMD21
void rtc_start_pulsein(void);
void rtc_end_pulsein(void);
void rtc_start_pulse(void);
void rtc_end_pulse(void);
#endif

Some files were not shown because too many files have changed in this diff Show More