Amdtp - Linux-2.4

From IEEE 1394 FireWire Wiki
Jump to: navigation, search

OBSOLETE CONTENT

This wiki has been archived and the content is no longer updated.

Contents


Description

The amdtp driver implements the Audio & Music Data Transmission Protocol (to become IEC 61883-6). Using this protocol it's possible to transmit regular 44.1kHz stereo audio, but also multi-channel, 24-bit 192kHz audio or even DSD coded super audio and MIDI signals. The 1394 bus guarantees sufficient bandwidth, low latency and synchronized playback at different nodes.

The driver in the linux 1394 system currently only supports transmission so the driver is only useful if you have some 1394 audio hardware to playback the stream. Maybe, in the future, PC speakers with 1394 interface will become available, but at the moment 1394 audio is mostly used in professional audio equipment and the Sony Lissa components.

Also, the driver only handles the actual streaming, some connection management is also required for this to actually work. That is outside the scope of the driver, and furthermore it is not really standardized yet.

This module will likely be superceded in the future by the new raw1394-based isochronous API (rawiso) and libiec61883 (under development).


Dependencies

First you need to configure the kernel so that the ohci1394 and the cmp modules are built. The amdtp driver depends on these two modules so once you've enabled them, you should be able to select the amdtp driver. Now you can compile and install the kernel and modules.


/dev

Next step is to create the device node. The amdtp driver uses major 171 as the rest of the 1394 drivers, but uses minor 48, so to create the node you should write (as root):

mknod -m 666 /dev/amdtp c 171 48


/proc

None


Applications

amdtpplay uses libraw1394 instead of the amdtp module and performs reception instead of transmission, but it is an example application of this protocol. amdtpplay plays an audio stream received form the IEEE 1394 bus on the local soundcard.

Developers

At this point the driver is ready to use. The driver has a very simple interface: You open /dev/amdtp, configure it using an ioctl and then start writing samples. Much like a soundcard, except that the ioctl is special. The details are documented in amdtp.h, but a piece of sample code never hurts (error checking omitted):

        int main(int argc, const char *argv[])
        {
                int fd, retval;
                struct amdtp_ioctl cfg;
                FILE *fp;
                char buffer[4096];
               
                fd = open("/dev/amdtp", O_RDWR);
       
                cfg.format = AMDTP_FORMAT_IEC958_PCM;
                cfg.rate = 44100;
                cfg.dimension = 2;
                cfg.u.channel = 27;
                ioctl(fd, AMDTP_IOC_CHANNEL, &cfg);
       
                fp = fdopen(fd, "w");
                do {
                        retval = fread(buffer, 1, sizeof(buffer), stdin);
                        fwrite(buffer, 1, retval, fp);
                } while (retval == sizeof(buffer));
       
                fclose(fp);
        }

This piece of code reads 16 bit stereo samples from stdin and transmits them as 44.1 kHz stereo using isochronous channel 27. If you compile it to an executable named 'transmit' you could use it like this:

ogg123 -d raw -f - track.ogg | transmit

where ogg123 is the Ogg Vorbis command line player streaming the song 'track.ogg' to stdout.

Personal tools