Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.advocacy > #93478
| Date | 2012-03-03 00:06 -0700 |
|---|---|
| From | GreyCloud <cumulus@mist.com> |
| Newsgroups | comp.os.linux.advocacy, comp.os.linux.embedded |
| Subject | Re: Reading the Riot Act To ARM's developers |
| References | (4 earlier) <TIa2r.45441$6J5.28348@newsfe17.ams2> <87zkc4mlho.fsf@bazspaz.fatphil.org> <rKKdna_xZ9tSctbSnZ2dnUVZ8m6dnZ2d@lyse.net> <87aa3ymtwp.fsf@bazspaz.fatphil.org> <ztd4r.173468$M05.23596@newsfe20.ams2> |
| Message-ID | <bc2dnSwQAMV1X8zSnZ2dnUVZ_gadnZ2d@bresnan.com> (permalink) |
Cross-posted to 2 groups.
On 3/2/2012 5:20 PM, 7 wrote:
> Phil Carmody wrote:
>
>
>>>>> 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.
>
>
> Waaaat?
>
>
> Lets say you define all the hardware in hardware.h.
> Then at the beginning you do this:
>
>
> #ifndef HARDWARE_H
> #define HARDWARE_H
> // filename hardware.h
>
> #include "your_CPU's_CMSIS_header_file.h"
>
> #define ENABLED 1
> #define ENABLE_RS232_INTERRUPT SYSCON.INT.INT_XMA = ENABLED
>
> // end of hardware.h
> #endif
>
> Now whenever you do a include "hardware.h" to get at
> ENABLE_RS232_INTERRUPT, you automatically have
> access to whatever SYSCON has been set up as in the CMSIS file.
>
>
So far so good. Seems a reasonable start.
Tho I don't know what is inside the CMSIS header file.
Back to comp.os.linux.advocacy | Previous | Next — Previous in thread | 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