Re: DMA

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

 



On 24-04-08 08:28, jeyram jadenthradevan wrote:

i am a beginner level in driver programming. please help to solve this problem.

this is a part of the internal modem driver coding. this is for intel chip set internal modem.

-------------------------------------------------------------------------------------------------------------------------------------------------------------

// ZT_MAX_CHUNKSIZE = 8


wc->writechunk = (int *)pci_alloc_consistent(pdev, ZT_MAX_CHUNKSIZE * 2 * 2 * 2 * 4, &wc->writedma);
    if (!wc->writechunk) {
        printk("wcfxo: Unable to allocate DMA-able memory\n");
        if (wc->freeregion)
            release_region(wc->ioaddr, 0xff);
        return -ENOMEM;
    }

wc->readchunk = wc->writechunk + ZT_MAX_CHUNKSIZE * 4; /* in doublewords */ wc->readdma = wc->writedma + ZT_MAX_CHUNKSIZE * 16; /* in bytes */

---------------------------------------------------------------------------------------------------------------------------------------------------------------


here they are creating 2 chunks for writing and reading.


but i couldn't understand this line.
wc->readdma = wc->writedma + ZT_MAX_CHUNKSIZE * 16;

why are they using ZT_MAX_CHUNKSIZE * 16 for allocating read chunk?

I gather "a chunk" is some entity consisting of 4 32-bit datums.

wc->writechunk is an int * I see from the cast and (I suppose) wc->writedma is a char *. C pointer arrithmetic says p + i = (char *)p + i * sizeof(*p) meaning both would end up at the same numeric value. I guess that was the question?

Rene.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux