Skip to contentSkip to conversation

usb_get_status(): what a weird implementation !

DISCUSSION Oliver Neukum 2 participants 4 messages Jun 30, 2008 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Am Montag 30 Juni 2008 14:41:37 schrieb Francis Moreau:

Quoted 13 lines · Oliver Neukum
Quoted 8 lines

Am Montag 30 Juni 2008 13:04:21 schrieb Francis Moreau:

Quoted 3 lines

well, it wouldn't be hard to allocated a buf on the stack with correct alignement
and size for DMA mapping.

Where would you put it and meet the alignment requirements?

wouldn't this code below do the trick ?

void foo(void)

Quoted 8 lines
{
    unsigned char __buf[2 * CACHE_LINE_SIZE];
    unsigned char *buf;

    buf = ((unsigned long)__buf) + CACHE_LINE_SIZE-1) & ~(CACHE_LINE_SIZE-1);
}

but I agree it looks hackish.

If your buffer is smaller than CACHE_LINE_SIZE it should work. However, this needs input from people who understand DMA in and out. But how large is 2 * CACHE_LINE_SIZE compared to the kernel stack?

Regards
Oliver

#4 lore raw
Quoted 3 lines · Oliver Neukum

If your buffer is smaller than CACHE_LINE_SIZE it should work. However, this needs input from people who understand DMA in and out.

yeah, that's the reason why it's a hack.

Maybe adding a new helper in the dma API would be better...

Quoted 1 line

But how large is 2 * CACHE_LINE_SIZE compared to the kernel stack?

CACHE_LINE_SIZE = 32 bytes is common for embedded systems I guess. For big system, I dunno.

Kernel stack size is usually 4KiB.

Signature · 1 line
Francis
#5 lore raw

Am Montag 30 Juni 2008 16:03:52 schrieb Francis Moreau:

Quoted 7 lines · Oliver Neukum
Quoted 3 lines

If your buffer is smaller than CACHE_LINE_SIZE it should work. However, this needs input from people who understand DMA in and out.

yeah, that's the reason why it's a hack.

Quoted 9 lines

Maybe adding a new helper in the dma API would be better...

Quoted 1 line

But how large is 2 * CACHE_LINE_SIZE compared to the kernel stack?

CACHE_LINE_SIZE = 32 bytes is common for embedded systems I guess. For big system, I dunno.

Kernel stack size is usually 4KiB.

Well, we have:
asm-mips/mach-ip32/kmalloc.h:#define ARCH_KMALLOC_MINALIGN 128
That's 256 bytes, that is 1/16 of the stack.

Regards
Oliver

#6 lore raw
Quoted 4 lines · Oliver Neukum

Well, we have:
asm-mips/mach-ip32/kmalloc.h:#define ARCH_KMALLOC_MINALIGN 128
That's 256 bytes, that is 1/16 of the stack.

yep but I wouldn't call such beast an embedded system ;)

And on this system stack size is 8 KiB.

But I agree a plain stack allocation as I showed is not usable.

Signature · 1 line
Francis