mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-15 12:38:11 +00:00
fixed usb serial queue crashing (#1761)
This commit is contained in:
parent
58b488b840
commit
eaac40df3a
@ -58,19 +58,18 @@ void bulk_out_receive(void) {
|
|||||||
void serial_bulk_transfer_complete(void* user_data, unsigned int bytes_transferred) {
|
void serial_bulk_transfer_complete(void* user_data, unsigned int bytes_transferred) {
|
||||||
(void)user_data;
|
(void)user_data;
|
||||||
|
|
||||||
chSysLockFromIsr();
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < bytes_transferred; i++) {
|
for (unsigned int i = 0; i < bytes_transferred; i++) {
|
||||||
msg_t ret;
|
msg_t ret;
|
||||||
do {
|
do {
|
||||||
|
chSysLockFromIsr();
|
||||||
ret = chIQPutI(&SUSBD1.iqueue, usbBulkBuffer[i]);
|
ret = chIQPutI(&SUSBD1.iqueue, usbBulkBuffer[i]);
|
||||||
if (ret == Q_FULL)
|
chSysUnlockFromIsr();
|
||||||
chThdSleepMilliseconds(1);
|
if (ret == Q_FULL) {
|
||||||
|
chThdYield();
|
||||||
|
}
|
||||||
|
|
||||||
} while (ret == Q_FULL);
|
} while (ret == Q_FULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
chSysUnlockFromIsr();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void onotify(GenericQueue* qp) {
|
static void onotify(GenericQueue* qp) {
|
||||||
@ -94,7 +93,7 @@ static void onotify(GenericQueue* qp) {
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
chThdSleepMilliseconds(1);
|
chThdYield();
|
||||||
|
|
||||||
} while (ret == -1);
|
} while (ret == -1);
|
||||||
chSysLock();
|
chSysLock();
|
||||||
|
Loading…
Reference in New Issue
Block a user