mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-12 20:10:34 +08:00
Add a generic nuttx hrt driver userspace interface
This adds a nuttx userspace interface for hrt driver, communicating with the actual hrt driver upper half via BOARDCTL IOCTLs This is be used when running PX4 in NuttX protected or kernel builds Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
@@ -76,6 +76,10 @@ typedef struct hrt_call {
|
||||
hrt_abstime period;
|
||||
hrt_callout callout;
|
||||
void *arg;
|
||||
#if defined(__PX4_NUTTX) && !defined(CONFIG_BUILD_FLAT)
|
||||
hrt_callout usr_callout;
|
||||
void *usr_arg;
|
||||
#endif
|
||||
} *hrt_call_t;
|
||||
|
||||
|
||||
@@ -84,6 +88,38 @@ extern const uint16_t latency_bucket_count;
|
||||
extern const uint16_t latency_buckets[LATENCY_BUCKET_COUNT];
|
||||
extern uint32_t latency_counters[LATENCY_BUCKET_COUNT + 1];
|
||||
|
||||
|
||||
typedef struct hrt_boardctl {
|
||||
hrt_call_t entry;
|
||||
hrt_abstime time; /* delay or calltime */
|
||||
hrt_abstime interval;
|
||||
hrt_callout callout;
|
||||
void *arg;
|
||||
} hrt_boardctl_t;
|
||||
|
||||
typedef struct latency_info {
|
||||
uint16_t bucket;
|
||||
uint32_t counter;
|
||||
} latency_info_t;
|
||||
|
||||
typedef struct latency_boardctl {
|
||||
uint16_t bucket_idx;
|
||||
uint16_t counter_idx;
|
||||
latency_info_t latency;
|
||||
} latency_boardctl_t;
|
||||
|
||||
#define _HRTIOCBASE (0x1000)
|
||||
#define _HRTIOC(_n) (_PX4_IOC(_HRTIOCBASE, _n))
|
||||
|
||||
#define HRT_WAITEVENT _HRTIOC(1)
|
||||
#define HRT_ABSOLUTE_TIME _HRTIOC(2)
|
||||
#define HRT_CALL_AFTER _HRTIOC(3)
|
||||
#define HRT_CALL_AT _HRTIOC(4)
|
||||
#define HRT_CALL_EVERY _HRTIOC(5)
|
||||
#define HRT_CANCEL _HRTIOC(6)
|
||||
#define HRT_GET_LATENCY _HRTIOC(7)
|
||||
#define HRT_RESET_LATENCY _HRTIOC(8)
|
||||
|
||||
/**
|
||||
* Get absolute time in [us] (does not wrap).
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user