From owner-freebsd-arm@freebsd.org Fri Nov 27 22:05:11 2020 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E868946A33B for ; Fri, 27 Nov 2020 22:05:11 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound5a.ore.mailhop.org (outbound5a.ore.mailhop.org [44.233.67.66]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CjTFg3Nhpz4Wky for ; Fri, 27 Nov 2020 22:05:11 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1606514705; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=XRLc3tv0y/GgEYSj3l3CV3sbMguCATlSZtuhifr1PoceQDin8R8nkF4a6ixlhDam1M8Q51KTZtjN8 iSyjqG9/c0MO4s/sDvT6VzJrPNXEgGJESTg88Rhf4HXJToDfKt8BJg4nYg2poBsw8Q5KOdWWjtrfNK O04IYEQVH4UUdIRRTAFfAp8VbIBSe01ggZLmH2Yb7P1qxiFnC1Up9CwDWiFPfEskSoKG+nhfTVIb/8 4YSqVRbUBHTwIpQ3UPqM1Z0TTMWPAYx4wOlPY0QEhGXwPnrp23AiIU6zmVkm/F6S4t5uuVe73o6mJC WJssmn8SJwoVJJJ1UUhKZWzBYxeOZLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=V8skLzckNqlR6JXb/d316lHAjJ1Zi9M47hgTFw5mrRY=; b=Dbc7ODStV/jXIRIYSdNULkRhoibuD36jerRwiLfUWuBzfGB+zQF4f9hJBqdJ3K3sDTfvbpCW99t5d PjlYAybmZzoN6KpgyTSNYSEK9yLbYDfIUy40YvKgIDHLY9s/+lGHKWCCya1cpt86EDX3/B8p71fya3 agEMlLP8KoKVFzluew+WvtYkmmVti37sFCRjscSCa4ZbXV6lMDwHqyhVHVmNOn5jt6X5pVZpgDxCkm aZPYq69X9dRVHVQH4cvi/IjrdkwMNz4PHJ2tYjcuSzrXXyvSsVnIjdn+sVcoSRuYBBdml1yDnZzNq+ ryF4biPYB8mpmGFztdoRp6qGebLEiIA== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=V8skLzckNqlR6JXb/d316lHAjJ1Zi9M47hgTFw5mrRY=; b=cOnAKQOVHLWUT8T7XWoQ+uUg+oDWWmhl+CP5+gr6c/c6mwL+YwoaWoxjaeJlhNbkhRDwc4q7/lQ5p JCdTPG3Kq1B1+26i0iG9P3fotQctr/HMKyo+vTjyphO3cVkCECF1LsAYb/a7R3l3k3FehOquKz1WiL 4qlBMSZ8cwd5Ig2/oaSFTU7oJjP5LmZDGXxQTZMTJNI4TgDxDJrd2ebVp+1Kh1KNpSpFNZ0IQdIXWo 0auPRFWoUbrkvXN48nn1eU7c9zIwXJXge+muD/8IMoyjfh41VhucXvvVVMdQykz774jNmCbcyvyswp G2XynCg5Mad5SHcOTsvUrCMLgElgsEw== X-MHO-RoutePath: aGlwcGll X-MHO-User: 99317c48-30fc-11eb-8b39-614106969e8d X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-67-177-211-60.hsd1.co.comcast.net [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 99317c48-30fc-11eb-8b39-614106969e8d; Fri, 27 Nov 2020 22:05:03 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 0ARM5225081065 for ; Fri, 27 Nov 2020 15:05:02 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: User Space GPIO Interrupt programming - GSoC-2018 From: Ian Lepore To: freebsd-arm@freebsd.org Date: Fri, 27 Nov 2020 15:05:02 -0700 In-Reply-To: <1e6993d43d22d6ce1aa2860a61745356688d1e53.camel@freebsd.org> References: <2B01780F-D367-48A3-A827-B479030A496D@obsigna.com> <8d806302-479c-ca34-3fdb-96d27f40e212@viruzzz.org> <8655AF30-273B-48E7-98CD-007AA1D265F5@obsigna.com> <54ffe2d2-01a2-8b43-94fa-aee4a3f89861@viruzzz.org> <08649892ca2ab434c261d36e0e13ba051086de6f.camel@freebsd.org> <1e6993d43d22d6ce1aa2860a61745356688d1e53.camel@freebsd.org> Content-Type: text/plain; charset="ASCII" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CjTFg3Nhpz4Wky X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; ASN(0.00)[asn:16509, ipnet:44.224.0.0/11, country:US] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Nov 2020 22:05:12 -0000 On Fri, 2020-11-27 at 11:04 -0700, Ian Lepore wrote: > > I think we need a way for the app to choose whether it wants simple > > reporting of pin number (like the original code) perhaps along with > > a count, versus requesting detailed per-event data. I'm going to > > propose something more detailed about this as soon as I get my > > thoughts all organized. Okay, here's my current thinking on this (with tabs compressed down to just a couple spaces to prevent line-wrap in email). This is a snippet from gpio.h... /* * Reporting gpio pin-change per-event details to userland. * * When configured for detail reporting, each call to read(2) will * return one or more of these structures (or will return * EWOULDBLOCK in non-blocking IO mode when there are no new events * to report). */ struct gpio_event_detail { struct timespec gp_time; /* Time of event */ uint16_t gp_pin; /* Pin number */ bool gp_pinstate; /* Pin state at time of event */ }; /* * Reporting gpio pin-change summary data to userland. * * When configured for summary reporting (the default), each call to * read(2) will return one or more of these structures (or will * return EWOULDBLOCK in non-blocking IO mode when there are no new * events to report). */ struct gpio_event_summary { struct timespec gp_first_time; /* Time of first event */ struct timespec gp_last_time; /* Time of last event */ uint16_t gp_pin; /* Pin number */ uint16_t gp_count; /* Event count */ bool gp_first_state; /* Pin state at first event */ bool gp_last_state; /* Pin state at last event */ }; /* * Configuring event reporting to userland. * * The default is to deliver gpio_event_summary reporting. To * change it, you must use the GPIOCONFIGEVENTS ioctl to set the * event fifo size before using GPIOSETCONFIG to configure reporting * interrupt events on any pins. This config is tracked on a * per-open-descriptor basis. Once it has been set, it cannot be * changed without closing and re-opening the file descriptor. */ struct gpio_event_config { uint32_t gp_fifo_size; /* Zero for summary reporting. */ }; #define GPIOCONFIGEVENTS _IOW('G', 9, struct gpio_event_config) I haven't written the implementation of all this yet, but I have a pretty good idea of how to do so. -- Ian