[Tinyos-commits] CVS: tinyos-1.x/tos/platform/mica PageEEPROMM.nc,
1.6, 1.7
Jonathan Hui
jwhui at users.sourceforge.net
Mon Jul 18 10:32:19 PDT 2005
Update of /cvsroot/tinyos/tinyos-1.x/tos/platform/mica
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21169
Modified Files:
PageEEPROMM.nc
Log Message:
- Implemented PageEEPROM.computeCrcContinue().
Index: PageEEPROMM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/platform/mica/PageEEPROMM.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** PageEEPROMM.nc 19 May 2005 17:28:48 -0000 1.6
--- PageEEPROMM.nc 18 Jul 2005 17:32:16 -0000 1.7
***************
*** 186,190 ****
uint8_t *ptr = cmd;
eeprompageoffset_t count = cmdCount;
! uint16_t crc = 0;
uint8_t lphase = P_SEND_CMD;
--- 186,190 ----
uint8_t *ptr = cmd;
eeprompageoffset_t count = cmdCount;
! uint16_t crc = computedCrc;
uint8_t lphase = P_SEND_CMD;
***************
*** 495,499 ****
result_t newRequest(uint8_t req, eeprompage_t page,
eeprompageoffset_t offset,
! void *reqdata, eeprompageoffset_t n) {
#ifdef CHECKARGS
if (page >= TOS_EEPROM_MAX_PAGES || offset >= TOS_EEPROM_PAGE_SIZE ||
--- 495,500 ----
result_t newRequest(uint8_t req, eeprompage_t page,
eeprompageoffset_t offset,
! void *reqdata, eeprompageoffset_t n,
! uint16_t crc) {
#ifdef CHECKARGS
if (page >= TOS_EEPROM_MAX_PAGES || offset >= TOS_EEPROM_PAGE_SIZE ||
***************
*** 516,519 ****
--- 517,521 ----
reqPage = page;
reqOffset = offset;
+ computedCrc = crc;
if (page == buffer[0].page)
***************
*** 531,535 ****
command result_t PageEEPROM.read(eeprompage_t page, eeprompageoffset_t offset,
void *reqdata, eeprompageoffset_t n) {
! return newRequest(R_READ, page, offset, reqdata, n);
}
--- 533,552 ----
command result_t PageEEPROM.read(eeprompage_t page, eeprompageoffset_t offset,
void *reqdata, eeprompageoffset_t n) {
! return newRequest(R_READ, page, offset, reqdata, n, 0);
! }
!
! result_t computeCrc(eeprompage_t page, eeprompageoffset_t offset,
! eeprompageoffset_t n, uint16_t crc) {
!
! if (n == 0)
! {
! request = R_READCRC;
! computedCrc = crc;
! post taskSuccess();
! return SUCCESS;
! }
! else
! return newRequest(R_READCRC, page, offset, NULL, n, crc);
!
}
***************
*** 537,549 ****
eeprompageoffset_t offset,
eeprompageoffset_t n) {
! if (n == 0)
! {
! request = R_READCRC;
! computedCrc = 0;
! post taskSuccess();
! return SUCCESS;
! }
! else
! return newRequest(R_READCRC, page, offset, NULL, n);
}
--- 554,565 ----
eeprompageoffset_t offset,
eeprompageoffset_t n) {
! return computeCrc(page, offset, n, 0);
! }
!
! command result_t PageEEPROM.computeCrcContinue(eeprompage_t page,
! eeprompageoffset_t offset,
! eeprompageoffset_t n,
! uint16_t crc) {
! return computeCrc(page, offset, n, crc);
}
***************
*** 580,589 ****
#endif
! return newRequest(R_WRITE, page, offset, reqdata, n);
}
command result_t PageEEPROM.erase(eeprompage_t page, uint8_t eraseKind) {
! return newRequest(R_ERASE, page, eraseKind, NULL, 0);
}
--- 596,605 ----
#endif
! return newRequest(R_WRITE, page, offset, reqdata, n, 0);
}
command result_t PageEEPROM.erase(eeprompage_t page, uint8_t eraseKind) {
! return newRequest(R_ERASE, page, eraseKind, NULL, 0, 0);
}
More information about the Tinyos-commits
mailing list