Merge branch 'master' of ssh://contiki.git.sourceforge.net/gitroot/contiki/contiki
This commit is contained in:
commit
3cace20809
@ -543,7 +543,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, struct rdc_buf_
|
|||||||
PRINTF("contikimac: radio is turned off\n");
|
PRINTF("contikimac: radio is turned off\n");
|
||||||
return MAC_TX_ERR_FATAL;
|
return MAC_TX_ERR_FATAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(packetbuf_totlen() == 0) {
|
if(packetbuf_totlen() == 0) {
|
||||||
PRINTF("contikimac: send_packet data len 0\n");
|
PRINTF("contikimac: send_packet data len 0\n");
|
||||||
return MAC_TX_ERR_FATAL;
|
return MAC_TX_ERR_FATAL;
|
||||||
@ -723,7 +723,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, struct rdc_buf_
|
|||||||
watchdog_periodic();
|
watchdog_periodic();
|
||||||
t0 = RTIMER_NOW();
|
t0 = RTIMER_NOW();
|
||||||
seqno = packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO);
|
seqno = packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO);
|
||||||
|
previous_txtime = RTIMER_NOW();
|
||||||
for(strobes = 0, collisions = 0;
|
for(strobes = 0, collisions = 0;
|
||||||
got_strobe_ack == 0 && collisions == 0 &&
|
got_strobe_ack == 0 && collisions == 0 &&
|
||||||
RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + STROBE_TIME); strobes++) {
|
RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + STROBE_TIME); strobes++) {
|
||||||
@ -737,7 +737,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr, struct rdc_buf_
|
|||||||
|
|
||||||
len = 0;
|
len = 0;
|
||||||
|
|
||||||
previous_txtime = RTIMER_NOW();
|
|
||||||
{
|
{
|
||||||
rtimer_clock_t wt;
|
rtimer_clock_t wt;
|
||||||
rtimer_clock_t txtime;
|
rtimer_clock_t txtime;
|
||||||
|
@ -781,6 +781,7 @@ input_packet(void)
|
|||||||
{
|
{
|
||||||
struct lpp_hdr hdr;
|
struct lpp_hdr hdr;
|
||||||
clock_time_t reception_time;
|
clock_time_t reception_time;
|
||||||
|
int ret;
|
||||||
|
|
||||||
reception_time = clock_time();
|
reception_time = clock_time();
|
||||||
|
|
||||||
@ -845,7 +846,7 @@ input_packet(void)
|
|||||||
if(i->broadcast_flag == BROADCAST_FLAG_NONE ||
|
if(i->broadcast_flag == BROADCAST_FLAG_NONE ||
|
||||||
i->broadcast_flag == BROADCAST_FLAG_SEND) {
|
i->broadcast_flag == BROADCAST_FLAG_SEND) {
|
||||||
i->num_transmissions = 1;
|
i->num_transmissions = 1;
|
||||||
NETSTACK_RADIO.send(queuebuf_dataptr(i->packet),
|
ret = NETSTACK_RADIO.send(queuebuf_dataptr(i->packet),
|
||||||
queuebuf_datalen(i->packet));
|
queuebuf_datalen(i->packet));
|
||||||
sent = 1;
|
sent = 1;
|
||||||
PRINTF("%d.%d: got a probe from %d.%d, sent packet to %d.%d\n",
|
PRINTF("%d.%d: got a probe from %d.%d, sent packet to %d.%d\n",
|
||||||
@ -860,7 +861,7 @@ input_packet(void)
|
|||||||
}
|
}
|
||||||
#else /* WITH_PENDING_BROADCAST */
|
#else /* WITH_PENDING_BROADCAST */
|
||||||
i->num_transmissions = 1;
|
i->num_transmissions = 1;
|
||||||
NETSTACK_RADIO.send(queuebuf_dataptr(i->packet),
|
ret = NETSTACK_RADIO.send(queuebuf_dataptr(i->packet),
|
||||||
queuebuf_datalen(i->packet));
|
queuebuf_datalen(i->packet));
|
||||||
PRINTF("%d.%d: got a probe from %d.%d, sent packet to %d.%d\n",
|
PRINTF("%d.%d: got a probe from %d.%d, sent packet to %d.%d\n",
|
||||||
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
|
rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1],
|
||||||
@ -879,12 +880,23 @@ input_packet(void)
|
|||||||
neighbors, and are dequeued by the dutycycling function
|
neighbors, and are dequeued by the dutycycling function
|
||||||
instead, after the appropriate time. */
|
instead, after the appropriate time. */
|
||||||
if(!rimeaddr_cmp(receiver, &rimeaddr_null)) {
|
if(!rimeaddr_cmp(receiver, &rimeaddr_null)) {
|
||||||
|
#if RDC_CONF_HARDWARE_ACK
|
||||||
|
|
||||||
|
if(ret == RADIO_TX_OK) {
|
||||||
|
remove_queued_packet(i, 1);
|
||||||
|
} else {
|
||||||
|
remove_queued_packet(i, 0);
|
||||||
|
}
|
||||||
|
#else
|
||||||
if(detect_ack()) {
|
if(detect_ack()) {
|
||||||
remove_queued_packet(i, 1);
|
remove_queued_packet(i, 1);
|
||||||
} else {
|
} else {
|
||||||
remove_queued_packet(i, 0);
|
remove_queued_packet(i, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* RDC_CONF_HARDWARE_ACK */
|
||||||
|
|
||||||
|
|
||||||
#if WITH_PROBE_AFTER_TRANSMISSION
|
#if WITH_PROBE_AFTER_TRANSMISSION
|
||||||
/* Send a probe packet to catch any reply from the other node. */
|
/* Send a probe packet to catch any reply from the other node. */
|
||||||
restart_dutycycle(PROBE_AFTER_TRANSMISSION_TIME);
|
restart_dutycycle(PROBE_AFTER_TRANSMISSION_TIME);
|
||||||
|
@ -454,6 +454,7 @@ send_packet(void)
|
|||||||
rtimer_clock_t t;
|
rtimer_clock_t t;
|
||||||
rtimer_clock_t encounter_time = 0;
|
rtimer_clock_t encounter_time = 0;
|
||||||
int strobes;
|
int strobes;
|
||||||
|
int ret;
|
||||||
#if 0
|
#if 0
|
||||||
struct xmac_hdr *hdr;
|
struct xmac_hdr *hdr;
|
||||||
#endif
|
#endif
|
||||||
@ -640,11 +641,11 @@ send_packet(void)
|
|||||||
|
|
||||||
if(is_broadcast) {
|
if(is_broadcast) {
|
||||||
#if WITH_STROBE_BROADCAST
|
#if WITH_STROBE_BROADCAST
|
||||||
NETSTACK_RADIO.send(strobe, strobe_len);
|
ret = NETSTACK_RADIO.send(strobe, strobe_len);
|
||||||
#else
|
#else
|
||||||
/* restore the packet to send */
|
/* restore the packet to send */
|
||||||
queuebuf_to_packetbuf(packet);
|
queuebuf_to_packetbuf(packet);
|
||||||
NETSTACK_RADIO.send(packetbuf_hdrptr(), packetbuf_totlen());
|
ret = NETSTACK_RADIO.send(packetbuf_hdrptr(), packetbuf_totlen());
|
||||||
#endif
|
#endif
|
||||||
off();
|
off();
|
||||||
} else {
|
} else {
|
||||||
@ -652,7 +653,7 @@ send_packet(void)
|
|||||||
rtimer_clock_t wt;
|
rtimer_clock_t wt;
|
||||||
#endif
|
#endif
|
||||||
on();
|
on();
|
||||||
NETSTACK_RADIO.send(strobe, strobe_len);
|
ret = NETSTACK_RADIO.send(strobe, strobe_len);
|
||||||
#if 0
|
#if 0
|
||||||
/* Turn off the radio for a while to let the other side
|
/* Turn off the radio for a while to let the other side
|
||||||
respond. We don't need to keep our radio on when we know
|
respond. We don't need to keep our radio on when we know
|
||||||
@ -661,12 +662,20 @@ send_packet(void)
|
|||||||
wt = RTIMER_NOW();
|
wt = RTIMER_NOW();
|
||||||
while(RTIMER_CLOCK_LT(RTIMER_NOW(), wt + WAIT_TIME_BEFORE_STROBE_ACK));
|
while(RTIMER_CLOCK_LT(RTIMER_NOW(), wt + WAIT_TIME_BEFORE_STROBE_ACK));
|
||||||
#endif /* 0 */
|
#endif /* 0 */
|
||||||
|
#if RDC_CONF_HARDWARE_ACK
|
||||||
|
if(ret == RADIO_TX_OK) {
|
||||||
|
got_strobe_ack = 1;
|
||||||
|
} else {
|
||||||
|
off();
|
||||||
|
}
|
||||||
|
#else
|
||||||
if(detect_ack()) {
|
if(detect_ack()) {
|
||||||
got_strobe_ack = 1;
|
got_strobe_ack = 1;
|
||||||
} else {
|
} else {
|
||||||
off();
|
off();
|
||||||
}
|
}
|
||||||
|
#endif /* RDC_CONF_HARDWARE_ACK */
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -693,12 +702,18 @@ send_packet(void)
|
|||||||
|
|
||||||
/* Send the data packet. */
|
/* Send the data packet. */
|
||||||
if((is_broadcast || got_strobe_ack || is_streaming) && collisions == 0) {
|
if((is_broadcast || got_strobe_ack || is_streaming) && collisions == 0) {
|
||||||
NETSTACK_RADIO.send(packetbuf_hdrptr(), packetbuf_totlen());
|
ret = NETSTACK_RADIO.send(packetbuf_hdrptr(), packetbuf_totlen());
|
||||||
|
|
||||||
if(!is_broadcast) {
|
if(!is_broadcast) {
|
||||||
|
#if RDC_CONF_HARDWARE_ACK
|
||||||
|
if(ret == RADIO_TX_OK) {
|
||||||
|
got_ack = 1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if(detect_ack()) {
|
if(detect_ack()) {
|
||||||
got_ack = 1;
|
got_ack = 1;
|
||||||
}
|
}
|
||||||
|
#endif /* RDC_CONF_HARDWARE_ACK */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
off();
|
off();
|
||||||
|
@ -37,6 +37,8 @@
|
|||||||
* Machine dependent STM32W radio code.
|
* Machine dependent STM32W radio code.
|
||||||
* \author
|
* \author
|
||||||
* Salvatore Pitrulli
|
* Salvatore Pitrulli
|
||||||
|
* Chi-Anh La la@imag.fr
|
||||||
|
* Simon Duquennoy <simonduq@sics.se>
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -53,13 +55,26 @@
|
|||||||
|
|
||||||
#include "net/packetbuf.h"
|
#include "net/packetbuf.h"
|
||||||
#include "net/rime/rimestats.h"
|
#include "net/rime/rimestats.h"
|
||||||
|
#include "sys/rtimer.h"
|
||||||
|
|
||||||
|
|
||||||
#define DEBUG 0
|
#define DEBUG 0
|
||||||
|
|
||||||
#include "dev/leds.h"
|
#include "dev/leds.h"
|
||||||
#define LED_ACTIVITY 0
|
#define LED_ACTIVITY 0
|
||||||
|
|
||||||
|
#ifdef ST_CONF_RADIO_AUTOACK
|
||||||
|
#define ST_RADIO_AUTOACK ST_CONF_RADIO_AUTOACK
|
||||||
|
#else
|
||||||
|
#define ST_RADIO_AUTOACK 0
|
||||||
|
#endif /* ST_CONF_RADIO_AUTOACK */
|
||||||
|
|
||||||
|
#if RDC_CONF_DEBUG_LED
|
||||||
|
#define LED_RDC RDC_CONF_DEBUG_LED
|
||||||
|
#define LED_ACTIVITY 1
|
||||||
|
#else
|
||||||
|
#define LED_RDC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if DEBUG > 0
|
#if DEBUG > 0
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -71,13 +86,37 @@
|
|||||||
#if LED_ACTIVITY
|
#if LED_ACTIVITY
|
||||||
#define LED_TX_ON() leds_on(LEDS_GREEN)
|
#define LED_TX_ON() leds_on(LEDS_GREEN)
|
||||||
#define LED_TX_OFF() leds_off(LEDS_GREEN)
|
#define LED_TX_OFF() leds_off(LEDS_GREEN)
|
||||||
#define LED_RX_ON() leds_on(LEDS_RED)
|
#define LED_RX_ON() { \
|
||||||
#define LED_RX_OFF() leds_off(LEDS_RED)
|
if(LED_RDC == 0){ \
|
||||||
|
leds_on(LEDS_RED); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
#define LED_RX_OFF() { \
|
||||||
|
if(LED_RDC == 0){ \
|
||||||
|
leds_off(LEDS_RED); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
#define LED_RDC_ON() { \
|
||||||
|
if(LED_RDC == 1){ \
|
||||||
|
leds_on(LEDS_RED); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
#define LED_RDC_OFF() { \
|
||||||
|
if(LED_RDC == 1){ \
|
||||||
|
leds_off(LEDS_RED); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
#define LED_TX_ON()
|
#define LED_TX_ON()
|
||||||
#define LED_TX_OFF()
|
#define LED_TX_OFF()
|
||||||
#define LED_RX_ON()
|
#define LED_RX_ON()
|
||||||
#define LED_RX_OFF()
|
#define LED_RX_OFF()
|
||||||
|
#define LED_RDC_ON()
|
||||||
|
#define LED_RDC_OFF()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if RDC_CONF_HARDWARE_CSMA
|
||||||
|
#define MAC_RETRIES 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MAC_RETRIES
|
#ifndef MAC_RETRIES
|
||||||
@ -113,16 +152,28 @@
|
|||||||
ENERGEST_OFF(ENERGEST_TYPE_LISTEN); \
|
ENERGEST_OFF(ENERGEST_TYPE_LISTEN); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
#if RDC_CONF_HARDWARE_CSMA
|
||||||
|
#define ST_RADIO_CHECK_CCA FALSE
|
||||||
|
#define ST_RADIO_CCA_ATTEMPT_MAX 0
|
||||||
|
#define ST_BACKOFF_EXP_MIN 0
|
||||||
|
#define ST_BACKOFF_EXP_MAX 0
|
||||||
|
#else
|
||||||
|
#define ST_RADIO_CHECK_CCA TRUE
|
||||||
|
#define ST_RADIO_CCA_ATTEMPT_MAX 4
|
||||||
|
#define ST_BACKOFF_EXP_MIN 2
|
||||||
|
#define ST_BACKOFF_EXP_MAX 6
|
||||||
|
#endif
|
||||||
const RadioTransmitConfig radioTransmitConfig = {
|
const RadioTransmitConfig radioTransmitConfig = {
|
||||||
TRUE, // waitForAck;
|
TRUE, // waitForAck;
|
||||||
TRUE, // checkCca; // Set to FALSE with low-power MACs.
|
ST_RADIO_CHECK_CCA, // checkCca; // Set to FALSE with low-power MACs.
|
||||||
4, // ccaAttemptMax;
|
ST_RADIO_CCA_ATTEMPT_MAX, // ccaAttemptMax;
|
||||||
2, // backoffExponentMin;
|
ST_BACKOFF_EXP_MIN, // backoffExponentMin;
|
||||||
6, // backoffExponentMax;
|
ST_BACKOFF_EXP_MAX, // backoffExponentMax;
|
||||||
TRUE // appendCrc;
|
TRUE // appendCrc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define MAC_RETRIES 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The buffers which hold incoming data.
|
* The buffers which hold incoming data.
|
||||||
*/
|
*/
|
||||||
@ -173,6 +224,20 @@ static uint8_t receiving_packet = 0;
|
|||||||
static s8 last_rssi;
|
static s8 last_rssi;
|
||||||
static volatile StStatus last_tx_status;
|
static volatile StStatus last_tx_status;
|
||||||
|
|
||||||
|
#define BUSYWAIT_UNTIL(cond, max_time) \
|
||||||
|
do { \
|
||||||
|
rtimer_clock_t t0; \
|
||||||
|
t0 = RTIMER_NOW(); \
|
||||||
|
while(!(cond) && RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + (max_time))); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
static uint8_t locked;
|
||||||
|
#define GET_LOCK() locked++
|
||||||
|
static void RELEASE_LOCK(void) {
|
||||||
|
if(locked>0)
|
||||||
|
locked--;
|
||||||
|
}
|
||||||
|
static volatile uint8_t is_transmit_ack;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS(stm32w_radio_process, "STM32W radio driver");
|
PROCESS(stm32w_radio_process, "STM32W radio driver");
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
@ -208,20 +273,26 @@ const struct radio_driver stm32w_radio_driver =
|
|||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int stm32w_radio_init(void)
|
static int stm32w_radio_init(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
// A channel needs also to be setted.
|
// A channel needs also to be setted.
|
||||||
ST_RadioSetChannel(RF_CHANNEL);
|
ST_RadioSetChannel(RF_CHANNEL);
|
||||||
|
|
||||||
// Initialize radio (analog section, digital baseband and MAC).
|
// Initialize radio (analog section, digital baseband and MAC).
|
||||||
// Leave radio powered up in non-promiscuous rx mode.
|
// Leave radio powered up in non-promiscuous rx mode.
|
||||||
ST_RadioInit(ST_RADIO_POWER_MODE_OFF);
|
ST_RadioInit(ST_RADIO_POWER_MODE_OFF);
|
||||||
|
|
||||||
onoroff = OFF;
|
onoroff = OFF;
|
||||||
ST_RadioSetNodeId(STM32W_NODE_ID); // To be deleted.
|
|
||||||
ST_RadioSetPanId(IEEE802154_PANID);
|
ST_RadioSetPanId(IEEE802154_PANID);
|
||||||
|
|
||||||
CLEAN_RXBUFS();
|
CLEAN_RXBUFS();
|
||||||
CLEAN_TXBUF();
|
CLEAN_TXBUF();
|
||||||
|
|
||||||
|
#if ST_RADIO_AUTOACK && !(UIP_CONF_LL_802154 && RIMEADDR_CONF_SIZE==8)
|
||||||
|
#error "Autoack and address filtering can only be used with EUI 64"
|
||||||
|
#endif
|
||||||
|
ST_RadioEnableAutoAck(ST_RADIO_AUTOACK);
|
||||||
|
ST_RadioEnableAddressFiltering(ST_RADIO_AUTOACK);
|
||||||
|
|
||||||
|
locked = 0;
|
||||||
process_start(&stm32w_radio_process, NULL);
|
process_start(&stm32w_radio_process, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -290,7 +361,11 @@ static int stm32w_radio_transmit(unsigned short payload_len)
|
|||||||
ST_RadioWake();
|
ST_RadioWake();
|
||||||
ENERGEST_ON(ENERGEST_TYPE_LISTEN);
|
ENERGEST_ON(ENERGEST_TYPE_LISTEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if RADIO_WAIT_FOR_PACKET_SENT
|
||||||
|
GET_LOCK();
|
||||||
|
#endif /* RADIO_WAIT_FOR_PACKET_SENT */
|
||||||
|
last_tx_status = -1;
|
||||||
LED_TX_ON();
|
LED_TX_ON();
|
||||||
if(ST_RadioTransmit(stm32w_txbuf)==ST_SUCCESS){
|
if(ST_RadioTransmit(stm32w_txbuf)==ST_SUCCESS){
|
||||||
|
|
||||||
@ -312,14 +387,21 @@ static int stm32w_radio_transmit(unsigned short payload_len)
|
|||||||
PRINTF("stm32w: unknown tx error.\r\n");
|
PRINTF("stm32w: unknown tx error.\r\n");
|
||||||
TO_PREV_STATE();
|
TO_PREV_STATE();
|
||||||
LED_TX_OFF();
|
LED_TX_OFF();
|
||||||
|
RELEASE_LOCK();
|
||||||
return RADIO_TX_ERR;
|
return RADIO_TX_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
TO_PREV_STATE();
|
TO_PREV_STATE();
|
||||||
if(last_tx_status == ST_SUCCESS || last_tx_status == ST_PHY_ACK_RECEIVED){
|
if(last_tx_status == ST_SUCCESS || last_tx_status == ST_PHY_ACK_RECEIVED || last_tx_status == ST_MAC_NO_ACK_RECEIVED){
|
||||||
return RADIO_TX_OK;
|
RELEASE_LOCK();
|
||||||
|
if(last_tx_status == ST_PHY_ACK_RECEIVED){
|
||||||
|
return RADIO_TX_OK; /* ACK status */
|
||||||
|
}
|
||||||
|
else if (last_tx_status == ST_MAC_NO_ACK_RECEIVED || last_tx_status == ST_SUCCESS){
|
||||||
|
return RADIO_TX_NOACK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
LED_TX_OFF();
|
LED_TX_OFF();
|
||||||
|
RELEASE_LOCK();
|
||||||
return RADIO_TX_ERR;
|
return RADIO_TX_ERR;
|
||||||
|
|
||||||
#else /* RADIO_WAIT_FOR_PACKET_SENT */
|
#else /* RADIO_WAIT_FOR_PACKET_SENT */
|
||||||
@ -331,7 +413,10 @@ static int stm32w_radio_transmit(unsigned short payload_len)
|
|||||||
#endif /* RADIO_WAIT_FOR_PACKET_SENT */
|
#endif /* RADIO_WAIT_FOR_PACKET_SENT */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if RADIO_WAIT_FOR_PACKET_SENT
|
||||||
|
RELEASE_LOCK();
|
||||||
|
#endif /* RADIO_WAIT_FOR_PACKET_SENT */
|
||||||
TO_PREV_STATE();
|
TO_PREV_STATE();
|
||||||
|
|
||||||
PRINTF("stm32w: transmission never started.\r\n");
|
PRINTF("stm32w: transmission never started.\r\n");
|
||||||
@ -372,7 +457,14 @@ static int stm32w_radio_off(void)
|
|||||||
/* Any transmit or receive packets in progress are aborted.
|
/* Any transmit or receive packets in progress are aborted.
|
||||||
* Waiting for end of transmission or reception have to be done.
|
* Waiting for end of transmission or reception have to be done.
|
||||||
*/
|
*/
|
||||||
if(onoroff == ON){
|
if(locked)
|
||||||
|
{
|
||||||
|
PRINTF("stm32w: try to off while sending/receiving (lock=%u).\r\n", locked);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/* off only if there is no transmission or reception of packet. */
|
||||||
|
if(onoroff == ON && TXBUF_EMPTY() && !receiving_packet){
|
||||||
|
LED_RDC_OFF();
|
||||||
ST_RadioSleep();
|
ST_RadioSleep();
|
||||||
onoroff = OFF;
|
onoroff = OFF;
|
||||||
CLEAN_TXBUF();
|
CLEAN_TXBUF();
|
||||||
@ -386,7 +478,9 @@ static int stm32w_radio_off(void)
|
|||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int stm32w_radio_on(void)
|
static int stm32w_radio_on(void)
|
||||||
{
|
{
|
||||||
|
PRINTF("stm32w: turn radio on\n");
|
||||||
if(onoroff == OFF){
|
if(onoroff == OFF){
|
||||||
|
LED_RDC_ON();
|
||||||
ST_RadioWake();
|
ST_RadioWake();
|
||||||
onoroff = ON;
|
onoroff = ON;
|
||||||
|
|
||||||
@ -410,6 +504,7 @@ void ST_RadioReceiveIsrCallback(u8 *packet,
|
|||||||
s8 rssi)
|
s8 rssi)
|
||||||
{
|
{
|
||||||
LED_RX_ON();
|
LED_RX_ON();
|
||||||
|
PRINTF("stm32w: incomming packet received\n");
|
||||||
receiving_packet = 0;
|
receiving_packet = 0;
|
||||||
/* Copy packet into the buffer. It is better to do this here. */
|
/* Copy packet into the buffer. It is better to do this here. */
|
||||||
if(add_to_rxbuf(packet)){
|
if(add_to_rxbuf(packet)){
|
||||||
@ -417,6 +512,21 @@ void ST_RadioReceiveIsrCallback(u8 *packet,
|
|||||||
last_rssi = rssi;
|
last_rssi = rssi;
|
||||||
}
|
}
|
||||||
LED_RX_OFF();
|
LED_RX_OFF();
|
||||||
|
GET_LOCK();
|
||||||
|
is_transmit_ack = 1;
|
||||||
|
/* Wait for sending ACK */
|
||||||
|
BUSYWAIT_UNTIL(!is_transmit_ack, RTIMER_SECOND / 1500);
|
||||||
|
RELEASE_LOCK();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void ST_RadioTxAckIsrCallback (void)
|
||||||
|
{
|
||||||
|
/* This callback is for simplemac 1.1.0.
|
||||||
|
Till now we block (RTIMER_SECOND / 1500)
|
||||||
|
to prevent radio off during ACK transmission */
|
||||||
|
is_transmit_ack = 0;
|
||||||
|
//RELEASE_LOCK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -461,19 +571,19 @@ void ST_RadioTransmitCompleteIsrCallback(StStatus status,
|
|||||||
|
|
||||||
/* Debug outputs. */
|
/* Debug outputs. */
|
||||||
if(status == ST_SUCCESS || status == ST_PHY_ACK_RECEIVED){
|
if(status == ST_SUCCESS || status == ST_PHY_ACK_RECEIVED){
|
||||||
PRINTF("TX_END");
|
PRINTF("stm32w: return status TX_END\r\n");
|
||||||
}
|
}
|
||||||
else if (status == ST_MAC_NO_ACK_RECEIVED){
|
else if (status == ST_MAC_NO_ACK_RECEIVED){
|
||||||
PRINTF("TX_END_NOACK!!!");
|
PRINTF("stm32w: return status TX_END_NOACK\r\n");
|
||||||
}
|
}
|
||||||
else if (status == ST_PHY_TX_CCA_FAIL){
|
else if (status == ST_PHY_TX_CCA_FAIL){
|
||||||
PRINTF("TX_END_CCA!!!");
|
PRINTF("stm32w: return status TX_END_CCA_FAIL\r\n");
|
||||||
}
|
}
|
||||||
else if(status == ST_PHY_TX_UNDERFLOW){
|
else if(status == ST_PHY_TX_UNDERFLOW){
|
||||||
PRINTF("TX_END_UFL!!!");
|
PRINTF("stm32w: return status TX_END_UNDERFLOW\r\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PRINTF("TX_END_INCOMPL!!!");
|
PRINTF("stm32w: return status TX_END_INCOMPLETE\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -533,7 +643,7 @@ static int stm32w_radio_read(void *buf, unsigned short bufsize)
|
|||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void ST_RadioOverflowIsrCallback(void)
|
void ST_RadioOverflowIsrCallback(void)
|
||||||
{
|
{
|
||||||
PRINTF("OVERFLOW\r\n");
|
PRINTF("stm32w: radio overflow\r\n");
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void ST_RadioSfdSentIsrCallback(u32 sfdSentTime)
|
void ST_RadioSfdSentIsrCallback(u32 sfdSentTime)
|
||||||
|
@ -46,8 +46,12 @@
|
|||||||
#include "sys/clock.h"
|
#include "sys/clock.h"
|
||||||
|
|
||||||
|
|
||||||
|
//#define RT_RESOLUTION RES_85US
|
||||||
|
#ifdef RT_CONF_RESOLUTION
|
||||||
|
#define RT_RESOLUTION RT_CONF_RESOLUTION
|
||||||
|
#else
|
||||||
#define RT_RESOLUTION RES_171US
|
#define RT_RESOLUTION RES_171US
|
||||||
|
#endif
|
||||||
|
|
||||||
#define RES_341US 0
|
#define RES_341US 0
|
||||||
#define RES_171US 1
|
#define RES_171US 1
|
||||||
|
@ -37,130 +37,113 @@
|
|||||||
* contiki-conf.h for MB851.
|
* contiki-conf.h for MB851.
|
||||||
* \author
|
* \author
|
||||||
* Salvatore Pitrulli <salvopitru@users.sourceforge.net>
|
* Salvatore Pitrulli <salvopitru@users.sourceforge.net>
|
||||||
|
* Chi-Anh La <la@imag.fr>
|
||||||
|
* Simon Duquennoy <simonduq@sics.se>
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __CONTIKI_CONF_H__
|
#ifndef __CONTIKI_CONF_H__
|
||||||
#define __CONTIKI_CONF_H__
|
#define __CONTIKI_CONF_H__
|
||||||
|
|
||||||
#include PLATFORM_HEADER
|
#ifdef PLATFORM_CONF_H
|
||||||
|
#include PLATFORM_CONF_H
|
||||||
|
#else
|
||||||
|
#include "platform-conf.h"
|
||||||
|
#endif /* PLATFORM_CONF_H */
|
||||||
|
|
||||||
#include <inttypes.h>
|
/* Radio and 802.15.4 params */
|
||||||
#include <string.h> // For memcpm().
|
/* 802.15.4 radio channel */
|
||||||
|
#define RF_CHANNEL 16
|
||||||
|
/* 802.15.4 PAN ID */
|
||||||
|
#define IEEE802154_CONF_PANID 0x1234
|
||||||
|
/* Use EID 64, enable hardware autoack and address filtering */
|
||||||
|
#define RIMEADDR_CONF_SIZE 8
|
||||||
|
#define UIP_CONF_LL_802154 1
|
||||||
|
#define ST_CONF_RADIO_AUTOACK 1
|
||||||
|
/* Number of buffers for incoming frames */
|
||||||
|
#define RADIO_RXBUFS 2
|
||||||
|
/* Set to 0 for non ethernet links */
|
||||||
|
#define UIP_CONF_LLH_LEN 0
|
||||||
|
|
||||||
#define CC_CONF_REGISTER_ARGS 0
|
/* RDC params */
|
||||||
#define CC_CONF_FUNCTION_POINTER_ARGS 1
|
/* TX routine passes the cca/ack result in the return parameter */
|
||||||
#define CC_CONF_FASTCALL
|
#define RDC_CONF_HARDWARE_ACK 1
|
||||||
#define CC_CONF_VA_ARGS 1
|
/* TX routine does automatic cca and optional backoff */
|
||||||
#define CC_CONF_INLINE inline
|
#define RDC_CONF_HARDWARE_CSMA 0
|
||||||
|
/* RDC debug with LED */
|
||||||
|
#define RDC_CONF_DEBUG_LED 1
|
||||||
|
/* Channel check rate (per second) */
|
||||||
|
#define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
|
||||||
|
/* Use ACK for optimization (LPP, XMAC) */
|
||||||
|
#define WITH_ACK_OPTIMIZATION 0
|
||||||
|
|
||||||
#define CCIF
|
/* Netstack config */
|
||||||
#define CLIF
|
#define NETSTACK_CONF_MAC csma_driver
|
||||||
|
#define NETSTACK_CONF_RDC contikimac_driver
|
||||||
|
#define NETSTACK_CONF_FRAMER framer_802154
|
||||||
|
#define NETSTACK_CONF_RADIO stm32w_radio_driver
|
||||||
|
|
||||||
/* These names are deprecated, use C99 names. */
|
/* ContikiMAC config */
|
||||||
typedef uint8_t u8_t;
|
#define CONTIKIMAC_CONF_COMPOWER 1
|
||||||
typedef uint16_t u16_t;
|
#define CONTIKIMAC_CONF_BROADCAST_RATE_LIMIT 0
|
||||||
typedef uint32_t u32_t;
|
#define CONTIKIMAC_CONF_ANNOUNCEMENTS 0
|
||||||
typedef int32_t s32_t;
|
|
||||||
|
|
||||||
typedef unsigned short uip_stats_t;
|
/* CXMAC config */
|
||||||
|
#define CXMAC_CONF_ANNOUNCEMENTS 0
|
||||||
|
#define CXMAC_CONF_COMPOWER 1
|
||||||
|
|
||||||
|
/* XMAC config */
|
||||||
|
#define XMAC_CONF_ANNOUNCEMENTS 0
|
||||||
|
#define XMAC_CONF_COMPOWER 1
|
||||||
|
|
||||||
//#define FIXED_NET_ADDRESS 1
|
/* Other */
|
||||||
//#define NET_ADDR_A 0x2001
|
#define ENERGEST_CONF_ON 0
|
||||||
//#define NET_ADDR_B 0xdb8
|
#define QUEUEBUF_CONF_NUM 2
|
||||||
//#define NET_ADDR_C 0xbbbb
|
|
||||||
//#define NET_ADDR_D 0xabcd
|
|
||||||
|
|
||||||
#define UART1_CONF_TX_WITH_INTERRUPT 0
|
#if WITH_UIP6
|
||||||
#define WITH_SERIAL_LINE_INPUT 1
|
|
||||||
#define ENERGEST_CONF_ON 0
|
|
||||||
#define TELNETD_CONF_NUMLINES 6
|
|
||||||
|
|
||||||
#define QUEUEBUF_CONF_NUM 2
|
/* Network setup for IPv6 */
|
||||||
|
#define NETSTACK_CONF_NETWORK sicslowpan_driver
|
||||||
|
|
||||||
|
/* Specify a minimum packet size for 6lowpan compression to be
|
||||||
|
enabled. This is needed for ContikiMAC, which needs packets to be
|
||||||
|
larger than a specified size, if no ContikiMAC header should be
|
||||||
|
used. */
|
||||||
|
#define SICSLOWPAN_CONF_COMPRESSION_THRESHOLD 63
|
||||||
|
#define CONTIKIMAC_CONF_WITH_CONTIKIMAC_HEADER 0
|
||||||
|
|
||||||
#define NETSTACK_CONF_RADIO stm32w_radio_driver
|
#define UIP_CONF_ROUTER 1
|
||||||
|
#define UIP_CONF_IPV6_RPL 1
|
||||||
|
#define UIP_CONF_ND6_SEND_RA 0
|
||||||
|
|
||||||
#if WITH_UIP6
|
#define UIP_CONF_IPV6 1
|
||||||
|
#define UIP_CONF_IPV6_QUEUE_PKT 0
|
||||||
|
#define UIP_CONF_IPV6_CHECKS 1
|
||||||
|
#define UIP_CONF_IPV6_REASSEMBLY 0
|
||||||
|
#define UIP_CONF_ND6_MAX_PREFIXES 2
|
||||||
|
#define UIP_CONF_ND6_MAX_NEIGHBORS 2
|
||||||
|
#define UIP_CONF_ND6_MAX_DEFROUTERS 1
|
||||||
|
#define UIP_CONF_IP_FORWARD 0
|
||||||
|
#define UIP_CONF_BUFFER_SIZE 140
|
||||||
|
#define UIP_CONF_MAX_CONNECTIONS 4
|
||||||
|
#define UIP_CONF_MAX_LISTENPORTS 8
|
||||||
|
#define UIP_CONF_UDP_CONNS 4
|
||||||
|
|
||||||
/* No radio cycling */
|
#include "net/sicslowpan.h"
|
||||||
#define NETSTACK_CONF_NETWORK sicslowpan_driver
|
|
||||||
#define NETSTACK_CONF_MAC nullmac_driver
|
|
||||||
#define NETSTACK_CONF_RDC sicslowmac_driver
|
|
||||||
#define NETSTACK_CONF_FRAMER framer_802154
|
|
||||||
|
|
||||||
#define RIMEADDR_CONF_SIZE 8
|
|
||||||
#define UIP_CONF_LL_802154 1
|
|
||||||
|
|
||||||
#define UIP_CONF_ROUTER 1
|
|
||||||
#define UIP_CONF_IPV6_RPL 1
|
|
||||||
#define UIP_CONF_ND6_SEND_RA 0
|
|
||||||
//#define RPL_BORDER_ROUTER 0
|
|
||||||
|
|
||||||
/* A trick to resolve a compilation error with IAR. */
|
|
||||||
#ifdef __ICCARM__
|
|
||||||
#define UIP_CONF_DS6_AADDR_NBU 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define UIP_CONF_IPV6 1
|
|
||||||
#define UIP_CONF_IPV6_QUEUE_PKT 0 // This is a very costly feature as it increases the RAM usage by approximately UIP_ND6_MAX_NEIGHBORS * UIP_LINK_MTU bytes.
|
|
||||||
#define UIP_CONF_IPV6_CHECKS 1
|
|
||||||
#define UIP_CONF_IPV6_REASSEMBLY 0
|
|
||||||
#define UIP_CONF_ND6_MAX_PREFIXES 2
|
|
||||||
#define UIP_CONF_ND6_MAX_NEIGHBORS 2
|
|
||||||
#define UIP_CONF_ND6_MAX_DEFROUTERS 1
|
|
||||||
#define UIP_CONF_IP_FORWARD 0
|
|
||||||
#define UIP_CONF_BUFFER_SIZE 140
|
|
||||||
#define UIP_CONF_MAX_CONNECTIONS 6
|
|
||||||
#define UIP_CONF_MAX_LISTENPORTS 6
|
|
||||||
#define UIP_CONF_UDP_CONNS 3
|
|
||||||
|
|
||||||
#define SICSLOWPAN_CONF_COMPRESSION_IPV6 0
|
|
||||||
#define SICSLOWPAN_CONF_COMPRESSION_HC1 1
|
|
||||||
#define SICSLOWPAN_CONF_COMPRESSION_HC06 2
|
|
||||||
#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_CONF_COMPRESSION_HC06
|
#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_CONF_COMPRESSION_HC06
|
||||||
#define SICSLOWPAN_CONF_FRAG 1
|
#define SICSLOWPAN_CONF_FRAG 1
|
||||||
#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2
|
#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2
|
||||||
#define SICSLOWPAN_CONF_MAXAGE 2
|
#define SICSLOWPAN_CONF_MAXAGE 2
|
||||||
|
|
||||||
#define UIP_CONF_ICMP6 0
|
#else /* WITH_UIP6 */
|
||||||
|
|
||||||
|
/* Network setup for non-IPv6 (rime). */
|
||||||
|
#define NETSTACK_CONF_NETWORK rime_driver
|
||||||
|
|
||||||
#endif /* WITH_UIP6 */
|
#endif /* WITH_UIP6 */
|
||||||
|
|
||||||
#define UIP_CONF_UDP 1
|
|
||||||
#define UIP_CONF_TCP 1
|
|
||||||
|
|
||||||
#define IEEE802154_CONF_PANID 0x1234
|
|
||||||
#define STM32W_NODE_ID 0x5678 // to be deleted
|
|
||||||
#define RF_CHANNEL 16
|
|
||||||
#define RADIO_RXBUFS 2 // Set to a number greater than 1 to decrease packet loss probability at high rates (e.g, with fragmented packets)
|
|
||||||
#define UIP_CONF_LLH_LEN 0
|
|
||||||
|
|
||||||
typedef unsigned long clock_time_t;
|
|
||||||
|
|
||||||
#define CLOCK_CONF_SECOND 1000
|
|
||||||
|
|
||||||
typedef unsigned long long rtimer_clock_t;
|
|
||||||
#define RTIMER_CLOCK_LT(a,b) ((signed short)((a)-(b)) < 0)
|
|
||||||
|
|
||||||
/* LEDs ports MB851 */
|
|
||||||
#define LEDS_CONF_RED_PIN 5
|
|
||||||
#define LEDS_CONF_GREEN_PIN 6
|
|
||||||
#define LEDS_CONF_PORT PORTB
|
|
||||||
#define LEDS_CONF_RED (1<<LEDS_CONF_RED_PIN)
|
|
||||||
#define LEDS_CONF_GREEN (1<<LEDS_CONF_GREEN_PIN)
|
|
||||||
|
|
||||||
|
|
||||||
#define UIP_ARCH_ADD32 1
|
|
||||||
#define UIP_ARCH_CHKSUM 0
|
|
||||||
|
|
||||||
#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PROJECT_CONF_H
|
#ifdef PROJECT_CONF_H
|
||||||
#include PROJECT_CONF_H
|
#include PROJECT_CONF_H
|
||||||
#endif /* PROJECT_CONF_H */
|
#endif /* PROJECT_CONF_H */
|
||||||
|
|
||||||
|
|
||||||
#endif /* __CONTIKI_CONF_H__ */
|
#endif /* __CONTIKI_CONF_H__ */
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
* Contiki main file.
|
* Contiki main file.
|
||||||
* \author
|
* \author
|
||||||
* Salvatore Pitrulli <salvopitru@users.sourceforge.net>
|
* Salvatore Pitrulli <salvopitru@users.sourceforge.net>
|
||||||
|
* Chi-Anh La <la@imag.fr>
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -82,9 +83,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#if UIP_CONF_IPV6
|
#if UIP_CONF_IPV6
|
||||||
PROCINIT(&etimer_process, &tcpip_process, &sensors_process);
|
PROCINIT(&tcpip_process, &sensors_process);
|
||||||
#else
|
#else
|
||||||
PROCINIT(&etimer_process, &sensors_process);
|
PROCINIT(&sensors_process);
|
||||||
#warning "No TCP/IP process!"
|
#warning "No TCP/IP process!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -108,9 +109,6 @@ set_rime_addr(void)
|
|||||||
eui64.u8[c] = stm32w_eui64[7 - c];
|
eui64.u8[c] = stm32w_eui64[7 - c];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PRINTF("\n\rRadio EUI-64:");
|
|
||||||
PRINTLLADDR(eui64);
|
|
||||||
PRINTF("\n\r");
|
|
||||||
|
|
||||||
#if UIP_CONF_IPV6
|
#if UIP_CONF_IPV6
|
||||||
memcpy(&uip_lladdr.addr, &eui64, sizeof(uip_lladdr.addr));
|
memcpy(&uip_lladdr.addr, &eui64, sizeof(uip_lladdr.addr));
|
||||||
@ -161,17 +159,25 @@ main(void)
|
|||||||
uart1_set_input(serial_line_input_byte);
|
uart1_set_input(serial_line_input_byte);
|
||||||
serial_line_init();
|
serial_line_init();
|
||||||
#endif
|
#endif
|
||||||
|
/* rtimer and ctimer should be initialized before radio duty cycling layers*/
|
||||||
|
rtimer_init();
|
||||||
|
/* etimer_process should be initialized before ctimer */
|
||||||
|
process_start(&etimer_process, NULL);
|
||||||
|
ctimer_init();
|
||||||
|
|
||||||
|
|
||||||
netstack_init();
|
netstack_init();
|
||||||
#if !UIP_CONF_IPV6
|
|
||||||
ST_RadioEnableAutoAck(FALSE); // Because frames are not 802.15.4 compatible.
|
|
||||||
ST_RadioEnableAddressFiltering(FALSE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
set_rime_addr();
|
set_rime_addr();
|
||||||
|
|
||||||
ctimer_init();
|
printf("%s %s, channel check rate %lu Hz\n",
|
||||||
rtimer_init();
|
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||||
|
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
|
||||||
|
NETSTACK_RDC.channel_check_interval()));
|
||||||
|
printf("802.15.4 PAN ID 0x%x, EUI-%d:",
|
||||||
|
IEEE802154_CONF_PANID, UIP_CONF_LL_802154?64:16);
|
||||||
|
uip_debug_lladdr_print(&rimeaddr_node_addr);
|
||||||
|
printf(", radio channel %u\n", RF_CHANNEL);
|
||||||
|
|
||||||
procinit_init();
|
procinit_init();
|
||||||
|
|
||||||
|
94
platform/mb851/platform-conf.h
Normal file
94
platform/mb851/platform-conf.h
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2010, STMicroelectronics.
|
||||||
|
* 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. The name of the author may not be used to endorse or promote
|
||||||
|
* products derived from this software without specific prior
|
||||||
|
* written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 OS
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* \file
|
||||||
|
* platform-conf.h for MB851.
|
||||||
|
* \author
|
||||||
|
* Salvatore Pitrulli <salvopitru@users.sourceforge.net>
|
||||||
|
* Chi-Anh La <la@imag.fr>
|
||||||
|
* Simon Duquennoy <simonduq@sics.se>
|
||||||
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef __PLATFORM_CONF_H__
|
||||||
|
#define __PLATFORM_CONF_H__
|
||||||
|
|
||||||
|
#include PLATFORM_HEADER
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <string.h> // For memcpm().
|
||||||
|
|
||||||
|
/* Platform-dependent definitions */
|
||||||
|
#define CC_CONF_REGISTER_ARGS 0
|
||||||
|
#define CC_CONF_FUNCTION_POINTER_ARGS 1
|
||||||
|
#define CC_CONF_FASTCALL
|
||||||
|
#define CC_CONF_VA_ARGS 1
|
||||||
|
#define CC_CONF_INLINE inline
|
||||||
|
|
||||||
|
#define CCIF
|
||||||
|
#define CLIF
|
||||||
|
|
||||||
|
typedef unsigned short uip_stats_t;
|
||||||
|
|
||||||
|
#define UART1_CONF_TX_WITH_INTERRUPT 0
|
||||||
|
#define WITH_SERIAL_LINE_INPUT 1
|
||||||
|
|
||||||
|
/* rtimer_second = 11719 */
|
||||||
|
#define RT_CONF_RESOLUTION 2
|
||||||
|
|
||||||
|
/* A trick to resolve a compilation error with IAR. */
|
||||||
|
#ifdef __ICCARM__
|
||||||
|
#define UIP_CONF_DS6_AADDR_NBU 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef unsigned long clock_time_t;
|
||||||
|
|
||||||
|
#define CLOCK_CONF_SECOND 1000
|
||||||
|
|
||||||
|
typedef unsigned long rtimer_clock_t;
|
||||||
|
#define RTIMER_CLOCK_LT(a,b) ((signed short)((a)-(b)) < 0)
|
||||||
|
|
||||||
|
/* LEDs ports MB851 */
|
||||||
|
#define LEDS_CONF_RED_PIN 5
|
||||||
|
#define LEDS_CONF_GREEN_PIN 6
|
||||||
|
#define LEDS_CONF_PORT PORTB
|
||||||
|
#define LEDS_CONF_RED (1<<LEDS_CONF_RED_PIN)
|
||||||
|
#define LEDS_CONF_GREEN (1<<LEDS_CONF_GREEN_PIN)
|
||||||
|
|
||||||
|
#define UIP_ARCH_ADD32 1
|
||||||
|
#define UIP_ARCH_CHKSUM 0
|
||||||
|
|
||||||
|
#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
|
||||||
|
|
||||||
|
#endif /* __PLATFORM_CONF_H__ */
|
@ -29,135 +29,121 @@
|
|||||||
*
|
*
|
||||||
* This file is part of the Contiki OS
|
* This file is part of the Contiki OS
|
||||||
*
|
*
|
||||||
|
* $Id: contiki-conf.h,v 1.2 2010/10/27 14:05:24 salvopitru Exp $
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* \file
|
* \file
|
||||||
* contiki-conf.h for MBXXX.
|
* contiki-conf.h for MBXXX.
|
||||||
* \author
|
* \author
|
||||||
* Salvatore Pitrulli <salvopitru@users.sourceforge.net>
|
* Salvatore Pitrulli <salvopitru@users.sourceforge.net>
|
||||||
|
* Chi-Anh La <la@imag.fr>
|
||||||
|
* Simon Duquennoy <simonduq@sics.se>
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef __CONTIKI_CONF_H__
|
#ifndef __CONTIKI_CONF_H__
|
||||||
#define __CONTIKI_CONF_H__
|
#define __CONTIKI_CONF_H__
|
||||||
|
|
||||||
#include PLATFORM_HEADER
|
#ifdef PLATFORM_CONF_H
|
||||||
|
#include PLATFORM_CONF_H
|
||||||
|
#else
|
||||||
|
#include "platform-conf.h"
|
||||||
|
#endif /* PLATFORM_CONF_H */
|
||||||
|
|
||||||
#include <inttypes.h>
|
/* Radio and 802.15.4 params */
|
||||||
#include <string.h> // For memcpm().
|
/* 802.15.4 radio channel */
|
||||||
|
#define RF_CHANNEL 16
|
||||||
|
/* 802.15.4 PAN ID */
|
||||||
|
#define IEEE802154_CONF_PANID 0x1234
|
||||||
|
/* Use EID 64, enable hardware autoack and address filtering */
|
||||||
|
#define RIMEADDR_CONF_SIZE 8
|
||||||
|
#define UIP_CONF_LL_802154 1
|
||||||
|
#define ST_CONF_RADIO_AUTOACK 1
|
||||||
|
/* Number of buffers for incoming frames */
|
||||||
|
#define RADIO_RXBUFS 2
|
||||||
|
/* Set to 0 for non ethernet links */
|
||||||
|
#define UIP_CONF_LLH_LEN 0
|
||||||
|
|
||||||
#define CC_CONF_REGISTER_ARGS 0
|
/* RDC params */
|
||||||
#define CC_CONF_FUNCTION_POINTER_ARGS 1
|
/* TX routine passes the cca/ack result in the return parameter */
|
||||||
#define CC_CONF_FASTCALL
|
#define RDC_CONF_HARDWARE_ACK 1
|
||||||
#define CC_CONF_VA_ARGS 1
|
/* TX routine does automatic cca and optional backoff */
|
||||||
#define CC_CONF_INLINE inline
|
#define RDC_CONF_HARDWARE_CSMA 0
|
||||||
|
/* RDC debug with LED */
|
||||||
|
#define RDC_CONF_DEBUG_LED 1
|
||||||
|
/* Channel check rate (per second) */
|
||||||
|
#define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
|
||||||
|
/* Use ACK for optimization (LPP, XMAC) */
|
||||||
|
#define WITH_ACK_OPTIMIZATION 0
|
||||||
|
|
||||||
#define CCIF
|
/* Netstack config */
|
||||||
#define CLIF
|
#define NETSTACK_CONF_MAC csma_driver
|
||||||
|
#define NETSTACK_CONF_RDC contikimac_driver
|
||||||
|
#define NETSTACK_CONF_FRAMER framer_802154
|
||||||
|
#define NETSTACK_CONF_RADIO stm32w_radio_driver
|
||||||
|
|
||||||
/* These names are deprecated, use C99 names. */
|
/* ContikiMAC config */
|
||||||
typedef uint8_t u8_t;
|
#define CONTIKIMAC_CONF_COMPOWER 1
|
||||||
typedef uint16_t u16_t;
|
#define CONTIKIMAC_CONF_BROADCAST_RATE_LIMIT 0
|
||||||
typedef uint32_t u32_t;
|
#define CONTIKIMAC_CONF_ANNOUNCEMENTS 0
|
||||||
typedef int32_t s32_t;
|
|
||||||
|
|
||||||
typedef unsigned short uip_stats_t;
|
/* CXMAC config */
|
||||||
|
#define CXMAC_CONF_ANNOUNCEMENTS 0
|
||||||
|
#define CXMAC_CONF_COMPOWER 1
|
||||||
|
|
||||||
//#define FIXED_NET_ADDRESS 1
|
/* XMAC config */
|
||||||
//#define NET_ADDR_A 0x2001
|
#define XMAC_CONF_ANNOUNCEMENTS 0
|
||||||
//#define NET_ADDR_B 0xdb8
|
#define XMAC_CONF_COMPOWER 1
|
||||||
//#define NET_ADDR_C 0xbbbb
|
|
||||||
//#define NET_ADDR_D 0xabcd
|
|
||||||
|
|
||||||
#define UART1_CONF_TX_WITH_INTERRUPT 0
|
/* Other */
|
||||||
#define WITH_SERIAL_LINE_INPUT 1
|
#define ENERGEST_CONF_ON 0
|
||||||
#define ENERGEST_CONF_ON 0
|
#define QUEUEBUF_CONF_NUM 2
|
||||||
#define TELNETD_CONF_NUMLINES 6
|
|
||||||
|
|
||||||
#define QUEUEBUF_CONF_NUM 2
|
|
||||||
|
|
||||||
|
|
||||||
#define NETSTACK_CONF_RADIO stm32w_radio_driver
|
|
||||||
|
|
||||||
#if WITH_UIP6
|
#if WITH_UIP6
|
||||||
|
|
||||||
/* No radio cycling */
|
/* Network setup for IPv6 */
|
||||||
#define NETSTACK_CONF_NETWORK sicslowpan_driver
|
#define NETSTACK_CONF_NETWORK sicslowpan_driver
|
||||||
#define NETSTACK_CONF_MAC nullmac_driver
|
|
||||||
#define NETSTACK_CONF_RDC sicslowmac_driver
|
|
||||||
#define NETSTACK_CONF_FRAMER framer_802154
|
|
||||||
|
|
||||||
#define RIMEADDR_CONF_SIZE 8
|
/* Specify a minimum packet size for 6lowpan compression to be
|
||||||
#define UIP_CONF_LL_802154 1
|
enabled. This is needed for ContikiMAC, which needs packets to be
|
||||||
|
larger than a specified size, if no ContikiMAC header should be
|
||||||
|
used. */
|
||||||
|
#define SICSLOWPAN_CONF_COMPRESSION_THRESHOLD 63
|
||||||
|
#define CONTIKIMAC_CONF_WITH_CONTIKIMAC_HEADER 0
|
||||||
|
|
||||||
#define UIP_CONF_ROUTER 1
|
#define UIP_CONF_ROUTER 1
|
||||||
#define UIP_CONF_IPV6_RPL 1
|
#define UIP_CONF_IPV6_RPL 1
|
||||||
#define UIP_CONF_ND6_SEND_RA 0
|
#define UIP_CONF_ND6_SEND_RA 0
|
||||||
//#define RPL_BORDER_ROUTER 0
|
|
||||||
|
|
||||||
/* A trick to resolve a compilation error with IAR. */
|
#define UIP_CONF_IPV6 1
|
||||||
#ifdef __ICCARM__
|
#define UIP_CONF_IPV6_QUEUE_PKT 0
|
||||||
#define UIP_CONF_DS6_AADDR_NBU 1
|
#define UIP_CONF_IPV6_CHECKS 1
|
||||||
#endif
|
#define UIP_CONF_IPV6_REASSEMBLY 0
|
||||||
|
#define UIP_CONF_ND6_MAX_PREFIXES 2
|
||||||
|
#define UIP_CONF_ND6_MAX_NEIGHBORS 2
|
||||||
|
#define UIP_CONF_ND6_MAX_DEFROUTERS 1
|
||||||
|
#define UIP_CONF_IP_FORWARD 0
|
||||||
|
#define UIP_CONF_BUFFER_SIZE 140
|
||||||
|
#define UIP_CONF_MAX_CONNECTIONS 4
|
||||||
|
#define UIP_CONF_MAX_LISTENPORTS 8
|
||||||
|
#define UIP_CONF_UDP_CONNS 4
|
||||||
|
|
||||||
#define UIP_CONF_IPV6 1
|
#include "net/sicslowpan.h"
|
||||||
#define UIP_CONF_IPV6_QUEUE_PKT 0 // This is a very costly feature as it increases the RAM usage by approximately UIP_ND6_MAX_NEIGHBORS * UIP_LINK_MTU bytes.
|
|
||||||
#define UIP_CONF_IPV6_CHECKS 1
|
|
||||||
#define UIP_CONF_IPV6_REASSEMBLY 0
|
|
||||||
#define UIP_CONF_ND6_MAX_PREFIXES 2
|
|
||||||
#define UIP_CONF_ND6_MAX_NEIGHBORS 2
|
|
||||||
#define UIP_CONF_ND6_MAX_DEFROUTERS 1
|
|
||||||
#define UIP_CONF_IP_FORWARD 0
|
|
||||||
#define UIP_CONF_BUFFER_SIZE 140
|
|
||||||
#define UIP_CONF_MAX_CONNECTIONS 6
|
|
||||||
#define UIP_CONF_MAX_LISTENPORTS 6
|
|
||||||
#define UIP_CONF_UDP_CONNS 3
|
|
||||||
|
|
||||||
#define SICSLOWPAN_CONF_COMPRESSION_IPV6 0
|
|
||||||
#define SICSLOWPAN_CONF_COMPRESSION_HC1 1
|
|
||||||
#define SICSLOWPAN_CONF_COMPRESSION_HC06 2
|
|
||||||
#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_CONF_COMPRESSION_HC06
|
#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_CONF_COMPRESSION_HC06
|
||||||
#define SICSLOWPAN_CONF_FRAG 1
|
#define SICSLOWPAN_CONF_FRAG 1
|
||||||
#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2
|
#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2
|
||||||
#define SICSLOWPAN_CONF_MAXAGE 2
|
#define SICSLOWPAN_CONF_MAXAGE 2
|
||||||
|
|
||||||
#define UIP_CONF_ICMP6 0
|
#else /* WITH_UIP6 */
|
||||||
|
|
||||||
|
/* Network setup for non-IPv6 (rime). */
|
||||||
|
#define NETSTACK_CONF_NETWORK rime_driver
|
||||||
|
|
||||||
#endif /* WITH_UIP6 */
|
#endif /* WITH_UIP6 */
|
||||||
|
|
||||||
#define UIP_CONF_UDP 1
|
|
||||||
#define UIP_CONF_TCP 1
|
|
||||||
|
|
||||||
#define IEEE802154_CONF_PANID 0x1234
|
|
||||||
#define STM32W_NODE_ID 0x5678 // to be deleted
|
|
||||||
#define RF_CHANNEL 16
|
|
||||||
#define RADIO_RXBUFS 2 // Set to a number greater than 1 to decrease packet loss probability at high rates (e.g, with fragmented packets)
|
|
||||||
#define UIP_CONF_LLH_LEN 0
|
|
||||||
|
|
||||||
typedef unsigned long clock_time_t;
|
|
||||||
|
|
||||||
#define CLOCK_CONF_SECOND 1000
|
|
||||||
|
|
||||||
typedef unsigned long long rtimer_clock_t;
|
|
||||||
#define RTIMER_CLOCK_LT(a,b) ((signed short)((a)-(b)) < 0)
|
|
||||||
|
|
||||||
/* LEDs ports MB8xxx */
|
|
||||||
|
|
||||||
#define LEDS_CONF_GREEN LED_D1
|
|
||||||
#define LEDS_CONF_YELLOW LED_D3
|
|
||||||
#define LEDS_CONF_RED LED_D3
|
|
||||||
|
|
||||||
|
|
||||||
#define UIP_ARCH_ADD32 1
|
|
||||||
#define UIP_ARCH_CHKSUM 0
|
|
||||||
|
|
||||||
#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PROJECT_CONF_H
|
#ifdef PROJECT_CONF_H
|
||||||
#include PROJECT_CONF_H
|
#include PROJECT_CONF_H
|
||||||
#endif /* PROJECT_CONF_H */
|
#endif /* PROJECT_CONF_H */
|
||||||
|
|
||||||
|
|
||||||
#endif /* __CONTIKI_CONF_H__ */
|
#endif /* __CONTIKI_CONF_H__ */
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
* Contiki main file.
|
* Contiki main file.
|
||||||
* \author
|
* \author
|
||||||
* Salvatore Pitrulli <salvopitru@users.sourceforge.net>
|
* Salvatore Pitrulli <salvopitru@users.sourceforge.net>
|
||||||
|
* Chi-Anh La <la@imag.fr>
|
||||||
*/
|
*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -65,8 +66,6 @@
|
|||||||
#include "net/rime.h"
|
#include "net/rime.h"
|
||||||
#include "net/rime/rime-udp.h"
|
#include "net/rime/rime-udp.h"
|
||||||
#include "net/uip.h"
|
#include "net/uip.h"
|
||||||
|
|
||||||
|
|
||||||
#define DEBUG 1
|
#define DEBUG 1
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -81,9 +80,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#if UIP_CONF_IPV6
|
#if UIP_CONF_IPV6
|
||||||
PROCINIT(&etimer_process, &tcpip_process, &sensors_process);
|
PROCINIT(&tcpip_process, &sensors_process);
|
||||||
#else
|
#else
|
||||||
PROCINIT(&etimer_process, &sensors_process);
|
PROCINIT(&sensors_process);
|
||||||
#warning "No TCP/IP process!"
|
#warning "No TCP/IP process!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -107,9 +106,6 @@ set_rime_addr(void)
|
|||||||
eui64.u8[c] = stm32w_eui64[7 - c];
|
eui64.u8[c] = stm32w_eui64[7 - c];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PRINTF("\n\rRadio EUI-64:");
|
|
||||||
PRINTLLADDR(eui64);
|
|
||||||
PRINTF("\n\r");
|
|
||||||
|
|
||||||
#if UIP_CONF_IPV6
|
#if UIP_CONF_IPV6
|
||||||
memcpy(&uip_lladdr.addr, &eui64, sizeof(uip_lladdr.addr));
|
memcpy(&uip_lladdr.addr, &eui64, sizeof(uip_lladdr.addr));
|
||||||
@ -160,26 +156,32 @@ main(void)
|
|||||||
uart1_set_input(serial_line_input_byte);
|
uart1_set_input(serial_line_input_byte);
|
||||||
serial_line_init();
|
serial_line_init();
|
||||||
#endif
|
#endif
|
||||||
|
/* rtimer and ctimer should be initialized before radio duty cycling layers*/
|
||||||
|
rtimer_init();
|
||||||
|
/* etimer_process should be initialized before ctimer */
|
||||||
|
process_start(&etimer_process, NULL);
|
||||||
|
ctimer_init();
|
||||||
|
|
||||||
netstack_init();
|
|
||||||
#if !UIP_CONF_IPV6
|
|
||||||
ST_RadioEnableAutoAck(FALSE); // Because frames are not 802.15.4 compatible.
|
|
||||||
ST_RadioEnableAddressFiltering(FALSE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
set_rime_addr();
|
|
||||||
|
|
||||||
ctimer_init();
|
|
||||||
rtimer_init();
|
rtimer_init();
|
||||||
|
netstack_init();
|
||||||
|
set_rime_addr();
|
||||||
|
|
||||||
|
printf("%s %s, channel check rate %lu Hz\n",
|
||||||
|
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||||
|
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
|
||||||
|
NETSTACK_RDC.channel_check_interval()));
|
||||||
|
printf("802.15.4 PAN ID 0x%x, EUI-%d:",
|
||||||
|
IEEE802154_CONF_PANID, UIP_CONF_LL_802154?64:16);
|
||||||
|
uip_debug_lladdr_print(&rimeaddr_node_addr);
|
||||||
|
printf(", radio channel %u\n", RF_CHANNEL);
|
||||||
|
|
||||||
procinit_init();
|
procinit_init();
|
||||||
|
|
||||||
energest_init();
|
energest_init();
|
||||||
ENERGEST_ON(ENERGEST_TYPE_CPU);
|
ENERGEST_ON(ENERGEST_TYPE_CPU);
|
||||||
|
|
||||||
autostart_start(autostart_processes);
|
autostart_start(autostart_processes);
|
||||||
|
|
||||||
|
|
||||||
watchdog_start();
|
watchdog_start();
|
||||||
|
|
||||||
while(1){
|
while(1){
|
||||||
|
92
platform/mbxxx/platform-conf.h
Normal file
92
platform/mbxxx/platform-conf.h
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2010, STMicroelectronics.
|
||||||
|
* 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. The name of the author may not be used to endorse or promote
|
||||||
|
* products derived from this software without specific prior
|
||||||
|
* written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 OS
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* \file
|
||||||
|
* platform-conf.h for MBXXX.
|
||||||
|
* \author
|
||||||
|
* Salvatore Pitrulli <salvopitru@users.sourceforge.net>
|
||||||
|
* Chi-Anh La <la@imag.fr>
|
||||||
|
* Simon Duquennoy <simonduq@sics.se>
|
||||||
|
*/
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef __PLATFORM_CONF_H__
|
||||||
|
#define __PLATFORM_CONF_H__
|
||||||
|
|
||||||
|
#include PLATFORM_HEADER
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <string.h> // For memcpm().
|
||||||
|
|
||||||
|
/* Platform-dependent definitions */
|
||||||
|
#define CC_CONF_REGISTER_ARGS 0
|
||||||
|
#define CC_CONF_FUNCTION_POINTER_ARGS 1
|
||||||
|
#define CC_CONF_FASTCALL
|
||||||
|
#define CC_CONF_VA_ARGS 1
|
||||||
|
#define CC_CONF_INLINE inline
|
||||||
|
|
||||||
|
#define CCIF
|
||||||
|
#define CLIF
|
||||||
|
|
||||||
|
typedef unsigned short uip_stats_t;
|
||||||
|
|
||||||
|
#define UART1_CONF_TX_WITH_INTERRUPT 0
|
||||||
|
#define WITH_SERIAL_LINE_INPUT 1
|
||||||
|
|
||||||
|
/* rtimer_second = 11719 */
|
||||||
|
#define RT_CONF_RESOLUTION 2
|
||||||
|
|
||||||
|
/* A trick to resolve a compilation error with IAR. */
|
||||||
|
#ifdef __ICCARM__
|
||||||
|
#define UIP_CONF_DS6_AADDR_NBU 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef unsigned long clock_time_t;
|
||||||
|
|
||||||
|
#define CLOCK_CONF_SECOND 1000
|
||||||
|
|
||||||
|
typedef unsigned long rtimer_clock_t;
|
||||||
|
#define RTIMER_CLOCK_LT(a,b) ((signed short)((a)-(b)) < 0)
|
||||||
|
|
||||||
|
/* LEDs ports MB8xxx */
|
||||||
|
#define LEDS_CONF_GREEN LED_D1
|
||||||
|
#define LEDS_CONF_YELLOW LED_D3
|
||||||
|
#define LEDS_CONF_RED LED_D3
|
||||||
|
|
||||||
|
#define UIP_ARCH_ADD32 1
|
||||||
|
#define UIP_ARCH_CHKSUM 0
|
||||||
|
|
||||||
|
#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN
|
||||||
|
|
||||||
|
#endif /* __PLATFORM_CONF_H__ */
|
Loading…
Reference in New Issue
Block a user