Commit graph

15 commits

Author SHA1 Message Date
William Wilgus
e180e45e01 events.c clean-up
check for invalid userdata by assigning the address of 'invalid_userdata'
this cleans up the functions a bit and removes some extra conditionals

Change-Id: Ic5e13147796e629010a1436eb60042f6550a959c
2022-12-30 07:23:29 -05:00
William Wilgus
f6f12db062 events.c do_add_event() only traverse event array once
we already go through the whole array might as well save the free slot as well

Change-Id: I6e1164b57a5510f5de5555d2cb91379afc58ae08
2022-12-08 05:19:40 -05:00
Thomas Jarosch
fdd4aef340 Make thirty functions static to reduce binary size
If any of those functions should be (unused) API functions,
they can easily be turned back once really needed.

Detected using a new cppcheck check that
uses the internal symbol database to catch
functions that are only used in the current file.

Change-Id: Ic2b1e5b8020b76397f11cefc4e205f3b7ac1f184
2015-01-05 18:44:36 +01:00
Thomas Martitz
915bc09996 Fix stupid typo in 470989b that triggered panics easily.
Change-Id: Ic998a0ea93141a5399e28dc286eea4e3d40663d6
2014-03-15 02:23:43 +01:00
Thomas Martitz
470989bd70 events: Rework event subsystem (add_event, send_event) to be more versatile.
add_event_ex is added that takes an extra user_data pointer. This pointer is
passed to the callback (add_event and add_event_ex have slightly different
callbacks types). All callbacks also get the event id passed. Events added
with add_event_ex must be removed with remove_event_ex because the user_data
pointer must match in addition to the callback pointer.

On the other add_event is simplified to omit the oneshort parameter which
was almost always false (still there with add_event_ex).

As a side effect the ata_idle_notify callbacks are changed as well, they
do not take a data parameter anymore which was always NULL anyway.

This commit also adds some documentation to events.h

Change-Id: I13e29a0f88ef908f175b376d83550f9e0231f772
2014-03-14 23:36:30 +01:00
Thomas Martitz
d85c3ec410 Convert lcd_activation callbacks to use the event system to allow for multiple parallel callbacks (for custom statusbar).
Increase maximum event count as we need more (I actually had a report about it during custom statusbar testing).
Removed corresponding functions from the core and plugin api. Bump min version and sort.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23302 a1c6a512-1295-4272-9138-f99709370657
2009-10-20 21:54:59 +00:00
Thomas Martitz
774bacc692 Correct wrong usage of event callbacks all over the place. It's not supposed to return anything, and should take a data parameter.
Fixing it because correcting the event api prototypes causes many warnings.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23301 a1c6a512-1295-4272-9138-f99709370657
2009-10-20 21:54:44 +00:00
Thomas Martitz
53b7a4ef8b Raise MAX_SYS_EVENTS to fix FS#10105 (*PANIC* event line full)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20660 a1c6a512-1295-4272-9138-f99709370657
2009-04-08 16:58:04 +00:00
Bertrik Sikken
9464fdde2d Apply FS#9155 (Simplified battery bench). This is a simplification/rework of the current battery bench code. Battery measurements are now done simply once a minute (no more dependency on HDD specific timeouts) and are flushed to disk by using the ata_idle callback instead of polling ata_disk_is_active (this call is removed from the plugin API now) to make the plugin as unobtrusive as possible. This battery bench plugin also works for flash-based targets like sansa e200.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18281 a1c6a512-1295-4272-9138-f99709370657
2008-08-14 22:35:00 +00:00
Daniel Stenberg
2acc0ac542 Updated our source code header to explicitly mention that we are GPL v2 or
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-06-28 18:10:04 +00:00
Bertrik Sikken
705e703f45 Increased MAX_SYS_EVENTS from 10 to 16, since there are potentially more than 10 events that can registered. Should fix FS#9039 - *PANIC* event line full (reproduceable).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17632 a1c6a512-1295-4272-9138-f99709370657
2008-05-26 06:54:57 +00:00
Bertrik Sikken
869fbfc1f1 Made events table static and moved MAX_SYS_EVENTS from events.c to events.h to make it private.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17586 a1c6a512-1295-4272-9138-f99709370657
2008-05-20 19:20:28 +00:00
Bertrik Sikken
f4eb0ee53c Updated panicf in remove_event. Also fixed some comments.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17265 a1c6a512-1295-4272-9138-f99709370657
2008-04-27 19:34:41 +00:00
Jonathan Gordon
a67e5d89ef It makes more sense for the callback registrar to decide if its a "oneshot" then the callback caller.
(Doing it this way means playback could(/should?) registar a disk spinup callback at init which is called every spinup without needing to be reregistered)


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16685 a1c6a512-1295-4272-9138-f99709370657
2008-03-17 05:22:53 +00:00
Miika Pekkarinen
19c6e66c13 Implement the playback event handling as a system-wide multi-purpose event system. Unified mpeg.c and playback.c audio event handling. Converted ata_idle_notify to use the new event handling system also.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16682 a1c6a512-1295-4272-9138-f99709370657
2008-03-16 13:55:16 +00:00