public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugs.ecos.sourceware.org
To: ecos-patches@ecos.sourceware.org
Subject: [Bug 1001787] GPIO Interrupt Support for Kinetis
Date: Tue, 19 Mar 2013 22:37:00 -0000	[thread overview]
Message-ID: <bug-1001787-104-n27GdpxZXP@http.bugs.ecos.sourceware.org/> (raw)
In-Reply-To: <bug-1001787-104@http.bugs.ecos.sourceware.org/>

Please do not reply to this email, use the link below.

http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001787

--- Comment #3 from Ilija Kocho <ilijak@siva.com.mk> ---
Mike

(In reply to comment #2)
> Ilija,
> 
> I made and tested the following change. I can make a patch later if you
> agree with it. This should allow arrays.
> 
> On Interrupt Acknowledge, I wanted an interface that took an int for port i
> order to be consistent with the overall API, and with the datasheet, and
> with Assertions. However, a user could use the Macro directly like this:
> 
> CYGHWR_HAL_KINETIS_PORT_PCR_ISFR_CLEAR(A, 5);
> 
> This means the user can either choose the slower and safer API, or the Macro
> that already exists. I don't know if that is consistent with eCos principles
> or not, but this is why I made the choice. My feeling was a newbie would see
> the API and use it first. Then if they needed a little more performance,
> they would discover and use the MACRO. This is consistent with my design
> methodology, which is based on late optimization. However, I do recognize
> that embedded community may not operate on that principle as much as large
> system architects, which is my background.
> 
> Let me know what you think. I can make more changes if this is not
> satisfactory.
> 

I am conservative with introduction of new API functions because once API is
released people will start using it and we are stuck with that (Linus
Torvalds).
I think that the macros do the job and are intuitive enough. True we lack
asserts but some errors, such as non existing port are reported by the
compiler.
I would add functions some time to recheck. One problem is that the port
representation is different from macros (i know there's not help there). In
meantime we could focus on macros.

> Mike
> 
> Changes
> -------
> 
> #define CYGHWR_HAL_KINETIS_PIN_CFG(__port, __bit, __irqc, __mux, __cnf) \
>     ((CYGHWR_HAL_KINETIS_PORT##__port << 20) | ((__bit) << 27)        \
>      | CYGHWR_HAL_KINETIS_PORT_PCR_IRQC(__irqc)                        \
>      | CYGHWR_HAL_KINETIS_PORT_PCR_MUX(__mux) | (__cnf))
> 

CFG is probably more intuitive than PINCD - OK. However I would put __mux next
to __port and __bit and __irqc next to __cnf. Rationale: __port, __bit, __mux
triplet represents kind of /addressing parameters/ and __irqc, __cnf are
/configuration options/.

> #define CYGHWR_HAL_KINETIS_PIN(__port, __bit, __mux, __cnf) \
>         CYGHWR_HAL_KINETIS_PIN_CFG(__port, __bit, 0, __mux, __cnf)
> 

Based on your example I expected some code for ISR handling. May, but doesn't
have to be. Please check if your patch is complete.

Ilija

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2013-03-19 22:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-02 18:25 [Bug 1001787] New: " bugzilla-daemon
2013-03-02 20:03 ` [Bug 1001787] " bugzilla-daemon
2013-03-17 14:00 ` bugzilla-daemon
2013-03-19 22:37 ` bugzilla-daemon [this message]
2013-03-20  7:28 ` bugzilla-daemon
2013-04-06 14:57 ` bugzilla-daemon
2013-04-06 15:01 ` bugzilla-daemon
2013-04-07 20:33 ` bugzilla-daemon
2013-06-12 21:34 ` bugzilla-daemon
2013-06-13 19:17 ` bugzilla-daemon
2017-02-15  7:35 ` bugzilla-daemon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-1001787-104-n27GdpxZXP@http.bugs.ecos.sourceware.org/ \
    --to=bugzilla-daemon@bugs.ecos.sourceware.org \
    --cc=ecos-patches@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).