fixed alignment problem with rime/chameleon
This commit is contained in:
parent
b0d37c34e3
commit
fabe4393f7
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: chameleon-bitopt.c,v 1.2 2008/02/28 21:25:34 oliverschmidt Exp $
|
||||
* $Id: chameleon-bitopt.c,v 1.3 2008/04/01 13:10:22 nifi Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -45,7 +45,7 @@
|
|||
#include <string.h>
|
||||
|
||||
struct bitopt_hdr {
|
||||
uint16_t channel;
|
||||
uint8_t channel[2];
|
||||
};
|
||||
|
||||
static const uint8_t bitmask[9] = { 0x00, 0x80, 0xc0, 0xe0, 0xf0,
|
||||
|
@ -268,7 +268,8 @@ pack_header(struct channel *c)
|
|||
|
||||
rimebuf_hdralloc(sizeof(struct bitopt_hdr));
|
||||
hdr = (struct bitopt_hdr *)rimebuf_hdrptr();
|
||||
hdr->channel = c->channelno;
|
||||
hdr->channel[0] = c->channelno & 0xff;
|
||||
hdr->channel[1] = (c->channelno & 0xff) << 8;
|
||||
|
||||
return 1; /* Send out packet */
|
||||
}
|
||||
|
@ -288,7 +289,7 @@ unpack_header(void)
|
|||
for. */
|
||||
hdr = (struct bitopt_hdr *)rimebuf_dataptr();
|
||||
rimebuf_hdrreduce(sizeof(struct bitopt_hdr));
|
||||
c = channel_lookup(hdr->channel);
|
||||
c = channel_lookup((hdr->channel[1] << 8) + (hdr->channel[0]));
|
||||
if(c == NULL) {
|
||||
PRINTF("chameleon-bitopt: input: channel %d not found\n", hdr->channel);
|
||||
return NULL;
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: rimeaddr.c,v 1.6 2007/08/30 14:39:17 matsutsuka Exp $
|
||||
* $Id: rimeaddr.c,v 1.7 2008/04/01 13:10:22 nifi Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -52,13 +52,15 @@ const rimeaddr_t rimeaddr_null = { { 0, 0 } };
|
|||
void
|
||||
rimeaddr_copy(rimeaddr_t *dest, const rimeaddr_t *src)
|
||||
{
|
||||
dest->u16[0] = src->u16[0];
|
||||
dest->u8[0] = src->u8[0];
|
||||
dest->u8[1] = src->u8[1];
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
rimeaddr_cmp(const rimeaddr_t *addr1, const rimeaddr_t *addr2)
|
||||
{
|
||||
return addr1->u16[0] == addr2->u16[0];
|
||||
return addr1->u8[0] == addr2->u8[0] &&
|
||||
addr1->u8[1] == addr2->u8[1];
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
|
|
Loading…
Reference in a new issue