summaryrefslogtreecommitdiff
path: root/firmware/thread.c
AgeCommit message (Collapse)Author
2012-02-04Use commit_dcache() instead of commit_discard_idcache() where possibleBoris Gjenero
- PCM playback DMA doesn't need the discard. Only recording DMA would need it. - When creating threads for another core, the core creating the thread only needs to commit. The discard on the other core is handled elsewhere. Change-Id: I864a0777e22f221a66218efd2c02ff3ad3889736
2012-01-26Fix FS#12559: sigaltstack threads fortify failureBoris Gjenero
Ubuntu defines _FORTIFY_SOURCE=2, which causes glibc longjmp() to check sp when gcc optimization is enabled. The check does not allow longjmp() to be used for switching threads and results in a "longjmp causes uninitialized stack frame" error. This disables the check. Change-Id: Idb8877b43ce711df880ca88875ba5477445a577a
2012-01-22Create fimrware/asm directory for assembly optimized stuff.Thomas Martitz
This dir is suitable for stuff that doesn't fit the target tree, e.g. because it also builds on hosted or otherwise. It also has a generic subfolder for fallback C implementations so that not all archs need to provide asm files. SOURCES should only contain "foo.c" where foo.c includes the specific <arch>/foo.c files from the subdirs using the preprocessor. This way automatic selection of asm versions or generic C verion is possible. For the start, the thread support files are moved, since ASM threads can be used on hosted platforms as well. Since core_sleep() remains platform specific it's moved to the corresponding system.h headers. Change-Id: Iebff272f3407a6eaafeb7656ceb0ae9eca3f7cb9
2011-12-17Commit to certain names for cache coherency APIs and discard the aliases.Michael Sevakis
Wouldn't surprise me a bit to get some non-green. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31339 a1c6a512-1295-4272-9138-f99709370657
2011-12-09Convert remaining __attribute__((noreturn)) to NORETURN_ATTR.Boris Gjenero
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31189 a1c6a512-1295-4272-9138-f99709370657
2011-12-09Introduce USED_ATTR wrapper for __attribute__((used)).Boris Gjenero
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31188 a1c6a512-1295-4272-9138-f99709370657
2011-11-29FS#12412 : Delete old buffer allocation code which has been replaced by ↵Boris Gjenero
core_alloc, and move buffer setup code to core_alloc.c git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31088 a1c6a512-1295-4272-9138-f99709370657
2011-03-05Change the thread api a bit.Thomas Martitz
* Remove THREAD_ID_CURRENT macro in favor of a thread_self() function, this allows thread functions to be simpler. * thread_self_entry() shortcut for kernel.c. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29521 a1c6a512-1295-4272-9138-f99709370657
2011-02-19Cleanup preprocessor around corelock usage and move its definition outside ↵Thomas Martitz
#ifdef ASSEMBLER_THREADS git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29330 a1c6a512-1295-4272-9138-f99709370657
2011-02-18Fix yellows and checkwps.Thomas Martitz
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29328 a1c6a512-1295-4272-9138-f99709370657
2011-02-18Implement cooperative threads on hosted platforms using C code.Thomas Martitz
This replaces SDL threads with real cooperative threads, which are less cpu intensive and allow priority scheduling. The backend for context switching is dependant on the host (sigaltstack/longjmp on Unix, Fibers on Windows). configure has options to force or disallow SDL threads. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29327 a1c6a512-1295-4272-9138-f99709370657
2010-12-29Return thread ID as a string for name when a thread isn't named or name ↵Michael Sevakis
cannot be used, as comment says, not slot pointer. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28928 a1c6a512-1295-4272-9138-f99709370657
2010-12-28Comment about thread_id_entry missleading and wrong. Fix the dumb.Michael Sevakis
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28918 a1c6a512-1295-4272-9138-f99709370657
2010-12-27Move codfire inline asm into cpu specific file.Nils Wallménius
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28910 a1c6a512-1295-4272-9138-f99709370657
2010-12-27Fix profiling on coldfire with newer Gcc.Nils Wallménius
In switch_thread, make the call to profile_thread_stopped from an inline asm block to make sure the sp is pointing to the right place before storing the context. This apparently worked by luck with the old Gcc. The workaround used for coldfire in the codeclib's __cyg_profile_func_enter does not work with newer gcc, however the workaround isn't needed for those so enable it only for coldfire gcc version < 4. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28908 a1c6a512-1295-4272-9138-f99709370657
2010-09-26Add optional (define BUFFER_ALLOC_DEBUG to enable it) code to check for code ↵Frank Gevaerts
overflowing buffer_alloc()-allocated buffers. Also add a panicf() if buffer_alloc() doesn't have enough space left to allocate a requested buffer git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28173 a1c6a512-1295-4272-9138-f99709370657
2010-08-02Rockbox as an application: Commit current Android port progress.Thomas Martitz
General state is: Rockbox is usable (plays music, saves configuration, touchscreen works too). Problems: - Playing music in the background (i.e. when switching to another app) doesn't work reliably, but I'm working on that now. - no cabbiev2 (only some preliminary files for it), no other default theme. - screen flickers sometimes if the updates are too frequent - no multi screen apk/package - strange behavior when a phone call comes in The java files (and the eclipse project) resides in android/, which is also supposed to be the build folder. I've put a small README in there for instructions. There are some steps needed after the make part, which are described there, and which eclipse mostly handles. But there ought to be some script/makefile rules which do that instead in the future. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27668 a1c6a512-1295-4272-9138-f99709370657
2010-06-18For multiprocessor targets, do the thread_exit routine such that we don't ↵Michael Sevakis
need to rely on the compiler's good graces to have stack switching be reliable. Only needs a few asm instructions. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26906 a1c6a512-1295-4272-9138-f99709370657
2010-06-17Fix red. Need 'inline' with 'always_inline'.Michael Sevakis
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26899 a1c6a512-1295-4272-9138-f99709370657
2010-06-17Switch iPod 3G to use EABI toolchain. Make necessary threading changes to ↵Michael Sevakis
avoid use of stack after switching to idle stack. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26898 a1c6a512-1295-4272-9138-f99709370657
2010-06-02Threading: Split processor support code into respective target files. C ↵Michael Sevakis
files from /target/xxx are included into thread.c because of essential inlining and files are code, not declarations. Copyrights in each new file go to whoever implemented the first functional support. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26479 a1c6a512-1295-4272-9138-f99709370657
2010-05-15i.MX31: Issue some NOP's immediately after MCR WFI to prevent premature ↵Michael Sevakis
execution of subsequent code. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26058 a1c6a512-1295-4272-9138-f99709370657
2010-05-06Move c/h files implementing/defining standard library stuff into a new libc ↵Thomas Martitz
directory, also standard'ify some parts of the code base (almost entirely #include fixes). This is to a) to cleanup firmware/common and firmware/include a bit, but also b) for Rockbox as an application which should use the host system's c library and headers, separating makes it easy to exclude our files from the build. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25850 a1c6a512-1295-4272-9138-f99709370657
2010-04-18Fix red from r25666 (forgot to use macro to not use core variable on single ↵Michael Sevakis
core), update a comment and remove core check for setting THREAD_SWITCH upon wakeup which is irrelevant to the idea behind the change. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25667 a1c6a512-1295-4272-9138-f99709370657
2010-04-18Threads of PRIORITY_REALTIME and above are no longer subject to being ↵Michael Sevakis
switched away based upon aging of lower priority threads. Now, recommend a thread switch in wakeup_thread of any thread of higher priority is ready to run. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25666 a1c6a512-1295-4272-9138-f99709370657
2010-04-16Use API call instead of accessing a global variable for receiving the ↵Thomas Martitz
current thread. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25657 a1c6a512-1295-4272-9138-f99709370657
2010-04-03Add IO priority handling. Currently all IO has equal priority, except the ↵Frank Gevaerts
dircache scanning thread which is lower. This fixes the slow boot problem for me, with the added benefit that actual audio playback also starts faster. Lots of the changes are due to changing storage_(read|write)sectors() from macros to wrapper functions. This means that they have to be called with IF_MD2(drive,) again. Flyspray: FS#11167 Author: Frank Gevaerts git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25459 a1c6a512-1295-4272-9138-f99709370657
2010-03-03FS#10756 - Free unused init codeThomas Martitz
Introduce a new .init section for initialisation code, so that it can be copied to an area which is later overwritten before calling. The stack/bss can then overwrite that code, effectively freeing the code size that the initialisation routines need. Gives a few kB ram usage back. Only implemented for PP and as3525 so far. More targets could be added, as well as more functions. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25013 a1c6a512-1295-4272-9138-f99709370657
2010-02-22as3525v2: core_sleep()Rafaël Carré
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24839 a1c6a512-1295-4272-9138-f99709370657
2009-11-20Fix warning on new gcc for checking value or truth of undefined _WIN32 and MIPS.Andrew Mahone
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23670 a1c6a512-1295-4272-9138-f99709370657
2009-10-10"Implement" S5L8701 core_sleepMichael Sparmann
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23081 a1c6a512-1295-4272-9138-f99709370657
2009-07-12* Fix overlooked r12 usage possibility in mpegplayer ARM idct Jens Arnold
* ARM dualcore: Don't save r12 in switch_thread_core() git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21830 a1c6a512-1295-4272-9138-f99709370657
2009-05-06MIPS: don't save gp register when switching threadsMaurus Cuelenaere
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20863 a1c6a512-1295-4272-9138-f99709370657
2009-04-08Jz4740:Maurus Cuelenaere
* Optimize & cleanup thread handling a bit * Unify exception return and fix a potential bug git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20659 a1c6a512-1295-4272-9138-f99709370657
2009-02-11s3c2440 can use the generic ARM WFI which is much simpler. If there's any ↵Michael Sevakis
advantage to setting the IDLE bit for power consumption, it's possible to combine its use with the old core_sleep instead of using the loop waiting for idle to kick in. For now, go basic. Let GCC choose the register for MCR instead of forcing it to r0. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19978 a1c6a512-1295-4272-9138-f99709370657
2009-02-11Make basic cache functions into calls, and get rid of ↵Michael Sevakis
CACHE_FUNCTION_WRAPPERS and CACHE_FUNCTIONS_AS_CALL macros. Rename flush/invalidate_icache to cpucache_flush/invalidate. They're inlined only if an implementation isn't provided by defining HAVE_CPUCACHE_FLUSH/INVALIDATE. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19971 a1c6a512-1295-4272-9138-f99709370657
2008-12-19Enable sleep() on MIPS targetsMaurus Cuelenaere
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19493 a1c6a512-1295-4272-9138-f99709370657
2008-12-14Place some LIKELY and UNLIKELY hints in kernel where I can definitively say ↵Michael Sevakis
anything about it and where it could make a small difference. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19433 a1c6a512-1295-4272-9138-f99709370657
2008-12-10Fix a wrong comment in thread.c and mention an alternative approach to ↵Michael Sevakis
inits. Fix a couple headers' Id fields while at it. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19386 a1c6a512-1295-4272-9138-f99709370657
2008-12-10Use cookies for thread identification instead of pointers directly which ↵Michael Sevakis
gives a buffer against wrongly identifying a thread when the slot is recycled (which has been nagging me for awhile). A slot gets 255 uses before it repeats. Everything gets incompatible so a full update is required. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19377 a1c6a512-1295-4272-9138-f99709370657
2008-11-09core_sleep(): only write once the same implementation, and add as3525 to the ↵Rafaël Carré
list git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19057 a1c6a512-1295-4272-9138-f99709370657
2008-11-04Onda VX747:Maurus Cuelenaere
clean up's, bug fixes and reworks git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19007 a1c6a512-1295-4272-9138-f99709370657
2008-10-07Fix TABs and get rid of HAVE_BUTTON_HOLDMaurus Cuelenaere
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18737 a1c6a512-1295-4272-9138-f99709370657
2008-09-16Commit fs#9404 (iAudio 7 updates by vitja). Also fixes play/pause behaviour ↵Rob Purchase
on D2. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18528 a1c6a512-1295-4272-9138-f99709370657
2008-09-14Forgot this..Maurus Cuelenaere
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18513 a1c6a512-1295-4272-9138-f99709370657
2008-09-14Onda VX747:Maurus Cuelenaere
* Get rid of bug when interrupts are enabled * Get threading to work (although with some weirdness) * Other fixes/optimizations git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18512 a1c6a512-1295-4272-9138-f99709370657
2008-08-06* Add basic (non-working) support for NAND flashMaurus Cuelenaere
* Add panicf() handling * Add not-yet-enabled dma acceleration * Other (minor) fixes git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18203 a1c6a512-1295-4272-9138-f99709370657
2008-07-171) Set svn:keywords where they should've been setMaurus Cuelenaere
2) Onda VX747 specific changes git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18080 a1c6a512-1295-4272-9138-f99709370657
2008-07-14Add preliminary support for the Onda VX747 (MIPS target)Maurus Cuelenaere
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18032 a1c6a512-1295-4272-9138-f99709370657
2008-06-28Updated our source code header to explicitly mention that we are GPL v2 orDaniel Stenberg
later. We still need to hunt down snippets used that are not. 1324 modified files... http://www.rockbox.org/mail/archive/rockbox-dev-archive-2008-06/0060.shtml git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17847 a1c6a512-1295-4272-9138-f99709370657