diff options
Diffstat (limited to 'utility/rtos_compatibility_layers/OSEK')
| -rw-r--r-- | utility/rtos_compatibility_layers/OSEK/demo_osek.c | 16 | ||||
| -rw-r--r-- | utility/rtos_compatibility_layers/OSEK/os.h | 14 | ||||
| -rw-r--r-- | utility/rtos_compatibility_layers/OSEK/osek_user.h | 13 | ||||
| -rw-r--r-- | utility/rtos_compatibility_layers/OSEK/threadx_osek_readme.txt | 106 | ||||
| -rw-r--r-- | utility/rtos_compatibility_layers/OSEK/tx_osek.c | 13 |
5 files changed, 73 insertions, 89 deletions
diff --git a/utility/rtos_compatibility_layers/OSEK/demo_osek.c b/utility/rtos_compatibility_layers/OSEK/demo_osek.c index 625282eb..2e104d31 100644 --- a/utility/rtos_compatibility_layers/OSEK/demo_osek.c +++ b/utility/rtos_compatibility_layers/OSEK/demo_osek.c @@ -51,7 +51,7 @@ TX_TIMER demo_isr_timer; VOID demo_isr_timer_entry(ULONG arg); -/* Main function. */ +/* Main function. */ int main() { @@ -67,8 +67,8 @@ CHAR * pointer; /* Put the first available address into character pointer. */ pointer = (CHAR * )free_memory; - - /* Setup hook pointers (optional). */ + + /* Setup hook pointers (optional). */ Application1.shutdown_hook_handler = ShutdownHook; Application1.pretask_hook_handler = PreTaskHook; Application1.posttask_hook_handler = PostTaskHook; @@ -77,7 +77,7 @@ CHAR * pointer; /* Initialize a pointer. */ osek_initialize(pointer,&Application1); - + /* Create the system counter */ SystemTimer = CreateCounter("SystemTimer", 0x7FFFFFFF, 2, 2, 0); DefineSystemCounter(SystemTimer); @@ -87,13 +87,13 @@ CHAR * pointer; /* Create an event. */ Event1 = CreateEvent(); - + /* Register Event1 to Task1. */ RegisterEventtoTask(Event1 , Task1); /* Create a resource. */ Resource1 = CreateResource("Resource1", STANDARD, 0); - + /* Register Resource1 to Task1. */ RegisterTasktoResource(Resource1, Task1); @@ -103,10 +103,10 @@ CHAR * pointer; /* Create a ThreadX timer to simulate an ISR. */ tx_timer_create(&demo_isr_timer, "Demo ISR timer", demo_isr_timer_entry, DemoISR, 1000, 1000, TX_AUTO_ACTIVATE); - + /* Start OSEK */ StartOS(OSDEFAULTAPPMODE); - + } /* Task body. */ diff --git a/utility/rtos_compatibility_layers/OSEK/os.h b/utility/rtos_compatibility_layers/OSEK/os.h index eda727b4..f88bfce7 100644 --- a/utility/rtos_compatibility_layers/OSEK/os.h +++ b/utility/rtos_compatibility_layers/OSEK/os.h @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -34,13 +35,6 @@ /* This file defines the constants, structures, etc. needed for the */ /* OSEK implementation. */ /* */ -/* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ -/* */ /**************************************************************************/ #ifndef TX_OSEK_H diff --git a/utility/rtos_compatibility_layers/OSEK/osek_user.h b/utility/rtos_compatibility_layers/OSEK/osek_user.h index 27b73ecd..45f4d7b6 100644 --- a/utility/rtos_compatibility_layers/OSEK/osek_user.h +++ b/utility/rtos_compatibility_layers/OSEK/osek_user.h @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -34,12 +35,6 @@ /* This files contains user configurable compile time paramteres for */ /* the OSEK implementation. */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ -/* */ /**************************************************************************/ #ifndef OSEK_USER_H diff --git a/utility/rtos_compatibility_layers/OSEK/threadx_osek_readme.txt b/utility/rtos_compatibility_layers/OSEK/threadx_osek_readme.txt index dd1e1209..6f19db6d 100644 --- a/utility/rtos_compatibility_layers/OSEK/threadx_osek_readme.txt +++ b/utility/rtos_compatibility_layers/OSEK/threadx_osek_readme.txt @@ -9,46 +9,46 @@ to the ThreadX readme file for installation instructions for ThreadX. 2. Building -Building the OSEK layer should be as simple as including the tx_osek.c and os.h file to +Building the OSEK layer should be as simple as including the tx_osek.c and os.h file to an existing ThreadX project, making sure that the location of the os.h header is in the -include paths. The OSEK layer requires that the ThreadX headers such as tx_api.h are +include paths. The OSEK layer requires that the ThreadX headers such as tx_api.h are reachable in the include paths as well. 3. Initialization -The OSEK layer initialization can be performed either from the tx_application_define() -during the ThreadX initialization or from a running ThreadX thread. It is strongly -recommended to initialize and start the OSEK layer as soon as possible. Once started -other ThreadX tasks and API call should not be used to prevent resource conflicts with +The OSEK layer initialization can be performed either from the tx_application_define() +during the ThreadX initialization or from a running ThreadX thread. It is strongly +recommended to initialize and start the OSEK layer as soon as possible. Once started +other ThreadX tasks and API call should not be used to prevent resource conflicts with OSEK. -The OSEK initialization has three phases. First the osek internal initialization which -must be performed before calling any other OSEK API functions, by calling +The OSEK initialization has three phases. First the osek internal initialization which +must be performed before calling any other OSEK API functions, by calling osek_initialize() passing it a pointer to the OSEK memory and the application structure. The size of the memory region passed to osek_initialize() must be set at compile time by adjusting the OSEK_MEMORY_SIZE define in osek_uart.h. -After having initialized the OSEK internally, the application can now create OSEK objects +After having initialized the OSEK internally, the application can now create OSEK objects and link or assigned them as needed. See below for a list of object creation functions. -Finally, after all the objects are created and configured the OSEK layer can be started -using StartOS(). Once started it is no longer possible to create or change any OSEK +Finally, after all the objects are created and configured the OSEK layer can be started +using StartOS(). Once started it is no longer possible to create or change any OSEK objects. 4. OSEK shutdown and restart -The OSEK layer can be shutdown using the standard OSEK API ShutdownOS(). As an extension -to the OSEK layer offers an osek_cleanup() function which can be used to cleanup and -reset the OSEK layer allowing a subsequent restart without having to reset the CPU. This +The OSEK layer can be shutdown using the standard OSEK API ShutdownOS(). As an extension +to the OSEK layer offers an osek_cleanup() function which can be used to cleanup and +reset the OSEK layer allowing a subsequent restart without having to reset the CPU. This is primarily intended for testing. 5. Hooks -The various hook routines available within OSEK can be set during initialization by -setting the various handler members of the APPLICATION_INFO structure passed to +The various hook routines available within OSEK can be set during initialization by +setting the various handler members of the APPLICATION_INFO structure passed to osek_initialize(). See the OSEK documentation for the signature of those hook functions. For example: @@ -62,15 +62,15 @@ For example: 6. Interrupts -As per the OSEK specification, category 1 ISRs are not affected by the OSEK layer +As per the OSEK specification, category 1 ISRs are not affected by the OSEK layer execution and are not allowed to call any of the OSEK API. Those ISR are configured and -processed just like any other interrupts under ThreadX. Category 2 ISR have to be +processed just like any other interrupts under ThreadX. Category 2 ISR have to be created using CreateISR() as well as being registered and enable like a category 1 ISR. In the body of the low level ISR process_ISR2() must be called with the return value of -the corresponding CreateISR() in argument. This will instruct the OSEK layer to schedule +the corresponding CreateISR() in argument. This will instruct the OSEK layer to schedule the category 2 ISR as soon as possible. -A category 2 ISR is made of two handlers, the one that process the hardware interrupt +A category 2 ISR is made of two handlers, the one that process the hardware interrupt and the OSEK ISR body. To define a category 2 ISR body use the standard ISR() macro as follows: @@ -104,7 +104,7 @@ void demo_isr_hardware_handler(void) 7. Implementation specific information -Since OSEK requires a static allocation methodology, the number of available OSEK object +Since OSEK requires a static allocation methodology, the number of available OSEK object has to be limited at compile time. By default the following limits apply: Maximum number of tasks: 32 @@ -121,10 +121,10 @@ Maximum task activation count: 8 8. Supported OSEK API -The ThreadX OSEK layer supports all the mandatory APIs specified in version 2.2.3 of +The ThreadX OSEK layer supports all the mandatory APIs specified in version 2.2.3 of the OSEK/VDK Operating System Specification. -Summary of the supported API, see the OSEK specification and tx_osek.c for the full +Summary of the supported API, see the OSEK specification and tx_osek.c for the full details of each API. TASK MANAGEMENT @@ -191,22 +191,22 @@ detailed description of each function. ---- CreateTask � Creates an OSEK task, the task is returned if successful. - TaskType CreateTask(CHAR *name, - void(*entry_function)(), - UINT priority, - UINT max_activation, - ULONG stack_size, - SCHEDULE policy, - AUTOSTART start, - UINT type, + TaskType CreateTask(CHAR *name, + void(*entry_function)(), + UINT priority, + UINT max_activation, + ULONG stack_size, + SCHEDULE policy, + AUTOSTART start, + UINT type, AppModeType mode); ---- CreateResource - Creates an OSEK resource, the resource is returned if successful. - ResourceType CreateResource(const CHAR *name, - StatusType type, + ResourceType CreateResource(const CHAR *name, + StatusType type, ResourceType linked_res); @@ -214,49 +214,49 @@ CreateResource - Creates an OSEK resource, the resource is returned if successfu RegisterTasktoResource - Registers a task to a resource. The resource will be accessible by the registered task. - StatusType RegisterTasktoResource(ResourceType Resource, + StatusType RegisterTasktoResource(ResourceType Resource, TaskType TaskID); ---- -CreateEvent - Creates an event, the created event is returned if successful. Note that +CreateEvent - Creates an event, the created event is returned if successful. Note that per the OSEK specification an absolute maximum of 32 events can be created. EventMaskType CreateEvent(void); ---- -RegisterEventtoTask - Register an event to a task. The event is now usable from that +RegisterEventtoTask - Register an event to a task. The event is now usable from that task. Note that an event can only be registered to a single task. - StatusType RegisterEventtoTask(EventType eventid, + StatusType RegisterEventtoTask(EventType eventid, TaskType TaskID); ---- CreateISR - Creates an ISR. - ISRType CreateISR(const CHAR *name, - void(*entry_function)(), - UINT category, + ISRType CreateISR(const CHAR *name, + void(*entry_function)(), + UINT category, ULONG stack_size); ---- -RegisterISRtoResource - Register an ISR to a resource. Note that ISR cannot be registered +RegisterISRtoResource - Register an ISR to a resource. Note that ISR cannot be registered to category 1 ISRS. - StatusType RegisterISRtoResource(ResourceType Resource, + StatusType RegisterISRtoResource(ResourceType Resource, ISRType ISRID); ---- CreateCounter - Creates a new counter. - CounterType CreateCounter(CHAR *name, - TickType max_allowed_value, - TickType ticks_per_base, - TickType min_cycle, + CounterType CreateCounter(CHAR *name, + TickType max_allowed_value, + TickType ticks_per_base, + TickType min_cycle, TickType start_value); ---- @@ -267,11 +267,11 @@ DefineSystemCounter - Assign a counter to be used as the system counter. --- CreateAlarm - Creates an alarm. -AlarmType CreateAlarm(CHAR *name, - CounterType cntr, - UINT action, - ULONG events, - TaskType task, - void (*callback)(), - UINT Startup, TickType Alarmtime, +AlarmType CreateAlarm(CHAR *name, + CounterType cntr, + UINT action, + ULONG events, + TaskType task, + void (*callback)(), + UINT Startup, TickType Alarmtime, TickType Cycle); diff --git a/utility/rtos_compatibility_layers/OSEK/tx_osek.c b/utility/rtos_compatibility_layers/OSEK/tx_osek.c index bf5f482c..fe778f32 100644 --- a/utility/rtos_compatibility_layers/OSEK/tx_osek.c +++ b/utility/rtos_compatibility_layers/OSEK/tx_osek.c @@ -1,10 +1,11 @@ /*************************************************************************** - * Copyright (c) 2024 Microsoft Corporation - * + * Copyright (c) 2024 Microsoft Corporation + * Copyright (c) 2026-present Eclipse ThreadX contributors + * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. - * + * * SPDX-License-Identifier: MIT **************************************************************************/ @@ -268,12 +269,6 @@ static StatusType ActivateISR(ISRType ISRID); /* */ /* Application */ /* */ -/* RELEASE HISTORY */ -/* */ -/* DATE NAME DESCRIPTION */ -/* */ -/* 06-02-2021 William E. Lamie Initial Version 6.1.7 */ -/* */ /**************************************************************************/ void StartOS(StatusType os_mode) { |
