XboxHacker BBS
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 18, 2013, 11:19:09 AM


Login with username, password and session length


Pages: 1
  Print  
Author Topic: linux device driver for xbox 360 audio  (Read 8710 times)
jc4360
Member
**
Posts: 10


View Profile
« on: October 02, 2009, 05:55:16 PM »

I am releasing the first version of linux device driver for xbox 360 audio. you can get source from here: http://www.megaupload.com/?d=SVAUYFBL. The device driver is alsa compitable, so basically you can compile mplayer and then it should play various music formats for you easily. It supports both analog stereo and digital spdif (only dobly digital by now). Thanks for tmbinc for his finding on 360 audio hardware details and his help on debuging the code. The license for the code is GPL.

In order to compile it, you will need to properly edit sound/pci/Makefile with the following statements, and also change Kconfig if needed. do not forget to enable ALSA support in your kernel.
snd-xenon-objs := xenon_snd.o
obj-$(CONFIG_SND_XENON) += snd-xenon.o

To compile mplayer, download MPlayer-1.0rc2.tar.bz2 and edit libmpcodecs/ad_hwac3.c by applying the following patch:

Code:
--- ad_hwac3.c  1969-12-31 19:15:52.000000000 -0500
+++ ad_hwac3.c.org      1969-12-31 19:15:17.000000000 -0500
@@ -144,4 +144,17 @@
 }

+static inline unsigned short bswap16(unsigned short a)
+{
+      return ((a&0xff)<<8) | ((a&0xff00)>>8);
+}
+
+static inline void mem_swap16(void *buf, int line)
+{
+    int i=0;
+    uint16_t *buf16 = (uint16_t *)buf;
+    for (i=0; i<line/2; i++)
+        buf16[i]=bswap16(buf16[i]);
+}
+
 static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen)
 {
@@ -177,4 +190,6 @@
     memset(buf + 8 + len, 0, 6144 - 8 - len);

+    mem_swap16(buf, 6144);
+
     return 6144;
   }
@@ -375,4 +390,6 @@
   memset(&buf[fsize + 8], 0, nr_samples * 2 * 2 - (fsize + 8));

+  mem_swap16(buf, nr_samples * 2 * 2);
+
   return nr_samples * 2 * 2;
 }

To test:
-bash-3.2# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: AudioPCI [Xenon AudioPCI], device 0: Xenon Audio [Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: AudioPCI [Xenon AudioPCI], device 1: Xenon Audio [Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

stereo music:
./mplayer -ao alsa:device=hw=0.0 music.mp3/ape/flac/wav

digital music:
./mplayer -ao alsa:device=hw=0.1 -ac hwac3 music.ac3
./mplayer -ao alsa:device=hw=0.1 -ac hwdts music.dts



Please feel free to improve this driver for the following things:
1) Interrupt: I could not get pci interrupt to work. This driver currently uses a timer interrupt.
2) DTS passthrough: my receiver could not decode the raw dts bit stream sent by mplayer, I guess one register was not set correctly for dts passthrough.  If you have a jtag setup on xbox 360 motherboard, you could help on this: put a dvd movie with dts track into 360 drive and play(check if your receiver receive dts signal), read 64 bytes from address 0xea001600 with your jtag device and then post the result here.
3) Mixer such as volumn setting etc.

The driver may not be bug free. I am not responsible for any damge that the driver may cause to your hardware, so use it at your own risk.
« Last Edit: October 02, 2009, 06:04:12 PM by jc4360 » Logged
Ced2911
Member
**
Posts: 26


View Profile
« Reply #1 on: October 03, 2009, 06:10:49 AM »

good job Smiley
Logged
barnhilltrckn
Hacker
***
Posts: 89


View Profile
« Reply #2 on: October 03, 2009, 06:15:52 PM »

Too bad I don't understand linux that good or I would give it a shot. Other than that great job man.
Logged
majinsoftware
Member
**
Posts: 25


View Profile
« Reply #3 on: October 04, 2009, 09:01:39 PM »

Any chance of some one building a live cd with it included.
Logged
jacksback
Master Hacker
****
Posts: 117



View Profile
« Reply #4 on: October 05, 2009, 07:55:33 AM »

Awesome job!
Logged
sandungas
Master Hacker
****
Posts: 212



View Profile
« Reply #5 on: October 05, 2009, 08:48:11 AM »

Any chance of some one building a live cd with it included.
jc4360 has said that the driver is buggy, it needs tests and improvements
Its too early now to talk about a new liveCD, but probably somebody will do it later on Wink

This are greats news Grin





Btw... i know that gentoo is the most proper distro to make a livecd for 360, because it is powerPC, but debian is a good choice too Wink
Debian is the "mother" of ubuntu... and ubuntu is the most used distro worldwide
Logged
jester
Master Hacker
****
Posts: 192


View Profile
« Reply #6 on: October 08, 2009, 08:11:47 PM »

Btw... i know that gentoo is the most proper distro to make a livecd for 360, because it is powerPC, but debian is a good choice too Wink
Debian is the "mother" of ubuntu... and ubuntu is the most used distro worldwide
I support this. Debian is fantastic to work with, much preferred over gentoo.
Logged
duggyuk
Master Hacker
****
Posts: 271


View Profile
« Reply #7 on: October 09, 2009, 02:40:18 AM »

whilst i'm pretty agnostic when it comes to Linux distros.. I'd prefer Debian over ubuntu  Grin
Logged
Coniger12
Master Hacker
****
Posts: 148


View Profile
« Reply #8 on: October 09, 2009, 02:48:09 AM »

Considering 360s are, for the better part, identical, a distro similar to ARCH Linux sounds ideal; where if servers are in-place, software can be compiled once and be usable for most(par-all) consoles, with a pacman-style package management system.
Logged

I like being the only person to rip from Lite-Ons using uxrip360.
slasherking823
Master Hacker
****
Posts: 222


View Profile
« Reply #9 on: October 09, 2009, 08:04:20 PM »

i run debian on my 360

Quote
tw... i know that gentoo is the most proper distro to make a livecd for 360, because it is powerPC, but debian is a good choice too
Debian is the "mother" of ubuntu... and ubuntu is the most used distro worldwide
and all things that run on the 360 are ppc not just gentoo
Logged

If that gamerscore or tenth prestige is so important to you that you absolutely need a pointless number - get it legit
If you are just trying to show off - throw a party(real party, not nerd party, some of you would miss that point)
If you like to be a fagot and go by "Jtags are for Mw2" - GTFO
wickwack
Member
**
Posts: 43


View Profile
« Reply #10 on: October 27, 2009, 02:32:43 PM »

i know it probably would run with the current xenosfb driver.. but what about fedora? i was reading around a bit about ppc linux and headed over to the fedora website.. went to the fedora 11 area and to my surprise they already have it available for ppc... quite impressive compared to ubuntu and many others...
Logged
mrowley
Newbie
*
Posts: 2


View Profile
« Reply #11 on: December 07, 2009, 11:02:01 AM »

hi, great work on the sound driver.

I am having a problem however ; (i am running a xenon and ubuntu 7.10)
I followed everything properly, it says to edit /sound/pci/makefile ... did that no probs, but it says to edit kconfig too if needed, but im not sure what to put.

I see alsa start up in the boot logs, but im not sure if its enabled or how to check.

The patch worked fine and patched 3 blocks (patch -p0 ad_hwac3.patch)
Then i ./configure'd then make then make install
rebooted

When i aplay-l i get no sound cards found.

Tried to update alsa to latests version but i get version.h missing when i try to compile, and the headers aren't available for this kernel??

Id love to get this driver running, any help would be greatly appreciated.
Logged
Pages: 1
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM