summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Osterwood <osterwood@gmail.com>2020-01-20 13:11:57 -0500
committerChris Osterwood <osterwood@gmail.com>2020-01-20 13:11:57 -0500
commit97420994e85f65a4f2ddb802d532acd56c1e5879 (patch)
tree11709251ee3b05ea46b7d262f3ba0ed28532e8cd /lib
parent137a4f8a5d21f5e37277031887a3908e6c4e371e (diff)
parent85c731734a0388c28c8e3895ec1cecd1d9491e0c (diff)
Merge remote-tracking branch 'origin/master' into capablerobot-usbhub
Diffstat (limited to 'lib')
m---------lib/mp30
-rw-r--r--lib/oofatfs/ff.c6
-rw-r--r--lib/oofatfs/ffconf.h6
m---------lib/stm32lib0
m---------lib/tinyusb0
-rw-r--r--lib/utils/buffer_helper.c4
-rw-r--r--lib/utils/buffer_helper.h3
-rw-r--r--lib/utils/interrupt_char.c2
-rw-r--r--lib/utils/sys_stdio_mphal.c2
9 files changed, 18 insertions, 5 deletions
diff --git a/lib/mp3 b/lib/mp3
new file mode 160000
+Subproject c3c664bf4db6a36d11808dfcbb5dbf7cff1715b
diff --git a/lib/oofatfs/ff.c b/lib/oofatfs/ff.c
index b0984756b..71bd19702 100644
--- a/lib/oofatfs/ff.c
+++ b/lib/oofatfs/ff.c
@@ -3382,7 +3382,11 @@ FRESULT f_read (
if (!sect) ABORT(fs, FR_INT_ERR);
sect += csect;
cc = btr / SS(fs); /* When remaining bytes >= sector size, */
- if (cc) { /* Read maximum contiguous sectors directly */
+ if (cc
+#if _FS_DISK_READ_ALIGNED
+ && (((int)rbuff & 3) == 0)
+#endif
+ ) {/* Read maximum contiguous sectors directly */
if (csect + cc > fs->csize) { /* Clip at cluster boundary */
cc = fs->csize - csect;
}
diff --git a/lib/oofatfs/ffconf.h b/lib/oofatfs/ffconf.h
index 214311b4c..a3795fa3f 100644
--- a/lib/oofatfs/ffconf.h
+++ b/lib/oofatfs/ffconf.h
@@ -343,6 +343,12 @@
/ SemaphoreHandle_t and etc.. A header file for O/S definitions needs to be
/ included somewhere in the scope of ff.h. */
+// Set to nonzero if buffers passed to disk_read have a word alignment
+// restriction
+#ifndef _FS_DISK_READ_ALIGNED
+#define _FS_DISK_READ_ALIGNED 0
+#endif
+
/* #include <windows.h> // O/S definitions */
diff --git a/lib/stm32lib b/lib/stm32lib
deleted file mode 160000
-Subproject d2bcfda543d3b99361e44112aca929225bdcc07
diff --git a/lib/tinyusb b/lib/tinyusb
-Subproject 1ee9ef4f2b7c6acfab6c398a4f57ca22036958f
+Subproject dda4c9a94b509238faa7b5ab5b9464c1d2e63ff
diff --git a/lib/utils/buffer_helper.c b/lib/utils/buffer_helper.c
index f6eb8bf1e..694952e3d 100644
--- a/lib/utils/buffer_helper.c
+++ b/lib/utils/buffer_helper.c
@@ -26,10 +26,10 @@
#include "lib/utils/buffer_helper.h"
-void normalize_buffer_bounds(int32_t* start, int32_t end, uint32_t* length) {
+void normalize_buffer_bounds(int32_t* start, int32_t end, size_t* length) {
if (end < 0) {
end += *length;
- } else if (((uint32_t) end) > *length) {
+ } else if (((size_t) end) > *length) {
end = *length;
}
if (*start < 0) {
diff --git a/lib/utils/buffer_helper.h b/lib/utils/buffer_helper.h
index 47042e7ef..7487b9df5 100644
--- a/lib/utils/buffer_helper.h
+++ b/lib/utils/buffer_helper.h
@@ -28,7 +28,8 @@
#define MICROPY_INCLUDED_LIB_UTILS_BUFFER_HELPER_H
#include <stdint.h>
+#include <string.h>
-void normalize_buffer_bounds(int32_t* start, int32_t end, uint32_t* length);
+void normalize_buffer_bounds(int32_t* start, int32_t end, size_t* length);
#endif // MICROPY_INCLUDED_LIB_UTILS_BUFFER_HELPER_H
diff --git a/lib/utils/interrupt_char.c b/lib/utils/interrupt_char.c
index 91ee5c80e..da7f70254 100644
--- a/lib/utils/interrupt_char.c
+++ b/lib/utils/interrupt_char.c
@@ -49,7 +49,7 @@ void mp_keyboard_interrupt(void) {
// Check to see if we've been CTRL-C'ed by autoreload or the user.
bool mp_hal_is_interrupted(void) {
- return MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception));
+ return MP_STATE_VM(mp_pending_exception) != NULL;
}
#endif
diff --git a/lib/utils/sys_stdio_mphal.c b/lib/utils/sys_stdio_mphal.c
index 266783f37..c1607dfe8 100644
--- a/lib/utils/sys_stdio_mphal.c
+++ b/lib/utils/sys_stdio_mphal.c
@@ -123,6 +123,7 @@ STATIC const mp_rom_map_elem_t stdio_locals_dict_table[] = {
STATIC MP_DEFINE_CONST_DICT(stdio_locals_dict, stdio_locals_dict_table);
STATIC const mp_stream_p_t stdio_obj_stream_p = {
+ MP_PROTO_IMPLEMENT(MP_QSTR_protocol_stream)
.read = stdio_read,
.write = stdio_write,
.ioctl = stdio_ioctl,
@@ -158,6 +159,7 @@ STATIC mp_uint_t stdio_buffer_write(mp_obj_t self_in, const void *buf, mp_uint_t
}
STATIC const mp_stream_p_t stdio_buffer_obj_stream_p = {
+ MP_PROTO_IMPLEMENT(MP_QSTR_protocol_stream)
.read = stdio_buffer_read,
.write = stdio_buffer_write,
.is_text = false,