瀏覽代碼

Merge pull request #29 from essej/txfix

fixed race condition in midi transmit
main
Paul Stoffregen 5 年之前
父節點
當前提交
ce04fdd5ec
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 4 行新增0 行删除
  1. +4
    -0
      midi.cpp

+ 4
- 0
midi.cpp 查看文件

// use tx_buffer1 // use tx_buffer1
tx_buffer1[tx1++] = data; tx_buffer1[tx1++] = data;
tx1_count = tx1; tx1_count = tx1;
__disable_irq();
if (tx1 >= tx_max) { if (tx1 >= tx_max) {
queue_Data_Transfer(txpipe, tx_buffer1, tx_max*4, this); queue_Data_Transfer(txpipe, tx_buffer1, tx_max*4, this);
} else { } else {
tx1_count = tx_max; tx1_count = tx_max;
queue_Data_Transfer(txpipe, tx_buffer1, tx_max*4, this); queue_Data_Transfer(txpipe, tx_buffer1, tx_max*4, this);
} }
__enable_irq();
return; return;
} }
if (tx2 < tx_max) { if (tx2 < tx_max) {
// use tx_buffer2 // use tx_buffer2
tx_buffer2[tx2++] = data; tx_buffer2[tx2++] = data;
tx2_count = tx2; tx2_count = tx2;
__disable_irq();
if (tx2 >= tx_max) { if (tx2 >= tx_max) {
queue_Data_Transfer(txpipe, tx_buffer2, tx_max*4, this); queue_Data_Transfer(txpipe, tx_buffer2, tx_max*4, this);
} else { } else {
tx2_count = tx_max; tx2_count = tx_max;
queue_Data_Transfer(txpipe, tx_buffer2, tx_max*4, this); queue_Data_Transfer(txpipe, tx_buffer2, tx_max*4, this);
} }
__enable_irq();
return; return;
} }
} }

Loading…
取消
儲存