135u5 / tinyos-main

Automatically exported from code.google.com/p/tinyos-main
1 stars 0 forks source link

At45dbP.nc - copyPage command #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

While using the component at45db on an micaz mote, if you use the command 
copyPage with a destination page greater than or equal to AT45_PAGE_SIZE.

What is the expected output? What do you see instead?

The result of the command in all cases is the same: FAIL. If the destination 
page is less than AT45_PAGE_SIZE, the operation do its work and the most times 
return SUCCESS.

What version of the product are you using? On what operating system?

I am using the version "r5108" with header: "// $Id: At45dbP.nc,v 1.11 
2010-06-29 22:07:43 scipio Exp $" on a XubunTOS virtual machine 2.1.

Please provide any additional information below.

I think the problem comes in lines from 394 to 399 at "At45dbP.nc" file, 
because if you replace that lines for the following code, the problem seems to 
be fixed:

#ifdef CHECKARGS
  if (page >= AT45_MAX_PAGES || (offset >= AT45_PAGE_SIZE && req != R_COPY) ||
      n > AT45_PAGE_SIZE || (offset + n > AT45_PAGE_SIZE && req != R_COPY) ||
      (offset >= AT45_MAX_PAGES && req == R_COPY))
    post taskFail();
  else
#endif

with these lines I add an exception if the command is copyPage in order to not 
always return FAIL if the destination page is greater than or equal to 
AT45_PAGE_SIZE, instead of, it return FAIL if the destination page is greather 
than or equal to AT45_MAX_PAGES.

Thanks for reading.
Enrique Castellanos.

Original issue reported on code.google.com by casor...@gmail.com on 23 Oct 2010 at 10:02

GoogleCodeExporter commented 8 years ago
This fix looks correct. I've applied it to the main tree. Thanks!

Original comment by philip.l...@gmail.com on 13 Nov 2010 at 1:11