Skip to contentSkip to conversation

e-mu 1212m and 1820(m) patch

PATCH Ctirad Fertr 2 participants 7 messages May 11, 2007 – May 13, 2007

lore
Share & tools
lore
#0 lore raw

Hello,

here is a little patch which enables ADAT and S/PDIF functionality. It adds possibility to sync with either S/PDIF or ADAT clock as well. 44.1/48kHz only, though it works pretty well for me.

Regards,

Ctirad

pci/emu10k1/emumixer.c +46 -6
diff -ruN a/pci/emu10k1/emumixer.c b/pci/emu10k1/emumixer.c
@@ -500,17 +500,19 @@
 static int snd_emu1010_internal_clock_info(struct snd_kcontrol *kcontrol,
 					  struct snd_ctl_elem_info *uinfo)
 {
-	static char *texts[2] = {
-		"44100", "48000"
+	static char *texts[4] = {
+		"44100", "48000", "SPDIF", "ADAT"
 	};
-
+		
 	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
 	uinfo->count = 1;
-	uinfo->value.enumerated.items = 2;
-	if (uinfo->value.enumerated.item > 1)
-                uinfo->value.enumerated.item = 1;
+	uinfo->value.enumerated.items = 4;
+	if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
+		uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
 	strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
 	return 0;
+	
+	
 }
 
 static int snd_emu1010_internal_clock_get(struct snd_kcontrol *kcontrol,
@@ -568,6 +570,44 @@
 			/* Unmute all */
 			snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE );
 			break;
+			
+		case 2: /* Take clock from S/PDIF IN */
+			/* Mute all */
+			snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_MUTE );
+			/* Default fallback clock 48kHz */
+			snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, EMU_HANA_DEFCLOCK_48K );
+			/* Word Clock source, sync to S/PDIF input */
+			snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK,
+				EMU_HANA_WCLOCK_HANA_SPDIF_IN | EMU_HANA_WCLOCK_1X );
+			/* Set LEDs on Audio Dock */
+			snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2,
+				EMU_HANA_DOCK_LEDS_2_EXT | EMU_HANA_DOCK_LEDS_2_LOCK );
+			/* FIXME: We should set EMU_HANA_DOCK_LEDS_2_LOCK only when clock signal is present and valid */	
+			/* Allow DLL to settle */
+			msleep(10);
+			/* Unmute all */
+			snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE );
+			break;
+		
+		case 3: 			
+			/* Take clock from ADAT IN */
+			/* Mute all */
+			snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_MUTE );
+			/* Default fallback clock 48kHz */
+			snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, EMU_HANA_DEFCLOCK_48K );
+			/* Word Clock source, sync to ADAT input */
+			snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK,
+				EMU_HANA_WCLOCK_HANA_ADAT_IN | EMU_HANA_WCLOCK_1X );
+			/* Set LEDs on Audio Dock */
+			snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, EMU_HANA_DOCK_LEDS_2_EXT | EMU_HANA_DOCK_LEDS_2_LOCK );
+			/* FIXME: We should set EMU_HANA_DOCK_LEDS_2_LOCK only when clock signal is present and valid */	
+			/* Allow DLL to settle */
+			msleep(10);
+			/*   Unmute all */
+			snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE );
+			 
+			
+			break;		
 		}
 	}
         return change;
pci/emu10k1/emu10k1_main.c +3 -3
diff -ruN a/pci/emu10k1/emu10k1_main.c b/pci/emu10k1/emu10k1_main.c
@@ -765,8 +765,8 @@
 	snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg );
 	snd_printk(KERN_INFO "emu1010: Card options=0x%x\n",reg);
 	snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp ); 
-	/* ADAT input. */
-	snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x01 );
+	/* Optical -> ADAT I/O  */
+	snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, EMU_HANA_OPTICAL_IN_ADAT | EMU_HANA_OPTICAL_OUT_ADAT );
 	snd_emu1010_fpga_read(emu, EMU_HANA_ADC_PADS, &tmp );
 	/* Set no attenuation on Audio Dock pads. */
 	snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00 );
@@ -1048,7 +1048,7 @@
 	emu->emu1010.output_source[23] = 28;
 
 	/* TEMP: Select SPDIF in/out */
-	snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x0); /* Output spdif */
+	//snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x0); /* Output spdif */
 
 	/* TEMP: Select 48kHz SPDIF out */
 	snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x0); /* Mute all */

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#1 lore raw
Quoted 10 lines · Ctirad Fertr

Hello,

here is a little patch which enables ADAT and S/PDIF functionality. It adds possibility to sync with either S/PDIF or ADAT clock as well. 44.1/48kHz only, though it works pretty well for me.

Regards,

Ctirad

Nice work. Did you manage to do this from just the comments I had placed in the source code, or did you use some other method?

I would like to put enough comments in the source code so others, like yourself, can add functionality that I have not had time to.

James

#2 lore raw

Dne sobota 12 květen 2007 10:46 James Courtier-Dutton napsal(a):

Quoted 2 lines

Nice work. Did you manage to do this from just the comments I had placed in the source code, or did you use some other method?

I learned most part form the register names in emu10k1.h. They are quite self explaining.

Quoted 2 lines

I would like to put enough comments in the source code so others, like yourself, can add functionality that I have not had time to.

It would be nice. There is another developer, Dustin, who I meet at local linux forum. He tries to find a way how to add more 24 bit capture channels then 8. It is confusing, as we don't have enough informations about connections between Hana and emu10k2. We belive EMU32 buses are 32bit and not 16 bit. The windows driver can record from (at least) 16 channels, anyway. Multichannel playback needs to be fixed as well. We need a help or at least a hint from you as you are only person who have datasheets.

Regards,

Ctirad
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#3 lore raw
Quoted 18 lines · Ctirad Fertr

Dne sobota 12 květen 2007 10:46 James Courtier-Dutton napsal(a):

Quoted 2 lines

Nice work. Did you manage to do this from just the comments I had placed in the source code, or did you use some other method?

I learned most part form the register names in emu10k1.h. They are quite self explaining.

Quoted 2 lines

I would like to put enough comments in the source code so others, like yourself, can add functionality that I have not had time to.

It would be nice. There is another developer, Dustin, who I meet at local linux forum. He tries to find a way how to add more 24 bit capture channels then 8. It is confusing, as we don't have enough informations about connections between Hana and emu10k2. We belive EMU32 buses are 32bit and not 16 bit. The windows driver can record from (at least) 16 channels, anyway. Multichannel playback needs to be fixed as well. We need a help or at least a hint from you as you are only person who have datasheets.

Quoted 3 lines

Regards,

Ctirad

The link between hana and emu10k2 is 32bit.
The link between the emu10k2 and the PCI bus for capture is 16bit and limited to 16 channels. I decided to instead make this link 32bit, by using 2 16bit channels, thus resulting in 16/2 = 8 channels. I do have one datasheet that hints at a 24bit channel from emu10k2 and the PCI bus, but I have not checked if the 1212m version of the emu10k2 supports it. It might only be the 1616m that supports it, and I have not added support for that in alsa yet.

James

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#4 lore raw
Quoted 3 lines

The link between hana and emu10k2 is 32bit.
The link between the emu10k2 and the PCI bus for capture is 16bit and limited to 16 channels.

Really? I'm almost sure that emu10k2 is capable of 64 streams at 16/44.1 (48kHz) resolution.

Quoted 5 lines

I decided to instead make this link 32bit, by
using 2 16bit channels, thus resulting in 16/2 = 8 channels. I do have one datasheet that hints at a 24bit channel from emu10k2 and the PCI bus, but I have not checked if the 1212m version of the emu10k2 supports it.

A friend of mine does 16 channel recordings on 1820m under windows, so it's definitely possible. I have only 1212M (old version) and it's capable of 12 ins and 12 outs at 44.1/48kHz, 8 ins and 8 outs at 96kHz and finally 4 ins and 4 outs at 192kHz.

Quoted 2 lines

It might only be the 1616m that supports it, and I have not added support for that in alsa yet.

How much difference is between current 1820 (old 1010) and 1616 (new 1010) code? Do you have something working? Anyway, I have good relations with local e-mu delaer, so I can borrow any e-mu hardware currently available. I also have gear needed for testing S/PDIF/ADAT/sync card functionality.

Regards,

Ctirad

#5 lore raw
Quoted 7 lines · Ctirad Fertr
Quoted 3 lines

The link between hana and emu10k2 is 32bit.
The link between the emu10k2 and the PCI bus for capture is 16bit and limited to 16 channels.

Really? I'm almost sure that emu10k2 is capable of 64 streams at 16/44.1 (48kHz) resolution.

For playback, not for capture.

Quoted 10 lines
Quoted 5 lines

I decided to instead make this link 32bit, by
using 2 16bit channels, thus resulting in 16/2 = 8 channels. I do have one datasheet that hints at a 24bit channel from emu10k2 and the PCI bus, but I have not checked if the 1212m version of the emu10k2 supports it.

A friend of mine does 16 channel recordings on 1820m under windows, so it's definitely possible. I have only 1212M (old version) and it's capable of 12 ins and 12 outs at 44.1/48kHz, 8 ins and 8 outs at 96kHz and finally 4 ins and 4 outs at 192kHz.

What resolution? 16bit or 24bit. I could get the above working for 16bit capture.

Quoted 8 lines
Quoted 3 lines

It might only be the 1616m that supports it, and I have not added support for that in alsa yet.

How much difference is between current 1820 (old 1010) and 1616 (new 1010) code? Do you have something working? Anyway, I have good relations with local e-mu delaer, so I can borrow any e-mu hardware currently available. I also have gear needed for testing S/PDIF/ADAT/sync card functionality.

I have not tried the 1616 yet. I expect that it will require different firmware, but I have to test first.

Quoted 8 lines

Regards,

Ctirad
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#6 lore raw
Quoted 7 lines
Quoted 4 lines

A friend of mine does 16 channel recordings on 1820m under windows, so it's definitely possible. I have only 1212M (old version) and it's capable of 12 ins and 12 outs at 44.1/48kHz, 8 ins and 8 outs at 96kHz and finally 4 ins and 4 outs at 192kHz.

What resolution? 16bit or 24bit. I could get the above working for 16bit capture.

24 bit. A pro card with 16 bit resolution would be quite a rarity nowdays ;)

Regards,

Ctirad