Reply by Torgeir Jakobsen May 14, 20022002-05-14
Hi

Texas has an application note, spra260, which describes a method (using
pointers) for accessing memory mapped registers from C code.

Best regards
Torgeir Jakobsen
Senior Engineer, Technology Department
Aanderaa Instruments AS
e-mail:
web: www.aanderaa.com
phone; +47 55 10 99 00
direct: +47 55 10 99 77
fax: +47 55 10 99 10
----- Original Message -----
From: "ensalada20022000" <>
To: <>
Sent: Monday, May 13, 2002 6:20 AM
Subject: [c54x] new c5402 user- C programmer, viewing/editing registers > hi all,
> I am using the c5402 kit for a university project. I am new to dsp
> I'm a C programmer. I already know the addresses of the memory-mapped
> registers. I am now wondering how I could edit/access the contents of
> a register in c code. I am thinking of saving the address to a
> pointer data and then use the indirection (*) operator to edit/view
> its contents. For example
>
> int *ptr;
> ptr=0x0007f; //register in address 0x0007f
> *ptr=0x00001; //write 0x00001 to register
> printf("%d",*ptr); //view contents of register
>
> am i thinking about it correctly or otherwise?
>
> best regards,
> leonor >
> _____________________________________
> 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.yahoogroups.com/group/c54x
>
> Other Groups: http://www.dsprelated.com > ">http://docs.yahoo.com/info/terms/ > --
> This e-mail has been protected by Song Networks' virus-scan service:
> http://www.securemail.no
>

--
This e-mail has been protected by Song Networks' virus-scan service:
http://www.securemail.no


Reply by Joel Ironstone May 14, 20022002-05-14
Yes, that will work fine.
you might consider setting the registers
in definition statements so you can write to them by name:

#define my register (unsigned int*)0xmyregaddress
and using something like:
*(int*)myregister=(int)(my value);

although that's a little redundant.
>hi all,
>I am using the c5402 kit for a university project. I am new to dsp
>I'm a C programmer. I already know the addresses of the memory-mapped
>registers. I am now wondering how I could edit/access the contents of
>a register in c code. I am thinking of saving the address to a
>pointer data and then use the indirection (*) operator to edit/view
>its contents. For example
>
>int *ptr;
>ptr=0x0007f; //register in address 0x0007f
>*ptr=0x00001; //write 0x00001 to register
>printf("%d",*ptr); //view contents of register
>
>am i thinking about it correctly or otherwise?
>
>best regards,
>leonor >
>
>________________________________________________________________________
>________________________________________________________________________ >
>">http://docs.yahoo.com/info/terms/


Reply by ensalada20022000 May 13, 20022002-05-13
hi all,
I am using the c5402 kit for a university project. I am new to dsp
I'm a C programmer. I already know the addresses of the memory-mapped
registers. I am now wondering how I could edit/access the contents of
a register in c code. I am thinking of saving the address to a
pointer data and then use the indirection (*) operator to edit/view
its contents. For example

int *ptr;
ptr=0x0007f; //register in address 0x0007f
*ptr=0x00001; //write 0x00001 to register
printf("%d",*ptr); //view contents of register

am i thinking about it correctly or otherwise?

best regards,
leonor