2008-09-02 08:11:41     Audio Talkthrough on Bf537 Ezkit

Document created by Aaronwu Employee on Aug 7, 2013
Version 1Show Document
  • View in full screen mode

2008-09-02 08:11:41     Audio Talkthrough on Bf537 Ezkit

Daniele Pagani (ITALY)

Message: 61535   

 

Dear guys,

 

I'm interested to develop a software that is similar to the "talkthrough" in vdk distribution, but I want to develop it in uClinux.

 

My goal is to develop it in userspace and not in kernelspace, so I suppose to have all driver that I need (dma,interrupt,gpio,sport).

 

The funcions are as follows:

 

Init_Flags(); // initialize portf according to the bf537ezkit

 

Audio_Reset(); // in order to reset the ad1954 and ad1971 ad/da

 

Init_Sport0(); // need to configure the sport register

 

Init_DMA(); // to use dma transfer

 

Init_Interrupts(); // to use interrupt when dma completed

 

Enable_DMA_Sport0(); // to start transfer

 

void Init_Flags(void)

{

    int temp;

    // configure programmable flags

    // set PORTF function enable register (need workaround)

    temp = *pPORTF_FER;

    temp++;

    *pPORTF_FER = 0x0000;

    *pPORTF_FER = 0x0000;

 

    // set PORTF direction register

    *pPORTFIO_DIR = 0x1FC0;

      

       // set PORTF input enable register

    *pPORTFIO_INEN = 0x003C;

       

    // set PORTF clear register

    *pPORTFIO_CLEAR = 0x0FC0;

}

 

 

--> I can do this using /dev/gpio.. driver. It works fine.

 

void Audio_Reset(void)

{

    int i;

    // give some time for reset to take affect

    for(i = 0; i< delay;i++){};

   

    // set port f set register

    *pPORTFIO_SET = PF12;

 

}

 

 

--> I can do this using /dev/gpio.. driver. It works fine.

 

void Init_Sport0(void)

{

    // Sport0 receive configuration

    // External CLK, External Frame sync, MSB first, Active Low

    // 24-bit data, Secondary side enable, Stereo frame sync enable

// Users of ADSP-BF537 EZ-KIT Board Rev 1.0 must enable the internal clock and frame sync  

//    *pSPORT0_RCR1 = RFSR | LRFS | RCKFE | IRFS | IRCLK;

    *pSPORT0_RCR1 = RFSR | RCKFE;

    *pSPORT0_RCR2 = SLEN_24 | RSFSE;

//    *pSPORT0_RCLKDIV = 0x0013;

//    *pSPORT0_RFSDIV = 0x001F;

  

    // Sport0 transmit configuration

    // External CLK, External Frame sync, MSB first, Active Low

    // 24-bit data, Secondary side enable, Stereo frame sync enable

// Users of ADSP-BF537 EZ-KIT Board Rev 1.0 must enable the internal clock and frame sync

//    *pSPORT0_TCR1 = TFSR | LTFS | TCKFE | ITFS | ITCLK;

    *pSPORT0_TCR1 = TFSR | TCKFE;

    *pSPORT0_TCR2 = SLEN_24 | TSFSE;

 

//    *pSPORT0_TCLKDIV = 0x0013;

//    *pSPORT0_TFSDIV = 0x001F;

  

}

 

--> Uhm, I have driver /dev/sport0 and I can open/read and so on on it, but I don't understand how can I setup a register with /dev/sport0 so I don't understand what string the ioctl function needs to work. Where can I find the declaration of registers that I can use?

 

void Init_DMA(void)

{

    // Configure DMA3

    // 32-bit transfers, Interrupt on completion, Autobuffer mode

    *pDMA3_CONFIG = WNR | WDSIZE_32 | DI_EN | FLOW_1;

    // Start address of data buffer

    *pDMA3_START_ADDR = iRxBuffer1;

    // DMA loop count

    *pDMA3_X_COUNT = 2;

    // DMA loop address increment

    *pDMA3_X_MODIFY = 4;

  

 

    // Configure DMA4

    // 32-bit transfers, Autobuffer mode

    *pDMA4_CONFIG = WDSIZE_32 | FLOW_1;

    // Start address of data buffer

    *pDMA4_START_ADDR = iTxBuffer1;

    // DMA loop count

    *pDMA4_X_COUNT = 2;

    // DMA loop address increment

    *pDMA4_X_MODIFY = 4;

 

}

 

void Enable_DMA_Sport0(void)

{

    // enable DMAs

    *pDMA4_CONFIG    = (*pDMA4_CONFIG | DMAEN);

    *pDMA3_CONFIG    = (*pDMA3_CONFIG | DMAEN);

  

    // enable Sport0 TX and RX

    *pSPORT0_TCR1     = (*pSPORT0_TCR1 | TSPEN);

    *pSPORT0_RCR1     = (*pSPORT0_RCR1 | RSPEN);

}

 

--> I don't know how can I setup the dma registers; please, consider that I want to use userspace and not kernelspace.

 

void Init_Interrupts(void)

{

    // Set Sport0 RX (DMA3) interrupt priority to 2 = IVG9

    *pSIC_IAR0 = 0xff2fffff;

    *pSIC_IAR1 = 0xffffffff;

    *pSIC_IAR2 = 0xffffffff;

    *pSIC_IAR3 = 0xffffffff;

 

    // assign ISRs to interrupt vectors

    // Sport0 RX ISR -> IVG 9

    register_handler(ik_ivg9, Sport0_RX_ISR);

 

    // enable Sport0 RX interrupt

    *pSIC_IMASK = 0x00000020;

}

 

--> I don't understand how can I manage a interrupt; that "include" do I need?

 

Any suggestions is very appreciated.

 

Best regards,

 

Daniele.

 

 

TranslateQuoteReplyEditDelete

 

 

2008-09-02 09:35:58     Re: Audio Talkthrough on Bf537 Ezkit

Mike Frysinger (UNITED STATES)

Message: 61542   

 

we dont really support VDSP porting of code.  that is left as an exercise for the user.

 

the SPORT driver is currently documented here ... for more info, you'll have to refer to the driver source itself:

http://docs.blackfin.uclinux.org/doku.php?id=sport_driver

 

you cannot manage DMA resources or interrupts from userspace.  that needs to be done from a kernel driver.

QuoteReplyEditDelete

 

 

2008-09-02 09:52:18     Re: Audio Talkthrough on Bf537 Ezkit

Robin Getz (UNITED STATES)

Message: 61544   

 

Daniele:

 

Audio talk through example in userspace. Type this at a command line prompt.

 

vrec -w | vplay

 

That is all there is too it.

QuoteReplyEditDelete

 

 

2008-09-02 10:14:07     Re: Audio Talkthrough on Bf537 Ezkit

Daniele Pagani (ITALY)

Message: 61547   

 

Thank you very much for your support, but some considerations:

 

1) I've tried vrec and vplay, but in my application I need to use an audio alghoritm (filters, gain, limiters and so on) from n inputs to m outputs. So, I'd like to reach the result by writing my application. I need also to change parameters (cut frequency of the filters) and so on by tcp/ip protocol, so I need my application and not something yet ready.

 

2) So, if I understand, the best solution is to develop something in the kernel space, and then develop something in user space. But, I don't understand, is not possible to setup dma in userspace? Is not possible to setup interrupt in userspace; so for example, can I use an interrupt timer in userspace?

 

Sorry, but I'm a little confused about the matter.

 

Best regards,

 

Daniele.

TranslateQuoteReplyEditDelete

 

 

2008-09-02 11:37:30     Re: Audio Talkthrough on Bf537 Ezkit

Mike Frysinger (UNITED STATES)

Message: 61549   

 

userspace cannot access supervisor resources.  that means MMRs, or DMA, or interrupts, or ......

 

that is for the kernel to handle

QuoteReplyEditDelete

 

 

2008-09-02 14:53:00     Re: Audio Talkthrough on Bf537 Ezkit

Robin Getz (UNITED STATES)

Message: 61554   

 

Daniele:

 

So, talk to the audio device like vrec/vplay - as a device. (open /dev/dsp and read/write from/to it).

 

Best thing to do is develop everything on your host x86 PC, and then when you have it working, move it to the Blackfin.

 

-Robin

QuoteReplyEditDelete

 

 

2008-09-03 03:43:43     Re: Audio Talkthrough on Bf537 Ezkit

Daniele Pagani (ITALY)

Message: 61559   

 

Dear guys,

 

I think that I need to develop kernel in order to have /dev/dsp working in according to my board.

 

That is, the bf537 ezkit has ad 1854 and ad 1871 ad/da.

 

So, if I understand, I need to develop these drivers (in kernel space) usign interrupt, sport and so on and then I need to develop in userspace using /dev/dsp driver in order to read, write and so on.

 

Has somebody develop driver for the bf 537 ezkit?

 

Thank you very much,

 

best regards,

 

Daniele.

TranslateQuoteReplyEditDelete

 

 

2008-09-03 10:59:22     Re: Audio Talkthrough on Bf537 Ezkit

Mike Frysinger (UNITED STATES)

Message: 61575   

 

please review:

http://docs.blackfin.uclinux.org/doku.php?id=hw:boards:bf537-ezkit#on-board_audio

QuoteReplyEditDelete

 

 

2008-09-09 13:46:35     Re: Audio Talkthrough on Bf537 Ezkit

Jason Hennigar (CANADA)

Message: 61846   

 

Hi Daniele,

 

There is an ALSA test application that I put together that has a capture and a playback thread with a queue between the two for transfering the audio sample buffers. You can find the alsatest.tar.gz at the following link, download the larger one.

 

https://blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=4393

 

Cheers!

 

Jason

QuoteReplyEditDelete

Attachments

    Outcomes