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] New: GPIO Interrupt Support for Kinetis
Date: Sat, 02 Mar 2013 18:25:00 -0000	[thread overview]
Message-ID: <bug-1001787-104@http.bugs.ecos.sourceware.org/> (raw)

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

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

            Bug ID: 1001787
           Summary: GPIO Interrupt Support for Kinetis
           Product: eCos
           Version: CVS
            Target: All
  Architecture/Host Cortex-M
                OS:
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: low
         Component: Patches and contributions
          Assignee: unassigned@bugs.ecos.sourceware.org
          Reporter: mjones@linear.com
                CC: ecos-patches@ecos.sourceware.org

Created attachment 2113
  --> http://bugs.ecos.sourceware.org/attachment.cgi?id=2113&action=edit
Support Kinetis GPIO interrupts and add set/get API

This patch adds to the Kinetis GPIO macros and API. It allows code to accept an
interrupt on a port by applying a configuration call, getting the interrupt,
and clearing the interrupt. I also added API for set/get of pins. The interrupt
is well tested on one port and pin. The set/get underlying macro was tested on
a pin before writing the API. The API is coded in a simple manner such that by
inspection if the original macros work, the API will work.

I don't have a mechanism to test interrupts on multiple pins/ports. So strictly
speaking, I can only say it is very robust using the example below. The code is
simple enough I feel save putting this code in CVS. However, if anyone has
hardware that would allow more testing, please do so if you have time.

If anyone is unhappy with the API, I am happy to make changes, retest, and send
a new patch.

An example:

#define ALERT_PORT 0
#define ALERT_PIN 19

cyg_uint32 alert_isr( cyg_vector_t vector,
                              cyg_addrword_t data
)
{
    cyg_interrupt_mask(CYGNUM_HAL_INTERRUPT_PORTA);
    hal_kinetis_gpio_interrupt_acknowledge(ALERT_PORT, ALERT_PIN);

    // Do a little critical work.

    return CYG_ISR_HANDLED | CYG_ISR_CALL_DSR;
}

void alert_dsr( cyg_vector_t vector,
                        cyg_ucount32 count,
                        cyg_addrword_t data
                      )
{
    cyg_flag_setbits(&alert_flag, 0x01);
    cyg_interrupt_unmask(CYGNUM_HAL_INTERRUPT_PORTA);
}



    cyg_interrupt_create(
            CYGNUM_HAL_INTERRUPT_PORTA, // Vector
            0xA0,                         // Priority
            (cyg_addrword_t)0,             // Data
            alert_isr,                     // ISR
            alert_dsr,                     // DSR
            &alert_handle,                 // Handle
            &alert_interrupt);            // INTR

    cyg_interrupt_attach(alert_handle);

    hal_kinetis_gpio_setup_port(ALERT_PORT, ALERT_PIN, 0xA, 0x1, 0x00);
    hal_kinetis_gpio_interrupt_acknowledge(ALERT_PORT, ALERT_PIN);
    cyg_interrupt_unmask(CYGNUM_HAL_INTERRUPT_PORTA);

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

             reply	other threads:[~2013-03-02 18:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-02 18:25 bugzilla-daemon [this message]
2013-03-02 20:03 ` [Bug 1001787] " bugzilla-daemon
2013-03-17 14:00 ` bugzilla-daemon
2013-03-19 22:37 ` bugzilla-daemon
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@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).