A null radio driver that does not do anything - useful in the native port and as a template for new radio drivers

This commit is contained in:
adamdunkels 2010-02-23 18:18:53 +00:00
parent e695e4860d
commit 5292005962
3 changed files with 90 additions and 3 deletions

View file

@ -53,7 +53,7 @@ SYSTEM = process.c procinit.c autostart.c elfloader.c profile.c \
THREADS = mt.c THREADS = mt.c
LIBS = memb.c mmem.c timer.c list.c etimer.c energest.c rtimer.c stimer.c \ LIBS = memb.c mmem.c timer.c list.c etimer.c energest.c rtimer.c stimer.c \
print-stats.c ifft.c crc16.c random.c checkpoint.c ringbuf.c print-stats.c ifft.c crc16.c random.c checkpoint.c ringbuf.c
DEV = nullradio.c
NET = netstack.c NET = netstack.c
ifdef UIP_CONF_IPV6 ifdef UIP_CONF_IPV6
@ -72,9 +72,9 @@ CTK = ctk.c
CTKVNC = $(CTK) ctk-vncserver.c libconio.c vnc-server.c vnc-out.c ctk-vncfont.c CTKVNC = $(CTK) ctk-vncserver.c libconio.c vnc-server.c vnc-out.c ctk-vncfont.c
ifndef CONTIKI_NO_NET ifndef CONTIKI_NO_NET
CONTIKIFILES = $(SYSTEM) $(LIBS) $(NET) $(THREADS) $(DHCP) CONTIKIFILES = $(SYSTEM) $(LIBS) $(NET) $(THREADS) $(DHCP) $(DEV)
else else
CONTIKIFILES = $(SYSTEM) $(LIBS) $(THREADS) sicslowpan.c fakeuip.c CONTIKIFILES = $(SYSTEM) $(LIBS) $(THREADS) $(DEV) sicslowpan.c fakeuip.c
endif endif
CONTIKI_SOURCEFILES += $(CONTIKIFILES) CONTIKI_SOURCEFILES += $(CONTIKIFILES)

79
core/dev/nullradio.c Normal file
View file

@ -0,0 +1,79 @@
#include "dev/nullradio.h"
/*---------------------------------------------------------------------------*/
static int
init(void)
{
return 0;
}
/*---------------------------------------------------------------------------*/
static int
prepare(const void *payload, unsigned short payload_len)
{
return 1;
}
/*---------------------------------------------------------------------------*/
static int
transmit(unsigned short transmit_len)
{
return RADIO_TX_OK;
}
/*---------------------------------------------------------------------------*/
static int
send(const void *payload, unsigned short payload_len)
{
prepare(payload, payload_len);
return transmit(payload_len);
}
/*---------------------------------------------------------------------------*/
static int
read(void *buf, unsigned short buf_len)
{
return 0;
}
/*---------------------------------------------------------------------------*/
static int
channel_clear(void)
{
return 1;
}
/*---------------------------------------------------------------------------*/
static int
receiving_packet(void)
{
return 0;
}
/*---------------------------------------------------------------------------*/
static int
pending_packet(void)
{
return 0;
}
/*---------------------------------------------------------------------------*/
static int
on(void)
{
return 0;
}
/*---------------------------------------------------------------------------*/
static int
off(void)
{
return 0;
}
/*---------------------------------------------------------------------------*/
const struct radio_driver nullradio_driver =
{
init,
prepare,
transmit,
send,
read,
channel_clear,
receiving_packet,
pending_packet,
on,
off,
};
/*---------------------------------------------------------------------------*/

8
core/dev/nullradio.h Normal file
View file

@ -0,0 +1,8 @@
#ifndef NULLRADIO_H
#define NULLRADIO_H
#include "dev/radio.h"
extern const struct radio_driver nullradio_driver;
#endif /* NULLRADIO_H */