summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Update company nameSebastian Huber2023-05-2054-54/+54
| | | | | The embedded brains GmbH & Co. KG is the legal successor of embedded brains GmbH.
* cpukit/rtems/src/partcreate.c: Correct style by adding bracesJoel Sherrill2023-01-261-3/+6
|
* rtems: Add rtems_clock_get_ticks_since_boot() functionSebastian Huber2022-09-231-0/+53
| | | | | This function was declared, however, a definition was missing. Add a validation test for it.
* rtems: Fix typo in rtems_build_name() definitionSebastian Huber2022-09-221-1/+1
|
* score: Use priority inheritance for thread joinSebastian Huber2022-07-281-8/+9
| | | | | | | | | | | | | | | | | | | | | Threads may join the thread termination of another thread using the pthread_join() or rtems_task_delete() directives. The thread cancel operation used a special case priority boosting mechanism implemented by _Thread_Raise_real_priority(). The problem was that this approach * is not transitive, * does not account for priority adjustments of the calling task while waiting for the join, * does not support clustered scheduling, and * does not detect deadlocks. All these problems are fixed by using a priority inheritance thread queue for the join operation. Close #4679.
* score: Remove PRIORITY_PSEUDO_ISR thread prioritySebastian Huber2022-07-261-1/+1
| | | | | | | | | | | | | | | The uniprocessor schedulers had some special case logic for the PRIORITY_PSEUDO_ISR priority. Tasks with a priority of PRIORITY_PSEUDO_ISR were allowed to preempt a not preemptible task. If other higher priority task are made ready while a PRIORITY_PSEUDO_ISR task preempts a not preemptible task, then the other tasks run before the not preemptible task. This made the RTEMS_NO_PREEMPT mode ineffective. Remove the PRIORITY_PSEUDO_ISR special case logic. This simplifies the uniprocessor schedulers. Move the uniprocessor-specific scheduler support to the new header file <rtems/score/scheduleruniimpl.h>. Close #2365.
* rtems: Simplify rtems_scheduler_ident()Sebastian Huber2022-07-071-16/+11
| | | | Use early returns to simplify rtems_scheduler_ident().
* rtems: Relicense rtemsmaxprio.cSebastian Huber2022-05-181-4/+23
| | | | | | Change license to BSD-2-Clause according to file history. Update #3053.
* cpukit/: Scripted embedded brains header file clean upJoel Sherrill2022-03-1019-114/+0
| | | | Updates #4625.
* cpukit/rtems/src/[s-z]*.c: Change license to BSD-2Joel Sherrill2022-02-2853-159/+1166
| | | | Updates #3053.
* cpukit/rtems/src/[a-r]*.c: Change license to BSD-2Joel Sherrill2022-02-2878-234/+1716
| | | | Updates #3053.
* rtems: Move scheduler directives to own headerSebastian Huber2021-12-0211-22/+22
| | | | | | Move all rtems_scheduler_* directives to the new header file <rtems/rtems/scheduler.h>. Add a Scheduler Manager API and implementation group.
* score: Simplify thread wait state handlingSebastian Huber2021-11-233-11/+7
| | | | | | | | | | Remove the THREAD_WAIT_STATE_READY_AGAIN and simply use the initial value to indicate that a thread does not wait on something. Rename THREAD_WAIT_FLAGS_INITIAL to THREAD_WAIT_STATE_READY. This change is necessary so that _Thread_Continue() can be called for threads which never waited on something (for example dormant threads). Update #4546.
* rtems: Fix rtems_scheduler_remove_processor()Sebastian Huber2021-11-231-2/+48
| | | | | | | | | | | | | | | | | | Return an error status for the following error condition in rtems_scheduler_remove_processor(): While an attempt is made to remove a processor from a scheduler, while the processor is the only processor owned by the scheduler, if a thread exists which uses the scheduler as a helping scheduler, then the processor shall not be removed. The reason is that ask for help requests and withdraw node requests are processed asynchronously in any order. An ask for help request carried out on a scheduler without a processor is undefined behaviour. Update error status description. Update #4544.
* rtems: Add external functionsSebastian Huber2021-11-182-0/+108
| | | | | | These external functions rtems_scheduler_get_processor() and rtems_scheduler_get_processor_maximum() which may be used by bindings for languages other than C/C++.
* rtems: Use RTEMS_WHO_AM_I for rtems_task_ident()Sebastian Huber2021-11-181-1/+2
|
* rtems: Simplify rtems_semaphore_set_priority()Sebastian Huber2021-11-151-25/+22
| | | | | Do not write to the object referenced by old_priority in error paths. This is in line with other directives.
* score: Fix _CORE_ceiling_mutex_Set_priority()Sebastian Huber2021-11-151-2/+1
| | | | | | | We have to use a second thread queue context to acquire and release the thread wait lock. Close #4356.
* score: Introduce CPU budget operationsSebastian Huber2021-11-153-18/+18
| | | | | | | | | | | | | | This patch set replaces the CPU budget algorithm enumeration with a set of CPU budget operations which implement a particular CPU budget algorithm. This helps to hide the CPU budget algorithm implementation details from the general thread handling. The CPU budget callouts are turned into CPU budget operations. This slightly reduces the size of the thread control block. All schedulers used the default scheduler tick implementation. The tick scheduler operation is removed and the CPU budget operations are directly used in _Watchdog_Tick() if the executing thread uses a CPU budget algorithm. This is performance improvement for all threads which do not use a CPU budget algorithm (default behaviour).
* rtems: Fix rate monotonic statisticsSebastian Huber2021-10-252-35/+14
| | | | | | | | | | | | | | | The rate monotonic period statistics were affected by rtems_cpu_usage_reset(). The logic to detect and work around a CPU usage reset was broken. The Thread_Contol::cpu_time_used is changed to contain the processor time used throughout the entire lifetime of the thread. The new member Thread_Contol::cpu_time_used_at_last_reset is added to contain the processor time used at the time of the last reset through rtems_cpu_usage_reset(). This decouples the resets of the CPU usage and the rate monotonic period statistics. Update #4528.
* rtems: Set postponed jobs in rate-monotonic cancelSebastian Huber2021-10-062-1/+2
| | | | | | | | Set the postponed jobs count to zero in rtems_rate_monotonic_cancel() so that rtems_rate_monotonic_get_status() returns a consistent status for inactive periods. Update #4511.
* rtems: Adjust parameter namesSebastian Huber2021-09-302-13/+13
| | | | | | | Adjust parameter names to match with the declaration. This avoid using a name reserved by the C standard: "time". Close #4035.
* rtems: Justify integer conversionsSebastian Huber2021-09-301-3/+8
| | | | Close #2548.
* rtems: Initialize count of postponed jobsSebastian Huber2021-09-091-0/+1
| | | | | | | | | The rtems_rate_monotonic_get_status() directive returns an arbitrary number for the count of postponed jobs if it is called for a newly created period object. Set the count of postponed jobs to zero during object creation. Close #4511.
* score: Change TOD_LATEST_YEAR to 2099Sebastian Huber2021-09-063-39/+18
| | | | | | | | This simplifies the implementation a bit. Declare _TOD_Days_to_date[] in <rtems/score/todimpl.h>. Make _TOD_Days_per_month[] and _TOD_Days_since_last_leap_year[] static. Update #4338.
* score: Simplify _TOD_Validate()Sebastian Huber2021-09-061-9/+25
| | | | Split up the multi line if statement into smaller parts.
* rtems: Fix partitions with RTEMS_MULIPROCESSINGSebastian Huber2021-08-311-1/+1
| | | | Replace call to removed _Partition_Free() with a call to _Objects_Free().
* score: Replace priority prepend it with an enumSebastian Huber2021-08-121-1/+1
| | | | | | | | Use the new Priority_Group_order enum instead of a boolean to indicated if a priority should be inserted as the first or last node into its priority group. This makes the code more expressive. It is also a bit more efficient since a branch in _Scheduler_Node_set_priority() is avoided and a simple bitwise or operation can be used.
* rtems: Fix rtems_partition_return_buffer()Sebastian Huber2021-08-122-9/+16
| | | | | | | | The rtems_partition_return_buffer() wrongly accepted which were exactly at the buffer area end. Use the buffer area limit address for the range checking. Close #4490.
* score: Simplify calling _Thread_Exit()Sebastian Huber2021-05-262-25/+2
| | | | | Move common code into _Thread_Exit(). This enables a tail call optimization in most cases.
* rtems: Return RTEMS_CALLED_FROM_ISRSebastian Huber2021-05-261-5/+15
| | | | | | | If rtems_task_delete() is called from within interrupt context, then return RTEMS_CALLED_FROM_ISR. This makes the behaviour predictable. Update #4414.
* rtems: Fix task restart within interrupt contextSebastian Huber2021-05-141-7/+1
| | | | | | | | | | | rtems_task_restart() may be called from within interrupt context. So checking only that the thread to restart is equal to the executing thread is insufficient to determine a self restart. We have to also check that no ISR is in progress. Merge _Thread_Restart_other() and _Thread_Restart_self() into one _Thread_Restart() since they share a lot of common code. Close #4412.
* score: Return status in _Thread_Restart_other()Sebastian Huber2021-05-141-3/+4
| | | | This simplifies rtems_task_restart().
* rtems: Check entry point in rtems_task_start()Sebastian Huber2021-05-141-0/+4
| | | | Close #4410.
* rtems: Add TOD_Ticks_validationSebastian Huber2021-05-141-3/+5
| | | | | | Replace defines with an enum. Update #4406.
* rtems: Constify rtems_task_wake_when()Sebastian Huber2021-05-124-10/+7
| | | | | | | | | | | | | | | | Add a parameter to _TOD_Validate() to disable the validation of the ticks member. There are two reasons for this change. Firstly, in rtems_task_wake_when() was a double check for time_buffer == NULL (one in rtems_task_wake_when() and one in _TOD_Validate()). Secondly, the ticks member is ignored by rtems_task_wake_when(). This was done with a write of zero to the ticks member and thus a modification of the user-provided structure. Now the structure is no longer modified. Using a mask parameter is quite efficient. You just have to load an immediate value and there are no additional branches in _TOD_Validate(). Close #4406.
* rtems: Use rtems_clock_get_ticks_per_second()Sebastian Huber2021-05-121-2/+2
| | | | This avoids an integer division at runtime.
* _TOD_Validate(): Fix incorrect return codeFrank Kühndel2021-05-124-33/+44
| | | | | | | | | | | | | | | This patch fixes bug #4403. Directives * rtems_timer_fire_when() * rtems_timer_server_fire_when() * rtems_task_wake_when() are documented to return RTEMS_INVALID_ADDRESS when their time-of-day argument is NULL. But actually they return RTEMS_INVALID_CLOCK. To fix the issue this patch changes _TOD_Validate() to return a status code instead of just true/false. Close #4403
* rtems: Use _Objects_Free_nothing() for msg queuesSebastian Huber2021-05-111-1/+6
| | | | | | | | Use _Objects_Free_nothing() for rtems_message_queue_construct() to avoid unreachable code in _CORE_message_queue_Close() in case only user-provided message buffers are used. Update #4007.
* score: Rename _Stack_Free_nothing()Sebastian Huber2021-05-111-1/+1
| | | | | | | Rename _Stack_Free_nothing() in _Objects_Free_nothing() to make it reusable for the message queue buffers. Update #4007.
* rtems: rtems_scheduler_get_processor_set() statusSebastian Huber2021-05-061-1/+1
| | | | | | | | | In case the processor set is not large enough to contain the processor set owned by the scheduler return RTEMS_INVALID_SIZE instead of RTEMS_INVALID_NUMBER. This is more in line with other directives since the issue is related to the size of an object. Close #4401.
* rtems: rtems_scheduler_ident_by_processor_set()Sebastian Huber2021-05-061-0/+4
| | | | Check for a NULL processor set pointer.
* rtems: Use allocator mutex for timer serverSebastian Huber2021-05-041-4/+2
| | | | | | | The allocator mutex is recursive and already used for the task creation in rtems_timer_initiate_server(). Just use this mutex instead of the once mutex to serialize the initialization. This avoids a dependency on condition variables which are not used here.
* score: Add _Thread_Dispatch_direct_no_return()Sebastian Huber2021-05-021-1/+1
| | | | | | | | | | The __builtin_unreachable() cannot be used with current GCC versions to tell the compiler that a function does not return to the caller, see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99151 Add a no return variant of _Thread_Dispatch_direct() to avoid generation of dead code.
* Use alias for rtems_task_self() and pthread_self()Sebastian Huber2021-04-301-28/+0
| | | | This may reduce the code size a bit.
* Return status code for _Thread_Start()Sebastian Huber2021-04-271-3/+4
| | | | | This avoids having conditional statements to get the API-specific status code.
* Return status code for _Scheduler_Set_affinity()Sebastian Huber2021-04-271-3/+4
| | | | | This avoids having conditional statements to get the API-specific status code.
* Simplify get affinitiy directivesSebastian Huber2021-04-271-3/+0
| | | | | There is no need to disable thread dispatching to get the affinity of a task.
* Return status code for _Scheduler_Get_affinity()Sebastian Huber2021-04-271-3/+4
| | | | | This avoids having conditional statements to get the API-specific status code.
* rtems: Constify timer fire when directivesSebastian Huber2021-04-272-2/+2
| | | | Close #4392.