Browse Source

Remove reboot() API, replace with a prototype for up_systemreset() which is portable.

sbg
px4dev 12 years ago
parent
commit
98791bc674
  1. 2
      apps/commander/state_machine_helper.c
  2. 8
      apps/drivers/boards/px4fmu/px4fmu_internal.h
  3. 2
      apps/drivers/px4fmu/fmu.cpp
  4. 5
      apps/systemcmds/reboot/reboot.c
  5. 35
      apps/systemlib/systemlib.c
  6. 2
      apps/systemlib/systemlib.h

2
apps/commander/state_machine_helper.c

@ -138,7 +138,7 @@ int do_state_update(int status_pub, struct vehicle_status_s *current_status, con @@ -138,7 +138,7 @@ int do_state_update(int status_pub, struct vehicle_status_s *current_status, con
current_status->flag_system_armed = false;
mavlink_log_critical(mavlink_fd, "[commander] REBOOTING SYSTEM");
usleep(500000);
reboot();
up_systemreset();
/* SPECIAL CASE: NEVER RETURNS FROM THIS FUNCTION CALL */
} else {
invalid_state = true;

8
apps/drivers/boards/px4fmu/px4fmu_internal.h

@ -47,7 +47,11 @@ @@ -47,7 +47,11 @@
#include <nuttx/compiler.h>
#include <stdint.h>
#include "stm32_internal.h"
__BEGIN_DECLS
/* these headers are not C++ safe */
#include <stm32_internal.h>
/****************************************************************************************************
* Definitions
@ -153,3 +157,5 @@ @@ -153,3 +157,5 @@
extern void stm32_spiinitialize(void);
#endif /* __ASSEMBLY__ */
__END_DECLS

2
apps/drivers/px4fmu/fmu.cpp

@ -59,13 +59,13 @@ @@ -59,13 +59,13 @@
#include <drivers/drv_gpio.h>
#include <drivers/boards/px4fmu/px4fmu_internal.h>
#include <systemlib/systemlib.h>
#include <systemlib/mixer/mixer.h>
#include <drivers/drv_mixer.h>
#include <uORB/topics/actuator_controls.h>
#include <uORB/topics/actuator_outputs.h>
#include <systemlib/systemlib.h>
#include <systemlib/err.h>
class PX4FMU : public device::CDev

5
apps/systemcmds/reboot/reboot.c

@ -41,14 +41,13 @@ @@ -41,14 +41,13 @@
#include <unistd.h>
#include <stdio.h>
#include "systemlib/systemlib.h"
#include <systemlib/systemlib.h>
__EXPORT int reboot_main(int argc, char *argv[]);
int reboot_main(int argc, char *argv[])
{
reboot();
return 0;
up_systemreset();
}

35
apps/systemlib/systemlib.c

@ -73,41 +73,6 @@ const struct __multiport_info multiport_info = { @@ -73,41 +73,6 @@ const struct __multiport_info multiport_info = {
static void kill_task(FAR _TCB *tcb, FAR void *arg);
/****************************************************************************
* user_start
****************************************************************************/
int reboot(void)
{
sched_lock();
// print text
printf("\r\nRebooting system - ending tasks and performing hard reset\r\n\r\n");
fflush(stdout);
//usleep(5000);
/* Sending kill signal to other tasks */
//killall();
/* Waiting maximum time for all to exit */
//usleep(5000);
//sched_lock();
/* Resetting CPU */
// FIXME Need check for ARM architecture here
#ifndef NVIC_AIRCR
#define NVIC_AIRCR (*((uint32_t*)0xE000ED0C))
#endif
/* Set the SYSRESETREQ bit to force a reset */
NVIC_AIRCR = 0x05fa0004;
/* Spinning until the board is really reset */
while (true);
/* Should never reach here */
return 0;
}
void killall()
{
// printf("Sending SIGUSR1 to all processes now\n");

2
apps/systemlib/systemlib.h

@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
__BEGIN_DECLS
/** Reboots the board */
__EXPORT int reboot(void);
extern void up_systemreset(void) noreturn_function;
/** Sends SIGUSR1 to all processes */
__EXPORT void killall(void);

Loading…
Cancel
Save