@@ -439,7 +439,12 @@ void CALLED_FROM_INTERRUPT jshIOEventOverflowed() {
439
439
/// Push an IO event (max IOEVENT_MAX_LEN) into the ioBuffer (designed to be called from IRQ), returns true on success, Calls jshHadEvent();
440
440
bool CALLED_FROM_INTERRUPT jshPushEvent (IOEventFlags evt , uint8_t * data , unsigned int length ) {
441
441
assert (length < IOEVENT_MAX_LEN );
442
- if (length > IOEVENT_MAX_LEN ) length = IOEVENT_MAX_LEN ;
442
+ if (length > IOEVENT_MAX_LEN ) {
443
+ #ifndef RELEASE
444
+ jsiConsolePrintf ("%d>IOEVENT_MAX_LEN\n" , length );
445
+ #endif
446
+ length = IOEVENT_MAX_LEN ;
447
+ }
443
448
/* We're disabling IRQs for this bit because it's actually quite likely for
444
449
* USB and USART data to be coming in at the same time, and it can trip
445
450
* things up if one IRQ interrupts another. */
@@ -496,8 +501,13 @@ void jshPushIOCharEvents(IOEventFlags channel, char *data, unsigned int count) {
496
501
ioHead = (ioHead + 1 ) & IOBUFFERMASK ;
497
502
}
498
503
} else {
499
- // Push the event
500
- jshPushEvent (channel , (uint8_t * )data , count );
504
+ // Push the event (split into IOEVENT_MAX_LEN chunks just in case)
505
+ while (count ) {
506
+ unsigned int c = (count > IOEVENT_MAX_LEN ) ? IOEVENT_MAX_LEN : count ;
507
+ jshPushEvent (channel , (uint8_t * )data , c );
508
+ count -= c ;
509
+ data += c ;
510
+ }
501
511
}
502
512
// Set flow control (as we've just filled the buffer up more)
503
513
if (DEVICE_HAS_DEVICE_STATE (channel ) && jshGetEventsUsed () > IOBUFFER_XOFF )
0 commit comments