[Tinyos-commits] CVS: tinyos-1.x/tos/platform/telos PageEEPROMM.nc,
1.3, 1.4
Jonathan Hui
jwhui at users.sourceforge.net
Sun Jul 17 14:02:13 PDT 2005
Update of /cvsroot/tinyos/tinyos-1.x/tos/platform/telos
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22644
Modified Files:
PageEEPROMM.nc
Log Message:
- Implement computeCrcContinue().
Index: PageEEPROMM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/platform/telos/PageEEPROMM.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PageEEPROMM.nc 20 Jun 2005 21:54:38 -0000 1.3
--- PageEEPROMM.nc 17 Jul 2005 21:02:11 -0000 1.4
***************
*** 208,212 ****
uint8_t *ptr = cmd;
eeprompageoffset_t count = cmdCount;
! uint16_t crc = 0;
uint8_t lphase = P_SEND_CMD;
--- 208,212 ----
uint8_t *ptr = cmd;
eeprompageoffset_t count = cmdCount;
! uint16_t crc = computedCrc;
uint8_t lphase = P_SEND_CMD;
***************
*** 520,524 ****
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 ||
--- 520,525 ----
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 ||
***************
*** 541,544 ****
--- 542,546 ----
reqPage = page;
reqOffset = offset;
+ computedCrc = crc;
if (page == buffer[0].page)
***************
*** 556,560 ****
command result_t PageEEPROM.read(eeprompage_t page, eeprompageoffset_t offset,
void *reqdata, eeprompageoffset_t n) {
! return newRequest(R_READ, page, offset, reqdata, n);
}
--- 558,577 ----
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);
!
}
***************
*** 562,574 ****
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);
}
--- 579,590 ----
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);
}
***************
*** 605,614 ****
#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);
}
--- 621,630 ----
#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