Merge remote-tracking branch 'origin/release-4.1' into develop
This commit is contained in:
commit
f9a1f958e1
@ -1,7 +1,7 @@
|
||||
# Contiki-NG: The OS for Next Generation IoT Devices
|
||||
|
||||
[![Build Status](https://travis-ci.org/contiki-ng/contiki-ng.svg?branch=master)](https://travis-ci.org/contiki-ng/contiki-ng/branches)
|
||||
[![License](https://img.shields.io/badge/License-3--Clause%20BSD-brightgreen.svg)](https://github.com/contiki-ng/contiki-ng/blob/master/LICENSE.md)
|
||||
[![license](https://img.shields.io/badge/license-3--clause%20bsd-brightgreen.svg)](https://github.com/contiki-ng/contiki-ng/blob/master/LICENSE.md)
|
||||
[![Latest release](https://img.shields.io/github/release/contiki-ng/contiki-ng.svg)](https://github.com/contiki-ng/contiki-ng/releases/latest)
|
||||
[![GitHub Release Date](https://img.shields.io/github/release-date/contiki-ng/contiki-ng.svg)](https://github.com/contiki-ng/contiki-ng/releases/latest)
|
||||
[![Last commit](https://img.shields.io/github/last-commit/contiki-ng/contiki-ng.svg)](https://github.com/contiki-ng/contiki-ng/commit/HEAD)
|
||||
@ -9,7 +9,7 @@
|
||||
Contiki-NG is an open-source, cross-platform operating system for Next-Generation IoT devices. It focuses on dependable (secure and reliable) low-power communication and standard protocols, such as IPv6/6LoWPAN, 6TiSCH, RPL, and CoAP. Contiki-NG comes with extensive documentation, tutorials, a roadmap, release cycle, and well-defined development flow for smooth integration of community contributions.
|
||||
|
||||
Unless excplicitly stated otherwise, Contiki-NG sources are distributed under
|
||||
the terms of the [3-clause BSD license](LICENSE.md).
|
||||
the terms of the [3-clause BSD license](LICENSE.md).
|
||||
|
||||
Contiki-NG started as a fork of the Contiki OS and retains some of its original features.
|
||||
|
||||
|
@ -55,7 +55,7 @@
|
||||
* - SPIX_FLUSH(x)
|
||||
*
|
||||
* Some of the old functions and macros are still supported.
|
||||
* When using these deprecated functions, the SSI module to use
|
||||
* When using these deprecated functions, the SSI module to use
|
||||
* has to be be selected by means of the macro SPI_CONF_DEFAULT_INSTANCE.
|
||||
*
|
||||
* This SPI driver depends on the following defines:
|
||||
@ -95,14 +95,14 @@
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Default values for the clock rate divider */
|
||||
#ifdef SPI0_CONF_CPRS_CPSDVSR
|
||||
#define SPI0_CPRS_CPSDVSR SPI0_CONF_CPRS_CPSDVSR
|
||||
#ifdef SPI0_CONF_CPRS_CPSDVSR
|
||||
#define SPI0_CPRS_CPSDVSR SPI0_CONF_CPRS_CPSDVSR
|
||||
#else
|
||||
#define SPI0_CPRS_CPSDVSR 2
|
||||
#endif
|
||||
|
||||
#ifdef SPI1_CONF_CPRS_CPSDVSR
|
||||
#define SPI1_CPRS_CPSDVSR SPI1_CONF_CPRS_CPSDVSR
|
||||
#ifdef SPI1_CONF_CPRS_CPSDVSR
|
||||
#define SPI1_CPRS_CPSDVSR SPI1_CONF_CPRS_CPSDVSR
|
||||
#else
|
||||
#define SPI1_CPRS_CPSDVSR 2
|
||||
#endif
|
||||
@ -120,7 +120,7 @@
|
||||
} while(0)
|
||||
#define SPIX_FLUSH(spi) do { \
|
||||
while(REG(SSI_BASE(spi) + SSI_SR) & SSI_SR_RNE) { \
|
||||
SPIX_BUF(spi); \
|
||||
SPIX_BUF(spi); \
|
||||
} \
|
||||
} while(0)
|
||||
#define SPIX_CS_CLR(port, pin) do { \
|
||||
@ -144,7 +144,7 @@
|
||||
#endif
|
||||
#define SPI_CS_CLR(port, pin) SPIX_CS_CLR(port, pin)
|
||||
#define SPI_CS_SET(port, pin) SPIX_CS_SET(port, pin)
|
||||
#endif /* #ifdef SPI_DEFAULT_INSTANCE */
|
||||
#endif /* #ifdef SPI_DEFAULT_INSTANCE */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/** \name Arch-specific SPI functions
|
||||
* @{
|
||||
@ -183,7 +183,7 @@ void spix_disable(uint8_t spi);
|
||||
*
|
||||
* See section 19.4.4 in the CC2538 user guide for more information.
|
||||
*
|
||||
* \param spi The SSI instance to use.
|
||||
* \param spi The SSI instance to use.
|
||||
* \param frame_format Set the SSI frame format. Use SSI_CR0_FRF_MOTOROLA,
|
||||
* SSI_CR0_FRF_TI, or SSI_CR0_FRF_MICROWIRE.
|
||||
* \param clock_polarity In Motorola mode, set whether the clock is high or low
|
||||
|
@ -1,30 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2006, Swedish Institute of Computer Science
|
||||
* All rights reserved.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 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 of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*
|
||||
*/
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
* exclusive. Set spi_busy so that interrupt handlers can check if
|
||||
* they are allowed to use the bus or not. Only the CC2420 radio needs
|
||||
* this in practice.
|
||||
*
|
||||
*
|
||||
*/
|
||||
unsigned char spi_busy = 0;
|
||||
|
||||
|
@ -1,30 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Swedish Institute of Computer Science
|
||||
* All rights reserved.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
* 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 of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE 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 INSTITUTE 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.
|
||||
*/
|
||||
|
||||
#ifndef MSP430_DEF_H_
|
||||
|
@ -1,6 +1,7 @@
|
||||
CONTIKI_CPU_DIRS = . net dev
|
||||
|
||||
CONTIKI_SOURCEFILES += rtimer-arch.c watchdog.c eeprom.c
|
||||
CONTIKI_SOURCEFILES += rtimer-arch.c watchdog.c eeprom.c int-master.c
|
||||
CONTIKI_SOURCEFILES += gpio-hal-arch.c
|
||||
|
||||
### Compiler definitions
|
||||
CC ?= gcc
|
||||
|
216
arch/cpu/native/dev/gpio-hal-arch.c
Normal file
216
arch/cpu/native/dev/gpio-hal-arch.c
Normal file
@ -0,0 +1,216 @@
|
||||
/*
|
||||
* Copyright (c) 2018, George Oikonomou - http://www.spd.gr
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 of the copyright holder 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 HOLDER 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.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
#include "dev/gpio-hal.h"
|
||||
#include "sys/log.h"
|
||||
|
||||
#include <stdint.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Log configuration */
|
||||
#define LOG_MODULE "GPIO arch"
|
||||
#define LOG_LEVEL LOG_LEVEL_NONE
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static gpio_hal_pin_cfg_t pin_cfg[GPIO_HAL_PIN_COUNT];
|
||||
static uint8_t pin_state[GPIO_HAL_PIN_COUNT];
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
gpio_hal_arch_interrupt_enable(gpio_hal_pin_t pin)
|
||||
{
|
||||
if(pin >= GPIO_HAL_PIN_COUNT) {
|
||||
LOG_ERR("Pin %u out of bounds\n", pin);
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_DBG("Pin %u: Enabled interrupt\n", pin);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
gpio_hal_arch_interrupt_disable(gpio_hal_pin_t pin)
|
||||
{
|
||||
if(pin >= GPIO_HAL_PIN_COUNT) {
|
||||
LOG_ERR("Pin %u out of bounds\n", pin);
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_DBG("Pin %u: Disabled interrupt\n", pin);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
gpio_hal_arch_pin_cfg_set(gpio_hal_pin_t pin, gpio_hal_pin_cfg_t cfg)
|
||||
{
|
||||
if(pin >= GPIO_HAL_PIN_COUNT) {
|
||||
LOG_ERR("Pin %u out of bounds\n", pin);
|
||||
return;
|
||||
}
|
||||
|
||||
pin_cfg[pin] = cfg;
|
||||
LOG_DBG("Pin %u: Set config=0x%02x\n", pin, pin_cfg[pin]);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
gpio_hal_pin_cfg_t
|
||||
gpio_hal_arch_pin_cfg_get(gpio_hal_pin_t pin)
|
||||
{
|
||||
if(pin >= GPIO_HAL_PIN_COUNT) {
|
||||
LOG_ERR("Pin %u out of bounds\n", pin);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LOG_DBG("Pin %u: Config=0x%02x\n", pin, pin_cfg[pin]);
|
||||
return pin_cfg[pin];
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
gpio_hal_arch_pin_set_input(gpio_hal_pin_t pin)
|
||||
{
|
||||
if(pin >= GPIO_HAL_PIN_COUNT) {
|
||||
LOG_ERR("Pin %u out of bounds\n", pin);
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_DBG("Pin %u: Set input\n", pin);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
gpio_hal_arch_pin_set_output(gpio_hal_pin_t pin)
|
||||
{
|
||||
if(pin >= GPIO_HAL_PIN_COUNT) {
|
||||
LOG_ERR("Pin %u out of bounds\n", pin);
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_DBG("Pin %u: Set output\n", pin);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
gpio_hal_arch_set_pin(gpio_hal_pin_t pin)
|
||||
{
|
||||
if(pin >= GPIO_HAL_PIN_COUNT) {
|
||||
LOG_ERR("Pin %u out of bounds\n", pin);
|
||||
return;
|
||||
}
|
||||
|
||||
pin_state[pin] = 1;
|
||||
LOG_DBG("Pin %u: Set\n", pin);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
gpio_hal_arch_clear_pin(gpio_hal_pin_t pin)
|
||||
{
|
||||
if(pin >= GPIO_HAL_PIN_COUNT) {
|
||||
LOG_ERR("Pin %u out of bounds\n", pin);
|
||||
return;
|
||||
}
|
||||
|
||||
pin_state[pin] = 0;
|
||||
LOG_DBG("Pin %u: Clear\n", pin);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
uint8_t
|
||||
gpio_hal_arch_read_pin(gpio_hal_pin_t pin)
|
||||
{
|
||||
if(pin >= GPIO_HAL_PIN_COUNT) {
|
||||
LOG_ERR("Pin %u out of bounds\n", pin);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LOG_DBG("Pin %u: Read=%u\n", pin, pin_state[pin]);
|
||||
return pin_state[pin];
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
gpio_hal_arch_write_pin(gpio_hal_pin_t pin, uint8_t value)
|
||||
{
|
||||
if(pin >= GPIO_HAL_PIN_COUNT) {
|
||||
LOG_ERR("Pin %u out of bounds\n", pin);
|
||||
return;
|
||||
}
|
||||
|
||||
pin_state[pin] = value;
|
||||
LOG_DBG("Pin %u: Write=%u\n", pin, pin_state[pin]);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
gpio_hal_arch_set_pins(gpio_hal_pin_mask_t pins)
|
||||
{
|
||||
gpio_hal_pin_t pin;
|
||||
|
||||
for(pin = 0; pin < GPIO_HAL_PIN_COUNT; pin++) {
|
||||
if(pins & (1 << pin)) {
|
||||
pin_state[pin] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_DBG("Set pins 0x%08" PRIx32 "\n", pins);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
gpio_hal_arch_clear_pins(gpio_hal_pin_mask_t pins)
|
||||
{
|
||||
gpio_hal_pin_t pin;
|
||||
|
||||
for(pin = 0; pin < GPIO_HAL_PIN_COUNT; pin++) {
|
||||
if(pins & (1 << pin)) {
|
||||
pin_state[pin] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_DBG("Clear pins 0x%08" PRIx32 "\n", pins);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
gpio_hal_pin_mask_t
|
||||
gpio_hal_arch_read_pins(gpio_hal_pin_mask_t pins)
|
||||
{
|
||||
gpio_hal_pin_t pin;
|
||||
gpio_hal_pin_mask_t state = 0;
|
||||
|
||||
for(pin = 0; pin < GPIO_HAL_PIN_COUNT; pin++) {
|
||||
state |= (pin_state[pin] << pin);
|
||||
}
|
||||
|
||||
LOG_DBG("Read pins 0x%08" PRIx32 "\n", state);
|
||||
return state;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
gpio_hal_arch_write_pins(gpio_hal_pin_mask_t pins, gpio_hal_pin_mask_t value)
|
||||
{
|
||||
gpio_hal_pin_t pin;
|
||||
|
||||
for(pin = 0; pin < GPIO_HAL_PIN_COUNT; pin++) {
|
||||
if(pins & (1 << pin)) {
|
||||
pin_state[pin] = (value & (1 << pin)) == 0 ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
LOG_DBG("Write pins 0x%08" PRIx32 "->0x%08" PRIx32 "\n", pins, value);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
67
arch/cpu/native/int-master.c
Normal file
67
arch/cpu/native/int-master.c
Normal file
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2018, George Oikonomou - http://www.spd.gr
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 of the copyright holder 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 HOLDER 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.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
#include "sys/int-master.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define DISABLED 0
|
||||
#define ENABLED 1
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static int_master_status_t stat = DISABLED;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
int_master_enable(void)
|
||||
{
|
||||
stat = ENABLED;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int_master_status_t
|
||||
int_master_read_and_disable(void)
|
||||
{
|
||||
int_master_status_t rv = stat;
|
||||
stat = DISABLED;
|
||||
return rv;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
int_master_status_set(int_master_status_t status)
|
||||
{
|
||||
stat = status;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
bool
|
||||
int_master_is_enabled(void)
|
||||
{
|
||||
return stat == DISABLED ? false : true;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
38
arch/cpu/native/native-def.h
Normal file
38
arch/cpu/native/native-def.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2018, George Oikonomou - http://www.spd.gr
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 of the copyright holder 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 HOLDER 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.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef NATIVE_DEF_H_
|
||||
#define NATIVE_DEF_H_
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define GPIO_HAL_CONF_ARCH_SW_TOGGLE 1
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#endif /* NATIVE_DEF_H_ */
|
||||
/*---------------------------------------------------------------------------*/
|
@ -113,13 +113,15 @@ static spi_device_t flash_spi_configuration_default = {
|
||||
/**
|
||||
* Get spi configuration, return default configuration if NULL
|
||||
*/
|
||||
static spi_device_t*
|
||||
get_spi_conf(spi_device_t *conf) {
|
||||
static spi_device_t *
|
||||
get_spi_conf(spi_device_t *conf)
|
||||
{
|
||||
if(conf == NULL) {
|
||||
return &flash_spi_configuration_default;
|
||||
}
|
||||
return conf;
|
||||
}/*---------------------------------------------------------------------------*/
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Clear external flash CSN line
|
||||
*/
|
||||
@ -334,7 +336,7 @@ ext_flash_open(spi_device_t *conf)
|
||||
/* Put the part is standby mode */
|
||||
power_standby(flash_spi_configuration);
|
||||
|
||||
if (verify_part(flash_spi_configuration) == VERIFY_PART_OK) {
|
||||
if(verify_part(flash_spi_configuration) == VERIFY_PART_OK) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -353,7 +355,7 @@ ext_flash_close(spi_device_t *conf)
|
||||
|
||||
/* Put the part in low power mode */
|
||||
ret = power_down(flash_spi_configuration);
|
||||
|
||||
|
||||
/* SPI is released no matter if power_down() succeeds or fails */
|
||||
if(spi_release(flash_spi_configuration) != SPI_DEV_STATUS_OK) {
|
||||
return false;
|
||||
@ -474,7 +476,7 @@ ext_flash_erase(spi_device_t *conf, uint32_t offset, uint32_t length)
|
||||
uint8_t wbuf[4];
|
||||
uint32_t i, numsectors;
|
||||
uint32_t endoffset = offset + length - 1;
|
||||
|
||||
|
||||
spi_device_t *flash_spi_configuration;
|
||||
|
||||
flash_spi_configuration = get_spi_conf(conf);
|
||||
|
@ -57,5 +57,3 @@ const leds_t leds_arch_leds[] = {
|
||||
#endif
|
||||
};
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
@ -6,8 +6,8 @@ endif
|
||||
CONTIKI_TARGET_DIRS = . dev
|
||||
CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o}
|
||||
|
||||
CONTIKI_TARGET_SOURCEFILES += platform.c clock.c xmem.c leds-arch.c
|
||||
CONTIKI_TARGET_SOURCEFILES += cfs-posix.c cfs-posix-dir.c
|
||||
CONTIKI_TARGET_SOURCEFILES += platform.c clock.c xmem.c
|
||||
CONTIKI_TARGET_SOURCEFILES += cfs-posix.c cfs-posix-dir.c buttons.c
|
||||
|
||||
ifeq ($(HOST_OS),Windows)
|
||||
CONTIKI_TARGET_SOURCEFILES += wpcap-drv.c wpcap.c
|
||||
|
@ -37,7 +37,9 @@
|
||||
#ifdef PROJECT_CONF_PATH
|
||||
#include PROJECT_CONF_PATH
|
||||
#endif /* PROJECT_CONF_PATH */
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "native-def.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include <inttypes.h>
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#include <sys/select.h>
|
||||
@ -60,8 +62,6 @@ int select_set_callback(int fd, const struct select_callback *callback);
|
||||
|
||||
typedef unsigned int uip_stats_t;
|
||||
|
||||
#define LEDS_CONF_LEGACY_API 1
|
||||
|
||||
#ifndef UIP_CONF_BYTE_ORDER
|
||||
#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
|
||||
#endif
|
||||
@ -91,6 +91,8 @@ typedef unsigned long clock_time_t;
|
||||
|
||||
#define LOG_CONF_ENABLED 1
|
||||
|
||||
#define PLATFORM_SUPPORTS_BUTTON_HAL 1
|
||||
|
||||
/* Not part of C99 but actually present */
|
||||
int strcasecmp(const char*, const char*);
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2018, RISE SICS AB.
|
||||
* Copyright (c) 2018, George Oikonomou - http://www.spd.gr
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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
|
||||
@ -14,10 +15,10 @@
|
||||
* 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 HOLDER AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* 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
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
@ -27,21 +28,13 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#error The CoAP example no longer fits the limited ROM in the Tmote Sky. \
|
||||
Please select another platform with more ROM to compile the CoAP example.
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define COAP_OBSERVE_CLIENT 0
|
||||
#include "contiki.h"
|
||||
#include "dev/button-hal.h"
|
||||
|
||||
#define COAP_MAX_CHUNK_SIZE 48
|
||||
|
||||
/* Turn off DAO-ACK and probing to make code smaller */
|
||||
#define RPL_CONF_WITH_DAO_ACK 0
|
||||
|
||||
#define LOG_CONF_LEVEL_MAIN 0
|
||||
|
||||
#define DCOSYNCH_CONF_ENABLED 0
|
||||
|
||||
#define PROCESS_CONF_NUMEVENTS 8
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
button_hal_button_t *button_hal_buttons[] = { NULL };
|
||||
const uint8_t button_hal_button_count = 0;
|
||||
/*---------------------------------------------------------------------------*/
|
@ -56,6 +56,9 @@
|
||||
#include "net/netstack.h"
|
||||
|
||||
#include "dev/serial-line.h"
|
||||
#include "dev/button-hal.h"
|
||||
#include "dev/gpio-hal.h"
|
||||
#include "dev/leds.h"
|
||||
|
||||
#include "net/ipv6/uip.h"
|
||||
#include "net/ipv6/uip-debug.h"
|
||||
@ -251,6 +254,9 @@ platform_process_args(int argc, char**argv)
|
||||
void
|
||||
platform_init_stage_one()
|
||||
{
|
||||
gpio_hal_init();
|
||||
button_hal_init();
|
||||
leds_init();
|
||||
return;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -54,5 +54,3 @@ const leds_t leds_arch_leds[] = {
|
||||
},
|
||||
};
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
@ -43,44 +43,41 @@
|
||||
#include "contiki-conf.h"
|
||||
#include "dev/xmem.h"
|
||||
|
||||
/*** MX25R8035F Memory Organization
|
||||
The memory is organized as:
|
||||
8Mbit = 1048576 bytes (8 bits each)
|
||||
256 sectors (32 Kbits, 4096 bytes each)
|
||||
4096 pages (256 bytes each).
|
||||
Each page can be individually programmed (bits are programmed from 1 to 0). The device is
|
||||
sector or bulk erasable (bits are erased from 0 to 1) but not page erasable
|
||||
*/
|
||||
#define COFFEE_XMEM_TOTAL_SIZE_KB 1024UL //Total size of the External Flash Memory in the Z1
|
||||
/*
|
||||
* MX25R8035F Memory Organization
|
||||
* The memory is organized as:
|
||||
* 8Mbit = 1048576 bytes (8 bits each)
|
||||
* 256 sectors (32 Kbits, 4096 bytes each)
|
||||
* 4096 pages (256 bytes each).
|
||||
* Each page can be individually programmed (bits are programmed from 1 to 0).
|
||||
* The device is sector or bulk erasable (bits are erased from 0 to 1) but not
|
||||
* page erasable
|
||||
*/
|
||||
#define COFFEE_XMEM_TOTAL_SIZE_KB 1024UL /* Total size of the External Flash Memory in the Z1 */
|
||||
|
||||
/* Coffee configuration parameters. */
|
||||
#define COFFEE_SECTOR_SIZE 4096UL
|
||||
#define COFFEE_SECTOR_SIZE 4096UL
|
||||
#define COFFEE_PAGE_SIZE 256UL
|
||||
#define COFFEE_START 0UL //COFFEE_SECTOR_SIZE
|
||||
#define COFFEE_START 0UL /* COFFEE_SECTOR_SIZE */
|
||||
#define COFFEE_SIZE (COFFEE_XMEM_TOTAL_SIZE_KB * 1024UL - COFFEE_START)
|
||||
#define COFFEE_NAME_LENGTH 16
|
||||
#define COFFEE_MAX_OPEN_FILES 6
|
||||
#define COFFEE_FD_SET_SIZE 8
|
||||
#define COFFEE_LOG_TABLE_LIMIT 256
|
||||
#define COFFEE_DYN_SIZE 2*1024
|
||||
#define COFFEE_DYN_SIZE 2 * 1024
|
||||
#define COFFEE_LOG_SIZE 1024
|
||||
|
||||
#define COFFEE_MICRO_LOGS 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Flash operations. */
|
||||
#define COFFEE_WRITE(buf, size, offset) \
|
||||
xmem_pwrite((char *)(buf), (size), COFFEE_START + (offset))
|
||||
#define COFFEE_WRITE(buf, size, offset) \
|
||||
xmem_pwrite((char *)(buf), (size), COFFEE_START + (offset))
|
||||
|
||||
#define COFFEE_READ(buf, size, offset) \
|
||||
xmem_pread((char *)(buf), (size), COFFEE_START + (offset))
|
||||
#define COFFEE_READ(buf, size, offset) \
|
||||
xmem_pread((char *)(buf), (size), COFFEE_START + (offset))
|
||||
|
||||
#define COFFEE_ERASE(sector) \
|
||||
xmem_erase(COFFEE_SECTOR_SIZE, COFFEE_START + (sector) * COFFEE_SECTOR_SIZE)
|
||||
#define COFFEE_ERASE(sector) \
|
||||
xmem_erase(COFFEE_SECTOR_SIZE, COFFEE_START + (sector) * COFFEE_SECTOR_SIZE)
|
||||
|
||||
/* Coffee types. */
|
||||
typedef int16_t coffee_page_t;
|
||||
|
@ -49,21 +49,17 @@
|
||||
|
||||
#define XMEM_BUFF_LENGHT 128
|
||||
|
||||
|
||||
#if 0
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define PRINTF(...) do {} while (0)
|
||||
#define PRINTF(...) do {} while(0)
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
xmem_init(void)
|
||||
{
|
||||
ext_flash_open(NULL);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
xmem_pread(void *_p, int size, unsigned long addr)
|
||||
{
|
||||
@ -80,21 +76,20 @@ xmem_pread(void *_p, int size, unsigned long addr)
|
||||
}
|
||||
|
||||
rv = ext_flash_read(NULL, addr, size, _p);
|
||||
for (i = 0; i < size; i++){
|
||||
for(i = 0; i < size; i++) {
|
||||
x = ~*((uint8_t *)_p + i);
|
||||
*((uint8_t *)_p+i) = x;
|
||||
*((uint8_t *)_p + i) = x;
|
||||
}
|
||||
|
||||
ext_flash_close(NULL);
|
||||
|
||||
if(rv)
|
||||
if(rv) {
|
||||
return size;
|
||||
}
|
||||
|
||||
PRINTF("Could not read flash memory!\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
int
|
||||
xmem_pwrite(const void *_buf, int size, unsigned long addr)
|
||||
{
|
||||
@ -112,13 +107,13 @@ xmem_pwrite(const void *_buf, int size, unsigned long addr)
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (remain = size, j = 0; remain > 0; remain -= XMEM_BUFF_LENGHT, j += XMEM_BUFF_LENGHT) {
|
||||
for(remain = size, j = 0; remain > 0; remain -= XMEM_BUFF_LENGHT, j += XMEM_BUFF_LENGHT) {
|
||||
int to_write = MIN(XMEM_BUFF_LENGHT, remain);
|
||||
for (i = 0; i < to_write; i++) {
|
||||
for(i = 0; i < to_write; i++) {
|
||||
tmp_buf[i] = ~*((uint8_t *)_buf + j + i);
|
||||
}
|
||||
rv = ext_flash_write(NULL, addr + j, to_write, tmp_buf);
|
||||
if (!rv) {
|
||||
if(!rv) {
|
||||
PRINTF("Could not write flash memory!\n");
|
||||
return size - remain;
|
||||
}
|
||||
@ -128,8 +123,6 @@ xmem_pwrite(const void *_buf, int size, unsigned long addr)
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
xmem_erase(long size, unsigned long addr)
|
||||
{
|
||||
@ -137,7 +130,6 @@ xmem_erase(long size, unsigned long addr)
|
||||
|
||||
rv = ext_flash_open(NULL);
|
||||
|
||||
|
||||
if(!rv) {
|
||||
PRINTF("Could not open flash to save config\n");
|
||||
ext_flash_close(NULL);
|
||||
@ -160,8 +152,9 @@ xmem_erase(long size, unsigned long addr)
|
||||
|
||||
watchdog_periodic();
|
||||
|
||||
if(rv)
|
||||
if(rv) {
|
||||
return size;
|
||||
}
|
||||
|
||||
PRINTF("Could not erase flash memory\n");
|
||||
return -1;
|
||||
|
@ -41,5 +41,3 @@ const leds_t leds_arch_leds[] = {
|
||||
{ .pin = BOARD_IOID_LED_2, .negative_logic = false },
|
||||
};
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
@ -39,5 +39,3 @@ const leds_t leds_arch_leds[] = {
|
||||
{ .pin = BOARD_IOID_LED_1, .negative_logic = false },
|
||||
};
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
@ -40,5 +40,3 @@ const leds_t leds_arch_leds[] = {
|
||||
{ .pin = BOARD_IOID_LED_2, .negative_logic = false },
|
||||
};
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
@ -42,5 +42,3 @@ const leds_t leds_arch_leds[] = {
|
||||
{ .pin = BOARD_IOID_LED_4, .negative_logic = false },
|
||||
};
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
@ -50,5 +50,3 @@ const leds_t leds_arch_leds[] = {
|
||||
},
|
||||
};
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
@ -28,8 +28,8 @@
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _PROJECT_CONF_H_
|
||||
#define _PROJECT_CONF_H_
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
#define UIP_CONF_ND6_SEND_RA 0
|
||||
|
||||
@ -39,4 +39,4 @@
|
||||
|
||||
#define LOG_CONF_LEVEL_6TOP LOG_LEVEL_DBG
|
||||
|
||||
#endif /* _PROJECT_CONF_H_ */
|
||||
#endif /* PROJECT_CONF_H_ */
|
||||
|
@ -32,8 +32,8 @@
|
||||
* \author Simon Duquennoy <simonduq@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __PROJECT_CONF_H__
|
||||
#define __PROJECT_CONF_H__
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
/* Set to enable TSCH security */
|
||||
#ifndef WITH_SECURITY
|
||||
@ -115,4 +115,4 @@
|
||||
#define LOG_CONF_LEVEL_6TOP LOG_LEVEL_DBG
|
||||
#define TSCH_LOG_CONF_PER_SLOT 1
|
||||
|
||||
#endif /* __PROJECT_CONF_H__ */
|
||||
#endif /* PROJECT_CONF_H_ */
|
||||
|
@ -32,8 +32,8 @@
|
||||
* \author Simon Duquennoy <simonduq@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __PROJECT_CONF_H__
|
||||
#define __PROJECT_CONF_H__
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
/* Set to enable TSCH security */
|
||||
#ifndef WITH_SECURITY
|
||||
@ -78,4 +78,4 @@
|
||||
#define LOG_CONF_LEVEL_FRAMER LOG_LEVEL_DBG
|
||||
#define TSCH_LOG_CONF_PER_SLOT 1
|
||||
|
||||
#endif /* __PROJECT_CONF_H__ */
|
||||
#endif /* PROJECT_CONF_H_ */
|
||||
|
@ -28,8 +28,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __PROJECT_CONF_H__
|
||||
#define __PROJECT_CONF_H__
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
/* Set to enable TSCH security */
|
||||
#ifndef WITH_SECURITY
|
||||
@ -103,4 +103,4 @@
|
||||
#endif /* CONTIKI_TARGET_CC2538DK || CONTIKI_TARGET_ZOUL \
|
||||
|| CONTIKI_TARGET_OPENMOTE_CC2538 */
|
||||
|
||||
#endif /* __PROJECT_CONF_H__ */
|
||||
#endif /* PROJECT_CONF_H_ */
|
||||
|
@ -1,38 +0,0 @@
|
||||
CONTIKI_PROJECT = coap-example-server coap-example-client
|
||||
# use target "plugtest-server" explicitly when required
|
||||
|
||||
all: $(CONTIKI_PROJECT)
|
||||
|
||||
CONTIKI=../..
|
||||
|
||||
# Do not try to build on Sky because of code size limitation
|
||||
PLATFORMS_EXCLUDE = sky
|
||||
|
||||
# build RESTful resources
|
||||
include $(CONTIKI)/Makefile.identify-target
|
||||
ifeq ($(TARGET),native)
|
||||
MODULES_REL += ./resources-plugtest
|
||||
endif
|
||||
MODULES_REL += ./resources
|
||||
MODULES_REL += $(TARGET)
|
||||
|
||||
# Include the CoAP implementation
|
||||
MODULES += os/net/app-layer/coap
|
||||
|
||||
include $(CONTIKI)/Makefile.include
|
||||
|
||||
# border router rules
|
||||
$(CONTIKI)/tools/tunslip6: $(CONTIKI)/tools/tunslip6.c
|
||||
(cd $(CONTIKI)/tools && $(MAKE) tunslip6)
|
||||
|
||||
connect-router: $(CONTIKI)/tools/tunslip6
|
||||
sudo $(CONTIKI)/tools/tunslip6 fd00::1/64
|
||||
|
||||
connect-router-cooja: $(CONTIKI)/tools/tunslip6
|
||||
sudo $(CONTIKI)/tools/tunslip6 -a 127.0.0.1 -p 60001 fd00::1/64
|
||||
|
||||
connect-router-native: $(CONTIKI)/examples/rpl-border-router/border-router.native
|
||||
sudo $(CONTIKI)/examples/rpl-border-router/border-router.native -a 127.0.0.1 -p 60001 fd00::1/64
|
||||
|
||||
connect-native:
|
||||
sudo ip address add fdfd::1/64 dev tun0
|
@ -1,83 +1,9 @@
|
||||
A Quick Introduction to the Erbium (Er) CoAP Engine
|
||||
===================================================
|
||||
# CoAP examples: client, server, and plugtest server
|
||||
|
||||
EXAMPLE FILES
|
||||
-------------
|
||||
* coap-example-server: A CoAP server example showing how to use the CoAP layer to develop server-side applications.
|
||||
* coap-example-client: A CoAP client that polls the /actuators/toggle resource every 10 seconds and cycles through 4 resources on button press (target address is hard-coded).
|
||||
* coap-plugtest-server: The server used for draft compliance testing at ETSI IoT CoAP Plugtests. Erbium (Er) participated in Paris, France, March 2012 and Sophia-Antipolis, France, November 2012 (configured for native).
|
||||
|
||||
- coap-example-server.c: A CoAP server example showing how to use the CoAP
|
||||
layer to develop server-side applications.
|
||||
- coap-example-client.c: A CoAP client that polls the /actuators/toggle resource
|
||||
every 10 seconds and cycles through 4 resources on button press (target
|
||||
address is hard-coded).
|
||||
- plugtest-server.c: The server used for draft compliance testing at ETSI
|
||||
IoT CoAP Plugtests. Erbium (Er) participated in Paris, France, March 2012 and
|
||||
Sophia-Antipolis, France, November 2012 (configured for native).
|
||||
|
||||
PRELIMINARIES
|
||||
-------------
|
||||
|
||||
- Get the Copper (Cu) CoAP user-agent from
|
||||
[https://addons.mozilla.org/en-US/firefox/addon/copper-270430](https://addons.mozilla.org/en-US/firefox/addon/copper-270430)
|
||||
|
||||
TMOTE SKY HOWTO
|
||||
---------------
|
||||
|
||||
The CoAP example no longer fits in the limited ROM of the Tmote Sky.
|
||||
Please use a platform with larger ROM instead.
|
||||
|
||||
NATIVE HOWTO
|
||||
------------
|
||||
|
||||
With the target native you can test your CoAP applications without
|
||||
constraints, i.e., with large buffers, debug output, memory protection, etc.
|
||||
The plugtest-server is thought for the native platform, as it requires
|
||||
an 1280-byte IP buffer and 1024-byte blocks.
|
||||
|
||||
make TARGET=native plugtest-server
|
||||
sudo ./plugtest-server.native
|
||||
|
||||
Open new terminal
|
||||
|
||||
make connect-native
|
||||
|
||||
- Start Copper and discover resources at coap://[fdfd::ff:fe00:10]:5683/
|
||||
- You can enable the ETSI Plugtest menu in Copper's preferences
|
||||
|
||||
Under Windows/Cygwin, WPCAP might need a patch in
|
||||
<cygwin>\usr\include\w32api\in6addr.h:
|
||||
|
||||
21,23c21
|
||||
< #ifdef __INSIDE_CYGWIN__
|
||||
< uint32_t __s6_addr32[4];
|
||||
< #endif
|
||||
---
|
||||
> u_int __s6_addr32[4];
|
||||
36d33
|
||||
< #ifdef __INSIDE_CYGWIN__
|
||||
39d35
|
||||
< #endif
|
||||
|
||||
DETAILS
|
||||
-------
|
||||
|
||||
Erbium implements the Proposed Standard of CoAP. Central features are commented
|
||||
in coap-example-server.c. In general, coap supports:
|
||||
|
||||
- All draft-18 header options
|
||||
- CON Retransmissions (note COAP_MAX_OPEN_TRANSACTIONS)
|
||||
- Blockwise Transfers (note COAP_MAX_CHUNK_SIZE, see plugtest-server.c for
|
||||
Block1 uploads)
|
||||
- Separate Responses (no rest_set_pre_handler() required anymore, note
|
||||
coap_separate_accept(), _reject(), and _resume())
|
||||
- Resource Discovery
|
||||
- Observing Resources (see EVENT_ and PERIODIC_RESOURCE, note
|
||||
COAP_MAX_OBSERVERS)
|
||||
|
||||
TODOs
|
||||
-----
|
||||
|
||||
- Dedicated Observe buffers
|
||||
- Optimize message struct variable access (directly access struct without copying)
|
||||
- Observe client
|
||||
- Multiple If-Match ETags
|
||||
- (Message deduplication)
|
||||
The examples can run either on a real device or as native.
|
||||
In the latter case, just start the executable with enough permissions (e.g. sudo), and you will then be able to reach the node via tun.
|
||||
A tutorial for setting up the CoAP server example and querying it is provided on the wiki.
|
||||
|
12
examples/coap/coap-example-client/Makefile
Normal file
12
examples/coap/coap-example-client/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
CONTIKI_PROJECT = coap-example-client
|
||||
# coap-example-observe-client is outdated but will be ported at a later point
|
||||
all: $(CONTIKI_PROJECT)
|
||||
|
||||
# Do not try to build on Sky because of code size limitation
|
||||
PLATFORMS_EXCLUDE = sky
|
||||
|
||||
# Include the CoAP implementation
|
||||
MODULES += os/net/app-layer/coap
|
||||
|
||||
CONTIKI=../../..
|
||||
include $(CONTIKI)/Makefile.include
|
@ -51,8 +51,8 @@
|
||||
|
||||
/* Log configuration */
|
||||
#include "coap-log.h"
|
||||
#define LOG_MODULE "client"
|
||||
#define LOG_LEVEL LOG_LEVEL_COAP
|
||||
#define LOG_MODULE "App"
|
||||
#define LOG_LEVEL LOG_LEVEL_APP
|
||||
|
||||
/* FIXME: This server address is hard-coded for Cooja and link-local for unconnected border router. */
|
||||
#define SERVER_EP "coap://[fe80::212:7402:0002:0202]"
|
@ -47,15 +47,11 @@
|
||||
#else
|
||||
#include "dev/button-sensor.h"
|
||||
#endif
|
||||
/*----------------------------------------------------------------------------*/
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#define PRINTFLN(format, ...) printf(format "\n", ##__VA_ARGS__)
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#define PRINTFLN(...)
|
||||
#endif
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "App"
|
||||
#define LOG_LEVEL LOG_LEVEL_APP
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* FIXME: This server address is hard-coded for Cooja */
|
||||
@ -145,8 +141,6 @@ PROCESS_THREAD(er_example_observe_client, ev, data)
|
||||
|
||||
/* store server address in server_ipaddr */
|
||||
SERVER_NODE(server_ipaddr);
|
||||
/* receives all CoAP messages */
|
||||
coap_init_engine();
|
||||
/* init timer and button (if available) */
|
||||
etimer_set(&et, TOGGLE_INTERVAL * CLOCK_SECOND);
|
||||
#if PLATFORM_HAS_BUTTON
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -27,34 +27,21 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* A brief description of what this file is.
|
||||
* Erbium (Er) example project configuration.
|
||||
* \author
|
||||
* Adam Dunkels <adam@sics.se>
|
||||
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
|
||||
*/
|
||||
|
||||
#include "dev/leds.h"
|
||||
static leds_mask_t leds;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
leds_arch_init(void)
|
||||
{
|
||||
leds = 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
leds_mask_t
|
||||
leds_arch_get(void)
|
||||
{
|
||||
return leds;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
leds_arch_set(leds_mask_t l)
|
||||
{
|
||||
leds = l;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
#define LOG_LEVEL_APP LOG_LEVEL_DBG
|
||||
|
||||
/* Enable client-side support for COAP observe */
|
||||
#define COAP_OBSERVE_CLIENT 1
|
||||
|
||||
#endif /* PROJECT_CONF_H_ */
|
14
examples/coap/coap-example-server/Makefile
Normal file
14
examples/coap/coap-example-server/Makefile
Normal file
@ -0,0 +1,14 @@
|
||||
CONTIKI_PROJECT = coap-example-server
|
||||
all: $(CONTIKI_PROJECT)
|
||||
|
||||
# Do not try to build on Sky because of code size limitation
|
||||
PLATFORMS_EXCLUDE = sky
|
||||
|
||||
# Include the CoAP implementation
|
||||
MODULES += os/net/app-layer/coap
|
||||
|
||||
# Include CoAP resources
|
||||
MODULES_REL += ./resources
|
||||
|
||||
CONTIKI=../../..
|
||||
include $(CONTIKI)/Makefile.include
|
@ -48,14 +48,10 @@
|
||||
#include "dev/button-sensor.h"
|
||||
#endif
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#endif
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "App"
|
||||
#define LOG_LEVEL LOG_LEVEL_APP
|
||||
/*
|
||||
* Resources to be activated need to be imported through the extern keyword.
|
||||
* The build system automatically compiles the resources in the corresponding sub-directory.
|
||||
@ -84,17 +80,6 @@ extern coap_resource_t res_battery;
|
||||
#include "dev/temperature-sensor.h"
|
||||
extern coap_resource_t res_temperature;
|
||||
#endif
|
||||
/*
|
||||
extern coap_resource_t res_battery;
|
||||
#endif
|
||||
#if PLATFORM_HAS_RADIO
|
||||
extern coap_resource_t res_radio;
|
||||
#endif
|
||||
#if PLATFORM_HAS_SHT11
|
||||
#include "dev/sht11/sht11-sensor.h"
|
||||
extern coap_resource_t res_sht11;
|
||||
#endif
|
||||
*/
|
||||
|
||||
PROCESS(er_example_server, "Erbium Example Server");
|
||||
AUTOSTART_PROCESSES(&er_example_server);
|
||||
@ -105,28 +90,23 @@ PROCESS_THREAD(er_example_server, ev, data)
|
||||
|
||||
PROCESS_PAUSE();
|
||||
|
||||
PRINTF("Starting Erbium Example Server\n");
|
||||
|
||||
PRINTF("uIP buffer: %u\n", UIP_BUFSIZE);
|
||||
PRINTF("LL header: %u\n", UIP_LLH_LEN);
|
||||
PRINTF("IP+UDP header: %u\n", UIP_IPUDPH_LEN);
|
||||
PRINTF("CoAP max chunk: %u\n", COAP_MAX_CHUNK_SIZE);
|
||||
LOG_INFO("Starting Erbium Example Server\n");
|
||||
|
||||
/*
|
||||
* Bind the resources to their Uri-Path.
|
||||
* WARNING: Activating twice only means alternate path, not two instances!
|
||||
* All static variables are the same for each URI path.
|
||||
*/
|
||||
coap_activate_resource(&res_hello, "test/hello");
|
||||
coap_activate_resource(&res_mirror, "debug/mirror");
|
||||
coap_activate_resource(&res_chunks, "test/chunks");
|
||||
coap_activate_resource(&res_separate, "test/separate");
|
||||
coap_activate_resource(&res_push, "test/push");
|
||||
coap_activate_resource(&res_hello, "test/hello");
|
||||
coap_activate_resource(&res_mirror, "debug/mirror");
|
||||
coap_activate_resource(&res_chunks, "test/chunks");
|
||||
coap_activate_resource(&res_separate, "test/separate");
|
||||
coap_activate_resource(&res_push, "test/push");
|
||||
#if PLATFORM_HAS_BUTTON
|
||||
coap_activate_resource(&res_event, "sensors/button");
|
||||
coap_activate_resource(&res_event, "sensors/button");
|
||||
#endif /* PLATFORM_HAS_BUTTON */
|
||||
coap_activate_resource(&res_sub, "test/sub");
|
||||
coap_activate_resource(&res_b1_sep_b2, "test/b1sepb2");
|
||||
coap_activate_resource(&res_sub, "test/sub");
|
||||
coap_activate_resource(&res_b1_sep_b2, "test/b1sepb2");
|
||||
#if PLATFORM_HAS_LEDS
|
||||
/* coap_activate_resource(&res_leds, "actuators/leds"); */
|
||||
coap_activate_resource(&res_toggle, "actuators/toggle");
|
||||
@ -143,15 +123,6 @@ PROCESS_THREAD(er_example_server, ev, data)
|
||||
coap_activate_resource(&res_temperature, "sensors/temperature");
|
||||
SENSORS_ACTIVATE(temperature_sensor);
|
||||
#endif
|
||||
/*
|
||||
#if PLATFORM_HAS_RADIO
|
||||
coap_activate_resource(&res_radio, "sensors/radio");
|
||||
#endif
|
||||
#if PLATFORM_HAS_SHT11
|
||||
coap_activate_resource(&res_sht11, "sensors/sht11");
|
||||
SENSORS_ACTIVATE(sht11_sensor);
|
||||
#endif
|
||||
*/
|
||||
|
||||
/* Define application-specific events here. */
|
||||
while(1) {
|
||||
@ -162,7 +133,7 @@ PROCESS_THREAD(er_example_server, ev, data)
|
||||
#else
|
||||
if(ev == sensors_event && data == &button_sensor) {
|
||||
#endif
|
||||
PRINTF("*******BUTTON*******\n");
|
||||
LOG_DBG("*******BUTTON*******\n");
|
||||
|
||||
/* Call the event_handler for this application-specific event. */
|
||||
res_event.trigger();
|
@ -36,33 +36,9 @@
|
||||
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
|
||||
*/
|
||||
|
||||
#ifndef PROJECT_ERBIUM_CONF_H_
|
||||
#define PROJECT_ERBIUM_CONF_H_
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
/* IP buffer size must match all other hops, in particular the border router. */
|
||||
/* #define UIP_CONF_BUFFER_SIZE 256 */
|
||||
#define LOG_LEVEL_APP LOG_LEVEL_DBG
|
||||
|
||||
/* Increase rpl-border-router IP-buffer when using more than 64. */
|
||||
#define COAP_MAX_CHUNK_SIZE 48
|
||||
|
||||
/* Estimate your header size, especially when using Proxy-Uri. */
|
||||
/* #define COAP_MAX_HEADER_SIZE 70 */
|
||||
|
||||
/* Multiplies with chunk size, be aware of memory constraints. */
|
||||
#ifndef COAP_MAX_OPEN_TRANSACTIONS
|
||||
#define COAP_MAX_OPEN_TRANSACTIONS 4
|
||||
#endif /* COAP_MAX_OPEN_TRANSACTIONS */
|
||||
|
||||
/* Must be <= open transactions, default is COAP_MAX_OPEN_TRANSACTIONS-1. */
|
||||
/* #define COAP_MAX_OBSERVERS 2 */
|
||||
|
||||
/* Filtering .well-known/core per query can be disabled to save space. */
|
||||
#define COAP_LINK_FORMAT_FILTERING 0
|
||||
#define COAP_PROXY_OPTION_PROCESSING 0
|
||||
|
||||
/* Enable client-side support for COAP observe */
|
||||
#ifndef COAP_OBSERVE_CLIENT
|
||||
#define COAP_OBSERVE_CLIENT 1
|
||||
#endif /* COAP_OBSERVE_CLIENT */
|
||||
|
||||
#endif /* PROJECT_ERBIUM_CONF_H_ */
|
||||
#endif /* PROJECT_CONF_H_ */
|
@ -41,17 +41,10 @@
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15])
|
||||
#define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]", (lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3], (lladdr)->addr[4], (lladdr)->addr[5])
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#define PRINT6ADDR(addr)
|
||||
#define PRINTLLADDR(addr)
|
||||
#endif
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "App"
|
||||
#define LOG_LEVEL LOG_LEVEL_APP
|
||||
|
||||
static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
static void res_event_handler(void);
|
||||
@ -94,7 +87,7 @@ res_event_handler(void)
|
||||
|
||||
/* Usually a condition is defined under with subscribers are notified, e.g., event was above a threshold. */
|
||||
if(1) {
|
||||
PRINTF("TICK %u for /%s\n", event_counter, res_event.url);
|
||||
LOG_DBG("TICK %u for /%s\n", (unsigned)event_counter, res_event.url);
|
||||
|
||||
/* Notify the registered observers which will trigger the res_get_handler to create the response. */
|
||||
coap_notify_observers(&res_event);
|
@ -75,7 +75,9 @@ res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
memcpy(buffer, message, length);
|
||||
} else {
|
||||
memcpy(buffer, message, length);
|
||||
} coap_set_header_content_format(response, TEXT_PLAIN); /* text/plain is the default, hence this option could be omitted. */
|
||||
}
|
||||
|
||||
coap_set_header_content_format(response, TEXT_PLAIN); /* text/plain is the default, hence this option could be omitted. */
|
||||
coap_set_header_etag(response, (uint8_t *)&length, 1);
|
||||
coap_set_payload(response, buffer, length);
|
||||
}
|
@ -44,17 +44,10 @@
|
||||
|
||||
#if PLATFORM_HAS_LEDS || LEDS_COUNT
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15])
|
||||
#define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]", (lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3], (lladdr)->addr[4], (lladdr)->addr[5])
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#define PRINT6ADDR(addr)
|
||||
#define PRINTLLADDR(addr)
|
||||
#endif
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "App"
|
||||
#define LOG_LEVEL LOG_LEVEL_APP
|
||||
|
||||
static void res_post_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
|
||||
@ -76,7 +69,7 @@ res_post_put_handler(coap_message_t *request, coap_message_t *response, uint8_t
|
||||
int success = 1;
|
||||
|
||||
if((len = coap_get_query_variable(request, "color", &color))) {
|
||||
PRINTF("color %.*s\n", len, color);
|
||||
LOG_DBG("color %.*s\n", (int)len, color);
|
||||
|
||||
if(strncmp(color, "r", len) == 0) {
|
||||
led = LEDS_RED;
|
||||
@ -90,7 +83,7 @@ res_post_put_handler(coap_message_t *request, coap_message_t *response, uint8_t
|
||||
} else {
|
||||
success = 0;
|
||||
} if(success && (len = coap_get_post_variable(request, "mode", &mode))) {
|
||||
PRINTF("mode %s\n", mode);
|
||||
LOG_DBG("mode %s\n", mode);
|
||||
|
||||
if(strncmp(mode, "on", len) == 0) {
|
||||
leds_on(led);
|
@ -41,17 +41,10 @@
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15])
|
||||
#define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]", (lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3], (lladdr)->addr[4], (lladdr)->addr[5])
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#define PRINT6ADDR(addr)
|
||||
#define PRINTLLADDR(addr)
|
||||
#endif
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "App"
|
||||
#define LOG_LEVEL LOG_LEVEL_APP
|
||||
|
||||
static void res_any_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
|
||||
@ -158,7 +151,7 @@ res_any_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
}
|
||||
coap_set_payload(response, buffer, strpos);
|
||||
|
||||
PRINTF("/mirror options received: %s\n", buffer);
|
||||
LOG_DBG("/mirror options received: %s\n", buffer);
|
||||
|
||||
/* Set dummy header options for response. Like getters, some setters are not implemented for HTTP and have no effect. */
|
||||
coap_set_header_content_format(response, TEXT_PLAIN);
|
14
examples/coap/coap-plugtest-server/Makefile
Normal file
14
examples/coap/coap-plugtest-server/Makefile
Normal file
@ -0,0 +1,14 @@
|
||||
CONTIKI_PROJECT = coap-plugtest-server
|
||||
all: $(CONTIKI_PROJECT)
|
||||
|
||||
# Only intended for native
|
||||
PLATFORMS_ONLY = native
|
||||
|
||||
# Include the CoAP implementation
|
||||
MODULES += os/net/app-layer/coap
|
||||
|
||||
# Include CoAP resources
|
||||
MODULES_REL += ./resources
|
||||
|
||||
CONTIKI=../../..
|
||||
include $(CONTIKI)/Makefile.include
|
@ -45,7 +45,11 @@
|
||||
#include "coap-transactions.h"
|
||||
#include "coap-separate.h"
|
||||
#include "coap-engine.h"
|
||||
#include "plugtest.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
/*
|
||||
* Resources to be activated need to be imported through the extern keyword.
|
||||
@ -80,12 +84,7 @@ PROCESS_THREAD(plugtest_server, ev, data)
|
||||
{
|
||||
PROCESS_BEGIN();
|
||||
|
||||
PRINTF("ETSI IoT CoAP Plugtests Server\n");
|
||||
|
||||
PRINTF("uIP buffer: %u\n", UIP_BUFSIZE);
|
||||
PRINTF("LL header: %u\n", UIP_LLH_LEN);
|
||||
PRINTF("IP+UDP header: %u\n", UIP_IPUDPH_LEN);
|
||||
PRINTF("REST max chunk: %u\n", REST_MAX_CHUNK_SIZE);
|
||||
LOG_INFO("ETSI IoT CoAP Plugtests Server\n");
|
||||
|
||||
/* Activate the application-specific resources. */
|
||||
coap_activate_resource(&res_plugtest_test, "test");
|
@ -36,20 +36,10 @@
|
||||
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
|
||||
*/
|
||||
|
||||
#ifndef PLUGTEST_H_
|
||||
#define PLUGTEST_H_
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
#if !defined(CONTIKI_TARGET_NATIVE)
|
||||
#warning "Should only be compiled for native!"
|
||||
#endif
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#endif
|
||||
#define LOG_LEVEL_PLUGTEST LOG_LEVEL_DBG
|
||||
|
||||
/* double expansion */
|
||||
#define TO_STRING2(x) # x
|
||||
@ -59,4 +49,4 @@
|
||||
#define MAX_PLUGFEST_BODY 2048
|
||||
#define CHUNKS_TOTAL 2012
|
||||
|
||||
#endif /* PLUGTEST_H_ */
|
||||
#endif /* PROJECT_CONF_H_ */
|
171
examples/coap/coap-plugtest-server/resources/res-mirror.c
Normal file
171
examples/coap/coap-plugtest-server/resources/res-mirror.c
Normal file
@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Institute for Pervasive Computing, ETH Zurich
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 of the Institute 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 INSTITUTE 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 INSTITUTE 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.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Example resource
|
||||
* \author
|
||||
* Matthias Kovatsch <kovatsch@inf.ethz.ch>
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_any_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
|
||||
/* This resource mirrors the incoming request. It shows how to access the options and how to set them for the response. */
|
||||
RESOURCE(res_mirror,
|
||||
"title=\"Returns your decoded message\";rt=\"Debug\"",
|
||||
res_any_handler,
|
||||
res_any_handler,
|
||||
res_any_handler,
|
||||
res_any_handler);
|
||||
|
||||
static void
|
||||
res_any_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
||||
{
|
||||
/* The ETag and Token is copied to the header. */
|
||||
uint8_t opaque[] = { 0x0A, 0xBC, 0xDE };
|
||||
|
||||
/* Strings are not copied, so use static string buffers or strings in .text memory (char *str = "string in .text";). */
|
||||
static char location[] = { '/', 'f', '/', 'a', '?', 'k', '&', 'e', 0 };
|
||||
|
||||
/* No default my be assumed for the Content-Format. (Unsigned -1 means all bits set.) */
|
||||
unsigned int content_format = -1;
|
||||
|
||||
/* The other getters copy the value (or string/array pointer) to the given pointers and return 1 for success or the length of strings/arrays. */
|
||||
uint32_t longint = 0;
|
||||
const char *str = NULL;
|
||||
const uint8_t *bytes = NULL;
|
||||
uint32_t block_num = 0;
|
||||
uint8_t block_more = 0;
|
||||
uint16_t block_size = 0;
|
||||
int len = 0;
|
||||
|
||||
/* Mirror the received header options in the response payload. Unsupported getters (e.g., rest_get_header_observe() with HTTP) will return 0. */
|
||||
|
||||
int strpos = 0;
|
||||
/* snprintf() counts the terminating '\0' to the size parameter.
|
||||
* The additional byte is taken care of by allocating REST_MAX_CHUNK_SIZE+1 bytes in the REST framework.
|
||||
* Add +1 to fill the complete buffer, as the payload does not need a terminating '\0'. */
|
||||
if(coap_get_header_content_format(request, &content_format)) {
|
||||
strpos += snprintf((char *)buffer, REST_MAX_CHUNK_SIZE + 1, "CF %u\n", content_format);
|
||||
}
|
||||
if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_accept(request, &content_format))) {
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "Ac %u\n", content_format);
|
||||
/* Some getters such as for ETag or Location are omitted, as these options should not appear in a request.
|
||||
* Max-Age might appear in HTTP requests or used for special purposes in CoAP. */
|
||||
}
|
||||
if(strpos <= REST_MAX_CHUNK_SIZE && coap_get_header_max_age(request, &longint)) {
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "MA %lu\n", (unsigned long) longint);
|
||||
/* For HTTP this is the Length option, for CoAP it is the Size option. */
|
||||
}
|
||||
if(strpos <= REST_MAX_CHUNK_SIZE && coap_get_header_size1(request, &longint)) {
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "SZ %lu\n", (unsigned long) longint);
|
||||
}
|
||||
if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_uri_host(request, &str))) {
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "UH %.*s\n", len, str);
|
||||
}
|
||||
if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_uri_path(request, &str))) {
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "UP %.*s\n", len, str);
|
||||
}
|
||||
if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_uri_query(request, &str))) {
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "UQ %.*s\n", len, str);
|
||||
/* Undefined request options for debugging: actions not required for normal RESTful Web service. */
|
||||
}
|
||||
if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_location_path(request, &str))) {
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "LP %.*s\n", len, str);
|
||||
}
|
||||
if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_header_location_query(request, &str))) {
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "LQ %.*s\n", len, str);
|
||||
/* CoAP-specific example: actions not required for normal RESTful Web service. */
|
||||
}
|
||||
coap_message_t *const coap_pkt = (coap_message_t *)request;
|
||||
|
||||
if(strpos <= REST_MAX_CHUNK_SIZE && coap_pkt->token_len > 0) {
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "To 0x");
|
||||
int index = 0;
|
||||
for(index = 0; index < coap_pkt->token_len; ++index) {
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "%02X", coap_pkt->token[index]);
|
||||
}
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "\n");
|
||||
}
|
||||
|
||||
if(strpos <= REST_MAX_CHUNK_SIZE && coap_is_option(coap_pkt, COAP_OPTION_OBSERVE)) {
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "Ob %lu\n", (unsigned long) coap_pkt->observe);
|
||||
}
|
||||
if(strpos <= REST_MAX_CHUNK_SIZE && coap_is_option(coap_pkt, COAP_OPTION_ETAG)) {
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "ET 0x");
|
||||
int index = 0;
|
||||
for(index = 0; index < coap_pkt->etag_len; ++index) {
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "%02X", coap_pkt->etag[index]);
|
||||
}
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "\n");
|
||||
}
|
||||
if(strpos <= REST_MAX_CHUNK_SIZE && coap_get_header_block2(request, &block_num, &block_more, &block_size, NULL)) { /* This getter allows NULL pointers to get only a subset of the block parameters. */
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "B2 %lu%s (%u)\n", (unsigned long) block_num, block_more ? "+" : "", block_size);
|
||||
}
|
||||
if(strpos <= REST_MAX_CHUNK_SIZE && coap_get_header_block1(request, &block_num, &block_more, &block_size, NULL)) {
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "B1 %lu%s (%u)\n", (unsigned long) block_num, block_more ? "+" : "", block_size);
|
||||
}
|
||||
if(strpos <= REST_MAX_CHUNK_SIZE && (len = coap_get_payload(request, &bytes))) {
|
||||
strpos += snprintf((char *)buffer + strpos, REST_MAX_CHUNK_SIZE - strpos + 1, "%.*s", len, bytes);
|
||||
}
|
||||
if(strpos >= REST_MAX_CHUNK_SIZE) {
|
||||
buffer[REST_MAX_CHUNK_SIZE - 1] = 0xBB; /* '»' to indicate truncation */
|
||||
}
|
||||
coap_set_payload(response, buffer, strpos);
|
||||
|
||||
LOG_DBG("/mirror options received: %s\n", buffer);
|
||||
|
||||
/* Set dummy header options for response. Like getters, some setters are not implemented for HTTP and have no effect. */
|
||||
coap_set_header_content_format(response, TEXT_PLAIN);
|
||||
coap_set_header_max_age(response, 17); /* For HTTP, browsers will not re-request the page for 17 seconds. */
|
||||
coap_set_header_etag(response, opaque, 2);
|
||||
coap_set_header_location_path(response, location); /* Initial slash is omitted by framework */
|
||||
coap_set_header_size1(response, strpos); /* For HTTP, browsers will not re-request the page for 10 s. CoAP action depends on the client. */
|
||||
|
||||
/* CoAP-specific example: actions not required for normal RESTful Web service. */
|
||||
coap_set_header_uri_host(response, "tiki");
|
||||
coap_set_header_observe(response, 10);
|
||||
coap_set_header_proxy_uri(response, "ftp://x");
|
||||
coap_set_header_block2(response, 42, 0, 64); /* The block option might be overwritten by the framework when blockwise transfer is requested. */
|
||||
coap_set_header_block1(response, 23, 0, 16);
|
||||
coap_set_header_accept(response, TEXT_PLAIN);
|
||||
coap_set_header_if_none_match(response);
|
||||
}
|
@ -39,7 +39,11 @@
|
||||
#include <string.h>
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
#include "plugtest.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
static void res_delete_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
@ -56,7 +60,7 @@ static uint8_t create1_exists = 0;
|
||||
static void
|
||||
res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
||||
{
|
||||
PRINTF("/create1 PUT");
|
||||
LOG_DBG("/create1 PUT");
|
||||
|
||||
if(coap_get_header_if_none_match(request)) {
|
||||
if(!create1_exists) {
|
||||
@ -73,7 +77,7 @@ res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
static void
|
||||
res_delete_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
||||
{
|
||||
PRINTF("/create1 DELETE ");
|
||||
LOG_DBG("/create1 DELETE ");
|
||||
coap_set_status_code(response, DELETED_2_02);
|
||||
|
||||
create1_exists = 0;
|
@ -39,7 +39,11 @@
|
||||
#include <string.h>
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
#include "plugtest.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
|
||||
@ -53,7 +57,7 @@ RESOURCE(res_plugtest_create2,
|
||||
static void
|
||||
res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
||||
{
|
||||
PRINTF("/create2 ");
|
||||
LOG_DBG("/create2 ");
|
||||
|
||||
coap_set_status_code(response, CREATED_2_01);
|
||||
coap_set_header_location_path(response, "/location1/location2/location3");
|
@ -39,7 +39,11 @@
|
||||
#include <string.h>
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
#include "plugtest.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
static void res_delete_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
@ -56,7 +60,7 @@ static uint8_t create3_exists = 0;
|
||||
static void
|
||||
res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
||||
{
|
||||
PRINTF("/create3 PUT ");
|
||||
LOG_DBG("/create3 PUT ");
|
||||
|
||||
if(coap_get_header_if_none_match(request)) {
|
||||
if(!create3_exists) {
|
||||
@ -73,7 +77,7 @@ res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
static void
|
||||
res_delete_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
||||
{
|
||||
PRINTF("/create3 DELETE ");
|
||||
LOG_DBG("/create3 DELETE ");
|
||||
coap_set_status_code(response, DELETED_2_02);
|
||||
|
||||
create3_exists = 0;
|
@ -39,7 +39,11 @@
|
||||
#include <string.h>
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
#include "plugtest.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
|
@ -41,7 +41,11 @@
|
||||
#include "sys/cc.h"
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
#include "plugtest.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
static void res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
@ -40,7 +40,11 @@
|
||||
#include <string.h>
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
#include "plugtest.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
|
@ -39,7 +39,11 @@
|
||||
#include <string.h>
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
#include "plugtest.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
|
@ -39,7 +39,11 @@
|
||||
#include <string.h>
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
#include "plugtest.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
|
||||
@ -53,11 +57,9 @@ RESOURCE(res_plugtest_locquery,
|
||||
static void
|
||||
res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
||||
{
|
||||
#if DEBUG
|
||||
coap_message_t *const coap_req = (coap_message_t *)request;
|
||||
#endif
|
||||
|
||||
PRINTF(
|
||||
LOG_DBG(
|
||||
"/location-query POST (%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
|
||||
coap_set_status_code(response, CREATED_2_01);
|
@ -41,7 +41,11 @@
|
||||
#include <string.h>
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
#include "plugtest.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
|
||||
@ -57,7 +61,7 @@ res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
{
|
||||
coap_message_t *const coap_req = (coap_message_t *)request;
|
||||
|
||||
PRINTF("/seg1/seg2/seg3 GET ");
|
||||
LOG_DBG("/seg1/seg2/seg3 GET ");
|
||||
/* Code 2.05 CONTENT is default. */
|
||||
coap_set_header_content_format(response, TEXT_PLAIN);
|
||||
coap_set_payload(
|
||||
@ -66,5 +70,5 @@ res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
snprintf((char *)buffer, MAX_PLUGFEST_PAYLOAD,
|
||||
"Type: %u\nCode: %u\nMID: %u", coap_req->type, coap_req->code, coap_req->mid));
|
||||
|
||||
PRINTF("(%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
LOG_DBG_("(%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
}
|
@ -40,7 +40,11 @@
|
||||
#include <string.h>
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
#include "plugtest.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
|
||||
@ -59,7 +63,7 @@ res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
unsigned int accept = -1;
|
||||
coap_get_header_accept(request, &accept);
|
||||
|
||||
PRINTF("/multi-format GET (%s %u) ", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
LOG_DBG("/multi-format GET (%s %u) ", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
|
||||
if(accept == -1 || accept == TEXT_PLAIN) {
|
||||
coap_set_header_content_format(response, TEXT_PLAIN);
|
||||
@ -69,7 +73,7 @@ res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
snprintf((char *)buffer, MAX_PLUGFEST_PAYLOAD,
|
||||
"Type: %u\nCode: %u\nMID: %u%s", coap_req->type, coap_req->code,
|
||||
coap_req->mid, accept != -1 ? "\nAccept: 0" : ""));
|
||||
PRINTF("PLAIN\n");
|
||||
LOG_DBG_("PLAIN\n");
|
||||
} else if(accept == APPLICATION_XML) {
|
||||
coap_set_header_content_format(response, APPLICATION_XML);
|
||||
coap_set_payload(
|
||||
@ -78,11 +82,11 @@ res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
snprintf((char *)buffer, MAX_PLUGFEST_PAYLOAD,
|
||||
"<status type=\"%u\" code=\"%u\" mid=\"%u\" accept=\"%u\"/>",
|
||||
coap_req->type, coap_req->code, coap_req->mid, accept));
|
||||
PRINTF("XML\n");
|
||||
LOG_DBG_("XML\n");
|
||||
} else {
|
||||
coap_set_status_code(response, NOT_ACCEPTABLE_4_06);
|
||||
const char *msg = "Supporting content-types text/plain and application/xml";
|
||||
coap_set_payload(response, msg, strlen(msg));
|
||||
PRINTF("ERROR\n");
|
||||
LOG_DBG_("ERROR\n");
|
||||
}
|
||||
}
|
@ -41,7 +41,11 @@
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
#include "coap-observe.h"
|
||||
#include "plugtest.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
static void res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
@ -67,7 +71,7 @@ static char obs_status = 0;
|
||||
static void
|
||||
obs_purge_list()
|
||||
{
|
||||
PRINTF("### SERVER ACTION ### Purging obs list");
|
||||
LOG_DBG("### SERVER ACTION ### Purging obs list\n");
|
||||
coap_remove_observer_by_uri(NULL, res_plugtest_obs.url);
|
||||
}
|
||||
static void
|
||||
@ -75,7 +79,7 @@ res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
{
|
||||
/* Keep server log clean from ticking events */
|
||||
if(request != NULL) {
|
||||
PRINTF("/obs GET\n");
|
||||
LOG_DBG("/obs GET\n");
|
||||
}
|
||||
coap_set_header_content_format(response, obs_format);
|
||||
coap_set_header_max_age(response, 5);
|
||||
@ -98,7 +102,7 @@ res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
|
||||
coap_get_header_content_format(request, &ct);
|
||||
|
||||
PRINTF("/obs PUT\n");
|
||||
LOG_DBG("/obs PUT\n");
|
||||
|
||||
if(ct != obs_format) {
|
||||
obs_status = 1;
|
||||
@ -115,7 +119,7 @@ res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
static void
|
||||
res_delete_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
||||
{
|
||||
PRINTF("/obs DELETE\n");
|
||||
LOG_DBG("/obs DELETE\n");
|
||||
|
||||
obs_status = 2;
|
||||
|
||||
@ -130,14 +134,12 @@ res_periodic_handler()
|
||||
{
|
||||
++obs_counter;
|
||||
|
||||
/* PRINTF("TICK %u for /%s\n", obs_counter, r->url); */
|
||||
|
||||
if(obs_status == 1) {
|
||||
|
||||
/* Notify the registered observers with the given message type, observe option, and payload. */
|
||||
coap_notify_observers(&res_plugtest_obs);
|
||||
|
||||
PRINTF("######### sending 5.00\n");
|
||||
LOG_DBG("######### sending 5.00\n");
|
||||
|
||||
obs_purge_list();
|
||||
} else if(obs_status == 2) {
|
@ -40,7 +40,11 @@
|
||||
#include <string.h>
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
#include "plugtest.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
|
@ -40,7 +40,11 @@
|
||||
#include <string.h>
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
#include "plugtest.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
|
||||
@ -58,11 +62,11 @@ res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
int len = 0;
|
||||
const char *query = NULL;
|
||||
|
||||
PRINTF(
|
||||
LOG_DBG(
|
||||
"/query GET (%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
|
||||
if((len = coap_get_header_uri_query(request, &query))) {
|
||||
PRINTF("Query: %.*s\n", len, query);
|
||||
LOG_DBG("Query: %.*s\n", len, query);
|
||||
/* Code 2.05 CONTENT is default. */
|
||||
}
|
||||
coap_set_header_content_format(response,
|
@ -42,7 +42,11 @@
|
||||
#include "coap.h"
|
||||
#include "coap-transactions.h"
|
||||
#include "coap-separate.h"
|
||||
#include "plugtest.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
static void res_resume_handler(void);
|
||||
@ -72,12 +76,12 @@ res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
{
|
||||
coap_message_t *const coap_req = (coap_message_t *)request;
|
||||
|
||||
PRINTF("/separate ");
|
||||
LOG_DBG("/separate ");
|
||||
if(separate_active) {
|
||||
PRINTF("REJECTED ");
|
||||
LOG_DBG_("REJECTED ");
|
||||
coap_separate_reject();
|
||||
} else {
|
||||
PRINTF("STORED ");
|
||||
LOG_DBG_("STORED ");
|
||||
separate_active = 1;
|
||||
|
||||
/* Take over and skip response by engine. */
|
||||
@ -89,17 +93,17 @@ res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
coap_req->mid);
|
||||
}
|
||||
|
||||
PRINTF("(%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
LOG_DBG_("(%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
}
|
||||
static void
|
||||
res_resume_handler()
|
||||
{
|
||||
if(separate_active) {
|
||||
PRINTF("/separate ");
|
||||
LOG_DBG("/separate ");
|
||||
coap_transaction_t *transaction = NULL;
|
||||
if((transaction = coap_new_transaction(separate_store->request_metadata.mid,
|
||||
&separate_store->request_metadata.endpoint))) {
|
||||
PRINTF(
|
||||
LOG_DBG_(
|
||||
"RESPONSE (%s %u)\n", separate_store->request_metadata.type == COAP_TYPE_CON ? "CON" : "NON", separate_store->request_metadata.mid);
|
||||
|
||||
coap_message_t response[1]; /* This way the message can be treated as pointer as usual. */
|
||||
@ -127,7 +131,7 @@ res_resume_handler()
|
||||
|
||||
separate_active = 0;
|
||||
} else {
|
||||
PRINTF("ERROR (transaction)\n");
|
||||
LOG_DBG_("ERROR (transaction)\n");
|
||||
}
|
||||
} /* if (separate_active) */
|
||||
}
|
@ -40,9 +40,13 @@
|
||||
#include <string.h>
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
#include "plugtest.h"
|
||||
#include "random.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
static void res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
static void res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
@ -68,7 +72,7 @@ test_update_etag()
|
||||
}
|
||||
test_change = 0;
|
||||
|
||||
PRINTF("### SERVER ACTION ### Changed ETag %u [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n", test_etag_len, test_etag[0], test_etag[1], test_etag[2], test_etag[3], test_etag[4], test_etag[5], test_etag[6], test_etag[7]);
|
||||
LOG_DBG("### SERVER ACTION ### Changed ETag %u [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n", test_etag_len, test_etag[0], test_etag[1], test_etag[2], test_etag[3], test_etag[4], test_etag[5], test_etag[6], test_etag[7]);
|
||||
}
|
||||
static void
|
||||
res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
||||
@ -78,17 +82,17 @@ res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
if(test_change) {
|
||||
test_update_etag();
|
||||
}
|
||||
PRINTF("/test GET (%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
LOG_DBG("/test GET (%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
|
||||
if((len = coap_get_header_etag(request, &bytes)) > 0
|
||||
&& len == test_etag_len
|
||||
&& memcmp(test_etag, bytes, len) == 0) {
|
||||
PRINTF("validate ");
|
||||
LOG_DBG("validate\n");
|
||||
coap_set_status_code(response, VALID_2_03);
|
||||
coap_set_header_etag(response, test_etag, test_etag_len);
|
||||
|
||||
test_change = 1;
|
||||
PRINTF("### SERVER ACTION ### Resource will change\n");
|
||||
LOG_DBG("### SERVER ACTION ### Resource will change\n");
|
||||
} else {
|
||||
/* Code 2.05 CONTENT is default. */
|
||||
coap_set_header_content_format(response, TEXT_PLAIN);
|
||||
@ -103,32 +107,28 @@ res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
static void
|
||||
res_post_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
||||
{
|
||||
#if DEBUG
|
||||
coap_message_t *const coap_req = (coap_message_t *)request;
|
||||
PRINTF("/test POST (%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
#endif
|
||||
coap_message_t *const coap_req = (coap_message_t *)request;
|
||||
LOG_DBG("/test POST (%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
coap_set_status_code(response, CREATED_2_01);
|
||||
coap_set_header_location_path(response, "/location1/location2/location3");
|
||||
}
|
||||
static void
|
||||
res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
||||
{
|
||||
#if DEBUG
|
||||
coap_message_t *const coap_req = (coap_message_t *)request;
|
||||
PRINTF("/test PUT (%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
#endif
|
||||
LOG_DBG("/test PUT (%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
|
||||
if(coap_get_header_if_none_match(request)) {
|
||||
if(test_none_match_okay) {
|
||||
coap_set_status_code(response, CREATED_2_01);
|
||||
|
||||
test_none_match_okay = 0;
|
||||
PRINTF("### SERVER ACTION ### If-None-Match will FAIL\n");
|
||||
LOG_DBG("### SERVER ACTION ### If-None-Match will FAIL\n");
|
||||
} else {
|
||||
coap_set_status_code(response, PRECONDITION_FAILED_4_12);
|
||||
|
||||
test_none_match_okay = 1;
|
||||
PRINTF("### SERVER ACTION ### If-None-Match will SUCCEED\n");
|
||||
LOG_DBG("### SERVER ACTION ### If-None-Match will SUCCEED\n");
|
||||
}
|
||||
} else if(((len = coap_get_header_if_match(request, &bytes)) > 0
|
||||
&& (len == test_etag_len
|
||||
@ -141,12 +141,12 @@ res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
|
||||
if(len > 0) {
|
||||
test_change = 1;
|
||||
PRINTF("### SERVER ACTION ### Resource will change\n");
|
||||
LOG_DBG("### SERVER ACTION ### Resource will change\n");
|
||||
}
|
||||
} else {
|
||||
PRINTF("Check %u/%u\n [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n",
|
||||
len,
|
||||
test_etag_len,
|
||||
LOG_DBG("Check %u/%u\n [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n",
|
||||
(unsigned)len,
|
||||
(unsigned)test_etag_len,
|
||||
bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7],
|
||||
test_etag[0], test_etag[1], test_etag[2], test_etag[3], test_etag[4], test_etag[5], test_etag[6], test_etag[7]);
|
||||
|
||||
@ -156,9 +156,7 @@ res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
static void
|
||||
res_delete_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
||||
{
|
||||
#if DEBUG
|
||||
coap_message_t *const coap_req = (coap_message_t *)request;
|
||||
PRINTF("/test DELETE (%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
#endif
|
||||
LOG_DBG("/test DELETE (%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
coap_set_status_code(response, DELETED_2_02);
|
||||
}
|
@ -40,9 +40,13 @@
|
||||
#include <string.h>
|
||||
#include "coap-engine.h"
|
||||
#include "coap.h"
|
||||
#include "plugtest.h"
|
||||
#include "random.h"
|
||||
|
||||
/* Log configuration */
|
||||
#include "sys/log.h"
|
||||
#define LOG_MODULE "Plugtest"
|
||||
#define LOG_LEVEL LOG_LEVEL_PLUGTEST
|
||||
|
||||
static void res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
static void res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset);
|
||||
|
||||
@ -70,7 +74,7 @@ validate_update_etag()
|
||||
}
|
||||
validate_change = 0;
|
||||
|
||||
PRINTF("### SERVER ACTION ### Changed ETag %u [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n",
|
||||
LOG_DBG("### SERVER ACTION ### Changed ETag %u [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n",
|
||||
validate_etag_len, validate_etag[0], validate_etag[1], validate_etag[2], validate_etag[3], validate_etag[4], validate_etag[5], validate_etag[6], validate_etag[7]);
|
||||
}
|
||||
static void
|
||||
@ -81,17 +85,17 @@ res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
if(validate_change) {
|
||||
validate_update_etag();
|
||||
}
|
||||
PRINTF("/validate GET");
|
||||
PRINTF("(%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
LOG_DBG("/validate GET");
|
||||
LOG_DBG_("(%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
|
||||
if((len = coap_get_header_etag(request, &bytes)) > 0
|
||||
&& len == validate_etag_len && memcmp(validate_etag, bytes, len) == 0) {
|
||||
PRINTF("validate ");
|
||||
LOG_DBG("validate\n");
|
||||
coap_set_status_code(response, VALID_2_03);
|
||||
coap_set_header_etag(response, validate_etag, validate_etag_len);
|
||||
|
||||
validate_change = 1;
|
||||
PRINTF("### SERVER ACTION ### Resouce will change\n");
|
||||
LOG_DBG("### SERVER ACTION ### Resouce will change\n");
|
||||
} else {
|
||||
/* Code 2.05 CONTENT is default. */
|
||||
coap_set_header_content_format(response, TEXT_PLAIN);
|
||||
@ -108,12 +112,10 @@ res_get_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
static void
|
||||
res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
||||
{
|
||||
#if DEBUG
|
||||
coap_message_t *const coap_req = (coap_message_t *)request;
|
||||
#endif
|
||||
|
||||
PRINTF("/validate PUT ");
|
||||
PRINTF("(%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
LOG_DBG("/validate PUT ");
|
||||
LOG_DBG_("(%s %u)\n", coap_req->type == COAP_TYPE_CON ? "CON" : "NON", coap_req->mid);
|
||||
|
||||
if(((len = coap_get_header_if_match(request, &bytes)) > 0
|
||||
&& (len == validate_etag_len
|
||||
@ -126,13 +128,13 @@ res_put_handler(coap_message_t *request, coap_message_t *response, uint8_t *buff
|
||||
|
||||
if(len > 0) {
|
||||
validate_change = 1;
|
||||
PRINTF("### SERVER ACTION ### Resouce will change\n");
|
||||
LOG_DBG("### SERVER ACTION ### Resouce will change\n");
|
||||
}
|
||||
} else {
|
||||
PRINTF(
|
||||
"Check %u/%u\n [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n [0x%02X%02X%02X%02X%02X%02X%02X%02X] ",
|
||||
len,
|
||||
validate_etag_len,
|
||||
LOG_DBG(
|
||||
"Check %u/%u\n [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n [0x%02X%02X%02X%02X%02X%02X%02X%02X]\n",
|
||||
(unsigned)len,
|
||||
(unsigned)validate_etag_len,
|
||||
bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7],
|
||||
validate_etag[0], validate_etag[1], validate_etag[2], validate_etag[3], validate_etag[4], validate_etag[5], validate_etag[6], validate_etag[7]);
|
||||
|
@ -3,6 +3,6 @@ CONTIKI = ../../..
|
||||
|
||||
all: $(CONTIKI_PROJECT)
|
||||
|
||||
PLATFORMS_ONLY = srf06-cc26xx cc2538dk openmote-cc2538 zoul
|
||||
PLATFORMS_ONLY = srf06-cc26xx cc2538dk openmote-cc2538 zoul native
|
||||
|
||||
include $(CONTIKI)/Makefile.include
|
||||
|
@ -47,10 +47,13 @@ PROCESS_THREAD(button_hal_example, ev, data)
|
||||
|
||||
printf("Button HAL example.\n");
|
||||
printf("Device button count: %u.\n", button_hal_button_count);
|
||||
printf("%s on pin %u with ID=0, Logic=%s, Pull=%s\n",
|
||||
BUTTON_HAL_GET_DESCRIPTION(btn), btn->pin,
|
||||
btn->negative_logic ? "Negative" : "Positive",
|
||||
btn->pull == GPIO_HAL_PIN_CFG_PULL_UP ? "Pull Up" : "Pull Down");
|
||||
|
||||
if(btn) {
|
||||
printf("%s on pin %u with ID=0, Logic=%s, Pull=%s\n",
|
||||
BUTTON_HAL_GET_DESCRIPTION(btn), btn->pin,
|
||||
btn->negative_logic ? "Negative" : "Positive",
|
||||
btn->pull == GPIO_HAL_PIN_CFG_PULL_UP ? "Pull Up" : "Pull Down");
|
||||
}
|
||||
|
||||
while(1) {
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
CONTIKI_PROJECT = gpio-hal-example
|
||||
CONTIKI = ../../..
|
||||
|
||||
PLATFORMS_ONLY = srf06-cc26xx cc2538dk openmote-cc2538 zoul
|
||||
PLATFORMS_ONLY = srf06-cc26xx cc2538dk openmote-cc2538 zoul native
|
||||
|
||||
include $(CONTIKI)/Makefile.identify-target
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "dev/button-hal.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
/*---------------------------------------------------------------------------*/
|
||||
extern gpio_hal_pin_t out_pin1, out_pin2, out_pin3;
|
||||
extern gpio_hal_pin_t btn_pin;
|
||||
@ -43,6 +44,13 @@ extern gpio_hal_pin_t btn_pin;
|
||||
static struct etimer et;
|
||||
static uint8_t counter;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Print gpio_hal_pin_mask_t using the correct format */
|
||||
#if GPIO_HAL_PIN_COUNT > 32
|
||||
#define PIN_MASK_FMT PRIx64
|
||||
#else
|
||||
#define PIN_MASK_FMT PRIx32
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(gpio_hal_example, "GPIO HAL Example");
|
||||
AUTOSTART_PROCESSES(&gpio_hal_example);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
@ -119,7 +127,8 @@ PROCESS_THREAD(gpio_hal_example, ev, data)
|
||||
}
|
||||
|
||||
/* Test read */
|
||||
printf("%u: Pins are 1-%u, 2=%u, 3=%u, mask=0x%08lx\n", counter & 7,
|
||||
printf("%u: Pins are 1-%u, 2=%u, 3=%u, mask=0x%08" PIN_MASK_FMT "\n",
|
||||
counter & 7,
|
||||
gpio_hal_arch_read_pin(out_pin1),
|
||||
gpio_hal_arch_read_pin(out_pin2),
|
||||
gpio_hal_arch_read_pin(out_pin3),
|
||||
|
40
examples/dev/gpio-hal/native/pins.c
Normal file
40
examples/dev/gpio-hal/native/pins.c
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2018, George Oikonomou - http://www.spd.gr
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 of the copyright holder 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 HOLDER 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.
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#include "contiki.h"
|
||||
#include "dev/gpio-hal.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
gpio_hal_pin_t out_pin1 = 0;
|
||||
gpio_hal_pin_t out_pin2 = 1;
|
||||
gpio_hal_pin_t out_pin3 = 2;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
gpio_hal_pin_t btn_pin = 4;
|
||||
/*---------------------------------------------------------------------------*/
|
@ -1,48 +0,0 @@
|
||||
IPSO Objects Example
|
||||
============================================
|
||||
|
||||
This is an example of how to make use of the IPSO Object and LWM2M
|
||||
implementation in Contiki.
|
||||
|
||||
The LWM2M implementation is based on the Erbium CoAP implementation
|
||||
and consists of two apps: lwm2m-engine and ipso-objects. The
|
||||
lwm2m-engine handle the specifics of LWM2M including bootstrapping and
|
||||
how read/writes of objects and resources are handled. The ipso-objects
|
||||
contains implementations of some of the IPSO Smart Objects.
|
||||
|
||||
The implementation was used during the IPSO Interop in May 2015,
|
||||
Kista, Sweden, and was successfully tested with other
|
||||
implementations.
|
||||
|
||||
The examples use some of the basic IPSO object for controlling LEDs on
|
||||
Contiki devices and for reading out temperature.
|
||||
|
||||
##Testing IPSO-objects with Leshan
|
||||
|
||||
First program a device with the examples/ipso-objects/example-ipso-objects.c
|
||||
|
||||
```bash
|
||||
>make example-ipso-objects.upload TARGET=zoul
|
||||
>...
|
||||
```
|
||||
|
||||
After that start up a native-border router or other border router on fd00::1/64
|
||||
or another prefix - NOTE: if you use another prefix you will need to change LWM2M_SERVER_ADDRESS for which the device will register - in project-conf.h:
|
||||
```
|
||||
#define LWM2M_SERVER_ADDRESS "fd00::1"
|
||||
```
|
||||
|
||||
Then when everything is setup you can download a Leshan and use that to
|
||||
test controlling LEDs of the device.
|
||||
|
||||
###Starting Leshan
|
||||
```bash
|
||||
wget https://hudson.eclipse.org/leshan/job/leshan/lastSuccessfulBuild/artifact/leshan-standalone.jar
|
||||
java -jar ./leshan-standalone.jar
|
||||
```
|
||||
Browse to leshans device page with http://127.0.0.1:8080 .
|
||||
|
||||
When you have started the border-router and also Leshan you should now
|
||||
start (or reboot) your IPSO Object enabled device. Within 30 seconds
|
||||
you should be able to see it on the Leshan device page.
|
||||
|
@ -1,5 +1,5 @@
|
||||
CONTIKI_PROJECT = ipv6-hooks
|
||||
all: $(CONTIKI_PROJECT)
|
||||
|
||||
CONTIKI=../..
|
||||
CONTIKI=../../..
|
||||
include $(CONTIKI)/Makefile.include
|
@ -36,9 +36,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __PROJECT_CONF_H__
|
||||
#define __PROJECT_CONF_H__
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
#define STACK_CHECK_CONF_ENABLED 1
|
||||
|
||||
#endif /* __PROJECT_CONF_H__ */
|
||||
#endif /* PROJECT_CONF_H_ */
|
||||
|
10
examples/lwm2m-ipso-objects/README.md
Normal file
10
examples/lwm2m-ipso-objects/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
LWM2M with IPSO Objects Example
|
||||
============================================
|
||||
|
||||
This is an OMA LWM2M example implementing IPSO Objects.
|
||||
It can connect to a Leshan server out-of-the-box.
|
||||
Important configuration paramters:
|
||||
* `LWM2M_SERVER_ADDRESS`: the address of the server to register to (or bosstrap from)
|
||||
* `REGISTER_WITH_LWM2M_BOOTSTRAP_SERVER`: set to bootstrap via `LWM2M_SERVER_ADDRESS` and then obtain the registration server address
|
||||
|
||||
A tutorial for setting up this example is provided on the wiki.
|
@ -8,6 +8,6 @@ CONTIKI = ../..
|
||||
|
||||
MODULES_REL += arch/platform/$(TARGET)
|
||||
|
||||
PLATFORMS_ONLY = srf06-cc26xx cc2538dk openmote-cc2538 zoul
|
||||
PLATFORMS_ONLY = srf06-cc26xx cc2538dk openmote-cc2538 zoul native
|
||||
|
||||
include $(CONTIKI)/Makefile.include
|
||||
|
@ -6,7 +6,7 @@ can be exchanged using BLE connections (IPv6 over BLE).
|
||||
This Contiki extenstion implements [BLEach][bleachWeb], a fully open-source IPv6-over-BLE stack for Contiki.
|
||||
BLEach in Contiki-NG can be used for node (BLE slave) devices.
|
||||
|
||||
It was developed by
|
||||
It was developed by
|
||||
* [Michael Spoerk](http://www.michaelspoerk.com), Graz University of Technology, michael.spoerk@tugraz.at, github user: [spoerk](https://github.com/spoerk)
|
||||
|
||||
This IPv6-over-BLE stack is presented and evaluated in the paper:
|
||||
@ -21,7 +21,7 @@ This implementation includes:
|
||||
* BLE link layer support for version [4.1][bleSpec]:
|
||||
* BLE advertisement
|
||||
* BLE connection slave
|
||||
|
||||
|
||||
It has been tested on the TI CC2650 SensorTag and the TI CC2650 LaunchPad hardware.
|
||||
|
||||
## Modules
|
||||
@ -78,4 +78,3 @@ specifies the used advertisement interval in milliseconds.
|
||||
[rfc7668]: https://tools.ietf.org/html/rfc7668
|
||||
[bleSpec]: https://www.bluetooth.com/specifications/bluetooth-core-specification/legacy-specifications
|
||||
[bleachWeb]: http://www.iti.tugraz.at/BLEach
|
||||
|
||||
|
@ -5,9 +5,14 @@ PLATFORMS_ONLY = srf06-cc26xx
|
||||
|
||||
MODULES_REL += ./resources
|
||||
|
||||
PROJECT_SOURCEFILES += cetic-6lbr-client.c coap-server.c net-uart.c mqtt-client.c
|
||||
PROJECT_SOURCEFILES += coap-server.c net-uart.c mqtt-client.c
|
||||
PROJECT_SOURCEFILES += httpd-simple.c
|
||||
|
||||
ifeq ($(MAKE_ROUTING),MAKE_ROUTING_RPL_CLASSIC)
|
||||
# 6lbr only supports RPL Classic
|
||||
PROJECT_SOURCEFILES += cetic-6lbr-client.c
|
||||
endif
|
||||
|
||||
# REST Engine shall use Erbium CoAP implementation
|
||||
MODULES += os/net/app-layer/mqtt
|
||||
MODULES += os/net/app-layer/coap
|
||||
|
@ -37,10 +37,11 @@
|
||||
#include "contiki-net.h"
|
||||
#include "net/routing/routing.h"
|
||||
#include "net/ipv6/uip.h"
|
||||
#if ROUTING_CONF_RPL_LITE
|
||||
#include "net/routing/rpl-lite/rpl.h"
|
||||
#elif ROUTING_CONF_RPL_CLASSIC
|
||||
#if ROUTING_CONF_RPL_CLASSIC
|
||||
#include "net/routing/rpl-classic/rpl.h"
|
||||
#include "net/routing/rpl-classic/rpl-private.h"
|
||||
#else
|
||||
#error The 6LBR client is only meant for RPL Classic. Set MAKE_ROUTING accordingly.
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
@ -160,8 +161,8 @@ timeout_handler(void)
|
||||
PRINT6ADDR(&client_conn->ripaddr);
|
||||
i = sprintf(buf, "%d | ", ++seq_id);
|
||||
instance = rpl_get_default_instance();
|
||||
if(instance && instance->dag.preferred_parent) {
|
||||
add_ipaddr(buf + i, rpl_parent_get_ipaddr(instance->dag.preferred_parent));
|
||||
if(instance && instance->current_dag->preferred_parent) {
|
||||
add_ipaddr(buf + i, rpl_parent_get_ipaddr(instance->current_dag->preferred_parent));
|
||||
} else {
|
||||
sprintf(buf + i, "(null)");
|
||||
}
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
/* Enable/Disable Components of this Demo */
|
||||
#define CC26XX_WEB_DEMO_CONF_MQTT_CLIENT 1
|
||||
#define CC26XX_WEB_DEMO_CONF_6LBR_CLIENT 1
|
||||
#define CC26XX_WEB_DEMO_CONF_6LBR_CLIENT ROUTING_CONF_RPL_CLASSIC
|
||||
#define CC26XX_WEB_DEMO_CONF_COAP_SERVER 1
|
||||
#define CC26XX_WEB_DEMO_CONF_NET_UART 1
|
||||
|
||||
|
@ -31,11 +31,11 @@
|
||||
* \author Simon Duquennoy <simonduq@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __PROJECT_CONF_H__
|
||||
#define __PROJECT_CONF_H__
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
#define UIP_CONF_TCP 0
|
||||
|
||||
#include "../common-conf.h"
|
||||
|
||||
#endif /* __PROJECT_CONF_H__ */
|
||||
#endif /* PROJECT_CONF_H_ */
|
||||
|
@ -31,11 +31,11 @@
|
||||
* \author Simon Duquennoy <simonduq@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __PROJECT_CONF_H__
|
||||
#define __PROJECT_CONF_H__
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
#define UIP_CONF_TCP 0
|
||||
|
||||
#include "../common-conf.h"
|
||||
|
||||
#endif /* __PROJECT_CONF_H__ */
|
||||
#endif /* PROJECT_CONF_H_ */
|
||||
|
@ -31,11 +31,11 @@
|
||||
* \author Simon Duquennoy <simonduq@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __PROJECT_CONF_H__
|
||||
#define __PROJECT_CONF_H__
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
#define UIP_CONF_TCP 0
|
||||
|
||||
#include "../common-conf.h"
|
||||
|
||||
#endif /* __PROJECT_CONF_H__ */
|
||||
#endif /* PROJECT_CONF_H_ */
|
||||
|
@ -32,9 +32,9 @@
|
||||
* \author Simon Duquennoy <simonduq@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __PROJECT_CONF_H__
|
||||
#define __PROJECT_CONF_H__
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
#include "../common-conf.h"
|
||||
|
||||
#endif /* __PROJECT_CONF_H__ */
|
||||
#endif /* PROJECT_CONF_H_ */
|
||||
|
@ -32,12 +32,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __PROJECT_CONF_H__
|
||||
#define __PROJECT_CONF_H__
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
#define UIP_CONF_TCP 0
|
||||
#define UART_BAUD_RATE UART_RATE_115200
|
||||
|
||||
#include "../../common-conf.h"
|
||||
|
||||
#endif /* __PROJECT_CONF_H__ */
|
||||
#endif /* PROJECT_CONF_H_ */
|
||||
|
@ -31,12 +31,12 @@
|
||||
* \author Simon Duquennoy <simonduq@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __PROJECT_CONF_H__
|
||||
#define __PROJECT_CONF_H__
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
#define UIP_CONF_TCP 0
|
||||
#define UART_BAUD_RATE UART_RATE_115200
|
||||
|
||||
#include "../../common-conf.h"
|
||||
|
||||
#endif /* __PROJECT_CONF_H__ */
|
||||
#endif /* PROJECT_CONF_H_ */
|
||||
|
@ -31,8 +31,8 @@
|
||||
* \author Simon Duquennoy <simonduq@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __PROJECT_CONF_H__
|
||||
#define __PROJECT_CONF_H__
|
||||
#ifndef PROJECT_CONF_H_
|
||||
#define PROJECT_CONF_H_
|
||||
|
||||
#define UIP_CONF_TCP 0
|
||||
|
||||
@ -46,4 +46,4 @@
|
||||
|
||||
#include "../common-conf.h"
|
||||
|
||||
#endif /* __PROJECT_CONF_H__ */
|
||||
#endif /* PROJECT_CONF_H_ */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user