[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/rincon/apps/Blackbook5/media/AT45DB
FlashBridgeM.nc, 1.1, 1.2 FlashBridgeC.nc, 1.1, 1.2
dmm
rincon at users.sourceforge.net
Tue Jun 6 09:51:01 PDT 2006
Update of /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/media/AT45DB
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv28804/contrib/rincon/apps/Blackbook5/media/AT45DB
Modified Files:
FlashBridgeM.nc FlashBridgeC.nc
Log Message:
Updated Blackbook to v.5.1, fixed many bugs and increased reliability
Index: FlashBridgeM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/media/AT45DB/FlashBridgeM.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** FlashBridgeM.nc 18 May 2006 22:34:20 -0000 1.1
--- FlashBridgeM.nc 6 Jun 2006 16:50:29 -0000 1.2
***************
*** 33,37 ****
* and then the flash kicks in so Blackbook can boot up
*
! * @author David Moss - dmm at rincon.com
*/
--- 33,68 ----
* and then the flash kicks in so Blackbook can boot up
*
! * TODO's
! * The AT45DB flash bridge uses the PageEEPROM component
! * to access the flash. One problem we ran into was with
! * sync and flush - when data is written to the flash, later
! * on we'd come back and the data wouldn't be there.
! * The code works correctly because debug output and telos motes
! * proved it. But the flash write was unreliable. This is because
! * the data would get written to the internal RAM buffer on the
! * AT45DB, but that data wouldn't get programmed to main memory.
! * This happened especially when programming to one page on flash
! * and then programming to another page on flash - the next page's
! * data would be lost.
! *
! * To try to solve these problems, after every flash write, the
! * AT45DB flash bridge component sync()'s, flush()'s, and completes.
! * This shouldn't be necessary, and it also wastes energy.
! * The code could be simplified with some better AT45DB low-level interfaces
! * - i.e. type in a flash address and get it, instead of calculating pages.
! * Another question to ask Atmel is why the flash pages need to be erased
! * before being re-written. If the answer is "so that your data
! * won't get corrupted" then it doesn't apply to us - Blackbook
! * takes care of not corrupting existing data. That should
! * double the data throughput to flash.
! *
! * Overall, this interface to the AT45DB needs a lot of work, especially
! * in the low-level hardware interface implementations. A complete
! * re-write with better matching to the FlashBridge interface and
! * more efficiency would make a good project for someone. I'm sure
! * the throughput and erasing can be performed much faster than what
! * we're seeing now.
! *
! * @author David Moss (dmm at rincon.com)
*/
***************
*** 71,74 ****
--- 102,108 ----
/** Total current CRC */
uint16_t currentCrc;
+
+ /** Amount of data to transact */
+ uint16_t amount;
enum {
***************
*** 239,243 ****
event result_t PageEEPROM.writeDone(result_t result) {
if(call State.getState() == S_WRITE) {
! post calculateParams();
}
return SUCCESS;
--- 273,278 ----
event result_t PageEEPROM.writeDone(result_t result) {
if(call State.getState() == S_WRITE) {
! currentTotal += amount;
! post flush();
}
return SUCCESS;
***************
*** 246,249 ****
--- 281,285 ----
event result_t PageEEPROM.readDone(result_t result) {
if(call State.getState() == S_READ) {
+ currentTotal += amount;
post calculateParams();
}
***************
*** 258,263 ****
}
event result_t PageEEPROM.syncDone(result_t result) {
- // Sync happens next
if(call State.getState() == S_FLUSH) {
call State.toIdle();
--- 294,304 ----
}
+
+ event result_t PageEEPROM.flushDone(result_t result) {
+ post sync();
+ return SUCCESS;
+ }
+
event result_t PageEEPROM.syncDone(result_t result) {
if(call State.getState() == S_FLUSH) {
call State.toIdle();
***************
*** 267,277 ****
call State.toIdle();
signal FlashBridge.eraseDone[currentClient]((currentAddr >> FLASH_SECTOR_SIZE_LOG2), SUCCESS);
}
! return SUCCESS;
! }
!
! event result_t PageEEPROM.flushDone(result_t result) {
! // Flush happens first
! post sync();
return SUCCESS;
}
--- 308,317 ----
call State.toIdle();
signal FlashBridge.eraseDone[currentClient]((currentAddr >> FLASH_SECTOR_SIZE_LOG2), SUCCESS);
+
+ } else if(call State.getState() == S_WRITE) {
+ post calculateParams();
}
!
!
return SUCCESS;
}
***************
*** 279,282 ****
--- 319,323 ----
event result_t PageEEPROM.computeCrcDone(result_t result, uint16_t pageCrc) {
if(call State.getState() == S_GETCRC) {
+ currentTotal += amount;
currentCrc = pageCrc;
post calculateParams();
***************
*** 304,308 ****
task void calculateParams() {
uint16_t offset;
- uint16_t amount;
uint16_t startPage = ((currentAddr + currentTotal) >> FLASH_PAGE_SIZE_LOG2);
--- 345,348 ----
***************
*** 335,340 ****
}
- currentTotal += amount;
-
} else {
// No more data exists
--- 375,378 ----
Index: FlashBridgeC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/rincon/apps/Blackbook5/media/AT45DB/FlashBridgeC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** FlashBridgeC.nc 18 May 2006 22:34:20 -0000 1.1
--- FlashBridgeC.nc 6 Jun 2006 16:50:29 -0000 1.2
***************
*** 44,48 ****
implementation {
components FlashBridgeM, PageEEPROMC, StateC, TimerC;
!
StdControl = FlashBridgeM;
StdControl = PageEEPROMC;
--- 44,48 ----
implementation {
components FlashBridgeM, PageEEPROMC, StateC, TimerC;
!
StdControl = FlashBridgeM;
StdControl = PageEEPROMC;
More information about the Tinyos-contrib-commits
mailing list