Sign in

username:

password:



Not a member?

Search adsp



Search tips

Subscribe to adsp



adsp by Keywords

AD1819 | AD7332 | ADSP-2106 | ADSP-21060 | ADSP-21065L | ADSP-2116 | ADSP-21160M | ADSP-2181 | ADSP-218x | ADSP-219 | ADSP-2199 | ADSP219 | BF531 | BF532 | BF533 | BF535 | Blackfin | FFT | JTAG | LDF | SDRAM | SHARC | SPORT | UART | VDSP++ | VisualDSP

Sponsor

Industry's highest performing at the lowest power DSPs now as low as $5.00*
Start development today!
*volume pricing for 10ku

Discussion Groups

See Also

Embedded SystemsFPGAElectronics

Discussion Groups | Analog Devices DSPs | circular buffers using C/C++

Technical discussions related to Analog Devices DSPs (including Blackfin, TigerSHARC, SHARC and ADSP-21xx DSPs).

  

Post a new Thread

circular buffers using C/C++ - Author Unknown - Mar 9 2:14:00 2001

Is there a way to declare and use circular buffers in C/C++ for the
Sharc? I tried searching for some clues with no luck other than
finding a few macros in macros.h. I remember someone telling me that
these were buggy. I saw a few old posts on the subject but they
didn't quite enlighten me :-(

I suspect there is no way to use the native support of the processor.

I'd appreciate examples or pointers to examples/docs that come with
the VisualDSP tools.

Cheers
Bhaskar



______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of adsp -- send a blank email to adsp-subscribe@yahoogroups.com )

Re: circular buffers using C/C++ - nagaraj cs - Mar 9 3:09:00 2001

Hi,
I had posted the same question long back,two three
times. Nobody replied. Even I suspect ADSP tools
supporting circular buffer declaration in C. One more
similar problem is declaring a variable at absolute
address.
Could anyone in the group look into these issues ?

Regards,
Nagaraj CS

--- wrote:
> Is there a way to declare and use circular buffers
> in C/C++ for the
> Sharc? I tried searching for some clues with no luck
> other than
> finding a few macros in macros.h. I remember someone
> telling me that
> these were buggy. I saw a few old posts on the
> subject but they
> didn't quite enlighten me :-(
>
> I suspect there is no way to use the native support
> of the processor.
>
> I'd appreciate examples or pointers to examples/docs
> that come with
> the VisualDSP tools.
>
> Cheers
> Bhaskar >
> _____________________________________ __________________________________________________



______________________________
Start your Android Ice Cream Sandwich development on TI's AM35x Sitara ARM Cortex-A8 processor today.



(You need to be a member of adsp -- send a blank email to adsp-subscribe@yahoogroups.com )

Re: circular buffers using C/C++ - Derek Hutton - Mar 9 14:23:00 2001

I never used them, but I believe the old (GNU-based) ADI C compiler had
built-in compiler functions that allowed the use of the hardware circular
buffers. They directly used specific DAG registers, so they were a bit
difficult to use. I think these went away when ADI changed to VDSP.

I have always just used the modulus operator in C to implement my circular
buffers. This can be a time-consuming operation if you are running on a
fixed-point DSP. If you use a buffer length that is a power of 2, you can
mask off the upper bits to achieve a faster modulus computation. For
example, if you want to increment your circular buffer pointer for a buffer
of length 8, you can do:

index = (++index) % 8;

which is equivalent to:

index = (++index) & 0x07;

If the compiler is good, it will compile the first statement the same as the
second statment. If not, then the second statement will definately run
faster, especially on a fixed-point processor.

Hope this helps.

-Derek ----- Original Message -----
From: nagaraj cs <>
To: <>
Cc: <>
Sent: Thursday, March 08, 2001 10:09 PM
Subject: Re: [adsp] circular buffers using C/C++ Hi,
I had posted the same question long back,two three
times. Nobody replied. Even I suspect ADSP tools
supporting circular buffer declaration in C. One more
similar problem is declaring a variable at absolute
address.
Could anyone in the group look into these issues ?

Regards,
Nagaraj CS

--- wrote:
> Is there a way to declare and use circular buffers
> in C/C++ for the
> Sharc? I tried searching for some clues with no luck
> other than
> finding a few macros in macros.h. I remember someone
> telling me that
> these were buggy. I saw a few old posts on the
> subject but they
> didn't quite enlighten me :-(
>
> I suspect there is no way to use the native support
> of the processor.
>
> I'd appreciate examples or pointers to examples/docs
> that come with
> the VisualDSP tools.
>
> Cheers
> Bhaskar >
> _____________________________________ __________________________________________________ _____________________________________






(You need to be a member of adsp -- send a blank email to adsp-subscribe@yahoogroups.com )

Re: circular buffers using C/C++ - Kenneth Porter - Mar 9 17:36:00 2001

On Thu, 8 Mar 2001 19:09:05 -0800 (PST), nagaraj cs wrote:

> One more similar problem is declaring a variable at absolute address.

This one's not too difficult, with some macro magic. Just declare the
variable like this:

#define my_absolute_object (* (my_absolute_object_type*) 0x123456)

You could also declare the address in the LDF file and then declare it
extern in the C file:

// in LDF file output section
// (You'll have to experiment with this to get the syntax and offsets
right.)
_my_absolute_object = 0x12345;

// in C file
extern my_absolute_object_type my_absolute_object;



______________________________
New Code Sharing Section now Live on DSPRelated.com. Learn about the Reward Program for Contributors here.



(You need to be a member of adsp -- send a blank email to adsp-subscribe@yahoogroups.com )

Re: circular buffers using C/C++ - Author Unknown - Mar 9 18:34:00 2001

> similar problem is declaring a variable at absolute
> address.

Another way to do this (other than the macro trick that Ken
suggested) is to declare a single word segment in your ldf file at
the abolute address you want and then use the placement support of
the compiler.

So if you want a variable at address 0xC000

then create a segment called my_var_seg in the ldf file which is
located at this address and is only 1 word (or however long your
variable is) long.

Then in your C code you can declare the variable like this...

static segment("my_var_seg") int my_var;

I think the macro works better with regards to ease of changes and
maintenance.

Cheers
Bhaskar --- In adsp@y..., nagaraj cs <nagaraj_c_s@y...> wrote:
> Hi,
> I had posted the same question long back,two three
> times. Nobody replied. Even I suspect ADSP tools
> supporting circular buffer declaration in C. One more
> similar problem is declaring a variable at absolute
> address.
> Could anyone in the group look into these issues ?
>
> Regards,
> Nagaraj CS
>
> --- bhaskar_thiagarajan@y... wrote:
> > Is there a way to declare and use circular buffers
> > in C/C++ for the
> > Sharc? I tried searching for some clues with no luck
> > other than
> > finding a few macros in macros.h. I remember someone
> > telling me that
> > these were buggy. I saw a few old posts on the
> > subject but they
> > didn't quite enlighten me :-(
> >
> > I suspect there is no way to use the native support
> > of the processor.
> >
> > I'd appreciate examples or pointers to examples/docs
> > that come with
> > the VisualDSP tools.
> >
> > Cheers
> > Bhaskar
> >
> >
> >
> > _____________________________________
> >
> >
> >
> >
> >
> > __________________________________________________






(You need to be a member of adsp -- send a blank email to adsp-subscribe@yahoogroups.com )