lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] memcpying p->payload?


From: Simon Goldschmidt
Subject: Re: [lwip-users] memcpying p->payload?
Date: Fri, 24 Aug 2012 09:44:47 +0200

girrian seedo <address@hidden> wrote:
> I had a problem when I was trying to memcpy p->payload directly into a
> systems memory. I tried to do it as below.

No idea what's going wrong there. There are so many unknown identifiers 
(variables or defines?) in the code you passed that it's impossible to tell 
what you are doing or what went wrong.

As a hint, the p->payload of each pbuf is only as big as p->len indicates. If 
the packet is bigger than that (p->len != p->tot_len), you have to go on 
copying the next pbuf's payload (p2 = p->next; p2->payload) and so on.

> [..]
> memcpy
> (
> (unsigned int *)(SYSTEM_MEMORY + 4*size),\
> (unsigned int *)(p->payload+PACKET_HEADER),
> bytesReceived-PACKET_HEADER
> );
> 
> This didn't work at all, and my packets data part didn't get copied.
> [..]
> And now from *packet I'm able to copy it into my systems memory address.
> 
> memcpy
> (
> (unsigned int *)(WARPLAB_TXBUFF_RADIO1 + 4*rxArgs0),\
> (unsigned int *)(receiveBuffer),
> bytesReceived-PACKET_HEADER
> );
> Any reason why I wasn't able to copy it directly from p->payload?

The destination pointer of these two example is totally different. I'd suggest 
you are somehow trying to write to an invalid memory pointer.


Simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]