ETRAX-FS: Process outgoing DMA channels until EOL.

For outgoing DMA channels, keep processing descriptors until hitting end
of list.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5553 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
edgar_igl 2008-10-27 20:44:27 +00:00
parent 31c18d8761
commit c968ef8df5

View File

@ -393,9 +393,7 @@ static void channel_out_run(struct fs_dma_ctrl *ctrl, int c)
uint32_t saved_data_buf; uint32_t saved_data_buf;
unsigned char buf[2 * 1024]; unsigned char buf[2 * 1024];
if (ctrl->channels[c].eol == 1) while (ctrl->channels[c].eol != 1) {
return;
saved_data_buf = channel_reg(ctrl, c, RW_SAVED_DATA_BUF); saved_data_buf = channel_reg(ctrl, c, RW_SAVED_DATA_BUF);
D(printf("ch=%d buf=%x after=%x saved_data_buf=%x\n", D(printf("ch=%d buf=%x after=%x saved_data_buf=%x\n",
@ -404,7 +402,7 @@ static void channel_out_run(struct fs_dma_ctrl *ctrl, int c)
(uint32_t)ctrl->channels[c].current_d.after, (uint32_t)ctrl->channels[c].current_d.after,
saved_data_buf)); saved_data_buf));
len = (uint32_t)(unsigned long) ctrl->channels[c].current_d.after; len = (uint32_t)ctrl->channels[c].current_d.after;
len -= saved_data_buf; len -= saved_data_buf;
if (len > sizeof buf) if (len > sizeof buf)
@ -416,14 +414,16 @@ static void channel_out_run(struct fs_dma_ctrl *ctrl, int c)
if (ctrl->channels[c].client->client.push) if (ctrl->channels[c].client->client.push)
ctrl->channels[c].client->client.push( ctrl->channels[c].client->client.push(
ctrl->channels[c].client->client.opaque, buf, len); ctrl->channels[c].client->client.opaque,
buf, len);
else else
printf("WARNING: DMA ch%d dataloss, no attached client.\n", c); printf("WARNING: DMA ch%d dataloss,"
" no attached client.\n", c);
saved_data_buf += len; saved_data_buf += len;
if (saved_data_buf == if (saved_data_buf ==
(uint32_t)(unsigned long)ctrl->channels[c].current_d.after) { (uint32_t)ctrl->channels[c].current_d.after) {
/* Done. Step to next. */ /* Done. Step to next. */
if (ctrl->channels[c].current_d.out_eop) { if (ctrl->channels[c].current_d.out_eop) {
/* TODO: signal eop to the client. */ /* TODO: signal eop to the client. */
@ -447,7 +447,7 @@ static void channel_out_run(struct fs_dma_ctrl *ctrl, int c)
channel_stop(ctrl, c); channel_stop(ctrl, c);
} else { } else {
ctrl->channels[c].regs[RW_SAVED_DATA] = ctrl->channels[c].regs[RW_SAVED_DATA] =
(uint32_t)(unsigned long) ctrl->channels[c].current_d.next; (uint32_t)ctrl->channels[c].current_d.next;
/* Load new descriptor. */ /* Load new descriptor. */
channel_load_d(ctrl, c); channel_load_d(ctrl, c);
saved_data_buf = (uint32_t)(unsigned long) saved_data_buf = (uint32_t)(unsigned long)
@ -455,10 +455,12 @@ static void channel_out_run(struct fs_dma_ctrl *ctrl, int c)
} }
channel_store_d(ctrl, c); channel_store_d(ctrl, c);
ctrl->channels[c].regs[RW_SAVED_DATA_BUF] = saved_data_buf; ctrl->channels[c].regs[RW_SAVED_DATA_BUF] =
saved_data_buf;
D(dump_d(c, &ctrl->channels[c].current_d)); D(dump_d(c, &ctrl->channels[c].current_d));
} }
ctrl->channels[c].regs[RW_SAVED_DATA_BUF] = saved_data_buf; ctrl->channels[c].regs[RW_SAVED_DATA_BUF] = saved_data_buf;
}
} }
static int channel_in_process(struct fs_dma_ctrl *ctrl, int c, static int channel_in_process(struct fs_dma_ctrl *ctrl, int c,
@ -471,7 +473,7 @@ static int channel_in_process(struct fs_dma_ctrl *ctrl, int c,
return 0; return 0;
saved_data_buf = channel_reg(ctrl, c, RW_SAVED_DATA_BUF); saved_data_buf = channel_reg(ctrl, c, RW_SAVED_DATA_BUF);
len = (uint32_t)(unsigned long) ctrl->channels[c].current_d.after; len = (uint32_t)ctrl->channels[c].current_d.after;
len -= saved_data_buf; len -= saved_data_buf;
if (len > buflen) if (len > buflen)
@ -481,7 +483,7 @@ static int channel_in_process(struct fs_dma_ctrl *ctrl, int c,
saved_data_buf += len; saved_data_buf += len;
if (saved_data_buf == if (saved_data_buf ==
(uint32_t)(unsigned long)ctrl->channels[c].current_d.after (uint32_t)ctrl->channels[c].current_d.after
|| eop) { || eop) {
uint32_t r_intr = ctrl->channels[c].regs[R_INTR]; uint32_t r_intr = ctrl->channels[c].regs[R_INTR];
@ -518,10 +520,10 @@ static int channel_in_process(struct fs_dma_ctrl *ctrl, int c,
channel_stop(ctrl, c); channel_stop(ctrl, c);
} else { } else {
ctrl->channels[c].regs[RW_SAVED_DATA] = ctrl->channels[c].regs[RW_SAVED_DATA] =
(uint32_t)(unsigned long) ctrl->channels[c].current_d.next; (uint32_t)ctrl->channels[c].current_d.next;
/* Load new descriptor. */ /* Load new descriptor. */
channel_load_d(ctrl, c); channel_load_d(ctrl, c);
saved_data_buf = (uint32_t)(unsigned long) saved_data_buf = (uint32_t)
ctrl->channels[c].current_d.buf; ctrl->channels[c].current_d.buf;
} }
} }