mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Replace waitable timer with sleep function in Win32 port layer.
This commit is contained in:
parent
93b07f3db7
commit
c30b4242bb
|
@ -137,40 +137,20 @@ extern void *pxCurrentTCB;
|
||||||
|
|
||||||
static DWORD WINAPI prvSimulatedPeripheralTimer( LPVOID lpParameter )
|
static DWORD WINAPI prvSimulatedPeripheralTimer( LPVOID lpParameter )
|
||||||
{
|
{
|
||||||
void *pvTimer;
|
|
||||||
LARGE_INTEGER liDueTime;
|
|
||||||
void *pvObjectList[ 2 ];
|
|
||||||
const long long ll_ms_In_100ns_units = ( long long ) -1000;
|
|
||||||
|
|
||||||
/* Just to prevent compiler warnings. */
|
/* Just to prevent compiler warnings. */
|
||||||
( void ) lpParameter;
|
( void ) lpParameter;
|
||||||
|
|
||||||
/* The timer is created as a one shot timer even though we want it to repeat
|
|
||||||
at a given frequency. This is because Windows is not a real time environment,
|
|
||||||
and attempting to set a high frequency periodic timer will result in event
|
|
||||||
overruns. Therefore the timer is just reset after each time the pseudo
|
|
||||||
interrupt handler has processed each tick event. */
|
|
||||||
pvTimer = CreateWaitableTimer( NULL, TRUE, NULL );
|
|
||||||
|
|
||||||
liDueTime.QuadPart = ( long long ) portTICK_RATE_MS * ll_ms_In_100ns_units;
|
|
||||||
|
|
||||||
/* Block on the timer itself and the event mutex that grants access to the
|
|
||||||
interrupt variables. */
|
|
||||||
pvObjectList[ 0 ] = pvInterruptEventMutex;
|
|
||||||
pvObjectList[ 1 ] = pvTimer;
|
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
/* The timer is reset on each itteration of this loop rather than being set
|
/* The timer is reset on each itteration of this loop rather than being set
|
||||||
to function periodicallys - this is for the reasons stated in the comments
|
to function periodicallys - this is for the reasons stated in the comments
|
||||||
where the timer is created. */
|
where the timer is created. */
|
||||||
vPortTrace( "prvSimulatedPeripheralTimer: Tick acked, setting new tick timer\r\n" );
|
vPortTrace( "prvSimulatedPeripheralTimer: Tick acked, re-Sleeping()\r\n" );
|
||||||
SetWaitableTimer( pvTimer, &liDueTime, 0, NULL, NULL, TRUE );
|
|
||||||
|
|
||||||
/* Wait until the timer expires and we can access the pseudo interrupt
|
/* Wait until the timer expires and we can access the pseudo interrupt
|
||||||
variables. */
|
variables. */
|
||||||
//WaitForMultipleObjects( ( sizeof( pvObjectList ) / sizeof( void * ) ), pvObjectList, TRUE, INFINITE );
|
Sleep( portTICK_RATE_MS );
|
||||||
WaitForSingleObject( pvTimer, INFINITE );
|
|
||||||
vPortTrace( "prvSimulatedPeripheralTimer: Timer signalled, waiting interrupt event mutex\r\n" );
|
vPortTrace( "prvSimulatedPeripheralTimer: Timer signalled, waiting interrupt event mutex\r\n" );
|
||||||
WaitForSingleObject( pvInterruptEventMutex, INFINITE );
|
WaitForSingleObject( pvInterruptEventMutex, INFINITE );
|
||||||
vPortTrace( "prvSimulatedPeripheralTimer: Got interrupt event mutex\r\n" );
|
vPortTrace( "prvSimulatedPeripheralTimer: Got interrupt event mutex\r\n" );
|
||||||
|
|
Loading…
Reference in a new issue