summaryrefslogtreecommitdiff
path: root/firmware/kernel.c
AgeCommit message (Collapse)Author
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
2008-01-18Finally, out goes struct spinlock for anything but mutiprocessor targets ↵Michael Sevakis
where it becomes a reenterable corelock. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16105 a1c6a512-1295-4272-9138-f99709370657
2007-10-30Fix FS#8052 - kernel.c compilation errors when compiling for debug. Just ↵Michael Sevakis
some minor typos that got in with last minute SW corelock changes. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15380 a1c6a512-1295-4272-9138-f99709370657
2007-10-27Add queue_peek to the kernel (written by Mike Sevakis), and use it to ↵Nicolas Pennequin
improve upon my previous commit. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15336 a1c6a512-1295-4272-9138-f99709370657
2007-10-21Be sure to register a new mutex owner _before_ waking it. Won't be an issue ↵Michael Sevakis
now but would be with mutex recursion on one used for > 1 core where ownership transfer and cs entry/recursion are allowed to run in parallel (by design). TODO: Add true exchange to wakeup_thread but that's not really important for the time being. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15251 a1c6a512-1295-4272-9138-f99709370657
2007-10-16Finally full multicore support for PortalPlayer 502x targets with an eye ↵Michael Sevakis
towards the possibility of other types. All SVN targets the low-lag code to speed up blocking operations. Most files are modified here simple due to a name change to actually support a real event object and a param change to create_thread. Add some use of new features but just sit on things for a bit and leave full integration for later. Work will continue on to address size on sensitive targets and simplify things if possible. Any PP target having problems with SWP can easily be changed to sw corelocks with one #define change in config.h though only PP5020 has shown an issue and seems to work without any difficulties. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15134 a1c6a512-1295-4272-9138-f99709370657
2007-10-05Stabilize PP5020 targets - tested on H10 5/20GB and iPod Color. Use no ↵Michael Sevakis
interrupts on COP but pulse it through the control interface. Don't mess with LCD clocking during clock changes. Give a reset register a name (DEV_OFF_MASK). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14998 a1c6a512-1295-4272-9138-f99709370657
2007-09-30Enable auto reply for queue messages sent with queue_send. It's only ↵Michael Sevakis
nescessary to use queue_reply to return a value other than zero or to return a result before waiting on the queue again. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14923 a1c6a512-1295-4272-9138-f99709370657
2007-09-28Commit a subset of the dual core changes that have to do with cache ↵Michael Sevakis
handling, stacks, firmware startup and thread startup. Tested on e200, H10-20GB, iPod Color and 5.5G. Thread function return implemented for all targets. Some changes to plugins to follow shortly. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14879 a1c6a512-1295-4272-9138-f99709370657
2007-09-21Merge the Gigabeat S branch back into trunk. Fingers crossed nothing breaks.Will Robertson
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14805 a1c6a512-1295-4272-9138-f99709370657
2007-07-29Add a new timeout API to the kernel. Enable only for e200 right now since ↵Michael Sevakis
it's the only user. Use that as the one-shot delay for SD card inserts. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14049 a1c6a512-1295-4272-9138-f99709370657
2007-07-06Gigabeat: Add timer functionality. Rework tick timer setup to be exactly ↵Michael Sevakis
100Hz. Metronome should work now but some pcm changes are needed to have faster tocks work correctly (in the works). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13806 a1c6a512-1295-4272-9138-f99709370657
2007-07-05Gigabeat: Use vectored IRQ mode interrupts and add a trap for unhandled ones.Michael Sevakis
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13792 a1c6a512-1295-4272-9138-f99709370657
2007-06-25current_tick really does need to be volatile since gcc can optimize away ↵Michael Sevakis
checking the value otherwise - found out the hard way. :) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13715 a1c6a512-1295-4272-9138-f99709370657
2007-05-12Messages queues must be guarded on both ends or else it's a race between ↵Michael Sevakis
detecting a message present and missing a wakeup on thread about to wait. Keeping IRQs from interacting with the scheduler would be preferable but this should do at the moment. Add more detailed panic info regarding blocking violations so we know who. Make panicf function well enough on Gigabeat and PortalPlayer targets. Move the core sleep instructions into a CPU-specific inline to keep thing organized. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13374 a1c6a512-1295-4272-9138-f99709370657
2007-04-14Simplification, queue pointers don't wrap (except at INT_MAX, but the ↵Jens Arnold
calculation is still correct in this case). Implemented queue_count() for the simulator. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13154 a1c6a512-1295-4272-9138-f99709370657
2007-03-26Make scheduler functions thread safe core wise. A big step towards playback ↵Miika Pekkarinen
running on COP (not yet possible because more protection on file system level is necessary). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12926 a1c6a512-1295-4272-9138-f99709370657
2007-03-26Fix a hole in the scheduler where collisions between waking blocked threads ↵Michael Sevakis
in mutexes with interrupts waking blocked threads in message queues can occur. Queue posts will put the threads on a separate list that is then added to the running list with IRQs disabled on the next task switch or CPU wakeup. Basically no overhead for other operations. Seems a likely cause of my occasional observation of the backlight fade causing playback threads to stop running and a recently reported blocking violation upon USB plugging. Time will tell but banging the backlight on and off frequently hasn't hiccuped again for me on H120. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12915 a1c6a512-1295-4272-9138-f99709370657
2007-03-24PNX0101 changes:Tomasz Malesinski
Make PNX0101-specific system.c and crt0.S. Add new register names from LPC2880 user manual. Add support for timer. Enable CPU frequency changing. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12904 a1c6a512-1295-4272-9138-f99709370657
2007-03-23In reponse to a report of a blocking violation, give sync queues a going ↵Michael Sevakis
over and catch any old, obscure leftover issues. A couple spots needed interrupt stopage where there could be confict if an IRQ post wakes a waiting thread because the queue is overflowing. There does appear to be an issue with wakeup_thread, interrupts and running list modification in general. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12895 a1c6a512-1295-4272-9138-f99709370657
2007-03-21Update sync queues to use a statically allocated return value in order to ↵Michael Sevakis
facilitate upcoming COP updates. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12881 a1c6a512-1295-4272-9138-f99709370657
2007-03-12Disable bootloader messages in the H10 and Sansa bootloaders unless the PLAY ↵Barry Wardell
(on H10) or RIGHT (on Sansa) button is being held. Messages are still displayed if an error occurs. This has already been implemented for iPod bootloaders, but still needs implementing for the other bootloaders. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12742 a1c6a512-1295-4272-9138-f99709370657
2007-03-11Optimized the gui list code performance, including automatic frame dropping ↵Miika Pekkarinen
and cpu boosting when button events are getting queued. Improved scrollwheel acceleration code is needed to notice a real change. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12721 a1c6a512-1295-4272-9138-f99709370657
2007-03-09Put an end to priority inversion in the ata driver. Gave up trying to have ↵Michael Sevakis
fully atomic dual use mutexes so just replaced the ata driver locking with spins. Maybe I'll have better luck later. Things should run smoothly with database updates and such happening in the background. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12688 a1c6a512-1295-4272-9138-f99709370657