Compare commits
2 commits
6ad8702936
...
142da6bbb0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
142da6bbb0 | ||
|
|
88dace0e0f |
3 changed files with 17 additions and 13 deletions
14
ads8688.c
14
ads8688.c
|
|
@ -105,13 +105,16 @@ static int read_auto_cb(struct ads8688_control *c)
|
|||
ads8688_readings(c, cc, i++, ii);
|
||||
return alldone_cb(c);
|
||||
}
|
||||
if (c->frame == 0)
|
||||
unsigned int n = c->nbuf;
|
||||
if (c->frame == 0) {
|
||||
n = 0;
|
||||
c->frame = 0x0300 | c->channels & 0xff;
|
||||
}
|
||||
else if ((c->frame & 0xff) == 0x03)
|
||||
c->frame = 0xa000;
|
||||
else
|
||||
return tcnh_cb(c);
|
||||
ssp_set_buffer(0, c->nbuf);
|
||||
ssp_set_buffer(0, n);
|
||||
return ssp_submit_batch(&c->frame, 1, 2, 0, 0);
|
||||
}
|
||||
|
||||
|
|
@ -143,6 +146,7 @@ static int gains_cb(struct ads8688_control *c)
|
|||
c->frame = cc + 5 << 9;
|
||||
if (f & 0x100)
|
||||
c->frame |= 0x100 | c->gains >> 4*cc;
|
||||
ssp_set_buffer(0, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -181,7 +185,6 @@ static int ads8688_start(int nskip, int nread)
|
|||
c->status = 0x100;
|
||||
c->job.command = &c->frame;
|
||||
c->job.count = 1 + nskip + nread;
|
||||
c->job.idle_frame = 0;
|
||||
c->match.frame_count = nskip;
|
||||
c->match.read_count = nread;
|
||||
return ssp_start_batch(ads8688_batch, 0);
|
||||
|
|
@ -204,7 +207,6 @@ int adc_gains_cmd(struct command *cmd, const struct command_par *par)
|
|||
}
|
||||
unsigned int newgains = c->gains; // volatile
|
||||
|
||||
c->nbuf = 8;
|
||||
c->job.cmd_count = 1;
|
||||
c->callback = gains_cb;
|
||||
int r = ads8688_start(1, 1);
|
||||
|
|
@ -237,6 +239,7 @@ int adc_read_cmd(struct command *cmd, const struct command_par *par)
|
|||
c->callback = read_auto_cb;
|
||||
}
|
||||
c->job.cmd_count = 0; // idle_frame = continue command
|
||||
c->nbuf = NSCRATCH;
|
||||
int r = ads8688_start(aidx+1, 1);
|
||||
int code = par->code;
|
||||
if (r)
|
||||
|
|
@ -262,7 +265,7 @@ int adc_print_cmd(struct command *cmd, const struct command_par *par)
|
|||
FLAG_VAL("abort", 0x04000000),
|
||||
{}
|
||||
};
|
||||
unsigned int chs = 0;
|
||||
unsigned int chs = (unsigned int)par->par;
|
||||
error_msg_t e = parse_flags(cmd, kw, &chs);
|
||||
if (e)
|
||||
return parser_error_message(cmd, e);
|
||||
|
|
@ -467,5 +470,6 @@ const struct keywords adc_commands[] = {
|
|||
CMD_KW("gains", adc_gains_cmd, 372, 0),
|
||||
CMD_KW("read", adc_read_cmd, 374, 0),
|
||||
CMD_KW("print", adc_print_cmd, 376, 0),
|
||||
CMD_KWF("status",adc_print_cmd, 376, 0x01000000),
|
||||
CMD_END
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ int ltc2656(unsigned int frame, int flags, int timeout)
|
|||
else
|
||||
ssp_deassert_ssel();
|
||||
ssp_assert_ssel();
|
||||
ssp_set_buffer(0,0);
|
||||
ssp_set_buffer(0, -1);
|
||||
unsigned short cmd[2] = { frame >> 16, frame & 0xffff };
|
||||
ssp_submit(cmd, 2, 2, 0);
|
||||
int r = ssp_wait(timeout);
|
||||
|
|
|
|||
12
ssp.c
12
ssp.c
|
|
@ -29,8 +29,8 @@ void ssp_set_buffer(short *buf, unsigned int size)
|
|||
volatile struct ssp_job *j=&job;
|
||||
if (!buf) {
|
||||
buf = ssp_scratch;
|
||||
if (!size || size > sizeof(ssp_scratch)/2)
|
||||
size = sizeof(ssp_scratch)/2;
|
||||
if (size > NSCRATCH)
|
||||
size = NSCRATCH;
|
||||
}
|
||||
ssp_buffer = (unsigned short *)buf;
|
||||
j->buf_ptr = (unsigned short *)buf;
|
||||
|
|
@ -184,8 +184,8 @@ int ssp_submit_job(const struct ssp_job *jj)
|
|||
{
|
||||
unsigned int iflg = disable_irq(INT_DISABLE);
|
||||
memcpy((void*)&job, jj, sizeof(job)-8);
|
||||
if (jj->buf_ptr || jj->buf_count)
|
||||
ssp_set_buffer(0, jj->buf_count);
|
||||
if (jj->buf_count)
|
||||
ssp_set_buffer(jj->buf_ptr, jj->buf_count);
|
||||
ssp_frames_sent = 0;
|
||||
ssp_frames_read = 0;
|
||||
ssp_callback = ssp_run_batch;
|
||||
|
|
@ -333,7 +333,7 @@ int ssp_run_batch()
|
|||
ssp_init(batch->ssel);
|
||||
|
||||
if (f & ssp_b_scratch)
|
||||
ssp_set_buffer(0, 0);
|
||||
ssp_set_buffer(0, -1);
|
||||
|
||||
if (c == ssp_b_buffer)
|
||||
ssp_set_buffer(batch->buffer, f & 0xffff);
|
||||
|
|
@ -618,7 +618,7 @@ int ssp_send_cmd(struct command *cmd, const struct command_par *par)
|
|||
if (frames < reads)
|
||||
frames = reads;
|
||||
}
|
||||
ssp_set_buffer(0,0);
|
||||
ssp_set_buffer(0, -1);
|
||||
int c = ssp_submit(ssp_scratch, n, frames, reads);
|
||||
parser_format_message(cmd, "%03d ssp %d frames %dw %dr → %d\n",
|
||||
par->code, frames, n, reads, c);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue