[rtems commit] bsp/gen5200: Simplify interrupt write support

Sebastian Huber sebh at rtems.org
Wed Jun 24 06:48:49 UTC 2015


Module:    rtems
Branch:    master
Commit:    df8341ae30cddbbf463c85a04d89dcfe9085c1f6
Changeset: http://git.rtems.org/rtems/commit/?id=df8341ae30cddbbf463c85a04d89dcfe9085c1f6

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Jun 23 14:20:11 2015 +0200

bsp/gen5200: Simplify interrupt write support

---

 c/src/lib/libbsp/powerpc/gen5200/console/console.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/c/src/lib/libbsp/powerpc/gen5200/console/console.c b/c/src/lib/libbsp/powerpc/gen5200/console/console.c
index c2e093c..0ccb52f 100644
--- a/c/src/lib/libbsp/powerpc/gen5200/console/console.c
+++ b/c/src/lib/libbsp/powerpc/gen5200/console/console.c
@@ -327,11 +327,6 @@ static void mpc5200_psc_interrupt_handler(rtems_irq_hdl_param handle)
   if (isr & ISR_TX_RDY & channel_info[minor].shadow_imr) {
     channel_info[minor].tx_interrupts++;
 
-    /*
-     * mask interrupt
-     */
-    psc->isr_imr = channel_info[minor].shadow_imr &= ~(IMR_TX_RDY);
-
     if (ttyp[minor] != NULL) {
       #ifndef SINGLE_CHAR_MODE
         rtems_termios_dequeue_characters(
@@ -581,11 +576,12 @@ static ssize_t mpc5200_uart_write(
   size_t len
 )
 {
+  struct mpc5200_psc *psc =
+    (struct mpc5200_psc *)(&mpc5200.psc[psc_minor_to_regset[minor]]);
+
   if (len > 0) {
     int frame_len = len;
     const char *frame_buf = buf;
-    struct mpc5200_psc *psc =
-      (struct mpc5200_psc *)(&mpc5200.psc[psc_minor_to_regset[minor]]);
 
    /*
     * Check tx fifo space
@@ -609,6 +605,11 @@ static ssize_t mpc5200_uart_write(
     * unmask interrupt
     */
     psc->isr_imr = channel_info[minor].shadow_imr |= IMR_TX_RDY;
+  } else {
+    /*
+     * mask interrupt
+     */
+    psc->isr_imr = channel_info[minor].shadow_imr &= ~(IMR_TX_RDY);
   }
 
   return 0;



More information about the vc mailing list