]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Remove redundant atomic blocks.
authorR. Steve McKown <rsmckown@gmail.com>
Thu, 8 Apr 2010 00:17:22 +0000 (18:17 -0600)
committerR. Steve McKown <rsmckown@gmail.com>
Tue, 13 Apr 2010 20:18:27 +0000 (14:18 -0600)
tos/chips/msp430/usci/Msp430SpiP.nc
tos/chips/msp430/usci/Msp430UartP.nc

index 6d8e9f4cea8eb6fa26960f90c17f5dfe4bbbe165..22bfbbd376b1aa00237b8539a94b7ab402ea7a4f 100644 (file)
@@ -229,13 +229,15 @@ implementation {
 
   async command uint8_t SpiByte.write(uint8_t byte)
   {
-    if (isBusy())
-      return 0;
-    else {
-      waitOnTx();
-      call Registers.setTxbuf(byte);
-      waitOnRx();
-      return call Registers.getRxbuf();
+    atomic {
+      if (isBusy())
+       return 0;
+      else {
+       waitOnTx();
+       call Registers.setTxbuf(byte);
+       waitOnRx();
+       return call Registers.getRxbuf();
+      }
     }
   }
 
index 1b595bfdbd9af40369beceb8128264f6f6620183..742c167470cd62d73fda661f01ead91cf509c93a 100644 (file)
@@ -236,25 +236,23 @@ implementation {
 
   async event void Interrupts.rx(uint8_t byte)
   {
-    atomic {
-      if (m_robuf) {
-       /* receive() takes precedence if active */
-       while (m_rlen && call Registers.getIfgRx()) {
-         *m_rbuf = byte;
-         if (--m_rlen)
-           m_rbuf++;
-       }
-       if (m_rlen == 0 && m_robuf) {
-         if (m_rxie) {
-           call Registers.clrIeRx();
-           call Registers.clrIfgRx();
-         }
-         m_robuf = 0;
-         signal UartStream.receiveDone(m_robuf, m_rolen, SUCCESS);
+    if (m_robuf) {
+      /* receive() takes precedence if active */
+      while (m_rlen && call Registers.getIfgRx()) {
+       *m_rbuf = byte;
+       if (--m_rlen)
+         m_rbuf++;
+      }
+      if (m_rlen == 0 && m_robuf) {
+       if (m_rxie) {
+         call Registers.clrIeRx();
+         call Registers.clrIfgRx();
        }
-      } else
-       signal UartStream.receivedByte(byte);
-    }
+       m_robuf = 0;
+       signal UartStream.receiveDone(m_robuf, m_rolen, SUCCESS);
+      }
+    } else
+      signal UartStream.receivedByte(byte);
   }
 
   default async command const msp430_usci_uart_t* Configure.get()