commit
17a935ddf5
19 changed files with 200 additions and 168 deletions
|
@ -93,3 +93,6 @@ unsigned char leds_arch_get(void);
|
|||
void leds_arch_set(unsigned char leds);
|
||||
|
||||
#endif /* LEDS_H_ */
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
struct ringbuf {
|
||||
uint8_t *data;
|
||||
uint8_t mask;
|
||||
|
||||
|
||||
/* XXX these must be 8-bit quantities to avoid race conditions. */
|
||||
uint8_t put_ptr, get_ptr;
|
||||
};
|
||||
|
@ -129,3 +129,6 @@ int ringbuf_size(struct ringbuf *r);
|
|||
int ringbuf_elements(struct ringbuf *r);
|
||||
|
||||
#endif /* RINGBUF_H_ */
|
||||
|
||||
/** @}*/
|
||||
/** @}*/
|
||||
|
|
|
@ -243,15 +243,15 @@ uip_add32(uint8_t *op32, uint16_t op16)
|
|||
uip_acc32[2] = op32[2] + (op16 >> 8);
|
||||
uip_acc32[1] = op32[1];
|
||||
uip_acc32[0] = op32[0];
|
||||
|
||||
|
||||
if(uip_acc32[2] < (op16 >> 8)) {
|
||||
++uip_acc32[1];
|
||||
if(uip_acc32[1] == 0) {
|
||||
++uip_acc32[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(uip_acc32[3] < (op16 & 0xff)) {
|
||||
++uip_acc32[2];
|
||||
if(uip_acc32[2] == 0) {
|
||||
|
@ -276,7 +276,7 @@ chksum(uint16_t sum, const uint8_t *data, uint16_t len)
|
|||
|
||||
dataptr = data;
|
||||
last_byte = data + len - 1;
|
||||
|
||||
|
||||
while(dataptr < last_byte) { /* At least two more bytes */
|
||||
t = (dataptr[0] << 8) + dataptr[1];
|
||||
sum += t;
|
||||
|
@ -285,7 +285,7 @@ chksum(uint16_t sum, const uint8_t *data, uint16_t len)
|
|||
}
|
||||
dataptr += 2;
|
||||
}
|
||||
|
||||
|
||||
if(dataptr == last_byte) {
|
||||
t = (dataptr[0] << 8) + 0;
|
||||
sum += t;
|
||||
|
@ -321,15 +321,15 @@ upper_layer_chksum(uint8_t proto)
|
|||
{
|
||||
uint16_t upper_layer_len;
|
||||
uint16_t sum;
|
||||
|
||||
|
||||
#if UIP_CONF_IPV6
|
||||
upper_layer_len = (((uint16_t)(BUF->len[0]) << 8) + BUF->len[1]);
|
||||
#else /* UIP_CONF_IPV6 */
|
||||
upper_layer_len = (((uint16_t)(BUF->len[0]) << 8) + BUF->len[1]) - UIP_IPH_LEN;
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
|
||||
|
||||
/* First sum pseudoheader. */
|
||||
|
||||
|
||||
/* IP protocol and length fields. This addition cannot carry. */
|
||||
sum = upper_layer_len + proto;
|
||||
/* Sum IP source and destination addresses. */
|
||||
|
@ -338,7 +338,7 @@ upper_layer_chksum(uint8_t proto)
|
|||
/* Sum TCP header and data. */
|
||||
sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN],
|
||||
upper_layer_len);
|
||||
|
||||
|
||||
return (sum == 0) ? 0xffff : uip_htons(sum);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -347,7 +347,7 @@ uint16_t
|
|||
uip_icmp6chksum(void)
|
||||
{
|
||||
return upper_layer_chksum(UIP_PROTO_ICMP6);
|
||||
|
||||
|
||||
}
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -384,7 +384,7 @@ uip_init(void)
|
|||
uip_udp_conns[c].lport = 0;
|
||||
}
|
||||
#endif /* UIP_UDP */
|
||||
|
||||
|
||||
|
||||
/* IPv4 initialization. */
|
||||
#if UIP_FIXEDADDR == 0
|
||||
|
@ -398,7 +398,7 @@ struct uip_conn *
|
|||
uip_connect(uip_ipaddr_t *ripaddr, uint16_t rport)
|
||||
{
|
||||
register struct uip_conn *conn, *cconn;
|
||||
|
||||
|
||||
/* Find an unused local port. */
|
||||
again:
|
||||
++lastport;
|
||||
|
@ -435,7 +435,7 @@ uip_connect(uip_ipaddr_t *ripaddr, uint16_t rport)
|
|||
if(conn == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
conn->tcpstateflags = UIP_SYN_SENT;
|
||||
|
||||
conn->snd_nxt[0] = iss[0];
|
||||
|
@ -444,7 +444,7 @@ uip_connect(uip_ipaddr_t *ripaddr, uint16_t rport)
|
|||
conn->snd_nxt[3] = iss[3];
|
||||
|
||||
conn->initialmss = conn->mss = UIP_TCP_MSS;
|
||||
|
||||
|
||||
conn->len = 1; /* TCP length of the SYN is one. */
|
||||
conn->nrtx = 0;
|
||||
conn->timer = 1; /* Send the SYN next time around. */
|
||||
|
@ -454,7 +454,7 @@ uip_connect(uip_ipaddr_t *ripaddr, uint16_t rport)
|
|||
conn->lport = uip_htons(lastport);
|
||||
conn->rport = rport;
|
||||
uip_ipaddr_copy(&conn->ripaddr, ripaddr);
|
||||
|
||||
|
||||
return conn;
|
||||
}
|
||||
#endif /* UIP_ACTIVE_OPEN */
|
||||
|
@ -464,7 +464,7 @@ struct uip_udp_conn *
|
|||
uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport)
|
||||
{
|
||||
register struct uip_udp_conn *conn;
|
||||
|
||||
|
||||
/* Find an unused local port. */
|
||||
again:
|
||||
++lastport;
|
||||
|
@ -472,7 +472,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport)
|
|||
if(lastport >= 32000) {
|
||||
lastport = 4096;
|
||||
}
|
||||
|
||||
|
||||
for(c = 0; c < UIP_UDP_CONNS; ++c) {
|
||||
if(uip_udp_conns[c].lport == uip_htons(lastport)) {
|
||||
goto again;
|
||||
|
@ -491,7 +491,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport)
|
|||
if(conn == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
conn->lport = UIP_HTONS(lastport);
|
||||
conn->rport = rport;
|
||||
if(ripaddr == NULL) {
|
||||
|
@ -500,7 +500,7 @@ uip_udp_new(const uip_ipaddr_t *ripaddr, uint16_t rport)
|
|||
uip_ipaddr_copy(&conn->ripaddr, ripaddr);
|
||||
}
|
||||
conn->ttl = UIP_TTL;
|
||||
|
||||
|
||||
return conn;
|
||||
}
|
||||
#endif /* UIP_UDP */
|
||||
|
@ -585,12 +585,12 @@ uip_reass(void)
|
|||
memcpy(&uip_reassbuf[UIP_IPH_LEN + offset],
|
||||
(char *)BUF + (int)((BUF->vhl & 0x0f) * 4),
|
||||
len);
|
||||
|
||||
|
||||
/* Update the bitmap. */
|
||||
if(offset / (8 * 8) == (offset + len) / (8 * 8)) {
|
||||
/* If the two endpoints are in the same byte, we only update
|
||||
that byte. */
|
||||
|
||||
|
||||
uip_reassbitmap[offset / (8 * 8)] |=
|
||||
bitmap_bits[(offset / 8 ) & 7] &
|
||||
~bitmap_bits[((offset + len) / 8 ) & 7];
|
||||
|
@ -606,7 +606,7 @@ uip_reass(void)
|
|||
uip_reassbitmap[(offset + len) / (8 * 8)] |=
|
||||
~bitmap_bits[((offset + len) / 8 ) & 7];
|
||||
}
|
||||
|
||||
|
||||
/* If this fragment has the More Fragments flag set to zero, we
|
||||
know that this is the last fragment, so we can calculate the
|
||||
size of the entire packet. We also set the
|
||||
|
@ -617,7 +617,7 @@ uip_reass(void)
|
|||
uip_reassflags |= UIP_REASS_FLAG_LASTFRAG;
|
||||
uip_reasslen = offset + len;
|
||||
}
|
||||
|
||||
|
||||
/* Finally, we check if we have a full packet in the buffer. We do
|
||||
this by checking if we have the last fragment and if all bits
|
||||
in the bitmap are set. */
|
||||
|
@ -679,7 +679,7 @@ uip_process(uint8_t flag)
|
|||
goto udp_send;
|
||||
}
|
||||
#endif /* UIP_UDP */
|
||||
|
||||
|
||||
uip_sappdata = uip_appdata = &uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN];
|
||||
|
||||
/* Check if we were invoked because of a poll request for a
|
||||
|
@ -698,7 +698,7 @@ uip_process(uint8_t flag)
|
|||
#endif /* UIP_ACTIVE_OPEN */
|
||||
}
|
||||
goto drop;
|
||||
|
||||
|
||||
/* Check if we were invoked because of the perodic timer fireing. */
|
||||
} else if(flag == UIP_TIMER) {
|
||||
#if UIP_REASSEMBLY
|
||||
|
@ -759,7 +759,7 @@ uip_process(uint8_t flag)
|
|||
4:
|
||||
uip_connr->nrtx);
|
||||
++(uip_connr->nrtx);
|
||||
|
||||
|
||||
/* Ok, so we need to retransmit. We do this differently
|
||||
depending on which state we are in. In ESTABLISHED, we
|
||||
call upon the application so that it may prepare the
|
||||
|
@ -772,14 +772,14 @@ uip_process(uint8_t flag)
|
|||
/* In the SYN_RCVD state, we should retransmit our
|
||||
SYNACK. */
|
||||
goto tcp_send_synack;
|
||||
|
||||
|
||||
#if UIP_ACTIVE_OPEN
|
||||
case UIP_SYN_SENT:
|
||||
/* In the SYN_SENT state, we retransmit out SYN. */
|
||||
BUF->flags = 0;
|
||||
goto tcp_send_syn;
|
||||
#endif /* UIP_ACTIVE_OPEN */
|
||||
|
||||
|
||||
case UIP_ESTABLISHED:
|
||||
/* In the ESTABLISHED state, we call upon the application
|
||||
to do the actual retransmit after which we jump into
|
||||
|
@ -788,13 +788,13 @@ uip_process(uint8_t flag)
|
|||
uip_flags = UIP_REXMIT;
|
||||
UIP_APPCALL();
|
||||
goto apprexmit;
|
||||
|
||||
|
||||
case UIP_FIN_WAIT_1:
|
||||
case UIP_CLOSING:
|
||||
case UIP_LAST_ACK:
|
||||
/* In all these states we should retransmit a FINACK. */
|
||||
goto tcp_send_finack;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} else if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED) {
|
||||
|
@ -827,7 +827,7 @@ uip_process(uint8_t flag)
|
|||
UIP_STAT(++uip_stat.ip.recv);
|
||||
|
||||
/* Start of IP input header processing code. */
|
||||
|
||||
|
||||
#if UIP_CONF_IPV6
|
||||
/* Check validity of the IP header. */
|
||||
if((BUF->vtc & 0xf0) != 0x60) { /* IP version and header length. */
|
||||
|
@ -845,7 +845,7 @@ uip_process(uint8_t flag)
|
|||
goto drop;
|
||||
}
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
|
||||
|
||||
/* Check the size of the packet. If the size reported to us in
|
||||
uip_len is smaller the size reported in the IP header, we assume
|
||||
that the packet has been corrupted in transit. If the size of
|
||||
|
@ -922,7 +922,7 @@ uip_process(uint8_t flag)
|
|||
goto udp_input;
|
||||
}
|
||||
#endif /* UIP_BROADCAST */
|
||||
|
||||
|
||||
/* Check if the packet is destined for our IP address. */
|
||||
#if !UIP_CONF_IPV6
|
||||
if(!uip_ipaddr_cmp(&BUF->destipaddr, &uip_hostaddr)) {
|
||||
|
@ -1042,14 +1042,14 @@ uip_process(uint8_t flag)
|
|||
/* Save the sender's address in our neighbor list. */
|
||||
uip_neighbor_add(&ICMPBUF->srcipaddr, &(ICMPBUF->options[2]));
|
||||
}
|
||||
|
||||
|
||||
/* We should now send a neighbor advertisement back to where the
|
||||
neighbor solicication came from. */
|
||||
ICMPBUF->type = ICMP6_NEIGHBOR_ADVERTISEMENT;
|
||||
ICMPBUF->flags = ICMP6_FLAG_S; /* Solicited flag. */
|
||||
|
||||
|
||||
ICMPBUF->reserved1 = ICMPBUF->reserved2 = ICMPBUF->reserved3 = 0;
|
||||
|
||||
|
||||
uip_ipaddr_copy(&ICMPBUF->destipaddr, &ICMPBUF->srcipaddr);
|
||||
uip_ipaddr_copy(&ICMPBUF->srcipaddr, &uip_hostaddr);
|
||||
ICMPBUF->options[0] = ICMP6_OPTION_TARGET_LINK_ADDRESS;
|
||||
|
@ -1057,9 +1057,9 @@ uip_process(uint8_t flag)
|
|||
memcpy(&(ICMPBUF->options[2]), &uip_lladdr, sizeof(uip_lladdr));
|
||||
ICMPBUF->icmpchksum = 0;
|
||||
ICMPBUF->icmpchksum = ~uip_icmp6chksum();
|
||||
|
||||
|
||||
goto send;
|
||||
|
||||
|
||||
}
|
||||
goto drop;
|
||||
} else if(ICMPBUF->type == ICMP6_ECHO) {
|
||||
|
@ -1068,12 +1068,12 @@ uip_process(uint8_t flag)
|
|||
ICMP checksum before we return the packet. */
|
||||
|
||||
ICMPBUF->type = ICMP6_ECHO_REPLY;
|
||||
|
||||
|
||||
uip_ipaddr_copy(&BUF->destipaddr, &BUF->srcipaddr);
|
||||
uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
|
||||
ICMPBUF->icmpchksum = 0;
|
||||
ICMPBUF->icmpchksum = ~uip_icmp6chksum();
|
||||
|
||||
|
||||
UIP_STAT(++uip_stat.icmp.sent);
|
||||
goto send;
|
||||
} else {
|
||||
|
@ -1085,7 +1085,7 @@ uip_process(uint8_t flag)
|
|||
}
|
||||
|
||||
/* End of IPv6 ICMP processing. */
|
||||
|
||||
|
||||
#endif /* !UIP_CONF_IPV6 */
|
||||
|
||||
#if UIP_UDP
|
||||
|
@ -1168,7 +1168,7 @@ uip_process(uint8_t flag)
|
|||
#else /* UIP_CONF_ICMP_DEST_UNREACH */
|
||||
goto drop;
|
||||
#endif /* UIP_CONF_ICMP_DEST_UNREACH */
|
||||
|
||||
|
||||
udp_found:
|
||||
UIP_STAT(++uip_stat.udp.recv);
|
||||
uip_conn = NULL;
|
||||
|
@ -1204,7 +1204,7 @@ uip_process(uint8_t flag)
|
|||
|
||||
uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
|
||||
uip_ipaddr_copy(&BUF->destipaddr, &uip_udp_conn->ripaddr);
|
||||
|
||||
|
||||
uip_appdata = &uip_buf[UIP_LLH_LEN + UIP_IPTCPH_LEN];
|
||||
|
||||
#if UIP_UDP_CHECKSUMS
|
||||
|
@ -1214,18 +1214,18 @@ uip_process(uint8_t flag)
|
|||
UDPBUF->udpchksum = 0xffff;
|
||||
}
|
||||
#endif /* UIP_UDP_CHECKSUMS */
|
||||
|
||||
|
||||
UIP_STAT(++uip_stat.udp.sent);
|
||||
goto ip_send_nolen;
|
||||
#endif /* UIP_UDP */
|
||||
|
||||
|
||||
/* TCP input processing. */
|
||||
#if UIP_TCP
|
||||
tcp_input:
|
||||
UIP_STAT(++uip_stat.tcp.recv);
|
||||
|
||||
/* Start of TCP input header processing code. */
|
||||
|
||||
|
||||
if(uip_tcpchksum() != 0xffff) { /* Compute and check the TCP
|
||||
checksum. */
|
||||
UIP_STAT(++uip_stat.tcp.drop);
|
||||
|
@ -1239,7 +1239,7 @@ uip_process(uint8_t flag)
|
|||
UIP_LOG("tcp: zero port.");
|
||||
goto drop;
|
||||
}
|
||||
|
||||
|
||||
/* Demultiplex this segment. */
|
||||
/* First check any active connections. */
|
||||
for(uip_connr = &uip_conns[0]; uip_connr <= &uip_conns[UIP_CONNS - 1];
|
||||
|
@ -1259,7 +1259,7 @@ uip_process(uint8_t flag)
|
|||
if((BUF->flags & TCP_CTL) != TCP_SYN) {
|
||||
goto reset;
|
||||
}
|
||||
|
||||
|
||||
tmp16 = BUF->destport;
|
||||
/* Next, check listening connections. */
|
||||
for(c = 0; c < UIP_LISTENPORTS; ++c) {
|
||||
|
@ -1267,7 +1267,7 @@ uip_process(uint8_t flag)
|
|||
goto found_listen;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* No matching connection found, so we send a RST packet. */
|
||||
UIP_STAT(++uip_stat.tcp.synrst);
|
||||
|
||||
|
@ -1278,7 +1278,7 @@ uip_process(uint8_t flag)
|
|||
}
|
||||
|
||||
UIP_STAT(++uip_stat.tcp.rst);
|
||||
|
||||
|
||||
BUF->flags = TCP_RST | TCP_ACK;
|
||||
uip_len = UIP_IPTCPH_LEN;
|
||||
BUF->tcpoffset = 5 << 4;
|
||||
|
@ -1287,15 +1287,15 @@ uip_process(uint8_t flag)
|
|||
c = BUF->seqno[3];
|
||||
BUF->seqno[3] = BUF->ackno[3];
|
||||
BUF->ackno[3] = c;
|
||||
|
||||
|
||||
c = BUF->seqno[2];
|
||||
BUF->seqno[2] = BUF->ackno[2];
|
||||
BUF->ackno[2] = c;
|
||||
|
||||
|
||||
c = BUF->seqno[1];
|
||||
BUF->seqno[1] = BUF->ackno[1];
|
||||
BUF->ackno[1] = c;
|
||||
|
||||
|
||||
c = BUF->seqno[0];
|
||||
BUF->seqno[0] = BUF->ackno[0];
|
||||
BUF->ackno[0] = c;
|
||||
|
@ -1310,16 +1310,16 @@ uip_process(uint8_t flag)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Swap port numbers. */
|
||||
tmp16 = BUF->srcport;
|
||||
BUF->srcport = BUF->destport;
|
||||
BUF->destport = tmp16;
|
||||
|
||||
|
||||
/* Swap IP addresses. */
|
||||
uip_ipaddr_copy(&BUF->destipaddr, &BUF->srcipaddr);
|
||||
uip_ipaddr_copy(&BUF->srcipaddr, &uip_hostaddr);
|
||||
|
||||
|
||||
/* And send out the RST packet! */
|
||||
goto tcp_send_noconn;
|
||||
|
||||
|
@ -1356,7 +1356,7 @@ uip_process(uint8_t flag)
|
|||
goto drop;
|
||||
}
|
||||
uip_conn = uip_connr;
|
||||
|
||||
|
||||
/* Fill in the necessary fields for the new connection. */
|
||||
uip_connr->rto = uip_connr->timer = UIP_RTO;
|
||||
uip_connr->sa = 0;
|
||||
|
@ -1397,7 +1397,7 @@ uip_process(uint8_t flag)
|
|||
(uint16_t)uip_buf[UIP_IPTCPH_LEN + UIP_LLH_LEN + 3 + c];
|
||||
uip_connr->initialmss = uip_connr->mss =
|
||||
tmp16 > UIP_TCP_MSS? UIP_TCP_MSS: tmp16;
|
||||
|
||||
|
||||
/* And we are done processing options. */
|
||||
break;
|
||||
} else {
|
||||
|
@ -1412,19 +1412,19 @@ uip_process(uint8_t flag)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Our response will be a SYNACK. */
|
||||
#if UIP_ACTIVE_OPEN
|
||||
tcp_send_synack:
|
||||
BUF->flags = TCP_ACK;
|
||||
|
||||
|
||||
tcp_send_syn:
|
||||
BUF->flags |= TCP_SYN;
|
||||
#else /* UIP_ACTIVE_OPEN */
|
||||
tcp_send_synack:
|
||||
BUF->flags = TCP_SYN | TCP_ACK;
|
||||
#endif /* UIP_ACTIVE_OPEN */
|
||||
|
||||
|
||||
/* We send out the TCP Maximum Segment Size option with our
|
||||
SYNACK. */
|
||||
BUF->optdata[0] = TCP_OPT_MSS;
|
||||
|
@ -1492,7 +1492,7 @@ uip_process(uint8_t flag)
|
|||
uip_connr->snd_nxt[1] = uip_acc32[1];
|
||||
uip_connr->snd_nxt[2] = uip_acc32[2];
|
||||
uip_connr->snd_nxt[3] = uip_acc32[3];
|
||||
|
||||
|
||||
/* Do RTT estimation, unless we have done retransmissions. */
|
||||
if(uip_connr->nrtx == 0) {
|
||||
signed char m;
|
||||
|
@ -1516,7 +1516,7 @@ uip_process(uint8_t flag)
|
|||
/* Reset length of outstanding data. */
|
||||
uip_connr->len = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* Do different things depending on in what state the connection is. */
|
||||
|
@ -1608,7 +1608,7 @@ uip_process(uint8_t flag)
|
|||
uip_conn->tcpstateflags = UIP_CLOSED;
|
||||
goto reset;
|
||||
#endif /* UIP_ACTIVE_OPEN */
|
||||
|
||||
|
||||
case UIP_ESTABLISHED:
|
||||
/* In the ESTABLISHED state, we call upon the application to feed
|
||||
data into the uip_buf. If the UIP_ACKDATA flag is set, the
|
||||
|
@ -1710,7 +1710,7 @@ uip_process(uint8_t flag)
|
|||
UIP_APPCALL();
|
||||
|
||||
appsend:
|
||||
|
||||
|
||||
if(uip_flags & UIP_ABORT) {
|
||||
uip_slen = 0;
|
||||
uip_connr->tcpstateflags = UIP_CLOSED;
|
||||
|
@ -1762,7 +1762,7 @@ uip_process(uint8_t flag)
|
|||
uip_connr->nrtx = 0;
|
||||
apprexmit:
|
||||
uip_appdata = uip_sappdata;
|
||||
|
||||
|
||||
/* If the application has data to be sent, or if the incoming
|
||||
packet had new data in it, we must send out a packet. */
|
||||
if(uip_slen > 0 && uip_connr->len > 0) {
|
||||
|
@ -1791,7 +1791,7 @@ uip_process(uint8_t flag)
|
|||
UIP_APPCALL();
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case UIP_FIN_WAIT_1:
|
||||
/* The application has closed the connection, but the remote host
|
||||
hasn't closed its end yet. Thus we do nothing but wait for a
|
||||
|
@ -1820,7 +1820,7 @@ uip_process(uint8_t flag)
|
|||
goto tcp_send_ack;
|
||||
}
|
||||
goto drop;
|
||||
|
||||
|
||||
case UIP_FIN_WAIT_2:
|
||||
if(uip_len > 0) {
|
||||
uip_add_rcv_nxt(uip_len);
|
||||
|
@ -1840,7 +1840,7 @@ uip_process(uint8_t flag)
|
|||
|
||||
case UIP_TIME_WAIT:
|
||||
goto tcp_send_ack;
|
||||
|
||||
|
||||
case UIP_CLOSING:
|
||||
if(uip_flags & UIP_ACKDATA) {
|
||||
uip_connr->tcpstateflags = UIP_TIME_WAIT;
|
||||
|
@ -1848,12 +1848,12 @@ uip_process(uint8_t flag)
|
|||
}
|
||||
}
|
||||
goto drop;
|
||||
|
||||
|
||||
/* We jump here when we are ready to send the packet, and just want
|
||||
to set the appropriate TCP sequence numbers in the TCP header. */
|
||||
tcp_send_ack:
|
||||
BUF->flags = TCP_ACK;
|
||||
|
||||
|
||||
tcp_send_nodata:
|
||||
uip_len = UIP_IPTCPH_LEN;
|
||||
|
||||
|
@ -1869,14 +1869,14 @@ uip_process(uint8_t flag)
|
|||
BUF->ackno[1] = uip_connr->rcv_nxt[1];
|
||||
BUF->ackno[2] = uip_connr->rcv_nxt[2];
|
||||
BUF->ackno[3] = uip_connr->rcv_nxt[3];
|
||||
|
||||
|
||||
BUF->seqno[0] = uip_connr->snd_nxt[0];
|
||||
BUF->seqno[1] = uip_connr->snd_nxt[1];
|
||||
BUF->seqno[2] = uip_connr->snd_nxt[2];
|
||||
BUF->seqno[3] = uip_connr->snd_nxt[3];
|
||||
|
||||
BUF->proto = UIP_PROTO_TCP;
|
||||
|
||||
|
||||
BUF->srcport = uip_connr->lport;
|
||||
BUF->destport = uip_connr->rport;
|
||||
|
||||
|
@ -1891,7 +1891,7 @@ uip_process(uint8_t flag)
|
|||
BUF->wnd[0] = ((UIP_RECEIVE_WINDOW) >> 8);
|
||||
BUF->wnd[1] = ((UIP_RECEIVE_WINDOW) & 0xff);
|
||||
}
|
||||
|
||||
|
||||
tcp_send_noconn:
|
||||
BUF->ttl = UIP_TTL;
|
||||
#if UIP_CONF_IPV6
|
||||
|
@ -1905,7 +1905,7 @@ uip_process(uint8_t flag)
|
|||
#endif /* UIP_CONF_IPV6 */
|
||||
|
||||
BUF->urgp[0] = BUF->urgp[1] = 0;
|
||||
|
||||
|
||||
/* Calculate TCP checksum. */
|
||||
BUF->tcpchksum = 0;
|
||||
BUF->tcpchksum = ~(uip_tcpchksum());
|
||||
|
@ -1927,14 +1927,14 @@ uip_process(uint8_t flag)
|
|||
BUF->ipchksum = 0;
|
||||
BUF->ipchksum = ~(uip_ipchksum());
|
||||
DEBUG_PRINTF("uip ip_send_nolen: chkecum 0x%04x\n", uip_ipchksum());
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
UIP_STAT(++uip_stat.tcp.sent);
|
||||
#if UIP_CONF_IPV6
|
||||
send:
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
DEBUG_PRINTF("Sending packet with length %d (%d)\n", uip_len,
|
||||
(BUF->len[0] << 8) | BUF->len[1]);
|
||||
|
||||
|
||||
UIP_STAT(++uip_stat.ip.sent);
|
||||
/* Return and let the caller do the actual transmission. */
|
||||
uip_flags = 0;
|
||||
|
@ -1973,5 +1973,6 @@ uip_send(const void *data, int len)
|
|||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
|
||||
/** @}*/
|
||||
|
|
|
@ -296,3 +296,4 @@ uip_ds6_get_least_lifetime_neighbor(void)
|
|||
return nbr_expiring;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
|
|
|
@ -108,3 +108,4 @@ int uip_ds6_nbr_num(void);
|
|||
uip_ds6_nbr_t *uip_ds6_get_least_lifetime_neighbor(void);
|
||||
|
||||
#endif /* UIP_DS6_NEIGHBOR_H_ */
|
||||
/** @} */
|
||||
|
|
|
@ -702,5 +702,6 @@ uip_ds6_compute_reachable_time(void)
|
|||
UIP_ND6_MIN_RANDOM_FACTOR(uip_ds6_if.base_reachable_time));
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** @} */
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
|
||||
/** @}*/
|
||||
|
|
|
@ -166,3 +166,4 @@ int frame802154_parse(uint8_t *data, int length, frame802154_t *pf);
|
|||
|
||||
/** @} */
|
||||
#endif /* FRAME_802154_H */
|
||||
/** @} */
|
||||
|
|
|
@ -365,7 +365,7 @@ check_prefix(rpl_prefix_t *last_prefix, rpl_prefix_t *new_prefix)
|
|||
uip_ds6_addr_rm(rep);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(new_prefix != NULL) {
|
||||
set_ip_from_prefix(&ipaddr, new_prefix);
|
||||
if(uip_ds6_addr_lookup(&ipaddr) == NULL) {
|
||||
|
@ -382,7 +382,7 @@ rpl_set_prefix(rpl_dag_t *dag, uip_ipaddr_t *prefix, unsigned len)
|
|||
{
|
||||
rpl_prefix_t last_prefix;
|
||||
uint8_t last_len = dag->prefix_info.length;
|
||||
|
||||
|
||||
if(len > 128) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ rpl_set_prefix(rpl_dag_t *dag, uip_ipaddr_t *prefix, unsigned len)
|
|||
if(last_len == 0) {
|
||||
PRINTF("rpl_set_prefix - prefix NULL\n");
|
||||
check_prefix(NULL, &dag->prefix_info);
|
||||
} else {
|
||||
} else {
|
||||
PRINTF("rpl_set_prefix - prefix NON-NULL\n");
|
||||
check_prefix(&last_prefix, &dag->prefix_info);
|
||||
}
|
||||
|
@ -1311,3 +1311,4 @@ rpl_lock_parent(rpl_parent_t *p)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
/** @} */
|
||||
|
|
|
@ -357,3 +357,5 @@ rpl_insert_header(void)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
|
||||
/** @}*/
|
||||
|
|
|
@ -274,7 +274,7 @@ dio_input(void)
|
|||
|
||||
PRINTF("RPL: Incoming DIO (id, ver, rank) = (%u,%u,%u)\n",
|
||||
(unsigned)dio.instance_id,
|
||||
(unsigned)dio.version,
|
||||
(unsigned)dio.version,
|
||||
(unsigned)dio.rank);
|
||||
|
||||
dio.grounded = buffer[i] & RPL_DIO_GROUNDED;
|
||||
|
@ -330,11 +330,11 @@ dio_input(void)
|
|||
dio.mc.obj.etx = get16(buffer, i + 6);
|
||||
|
||||
PRINTF("RPL: DAG MC: type %u, flags %u, aggr %u, prec %u, length %u, ETX %u\n",
|
||||
(unsigned)dio.mc.type,
|
||||
(unsigned)dio.mc.flags,
|
||||
(unsigned)dio.mc.aggr,
|
||||
(unsigned)dio.mc.prec,
|
||||
(unsigned)dio.mc.length,
|
||||
(unsigned)dio.mc.type,
|
||||
(unsigned)dio.mc.flags,
|
||||
(unsigned)dio.mc.aggr,
|
||||
(unsigned)dio.mc.prec,
|
||||
(unsigned)dio.mc.length,
|
||||
(unsigned)dio.mc.obj.etx);
|
||||
} else if(dio.mc.type == RPL_DAG_MC_ENERGY) {
|
||||
dio.mc.obj.energy.flags = buffer[i + 6];
|
||||
|
@ -431,7 +431,7 @@ dio_output(rpl_instance_t *instance, uip_ipaddr_t *uc_addr)
|
|||
#endif /* !RPL_LEAF_ONLY */
|
||||
|
||||
#if RPL_LEAF_ONLY
|
||||
/* In leaf mode, we only send DIO messages as unicasts in response to
|
||||
/* In leaf mode, we only send DIO messages as unicasts in response to
|
||||
unicast DIS messages. */
|
||||
if(uc_addr == NULL) {
|
||||
PRINTF("RPL: LEAF ONLY have multicast addr: skip dio_output\n");
|
||||
|
@ -957,3 +957,5 @@ rpl_icmp6_register_handlers()
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
|
||||
/** @}*/
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
* \file
|
||||
* The Minimum Rank with Hysteresis Objective Function (MRHOF)
|
||||
*
|
||||
* This implementation uses the estimated number of
|
||||
* This implementation uses the estimated number of
|
||||
* transmissions (ETX) as the additive routing metric,
|
||||
* and also provides stubs for the energy metric.
|
||||
*
|
||||
|
@ -272,3 +272,5 @@ update_metric_container(rpl_instance_t *instance)
|
|||
#endif /* RPL_DAG_MC == RPL_DAG_MC_ETX */
|
||||
}
|
||||
#endif /* RPL_DAG_MC == RPL_DAG_MC_NONE */
|
||||
|
||||
/** @}*/
|
||||
|
|
|
@ -125,7 +125,7 @@ best_parent(rpl_parent_t *p1, rpl_parent_t *p2)
|
|||
{
|
||||
rpl_rank_t r1, r2;
|
||||
rpl_dag_t *dag;
|
||||
|
||||
|
||||
PRINTF("RPL: Comparing parent ");
|
||||
PRINT6ADDR(rpl_get_parent_ipaddr(p1));
|
||||
PRINTF(" (confidence %d, rank %d) with parent ",
|
||||
|
@ -159,3 +159,5 @@ update_metric_container(rpl_instance_t *instance)
|
|||
{
|
||||
instance->mc.type = RPL_DAG_MC_NONE;
|
||||
}
|
||||
|
||||
/** @}*/
|
||||
|
|
|
@ -324,3 +324,5 @@ rpl_cancel_dao(rpl_instance_t *instance)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
|
||||
/** @}*/
|
||||
|
|
|
@ -315,3 +315,5 @@ rpl_init(void)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* UIP_CONF_IPV6 */
|
||||
|
||||
/** @}*/
|
||||
|
|
|
@ -105,3 +105,5 @@ rtimer_run_next(void)
|
|||
return;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/** @}*/
|
||||
|
|
|
@ -67,3 +67,6 @@
|
|||
}
|
||||
|
||||
#endif /* SUBPROCESS_H_ */
|
||||
|
||||
/** @}*/
|
||||
/** @}*/
|
||||
|
|
|
@ -171,13 +171,13 @@
|
|||
*/
|
||||
/*@{*/
|
||||
|
||||
/*!
|
||||
* \brief Bank select register.
|
||||
/*!
|
||||
* \brief Bank select register.
|
||||
*/
|
||||
#define NIC_BSR (LANC111_BASE_ADDR + 0x0E)
|
||||
|
||||
/*!
|
||||
* \brief Bank 0 - Transmit control register.
|
||||
/*!
|
||||
* \brief Bank 0 - Transmit control register.
|
||||
*/
|
||||
#define NIC_TCR (LANC111_BASE_ADDR + 0x00)
|
||||
|
||||
|
@ -193,13 +193,13 @@
|
|||
#define TCR_TXENA 0x0001 /*!< \ref NIC_TCR bit mask, enables transmitter. */
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Bank 0 - EPH status register.
|
||||
/*!
|
||||
* \brief Bank 0 - EPH status register.
|
||||
*/
|
||||
#define NIC_EPHSR (LANC111_BASE_ADDR + 0x02)
|
||||
|
||||
/*!
|
||||
* \brief Bank 0 - Receive control register.
|
||||
/*!
|
||||
* \brief Bank 0 - Receive control register.
|
||||
*/
|
||||
#define NIC_RCR (LANC111_BASE_ADDR + 0x04)
|
||||
|
||||
|
@ -212,17 +212,17 @@
|
|||
#define RCR_PRMS 0x0002 /*!< \ref NIC_RCR bit mask, enables promiscuous mode. */
|
||||
#define RCR_RX_ABORT 0x0001 /*!< \ref NIC_RCR bit mask, set when receive was aborted. */
|
||||
|
||||
/*!
|
||||
/*!
|
||||
* \brief Bank 0 - Counter register.
|
||||
*/
|
||||
#define NIC_ECR (LANC111_BASE_ADDR + 0x06)
|
||||
|
||||
/*!
|
||||
/*!
|
||||
* \brief Bank 0 - Memory information register.
|
||||
*/
|
||||
#define NIC_MIR (LANC111_BASE_ADDR + 0x08)
|
||||
|
||||
/*!
|
||||
/*!
|
||||
* \brief Bank 0 - Receive / PHY control register.
|
||||
*/
|
||||
#define NIC_RPCR (LANC111_BASE_ADDR + 0x0A)
|
||||
|
@ -233,29 +233,29 @@
|
|||
#define RPCR_LEDA_PAT 0x0000 /*!< \ref NIC_RPCR bit mask for LEDA mode. */
|
||||
#define RPCR_LEDB_PAT 0x0010 /*!< \ref NIC_RPCR bit mask for LEDB mode. */
|
||||
|
||||
/*!
|
||||
/*!
|
||||
* \brief Bank 1 - Configuration register.
|
||||
*/
|
||||
#define NIC_CR (LANC111_BASE_ADDR + 0x00)
|
||||
|
||||
#define CR_EPH_EN 0x8000 /*!< \ref NIC_CR bit mask, . */
|
||||
|
||||
/*!
|
||||
/*!
|
||||
* \brief Bank 1 - Base address register.
|
||||
*/
|
||||
#define NIC_BAR (LANC111_BASE_ADDR + 0x02)
|
||||
|
||||
/*!
|
||||
/*!
|
||||
* \brief Bank 1 - Individual address register.
|
||||
*/
|
||||
#define NIC_IAR (LANC111_BASE_ADDR + 0x04)
|
||||
|
||||
/*!
|
||||
/*!
|
||||
* \brief Bank 1 - General purpose register.
|
||||
*/
|
||||
#define NIC_GPR (LANC111_BASE_ADDR + 0x0A)
|
||||
|
||||
/*!
|
||||
/*!
|
||||
* \brief Bank 1 - Control register.
|
||||
*/
|
||||
#define NIC_CTR (LANC111_BASE_ADDR + 0x0C)
|
||||
|
@ -654,10 +654,10 @@ static int NicPhyConfig(void)
|
|||
uint16_t phy_to;
|
||||
uint16_t mode;
|
||||
|
||||
/*
|
||||
/*
|
||||
* Reset the PHY and wait until this self clearing bit
|
||||
* becomes zero. We sleep 63 ms before each poll and
|
||||
* give up after 3 retries.
|
||||
* give up after 3 retries.
|
||||
*/
|
||||
//printf("Reset PHY..");
|
||||
NicPhyWrite(NIC_PHYCR, PHYCR_RST);
|
||||
|
@ -860,8 +860,8 @@ static void NicInterrupt(void *arg)
|
|||
isr &= imr;
|
||||
|
||||
/*
|
||||
* If this is a transmit interrupt, then a packet has been sent.
|
||||
* So we can clear the transmitter busy flag and wake up the
|
||||
* If this is a transmit interrupt, then a packet has been sent.
|
||||
* So we can clear the transmitter busy flag and wake up the
|
||||
* transmitter thread.
|
||||
*/
|
||||
if (isr & INT_TX_EMPTY) {
|
||||
|
@ -884,7 +884,7 @@ static void NicInterrupt(void *arg)
|
|||
|
||||
|
||||
/*
|
||||
* If this is a receive interrupt, then wake up the receiver
|
||||
* If this is a receive interrupt, then wake up the receiver
|
||||
* thread.
|
||||
*/
|
||||
if (isr & INT_RX_OVRN) {
|
||||
|
@ -964,7 +964,7 @@ static NETBUF *NicGetPacket(void)
|
|||
uint16_t fsw;
|
||||
uint16_t fbc;
|
||||
|
||||
/* Check the fifo empty bit. If it is set, then there is
|
||||
/* Check the fifo empty bit. If it is set, then there is
|
||||
nothing in the receiver fifo. */
|
||||
nic_bs(2);
|
||||
if (nic_inw(NIC_FIFO) & 0x8000) {
|
||||
|
@ -993,8 +993,8 @@ static NETBUF *NicGetPacket(void)
|
|||
}
|
||||
|
||||
else {
|
||||
/*
|
||||
* Allocate a NETBUF.
|
||||
/*
|
||||
* Allocate a NETBUF.
|
||||
* Hack alert: Rev A chips never set the odd frame indicator.
|
||||
*/
|
||||
fbc -= 3;
|
||||
|
@ -1022,7 +1022,7 @@ static NETBUF *NicGetPacket(void)
|
|||
* release the buffer in case of an error.
|
||||
*
|
||||
* \return 0 on success, -1 in case of any errors. Errors
|
||||
* will automatically release the network buffer
|
||||
* will automatically release the network buffer
|
||||
* structure.
|
||||
*/
|
||||
#if 0
|
||||
|
@ -1034,7 +1034,7 @@ static int NicPutPacket(NETBUF * nb)
|
|||
|
||||
//printf("[P]");
|
||||
/*
|
||||
* Calculate the number of bytes to be send. Do not send packets
|
||||
* Calculate the number of bytes to be send. Do not send packets
|
||||
* larger than the Ethernet maximum transfer unit. The MTU
|
||||
* consist of 1500 data bytes plus the 14 byte Ethernet header
|
||||
* plus 4 bytes CRC. We check the data bytes only.
|
||||
|
@ -1132,7 +1132,7 @@ PROCESS_THREAD(lanc111_process, ev, data)
|
|||
NETBUF *nb;*/
|
||||
uint8_t imsk;
|
||||
static struct etimer et;
|
||||
|
||||
|
||||
/* dev = arg;
|
||||
ifn = (IFNET *) dev->dev_icb;
|
||||
ni = (NICINFO *) dev->dev_dcb;*/
|
||||
|
@ -1144,7 +1144,7 @@ PROCESS_THREAD(lanc111_process, ev, data)
|
|||
*/
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
|
||||
/* while(*((u_long *) (ifn->if_mac)) &&
|
||||
*((u_long *) (ifn->if_mac)) != 0xFFFFFFFFUL) {*/
|
||||
while(0) {
|
||||
|
@ -1191,7 +1191,7 @@ PROCESS_THREAD(lanc111_process, ev, data)
|
|||
/* while ((nb = NicGetPacket()) != 0) {
|
||||
if (nb != (NETBUF *) 0xFFFF) {
|
||||
ni->ni_rx_packets++;
|
||||
(*ifn->if_recv) (dev, nb);
|
||||
(*ifn->if_recv) (dev, nb);
|
||||
}
|
||||
}*/
|
||||
nic_outlb(NIC_MSK, imsk | INT_RCV | INT_ERCV);
|
||||
|
@ -1247,12 +1247,12 @@ int LancOutput(NUTDEVICE * dev, NETBUF * nb)
|
|||
/*!
|
||||
* \brief Initialize Ethernet hardware.
|
||||
*
|
||||
* Resets the LAN91C111 Ethernet controller, initializes all required
|
||||
* hardware registers and starts a background thread for incoming
|
||||
* Resets the LAN91C111 Ethernet controller, initializes all required
|
||||
* hardware registers and starts a background thread for incoming
|
||||
* Ethernet traffic.
|
||||
*
|
||||
* Applications should do not directly call this function. It is
|
||||
* automatically executed during during device registration by
|
||||
* Applications should do not directly call this function. It is
|
||||
* automatically executed during during device registration by
|
||||
* NutRegisterDevice().
|
||||
*
|
||||
* If the network configuration hasn't been set by the application
|
||||
|
@ -1312,11 +1312,11 @@ static IFNET ifn_eth0 = {
|
|||
/*!
|
||||
* \brief Device information structure.
|
||||
*
|
||||
* A pointer to this structure must be passed to NutRegisterDevice()
|
||||
* A pointer to this structure must be passed to NutRegisterDevice()
|
||||
* to bind this Ethernet device driver to the Nut/OS kernel.
|
||||
* An application may then call NutNetIfConfig() with the name \em eth0
|
||||
* An application may then call NutNetIfConfig() with the name \em eth0
|
||||
* of this driver to initialize the network interface.
|
||||
*
|
||||
*
|
||||
*/
|
||||
NUTDEVICE devSmsc111 = {
|
||||
0, /* Pointer to next device. */
|
||||
|
@ -1360,3 +1360,4 @@ lanc111_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
|
|
@ -34,13 +34,13 @@
|
|||
* \brief This module contains code to interface a Contiki-based
|
||||
* project on the AVR Raven platform's ATMega1284P chip to the LCD
|
||||
* driver chip (ATMega3290P) on the Raven.
|
||||
*
|
||||
*
|
||||
* \author Blake Leverett <bleverett@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
/** \addtogroup raven
|
||||
* @{
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -121,7 +121,7 @@ seqno++;
|
|||
} else {
|
||||
// uip_ip6addr(&UIP_IP_BUF->destipaddr,0x2001,0x0420,0x5FFF,0x007D,0x02D0,0xB7FF,0xFE23,0xE6DB); //?.cisco.com
|
||||
uip_ip6addr(&UIP_IP_BUF->destipaddr,0x2001,0x0420,0x0000,0x0010,0x0250,0x8bff,0xfee8,0xf800); //six.cisco.com
|
||||
}
|
||||
}
|
||||
#else
|
||||
uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, uip_ds6_defrt_choose()); //the default router
|
||||
#endif
|
||||
|
@ -134,16 +134,16 @@ seqno++;
|
|||
/* put one byte of data */
|
||||
memset((void *)UIP_ICMP_BUF + UIP_ICMPH_LEN + UIP_ICMP6_ECHO_REQUEST_LEN,
|
||||
count, PING6_DATALEN);
|
||||
|
||||
|
||||
|
||||
|
||||
uip_len = UIP_ICMPH_LEN + UIP_ICMP6_ECHO_REQUEST_LEN + UIP_IPH_LEN + PING6_DATALEN;
|
||||
UIP_IP_BUF->len[0] = (uint8_t)((uip_len - 40) >> 8);
|
||||
UIP_IP_BUF->len[1] = (uint8_t)((uip_len - 40) & 0x00FF);
|
||||
|
||||
|
||||
UIP_ICMP_BUF->icmpchksum = 0;
|
||||
UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum();
|
||||
|
||||
|
||||
|
||||
|
||||
tcpip_ipv6_output();
|
||||
}
|
||||
#if defined(__AVR_ATmega128RFA1__)
|
||||
|
@ -178,7 +178,7 @@ char serial_char_received;
|
|||
*
|
||||
* Until someone figures out how to get UART to wake from powerdown,
|
||||
* a three second powersave cycle is used with exit based on any character received.
|
||||
|
||||
|
||||
* The system clock is adjusted to reflect the sleep time.
|
||||
*/
|
||||
|
||||
|
@ -205,7 +205,7 @@ void micro_sleep(uint8_t howlong)
|
|||
SREG = saved_sreg; // Restore interrupt state.
|
||||
// UCSR(USART,B)&= ~(1<<RXCIE(USART)) // Disable the RX Complete interrupt;
|
||||
// UCSR0B|=(1<<RXCIE0); // Enable UART0 RX complete interrupt
|
||||
// UCSR1B|=(1<<RXCIE1); // Enable UART1 RX complete interrupt
|
||||
// UCSR1B|=(1<<RXCIE1); // Enable UART1 RX complete interrupt
|
||||
// TCNT2 = 0; // Reset TIMER2 timer counter value.
|
||||
// while(ASSR & (1 << TCN2UB)); // Wait for TCNT2 write to finish before entering sleep.
|
||||
// TIMSK2 |= (1 << OCIE2A); // Enable TIMER2 output compare interrupt.
|
||||
|
@ -263,7 +263,7 @@ ISR(TIMER2_COMPA_vect)
|
|||
#if DEBUGSERIAL
|
||||
uint8_t serialcount;
|
||||
char dbuf[30];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
extern uint16_t ledtimer;
|
||||
|
@ -271,7 +271,7 @@ static uint8_t
|
|||
raven_gui_loop(process_event_t ev, process_data_t data)
|
||||
{
|
||||
uint8_t i,activeconnections,radio_state;
|
||||
|
||||
|
||||
// PRINTF("\nevent %d ",ev);
|
||||
#if DEBUGSERIAL
|
||||
printf_P(PSTR("Buffer [%d]="),serialcount);
|
||||
|
@ -304,7 +304,7 @@ raven_gui_loop(process_event_t ev, process_data_t data)
|
|||
break;
|
||||
|
||||
} else switch (ev) {
|
||||
case SERIAL_CMD:
|
||||
case SERIAL_CMD:
|
||||
/* Check for command from serial port, execute it. */
|
||||
/* Note cmd frame is written in an interrupt - delays here can cause overwriting by next command */
|
||||
PRINTF("\nCommand %d length %d done %d",cmd.cmd,cmd.len,cmd.done);
|
||||
|
@ -373,7 +373,7 @@ raven_gui_loop(process_event_t ev, process_data_t data)
|
|||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Process an input character from serial port.
|
||||
/* Process an input character from serial port.
|
||||
* ** This is called from an ISR!!
|
||||
*/
|
||||
|
||||
|
@ -388,7 +388,7 @@ int raven_lcd_serial_input(unsigned char ch)
|
|||
#endif
|
||||
/* Don't overwrite an unprocessed command */
|
||||
// if (cmd.done) return 0;
|
||||
|
||||
|
||||
/* Parse frame, */
|
||||
switch (cmd.ndx){
|
||||
case 0:
|
||||
|
@ -402,7 +402,7 @@ int raven_lcd_serial_input(unsigned char ch)
|
|||
return 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
/* Second byte, length of payload */
|
||||
cmd.len = ch;
|
||||
break;
|
||||
|
@ -441,7 +441,7 @@ int raven_lcd_serial_input(unsigned char ch)
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
cmd.ndx++;
|
||||
return 0;
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ raven_lcd_show_text(char *text) {
|
|||
static void
|
||||
lcd_show_servername(void) {
|
||||
|
||||
//extern uint8_t mac_address[8]; //These are defined in httpd-fsdata.c via makefsdata.h
|
||||
//extern uint8_t mac_address[8]; //These are defined in httpd-fsdata.c via makefsdata.h
|
||||
extern uint8_t server_name[16];
|
||||
//extern uint8_t domain_name[30];
|
||||
char buf[sizeof(server_name)+1];
|
||||
|
@ -480,14 +480,15 @@ PROCESS_THREAD(raven_lcd_process, ev, data)
|
|||
|
||||
/* Get ICMP6 callbacks from uip6 stack, perform 3290p action on pings, responses, etc. */
|
||||
if(icmp6_new(NULL) == 0) {
|
||||
|
||||
|
||||
while(1) {
|
||||
PROCESS_YIELD();
|
||||
// if (ev != ?) //trap frequent strobes?
|
||||
raven_gui_loop(ev, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
PROCESS_END();
|
||||
}
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
|
|
@ -34,13 +34,13 @@
|
|||
* \brief This module contains code to interface a Contiki-based
|
||||
* project on the AVR Raven platform's ATMega1284P chip to the LCD
|
||||
* driver chip (ATMega3290P) on the Raven.
|
||||
*
|
||||
*
|
||||
* \author Blake Leverett <bleverett@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
/** \addtogroup raven
|
||||
* @{
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -121,7 +121,7 @@ raven_ping6(void)
|
|||
} else {
|
||||
// uip_ip6addr(&UIP_IP_BUF->destipaddr,0x2001,0x0420,0x5FFF,0x007D,0x02D0,0xB7FF,0xFE23,0xE6DB); //?.cisco.com
|
||||
uip_ip6addr(&UIP_IP_BUF->destipaddr,0x2001,0x0420,0x0000,0x0010,0x0250,0x8bff,0xfee8,0xf800); //six.cisco.com
|
||||
}
|
||||
}
|
||||
#else
|
||||
uip_ipaddr_copy(&UIP_IP_BUF->destipaddr, uip_ds6_defrt_choose()); //the default router
|
||||
#endif
|
||||
|
@ -134,16 +134,16 @@ raven_ping6(void)
|
|||
/* put one byte of data */
|
||||
memset((void *)UIP_ICMP_BUF + UIP_ICMPH_LEN + UIP_ICMP6_ECHO_REQUEST_LEN,
|
||||
count, PING6_DATALEN);
|
||||
|
||||
|
||||
|
||||
|
||||
uip_len = UIP_ICMPH_LEN + UIP_ICMP6_ECHO_REQUEST_LEN + UIP_IPH_LEN + PING6_DATALEN;
|
||||
UIP_IP_BUF->len[0] = (uint8_t)((uip_len - 40) >> 8);
|
||||
UIP_IP_BUF->len[1] = (uint8_t)((uip_len - 40) & 0x00FF);
|
||||
|
||||
|
||||
UIP_ICMP_BUF->icmpchksum = 0;
|
||||
UIP_ICMP_BUF->icmpchksum = ~uip_icmp6chksum();
|
||||
|
||||
|
||||
|
||||
|
||||
tcpip_ipv6_output();
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ char serial_char_received;
|
|||
*
|
||||
* Until someone figures out how to get UART to wake from powerdown,
|
||||
* a three second powersave cycle is used with exit based on any character received.
|
||||
|
||||
|
||||
* The system clock is adjusted to reflect the sleep time.
|
||||
*/
|
||||
|
||||
|
@ -197,7 +197,7 @@ void micro_sleep(uint8_t howlong)
|
|||
SREG = saved_sreg; // Restore interrupt state.
|
||||
// UCSR(USART,B)&= ~(1<<RXCIE(USART)) // Disable the RX Complete interrupt;
|
||||
// UCSR0B|=(1<<RXCIE0); // Enable UART0 RX complete interrupt
|
||||
// UCSR1B|=(1<<RXCIE1); // Enable UART1 RX complete interrupt
|
||||
// UCSR1B|=(1<<RXCIE1); // Enable UART1 RX complete interrupt
|
||||
// TCNT2 = 0; // Reset TIMER2 timer counter value.
|
||||
// while(ASSR & (1 << TCN2UB)); // Wait for TCNT2 write to finish before entering sleep.
|
||||
// TIMSK2 |= (1 << OCIE2A); // Enable TIMER2 output compare interrupt.
|
||||
|
@ -254,14 +254,14 @@ ISR(TIMER2_COMPA_vect)
|
|||
#if DEBUGSERIAL
|
||||
uint8_t serialcount;
|
||||
char dbuf[30];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static uint8_t
|
||||
raven_gui_loop(process_event_t ev, process_data_t data)
|
||||
{
|
||||
uint8_t i,activeconnections,radio_state;
|
||||
|
||||
|
||||
// PRINTF("\nevent %d ",ev);
|
||||
#if DEBUGSERIAL
|
||||
printf_P(PSTR("Buffer [%d]="),serialcount);
|
||||
|
@ -291,7 +291,7 @@ raven_gui_loop(process_event_t ev, process_data_t data)
|
|||
break;
|
||||
|
||||
} else switch (ev) {
|
||||
case SERIAL_CMD:
|
||||
case SERIAL_CMD:
|
||||
/* Check for command from serial port, execute it. */
|
||||
/* Note cmd frame is written in an interrupt - delays here can cause overwriting by next command */
|
||||
PRINTF("\nCommand %d length %d done %d",cmd.cmd,cmd.len,cmd.done);
|
||||
|
@ -366,7 +366,7 @@ raven_gui_loop(process_event_t ev, process_data_t data)
|
|||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Process an input character from serial port.
|
||||
/* Process an input character from serial port.
|
||||
* ** This is called from an ISR!!
|
||||
*/
|
||||
|
||||
|
@ -381,7 +381,7 @@ int raven_lcd_serial_input(unsigned char ch)
|
|||
#endif
|
||||
/* Don't overwrite an unprocessed command */
|
||||
// if (cmd.done) return 0;
|
||||
|
||||
|
||||
/* Parse frame, */
|
||||
switch (cmd.ndx){
|
||||
case 0:
|
||||
|
@ -395,7 +395,7 @@ int raven_lcd_serial_input(unsigned char ch)
|
|||
return 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case 1:
|
||||
/* Second byte, length of payload */
|
||||
cmd.len = ch;
|
||||
break;
|
||||
|
@ -434,7 +434,7 @@ int raven_lcd_serial_input(unsigned char ch)
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
cmd.ndx++;
|
||||
return 0;
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ raven_lcd_show_text(char *text) {
|
|||
static void
|
||||
lcd_show_servername(void) {
|
||||
|
||||
//extern uint8_t eemem_mac_address[8]; //These are defined in httpd-fsdata.c via makefsdata.h
|
||||
//extern uint8_t eemem_mac_address[8]; //These are defined in httpd-fsdata.c via makefsdata.h
|
||||
extern uint8_t eemem_server_name[16];
|
||||
//extern uint8_t eemem_domain_name[30];
|
||||
char buf[sizeof(eemem_server_name)+1];
|
||||
|
@ -473,14 +473,15 @@ PROCESS_THREAD(raven_lcd_process, ev, data)
|
|||
|
||||
/* Get ICMP6 callbacks from uip6 stack, perform 3290p action on pings, responses, etc. */
|
||||
if(icmp6_new(NULL) == 0) {
|
||||
|
||||
|
||||
while(1) {
|
||||
PROCESS_YIELD();
|
||||
// if (ev != ?) //trap frequent strobes?
|
||||
raven_gui_loop(ev, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
PROCESS_END();
|
||||
}
|
||||
|
||||
/** @} */
|
||||
/** @} */
|
||||
|
|
Loading…
Reference in a new issue