summaryrefslogtreecommitdiff
path: root/firmware/kernel.c
AgeCommit message (Collapse)Author
2014-03-03kernel: Break out kernel primitives into separate files and move to separate ↵Thomas Martitz
dir. No code changed, just shuffling stuff around. This should make it easier to build only select parts kernel and use different implementations. Change-Id: Ie1f00f93008833ce38419d760afd70062c5e22b5
2012-09-28kernel: Allow queue_wait_w_tmo() to be called with TIMEOUT_BLOCK.Thomas Martitz
Previously TIMEOUT_BLOCK would be handled the same as TIMEOUT_NOBLOCK, i.e. poll only without thread switch, which is rather unexpected from *_w_tmo() functions. No current code doesn't call it that way yet. Change-Id: I370ce0f752681122d197eadeee9ab17112647c20
2012-01-08AS3525v1/2: Enable nested handling of interruptsMichael Sevakis
Mostly for the sake of reducing latency for audio servicing where other service routines can take a long time to complete, leading to occasional drops of a few samples, especially in recording, where they are fairly frequent. One mystery that remains is GPIOA IRQ being interrupted causes strange undefined instruction exceptions, most easily produced on my Fuze V2 with a scrollwheel. Making GPIOA the top ISR for now, thus not interruptible, cures it. SVC mode is used during the actual calls. Hopefully the SVC stack size is sufficient. Prologue and epilogue code only uses the IRQ stack and is large enough. Any routine code that should not be interrupted should disable IRQ itself from here on in. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31642 a1c6a512-1295-4272-9138-f99709370657
2011-12-15Add comments source comments about the behavior of yield and sleep.Michael Sevakis
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31288 a1c6a512-1295-4272-9138-f99709370657
2011-07-19Fix "variable 'result' set but not used" warningFrank Gevaerts
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30172 a1c6a512-1295-4272-9138-f99709370657
2011-04-27Commit FS#12069 - Playback rework - first stages. Gives as thorough as ↵Michael Sevakis
possible a treatment of codec management, track change and metadata logic as possible while maintaining fairly narrow focus and not rewriting everything all at once. Please see the rockbox-dev mail archive on 2011-04-25 (Playback engine rework) for a more thorough manifest of what was addressed. Plugins and codecs become incompatible. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29785 a1c6a512-1295-4272-9138-f99709370657
2011-03-17No need to save irq again after thread wakeup in queue_wait(_w_tmo), just ↵Michael Sevakis
disable it. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29608 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-03-02Merge functionality of wakeups and semaphores-- fewer APIs and object types. ↵Michael Sevakis
semaphore_wait takes a timeout now so codecs and plugins have to be made incompatible. Don't make semaphores for targets not using them. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29492 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-01-29Add a couple KERNEL_ASSERTs to check queue fullness when extra checks are ↵Michael Sevakis
enabled. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29164 a1c6a512-1295-4272-9138-f99709370657
2011-01-15Bootloader USB mode for PP502x. Enable only on GoGear SA9200 for the time ↵Michael Sevakis
being. Add HAVE_BOOTLOADER_USB_MODE to config if BOOTLOADER is defined to enable it. Clean up some kernel stuff a little to support it. Mess up a bunch of other stuff (hopefully not too badly). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29053 a1c6a512-1295-4272-9138-f99709370657
2010-12-27Certain data accesses in the kernel should have volatile semantics to be ↵Michael Sevakis
correct and not rely on the whims of the compiler. Change queue clearing to simply catch read up to write rather than reset both to 0 to ensure sane results for queue_count and queue_empty with concurrency. Binsize may or may not increase a bit depending upon whether the output was as intended in all places; wrong stuff was already unlikely to cause any issue. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28909 a1c6a512-1295-4272-9138-f99709370657
2010-12-26Make mutexes a tiny bit leaner. There is no need for a separate locked ↵Michael Sevakis
semaphore since having an owning thread also indicates that it is locked. Rename member 'count' to 'recursion' since it counts reentry, not locks. Change presents no compatibility issues for plugins or codecs because the structure size goes down. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28901 a1c6a512-1295-4272-9138-f99709370657
2010-09-01Ged rid of uisimulator/common/io.c for android builds.Thomas Martitz
Use host's functions for file i/o directly (open(), close() ,etc.), not the sim_* variants. Some dir functions need to be wrapped still because we need to cache the parents dir's path (host's dirent doesn't let us know). For the same reason (incompatibility) with host's dirent) detach some members from Rockbox' dirent struct and put it into an extra one, the values can be retrieved via the new dir_get_info(). Get rid of the sim_ prefix for sleep as well and change the signature to unix sleep(). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27968 a1c6a512-1295-4272-9138-f99709370657
2010-06-10avoid dereferencing void** to remove warnings when building with -OsRafaël Carré
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26733 a1c6a512-1295-4272-9138-f99709370657
2010-05-21kernel: the header says queue_peek should always be compiled in but the ↵Amaury Pouly
source put it in the #ifdef HAVE_EXTENDED_MESSAGING_AND_NAME section git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26229 a1c6a512-1295-4272-9138-f99709370657
2010-05-17Simplify mpegplayer a bit and use array-based lists rather than linked lists ↵Michael Sevakis
for stream management. Move a couple useful functions to handle pointer arrays from kernel.c into general.c; mpeglayer now makes use of them. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26101 a1c6a512-1295-4272-9138-f99709370657
2010-05-15- Move uisimulator/sdl/*.[ch] into the target tree, under ↵Thomas Martitz
firmware/target/hosted/sdl, uisdl.c is split up across button-sdl.c and system-sdl.c. - Refactor the program startup. main() is now in main.c like on target, and the implicit application thread will now act as our main thread (previously a separate one was created for this in thread initialization). This is part of Rockbox as an application and is the first step to make an application port from the uisimulator. In a further step the sim bits from the sdl build will be separated out. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26065 a1c6a512-1295-4272-9138-f99709370657
2010-04-18Use boolean instead of int for keeping track of mutex signalled state and ↵Bertrik Sikken
wakeup signalled state git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25671 a1c6a512-1295-4272-9138-f99709370657
2010-04-18Add the guard where it should be used. The net effect is zero now but it ↵Alexander Levin
might be not in the future if the definitions are changed. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25669 a1c6a512-1295-4272-9138-f99709370657
2010-04-16Convert macro to inline function and move it into .c file.Thomas Martitz
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25658 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-01-03Fix further tabsAndree Buschmann
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24156 a1c6a512-1295-4272-9138-f99709370657
2009-12-07make tpj1022 bootloader compile again Robert Kukla
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23892 a1c6a512-1295-4272-9138-f99709370657
2009-10-18Use wrap-safe TIME_BEFORE/TIME_AFTER macros to compare times with ↵Bertrik Sikken
current_time, instead of comparing them directly. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23246 a1c6a512-1295-4272-9138-f99709370657
2009-03-23Correct Björn's name in various file headers.Nicolas Pennequin
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20491 a1c6a512-1295-4272-9138-f99709370657
2009-02-03Remove struct spinlock to cleanup some mess and simplify. It's only used in ↵Michael Sevakis
boosting for multiprocesors and a pure two-corelock heirarchy will do just fine. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19910 a1c6a512-1295-4272-9138-f99709370657
2009-01-21Unify kernel list management for ticks, registered queues and timeout ↵Michael Sevakis
objects by using NULL-terminated lists of pointers. Redo timeout API a bit to simplify it and integrate it. Should give some small binsize reduction accross the board but more if timeout objects are being included. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19808 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-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-12-08Meg-FX: Enable a real tick in the bootloader. Do cleanups before switching ↵Michael Sevakis
to firmware and cache handling. Put proper main return address in lr. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19368 a1c6a512-1295-4272-9138-f99709370657
2008-12-07Meg F/X: Radically changing divider settings messed up the fake sleep in the ↵Michael Sevakis
bootloader. They aren't reset even after powering off. Make sure they are always specified. Move that code to target tree as well. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19358 a1c6a512-1295-4272-9138-f99709370657
2008-10-29Move kernel tick initialization and handling to the target tree for ones ↵Michael Sevakis
remaining in kernel.c git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18919 a1c6a512-1295-4272-9138-f99709370657
2008-10-27Strange little kernel optimization to ease targeting the timer tick and to ↵Michael Sevakis
limit the number of loops in the tick function to the number of tasks added rather than always looping the max number. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18893 a1c6a512-1295-4272-9138-f99709370657
2008-10-23Remove the event object in the kernel since it's rather extraneous at the ↵Michael Sevakis
moment. This makes the codecs and the plugins incompatible, so update fully. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18867 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
2008-05-141) Use a separate config-<target>.h for Zen Vision(:M) (60GB)Maurus Cuelenaere
2) Other unrelated cleanups git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17503 a1c6a512-1295-4272-9138-f99709370657
2008-05-05Convert the whole codebase to UTF-8, except docs/COMMITTERS and ↵Nicolas Pennequin
tools/creative.c, which need checking. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17369 a1c6a512-1295-4272-9138-f99709370657
2008-04-24Commit whole Creative Zen Vision:M target tree + all related firmware/ Maurus Cuelenaere
changes. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17241 a1c6a512-1295-4272-9138-f99709370657
2008-04-11Serial driver for imx31. Perhaps not 100% but maybe 80-90% (future ↵Michael Sevakis
developments will tell). Factor-out the mc13783 stuff and make that driver a layer above the SPI. TODO: start processing PMIC interrupts. Start a clkctl API for imx31 (we'll see if this sticks around but it seems reasonable here). Misc. stuff for convenience/neatness. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17070 a1c6a512-1295-4272-9138-f99709370657
2008-04-06Enable nocache sections using the linker. PP5022/4 must use SW_CORELOCK now ↵Michael Sevakis
with shared variables in DRAM (it seems swp(b) is at least partially broken on all PP or I'm doing something very wrong here :\). For core-shared data use SHAREDBSS/DATA_ATTR. NOCACHEBSS/DATA_ATTR is available whether or not single core is forced for static peripheral-DMA buffer allocation without use of the UNCACHED_ADDR macro in code and is likely useful on a non-PP target with a data cache (although not actually enabled in config.h and the .lds's in this commit). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16981 a1c6a512-1295-4272-9138-f99709370657
2008-04-01Change a #define constant that conflicts with a mingw definition. Change ↵Michael Sevakis
"WAIT_*" to "OBJ_WAIT_*". git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16906 a1c6a512-1295-4272-9138-f99709370657
2008-03-30Add a lightweight wakeup object for fast processors.Michael Sevakis
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16885 a1c6a512-1295-4272-9138-f99709370657
2008-03-28queue_delete should reset the blocker_p member.Michael Sevakis
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16859 a1c6a512-1295-4272-9138-f99709370657
2008-03-26Do core interrupt masking in a less general fashion and save some ↵Michael Sevakis
instructions to decrease size and speed things up a little bit. Small fix to a few places where interrupts would get enabled again where they shouldn't have been (context switching calls when disabled). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16811 a1c6a512-1295-4272-9138-f99709370657
2008-03-25Add a complete priority inheritance implementation to the scheduler (all ↵Michael Sevakis
mutex ownership and queue_send calls are inheritable). Priorities are differential so that dispatch depends on the runnable range of priorities. Codec priority can therefore be raised in small steps (pcmbuf updated to enable). Simplify the kernel functions to ease implementation and use the same kernel.c for both sim and target (I'm tired of maintaining two ;_). 1) Not sure if a minor audio break at first buffering issue will exist on large-sector disks (the main mutex speed issue was genuinely resolved earlier). At this point it's best dealt with at the buffering level. It seems a larger filechunk could be used again. 2) Perhaps 64-bit sims will have some minor issues (finicky) but a backroll of the code of concern there is a 5-minute job. All kernel objects become incompatible so a full rebuild and update is needed. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16791 a1c6a512-1295-4272-9138-f99709370657
2008-02-08Gigabeat S: Interrupt enabled bootloader. Miscellaneous integration changes.Michael Sevakis
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16243 a1c6a512-1295-4272-9138-f99709370657
2008-02-05Gigabeat S mixer: Make some progress. Get the tick and core sleep working ↵Michael Sevakis
using the AVIC. Redo the startup code to remap from IRAM and not include the lcd driver frambuffer in the remapping (until it can be moved). Clean up LCD driver. For other misc. changes, see the diffs. Now it progresses to ATA init and fails with -11 but without crashing or hanging. Replace all bootloaders. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16216 a1c6a512-1295-4272-9138-f99709370657
2008-01-19Do some simplification in switch_thread regarding interrupt enabling which ↵Michael Sevakis
simplifies kernel objects as well. Simply doing unconditional disable/enable should be fine in the firmware. Not sure about the case in the bootloader for all targets and so will evaluate but that should be fine too if everything is masked. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16107 a1c6a512-1295-4272-9138-f99709370657