X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Fchips%2Fmsp430%2Fusci%2FMsp430UartP.nc;h=ca6cd52ce628e0f8aa0034a3c5595065efec51e2;hb=be862ab07d080085823951d18dcb27a28a310ace;hp=cdc08089793142d70ef6892dfe40ece057697dce;hpb=2fc550ecfc8fb03f258b5a692c8e7e90793aced2;p=tinyos-2.x.git diff --git a/tos/chips/msp430/usci/Msp430UartP.nc b/tos/chips/msp430/usci/Msp430UartP.nc index cdc08089..ca6cd52c 100644 --- a/tos/chips/msp430/usci/Msp430UartP.nc +++ b/tos/chips/msp430/usci/Msp430UartP.nc @@ -10,7 +10,7 @@ * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * - Neither the name of the Technische Universität Berlin nor the names + * - Neither the name of the Titanium Mirror, Inc. nor the names * of its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -55,7 +55,7 @@ generic module Msp430UartP() { implementation { enum { /* Bit positions in m_pins */ - PINS_RXD = 1, + PINS_RXD = 0, PINS_TXD }; @@ -104,12 +104,20 @@ implementation { call TXD.selectModuleFunc(); } + /* Reset important state variables */ + m_robuf = 0; + m_sobuf = 0; + /* Clear interrupts; we'll add them as needed */ call Registers.clrIeRx(); call Registers.clrIeTx(); /* Enable the device */ call Registers.clrCtl1(UCSWRST); + + /* TOS convention is for receive interrupts on by default. */ + call Registers.clrIfgRx(); + call Registers.setIeRx(); } } @@ -124,10 +132,14 @@ implementation { call Registers.clrIeTx(); call Registers.clrIfgRx(); + /* Reset important state variables */ + m_robuf = 0; + m_sobuf = 0; + /* Restore pins to their pre-configure state */ - if (m_pins & PINS_RXD) + if (m_pins & (1 << PINS_RXD)) call RXD.selectIOFunc(); - if (m_pins & PINS_TXD) + if (m_pins & (1 << PINS_TXD)) call TXD.selectIOFunc(); } } @@ -277,7 +289,7 @@ implementation { async event void Interrupts.i2cStop() {} async event void Interrupts.i2cCal() {} async event void Interrupts.brk() {} - async event void Interrupts.i2cNak() {} + async event void Interrupts.i2cNack() {} async event void Counter.overflow() {} default async event void UartStream.sendDone( uint8_t* buf, uint16_t len,