Commit ded6c7e5 by zacharyc

Removed silicon workaround


git-svn-id: https://bucket.mit.edu/svn/nilm/acquisition/ethstream@7289 ddd99763-3ecb-0310-9145-efcb8ce7c51f
parent f2d65660
Showing with 5 additions and 3 deletions
...@@ -47,9 +47,11 @@ typedef struct __attribute__((__packed__)) { ...@@ -47,9 +47,11 @@ typedef struct __attribute__((__packed__)) {
desired scanrate. Returns -1 if no valid config found */ desired scanrate. Returns -1 if no valid config found */
int nerdjack_choose_scan(double desired_rate, double *actual_rate, unsigned long *period) 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. //The ffffe is because of a silicon bug. The last bit is unusable in all
*period = floor((double) NERDJACK_CLOCK_RATE / desired_rate) + 1; //devices so far. It is worked around on the chip, but giving it exactly
if(*period > 0x0fffff) { //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"); info("Cannot sample that slowly\n");
*actual_rate = (double)NERDJACK_CLOCK_RATE / (double) 0x0ffffe; *actual_rate = (double)NERDJACK_CLOCK_RATE / (double) 0x0ffffe;
//info("Sampling at slowest rate:%f\n",*actual_rate); //info("Sampling at slowest rate:%f\n",*actual_rate);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment