Compare commits

..

No commits in common. "dd6bf3ef4081cf79aa6a4d01bbadc63b56d6bfb0" and "0affc4aa8c2772f14f0460516741493b45603c03" have entirely different histories.

2 changed files with 15 additions and 15 deletions

View file

@ -27,19 +27,20 @@ static struct ads8688_control {
void ads8688_readings(struct ads8688_control *c, unsigned int cc, int i, int ii)
{
unsigned short first = ssp_buffer[i];
unsigned short first = ssp_buffer[0];
unsigned int sum = first;
int square = 0;
int n = 1;
unsigned short sdo = 0;
if (!i && ii > 1)
sdo = ssp_buffer[1];
while ((i+=ii) < c->nbuf) {
while (i < c->nbuf) {
int d = ssp_buffer[i];
sum += d;
d -= first;
square += d*d;
n++;
i += ii;
}
if (cc > 9)
cc = 9;
@ -50,7 +51,7 @@ void ads8688_readings(struct ads8688_control *c, unsigned int cc, int i, int ii)
cc = 1<<cc;
c->nchannels |= cc;
c->tchannels |= cc;
c->status |= 0x1000 | cc<<16;
c->status |= 0x10000 | cc<<8;
}
static inline int tcnh_cb(struct ads8688_control *c)
@ -68,9 +69,9 @@ static inline int alldone_cb(struct ads8688_control *c)
static int read_cb(struct ads8688_control *c)
{
c->status = c->status & 0xff | 0x300;
if ((c->frame & 0xc3ff) != 0xc000)
if ((c->frame & 0xf0ff) != 0xc000)
return tcnh_cb(c);
unsigned int cc = c->frame >> 10 & 0xf;
unsigned int cc = c->frame >> 8 & 0xf;
if (cc <= 8) {
ads8688_readings(c, cc, 0, c->match.read_count);
cc++;
@ -81,7 +82,7 @@ static int read_cb(struct ads8688_control *c)
cc++;
if (cc > 8)
return alldone_cb(c);
c->frame = 0xc000 | cc << 10;
c->frame = 0xc000 | cc;
ssp_set_buffer(0, c->nbuf);
return ssp_submit_batch(&c->frame, 1, 2, 0, 0);
}
@ -92,7 +93,7 @@ static int read_auto_cb(struct ads8688_control *c)
if (c->frame == 0xa000) {
int ii = 0;
int i = 0;
unsigned int cc = c->channels & 0xff;
unsigned int cc = c->channels;
while (cc) {
cc >>= 1;
ii++;
@ -134,16 +135,15 @@ static int gains_cb(struct ads8688_control *c)
if (f & 0xe000)
return tcnh_cb(c);
unsigned int cc = save_gain(f, *ssp_buffer, &c->gains);
cc++;
if (cc == 12)
if (cc == 11)
cc = 0;
else if (cc >= 8)
return alldone_cb(c);
else
c->status |= 0x1000 | cc<<16;
c->status |= 0x10000 | cc<<8;
c->frame = cc + 5 << 9;
if (f & 0x100)
c->frame |= 0x100 | c->gains >> 4*cc & 0xf;
c->frame |= 0x100 | c->gains >> 4*cc;
ssp_set_buffer(0, 1);
return -1;
}
@ -233,7 +233,7 @@ int adc_read_cmd(struct command *cmd, const struct command_par *par)
int aidx = c->channels >> 12;
if (!k) {
c->frame = 0xfc00;
c->frame = 0xcf00;
c->callback = read_cb;
}
else {

6
ssp.c
View file

@ -265,7 +265,7 @@ unsigned int ssp_busy(void)
if (c & mask)
return c;
if (!ssp_run_batch())
return c | 0x8000;
return -1;
ssp_reset();
return 0;
}
@ -666,8 +666,8 @@ int ssp_resp_cmd(struct command *cmd, const struct command_par *par)
if (what & 0x01000000 || r) {
if (r)
code++;
parser_format_message(cmd, "%03d ssp busy: 0x%x ssel 0x%08x mode 0x%04x\n",
code, r, ssp_config.ssel, ssp_config.mode);
parser_format_message(cmd, "%03d ssp busy: 0x%x\n",
code, r);
return code;
}
}