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

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
connected?

Thank you.

Best regards,
Yuriy.

    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);