[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Par port DMA

I haven't studied the code in detail but here are some pointers:
For the parallel port to work you have to enable it and connect the DMAs
to it in R_GEN_CONFIG. You also have to make sure that other interfaces
that uses the same pins and/or DMA channels (e.g. IDE) are disabled.

>*port->out_dma_descr = virt_to_phys(descr);
>*port->out_dma_first = virt_to_phys(descr);
>*port->out_dma_buf   = virt_to_phys(port->out_buffer);
>*port->out_dma_cmd = IO_STATE(R_DMA_CH2_CMD, cmd, restart);

You should do:
*port->out_dma_first = virt_to_phys(descr);
*port->out_dma_buf   = virt_to_phys(port->out_buffer);
*port->out_dma_cmd = IO_STATE(R_DMA_CH2_CMD, cmd, start);

Restart is typically used if there might be a running transfer that
you want to add more data to.

-----Original Message-----
From: owner-dev-etrax@xxxxxxx.com">mailto:owner-dev-etrax@xxxxxxx.com] On
Behalf Of Yuriy Prokazov
Sent: Wednesday, September 24, 2003 5:13 PM
To: dev-etrax
Subject: Par port DMA

Dear ETRAX developers,

I want to write info to the par0 using DMA. I wrote the code listed
below. I ignore acknowledgments and strobes. I just want to push data
out. Is there anything wrong with it?

Is it possible to write to parport without any additional hardware

Thank you.

Best regards,

    SETS(port->config_shadow, R_PAR0_CONFIG, mode, ecp_fwd);
    SETS(port->config_shadow, R_PAR0_CONFIG, ign_ack, ignore);
    SETS(port->config_shadow, R_PAR0_CONFIG, oe_ack, dont_wait);
    SETS(port->config_shadow, R_PAR0_CONFIG, dma, enable);
    SETS(port->config_shadow, R_PAR0_CONFIG, wide, disable);
    SETS(port->config_shadow, R_PAR0_CONFIG, force, on);
    *port->config = port->config_shadow;
    while (((*port->status_data) & IO_MASK(R_PAR0_STATUS_DATA, mode)) !=
        IO_STATE(R_PAR0_STATUS_DATA, mode, ecp_fwd));
    *port->ctrl_data = 0;
    *port->delay = 0;
    for( i=0; i<OUT_BUFFER_SIZE; i+=4 )
        port->out_buffer[i  ] = 0xff;
        port->out_buffer[i+1] = 0;
        port->out_buffer[i+2] = 0xff;
        port->out_buffer[i+3] = 0;

    descr = &port->out_descrs;
    descr->sw_len = OUT_BUFFER_SIZE;
    descr->buf  = virt_to_phys(port->out_buffer);
    descr->ctrl |= d_eol | d_eop | d_wait;

    *port->out_dma_descr = virt_to_phys(descr);
    *port->out_dma_first = virt_to_phys(descr);
    *port->out_dma_buf   = virt_to_phys(port->out_buffer);
    *port->out_dma_cmd = IO_STATE(R_DMA_CH2_CMD, cmd, restart);