Merge pull request #3334 from kaspar030/remove_old_net

remove old network stack
dev/timer
Oleg Hahm 8 years ago
commit f90032f94f

@ -1,53 +1,3 @@
ifneq (,$(filter libcoap,$(USEPKG)))
USEMODULE += pnet
endif
ifneq (,$(filter pnet,$(USEMODULE)))
USEMODULE += posix
USEMODULE += socket_base
USEMODULE += net_help
endif
ifneq (,$(filter transport_layer,$(USEMODULE)))
USEMODULE += tcp
USEMODULE += udp
endif
ifneq (,$(filter udp,$(USEMODULE)))
USEMODULE += socket_base
endif
ifneq (,$(filter tcp,$(USEMODULE)))
USEMODULE += socket_base
endif
ifneq (,$(filter socket_base,$(USEMODULE)))
USEMODULE += sixlowpan
USEMODULE += net_help
USEMODULE += vtimer
endif
ifneq (,$(filter sixlowborder,$(USEMODULE)))
USEMODULE += sixlowpan
endif
ifneq (,$(filter rpl,$(USEMODULE)))
USEMODULE += trickle
USEMODULE += routing
endif
ifneq (,$(filter routing,$(USEMODULE)))
USEMODULE += sixlowpan
endif
ifneq (,$(filter sixlowpan,$(USEMODULE)))
USEMODULE += ieee802154
USEMODULE += net_help
USEMODULE += net_if
USEMODULE += posix
USEMODULE += vtimer
endif
ifneq (,$(filter ng_netif_default,$(USEMODULE)))
USEMODULE += ng_netif
endif
@ -232,14 +182,6 @@ ifneq (,$(filter ng_slip,$(USEMODULE)))
USEMODULE += ng_netbase
endif
ifneq (,$(filter aodvv2,$(USEMODULE)))
USEMODULE += vtimer
USEMODULE += sixlowpan
USEMODULE += oonf_common
USEMODULE += oonf_rfc5444
USEMODULE += fib
endif
ifneq (,$(filter uart0,$(USEMODULE)))
USEMODULE += posix
endif
@ -253,51 +195,10 @@ ifneq (,$(filter cbor,$(USEMODULE)))
USEMODULE += net_help
endif
ifneq (,$(filter cc110x%,$(USEMODULE)))
USEMODULE += protocol_multiplex
USEMODULE += vtimer
endif
ifneq (,$(filter cc110x,$(USEMODULE)))
USEMODULE += transceiver
endif
ifneq (,$(filter cc110x_legacy,$(USEMODULE)))
USEMODULE += transceiver
endif
ifneq (,$(filter cc2420,$(USEMODULE)))
USEMODULE += transceiver
USEMODULE += ieee802154
endif
ifneq (,$(filter at86rf231,$(USEMODULE)))
USEMODULE += netdev_802154
USEMODULE += ieee802154
endif
ifneq (,$(filter l2_ping,$(USEMODULE)))
USEMODULE += vtimer
endif
ifneq (,$(filter vtimer,$(USEMODULE)))
USEMODULE += timex
endif
ifneq (,$(filter net_if,$(USEMODULE)))
USEMODULE += transceiver
USEMODULE += net_help
USEMODULE += hashes
endif
ifneq (,$(filter ccn_lite,$(USEMODULE)))
USEMODULE += crypto
endif
ifneq (,$(filter netdev_802154,$(USEMODULE)))
USEMODULE += netdev_base
endif
ifneq (,$(filter rgbled,$(USEMODULE)))
USEMODULE += color
endif
@ -306,10 +207,6 @@ ifneq (,$(filter libfixmath-unittests,$(USEMODULE)))
USEPKG += libfixmath
endif
ifneq (,$(filter defaulttransceiver,$(USEMODULE)))
FEATURES_REQUIRED += transceiver
endif
ifneq (,$(filter nhdp,$(USEMODULE)))
USEMODULE += vtimer
USEMODULE += oonf_common
@ -343,6 +240,10 @@ ifneq (,$(filter newlib,$(USEMODULE)))
USEMODULE += uart_stdio
endif
ifneq (,$(filter ng_netdev_eth,$(USEMODULE)))
USEMODULE += ng_pktbuf
endif
ifneq (,$(filter hih6130,$(USEMODULE)))
USEMODULE += vtimer
endif

@ -1,5 +1,3 @@
PSEUDOMODULES += defaulttransceiver
PSEUDOMODULES += transport_layer
PSEUDOMODULES += ng_netif_default
PSEUDOMODULES += ng_ieee802154
PSEUDOMODULES += ng_ipv6_default

@ -40,9 +40,9 @@ Its features comprise
* the native port allows to run RIOT as-is on Linux, BSD, and MacOS. Multiple instances of RIOT running on a single machine can also be interconnected via a simple virtual Ethernet bridge
* Wiselib support (C++ algorithm library, including routing, clustering, timesync, localization, security and more algorithms)
* IPv6
* TCP and UDP
* UDP
* 6LoWPAN
* AODVv2, NHDP, RPL
* NHDP
## GETTING STARTED
* You want to start the RIOT? Just follow our [Getting started documentation](https://github.com/RIOT-OS/RIOT/wiki/Introduction)
@ -58,11 +58,6 @@ There is a shellscript in `RIOT/cpu/native` called `tapsetup.sh` which you can u
To create a bridge and two (or count at your option) tap interfaces:
./tapsetup.sh create [count]
### EXAMPLE APPLICATIONS
In the `examples` directory you can find some example applications. The `default` application demonstrates all available features for the current platform.
For example, you can use it to the test the native networking by running two instances: `make term PORT=tap0` and `make term PORT=tap1`. Now configure two different addresses for both RIOT instances by typing `addr 1` and `addr 2` respectively and send a text message from one "node" to another by typing `txtsnd 2 hello` on the first "node".
## CONTRIBUTE
To contribute something to RIOT, please refer to the [development procedures](https://github.com/RIOT-OS/RIOT/wiki/Development-procedures) and read all notes for best practice.

@ -1,3 +1,2 @@
FEATURES_PROVIDED += transceiver
FEATURES_PROVIDED += periph_rtc
FEATURES_MCU_GROUP = arm7

@ -1,12 +1,2 @@
export INCLUDES += -I$(RIOTBOARD)/avsextrem/include
ifneq (,$(filter defaulttransceiver,$(USEMODULE)))
USEMODULE += cc110x_legacy
USEMODULE += transceiver
endif
ifneq (,$(filter cc110x_legacy_csma,$(USEMODULE)))
INCLUDES += -I$(RIOTBASE)/sys/net/include
endif
export INCLUDES += -I$(RIOTCPU)/$(CPU)/include/ -I$(RIOTBOARD)/$(BOARD)/include/
include $(RIOTBOARD)/msba2-common/Makefile.include

@ -1,254 +0,0 @@
/*
* avsextrem-cc1100.c - CC100 Transceiver Driver for the AVSEXTREM-BOARD.
* Copyright (C) 2013 Heiko Will <hwill@inf.fu-berlin.de>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @file
* @ingroup LPC2387
* @brief CC1100 LPC2387 dependend functions
*
* @author Heiko Will <hwill@inf.fu-berlin.de>
* @author Thomas Hillebrandt <hillebra@inf.fu-berlin.de>
* @author Zakaria Kasmi <zkasmi@inf.fu-berlin.de>
*
* @version $Revision: 1781 $
*
* @note $Id: avsextrem-cc1100.c 1781 2013-08-14 13:39:36Z kasmi $
*/
#include <stdio.h>
#include <stddef.h>
// cpu
#include "cpu.h"
// sys
#include "cc110x_legacy.h"
#include "gpioint.h"
#define CC1100_GDO0 (FIO2PIN & BIT6) // read serial I/O (GDO0)
#define CC1100_GDO1 (FIO0PIN & BIT8) // read serial I/O (GDO1)
#define CC1100_GDO2 (FIO0PIN & BIT28) // read serial I/O (GDO2)
#define SPI_TX_EMPTY (SSP1SR & SSPSR_TFE)
#define SPI_BUSY (SSP1SR & SSPSR_BSY)
#define SPI_RX_AVAIL (SSP1SR & SSPSR_RNE)
#define CC1100_GDO1_LOW_RETRY (100) // max. retries for GDO1 to go low
#define CC1100_GDO1_LOW_COUNT (2700) // loop count (timeout ~ 500 us) to wait
// for GDO1 to go low when CS low
//#define DEBUG
#ifdef DEBUG
static unsigned long time_value;
static void set_time(void)
{
time_value = 0;
}
static int test_time(int code)
{
time_value++;
if (time_value > 10000000) {
printf("CC1100 SPI alarm: %d!\n", code);
time_value = 0;
return 1;
}
return 0;
}
#endif
int cc110x_get_gdo0(void)
{
return CC1100_GDO0;
}
int cc110x_get_gdo1(void)
{
return CC1100_GDO1;
}
int cc110x_get_gdo2(void)
{
return CC1100_GDO2;
}
void cc110x_spi_init(void)
{
// configure chip-select
FIO0DIR |= BIT6;
FIO0SET = BIT6;
// Power
PCONP |= PCSSP1; // Enable power for SSP1 (default is on)
// PIN Setup
PINSEL0 |= BIT15; // Set CLK function to SSP1
PINSEL0 &= ~BIT14;
PINSEL0 |= BIT17 ; // Set MISO function to SSP1
PINSEL0 &= ~BIT16;
PINSEL0 |= BIT19; // Set MOSI function to SSP1
PINSEL0 &= ~BIT18;
// Interface Setup
SSP1CR0 = 7;
// Clock Setup
uint32_t pclksel;
uint32_t cpsr;
lpc2387_pclk_scale(F_CPU / 1000, 6000, &pclksel, &cpsr);
PCLKSEL0 &= ~(BIT21 | BIT20); // CCLK to PCLK divider
PCLKSEL0 |= pclksel << 20;
SSP1CPSR = cpsr;
// Enable
SSP1CR1 |= BIT1; // SSP-Enable
int dummy;
// Clear RxFIFO:
while (SPI_RX_AVAIL) { // while RNE (Receive FIFO Not Empty)...
dummy = SSP1DR; // read data
}
/* to suppress unused-but-set-variable */
(void) dummy;
}
uint8_t
cc110x_txrx(uint8_t c)
{
uint8_t result;
SSP1DR = c;
#ifdef DEBUG
set_time();
#endif
while (!SPI_TX_EMPTY) {
#ifdef DEBUG
test_time(0);
#endif
}
#ifdef DEBUG
set_time();
#endif
while (SPI_BUSY) {
#ifdef DEBUG
test_time(1);
#endif
}
#ifdef DEBUG
set_time();
#endif
while (!SPI_RX_AVAIL) {
#ifdef DEBUG
test_time(2);
#endif
}
result = (uint8_t)SSP1DR;
return result;
}
void cc110x_spi_cs(void)
{
FIO0CLR = BIT6;
}
void
cc110x_spi_select(void)
{
volatile int retry_count = 0;
volatile int abort_count;
// Switch to GDO mode input
PINSEL0 &= ~(BIT17 + BIT16); // Set MISO function to GPIO
FIO0DIR &= ~BIT8;
cs_low:
// CS to low
abort_count = 0;
FIO0CLR = BIT6;
// Wait for SO to go low (voltage regulator
// has stabilized and the crystal is running)
loop:
asm volatile("nop");
if (CC1100_GDO1) {
abort_count++;
if (abort_count > CC1100_GDO1_LOW_COUNT) {
retry_count++;
if (retry_count > CC1100_GDO1_LOW_RETRY) {
puts("[CC1100 SPI] fatal error\n");
goto final;
}
FIO0SET = BIT6; // CS to high
goto cs_low; // try again
}
goto loop;
}
final:
// Switch to SPI mode
PINSEL0 |= BIT17; // Set MISO function to SSP1
PINSEL0 &= ~BIT16;
}
void
cc110x_spi_unselect(void)
{
FIO0SET = BIT6;
}
void cc110x_gdo2_disable(void)
{
gpioint_set(0, BIT28, GPIOINT_DISABLE, NULL);
}
void cc110x_gdo2_enable(void)
{
gpioint_set(0, BIT28, GPIOINT_FALLING_EDGE, &cc110x_gdo2_irq);
}
void cc110x_before_send(void)
{
// Disable GDO2 interrupt before sending packet
cc110x_gdo2_disable();
}
void cc110x_after_send(void)
{
// Enable GDO2 interrupt after sending packet
cc110x_gdo2_enable();
}
void cc110x_gdo0_enable(void)
{
gpioint_set(2, BIT6, GPIOINT_RISING_EDGE, &cc110x_gdo0_irq);
}
void cc110x_gdo0_disable(void)
{
gpioint_set(2, BIT6, GPIOINT_DISABLE, NULL);
}
void cc110x_init_interrupts(void)
{
// Enable external interrupt on low edge (for GDO2)
FIO0DIR &= ~BIT28;
cc110x_gdo2_enable();
// Enable external interrupt on low edge (for GDO0)
FIO2DIR &= ~BIT6;
}

@ -51,8 +51,6 @@ extern "C" {
void init_clks1(void);
typedef uint8_t radio_packet_length_t;
#ifdef __cplusplus
}
#endif

@ -1,4 +0,0 @@
ifneq (,$(filter defaulttransceiver,$(USEMODULE)))
USEMODULE += cc110x_legacy
USEMODULE += transceiver
endif

@ -1,3 +1,2 @@
FEATURES_PROVIDED += transceiver
FEATURES_PROVIDED += periph_rtc
FEATURES_MCU_GROUP = msp430

@ -1,112 +0,0 @@
/*
* Copyright (C) 2014 INRIA
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup chronos
* @{
*/
/**
* @file
* @brief eZ430-chronos radio driver (board dependent part)
*
* @author Oliver Hahm <oliver.hahm@inria.fr>
*
*/
#include <stdint.h>
#include <stdint.h>
#include <cc430f6137.h>
#include "cpu.h"
#include "irq.h"
#include "cc110x_legacy.h"
#define CC1100_GDO0 (RF1AIN & BIT0)
#define CC1100_GDO1 (RF1AIN & BIT1)
#define CC1100_GDO2 (RF1AIN & BIT2)
int cc110x_get_gdo0(void)
{
return CC1100_GDO0;
}
int cc110x_get_gdo1(void)
{
return CC1100_GDO1;
}
int cc110x_get_gdo2(void)
{
return CC1100_GDO2;
}
void cc110x_before_send(void)
{
// Disable GDO2 interrupt before sending packet
cc110x_gdo2_disable();
}
void cc110x_after_send(void)
{
// Enable GDO2 interrupt after sending packet
cc110x_gdo2_enable();
}
void cc110x_gdo0_enable(void)
{
RF1AIFG &= ~BIT0;
RF1AIE |= BIT0;
}
void cc110x_gdo0_disable(void)
{
RF1AIE &= ~BIT0;
RF1AIFG &= ~BIT0;
}
void cc110x_gdo2_disable(void)
{
RF1AIFG &= ~BIT2; // Clear a pending interrupt
RF1AIE &= ~BIT2; // Disable the interrupt
}
void cc110x_gdo2_enable(void)
{
RF1AIFG &= ~BIT2; // Clear a pending interrupt
RF1AIE |= BIT2; // Enable the interrupt
}
void cc110x_init_interrupts(void)
{
uint8_t state = disableIRQ(); /* Disable all interrupts */
cc110x_gdo2_enable();
cc110x_gdo0_disable();
restoreIRQ(state); /* Enable all interrupts */
}
interrupt(CC1101_VECTOR) __attribute__((naked)) cc110x_isr(void)
{
__enter_isr();
/* Check IFG */
if (RF1AIV == RF1AIV_RFIFG2) {
while (RF1AIN & BIT2);
/* discard all further interrupts */
RF1AIV = 0;
cc110x_gdo2_irq();
}
if (RF1AIV == RF1AIV_RFIFG0) {
cc110x_gdo0_irq();
RF1AIE &= ~BIT0;
}
__exit_isr();
}

@ -38,8 +38,6 @@ extern "C" {
#define MSP430_HAS_DCOR 1
#define MSP430_HAS_EXTERNAL_CRYSTAL 1
typedef uint8_t radio_packet_length_t;
#ifdef __cplusplus
}
#endif

@ -1,6 +0,0 @@
ifneq (,$(filter defaulttransceiver,$(USEMODULE)))
USEMODULE += at86rf231
ifeq (,$(filter netdev_base,$(USEMODULE)))
USEMODULE += transceiver
endif
endif

@ -1,4 +1,3 @@
FEATURES_PROVIDED += transceiver
FEATURES_PROVIDED += periph_gpio
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_spi

@ -122,11 +122,6 @@ extern "C" {
#define LED_ORANGE_TOGGLE
/** @} */
/**
* Define the type for the radio packet length for the transceiver
*/
typedef uint8_t radio_packet_length_t;
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/

@ -85,11 +85,6 @@ extern "C"
#define LED_RED_TOGGLE LED_R_TOGGLE
/** @} */
/**
* Define the type for the radio packet length for the transceiver
*/
typedef uint8_t radio_packet_length_t;
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/

@ -1,10 +1,3 @@
ifneq (,$(filter defaulttransceiver,$(USEMODULE)))
USEMODULE += at86rf231
ifeq (,$(filter netdev_base,$(USEMODULE)))
USEMODULE += transceiver
endif
endif
ifneq (,$(filter ng_netif_default,$(USEMODULE)))
USEMODULE += ng_at86rf231
USEMODULE += ng_nomac

@ -1,4 +1,3 @@
FEATURES_PROVIDED += transceiver
FEATURES_PROVIDED += periph_gpio
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_spi

@ -151,11 +151,6 @@ extern "C" {
#define LED_ORANGE_TOGGLE (LED_ORANGE_PORT->ODR ^= (1<<LED_ORANGE_PIN))
/** @} */
/**
* Define the type for the radio packet length for the transceiver
*/
typedef uint8_t radio_packet_length_t;
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/

@ -88,11 +88,6 @@ extern "C" {
#define LED_RED_TOGGLE LED4_TOGGLE
/** @} */
/**
* @brief define radio packet length
*/
typedef uint8_t radio_packet_length_t;
/**
* @brief Initialize board specific hardware, include clocks, LEDs and stdio
*/

@ -61,7 +61,5 @@ extern "C" {
#include "board-conf.h"
typedef uint8_t radio_packet_length_t;
/** @} */
#endif /* MSB_BOARD_H_ */

@ -1,8 +0,0 @@
ifneq (,$(filter defaulttransceiver,$(USEMODULE)))
USEMODULE += cc110x_legacy
USEMODULE += transceiver
endif
ifneq (,$(filter cc110x_legacy,$(USEMODULE)))
USEMODULE += cc110x_spi
endif

@ -1,2 +1,2 @@
FEATURES_PROVIDED += transceiver config
FEATURES_PROVIDED += config
FEATURES_MCU_GROUP = msp430

@ -1,347 +0,0 @@
/*
* Copyright (C) 2005, 2006, 2007, 2008 by Thomas Hillebrandt and Heiko Will
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
#include <stdio.h>
#include "board.h"
#include "cpu.h"
#include "irq.h"
#include "cc110x_legacy.h"
#define CC1100_GDO0 (P2IN & 0x02) // read serial I/O (GDO0)
#define CC1100_GDO1 (P3IN & 0x04) // read serial I/O (GDO1)
#define CC1100_GDO2 (P2IN & 0x01) // read serial I/O (GDO2)
#define CC1100_CS_LOW (P3OUT &= ~0x01)
#define CC1100_CS_HIGH (P3OUT |= 0x01)
#define CC1100_GDO1_LOW_COUNT (2700) // loop count (timeout ~ 500 us) to wait
#define CC1100_GDO1_LOW_RETRY (100) // max. retries for GDO1 to go low
volatile int abort_count;
volatile int retry_count = 0;
void cc110x_gdo0_enable(void)
{
P2IFG &= ~0x02; /* Clear IFG for GDO0 */
P2IE |= 0x02; /* Enable interrupt for GDO0 */
}
void cc110x_gdo0_disable(void)
{
P2IE &= ~0x02; /* Disable interrupt for GDO0 */
P2IFG &= ~0x02; /* Clear IFG for GDO0 */
}
void cc110x_gdo2_enable(void)
{
P2IFG &= ~0x01; /* Clear IFG for GDO2 */
P2IE |= 0x01; /* Enable interrupt for GDO2 */
}
void cc110x_gdo2_disable(void)
{
P2IE &= ~0x01; /* Disable interrupt for GDO2 */
P2IFG &= ~0x01; /* Clear IFG for GDO2 */
}
void cc110x_before_send(void)
{
// Disable GDO2 interrupt before sending packet
cc110x_gdo2_disable();
}
void cc110x_after_send(void)
{
// Enable GDO2 interrupt after sending packet
cc110x_gdo2_enable();
}
int cc110x_get_gdo0(void)
{
return CC1100_GDO0;
}
int cc110x_get_gdo1(void)
{
return CC1100_GDO1;
}
int cc110x_get_gdo2(void)
{
return CC1100_GDO2;
}
void cc110x_spi_cs(void)
{
CC1100_CS_LOW;
}
uint8_t cc110x_txrx(uint8_t data)
{
/* Ensure TX Buf is empty */
long c = 0;
IFG1 &= ~UTXIFG0;
IFG1 &= ~URXIFG0;
TXBUF0 = data;
while (!(IFG1 & UTXIFG0)) {
if (c++ == 1000000) {
puts("cc110x_txrx alarm()");
}
}
/* Wait for Byte received */
c = 0;
while (!(IFG1 & URXIFG0)) {
if (c++ == 1000000) {
puts("cc110x_txrx alarm()");
}
}
return RXBUF0;
}
void cc110x_spi_select(void)
{
// Switch to GDO mode
P3SEL &= ~0x04;
P3DIR &= ~0x04;
cs_low:
// CS to low
abort_count = 0;
CC1100_CS_LOW;
// Wait for SO to go low (voltage regulator
// has stabilized and the crystal is running)
loop:
// asm volatile ("nop");
if (CC1100_GDO1) {
abort_count++;
if (abort_count > CC1100_GDO1_LOW_COUNT) {
retry_count++;
if (retry_count > CC1100_GDO1_LOW_RETRY) {
puts("[CC1100 SPI] fatal error\n");
goto final;
}
CC1100_CS_HIGH;
goto cs_low; // try again
}
goto loop;
}
final:
/* Switch to SPI mode */
P3SEL |= 0x04;
}
void cc110x_spi_unselect(void)
{
CC1100_CS_HIGH;
}
void cc110x_init_interrupts(void)
{
unsigned int state = disableIRQ(); /* Disable all interrupts */
P2SEL = 0x00; /* must be <> 1 to use interrupts */
P2IES |= 0x01; /* Enables external interrupt on low edge (for GDO2) */
P2IE |= 0x01; /* Enable interrupt */
P2IFG &= ~0x01; /* Clears the interrupt flag */
P2IE &= ~0x02; /* Disable interrupt for GDO0 */
P2IFG &= ~0x02; /* Clear IFG for GDO0 */
restoreIRQ(state); /* Enable all interrupts */
}
void cc110x_spi_init(void)
{
// Switch off async UART
while (!(UTCTL0 & TXEPT)); // Wait for empty UxTXBUF register
IE1 &= ~(URXIE0 + UTXIE0); // Disable USART0 receive&transmit interrupt
ME1 &= ~(UTXE0 + URXE0);
P3SEL |= 0x0E; // Set pin as SPI
// Keep peripheral in reset state
UCTL0 = SWRST;
// 8-bit SPI Master 3-pin mode, with SMCLK as clock source
// CKPL works also, but not CKPH+CKPL or none of them!!
UCTL0 |= CHAR + SYNC + MM;
UTCTL0 = CKPH + SSEL1 + SSEL0 + STC;
// Ignore clockrate argument for now, just use clock source/2
// SMCLK = 7,3728 MHz
UBR00 = 0x02; // Ensure baud rate >= 2
UBR10 = 0x00;
UMCTL0 = 0x00; // No modulation
URCTL0 = 0x00; // Reset Receive Control Register
// Enable SPI mode
ME1 |= USPIE0;
// Release for operation
UCTL0 &= ~SWRST;
}
// #include <msp430x16x.h>
// #include <signal.h>
// #include "type.h"
// #include "cc110x_defines.h"
// #include "driver_cc110x.h"
// #include "driver_system.h"
// #include "spi0.h"
//
// static callback_t _paket_cb;
// static callback_t _cs_cb;
//
// //-------------------------------------------------------------------------------------------------------
// // Public CC1100 communication functions (SPI)
// //-------------------------------------------------------------------------------------------------------
//
// //-------------------------------------------------------------------------------------------------------
// // void spiInitTrx(void)
// //
// // DESCRIPTION:
// // This function puts the cc110x into spi mode. You have to call this bevore every spi transaction.
// //
// //-------------------------------------------------------------------------------------------------------
//
//
// void drivercc110x_spiwriteburstreg(uint8_t addr, unsigned char *buffer, uint8_t count)
// {
// uint8_t i;
// long c;
// drivercc110x_spiinittrx();
// drivercc110x_trxspi(addr | CC1100_WRITE_BURST);
// for (i = 0; i < count; i++)
// {
// c = 0;
// IFG1 &= ~UTXIFG0;
// IFG1 &= ~URXIFG0;
// TXBUF0 = buffer[i];
// /* Wait for TX to finish */
// while(!(IFG1 & UTXIFG0))
// {
// if (c++ == 1000000)
// alarm();
// }
// }
// /* Wait for Byte received */
// c = 0;
// while(!(IFG1 & URXIFG0))
// {
// if (c++ == 1000000)
// alarm();
// }
// CC1100_CS_HIGH;
// }
//
// void drivercc110x_spireadburstreg(uint8_t addr, char *buffer, uint8_t count)
// {
// uint8_t i;
// drivercc110x_spiinittrx();
// drivercc110x_trxspi(addr | CC1100_READ_BURST);
// for (i = 0; i < count; i++)
// {
// long c = 0;
// IFG1 &= ~UTXIFG0;
// IFG1 &= ~URXIFG0;
// TXBUF0 = NOBYTE;
// while(!(IFG1 & UTXIFG0))
// {
// if (c++ == 1000000)
// alarm();
// }
// /* Wait for Byte received */
// c = 0;
// while(!(IFG1 & URXIFG0))
// {
// if (c++ == 1000000)
// alarm();
// }
// buffer[i] = RXBUF0;
// }
// CC1100_CS_HIGH;
// }
//
// void drivercc110x_load(callback_t cs_cb,callback_t paket_cb)
// {
// _paket_cb = paket_cb;
// _cs_cb = cs_cb;
// spi0_init(0);
// }
//
// void drivercc110x_aftersend(void)
// {
// CLEAR(P2IFG, 0x01);
// SET(P2IE, 0x01); /* Enable interrupts on port 2 pin 0 */
// CLEAR(P4OUT, 0x08); /* Turn off Sending Led*/
// }
//
// void drivercc110x_initinterrupts(void)
// {
// _DINT(); /* Disable all interrupts */
// P2SEL = 0x00; /* must be <> 1 to use interrupts */
// SET(P2IES, 0x01); /* Enables external interrupt on low edge (for GDO2) */
// SET(P2IE, 0x01); /* Enable interrupt */
// CLEAR(P2IFG, 0x01); /* Clears the interrupt flag */
// CLEAR(P2IE, 0x02); /* Disable interrupt for GDO0 */
// CLEAR(P2IFG, 0x02); /* Clear IFG for GDO0 */
// _EINT(); /* Enable all interrupts */
// }
//
// void drivercc110x_beforesend(void)
// {
// /* Turn on Led while sending paket for debug reasons */
// SET(P4OUT, 0x08);
// /* Disable interrupts on port 2 pin 0 */
// CLEAR(P2IE, 0x01);
// }
//
//
// /*
// * Private functions
// */
//
//
/*
* CC1100 receive interrupt
*/
interrupt(PORT2_VECTOR) __attribute__((naked)) cc110x_isr(void)
{
__enter_isr();
// if (system_state.POWERDOWN) SPI_INIT; /* Initialize SPI after wakeup */
/* Check IFG */
if ((P2IFG & 0x01) != 0) {
P2IFG &= ~0x01;
cc110x_gdo2_irq();
}
else if ((P2IFG & 0x02) != 0) {
cc110x_gdo0_irq();
P2IE &= ~0x02; // Disable interrupt for GDO0
P2IFG &= ~0x02; // Clear IFG for GDO0
}
else {
puts("cc110x_isr(): unexpected IFG!");
/* Should not occur - only Port 2 Pin 0 interrupts are enabled */
// CLEAR(P2IFG, 0xFF); /* Clear all flags */
}
// if (system_state.POWERDOWN != 0) END_LPM3;
__exit_isr();
}

@ -54,7 +54,5 @@ extern "C" {
#include "board-conf.h"
typedef uint8_t radio_packet_length_t;
/** @} */
#endif /* MSB_BOARD_H_ */

@ -1,12 +1,3 @@
ifneq (,$(filter cc110x_legacy_csma,$(USEMODULE)))
USEMODULE += gpioint
endif
ifneq (,$(filter cc110x_legacy,$(USEMODULE)))
USEMODULE += cc110x_spi
USEMODULE += gpioint
endif
ifneq (,$(filter ltc4150,$(USEMODULE)))
USEMODULE += gpioint
endif

@ -1,5 +1,4 @@
MODULE =$(BOARD)_base
INCLUDES += -I$(RIOTBASE)/drivers/cc110x_legacy_csma
DIRS = $(RIOTBOARD)/msba2-common

@ -1,4 +1,3 @@
FEATURES_PROVIDED += transceiver
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += cpp

@ -1,8 +1,3 @@
export INCLUDES += -I$(RIOTBOARD)/msba2/include
ifneq (,$(filter defaulttransceiver,$(USEMODULE)))
USEMODULE += cc110x_legacy
USEMODULE += transceiver
endif
include $(RIOTBOARD)/msba2-common/Makefile.include

@ -41,8 +41,6 @@ extern "C" {
void init_clks1(void);
typedef uint8_t radio_packet_length_t;
#ifdef __cplusplus
}
#endif

@ -1,249 +0,0 @@
/*
* Copyright (C) 2008, Freie Universitaet Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @file
* @ingroup LPC2387
* @brief CC1100 LPC2387 dependend functions
*
* @author Heiko Will <hwill@inf.fu-berlin.de>
* @author Thomas Hillebrandt <hillebra@inf.fu-berlin.de>
* @version $Revision: 1781 $
*
* @note $Id: msba2-cc110x.c 1781 2010-01-26 13:39:36Z hillebra $
*/
#include <stdio.h>
#include <stddef.h>
/* core */
#include "irq.h"
/* cpu */
#include "cpu.h"
/* drivers */
#include "cc110x_legacy.h"
#include "gpioint.h"
#define CC1100_GDO0 (FIO0PIN & BIT27) // read serial I/O (GDO0)
#define CC1100_GDO1 (FIO1PIN & BIT23) // read serial I/O (GDO1)
#define CC1100_GDO2 (FIO0PIN & BIT28) // read serial I/O (GDO2)
#define SPI_TX_EMPTY (SSP0SR & SSPSR_TFE)
#define SPI_BUSY (SSP0SR & SSPSR_BSY)
#define SPI_RX_AVAIL (SSP0SR & SSPSR_RNE)
#define CC1100_GDO1_LOW_RETRY (100) // max. retries for GDO1 to go low
#define CC1100_GDO1_LOW_COUNT (2700) // loop count (timeout ~ 500 us) to wait
// for GDO1 to go low when CS low
//#define DEBUG
#ifdef DEBUG
static unsigned long time_value;
static void set_time(void)
{
time_value = 0;
}
static int test_time(int code)
{
time_value++;
if (time_value > 10000000) {
printf("CC1100 SPI alarm: %d!\n", code);
time_value = 0;
return 1;
}
return 0;
}
#endif
int cc110x_get_gdo0(void)
{
return CC1100_GDO0;
}
int cc110x_get_gdo1(void)
{
return CC1100_GDO1;
}
int cc110x_get_gdo2(void)
{
return CC1100_GDO2;
}
void cc110x_spi_init(void)
{
// configure chip-select
FIO1DIR |= BIT21;
FIO1SET = BIT21;
// Power
PCONP |= PCSSP0; // Enable power for SSP0 (default is on)
// PIN Setup
PINSEL3 |= BIT8 + BIT9; // Set CLK function to SPI
PINSEL3 |= BIT14 + BIT15; // Set MISO function to SPI
PINSEL3 |= BIT16 + BIT17; // Set MOSI function to SPI
// Interface Setup
SSP0CR0 = 7;
// Clock Setup
uint32_t pclksel;
uint32_t cpsr;
lpc2387_pclk_scale(F_CPU / 1000, 6000, &pclksel, &cpsr);
PCLKSEL1 &= ~(BIT10 | BIT11); // CCLK to PCLK divider
PCLKSEL1 |= pclksel << 10;
SSP0CPSR = cpsr;
// Enable
SSP0CR1 |= BIT1; // SSP-Enable
int dummy;
// Clear RxFIFO:
while (SPI_RX_AVAIL) { // while RNE (Receive FIFO Not Empty)...
dummy = SSP0DR; // read data
}
/* to suppress unused-but-set-variable */
(void) dummy;
}
uint8_t cc110x_txrx(uint8_t c)
{
uint8_t result;
SSP0DR = c;
#ifdef DEBUG
set_time();
#endif
while (!SPI_TX_EMPTY) {
#ifdef DEBUG
test_time(0);
#endif
}
#ifdef DEBUG
set_time();
#endif
while (SPI_BUSY) {
#ifdef DEBUG
test_time(1);
#endif
}
#ifdef DEBUG
set_time();
#endif
while (!SPI_RX_AVAIL) {
#ifdef DEBUG
test_time(2);
#endif
}
result = (uint8_t)SSP0DR;
return result;
}
void cc110x_spi_cs(void)
{
FIO1CLR = BIT21;
}
void
cc110x_spi_select(void)
{
volatile int retry_count = 0;
volatile int abort_count;
// Switch to GDO mode input
PINSEL3 &= ~(BIT14 + BIT15);// Set MISO function to GPIO
FIO1DIR &= ~BIT23;
cs_low:
// CS to low
abort_count = 0;
FIO1CLR = BIT21;
// Wait for SO to go low (voltage regulator
// has stabilized and the crystal is running)
loop:
asm volatile("nop");
if (CC1100_GDO1) {
abort_count++;
if (abort_count > CC1100_GDO1_LOW_COUNT) {
retry_count++;
if (retry_count > CC1100_GDO1_LOW_RETRY) {
puts("[CC1100 SPI] fatal error\n");
goto final;
}
FIO1SET = BIT21; // CS to high
goto cs_low; // try again
}
goto loop;
}
final:
// Switch to SPI mode
PINSEL3 |= (BIT14 + BIT15); // Set MISO function to SPI
}
void
cc110x_spi_unselect(void)
{
FIO1SET = BIT21;
}
void cc110x_before_send(void)
{
// Disable GDO2 interrupt before sending packet
cc110x_gdo2_disable();
}
void cc110x_after_send(void)
{
// Enable GDO2 interrupt after sending packet
cc110x_gdo2_enable();
}
void cc110x_gdo0_enable(void)
{
gpioint_set(0, BIT27, GPIOINT_RISING_EDGE, &cc110x_gdo0_irq);
}
void cc110x_gdo0_disable(void)
{
gpioint_set(0, BIT27, GPIOINT_DISABLE, NULL);
}
void cc110x_gdo2_disable(void)
{
gpioint_set(0, BIT28, GPIOINT_DISABLE, NULL);
}
void cc110x_gdo2_enable(void)
{
gpioint_set(0, BIT28, GPIOINT_FALLING_EDGE, &cc110x_gdo2_irq);
}
void cc110x_init_interrupts(void)
{
// Enable external interrupt on low edge (for GDO2)
FIO0DIR &= ~BIT28;
cc110x_gdo2_enable();
// Enable external interrupt on low edge (for GDO0)
FIO0DIR &= ~BIT27;
}

@ -1,5 +1,4 @@
# tell the Makefile.base which module to build
MODULE = $(BOARD)_base
INCLUDES += -I$(RIOTBASE)/drivers/cc110x
include $(RIOTBASE)/Makefile.base

@ -7,5 +7,4 @@ FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_random
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_dac
FEATURES_PROVIDED += transceiver
FEATURES_MCU_GROUP = cortex_m4

@ -2,13 +2,6 @@
export CPU = stm32f4
export CPU_MODEL = stm32f415rg
ifneq (,$(filter defaulttransceiver,$(USEMODULE)))
USEMODULE += cc110x
ifeq (,$(filter netdev_base,$(USEMODULE)))
USEMODULE += transceiver
endif
endif
#define the default port depending on the host OS
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(shell ls -1 /dev/tty.SLAB_USBtoUART* | head -n 1)

@ -49,8 +49,6 @@ extern "C" {
#define CC110X_GDO0 GPIO(PORT_C, 4)
#define CC110X_GDO1 GPIO(PORT_A, 6)
#define CC110X_GDO2 GPIO(PORT_C, 5)
typedef uint8_t radio_packet_length_t;
/** @} */
/**

@ -1,10 +1,3 @@
ifneq (,$(filter defaulttransceiver,$(USEMODULE)))
USEMODULE += at86rf231
ifeq (,$(filter netdev_base,$(USEMODULE)))
USEMODULE += transceiver
endif
endif
ifneq (,$(filter ng_netif_default,$(USEMODULE)))
USEMODULE += ng_at86rf212b
USEMODULE += ng_nomac

@ -9,5 +9,4 @@ FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += transceiver
FEATURES_MCU_GROUP = cortex_m4

@ -94,11 +94,6 @@ extern "C" {
*/
void board_init(void);
/**
* Define the type for the radio packet length for the transceiver
*/
typedef uint8_t radio_packet_length_t;
#ifdef __cplusplus
}
#endif