[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-users] lwIP on TI C55 processor
From: |
Jamie Granger |
Subject: |
RE: [lwip-users] lwIP on TI C55 processor |
Date: |
Fri, 4 Sep 2009 15:41:01 +0100 |
Hi Jared,
Ok you're right, it does use the whole 16-bits. (I was thinking about
char constants, which do use only the low 8-bits of a 16-bit word).
So on the C55 you have to do a "typedef u16_t u8_t", I agree. However,
I don't think the solution is as simple as doing the typedef plus some
packing/unpacking in the physical layer. I think that there may also be
some problems buried in the internals of lwip due to using u8_t pointer
dereferencing.
Thanks for your various comments.
I need to look into this further, but I'm actually going away on holiday
for a week now, so will forget all about this until I get back.
Many thanks,
Jamie
-----Original Message-----
From: address@hidden
[mailto:address@hidden On
Behalf Of Grubb, Jared
Sent: 03 September 2009 21:40
To: Mailing list for lwIP users
Subject: Re: [lwip-users] lwIP on TI C55 processor
You say that "char" is 16-bits, but only uses the lower 8. I don't
think that's true. For example:
char x = 1000;
int y = x;
printf("%d", y);
I bet that you see "1000" get printed out. (I've never used C55, but
this is my hunch)
In C, the type "char" is defined as being the minimally-addressable
unit in the architecture and sizeof(char)==1 byte. For most
architectures "byte" means "8 bits", but for the C55, "byte" means "16
bits". (This is one reason the RFC's for IPv4/6 all use the word
"octet" rather than "byte" -- "byte" is ambiguous, "octet" always
means 8 bits)
Therefore the type "u8_t" is impossible on the C55 (and likewise for
u8_t*).
For example:
char x[4] = "abc";
should look like 00 65 00 66 00 67 00 00 in memory and be 8 octets
long (but sizeof(x)==4).
If your PHY layer reads that variable x and transmits only the lower 8
bits of every "byte" (skipping over the upper 8 bits completely), then
you can use LwIP on the C55 just fine (do a "typedef u16_t u8_t").
Every packet will take twice as many bytes as it would on a
byte==octet system, but at least it works.
But, if that is not the case, I think you'll have to write a custom IP
stack possibly from scratch, and I think it will be very difficult.
Jared
This email was scanned by Postini, the leading provider in Managed Email
Security. For more information visit
www.groveis.com