• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Operating System/Drivers
  • Assigned To No-one
  • Operating System Another
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by mcuelenaere - 2008-03-05
Last edited by mcuelenaere - 2008-07-30

FS#8686 - Creative Zen Vision:M Rockbox Port

This is the Creative ZVM Port FlySpray task; I opened it on request of NicolasP.

More information is available on and

Current attached diff contains code which isn't very clean and certainly not formatted according to Rockbox guidelines, I'll have to look in to this (later).

   zvm.diff (80.7 KiB)
Closed by  mcuelenaere
2008-07-30 16:00
Reason for closing:  Accepted
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

Already in SVN for a long time

Current status (see diff).

I formatted some files according to the guidelines and cleaned some code.

Current problems have to do with IRQ, sometimes the device gives me an not-set interrupt and this seems to be for example when I want to assign a start value to a char array.
Also the load_context() problems aren't solved either, and I think it is related to the above problem (something with IRQ-stack ↔ normal stack?)

I tried making a basic Rescue Mode, but as the current button driver can't announce key releases it is hard to use them (there has to be some kind of command to the PIC to get the current pressed buttons, but I haven't found it yet → do_write() )

Maybe a last remark should be that the player crashes when IRQ and FIQ mode is disabled → I don't think this should happen?

   zvm.diff (93.7 KiB)

After days and days of bughunting stupid me just didn't read the datasheet correctly; that's why I reversed the IRQ handler in system-dm320.c to the original one: this one works correctly :)

So finally the code is running stable on the device (except for the load_context() part, which still isn't resolved).

I optimized the button driver and added a system_reboot(), the I²C driver now interprets addresses as the OF (although it is feed differently to the I²C registers), a basic rescue mode is available by pressing the Menu button (bottom right); I think that's all: for more info, see the code.

These are some isolated diff's to current SVN, normally these should be commit-ready.

i2c.diff: adds support for I²C
spi.diff: adds support for ZVM + ZVM's LCD
system.diff: adds system_reboot(), support for ZVM and resets interrupts to default priorities + some minor changes

This is the correct version of i2c.diff

   i2c.diff (7.6 KiB)

* threading now works apart from sleep_thread() → I haven't figured out yet what's wrong with that
* I reworked scramble so now Creative FW generating is fully done during building (no more need to build a CIFF structure around it)
* ATA seems to work pretty decently, but the FS still hasn't been figured out yet
* some other changes

This patch hasn't been reviewed for unwanted changes, so it could affect other targets.

   zvm.diff (130.9 KiB)

BTW the problem with threading was that there wasn't another thread created (besides main) before a yield() call was done, so it was trying to switch to the current thread which obviously didn't work. Shouldn't there be some check for this?

* added support for Zen V in scramble
* ATA works perfectly until it spins down; it won't spin up anymore currently..
* there's a simple FS info dialog when you press PLAY → BACK → CUSTOM → BACK → CUSTOM
* the sleep() bug still exists

   zvm.diff (131.4 KiB)

* sleep() bug is fixed with workaround
* ATA problem is solved, it will spin up and down when it's needed
* some basic HDD browsing is implemented when PLAY is pressed (see code for more info)

   zvm.diff (131.4 KiB)

And that of course wasn't the right diff…

   zvm.diff (131.6 KiB)

Forgot to add some extra files…

   zvm.diff (164.2 KiB)

* basic USB driver added
* 'normal' compiling works due to stub code added
* optimizations and (bug)fixes here and there

   zvm.diff (214.4 KiB)
MikeS commented on 2008-04-07 02:40

For compatibility core_sleep should be updated to simply use enable_irq after the WFI command (I guess this could just share that function with imx31 if this is also what would be a final implementation).

Sorry, I didn't saw that line :)
I also think clearing the interrupt at core level shouldn't be done? That's why I used the imx31 implementation as you suggested.

   zvm.diff (211.7 KiB)
MikeS commented on 2008-04-07 20:52

The imx31 was changed and the asm was also unmasking FIQ at core level but now the scheduler keeps clear of FIQ entirely. Scheduling takes over control of whether core-level interrupts are masked or not for two reasons (up to HIGHEST_IRQ_LEVEL so not the audio interrupt) :

1) Making core_sleep does not actually sleep if an interrupt becomes pending after checking if the run list is NULL and the core_sleep operation has been committed to. Processor that allow wakeup with them still masked make this easy. SH and s3c2440 need some tricks to do it atomically since they won't wake with them masked.
2) Having them masked and forcing a task switch can leave them masked for an unbounded length of time anyway since the nesting doesn't operate as such when turning control to other code.

* new USB int handler making USB code totally stable
* some code is committed to SVN

The only problem now is that I only get SUSP, VBUS & RESM statuses..

   zvm.diff (31.5 KiB)

* do endpoints like described in the manual(s)
* do NOT set up endpoint 0 as a non-control endpoint :)
* other changes I forgot to mention

   zvm.diff (31.5 KiB)

Forgot to 'svn add' some files…

   zvm.diff (58.2 KiB)

Forgot to add the whole target/arm/tms320dm320/creative-zvm/ dir..

   zvm.diff (105.5 KiB)

* some (minor) USB changes
* added missing files in the patch

   zvm.diff (127.8 KiB)

* fixed bug in button driver where first button wouldn't get detected correctly
* the usual USB changes without any useful results :(

   zvm.diff (129.1 KiB)

So the problem with the USB chip was that somehow the interrupts don't come through, so I worked around this through a pulling method at every tick.
Now I can receive the EP0SETUP and identify it as a GET_CONFIG, but that's as far as I currently can get.

   zvm.diff (130.1 KiB)

Sync with SVN

   zvm.diff (126 KiB)

* added keymappings
* non-bootloader can get to app_main(), but fails when some function uses IRAM-allocated data (something is currently wrong with IRAM) e.g. lcd_init()

   zvm.diff (152.6 KiB)

* it boots Rockbox :)
* current requirements for booting Rockbox is that you've deleted the cfs partition and replaced it by a fat partition
* keymap is badly implemented, almost no keys work

   zvm.diff (153.3 KiB)

* keys are for some unknown reason repeated indefinitely on main menus, so you can only choose the first and last item
* debug menu works
* code cleanup

   zvm.diff (156.5 KiB)

Current state at trying to get sound working (using Catalin's DSP patch)

   zvm.diff (29.8 KiB)

Forgot some files…

   zvm.diff (45.9 KiB)

This is Toni's emulator with some modifications running the ZVM's flash dump.
It doesn't yield any (very) interesting results though, I'm waiting for the SoC project which I'm planning to help with porting to the DM320.

   ARMemu.rar (653.7 KiB)


Available keyboard shortcuts


Task Details

Task Editing