Merge remote-tracking branch 'origin/master'

This commit is contained in:
Oliver Schmidt 2011-04-10 13:23:13 +02:00
commit c6c0d6247b
27 changed files with 252 additions and 50 deletions

View file

@ -39,6 +39,7 @@
*/
#include "contiki.h"
#include "io.h"
#include "dev/cc2420.h"
#include "dev/cc2420-aes.h"
#include "dev/spi.h"

View file

@ -41,8 +41,12 @@
#if defined(__AVR__)
#include <avr/io.h>
#elif defined(__MSP430__)
#ifdef __IAR_SYSTEMS_ICC__
#include <io430.h>
#else
#include <io.h>
#endif
#endif
#include "dev/leds.h"
#include "dev/spi.h"

View file

@ -33,9 +33,9 @@
#ifndef __ME_TABS_H__
#define __ME_TABS_H__
const unsigned short me_encode_tab[256];
const unsigned char me_decode_tab[256];
const unsigned char me_valid_tab[256];
extern const unsigned short me_encode_tab[256];
extern const unsigned char me_decode_tab[256];
extern const unsigned char me_valid_tab[256];
#endif /* __ME_TABS_H__ */

View file

@ -82,10 +82,10 @@ int neighbor_info_subscribe(neighbor_info_subscriber_t);
/**
* Get link ETX value for a specific neighbor.
* Get link metric value for a specific neighbor.
*
* \return Returns ETX if the neighbor exists, and 0 if not.
* \return Returns link metric if the neighbor exists, and 0 if not.
*/
link_metric_t neighbor_info_get_etx(const rimeaddr_t *addr);
link_metric_t neighbor_info_get_metric(const rimeaddr_t *addr);
#endif /* NEIGHBOR_INFO_H */

View file

@ -142,6 +142,8 @@ remove_worst_parent(rpl_dag_t *dag, rpl_rank_t min_worst_rank)
static int
should_send_dao(rpl_dag_t *dag, rpl_dio_t *dio, rpl_parent_t *p)
{
/* if MOP is set to no downward routes no DAO should be sent */
if(dag->mop == RPL_MOP_NO_DOWNWARD_ROUTES) return 0;
return dio->dtsn > p->dtsn && p == dag->preferred_parent;
}
/************************************************************************/
@ -340,19 +342,28 @@ rpl_select_parent(rpl_dag_t *dag)
best = NULL;
for(p = list_head(dag->parents); p != NULL; p = p->next) {
if(best == NULL) {
if(p->rank == INFINITE_RANK) {
/* ignore this neighbor */
} else if(best == NULL) {
best = p;
} else {
best = dag->of->best_parent(best, p);
}
}
if(best == NULL) {
/* need to handle update of best... */
return NULL;
}
if(dag->preferred_parent != best) {
dag->preferred_parent = best; /* Cache the value. */
dag->of->update_metric_container(dag);
rpl_set_default_route(dag, &best->addr);
/* The DAO parent set changed - schedule a DAO transmission. */
if(dag->mop != RPL_MOP_NO_DOWNWARD_ROUTES) {
rpl_schedule_dao(dag);
}
rpl_reset_dio_timer(dag, 1);
PRINTF("RPL: New preferred parent, rank changed from %u to %u\n",
(unsigned)dag->rank, dag->of->calculate_rank(best, 0));
@ -638,7 +649,8 @@ rpl_process_parent_event(rpl_dag_t *dag, rpl_parent_t *p)
rpl_reset_dio_timer(dag, 1);
}
if(!acceptable_rank(dag, dag->of->calculate_rank(NULL, parent_rank))) {
if(parent_rank == INFINITE_RANK ||
!acceptable_rank(dag, dag->of->calculate_rank(NULL, parent_rank))) {
/* The candidate parent is no longer valid: the rank increase resulting
from the choice of it as a parent would be too high. */
return 0;

View file

@ -170,7 +170,12 @@
#define RPL_MOP_NON_STORING 1
#define RPL_MOP_STORING_NO_MULTICAST 2
#define RPL_MOP_STORING_MULTICAST 3
#ifdef RPL_CONF_MOP
#define RPL_MOP_DEFAULT RPL_CONF_MOP
#else
#define RPL_MOP_DEFAULT RPL_MOP_STORING_NO_MULTICAST
#endif
/*
* The ETX in the metric container is expressed as a fixed-point value

View file

@ -571,7 +571,10 @@ compress_hdr_hc06(rimeaddr_t *rime_destaddr)
iphc1 |= compress_addr_64(SICSLOWPAN_IPHC_SAM_BIT,
&UIP_IP_BUF->srcipaddr, &uip_lladdr);
/* No context found for this address */
} else if(uip_is_addr_link_local(&UIP_IP_BUF->srcipaddr)) {
} else if(uip_is_addr_link_local(&UIP_IP_BUF->srcipaddr) &&
UIP_IP_BUF->destipaddr.u16[1] == 0 &&
UIP_IP_BUF->destipaddr.u16[2] == 0 &&
UIP_IP_BUF->destipaddr.u16[3] == 0) {
iphc1 |= compress_addr_64(SICSLOWPAN_IPHC_SAM_BIT,
&UIP_IP_BUF->srcipaddr, &uip_lladdr);
} else {
@ -619,7 +622,10 @@ compress_hdr_hc06(rimeaddr_t *rime_destaddr)
iphc1 |= compress_addr_64(SICSLOWPAN_IPHC_DAM_BIT,
&UIP_IP_BUF->destipaddr, (uip_lladdr_t *)rime_destaddr);
/* No context found for this address */
} else if(uip_is_addr_link_local(&UIP_IP_BUF->destipaddr)) {
} else if(uip_is_addr_link_local(&UIP_IP_BUF->destipaddr) &&
UIP_IP_BUF->destipaddr.u16[1] == 0 &&
UIP_IP_BUF->destipaddr.u16[2] == 0 &&
UIP_IP_BUF->destipaddr.u16[3] == 0) {
iphc1 |= compress_addr_64(SICSLOWPAN_IPHC_DAM_BIT,
&UIP_IP_BUF->destipaddr, (uip_lladdr_t *)rime_destaddr);
} else {

View file

@ -742,14 +742,20 @@ void rf230_warm_reset(void) {
/* CCA energy threshold = -91dB + 2*SR_CCA_ED_THRESH. Reset defaults to -77dB */
/* Use RF230 base of -91; RF231 base is -90 according to datasheet */
#ifdef RF230_CONF_CCA_THRES
#if RF230_CONF_CCA_THRES < -91
#warning
#warning RF230_CONF_CCA_THRES below hardware limit, setting to -91dBm
#warning
hal_subregister_write(SR_CCA_ED_THRES,0);
#elif RF230_CONF_CCA_THRES > -61
#warning
#warning RF230_CONF_CCA_THRES above hardware limit, setting to -61dBm
#warning
hal_subregister_write(SR_CCA_ED_THRES,15);
#else
hal_subregister_write(SR_CCA_ED_THRES,(RF230_CONF_CCA_THRES+91)/2);
#endif
#endif
/* Use automatic CRC unless manual is specified */

View file

@ -70,9 +70,29 @@
#define UART2_UCTS ((volatile uint32_t *) ( UART2_BASE + UCTS ))
#define UART2_UBRCNT ((volatile uint32_t *) ( UART2_BASE + UBRCNT ))
extern volatile uint32_t u1_head, u1_tail;
/* The mc1322x has a 32 byte hardware FIFO for transmitted characters.
* Currently it is always filled from a larger RAM buffer. It would be
* possible to eliminate that overhead by filling directly from a chain
* of data buffer pointers, but printf's would be not so easy.
*/
#define UART1_TX_BUFFERSIZE 1024
extern volatile uint32_t u1_tx_head, u1_tx_tail;
void uart1_putc(char c);
/* The mc1322x has a 32 byte hardware FIFO for received characters.
* If a larger rx buffersize is specified the FIFO will be extended into RAM.
* RAM transfers will occur on interrupt when the FIFO is nearly full.
* If a smaller buffersize is specified hardware flow control will be
* initiated at that FIFO level.
* Set to 32 for no flow control or RAM buffer.
*/
#define UART1_RX_BUFFERSIZE 128
#if UART1_RX_BUFFERSIZE > 32
extern volatile uint32_t u1_rx_head, u1_rx_tail;
#define uart1_can_get() ((u1_rx_head!=u1_rx_tail) || (*UART1_URXCON > 0))
#else
#define uart1_can_get() (*UART1_URXCON > 0)
#endif
uint8_t uart1_getc(void);

View file

@ -36,43 +36,91 @@
#include <mc1322x.h>
#include <stdint.h>
volatile char u1_tx_buf[1024];
volatile uint32_t u1_head, u1_tail;
volatile char u1_tx_buf[UART1_TX_BUFFERSIZE];
volatile uint32_t u1_tx_head, u1_tx_tail;
#if UART1_RX_BUFFERSIZE > 32
volatile char u1_rx_buf[UART1_RX_BUFFERSIZE-32];
volatile uint32_t u1_rx_head, u1_rx_tail;
#endif
void uart1_isr(void) {
while( *UART1_UTXCON != 0 ) {
if (u1_head == u1_tail) {
disable_irq(UART1);
#if UART1_RX_BUFFERSIZE > 32
if (*UART1_USTAT & ( 1 << 6)) { //receive interrupt
while( *UART1_URXCON != 0 ) { //flush the hardware fifo into the software buffer
uint32_t u1_rx_tail_next;
u1_rx_tail_next = u1_rx_tail+1;
if (u1_rx_tail_next >= sizeof(u1_rx_buf))
u1_rx_tail_next = 0;
if (u1_rx_head != u1_rx_tail_next) {
u1_rx_buf[u1_rx_tail]= *UART1_UDATA;
u1_rx_tail = u1_rx_tail_next;
}
}
return;
}
*UART1_UDATA = u1_tx_buf[u1_tail];
u1_tail++;
if (u1_tail >= sizeof(u1_tx_buf))
u1_tail = 0;
#endif
while( *UART1_UTXCON != 0 ) {
if (u1_tx_head == u1_tx_tail) {
#if UART1_RX_BUFFERSIZE > 32
*UART1_UCON |= (1 << 13); /*disable tx interrupt */
#else
disable_irq(UART1);
#endif
return;
}
*UART1_UDATA = u1_tx_buf[u1_tx_tail];
u1_tx_tail++;
if (u1_tx_tail >= sizeof(u1_tx_buf))
u1_tx_tail = 0;
}
}
void uart1_putc(char c) {
/* disable UART1 since */
/* UART1 isr modifies u1_head and u1_tail */
/* UART1 isr modifies u1_tx_head and u1_tx_tail */
#if UART1_RX_BUFFERSIZE > 32
*UART1_UCON |= (1 << 13); /*disable tx interrupt */
#else
disable_irq(UART1);
#endif
if( (u1_head == u1_tail) &&
if( (u1_tx_head == u1_tx_tail) &&
(*UART1_UTXCON != 0)) {
*UART1_UDATA = c;
} else {
u1_tx_buf[u1_head] = c;
u1_head += 1;
if (u1_head >= sizeof(u1_tx_buf))
u1_head = 0;
if (u1_head == u1_tail) { /* drop chars when no room */
if (u1_head) { u1_head -=1; } else { u1_head = sizeof(u1_tx_buf); }
u1_tx_buf[u1_tx_head] = c;
u1_tx_head += 1;
if (u1_tx_head >= sizeof(u1_tx_buf))
u1_tx_head = 0;
if (u1_tx_head == u1_tx_tail) { /* drop chars when no room */
if (u1_tx_head) { u1_tx_head -=1; } else { u1_tx_head = sizeof(u1_tx_buf); }
}
#if UART1_RX_BUFFERSIZE > 32
*UART1_UCON &= ~(1 << 13); /*enable tx interrupt */
#else
enable_irq(UART1);
#endif
}
}
uint8_t uart1_getc(void) {
#if UART1_RX_BUFFERSIZE > 32
/* First pull from the ram buffer */
uint8_t c=0;
if (u1_rx_head != u1_rx_tail) {
c = u1_rx_buf[u1_rx_head++];
if (u1_rx_head >= sizeof(u1_rx_buf))
u1_rx_head=0;
return c;
}
#endif
/* Then pull from the hardware fifo */
while(uart1_can_get() == 0) { continue; }
return *UART1_UDATA;
}

View file

@ -51,22 +51,39 @@ void uart1_init(uint16_t inc, uint16_t mod, uint8_t samp) {
*UART1_UCON = 0;
*UART1_UBRCNT = ( inc << 16 ) | mod;
/* TX and CTS as outputs */
GPIO->PAD_DIR_SET.GPIO_14 = 1;
GPIO->PAD_DIR_SET.GPIO_16 = 1;
/* RX and RTS as inputs */
GPIO->PAD_DIR_RESET.GPIO_15 = 1;
GPIO->PAD_DIR_RESET.GPIO_17 = 1;
/* see Section 11.5.1.2 Alternate Modes */
/* you must enable the peripheral first BEFORE setting the function in GPIO_FUNC_SEL */
/* From the datasheet: "The peripheral function will control operation of the pad IF */
/* THE PERIPHERAL IS ENABLED. */
*UART1_UCON = (1 << 0) | (1 << 1); /* enable receive, transmit */
#if UART1_RX_BUFFERSIZE > 32
*UART1_UCON = (1 << 0) | (1 << 1) ; /* enable receive, transmit, and both interrupts */
*UART1_URXCON = 30; /* interrupt when fifo is nearly full */
u1_rx_head = 0; u1_rx_tail = 0;
#elif UART1_RX_BUFFERSIZE < 32 /* enable receive, transmit, flow control, disable rx interrupt */
*UART1_UCON = (1 << 0) | (1 << 1) | (1 << 12) | (1 << 14);
*UART1_UCTS = UART1_RX_BUFFERSIZE; /* drop cts when tx buffer at trigger level */
*GPIO_FUNC_SEL1 = ( (0x01 << (0*2)) | (0x01 << (1*2)) ); /* set GPIO17-16 to UART1 CTS and RTS */
#else
*UART1_UCON = (1 << 0) | (1 << 1) | (1 << 14); /* enable receive, transmit, disable rx interrupt */
#endif
if(samp == UCON_SAMP_16X)
set_bit(*UART1_UCON,UCON_SAMP);
*GPIO_FUNC_SEL0 = ( (0x01 << (14*2)) | (0x01 << (15*2)) ); /* set GPIO15-14 to UART (UART1 TX and RX)*/
/* interrupt when there are this number or more bytes free in the TX buffer*/
*UART1_UTXCON = 16;
u1_tx_head = 0; u1_tx_tail = 0;
u1_head = 0; u1_tail = 0;
/* tx and rx interrupts are enabled in the UART by default */
/* see status register bits 13 and 14 */
/* enable UART1 interrupts in the interrupt controller */
enable_irq(UART1);
}

View file

@ -25,6 +25,40 @@ CONTIKI_TARGET_SOURCEFILES += $(MSP430) \
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
### Compiler definitions
ifdef IAR
CC = icc430
LD = xlink
AS = iasm430
AR = xar
OBJCOPY = ielftool
STRIP = strip
ifndef IAR_PATH
# This works with cygwin...
IAR_BIN_PATH = $(shell dirname `which $(CC)`)
IAR_PATH_C = $(shell dirname $(IAR_BIN_PATH))
IAR_PATH = $(shell cygpath -m $(IAR_PATH_C))
endif
CFLAGSNO = --dlib_config $(IAR_PATH)/LIB/DLIB/dl430xlfn.h -Ohz --multiplier=32 --multiplier_location=4C0 --hw_workaround=CPU40 --core=430X $(CFLAGSWERROR) --data_model large --double=32
CUSTOM_RULE_C_TO_O = 1
%.o: %.c
$(CC) $(CFLAGS) $< -o $@
CUSTOM_RULE_C_TO_OBJECTDIR_O = 1
$(OBJECTDIR)/%.o: %.c
$(CC) $(CFLAGS) $< -o $@
# @$(FINALIZE_DEPENDENCY)
CUSTOM_RULE_C_TO_CO = 1
%.co: %.c
$(CC) $(CFLAGS) -DAUTOSTART_ENABLE $< -o $@
AROPTS = -o
LDFLAGS += -B $(IAR_PATH)/lib/dlib/dl430xlfn.r43 -f $(IAR_PATH)/config/lnk430f5437.xcl -l contiki-$(TARGET).map -Fintel-extended -s __program_start
else
GCC = 1
CC = msp430-gcc
LD = msp430-gcc
AS = msp430-as
@ -33,12 +67,16 @@ NM = msp430-nm
OBJCOPY = msp430-objcopy
STRIP = msp430-strip
BSL = msp430-bsl
ifdef WERROR
CFLAGSWERROR=-Werror
endif
CFLAGSNO = -Wall -mmcu=$(MCU) -g $(CFLAGSWERROR)
CFLAGS += $(CFLAGSNO) -Os
LDFLAGS += -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map
endif
ifdef WERROR
CFLAGSWERROR=-Werror
endif
CFLAGS += $(CFLAGSNO)
### These flags can reduce the code size and RAM usage with up to 10%

View file

@ -35,7 +35,14 @@
#include "sys/cc.h"
#ifdef __GNUC__
#include <io.h>
#include <signal.h>
#endif
#ifdef __IAR_SYSTEMS_ICC__
#include <io430.h>
#endif
#define HWCONF_PIN(name, port, bit) \
static CC_INLINE void name##_SELECT() {P##port##SEL &= ~(1 << bit);} \

View file

@ -33,7 +33,6 @@
#ifndef __LPM_H__
#define __LPM_H__
#include <io.h>
#include "contiki-conf.h"
#ifdef LPM_CONF_ON

View file

@ -35,9 +35,15 @@
*
*/
#include <msp430x14x.h>
#include "contiki.h"
#ifdef __IAR_SYSTEMS_ICC__
#include <io430.h>
#else
#include <stdlib.h>
#include <io.h>
#include <signal.h>
#endif
#include "dev/flash.h"
#include "dev/watchdog.h"

View file

@ -69,7 +69,11 @@ void splx_(spl_t);
spl_t splhigh_(void);
#define splhigh() splhigh_()
#ifdef __IAR_SYSTEMS_ICC__
#define splx(sr) sr = __get_SR_register()
#else
#define splx(sr) __asm__ __volatile__("bis %0, r2" : : "r" (sr))
#endif
/* Workaround for bug in msp430-gcc compiler */
#if defined(__MSP430__) && defined(__GNUC__) && MSP430_MEMCPY_WORKAROUND

View file

@ -34,6 +34,10 @@
#include <stdio.h>
#include "sys/mt.h"
#ifdef __IAR_SYSTEMS_ICC__
#define __asm__ asm
#endif
static unsigned short *sptmp;
static struct mtarch_thread *running;
@ -97,8 +101,14 @@ sw(void)
__asm__("push r14");
__asm__("push r15");
#ifdef __IAR_SYSTEMS_ICC__
/* use IAR intrinsic functions */
running->sp = (unsigned short *) __get_SP_register();
__set_SP_register((unsigned short) sptmp);
#else
__asm__("mov.w r1,%0" : "=r" (running->sp));
__asm__("mov.w %0,r1" : : "m" (sptmp));
#endif
__asm__("pop r15");
__asm__("pop r14");

View file

@ -39,7 +39,7 @@ struct mtarch_thread {
unsigned short stack[MTARCH_STACKSIZE];
unsigned short *sp;
void *data;
void *function;
void (* function)(void *);
};
struct mt_thread;

View file

@ -38,8 +38,14 @@
* Adam Dunkels <adam@sics.se>
*/
#ifdef __GNUC__
#include <io.h>
#include <signal.h>
#endif
#ifdef __IAR_SYSTEMS_ICC__
#include <io430.h>
#endif
#include "sys/energest.h"
#include "sys/rtimer.h"

View file

@ -41,7 +41,6 @@
#ifndef __RTIMER_ARCH_H__
#define __RTIMER_ARCH_H__
#include <io.h>
#include "sys/rtimer.h"
#define RTIMER_ARCH_SECOND (4096U*8)

View file

@ -32,6 +32,7 @@
*/
#include "dev/watchdog.h"
#include <stdlib.h>
/*---------------------------------------------------------------------------*/
void
@ -57,5 +58,7 @@ watchdog_stop(void)
void
watchdog_reboot(void)
{
// Death by watchdog.
exit(-1);
}
/*---------------------------------------------------------------------------*/

View file

@ -136,7 +136,7 @@ collect_common_send(void)
nbr = uip_ds6_nbr_lookup(&preferred_parent->addr);
if(nbr != NULL) {
rimeaddr_copy(&parent, (rimeaddr_t *)&nbr->ipaddr.u8[8]);
parent_etx = neighbor_info_get_etx((rimeaddr_t *) &nbr->lladdr) / 2;
parent_etx = neighbor_info_get_metric((rimeaddr_t *) &nbr->lladdr) / 2;
}
}
rtmetric = dag->rank;

View file

@ -33,6 +33,7 @@
#include "lib/sensors.h"
#include "dev/irq.h"
#include "dev/lpm.h"
#include <io.h>
#include <signal.h>
#define ADC12MCTL_NO(adcno) ((unsigned char *) ADC12MCTL0_)[adcno]

View file

@ -34,6 +34,7 @@
#include "dev/radio-sensor.h"
#include "dev/irq.h"
#include "dev/tr1001.h"
#include <io.h>
const struct sensors_sensor radio_sensor;

View file

@ -30,9 +30,10 @@
*
* @(#)$Id: sound-sensor.c,v 1.5 2010/02/08 00:00:45 nifi Exp $
*/
#include <stdlib.h>
#include "dev/sound-sensor.h"
#include "dev/irq.h"
#include <stdlib.h>
#include <io.h>
#define MIC_MIN_SENS 150
#define SAMPLE 1

View file

@ -48,6 +48,7 @@
#include "lib/random.h"
#include "net/netstack.h"
#include "net/mac/frame802154.h"
#include "lib/include/uart1.h"
#if WITH_UIP6
#include "net/sicslowpan.h"
@ -490,7 +491,6 @@ main(void)
cop_service();
#endif
/* TODO: replace this with a uart rx interrupt */
if(uart1_input_handler != NULL) {
if(uart1_can_get()) {
uart1_input_handler(uart1_getc());

View file

@ -60,7 +60,7 @@ const char *netmask;
int slipfd = 0;
uint16_t basedelay=0,delaymsec=0;
uint32_t startsec,startmsec,delaystartsec,delaystartmsec;
int timestamp = 0;
int timestamp = 0, flowcontrol=0;
int ssystem(const char *fmt, ...)
__attribute__((__format__ (__printf__, 1, 2)));
@ -172,7 +172,7 @@ serial_to_tun(FILE *inslip, int outfd)
if(inbufptr >= sizeof(uip.inbuf)) {
inbufptr = 0;
if(timestamp) stamptime();
fprintf(stderr, "*** dropping too large packet\n");
fprintf(stderr, "*** dropping large %d byte packet\n",inbufptr);
}
ret = fread(&c, 1, 1, inslip);
#ifdef linux
@ -459,6 +459,9 @@ stty_telos(int fd)
/* Nonblocking read. */
tty.c_cc[VTIME] = 0;
tty.c_cc[VMIN] = 0;
if (flowcontrol)
tty.c_cflag |= CRTSCTS;
else
tty.c_cflag &= ~CRTSCTS;
tty.c_cflag &= ~HUPCL;
tty.c_cflag &= ~CLOCAL;
@ -616,12 +619,16 @@ main(int argc, char **argv)
prog = argv[0];
setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */
while((c = getopt(argc, argv, "B:D:Lhs:t:v::d::a:p:T")) != -1) {
while((c = getopt(argc, argv, "B:H:D:Lhs:t:v::d::a:p:T")) != -1) {
switch(c) {
case 'B':
baudrate = atoi(optarg);
break;
case 'H':
flowcontrol=1;
break;
case 'L':
timestamp=1;
break;
@ -671,6 +678,7 @@ fprintf(stderr,"usage: %s [options] ipaddress\n", prog);
fprintf(stderr,"example: tunslip6 -L -v2 -s ttyUSB1 aaaa::1/64\n");
fprintf(stderr,"Options are:\n");
fprintf(stderr," -B baudrate 9600,19200,38400,57600,115200 (default)\n");
fprintf(stderr," -H Hardware CTS/RTS flow control (default disabled)\n");
fprintf(stderr," -L Log output format (adds time stamps)\n");
fprintf(stderr," -s siodev Serial device (default /dev/ttyUSB0)\n");
fprintf(stderr," -T Make tap interface (default is tun interface)\n");
@ -696,7 +704,7 @@ exit(1);
argv += (optind - 1);
if(argc != 2 && argc != 3) {
err(1, "usage: %s [-B baudrate] [-L] [-s siodev] [-t tundev] [-T] [-v verbosity] [-d delay] [-a serveraddress] [-p serverport] ipaddress", prog);
err(1, "usage: %s [-B baudrate] [-H] [-L] [-s siodev] [-t tundev] [-T] [-v verbosity] [-d delay] [-a serveraddress] [-p serverport] ipaddress", prog);
}
ipaddr = argv[1];