Recent blog entries for zx80user

Whoo hoo, booted up to journeyer level. Feel like a proper kernel hacker now :)

Actually, been struggling a little with the mixer code on the driver, but worked out what was wrong (the documentation referred to the api in the alsa-driver tree which is somewhat ahead of the code in the kernel).

21 Mar 2006 (updated 21 Mar 2006 at 14:30 UTC) »

Although I claimed to have a working driver ten days ago in fact all it did was play 8 bit mono. Now I have one that will play 16 bit stereo too.

Try as I might I just could not get the stereo to work - firstly because I assumed that, as I had done with the OSS driver, I'd have to write the stereo separation code myself (in fact the ALSA middle layer does all that) and then because of what appeared to be repeated buffer over-runs.

I had built an OSS only version of mpg123 to test this and try as I might I just got clicks and gaps as the middle layer responded to the over runs by restarting the DMA transfer.

Eventually I realised that ALSA was assuming that my buffer stayed a constant size (in fact it doubles in size for stereo). Once I cut the hardware buffers in half and fixed up the period sizes to something close to optimum it all worked.

I can now also see how to add additional channels - not too difficult really. But I am not sure I can see a reason.

Working on the mixer code now.

12 Mar 2006 (updated 12 Mar 2006 at 01:16 UTC) »

Well, after a mere three years I have a working ALSA driver for the Dreamcast. Had to get a lot of help from the ALSA developers to do it - so special thanks to James Courier-Dutton and Lee Revell - but it's a good feeling.

The code is now at

Key events today were fianlly burning a new boot cdrom so I didn't have to struggle with the five year old one that would only boot when cold (I assume that was the reason) and realising that timer polling was the way to go - the ARM7->SH4 interrupt clearly wasn't fully reversed as it just didn't worked as described.

Well, the driver now plays something a bit more sophisticated than crackles - it even sounds slightly like my daughter telling me I've got an email when I use my test sound.

But I still have lots of problems. it only plays on the left hand side for instance (a consequence of me not working out how to handle stereo in this model) and it get stuck in an endless loop. Previously - in the white noise era - it didn't, so it's been two steps forward and one step back in that regard.

The main breakthrough today has been on the ARM7 side - I dug up some arm7-elf generating tools (couldn't be bothered to build them all myself so got RPMs and installed them on a Fedora box I have here - my main dev box is Ubuntu these days). Wrote some new code to raise an interrupt - needed, I think, for the driver's overall health - and not only did this code work (the SH4 portion treats it as firmware), it played better sound - I think the only firmware may have been broken or corrupted over time.

The driver now plays screeches and crackles - so it is giving me sound output. Lying in bed last night I realised there were several more simple changes to make to get me closer, but at heart I fear the DMA mechanism I have chosen is wrong and might need to be looked at again.

Just got the DMA to start working on the driver and I am therefore filled with glee. I still have lots to do, but I am beginning to feel that a three year quest is approaching the end!

15 Feb 2006 (updated 15 Feb 2006 at 14:16 UTC) »

Well, have finally made some progress on the ALSA driver - though now have to get stuck into the meat of the DMA API and face the fact that the existing Linux g2 DMA is 99% certain to be broken.

But it's still a thrill to see a piece of code go from completely broken to behaving as expected after just a few tweaks. That is what hacking is all about!

<aside>Anybody else think the Advogato UI is less than optimal?</aside>
Anyway, made a little progress on the driver - though spent a lot of the last week's spare time building a PC from scratch (for the first time) as the old one relied on a not very stable wireless driver and accordingly locked up every 48 hours or so - but the box was far, far too noisy to move to the living room and plug into the ethernet.
Anyway, driver still does nothing real but now (at least partially) properly handles the kobject model in the 2.6 kernels...

Just a brief one - as i won't be about for a few days. Wondered why my driver didn't show up in /proc and then realised that was because I wasn't registering the device. So fixed that - so proc now acknowledges my existence.
Reading the diary entries below, from the first iteration of this effort worried me a bit last night - because it suggested that I was going wrong... hmmm. Well, the last time round went nowhere so I hope that was the wrong one :)

Ok, it's almost two years since I last was here and the funny thing is nothing much has changed ... still looking to write an ALSA module for the Dreamcast.
In the last two years my Linux knowledge has come on leaps and bounds - after 4 years of the OS I no longer feel like a newbie all the time and can even answer other people's questions on my LUG email group with a little authority (well, some of them anyway).
C coding has taken a back seat though I've hacked quite a lot of perl in the last two years.
Now I've helped inject a little bit of life into the Dreamcast port of SH (general work was powering ahead, but the DC side of it was pretty dead) by posting up a working kernel on my website (here) and have at least written a few lines of code to get the ALSA port started again (on my subversion repository if you're interested).
Progress will be slow - despite a little effort at trying to get myself a job as a hacker based on the perl stuff, I am still working in communications, so this is strictly part time :)

8 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!