Added configuration in order to run Rime.
This commit is contained in:
parent
25ceab07d2
commit
d8711d32a3
|
@ -29,6 +29,7 @@
|
|||
*
|
||||
* This file is part of the Contiki OS
|
||||
*
|
||||
* $Id: stm32w-radio.c,v 1.2 2010/10/27 14:05:23 salvopitru Exp $
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
|
@ -218,9 +219,6 @@ static int stm32w_radio_init(void)
|
|||
ST_RadioSetNodeId(STM32W_NODE_ID); // To be deleted.
|
||||
ST_RadioSetPanId(IEEE802154_PANID);
|
||||
|
||||
ST_RadioEnableAutoAck(TRUE);
|
||||
|
||||
|
||||
CLEAN_RXBUFS();
|
||||
CLEAN_TXBUF();
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
*
|
||||
* This file is part of the Contiki OS
|
||||
*
|
||||
* $Id: contiki-conf.h,v 1.1 2010/10/25 09:03:39 salvopitru Exp $
|
||||
* $Id: contiki-conf.h,v 1.2 2010/10/27 14:05:24 salvopitru Exp $
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
|
@ -79,6 +79,8 @@ typedef unsigned short uip_stats_t;
|
|||
#define QUEUEBUF_CONF_NUM 2
|
||||
|
||||
|
||||
#define NETSTACK_CONF_RADIO stm32w_radio_driver
|
||||
|
||||
#if WITH_UIP6
|
||||
|
||||
/* No radio cycling */
|
||||
|
@ -86,8 +88,9 @@ typedef unsigned short uip_stats_t;
|
|||
#define NETSTACK_CONF_MAC nullmac_driver
|
||||
#define NETSTACK_CONF_RDC sicslowmac_driver
|
||||
#define NETSTACK_CONF_FRAMER framer_802154
|
||||
#define NETSTACK_CONF_RADIO stm32w_radio_driver
|
||||
|
||||
#define RIMEADDR_CONF_SIZE 8
|
||||
#define UIP_CONF_LL_802154 1
|
||||
|
||||
#define UIP_CONF_ROUTER 1
|
||||
#define UIP_CONF_IPV6_RPL 1
|
||||
|
@ -103,7 +106,6 @@ typedef unsigned short uip_stats_t;
|
|||
#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_NETIF_MAX_ADDRESSES 3
|
||||
#define UIP_CONF_ND6_MAX_PREFIXES 2
|
||||
#define UIP_CONF_ND6_MAX_NEIGHBORS 2
|
||||
#define UIP_CONF_ND6_MAX_DEFROUTERS 1
|
||||
|
@ -131,8 +133,6 @@ typedef unsigned short uip_stats_t;
|
|||
#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 RIMEADDR_CONF_SIZE 8
|
||||
#define UIP_CONF_LL_802154 1
|
||||
#define UIP_CONF_LLH_LEN 0
|
||||
|
||||
typedef unsigned long clock_time_t;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
*
|
||||
* This file is part of the Contiki OS
|
||||
*
|
||||
* $Id: contiki-main.c,v 1.1 2010/10/25 09:03:39 salvopitru Exp $
|
||||
* $Id: contiki-main.c,v 1.2 2010/10/27 14:05:24 salvopitru Exp $
|
||||
*/
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
|
@ -81,7 +81,7 @@
|
|||
#endif
|
||||
|
||||
|
||||
#ifdef WITH_UIP6
|
||||
#if UIP_CONF_IPV6
|
||||
PROCINIT(&etimer_process, &tcpip_process, &sensors_process);
|
||||
#else
|
||||
PROCINIT(&etimer_process, &sensors_process);
|
||||
|
@ -91,7 +91,45 @@ PROCINIT(&etimer_process, &sensors_process);
|
|||
SENSORS(&button_sensor,&temperature_sensor,&acc_sensor);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
set_rime_addr(void)
|
||||
{
|
||||
int i;
|
||||
union {
|
||||
u8_t u8[8];
|
||||
}eui64;
|
||||
|
||||
//rimeaddr_t lladdr;
|
||||
|
||||
int8u *stm32w_eui64 = ST_RadioGetEui64();
|
||||
{
|
||||
int8u c;
|
||||
for(c = 0; c < 8; c++) { // Copy the EUI-64 to lladdr converting from Little-Endian to Big-Endian.
|
||||
eui64.u8[c] = stm32w_eui64[7 - c];
|
||||
}
|
||||
}
|
||||
PRINTF("\n\rRadio EUI-64:");
|
||||
PRINTLLADDR(eui64);
|
||||
PRINTF("\n\r");
|
||||
|
||||
#if UIP_CONF_IPV6
|
||||
memcpy(&uip_lladdr.addr, &eui64, sizeof(uip_lladdr.addr));
|
||||
#endif
|
||||
|
||||
#if UIP_CONF_IPV6
|
||||
rimeaddr_set_node_addr((rimeaddr_t *)&eui64);
|
||||
#else
|
||||
rimeaddr_set_node_addr((rimeaddr_t *)&eui64.u8[8-RIMEADDR_SIZE]);
|
||||
#endif
|
||||
|
||||
printf("Rime started with address ");
|
||||
for(i = 0; i < sizeof(rimeaddr_t) - 1; i++) {
|
||||
printf("%d.", rimeaddr_node_addr.u8[i]);
|
||||
}
|
||||
printf("%d\n", rimeaddr_node_addr.u8[i]);
|
||||
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
|
@ -119,35 +157,18 @@ main(void)
|
|||
|
||||
process_init();
|
||||
|
||||
#if WITH_SERIAL_LINE_INPUT
|
||||
#if WITH_SERIAL_LINE_INPUT
|
||||
uart1_set_input(serial_line_input_byte);
|
||||
serial_line_init();
|
||||
#endif
|
||||
|
||||
#ifdef WITH_UIP6
|
||||
#endif
|
||||
|
||||
netstack_init();
|
||||
|
||||
{
|
||||
rimeaddr_t lladdr;
|
||||
|
||||
int8u *stm32w_eui64 = ST_RadioGetEui64();
|
||||
{
|
||||
int8u c;
|
||||
for(c = 0; c < 8; c++) { // Copy the EUI-64 to lladdr converting from Little-Endian to Big-Endian.
|
||||
lladdr.u8[c] = stm32w_eui64[7 - c];
|
||||
}
|
||||
}
|
||||
PRINTF("\n\rRadio EUI-64:");
|
||||
PRINTLLADDR(lladdr);
|
||||
PRINTF("\n\r");
|
||||
|
||||
rimeaddr_set_node_addr(&lladdr);
|
||||
|
||||
memcpy(&uip_lladdr.addr, &lladdr, sizeof(uip_lladdr.addr));
|
||||
}
|
||||
|
||||
#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();
|
||||
|
|
Loading…
Reference in a new issue