lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] lwIP on TI C55 processor


From: Grubb, Jared
Subject: Re: [lwip-users] lwIP on TI C55 processor
Date: Thu, 3 Sep 2009 13:40:24 -0700

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

On 3 Sep 2009, at 08:21, Jamie Granger wrote:

> Chris,
>
> Yes, the C55 does allow packing 8-bit values to/from 16-bit words as  
> you
> suggest.  This is all just 16-bit operations, and shifting and  
> masking,
> which are fine.  In fact there is a "char" type on the C55, but it  
> is a
> 16-bit value which uses only the lower 8-bits.
>
> So I think, in many places in lwip where an 8-bit pointer is used to
> access memory, I would have to replace it with some packing/unpacking
> similar to your example.  It looks like it might be a lot of work -
> which is why I was asking if anyone's already done it.
>
> Thanks,
> Jamie
>
>
>
> -----Original Message-----
> Jamie,
>
> Does the C55 provide any way of handling 8 bits, or of packing 16 bits
> down to 8?
>
> For instance:
>
> int16 a,b,c;
>
>        c = (a<<8) + (b & 0x00ff);
>
> where the 8 bit values are the bottom 8 bits of the 16 bit a and b.
>
> Much of the data encoding in TCP/IP etc is 8 bit values packed into 16
> bit locations. If you can manage the pack and unpack, then there is
> hope.
>
> Regards,
>
> Chris.
> -- 
> ------------------------------------------------------------------------
> ---
> | Chris Williams    EMail address@hidden
> |
> |                   Web www.chrydesn.co.uk
> |
> |                   Tel/Fax  01686 688065
> |
> | Chrysalis Design. Electronics, Computers, Hardware, Software.
> |
> |                   Design and development to meet all your needs.
> |
> ------------------------------------------------------------------------
> ---
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
> This e-mail and any files transmitted with it ("E-mail") is intended  
> solely for the
> addressee(s) and may contain confidential and/or legally privileged  
> information.
> If you are not the addressee(s), any disclosure, reproduction,  
> copying, distribution
> or other use of the E-mail is prohibited. If you have received this  
> E-mail in error,
> please delete it and notify the sender immediately via our  
> switchboard or return e-mail.
>
> Neither the company nor any individual sending this E-mail accepts  
> any liability
> in respect of the content (including errors and omissions) and  
> timeliness of the E-mail
> which arise as a result of transmission. If verification is  
> required, please request
> a hard copy version.
>
> ERA Technology Ltd Registered in England Number 4044609 Registered  
> Office:
> Brook Road, Wimborne, Dorset, U.K. BH21 2BJ .
> This email was scanned by Postini, the leading provider in Managed  
> Email Security.  For more information visit
> www.groveis.com
>
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users





reply via email to

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