[Tinyos-commits] CVS: tinyos-1.x/tos/lib/Deluge/TOSBoot/msp430
ProgFlashM.nc, 1.1, 1.2
Joe Polastre
jpolastre at users.sourceforge.net
Mon Sep 19 16:40:13 PDT 2005
Update of /cvsroot/tinyos/tinyos-1.x/tos/lib/Deluge/TOSBoot/msp430
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26745/msp430
Modified Files:
ProgFlashM.nc
Log Message:
changed TOSBootM to only use the size of the internal flash addressing.
this prevents doing 32-bit transforms on platforms that only use
16-bit addressing (such as msp430). saves significant space.
each platform now typedef's the kind of flash it has (internal and external)
and casts are done appropriately for that flash.
The ProgFlash interface is now updated to only use in_flash_addr_t types.
Index: ProgFlashM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/lib/Deluge/TOSBoot/msp430/ProgFlashM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ProgFlashM.nc 22 Jul 2005 17:40:10 -0000 1.1
--- ProgFlashM.nc 19 Sep 2005 23:40:11 -0000 1.2
***************
*** 41,45 ****
};
! command result_t ProgFlash.write(uint32_t addr, uint8_t* buf, uint16_t len) {
volatile uint16_t *flashAddr = (uint16_t*)(uint16_t)addr;
--- 41,45 ----
};
! command result_t ProgFlash.write(in_flash_addr_t addr, uint8_t* buf, uint16_t len) {
volatile uint16_t *flashAddr = (uint16_t*)(uint16_t)addr;
***************
*** 47,69 ****
uint16_t i = 0;
! if (addr < TOSBOOT_END || addr + len > 0x10000L)
! return FAIL;
!
! FCTL2 = FWKEY + FSSEL1 + FN2;
! FCTL3 = FWKEY;
! FCTL1 = FWKEY + ERASE;
! *flashAddr = 0;
! FCTL1 = FWKEY + WRT;
! for (i = 0; i < len / sizeof(uint16_t); i++, flashAddr++) {
! if ((uint16_t)flashAddr != RESET_ADDR)
! *flashAddr = wordBuf[i];
! else
! *flashAddr = TOSBOOT_START;
}
! FCTL1 = FWKEY;
! FCTL3 = FWKEY + LOCK;
!
! return SUCCESS;
!
}
--- 47,69 ----
uint16_t i = 0;
! // len is 16 bits so it can't be larger than 0xffff
! // make sure we can't wrap around
! if (addr < (0xffff - (len >> 1))) {
! FCTL2 = FWKEY + FSSEL1 + FN2;
! FCTL3 = FWKEY;
! FCTL1 = FWKEY + ERASE;
! *flashAddr = 0;
! FCTL1 = FWKEY + WRT;
! for (i = 0; i < (len >> 1); i++, flashAddr++) {
! if ((uint16_t)flashAddr != RESET_ADDR)
! *flashAddr = wordBuf[i];
! else
! *flashAddr = TOSBOOT_START;
! }
! FCTL1 = FWKEY;
! FCTL3 = FWKEY + LOCK;
! return SUCCESS;
}
! return FAIL;
}
More information about the Tinyos-commits
mailing list