Hi:
I am trying to write an SPI driver inside a RT-Linux module. I have
a problem initializing the SPI controller, because I don�t know
how to assign an address (it has to be assigned as physical one, and from
that address, some space has to be allocated continously) to the buffer descriptor
field "rxbd->addr". I tried usind "__pa()" but it fails. Can someone
tell me how I can get a continuous space allocation and its
physical address from an RT-Linux module?
Thank you
Billa
volatile SPI_BD *rxbd, *txbd;
volatile unsigned char txbuf[SPI_TX_LEN], rxbuf[SPI_RX_LEN];
int SPI_init(void)
{
.........
// Initialize BUFFER DESCRIPTORs
for(i=0;i<SPI_RX_LEN;i++){ rxbuf[i]=0; }
rxbd = (volatile SPI_BD *)((unsigned char *)&cp->cp_dpmem[spi->spi_rbase]);
rxbd->addr = __pa(rxbuf);
rxbd->status = RXBD_E | RXBD_W | RXBD_L; // 0xa800 --> Rx: Empty, Wrap, No Interrupt, Last
for(i=0;i<SPI_TX_LEN;i++){ txbuf[i]=0; }
txbd = (volatile SPI_BD *)((unsigned char *)&cp->cp_dpmem[spi->spi_tbase]);
txbd->addr = __pa(txbuf);
txbd->status = TXBD_W| TXBD_L;
.................
}
