summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-20 13:32:49 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-20 13:32:49 +0000
commitfb0960f36c48d3dc2e21d3f5193788f23b6bfa48 (patch)
treed0e355e0baa6cdfe2bc68f770341c1e12ad68f7f
parent60af61e86dfef73118ca1b21052085819df772a8 (diff)
downloadnuttx-fb0960f36c48d3dc2e21d3f5193788f23b6bfa48.tar.gz
nuttx-fb0960f36c48d3dc2e21d3f5193788f23b6bfa48.tar.bz2
nuttx-fb0960f36c48d3dc2e21d3f5193788f23b6bfa48.zip
Updates from Uros
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3527 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/drivers/Makefile28
-rw-r--r--nuttx/drivers/README.txt7
-rw-r--r--nuttx/drivers/sensors/st_lis331dl.c36
-rw-r--r--nuttx/drivers/wireless/Make.defs41
-rwxr-xr-xnuttx/drivers/wireless/chipcon_cc1101.c516
-rwxr-xr-xnuttx/include/nuttx/event.h235
-rw-r--r--nuttx/include/nuttx/sensors/st_lis331dl.h35
-rwxr-xr-xnuttx/include/nuttx/wireless/chipcon_cc1101.h (renamed from nuttx/include/nuttx/ptimer.h)86
-rw-r--r--nuttx/tools/Makefile.host3
9 files changed, 912 insertions, 75 deletions
diff --git a/nuttx/drivers/Makefile b/nuttx/drivers/Makefile
index 45dbe761a..7bc8c6912 100644
--- a/nuttx/drivers/Makefile
+++ b/nuttx/drivers/Makefile
@@ -39,69 +39,67 @@ ifeq ($(WINTOOL),y)
INCDIROPT = -w
endif
+ROOTDEPPATH = --dep-path .
+
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
include serial/Make.defs
-ROOTDEPPATH = --dep-path .
SERIALDEPPATH = --dep-path serial
endif
ifeq ($(CONFIG_NET),y)
include net/Make.defs
-ROOTDEPPATH = --dep-path .
NETDEPPATH = --dep-path net
endif
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
include pipes/Make.defs
-ROOTDEPPATH = --dep-path .
PIPEDEPPATH = --dep-path pipes
endif
ifeq ($(CONFIG_USBDEV),y)
include usbdev/Make.defs
-ROOTDEPPATH = --dep-path .
USBDEVDEPPATH = --dep-path usbdev
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/usbdev}
endif
ifeq ($(CONFIG_USBHOST),y)
include usbhost/Make.defs
-ROOTDEPPATH = --dep-path .
USBHOSTDEPPATH = --dep-path usbhost
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/usbhost}
endif
include mmcsd/Make.defs
-ROOTDEPPATH = --dep-path .
MMCSDDEPPATH = --dep-path mmcsd
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/mmcsd}
include lcd/Make.defs
-ROOTDEPPATH = --dep-path .
LCDDEPPATH = --dep-path lcd
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/lcd}
ifneq ($(CONFIG_NFILE_DESCRIPTORS),0)
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
include bch/Make.defs
-ROOTDEPPATH = --dep-path .
BCHDEPPATH = --dep-path bch
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/bch}
endif
endif
include mtd/Make.defs
-ROOTDEPPATH = --dep-path .
MTDDEPPATH = --dep-path mtd
include sensors/Make.defs
-ROOTDEPPATH = --dep-path .
-SENSORDEPPATH = --dep-path sensors
+SENSORSDEPPATH = --dep-path sensors
CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/sensors}
+ifeq ($(CONFIG_WIRELESS),y)
+include wireless/Make.defs
+WIRELESSDEPPATH = --dep-path wireless
+CFLAGS += ${shell $(TOPDIR)/tools/incdir.sh $(INCDIROPT) "$(CC)" $(TOPDIR)/drivers/wireless}
+endif
+
ASRCS = $(SERIAL_ASRCS) $(NET_ASRCS) $(PIPE_ASRCS) $(USBDEV_ASRCS) \
$(USBHOST_ASRCS) $(MMCSD_ASRCS) $(LCD_ASRCS) $(BCH_ASRCS) \
- $(MTD_ASRCS) $(SENSOR_ASRCS)
+ $(MTD_ASRCS) $(SENSOR_ASRCS) $(WIRELESS_ASRCS)
AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS =
@@ -113,7 +111,7 @@ endif
endif
CSRCS += $(SERIAL_CSRCS) $(NET_CSRCS) $(PIPE_CSRCS) $(USBDEV_CSRCS) \
$(USBHOST_CSRCS) $(MMCSD_CSRCS) $(LCD_CSRCS) $(BCH_CSRCS) \
- $(MTD_CSRCS) $(SENSOR_CSRCS)
+ $(MTD_CSRCS) $(SENSOR_CSRCS) $(WIRELESS_CSRCS)
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
@@ -121,7 +119,7 @@ OBJS = $(AOBJS) $(COBJS)
BIN = libdrivers$(LIBEXT)
-VPATH = serial:net:pipes:usbdev:usbhost:mmcsd:lcd:bch:mtd:sensors
+VPATH = serial:net:pipes:usbdev:usbhost:mmcsd:lcd:bch:mtd:sensors:wireless
all: $(BIN)
@@ -139,7 +137,7 @@ $(BIN): $(OBJS)
.depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) $(SERIALDEPPATH) $(NETDEPPATH) $(PIPEDEPPATH) \
$(USBDEVDEPPATH) $(USBHOSTDEPPATH) $(MMCSDDEPPATH) $(LCDDEPPATH) \
- $(BCHDEPPATH) $(MTDDEPPATH) $(SENSORDEPPATH) \
+ $(BCHDEPPATH) $(MTDDEPPATH) $(SENSORSDEPPATH) $(WIRELESSDEPPATH) \
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@
diff --git a/nuttx/drivers/README.txt b/nuttx/drivers/README.txt
index d0949e514..871a713df 100644
--- a/nuttx/drivers/README.txt
+++ b/nuttx/drivers/README.txt
@@ -31,6 +31,10 @@ ramdisk.c
a block driver that can be mounted as a files system. See
include/nuttx/ramdisk.h.
+rwbuffer.c
+ A facility that can be use by any block driver in-order to add
+ writing buffering and read-ahead buffering.
+
Subdirectories of this directory:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -66,6 +70,9 @@ pipes/
FIFO and named pipe drivers. Standard interfaces are declared
in include/unistd.h
+sensors/
+ Drivers for various sensors
+
serial/
Front-ends character drivers for chip-specific UARTs. This provide
some TTY-like functionality and are commonly used (but not required for)
diff --git a/nuttx/drivers/sensors/st_lis331dl.c b/nuttx/drivers/sensors/st_lis331dl.c
index 19f7dd755..ab2228fe7 100644
--- a/nuttx/drivers/sensors/st_lis331dl.c
+++ b/nuttx/drivers/sensors/st_lis331dl.c
@@ -48,6 +48,42 @@
#include <nuttx/kmalloc.h>
#include <nuttx/sensors/st_lis331dl.h>
+
+/************************************************************************************
+ * LIS331DL Internal Registers
+ ************************************************************************************/
+
+#define ST_LIS331DL_WHOAMI 0x0F /* who am I register */
+#define ST_LIS331DL_WHOAMI_VALUE 0x3B /* Valid result is 0x3B */
+
+#define ST_LIS331DL_CTRL_REG1 0x20
+#define ST_LIS331DL_CR1_DR 0x80 /* Data-rate selection 0: 100 Hz, 1: 400 Hz */
+#define ST_LIS331DL_CR1_PD 0x40 /* Active Mode (1) / Power-down (0) */
+#define ST_LIS331DL_CR1_FS 0x20 /* Full Scale (1) +-9g or Normal Scale (0) +-2g */
+#define ST_LIS331DL_CR1_ST 0x18 /* Self test enable */
+#define ST_LIS331DL_CR1_ZEN 0x04 /* Z-Axis Enable */
+#define ST_LIS331DL_CR1_YEN 0x02 /* Y-Axis Enable */
+#define ST_LIS331DL_CR1_XEN 0x01 /* X-Axis Enable */
+
+#define ST_LIS331DL_CTRL_REG2 0x21
+#define ST_LIS331DL_CTRL_REG3 0x22
+
+#define ST_LIS331DL_HP_FILTER_RESET 0x23
+
+#define ST_LIS331DL_STATUS_REG 0x27 /* Status Register */
+#define ST_LIS331DL_SR_ZYXOR 0x80 /* OR'ed X,Y and Z data over-run */
+#define ST_LIS331DL_SR_ZOR 0x40 /* individual data over-run ... */
+#define ST_LIS331DL_SR_YOR 0x20
+#define ST_LIS331DL_SR_XOR 0x10
+#define ST_LIS331DL_SR_ZYXDA 0x08 /* OR'ed X,Y and Z data available */
+#define ST_LIS331DL_SR_ZDA 0x04 /* individual data available ... */
+#define ST_LIS331DL_SR_YDA 0x02
+#define ST_LIS331DL_SR_XDA 0x01
+
+#define ST_LIS331DL_OUT_X 0x29
+#define ST_LIS331DL_OUT_Y 0x2B
+#define ST_LIS331DL_OUT_Z 0x2D
+
/************************************************************************************
* Private Data Types
diff --git a/nuttx/drivers/wireless/Make.defs b/nuttx/drivers/wireless/Make.defs
new file mode 100644
index 000000000..93d062d2b
--- /dev/null
+++ b/nuttx/drivers/wireless/Make.defs
@@ -0,0 +1,41 @@
+############################################################################
+# drivers/wireless/Make.defs
+#
+# Copyright (C) 2011 Gregory Nutt. All rights reserved.
+# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# 3. Neither the name NuttX nor the names of its contributors may be
+# used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+############################################################################
+
+WIRELESS_ASRCS =
+WIRELESS_CSRCS =
+
+ifeq ($(CONFIG_WIRELESS),y)
+WIRELESS_CSRCS += chipcon_cc1101.c
+endif
diff --git a/nuttx/drivers/wireless/chipcon_cc1101.c b/nuttx/drivers/wireless/chipcon_cc1101.c
new file mode 100755
index 000000000..5c492a4fd
--- /dev/null
+++ b/nuttx/drivers/wireless/chipcon_cc1101.c
@@ -0,0 +1,516 @@
+/****************************************************************************
+ * drivers/wireless/chipcon_cc1101.c
+ *
+ * Copyright (C) 2011 Uros Platise. All rights reserved.
+ *
+ * Authors: Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/** \file
+ * \author Uros Platise
+ * \brief Chipcon CC1101 Device Driver
+ *
+ *
+ **/
+
+#include <nuttx/config.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <stdio.h>
+
+#include <nuttx/kmalloc.h>
+#include <nuttx/wireless/chipcon_cc1101.h>
+
+#include <nuttx/ptimer.h>
+
+
+/************************************************************************************
+ * Chipcon CC1101 Internal Registers
+ ************************************************************************************/
+
+/* Configuration Registers */
+
+#define CC1101_IOCFG2 0x00 /* GDO2 output pin configuration */
+#define CC1101_IOCFG1 0x01 /* GDO1 output pin configuration */
+#define CC1101_IOCFG0 0x02 /* GDO0 output pin configuration */
+#define CC1101_FIFOTHR 0x03 /* RX FIFO and TX FIFO thresholds */
+#define CC1101_SYNC1 0x04 /* Sync word, high byte */
+#define CC1101_SYNC0 0x05 /* Sync word, low byte */
+#define CC1101_PKTLEN 0x06 /* Packet length */
+#define CC1101_PKTCTRL1 0x07 /* Packet automation control */
+#define CC1101_PKTCTRL0 0x08 /* Packet automation control */
+#define CC1101_ADDR 0x09 /* Device address */
+#define CC1101_CHANNR 0x0A /* Channel number */
+#define CC1101_FSCTRL1 0x0B /* Frequency synthesizer control */
+#define CC1101_FSCTRL0 0x0C /* Frequency synthesizer control */
+#define CC1101_FREQ2 0x0D /* Frequency control word, high byte */
+#define CC1101_FREQ1 0x0E /* Frequency control word, middle byte */
+#define CC1101_FREQ0 0x0F /* Frequency control word, low byte */
+#define CC1101_MDMCFG4 0x10 /* Modem configuration */
+#define CC1101_MDMCFG3 0x11 /* Modem configuration */
+#define CC1101_MDMCFG2 0x12 /* Modem configuration */
+#define CC1101_MDMCFG1 0x13 /* Modem configuration */
+#define CC1101_MDMCFG0 0x14 /* Modem configuration */
+#define CC1101_DEVIATN 0x15 /* Modem deviation setting */
+#define CC1101_MCSM2 0x16 /* Main Radio Cntrl State Machine config */
+#define CC1101_MCSM1 0x17 /* Main Radio Cntrl State Machine config */
+#define CC1101_MCSM0 0x18 /* Main Radio Cntrl State Machine config */
+#define CC1101_FOCCFG 0x19 /* Frequency Offset Compensation config */
+#define CC1101_BSCFG 0x1A /* Bit Synchronization configuration */
+#define CC1101_AGCCTRL2 0x1B /* AGC control */
+#define CC1101_AGCCTRL1 0x1C /* AGC control */
+#define CC1101_AGCCTRL0 0x1D /* AGC control */
+#define CC1101_WOREVT1 0x1E /* High byte Event 0 timeout */
+#define CC1101_WOREVT0 0x1F /* Low byte Event 0 timeout */
+#define CC1101_WORCTRL 0x20 /* Wake On Radio control */
+#define CC1101_FREND1 0x21 /* Front end RX configuration */
+#define CC1101_FREND0 0x22 /* Front end TX configuration */
+#define CC1101_FSCAL3 0x23 /* Frequency synthesizer calibration */
+#define CC1101_FSCAL2 0x24 /* Frequency synthesizer calibration */
+#define CC1101_FSCAL1 0x25 /* Frequency synthesizer calibration */
+#define CC1101_FSCAL0 0x26 /* Frequency synthesizer calibration */
+#define CC1101_RCCTRL1 0x27 /* RC oscillator configuration */
+#define CC1101_RCCTRL0 0x28 /* RC oscillator configuration */
+#define CC1101_FSTEST 0x29 /* Frequency synthesizer cal control */
+#define CC1101_PTEST 0x2A /* Production test */
+#define CC1101_AGCTEST 0x2B /* AGC test */
+#define CC1101_TEST2 0x2C /* Various test settings */
+#define CC1101_TEST1 0x2D /* Various test settings */
+#define CC1101_TEST0 0x2E /* Various test settings */
+
+/* Status registers */
+
+#define CC1101_PARTNUM (0x30 | 0xc0) /* Part number */
+#define CC1101_VERSION (0x31 | 0xc0) /* Current version number */
+#define CC1101_FREQEST (0x32 | 0xc0) /* Frequency offset estimate */
+#define CC1101_LQI (0x33 | 0xc0) /* Demodulator estimate for link quality */
+#define CC1101_RSSI (0x34 | 0xc0) /* Received signal strength indication */
+#define CC1101_MARCSTATE (0x35 | 0xc0) /* Control state machine state */
+#define CC1101_WORTIME1 (0x36 | 0xc0) /* High byte of WOR timer */
+#define CC1101_WORTIME0 (0x37 | 0xc0) /* Low byte of WOR timer */
+#define CC1101_PKTSTATUS (0x38 | 0xc0) /* Current GDOx status and packet status */
+#define CC1101_VCO_VC_DAC (0x39 | 0xc0) /* Current setting from PLL cal module */
+#define CC1101_TXBYTES (0x3A | 0xc0) /* Underflow and # of bytes in TXFIFO */
+#define CC1101_RXBYTES (0x3B | 0xc0) /* Overflow and # of bytes in RXFIFO */
+#define CC1101_RCCTRL1_STATUS (0x3E | 0xc0) /* Last RC oscilator calibration results */
+#define CC1101_RCCTRL0_STATUS (0x3F | 0xc0) /* Last RC oscilator calibration results */
+
+/* Multi byte memory locations */
+
+#define CC1101_PATABLE 0x3E
+#define CC1101_TXFIFO 0x3F
+#define CC1101_RXFIFO 0x3F
+
+/* Definitions for burst/single access to registers */
+
+#define CC1101_WRITE_BURST 0x40
+#define CC1101_READ_SINGLE 0x80
+#define CC1101_READ_BURST 0xC0
+
+/* Strobe commands */
+
+#define CC1101_SRES 0x30 /* Reset chip. */
+#define CC1101_SFSTXON 0x31 /* Enable and calibrate frequency synthesizer (if MCSM0.FS_AUTOCAL=1). */
+#define CC1101_SXOFF 0x32 /* Turn off crystal oscillator. */
+#define CC1101_SCAL 0x33 /* Calibrate frequency synthesizer and turn it off */
+#define CC1101_SRX 0x34 /* Enable RX. Perform calibration first if switching from IDLE and MCSM0.FS_AUTOCAL=1. */
+#define CC1101_STX 0x35 /* Enable TX. Perform calibration first if IDLE and MCSM0.FS_AUTOCAL=1. */
+ /* If switching from RX state and CCA is enabled then go directly to TX if channel is clear. */
+#define CC1101_SIDLE 0x36 /* Exit RX / TX, turn off frequency synthesizer and exit Wake-On-Radio mode if applicable. */
+#define CC1101_SAFC 0x37 /* Perform AFC adjustment of the frequency synthesizer */
+#define CC1101_SWOR 0x38 /* Start automatic RX polling sequence (Wake-on-Radio) */
+#define CC1101_SPWD 0x39 /* Enter power down mode when CSn goes high. */
+#define CC1101_SFRX 0x3A /* Flush the RX FIFO buffer. */
+#define CC1101_SFTX 0x3B /* Flush the TX FIFO buffer. */
+#define CC1101_SWORRST 0x3C /* Reset real time clock. */
+#define CC1101_SNOP 0x3D /* No operation. */
+
+/*
+ * Chip Status Byte
+ */
+
+/* Bit fields in the chip status byte */
+
+#define CC1101_STATUS_CHIP_RDYn_BM 0x80
+#define CC1101_STATUS_STATE_BM 0x70
+#define CC1101_STATUS_FIFO_BYTES_AVAILABLE_BM 0x0F
+
+/* Chip states */
+
+#define CC1101_STATE_IDLE 0x00
+#define CC1101_STATE_RX 0x10
+#define CC1101_STATE_TX 0x20
+#define CC1101_STATE_FSTXON 0x30
+#define CC1101_STATE_CALIBRATE 0x40
+#define CC1101_STATE_SETTLING 0x50
+#define CC1101_STATE_RX_OVERFLOW 0x60
+#define CC1101_STATE_TX_UNDERFLOW 0x70
+
+/* Values of the MACRSTATE register */
+
+#define CC1101_MARCSTATE_SLEEP 0x00
+#define CC1101_MARCSTATE_IDLE 0x01
+#define CC1101_MARCSTATE_XOFF 0x02
+#define CC1101_MARCSTATE_VCOON_MC 0x03
+#define CC1101_MARCSTATE_REGON_MC 0x04
+#define CC1101_MARCSTATE_MANCAL 0x05
+#define CC1101_MARCSTATE_VCOON 0x06
+#define CC1101_MARCSTATE_REGON 0x07
+#define CC1101_MARCSTATE_STARTCAL 0x08
+#define CC1101_MARCSTATE_BWBOOST 0x09
+#define CC1101_MARCSTATE_FS_LOCK 0x0A
+#define CC1101_MARCSTATE_IFADCON 0x0B
+#define CC1101_MARCSTATE_ENDCAL 0x0C
+#define CC1101_MARCSTATE_RX 0x0D
+#define CC1101_MARCSTATE_RX_END 0x0E
+#define CC1101_MARCSTATE_RX_RST 0x0F
+#define CC1101_MARCSTATE_TXRX_SWITCH 0x10
+#define CC1101_MARCSTATE_RXFIFO_OVERFLOW 0x11
+#define CC1101_MARCSTATE_FSTXON 0x12
+#define CC1101_MARCSTATE_TX 0x13
+#define CC1101_MARCSTATE_TX_END 0x14
+#define CC1101_MARCSTATE_RXTX_SWITCH 0x15
+#define CC1101_MARCSTATE_TXFIFO_UNDERFLOW 0x16
+
+
+/*
+ * General Purpose, Test Output Pin Options
+ */
+
+/* Associated to the RX FIFO: Asserts when RX FIFO is filled at or above
+ * the RX FIFO threshold. De-asserts when RX FIFO is drained below the
+ * same threshold. */
+#define CC1101_GDO_RXFIFO_THR 0x00
+
+/* Associated to the RX FIFO: Asserts when RX FIFO is filled at or above
+ * the RX FIFO threshold or the end of packet is reached. De-asserts when
+ * the RX FIFO is empty. */
+#define CC1101_GDO_RXFIFO_THREND 0x01
+
+/* Associated to the TX FIFO: Asserts when the TX FIFO is filled at or
+ * above the TX FIFO threshold. De-asserts when the TX FIFO is below the
+ * same threshold. */
+#define CC1101_GDO_TXFIFO_THR 0x02
+
+/* Associated to the TX FIFO: Asserts when TX FIFO is full. De-asserts
+ * when the TX FIFO is drained below theTX FIFO threshold. */
+#define CC1101_GDO_TXFIFO_FULL 0x03
+
+/* Asserts when the RX FIFO has overflowed. De-asserts when the FIFO has
+ * been flushed. */
+#define CC1101_GDO_RXFIFO_OVR 0x04
+
+/* Asserts when the TX FIFO has underflowed. De-asserts when the FIFO is
+ * flushed. */
+#define CC1101_GDO_TXFIFO_UNR 0x05
+
+/* Asserts when sync word has been sent / received, and de-asserts at the
+ * end of the packet. In RX, the pin will de-assert when the optional
+ * address check fails or the RX FIFO overflows. In TX the pin will
+ * de-assert if the TX FIFO underflows. */
+#define CC1101_GDO_SYNC 0x06
+
+/* Asserts when a packet has been received with CRC OK. De-asserts when
+ * the first byte is read from the RX FIFO. */
+#define CC1101_GDO_CRCOK 0x07
+
+/* Preamble Quality Reached. Asserts when the PQI is above the programmed
+ * PQT value. */
+#define CC1101_GDO_PREAMBLE 0x08
+
+/* Clear channel assessment. High when RSSI level is below threshold
+ * (dependent on the current CCA_MODE setting). */
+#define CC1101_GDO_CHCLEAR 0x09
+
+/* Lock detector output. The PLL is in lock if the lock detector output
+ * has a positive transition or is constantly logic high. To check for
+ * PLL lock the lock detector output should be used as an interrupt for
+ * the MCU. */
+#define CC1101_GDO_LOCK 0x0A
+
+/* Serial Clock. Synchronous to the data in synchronous serial mode.
+ * In RX mode, data is set up on the falling edge by CC1101 when GDOx_INV=0.
+ * In TX mode, data is sampled by CC1101 on the rising edge of the serial
+ * clock when GDOx_INV=0. */
+#define CC1101_GDO_SSCLK 0x0B
+
+/* Serial Synchronous Data Output. Used for synchronous serial mode. */
+#define CC1101_GDO_SSDO 0x0C
+
+/* Serial Data Output. Used for asynchronous serial mode. */
+#define CC1101_GDO_ASDO 0x0D
+
+/* Carrier sense. High if RSSI level is above threshold. */
+#define CC1101_GDO_CARRIER 0x0E
+
+/* CRC_OK. The last CRC comparison matched. Cleared when entering or
+ * restarting RX mode. */
+#define CC1101_GDO_CRCOK2 0x0F
+
+/* RX_HARD_DATA[1]. Can be used together with RX_SYMBOL_TICK for
+ * alternative serial RX output. */
+#define CC1101_GDO_RXOUT1 0x16
+
+/* RX_HARD_DATA[0]. Can be used together with RX_SYMBOL_TICK for
+ * alternative serial RX output. */
+#define CC1101_GDO_RXOUT0 0x17
+
+/* PA_PD. Note: PA_PD will have the same signal level in SLEEP and TX
+ * states. To control an external PA or RX/TX switch in applications
+ * where the SLEEP state is used it is recommended to use GDOx_CFGx=0x2F
+ * instead. */
+#define CC1101_GDO_PA_PD 0x1B
+
+/* LNA_PD. Note: LNA_PD will have the same signal level in SLEEP and RX
+ * states. To control an external LNA or RX/TX switch in applications
+ * where the SLEEP state is used it is recommended to use GDOx_CFGx=0x2F
+ * instead. */
+#define CC1101_GDO_LNA_PD 0x1C
+
+/* RX_SYMBOL_TICK. Can be used together with RX_HARD_DATA for alternative
+ * serial RX output. */
+#define CC1101_GDO_RXSYMTICK 0x1D
+
+#define CC1101_GDO_WOR_EVNT0 0x24
+#define CC1101_GDO_WOR_EVNT1 0x25
+#define CC1101_GDO_CLK32K 0x27
+#define CC1101_GDO_CHIP_RDYn 0x29
+#define CC1101_GDO_XOSC_STABLE 0x2B
+
+/* GDO0_Z_EN_N. When this output is 0, GDO0 is configured as input
+ * (for serial TX data). */
+#define CC1101_GDO_GDO0_Z_EN_N 0x2D
+
+/* High impedance (3-state). */
+#define CC1101_GDO_HIZ 0x2E
+
+/* HW to 0 (HW1 achieved by setting GDOx_INV=1). Can be used to control
+ * an external LNA/PA or RX/TX switch. */
+#define CC1101_GDO_HW 0x2F
+
+/* There are 3 GDO pins, but only one CLK_XOSC/n can be selected as an
+ * output at any time. If CLK_XOSC/n is to be monitored on one of the
+ * GDO pins, the other two GDO pins must be configured to values less
+ * than 0x30. The GDO0 default value is CLK_XOSC/192. To optimize RF
+ * performance, these signals should not be used while the radio is
+ * in RX or TX mode. */
+#define CC1101_GDO_CLK_XOSC1 0x30
+#define CC1101_GDO_CLK_XOSC1_5 0x31
+#define CC1101_GDO_CLK_XOSC2 0x32
+#define CC1101_GDO_CLK_XOSC3 0x33
+#define CC1101_GDO_CLK_XOSC4 0x34
+#define CC1101_GDO_CLK_XOSC6 0x35
+#define CC1101_GDO_CLK_XOSC8 0x36
+#define CC1101_GDO_CLK_XOSC12 0x37
+#define CC1101_GDO_CLK_XOSC16 0x38
+#define CC1101_GDO_CLK_XOSC24 0x39
+#define CC1101_GDO_CLK_XOSC32 0x3A
+#define CC1101_GDO_CLK_XOSC48 0x3B
+#define CC1101_GDO_CLK_XOSC64 0x3C
+#define CC1101_GDO_CLK_XOSC96 0x3D
+#define CC1101_GDO_CLK_XOSC128 0x3E
+#define CC1101_GDO_CLK_XOSC192 0x3F
+
+/*
+ * Others ...
+ */
+
+#define CC1101_LQI_CRC_OK_BM 0x80
+#define CC1101_LQI_EST_BM 0x7F
+
+
+/************************************************************************************
+ * Private Data Types
+ ************************************************************************************/
+
+struct chipcon_c1101_rfsettings_s {
+ uint8_t FSCTRL1; /* Frequency synthesizer control. */
+ uint8_t IOCFG0; /* GDO0 output pin configuration */
+ uint8_t FSCTRL0; /* Frequency synthesizer control. */
+ uint8_t FREQ2; /* Frequency control word, high byte. */
+ uint8_t FREQ1; /* Frequency control word, middle byte. */
+ uint8_t FREQ0; /* Frequency control word, low byte. */
+ uint8_t MDMCFG4; /* Modem configuration. */
+ uint8_t MDMCFG3; /* Modem configuration. */
+ uint8_t MDMCFG2; /* Modem configuration. */
+ uint8_t MDMCFG1; /* Modem configuration. */
+ uint8_t MDMCFG0; /* Modem configuration. */
+ uint8_t CHANNR; /* Channel number. */
+ uint8_t DEVIATN; /* Modem deviation setting (when FSK modulation is enabled). */
+ uint8_t FREND1; /* Front end RX configuration. */
+ uint8_t FREND0; /* Front end RX configuration. */
+ uint8_t MCSM0; /* Main Radio Control State Machine configuration. */
+ uint8_t FOCCFG; /* Frequency Offset Compensation Configuration. */
+ uint8_t BSCFG; /* Bit synchronization Configuration. */
+ uint8_t AGCCTRL2; /* AGC control. */
+ uint8_t AGCCTRL1; /* AGC control. */
+ uint8_t AGCCTRL0; /* AGC control. */
+ uint8_t FSCAL3; /* Frequency synthesizer calibration. */
+ uint8_t FSCAL2; /* Frequency synthesizer calibration. */
+ uint8_t FSCAL1; /* Frequency synthesizer calibration. */
+ uint8_t FSCAL0; /* Frequency synthesizer calibration. */
+ uint8_t FSTEST; /* Frequency synthesizer calibration control */
+ uint8_t TEST2; /* Various test settings. */
+ uint8_t TEST1; /* Various test settings. */
+ uint8_t TEST0; /* Various test settings. */
+ uint8_t FIFOTHR; /* RXFIFO and TXFIFO thresholds. */
+ uint8_t IOCFG2; /* GDO2 output pin configuration */
+ uint8_t PKTCTRL1; /* Packet automation control. */
+ uint8_t PKTCTRL0; /* Packet automation control. */
+ uint8_t ADDR; /* Device address. */
+ uint8_t PKTLEN; /* Packet length. */
+};
+
+struct chipcon_cc1101_dev_s {
+ struct spi_dev_s * spi;
+ struct chipcon_c1101_rfsettings_s * settings;
+
+};
+
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/** LIS331DL Access with range check
+ *
+ * \param dev LIS331 DL Private Structure
+ * \param subaddr LIS331 Sub Address
+ * \param buf Pointer to buffer, either for read or write access
+ * \param length when >0 it denotes read access, when <0 it denotes write access of -length
+ * \return OK on success or errno is set.
+ **/
+int chipcon_cc1101_access(struct chipcon_cc1101_dev_s * dev, uint8_t subaddr, uint8_t *buf, int length)
+{
+ return 0;
+}
+
+
+/****************************************************************************
+ * Callbacks
+ ****************************************************************************/
+
+/** External line triggers this callback
+ *
+ * The concept todo is:
+ * - GPIO provides EXTI Interrupt
+ * - It should handle EXTI Interrupts in ISR, to which chipcon can
+ * register a callback (and others). The ISR then foreach() calls a
+ * its callback, and it is up to peripheral to find, whether the cause
+ * of EXTI ISR was itself.
+ **/
+void chipcon_cc1101_eventcb(void)
+{
+}
+
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+struct chipcon_cc1101_dev_s * chipcon_cc1101_init(struct spi_dev_s * spi)
+{
+ /* Powerup or wake-up, if it was previously set into some power-down state */
+
+ /* Inquiry part number and version */
+
+ /* Reset chip, check status bytes */
+
+ /* Load it with default configuration */
+
+ /* Bind to external interrupt line */
+
+ return NULL;
+}
+
+
+int chipcon_cc1101_deinit(struct chipcon_cc1101_dev_s * dev)
+{
+ /* Power down chip, possibly in some inactive state */
+
+ return 0;
+}
+
+
+int chipcon_cc1101_setgdo(struct chipcon_cc1101_dev_s * dev, uint8_t pin, uint8_t function)
+{
+ return 0;
+}
+
+
+int chipcon_cc1101_setrf(struct chipcon_cc1101_dev_s * dev, uint32_t frequency, int modulation)
+{
+ return 0;
+}
+
+
+int chipcon_cc1101_read(struct chipcon_cc1101_dev_s * dev, uint8_t * data, size_t size)
+{
+ return 0;
+}
+
+
+int chipcon_cc1101_write(struct chipcon_cc1101_dev_s * dev, const uint8_t * data, size_t size)
+{
+ return 0;
+}
+
+
+int chipcon_cc1101_listen(struct chipcon_cc1101_dev_s * dev)
+{
+ return 0;
+}
+
+
+int chipcon_cc1101_send(struct chipcon_cc1101_dev_s * dev)
+{
+ return 0;
+}
+
+
+int chipcon_cc1101_idle(struct chipcon_cc1101_dev_s * dev)
+{
+ return 0;
+}
+
+
+int chipcon_cc1101_powerup(struct chipcon_cc1101_dev_s * dev)
+{
+ return 0;
+}
+
+
+int chipcon_cc1101_powerdown(struct chipcon_cc1101_dev_s * dev)
+{
+ return 0;
+}
diff --git a/nuttx/include/nuttx/event.h b/nuttx/include/nuttx/event.h
new file mode 100755
index 000000000..dfa3a585c
--- /dev/null
+++ b/nuttx/include/nuttx/event.h
@@ -0,0 +1,235 @@
+/****************************************************************************
+ * include/nuttx/event.h
+ *
+ * Copyright(C) 2011 Uros Platise. All rights reserved.
+ * Author: Uros Platise <uros.platise@isotel.eu>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/** \file
+ * \author Uros Platise
+ * \brief Events
+ *
+ * Event moudle offer real-time signaling and handling of real-time
+ * events at precision of system resolution clock_t.
+ *
+ * Events are based on periodic timers, where each started event starts
+ * counting at its relative time = 0, and overflows at given period.
+ * Overflow is signalized by posted event that is handled by the
+ * event_eventhandler() called by each thread or task working with
+ * Events.
+ *
+ * Events may be used inside one thread or task only or between tasks
+ * and threads. An event can also be bind to another event i.e.:
+ * - System Clock may issue a notification about Power Failure
+ * - Other threads may connect to this event and when handled, they may
+ * inquiry for pricise time when this event has happend, using the
+ * event_gettime()
+ *
+ * Or system is about to control a process, and instead of looping and
+ * inquiring for time, system timers offer simple and effective
+ * mechanism to control timed actions:
+ * - First event is about to wait 5 seconds, then it must assert some
+ * switch, triggering another event after 2 seconds, to check the
+ * state of the system.
+ * - After 2 seconds new event is triggerred, if it is time criticial
+ * it may check for the overrun time and handle further actions,
+ * - ...
+ *
+ * Each event is denoted by a callback function event_callback_t, and
+ * an argument. Posted event with the same callback but different
+ * argument is treated as different event, while the same callback with
+ * the same argument replaces previously started event.
+ **/
+
+#ifdef CONFIG_EVENT
+
+#ifndef __INCLUDE_NUTTX_EVENT_H
+#define __INCLUDE_NUTTX_EVENT_H
+
+#include <nuttx/config.h>
+
+#include <time.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <nuttx/clock.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#undef EXTERN
+#if defined(__cplusplus)
+#define EXTERN extern "C"
+extern "C" {
+#else
+#define EXTERN extern
+#endif
+
+/****************************************************************************
+ * Public Types
+ ****************************************************************************/
+
+/** Event Callback
+ *
+ * \param arg an argument as posted by the event_post(),
+ * event_signal() or event_start() methods.
+ *
+ * \return Optional time to increment to retrigger. This time is added
+ * to present actual time, so an event returning with constant value
+ * as return PERIOD would be periodic with long-term absolute precision.
+ *
+ * \retval >0 Time to increment to second post of the event.
+ * \retval 0 Acknowledge event.
+ */
+typedef clock_t (*event_callback_t)(FAR void *arg);
+
+typedef struct event_s event_t;
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/** Create new instance of Events (typically per thread)
+ *
+ * \param base Future extension to support multiple base timers. Pass NULL at
+ * the moment.
+ *
+ * \return Valid structure or NULL on error with errno set.
+ */
+event_t * event_create( void * base );
+
+/** Delete unused instance of Events. A call to this function also destroys
+ * all bindings.
+ *
+ * \param events Pointer to a structure as returned by event_create()
+ * \return 0 On success or -1 on error.
+ */
+int event_delete( event_t *events );
+
+/** Post an event, equal to period = 0
+ *
+ * \param events Pointer to a structure as returned by event_create()
+ * \param event Callback to be called
+ * \param arg Optional argument to be passed to the event.
+ * \return 0 On success or -1 on error.
+ */
+int event_post( event_t *events, event_callback_t event, void *arg );
+
+/** Trigger an event without calling it but may trigger connected events
+ *
+ * \param events Pointer to a structure as returned by event_create()
+ * \param event Callback to be called
+ * \param arg Optional argument to be passed to the event.
+ * \return 0 On success or -1 on error.
+ */
+int event_signal( event_t *events, event_callback_t event, void *arg );
+
+/** Start timer with given period
+ *
+ * \param events Pointer to a structure as returned by event_create()
+ * \param event Callback to be called
+ * \param arg Optional argument to be passed to the event.
+ * \param period Time to first occurence.
+ * \return 0 On success or -1 on error.
+ */
+int event_start( event_t *events, event_callback_t event, void *arg, clock_t period );
+
+/** Stop timer, matches only those with equal event and arg.
+ *
+ * \param events Pointer to a structure as returned by event_create()
+ * \param event Callback to be called
+ * \param arg Optional argument to be passed to the event.
+ * \return 0 On success or -1 on error.
+ */
+int event_stop( event_t *events, event_callback_t event, void *arg );
+
+/** Stop all timers related to the same event callback
+ *
+ * \param events Pointer to a structure as returned by event_create()
+ * \param event Callback to be called
+ * \return 0 On success or -1 on error.
+ */
+int event_stopall( event_t *events, event_callback_t event );
+
+/** Get present time of given timer
+ *
+ * \param events Pointer to a structure as returned by event_create()
+ * \param event Callback to be called
+ * \param arg Optional argument to be passed to the event.
+ * \return 0 On success or -1 on error.
+ */
+clock_t event_gettime( event_t *events, event_callback_t event, void *arg );
+
+/** Bind two events
+ *
+ * \param source_events Pointer to source event structure.
+ * \param source_event Source event
+ * \param dest_events Pointer to destination event structure
+ * \param dest_event Destination event to be called, when source fires
+ * \return 0 On success or -1 on error.
+ */
+int event_connect(event_t *source_events, event_callback_t source_event,
+ event_t *dest_events, event_callback_t dest_event);
+
+/** Unbind two events
+ *
+ * \param source_events Pointer to source event structure.
+ * \param source_event Source event
+ * \param dest_events Pointer to destination event structure
+ * \param dest_event Destination event to be called, when source fires
+ * \return 0 On success or -1 on error.
+ */
+int event_disconnect(event_t *source_events, event_callback_t source_event,
+ event_t *dest_events, event_callback_t dest_event);
+
+/** Unbind all events related to given destination
+ *
+ * \param dest_events Pointer to destination event structure
+ * \param dest_event Destination event to be called, when source fires
+ * \return 0 On success or -1 on error.
+ */
+int event_disconnectall(event_t *dest_events, event_callback_t dest_event);
+
+/** Handle callbacks
+ *
+ * \param events Pointer to a structure as returned by event_create()
+ * \param timeout Time to wait for a callback to be served.
+ * \return Remaining time.
+ * */
+clock_t event_handle( event_t *events, clock_t timeout );
+
+#undef EXTERN
+#if defined(__cplusplus)
+}
+#endif
+#endif /* __INCLUDE_NUTTX_EVENT_H */
+#endif /* CONFIG_EVENT */
diff --git a/nuttx/include/nuttx/sensors/st_lis331dl.h b/nuttx/include/nuttx/sensors/st_lis331dl.h
index 679ba81ec..404d4a480 100644
--- a/nuttx/include/nuttx/sensors/st_lis331dl.h
+++ b/nuttx/include/nuttx/sensors/st_lis331dl.h
@@ -59,41 +59,6 @@ extern "C" {
#define EXTERN extern
#endif
-/************************************************************************************
- * LIS331DL Internal Registers
- ************************************************************************************/
-
-#define ST_LIS331DL_WHOAMI 0x0F /* who am I register */
-#define ST_LIS331DL_WHOAMI_VALUE 0x3B /* Valid result is 0x3B */
-
-#define ST_LIS331DL_CTRL_REG1 0x20
-#define ST_LIS331DL_CR1_DR 0x80 /* Data-rate selection 0: 100 Hz, 1: 400 Hz */
-#define ST_LIS331DL_CR1_PD 0x40 /* Active Mode (1) / Power-down (0) */
-#define ST_LIS331DL_CR1_FS 0x20 /* Full Scale (1) +-9g or Normal Scale (0) +-2g */
-#define ST_LIS331DL_CR1_ST 0x18 /* Self test enable */
-#define ST_LIS331DL_CR1_ZEN 0x04 /* Z-Axis Enable */
-#define ST_LIS331DL_CR1_YEN 0x02 /* Y-Axis Enable */
-#define ST_LIS331DL_CR1_XEN 0x01 /* X-Axis Enable */
-
-#define ST_LIS331DL_CTRL_REG2 0x21
-#define ST_LIS331DL_CTRL_REG3 0x22
-
-#define ST_LIS331DL_HP_FILTER_RESET 0x23
-
-#define ST_LIS331DL_STATUS_REG 0x27 /* Status Register */
-#define ST_LIS331DL_SR_ZYXOR 0x80 /* OR'ed X,Y and Z data over-run */
-#define ST_LIS331DL_SR_ZOR 0x40 /* individual data over-run ... */
-#define ST_LIS331DL_SR_YOR 0x20
-#define ST_LIS331DL_SR_XOR 0x10
-#define ST_LIS331DL_SR_ZYXDA 0x08 /* OR'ed X,Y and Z data available */
-#define ST_LIS331DL_SR_ZDA 0x04 /* individual data available ... */
-#define ST_LIS331DL_SR_YDA 0x02
-#define ST_LIS331DL_SR_XDA 0x01
-
-#define ST_LIS331DL_OUT_X 0x29
-#define ST_LIS331DL_OUT_Y 0x2B
-#define ST_LIS331DL_OUT_Z 0x2D
-
/************************************************************************************
* Public Data Types
diff --git a/nuttx/include/nuttx/ptimer.h b/nuttx/include/nuttx/wireless/chipcon_cc1101.h
index a8bac82fe..0daadada1 100755
--- a/nuttx/include/nuttx/ptimer.h
+++ b/nuttx/include/nuttx/wireless/chipcon_cc1101.h
@@ -1,8 +1,9 @@
/****************************************************************************
- * include/nuttx/ptimer.h
+ * include/nuttx/wireless/chipcon_cc1101.h
*
- * Copyright(C) 2011 Uros Platise. All rights reserved.
- * Author: Uros Platise <uros.platise@isotel.eu>
+ * Copyright (C) 2011 Uros Platise. All rights reserved.
+ *
+ * Authors: Uros Platise <uros.platise@isotel.eu>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,40 +24,35 @@
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
-#ifndef __INCLUDE_NUTTX_PTIMER_H
-#define __INCLUDE_NUTTX_PTIMER_H
+/** \file
+ * \author Uros Platise
+ * \brief Chipcon CC1101 Device Driver
+ **/
-/****************************************************************************
- * Included Files
- ****************************************************************************/
+#ifndef __INCLUDE_NUTTX_WIRELESS_CHIPCON_CC1101_H
+#define __INCLUDE_NUTTX_WIRELESS_CHIPCON_CC1101_H
#include <nuttx/config.h>
+#include <nuttx/spi.h>
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
+#include <stdint.h>
+#include <stdbool.h>
-/****************************************************************************
- * Public Types
- ****************************************************************************/
+/************************************************************************************
+ * Pre-Processor Declarations
+ ************************************************************************************/
-/****************************************************************************
- * Public Variables
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
+#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
@@ -67,9 +63,51 @@ extern "C" {
#endif
+/************************************************************************************
+ * Public Data Types
+ ************************************************************************************/
+
+struct chipcon_cc1101_dev_s;
+
+
+/************************************************************************************
+ * Public Function Prototypes
+ ************************************************************************************/
+
+/** Initialize Chipcon CC1101 Chip
+ *
+ * \param spi SPI Device Structure
+ * \return Pointer to newly allocated CC1101 structure or NULL on error with errno set.
+ *
+ * Possible errno as set by this function on error:
+ * - ENODEV: When device addressed is not compatible or it is not a CC1101
+ * - EFAULT: When there is no device
+ * - EBUSY: When device is already addressed by other device driver (not yet supported by low-level driver)
+ **/
+EXTERN struct chipcon_cc1101_dev_s * chipcon_cc1101_init(struct spi_dev_s * spi);
+
+/** Deinitialize Chipcon CC1101 Chip
+ *
+ * \param dev Device to CC1101 device structure, as returned by the chipcon_cc1101_init()
+ * \return OK On success
+ *
+ **/
+EXTERN int chipcon_cc1101_deinit(struct chipcon_cc1101_dev_s * dev);
+
+/** Power up device, start conversion */
+EXTERN int chipcon_cc1101_powerup(struct chipcon_cc1101_dev_s * dev);
+
+/** Power down device, stop conversion */
+EXTERN int chipcon_cc1101_powerdown(struct chipcon_cc1101_dev_s * dev);
+
+/** Set Multi Purpose Output Function */
+EXTERN int chipcon_cc1101_setgdo(struct chipcon_cc1101_dev_s * dev, uint8_t pin, uint8_t function);
+
+
#undef EXTERN
#if defined(__cplusplus)
}
#endif
+#endif /* __ASSEMBLY__ */
+#endif /* __INCLUDE_NUTTX_WIRELESS_CHIPCON_CC1101_H */
-#endif /* __INCLUDE_NUTTX_PTIMER_H */
diff --git a/nuttx/tools/Makefile.host b/nuttx/tools/Makefile.host
index cf44f3e58..163472462 100644
--- a/nuttx/tools/Makefile.host
+++ b/nuttx/tools/Makefile.host
@@ -57,4 +57,5 @@ mksyscall: mksyscall.c
@gcc $(CFLAGS) -o mksyscall mksyscall.c
clean:
- @rm -f mkconfig mksyscall mkconfig.exe mksyscall.exe *~
+ @rm -f *.o *.a *~ .*.swp
+ @rm -f mkconfig mksyscall mkversion mkconfig.exe mksyscall.exe mkversion.exe \ No newline at end of file