mirror of https://github.com/xqemu/xqemu.git
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>
This commit is contained in:
parent
9f6113c7e6
commit
73a511decc
|
@ -401,15 +401,29 @@ static int 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];
|
||||||
|
|
||||||
|
struct dma_context_metadata meta;
|
||||||
|
bool send_context = true;
|
||||||
|
|
||||||
if (ctrl->channels[c].eol)
|
if (ctrl->channels[c].eol)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
bool out_eop;
|
||||||
D(printf("ch=%d buf=%x after=%x\n",
|
D(printf("ch=%d buf=%x after=%x\n",
|
||||||
c,
|
c,
|
||||||
(uint32_t)ctrl->channels[c].current_d.buf,
|
(uint32_t)ctrl->channels[c].current_d.buf,
|
||||||
(uint32_t)ctrl->channels[c].current_d.after));
|
(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);
|
channel_load_d(ctrl, c);
|
||||||
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)
|
len = (uint32_t)(unsigned long)
|
||||||
|
@ -420,13 +434,17 @@ static int channel_out_run(struct fs_dma_ctrl *ctrl, int c)
|
||||||
len = sizeof buf;
|
len = sizeof buf;
|
||||||
cpu_physical_memory_read (saved_data_buf, buf, len);
|
cpu_physical_memory_read (saved_data_buf, buf, len);
|
||||||
|
|
||||||
D(printf("channel %d pushes %x %u bytes\n", c,
|
out_eop = ((saved_data_buf + len) ==
|
||||||
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)
|
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,
|
ctrl->channels[c].client->client.opaque,
|
||||||
buf, len);
|
buf, len, out_eop);
|
||||||
else
|
else
|
||||||
printf("WARNING: DMA ch%d dataloss,"
|
printf("WARNING: DMA ch%d dataloss,"
|
||||||
" no attached client.\n", c);
|
" 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) {
|
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. */
|
send_context = true;
|
||||||
D(printf("signal eop\n"));
|
|
||||||
}
|
}
|
||||||
if (ctrl->channels[c].current_d.intr) {
|
if (ctrl->channels[c].current_d.intr) {
|
||||||
/* TODO: signal eop to the client. */
|
|
||||||
/* data intr. */
|
/* data intr. */
|
||||||
D(printf("signal intr %d eol=%d\n",
|
D(printf("signal intr %d eol=%d\n",
|
||||||
len, ctrl->channels[c].current_d.eol));
|
len, ctrl->channels[c].current_d.eol));
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
struct dma_context_metadata {
|
||||||
|
/* data descriptor md */
|
||||||
|
uint16_t metadata;
|
||||||
|
};
|
||||||
|
|
||||||
struct etraxfs_dma_client
|
struct etraxfs_dma_client
|
||||||
{
|
{
|
||||||
/* DMA controller. */
|
/* DMA controller. */
|
||||||
|
@ -5,10 +10,12 @@ struct etraxfs_dma_client
|
||||||
void *ctrl;
|
void *ctrl;
|
||||||
|
|
||||||
/* client. */
|
/* client. */
|
||||||
struct
|
struct {
|
||||||
{
|
int (*push)(void *opaque, unsigned char *buf,
|
||||||
int (*push)(void *opaque, unsigned char *buf, int len);
|
int len, bool eop);
|
||||||
void (*pull)(void *opaque);
|
void (*pull)(void *opaque);
|
||||||
|
void (*metadata_push)(void *opaque,
|
||||||
|
const struct dma_context_metadata *md);
|
||||||
void *opaque;
|
void *opaque;
|
||||||
} client;
|
} client;
|
||||||
};
|
};
|
||||||
|
|
|
@ -540,7 +540,7 @@ static ssize_t eth_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int eth_tx_push(void *opaque, unsigned char *buf, int len)
|
static int eth_tx_push(void *opaque, unsigned char *buf, int len, bool eop)
|
||||||
{
|
{
|
||||||
struct fs_eth *eth = opaque;
|
struct fs_eth *eth = opaque;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue