mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
PiOS/win32: Made the process priority "high priority" for OpenPilot.exe to help with accurate timing. Also removed some unneeded debugging code from tasks.c.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1553 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
d06d7025ff
commit
c2e93aa810
@ -234,7 +234,7 @@ static DWORD WINAPI tick_generator(LPVOID lpParameter)
|
|||||||
before = (float)clock()/CLOCKS_PER_SEC;
|
before = (float)clock()/CLOCKS_PER_SEC;
|
||||||
debug_printf("tick before, %f\n", before);
|
debug_printf("tick before, %f\n", before);
|
||||||
SetWaitableTimer(hTimer, &liDueTime, 0, NULL, NULL, FALSE);
|
SetWaitableTimer(hTimer, &liDueTime, 0, NULL, NULL, FALSE);
|
||||||
if(WaitForMultipleObjects(2, hObjList, TRUE, 1000) == WAIT_TIMEOUT)
|
if(WaitForMultipleObjects(2, hObjList, TRUE, 2000) == WAIT_TIMEOUT)
|
||||||
{
|
{
|
||||||
printf("Tick generator: timed out at WaitForMultipleObjects\n");
|
printf("Tick generator: timed out at WaitForMultipleObjects\n");
|
||||||
return 0;
|
return 0;
|
||||||
@ -249,7 +249,7 @@ static DWORD WINAPI tick_generator(LPVOID lpParameter)
|
|||||||
|
|
||||||
// wait till interrupt handler acknowledges the interrupt (avoids
|
// wait till interrupt handler acknowledges the interrupt (avoids
|
||||||
// overruns).
|
// overruns).
|
||||||
if(SignalObjectAndWait(hIsrMutex, hTickAck, 1000, FALSE) == WAIT_TIMEOUT)
|
if(SignalObjectAndWait(hIsrMutex, hTickAck, 2000, FALSE) == WAIT_TIMEOUT)
|
||||||
{
|
{
|
||||||
printf("Tick generator: timed out at SignalObjectAndWait\n");
|
printf("Tick generator: timed out at SignalObjectAndWait\n");
|
||||||
return 0;
|
return 0;
|
||||||
@ -279,6 +279,7 @@ static void create_system_objects(void)
|
|||||||
DUPLICATE_SAME_ACCESS);
|
DUPLICATE_SAME_ACCESS);
|
||||||
|
|
||||||
SetThreadPriority(hIsrDispatcher, THREAD_PRIORITY_BELOW_NORMAL);
|
SetThreadPriority(hIsrDispatcher, THREAD_PRIORITY_BELOW_NORMAL);
|
||||||
|
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
|
||||||
|
|
||||||
hIsrMutex = CreateMutex(NULL, FALSE, NULL);
|
hIsrMutex = CreateMutex(NULL, FALSE, NULL);
|
||||||
hIsrInvoke = CreateEvent(NULL, FALSE, FALSE, NULL);
|
hIsrInvoke = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||||
@ -352,7 +353,7 @@ portBASE_TYPE xPortStartScheduler( void )
|
|||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
if(WaitForMultipleObjects(2, hObjList, TRUE, 1000) == WAIT_TIMEOUT)
|
if(WaitForMultipleObjects(2, hObjList, TRUE, 2000) == WAIT_TIMEOUT)
|
||||||
{
|
{
|
||||||
printf("vPortStartScheduler: timed out at WaitForMultipleObjects\n");
|
printf("vPortStartScheduler: timed out at WaitForMultipleObjects\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1578,7 +1578,6 @@ void vTaskSwitchContext( void )
|
|||||||
/* Find the highest priority queue that contains ready tasks. */
|
/* Find the highest priority queue that contains ready tasks. */
|
||||||
while( listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxTopReadyPriority ] ) ) )
|
while( listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxTopReadyPriority ] ) ) )
|
||||||
{
|
{
|
||||||
printf("%i is empty\n", (int) uxTopReadyPriority);
|
|
||||||
--uxTopReadyPriority;
|
--uxTopReadyPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1828,7 +1827,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
|
|||||||
// (depending on kernel settings - around 100 microseconds)
|
// (depending on kernel settings - around 100 microseconds)
|
||||||
// decreases idle thread CPU load from 100 to practically 0
|
// decreases idle thread CPU load from 100 to practically 0
|
||||||
#ifdef IDLE_SLEEPS
|
#ifdef IDLE_SLEEPS
|
||||||
Sleep(INFINITE);
|
Sleep(5);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} /*lint !e715 pvParameters is not accessed but all task functions require the same prototype. */
|
} /*lint !e715 pvParameters is not accessed but all task functions require the same prototype. */
|
||||||
|
Loading…
Reference in New Issue
Block a user