diff options
| author | Tiejun Zhou <[email protected]> | 2023-03-08 08:26:22 +0000 |
|---|---|---|
| committer | Tiejun Zhou <[email protected]> | 2023-03-08 08:26:22 +0000 |
| commit | 2aa19f3de0b6cf09bb9dca78c8a53fe337b8f0f7 (patch) | |
| tree | 8ec91a64e0831e3100a6ad9a5dec41d9fd7fc74f /ports/win32 | |
| parent | 745395d6a2f931c85c4428425db21eb7d03b4324 (diff) | |
Release 6.2.1 on 08 Mar 2023. Expand to see details.v6.2.1_rel
cee19603d Include tx_user.h conditionally.
e40e08007 Update owners
d69641273 Update release date and version
394aee52f Add tx_user.h to GNU port assembly files
5cca2ddd0 RISC-V 64 bit port for Microchip
e0f2c373c Link Winmm.lib that required by the high-resolution timer.
6af472a68 Update Win32 port with high resolution timer.
aea7b556a Add DMB ISH barrier inst in ARMv8-A SMP scheduler
19091a262 Add .section .preamble to m3 m4 m7 module ports
ced60e1b7 Add missing parenthesis in ports assembly file
309dc77ca Modules Cortex-A7 IAR new port
c752a4063 Modules Cortex-A7 GNU new port
dc224b90f Fix race condition in tx_thread_wait_abort and update regression test
6e261f5b7 create threadx cmsis-pack
Diffstat (limited to 'ports/win32')
| -rw-r--r-- | ports/win32/vs_2019/inc/tx_port.h | 6 | ||||
| -rw-r--r-- | ports/win32/vs_2019/src/tx_initialize_low_level.c | 76 |
2 files changed, 32 insertions, 50 deletions
diff --git a/ports/win32/vs_2019/inc/tx_port.h b/ports/win32/vs_2019/inc/tx_port.h index 672f9b63..d43742f1 100644 --- a/ports/win32/vs_2019/inc/tx_port.h +++ b/ports/win32/vs_2019/inc/tx_port.h @@ -419,7 +419,7 @@ VOID _tx_thread_interrupt_restore(UINT previous_posture); #ifdef TX_THREAD_INIT CHAR _tx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX Win32/Visual Studio Version 6.1.9 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX Win32/Visual Studio Version 6.2.1 *"; #else extern CHAR _tx_version_id[]; #endif @@ -434,7 +434,7 @@ extern ULONG _tx_win32_global_int_disabled_fl extern LARGE_INTEGER _tx_win32_time_stamp; extern ULONG _tx_win32_system_error; extern HANDLE _tx_win32_timer_handle; -extern DWORD _tx_win32_timer_id; +extern UINT _tx_win32_timer_id; extern LARGE_INTEGER _tx_win32_time_stamp; @@ -443,7 +443,7 @@ extern LARGE_INTEGER _tx_win32_time_stamp; #endif #ifndef TX_TIMER_PERIODIC -#define TX_TIMER_PERIODIC 18 +#define TX_TIMER_PERIODIC 10 #endif #endif diff --git a/ports/win32/vs_2019/src/tx_initialize_low_level.c b/ports/win32/vs_2019/src/tx_initialize_low_level.c index 71cacd10..b4df4521 100644 --- a/ports/win32/vs_2019/src/tx_initialize_low_level.c +++ b/ports/win32/vs_2019/src/tx_initialize_low_level.c @@ -30,7 +30,7 @@ #include <stdio.h> #include <stdlib.h> #include <windows.h> - +#pragma comment (lib, "Winmm.lib") /* Define various Win32 objects used by the ThreadX port. */ @@ -47,9 +47,8 @@ extern TX_THREAD *_tx_thread_current_ptr; how other interrupts may be defined as well. See code below for an example. */ -HANDLE _tx_win32_timer_handle; -DWORD _tx_win32_timer_id; -DWORD WINAPI _tx_win32_timer_interrupt(LPVOID p); +UINT _tx_win32_timer_id; +VOID CALLBACK _tx_win32_timer_interrupt(UINT wTimerID, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2); #ifdef TX_WIN32_DEBUG_ENABLE @@ -243,26 +242,6 @@ VOID _tx_initialize_low_level(VOID) /* Initialize the global interrupt disabled flag. */ _tx_win32_global_int_disabled_flag = TX_FALSE; - - /* Setup periodic timer interrupt. */ - _tx_win32_timer_handle = - CreateThread(NULL, 0, _tx_win32_timer_interrupt, (LPVOID) &_tx_win32_timer_handle,CREATE_SUSPENDED, &_tx_win32_timer_id); - - /* Check for a good thread create. */ - if (!_tx_win32_timer_handle) - { - - /* Error creating the timer interrupt. */ - printf("ThreadX Win32 error creating timer interrupt thread!\n"); - while(1) - { - } - } - - /* Otherwise, we have a good thread create. Now set the priority to - a level lower than the system thread but higher than the application - threads. */ - SetThreadPriority(_tx_win32_timer_handle, THREAD_PRIORITY_BELOW_NORMAL); /* Done, return to caller. */ } @@ -272,36 +251,39 @@ VOID _tx_initialize_low_level(VOID) all interrupt threads. Interrupt threads in addition to the timer may be added to this routine as well. */ -void _tx_initialize_start_interrupts(void) +void _tx_initialize_start_interrupts(void) { + TIMECAPS tc; + UINT wTimerRes; - /* Kick the timer thread off to generate the ThreadX periodic interrupt - source. */ - ResumeThread(_tx_win32_timer_handle); -} + /* Queries the timer device to determine its resolution. */ + if (timeGetDevCaps(&tc, sizeof(TIMECAPS)) != TIMERR_NOERROR) + { + /* Error; application can't continue. */ + printf("Query timer device error."); + while (1) + { + } + } + wTimerRes = min(max(tc.wPeriodMin, TX_TIMER_PERIODIC), tc.wPeriodMax); + + /* Start a specified timer event. The timer runs in its own thread. + It calls the specified callback function when the event is activated. */ + _tx_win32_timer_id = timeSetEvent(TX_TIMER_PERIODIC, wTimerRes, _tx_win32_timer_interrupt, 0, TIME_PERIODIC); +} /* Define the ThreadX system timer interrupt. Other interrupts may be simulated in a similar way. */ - -DWORD WINAPI _tx_win32_timer_interrupt(LPVOID p) +VOID CALLBACK _tx_win32_timer_interrupt(UINT wTimerID, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2) { + /* Call ThreadX context save for interrupt preparation. */ + _tx_thread_context_save(); - while(1) - { - - /* Sleep for the desired time. */ - Sleep(TX_TIMER_PERIODIC); - - /* Call ThreadX context save for interrupt preparation. */ - _tx_thread_context_save(); + /* Call the ThreadX system timer interrupt processing. */ + _tx_timer_interrupt(); - - /* Call the ThreadX system timer interrupt processing. */ - _tx_timer_interrupt(); - - /* Call ThreadX context restore for interrupt completion. */ - _tx_thread_context_restore(); - } -} + /* Call ThreadX context restore for interrupt completion. */ + _tx_thread_context_restore(); +}
\ No newline at end of file |
