native cc110x_ng placebo

This commit is contained in:
Ludwig Ortmann 2013-03-21 17:08:41 +01:00
parent 1197314093
commit 671cb6560f
6 changed files with 175 additions and 1 deletions

View File

@ -33,5 +33,11 @@ ifneq (,$(findstring cc110x_ng,$(USEMODULE)))
USEMODULE += hwtimer
endif
endif
ifneq (,$(findstring native,$(BOARD)))
USEMODULE += cc110x_spi
ifeq (,$(findstring hwtimer,$(USEMODULE)))
USEMODULE += hwtimer
endif
endif
endif

View File

@ -5,6 +5,9 @@ DIRS =
ifneq (,$(findstring rtc,$(USEMODULE)))
DIRS += rtc
endif
ifneq (,$(findstring cc110x_ng,$(USEMODULE)))
DIRS += cc110x_ng
endif
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do $(MAKE) -C $$i ; done ;

View File

@ -0,0 +1,7 @@
INCLUDES = -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/core/include
INCLUDES += -I$(RIOTBASE)/drivers/cc110x_ng/include/ -I$(RIOTBASE)/sys/include
MODULE =cc110x_ng
include $(MAKEBASE)/Makefile.base

View File

@ -0,0 +1,151 @@
#include <stdio.h>
#include <err.h>
#include <debug.h>
#include <cc110x-arch.h>
#include <cc110x_ng.h>
#include <cc110x_spi.h>
#include <cc110x-internal.h> /* CC1100_READ_BURST etc. */
static int native_cc110x_enabled;
static int native_cc110x_gd0;
static int native_cc110x_gd1;
static int native_cc110x_gd2;
static int native_cc110x_gd0_enabled;
static int native_cc110x_gd2_enabled;
static uint8_t native_cc110x_ssp0dr;
/* arch */
/**
* writes to SSP0 data register and reads from it once it is ready
*/
uint8_t cc110x_txrx(uint8_t c)
{
native_cc110x_ssp0dr = c;
switch (c) {
case CC1100_READ_BURST:
case CC1100_WRITE_BURST:
case CC1100_READ_SINGLE:
case CC1100_NOBYTE:
default:
warnx("cc110x_txrx (%i): not implemented", c);
}
DEBUG("cc110x_txrx\n");
return native_cc110x_ssp0dr;
}
/**
* disables GDO0 interrupt
*/
void cc110x_gdo0_enable(void)
{
/* this would be for rising/high edge if this was proper hardware */
native_cc110x_gd0_enabled = 1;
DEBUG("cc110x_gdo0_enable\n");
return;
}
/**
* enables GDO0 interrupt
*/
void cc110x_gdo0_disable(void)
{
native_cc110x_gd0_enabled = 0;
DEBUG("cc110x_gdo0_disable\n");
return;
}
/**
* enables GDO2 interrupt
*/
void cc110x_gdo2_enable(void)
{
/* this would be for falling/low edge if this was proper hardware */
native_cc110x_gd2_enabled = 1;
DEBUG("cc110x_gdo2_enable\n");
return;
}
/**
* disables GDO2 interrupt
*/
void cc110x_gdo2_disable(void)
{
native_cc110x_gd2_enabled = 0;
DEBUG("cc110x_gdo2_disable\n");
return;
}
/**
* enable interrupts for GDO0 and GDO2
*/
void cc110x_init_interrupts(void)
{
/* this would be for low edge in both cases if this was proper hardware */
cc110x_gdo2_enable();
cc110x_gdo0_enable();
DEBUG("cc110x_init_interrupts\n");
return;
}
void cc110x_before_send(void)
{
cc110x_gdo2_disable();
DEBUG("cc110x_before_send\n");
return;
}
void cc110x_after_send(void)
{
cc110x_gdo2_enable();
DEBUG("cc110x_after_send\n");
return;
}
/* spi */
int cc110x_get_gdo0(void)
{
DEBUG("cc110x_get_gdo0\n");
return native_cc110x_gd0;
}
int cc110x_get_gdo1(void)
{
DEBUG("cc110x_get_gdo1\n");
return native_cc110x_gd1;
}
int cc110x_get_gdo2(void)
{
DEBUG("cc110x_get_gdo2\n");
return native_cc110x_gd2;
}
void cc110x_spi_init(void)
{
native_cc110x_enabled = 1; /* power on */
DEBUG("cc110x_spi_init\n");
return;
}
void cc110x_spi_cs(void)
{
DEBUG("cc110x_spi_cs\n");
return;
}
void cc110x_spi_select(void)
{
DEBUG("cc110x_spi_select\n");
return;
}
void cc110x_spi_unselect(void)
{
DEBUG("cc110x_spi_unselect\n");
return;
}
/* ng */

View File

@ -21,7 +21,7 @@
#define KERNEL_CONF_STACKSIZE_DEFAULT 8192
#endif
#define KERNEL_CONF_STACKSIZE_IDLE 2048
#define KERNEL_CONF_STACKSIZE_IDLE 4096
#define NATIVE_ISR_STACKSIZE 8192
#define _SIG_UNDEF SIGRTMIN + 0
@ -30,4 +30,8 @@
/* TODO: check for overflow (SIGRTMAX) */
/* for cc110x_ng */
#define RX_BUF_SIZE (10)
#define TRANSCEIVER_BUFFER_SIZE (3)
#endif /* CPUCONF_H_ */

View File

@ -8,6 +8,9 @@ endif
ifneq (,$(findstring msba2,$(BOARD)))
DIRS += spi
endif
ifneq (,$(findstring native,$(BOARD)))
DIRS += spi
endif
all: $(BINDIR)$(MODULE).a
@for i in $(DIRS) ; do $(MAKE) -C $$i ; done ;