public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
* [Bug 1001787] New: GPIO Interrupt Support for Kinetis
@ 2013-03-02 18:25 bugzilla-daemon
  2013-03-02 20:03 ` [Bug 1001787] " bugzilla-daemon
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: bugzilla-daemon @ 2013-03-02 18:25 UTC (permalink / raw)
  To: ecos-patches

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-02-15  7:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-02 18:25 [Bug 1001787] New: GPIO Interrupt Support for Kinetis 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
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

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).