[Tinyos-2-commits] CVS: tinyos-2.x/tos/chips/at45db At45dbP.nc, 1.7, 1.8 BlockStorageP.nc, 1.6, 1.7 HplAt45dbByteC.nc, 1.5, 1.6
David Gay
idgay at users.sourceforge.net
Mon Jun 23 11:53:16 PDT 2008
Update of /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv5446
Modified Files:
At45dbP.nc BlockStorageP.nc HplAt45dbByteC.nc
Log Message:
deputy fixes
Index: At45dbP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/At45dbP.nc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** At45dbP.nc 11 Jun 2008 00:46:23 -0000 1.7
--- At45dbP.nc 23 Jun 2008 18:53:14 -0000 1.8
***************
*** 368,373 ****
request = req;
! reqBuf = reqdata;
reqBytes = n;
reqPage = page;
reqOffset = offset;
--- 368,374 ----
request = req;
! reqBuf = NULL;
reqBytes = n;
+ reqBuf = reqdata;
reqPage = page;
reqOffset = offset;
Index: BlockStorageP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/BlockStorageP.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** BlockStorageP.nc 11 Jun 2008 00:46:23 -0000 1.6
--- BlockStorageP.nc 23 Jun 2008 18:53:14 -0000 1.7
***************
*** 89,93 ****
uint8_t client = NO_CLIENT;
! storage_addr_t bytesRemaining;
struct {
--- 89,93 ----
uint8_t client = NO_CLIENT;
! storage_addr_t currentOffset;
struct {
***************
*** 132,136 ****
void eraseStart();
void syncStart();
! void multipageStart(storage_len_t len, uint16_t crc);
void startRequest() {
--- 132,136 ----
void eraseStart();
void syncStart();
! void multipageStart(uint16_t crc);
void startRequest() {
***************
*** 144,148 ****
break;
default:
! multipageStart(s[client].len, (uint16_t)s[client].buf);
}
}
--- 144,148 ----
break;
default:
! multipageStart((uint16_t)s[client].buf);
}
}
***************
*** 151,157 ****
uint8_t c = client;
uint8_t tmpState = s[c].request;
- storage_addr_t actualLength = s[c].len - bytesRemaining;
- storage_addr_t addr = s[c].addr - actualLength;
- void *ptr = s[c].buf - actualLength;
client = NO_CLIENT;
--- 151,154 ----
***************
*** 162,169 ****
{
case R_READ:
! signal BlockRead.readDone[c](addr, ptr, actualLength, result);
break;
case R_WRITE:
! signal BlockWrite.writeDone[c](addr, ptr, actualLength, result);
break;
case R_ERASE:
--- 159,166 ----
{
case R_READ:
! signal BlockRead.readDone[c](s[c].addr, s[c].buf, currentOffset, result);
break;
case R_WRITE:
! signal BlockWrite.writeDone[c](s[c].addr, s[c].buf, currentOffset, result);
break;
case R_ERASE:
***************
*** 171,175 ****
break;
case R_CRC:
! signal BlockRead.computeCrcDone[c](addr, actualLength, crc, result);
break;
case R_SYNC:
--- 168,172 ----
break;
case R_CRC:
! signal BlockRead.computeCrcDone[c](s[c].addr, currentOffset, crc, result);
break;
case R_SYNC:
***************
*** 192,197 ****
s[id].request = newState;
s[id].addr = addr;
! s[id].buf = buf;
s[id].len = len;
call Resource.request[id]();
--- 189,199 ----
s[id].request = newState;
s[id].addr = addr;
! /* With deputy, updating a buffer/length pair requires nulling-out the
! buffer first (setting the buffer first would fail if the new buffer
! is shorter than the old, setting the length first would fail if the
! new buffer is longer than the old) */
! s[id].buf = NULL;
s[id].len = len;
+ s[id].buf = buf;
call Resource.request[id]();
***************
*** 231,251 ****
/* ------------------------------------------------------------------ */
- void calcRequest(storage_addr_t addr, at45page_t *page,
- at45pageoffset_t *offset, at45pageoffset_t *count) {
- *page = pageRemap(addr >> AT45_PAGE_SIZE_LOG2);
- *offset = addr & ((1 << AT45_PAGE_SIZE_LOG2) - 1);
- if (bytesRemaining < (1 << AT45_PAGE_SIZE_LOG2) - *offset)
- *count = bytesRemaining;
- else
- *count = (1 << AT45_PAGE_SIZE_LOG2) - *offset;
-
- }
-
void multipageContinue(uint16_t crc) {
at45page_t page;
! at45pageoffset_t offset, count;
! uint8_t *buf = s[client].buf;
! if (bytesRemaining == 0)
{
endRequest(SUCCESS, crc);
--- 233,243 ----
/* ------------------------------------------------------------------ */
void multipageContinue(uint16_t crc) {
+ storage_addr_t remaining = s[client].len - currentOffset, addr;
at45page_t page;
! at45pageoffset_t pageOffset, count;
! uint8_t *buf = s[client].buf + currentOffset;
! if (remaining == 0)
{
endRequest(SUCCESS, crc);
***************
*** 253,277 ****
}
! calcRequest(s[client].addr, &page, &offset, &count);
! bytesRemaining -= count;
! s[client].addr += count;
! s[client].buf = buf + count;
switch (s[client].request)
{
case R_WRITE:
! call At45db.write(page, offset, buf, count);
break;
case R_READ:
! call At45db.read(page, offset, buf, count);
break;
case R_CRC:
! call At45db.computeCrc(page, offset, count, crc);
break;
}
}
! void multipageStart(storage_len_t len, uint16_t crc) {
! bytesRemaining = len;
multipageContinue(crc);
}
--- 245,272 ----
}
! addr = s[client].addr + currentOffset;
! page = pageRemap(addr >> AT45_PAGE_SIZE_LOG2);
! pageOffset = addr & ((1 << AT45_PAGE_SIZE_LOG2) - 1);
! count = (1 << AT45_PAGE_SIZE_LOG2) - pageOffset;
! if (remaining < count)
! count = remaining;
switch (s[client].request)
{
case R_WRITE:
! call At45db.write(page, pageOffset, buf, count);
break;
case R_READ:
! call At45db.read(page, pageOffset, buf, count);
break;
case R_CRC:
! call At45db.computeCrc(page, pageOffset, count, crc);
break;
}
+ currentOffset += count;
}
! void multipageStart(uint16_t crc) {
! currentOffset = 0;
multipageContinue(crc);
}
Index: HplAt45dbByteC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/chips/at45db/HplAt45dbByteC.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** HplAt45dbByteC.nc 1 Jun 2008 04:24:33 -0000 1.5
--- HplAt45dbByteC.nc 23 Jun 2008 18:53:14 -0000 1.6
***************
*** 48,52 ****
};
uint8_t status = P_IDLE;
! uint8_t flashCmd[4];
at45pageoffset_t dataCount;
uint8_t * COUNT_NOK(dataCount) data;
--- 48,52 ----
};
uint8_t status = P_IDLE;
! uint8_t flashCmd[9];
at45pageoffset_t dataCount;
uint8_t * COUNT_NOK(dataCount) data;
***************
*** 181,186 ****
flashCmd[2] = reqPage << (sectorSizeLog2 - 8) | reqOffset >> 8;
flashCmd[3] = reqOffset; // low-order 8 bits
! data = reqData;
dataCount = reqCount;
dontCare = reqDontCare;
--- 181,187 ----
flashCmd[2] = reqPage << (sectorSizeLog2 - 8) | reqOffset >> 8;
flashCmd[3] = reqOffset; // low-order 8 bits
! data = NULL;
dataCount = reqCount;
+ data = reqData;
dontCare = reqDontCare;
More information about the Tinyos-2-commits
mailing list