Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Nov 2020 14:28:24 +0300
From:      Vladimir Goncharov <freebsd@viruzzz.org>
To:        freebsd-arm@freebsd.org
Subject:   Re: User Space GPIO Interrupt programming - GSoC-2018
Message-ID:  <54ffe2d2-01a2-8b43-94fa-aee4a3f89861@viruzzz.org>
In-Reply-To: <8655AF30-273B-48E7-98CD-007AA1D265F5@obsigna.com>
References:  <2B01780F-D367-48A3-A827-B479030A496D@obsigna.com> <c55d7f332631b69c3241a60538a6a7b5475d93b9.camel@freebsd.org> <FBEF19B1-0504-4CDF-976C-C50707E06584@obsigna.com> <8d806302-479c-ca34-3fdb-96d27f40e212@viruzzz.org> <8655AF30-273B-48E7-98CD-007AA1D265F5@obsigna.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------2A1AAF89C0C383B854E76A38
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Here it is.
There is struct gpioc_event with pin number and bintime which is send to
userspace.

Also I'm thinking about to implementation notofication without extra
reading from socket via struct kevent's extra fields (fflags/ext[4]),
looks like it is possible.


2020-11-27 14:09, Dr. Rolf Jansen пишет:
> Hello Vladimir,
> 
> yes please, I am interested. Please can show us your version of the
> GSoC-2018 diff file?
> 
> Best regards
> 
> Rolf
> 
>> Am 27.11.2020 um 05:02 schrieb Vladimir Goncharov <freebsd@viruzzz.org
>> <mailto:freebsd@viruzzz.org>>:
>>
>> Hello Rolf,
>>
>> I have implemented in kernel queue for generated GPIO interrupts with
>> timestamps, so now it's possible to catch all events even on busy
>> system. It's all for gpio_gsoc2018 code. In result I have no more
>> warnings in dmesg. Unfortunately it requires allocating memory on each
>> event to store pin number and timestamp. In case of unability allocating
>> memory it falls back to gpio_gsoc2018 method.
>> Does anybody interested in such patches?
>>
>>
>> 2020-11-27 04:18, Dr. Rolf Jansen пишет:
>>>> Am 26.11.2020 um 16:56 schrieb Ian Lepore <ian@freebsd.org
>>>> <mailto:ian@freebsd.org>>:
>>>>
>>>> On Tue, 2020-11-24 at 17:14 -0300, Dr. Rolf Jansen wrote:
>>>>> Hello
>>>>>
>>>>> Has anything of the GSoC-2018 efforts made it into the current code
>>>>> base?
>>>>>
>>>>>
>>>> https://wiki.freebsd.org/SummerOfCode2018Projects/UserSpaceGPIOinterrupts
>>>> <https://wiki.freebsd.org/SummerOfCode2018Projects/UserSpaceGPIOinterrupts>;
>>>>>
>>>>> I installed the recent 13.0-CURRENT snapshot (2020-11-19) on a
>>>>> BeagleBone Black which was one of the implementation targets of said
>>>>> project, but when running the test tools, I either see cannot
>>>>> read/kevent/poll/aio_read - Operation not supported by device or
>>>>> Inappropriate ioctl for device.
>>>>>
>>>>> Perhaps I need to pull the project´s changes into the kernel by
>>>>> myself. However, before this I would like to ask whether it is worth
>>>>> the effort.
>>>>>
>>>>> Please, can anyone shed some light on this.
>>>>>
>>>>> Best regards
>>>>>
>>>>> Rolf
>>>>>
>>>>
>>>> I made some time this morning to review the gsoc2018 code.  It turns
>>>> out this code is very high quality, nearly ready to commit as-is.  The
>>>> main thing it needs is some style cleanup in its comment blocks, and
>>>> documentation.  I'd be inclined to commit the code first and write the
>>>> documentation over the next little while and commit it separately.
>>>>
>>>> If you'd like to give it a try, here's a diff that should apply and
>>>> build cleanly on freebsd 12 or 13:
>>>>
>>>> https://people.freebsd.org/~ian/gpio_gsoc2018.diff
>>>>
>>>> While there isn't any documentation yet, there is a test program (I
>>>> haven't run it yet) that demonstrates all the features:
>>>>
>>>> https://github.com/ckraemer/gsoc2018-utils/blob/master/src/gpioc_intr_test.c
>>>>
>>>> Right now the code will let you block waiting for a pin-change event
>>>> using select(), poll() or kevents, or to be notified via SIGIO, but
>>>> after being notified that something happened, you still have to call
>>>> read() to see which pin changed.  I think if the pin changes state
>>>> multiple times between calls to read(), you'll lose track of some
>>>> changes (I'm not positive of that, I don't understand the kevent stuff
>>>> well).
>>>>
>>>> I'd like to add some features so that you can configure it to track pin
>>>> changes in counting-mode and timestamping-mode.  In counting mode, when
>>>> you do a read() you would get back a pair of values, the pin number and
>>>> how many times its interrupt fired since the last read.  In
>>>> timestamping mode, every read would return a pin number and an
>>>> associated timespec giving the exact time the interrupt happened (there
>>>> would need to be a way to configure how many events it could buffer,
>>>> but I think even allowing a thousand buffered events would only use a
>>>> few kbytes of memory).
>>>
>>> I got it working as well, please see my other post from yesterday. I
>>> used gpioc_intr_test.c.
>>>
>>> I see hundreds of warning messages when I press the test button a few
>>> times. May these warnings be safely ignored. The kernel module of
>>> Oskar Holmund works quite nice as well (for what I need), and with
>>> that one, I don’t see warnings.
>>>
>>> The counting- and timestamping-mode for sure would be very useful.
>>> Perhaps by implementing this, there won’t be no unhandled interrupts
>>> anymore, and hence there won’t be any warnings either.
>>>
>>> Best regards
>>>
>>> Rolf
>>>
>>>
>> _______________________________________________
>> freebsd-arm@freebsd.org <mailto:freebsd-arm@freebsd.org> mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-arm
>> <https://lists.freebsd.org/mailman/listinfo/freebsd-arm>;
>> To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org"
> 
> 
> 
> Dr. Rolf Jansen
> - -
> Rua Reginaldo de Lima, 98
> Parque São Diogo
> 09732-550, São Bernardo do Campo
> São Paulo - Brazil
> 
> Phone:0055-11/4317-0974
> Mobile:0055-11/9 8141-1465
> E-Mail:rj@obsigna.com <mailto:rj@obsigna.com>
> BLog:obsigna.com <http://obsigna.com/>;
> 


--------------2A1AAF89C0C383B854E76A38
Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0";
 name="gpio.diff"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="gpio.diff"

ZGlmZiAtcnUgLi9kZXYvZ3Bpby9ncGlvYnVzLmMgL3Vzci9ob21lL2J1aWxkcm9vdC91c3Iv
c3JjL3N5cy9kZXYvZ3Bpby9ncGlvYnVzLmMKLS0tIC4vZGV2L2dwaW8vZ3Bpb2J1cy5jCTIw
MjAtMTAtM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UWVBFX01JU0MgfCBJ
TlRSX01QU0FGRSwgTlVMTCwgZ3Bpb2NfaW50ZXJydXB0X2hhbmRsZXIsCisJCQlpbnRyX2Nv
bmYsICZpbnRyX2NvbmYtPmludHJfY29va2llKTsKKwlpZiAoZXJyICE9IDApCisJCXJldHVy
biAoZXJyKTsKKworCWludHJfY29uZi0+cGluLT5mbGFncyA9IGZsYWdzOworCW10eF9sb2Nr
KCZpbnRyX2NvbmYtPm10eCk7CisJaW50cl9jb25mLT5jb25maWdfbG9ja2VkID0gZmFsc2U7
CisJd2FrZXVwKCZpbnRyX2NvbmYtPmNvbmZpZ19sb2NrZWQpOworCisJcmV0dXJuICgwKTsK
K30KKworCXN0YXRpYyBpbnQKK2dwaW9jX3JlbGVhc2VfcGluX2ludHIoc3RydWN0IGdwaW9j
X3Bpbl9pbnRyICppbnRyX2NvbmYpCit7CisJaW50IGVycjsKKworCWludHJfY29uZi0+Y29u
ZmlnX2xvY2tlZCA9IHRydWU7CisJbXR4X3VubG9jaygmaW50cl9jb25mLT5tdHgpOworCisJ
aWYgKGludHJfY29uZi0+aW50cl9jb29raWUgIT0gTlVMTCkgeworCQllcnIgPSBidXNfdGVh
cmRvd25faW50cihpbnRyX2NvbmYtPnBpbi0+ZGV2LAorCQkJCWludHJfY29uZi0+aW50cl9y
ZXMsIGludHJfY29uZi0+aW50cl9jb29raWUpOworCQlpZiAoZXJyICE9IDApCisJCQlyZXR1
cm4gKGVycik7CisJCWVsc2UKKwkJCWludHJfY29uZi0+aW50cl9jb29raWUgPSBOVUxMOwor
CX0KKworCWlmIChpbnRyX2NvbmYtPmludHJfcmVzICE9IE5VTEwpIHsKKwkJZXJyID0gYnVz
X3JlbGVhc2VfcmVzb3VyY2UoaW50cl9jb25mLT5waW4tPmRldiwgU1lTX1JFU19JUlEsCisJ
CQkJaW50cl9jb25mLT5pbnRyX3JpZCwgaW50cl9jb25mLT5pbnRyX3Jlcyk7CisJCWlmIChl
cnIgIT0gMCkKKwkJCXJldH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J
U0xJU1RfRk9SRUFDSChwcml2X2xpbmssICZpbnRyX2NvbmYtPnByaXZzLCBuZXh0KSB7CisJ
CWlmIChwcml2X2xpbmstPnByaXYgIT0gcHJpdikKKwkJCXJldHVybiAoZmFsc2UpOworCX0K
KworCXJldHVybiAodHJ1ZSk7Cit9CisKKworCXN0YXRpYyB1aW50MzJfdAorZ3Bpb2NfZ2V0
X2ludHJfY29uZmlnKHN0cnVjdCBncGlvY19zb2Z0YyAqc2MsIHN0cnVjdCBncGlvY19jZGV2
cHJpdiAqcHJpdiwKKwkJdWludDMyX3QgcGluKQoreworCXN0cnVjdCBncGlvY19waW5faW50
cgkqaW50cl9jb25mID0gJnNjLT5zY19waW5faW50cltwaW5dOworCXN0cnVjdCBncGlvY19w
cml2cwkqcHJpdl9saW5rOworCXVpbnQzMl90CQlmbGFnczsKKworCWZsYWdzID0gaW50cl9j
b25mLT5waW4tPmZsYWdzOworCisJaWYgKGZsYWdzID09IDApCisJCXJldHVybiAoMCk7CisK
KwlTTElTVF9GT1JFQUNIKHByaXZfbGluaywgJmludHJfY29uZi0+cHJpdnMsIG5leHQpIHsK
KwkJaWYgKHByaXZfbGluay0+cHJpdiA9PSBwcml2KSB7CisJCQlmbGFncyB8PSBHUElPX0lO
VFJfQVRUQUNIRUQ7CisJCQlicmVhazsKKwkJfQorCX0KKworCXJldHVybiAoZmxhZ3MpOwor
fQorCisJc3RhdGljIGludAorZ3Bpb2Nfc2V0X2ludHJfY29uZmlnKHN0cnVjdCBncGlvY19z
b2Z0YyAqc2MsIHN0cnVjdCBncGlvY19jZGV2cHJpdiAqcHJpdiwKKwkJdWludDMyX3QgcGlu
LCB1aW50MzJfdCBmbGFncykKK3sKKwlzdHJ1Y3QgZ3Bpb2NfcGluX2ludHIgKmludHJfY29u
ZiA9ICZzYy0+c2NfcGluX2ludHJbcGluXTsKKwlpbnQgcmVzOworCisJcmVzID0gMDsKKwlp
ZiAoaW50cl9jb25mLT5waW4tPmZsYWdzID09IDAgJ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OworCQkJaWYgKHJlcyA9PSAwKQorCQkJCXJlcyA9IGZzZXRvd24oKihpbnQgKilhcmcs
ICZwcml2LT5zaWdpbyk7CisJCQlicmVhazsKIAkJZGVmYXVsdDoKIAkJCXJldHVybiAoRU5P
VFRZKTsKIAkJCWJyZWFrOwogCX0KIAogCXJldHVybiAocmVzKTsKK30KKworCXN0YXRpYyBp
bnQKK2dwaW9jX3BvbGwoc3RydWN0IGNkZXYgKmRldiwgaW50IGV2ZW50cywgc3RydWN0IHRo
cmVhZCAqdGQpCit7CisJc3RydWN0IGdwaW9jX2NkZXZwcml2ICpwcml2OworCWludCBlcnI7
CisJaW50IHJldmVudHM7CisKKwlyZXZlbnRzID0gMDsKKworCWVyciA9IGRldmZzX2dldF9j
ZGV2cHJpdigodm9pZCAqKikmcHJpdik7CisJaWYgKGVyciAhPSAwKSB7CisJCXJldmVudHMg
PSBQT0xMRVJSOworCQlyZXR1cm4gKHJldmVudHMpOworCX0KKworCWlmIChTTElTVF9FTVBU
WSgmcHJpdi0+cGlucykpIHsKKwkJcmV2ZW50cyA9IFBPTExIVVA7CisJCXJldHVybiAocmV2
ZW50cyk7CisJfQorCisJaWYgKGV2ZW50cyAmIChQT0xMSU4gfCBQT0xMUkROT1JNKSkgewor
CQlpZiAocHJpdi0+bGFzdF9pbnRyX3BpbiAhPSAtMSkKKwkJCXJldmVudHMgfD0gZXZlbnRz
ICYgKFBPTExJTiB8IFBPTExSRE5PUk0pOworCQllbHNlCisJCQlzZWxyZWNvcmQodGQsICZw
cml2LT5zZWxpbmZvKTsKKwl9CisKKwlyZXR1cm4gKHJldmVudHMpOworfQorCisJc3RhdGlj
IGludAorZ3Bpb2Nfa3FmaWx0ZXIoc3RydWN0IGNkZXYgKmRldiwgc3RydWN0IGtub3RlICpr
bikKK3svL2F0dGFjaCB0byBrcXVldWUKKwlzdHJ1Y3QgZ3Bpb2NfY2RldnByaXYgKnByaXY7
CisJc3RydWN0IGtubGlzdCAqa25saXN0OworCWludCBlc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LT5zZWxpbmZvLnNpX25vdGU7CisKKwlrbmxpc3RfcmVtb3ZlKGtubGlzdCwga24sIDApOwog
fQogCiBzdGF0aWMgZGV2aWNlX21ldGhvZF90IGdwaW9jX21ldGhvZHNbXSA9IHsKT25seSBp
biAvdXNyL2hvbWUvYnVpbGRyb290L3Vzci9zcmMvc3lzL2Rldi9ncGlvOiBncGlvYy5jLm9y
aWcKT25seSBpbiAuOiBkaWZmLmNvcmUKT25seSBpbiAuOiBncGlvLmRpZmYKZGlmZiAtcnUg
Li9zeXMvZ3Bpby5oIC91c3IvaG9tZS9idWlsZHJvb3QvdXNyL3NyYy9zeXMvc3lzL2dwaW8u
aAotLS0gLi9zeXMvZ3Bpby5oCTIwMjAtMTAtMjMgMDM6MDI6MTguMDAwMDAwMDAwICswMzAw
CisrKyAvdXNyL2hvbWUvYnVpbGRyb290L3Vzci9zcmMvc3lzL3N5cy9ncGlvLmgJMjAyMC0x
MS0yNSAxMjoyMjo0MS40NjA5NDEwMDAgKzAzMDAKQEAgLTg0LDYgKzg0LDcgQEAKICNkZWZp
bmUgR1BJT19JTlRSX01BU0sJCShHUElPX0lOVFJfTEVWRUxfTE9XIHwgR1BJT19JTlRSX0xF
VkVMX0hJR0ggfCBcCiAJCQkJR1BJT19JTlRSX0VER0VfUklTSU5HIHwJCQkgICAgICBcCiAJ
CQkJR1BJT19JTlRSX0VER0VfRkFMTElORyB8IEdQSU9fSU5UUl9FREdFX0JPVEgpCisjZGVm
aW5lIEdQSU9fSU5UUl9BVFRBQ0hFRAkweDAwMjAwMDAwICAgICAgLyogaW50ZXJydXB0IGF0
dGFjaGVkIHRvIGZpbGUgKi8KIAogc3RydWN0IGdwaW9fcGluIHsKIAl1aW50MzJfdCBncF9w
aW47CQkJLyogcGluIG51bWJlciAqLwpPbmx5IGluIC91c3IvaG9tZS9idWlsZHJvb3QvdXNy
L3NyYy9zeXMvc3lzOiBncGlvLmgub3JpZwo=
--------------2A1AAF89C0C383B854E76A38--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54ffe2d2-01a2-8b43-94fa-aee4a3f89861>