mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 16:53:34 +08:00
Honor Micro hal and new Nuttx Loging API
This commit is contained in:
committed by
Lorenz Meier
parent
ddb9bc3242
commit
d8580d39b9
+16
-13
@@ -62,14 +62,16 @@
|
|||||||
#include <board_config.h>
|
#include <board_config.h>
|
||||||
#include <drivers/drv_hrt.h>
|
#include <drivers/drv_hrt.h>
|
||||||
|
|
||||||
#include "chip.h"
|
|
||||||
#include "up_internal.h"
|
|
||||||
#include "up_arch.h"
|
|
||||||
|
|
||||||
#include "stm32.h"
|
|
||||||
#include "stm32_gpio.h"
|
#include "stm32_gpio.h"
|
||||||
#include "stm32_tim.h"
|
#include "stm32_tim.h"
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_HRT
|
||||||
|
# define hrtinfo _info
|
||||||
|
#else
|
||||||
|
# define hrtinfo(x...)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HRT_TIMER
|
#ifdef HRT_TIMER
|
||||||
|
|
||||||
/* HRT configuration */
|
/* HRT configuration */
|
||||||
@@ -865,7 +867,7 @@ hrt_call_enter(struct hrt_call *entry)
|
|||||||
|
|
||||||
if ((call == NULL) || (entry->deadline < call->deadline)) {
|
if ((call == NULL) || (entry->deadline < call->deadline)) {
|
||||||
sq_addfirst(&entry->link, &callout_queue);
|
sq_addfirst(&entry->link, &callout_queue);
|
||||||
//lldbg("call enter at head, reschedule\n");
|
hrtinfo("call enter at head, reschedule\n");
|
||||||
/* we changed the next deadline, reschedule the timer event */
|
/* we changed the next deadline, reschedule the timer event */
|
||||||
hrt_call_reschedule();
|
hrt_call_reschedule();
|
||||||
|
|
||||||
@@ -874,14 +876,14 @@ hrt_call_enter(struct hrt_call *entry)
|
|||||||
next = (struct hrt_call *)sq_next(&call->link);
|
next = (struct hrt_call *)sq_next(&call->link);
|
||||||
|
|
||||||
if ((next == NULL) || (entry->deadline < next->deadline)) {
|
if ((next == NULL) || (entry->deadline < next->deadline)) {
|
||||||
//lldbg("call enter after head\n");
|
hrtinfo("call enter after head\n");
|
||||||
sq_addafter(&call->link, &entry->link, &callout_queue);
|
sq_addafter(&call->link, &entry->link, &callout_queue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while ((call = next) != NULL);
|
} while ((call = next) != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//lldbg("scheduled\n");
|
hrtinfo("scheduled\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -905,7 +907,7 @@ hrt_call_invoke(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sq_rem(&call->link, &callout_queue);
|
sq_rem(&call->link, &callout_queue);
|
||||||
//lldbg("call pop\n");
|
hrtinfo("call pop\n");
|
||||||
|
|
||||||
/* save the intended deadline for periodic calls */
|
/* save the intended deadline for periodic calls */
|
||||||
deadline = call->deadline;
|
deadline = call->deadline;
|
||||||
@@ -915,7 +917,7 @@ hrt_call_invoke(void)
|
|||||||
|
|
||||||
/* invoke the callout (if there is one) */
|
/* invoke the callout (if there is one) */
|
||||||
if (call->callout) {
|
if (call->callout) {
|
||||||
//lldbg("call %p: %p(%p)\n", call, call->callout, call->arg);
|
hrtinfo("call %p: %p(%p)\n", call, call->callout, call->arg);
|
||||||
call->callout(call->arg);
|
call->callout(call->arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -958,19 +960,20 @@ hrt_call_reschedule()
|
|||||||
* hrt_absolute_time runs at least once per timer period.
|
* hrt_absolute_time runs at least once per timer period.
|
||||||
*/
|
*/
|
||||||
if (next != NULL) {
|
if (next != NULL) {
|
||||||
//lldbg("entry in queue\n");
|
hrtinfo("entry in queue\n");
|
||||||
|
|
||||||
if (next->deadline <= (now + HRT_INTERVAL_MIN)) {
|
if (next->deadline <= (now + HRT_INTERVAL_MIN)) {
|
||||||
//lldbg("pre-expired\n");
|
hrtinfo("pre-expired\n");
|
||||||
/* set a minimal deadline so that we call ASAP */
|
/* set a minimal deadline so that we call ASAP */
|
||||||
deadline = now + HRT_INTERVAL_MIN;
|
deadline = now + HRT_INTERVAL_MIN;
|
||||||
|
|
||||||
} else if (next->deadline < deadline) {
|
} else if (next->deadline < deadline) {
|
||||||
//lldbg("due soon\n");
|
hrtinfo("due soon\n");
|
||||||
deadline = next->deadline;
|
deadline = next->deadline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//lldbg("schedule for %u at %u\n", (unsigned)(deadline & 0xffffffff), (unsigned)(now & 0xffffffff));
|
hrtinfo("schedule for %u at %u\n", (unsigned)(deadline & 0xffffffff), (unsigned)(now & 0xffffffff));
|
||||||
|
|
||||||
/* set the new compare value and remember it for latency tracking */
|
/* set the new compare value and remember it for latency tracking */
|
||||||
rCCR_HRT = latency_baseline = deadline & 0xffff;
|
rCCR_HRT = latency_baseline = deadline & 0xffff;
|
||||||
|
|||||||
Reference in New Issue
Block a user