All of lore.kernel.org
 help / color / mirror / Atom feed
* Problems with a PCM driver
@ 2003-08-30 18:56 Adrian McMenamin
  2003-08-30 19:14 ` James Courtier-Dutton
  2003-08-31  7:04 ` Jaroslav Kysela
  0 siblings, 2 replies; 6+ messages in thread
From: Adrian McMenamin @ 2003-08-30 18:56 UTC (permalink / raw)
  To: ALSA development

I am writing a PCM driver for the AICA device on the Sega Dreamcast for a 
2.6.0-testX kernel.

The driver is far from complete, but I am having various problems when I test 
bits of it...

A simple write of a file gives me this...

/dev/snd # cat /test.txt > pcmC0D0p
ALSA sound/sh/aica.c:165: In snd_aica_playback_open
ALSA sound/sh/aica.c:80: Disabling AICA device
ALSA sound/sh/aica.c:66: Enabling AICA device
cat: write: File descriptor in bad state

The three snd_printk messages are just what I would expect but I am not sure 
why I get the message about the file descriptor.

Here is the open function...

static int snd_aica_playback_open(snd_pcm_substream_t *subs)
{
	snd_printk("In snd_aica_playback_open \n");
	snd_aica_pcm_t *aica_chip = snd_pcm_substream_chip(subs);
	snd_pcm_runtime_t *runtime = subs->runtime;
	runtime->hw = snd_aica_playback_hw;


	/*setup the aica spu*/
	
	spu_disable();
	spu_memset(0, 0, 0x31000);
	spu_memload(0, bin_arm7, sizeof(bin_arm7));
	spu_enable();

	
	return 0;
}


The device doesn't support dma (or rather nobody has yet successful reversed 
the DMA mechanism) and so I am using the methods that worked when I wrote the 
OSS driver for the 2.4 kernels.

snd_aica_playback_hw is...

static snd_pcm_hardware_t snd_aica_playback_hw = {
	.info = SNDRV_PCM_INFO_INTERLEAVED|SNDRV_PCM_INFO_NONINTERLEAVED,
	.formats = SNDRV_PCM_FORMAT_S8 | SNDRV_PCM_FORMAT_U8 | 
SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_IMA_ADPCM,
	.rates = SNDRV_PCM_RATE_8000_44100,
	.rate_min = 8000,
	.rate_max = 44100,
	.channels_min = 1,
	.channels_max = 2,
	.buffer_bytes_max = 32768,
	.period_bytes_min = 8192,
	.period_bytes_max = 32768,
	.periods_min = 1,
	.periods_max = 4
};

Anybody able to give me a few pointers as to what is going wrong?

Thanks

Adrian


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problems with a PCM driver
  2003-08-30 18:56 Problems with a PCM driver Adrian McMenamin
@ 2003-08-30 19:14 ` James Courtier-Dutton
  2003-08-30 19:22   ` Adrian McMenamin
  2003-08-31  7:04 ` Jaroslav Kysela
  1 sibling, 1 reply; 6+ messages in thread
From: James Courtier-Dutton @ 2003-08-30 19:14 UTC (permalink / raw)
  To: Adrian McMenamin; +Cc: ALSA development

Adrian McMenamin wrote:
> I am writing a PCM driver for the AICA device on the Sega Dreamcast for a 
> 2.6.0-testX kernel.
> 
> The driver is far from complete, but I am having various problems when I test 
> bits of it...
> 
> A simple write of a file gives me this...
> 
> /dev/snd # cat /test.txt > pcmC0D0p
> ALSA sound/sh/aica.c:165: In snd_aica_playback_open
> ALSA sound/sh/aica.c:80: Disabling AICA device
> ALSA sound/sh/aica.c:66: Enabling AICA device
> cat: write: File descriptor in bad state
> 
> The three snd_printk messages are just what I would expect but I am not sure 
> why I get the message about the file descriptor.
> 
Why don't you do instead: -
aplay test.txt

I don't think you can write to pcmC0D0p directly, you have to go via the 
alsa-lib.

Cheers
James




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problems with a PCM driver
  2003-08-30 19:14 ` James Courtier-Dutton
@ 2003-08-30 19:22   ` Adrian McMenamin
  2003-08-30 19:45     ` James Courtier-Dutton
  0 siblings, 1 reply; 6+ messages in thread
From: Adrian McMenamin @ 2003-08-30 19:22 UTC (permalink / raw)
  To: James Courtier-Dutton; +Cc: ALSA development

On Saturday 30 August 2003 20:14, James Courtier-Dutton wrote:
> Adrian McMenamin wrote:
> > I am writing a PCM driver for the AICA device on the Sega Dreamcast for a
> > 2.6.0-testX kernel.
> >
> > The driver is far from complete, but I am having various problems when I
> > test bits of it...
> >
> > A simple write of a file gives me this...
> >
> > /dev/snd # cat /test.txt > pcmC0D0p
> > ALSA sound/sh/aica.c:165: In snd_aica_playback_open
> > ALSA sound/sh/aica.c:80: Disabling AICA device
> > ALSA sound/sh/aica.c:66: Enabling AICA device
> > cat: write: File descriptor in bad state
> >
> > The three snd_printk messages are just what I would expect but I am not
> > sure why I get the message about the file descriptor.
>
> Why don't you do instead: -
> aplay test.txt
>
Is aplay a system call?

All I get is this...

/dev/snd # aplay /test.txt
aplay: No such file or directory


Incidentally, the mini-HOWTO on the site says this:

Now you are ready to put any soundfile you want into the PCM device of the 
first card. So try to cat any textfile (any file) to /dev/snd/pcmC0D0, like 
this: cat <filename> > /dev/snd/pcmC0D0. 

Thanks for the help anyway :)

Adrian


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problems with a PCM driver
  2003-08-30 19:22   ` Adrian McMenamin
@ 2003-08-30 19:45     ` James Courtier-Dutton
  2003-08-30 19:51       ` Adrian McMenamin
  0 siblings, 1 reply; 6+ messages in thread
From: James Courtier-Dutton @ 2003-08-30 19:45 UTC (permalink / raw)
  To: Adrian McMenamin; +Cc: ALSA development

Adrian McMenamin wrote:
> On Saturday 30 August 2003 20:14, James Courtier-Dutton wrote:
> 
>>Adrian McMenamin wrote:
>>
>>>I am writing a PCM driver for the AICA device on the Sega Dreamcast for a
>>>2.6.0-testX kernel.
>>>
>>>The driver is far from complete, but I am having various problems when I
>>>test bits of it...
>>>
>>>A simple write of a file gives me this...
>>>
>>>/dev/snd # cat /test.txt > pcmC0D0p
>>>ALSA sound/sh/aica.c:165: In snd_aica_playback_open
>>>ALSA sound/sh/aica.c:80: Disabling AICA device
>>>ALSA sound/sh/aica.c:66: Enabling AICA device
>>>cat: write: File descriptor in bad state
>>>
>>>The three snd_printk messages are just what I would expect but I am not
>>>sure why I get the message about the file descriptor.
>>
>>Why don't you do instead: -
>>aplay test.txt
>>
> 
> Is aplay a system call?
> 
> All I get is this...
> 
> /dev/snd # aplay /test.txt
> aplay: No such file or directory
> 
> 
> Incidentally, the mini-HOWTO on the site says this:
> 
> Now you are ready to put any soundfile you want into the PCM device of the 
> first card. So try to cat any textfile (any file) to /dev/snd/pcmC0D0, like 
> this: cat <filename> > /dev/snd/pcmC0D0. 
> 
> Thanks for the help anyway :)
> 
> Adrian
> 
> 
Have you installed alsa correctly?
alsa-driver, (Kernel modules like the one you are developing)
alsa-lib, (the alsa api.)
alsa-utils, (the one with aplay in it.)
alsa-tools (other useful tools.)
alsa-oss (if you want oss emulation in userland.)

Cheers
James



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problems with a PCM driver
  2003-08-30 19:45     ` James Courtier-Dutton
@ 2003-08-30 19:51       ` Adrian McMenamin
  0 siblings, 0 replies; 6+ messages in thread
From: Adrian McMenamin @ 2003-08-30 19:51 UTC (permalink / raw)
  To: James Courtier-Dutton; +Cc: ALSA development

On Saturday 30 August 2003 20:45, James Courtier-Dutton wrote:
> Adrian McMenamin wrote:
> > On Saturday 30 August 2003 20:14, James Courtier-Dutton wrote:
> >>Adrian McMenamin wrote:
> >>>I am writing a PCM driver for the AICA device on the Sega Dreamcast for
> >>> a 2.6.0-testX kernel.
> >>>
> >>>The driver is far from complete, but I am having various problems when I
> >>>test bits of it...
> >>>
> >>>A simple write of a file gives me this...
> >>>
> >>>/dev/snd # cat /test.txt > pcmC0D0p
> >>>ALSA sound/sh/aica.c:165: In snd_aica_playback_open
> >>>ALSA sound/sh/aica.c:80: Disabling AICA device
> >>>ALSA sound/sh/aica.c:66: Enabling AICA device
> >>>cat: write: File descriptor in bad state
> >>>
> >>>The three snd_printk messages are just what I would expect but I am not
> >>>sure why I get the message about the file descriptor.
> >>
> >>Why don't you do instead: -
> >>aplay test.txt
> >
> > Is aplay a system call?
> >
> > All I get is this...
> >
> > /dev/snd # aplay /test.txt
> > aplay: No such file or directory
> >
> >
> > Incidentally, the mini-HOWTO on the site says this:
> >
> > Now you are ready to put any soundfile you want into the PCM device of
> > the first card. So try to cat any textfile (any file) to
> > /dev/snd/pcmC0D0, like this: cat <filename> > /dev/snd/pcmC0D0.
> >
> > Thanks for the help anyway :)
> >
> > Adrian
>
> Have you installed alsa correctly?
> alsa-driver, (Kernel modules like the one you are developing)
> alsa-lib, (the alsa api.)
> alsa-utils, (the one with aplay in it.)
> alsa-tools (other useful tools.)
> alsa-oss (if you want oss emulation in userland.)
>
Errr, no. I suppose that might have something to do with it :)

To be frank, the site doesn't exactly make it particularly clear this is what 
you need to do - though I suppose I could always have asked :p

Thanks

Adrian


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Problems with a PCM driver
  2003-08-30 18:56 Problems with a PCM driver Adrian McMenamin
  2003-08-30 19:14 ` James Courtier-Dutton
@ 2003-08-31  7:04 ` Jaroslav Kysela
  1 sibling, 0 replies; 6+ messages in thread
From: Jaroslav Kysela @ 2003-08-31  7:04 UTC (permalink / raw)
  To: Adrian McMenamin; +Cc: ALSA development

On Sat, 30 Aug 2003, Adrian McMenamin wrote:

> I am writing a PCM driver for the AICA device on the Sega Dreamcast for a 
> 2.6.0-testX kernel.
> 
> The driver is far from complete, but I am having various problems when I test 
> bits of it...
> 
> A simple write of a file gives me this...
> 
> /dev/snd # cat /test.txt > pcmC0D0p
> ALSA sound/sh/aica.c:165: In snd_aica_playback_open
> ALSA sound/sh/aica.c:80: Disabling AICA device
> ALSA sound/sh/aica.c:66: Enabling AICA device
> cat: write: File descriptor in bad state

Use the aplay utility. The native devices need a special initialization 
using ioctl.

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-08-31  7:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-30 18:56 Problems with a PCM driver Adrian McMenamin
2003-08-30 19:14 ` James Courtier-Dutton
2003-08-30 19:22   ` Adrian McMenamin
2003-08-30 19:45     ` James Courtier-Dutton
2003-08-30 19:51       ` Adrian McMenamin
2003-08-31  7:04 ` Jaroslav Kysela

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.