Hi!
Why using a pointer?
The normal defines in MSPGCC are evaluated to
volatile unsigned char/int NAME asm(#ADDRESS);
So in this case
volatile OutputEndDescriptorType tOutputEndPointDescriptorBlock
asm(#USBOEPCNF_1);
should do the trick. Any member of the struct is then accessed by
tOutputEndPointDescriptorBlock.xyz
It not only saves two bytes of RAM for storing the pointer to the register, it
will also generate slightly smaller code, depending on usage.
Also, the below proposed usage will make the pointer volatile (so the compiler
will NOT store it in a local register but constantly reload it from RAM) and
not the hardware register it points to.
It might happen that the value, once read, is calculated with again and again
without ever reloading it.
JMGross
----- Ursprüngliche Nachricht -----
Von: Gerald Lutter
An: 'GCC for MSP430 - http://mspgcc.sf.net'
Gesendet am: 03 Dez 2009 09:19:06
Betreff: Re: [Mspgcc-users] msp430x5529 support
Hi Bernie,
changing addresses inside the assembler section does not change the symbol
for your C-Code. This is because the assembler Section of the header is only
available if you use assembler. But I think you are using C-Code therefore
your changes will have no effect. By the way, the assembler section of
msp430x55x9_newversion.h is generated automatically during the build of the
library out of msp430x55x9_template.header (this file does only exist before
you build the msp430-libc after applying our patch).
But now to your actual question:
if tOutputEndPointDescriptorBlock is of type OutputEndDescriptorType then
you have to define your tOutputEndPointDescriptorBlock as pointer:
volatile OutputEndDescriptorType *tOutputEndDescriptorBlock = (volatile
OutputEndDescriptorType *)&USBOEPCNF_1;
you are now able to configure your component using this code
tOutputEndDiscriptorBlock-><any field inside your struct> = <any value you
need>;
Best regards,