diff --git a/Makefile.include b/Makefile.include index e3e169a37..ffeee925b 100644 --- a/Makefile.include +++ b/Makefile.include @@ -67,7 +67,7 @@ CFLAGS += -DCONTIKI=1 -DCONTIKI_TARGET_$(TARGET_UPPERCASE)=1 MODULES += core/sys core/dev core/lib -# Include IPv6, IPv4, and/or Rime +# Include IPv6, RPL HAS_STACK = 0 diff --git a/apps/orchestra/orchestra.c b/apps/orchestra/orchestra.c index c695bd397..c7ab3e387 100644 --- a/apps/orchestra/orchestra.c +++ b/apps/orchestra/orchestra.c @@ -48,7 +48,7 @@ /* A net-layer sniffer for packets sent and received */ static void orchestra_packet_received(void); static void orchestra_packet_sent(int mac_status); -RIME_SNIFFER(orchestra_sniffer, orchestra_packet_received, orchestra_packet_sent); +NETSTACK_SNIFFER(orchestra_sniffer, orchestra_packet_received, orchestra_packet_sent); /* The current RPL preferred parent's link-layer address */ linkaddr_t orchestra_parent_linkaddr; @@ -152,7 +152,7 @@ orchestra_init(void) int i; /* Snoop on packet transmission to know if our parent knows about us * (i.e. has ACKed at one of our DAOs since we decided to use it as a parent) */ - rime_sniffer_add(&orchestra_sniffer); + netstack_sniffer_add(&orchestra_sniffer); linkaddr_copy(&orchestra_parent_linkaddr, &linkaddr_null); /* Initialize all Orchestra rules */ for(i = 0; i < NUM_RULES; i++) { diff --git a/core/net/ip/tcpip.c b/core/net/ip/tcpip.c index 3b1091b9d..d9e609c0f 100644 --- a/core/net/ip/tcpip.c +++ b/core/net/ip/tcpip.c @@ -31,7 +31,7 @@ /** * \file - * Code for tunnelling uIP packets over the Rime mesh routing module + * Core of the TCP/IP stack, handles input/output/routing * * \author Adam Dunkels \author * \author Mathilde Durvy (IPv6 related code) diff --git a/core/net/ipv6/sicslowpan.c b/core/net/ipv6/sicslowpan.c index 39139e82f..7b967b7af 100644 --- a/core/net/ipv6/sicslowpan.c +++ b/core/net/ipv6/sicslowpan.c @@ -421,18 +421,18 @@ copy_frags2uip(int context) /* -------------------------------------------------------------------------- */ /*-------------------------------------------------------------------------*/ -/* Rime Sniffer support for one single listener to enable powertrace of IP */ +/* Basic netstack sniffer */ /*-------------------------------------------------------------------------*/ -static struct rime_sniffer *callback = NULL; +static struct netstack_sniffer *callback = NULL; void -rime_sniffer_add(struct rime_sniffer *s) +netstack_sniffer_add(struct netstack_sniffer *s) { callback = s; } void -rime_sniffer_remove(struct rime_sniffer *s) +netstack_sniffer_remove(struct netstack_sniffer *s) { callback = NULL; } diff --git a/core/net/linkaddr.c b/core/net/linkaddr.c index 1f08b0824..c63f08135 100644 --- a/core/net/linkaddr.c +++ b/core/net/linkaddr.c @@ -32,7 +32,7 @@ /** * \file - * Functions for manipulating Rime addresses + * Functions for manipulating link-layer addresses * \author * Adam Dunkels */ diff --git a/core/net/linkaddr.h b/core/net/linkaddr.h index e2a4bfc4f..839af4cbe 100644 --- a/core/net/linkaddr.h +++ b/core/net/linkaddr.h @@ -32,22 +32,21 @@ /** * \file - * Header file for the Rime address representation + * Header file for the link-layer address representation * \author * Adam Dunkels */ /** - * \addtogroup rime + * \addtogroup netstack * @{ */ /** - * \defgroup linkaddr Rime addresses + * \defgroup linkaddr link-layer addresses * @{ * - * The linkaddr module is an abstract representation of addresses in - * Rime. + * The linkaddr module handles link-layer addresses. * */ @@ -75,23 +74,23 @@ typedef union { } linkaddr_extended_t; /** - * \brief Copy a Rime address + * \brief Copy a link-layer address * \param dest The destination * \param from The source * - * This function copies a Rime address from one location + * This function copies a link-layer address from one location * to another. * */ void linkaddr_copy(linkaddr_t *dest, const linkaddr_t *from); /** - * \brief Compare two Rime addresses + * \brief Compare two link-layer addresses * \param addr1 The first address * \param addr2 The second address * \return Non-zero if the addresses are the same, zero if they are different * - * This function compares two Rime addresses and returns + * This function compares two link-layer addresses and returns * the result of the comparison. The function acts like * the '==' operator and returns non-zero if the addresses * are the same, and zero if the addresses are different. @@ -104,15 +103,15 @@ int linkaddr_cmp(const linkaddr_t *addr1, const linkaddr_t *addr2); * \brief Set the address of the current node * \param addr The address * - * This function sets the Rime address of the node. + * This function sets the link-layer address of the node. * */ void linkaddr_set_node_addr(linkaddr_t *addr); /** - * \brief The Rime address of the node + * \brief The link-layer address of the node * - * This variable contains the Rime address of the + * This variable contains the link-layer address of the * node. This variable should not be changed directly; * rather, the linkaddr_set_node_addr() function should be * used. @@ -121,9 +120,9 @@ void linkaddr_set_node_addr(linkaddr_t *addr); extern linkaddr_t linkaddr_node_addr; /** - * \brief The null Rime address + * \brief The null link-layer address * - * This variable contains the null Rime address. The null + * This variable contains the null link-layer address. The null * address is used in route tables to indicate that the * table entry is unused. Nodes with no configured address * has the null address. Nodes with their node address set diff --git a/core/net/mac/csma/csma-output.c b/core/net/mac/csma/csma-output.c index 555c8e88a..0402ddd56 100644 --- a/core/net/mac/csma/csma-output.c +++ b/core/net/mac/csma/csma-output.c @@ -192,9 +192,6 @@ send_one_packet(mac_callback_t sent, void *ptr) sending with auto ack. */ ret = MAC_TX_COLLISION; } else { - if(!is_broadcast) { - RIMESTATS_ADD(reliabletx); - } switch(NETSTACK_RADIO.transmit(packetbuf_totlen())) { case RADIO_TX_OK: @@ -236,7 +233,6 @@ send_one_packet(mac_callback_t sent, void *ptr) len = NETSTACK_RADIO.read(ackbuf, CSMA_ACK_LEN); if(len == CSMA_ACK_LEN && ackbuf[2] == dsn) { /* Ack received */ - RIMESTATS_ADD(ackrx); ret = MAC_TX_OK; } else { /* Not an ack or ack not for us: collision */ diff --git a/core/net/mac/framer/framer-802154.c b/core/net/mac/framer/framer-802154.c index 4b219a980..39c652b08 100644 --- a/core/net/mac/framer/framer-802154.c +++ b/core/net/mac/framer/framer-802154.c @@ -129,7 +129,7 @@ create_frame(int type, int do_create) /* Complete the addressing fields. */ /** \todo For phase 1 the addresses are all long. We'll need a mechanism - in the rime attributes to tell the mac to use long or short for phase 2. + in the packetbuf attributes to tell the mac to use long or short for phase 2. */ if(LINKADDR_SIZE == 2) { /* Use short address mode if linkaddr size is short. */ diff --git a/core/net/mac/mac-sequence.h b/core/net/mac/mac-sequence.h index 455160c2d..e3f2e9f92 100644 --- a/core/net/mac/mac-sequence.h +++ b/core/net/mac/mac-sequence.h @@ -51,7 +51,7 @@ * * This function is used to check for duplicate packet by comparing * the sequence number of the incoming packet with the last few ones - * we saw, filtering with the Rime address. + * we saw, filtering with the link-layer address. */ int mac_sequence_is_duplicate(void); diff --git a/core/net/mac/mac.h b/core/net/mac/mac.h index 61c0fa0f2..be0b5d470 100644 --- a/core/net/mac/mac.h +++ b/core/net/mac/mac.h @@ -57,12 +57,12 @@ struct mac_driver { /** Initialize the MAC driver */ void (* init)(void); - /** Send a packet from the Rime buffer */ + /** Send a packet from the packetbuf */ void (* send)(mac_callback_t sent_callback, void *ptr); /** Callback for getting notified of incoming packet. */ void (* input)(void); - + /** Turn the MAC layer on. */ int (* on)(void); diff --git a/core/net/netstack.h b/core/net/netstack.h index a65fccd4a..5f109f9d5 100644 --- a/core/net/netstack.h +++ b/core/net/netstack.h @@ -99,23 +99,18 @@ extern const struct framer NETSTACK_FRAMER; void netstack_init(void); -/* "Rime" sniffer */ +/* Netstack sniffer */ -struct rime_sniffer { - struct rime_sniffer *next; +struct netstack_sniffer { + struct netstack_sniffer *next; void (* input_callback)(void); void (* output_callback)(int mac_status); }; -#define RIME_SNIFFER(name, input_callback, output_callback) \ -static struct rime_sniffer name = { NULL, input_callback, output_callback } +#define NETSTACK_SNIFFER(name, input_callback, output_callback) \ +static struct netstack_sniffer name = { NULL, input_callback, output_callback } -void rime_sniffer_add(struct rime_sniffer *s); -void rime_sniffer_remove(struct rime_sniffer *s); - -/* Rimestats. Does nothing (for now) */ - -#define RIMESTATS_ADD(x) -#define RIMESTATS_GET(x) 0 +void netstack_sniffer_add(struct netstack_sniffer *s); +void netstack_sniffer_remove(struct netstack_sniffer *s); #endif /* NETSTACK_H */ diff --git a/core/net/packetbuf.c b/core/net/packetbuf.c index 164e9824f..68dd9b620 100644 --- a/core/net/packetbuf.c +++ b/core/net/packetbuf.c @@ -32,7 +32,7 @@ /** * \file - * Rime buffer (packetbuf) management + * Packet buffer (packetbuf) management * \author * Adam Dunkels */ @@ -92,20 +92,6 @@ packetbuf_copyfrom(const void *from, uint16_t len) return l; } /*---------------------------------------------------------------------------*/ -void -packetbuf_compact(void) -{ - int16_t i; - - if(bufptr) { - /* shift data to the left */ - for(i = 0; i < buflen; i++) { - packetbuf[hdrlen + i] = packetbuf[packetbuf_hdrlen() + i]; - } - bufptr = 0; - } -} -/*---------------------------------------------------------------------------*/ int packetbuf_copyto(void *to) { diff --git a/core/net/packetbuf.h b/core/net/packetbuf.h index 7e2d23673..8ec160b7e 100644 --- a/core/net/packetbuf.h +++ b/core/net/packetbuf.h @@ -32,21 +32,21 @@ /** * \file - * Header file for the Rime buffer (packetbuf) management + * Header file for the Packet buffer (packetbuf) management * \author * Adam Dunkels */ /** - * \addtogroup rime + * \addtogroup netstack * @{ */ /** - * \defgroup packetbuf Rime buffer management + * \defgroup packetbuf Packet buffer management * @{ * - * The packetbuf module does Rime's buffer management. + * The packetbuf module does Contiki's buffer management. */ #ifndef PACKETBUF_H_ @@ -130,20 +130,6 @@ uint16_t packetbuf_remaininglen(void); */ void packetbuf_set_datalen(uint16_t len); -/** - * \brief Compact the packetbuf - * - * This function compacts the packetbuf by copying the data - * portion of the packetbuf so that becomes consecutive to - * the header. - * - * This function is called by the Rime code before a - * packet is to be sent by a device driver. This assures - * that the entire packet is consecutive in memory. - * - */ -void packetbuf_compact(void); - /** * \brief Copy from external data into the packetbuf * \param from A pointer to the data from which to copy diff --git a/core/net/queuebuf.c b/core/net/queuebuf.c index 1cfc7561c..91eeb88d7 100644 --- a/core/net/queuebuf.c +++ b/core/net/queuebuf.c @@ -32,13 +32,13 @@ /** * \file - * Implementation of the Rime queue buffers + * Implementation of the Packet queue buffers * \author * Adam Dunkels */ /** - * \addtogroup rimequeuebuf + * \addtogroup queuebuf * @{ */ diff --git a/core/net/queuebuf.h b/core/net/queuebuf.h index 89e9aba29..3c9784711 100644 --- a/core/net/queuebuf.h +++ b/core/net/queuebuf.h @@ -32,18 +32,18 @@ /** * \file - * Header file for the Rime queue buffer management + * Header file for the Packet queue buffer management * \author * Adam Dunkels */ /** - * \addtogroup rime + * \addtogroup netstack * @{ */ /** - * \defgroup rimequeuebuf Rime queue buffer management + * \defgroup queuebuf Packet queue buffer management * @{ * * The queuebuf module handles buffers that are queued. diff --git a/drivers/cpu/cc2538/dev/cc2538-rf.c b/drivers/cpu/cc2538/dev/cc2538-rf.c index de6cdbbf8..942aca2db 100644 --- a/drivers/cpu/cc2538/dev/cc2538-rf.c +++ b/drivers/cpu/cc2538/dev/cc2538-rf.c @@ -625,7 +625,6 @@ transmit(unsigned short transmit_len) if(send_on_cca) { if(channel_clear() == CC2538_RF_CCA_BUSY) { - RIMESTATS_ADD(contentiondrop); return RADIO_TX_COLLISION; } } @@ -635,7 +634,6 @@ transmit(unsigned short transmit_len) * receiving. Abort transmission and bail out with RADIO_TX_COLLISION */ if(REG(RFCORE_XREG_FSMSTAT1) & RFCORE_XREG_FSMSTAT1_SFD) { - RIMESTATS_ADD(contentiondrop); return RADIO_TX_COLLISION; } @@ -667,8 +665,6 @@ transmit(unsigned short transmit_len) off(); } - RIMESTATS_ADD(lltx); - return ret; } /*---------------------------------------------------------------------------*/ @@ -699,7 +695,6 @@ read(void *buf, unsigned short bufsize) /* Oops, we must be out of sync. */ PRINTF("RF: bad sync\n"); - RIMESTATS_ADD(badsynch); CC2538_RF_CSP_ISFLUSHRX(); return 0; } @@ -707,7 +702,6 @@ read(void *buf, unsigned short bufsize) if(len <= CC2538_RF_MIN_PACKET_LEN) { PRINTF("RF: too short\n"); - RIMESTATS_ADD(tooshort); CC2538_RF_CSP_ISFLUSHRX(); return 0; } @@ -715,7 +709,6 @@ read(void *buf, unsigned short bufsize) if(len - CHECKSUM_LEN > bufsize) { PRINTF("RF: too long\n"); - RIMESTATS_ADD(toolong); CC2538_RF_CSP_ISFLUSHRX(); return 0; } @@ -761,9 +754,7 @@ read(void *buf, unsigned short bufsize) if(crc_corr & CRC_BIT_MASK) { packetbuf_set_attr(PACKETBUF_ATTR_RSSI, rssi); packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, crc_corr & LQI_BIT_MASK); - RIMESTATS_ADD(llrx); } else { - RIMESTATS_ADD(badcrc); PRINTF("RF: Bad CRC\n"); CC2538_RF_CSP_ISFLUSHRX(); return 0; diff --git a/drivers/cpu/cc253x/dev/cc2530-rf.c b/drivers/cpu/cc253x/dev/cc2530-rf.c index 52c9a1c3e..5933f7ce3 100644 --- a/drivers/cpu/cc253x/dev/cc2530-rf.c +++ b/drivers/cpu/cc253x/dev/cc2530-rf.c @@ -45,7 +45,6 @@ #include "sys/rtimer.h" #include "net/packetbuf.h" -#include "net/rime/rimestats.h" #include "net/linkaddr.h" #include "net/netstack.h" @@ -431,7 +430,6 @@ transmit(unsigned short transmit_len) } if(channel_clear() == CC2530_RF_CCA_BUSY) { - RIMESTATS_ADD(contentiondrop); return RADIO_TX_COLLISION; } @@ -440,7 +438,6 @@ transmit(unsigned short transmit_len) * receiving. Abort transmission and bail out with RADIO_TX_COLLISION */ if(FSMSTAT1 & FSMSTAT1_SFD) { - RIMESTATS_ADD(contentiondrop); return RADIO_TX_COLLISION; } @@ -472,8 +469,6 @@ transmit(unsigned short transmit_len) off(); } - RIMESTATS_ADD(lltx); - RF_TX_LED_OFF(); /* OK, sent. We are now ready to send more */ @@ -505,7 +500,6 @@ read(void *buf, unsigned short bufsize) /* Oops, we must be out of sync. */ PUTSTRING("RF: bad sync\n"); - RIMESTATS_ADD(badsynch); CC2530_CSP_ISFLUSHRX(); return 0; } @@ -513,7 +507,6 @@ read(void *buf, unsigned short bufsize) if(len <= CC2530_RF_MIN_PACKET_LEN) { PUTSTRING("RF: too short\n"); - RIMESTATS_ADD(tooshort); CC2530_CSP_ISFLUSHRX(); return 0; } @@ -521,7 +514,6 @@ read(void *buf, unsigned short bufsize) if(len - CHECKSUM_LEN > bufsize) { PUTSTRING("RF: too long\n"); - RIMESTATS_ADD(toolong); CC2530_CSP_ISFLUSHRX(); return 0; } @@ -546,9 +538,7 @@ read(void *buf, unsigned short bufsize) if(crc_corr & CRC_BIT_MASK) { packetbuf_set_attr(PACKETBUF_ATTR_RSSI, rssi); packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, crc_corr & LQI_BIT_MASK); - RIMESTATS_ADD(llrx); } else { - RIMESTATS_ADD(badcrc); CC2530_CSP_ISFLUSHRX(); RF_RX_LED_OFF(); return 0; diff --git a/drivers/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c b/drivers/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c index 4d2289153..ae9a91f81 100644 --- a/drivers/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c +++ b/drivers/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c @@ -966,7 +966,6 @@ transmit(unsigned short transmit_len) if(stat == RF_CORE_RADIO_OP_STATUS_IEEE_DONE_OK) { /* Sent OK */ - RIMESTATS_ADD(lltx); ret = RADIO_TX_OK; } else { /* Operation completed, but frame was not sent */ @@ -1081,7 +1080,6 @@ read_frame(void *buf, unsigned short buf_len) if(rx_read_entry[8] < 4) { PRINTF("RF: too short\n"); - RIMESTATS_ADD(tooshort); release_data_entry(); return 0; @@ -1091,7 +1089,6 @@ read_frame(void *buf, unsigned short buf_len) if(len > buf_len) { PRINTF("RF: too long\n"); - RIMESTATS_ADD(toolong); release_data_entry(); return 0; @@ -1114,7 +1111,6 @@ read_frame(void *buf, unsigned short buf_len) packetbuf_set_attr(PACKETBUF_ATTR_RSSI, last_rssi); packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, last_corr_lqi); } - RIMESTATS_ADD(llrx); release_data_entry(); diff --git a/drivers/cpu/cc26xx-cc13xx/rf-core/prop-mode.c b/drivers/cpu/cc26xx-cc13xx/rf-core/prop-mode.c index 7a4f8b634..fb2099ed7 100644 --- a/drivers/cpu/cc26xx-cc13xx/rf-core/prop-mode.c +++ b/drivers/cpu/cc26xx-cc13xx/rf-core/prop-mode.c @@ -719,7 +719,6 @@ transmit(unsigned short transmit_len) if(cmd_tx_adv->status == RF_CORE_RADIO_OP_STATUS_PROP_DONE_OK) { /* Sent OK */ - RIMESTATS_ADD(lltx); ret = RADIO_TX_OK; } else { /* Operation completed, but frame was not sent */ diff --git a/drivers/cpu/cc26xx-cc13xx/rf-core/rf-core.c b/drivers/cpu/cc26xx-cc13xx/rf-core/rf-core.c index eefab9e7d..5f56ca280 100644 --- a/drivers/cpu/cc26xx-cc13xx/rf-core/rf-core.c +++ b/drivers/cpu/cc26xx-cc13xx/rf-core/rf-core.c @@ -562,8 +562,6 @@ PROCESS_THREAD(rf_core_process, ev, data) static void rx_nok_isr(void) { - RIMESTATS_ADD(badcrc); - PRINTF("RF: Bad CRC\n"); } /*---------------------------------------------------------------------------*/ void diff --git a/drivers/dev/cc1200/cc1200.c b/drivers/dev/cc1200/cc1200.c index 5d8b5969a..c1492317d 100644 --- a/drivers/dev/cc1200/cc1200.c +++ b/drivers/dev/cc1200/cc1200.c @@ -756,7 +756,6 @@ transmit(unsigned short transmit_len) /* Perform clear channel assessment */ if(!channel_clear()) { /* Channel occupied */ - RIMESTATS_ADD(contentiondrop); if(was_off) { off(); } @@ -789,8 +788,6 @@ transmit(unsigned short transmit_len) } #endif - RIMESTATS_ADD(lltx); - /* Send data using TX FIFO */ if(idle_tx_rx((const uint8_t *)tx_pkt, tx_pkt_len) == RADIO_TX_OK) { @@ -886,8 +883,6 @@ read(void *buf, unsigned short buf_len) /* Mask out CRC bit */ packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, crc_lqi & ~(1 << 7)); - - RIMESTATS_ADD(llrx); } } @@ -2300,7 +2295,6 @@ cc1200_rx_interrupt(void) if(payload_len < ACK_LEN) { /* Packet to short. Discard it */ WARNING("RF: Packet too short!\n"); - RIMESTATS_ADD(tooshort); rx_rx(); RELEASE_SPI(); return 0; @@ -2309,7 +2303,6 @@ cc1200_rx_interrupt(void) if(payload_len > CC1200_MAX_PAYLOAD_LEN) { /* Packet to long. Discard it */ WARNING("RF: Packet to long!\n"); - RIMESTATS_ADD(toolong); rx_rx(); RELEASE_SPI(); return 0; @@ -2374,7 +2367,6 @@ cc1200_rx_interrupt(void) if(!(crc_lqi & (1 << 7))) { /* CRC error. Drop the packet */ INFO("RF: CRC error!\n"); - RIMESTATS_ADD(badcrc); } else if(rx_pkt_len != 0) { /* An old packet is pending. Drop the packet */ WARNING("RF: Packet pending!\n"); diff --git a/drivers/dev/cc2420/cc2420.c b/drivers/dev/cc2420/cc2420.c index 6322854c9..56428706f 100644 --- a/drivers/dev/cc2420/cc2420.c +++ b/drivers/dev/cc2420/cc2420.c @@ -740,7 +740,6 @@ cc2420_transmit(unsigned short payload_len) /* If we send with cca (cca_on_send), we get here if the packet wasn't transmitted because of other channel activity. */ - RIMESTATS_ADD(contentiondrop); PRINTF("cc2420: do_send() transmission never started\n"); RELEASE_LOCK(); @@ -756,8 +755,6 @@ cc2420_prepare(const void *payload, unsigned short payload_len) PRINTF("cc2420: sending %d bytes\n", payload_len); - RIMESTATS_ADD(lltx); - /* Wait for any previous transmission to finish. */ /* while(status() & BV(CC2420_TX_ACTIVE));*/ @@ -930,11 +927,10 @@ cc2420_read(void *buf, unsigned short bufsize) if(len > CC2420_MAX_PACKET_LEN) { /* Oops, we must be out of sync. */ - RIMESTATS_ADD(badsynch); } else if(len <= FOOTER_LEN) { - RIMESTATS_ADD(tooshort); + /* Packet too short */ } else if(len - FOOTER_LEN > bufsize) { - RIMESTATS_ADD(toolong); + /* Packet too long */ } else { getrxdata((uint8_t *) buf, len - FOOTER_LEN); getrxdata(footer, FOOTER_LEN); @@ -949,10 +945,7 @@ cc2420_read(void *buf, unsigned short bufsize) packetbuf_set_attr(PACKETBUF_ATTR_RSSI, cc2420_last_rssi); packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY, cc2420_last_correlation); } - - RIMESTATS_ADD(llrx); } else { - RIMESTATS_ADD(badcrc); len = FOOTER_LEN; } diff --git a/drivers/platform/cc2538dk/contiki-conf.h b/drivers/platform/cc2538dk/contiki-conf.h index b51edd85d..ee2c7ece3 100644 --- a/drivers/platform/cc2538dk/contiki-conf.h +++ b/drivers/platform/cc2538dk/contiki-conf.h @@ -287,7 +287,7 @@ typedef uint32_t rtimer_clock_t; /** * \name IEEE address configuration * - * Used to generate our RIME & IPv6 address + * Used to generate our link-layer & IPv6 address * @{ */ /** @@ -350,7 +350,7 @@ typedef uint32_t rtimer_clock_t; /** @} */ /*---------------------------------------------------------------------------*/ /** - * \name IPv6, RIME and network buffer configuration + * \name IPv6 and network buffer configuration * * @{ */ diff --git a/drivers/platform/cc2538dk/contiki-main.c b/drivers/platform/cc2538dk/contiki-main.c index e7f623f56..31c186974 100644 --- a/drivers/platform/cc2538dk/contiki-main.c +++ b/drivers/platform/cc2538dk/contiki-main.c @@ -121,7 +121,7 @@ set_rf_params(void) #if STARTUP_CONF_VERBOSE { int i; - printf("Rime configured with address "); + printf("Contiki configured with address "); for(i = 0; i < LINKADDR_SIZE - 1; i++) { printf("%02x:", linkaddr_node_addr.u8[i]); } diff --git a/drivers/platform/cooja/Makefile.cooja b/drivers/platform/cooja/Makefile.cooja index 30dfc33ec..b7fbcd9cc 100644 --- a/drivers/platform/cooja/Makefile.cooja +++ b/drivers/platform/cooja/Makefile.cooja @@ -82,10 +82,6 @@ MODULES += core/net core/net/mac core/net/mac/framer core/net/ip64-addr \ ## Copied from Makefile.include, since Cooja overrides CFLAGS et al HAS_STACK = 0 -ifeq ($(CONTIKI_WITH_RIME),1) - HAS_STACK = 1 - CFLAGS += -DNETSTACK_CONF_WITH_RIME=1 -endif # Make IPv6 the default stack ifeq ($(HAS_STACK),0) diff --git a/drivers/platform/cooja/contiki-cooja-main.c b/drivers/platform/cooja/contiki-cooja-main.c index 9a39e90b0..625cf6896 100644 --- a/drivers/platform/cooja/contiki-cooja-main.c +++ b/drivers/platform/cooja/contiki-cooja-main.c @@ -144,7 +144,7 @@ rtimer_thread_loop(void *data) } /*---------------------------------------------------------------------------*/ static void -set_rime_addr(void) +set_lladdr(void) { linkaddr_t addr; int i; @@ -160,7 +160,7 @@ set_rime_addr(void) addr.u8[1] = node_id >> 8; #endif /* NETSTACK_CONF_WITH_IPV6 */ linkaddr_set_node_addr(&addr); - printf("Rime started with address "); + printf("Contiki started with address "); for(i = 0; i < sizeof(addr.u8) - 1; i++) { printf("%d.", addr.u8[i]); } @@ -190,7 +190,7 @@ contiki_init() printf("Node id is not set.\n"); } - set_rime_addr(); + set_lladdr(); { uint8_t longaddr[8]; diff --git a/drivers/platform/cooja/dev/cooja-radio.c b/drivers/platform/cooja/dev/cooja-radio.c index 5f56b06b4..4f7e6a357 100644 --- a/drivers/platform/cooja/dev/cooja-radio.c +++ b/drivers/platform/cooja/dev/cooja-radio.c @@ -172,7 +172,6 @@ radio_read(void *buf, unsigned short bufsize) } if(bufsize < simInSize) { simInSize = 0; /* rx flush */ - RIMESTATS_ADD(toolong); return 0; } diff --git a/drivers/platform/jn516x/contiki-conf.h b/drivers/platform/jn516x/contiki-conf.h index b36e54a18..3fad0e5c3 100644 --- a/drivers/platform/jn516x/contiki-conf.h +++ b/drivers/platform/jn516x/contiki-conf.h @@ -75,7 +75,7 @@ #define QUEUEBUF_CONF_NUM 16 #endif -/* Network setup for non-IP (rime). */ +/* Network setup for non-IP */ #else #define LINKADDR_CONF_SIZE 2 diff --git a/drivers/platform/jn516x/dev/micromac-radio.c b/drivers/platform/jn516x/dev/micromac-radio.c index 6678ed4ec..5fa54462a 100644 --- a/drivers/platform/jn516x/dev/micromac-radio.c +++ b/drivers/platform/jn516x/dev/micromac-radio.c @@ -405,16 +405,12 @@ transmit(unsigned short payload_len) uint32_t tx_error = u32MMAC_GetTxErrors(); if(tx_error == 0) { ret = RADIO_TX_OK; - RIMESTATS_ADD(acktx); } else if(tx_error & E_MMAC_TXSTAT_ABORTED) { ret = RADIO_TX_ERR; - RIMESTATS_ADD(sendingdrop); } else if(tx_error & E_MMAC_TXSTAT_CCA_BUSY) { ret = RADIO_TX_COLLISION; - RIMESTATS_ADD(contentiondrop); } else if(tx_error & E_MMAC_TXSTAT_NO_ACK) { ret = RADIO_TX_NOACK; - RIMESTATS_ADD(noacktx); } else { ret = RADIO_TX_ERR; } @@ -429,8 +425,6 @@ prepare(const void *payload, unsigned short payload_len) uint16_t checksum; #endif - RIMESTATS_ADD(lltx); - if(tx_in_progress) { return 1; } @@ -633,7 +627,6 @@ read(void *buf, unsigned short bufsize) | input_frame_buffer->uPayload.au8Byte[len]; radio_last_rx_crc_ok = (checksum == radio_last_rx_crc); if(!radio_last_rx_crc_ok) { - RIMESTATS_ADD(badcrc); } #endif /* CRC_SW */ if(radio_last_rx_crc_ok) { @@ -649,7 +642,6 @@ read(void *buf, unsigned short bufsize) if(len != 0) { bufsize = MIN(len, bufsize); memcpy(buf, input_frame_buffer->uPayload.au8Byte, bufsize); - RIMESTATS_ADD(llrx); if(!poll_mode) { /* Not in poll mode: packetbuf should not be accessed in interrupt context */ packetbuf_set_attr(PACKETBUF_ATTR_RSSI, radio_last_rssi); @@ -848,14 +840,6 @@ radio_interrupt_handler(uint32 mac_event) } #endif } - } else { /* if rx is not successful */ - if(rx_status & E_MMAC_RXSTAT_ABORTED) { - RIMESTATS_ADD(badsynch); - } else if(rx_status & E_MMAC_RXSTAT_ERROR) { - RIMESTATS_ADD(badcrc); - } else if(rx_status & E_MMAC_RXSTAT_MALFORMED) { - RIMESTATS_ADD(toolong); - } } } if(overflow) { diff --git a/drivers/platform/native/contiki-main.c b/drivers/platform/native/contiki-main.c index 4a0b0d066..f480d11e0 100644 --- a/drivers/platform/native/contiki-main.c +++ b/drivers/platform/native/contiki-main.c @@ -137,7 +137,7 @@ const static struct select_callback stdin_fd = { }; /*---------------------------------------------------------------------------*/ static void -set_rime_addr(void) +set_lladdr(void) { linkaddr_t addr; int i; @@ -156,7 +156,7 @@ set_rime_addr(void) } #endif linkaddr_set_node_addr(&addr); - printf("Rime started with address "); + printf("Contiki started with address "); for(i = 0; i < sizeof(addr.u8) - 1; i++) { printf("%d.", addr.u8[i]); } @@ -202,7 +202,7 @@ main(int argc, char **argv) ctimer_init(); rtimer_init(); - set_rime_addr(); + set_lladdr(); netstack_init(); printf("MAC %s NETWORK %s\n", NETSTACK_MAC.name, NETSTACK_NETWORK.name); diff --git a/drivers/platform/openmote-cc2538/contiki-conf.h b/drivers/platform/openmote-cc2538/contiki-conf.h index 867dcd651..0e3e385f1 100644 --- a/drivers/platform/openmote-cc2538/contiki-conf.h +++ b/drivers/platform/openmote-cc2538/contiki-conf.h @@ -344,7 +344,7 @@ typedef uint32_t rtimer_clock_t; /** * \name IEEE address configuration * - * Used to generate our RIME & IPv6 address + * Used to generate our link-layer & IPv6 address * @{ */ /** @@ -407,7 +407,7 @@ typedef uint32_t rtimer_clock_t; /** @} */ /*---------------------------------------------------------------------------*/ /** - * \name IPv6, RIME and network buffer configuration + * \name IPv6 and network buffer configuration * * @{ */ diff --git a/drivers/platform/openmote-cc2538/contiki-main.c b/drivers/platform/openmote-cc2538/contiki-main.c index 8dbdff8b9..6b5e09b89 100644 --- a/drivers/platform/openmote-cc2538/contiki-main.c +++ b/drivers/platform/openmote-cc2538/contiki-main.c @@ -129,7 +129,7 @@ set_rf_params(void) #if STARTUP_CONF_VERBOSE { int i; - printf("Rime configured with address "); + printf("Contiki configured with address "); for(i = 0; i < LINKADDR_SIZE - 1; i++) { printf("%02x:", linkaddr_node_addr.u8[i]); } diff --git a/drivers/platform/sky/contiki-sky-main.c b/drivers/platform/sky/contiki-sky-main.c index 6a1dca6a4..7b9c7449a 100644 --- a/drivers/platform/sky/contiki-sky-main.c +++ b/drivers/platform/sky/contiki-sky-main.c @@ -53,19 +53,6 @@ #include "cfs/cfs-coffee.h" #include "sys/autostart.h" -#if UIP_CONF_ROUTER - -#ifndef UIP_ROUTER_MODULE -#ifdef UIP_CONF_ROUTER_MODULE -#define UIP_ROUTER_MODULE UIP_CONF_ROUTER_MODULE -#else /* UIP_CONF_ROUTER_MODULE */ -#define UIP_ROUTER_MODULE rimeroute -#endif /* UIP_CONF_ROUTER_MODULE */ -#endif /* UIP_ROUTER_MODULE */ - -extern const struct uip_router UIP_ROUTER_MODULE; -#endif /* UIP_CONF_ROUTER */ - #if DCOSYNCH_CONF_ENABLED static struct timer mgt_timer; #endif @@ -112,7 +99,7 @@ force_inclusion(int d1, int d2) #endif /*---------------------------------------------------------------------------*/ static void -set_rime_addr(void) +set_lladdr(void) { linkaddr_t addr; int i; @@ -131,7 +118,7 @@ set_rime_addr(void) } #endif linkaddr_set_node_addr(&addr); - PRINTF("Rime started with address "); + PRINTF("Contiki started with address "); for(i = 0; i < sizeof(addr.u8) - 1; i++) { PRINTF("%d.", addr.u8[i]); } @@ -221,7 +208,7 @@ main(int argc, char **argv) init_platform(); - set_rime_addr(); + set_lladdr(); cc2420_init(); { diff --git a/drivers/platform/srf06-cc26xx/contiki-conf.h b/drivers/platform/srf06-cc26xx/contiki-conf.h index e6c57dd00..611cc5575 100644 --- a/drivers/platform/srf06-cc26xx/contiki-conf.h +++ b/drivers/platform/srf06-cc26xx/contiki-conf.h @@ -119,7 +119,7 @@ /** * \name IEEE address configuration * - * Used to generate our RIME & IPv6 address + * Used to generate our link-local & IPv6 address * @{ */ /** @@ -165,7 +165,7 @@ /*---------------------------------------------------------------------------*/ /** @} */ /** - * \name IPv6, RIME and network buffer configuration + * \name IPv6 and network buffer configuration * * @{ */ diff --git a/drivers/platform/zoul/contiki-conf.h b/drivers/platform/zoul/contiki-conf.h index 20613a05f..6746d3dbe 100644 --- a/drivers/platform/zoul/contiki-conf.h +++ b/drivers/platform/zoul/contiki-conf.h @@ -375,7 +375,7 @@ typedef uint32_t rtimer_clock_t; /** * \name IEEE address configuration * - * Used to generate our RIME & IPv6 address + * Used to generate our link-layer & IPv6 address * @{ */ /** @@ -438,7 +438,7 @@ typedef uint32_t rtimer_clock_t; /** @} */ /*---------------------------------------------------------------------------*/ /** - * \name IPv6, RIME and network buffer configuration + * \name IPv6 and network buffer configuration * * @{ */ diff --git a/drivers/platform/zoul/contiki-main.c b/drivers/platform/zoul/contiki-main.c index 2df3270eb..d97654b73 100644 --- a/drivers/platform/zoul/contiki-main.c +++ b/drivers/platform/zoul/contiki-main.c @@ -183,7 +183,7 @@ set_rf_params(void) #if STARTUP_CONF_VERBOSE { int i; - printf("Rime configured with address "); + printf("Contiki configured with address "); for(i = 0; i < LINKADDR_SIZE - 1; i++) { printf("%02x:", linkaddr_node_addr.u8[i]); } diff --git a/examples/platform-specific/cc2538dk/Makefile b/examples/platform-specific/cc2538dk/Makefile deleted file mode 100644 index 06ae32fce..000000000 --- a/examples/platform-specific/cc2538dk/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -CONTIKI_PROJECT = cc2538-demo - -all: $(CONTIKI_PROJECT) - -CONTIKI = ../../.. -CONTIKI_WITH_RIME = 1 -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/cc2538dk/Makefile.target b/examples/platform-specific/cc2538dk/Makefile.target deleted file mode 100644 index 777593c88..000000000 --- a/examples/platform-specific/cc2538dk/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = cc2538dk diff --git a/examples/platform-specific/cc2538dk/cc2538-demo.c b/examples/platform-specific/cc2538dk/cc2538-demo.c deleted file mode 100644 index 127dfe75c..000000000 --- a/examples/platform-specific/cc2538dk/cc2538-demo.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup cc2538-platforms - * @{ - * - * \defgroup cc2538-examples cc2538 Example Projects - * @{ - * - * \defgroup cc2538-demo cc2538dk Demo Project - * - * Example project demonstrating the cc2538dk functionality - * - * This assumes that you are using a SmartRF06EB with a cc2538 EM - * - * - Boot sequence: LEDs flashing, LED2 followed by LED3 then LED4 - * - etimer/clock : Every LOOP_INTERVAL clock ticks the LED defined as - * LEDS_PERIODIC will turn on - * - rtimer : Exactly LEDS_OFF_HYSTERISIS rtimer ticks later, - * LEDS_PERIODIC will turn back off - * - Buttons : - * - BTN_DOWN turns on LEDS_REBOOT and causes a watchdog reboot - * - BTN_UP to soft reset (SYS_CTRL_PWRDBG::FORCE_WARM_RESET) - * - BTN_LEFT and BTN_RIGHT flash the LED defined as LEDS_BUTTON - * - ADC sensors : On-chip VDD / 3 and temperature, and ambient light sensor - * values are printed over UART periodically. - * - UART : Every LOOP_INTERVAL the EM will print something over the - * UART. Receiving an entire line of text over UART (ending - * in \\r) will cause LEDS_SERIAL_IN to toggle - * - Radio comms : BTN_SELECT sends a rime broadcast. Reception of a rime - * packet will toggle LEDs defined as LEDS_RF_RX - * - * @{ - * - * \file - * Example demonstrating the cc2538dk platform - */ -#include "contiki.h" -#include "cpu.h" -#include "sys/etimer.h" -#include "sys/rtimer.h" -#include "dev/leds.h" -#include "dev/uart.h" -#include "dev/cc2538-sensors.h" -#include "dev/button-sensor.h" -#include "dev/als-sensor.h" -#include "dev/watchdog.h" -#include "dev/serial-line.h" -#include "dev/sys-ctrl.h" -#include "net/rime/broadcast.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define LOOP_INTERVAL CLOCK_SECOND -#define LEDS_OFF_HYSTERISIS (RTIMER_SECOND >> 1) -#define LEDS_PERIODIC LEDS_YELLOW -#define LEDS_BUTTON LEDS_RED -#define LEDS_SERIAL_IN LEDS_ORANGE -#define LEDS_REBOOT LEDS_ALL -#define LEDS_RF_RX (LEDS_YELLOW | LEDS_ORANGE) -#define BROADCAST_CHANNEL 129 -/*---------------------------------------------------------------------------*/ -static struct etimer et; -static struct rtimer rt; -static uint16_t counter; -/*---------------------------------------------------------------------------*/ -PROCESS(cc2538_demo_process, "cc2538 demo process"); -AUTOSTART_PROCESSES(&cc2538_demo_process); -/*---------------------------------------------------------------------------*/ -static void -broadcast_recv(struct broadcast_conn *c, const linkaddr_t *from) -{ - leds_toggle(LEDS_RF_RX); - printf("Received %u bytes: '0x%04x'\n", packetbuf_datalen(), - *(uint16_t *)packetbuf_dataptr()); -} -/*---------------------------------------------------------------------------*/ -static const struct broadcast_callbacks bc_rx = { broadcast_recv }; -static struct broadcast_conn bc; -/*---------------------------------------------------------------------------*/ -void -rt_callback(struct rtimer *t, void *ptr) -{ - leds_off(LEDS_PERIODIC); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(cc2538_demo_process, ev, data) -{ - PROCESS_EXITHANDLER(broadcast_close(&bc)) - - PROCESS_BEGIN(); - - counter = 0; - broadcast_open(&bc, BROADCAST_CHANNEL, &bc_rx); - - etimer_set(&et, CLOCK_SECOND); - - while(1) { - - PROCESS_YIELD(); - - if(ev == PROCESS_EVENT_TIMER) { - leds_on(LEDS_PERIODIC); - printf("-----------------------------------------\n" - "Counter = 0x%08x\n", counter); - - printf("VDD = %d mV\n", - vdd3_sensor.value(CC2538_SENSORS_VALUE_TYPE_CONVERTED)); - - printf("Temperature = %d mC\n", - cc2538_temp_sensor.value(CC2538_SENSORS_VALUE_TYPE_CONVERTED)); - - printf("Ambient light sensor = %d raw\n", als_sensor.value(0)); - - etimer_set(&et, CLOCK_SECOND); - rtimer_set(&rt, RTIMER_NOW() + LEDS_OFF_HYSTERISIS, 1, - rt_callback, NULL); - counter++; - } else if(ev == sensors_event) { - if(data == &button_select_sensor) { - packetbuf_copyfrom(&counter, sizeof(counter)); - broadcast_send(&bc); - } else if(data == &button_left_sensor || data == &button_right_sensor) { - leds_toggle(LEDS_BUTTON); - } else if(data == &button_down_sensor) { - INTERRUPTS_DISABLE(); - leds_on(LEDS_REBOOT); - watchdog_reboot(); - } else if(data == &button_up_sensor) { - sys_ctrl_reset(); - } - } else if(ev == serial_line_event_message) { - leds_toggle(LEDS_SERIAL_IN); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - * @} - */ diff --git a/examples/platform-specific/openmote-cc2538/Makefile b/examples/platform-specific/openmote-cc2538/Makefile deleted file mode 100644 index b70be80c9..000000000 --- a/examples/platform-specific/openmote-cc2538/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -DEFINES+=PROJECT_CONF_H=\"project-conf.h\" - -CONTIKI_PROJECT = openmote-demo - -all: $(CONTIKI_PROJECT) - -CONTIKI = ../../.. -CONTIKI_WITH_RIME = 1 -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/openmote-cc2538/openmote-demo.c b/examples/platform-specific/openmote-cc2538/openmote-demo.c deleted file mode 100644 index 393203a0c..000000000 --- a/examples/platform-specific/openmote-cc2538/openmote-demo.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2014, OpenMote Technologies, S.L. - * 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup openmote-cc2538 - * @{ - * - * \defgroup openmote-examples OpenMote-CC2538 Example Projects - * @{ - * - * Example project demonstrating the OpenMote-CC2538 functionality - * - * @{ - * - * \file - * Example demonstrating the OpenMote-CC2538 platform - * \author - * Pere Tuset - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "cpu.h" -#include "sys/etimer.h" -#include "dev/leds.h" -#include "dev/uart.h" -#include "dev/button-sensor.h" -#include "dev/serial-line.h" -#include "dev/sys-ctrl.h" -#include "net/rime/broadcast.h" - -#include "dev/adxl346.h" -#include "dev/max44009.h" -#include "dev/sht21.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define BROADCAST_CHANNEL 129 -/*---------------------------------------------------------------------------*/ -PROCESS(openmote_demo_process, "OpenMote-CC2538 demo process"); -AUTOSTART_PROCESSES(&openmote_demo_process); -/*---------------------------------------------------------------------------*/ -static void -broadcast_recv(struct broadcast_conn *c, const linkaddr_t *from) -{ - leds_toggle(LEDS_GREEN); - printf("Received %u bytes: '0x%04x'\n", packetbuf_datalen(), - *(uint16_t *)packetbuf_dataptr()); -} -/*---------------------------------------------------------------------------*/ -static const struct broadcast_callbacks bc_rx = { broadcast_recv }; -static struct broadcast_conn bc; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(openmote_demo_process, ev, data) -{ - static struct etimer et; - static int16_t counter; - static uint16_t adxl346_present, sht21_present, max44009_present; - static int16_t accel, light, temperature, humidity; - - PROCESS_EXITHANDLER(broadcast_close(&bc)) - - PROCESS_BEGIN(); - - /* Initialize and calibrate the ADXL346 sensor */ - adxl346_present = SENSORS_ACTIVATE(adxl346); - if(adxl346_present == ADXL346_ERROR) { - printf("ADXL346 sensor is NOT present!\n"); - leds_on(LEDS_YELLOW); - } else { - adxl346.configure(ADXL346_CALIB_OFFSET, 0); - } - - /* Initialize the MAX44009 sensor */ - max44009_present = SENSORS_ACTIVATE(max44009); - if(max44009_present == MAX44009_ERROR) { - printf("MAX44009 sensor is NOT present!\n"); - leds_on(LEDS_ORANGE); - } - - /* Initialize the SHT21 sensor */ - sht21_present = SENSORS_ACTIVATE(sht21); - if(sht21_present == SHT21_ERROR) { - printf("SHT21 sensor is NOT present!\n"); - leds_on(LEDS_RED); - } - - counter = 0; - broadcast_open(&bc, BROADCAST_CHANNEL, &bc_rx); - - printf("****************************************\n"); - - while(1) { - etimer_set(&et, CLOCK_SECOND); - - PROCESS_YIELD(); - - if(ev == PROCESS_EVENT_TIMER) { - if(adxl346_present != ADXL346_ERROR) { - leds_on(LEDS_YELLOW); - accel = adxl346.value(ADXL346_READ_X_mG); - printf("X Acceleration: %d.%u G\n", accel / 1000, accel % 1000); - accel = adxl346.value(ADXL346_READ_Y_mG); - printf("Y Acceleration: %d.%u G\n", accel / 1000, accel % 1000); - accel = adxl346.value(ADXL346_READ_Z_mG); - printf("Z Acceleration: %d.%u G\n", accel / 1000, accel % 1000); - leds_off(LEDS_YELLOW); - } - - if(max44009_present != MAX44009_ERROR) { - leds_on(LEDS_ORANGE); - light = max44009.value(MAX44009_READ_LIGHT); - printf("Light: %u.%ulux\n", light / 100, light % 100); - leds_off(LEDS_ORANGE); - } - - if(sht21_present != SHT21_ERROR) { - leds_on(LEDS_RED); - temperature = sht21.value(SHT21_READ_TEMP); - printf("Temperature: %u.%uC\n", temperature / 100, temperature % 100); - humidity = sht21.value(SHT21_READ_RHUM); - printf("Rel. humidity: %u.%u%%\n", humidity / 100, humidity % 100); - leds_off(LEDS_RED); - } - - printf("****************************************\n"); - } - - if(ev == sensors_event) { - if(data == &button_sensor) { - if(button_sensor.value(BUTTON_SENSOR_VALUE_TYPE_LEVEL) == - BUTTON_SENSOR_PRESSED_LEVEL) { - leds_toggle(LEDS_GREEN); - packetbuf_copyfrom(&counter, sizeof(counter)); - broadcast_send(&bc); - } - } - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - * @} - */ diff --git a/examples/platform-specific/openmote-cc2538/openmote-demo.gdb b/examples/platform-specific/openmote-cc2538/openmote-demo.gdb deleted file mode 100644 index 43cbb5530..000000000 --- a/examples/platform-specific/openmote-cc2538/openmote-demo.gdb +++ /dev/null @@ -1,10 +0,0 @@ -target remote localhost:2331 -monitor interface JTAG -monitor endian little -monitor speed auto -monitor flash device = CC2538SF53 -monitor flash breakpoints = 1 -monitor flash download = 1 -monitor reset -load -continue diff --git a/examples/platform-specific/openmote-cc2538/project-conf.h b/examples/platform-specific/openmote-cc2538/project-conf.h deleted file mode 100644 index 481100e7a..000000000 --- a/examples/platform-specific/openmote-cc2538/project-conf.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * 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. - */ -/** - * \addtogroup remote-examples - * @{ - * - * \file - * Project specific configuration defines for the basic RE-Mote examples - */ -/*---------------------------------------------------------------------------*/ -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ -/*---------------------------------------------------------------------------*/ -#define BROADCAST_CHANNEL 129 -/*---------------------------------------------------------------------------*/ -#endif /* PROJECT_CONF_H_ */ -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/examples/platform-specific/zoul/Makefile b/examples/platform-specific/zoul/Makefile index f871d647f..948066f73 100644 --- a/examples/platform-specific/zoul/Makefile +++ b/examples/platform-specific/zoul/Makefile @@ -1,6 +1,6 @@ DEFINES+=PROJECT_CONF_H=\"project-conf.h\" -CONTIKI_PROJECT = zoul-demo test-tsl256x test-sht25 test-servo.c +CONTIKI_PROJECT = test-tsl256x test-sht25 test-servo.c CONTIKI_PROJECT += test-bmp085-bmp180 test-motion test-rotation-sensor CONTIKI_PROJECT += test-grove-light-sensor test-grove-loudness-sensor CONTIKI_PROJECT += test-weather-meter test-grove-gyro test-lcd test-iaq @@ -18,5 +18,4 @@ MODULES += drivers//dev/bme280 all: $(CONTIKI_PROJECT) CONTIKI = ../../.. -CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/zoul/cc1200-demo/Makefile b/examples/platform-specific/zoul/cc1200-demo/Makefile deleted file mode 100644 index 76b1a2833..000000000 --- a/examples/platform-specific/zoul/cc1200-demo/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -DEFINES+=PROJECT_CONF_H=\"project-conf.h\" -CONTIKI_PROJECT = cc1200-demo - -all: $(CONTIKI_PROJECT) - -CONTIKI = ../../../../.. -CONTIKI_WITH_RIME = 1 -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/zoul/cc1200-demo/Makefile.target b/examples/platform-specific/zoul/cc1200-demo/Makefile.target deleted file mode 100644 index 75430a6e4..000000000 --- a/examples/platform-specific/zoul/cc1200-demo/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = zoul diff --git a/examples/platform-specific/zoul/cc1200-demo/cc1200-demo.c b/examples/platform-specific/zoul/cc1200-demo/cc1200-demo.c deleted file mode 100644 index a4e1129be..000000000 --- a/examples/platform-specific/zoul/cc1200-demo/cc1200-demo.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-cc1200-demo Zoul on-board CC1200 RF transceiver test - * - * Demonstrates the use of the TI CC1200 RF transceiver on Sub-1GHz - * @{ - * - * \file - * Test file for the CC1200 demo - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "cpu.h" -#include "sys/etimer.h" -#include "dev/leds.h" -#include "dev/watchdog.h" -#include "dev/serial-line.h" -#include "dev/sys-ctrl.h" -#include "net/rime/broadcast.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define LOOP_PERIOD 2 -#define LOOP_INTERVAL (CLOCK_SECOND * LOOP_PERIOD) -#define BROADCAST_CHANNEL 129 -/*---------------------------------------------------------------------------*/ -static struct etimer et; -static uint16_t counter; -/*---------------------------------------------------------------------------*/ -static void -broadcast_recv(struct broadcast_conn *c, const linkaddr_t *from) -{ - printf("*** Received %u bytes from %u:%u: '0x%04u' ", packetbuf_datalen(), - from->u8[0], from->u8[1], *(uint16_t *)packetbuf_dataptr()); - printf("%d - %u\n", (int8_t)packetbuf_attr(PACKETBUF_ATTR_RSSI), - packetbuf_attr(PACKETBUF_ATTR_LINK_QUALITY)); - leds_toggle(LEDS_GREEN); -} -/*---------------------------------------------------------------------------*/ -static const struct broadcast_callbacks bc_rx = { broadcast_recv }; -static struct broadcast_conn bc; -/*---------------------------------------------------------------------------*/ -PROCESS(cc1200_demo_process, "cc1200 demo process"); -AUTOSTART_PROCESSES(&cc1200_demo_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(cc1200_demo_process, ev, data) -{ - PROCESS_EXITHANDLER(broadcast_close(&bc)) - PROCESS_BEGIN(); - - broadcast_open(&bc, BROADCAST_CHANNEL, &bc_rx); - - etimer_set(&et, LOOP_INTERVAL); - - while(1) { - PROCESS_YIELD(); - if(ev == PROCESS_EVENT_TIMER) { - printf("Broadcast --> %u\n", counter); - leds_toggle(LEDS_RED); - packetbuf_copyfrom(&counter, sizeof(counter)); - broadcast_send(&bc); - counter++; - etimer_set(&et, LOOP_INTERVAL); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - */ diff --git a/examples/platform-specific/zoul/cc1200-demo/project-conf.h b/examples/platform-specific/zoul/cc1200-demo/project-conf.h deleted file mode 100644 index 0fd89c82b..000000000 --- a/examples/platform-specific/zoul/cc1200-demo/project-conf.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul-examples - * @{ - * - * \defgroup remote-cc1200-demo RE-Mote CC1200 RF transceiver test - * - * Demonstrates the use of the TI CC1200 RF transceiver on Sub-1GHz - * @{ - * - * \file - * Configuration file for the cc1200 demo - * - * \author - * Antonio Lignan - */ -/*---------------------------------------------------------------------------*/ -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#undef NETSTACK_CONF_RADIO -#define NETSTACK_CONF_RADIO cc1200_driver -#define CC1200_CONF_USE_GPIO2 0 -#define CC1200_CONF_USE_RX_WATCHDOG 0 -#define ANTENNA_SW_SELECT_DEF_CONF ANTENNA_SW_SELECT_SUBGHZ - -#endif /* PROJECT_CONF_H_ */ - -/** - * @} - * @} - */ diff --git a/examples/platform-specific/zoul/rev-a/Makefile b/examples/platform-specific/zoul/rev-a/Makefile deleted file mode 100644 index bf3c06f74..000000000 --- a/examples/platform-specific/zoul/rev-a/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -DEFINES+=PROJECT_CONF_H=\"project-conf.h\" - -CONTIKI_PROJECT = test-power-mgmt - -all: $(CONTIKI_PROJECT) - -CONTIKI = ../../../.. -CONTIKI_WITH_RIME = 1 -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/zoul/rev-a/Makefile.target b/examples/platform-specific/zoul/rev-a/Makefile.target deleted file mode 100644 index 75430a6e4..000000000 --- a/examples/platform-specific/zoul/rev-a/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = zoul diff --git a/examples/platform-specific/zoul/rev-a/project-conf.h b/examples/platform-specific/zoul/rev-a/project-conf.h deleted file mode 100644 index 2dcc147e3..000000000 --- a/examples/platform-specific/zoul/rev-a/project-conf.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2016, Zolertia - * 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. - */ -/** - * \addtogroup remote-examples - * @{ - * - * \file - * Project specific configuration defines for the basic RE-Mote examples - */ -#ifndef PROJECT_CONF_H_ -#define PROJECT_CONF_H_ - -#define BROADCAST_CHANNEL 129 - -#endif /* PROJECT_CONF_H_ */ - -/** @} */ diff --git a/examples/platform-specific/zoul/rev-a/test-power-mgmt.c b/examples/platform-specific/zoul/rev-a/test-power-mgmt.c deleted file mode 100644 index 63bd0aa4a..000000000 --- a/examples/platform-specific/zoul/rev-a/test-power-mgmt.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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. - * - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup remote-power-management-test - * @{ - * - * Test the RE-Mote's (revision A) power management features, shutdown mode and - * battery management - * - * @{ - * - * \author - * Antonio Lignan - * Aitor Mejias - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "cpu.h" -#include "sys/etimer.h" -#include "sys/process.h" -#include "dev/leds.h" -#include "dev/sys-ctrl.h" -#include "dev/gpio.h" -#include "lib/list.h" -#include "power-mgmt.h" -#include "net/rime/broadcast.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -/* RE-Mote revision A */ -#define PM_EXPECTED_VERSION 0x00 -#define ENTER_SHUTDOWN_COUNT 10 -/*---------------------------------------------------------------------------*/ -PROCESS(test_remote_pm, "RE-Mote Power Management Test"); -AUTOSTART_PROCESSES(&test_remote_pm); -/*---------------------------------------------------------------------------*/ -static struct etimer et; -/*---------------------------------------------------------------------------*/ -static void -broadcast_recv(struct broadcast_conn *c, const linkaddr_t *from) -{ - leds_toggle(LEDS_BLUE); - printf("*** Received %u bytes from %u:%u: '0x%04x'\n", packetbuf_datalen(), - from->u8[0], from->u8[1], *(uint16_t *)packetbuf_dataptr()); -} -/*---------------------------------------------------------------------------*/ -static const struct broadcast_callbacks bc_rx = { broadcast_recv }; -static struct broadcast_conn bc; -/*---------------------------------------------------------------------------*/ -static char * -print_pm(uint8_t state) -{ - switch(state) { - case PM_SYSOFF_ON: - return "Battery on"; - case PM_SYSOFF_OFF: - return "Battery off"; - case PM_TIMER_ENABLED: - return "Nano Timer enabled"; - case PM_TIMER_DISABLED: - return "Nano Timer disabled"; - case PM_AWAITING_RTC_EVENT: - return "Awaiting RTC event"; - default: - return "UNKNOWN"; - } -} -/*---------------------------------------------------------------------------*/ -static int8_t -get_status(uint8_t mask, uint8_t *val) -{ - uint8_t status, print_msg; - - /* Retrieve the status of the power management block */ - if(pm_get_state(&status) != PM_SUCCESS) { - printf("Failed to retrieve the power management status\n"); - return PM_ERROR; - } - - if(!mask) { - printf("STATUS %u\n", status); - *val = PM_IDLE; - return PM_SUCCESS; - } - - /* Read back ony the requested status bit */ - switch(mask) { - case PM_SYSOFF_ON_MASK: - print_msg = (status & mask) ? PM_SYSOFF_ON : PM_SYSOFF_OFF; - break; - case PM_TIMER_ENABLED_MASK: - print_msg = (status & mask) ? PM_TIMER_ENABLED : PM_TIMER_DISABLED; - break; - case PM_AWAITING_RTC_EVENT_MASK: - print_msg = (status & mask) ? PM_AWAITING_RTC_EVENT : PM_AWAITING_RTC_DIS; - break; - default: - return PM_ERROR; - } - - printf("Status -> %s\n", print_pm(print_msg)); - *val = print_msg; - return PM_SUCCESS; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_remote_pm, ev, data) -{ - static uint8_t aux; - - PROCESS_BEGIN(); - - /* Configures the pins and initializes the driver */ - if(pm_init() != PM_SUCCESS) { - printf("Failed to initialize\n"); - PROCESS_EXIT(); - } - - /* Get the current firmware version to track the driver implementation on the - * low-power MCU - */ - if(pm_get_firmware_version(&aux) != PM_SUCCESS) { - printf("Failed to retrieve PIC's fw version\n"); - PROCESS_EXIT(); - } - printf("Firmware PIC-Power Manager Version: V0.%u\n", aux); - - if(aux != PM_EXPECTED_VERSION) { - printf("Unexpected firmware version\n"); - PROCESS_EXIT(); - } - - /* Enables the nano timer, the power management block will be driven by the - * nano timer now, putting the node in shutdown mode every minute (as - * default). For this test you need to disconnect the USB cable off to power - * the RE-Mote ONLY from the external battery, so after veryfing the above - * works, disconnect the USB cable and hit the reset button - * When the nano timer is enabled, the external battery is shutdown for a - * couple of usecs, so the CC2538 is restarted. After this as the nano timer - * is enabled, then it will run as intended - */ - - if(get_status(PM_TIMER_ENABLED_MASK, &aux) != PM_SUCCESS) { - PROCESS_EXIT(); - } - - if(aux == PM_TIMER_DISABLED) { - printf("Enabling the nano Timer...\n"); - if(pm_enable_timer() != PM_SUCCESS) { - printf("Failed to set the nano Timer\n"); - PROCESS_EXIT(); - } - } - - /* At this point as the RE-Mote is powered over USB you should see the prints, - * disconnect the USB cable and power only with the external battery. If - * something fails, then you should not see the red LED blinking - */ - aux = ENTER_SHUTDOWN_COUNT; - - /* Open the broadcast channel */ - broadcast_open(&bc, BROADCAST_CHANNEL, &bc_rx); - - /* Send a message */ - packetbuf_copyfrom(&aux, sizeof(aux)); - broadcast_send(&bc); - - /* And wait a few seconds before going to sleep */ - while(1) { - etimer_set(&et, CLOCK_SECOND); - PROCESS_WAIT_EVENT(); - - /* Enter shutdown mode before the shutdown period (1 min default) expires */ - if(!aux) { - /* Say goodnight */ - PM_SHUTDOWN_NOW; - printf("Goodnight!\n"); - PROCESS_EXIT(); - } - - aux--; - leds_toggle(LEDS_RED); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - */ diff --git a/examples/platform-specific/zoul/rev-b/Makefile b/examples/platform-specific/zoul/rev-b/Makefile index 882591218..d7f4a64c7 100644 --- a/examples/platform-specific/zoul/rev-b/Makefile +++ b/examples/platform-specific/zoul/rev-b/Makefile @@ -7,5 +7,4 @@ BOARD ?= remote-revb all: $(CONTIKI_PROJECT) CONTIKI = ../../../.. -CONTIKI_WITH_RIME = 1 include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/zoul/zoul-demo.c b/examples/platform-specific/zoul/zoul-demo.c deleted file mode 100644 index 8db518d5d..000000000 --- a/examples/platform-specific/zoul/zoul-demo.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ - * Copyright (c) 2015, Zolertia - http://www.zolertia.com - * 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. - */ -/*---------------------------------------------------------------------------*/ -/** - * \addtogroup zoul - * @{ - * - * \defgroup zoul-examples Zoul examples - * @{ - * - * \defgroup zoul-demo Zoul demo application - * - * Example project demonstrating the Zoul module on the RE-Mote and Firefly - * platforms. - * - * - Boot sequence: LEDs flashing (Red, then yellow, finally green) - * - * - etimer/clock : Every LOOP_INTERVAL clock ticks (LOOP_PERIOD secs) the LED - * defined as LEDS_PERIODIC will turn on - * - rtimer : Exactly LEDS_OFF_HYSTERISIS rtimer ticks later, - * LEDS_PERIODIC will turn back off - * - ADC sensors : On-chip VDD / 3, temperature, and Phidget sensor - * values are printed over UART periodically. - * - UART : Every LOOP_INTERVAL the Remote will print something over - * the UART. Receiving an entire line of text over UART (ending - * in \\r) will cause LEDS_SERIAL_IN to toggle - * - Radio comms : BTN_USER sends a rime broadcast. Reception of a rime - * packet will toggle LEDs defined as LEDS_RF_RX - * - Button : Keeping the button pressed will print a counter that - * increments every BUTTON_PRESS_EVENT_INTERVAL ticks - * - * @{ - * - * \file - * Example demonstrating the Zoul module on the RE-Mote & Firefly platforms - */ -/*---------------------------------------------------------------------------*/ -#include "contiki.h" -#include "cpu.h" -#include "sys/etimer.h" -#include "sys/rtimer.h" -#include "dev/leds.h" -#include "dev/uart.h" -#include "dev/button-sensor.h" -#include "dev/adc-zoul.h" -#include "dev/zoul-sensors.h" -#include "dev/watchdog.h" -#include "dev/serial-line.h" -#include "dev/sys-ctrl.h" -#include "net/netstack.h" -#include "net/rime/broadcast.h" -#include "net/packetbuf.h" - -#include -#include -/*---------------------------------------------------------------------------*/ -#define LOOP_PERIOD 8 -#define LOOP_INTERVAL (CLOCK_SECOND * LOOP_PERIOD) -#define LEDS_OFF_HYSTERISIS ((RTIMER_SECOND * LOOP_PERIOD) >> 1) -#define LEDS_PERIODIC LEDS_BLUE -#define LEDS_BUTTON LEDS_RED -#define LEDS_SERIAL_IN LEDS_GREEN -#define LEDS_REBOOT LEDS_ALL -#define LEDS_RF_RX (LEDS_YELLOW | LEDS_RED) -#define BUTTON_PRESS_EVENT_INTERVAL (CLOCK_SECOND) -/*---------------------------------------------------------------------------*/ -static struct etimer et; -static struct rtimer rt; -static uint16_t counter; -/*---------------------------------------------------------------------------*/ -PROCESS(zoul_demo_process, "Zoul demo process"); -AUTOSTART_PROCESSES(&zoul_demo_process); -/*---------------------------------------------------------------------------*/ -static void -broadcast_recv(struct broadcast_conn *c, const linkaddr_t *from) -{ - leds_toggle(LEDS_RF_RX); - printf("*** Received %u bytes from %u:%u: '0x%04x'\n", packetbuf_datalen(), - from->u8[0], from->u8[1], *(uint16_t *)packetbuf_dataptr()); -} -/*---------------------------------------------------------------------------*/ -static const struct broadcast_callbacks bc_rx = { broadcast_recv }; -static struct broadcast_conn bc; -/*---------------------------------------------------------------------------*/ -static void -rt_callback(struct rtimer *t, void *ptr) -{ - leds_off(LEDS_PERIODIC); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(zoul_demo_process, ev, data) -{ - PROCESS_EXITHANDLER(broadcast_close(&bc)) - - PROCESS_BEGIN(); - - counter = 0; - - broadcast_open(&bc, BROADCAST_CHANNEL, &bc_rx); - - /* Configure the user button */ - button_sensor.configure(BUTTON_SENSOR_CONFIG_TYPE_INTERVAL, - BUTTON_PRESS_EVENT_INTERVAL); - - /* Configure the ADC ports */ - adc_zoul.configure(SENSORS_HW_INIT, ZOUL_SENSORS_ADC_ALL); - - printf("Zoul test application\n"); - - etimer_set(&et, LOOP_INTERVAL); - - while(1) { - - PROCESS_YIELD(); - - if(ev == PROCESS_EVENT_TIMER) { - leds_on(LEDS_PERIODIC); - - printf("-----------------------------------------\n" - "Counter = 0x%08x\n", counter); - - printf("VDD = %d mV\n", - vdd3_sensor.value(CC2538_SENSORS_VALUE_TYPE_CONVERTED)); - - printf("Temperature = %d mC\n", - cc2538_temp_sensor.value(CC2538_SENSORS_VALUE_TYPE_CONVERTED)); - - printf("ADC1 = %d raw\n", - adc_zoul.value(ZOUL_SENSORS_ADC1)); - - printf("ADC3 = %d raw\n", - adc_zoul.value(ZOUL_SENSORS_ADC3)); - - etimer_set(&et, LOOP_INTERVAL); - rtimer_set(&rt, RTIMER_NOW() + LEDS_OFF_HYSTERISIS, 1, - rt_callback, NULL); - counter++; - - } else if(ev == sensors_event) { - if(data == &button_sensor) { - if(button_sensor.value(BUTTON_SENSOR_VALUE_TYPE_LEVEL) == - BUTTON_SENSOR_PRESSED_LEVEL) { - printf("Button pressed\n"); - packetbuf_copyfrom(&counter, sizeof(counter)); - broadcast_send(&bc); - } else { - printf("...and released!\n"); - } - } - - } else if(ev == serial_line_event_message) { - leds_toggle(LEDS_SERIAL_IN); - } else if(ev == button_press_duration_exceeded) { - printf("Button pressed for %d ticks [%u events]\n", - (*((uint8_t *)data) * BUTTON_PRESS_EVENT_INTERVAL), - button_sensor.value(BUTTON_SENSOR_VALUE_TYPE_PRESS_DURATION)); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/** - * @} - * @} - * @} - */