Fixed a problem in the USB-CDC demo.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2733 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
gdisirio 2011-02-12 18:59:34 +00:00
parent d749ecc10a
commit 95d128420a
2 changed files with 4 additions and 3 deletions

View File

@ -124,7 +124,7 @@ static void inotify(GenericQueue *qp) {
if (n != USB_ENDPOINT_BUSY) { if (n != USB_ENDPOINT_BUSY) {
sdup->iqueue.q_rdptr = sdup->iqueue.q_buffer; sdup->iqueue.q_rdptr = sdup->iqueue.q_buffer;
chSemSetCounterI(&sdup->iqueue.q_sem, n); chSemSetCounterI(&sdup->iqueue.q_sem, n);
// chIOAddFlagsI(sdup, IO_INPUT_AVAILABLE); chIOAddFlagsI(sdup, IO_INPUT_AVAILABLE);
} }
} }
} }
@ -143,7 +143,7 @@ static void onotify(GenericQueue *qp) {
if (n != USB_ENDPOINT_BUSY) { if (n != USB_ENDPOINT_BUSY) {
sdup->oqueue.q_wrptr = sdup->oqueue.q_buffer; sdup->oqueue.q_wrptr = sdup->oqueue.q_buffer;
chSemSetCounterI(&sdup->oqueue.q_sem, SERIAL_USB_BUFFERS_SIZE); chSemSetCounterI(&sdup->oqueue.q_sem, SERIAL_USB_BUFFERS_SIZE);
// chIOAddFlagsI(sdup, IO_OUTPUT_EMPTY); chIOAddFlagsI(sdup, IO_OUTPUT_EMPTY);
} }
} }

View File

@ -367,7 +367,8 @@ static msg_t Thread2(void *arg) {
uint8_t buffer[0x40]; uint8_t buffer[0x40];
size_t n = chIQReadTimeout(&sdup->iqueue, buffer, size_t n = chIQReadTimeout(&sdup->iqueue, buffer,
sizeof(buffer), TIME_IMMEDIATE); sizeof(buffer), TIME_IMMEDIATE);
chOQWriteTimeout(&sdup->oqueue, buffer, n, TIME_IMMEDIATE); if (n > 0)
chOQWriteTimeout(&sdup->oqueue, buffer, n, TIME_IMMEDIATE);
} }
} }
} }