Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] accessing SPI registers

2005-05-25 by Brett Delmage

At 11:37 AM 5/25/05 -0400, Brett Delmage wrote:

> >Now, can anyone tell me if there is clean, way to generate faster 
> code than:
> >
> >#define REG(addr) (*(volatile unsigned long *)(addr))
> >#define REG8(addr) (*(volatile char *)(addr))

Robert Adsett wrote:

> IE in the appropriate ld control file I have something like
>
> I find that 'cleaner' than pointer de-references.  YMMV  The biggest
> disadvantage is you end up depending on both the ld file and the header
> file.  I don't know how the code generation compares.
>
> You can see this in the newlib-lpc source.

Excellent. Thank you Robert! That is exactly what I wanted to do 
eventually. I have coded that way wih other CPUs and build tools and I 
agree that it is "cleaner".
At this point, I'm learning one new element at a time, and didn't want 
to dive into the linker in that detail yet. This past week I was happy, 
even with rougher code,  to get SPI to work with 3 different (types of) 
devices. The great thing about SPI (not) is that there are so many modes 
that every manufacturer can pick a unique one  :-p   = :o
I am glad to say that the LPC SPI, limited as it is, was up to the 
challenge.

   Brett

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.