kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: Tony He <huangya90@gmail.com>
To: kernelnewbies@kernelnewbies.org
Subject: GPIO and interrupt
Date: Wed, 26 Jul 2023 18:10:17 +0800	[thread overview]
Message-ID: <CAAUX2SXaim8FFKKmKJyuBXWnZrTXspioL4iNn3h5aVyLDoLFFQ@mail.gmail.com> (raw)

Hi,

I'm writing button driver. The button is based on GPIO.When the button
is pressed or released, the interrupt is generated. According to the
GPIO value(1 or 0) , I can know which action is taken(pressed or
released).
However, a question occurred to me. Do I need to consider when to get
the GPIO value? I mean is it possible that GPIO value will be changed
caused by another interrupt when I get the GPIO value in top or bottom
half
of first interrupt? I know the CPU is fast and pushing/releasing
button is slow, so it should not happen in practice. But let's just
consider this case in theory. You can assume the button is pushed or
released very very fast.

Seems that GPIO interrupt is special comparing with other device with
cache. There is no cache to store data(GPIO value) for GPIO. Right?
Can someone help to clarify this question? Thanks a lot.

Tony

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

             reply	other threads:[~2023-07-26 10:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-26 10:10 Tony He [this message]
2023-07-26 11:09 ` GPIO and interrupt Ahmad Fatoum

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=CAAUX2SXaim8FFKKmKJyuBXWnZrTXspioL4iNn3h5aVyLDoLFFQ@mail.gmail.com \
    --to=huangya90@gmail.com \
    --cc=kernelnewbies@kernelnewbies.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 NNTP newsgroup(s).