Fixed alignment problem on the MSP430, where the LPP header may be misaligned
This commit is contained in:
parent
dc8338d248
commit
04101aae36
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: lpp.c,v 1.14 2009/03/31 14:44:13 nvt-se Exp $
|
* $Id: lpp.c,v 1.15 2009/03/31 17:39:54 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -251,22 +251,21 @@ dutycycle(void *ptr)
|
||||||
static int
|
static int
|
||||||
send_packet(void)
|
send_packet(void)
|
||||||
{
|
{
|
||||||
struct lpp_hdr *hdr;
|
struct lpp_hdr hdr;
|
||||||
clock_time_t timeout;
|
clock_time_t timeout;
|
||||||
|
|
||||||
packetbuf_hdralloc(sizeof(struct lpp_hdr));
|
rimeaddr_copy(&hdr.sender, &rimeaddr_node_addr);
|
||||||
hdr = packetbuf_hdrptr();
|
rimeaddr_copy(&hdr.receiver, packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
|
||||||
|
hdr.type = TYPE_DATA;
|
||||||
|
|
||||||
rimeaddr_copy(&hdr->sender, &rimeaddr_node_addr);
|
packetbuf_hdralloc(sizeof(struct lpp_hdr));
|
||||||
rimeaddr_copy(&hdr->receiver, packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
|
memcpy(packetbuf_hdrptr(), &hdr, sizeof(struct lpp_hdr));
|
||||||
hdr->type = TYPE_DATA;
|
|
||||||
|
|
||||||
packetbuf_compact();
|
packetbuf_compact();
|
||||||
PRINTF("%d.%d: queueing packet to %d.%d, channel %d\n",
|
PRINTF("%d.%d: queueing packet to %d.%d, channel %d\n",
|
||||||
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
|
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
|
||||||
hdr->receiver.u8[0], hdr->receiver.u8[1],
|
hdr.receiver.u8[0], hdr.receiver.u8[1],
|
||||||
packetbuf_attr(PACKETBUF_ATTR_CHANNEL));
|
packetbuf_attr(PACKETBUF_ATTR_CHANNEL));
|
||||||
|
|
||||||
if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == PACKETBUF_ATTR_PACKET_TYPE_ACK) {
|
if(packetbuf_attr(PACKETBUF_ATTR_PACKET_TYPE) == PACKETBUF_ATTR_PACKET_TYPE_ACK) {
|
||||||
/* Immediately send ACKs - we're assuming that the other node is
|
/* Immediately send ACKs - we're assuming that the other node is
|
||||||
listening. */
|
listening. */
|
||||||
|
@ -283,7 +282,7 @@ send_packet(void)
|
||||||
} else {
|
} else {
|
||||||
list_add(queued_packets_list, i);
|
list_add(queued_packets_list, i);
|
||||||
timeout = UNICAST_TIMEOUT;
|
timeout = UNICAST_TIMEOUT;
|
||||||
if(rimeaddr_cmp(&hdr->receiver, &rimeaddr_null)) {
|
if(rimeaddr_cmp(&hdr.receiver, &rimeaddr_null)) {
|
||||||
timeout = PACKET_LIFETIME;
|
timeout = PACKET_LIFETIME;
|
||||||
}
|
}
|
||||||
ctimer_set(&i->timer, timeout, remove_queued_packet, i);
|
ctimer_set(&i->timer, timeout, remove_queued_packet, i);
|
||||||
|
|
Loading…
Reference in a new issue