electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » Instruments and Equipment » Chameleon
DMA buffer ready interrupt?
Post new topic   Reply to topic
Page 1 of 1 [5 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
BobTheDog



Joined: Feb 28, 2005
Posts: 4044
Location: England
Audio files: 32
G2 patch files: 15

PostPosted: Mon Jun 30, 2008 1:53 pm    Post subject: DMA buffer ready interrupt? Reply with quote  Mark this post and the followings unread

Well here is the first technical question for the Chameleon masters:

Using DMA to fill a buffer from the ADC is it possible to have an interrupt fired when this buffer is full?

Cheers

Andy
Back to top
View user's profile Send private message
DrJustice



Joined: Sep 13, 2004
Posts: 2114
Location: Morokulien
Audio files: 4

PostPosted: Mon Jun 30, 2008 2:32 pm    Post subject: Reply with quote  Mark this post and the followings unread

Yes it is.

The DSP56303 User Manual (DSP56303UM.pdf), page 4-33 documents the use of the DIE bit in the DMA channel Control Registers (DCRn). Add your interrupt handler to the vector table, set DIE and you should be good to go.

BTW, the 'dspthru' example project shows the use of serial port interrupts to drive the audio IO - useful in this case to illustrate the use of interrupts.

DJ
--
Back to top
View user's profile Send private message Visit poster's website
DrJustice



Joined: Sep 13, 2004
Posts: 2114
Location: Morokulien
Audio files: 4

PostPosted: Mon Jun 30, 2008 2:49 pm    Post subject: Reply with quote  Mark this post and the followings unread

...so a few lines like the following, e.g. for DMA channel 0:
Code:

  ; Set up the interrupt vector
  org   P:VecDMA0
  JSR   >my_DMA0_interrupt   
  ; ... ... ...

  ; Set up DMA and enable the DMA interrupt
  ; ... ... ...
  BSET   #DCR_DIE,X:<<DCR0 
  ; ... ... ...

my_DMA0_interrupt:
  ; Do stuff!
  ; ... ... ... ...
  RTI

DJ
--
Back to top
View user's profile Send private message Visit poster's website
BobTheDog



Joined: Feb 28, 2005
Posts: 4044
Location: England
Audio files: 32
G2 patch files: 15

PostPosted: Mon Jun 30, 2008 3:39 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hi Are,

Thanks for the info.

I will have a read of that section of the document tomorrow morning over coffee.

I have looked through the polling, interrupt and DMA code in the dspthru project, this is what made me think about triggering an interrupt from the DMA.

Is this usually how you do this or is there a "better" way?

Cheers

Andy
Back to top
View user's profile Send private message
DrJustice



Joined: Sep 13, 2004
Posts: 2114
Location: Morokulien
Audio files: 4

PostPosted: Mon Jun 30, 2008 4:16 pm    Post subject: Reply with quote  Mark this post and the followings unread

BobTheDog wrote:
Is this usually how you do this or is there a "better" way?

Well... there are several ways, if nothing else.

The examples are using the the audio dma driver ('audio_ama.asm' file) run the DMA without interrupts, and the audio processing is done in a loop in the foreground. At the end of each iteration ChangeActiveBufferDMA is called and loops until the current DMA transfer is done, then it swaps the buffer pointers (...as you have made out, just filling in for other readers).

The host communication is interrupt driven in (most of?) the Soundart examples, but it could have been run in the foreground too.

Then there's the serial port interrupt. It's slightly less efficient and flexible (context changes, hard realtime), but can be used for the quickest response time. The audio processing could then run in that interrupt handler. Host communication could be run in the foreground.

And, you can use the DMA interrupt, as you are onto, to swap buffer pointers, emit signals and/or run your processing.

So, one can mix and match depending on priorities and convenience. Using DMA (with or without interrupts) is probably a good idea for most applications. Use a very short buffer for low latency or a longer buffer if you need to allow for spikes in DSP usage or efficient block processing. My best advice would be to try it all out and see what you're comfortable with and what suits your applications and your style.

DJ
--
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic
Page 1 of 1 [5 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » Instruments and Equipment » Chameleon
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use