Merge branch 'develop' into contrib/readme

This commit is contained in:
Simon Duquennoy 2018-02-26 08:46:43 +01:00 committed by GitHub
commit 02227c6e66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 136 additions and 111 deletions

View File

@ -40,6 +40,7 @@
#include "contiki.h"
#include "ac-dimmer.h"
#include "dev/gpio.h"
#include "dev/gpio-hal.h"
#include "lib/sensors.h"
#include "dev/ioc.h"
/*---------------------------------------------------------------------------*/
@ -76,13 +77,17 @@ PROCESS_THREAD(ac_dimmer_int_process, ev, data)
}
/*---------------------------------------------------------------------------*/
static void
dimmer_zero_cross_int_handler(uint8_t port, uint8_t pin)
dimmer_zero_cross_int_handler(gpio_hal_pin_mask_t pin_mask)
{
if((port == DIMMER_SYNC_PORT) && (pin == DIMMER_SYNC_PIN)) {
process_poll(&ac_dimmer_int_process);
}
process_poll(&ac_dimmer_int_process);
}
/*---------------------------------------------------------------------------*/
static gpio_hal_event_handler_t dimmer_handler = {
.next = NULL,
.handler = dimmer_zero_cross_int_handler,
.pin_mask = gpio_hal_pin_to_mask(DIMMER_SYNC_PIN) << (DIMMER_SYNC_PORT << 3),
};
/*---------------------------------------------------------------------------*/
static int
status(int type)
{
@ -128,8 +133,7 @@ configure(int type, int value)
GPIO_DETECT_EDGE(DIMMER_SYNC_PORT_BASE, DIMMER_SYNC_PIN_MASK);
GPIO_TRIGGER_SINGLE_EDGE(DIMMER_SYNC_PORT_BASE, DIMMER_SYNC_PIN_MASK);
GPIO_DETECT_RISING(DIMMER_SYNC_PORT_BASE, DIMMER_SYNC_PIN_MASK);
gpio_register_callback(dimmer_zero_cross_int_handler, DIMMER_SYNC_PORT,
DIMMER_SYNC_PIN);
gpio_hal_register_handler(&dimmer_handler);
/* Spin process until an interrupt is received */
process_start(&ac_dimmer_int_process, NULL);

View File

@ -44,6 +44,7 @@
#include "contiki.h"
#include "dev/i2c.h"
#include "dev/grove-gyro.h"
#include "dev/gpio-hal.h"
#include "lib/sensors.h"
#include "dev/watchdog.h"
/*---------------------------------------------------------------------------*/
@ -458,11 +459,17 @@ PROCESS_THREAD(grove_gyro_int_process, ev, data)
}
/*---------------------------------------------------------------------------*/
static void
grove_gyro_interrupt_handler(uint8_t port, uint8_t pin)
grove_gyro_interrupt_handler(gpio_hal_pin_mask_t pin_mask)
{
process_poll(&grove_gyro_int_process);
}
/*---------------------------------------------------------------------------*/
static gpio_hal_event_handler_t gyro_handler = {
.next = NULL,
.handler = grove_gyro_interrupt_handler,
.pin_mask = gpio_hal_pin_to_mask(I2C_INT_PIN) << (I2C_INT_PORT << 3),
};
/*---------------------------------------------------------------------------*/
static int
value(int type)
{
@ -593,8 +600,7 @@ configure(int type, int value)
GPIO_DETECT_EDGE(GROVE_GYRO_INT_PORT_BASE, GROVE_GYRO_INT_PIN_MASK);
GPIO_TRIGGER_SINGLE_EDGE(GROVE_GYRO_INT_PORT_BASE, GROVE_GYRO_INT_PIN_MASK);
GPIO_DETECT_FALLING(GROVE_GYRO_INT_PORT_BASE, GROVE_GYRO_INT_PIN_MASK);
gpio_register_callback(grove_gyro_interrupt_handler, I2C_INT_PORT,
I2C_INT_PIN);
gpio_hal_register_handler(&gyro_handler);
/* Spin process until an interrupt is received */
process_start(&grove_gyro_int_process, NULL);

View File

@ -47,6 +47,7 @@
#include "lib/sensors.h"
#include "dev/sys-ctrl.h"
#include "dev/gpio.h"
#include "dev/gpio-hal.h"
#include "dev/ioc.h"
/*---------------------------------------------------------------------------*/
#define DEBUG 0
@ -76,11 +77,17 @@ PROCESS_THREAD(motion_int_process, ev, data)
}
/*---------------------------------------------------------------------------*/
static void
motion_interrupt_handler(uint8_t port, uint8_t pin)
motion_interrupt_handler(gpio_hal_pin_mask_t pin_mask)
{
process_poll(&motion_int_process);
}
/*---------------------------------------------------------------------------*/
static gpio_hal_event_handler_t motion_handler = {
.next = NULL,
.handler = motion_interrupt_handler,
.pin_mask = gpio_hal_pin_to_mask(MOTION_SENSOR_PIN) << (MOTION_SENSOR_PORT << 3),
};
/*---------------------------------------------------------------------------*/
static int
status(int type)
{
@ -113,8 +120,7 @@ configure(int type, int value)
GPIO_DETECT_RISING(MOTION_SENSOR_PORT_BASE, MOTION_SENSOR_PIN_MASK);
GPIO_TRIGGER_SINGLE_EDGE(MOTION_SENSOR_PORT_BASE, MOTION_SENSOR_PIN_MASK);
ioc_set_over(MOTION_SENSOR_PORT, MOTION_SENSOR_PIN, IOC_OVERRIDE_DIS);
gpio_register_callback(motion_interrupt_handler, MOTION_SENSOR_PORT,
MOTION_SENSOR_PIN);
gpio_hal_register_handler(&motion_handler);
process_start(&motion_int_process, NULL);

View File

@ -43,6 +43,7 @@
#include "contiki.h"
#include "dev/i2c.h"
#include "dev/gpio.h"
#include "dev/gpio-hal.h"
#include "dev/zoul-sensors.h"
#include "lib/sensors.h"
#include "tsl256x.h"
@ -255,7 +256,7 @@ PROCESS_THREAD(tsl256x_int_process, ev, data)
}
/*---------------------------------------------------------------------------*/
static void
tsl256x_interrupt_handler(uint8_t port, uint8_t pin)
tsl256x_interrupt_handler(gpio_hal_pin_mask_t pin_mask)
{
/* There's no alert/interruption flag to check, clear the interruption by
* writting to the CLEAR bit in the COMMAND register
@ -263,6 +264,12 @@ tsl256x_interrupt_handler(uint8_t port, uint8_t pin)
process_poll(&tsl256x_int_process);
}
/*---------------------------------------------------------------------------*/
static gpio_hal_event_handler_t tsl256x_handler = {
.next = NULL,
.handler = tsl256x_interrupt_handler,
.pin_mask = gpio_hal_pin_to_mask(I2C_INT_PIN) << (I2C_INT_PORT << 3),
};
/*---------------------------------------------------------------------------*/
static int
configure(int type, int value)
{
@ -440,7 +447,7 @@ configure(int type, int value)
GPIO_DETECT_EDGE(TSL256X_INT_PORT_BASE, TSL256X_INT_PIN_MASK);
GPIO_TRIGGER_SINGLE_EDGE(TSL256X_INT_PORT_BASE, TSL256X_INT_PIN_MASK);
GPIO_DETECT_FALLING(TSL256X_INT_PORT_BASE, TSL256X_INT_PIN_MASK);
gpio_register_callback(tsl256x_interrupt_handler, I2C_INT_PORT, I2C_INT_PIN);
gpio_hal_register_handler(&tsl256x_handler);
/* Spin process until an interrupt is received */
process_start(&tsl256x_int_process, NULL);

View File

@ -51,6 +51,7 @@
#include "lib/sensors.h"
#include "dev/sys-ctrl.h"
#include "dev/gpio.h"
#include "dev/gpio-hal.h"
#include "dev/ioc.h"
#include "sys/timer.h"
#include "sys/ctimer.h"
@ -292,8 +293,22 @@ PROCESS_THREAD(weather_meter_int_process, ev, data)
PROCESS_END();
}
/*---------------------------------------------------------------------------*/
static void weather_meter_interrupt_handler(gpio_hal_pin_mask_t pin_mask);
/*---------------------------------------------------------------------------*/
static gpio_hal_event_handler_t rain_handler = {
.next = NULL,
.handler = weather_meter_interrupt_handler,
.pin_mask = gpio_hal_pin_to_mask(RAIN_GAUGE_SENSOR_PIN) << (RAIN_GAUGE_SENSOR_PORT << 3),
};
/*---------------------------------------------------------------------------*/
static gpio_hal_event_handler_t anemometer_handler = {
.next = NULL,
.handler = weather_meter_interrupt_handler,
.pin_mask = gpio_hal_pin_to_mask(ANEMOMETER_SENSOR_PIN) << (ANEMOMETER_SENSOR_PORT << 3),
};
/*---------------------------------------------------------------------------*/
static void
weather_meter_interrupt_handler(uint8_t port, uint8_t pin)
weather_meter_interrupt_handler(gpio_hal_pin_mask_t pin_mask)
{
uint32_t aux;
@ -308,10 +323,10 @@ weather_meter_interrupt_handler(uint8_t port, uint8_t pin)
* value
*/
if((port == ANEMOMETER_SENSOR_PORT) && (pin == ANEMOMETER_SENSOR_PIN)) {
if(pin_mask == rain_handler.pin_mask) {
weather_sensors.anemometer.ticks++;
process_post(&weather_meter_int_process, anemometer_int_event, NULL);
} else if((port == RAIN_GAUGE_SENSOR_PORT) && (pin == RAIN_GAUGE_SENSOR_PIN)) {
} else if(pin_mask == anemometer_handler.pin_mask) {
weather_sensors.rain_gauge.ticks++;
aux = weather_sensors.rain_gauge.ticks * WEATHER_METER_AUX_RAIN_MM;
aux /= 1000;
@ -427,8 +442,7 @@ configure(int type, int value)
GPIO_TRIGGER_SINGLE_EDGE(ANEMOMETER_SENSOR_PORT_BASE,
ANEMOMETER_SENSOR_PIN_MASK);
ioc_set_over(ANEMOMETER_SENSOR_PORT, ANEMOMETER_SENSOR_PIN, IOC_OVERRIDE_DIS);
gpio_register_callback(weather_meter_interrupt_handler, ANEMOMETER_SENSOR_PORT,
ANEMOMETER_SENSOR_PIN);
gpio_hal_register_handler(&anemometer_handler);
/* Configure rain gauge interruption */
GPIO_SOFTWARE_CONTROL(RAIN_GAUGE_SENSOR_PORT_BASE, RAIN_GAUGE_SENSOR_PIN_MASK);
@ -437,8 +451,7 @@ configure(int type, int value)
GPIO_TRIGGER_SINGLE_EDGE(RAIN_GAUGE_SENSOR_PORT_BASE,
RAIN_GAUGE_SENSOR_PIN_MASK);
ioc_set_over(RAIN_GAUGE_SENSOR_PORT, RAIN_GAUGE_SENSOR_PIN, IOC_OVERRIDE_DIS);
gpio_register_callback(weather_meter_interrupt_handler, RAIN_GAUGE_SENSOR_PORT,
RAIN_GAUGE_SENSOR_PIN);
gpio_hal_register_handler(&rain_handler);
process_start(&weather_meter_int_process, NULL);

View File

@ -3,9 +3,12 @@ all: $(CONTIKI_PROJECT)
CONTIKI=../../..
MAKE_WITH_ORCHESTRA ?= 0 # force Orchestra from command line
MAKE_WITH_SECURITY ?= 0 # force Security from command line
MAKE_WITH_PERIODIC_ROUTES_PRINT ?= 0 # print #routes periodically, used for regression tests
# force Orchestra from command line
MAKE_WITH_ORCHESTRA ?= 0
# force Security from command line
MAKE_WITH_SECURITY ?= 0
# print #routes periodically, used for regression tests
MAKE_WITH_PERIODIC_ROUTES_PRINT ?= 0
MAKE_MAC = MAKE_MAC_TSCH
MODULES += os/services/shell

View File

@ -671,8 +671,8 @@ compress_hdr_iphc(linkaddr_t *link_destaddr)
int ext_hdr_len;
struct uip_udp_hdr *udp_buf;
#if LOG_DBG_ENABLED
{ uint16_t ndx;
if(LOG_DBG_ENABLED) {
uint16_t ndx;
LOG_DBG("before compression (%d): ", UIP_IP_BUF->len[1]);
for(ndx = 0; ndx < UIP_IP_BUF->len[1] + 40; ndx++) {
uint8_t data = ((uint8_t *) (UIP_IP_BUF))[ndx];
@ -680,7 +680,6 @@ compress_hdr_iphc(linkaddr_t *link_destaddr)
}
LOG_DBG("\n");
}
#endif /* LOG_DBG_ENABLED */
hc06_ptr = PACKETBUF_IPHC_BUF + 2;
/*
@ -996,16 +995,15 @@ compress_hdr_iphc(linkaddr_t *link_destaddr)
PACKETBUF_IPHC_BUF[0] = iphc0;
PACKETBUF_IPHC_BUF[1] = iphc1;
#if LOG_DBG_ENABLED
{ uint16_t ndx;
if(LOG_DBG_ENABLED) {
uint16_t ndx;
LOG_DBG("after compression %d: ", (int)(hc06_ptr - packetbuf_ptr));
for(ndx = 0; ndx < hc06_ptr - packetbuf_ptr; ndx++) {
uint8_t data = ((uint8_t *) packetbuf_ptr)[ndx];
LOG_DBG("%02x", data);
}
LOG_DBG("\n");
}
#endif
}
packetbuf_hdr_len = hc06_ptr - packetbuf_ptr;
}
@ -1906,8 +1904,7 @@ input(void)
LOG_INFO("input: IP packet ready (length %d)\n",
uip_len);
#if LOG_DBG_ENABLED
{
if(LOG_DBG_ENABLED) {
uint16_t ndx;
LOG_DBG("after decompression %u:", UIP_IP_BUF->len[1]);
for (ndx = 0; ndx < UIP_IP_BUF->len[1] + 40; ndx++) {
@ -1916,7 +1913,6 @@ input(void)
}
LOG_DBG("\n");
}
#endif /* LOG_DBG_ENABLED */
/* if callback is set then set attributes and call */
if(callback) {

View File

@ -103,7 +103,6 @@ LIST(notificationlist);
#endif
/*---------------------------------------------------------------------------*/
#if LOG_DBG_ENABLED
static void
assert_nbr_routes_list_sane(void)
{
@ -131,7 +130,6 @@ assert_nbr_routes_list_sane(void)
}
#endif /* (UIP_MAX_ROUTES != 0) */
}
#endif /* LOG_DBG_ENABLED */
/*---------------------------------------------------------------------------*/
#if UIP_DS6_NOTIFICATIONS
static void
@ -330,9 +328,9 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
uip_ds6_route_t *r;
struct uip_ds6_route_neighbor_route *nbrr;
#if LOG_DBG_ENABLED
assert_nbr_routes_list_sane();
#endif /* LOG_DBG_ENABLED */
if(LOG_DBG_ENABLED) {
assert_nbr_routes_list_sane();
}
if(ipaddr == NULL || nexthop == NULL) {
return NULL;
@ -473,9 +471,9 @@ uip_ds6_route_add(uip_ipaddr_t *ipaddr, uint8_t length,
call_route_callback(UIP_DS6_NOTIFICATION_ROUTE_ADD, ipaddr, nexthop);
#endif
#if LOG_DBG_ENABLED
assert_nbr_routes_list_sane();
#endif /* LOG_DBG_ENABLED */
if(LOG_DBG_ENABLED) {
assert_nbr_routes_list_sane();
}
return r;
#else /* (UIP_MAX_ROUTES != 0) */
@ -489,9 +487,11 @@ uip_ds6_route_rm(uip_ds6_route_t *route)
{
#if (UIP_MAX_ROUTES != 0)
struct uip_ds6_route_neighbor_route *neighbor_route;
#if LOG_DBG_ENABLED
assert_nbr_routes_list_sane();
#endif /* LOG_DBG_ENABLED */
if(LOG_DBG_ENABLED) {
assert_nbr_routes_list_sane();
}
if(route != NULL && route->neighbor_routes != NULL) {
LOG_INFO("Rm: removing route: ");
@ -541,9 +541,9 @@ uip_ds6_route_rm(uip_ds6_route_t *route)
#endif
}
#if LOG_DBG_ENABLED
assert_nbr_routes_list_sane();
#endif /* LOG_DBG_ENABLED */
if(LOG_DBG_ENABLED) {
assert_nbr_routes_list_sane();
}
#endif /* (UIP_MAX_ROUTES != 0) */
return;
@ -553,9 +553,10 @@ uip_ds6_route_rm(uip_ds6_route_t *route)
static void
rm_routelist(struct uip_ds6_route_neighbor_routes *routes)
{
#if LOG_DBG_ENABLED
assert_nbr_routes_list_sane();
#endif /* LOG_DBG_ENABLED */
if(LOG_DBG_ENABLED) {
assert_nbr_routes_list_sane();
}
if(routes != NULL && routes->route_list != NULL) {
struct uip_ds6_route_neighbor_route *r;
r = list_head(routes->route_list);
@ -565,9 +566,10 @@ rm_routelist(struct uip_ds6_route_neighbor_routes *routes)
}
nbr_table_remove(nbr_routes, routes);
}
#if LOG_DBG_ENABLED
assert_nbr_routes_list_sane();
#endif /* LOG_DBG_ENABLED */
if(LOG_DBG_ENABLED) {
assert_nbr_routes_list_sane();
}
}
/*---------------------------------------------------------------------------*/
static void
@ -603,9 +605,9 @@ uip_ds6_defrt_add(uip_ipaddr_t *ipaddr, unsigned long interval)
{
uip_ds6_defrt_t *d;
#if LOG_DBG_ENABLED
assert_nbr_routes_list_sane();
#endif /* LOG_DBG_ENABLED */
if(LOG_DBG_ENABLED) {
assert_nbr_routes_list_sane();
}
if(ipaddr == NULL) {
return NULL;
@ -643,9 +645,9 @@ uip_ds6_defrt_add(uip_ipaddr_t *ipaddr, unsigned long interval)
call_route_callback(UIP_DS6_NOTIFICATION_DEFRT_ADD, ipaddr, ipaddr);
#endif
#if LOG_DBG_ENABLED
if(LOG_DBG_ENABLED) {
assert_nbr_routes_list_sane();
#endif /* LOG_DBG_ENABLED */
}
return d;
}
@ -655,9 +657,9 @@ uip_ds6_defrt_rm(uip_ds6_defrt_t *defrt)
{
uip_ds6_defrt_t *d;
#if LOG_DBG_ENABLED
assert_nbr_routes_list_sane();
#endif /* LOG_DBG_ENABLED */
if(LOG_DBG_ENABLED) {
assert_nbr_routes_list_sane();
}
/* Make sure that the defrt is in the list before we remove it. */
for(d = list_head(defaultrouterlist);
@ -675,10 +677,10 @@ uip_ds6_defrt_rm(uip_ds6_defrt_t *defrt)
return;
}
}
#if LOG_DBG_ENABLED
assert_nbr_routes_list_sane();
#endif /* LOG_DBG_ENABLED */
if(LOG_DBG_ENABLED) {
assert_nbr_routes_list_sane();
}
}
/*---------------------------------------------------------------------------*/
uip_ds6_defrt_t *

View File

@ -217,13 +217,13 @@ uip_sr_periodic(unsigned seconds)
break;
}
}
#if LOG_INFO_ENABLED
uip_ipaddr_t node_addr;
NETSTACK_ROUTING.get_sr_node_ipaddr(&node_addr, l);
LOG_INFO("NS: removing expired node ");
LOG_INFO_6ADDR(&node_addr);
LOG_INFO_("\n");
#endif /* LOG_INFO_ENABLED */
if(LOG_INFO_ENABLED) {
uip_ipaddr_t node_addr;
NETSTACK_ROUTING.get_sr_node_ipaddr(&node_addr, l);
LOG_INFO("NS: removing expired node ");
LOG_INFO_6ADDR(&node_addr);
LOG_INFO_("\n");
}
/* No child found, deallocate node */
list_remove(nodelist, l);
memb_free(&nodememb, l);

View File

@ -452,16 +452,15 @@ tsch_schedule_print(void)
if(!tsch_is_locked()) {
struct tsch_slotframe *sf = list_head(slotframe_list);
printf("Schedule: slotframe list\n");
LOG_PRINT("----- start slotframe list -----\n");
while(sf != NULL) {
struct tsch_link *l = list_head(sf->links_list);
printf("[Slotframe] Handle %u, size %u\n", sf->handle, sf->size.val);
printf("List of links:\n");
LOG_PRINT("Slotframe Handle %u, size %u\n", sf->handle, sf->size.val);
while(l != NULL) {
printf("[Link] Options %02x, type %u, timeslot %u, channel offset %u, address %u\n",
LOG_PRINT("* Link Options %02x, type %u, timeslot %u, channel offset %u, address %u\n",
l->link_options, l->link_type, l->timeslot, l->channel_offset, l->addr.u8[7]);
l = list_item_next(l);
}
@ -469,7 +468,7 @@ tsch_schedule_print(void)
sf = list_item_next(sf);
}
printf("Schedule: end of slotframe list\n");
LOG_PRINT("----- end slotframe list -----\n");
}
}
/*---------------------------------------------------------------------------*/

View File

@ -185,9 +185,9 @@ rpl_global_repair(const char *str)
if(rpl_dag_root_is_root()) {
LOG_WARN("initiating global repair (%s), version %u, rank %u)\n",
str, curr_instance.dag.version, curr_instance.dag.rank);
#if LOG_INFO_ENABLED
rpl_neighbor_print_list("Global repair (before)");
#endif /* LOG_INFO_ENABLED */
if(LOG_INFO_ENABLED) {
rpl_neighbor_print_list("Global repair (before)");
}
/* Initiate global repair */
RPL_LOLLIPOP_INCREMENT(curr_instance.dag.version); /* New DAG version */
@ -202,9 +202,9 @@ global_repair_non_root(rpl_dio_t *dio)
if(!rpl_dag_root_is_root()) {
LOG_WARN("participating in global repair, version %u, rank %u)\n",
curr_instance.dag.version, curr_instance.dag.rank);
#if LOG_INFO_ENABLED
rpl_neighbor_print_list("Global repair (before)");
#endif /* LOG_INFO_ENABLED */
if(LOG_INFO_ENABLED) {
rpl_neighbor_print_list("Global repair (before)");
}
/* Re-initialize configuration from DIO */
init_dag_from_dio(dio);
rpl_local_repair("Global repair");
@ -325,9 +325,9 @@ rpl_dag_update_state(void)
rpl_timers_schedule_leaving();
}
#if LOG_INFO_ENABLED
rpl_neighbor_print_list("Parent switch");
#endif /* LOG_INFO_ENABLED */
if(LOG_INFO_ENABLED) {
rpl_neighbor_print_list("Parent switch");
}
}
}

View File

@ -65,19 +65,7 @@ static int num_parents; /* all nodes that are possible parents */
static int num_free;
static linkaddr_t *worst_rank_nbr_lladdr; /* lladdr of the the neighbor with the worst rank */
static rpl_rank_t worst_rank;
/*---------------------------------------------------------------------------*/
#if LOG_DBG_ENABLED
/* Print out state periodically */
static void update_state(void);
static struct ctimer periodic_timer;
static int timer_init = 0;
static void
handle_periodic_timer(void *ptr)
{
update_state();
ctimer_restart(&periodic_timer);
}
#endif /* LOG_DBG_ENABLED */
/*---------------------------------------------------------------------------*/
static void
update_state(void)
@ -87,14 +75,6 @@ update_state(void)
rpl_rank_t nbr_rank;
int num_used = 0;
#if LOG_DBG_ENABLED
if(!timer_init) {
timer_init = 1;
ctimer_set(&periodic_timer, 60 * CLOCK_SECOND,
&handle_periodic_timer, NULL);
}
#endif /* LOG_DBG_ENABLED */
worst_rank = 0;
worst_rank_nbr_lladdr = NULL;
num_parents = 0;

View File

@ -514,9 +514,9 @@ handle_periodic_timer(void *ptr)
the meaning of last_advertised_rank changes with time */
rpl_dag_update_state();
#if LOG_INFO_ENABLED
rpl_neighbor_print_list("Periodic");
#endif /* LOG_INFO_ENABLED */
if(LOG_INFO_ENABLED) {
rpl_neighbor_print_list("Periodic");
}
ctimer_reset(&periodic_timer);
}

View File

@ -145,27 +145,36 @@ extern struct log_module all_modules[];
} while (0)
/* More compact versions of LOG macros */
#define LOG_PRINT(...) LOG(1, 0, "PRI", __VA_ARGS__)
#define LOG_ERR(...) LOG(1, LOG_LEVEL_ERR, "ERR", __VA_ARGS__)
#define LOG_WARN(...) LOG(1, LOG_LEVEL_WARN, "WARN", __VA_ARGS__)
#define LOG_INFO(...) LOG(1, LOG_LEVEL_INFO, "INFO", __VA_ARGS__)
#define LOG_DBG(...) LOG(1, LOG_LEVEL_DBG, "DBG", __VA_ARGS__)
#define LOG_PRINT_(...) LOG(0, 0, "PRI", __VA_ARGS__)
#define LOG_ERR_(...) LOG(0, LOG_LEVEL_ERR, "ERR", __VA_ARGS__)
#define LOG_WARN_(...) LOG(0, LOG_LEVEL_WARN, "WARN", __VA_ARGS__)
#define LOG_INFO_(...) LOG(0, LOG_LEVEL_INFO, "INFO", __VA_ARGS__)
#define LOG_DBG_(...) LOG(0, LOG_LEVEL_DBG, "DBG", __VA_ARGS__)
#define LOG_PRINT_LLADDR(...) LOG_LLADDR(0, __VA_ARGS__)
#define LOG_ERR_LLADDR(...) LOG_LLADDR(LOG_LEVEL_ERR, __VA_ARGS__)
#define LOG_WARN_LLADDR(...) LOG_LLADDR(LOG_LEVEL_WARN, __VA_ARGS__)
#define LOG_INFO_LLADDR(...) LOG_LLADDR(LOG_LEVEL_INFO, __VA_ARGS__)
#define LOG_DBG_LLADDR(...) LOG_LLADDR(LOG_LEVEL_DBG, __VA_ARGS__)
#define LOG_PRINT_6ADDR(...) LOG_6ADDR(0, __VA_ARGS__)
#define LOG_ERR_6ADDR(...) LOG_6ADDR(LOG_LEVEL_ERR, __VA_ARGS__)
#define LOG_WARN_6ADDR(...) LOG_6ADDR(LOG_LEVEL_WARN, __VA_ARGS__)
#define LOG_INFO_6ADDR(...) LOG_6ADDR(LOG_LEVEL_INFO, __VA_ARGS__)
#define LOG_DBG_6ADDR(...) LOG_6ADDR(LOG_LEVEL_DBG, __VA_ARGS__)
/* For testing log level */
/* For checking log level.
As this builds on curr_log_level variables, this should not be used
in pre-processor macros. Use in a C 'if' statement instead, e.g.:
if(LOG_INFO_ENABLED) { ... }
Note that most compilers will still be able to strip the code out
for low enough log levels configurations. */
#define LOG_ERR_ENABLED ((LOG_LEVEL) >= LOG_LEVEL_ERR)
#define LOG_WARN_ENABLED ((LOG_LEVEL) >= LOG_LEVEL_WARN)
#define LOG_INFO_ENABLED ((LOG_LEVEL) >= LOG_LEVEL_INFO)