Browse Source

Removed silicon workaround

git-svn-id: https://bucket.mit.edu/svn/nilm/acquisition/ethstream@7289 ddd99763-3ecb-0310-9145-efcb8ce7c51f
tags/ethstream-1.1
zacharyc 15 years ago
parent
commit
ded6c7e5f4
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      nerdjack.c

+ 5
- 3
nerdjack.c View File

@@ -47,9 +47,11 @@ typedef struct __attribute__((__packed__)) {
desired scanrate. Returns -1 if no valid config found */
int nerdjack_choose_scan(double desired_rate, double *actual_rate, unsigned long *period)
{
//The +1 corrects a silicon bug. The timer resets to 1, not 0.
*period = floor((double) NERDJACK_CLOCK_RATE / desired_rate) + 1;
if(*period > 0x0fffff) {
//The ffffe is because of a silicon bug. The last bit is unusable in all
//devices so far. It is worked around on the chip, but giving it exactly
//0xfffff would cause the workaround code to roll over.
*period = floor((double) NERDJACK_CLOCK_RATE / desired_rate);
if(*period > 0x0ffffe) {
info("Cannot sample that slowly\n");
*actual_rate = (double)NERDJACK_CLOCK_RATE / (double) 0x0ffffe;
//info("Sampling at slowest rate:%f\n",*actual_rate);


Loading…
Cancel
Save