From: R. Steve McKown Date: Thu, 8 Apr 2010 00:17:22 +0000 (-0600) Subject: Remove redundant atomic blocks. X-Git-Tag: debian/2.1.0-4-1tmi~1^2~7 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=753d22d3f0f9764e9a4cdfbefdcf45ff9db4c3cc Remove redundant atomic blocks. --- diff --git a/tos/chips/msp430/usci/Msp430SpiP.nc b/tos/chips/msp430/usci/Msp430SpiP.nc index 6d8e9f4c..22bfbbd3 100644 --- a/tos/chips/msp430/usci/Msp430SpiP.nc +++ b/tos/chips/msp430/usci/Msp430SpiP.nc @@ -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(); + } } } diff --git a/tos/chips/msp430/usci/Msp430UartP.nc b/tos/chips/msp430/usci/Msp430UartP.nc index 1b595bfd..742c1674 100644 --- a/tos/chips/msp430/usci/Msp430UartP.nc +++ b/tos/chips/msp430/usci/Msp430UartP.nc @@ -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()