Commit graph

32738 commits

Author SHA1 Message Date
Thomas Jarosch
06eeab0242 Always initialize "item"
Otherwise item.cfg_name and item.default_val
will contain garbage. It doesn't seem to have
an effect right now, but who knows what
a future refactoring might do.

cppcheck reported:
[rockbox/apps/settings.c:1268]: (error) Uninitialized variable: item

Change-Id: Ic4d0c302929613de8f291cd2d69cd39db8711107
2014-12-22 21:12:11 +01:00
Thomas Jarosch
9a5f7ce0f2 wavrecord plugin: Add harmless sanity check
cppcheck reported:
[rockbox/apps/plugins/wavrecord.c:3672]: (error) Array 'sampr[9][2]' index sampr[9][1] out of bounds.

Change-Id: Ib1e9c25842aa275b15d8d817018cc523269b1f42
2014-12-21 17:22:09 +01:00
Thomas Jarosch
29ffa832fe Remove useless assignment of 'len'
The variable 'len' is not used after this statement.
Probably a copy'n'paste leftover from the similar
looking block above.

cppcheck reported:
[rockbox/utils/zenutils/source/shared/cenc.cpp:212]: (style) Same expression on both sides of '-'.

Change-Id: Ia8357187ed39d3fab10d97df75a1146c4f733790
2014-12-20 15:52:35 +01:00
Amaury Pouly
515a07e51d sb1: fix buggy comparison
cppcheck reported:
[rockbox/utils/imxtools/sbtools/sb1.c:440]: (warning) Comparison of a boolean expression with an integer other than 0 or 1.

Thanks to Thomas Jarosch

Change-Id: I0078232706d4014a1f2acea310a7a0d0edf7788b
2014-12-20 15:31:18 +01:00
Thomas Jarosch
61e322c840 mkzenboot: Fix double close of bootfd on error
cppcheck reported:
[rockbox/tools/mkzenboot.c:1176]: (error) Used file that is not opened.

Change-Id: Ibbf7ab2910c7f43b547fef25c62e0b4d19ff9551
2014-12-20 15:18:46 +01:00
Thomas Jarosch
1eb1bc24f2 DX 50: Fix file descriptor leak on error
Unimportant change, still good style.

cppcheck reported:
[rockbox/firmware/target/hosted/android/dx50/button-dx50.c:92]: (error) Resource leak: fd
[rockbox/firmware/target/hosted/android/dx50/button-dx50.c:98]: (error) Resource leak: fd

Change-Id: Ic1831382219c44e7bef71cb2391646c9910d2369
2014-12-20 14:59:19 +01:00
Thomas Jarosch
575ec8902e mini2440: Fix bogus buffer access in LCD backlight driver
The backlight driver always writes a bogus value
from memory into the LCD brightness register.

Fix it up by adding bounds checks and
use a more sane default value.

While looking at the code, I noticed
that BACKLIGHT_CONTROL_SET probably ignores
the desired brightness level, too.

Note: Please test on real hardware, I don't own it.

cppcheck reported:
[rockbox/firmware/target/arm/s3c2440/mini2440/backlight-mini2440.c:53]: (error) Array 'log_brightness[13]' accessed at index 255, which is out of bounds.

Change-Id: Iaafa929a8adaa97b93ebcb66e1f6bd3bf0dad84e
2014-12-20 14:47:09 +01:00
Thomas Jarosch
d62e1b3c5f vibe 500: Fix ide_powered() always returning false
While the right GPIO location is accessed,
the result of the logical AND was tested wrong.

I don't have this hardware, but I can imagine
that bug caused ide_power_enable() to be called
more times than it needed to be.

cppcheck reported:
[rockbox/firmware/target/arm/pbell/vibe500/power-vibe500.c:101]: (style) Expression '(X & 0x8) == 0x1' is always false.

Change-Id: I98498f79d383c6f29869e170bfc94ba9a0d2ba7e
2014-12-20 14:03:23 +01:00
Thomas Jarosch
ef1497c3df Add missing va_end() call when the log is full
No need to go out of memory, too ;)

cppcheck reported:
[rockbox/firmware/logf.c:338]: (error) va_list 'ap' was opened but not closed by va_end().

Change-Id: I00e4c04d7e3d5d1415aa5066487ce1d9209e53aa
2014-12-20 13:48:43 +01:00
Thomas Jarosch
c54537a663 Prevent theoretical out-of-bounds access in STM_Load()
We should be safe since STM_Load() should
never be called if STM_Test() fails.
Still it's better safe than sorry.

cppcheck reported:
[rockbox/apps/plugins/mikmod/load_stm.c:302]: (error) Array 'STM_Version[3]' accessed at index 3, which is out of bounds.

Change-Id: I914935fd108c492d013de24d17dcb9c227af6cd8
2014-12-20 13:37:40 +01:00
Thomas Jarosch
f8d9e9cb6c m3u playlist parser: Check size limit before using buffer
This should only be a problem if the last line
is not terminated by \r or \n though.

cppcheck reported:
[rockbox/apps/playlist.c:234]: (style) Array index 'i' is used before limits check.

Change-Id: I8182b66272ba9c024984c81588bd2a6dbb8255b8
2014-12-20 13:14:19 +01:00
Thomas Jarosch
2caf8870af text_viewer plugin: Fix two out-of-bounds buffer accesses
Test code:
--------------
int main(void)
{
    static unsigned short extra_spaces[] = { 0, 0x3000 };
    return sizeof(extra_spaces);
}
--------------

-> returns four instead of two.

cppcheck reported:
[rockbox/apps/plugins/text_viewer/tv_text_processor.c:180]: (error) Array 'break_chars[27]' acces
sed at index 53, which is out of bounds.
[rockbox/apps/plugins/text_viewer/tv_text_processor.c:195]: (error) Array 'extra_spaces[2]' acces
sed at index 3, which is out of bounds.

Change-Id: I66c305cc5c99e59e7c8e0aa9c86cecbe293ff037
2014-12-20 12:55:20 +01:00
Thomas Jarosch
1ff5fd4d6b Fix broken buflib_handle check in backdrop settings loader
The logic was messed up and always evaluated to true
if buflib_handle is non-zero.

Thanks to JdGordon for verifying the change.

cppcheck reported:
[rockbox/apps/gui/skin_engine/skin_backdrops.c:262]: (warning) Comparison of a boolean expression with an integer other than 0 or 1.

Change-Id: Ib52a73e0a6a2017a631e2dec19b638a2974dab83
2014-12-20 12:33:26 +01:00
Thomas Jarosch
c55be3b83a maemo port: Fix startup crash exposed by audio thread refactoring
The refactoring of the audio thread in this commit
-----------------------------------------------
commit 5857c44017
Author: Michael Sevakis <jethead71@rockbox.org>
Date:   Fri May 31 02:41:02 2013 -0400

    Refactor audio thread to run both recording and playback.
-----------------------------------------------

moved pcm_init() next to dsp_init() in apps/main.c:init().
Before that pcm_init() was called by audio_init().

Unfortunately the maemo init code didn't properly
wait until the maemo thread was fully initialized,
leading to dangling pointers when the code called
by pcm_init() tried to access maemo's variables.

Fix it by refactoring the "very fast shutdown" semaphore
to wait until maemo is initialized in any case.

This should also fix very rare rockbox crashes
on startup that I got once a year or so.
The new code has been tested by a script that
starts and kills rockbox after one second.

Change-Id: I464efce5f2b71ca869c72a5bc578555b8022e459
2014-12-20 02:23:15 +01:00
Thomas Jarosch
55a5aab97c Add newlines at the end of the file
Quiet maemo's gcc 4.2.1 compiler warning.

Change-Id: I35dfb2c0cb269b05edd62adf71fe0308a4b9ba5b
2014-12-17 23:34:48 +01:00
Thomas Jarosch
3add6c7435 Fix up maemo port after byte swap header refactoring
Turns out maemo's old gcc 4.2.1 doesn't include any arch
optimized swapXX() functions, just plain C implementations.

Before we pull in lots of linux kernel headers for the
C implementation, just stick to rockbox's own version.

Change-Id: Ic28b41b52fe47f814c7f3897ce15334a42b6c5e2
2014-12-17 23:29:44 +01:00
Amaury Pouly
5dab768838 regtools/qeditor: use the new model, drop unused code
Change-Id: Ic4e2e201f6d055c85d52b7fe15d25980386df5b8
Reviewed-on: http://gerrit.rockbox.org/1023
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-15 22:57:20 +01:00
Amaury Pouly
abed208efb regtools/qeditor: introduce custom table model for reg fields
This one is much more efficient than using a generic table widget.

Change-Id: I3578964eead746e656f6b0a8dcec0f8442deb13d
Reviewed-on: http://gerrit.rockbox.org/1022
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-15 22:54:28 +01:00
Amaury Pouly
edaeee168d regtoosl/qeditor: remove unused code
Change-Id: I79ad3151d6a500903786b3467c271b43741f8fee
Reviewed-on: http://gerrit.rockbox.org/1021
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-15 22:54:20 +01:00
Amaury Pouly
88053b8832 regtools/qeditor: fix field editor not updating the validator on change
Change-Id: Ib8df47c8b7cfe0beb486e45542e3fcc9187bcc54
Reviewed-on: http://gerrit.rockbox.org/1020
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-15 22:54:13 +01:00
Amaury Pouly
04e798eddf regtools/qeditor: fix backend dump bug, be more correct on read
Change-Id: I581c033435f553f092b61144c4b68b05ab931dd8
Reviewed-on: http://gerrit.rockbox.org/1019
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-15 22:54:05 +01:00
Amaury Pouly
6cb861137d regtools/socdesc: update library with a field useful functions
Change-Id: Ib2891fe36b0594e8554bb354a29bc8b3485de20d
Reviewed-on: http://gerrit.rockbox.org/1018
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-15 22:53:57 +01:00
Amaury Pouly
7749c4d0e9 qeditor: message widget now supports IDs, useful to clear messages
Change-Id: Ibe0a8909128469a71a25415761860e06fc9f1e67
Reviewed-on: http://gerrit.rockbox.org/1006
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-15 22:53:49 +01:00
Amaury Pouly
cef5e1018e qeditor: change setting names, they were inconsistent
Change-Id: I47c94520749d0cef1e602c7c62c685a8a3703258
Reviewed-on: http://gerrit.rockbox.org/1000
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-15 22:53:41 +01:00
Amaury Pouly
dc3ae2aeb9 qeditor: rework register dump to be more general and flexible
Change-Id: I2fb7a2813c93f0804ed1ca6223625706d0dff9a5
Reviewed-on: http://gerrit.rockbox.org/998
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-15 22:53:33 +01:00
Amaury Pouly
1bcc4fc67b qeditor: introduce a new "RAM" backend, and refactor file backend
Change-Id: Icfbbc01b83d3592041803387e35f5aa6fb0fa813
Reviewed-on: http://gerrit.rockbox.org/997
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-15 22:53:15 +01:00
Amaury Pouly
4a711fee42 qeditor: display message on "Nothing" backend selection
Change-Id: I071c79500f55afe0b6342cbb5a26a9fddba35d94
Reviewed-on: http://gerrit.rockbox.org/996
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-15 22:53:03 +01:00
Amaury Pouly
99ed6d2bea qeditor: backends can now report validity status
Change-Id: Iefedc9cee10a8c7457d972e5a60d151a6cb38aa8
Reviewed-on: http://gerrit.rockbox.org/995
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-15 22:52:54 +01:00
Amaury Pouly
b08620dd30 qeditor: introduce a message widget to display non-interactive messages
Change-Id: Iad43efa1f09428389fbd09403c1ae20d2805f1c5
Reviewed-on: http://gerrit.rockbox.org/987
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-15 22:52:45 +01:00
Amaury Pouly
3b4e63173d qeditor: rework mainwindow tab names handling
With the previous code, tab names would be ignored if tab is detached
which can happen early on.

Change-Id: I9eac4202850f3e79a04590a4ba1444850ec6a583
Reviewed-on: http://gerrit.rockbox.org/986
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-15 22:52:35 +01:00
Amaury Pouly
fe1fed8873 qeditor: add copyright
Change-Id: I7834bc09b21f2a2d84b1c9edbbe1188372809c63
Reviewed-on: http://gerrit.rockbox.org/983
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-15 22:52:26 +01:00
Amaury Pouly
94c4834bbb Revert "regtools/qeditor: use the new model, drop unused code"
This reverts commit 3b3d9bf725.
Gerrit did crap on this one.
2014-12-15 22:44:17 +01:00
Amaury Pouly
3b3d9bf725 regtools/qeditor: use the new model, drop unused code
Change-Id: Ic4e2e201f6d055c85d52b7fe15d25980386df5b8
Reviewed-on: http://gerrit.rockbox.org/1023
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-12-15 22:42:43 +01:00
Amaury Pouly
0389fd0982 MTP: put libs after files in the Makefile, to please old gcc versions
Change-Id: I6de6771bd8888e40fb9dafa3c84653c8c680bbef
2014-12-13 12:58:08 +01:00
Cástor Muñoz
b320bbaf61 iPod Classic: YUV to RGB optimizations for ARM v5+
Optimizes YUV to RGB conversion using ARMv5 multiply-accumulate
intructions for operations and data tables for saturation.

This first patch set includes the three versions i have developed.
Although iPod Classic need to use the latest version to reach 30fps,
old versions may serve other targets.

All versions are based on current SVN algorithm (round->scale->add)
using the same coefficients, so output results are identical.

Version history:

  ARMv4:
   - use all available registers to calculate four pixels within each
     loop iteration.
   - avoid LDR interlocks.

  ARMv5TE:
   - use ARMv5TE+ 1-cycle multiply-accumulate instructions.

  ARMv5TE_WST:
   - use data tables (256 bytes) for RBG565 saturation.

Benchmarks results using iPod Classic (ARM926EJ 216Mhz):

                 size    test_fps (1)    mpegplayer (2)
                 bytes   YUV  YUV1/4     average  min/max
                 -----   -----------     ------------------
  SVN-20141107   528     27.8  110.0     11035  10864/13397
  ARMv4          480     28.8  114.0      9767   9586/12126
  ARMv5TE        468     29.7  117.5      8751   8584/11118
  ARMv5TE_WST    544     33.6  133.0      6355   6316/6403

  (1) boosted
  (2) play full elephants_dream_320x240.mpg file (15693 frames) using
      mpegplayer, patched RB measures YUV to RGB565 frame conversion
      time (microseconds)

  Compared against the WST version, the ARMV5TE version w/o cached
  saturation tables is slower, but it is smaller and i have doubts
  about the power consumption.

Change-Id: I2b6a81804636658d85a1bb104ccb2055e77ac120
Reviewed-on: http://gerrit.rockbox.org/1034
Reviewed-by: Cástor Muñoz <cmvidal@gmail.com>
Tested: Cástor Muñoz <cmvidal@gmail.com>
2014-12-10 20:39:34 +01:00
Thomas Martitz
a2136a811f ypr0: Get it up and running again
7d1a47cf13 introduced a regression that broke it completely so that
it couldn't boot into the main menu anymore. It had a faulty call to
get_volume_name() which made handle_special_links() act up. This broke
every open() and opendir() (and friends) library calls.

Change-Id: I399960ca8fb6e3bcc1f25c9b4a3c19a6d28b77bd
2014-12-09 23:20:00 +01:00
Cástor Muñoz
9454ad4c97 iPod Classic: configure piezo GPIO ports
Configures piezo GPIO ports for the lowest power consumption
when not in use.

Change-Id: If80b0c947f197277972fd9319b8ab283cca96d3c
2014-12-08 03:11:34 +01:00
Cástor Muñoz
bfb63f8017 iPod Classic: minor modifications in TIMER
The current behaviour should not change.

Change-Id: Ia8f44cdccf41dbc3881722f9aebab91de51a9bc5
2014-12-08 03:07:44 +01:00
Andrew Ryabinin
8618f2c227 rk27xx: sd: properly align buffer used for DMA transfers.
Commit 7d1a47cf ("Rewrite filesystem code (WIP)") exposed
bug in rk27xx sd driver. Buffer passed to sd_read/write_sectors()
doesn't has to be cacheline aligned. DMA transfers on
unaligned buffers is quiet dangerous thing.
Make sure that the buffer is aligned to cacheline size,
If not use a temporary aligned buffer for DMA transfer.

Change-Id: I91420f2b8d58159c80c3f15f4b35e88ea0dfd14c
2014-11-29 21:00:11 +03:00
Andrew Ryabinin
d1fcfe950a Add IS_ALIGNED(x, a) macro helper
Change-Id: Ic5799e4bc03cabddece80cbc129b16f3a19ff9c5
2014-11-29 20:59:18 +03:00
Michael Giacomelli
d924c83066 Fix warning in WMA Pro and remove a c++ comment.
Change-Id: Id9b50c1fdeca4d87f158da717de8958330f027ef
2014-11-28 23:04:50 +01:00
Michael Giacomelli
aa2c55e105 Fix FS#13009.
This file revealed several problems with our ASF parser:

1)  The packet count in the ASF was actually a 64 bit value,
leading to overflow in very long files.

2)  Seeking blindly trusted the bitrate listed in the ASF header
rather than computing it from the packet size and number of packets.

Fix these problems and fix a few minor issues.

Change-Id: Ie0f68734e6423e837757528ddb155f3bdcc979f3
2014-11-28 22:30:05 +01:00
Marcin Bukat
0cd9e4e6bc hwstub/atj213x: add clock setup to crt0.S
Change-Id: I3b6e1b8ee1fa76396f7abe7df69af26e9599cfe9
Reviewed-on: http://gerrit.rockbox.org/1055
Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
Tested: Marcin Bukat <marcin.bukat@gmail.com>
2014-11-28 19:39:38 +01:00
Marcin Bukat
5e1381be87 qeditor: add clock analyser for ATJ213x
Change-Id: I5f5a3537d1ddf6b02684dd4c1dd13be862d3a918
Reviewed-on: http://gerrit.rockbox.org/1054
Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
2014-11-28 19:39:15 +01:00
Marcin Bukat
e99c036ed1 hwstub_shell: add support for call and jump
Change-Id: Ie09d0db21831b79255da858bada7382a08ff4eef
Reviewed-on: http://gerrit.rockbox.org/1052
Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
Tested: Marcin Bukat <marcin.bukat@gmail.com>
2014-11-28 19:38:02 +01:00
Marcin Bukat
9439635aa2 hwstub: lua functions for atj213x/irivere150
Change-Id: I3ab32996b4b6603fd7d66eee5b3bfd795b79eee1
Reviewed-on: http://gerrit.rockbox.org/1049
Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
Tested: Marcin Bukat <marcin.bukat@gmail.com>
2014-11-28 19:37:14 +01:00
Marcin Bukat
19f4e396fd regs-atj213x.xml upadte
Change-Id: Ia34dcf651e68ea66baebdeb8c056db86799ea33c
2014-11-18 23:30:44 +01:00
Marcin Bukat
cd04a5f1aa hwstub/qeditor: add support for atomic read/writes
The current code assumed that READ/WRITE would produce atomic read/writes for
8/16/32-bit words, which in turned put assumption on the memcpy function.
Since some memcpy implementation do not always guarantee such strong assumption,
introduce two new operation READ/WRITE_ATOMIC which provide the necessary
tools to do correct read and write to register in a single memory access.

Change-Id: I37451bd5057bb0dcaf5a800d8aef8791c792a090
2014-11-18 23:30:44 +01:00
Cástor Muñoz
794169a18f iPod Classic: fix HW_FREQ_32
Change-Id: I1e1b4e6ceb92eb793affaefc61ab082d5da735b4
2014-11-18 06:22:32 +01:00
Cástor Muñoz
61206ce468 Add myself to committers list
Change-Id: I3fa17e8146e00a8f5dcab282916c62909ba6e5ac
2014-11-18 02:31:24 +01:00