X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Flib%2Ftosboot%2Fmsp430%2FHPLUSART0M.nc;fp=tos%2Flib%2Ftosboot%2Fmsp430%2FHPLUSART0M.nc;h=0000000000000000000000000000000000000000;hb=b9d9b45472ac2b5043943979487ae619a70bf6e6;hp=e53c9eb057d155379d99d90d63b39e66033d3d91;hpb=0824f96f43ff0b85395408b7f47aa7c05f6c3658;p=tinyos-2.x.git diff --git a/tos/lib/tosboot/msp430/HPLUSART0M.nc b/tos/lib/tosboot/msp430/HPLUSART0M.nc deleted file mode 100644 index e53c9eb0..00000000 --- a/tos/lib/tosboot/msp430/HPLUSART0M.nc +++ /dev/null @@ -1,128 +0,0 @@ -// $Id$ - -/* tab:2 - * - * - * "Copyright (c) 2000-2005 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice, the following - * two paragraphs and the author appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." - * - */ - -/** - * @author Jonathan Hui - */ - -module HPLUSART0M { - provides interface HPLUSARTControl; -} -implementation { - - command void HPLUSARTControl.disableSPI() { - // USART0 SPI module disable - //ME1 &= ~USPIE0; - - // set to PUC values - ME1 = 0; - U0CTL = 1; - U0TCTL = 1; - U0RCTL = 0; - } - - command void HPLUSARTControl.setModeSPI() { - - //U0CTL = SWRST; - - // 8-bit char, SPI-mode, USART as master - U0CTL = SWRST | CHAR | SYNC | MM; - - // 3-pin + half-cycle delayed UCLK - U0TCTL |= STC + CKPH + SSEL_SMCLK; - - // as fast as possible - U0BR0 = 0x02; - U0BR1 = 0; - - // enable SPI - ME1 |= USPIE0; - - U0CTL &= ~SWRST; - - // clear interrupts - IFG1 = 0; - - } - - command void HPLUSARTControl.disableI2C() { - /* - U0CTL = 1; - U0TCTL = 1; - I2CTCTL = 0; - */ - U0CTL &= ~I2CEN; - U0CTL &= ~I2C; - I2CTCTL = 0; - call HPLUSARTControl.disableSPI(); - } - - command void HPLUSARTControl.setModeI2C() { - - // Recommended init procedure - U0CTL = I2C + SYNC + MST; - - // use 1MHz SMCLK as the I2C reference - I2CTCTL |= I2CSSEL_2 | I2CTRX; - - // Enable I2C - U0CTL |= I2CEN; - - return; - } - - command error_t HPLUSARTControl.isTxEmpty(){ - if (U0TCTL & TXEPT) { - return SUCCESS; - } - return FAIL; - } - - command error_t HPLUSARTControl.isTxIntrPending(){ - if (IFG1 & UTXIFG0){ - IFG1 &= ~UTXIFG0; - return SUCCESS; - } - return FAIL; - } - - command error_t HPLUSARTControl.isRxIntrPending(){ - if (IFG1 & URXIFG0){ - IFG1 &= ~URXIFG0; - return SUCCESS; - } - return FAIL; - } - - command void HPLUSARTControl.tx(uint8_t data){ - U0TXBUF = data; - } - - command uint8_t HPLUSARTControl.rx(){ - return U0RXBUF; - } - -}