Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.advocacy > #93436
| From | Phil Carmody <thefatphil_demunged@yahoo.co.uk> |
|---|---|
| Newsgroups | comp.os.linux.advocacy, comp.os.linux.embedded |
| Subject | Re: Reading the Riot Act To ARM's developers |
| Date | 2012-03-03 02:04 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <87aa3ymtwp.fsf@bazspaz.fatphil.org> (permalink) |
| References | (2 earlier) <PYqZq.3558$FY5.2955@newsfe10.ams2> <87fwdzpbqe.fsf@bazspaz.fatphil.org> <TIa2r.45441$6J5.28348@newsfe17.ams2> <87zkc4mlho.fsf@bazspaz.fatphil.org> <rKKdna_xZ9tSctbSnZ2dnUVZ8m6dnZ2d@lyse.net> |
Cross-posted to 2 groups.
David Brown <david.brown@removethis.hesbynett.no> writes:
> On 27/02/12 14:52, Phil Carmody wrote:
> > 7<email_at_www_at_enemygadgets_dot_com@enemygadgets.com> writes:
> >> Phil Carmody wrote:
> >>>> #define INT_XMA (1<< 4)
> >>>> #define ENABLE_RS232 SYSCON->INT |= INT_XMA
> >>>
> >>> Ewwww! Don't do that.
> >>>
> >>>> The problem I am having is what does that '4' mean. Is it 4 or 14 or
> >>>> something else? I need a datasheet. Thats just crap programming.
> >>>>
> >>>> What I want to be able to do is
> >>>>
> >>>> #define ENABLED 1
> >>>> #define ENABLE_RS232_INTERRUPT SYSCON.INT.INT_XMA = ENABLED
> >>>
> >>> Ewww! Don't do that either.
> >>>
> >>> NACKed.
> >>
> >> By all means save us the laughs and
> >> write one line of code to say what you would do.
> >
> > Well, even the mindless robotic conversion to
> >
> > #define ENABLE_RS232_INTERRUPT() do { SYSCON.INT.INT_XMA = ENABLED; } while(0)
> >
> > would be better than what you had.
> >
> > Phil
>
> I would prefer three lines:
>
> static inline void enable_rs232_interrupt(void) {
> SYSCON.INT.INT_XMA = ENABLED;
> }
Whilst it is a sensible assumption to presume that SYSCON is visible at
the point of definition of the helper, it is by no means guaranteed, as
it's not obvious from the above, nor necessary for the macro to work -
you have to bear in mind the kind of code we're already dealing with.
> Be daring - learn C99!
I'd rather not have to forget the C11 things, thank you.
Phil
--
> I'd argue that there is much evidence for the existence of a God.
Pics or it didn't happen.
-- Tom (/. uid 822)
Back to comp.os.linux.advocacy | Previous | Next — Next in thread | Find similar
Re: Reading the Riot Act To ARM's developers Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-03-03 02:04 +0200
Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-03-03 00:20 +0000
Re: Reading the Riot Act To ARM's developers GreyCloud <cumulus@mist.com> - 2012-03-03 00:06 -0700
Re: Reading the Riot Act To ARM's developers Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-03-03 15:22 +0200
Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-03-04 12:28 +0000
Re: Reading the Riot Act To ARM's developers "Ezekiel" <zeke@nosuchemail.com> - 2012-03-04 09:15 -0500
Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-03-04 21:29 +0000
csiph-web