[Tinyos-devel] TinyOS-2.x platform independent types?
Matti Juhani Öhman
mohman at cc.hut.fi
Thu Sep 7 02:49:53 PDT 2006
Hi all,
what is the current status of TinyOS platform independent types (aka
network types)? I am trying to compose a message structure with 24-bit
little endian integers with no success.
The most useful source of information I could find is the TinyOS
Programming Manual. It explains platform independent types it does not
mention bit fields at all.
I did some test with the nesC compiler. It seems that big endian types
support bit fields but little endian types do not:
typedef nx_struct test_t {
nx_uint32_t a:24;
nx_uint32_t b:24;
nx_uint32_t c:24;
nx_uint32_t d:24;
} test_t;
-> compiles just fine, but
typedef nx_struct test_t {
nxle_uint32_t a:24;
nxle_uint32_t b:24;
nxle_uint32_t c:24;
nxle_uint32_t d:24;
} test_t;
-> gives a compiler error: "type of `a' cannot be used as a bit-field"
Shouldn't it be possible to declare little endian bitfields?
The supported platform independent big endian (little endian) types are:
nx_uint8_t (nxle_uint8_t) -> 1 byte
nx_uint16_t (nxle_uint16_t) -> 2 bytes
nx_uint32_t (nxle_uint32_t) -> 4 bytes
For completeness, the following types could also be supported:
nx_uint24_t (nxle_uint24_t) -> 3 bytes
The big endian version (nx_uint24_t) can be simulated with bit fields (as
above), but the little endian version cannot? Am I missing something?
Cheers,
Matti
More information about the Tinyos-devel
mailing list