[Tinyos-beta-commits]
CVS: tinyos-1.x/beta/Deluge/Deluge/TOSBoot/stm25p
STM25PC.nc, NONE, 1.1 STM25PM.nc, NONE, 1.1
Jonathan Hui
jwhui at users.sourceforge.net
Thu Apr 21 10:31:43 PDT 2005
- Previous message: [Tinyos-beta-commits]
CVS: tinyos-1.x/beta/Deluge/Deluge/TOSBoot/msp430
HPLUSART0M.nc, NONE, 1.1 ProgFlashM.nc, NONE, 1.1 hardware.h,
NONE, 1.1 msp430hardware.h, NONE, 1.1
- Next message: [Tinyos-beta-commits]
CVS: tinyos-1.x/beta/Deluge/Deluge/TOSBoot/build/telosb
app.c, 1.3, 1.4 ident_flags.txt, 1.3, 1.4 main.exe, 1.3,
1.4 main.ihex, 1.3, 1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/beta/Deluge/Deluge/TOSBoot/stm25p
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9078/stm25p
Added Files:
STM25PC.nc STM25PM.nc
Log Message:
- Cleaned up bootloader for msp430. Reduces code size by more than
half and now sits at under 2K of code.
--- NEW FILE: STM25PC.nc ---
// $Id: STM25PC.nc,v 1.1 2005/04/21 17:31:41 jwhui Exp $
/* tab:4
*
*
* "Copyright (c) 2000-2004 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 <jwhui at cs.berkeley.edu>
*/
configuration STM25PC {
provides {
interface StdControl;
interface TOSBootExtFlash;
}
}
implementation {
components
STM25PM,
HPLUSART0M;
StdControl = STM25PM;
TOSBootExtFlash = STM25PM;
STM25PM.USARTControl -> HPLUSART0M;
}
--- NEW FILE: STM25PM.nc ---
// $Id: STM25PM.nc,v 1.1 2005/04/21 17:31:41 jwhui Exp $
/* tab:4
*
*
* "Copyright (c) 2000-2004 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 <jwhui at cs.berkeley.edu>
*/
module STM25PM {
provides {
interface StdControl;
interface TOSBootExtFlash;
}
uses {
interface HPLUSARTControl as USARTControl;
}
}
implementation {
command result_t StdControl.init() {
TOSH_MAKE_FLASH_HOLD_OUTPUT();
TOSH_MAKE_FLASH_CS_OUTPUT();
call USARTControl.setModeSPI();
call USARTControl.disableRxIntr();
call USARTControl.disableTxIntr();
return SUCCESS;
}
command result_t StdControl.start() {
return SUCCESS;
}
command result_t StdControl.stop() {
TOSH_CLR_FLASH_CS_PIN();
TOSH_SET_FLASH_HOLD_PIN();
call USARTControl.tx(0xb9);
while(!(call USARTControl.isTxIntrPending()));
TOSH_SET_FLASH_CS_PIN();
TOSH_CLR_FLASH_HOLD_PIN();
call USARTControl.disableSPI();
return SUCCESS;
}
void powerOnFlash() {
uint8_t i;
TOSH_CLR_FLASH_CS_PIN();
TOSH_SET_FLASH_HOLD_PIN();
// command byte
call USARTControl.tx(0xab);
while(!(call USARTControl.isTxIntrPending()));
// dummy bytes
for ( i = 0; i < 3; i++ ) {
call USARTControl.tx(0);
while(!(call USARTControl.isTxIntrPending()));
}
// signature
call USARTControl.rx(); // clear receive interrupt
call USARTControl.tx(0);
while(!(call USARTControl.isRxIntrPending()));
call USARTControl.rx(); // read signature
TOSH_SET_FLASH_CS_PIN();
TOSH_CLR_FLASH_HOLD_PIN();
}
command result_t TOSBootExtFlash.startRead(uint32_t addr) {
uint8_t i;
powerOnFlash();
TOSH_CLR_FLASH_CS_PIN();
TOSH_SET_FLASH_HOLD_PIN();
// command
call USARTControl.tx(0x3);
while(!(call USARTControl.isTxIntrPending()));
// address
for ( i = 3; i > 0; i-- ) {
call USARTControl.tx((addr >> (i-1)*8) & 0xff);
while(!(call USARTControl.isTxIntrPending()));
}
call USARTControl.rx(); // clear receive interrupt
return SUCCESS;
}
command uint8_t TOSBootExtFlash.readByte() {
call USARTControl.tx(0);
while(!(call USARTControl.isRxIntrPending()));
return call USARTControl.rx();
}
command result_t TOSBootExtFlash.stopRead() {
TOSH_SET_FLASH_CS_PIN();
return SUCCESS;
}
}
- Previous message: [Tinyos-beta-commits]
CVS: tinyos-1.x/beta/Deluge/Deluge/TOSBoot/msp430
HPLUSART0M.nc, NONE, 1.1 ProgFlashM.nc, NONE, 1.1 hardware.h,
NONE, 1.1 msp430hardware.h, NONE, 1.1
- Next message: [Tinyos-beta-commits]
CVS: tinyos-1.x/beta/Deluge/Deluge/TOSBoot/build/telosb
app.c, 1.3, 1.4 ident_flags.txt, 1.3, 1.4 main.exe, 1.3,
1.4 main.ihex, 1.3, 1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-beta-commits
mailing list