Skip to content

Commit

Permalink
shutdown: ifdef for NuttX builds without work queue support
Browse files Browse the repository at this point in the history
For example on px4cannode-v1_default.
  • Loading branch information
bkueng committed Apr 18, 2017
1 parent b4361f6 commit ae387c4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/platforms/common/shutdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,31 @@
#include <errno.h>
#include <pthread.h>

#if defined(__PX4_NUTTX) && !defined(CONFIG_SCHED_WORKQUEUE)
// minimal NuttX build without work queue support

int px4_register_shutdown_hook(shutdown_hook_t hook)
{
return -EINVAL;
}
int px4_unregister_shutdown_hook(shutdown_hook_t hook)
{
return -EINVAL;
}

int px4_shutdown_request(bool reboot, bool to_bootloader)
{
if (reboot) {
px4_systemreset(to_bootloader);

} else {
return board_shutdown();
}

return 0;
}

#else

static struct work_s shutdown_work = {};
static uint8_t shutdown_counter = 0;
Expand Down Expand Up @@ -170,3 +195,5 @@ int px4_shutdown_request(bool reboot, bool to_bootloader)
return work_queue(HPWORK, &shutdown_work, (worker_t)&shutdown_worker, NULL, USEC2TICK(0));
}


#endif /* if defined(__PX4_NUTTX) && !defined(CONFIG_SCHED_WORKQUEUE) */

0 comments on commit ae387c4

Please sign in to comment.