From fd403521e9ef8c3c0bffed2910334c119dd11c80 Mon Sep 17 00:00:00 2001 From: Yuxin Zhou Date: Tue, 1 Feb 2022 23:21:49 -0800 Subject: [PATCH] Add rxv1, v2, v3 port: removed system state macro, added missing interrupt control defines, and added missing thread preemption logic. --- ports/rxv1/ccrx/inc/tx_port.h | 28 +++++++++--------- ports/rxv1/ccrx/readme_threadx.txt | 7 ++++- .../rxv1/ccrx/src/tx_initialize_low_level.src | 4 ++- .../ccrx/src/tx_thread_context_restore.src | 4 ++- .../rxv1/ccrx/src/tx_thread_context_save.src | 4 ++- .../ccrx/src/tx_thread_interrupt_control.src | 4 ++- ports/rxv1/ccrx/src/tx_thread_schedule.src | 4 ++- ports/rxv1/ccrx/src/tx_thread_stack_build.src | 4 ++- .../rxv1/ccrx/src/tx_thread_system_return.src | 4 ++- ports/rxv1/ccrx/src/tx_timer_interrupt.src | 29 ++++++++++++++++++- ports/rxv1/gnu/inc/tx_port.h | 14 +++++++-- ports/rxv1/gnu/readme_threadx.txt | 6 +++- ports/rxv1/gnu/src/tx_initialize_low_level.S | 4 ++- .../rxv1/gnu/src/tx_thread_context_restore.S | 4 ++- ports/rxv1/gnu/src/tx_thread_context_save.S | 4 ++- .../gnu/src/tx_thread_interrupt_control.S | 4 ++- ports/rxv1/gnu/src/tx_thread_schedule.S | 4 ++- ports/rxv1/gnu/src/tx_thread_stack_build.S | 4 ++- ports/rxv1/gnu/src/tx_thread_system_return.S | 4 ++- ports/rxv1/gnu/src/tx_timer_interrupt.S | 28 +++++++++++++++++- ports/rxv1/iar/inc/tx_port.h | 23 ++++++++------- ports/rxv1/iar/readme_threadx.txt | 7 ++++- ports/rxv1/iar/src/tx_initialize_low_level.s | 4 ++- .../rxv1/iar/src/tx_thread_context_restore.s | 4 ++- ports/rxv1/iar/src/tx_thread_context_save.s | 4 ++- .../iar/src/tx_thread_interrupt_control.s | 4 ++- ports/rxv1/iar/src/tx_thread_schedule.s | 4 ++- ports/rxv1/iar/src/tx_thread_stack_build.s | 5 ++-- ports/rxv1/iar/src/tx_thread_system_return.s | 4 ++- ports/rxv1/iar/src/tx_timer_interrupt.s | 28 +++++++++++++++++- ports/rxv2/ccrx/inc/tx_port.h | 28 +++++++++--------- ports/rxv2/ccrx/readme_threadx.txt | 7 ++++- .../rxv2/ccrx/src/tx_initialize_low_level.src | 5 ++-- .../ccrx/src/tx_thread_context_restore.src | 4 ++- .../rxv2/ccrx/src/tx_thread_context_save.src | 4 ++- .../ccrx/src/tx_thread_interrupt_control.src | 4 ++- ports/rxv2/ccrx/src/tx_thread_schedule.src | 4 ++- ports/rxv2/ccrx/src/tx_thread_stack_build.src | 4 ++- .../rxv2/ccrx/src/tx_thread_system_return.src | 4 ++- ports/rxv2/ccrx/src/tx_timer_interrupt.src | 29 ++++++++++++++++++- ports/rxv2/gnu/inc/tx_port.h | 14 +++++++-- ports/rxv2/gnu/readme_threadx.txt | 6 +++- ports/rxv2/gnu/src/tx_initialize_low_level.S | 4 ++- .../rxv2/gnu/src/tx_thread_context_restore.S | 4 ++- ports/rxv2/gnu/src/tx_thread_context_save.S | 4 ++- .../gnu/src/tx_thread_interrupt_control.S | 4 ++- ports/rxv2/gnu/src/tx_thread_schedule.S | 4 ++- ports/rxv2/gnu/src/tx_thread_stack_build.S | 4 ++- ports/rxv2/gnu/src/tx_thread_system_return.S | 4 ++- ports/rxv2/gnu/src/tx_timer_interrupt.S | 28 +++++++++++++++++- ports/rxv2/iar/inc/tx_port.h | 24 ++++++++------- ports/rxv2/iar/readme_threadx.txt | 7 ++++- ports/rxv2/iar/src/tx_initialize_low_level.s | 4 ++- .../rxv2/iar/src/tx_thread_context_restore.s | 4 ++- ports/rxv2/iar/src/tx_thread_context_save.s | 4 ++- .../iar/src/tx_thread_interrupt_control.s | 4 ++- ports/rxv2/iar/src/tx_thread_schedule.s | 4 ++- ports/rxv2/iar/src/tx_thread_stack_build.s | 4 ++- ports/rxv2/iar/src/tx_thread_system_return.s | 4 ++- ports/rxv2/iar/src/tx_timer_interrupt.s | 28 +++++++++++++++++- ports/rxv3/ccrx/inc/tx_port.h | 28 +++++++++--------- ports/rxv3/ccrx/readme_threadx.txt | 7 ++++- .../rxv3/ccrx/src/tx_initialize_low_level.src | 4 ++- .../ccrx/src/tx_thread_context_restore.src | 4 ++- .../rxv3/ccrx/src/tx_thread_context_save.src | 4 ++- .../ccrx/src/tx_thread_interrupt_control.src | 4 ++- ports/rxv3/ccrx/src/tx_thread_schedule.src | 4 ++- ports/rxv3/ccrx/src/tx_thread_stack_build.src | 4 ++- .../rxv3/ccrx/src/tx_thread_system_return.src | 4 ++- ports/rxv3/ccrx/src/tx_timer_interrupt.src | 29 ++++++++++++++++++- ports/rxv3/gnu/inc/tx_port.h | 14 +++++++-- ports/rxv3/gnu/readme_threadx.txt | 6 +++- ports/rxv3/gnu/src/tx_initialize_low_level.S | 4 ++- .../rxv3/gnu/src/tx_thread_context_restore.S | 4 ++- ports/rxv3/gnu/src/tx_thread_context_save.S | 4 ++- .../gnu/src/tx_thread_interrupt_control.S | 4 ++- ports/rxv3/gnu/src/tx_thread_schedule.S | 4 ++- ports/rxv3/gnu/src/tx_thread_stack_build.S | 4 ++- ports/rxv3/gnu/src/tx_thread_system_return.S | 4 ++- ports/rxv3/gnu/src/tx_timer_interrupt.S | 27 ++++++++++++++++- ports/rxv3/iar/inc/tx_port.h | 23 ++++++++------- ports/rxv3/iar/readme_threadx.txt | 7 ++++- ports/rxv3/iar/src/tx_initialize_low_level.s | 4 ++- .../rxv3/iar/src/tx_thread_context_restore.s | 4 ++- ports/rxv3/iar/src/tx_thread_context_save.s | 4 ++- .../iar/src/tx_thread_interrupt_control.s | 4 ++- ports/rxv3/iar/src/tx_thread_schedule.s | 4 ++- ports/rxv3/iar/src/tx_thread_stack_build.s | 4 ++- ports/rxv3/iar/src/tx_thread_system_return.s | 4 ++- ports/rxv3/iar/src/tx_timer_interrupt.s | 29 ++++++++++++++++++- 90 files changed, 600 insertions(+), 165 deletions(-) diff --git a/ports/rxv1/ccrx/inc/tx_port.h b/ports/rxv1/ccrx/inc/tx_port.h index fdb4e294..499e98f7 100644 --- a/ports/rxv1/ccrx/inc/tx_port.h +++ b/ports/rxv1/ccrx/inc/tx_port.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* tx_port.h RXv1/CCRX */ -/* 6.1.9 */ +/* 6.1.10 */ /* */ /* AUTHOR */ /* */ @@ -50,6 +50,11 @@ /* 08-02-2021 William E. Lamie Initial Version 6.1.8 */ /* 10-15-2021 William E. Lamie Modified comment(s), */ /* resulting in version 6.1.9 */ +/* 01-31-2022 William E. Lamie Modified comment(s), removed */ +/* system state macro, and */ +/* added missing interrupt */ +/* control defines, */ +/* resulting in version 6.1.10 */ /* */ /**************************************************************************/ @@ -80,6 +85,12 @@ typedef short SHORT; typedef unsigned short USHORT; +/* Define interrupt control options. */ + +#define TX_INT_DISABLE 0x00000000 +#define TX_INT_ENABLE 0x00010000 + + /* Define the priority levels for ThreadX. Legal values range from 32 to 1024 and MUST be evenly divisible by 32. */ @@ -246,19 +257,6 @@ static void _tx_thread_system_return_inline(void) } -#ifndef TX_THREAD_GET_SYSTEM_STATE - -#pragma inline_asm _get_psw -static UINT _get_psw(void){ - MVFC PSW,R1 ; -} - -extern volatile ULONG _tx_thread_system_state; -#define TX_THREAD_GET_SYSTEM_STATE() (_tx_thread_system_state | ((~_get_psw()) & (1u << 17u))) -#endif - - - /* Define the interrupt lockout macros for each ThreadX object. */ #define TX_BLOCK_POOL_DISABLE TX_DISABLE @@ -273,7 +271,7 @@ extern volatile ULONG _tx_thread_system_state; #ifdef TX_THREAD_INIT CHAR _tx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv1/CCRX Version 6.1.9 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv1/CCRX Version 6.1.10 *"; #else extern CHAR _tx_version_id[]; #endif diff --git a/ports/rxv1/ccrx/readme_threadx.txt b/ports/rxv1/ccrx/readme_threadx.txt index 74f64eea..4078fa51 100644 --- a/ports/rxv1/ccrx/readme_threadx.txt +++ b/ports/rxv1/ccrx/readme_threadx.txt @@ -150,6 +150,11 @@ For generic code revision information, please refer to the readme_threadx_generi file, which is included in your distribution. The following details the revision information associated with this specific port of ThreadX: +01-31-2022 Release 6.1.10 changes: + tx_port.h Removed system state macro, and added + missing interrupt control defines + tx_timer_interrupt.src Added missing thread preemption logic + 10-15-2021 Release 6.1.9 changes: tx_thread_context_restore.src Removed unnecessary stack type placement tx_thread_schedule.src Removed unnecessary stack type checking @@ -158,7 +163,7 @@ information associated with this specific port of ThreadX: 08-02-2021 Initial ThreadX release for the RXv1 using CC-RXX tools, version 6.1.8 -Copyright(c) 1996-2021 Microsoft Corporation +Copyright(c) 1996-2022 Microsoft Corporation https://azure.com/rtos diff --git a/ports/rxv1/ccrx/src/tx_initialize_low_level.src b/ports/rxv1/ccrx/src/tx_initialize_low_level.src index b5427093..e77e92e2 100644 --- a/ports/rxv1/ccrx/src/tx_initialize_low_level.src +++ b/ports/rxv1/ccrx/src/tx_initialize_low_level.src @@ -34,7 +34,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_initialize_low_level RXv1/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -70,6 +70,8 @@ ;/* 08-02-2021 William E. Lamie Initial Version 6.1.8 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ diff --git a/ports/rxv1/ccrx/src/tx_thread_context_restore.src b/ports/rxv1/ccrx/src/tx_thread_context_restore.src index a38759a1..e37b63b3 100644 --- a/ports/rxv1/ccrx/src/tx_thread_context_restore.src +++ b/ports/rxv1/ccrx/src/tx_thread_context_restore.src @@ -45,7 +45,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_restore RXv1/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -82,6 +82,8 @@ ;/* removed unnecessary stack */ ;/* type placement, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_context_restore(VOID) diff --git a/ports/rxv1/ccrx/src/tx_thread_context_save.src b/ports/rxv1/ccrx/src/tx_thread_context_save.src index 9bb04a0e..0683dfa9 100644 --- a/ports/rxv1/ccrx/src/tx_thread_context_save.src +++ b/ports/rxv1/ccrx/src/tx_thread_context_save.src @@ -40,7 +40,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_save RXv1/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -74,6 +74,8 @@ ;/* 08-02-2021 William E. Lamie Initial Version 6.1.8 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_context_save(VOID) diff --git a/ports/rxv1/ccrx/src/tx_thread_interrupt_control.src b/ports/rxv1/ccrx/src/tx_thread_interrupt_control.src index 776ccec4..11655e7f 100644 --- a/ports/rxv1/ccrx/src/tx_thread_interrupt_control.src +++ b/ports/rxv1/ccrx/src/tx_thread_interrupt_control.src @@ -35,7 +35,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_interrupt_control RXv1/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -68,6 +68,8 @@ ;/* 08-02-2021 William E. Lamie Initial Version 6.1.8 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;UINT _tx_thread_interrupt_control(UINT new_posture) diff --git a/ports/rxv1/ccrx/src/tx_thread_schedule.src b/ports/rxv1/ccrx/src/tx_thread_schedule.src index d697afdd..b7fca0cf 100644 --- a/ports/rxv1/ccrx/src/tx_thread_schedule.src +++ b/ports/rxv1/ccrx/src/tx_thread_schedule.src @@ -42,7 +42,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_schedule RXv1/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -80,6 +80,8 @@ ;/* removed unnecessary stack */ ;/* type checking, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_schedule(VOID) diff --git a/ports/rxv1/ccrx/src/tx_thread_stack_build.src b/ports/rxv1/ccrx/src/tx_thread_stack_build.src index 09eb4878..9343091e 100644 --- a/ports/rxv1/ccrx/src/tx_thread_stack_build.src +++ b/ports/rxv1/ccrx/src/tx_thread_stack_build.src @@ -36,7 +36,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_stack_build RXv1/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -73,6 +73,8 @@ ;/* removed unnecessary stack */ ;/* type placement, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_stack_build(TX_THREAD *thread_ptr, VOID (*function_ptr)(VOID)) diff --git a/ports/rxv1/ccrx/src/tx_thread_system_return.src b/ports/rxv1/ccrx/src/tx_thread_system_return.src index 481c4908..7e8134fb 100644 --- a/ports/rxv1/ccrx/src/tx_thread_system_return.src +++ b/ports/rxv1/ccrx/src/tx_thread_system_return.src @@ -40,7 +40,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_system_return RXv1/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -76,6 +76,8 @@ ;/* 10-15-2021 William E. Lamie Modified comment(s), and */ ;/* removed unused code, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_system_return(VOID) diff --git a/ports/rxv1/ccrx/src/tx_timer_interrupt.src b/ports/rxv1/ccrx/src/tx_timer_interrupt.src index a9c4918c..c91849d3 100644 --- a/ports/rxv1/ccrx/src/tx_timer_interrupt.src +++ b/ports/rxv1/ccrx/src/tx_timer_interrupt.src @@ -32,6 +32,9 @@ ; ;Define Assembly language external references... ; + + SWI0 .EQU 872E0H + .GLB __tx_timer_time_slice .GLB __tx_timer_system_clock .GLB __tx_timer_current_ptr @@ -43,6 +46,9 @@ .GLB __tx_thread_context_save .GLB __tx_thread_time_slice .GLB __tx_thread_context_restore + .GLB __tx_thread_preempt_disable + .GLB __tx_thread_execute_ptr + .GLB __tx_thread_current_ptr ; .SECTION P,CODE ;/**************************************************************************/ @@ -50,7 +56,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_timer_interrupt RXv1/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -89,6 +95,10 @@ ;/* 08-02-2021 William E. Lamie Initial Version 6.1.8 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), and */ +;/* added missing thread */ +;/* preemption logic, */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_timer_interrupt(VOID) @@ -236,6 +246,23 @@ __tx_timer_dont_activate: ; _tx_thread_time_slice(); BSR __tx_thread_time_slice ; Call time-slice processing + +; /* Check if we must trigger a context switch. */ + MOV.L #__tx_thread_preempt_disable, R1 ; Load prempt disable flag. + MOV.L [R1], R1 + CMP #0, R1 + BNE __tx_timer_not_ts_expiration ; Skip if prempt disabled. + + MOV.L #__tx_thread_execute_ptr, R1 + MOV.L [R1], R1 + MOV.L #__tx_thread_current_ptr, R2 + MOV.L [R2], R2 + CMP R1, R2 + BEQ __tx_timer_not_ts_expiration + + MOV.L #SWI0, R1 + MOV.L #1, [R1] + ; } ; __tx_timer_not_ts_expiration: diff --git a/ports/rxv1/gnu/inc/tx_port.h b/ports/rxv1/gnu/inc/tx_port.h index 2841e4ba..ba7645bc 100644 --- a/ports/rxv1/gnu/inc/tx_port.h +++ b/ports/rxv1/gnu/inc/tx_port.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* tx_port.h RXv1/GNURX */ -/* 6.1.9 */ +/* 6.1.10 */ /* */ /* AUTHOR */ /* */ @@ -50,6 +50,10 @@ /* 08-02-2021 William E. Lamie Initial Version 6.1.8 */ /* 10-15-2021 William E. Lamie Modified comment(s), */ /* resulting in version 6.1.9 */ +/* 01-31-2022 William E. Lamie Modified comment(s), and */ +/* added missing interrupt */ +/* control defines, */ +/* resulting in version 6.1.10 */ /* */ /**************************************************************************/ @@ -83,6 +87,12 @@ typedef short SHORT; typedef unsigned short USHORT; +/* Define interrupt control options. */ + +#define TX_INT_DISABLE 0x00000000 +#define TX_INT_ENABLE 0x00010000 + + /* Define the priority levels for ThreadX. Legal values range from 32 to 1024 and MUST be evenly divisible by 32. */ @@ -257,7 +267,7 @@ static void _tx_thread_system_return_inline(void) #ifdef TX_THREAD_INIT CHAR _tx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv1/GNURX Version 6.1.9 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv1/GNURX Version 6.1.10 *"; #else extern CHAR _tx_version_id[]; #endif diff --git a/ports/rxv1/gnu/readme_threadx.txt b/ports/rxv1/gnu/readme_threadx.txt index 385a1bdd..46b63ba7 100644 --- a/ports/rxv1/gnu/readme_threadx.txt +++ b/ports/rxv1/gnu/readme_threadx.txt @@ -146,6 +146,10 @@ For generic code revision information, please refer to the readme_threadx_generi file, which is included in your distribution. The following details the revision information associated with this specific port of ThreadX: +01-31-2022 Release 6.1.10 changes: + tx_port.h Added missing interrupt control defines + tx_timer_interrupt.src Added missing thread preemption logic + 10-15-2021 Release 6.1.9 changes: tx_thread_context_restore.s Removed unnecessary stack type placement tx_thread_schedule.s Removed unnecessary stack type checking @@ -154,7 +158,7 @@ information associated with this specific port of ThreadX: 08-02-2021 Initial ThreadX release for the RXv1 using GNURX tools, version 6.1.8 -Copyright(c) 1996-2021 Microsoft Corporation +Copyright(c) 1996-2022 Microsoft Corporation https://azure.com/rtos diff --git a/ports/rxv1/gnu/src/tx_initialize_low_level.S b/ports/rxv1/gnu/src/tx_initialize_low_level.S index d70ff24d..738fb358 100644 --- a/ports/rxv1/gnu/src/tx_initialize_low_level.S +++ b/ports/rxv1/gnu/src/tx_initialize_low_level.S @@ -29,7 +29,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_initialize_low_level RXv1/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -65,6 +65,8 @@ ;/* 08-02-2021 William E. Lamie Initial Version 6.1.8 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ .global __tx_initialize_low_level diff --git a/ports/rxv1/gnu/src/tx_thread_context_restore.S b/ports/rxv1/gnu/src/tx_thread_context_restore.S index f7a890db..abb8e0f9 100644 --- a/ports/rxv1/gnu/src/tx_thread_context_restore.S +++ b/ports/rxv1/gnu/src/tx_thread_context_restore.S @@ -46,7 +46,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_restore RXv1/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -83,6 +83,8 @@ ;/* removed unnecessary stack */ ;/* type placement, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_context_restore(VOID) diff --git a/ports/rxv1/gnu/src/tx_thread_context_save.S b/ports/rxv1/gnu/src/tx_thread_context_save.S index 192950bf..b15a9fb0 100644 --- a/ports/rxv1/gnu/src/tx_thread_context_save.S +++ b/ports/rxv1/gnu/src/tx_thread_context_save.S @@ -30,7 +30,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_save RXv1/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -64,6 +64,8 @@ ;/* 08-02-2021 William E. Lamie Initial Version 6.1.8 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_context_save(VOID) diff --git a/ports/rxv1/gnu/src/tx_thread_interrupt_control.S b/ports/rxv1/gnu/src/tx_thread_interrupt_control.S index 23e3b984..db3f59b4 100644 --- a/ports/rxv1/gnu/src/tx_thread_interrupt_control.S +++ b/ports/rxv1/gnu/src/tx_thread_interrupt_control.S @@ -26,7 +26,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_interrupt_control RXv1/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -59,6 +59,8 @@ ;/* 08-02-2021 William E. Lamie Initial Version 6.1.8 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;UINT _tx_thread_interrupt_control(UINT new_posture) diff --git a/ports/rxv1/gnu/src/tx_thread_schedule.S b/ports/rxv1/gnu/src/tx_thread_schedule.S index eae5d02c..4d3548be 100644 --- a/ports/rxv1/gnu/src/tx_thread_schedule.S +++ b/ports/rxv1/gnu/src/tx_thread_schedule.S @@ -31,7 +31,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_schedule RXv1/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -69,6 +69,8 @@ ;/* removed unnecessary stack */ ;/* type checking, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_schedule(VOID) diff --git a/ports/rxv1/gnu/src/tx_thread_stack_build.S b/ports/rxv1/gnu/src/tx_thread_stack_build.S index a8098a23..e4313997 100644 --- a/ports/rxv1/gnu/src/tx_thread_stack_build.S +++ b/ports/rxv1/gnu/src/tx_thread_stack_build.S @@ -26,7 +26,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_stack_build RXv1/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -63,6 +63,8 @@ ;/* removed unnecessary stack */ ;/* type placement, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_stack_build(TX_THREAD *thread_ptr, VOID (*function_ptr)(VOID)) diff --git a/ports/rxv1/gnu/src/tx_thread_system_return.S b/ports/rxv1/gnu/src/tx_thread_system_return.S index d76ea409..3dd9dbd0 100644 --- a/ports/rxv1/gnu/src/tx_thread_system_return.S +++ b/ports/rxv1/gnu/src/tx_thread_system_return.S @@ -30,7 +30,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_system_return RXv1/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -66,6 +66,8 @@ ;/* 10-15-2021 William E. Lamie Modified comment(s), and */ ;/* removed unused code, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_system_return(VOID) diff --git a/ports/rxv1/gnu/src/tx_timer_interrupt.S b/ports/rxv1/gnu/src/tx_timer_interrupt.S index da63b4a1..3f1045b1 100644 --- a/ports/rxv1/gnu/src/tx_timer_interrupt.S +++ b/ports/rxv1/gnu/src/tx_timer_interrupt.S @@ -20,6 +20,7 @@ ;/**************************************************************************/ ;/**************************************************************************/ + .equ SWI0, 872E0H .global __tx_timer_time_slice .global __tx_timer_system_clock .global __tx_timer_current_ptr @@ -31,6 +32,9 @@ .global __tx_thread_context_save .global __tx_thread_time_slice .global __tx_thread_context_restore + .global __tx_thread_preempt_disable + .global __tx_thread_execute_ptr + .global __tx_thread_current_ptr .SECTION P,CODE ;/**************************************************************************/ @@ -38,7 +42,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_timer_interrupt RXv1/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -77,6 +81,10 @@ ;/* 08-02-2021 William E. Lamie Initial Version 6.1.8 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), and */ +;/* added missing thread */ +;/* preemption logic, */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_timer_interrupt(VOID) @@ -224,6 +232,24 @@ __tx_timer_dont_activate: ; _tx_thread_time_slice(); BSR __tx_thread_time_slice ; Call time-slice processing + +; /* Check if we must trigger a context switch. */ + MOV.L #__tx_thread_preempt_disable, R1 ; Load prempt disable flag. + MOV.L [R1], R1 + CMP #0, R1 + BNE __tx_timer_not_ts_expiration ; Skip if prempt disabled. + + MOV.L #__tx_thread_execute_ptr, R1 + MOV.L [R1], R1 + MOV.L #__tx_thread_current_ptr, R2 + MOV.L [R2], R2 + CMP R1, R2 + BEQ __tx_timer_not_ts_expiration + + MOV.L #SWI0, R1 + MOV.L #1, [R1] + + ; } ; __tx_timer_not_ts_expiration: diff --git a/ports/rxv1/iar/inc/tx_port.h b/ports/rxv1/iar/inc/tx_port.h index 085109b8..cefde522 100644 --- a/ports/rxv1/iar/inc/tx_port.h +++ b/ports/rxv1/iar/inc/tx_port.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* tx_port.h RXv1/IAR */ -/* 6.1.9 */ +/* 6.1.10 */ /* */ /* AUTHOR */ /* */ @@ -50,6 +50,11 @@ /* 08-02-2021 William E. Lamie Initial Version 6.1.8 */ /* 10-15-2021 William E. Lamie Modified comment(s), */ /* resulting in version 6.1.9 */ +/* 01-31-2022 William E. Lamie Modified comment(s), removed */ +/* system state macro, and */ +/* added missing interrupt */ +/* control defines, */ +/* resulting in version 6.1.10 */ /* */ /**************************************************************************/ @@ -83,6 +88,12 @@ typedef short SHORT; typedef unsigned short USHORT; +/* Define interrupt control options. */ + +#define TX_INT_DISABLE 0x00000000 +#define TX_INT_ENABLE 0x00010000 + + /* Define the priority levels for ThreadX. Legal values range from 32 to 1024 and MUST be evenly divisible by 32. */ @@ -243,14 +254,6 @@ static void _tx_thread_system_return_inline(void) #endif -#ifndef TX_THREAD_GET_SYSTEM_STATE - -extern volatile ULONG _tx_thread_system_state; -#define TX_THREAD_GET_SYSTEM_STATE() (_tx_thread_system_state | ((~__get_PSW_register()) & (1u << 17u))) -#endif - - - /* Define the interrupt lockout macros for each ThreadX object. */ #define TX_BLOCK_POOL_DISABLE TX_DISABLE @@ -265,7 +268,7 @@ extern volatile ULONG _tx_thread_system_state; #ifdef TX_THREAD_INIT CHAR _tx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv1/IAR Version 6.1.9 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv1/IAR Version 6.1.10 *"; #else extern CHAR _tx_version_id[]; #endif diff --git a/ports/rxv1/iar/readme_threadx.txt b/ports/rxv1/iar/readme_threadx.txt index 09345eb5..eec308df 100644 --- a/ports/rxv1/iar/readme_threadx.txt +++ b/ports/rxv1/iar/readme_threadx.txt @@ -143,6 +143,11 @@ For generic code revision information, please refer to the readme_threadx_generi file, which is included in your distribution. The following details the revision information associated with this specific port of ThreadX: +01-31-2022 Release 6.1.10 changes: + tx_port.h Removed system state macro, and added + missing interrupt control defines + tx_timer_interrupt.src Added missing thread preemption logic + 10-15-2021 Release 6.1.9 changes: tx_thread_context_restore.s Removed unnecessary stack type placement tx_thread_schedule.s Removed unnecessary stack type checking @@ -151,7 +156,7 @@ information associated with this specific port of ThreadX: 08-02-2021 Initial ThreadX release for the RXv1using IAR tools, version 6.1.8 -Copyright(c) 1996-2021 Microsoft Corporation +Copyright(c) 1996-2022 Microsoft Corporation https://azure.com/rtos \ No newline at end of file diff --git a/ports/rxv1/iar/src/tx_initialize_low_level.s b/ports/rxv1/iar/src/tx_initialize_low_level.s index a3d1f196..fb009cb1 100644 --- a/ports/rxv1/iar/src/tx_initialize_low_level.s +++ b/ports/rxv1/iar/src/tx_initialize_low_level.s @@ -31,7 +31,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_initialize_low_level RXv1/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -67,6 +67,8 @@ ;/* 08-02-2021 William E. Lamie Initial Version 6.1.8 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ public __tx_initialize_low_level diff --git a/ports/rxv1/iar/src/tx_thread_context_restore.s b/ports/rxv1/iar/src/tx_thread_context_restore.s index 276a22b6..40d8f399 100644 --- a/ports/rxv1/iar/src/tx_thread_context_restore.s +++ b/ports/rxv1/iar/src/tx_thread_context_restore.s @@ -34,7 +34,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_restore RXv1/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -71,6 +71,8 @@ ;/* removed unnecessary stack */ ;/* type placement, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ public __tx_thread_context_restore diff --git a/ports/rxv1/iar/src/tx_thread_context_save.s b/ports/rxv1/iar/src/tx_thread_context_save.s index fa134246..6a43112e 100644 --- a/ports/rxv1/iar/src/tx_thread_context_save.s +++ b/ports/rxv1/iar/src/tx_thread_context_save.s @@ -29,7 +29,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_save RXv1/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -63,6 +63,8 @@ ;/* 08-02-2021 William E. Lamie Initial Version 6.1.8 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_context_save(VOID) diff --git a/ports/rxv1/iar/src/tx_thread_interrupt_control.s b/ports/rxv1/iar/src/tx_thread_interrupt_control.s index 88d666ce..5c5d532b 100644 --- a/ports/rxv1/iar/src/tx_thread_interrupt_control.s +++ b/ports/rxv1/iar/src/tx_thread_interrupt_control.s @@ -26,7 +26,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_interrupt_control RXv1/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -59,6 +59,8 @@ ;/* 08-02-2021 William E. Lamie Initial Version 6.1.8 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;UINT _tx_thread_interrupt_control(UINT new_posture) diff --git a/ports/rxv1/iar/src/tx_thread_schedule.s b/ports/rxv1/iar/src/tx_thread_schedule.s index 9bc71244..1d55ddaf 100644 --- a/ports/rxv1/iar/src/tx_thread_schedule.s +++ b/ports/rxv1/iar/src/tx_thread_schedule.s @@ -31,7 +31,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_schedule RXv1/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -69,6 +69,8 @@ ;/* removed unnecessary stack */ ;/* type checking, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_schedule(VOID) diff --git a/ports/rxv1/iar/src/tx_thread_stack_build.s b/ports/rxv1/iar/src/tx_thread_stack_build.s index b76c5839..ddf5a03e 100644 --- a/ports/rxv1/iar/src/tx_thread_stack_build.s +++ b/ports/rxv1/iar/src/tx_thread_stack_build.s @@ -28,7 +28,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_stack_build RXv1/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -65,7 +65,8 @@ ;/* removed unnecessary stack */ ;/* type placement, */ ;/* resulting in version 6.1.9 */ - +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ diff --git a/ports/rxv1/iar/src/tx_thread_system_return.s b/ports/rxv1/iar/src/tx_thread_system_return.s index b7ebe37f..b14a4249 100644 --- a/ports/rxv1/iar/src/tx_thread_system_return.s +++ b/ports/rxv1/iar/src/tx_thread_system_return.s @@ -27,7 +27,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_system_return RXv1/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -62,6 +62,8 @@ ;/* 08-02-2021 William E. Lamie Initial Version 6.1.8 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ diff --git a/ports/rxv1/iar/src/tx_timer_interrupt.s b/ports/rxv1/iar/src/tx_timer_interrupt.s index 47305341..d3952d07 100644 --- a/ports/rxv1/iar/src/tx_timer_interrupt.s +++ b/ports/rxv1/iar/src/tx_timer_interrupt.s @@ -20,6 +20,8 @@ ;/**************************************************************************/ ;/**************************************************************************/ +SWI0 EQU 0x872E0 + extern __tx_timer_expiration_process extern __tx_timer_system_clock extern __tx_timer_expired_time_slice @@ -29,6 +31,9 @@ extern __tx_timer_time_slice extern __tx_timer_list_end extern __tx_thread_time_slice + extern __tx_thread_preempt_disable + extern __tx_thread_execute_ptr + extern __tx_thread_current_ptr section .text:CODE:ROOT @@ -37,7 +42,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_timer_interrupt RXv1/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -76,6 +81,10 @@ ;/* 08-02-2021 William E. Lamie Initial Version 6.1.8 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), and */ +;/* added missing thread */ +;/* preemption logic, */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ @@ -222,6 +231,23 @@ __tx_timer_dont_activate: ; _tx_thread_time_slice(); BSR __tx_thread_time_slice ; Call time-slice processing + +; /* Check if we must trigger a context switch. */ + MOV.L #__tx_thread_preempt_disable, R1 ; Load prempt disable flag. + MOV.L [R1], R1 + CMP #0, R1 + BNE __tx_timer_not_ts_expiration ; Skip if prempt disabled. + + MOV.L #__tx_thread_execute_ptr, R1 + MOV.L [R1], R1 + MOV.L #__tx_thread_current_ptr, R2 + MOV.L [R2], R2 + CMP R1, R2 + BEQ __tx_timer_not_ts_expiration + + MOV.L #SWI0, R1 + MOV.L #1, [R1] + ; } ; __tx_timer_not_ts_expiration: diff --git a/ports/rxv2/ccrx/inc/tx_port.h b/ports/rxv2/ccrx/inc/tx_port.h index e850e5a8..c397f689 100644 --- a/ports/rxv2/ccrx/inc/tx_port.h +++ b/ports/rxv2/ccrx/inc/tx_port.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* tx_port.h RXv2/CCRX */ -/* 6.1.9 */ +/* 6.1.10 */ /* */ /* AUTHOR */ /* */ @@ -52,6 +52,11 @@ /* resulting in version 6.1.7 */ /* 10-15-2021 William E. Lamie Modified comment(s), */ /* resulting in version 6.1.9 */ +/* 01-31-2022 William E. Lamie Modified comment(s), removed */ +/* system state macro, and */ +/* added missing interrupt */ +/* control defines, */ +/* resulting in version 6.1.10 */ /* */ /**************************************************************************/ @@ -82,6 +87,12 @@ typedef short SHORT; typedef unsigned short USHORT; +/* Define interrupt control options. */ + +#define TX_INT_DISABLE 0x00000000 +#define TX_INT_ENABLE 0x00010000 + + /* Define the priority levels for ThreadX. Legal values range from 32 to 1024 and MUST be evenly divisible by 32. */ @@ -248,19 +259,6 @@ static void _tx_thread_system_return_inline(void) } -#ifndef TX_THREAD_GET_SYSTEM_STATE - -#pragma inline_asm _get_psw -static UINT _get_psw(void){ - MVFC PSW,R1 ; -} - -extern volatile ULONG _tx_thread_system_state; -#define TX_THREAD_GET_SYSTEM_STATE() (_tx_thread_system_state | ((~_get_psw()) & (1u << 17u))) -#endif - - - /* Define the interrupt lockout macros for each ThreadX object. */ #define TX_BLOCK_POOL_DISABLE TX_DISABLE @@ -275,7 +273,7 @@ extern volatile ULONG _tx_thread_system_state; #ifdef TX_THREAD_INIT CHAR _tx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv2/CCRX Version 6.1.9 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv2/CCRX Version 6.1.10 *"; #else extern CHAR _tx_version_id[]; #endif diff --git a/ports/rxv2/ccrx/readme_threadx.txt b/ports/rxv2/ccrx/readme_threadx.txt index 39fb9282..ee264624 100644 --- a/ports/rxv2/ccrx/readme_threadx.txt +++ b/ports/rxv2/ccrx/readme_threadx.txt @@ -153,6 +153,11 @@ For generic code revision information, please refer to the readme_threadx_generi file, which is included in your distribution. The following details the revision information associated with this specific port of ThreadX: +01-31-2022 Release 6.1.10 changes: + tx_port.h Removed system state macro, and added + missing interrupt control defines + tx_timer_interrupt.src Added missing thread preemption logic + 10-15-2021 Release 6.1.9 changes: tx_thread_context_restore.src Removed unnecessary stack type placement tx_thread_schedule.src Removed unnecessary stack type checking @@ -167,7 +172,7 @@ information associated with this specific port of ThreadX: 12-31-2020 Initial ThreadX release for the RXv2 using CC-RXX tools, version 6.1.3 -Copyright(c) 1996-2020 Microsoft Corporation +Copyright(c) 1996-2022 Microsoft Corporation https://azure.com/rtos diff --git a/ports/rxv2/ccrx/src/tx_initialize_low_level.src b/ports/rxv2/ccrx/src/tx_initialize_low_level.src index 3dfc10a9..29cf9b42 100644 --- a/ports/rxv2/ccrx/src/tx_initialize_low_level.src +++ b/ports/rxv2/ccrx/src/tx_initialize_low_level.src @@ -34,7 +34,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_initialize_low_level RXv2/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -70,7 +70,8 @@ ;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ - +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ diff --git a/ports/rxv2/ccrx/src/tx_thread_context_restore.src b/ports/rxv2/ccrx/src/tx_thread_context_restore.src index f4a64c09..dbad3f22 100644 --- a/ports/rxv2/ccrx/src/tx_thread_context_restore.src +++ b/ports/rxv2/ccrx/src/tx_thread_context_restore.src @@ -45,7 +45,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_restore RXv2/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -82,6 +82,8 @@ ;/* removed unnecessary stack */ ;/* type placement, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_context_restore(VOID) diff --git a/ports/rxv2/ccrx/src/tx_thread_context_save.src b/ports/rxv2/ccrx/src/tx_thread_context_save.src index 0451a890..8712c80b 100644 --- a/ports/rxv2/ccrx/src/tx_thread_context_save.src +++ b/ports/rxv2/ccrx/src/tx_thread_context_save.src @@ -40,7 +40,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_save RXv2/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -74,6 +74,8 @@ ;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_context_save(VOID) diff --git a/ports/rxv2/ccrx/src/tx_thread_interrupt_control.src b/ports/rxv2/ccrx/src/tx_thread_interrupt_control.src index b3a66f26..42e76109 100644 --- a/ports/rxv2/ccrx/src/tx_thread_interrupt_control.src +++ b/ports/rxv2/ccrx/src/tx_thread_interrupt_control.src @@ -35,7 +35,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_interrupt_control RXc2/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -68,6 +68,8 @@ ;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;UINT _tx_thread_interrupt_control(UINT new_posture) diff --git a/ports/rxv2/ccrx/src/tx_thread_schedule.src b/ports/rxv2/ccrx/src/tx_thread_schedule.src index bbb1449d..fb733165 100644 --- a/ports/rxv2/ccrx/src/tx_thread_schedule.src +++ b/ports/rxv2/ccrx/src/tx_thread_schedule.src @@ -42,7 +42,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_schedule RXv2/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -80,6 +80,8 @@ ;/* removed unnecessary stack */ ;/* type checking, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_schedule(VOID) diff --git a/ports/rxv2/ccrx/src/tx_thread_stack_build.src b/ports/rxv2/ccrx/src/tx_thread_stack_build.src index bf6f0ffd..fdcba9cd 100644 --- a/ports/rxv2/ccrx/src/tx_thread_stack_build.src +++ b/ports/rxv2/ccrx/src/tx_thread_stack_build.src @@ -36,7 +36,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_stack_build RXc2/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -73,6 +73,8 @@ ;/* removed unnecessary stack */ ;/* type placement, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_stack_build(TX_THREAD *thread_ptr, VOID (*function_ptr)(VOID)) diff --git a/ports/rxv2/ccrx/src/tx_thread_system_return.src b/ports/rxv2/ccrx/src/tx_thread_system_return.src index a022fadc..00b9d10f 100644 --- a/ports/rxv2/ccrx/src/tx_thread_system_return.src +++ b/ports/rxv2/ccrx/src/tx_thread_system_return.src @@ -40,7 +40,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_system_return RXv2/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -76,6 +76,8 @@ ;/* 10-15-2021 William E. Lamie Modified comment(s), and */ ;/* removed unused code, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_system_return(VOID) diff --git a/ports/rxv2/ccrx/src/tx_timer_interrupt.src b/ports/rxv2/ccrx/src/tx_timer_interrupt.src index 55948caf..dd166d1e 100644 --- a/ports/rxv2/ccrx/src/tx_timer_interrupt.src +++ b/ports/rxv2/ccrx/src/tx_timer_interrupt.src @@ -32,6 +32,9 @@ ; ;Define Assembly language external references... ; + + SWI0 .EQU 872E0H + .GLB __tx_timer_time_slice .GLB __tx_timer_system_clock .GLB __tx_timer_current_ptr @@ -43,6 +46,9 @@ .GLB __tx_thread_context_save .GLB __tx_thread_time_slice .GLB __tx_thread_context_restore + .GLB __tx_thread_preempt_disable + .GLB __tx_thread_execute_ptr + .GLB __tx_thread_current_ptr ; .SECTION P,CODE ;/**************************************************************************/ @@ -50,7 +56,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_timer_interrupt RXv2/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -89,6 +95,10 @@ ;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), and */ +;/* added missing thread */ +;/* preemption logic, */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_timer_interrupt(VOID) @@ -236,6 +246,23 @@ __tx_timer_dont_activate: ; _tx_thread_time_slice(); BSR __tx_thread_time_slice ; Call time-slice processing + +; /* Check if we must trigger a context switch. */ + MOV.L #__tx_thread_preempt_disable, R1 ; Load prempt disable flag. + MOV.L [R1], R1 + CMP #0, R1 + BNE __tx_timer_not_ts_expiration ; Skip if prempt disabled. + + MOV.L #__tx_thread_execute_ptr, R1 + MOV.L [R1], R1 + MOV.L #__tx_thread_current_ptr, R2 + MOV.L [R2], R2 + CMP R1, R2 + BEQ __tx_timer_not_ts_expiration + + MOV.L #SWI0, R1 + MOV.L #1, [R1] + ; } ; __tx_timer_not_ts_expiration: diff --git a/ports/rxv2/gnu/inc/tx_port.h b/ports/rxv2/gnu/inc/tx_port.h index bae23720..7c0364e5 100644 --- a/ports/rxv2/gnu/inc/tx_port.h +++ b/ports/rxv2/gnu/inc/tx_port.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* tx_port.h RXv2/GNURX */ -/* 6.1.9 */ +/* 6.1.10 */ /* */ /* AUTHOR */ /* */ @@ -52,6 +52,10 @@ /* resulting in version 6.1.7 */ /* 10-15-2021 William E. Lamie Modified comment(s), */ /* resulting in version 6.1.9 */ +/* 01-31-2022 William E. Lamie Modified comment(s), and */ +/* added missing interrupt */ +/* control defines, */ +/* resulting in version 6.1.10 */ /* */ /**************************************************************************/ @@ -85,6 +89,12 @@ typedef short SHORT; typedef unsigned short USHORT; +/* Define interrupt control options. */ + +#define TX_INT_DISABLE 0x00000000 +#define TX_INT_ENABLE 0x00010000 + + /* Define the priority levels for ThreadX. Legal values range from 32 to 1024 and MUST be evenly divisible by 32. */ @@ -259,7 +269,7 @@ static void _tx_thread_system_return_inline(void) #ifdef TX_THREAD_INIT CHAR _tx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv2/GNURX Version 6.1.9 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv2/GNURX Version 6.1.10 *"; #else extern CHAR _tx_version_id[]; #endif diff --git a/ports/rxv2/gnu/readme_threadx.txt b/ports/rxv2/gnu/readme_threadx.txt index 7cdee82f..2abbdb7e 100644 --- a/ports/rxv2/gnu/readme_threadx.txt +++ b/ports/rxv2/gnu/readme_threadx.txt @@ -149,6 +149,10 @@ For generic code revision information, please refer to the readme_threadx_generi file, which is included in your distribution. The following details the revision information associated with this specific port of ThreadX: +01-31-2022 Release 6.1.10 changes: + tx_port.h Added missing interrupt control defines + tx_timer_interrupt.src Added missing thread preemption logic + 10-15-2021 Release 6.1.9 changes: tx_thread_context_restore.s Removed unnecessary stack type placement tx_thread_schedule.s Removed unnecessary stack type checking @@ -165,7 +169,7 @@ information associated with this specific port of ThreadX: 12-31-2020 Initial ThreadX release for the RXv2 using GNURX tools, version 6.1.3 -Copyright(c) 1996-2020 Microsoft Corporation +Copyright(c) 1996-2022 Microsoft Corporation https://azure.com/rtos diff --git a/ports/rxv2/gnu/src/tx_initialize_low_level.S b/ports/rxv2/gnu/src/tx_initialize_low_level.S index 78a94600..189bc121 100644 --- a/ports/rxv2/gnu/src/tx_initialize_low_level.S +++ b/ports/rxv2/gnu/src/tx_initialize_low_level.S @@ -29,7 +29,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_initialize_low_level RXv2/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -65,6 +65,8 @@ ;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ .global __tx_initialize_low_level diff --git a/ports/rxv2/gnu/src/tx_thread_context_restore.S b/ports/rxv2/gnu/src/tx_thread_context_restore.S index d6a878fa..7b61af43 100644 --- a/ports/rxv2/gnu/src/tx_thread_context_restore.S +++ b/ports/rxv2/gnu/src/tx_thread_context_restore.S @@ -46,7 +46,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_restore RXv2/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -83,6 +83,8 @@ ;/* removed unnecessary stack */ ;/* type placement, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_context_restore(VOID) diff --git a/ports/rxv2/gnu/src/tx_thread_context_save.S b/ports/rxv2/gnu/src/tx_thread_context_save.S index 2b9491f9..ca381e90 100644 --- a/ports/rxv2/gnu/src/tx_thread_context_save.S +++ b/ports/rxv2/gnu/src/tx_thread_context_save.S @@ -40,7 +40,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_save RXv2/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -74,6 +74,8 @@ ;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_context_save(VOID) diff --git a/ports/rxv2/gnu/src/tx_thread_interrupt_control.S b/ports/rxv2/gnu/src/tx_thread_interrupt_control.S index 00ba3249..535334de 100644 --- a/ports/rxv2/gnu/src/tx_thread_interrupt_control.S +++ b/ports/rxv2/gnu/src/tx_thread_interrupt_control.S @@ -35,7 +35,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_interrupt_control RXv2/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -68,6 +68,8 @@ ;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;UINT _tx_thread_interrupt_control(UINT new_posture) diff --git a/ports/rxv2/gnu/src/tx_thread_schedule.S b/ports/rxv2/gnu/src/tx_thread_schedule.S index b05dedb8..9587ac03 100644 --- a/ports/rxv2/gnu/src/tx_thread_schedule.S +++ b/ports/rxv2/gnu/src/tx_thread_schedule.S @@ -42,7 +42,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_schedule RXv2/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -80,6 +80,8 @@ ;/* removed unnecessary stack */ ;/* type checking, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_schedule(VOID) diff --git a/ports/rxv2/gnu/src/tx_thread_stack_build.S b/ports/rxv2/gnu/src/tx_thread_stack_build.S index 4579abb0..97f9b8df 100644 --- a/ports/rxv2/gnu/src/tx_thread_stack_build.S +++ b/ports/rxv2/gnu/src/tx_thread_stack_build.S @@ -36,7 +36,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_stack_build RXv2/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -73,6 +73,8 @@ ;/* removed unnecessary stack */ ;/* type placement, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_stack_build(TX_THREAD *thread_ptr, VOID (*function_ptr)(VOID)) diff --git a/ports/rxv2/gnu/src/tx_thread_system_return.S b/ports/rxv2/gnu/src/tx_thread_system_return.S index 43e7023a..aeacbc65 100644 --- a/ports/rxv2/gnu/src/tx_thread_system_return.S +++ b/ports/rxv2/gnu/src/tx_thread_system_return.S @@ -30,7 +30,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_system_return RXv2/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -66,6 +66,8 @@ ;/* 10-15-2021 William E. Lamie Modified comment(s), and */ ;/* removed unused code, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_system_return(VOID) diff --git a/ports/rxv2/gnu/src/tx_timer_interrupt.S b/ports/rxv2/gnu/src/tx_timer_interrupt.S index c550132a..8b8f5b9d 100644 --- a/ports/rxv2/gnu/src/tx_timer_interrupt.S +++ b/ports/rxv2/gnu/src/tx_timer_interrupt.S @@ -32,6 +32,8 @@ ; ;Define Assembly language external references... ; + + .equ SWI0, 872E0H .global __tx_timer_time_slice .global __tx_timer_system_clock .global __tx_timer_current_ptr @@ -43,6 +45,9 @@ .global __tx_thread_context_save .global __tx_thread_time_slice .global __tx_thread_context_restore + .global __tx_thread_preempt_disable + .global __tx_thread_execute_ptr + .global __tx_thread_current_ptr ; .SECTION P,CODE ;/**************************************************************************/ @@ -50,7 +55,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_timer_interrupt RXv2/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -89,6 +94,10 @@ ;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), and */ +;/* added missing thread */ +;/* preemption logic, */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_timer_interrupt(VOID) @@ -236,6 +245,23 @@ __tx_timer_dont_activate: ; _tx_thread_time_slice(); BSR __tx_thread_time_slice ; Call time-slice processing + +; /* Check if we must trigger a context switch. */ + MOV.L #__tx_thread_preempt_disable, R1 ; Load prempt disable flag. + MOV.L [R1], R1 + CMP #0, R1 + BNE __tx_timer_not_ts_expiration ; Skip if prempt disabled. + + MOV.L #__tx_thread_execute_ptr, R1 + MOV.L [R1], R1 + MOV.L #__tx_thread_current_ptr, R2 + MOV.L [R2], R2 + CMP R1, R2 + BEQ __tx_timer_not_ts_expiration + + MOV.L #SWI0, R1 + MOV.L #1, [R1] + ; } ; __tx_timer_not_ts_expiration: diff --git a/ports/rxv2/iar/inc/tx_port.h b/ports/rxv2/iar/inc/tx_port.h index 1fb74c2b..10e6fe2c 100644 --- a/ports/rxv2/iar/inc/tx_port.h +++ b/ports/rxv2/iar/inc/tx_port.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* tx_port.h RXv2/IAR */ -/* 6.1.9 */ +/* 6.1.10 */ /* */ /* AUTHOR */ /* */ @@ -52,6 +52,11 @@ /* resulting in version 6.1.7 */ /* 10-15-2021 William E. Lamie Modified comment(s), */ /* resulting in version 6.1.9 */ +/* 01-31-2022 William E. Lamie Modified comment(s), removed */ +/* system state macro, and */ +/* added missing interrupt */ +/* control defines, */ +/* resulting in version 6.1.10 */ /* */ /**************************************************************************/ @@ -85,6 +90,12 @@ typedef short SHORT; typedef unsigned short USHORT; +/* Define interrupt control options. */ + +#define TX_INT_DISABLE 0x00000000 +#define TX_INT_ENABLE 0x00010000 + + /* Define the priority levels for ThreadX. Legal values range from 32 to 1024 and MUST be evenly divisible by 32. */ @@ -244,15 +255,6 @@ static void _tx_thread_system_return_inline(void) #endif - -#ifndef TX_THREAD_GET_SYSTEM_STATE - -extern volatile ULONG _tx_thread_system_state; -#define TX_THREAD_GET_SYSTEM_STATE() (_tx_thread_system_state | ((~__get_PSW_register()) & (1u << 17u))) -#endif - - - /* Define the interrupt lockout macros for each ThreadX object. */ #define TX_BLOCK_POOL_DISABLE TX_DISABLE @@ -267,7 +269,7 @@ extern volatile ULONG _tx_thread_system_state; #ifdef TX_THREAD_INIT CHAR _tx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv2/IAR Version 6.1.9 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv2/IAR Version 6.1.10 *"; #else extern CHAR _tx_version_id[]; #endif diff --git a/ports/rxv2/iar/readme_threadx.txt b/ports/rxv2/iar/readme_threadx.txt index 227cd055..3ec196ed 100644 --- a/ports/rxv2/iar/readme_threadx.txt +++ b/ports/rxv2/iar/readme_threadx.txt @@ -146,6 +146,11 @@ For generic code revision information, please refer to the readme_threadx_generi file, which is included in your distribution. The following details the revision information associated with this specific port of ThreadX: +01-31-2022 Release 6.1.10 changes: + tx_port.h Removed system state macro, and added + missing interrupt control defines + tx_timer_interrupt.src Added missing thread preemption logic + 10-15-2021 Release 6.1.9 changes: tx_thread_context_restore.s Removed unnecessary stack type placement tx_thread_schedule.s Removed unnecessary stack type checking @@ -160,7 +165,7 @@ information associated with this specific port of ThreadX: 12-31-2020 Initial ThreadX release for the RXv2using IAR tools, version 6.1.3 -Copyright(c) 1996-2020 Microsoft Corporation +Copyright(c) 1996-2022 Microsoft Corporation https://azure.com/rtos \ No newline at end of file diff --git a/ports/rxv2/iar/src/tx_initialize_low_level.s b/ports/rxv2/iar/src/tx_initialize_low_level.s index 13a652af..638b001b 100644 --- a/ports/rxv2/iar/src/tx_initialize_low_level.s +++ b/ports/rxv2/iar/src/tx_initialize_low_level.s @@ -31,7 +31,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_initialize_low_level RXv2/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -67,6 +67,8 @@ ;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ public __tx_initialize_low_level diff --git a/ports/rxv2/iar/src/tx_thread_context_restore.s b/ports/rxv2/iar/src/tx_thread_context_restore.s index be435f74..1e4e804b 100644 --- a/ports/rxv2/iar/src/tx_thread_context_restore.s +++ b/ports/rxv2/iar/src/tx_thread_context_restore.s @@ -45,7 +45,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_restore RXv2/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -82,6 +82,8 @@ ;/* removed unnecessary stack */ ;/* type placement, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ public __tx_thread_context_restore diff --git a/ports/rxv2/iar/src/tx_thread_context_save.s b/ports/rxv2/iar/src/tx_thread_context_save.s index 8050ba36..888432c0 100644 --- a/ports/rxv2/iar/src/tx_thread_context_save.s +++ b/ports/rxv2/iar/src/tx_thread_context_save.s @@ -39,7 +39,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_save RXv2/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -73,6 +73,8 @@ ;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_context_save(VOID) diff --git a/ports/rxv2/iar/src/tx_thread_interrupt_control.s b/ports/rxv2/iar/src/tx_thread_interrupt_control.s index a0adefca..c1208669 100644 --- a/ports/rxv2/iar/src/tx_thread_interrupt_control.s +++ b/ports/rxv2/iar/src/tx_thread_interrupt_control.s @@ -34,7 +34,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_interrupt_control RXv2/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -67,6 +67,8 @@ ;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;UINT _tx_thread_interrupt_control(UINT new_posture) diff --git a/ports/rxv2/iar/src/tx_thread_schedule.s b/ports/rxv2/iar/src/tx_thread_schedule.s index 5c005b19..55ba05d6 100644 --- a/ports/rxv2/iar/src/tx_thread_schedule.s +++ b/ports/rxv2/iar/src/tx_thread_schedule.s @@ -42,7 +42,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_schedule RXv2/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -80,6 +80,8 @@ ;/* removed unnecessary stack */ ;/* type checking, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_schedule(VOID) diff --git a/ports/rxv2/iar/src/tx_thread_stack_build.s b/ports/rxv2/iar/src/tx_thread_stack_build.s index 966edcd6..637911ca 100644 --- a/ports/rxv2/iar/src/tx_thread_stack_build.s +++ b/ports/rxv2/iar/src/tx_thread_stack_build.s @@ -28,7 +28,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_stack_build RXv2/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -65,6 +65,8 @@ ;/* removed unnecessary stack */ ;/* type placement, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ public __tx_thread_stack_build diff --git a/ports/rxv2/iar/src/tx_thread_system_return.s b/ports/rxv2/iar/src/tx_thread_system_return.s index e0be2778..d1dc37df 100644 --- a/ports/rxv2/iar/src/tx_thread_system_return.s +++ b/ports/rxv2/iar/src/tx_thread_system_return.s @@ -27,7 +27,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_system_return RXv2/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -62,6 +62,8 @@ ;/* 12-31-2020 William E. Lamie Initial Version 6.1.3 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ diff --git a/ports/rxv2/iar/src/tx_timer_interrupt.s b/ports/rxv2/iar/src/tx_timer_interrupt.s index 91d9a205..855bacc3 100644 --- a/ports/rxv2/iar/src/tx_timer_interrupt.s +++ b/ports/rxv2/iar/src/tx_timer_interrupt.s @@ -20,6 +20,8 @@ ;/**************************************************************************/ ;/**************************************************************************/ +SWI0 EQU 0x872E0 + extern __tx_timer_expiration_process extern __tx_timer_system_clock extern __tx_timer_expired_time_slice @@ -29,6 +31,9 @@ extern __tx_timer_time_slice extern __tx_timer_list_end extern __tx_thread_time_slice + extern __tx_thread_preempt_disable + extern __tx_thread_execute_ptr + extern __tx_thread_current_ptr section .text:CODE:ROOT @@ -37,7 +42,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_timer_interrupt RXv2/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -76,6 +81,10 @@ ;/* 12-30-2020 William E. Lamie Initial Version 6.1.3 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), and */ +;/* added missing thread */ +;/* preemption logic, */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ @@ -222,6 +231,23 @@ __tx_timer_dont_activate: ; _tx_thread_time_slice(); BSR __tx_thread_time_slice ; Call time-slice processing + +; /* Check if we must trigger a context switch. */ + MOV.L #__tx_thread_preempt_disable, R1 ; Load prempt disable flag. + MOV.L [R1], R1 + CMP #0, R1 + BNE __tx_timer_not_ts_expiration ; Skip if prempt disabled. + + MOV.L #__tx_thread_execute_ptr, R1 + MOV.L [R1], R1 + MOV.L #__tx_thread_current_ptr, R2 + MOV.L [R2], R2 + CMP R1, R2 + BEQ __tx_timer_not_ts_expiration + + MOV.L #SWI0, R1 + MOV.L #1, [R1] + ; } ; __tx_timer_not_ts_expiration: diff --git a/ports/rxv3/ccrx/inc/tx_port.h b/ports/rxv3/ccrx/inc/tx_port.h index 42c875f3..0226aa0e 100644 --- a/ports/rxv3/ccrx/inc/tx_port.h +++ b/ports/rxv3/ccrx/inc/tx_port.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* tx_port.h RXv3/CCRX */ -/* 6.1.9 */ +/* 6.1.10 */ /* */ /* AUTHOR */ /* */ @@ -51,6 +51,11 @@ /* 10-15-2021 William E. Lamie Modified comment(s), and */ /* added FPU support, */ /* resulting in version 6.1.9 */ +/* 01-31-2022 William E. Lamie Modified comment(s), removed */ +/* system state macro, and */ +/* added missing interrupt */ +/* control defines, */ +/* resulting in version 6.1.10 */ /* */ /**************************************************************************/ @@ -81,6 +86,12 @@ typedef short SHORT; typedef unsigned short USHORT; +/* Define interrupt control options. */ + +#define TX_INT_DISABLE 0x00000000 +#define TX_INT_ENABLE 0x00010000 + + /* Define the priority levels for ThreadX. Legal values range from 32 to 1024 and MUST be evenly divisible by 32. */ @@ -247,19 +258,6 @@ static void _tx_thread_system_return_inline(void) } -#ifndef TX_THREAD_GET_SYSTEM_STATE - -#pragma inline_asm _get_psw -static UINT _get_psw(void){ - MVFC PSW,R1 ; -} - -extern volatile ULONG _tx_thread_system_state; -#define TX_THREAD_GET_SYSTEM_STATE() (_tx_thread_system_state | ((~_get_psw()) & (1u << 17u))) -#endif - - - /* Define the interrupt lockout macros for each ThreadX object. */ #define TX_BLOCK_POOL_DISABLE TX_DISABLE @@ -279,7 +277,7 @@ void tx_thread_fpu_disable(void); #ifdef TX_THREAD_INIT CHAR _tx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv3/CCRX Version 6.1.9 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv3/CCRX Version 6.1.10 *"; #else extern CHAR _tx_version_id[]; #endif diff --git a/ports/rxv3/ccrx/readme_threadx.txt b/ports/rxv3/ccrx/readme_threadx.txt index 2a399909..54a0aafd 100644 --- a/ports/rxv3/ccrx/readme_threadx.txt +++ b/ports/rxv3/ccrx/readme_threadx.txt @@ -209,6 +209,11 @@ For generic code revision information, please refer to the readme_threadx_generi file, which is included in your distribution. The following details the revision information associated with this specific port of ThreadX: +01-31-2022 Release 6.1.10 changes: + tx_port.h Removed system state macro, and added + missing interrupt control defines + tx_timer_interrupt.src Added missing thread preemption logic + 10-15-2021 Release 6.1.9 changes: tx_port.h Added FPU support tx_thread_context_restore.s Added FPU support @@ -218,7 +223,7 @@ information associated with this specific port of ThreadX: 06-02-2021 Initial ThreadX release for the RXv3 using CC-RXX tools, version 6.1.7 -Copyright(c) 1996-2021 Microsoft Corporation +Copyright(c) 1996-2022 Microsoft Corporation https://azure.com/rtos diff --git a/ports/rxv3/ccrx/src/tx_initialize_low_level.src b/ports/rxv3/ccrx/src/tx_initialize_low_level.src index df15b422..aa8f36e1 100644 --- a/ports/rxv3/ccrx/src/tx_initialize_low_level.src +++ b/ports/rxv3/ccrx/src/tx_initialize_low_level.src @@ -34,7 +34,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_initialize_low_level RXv3/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -70,6 +70,8 @@ ;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ diff --git a/ports/rxv3/ccrx/src/tx_thread_context_restore.src b/ports/rxv3/ccrx/src/tx_thread_context_restore.src index f9d555a3..be6475b3 100644 --- a/ports/rxv3/ccrx/src/tx_thread_context_restore.src +++ b/ports/rxv3/ccrx/src/tx_thread_context_restore.src @@ -45,7 +45,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_restore RXv3/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -81,6 +81,8 @@ ;/* 10-15-2021 William E. Lamie Modified comment(s), and */ ;/* added FPU support, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_context_restore(VOID) diff --git a/ports/rxv3/ccrx/src/tx_thread_context_save.src b/ports/rxv3/ccrx/src/tx_thread_context_save.src index 329e7198..f1888613 100644 --- a/ports/rxv3/ccrx/src/tx_thread_context_save.src +++ b/ports/rxv3/ccrx/src/tx_thread_context_save.src @@ -40,7 +40,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_save RXv3/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -74,6 +74,8 @@ ;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_context_save(VOID) diff --git a/ports/rxv3/ccrx/src/tx_thread_interrupt_control.src b/ports/rxv3/ccrx/src/tx_thread_interrupt_control.src index ced0af42..10c81a7e 100644 --- a/ports/rxv3/ccrx/src/tx_thread_interrupt_control.src +++ b/ports/rxv3/ccrx/src/tx_thread_interrupt_control.src @@ -35,7 +35,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_interrupt_control RXv3/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -68,6 +68,8 @@ ;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;UINT _tx_thread_interrupt_control(UINT new_posture) diff --git a/ports/rxv3/ccrx/src/tx_thread_schedule.src b/ports/rxv3/ccrx/src/tx_thread_schedule.src index 55bdb064..c62b3b6a 100644 --- a/ports/rxv3/ccrx/src/tx_thread_schedule.src +++ b/ports/rxv3/ccrx/src/tx_thread_schedule.src @@ -42,7 +42,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_schedule RXv3/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -79,6 +79,8 @@ ;/* 10-15-2021 William E. Lamie Modified comment(s), and */ ;/* added FPU support, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_schedule(VOID) diff --git a/ports/rxv3/ccrx/src/tx_thread_stack_build.src b/ports/rxv3/ccrx/src/tx_thread_stack_build.src index 20343bb4..94c26dda 100644 --- a/ports/rxv3/ccrx/src/tx_thread_stack_build.src +++ b/ports/rxv3/ccrx/src/tx_thread_stack_build.src @@ -36,7 +36,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_stack_build RXv3/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -71,6 +71,8 @@ ;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_stack_build(TX_THREAD *thread_ptr, VOID (*function_ptr)(VOID)) diff --git a/ports/rxv3/ccrx/src/tx_thread_system_return.src b/ports/rxv3/ccrx/src/tx_thread_system_return.src index f0bd7329..dcf31a30 100644 --- a/ports/rxv3/ccrx/src/tx_thread_system_return.src +++ b/ports/rxv3/ccrx/src/tx_thread_system_return.src @@ -40,7 +40,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_system_return RXv3/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -76,6 +76,8 @@ ;/* 10-15-2021 William E. Lamie Modified comment(s), and */ ;/* removed unused code, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_system_return(VOID) diff --git a/ports/rxv3/ccrx/src/tx_timer_interrupt.src b/ports/rxv3/ccrx/src/tx_timer_interrupt.src index f950554f..bca71c27 100644 --- a/ports/rxv3/ccrx/src/tx_timer_interrupt.src +++ b/ports/rxv3/ccrx/src/tx_timer_interrupt.src @@ -32,6 +32,9 @@ ; ;Define Assembly language external references... ; + + SWI0 .EQU 872E0H + .GLB __tx_timer_time_slice .GLB __tx_timer_system_clock .GLB __tx_timer_current_ptr @@ -43,6 +46,9 @@ .GLB __tx_thread_context_save .GLB __tx_thread_time_slice .GLB __tx_thread_context_restore + .GLB __tx_thread_preempt_disable + .GLB __tx_thread_execute_ptr + .GLB __tx_thread_current_ptr ; .SECTION P,CODE ;/**************************************************************************/ @@ -50,7 +56,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_timer_interrupt RXv3/CCRX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -89,6 +95,10 @@ ;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), and */ +;/* added missing thread */ +;/* preemption logic, */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_timer_interrupt(VOID) @@ -236,6 +246,23 @@ __tx_timer_dont_activate: ; _tx_thread_time_slice(); BSR __tx_thread_time_slice ; Call time-slice processing + +; /* Check if we must trigger a context switch. */ + MOV.L #__tx_thread_preempt_disable, R1 ; Load prempt disable flag. + MOV.L [R1], R1 + CMP #0, R1 + BNE __tx_timer_not_ts_expiration ; Skip if prempt disabled. + + MOV.L #__tx_thread_execute_ptr, R1 + MOV.L [R1], R1 + MOV.L #__tx_thread_current_ptr, R2 + MOV.L [R2], R2 + CMP R1, R2 + BEQ __tx_timer_not_ts_expiration + + MOV.L #SWI0, R1 + MOV.L #1, [R1] + ; } ; __tx_timer_not_ts_expiration: diff --git a/ports/rxv3/gnu/inc/tx_port.h b/ports/rxv3/gnu/inc/tx_port.h index 9aec1ed3..ce2cc09f 100644 --- a/ports/rxv3/gnu/inc/tx_port.h +++ b/ports/rxv3/gnu/inc/tx_port.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* tx_port.h RXv3/GNURX */ -/* 6.1.9 */ +/* 6.1.10 */ /* */ /* AUTHOR */ /* */ @@ -51,6 +51,10 @@ /* 10-15-2021 William E. Lamie Modified comment(s), and */ /* added FPU support, */ /* resulting in version 6.1.9 */ +/* 01-31-2022 William E. Lamie Modified comment(s), and */ +/* added missing interrupt */ +/* control defines, */ +/* resulting in version 6.1.10 */ /* */ /**************************************************************************/ @@ -84,6 +88,12 @@ typedef short SHORT; typedef unsigned short USHORT; +/* Define interrupt control options. */ + +#define TX_INT_DISABLE 0x00000000 +#define TX_INT_ENABLE 0x00010000 + + /* Define the priority levels for ThreadX. Legal values range from 32 to 1024 and MUST be evenly divisible by 32. */ @@ -263,7 +273,7 @@ void tx_thread_fpu_disable(void); #ifdef TX_THREAD_INIT CHAR _tx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv3/GNURX Version 6.1.9 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv3/GNURX Version 6.1.10 *"; #else extern CHAR _tx_version_id[]; #endif diff --git a/ports/rxv3/gnu/readme_threadx.txt b/ports/rxv3/gnu/readme_threadx.txt index 46c2fdb0..ffbe53d0 100644 --- a/ports/rxv3/gnu/readme_threadx.txt +++ b/ports/rxv3/gnu/readme_threadx.txt @@ -203,6 +203,10 @@ For generic code revision information, please refer to the readme_threadx_generi file, which is included in your distribution. The following details the revision information associated with this specific port of ThreadX: +01-31-2022 Release 6.1.10 changes: + tx_port.h Added missing interrupt control defines + tx_timer_interrupt.src Added missing thread preemption logic + 10-15-2021 Release 6.1.9 changes: tx_port.h Added FPU support tx_thread_context_restore.s Added FPU support @@ -212,7 +216,7 @@ information associated with this specific port of ThreadX: 06-02-2021 Initial ThreadX release for the RXv3 using GNURX tools, version 6.1.7 -Copyright(c) 1996-2021 Microsoft Corporation +Copyright(c) 1996-2022 Microsoft Corporation https://azure.com/rtos diff --git a/ports/rxv3/gnu/src/tx_initialize_low_level.S b/ports/rxv3/gnu/src/tx_initialize_low_level.S index eb403fb2..54876912 100644 --- a/ports/rxv3/gnu/src/tx_initialize_low_level.S +++ b/ports/rxv3/gnu/src/tx_initialize_low_level.S @@ -29,7 +29,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_initialize_low_level RXv3/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -65,6 +65,8 @@ ;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ .global __tx_initialize_low_level diff --git a/ports/rxv3/gnu/src/tx_thread_context_restore.S b/ports/rxv3/gnu/src/tx_thread_context_restore.S index ff7f740d..0785de15 100644 --- a/ports/rxv3/gnu/src/tx_thread_context_restore.S +++ b/ports/rxv3/gnu/src/tx_thread_context_restore.S @@ -46,7 +46,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_restore RXv3/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -82,6 +82,8 @@ ;/* 10-15-2021 William E. Lamie Modified comment(s), and */ ;/* added FPU support, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_context_restore(VOID) diff --git a/ports/rxv3/gnu/src/tx_thread_context_save.S b/ports/rxv3/gnu/src/tx_thread_context_save.S index 765a91bc..b9a53685 100644 --- a/ports/rxv3/gnu/src/tx_thread_context_save.S +++ b/ports/rxv3/gnu/src/tx_thread_context_save.S @@ -40,7 +40,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_save RXv3/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -74,6 +74,8 @@ ;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_context_save(VOID) diff --git a/ports/rxv3/gnu/src/tx_thread_interrupt_control.S b/ports/rxv3/gnu/src/tx_thread_interrupt_control.S index fc44e754..9ffee489 100644 --- a/ports/rxv3/gnu/src/tx_thread_interrupt_control.S +++ b/ports/rxv3/gnu/src/tx_thread_interrupt_control.S @@ -35,7 +35,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_interrupt_control RXv3/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -68,6 +68,8 @@ ;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;UINT _tx_thread_interrupt_control(UINT new_posture) diff --git a/ports/rxv3/gnu/src/tx_thread_schedule.S b/ports/rxv3/gnu/src/tx_thread_schedule.S index 904ca03e..61fc0d88 100644 --- a/ports/rxv3/gnu/src/tx_thread_schedule.S +++ b/ports/rxv3/gnu/src/tx_thread_schedule.S @@ -42,7 +42,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_schedule RXv3/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -79,6 +79,8 @@ ;/* 10-15-2021 William E. Lamie Modified comment(s), and */ ;/* added FPU support, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_schedule(VOID) diff --git a/ports/rxv3/gnu/src/tx_thread_stack_build.S b/ports/rxv3/gnu/src/tx_thread_stack_build.S index 7240d55c..90422211 100644 --- a/ports/rxv3/gnu/src/tx_thread_stack_build.S +++ b/ports/rxv3/gnu/src/tx_thread_stack_build.S @@ -36,7 +36,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_stack_build RXv3/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -71,6 +71,8 @@ ;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_stack_build(TX_THREAD *thread_ptr, VOID (*function_ptr)(VOID)) diff --git a/ports/rxv3/gnu/src/tx_thread_system_return.S b/ports/rxv3/gnu/src/tx_thread_system_return.S index 653be9b3..f995cbe4 100644 --- a/ports/rxv3/gnu/src/tx_thread_system_return.S +++ b/ports/rxv3/gnu/src/tx_thread_system_return.S @@ -40,7 +40,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_system_return RXv3/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -76,6 +76,8 @@ ;/* 10-15-2021 William E. Lamie Modified comment(s), and */ ;/* removed unused code, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_system_return(VOID) diff --git a/ports/rxv3/gnu/src/tx_timer_interrupt.S b/ports/rxv3/gnu/src/tx_timer_interrupt.S index f7b5e8b8..dcb30b2f 100644 --- a/ports/rxv3/gnu/src/tx_timer_interrupt.S +++ b/ports/rxv3/gnu/src/tx_timer_interrupt.S @@ -32,6 +32,7 @@ ; ;Define Assembly language external references... ; + .equ SWI0, 872E0H .global __tx_timer_time_slice .global __tx_timer_system_clock .global __tx_timer_current_ptr @@ -43,6 +44,9 @@ .global __tx_thread_context_save .global __tx_thread_time_slice .global __tx_thread_context_restore + .global __tx_thread_preempt_disable + .global __tx_thread_execute_ptr + .global __tx_thread_current_ptr ; .SECTION P,CODE ;/**************************************************************************/ @@ -50,7 +54,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_timer_interrupt RXv3/GNURX */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -89,6 +93,10 @@ ;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), and */ +;/* added missing thread */ +;/* preemption logic, */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_timer_interrupt(VOID) @@ -236,6 +244,23 @@ __tx_timer_dont_activate: ; _tx_thread_time_slice(); BSR __tx_thread_time_slice ; Call time-slice processing + +; /* Check if we must trigger a context switch. */ + MOV.L #__tx_thread_preempt_disable, R1 ; Load prempt disable flag. + MOV.L [R1], R1 + CMP #0, R1 + BNE __tx_timer_not_ts_expiration ; Skip if prempt disabled. + + MOV.L #__tx_thread_execute_ptr, R1 + MOV.L [R1], R1 + MOV.L #__tx_thread_current_ptr, R2 + MOV.L [R2], R2 + CMP R1, R2 + BEQ __tx_timer_not_ts_expiration + + MOV.L #SWI0, R1 + MOV.L #1, [R1] + ; } ; __tx_timer_not_ts_expiration: diff --git a/ports/rxv3/iar/inc/tx_port.h b/ports/rxv3/iar/inc/tx_port.h index 9e0a4f0b..6e515137 100644 --- a/ports/rxv3/iar/inc/tx_port.h +++ b/ports/rxv3/iar/inc/tx_port.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* tx_port.h RXv3/IAR */ -/* 6.1.9 */ +/* 6.1.10 */ /* */ /* AUTHOR */ /* */ @@ -51,6 +51,11 @@ /* 10-15-2021 William E. Lamie Modified comment(s), and */ /* added FPU support, */ /* resulting in version 6.1.9 */ +/* 01-31-2022 William E. Lamie Modified comment(s), removed */ +/* system state macro, and */ +/* added missing interrupt */ +/* control defines, */ +/* resulting in version 6.1.10 */ /* */ /**************************************************************************/ @@ -84,6 +89,12 @@ typedef short SHORT; typedef unsigned short USHORT; +/* Define interrupt control options. */ + +#define TX_INT_DISABLE 0x00000000 +#define TX_INT_ENABLE 0x00010000 + + /* Define the priority levels for ThreadX. Legal values range from 32 to 1024 and MUST be evenly divisible by 32. */ @@ -244,14 +255,6 @@ static void _tx_thread_system_return_inline(void) #endif -#ifndef TX_THREAD_GET_SYSTEM_STATE - -extern volatile ULONG _tx_thread_system_state; -#define TX_THREAD_GET_SYSTEM_STATE() (_tx_thread_system_state | ((~__get_PSW_register()) & (1u << 17u))) -#endif - - - /* Define the interrupt lockout macros for each ThreadX object. */ #define TX_BLOCK_POOL_DISABLE TX_DISABLE @@ -271,7 +274,7 @@ void tx_thread_fpu_disable(void); #ifdef TX_THREAD_INIT CHAR _tx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv3/IAR Version 6.1.9 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * ThreadX RXv3/IAR Version 6.1.10 *"; #else extern CHAR _tx_version_id[]; #endif diff --git a/ports/rxv3/iar/readme_threadx.txt b/ports/rxv3/iar/readme_threadx.txt index d397a7a3..d1d367da 100644 --- a/ports/rxv3/iar/readme_threadx.txt +++ b/ports/rxv3/iar/readme_threadx.txt @@ -203,6 +203,11 @@ For generic code revision information, please refer to the readme_threadx_generi file, which is included in your distribution. The following details the revision information associated with this specific port of ThreadX: +01-31-2022 Release 6.1.10 changes: + tx_port.h Removed system state macro, and added + missing interrupt control defines + tx_timer_interrupt.src Added missing thread preemption logic + 10-15-2021 Release 6.1.9 changes: tx_port.h Added FPU support tx_thread_context_restore.s Added FPU support @@ -211,7 +216,7 @@ information associated with this specific port of ThreadX: 06-02-2021 Initial ThreadX release for the RXv3using IAR tools, version 6.1.7 -Copyright(c) 1996-2021 Microsoft Corporation +Copyright(c) 1996-2022 Microsoft Corporation https://azure.com/rtos \ No newline at end of file diff --git a/ports/rxv3/iar/src/tx_initialize_low_level.s b/ports/rxv3/iar/src/tx_initialize_low_level.s index 4af7e81e..b74419d4 100644 --- a/ports/rxv3/iar/src/tx_initialize_low_level.s +++ b/ports/rxv3/iar/src/tx_initialize_low_level.s @@ -31,7 +31,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_initialize_low_level RXv3/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -67,6 +67,8 @@ ;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ public __tx_initialize_low_level diff --git a/ports/rxv3/iar/src/tx_thread_context_restore.s b/ports/rxv3/iar/src/tx_thread_context_restore.s index d3c71344..dad03641 100644 --- a/ports/rxv3/iar/src/tx_thread_context_restore.s +++ b/ports/rxv3/iar/src/tx_thread_context_restore.s @@ -45,7 +45,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_restore RXv3/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -81,6 +81,8 @@ ;/* 10-15-2021 William E. Lamie Modified comment(s), and */ ;/* added FPU support, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ public __tx_thread_context_restore diff --git a/ports/rxv3/iar/src/tx_thread_context_save.s b/ports/rxv3/iar/src/tx_thread_context_save.s index e2764ba3..57b7f5d3 100644 --- a/ports/rxv3/iar/src/tx_thread_context_save.s +++ b/ports/rxv3/iar/src/tx_thread_context_save.s @@ -39,7 +39,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_context_save RXv3/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -73,6 +73,8 @@ ;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_context_save(VOID) diff --git a/ports/rxv3/iar/src/tx_thread_interrupt_control.s b/ports/rxv3/iar/src/tx_thread_interrupt_control.s index dc37cbd9..8e0ab20a 100644 --- a/ports/rxv3/iar/src/tx_thread_interrupt_control.s +++ b/ports/rxv3/iar/src/tx_thread_interrupt_control.s @@ -34,7 +34,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_interrupt_control RXv3/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -67,6 +67,8 @@ ;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;UINT _tx_thread_interrupt_control(UINT new_posture) diff --git a/ports/rxv3/iar/src/tx_thread_schedule.s b/ports/rxv3/iar/src/tx_thread_schedule.s index c2ab71fe..3f743b14 100644 --- a/ports/rxv3/iar/src/tx_thread_schedule.s +++ b/ports/rxv3/iar/src/tx_thread_schedule.s @@ -42,7 +42,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_schedule RXv3/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -79,6 +79,8 @@ ;/* 10-15-2021 William E. Lamie Modified comment(s), and */ ;/* added FPU support, */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ ;VOID _tx_thread_schedule(VOID) diff --git a/ports/rxv3/iar/src/tx_thread_stack_build.s b/ports/rxv3/iar/src/tx_thread_stack_build.s index afc4d9bb..c5309192 100644 --- a/ports/rxv3/iar/src/tx_thread_stack_build.s +++ b/ports/rxv3/iar/src/tx_thread_stack_build.s @@ -28,7 +28,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_stack_build RXv3/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -63,6 +63,8 @@ ;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ diff --git a/ports/rxv3/iar/src/tx_thread_system_return.s b/ports/rxv3/iar/src/tx_thread_system_return.s index aca2453a..558e6534 100644 --- a/ports/rxv3/iar/src/tx_thread_system_return.s +++ b/ports/rxv3/iar/src/tx_thread_system_return.s @@ -27,7 +27,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_thread_system_return RXv3/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -62,6 +62,8 @@ ;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ diff --git a/ports/rxv3/iar/src/tx_timer_interrupt.s b/ports/rxv3/iar/src/tx_timer_interrupt.s index 6358afcc..b60088f5 100644 --- a/ports/rxv3/iar/src/tx_timer_interrupt.s +++ b/ports/rxv3/iar/src/tx_timer_interrupt.s @@ -20,6 +20,8 @@ ;/**************************************************************************/ ;/**************************************************************************/ +SWI0 EQU 0x872E0 + extern __tx_timer_expiration_process extern __tx_timer_system_clock extern __tx_timer_expired_time_slice @@ -29,6 +31,10 @@ extern __tx_timer_time_slice extern __tx_timer_list_end extern __tx_thread_time_slice + extern __tx_thread_preempt_disable + extern __tx_thread_execute_ptr + extern __tx_thread_current_ptr + section .text:CODE:ROOT @@ -37,7 +43,7 @@ ;/* FUNCTION RELEASE */ ;/* */ ;/* _tx_timer_interrupt RXv3/IAR */ -;/* 6.1.9 */ +;/* 6.1.10 */ ;/* AUTHOR */ ;/* */ ;/* William E. Lamie, Microsoft Corporation */ @@ -76,6 +82,10 @@ ;/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ ;/* 10-15-2021 William E. Lamie Modified comment(s), */ ;/* resulting in version 6.1.9 */ +;/* 01-31-2022 William E. Lamie Modified comment(s), and */ +;/* added missing thread */ +;/* preemption logic, */ +;/* resulting in version 6.1.10 */ ;/* */ ;/**************************************************************************/ @@ -222,6 +232,23 @@ __tx_timer_dont_activate: ; _tx_thread_time_slice(); BSR __tx_thread_time_slice ; Call time-slice processing + +; /* Check if we must trigger a context switch. */ + MOV.L #__tx_thread_preempt_disable, R1 ; Load prempt disable flag. + MOV.L [R1], R1 + CMP #0, R1 + BNE __tx_timer_not_ts_expiration ; Skip if prempt disabled. + + MOV.L #__tx_thread_execute_ptr, R1 + MOV.L [R1], R1 + MOV.L #__tx_thread_current_ptr, R2 + MOV.L [R2], R2 + CMP R1, R2 + BEQ __tx_timer_not_ts_expiration + + MOV.L #SWI0, R1 + MOV.L #1, [R1] + ; } ; __tx_timer_not_ts_expiration: