> 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
> >
> >
> >
> > _____________________________________
> > Note: If you do a simple "reply" with your email
> > client, only the author of this message will receive
> > your answer. You need to do a "reply all" if you
> > want your answer to be distributed to the entire
> > group.
> >
> > _____________________________________
> > About this discussion group:
> >
> > To Join: Send an email to
> >
> >
> > To Post: Send an email to
> >
> > To Leave: Send an email to
> >
> >
> > Archives: http://www.egroups.com/group/adsp
> >
> > Other Groups: http://www.dsprelated.com
> >
> >
> > ">http://docs.yahoo.com/info/terms/
> >
>
> __________________________________________________
>
Reply by Kenneth Porter●March 9, 20012001-03-09
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:
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;
Reply by Derek Hutton●March 9, 20012001-03-09
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
>
> _____________________________________
> Note: If you do a simple "reply" with your email
> client, only the author of this message will receive
> your answer. You need to do a "reply all" if you
> want your answer to be distributed to the entire
> group.
>
> _____________________________________
> About this discussion group:
>
> To Join: Send an email to
> To Post: Send an email to
>
> To Leave: Send an email to
> Archives: http://www.egroups.com/group/adsp
>
> Other Groups: http://www.dsprelated.com
> ">http://docs.yahoo.com/info/terms/
__________________________________________________
_____________________________________
Note: If you do a simple "reply" with your email client, only the
author of
this message will receive your answer. You need to do a "reply all" if
you
want your answer to be distributed to the entire group.
_____________________________________
About this discussion group:
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
>
> _____________________________________
> Note: If you do a simple "reply" with your email
> client, only the author of this message will receive
> your answer. You need to do a "reply all" if you
> want your answer to be distributed to the entire
> group.
>
> _____________________________________
> About this discussion group:
>
> To Join: Send an email to
> To Post: Send an email to
>
> To Leave: Send an email to
> Archives: http://www.egroups.com/group/adsp
>
> Other Groups: http://www.dsprelated.com
> ">http://docs.yahoo.com/info/terms/
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.