summaryrefslogtreecommitdiff
path: root/firmware/kernel.c (follow)
Commit message (Collapse)AuthorAge
* kernel: Break out kernel primitives into separate files and move to separate ↵Thomas Martitz2014-03-03
| | | | | | | | | 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
* kernel: Allow queue_wait_w_tmo() to be called with TIMEOUT_BLOCK.Thomas Martitz2012-09-28
| | | | | | | | 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
* AS3525v1/2: Enable nested handling of interruptsMichael Sevakis2012-01-08
| | | | | | | | | | | | | | | | | | | | 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
* Add comments source comments about the behavior of yield and sleep.Michael Sevakis2011-12-15
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31288 a1c6a512-1295-4272-9138-f99709370657
* Fix "variable 'result' set but not used" warningFrank Gevaerts2011-07-19
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30172 a1c6a512-1295-4272-9138-f99709370657
* Commit FS#12069 - Playback rework - first stages. Gives as thorough as ↵Michael Sevakis2011-04-27
| | | | | | 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
* No need to save irq again after thread wakeup in queue_wait(_w_tmo), just ↵Michael Sevakis2011-03-17
| | | | | | disable it. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29608 a1c6a512-1295-4272-9138-f99709370657
* Change the thread api a bit.Thomas Martitz2011-03-05
| | | | | | | * 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
* Merge functionality of wakeups and semaphores-- fewer APIs and object types. ↵Michael Sevakis2011-03-02
| | | | | | 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
* Cleanup preprocessor around corelock usage and move its definition outside ↵Thomas Martitz2011-02-19
| | | | | | #ifdef ASSEMBLER_THREADS git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29330 a1c6a512-1295-4272-9138-f99709370657
* Add a couple KERNEL_ASSERTs to check queue fullness when extra checks are ↵Michael Sevakis2011-01-29
| | | | | | enabled. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29164 a1c6a512-1295-4272-9138-f99709370657
* Bootloader USB mode for PP502x. Enable only on GoGear SA9200 for the time ↵Michael Sevakis2011-01-15
| | | | | | 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
* Certain data accesses in the kernel should have volatile semantics to be ↵Michael Sevakis2010-12-27
| | | | | | 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
* Make mutexes a tiny bit leaner. There is no need for a separate locked ↵Michael Sevakis2010-12-26
| | | | | | 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
* Ged rid of uisimulator/common/io.c for android builds.Thomas Martitz2010-09-01
| | | | | | | | | | | 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
* avoid dereferencing void** to remove warnings when building with -OsRafaël Carré2010-06-10
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26733 a1c6a512-1295-4272-9138-f99709370657
* kernel: the header says queue_peek should always be compiled in but the ↵Amaury Pouly2010-05-21
| | | | | | 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
* Simplify mpegplayer a bit and use array-based lists rather than linked lists ↵Michael Sevakis2010-05-17
| | | | | | 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
* - Move uisimulator/sdl/*.[ch] into the target tree, under ↵Thomas Martitz2010-05-15
| | | | | | | | | | 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
* Use boolean instead of int for keeping track of mutex signalled state and ↵Bertrik Sikken2010-04-18
| | | | | | wakeup signalled state git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25671 a1c6a512-1295-4272-9138-f99709370657
* Add the guard where it should be used. The net effect is zero now but it ↵Alexander Levin2010-04-18
| | | | | | 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
* Convert macro to inline function and move it into .c file.Thomas Martitz2010-04-16
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25658 a1c6a512-1295-4272-9138-f99709370657
* Use API call instead of accessing a global variable for receiving the ↵Thomas Martitz2010-04-16
| | | | | | current thread. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25657 a1c6a512-1295-4272-9138-f99709370657
* Fix further tabsAndree Buschmann2010-01-03
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24156 a1c6a512-1295-4272-9138-f99709370657
* make tpj1022 bootloader compile again Robert Kukla2009-12-07
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23892 a1c6a512-1295-4272-9138-f99709370657
* Use wrap-safe TIME_BEFORE/TIME_AFTER macros to compare times with ↵Bertrik Sikken2009-10-18
| | | | | | current_time, instead of comparing them directly. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23246 a1c6a512-1295-4272-9138-f99709370657
* Correct Björn's name in various file headers.Nicolas Pennequin2009-03-23
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20491 a1c6a512-1295-4272-9138-f99709370657
* Remove struct spinlock to cleanup some mess and simplify. It's only used in ↵Michael Sevakis2009-02-03
| | | | | | 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
* Unify kernel list management for ticks, registered queues and timeout ↵Michael Sevakis2009-01-21
| | | | | | 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
* Place some LIKELY and UNLIKELY hints in kernel where I can definitively say ↵Michael Sevakis2008-12-14
| | | | | | 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
* Use cookies for thread identification instead of pointers directly which ↵Michael Sevakis2008-12-10
| | | | | | 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
* Meg-FX: Enable a real tick in the bootloader. Do cleanups before switching ↵Michael Sevakis2008-12-08
| | | | | | 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
* Meg F/X: Radically changing divider settings messed up the fake sleep in the ↵Michael Sevakis2008-12-07
| | | | | | 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
* Move kernel tick initialization and handling to the target tree for ones ↵Michael Sevakis2008-10-29
| | | | | | remaining in kernel.c git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18919 a1c6a512-1295-4272-9138-f99709370657
* Strange little kernel optimization to ease targeting the timer tick and to ↵Michael Sevakis2008-10-27
| | | | | | 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
* Remove the event object in the kernel since it's rather extraneous at the ↵Michael Sevakis2008-10-23
| | | | | | 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
* Updated our source code header to explicitly mention that we are GPL v2 orDaniel Stenberg2008-06-28
| | | | | | | | | 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
* 1) Use a separate config-<target>.h for Zen Vision(:M) (60GB)Maurus Cuelenaere2008-05-14
| | | | | | | 2) Other unrelated cleanups git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17503 a1c6a512-1295-4272-9138-f99709370657
* Convert the whole codebase to UTF-8, except docs/COMMITTERS and ↵Nicolas Pennequin2008-05-05
| | | | | | tools/creative.c, which need checking. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17369 a1c6a512-1295-4272-9138-f99709370657
* Commit whole Creative Zen Vision:M target tree + all related firmware/ Maurus Cuelenaere2008-04-24
| | | | | | | changes. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17241 a1c6a512-1295-4272-9138-f99709370657
* Serial driver for imx31. Perhaps not 100% but maybe 80-90% (future ↵Michael Sevakis2008-04-11
| | | | | | 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
* Enable nocache sections using the linker. PP5022/4 must use SW_CORELOCK now ↵Michael Sevakis2008-04-06
| | | | | | 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
* Change a #define constant that conflicts with a mingw definition. Change ↵Michael Sevakis2008-04-01
| | | | | | "WAIT_*" to "OBJ_WAIT_*". git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16906 a1c6a512-1295-4272-9138-f99709370657
* Add a lightweight wakeup object for fast processors.Michael Sevakis2008-03-30
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16885 a1c6a512-1295-4272-9138-f99709370657
* queue_delete should reset the blocker_p member.Michael Sevakis2008-03-28
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16859 a1c6a512-1295-4272-9138-f99709370657
* Do core interrupt masking in a less general fashion and save some ↵Michael Sevakis2008-03-26
| | | | | | 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
* Add a complete priority inheritance implementation to the scheduler (all ↵Michael Sevakis2008-03-25
| | | | | | 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
* Gigabeat S: Interrupt enabled bootloader. Miscellaneous integration changes.Michael Sevakis2008-02-08
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16243 a1c6a512-1295-4272-9138-f99709370657
* Gigabeat S mixer: Make some progress. Get the tick and core sleep working ↵Michael Sevakis2008-02-05
| | | | | | 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
* Do some simplification in switch_thread regarding interrupt enabling which ↵Michael Sevakis2008-01-19
| | | | | | 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