forked from Archive/PX4-Autopilot
Merge branch 'master' of github.com:PX4/Firmware into stack_sweep
This commit is contained in:
commit
93388803b7
|
@ -1,10 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2013, 2014 PX4 Development Team. All rights reserved.
|
||||||
* Author: Jean Cyr
|
|
||||||
* Lorenz Meier
|
|
||||||
* Julian Oes
|
|
||||||
* Thomas Gubler
|
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
@ -37,6 +33,11 @@
|
||||||
/**
|
/**
|
||||||
* @file dataman.c
|
* @file dataman.c
|
||||||
* DATAMANAGER driver.
|
* DATAMANAGER driver.
|
||||||
|
*
|
||||||
|
* @author Jean Cyr
|
||||||
|
* @author Lorenz Meier
|
||||||
|
* @author Julian Oes
|
||||||
|
* @author Thomas Gubler
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
@ -62,7 +63,7 @@ __EXPORT ssize_t dm_write(dm_item_t item, unsigned char index, dm_persitence_t
|
||||||
__EXPORT int dm_clear(dm_item_t item);
|
__EXPORT int dm_clear(dm_item_t item);
|
||||||
__EXPORT int dm_restart(dm_reset_reason restart_type);
|
__EXPORT int dm_restart(dm_reset_reason restart_type);
|
||||||
|
|
||||||
/* Types of function calls supported by the worker task */
|
/** Types of function calls supported by the worker task */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
dm_write_func = 0,
|
dm_write_func = 0,
|
||||||
dm_read_func,
|
dm_read_func,
|
||||||
|
@ -71,7 +72,7 @@ typedef enum {
|
||||||
dm_number_of_funcs
|
dm_number_of_funcs
|
||||||
} dm_function_t;
|
} dm_function_t;
|
||||||
|
|
||||||
/* Work task work item */
|
/** Work task work item */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
sq_entry_t link; /**< list linkage */
|
sq_entry_t link; /**< list linkage */
|
||||||
sem_t wait_sem;
|
sem_t wait_sem;
|
||||||
|
@ -411,7 +412,7 @@ _clear(dm_item_t item)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell the data manager about the type of the last reset */
|
/** Tell the data manager about the type of the last reset */
|
||||||
static int
|
static int
|
||||||
_restart(dm_reset_reason reason)
|
_restart(dm_reset_reason reason)
|
||||||
{
|
{
|
||||||
|
@ -480,7 +481,7 @@ _restart(dm_reset_reason reason)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write to the data manager file */
|
/** Write to the data manager file */
|
||||||
__EXPORT ssize_t
|
__EXPORT ssize_t
|
||||||
dm_write(dm_item_t item, unsigned char index, dm_persitence_t persistence, const void *buf, size_t count)
|
dm_write(dm_item_t item, unsigned char index, dm_persitence_t persistence, const void *buf, size_t count)
|
||||||
{
|
{
|
||||||
|
@ -505,7 +506,7 @@ dm_write(dm_item_t item, unsigned char index, dm_persitence_t persistence, const
|
||||||
return (ssize_t)enqueue_work_item_and_wait_for_result(work);
|
return (ssize_t)enqueue_work_item_and_wait_for_result(work);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieve from the data manager file */
|
/** Retrieve from the data manager file */
|
||||||
__EXPORT ssize_t
|
__EXPORT ssize_t
|
||||||
dm_read(dm_item_t item, unsigned char index, void *buf, size_t count)
|
dm_read(dm_item_t item, unsigned char index, void *buf, size_t count)
|
||||||
{
|
{
|
||||||
|
@ -736,7 +737,7 @@ start(void)
|
||||||
sem_init(&g_init_sema, 1, 0);
|
sem_init(&g_init_sema, 1, 0);
|
||||||
|
|
||||||
/* start the worker thread */
|
/* start the worker thread */
|
||||||
if ((task = task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_MAX - 5, 2048, task_main, NULL)) <= 0) {
|
if ((task = task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_MAX - 5, 2000, task_main, NULL)) <= 0) {
|
||||||
warn("task start failed");
|
warn("task start failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2013, 2014 PX4 Development Team. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Types of items that the data manager can store */
|
/** Types of items that the data manager can store */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DM_KEY_SAFE_POINTS = 0, /* Safe points coordinates, safe point 0 is home point */
|
DM_KEY_SAFE_POINTS = 0, /* Safe points coordinates, safe point 0 is home point */
|
||||||
DM_KEY_FENCE_POINTS, /* Fence vertex coordinates */
|
DM_KEY_FENCE_POINTS, /* Fence vertex coordinates */
|
||||||
|
@ -56,7 +56,7 @@ extern "C" {
|
||||||
DM_KEY_NUM_KEYS /* Total number of item types defined */
|
DM_KEY_NUM_KEYS /* Total number of item types defined */
|
||||||
} dm_item_t;
|
} dm_item_t;
|
||||||
|
|
||||||
/* The maximum number of instances for each item type */
|
/** The maximum number of instances for each item type */
|
||||||
enum {
|
enum {
|
||||||
DM_KEY_SAFE_POINTS_MAX = 8,
|
DM_KEY_SAFE_POINTS_MAX = 8,
|
||||||
DM_KEY_FENCE_POINTS_MAX = GEOFENCE_MAX_VERTICES,
|
DM_KEY_FENCE_POINTS_MAX = GEOFENCE_MAX_VERTICES,
|
||||||
|
@ -65,24 +65,24 @@ extern "C" {
|
||||||
DM_KEY_WAYPOINTS_ONBOARD_MAX = NUM_MISSIONS_SUPPORTED
|
DM_KEY_WAYPOINTS_ONBOARD_MAX = NUM_MISSIONS_SUPPORTED
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Data persistence levels */
|
/** Data persistence levels */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DM_PERSIST_POWER_ON_RESET = 0, /* Data survives all resets */
|
DM_PERSIST_POWER_ON_RESET = 0, /* Data survives all resets */
|
||||||
DM_PERSIST_IN_FLIGHT_RESET, /* Data survives in-flight resets only */
|
DM_PERSIST_IN_FLIGHT_RESET, /* Data survives in-flight resets only */
|
||||||
DM_PERSIST_VOLATILE /* Data does not survive resets */
|
DM_PERSIST_VOLATILE /* Data does not survive resets */
|
||||||
} dm_persitence_t;
|
} dm_persitence_t;
|
||||||
|
|
||||||
/* The reason for the last reset */
|
/** The reason for the last reset */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DM_INIT_REASON_POWER_ON = 0, /* Data survives resets */
|
DM_INIT_REASON_POWER_ON = 0, /* Data survives resets */
|
||||||
DM_INIT_REASON_IN_FLIGHT, /* Data survives in-flight resets only */
|
DM_INIT_REASON_IN_FLIGHT, /* Data survives in-flight resets only */
|
||||||
DM_INIT_REASON_VOLATILE /* Data does not survive reset */
|
DM_INIT_REASON_VOLATILE /* Data does not survive reset */
|
||||||
} dm_reset_reason;
|
} dm_reset_reason;
|
||||||
|
|
||||||
/* Maximum size in bytes of a single item instance */
|
/** Maximum size in bytes of a single item instance */
|
||||||
#define DM_MAX_DATA_SIZE 124
|
#define DM_MAX_DATA_SIZE 124
|
||||||
|
|
||||||
/* Retrieve from the data manager store */
|
/** Retrieve from the data manager store */
|
||||||
__EXPORT ssize_t
|
__EXPORT ssize_t
|
||||||
dm_read(
|
dm_read(
|
||||||
dm_item_t item, /* The item type to retrieve */
|
dm_item_t item, /* The item type to retrieve */
|
||||||
|
@ -91,7 +91,7 @@ extern "C" {
|
||||||
size_t buflen /* Length in bytes of data to retrieve */
|
size_t buflen /* Length in bytes of data to retrieve */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* write to the data manager store */
|
/** write to the data manager store */
|
||||||
__EXPORT ssize_t
|
__EXPORT ssize_t
|
||||||
dm_write(
|
dm_write(
|
||||||
dm_item_t item, /* The item type to store */
|
dm_item_t item, /* The item type to store */
|
||||||
|
@ -101,13 +101,13 @@ extern "C" {
|
||||||
size_t buflen /* Length in bytes of data to retrieve */
|
size_t buflen /* Length in bytes of data to retrieve */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Erase all items of this type */
|
/** Erase all items of this type */
|
||||||
__EXPORT int
|
__EXPORT int
|
||||||
dm_clear(
|
dm_clear(
|
||||||
dm_item_t item /* The item type to clear */
|
dm_item_t item /* The item type to clear */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* Tell the data manager about the type of the last reset */
|
/** Tell the data manager about the type of the last reset */
|
||||||
__EXPORT int
|
__EXPORT int
|
||||||
dm_restart(
|
dm_restart(
|
||||||
dm_reset_reason restart_type /* The last reset type */
|
dm_reset_reason restart_type /* The last reset type */
|
||||||
|
|
Loading…
Reference in New Issue