Merge branch 'master' of ssh://contiki.git.sourceforge.net/gitroot/contiki/contiki
This commit is contained in:
commit
3f31fb9514
@ -11,7 +11,7 @@ shell_src = shell.c shell-reboot.c \
|
||||
shell-rime-unicast.c \
|
||||
shell-tweet.c shell-base64.c \
|
||||
shell-netperf.c shell-memdebug.c \
|
||||
shell-powertrace.c shell-collect-view.c
|
||||
shell-powertrace.c shell-collect-view.c shell-crc.c
|
||||
shell_dsc = shell-dsc.c
|
||||
|
||||
APPS += webserver
|
||||
|
298
apps/shell/shell-crc.c
Normal file
298
apps/shell/shell-crc.c
Normal file
@ -0,0 +1,298 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Swedish Institute of Computer Science.
|
||||
* 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.
|
||||
*
|
||||
* $Id: shell-text.c,v 1.7 2010/09/13 13:29:47 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Block-wise hexadecimal conversion and CRC commands
|
||||
* \author
|
||||
* Fredrik Osterlind <fros@sics.se>
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "shell.h"
|
||||
#include "lib/crc16.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(shell_bin2hex_process, "bin2hex");
|
||||
SHELL_COMMAND(bin2hex_command,
|
||||
"bin2hex",
|
||||
"bin2hex: binary to hexadecimal",
|
||||
&shell_bin2hex_process);
|
||||
PROCESS(shell_hex2bin_process, "hex2bin");
|
||||
SHELL_COMMAND(hex2bin_command,
|
||||
"hex2bin",
|
||||
"hex2bin: hexadecimal to binary",
|
||||
&shell_hex2bin_process);
|
||||
PROCESS(shell_crc_process, "crc");
|
||||
SHELL_COMMAND(crc_command,
|
||||
"crc",
|
||||
"crc: append per-block crc",
|
||||
&shell_crc_process);
|
||||
PROCESS(shell_crcvalidate_process, "crc-v");
|
||||
SHELL_COMMAND(crcvalidate_command,
|
||||
"crc-v",
|
||||
"crc-v: verify crc and output if valid",
|
||||
&shell_crcvalidate_process);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static unsigned char
|
||||
fromhexchar(unsigned char c)
|
||||
{
|
||||
unsigned char h;
|
||||
if(c >= '0' && c <= '9') {
|
||||
h = c-'0';
|
||||
} else if(c >= 'a' && c <= 'f') {
|
||||
h = c-'a'+10;
|
||||
} else if(c >= 'A' && c <= 'F') {
|
||||
h = c-'A'+10;
|
||||
} else {
|
||||
PRINTF("Bad hex input: %c", c);
|
||||
h = 0;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static unsigned char
|
||||
fromhex(unsigned char c1, unsigned char c2)
|
||||
{
|
||||
return (fromhexchar(c1)<<4) + fromhexchar(c2);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(shell_bin2hex_process, ev, data)
|
||||
{
|
||||
struct shell_input *input;
|
||||
int i;
|
||||
char *bufptr;
|
||||
char *buf;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
while(1) {
|
||||
PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
|
||||
input = data;
|
||||
|
||||
if(input->len1 + input->len2 == 0) {
|
||||
PROCESS_EXIT();
|
||||
}
|
||||
|
||||
buf = alloca((input->len1 + input->len2)*2);
|
||||
|
||||
bufptr = buf;
|
||||
for(i = 0; i < input->len1; i++) {
|
||||
bufptr += sprintf(bufptr, "%02x", 0xff&((char*)input->data1)[i]);
|
||||
}
|
||||
for(i = 0; i < input->len2; i++) {
|
||||
bufptr += sprintf(bufptr, "%02x", 0xff&((char*)input->data2)[i]);
|
||||
}
|
||||
|
||||
shell_output(
|
||||
&bin2hex_command,
|
||||
buf, ((input->len1 + input->len2)*2), "", 0);
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(shell_hex2bin_process, ev, data)
|
||||
{
|
||||
struct shell_input *input;
|
||||
int i, cnt;
|
||||
char* buf;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
/* Reads data in hexadecimal format and prints in binary */
|
||||
|
||||
while(1) {
|
||||
PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
|
||||
input = data;
|
||||
|
||||
if(input->len1 + input->len2 == 0) {
|
||||
PROCESS_EXIT();
|
||||
}
|
||||
|
||||
if(input->len1 % 2 != 0) {
|
||||
PRINTF("Bad input length 1: %d\n", input->len1);
|
||||
continue;
|
||||
}
|
||||
if(input->len2 % 2 != 0) {
|
||||
PRINTF("Bad input length 2: %d\n", input->len2);
|
||||
continue;
|
||||
}
|
||||
|
||||
buf = alloca((input->len1 + input->len2)/2+1);
|
||||
|
||||
cnt = 0;
|
||||
for(i = 0; i < input->len1; i += 2) {
|
||||
buf[cnt++] = fromhex(
|
||||
((char*)input->data1)[i],
|
||||
((char*)input->data1)[i+1]);
|
||||
}
|
||||
for(i = 0; i < input->len2; i += 2) {
|
||||
buf[cnt++] = fromhex(
|
||||
((char*)input->data2)[i],
|
||||
((char*)input->data2)[i+1]);
|
||||
}
|
||||
|
||||
shell_output(&hex2bin_command, buf, cnt, "", 0);
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(shell_crc_process, ev, data)
|
||||
{
|
||||
struct shell_input *input;
|
||||
int i;
|
||||
uint16_t crc;
|
||||
char *buf;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
/* Append per-block 16-bit CRC */
|
||||
|
||||
while(1) {
|
||||
PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
|
||||
input = data;
|
||||
|
||||
if(input->len1 + input->len2 == 0) {
|
||||
PROCESS_EXIT();
|
||||
}
|
||||
|
||||
/* calculate crc */
|
||||
crc = 0;
|
||||
for(i = 0; i < input->len1; i++) {
|
||||
crc = crc16_add(((char*)(input->data1))[i], crc);
|
||||
}
|
||||
for(i = 0; i < input->len2; i++) {
|
||||
crc = crc16_add(((char*)(input->data2))[i], crc);
|
||||
}
|
||||
|
||||
/* input + 16-bit CRC */
|
||||
buf = alloca(input->len2+2);
|
||||
|
||||
memcpy(buf, input->data2, input->len2);
|
||||
buf[input->len2] = crc&0xff;
|
||||
buf[input->len2+1] = (crc>>8)&0xff;
|
||||
|
||||
shell_output(&crc_command, input->data1, input->len1, buf, input->len2+2);
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(shell_crcvalidate_process, ev, data)
|
||||
{
|
||||
struct shell_input *input;
|
||||
int i;
|
||||
char crc1, crc2;
|
||||
uint16_t crc, crc_footer;
|
||||
|
||||
PROCESS_BEGIN();
|
||||
|
||||
/* Per-block 16-bit CRC verification:
|
||||
* outputs data without CRCs matches, otherwise nothing */
|
||||
|
||||
while(1) {
|
||||
PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
|
||||
input = data;
|
||||
|
||||
if(input->len1 + input->len2 == 0) {
|
||||
PROCESS_EXIT();
|
||||
}
|
||||
|
||||
if(input->len1 + input->len2 < 2) {
|
||||
/* too short - no output */
|
||||
PRINTF("Too short input: %d+%d\n", input->len1, input->len2);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(input->len2 == 1) {
|
||||
crc1 = ((char*)input->data1)[input->len1-1];
|
||||
crc2 = ((char*)input->data2)[input->len2-1];
|
||||
input->len1 -= 1;
|
||||
input->len2 -= 1;
|
||||
} else if(input->len2 >= 2) {
|
||||
crc1 = ((char*)input->data2)[input->len2-2];
|
||||
crc2 = ((char*)input->data2)[input->len2-1];
|
||||
input->len2 -= 2;
|
||||
} else {
|
||||
crc1 = ((char*)input->data1)[input->len1-2];
|
||||
crc2 = ((char*)input->data1)[input->len1-1];
|
||||
input->len1 -= 2;
|
||||
}
|
||||
|
||||
/* recalculate crc */
|
||||
crc = 0;
|
||||
for(i = 0; i < input->len1; i++) {
|
||||
crc = crc16_add(((char*)(input->data1))[i], crc);
|
||||
}
|
||||
for(i = 0; i < input->len2; i++) {
|
||||
crc = crc16_add(((char*)(input->data2))[i], crc);
|
||||
}
|
||||
|
||||
/* compare with input crc */
|
||||
crc_footer = ((0xff&crc2)<<8) | (0xff&crc1);
|
||||
|
||||
/* output if matching crcs */
|
||||
if(crc_footer == crc) {
|
||||
shell_output(
|
||||
&crcvalidate_command,
|
||||
input->data1, input->len1, input->data2, input->len2);
|
||||
}
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
shell_crc_init(void)
|
||||
{
|
||||
shell_register_command(&bin2hex_command);
|
||||
shell_register_command(&hex2bin_command);
|
||||
shell_register_command(&crc_command);
|
||||
shell_register_command(&crcvalidate_command);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
39
apps/shell/shell-crc.h
Normal file
39
apps/shell/shell-crc.h
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Swedish Institute of Computer Science.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __SHELL_CRC_H__
|
||||
#define __SHELL_CRC_H__
|
||||
|
||||
#include "shell.h"
|
||||
|
||||
void shell_crc_init(void);
|
||||
|
||||
#endif /* __SHELL_CRC_H__ */
|
@ -75,7 +75,7 @@ PROCESS_THREAD(shell_echo_process, ev, data)
|
||||
{
|
||||
PROCESS_BEGIN();
|
||||
|
||||
shell_output(&echo_command, data, (int)strlen(data), "\n", 1);
|
||||
shell_output(&echo_command, data, (int)strlen(data), "", 0);
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
|
@ -55,13 +55,9 @@ static volatile uint8_t transmitting;
|
||||
#ifdef UART1_CONF_RX_WITH_DMA
|
||||
#define RX_WITH_DMA UART1_CONF_RX_WITH_DMA
|
||||
#else /* UART1_CONF_RX_WITH_DMA */
|
||||
#define RX_WITH_DMA 0
|
||||
#define RX_WITH_DMA 1
|
||||
#endif /* UART1_CONF_RX_WITH_DMA */
|
||||
|
||||
#if RX_WITH_DMA
|
||||
#warning RX_WITH_DMA ENABLED - WILL NOT WORK WITH MSPSIM / COOJA!
|
||||
#endif /* RX_WITH_DMA */
|
||||
|
||||
#if TX_WITH_INTERRUPT
|
||||
#define TXBUFSIZE 128
|
||||
|
||||
|
@ -3,8 +3,7 @@ TARGET=z1
|
||||
endif
|
||||
|
||||
CONTIKI_PROJECT = test-phidgets blink test-adxl345 tmp102-test test-battery test-sht11 #test-potent
|
||||
CONTIKI_SOURCEFILES += cc2420-arch.c sensors.c sht11.c potentiometer-sensor.c
|
||||
PROJECT_SOURCEFILES = i2cmaster.c tmp102.c adxl345.c battery-sensor.c sky-sensors.c #potentiometer-sensor.c
|
||||
CONTIKI_SOURCEFILES += sht11.c potentiometer-sensor.c
|
||||
APPS=serial-shell
|
||||
|
||||
|
||||
|
@ -43,7 +43,10 @@
|
||||
#include <stdio.h>
|
||||
#include "contiki.h"
|
||||
#include "serial-shell.h"
|
||||
#include "adxl345.h"
|
||||
#include "shell-ps.h"
|
||||
#include "shell-file.h"
|
||||
#include "shell-text.h"
|
||||
#include "dev/adxl345.h"
|
||||
|
||||
#define LED_INT_ONTIME CLOCK_SECOND/2
|
||||
#define ACCM_READ_INTERVAL CLOCK_SECOND
|
||||
@ -176,8 +179,8 @@ PROCESS_THREAD(accel_process, ev, data) {
|
||||
accm_init();
|
||||
|
||||
/* Register the callback functions for each interrupt */
|
||||
ACCM_REGISTER_INT1_CB((void *)accm_ff_cb);
|
||||
ACCM_REGISTER_INT2_CB((void *)accm_tap_cb);
|
||||
ACCM_REGISTER_INT1_CB(accm_ff_cb);
|
||||
ACCM_REGISTER_INT2_CB(accm_tap_cb);
|
||||
|
||||
/* Set what strikes the corresponding interrupts. Several interrupts per pin is
|
||||
possible. For the eight possible interrupts, see adxl345.h and adxl345 datasheet. */
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "net/netstack.h"
|
||||
#include "net/mac/frame802154.h"
|
||||
#include "dev/button-sensor.h"
|
||||
#include "dev/adxl345.h"
|
||||
|
||||
#if WITH_UIP6
|
||||
#include "net/uip-ds6.h"
|
||||
|
@ -46,8 +46,10 @@
|
||||
#include "i2cmaster.h"
|
||||
|
||||
/* Callback pointers when interrupt occurs */
|
||||
extern void (*accm_int1_cb)(u8_t reg);
|
||||
extern void (*accm_int2_cb)(u8_t reg);
|
||||
void (*accm_int1_cb)(u8_t reg);
|
||||
void (*accm_int2_cb)(u8_t reg);
|
||||
|
||||
process_event_t int1_event, int2_event;
|
||||
|
||||
/* Bitmasks for the interrupts */
|
||||
static uint16_t int1_mask = 0, int2_mask = 0;
|
||||
|
@ -41,7 +41,7 @@
|
||||
#ifndef __ADXL345_H__
|
||||
#define __ADXL345_H__
|
||||
#include <stdio.h>
|
||||
#include "i2cmaster.h"
|
||||
#include "dev/i2cmaster.h"
|
||||
|
||||
#define DEBUGLEDS 0
|
||||
#if DEBUGLEDS
|
||||
@ -62,21 +62,6 @@
|
||||
#define L_ON(x) (LEDS_PxOUT &= ~x)
|
||||
#define L_OFF(x) (LEDS_PxOUT |= x)
|
||||
|
||||
//XXX Temporary place for defines that are lacking in mspgcc4's gpio.h
|
||||
#ifdef __GNUC__
|
||||
#ifndef P1SEL2_
|
||||
#define P1SEL2_ 0x0041 /* Port 1 Selection 2*/
|
||||
sfrb(P1SEL2, P1SEL2_);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#ifndef P1SEL2_
|
||||
#define P1SEL2_ (0x0041u) /* Port 1 Selection 2*/
|
||||
DEFC( P1SEL2 , P1SEL2_)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Used in accm_read_axis(), eg accm_read_axis(X_AXIS);*/
|
||||
enum ADXL345_AXIS {
|
||||
X_AXIS = 0,
|
||||
@ -293,12 +278,12 @@ void accm_set_irq(uint8_t int1, uint8_t int2);
|
||||
#define ADXL345_SRATE_0_10 0x00 // 0.10 Hz, when I2C data rate >= 100 kHz
|
||||
|
||||
/* Callback pointers for the interrupts */
|
||||
void (*accm_int1_cb)(u8_t reg);
|
||||
void (*accm_int2_cb)(u8_t reg);
|
||||
extern void (*accm_int1_cb)(u8_t reg);
|
||||
extern void (*accm_int2_cb)(u8_t reg);
|
||||
|
||||
/* Interrupt 1 and 2 events; ADXL345 signals interrupt on INT1 or INT2 pins,
|
||||
ISR is invoked and polls the accelerometer process which invokes the callbacks. */
|
||||
process_event_t int1_event, int2_event; // static ?
|
||||
extern process_event_t int1_event, int2_event; // static ?
|
||||
|
||||
#define ACCM_INT1 0x01
|
||||
#define ACCM_INT2 0x02
|
||||
@ -306,4 +291,3 @@ process_event_t int1_event, int2_event; // static ?
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
#endif /* ifndef __ADXL345_H__ */
|
||||
|
||||
|
@ -41,12 +41,7 @@
|
||||
#ifndef __I2CMASTER_H__
|
||||
#define __I2CMASTER_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include "contiki.h"
|
||||
#include <dev/spi.h>
|
||||
#include <dev/leds.h>
|
||||
|
||||
|
||||
|
||||
void i2c_enable(void);
|
||||
|
||||
@ -58,18 +53,6 @@ void i2c_transmit_n(u8_t byte_ctr, u8_t *tx_buf);
|
||||
|
||||
u8_t i2c_busy(void);
|
||||
|
||||
//XXX Temporary place for defines that are lacking in mspgcc4's gpio.h
|
||||
#ifdef __GNUC__
|
||||
#ifndef P5SEL2_
|
||||
#define P5SEL2_ 0x0045 /* Port 5 Selection 2*/
|
||||
sfrb(P5SEL2, P5SEL2_);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#define P5SEL2_ (0x0045u) /* Port 5 Selection 2*/
|
||||
DEFC( P5SEL2 , P5SEL2_)
|
||||
#endif
|
||||
|
||||
//XXX Should these defines be in the contiki-conf.h to make it more platform-independent?
|
||||
#define I2C_PxDIR P5DIR
|
||||
#define I2C_PxIN P5IN
|
||||
@ -97,6 +80,7 @@ DEFC( P5SEL2 , P5SEL2_)
|
||||
|
||||
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
#define PRINTFDEBUG(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define PRINTFDEBUG(...)
|
||||
|
@ -189,7 +189,7 @@ xmem_pread(void *_p, int size, unsigned long offset)
|
||||
return size;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static const char *
|
||||
static const unsigned char *
|
||||
program_page(unsigned long offset, const unsigned char *p, int nbytes)
|
||||
{
|
||||
const unsigned char *end = p + nbytes;
|
||||
|
@ -33,12 +33,7 @@
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#include <sys/unistd.h>
|
||||
#ifndef __IAR_SYSTEMS_ICC__
|
||||
#define asmv(arg) __asm__ __volatile__(arg)
|
||||
#endif
|
||||
|
||||
|
@ -60,10 +60,8 @@
|
||||
#define CC_CONF_INLINE inline
|
||||
#endif
|
||||
|
||||
|
||||
/* CPU target speed in Hz */
|
||||
/* CPU target speed in Hz */
|
||||
#define F_CPU 8000000uL // 8MHz by default
|
||||
#define F_CPU 8000000uL /* 8MHz by default */
|
||||
//Enric #define F_CPU 3900000uL /*2457600uL*/
|
||||
|
||||
/* Our clock resolution, this is the same as Unix HZ. */
|
||||
@ -78,6 +76,28 @@
|
||||
#define MSP430_MEMCPY_WORKAROUND 1
|
||||
#include "msp430def.h"
|
||||
|
||||
/* XXX Temporary place for defines that are lacking in mspgcc4's gpio.h */
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#ifndef P1SEL2_
|
||||
#define P1SEL2_ (0x0041u) /* Port 1 Selection 2*/
|
||||
DEFC( P1SEL2 , P1SEL2_)
|
||||
#endif
|
||||
#ifndef P5SEL2_
|
||||
#define P5SEL2_ (0x0045u) /* Port 5 Selection 2*/
|
||||
DEFC( P5SEL2 , P5SEL2_)
|
||||
#endif
|
||||
#else /* __IAR_SYSTEMS_ICC__ */
|
||||
#ifdef __GNUC__
|
||||
#ifndef P1SEL2_
|
||||
#define P1SEL2_ 0x0041 /* Port 1 Selection 2*/
|
||||
sfrb(P1SEL2, P1SEL2_);
|
||||
#endif
|
||||
#ifndef P5SEL2_
|
||||
#define P5SEL2_ 0x0045 /* Port 5 Selection 2*/
|
||||
sfrb(P5SEL2, P5SEL2_);
|
||||
#endif
|
||||
#endif /* __GNUC__ */
|
||||
#endif /* __IAR_SYSTEMS_ICC__ */
|
||||
|
||||
/* Types for clocks and uip_stats */
|
||||
typedef unsigned short uip_stats_t;
|
||||
|
@ -65,6 +65,28 @@
|
||||
#define MSP430_MEMCPY_WORKAROUND 1
|
||||
#include "msp430def.h"
|
||||
|
||||
/* XXX Temporary place for defines that are lacking in mspgcc4's gpio.h */
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#ifndef P1SEL2_
|
||||
#define P1SEL2_ (0x0041u) /* Port 1 Selection 2*/
|
||||
DEFC( P1SEL2 , P1SEL2_)
|
||||
#endif
|
||||
#ifndef P5SEL2_
|
||||
#define P5SEL2_ (0x0045u) /* Port 5 Selection 2*/
|
||||
DEFC( P5SEL2 , P5SEL2_)
|
||||
#endif
|
||||
#else /* __IAR_SYSTEMS_ICC__ */
|
||||
#ifdef __GNUC__
|
||||
#ifndef P1SEL2_
|
||||
#define P1SEL2_ 0x0041 /* Port 1 Selection 2*/
|
||||
sfrb(P1SEL2, P1SEL2_);
|
||||
#endif
|
||||
#ifndef P5SEL2_
|
||||
#define P5SEL2_ 0x0045 /* Port 5 Selection 2*/
|
||||
sfrb(P5SEL2, P5SEL2_);
|
||||
#endif
|
||||
#endif /* __GNUC__ */
|
||||
#endif /* __IAR_SYSTEMS_ICC__ */
|
||||
|
||||
/* Types for clocks and uip_stats */
|
||||
typedef unsigned short uip_stats_t;
|
||||
|
Loading…
Reference in New Issue
Block a user