Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MODSERIAL by
Revision 6:c8f77fe1cc10, committed 2010-11-21
- Comitter:
- AjK
- Date:
- Sun Nov 21 16:25:44 2010 +0000
- Parent:
- 5:8365c4cf8f33
- Child:
- 7:ffa4a7cb7f8d
- Commit message:
- 1.6
Changed in this revision
--- a/ChangeLog.c Sun Nov 21 16:08:36 2010 +0000
+++ b/ChangeLog.c Sun Nov 21 16:25:44 2010 +0000
@@ -1,5 +1,16 @@
/* $Id:$
+1.6 - 21/11/2010
+
+ * Version 1.5 solved a blocking problem on putc() when called
+ from another ISR. However, isr_tx() invokes a callback of it's
+ own when a byte is tranferred from TX buffer to TX FIFO. User
+ programs may interpret that as an IRQ callback. That's an ISR
+ call from within an existing ISR which is not good. So the
+ TxIrq callback from isr_tx is now conditional. It will only
+ be called when isr_tx() is actually within it's own ISR and
+ not when called from alternate ISR handlers.
+
1.5 - 21/11/2010
* Calling putc() (or any derived function that uses it like
--- a/ISR_TX.cpp Sun Nov 21 16:08:36 2010 +0000
+++ b/ISR_TX.cpp Sun Nov 21 16:25:44 2010 +0000
@@ -26,7 +26,7 @@
namespace AjK {
void
-MODSERIAL::isr_tx(void)
+MODSERIAL::isr_tx(bool doCallback)
{
if (! _base ) return;
@@ -37,7 +37,7 @@
if (buffer_out[TxIrq] >= buffer_size[TxIrq]) {
buffer_out[TxIrq] = 0;
}
- _isr[TxIrq].call();
+ if (doCallback) _isr[TxIrq].call();
}
if ( MODSERIAL_TX_BUFFER_EMPTY && MODSERIAL_THR_HAS_SPACE ) {
--- a/MODSERIAL.h Sun Nov 21 16:08:36 2010 +0000
+++ b/MODSERIAL.h Sun Nov 21 16:25:44 2010 +0000
@@ -680,7 +680,14 @@
* TX Interrupt Service Routine.
* @ingroup INTERNALS
*/
- void isr_tx(void);
+ void isr_tx(bool doCallback);
+
+ /**
+ * TX Interrupt Service Routine stub version.
+ * @ingroup INTERNALS
+ */
+ void isr_tx(void) { isr_tx(true); }
+
/**
* RX Interrupt Service Routine.
--- a/PUTC.cpp Sun Nov 21 16:08:36 2010 +0000
+++ b/PUTC.cpp Sun Nov 21 16:25:44 2010 +0000
@@ -46,7 +46,7 @@
// TX buffer to TX FIFO to make space. The easiest way
// to do this is to poll the isr_tx() function while we
// are blocking.
- isr_tx();
+ isr_tx(false);
}
}
else if( MODSERIAL_TX_BUFFER_FULL ) {
