1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

133 Commits

Author SHA1 Message Date
f9f6adb48d core: clist: make singly linked 2016-03-30 00:27:49 +02:00
DipSwitch
0bb4748a94 core: Fix/refactor function naming in core/incude/irq.h 2016-03-20 16:47:34 +01:00
2b010b5337 core: rename tcb_t -> thread_t, move into thread.h 2016-03-05 18:20:17 +01:00
9082273746 core: header cleanup 2016-02-28 22:46:28 +01:00
085383bfae core: remove hwtimer, switch schedstatistics to xtimer 2015-09-16 10:58:51 +02:00
Joakim Gebart
555085acdc core/sched: Add missing inttypes.h include when debugging. 2015-07-07 00:53:26 +02:00
Joakim Gebart
13832d8e62 everything: Remove filename from @file Doxygen command 2015-05-22 07:34:41 +02:00
c944d54171 core: log: introduce logging API 2015-05-17 21:49:22 +02:00
René Kijewski
310ea35018 Don't evaluate inISR() if not needed 2014-12-11 17:39:17 +01:00
René Kijewski
370f926bad core: sched_switch() switch if not on runqueue
Fixes #1935.

`sched_switch()` should not only switch if the other priority is higher,
but also if the current thread was moved from the runqueue.
2014-12-11 17:39:17 +01:00
Ludwig Ortmann
86189d600e core: remove remaining dINT occurences 2014-12-04 17:17:24 +01:00
Ludwig Ortmann
e4fec18bdc core/sched: unify DEBUG text syntax, nomenclature 2014-11-11 17:55:09 +01:00
René Kijewski
12d157247c core: sched.c did not compile with DEBUG=1 2014-11-07 12:45:12 +01:00
feb550f17a Merge pull request #1885 from OlegHahm/thread_yield_higher_cleanup
core: thread_yield_higher cleanup
2014-10-30 23:22:27 +01:00
René Kijewski
9ddbf57709 core: refactor sched_run
`sched_run()` was cluttered. Many individual changes were done without a
proper refactoring.
2014-10-30 21:00:09 +01:00
Oleg Hahm
93ac114bc3 core: move thread_yield*() to thread.[ch]
Although it might conceptionally rather belong to the scheduler, the
yield functions are prefixed with thread_ and thus, belong there.
2014-10-28 00:56:37 +01:00
Oleg Hahm
6f53cd484d core: make sched_runqueue public
Reverting b604832, because thread_yield() needs to access this
information.
2014-10-28 00:56:14 +01:00
René Kijewski
677d690e2b core: introduce thread_yield_higher(), yield less
Fixes #1708.

Currently involuntary preemption causes the current thread not only to
yield for a higher prioritized thread, but all other threads of its own
priority class, too.

This PR adds the function `thread_yield_higher()`, which will yield the
current thread in favor of higher prioritized functions, but not for
threads of its own priority class.

Boards now need to implement `thread_yield_higher()` instead of
`thread_yield()`, but `COREIF_NG` boards are not affected in any way.

`thread_yield()` retains its old meaning: yield for every thread that
has the same or a higher priority.

This PR does not touch the occurrences of `thread_yield()` in the periph
drivers, because the author of this PR did not look into the logic of
the various driver implementations.
2014-10-24 00:09:56 +02:00
René Kijewski
c0ce346a12 cppcheck: don't needlessly assign sched_active_pid 2014-10-23 20:50:31 +02:00
René Kijewski
b604832777 core: make sched_runqueues static
PR #1000 overlooked to rename `runqueues` into `sched_runqueues` in
 `sched.h`. This shows that the variable is not used outside of
 `sched.c`.

 As the list should not be accessed outside of the scheduler, so it
 can be `static`.
2014-10-22 16:55:50 +02:00
René Kijewski
1df0b5644a core: sched_switch only switch for higher priority
sched_switch() is called by some library functions when a call unblocks
another thread. Then it needs to be tested if the current thread should
be preempted for the newly runnable thread.

A non-volutarily yield should only happen if the unblocked thread has a
_higher_ priority than the current thread. The current implementation,
which tests if the other thread has the same or a higher priority, does
not fit the documentation.
2014-09-25 10:16:33 +02:00
003dd1969c Merge pull request #1566 from Kijewski/undef_is_null
core: let PIDs begin with 1
2014-08-22 00:43:04 +02:00
René Kijewski
a5c9d4572d core: clist without explicit thread
Right now the core component `clist` is a generic cyclic doubly-linked list.
In the core it is used in `tcb_t::rq_entry`.
Further it is used `net_if.c`.

This commit removes the member `clist_node_t::data` which stored the
pointer to the `tcb_t` instance of which the clist is already a member.
The needless member added `sizeof (int)` bytes to every instance of
`tcb_t`.

In `net_if.c` the clist was used in a type-punned way, so that the
change won't affect it.
2014-08-21 21:10:04 +02:00
René Kijewski
2cb4166c3e all over the place: use sched_active_pid
In many places we needlessly use `sched_active_thread->pid` whilst we
already have `sched_active_pid` with the same value, and one less
indirection.

`thread_getpid()` is made `static inline` so that there is no penalty in
using this function over accessing `sched_active_pid` directly.
2014-08-17 21:04:25 +02:00
René Kijewski
427a5fbaef core: let valid PIDs start with 1 2014-08-17 19:51:03 +02:00
Oleg Hahm
c2b0423918 core: renamed KERNEL_PID_NULL to KERNEL_PID_UNDEF
As @authmillenon pointed out the "null" in the old name is somewhat
misleading, since the actual value is -1.
2014-08-07 16:31:27 +02:00
Oleg Hahm
983d056c75 core: harmonizes the data type for the process ID
Instead of using differing integer types use kernel_pid_t for process
identifier. This type is introduced in a new header file to avoid
circular dependencies.
2014-08-01 12:02:54 +02:00
Ludwig Ortmann
3ca4f18479 doc: use lgplv2.1-short license header instead of lgpl-short-riot 2014-07-31 22:57:20 +02:00
Ludwig Ortmann
b6846e31fc doc: fix most occurences of FU as an author
.. but only if there are other authors as well
2014-07-29 17:23:11 +02:00
Ludwig Ortmann
a585eaf752 core/sched: remove MODULE_NSS helpers (API CHANGE)
remove thread_getlastpid and last_pid from the API, it is unused
2014-07-12 07:30:31 +02:00
Ludwig Ortmann
147c285365 core/sched: fix pid/tcb & refactor SCHEDSTATISTICS
pid and tcb_t were compared instead of pid and pid

SCHEDSTATISTICS:
- reduce hwtimer_now calls
- dont use thread_last_pid anymore
- increase readability
2014-07-12 07:29:52 +02:00
Ludwig Ortmann
9cabdb3043 core/sched: clean up
- remove stray spaces
- remove TODOs:
    - MODULE_HWTIMER is not a module anymore
    - checking for NULL is necessary, at least without API changes:
      `sched_task_exit` sets `sched_active_thread` to `NULL`, then exits,
      afterwards `cpu_switch_context_exit` calls `sched_run`
2014-07-12 06:51:51 +02:00
René Kijewski
a21c3f45bc core: remove unnecessary tests in sched.c
The scheduling gets activated by `kernel_init()` calling
`cpu_switch_context_exit()`. Before this `sched_run()` won't be called.
When it gets called, at least the main thread and the idle thread are
spawned. The idle thread won't die / get killed. So there always is at
least one thread in `runqueue_bitcache`.

Closes #19.
2014-06-10 17:04:39 +02:00
René Kijewski
05a4bf7f04 Merge pull request #1057 from Kijewski/sched_switch-current_prio
core: imply current_prio in `sched_switch()`
2014-06-03 15:59:23 +02:00
Martin Lenders
2362623490 Fix trailing whitespaces
Fixes #1138
2014-05-26 14:54:23 +02:00
René Kijewski
a6fd5bff92 core: imply current_prio in sched_switch()
There is no need to supply the current priority to `sched_switch()`,
when this function can easily tell the value of
`active_thread->priority` itself.
2014-05-24 16:48:35 +02:00
Oleg Hahm
ef5ec344fd core: prefix API functions correctly
Also changed names for bitarithm functions and rename thread_pid to sched_active_pid.
2014-05-18 08:53:20 +02:00
Oleg Hahm
5d7f7dd686 Merge pull request #1079 from BytesGalore/add_NORETURNs
core: and cpu: Added NORETURN to functions that should not return
2014-05-16 00:33:20 +02:00
René Kijewski
9a9caf2c68 Exterminate old-style function definitions 2014-05-12 21:57:09 +02:00
Hauke Petersen
608afc4777 Introduced a cleaned-up cpu/core interface
- Included a collection of cpu-dependent headers in core/include/arch
- Extracted all interfaces that need to be implemented for a cpu
- Created a mapping between those interfaces and the old ones
- added flag for disabling arch interface
- added missing state to lpm_arch interface
- added arch interface for reboot
- fixed newline issues that were pointed out
- documentation fixes to cpu-core interface
2014-05-09 16:01:13 +02:00
Martin
4e73169b38 added NORETURNs to functions that should not return
and added `UNREACHABLE();` to hint the compiler unreachable lines

added right signature for first parameter of `thread_stack_init()`
added `UNREACHABLE();` macro to `cpu/lpc1768/atom.c` and `cpu/msp430-common/cpu.c`
2014-05-08 06:25:25 +02:00
Oleg Hahm
25a2122f83 core: documentation: updated, improved, and completed doxygen comments 2014-05-05 14:09:01 +02:00
René Kijewski
83988b2d03 Merge pull request #725 from kaspar030/optimize_thread_status_usage
core: sched: thread: optimize thread status field usage
2014-03-05 17:30:31 +01:00
Oleg Hahm
32f918abe8 simplified sched_switch
sched_switch can check ISR itself.
2014-02-25 09:47:58 +01:00
Oleg Hahm
24f5ec929c removed duplicate inISR prototype 2014-02-24 18:42:13 +01:00
36981c95b9 core: sched: thread: optimize thread status field usage
see PR #716 for discussion
2014-02-17 12:28:54 +01:00
Christian Mehlis
3dce0cbb97 Merge pull request #662 from Kijewski/remove-sched_init
Do not zero out sched_threads needlessly
2014-02-16 11:37:05 +01:00
Ludwig Ortmann
2525920426 remove trailing whitespace and newlines 2014-02-11 18:45:06 +01:00
René Kijewski
7e685d6b36 Do not zero out sched_threads needlessly
The function sched_init() zeroes out sched_threads needlessly. All
static variables can be assumed to be initialized with zero, anyways.
The C standard mandates it, and all at other places in the code it is
assumed.
2014-02-11 16:47:00 +01:00
56ee585c81 update Kaspar's email address
kaspar.schleiser@fu-berlin.de is obsolete.
(2nd try, first try was overwritten by some overzealous documenter)
2014-01-28 11:53:19 +01:00
Oleg Hahm
903ec54a43 making include directives consistent 2013-12-19 15:31:37 +01:00
Oleg Hahm
9eb1daf31e added thread.h include (necessary since 227c847135) 2013-12-19 12:16:35 +01:00
Hauke Petersen
edcabf7cb6 Fixed a lot of comments by removing tabs and correcting format. 2013-12-16 14:00:33 +01:00
Hauke Petersen
3785fe956b Fixed doxygen comments, focused on file headers and group definitions 2013-12-16 14:00:24 +01:00
f85adf608f change my email address
kaspar.schleiser@fu-berlin.de will be obsoleted soon. Replace it with
kaspar@schleiser.de, which will (hopefully) stay.
2013-12-04 15:09:56 +01:00
Ludwig Ortmann
d6c213fb47 fix grammar in license header 2013-11-23 13:11:56 +01:00
Ludwig Ortmann
d06e0d8717 rename runtime to reflect the unit of measurement 2013-11-18 12:14:43 +01:00
Ludwig Ortmann
ffd8088d1d proper inttype runtime, declare to import
define runtime long as hwtimer_now() uses long
import hwtimer.h instead of declaring hwtimer_now()
2013-11-16 19:26:02 +01:00
Oleg Hahm
9fac7c3f5f Merge pull request #134 from OlegHahm/sched_fixes
Scheduler callback
2013-08-14 04:55:27 -07:00
Oleg Hahm
1709fa600c re-added the scheduler callback (the actual call was missing) 2013-08-14 13:53:49 +02:00
Oleg Hahm
932c626c6b moved prototype for sched_register_cb() from C file to header 2013-08-14 13:09:43 +02:00
Oleg Hahm
b6fe284331 fix priority comparison in sched_switch 2013-08-12 19:27:04 +02:00
Oleg Hahm
599e266b55 Revert "removed redefined ENABLE_DEBUG"
This reverts commit 69c526f44d.

Instead of removing ENABLE_DEBUG, define it as zero and replacing the
ifdef preprocessor commands by a simple #if
2013-07-24 00:38:43 +02:00
Christian Mehlis
837bad38eb rename kernel_intern.h
german "intern" to english "internal"
2013-07-16 16:36:37 +02:00
Christian Mehlis
69c526f44d removed redefined ENABLE_DEBUG 2013-07-16 15:27:19 +02:00
Oliver Hahm
c8bee9e554 fixed coding style (space after most keywords) 2013-06-24 22:37:35 +02:00
Oliver Hahm
ffeb6f8523 fixed coding conventions (correctly this time) 2013-06-20 18:18:29 +02:00
Oliver Hahm
0d6d8390c0 * updated copyright and license headers in various files 2013-06-18 17:21:38 +02:00
Christian Mehlis
42063530c0 clarify: while loop without body is correct here 2013-06-09 17:52:02 +02:00
Oleg Hahm
e8af0c42c3 * created prototype for cpu_switch_context_exit() 2013-03-27 14:53:38 +01:00
Oleg Hahm
2277b366b2 * removed outdated occurrences of (u|µ)kleos and FeuerWare 2013-03-07 20:51:26 +01:00
Oleg Hahm
48e5df9bef * some clean up
* assert active_thread pointer before saving it
2013-02-28 18:11:20 +01:00
Oliver Hahm
92281753ad Merge branch 'stable'
Conflicts:
	core/sched.c
	sys/auto_init.c
2012-11-05 19:15:57 -05:00
Oliver Hahm
a20088f6e8 [core sched]
* fixed thread_getlastpid()
* enable interrupts again in thread_sleep() to avoid getting stuck w/
    disabled interrupts

[cpu lpc2387]
* added hwtimer as dependency for MCI driver

[project test_*]

* fixed some expect scripts
2012-11-01 13:18:17 +01:00
Oliver Hahm
2109f7dc86 [core thread]
* added thread_getlastpid
2012-10-18 18:08:40 +02:00
Oliver Hahm
e89dc07a05 core/ 2011-12-28 11:41:33 +01:00
Oliver Hahm
5a0e412249 [core sched]
* removed declaration from header file
2011-06-24 17:53:09 +02:00
Stephan Zeisberg
5abef6daf2 changed types irq_callback, hashtable, posix_io, s_display_flags, seq_buffer_entry, tcb, toprint to type_t" 2011-03-08 11:43:21 +01:00
0441c5a4a4 * some more mutex related changes 2010-11-11 11:22:45 +01:00
8b242c74a8 * mutex changes 2010-11-11 09:55:08 +01:00
Oleg
416029d2c0 * changed default project from "hello-world" to "default"
* increased main priority to the half of maximum priority
* introduced define for minimum stack size
* decreased stack size for uart0 thread
* merged commands for rtc shell module to one command (date)
* cleanup of header includes
2010-11-05 19:33:45 +01:00
11bc939d67 * merge fixes 2010-10-28 11:31:19 +02:00
1e238e4131 * massive name changes 2010-10-28 11:29:03 +02:00