aboutsummaryrefslogtreecommitdiff
path: root/hw/etraxfs_dma.c
diff options
context:
space:
mode:
authorLars Persson <larper@axis.com>2011-12-21 15:11:35 +0100
committerEdgar E. Iglesias <edgar.iglesias@gmail.com>2012-01-12 13:54:17 +0100
commit73a511decc9c87cbc1bac0012d990e4e74a648bf (patch)
treee830b615dc29c38e84d80391f14141321204b465 /hw/etraxfs_dma.c
parent9f6113c7e65a98a88bb95ff5fd8679fbb28f18d6 (diff)
etraxfs-dma: Model metadata and eop
- Send EOP flags to the out channels. - Send data descriptor metadata to the out channels. Signed-off-by: Lars Persson <larper@axis.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Diffstat (limited to 'hw/etraxfs_dma.c')
-rw-r--r--hw/etraxfs_dma.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/hw/etraxfs_dma.c b/hw/etraxfs_dma.c
index d2bd584bc5..332525cab1 100644
--- a/hw/etraxfs_dma.c
+++ b/hw/etraxfs_dma.c
@@ -401,15 +401,29 @@ static int channel_out_run(struct fs_dma_ctrl *ctrl, int c)
uint32_t saved_data_buf;
unsigned char buf[2 * 1024];
+ struct dma_context_metadata meta;
+ bool send_context = true;
+
if (ctrl->channels[c].eol)
return 0;
do {
+ bool out_eop;
D(printf("ch=%d buf=%x after=%x\n",
c,
(uint32_t)ctrl->channels[c].current_d.buf,
(uint32_t)ctrl->channels[c].current_d.after));
+ if (send_context) {
+ if (ctrl->channels[c].client->client.metadata_push) {
+ meta.metadata = ctrl->channels[c].current_d.md;
+ ctrl->channels[c].client->client.metadata_push(
+ ctrl->channels[c].client->client.opaque,
+ &meta);
+ }
+ send_context = false;
+ }
+
channel_load_d(ctrl, c);
saved_data_buf = channel_reg(ctrl, c, RW_SAVED_DATA_BUF);
len = (uint32_t)(unsigned long)
@@ -420,13 +434,17 @@ static int channel_out_run(struct fs_dma_ctrl *ctrl, int c)
len = sizeof buf;
cpu_physical_memory_read (saved_data_buf, buf, len);
- D(printf("channel %d pushes %x %u bytes\n", c,
- saved_data_buf, len));
+ out_eop = ((saved_data_buf + len) ==
+ ctrl->channels[c].current_d.after) &&
+ ctrl->channels[c].current_d.out_eop;
+
+ D(printf("channel %d pushes %x %u bytes eop=%u\n", c,
+ saved_data_buf, len, out_eop));
if (ctrl->channels[c].client->client.push)
ctrl->channels[c].client->client.push(
ctrl->channels[c].client->client.opaque,
- buf, len);
+ buf, len, out_eop);
else
printf("WARNING: DMA ch%d dataloss,"
" no attached client.\n", c);
@@ -437,11 +455,9 @@ static int channel_out_run(struct fs_dma_ctrl *ctrl, int c)
ctrl->channels[c].current_d.after) {
/* Done. Step to next. */
if (ctrl->channels[c].current_d.out_eop) {
- /* TODO: signal eop to the client. */
- D(printf("signal eop\n"));
+ send_context = true;
}
if (ctrl->channels[c].current_d.intr) {
- /* TODO: signal eop to the client. */
/* data intr. */
D(printf("signal intr %d eol=%d\n",
len, ctrl->channels[c].current_d.eol));