From owner-freebsd-embedded@FreeBSD.ORG Thu May 8 00:47:38 2014 Return-Path: Delivered-To: freebsd-embedded@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D026A2AA for ; Thu, 8 May 2014 00:47:38 +0000 (UTC) Received: from mail-wi0-x229.google.com (mail-wi0-x229.google.com [IPv6:2a00:1450:400c:c05::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6971531C for ; Thu, 8 May 2014 00:47:38 +0000 (UTC) Received: by mail-wi0-f169.google.com with SMTP id hi2so238197wib.4 for ; Wed, 07 May 2014 17:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=09YPA/MRllMMTOXBQs52JhRIQ/q9w9mUdqcpzyyw4c8=; b=XVPfvhIfq3cHb2d0a+wOy6ExZuT/UbmX23PT+DZ2PZretEWLM1ETMBqUI7Tx0yreZq 3UaVk1GYdv8hK7+cw1mLRY4K43pYMoySU4xYG0VioJ0A+w8fM7Ozal6CkeHBhmgsEd6t Rhk8FXzlA/7nqmnKxRnmlU4EN0gzvhMk7eztRG9ceTjauNaDwUEXK5NtwzUBTZFvAnyJ ThTnVqs0YH9QKZ//CGn+5i+BAnC1yQnxWauFNxexoQ9E2jUoprAv+mIrYcLFHxrz/ySs mXIxrLNzUQNZtDgQdKBUnaAeY3Pd+C2jwgMLs6kyS1YJEwJ1elsOW6/xr49Rz1byL6ml EnEg== MIME-Version: 1.0 X-Received: by 10.180.218.35 with SMTP id pd3mr10169716wic.26.1399510056689; Wed, 07 May 2014 17:47:36 -0700 (PDT) Received: by 10.216.40.72 with HTTP; Wed, 7 May 2014 17:47:36 -0700 (PDT) In-Reply-To: <1A78D43F-9406-4DAB-8554-D8802DE8A3E1@sezi.eu> References: <1A78D43F-9406-4DAB-8554-D8802DE8A3E1@sezi.eu> Date: Wed, 7 May 2014 21:47:36 -0300 Message-ID: Subject: Re: GPIO interrupts on Carambola2 From: Luiz Otavio O Souza To: Sebastian Zietz Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-embedded X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 May 2014 00:47:38 -0000 On 7 May 2014 16:48, Sebastian Zietz wrote: > Hi all, > > since I am not much into device driver programming jet I hope you can hel= p me with my problem. I have a hardware button on GPIO pin 22 and can=E2=80= =99t generate interrupts on it. In sys/mips/atheros/ar71xx_gpio.c I=E2=80= =99d like to do something like: > > 331 static void > 332 ar71xx_gpio_intr(void *arg) > 333 { > 334 struct ar71xx_gpio_softc *sc =3D arg; > 335 GPIO_LOCK(sc); > 336 /* TODO: something useful */ > 337 devctl_notify("GPIO", "pin22", "notify", NULL); > 338 GPIO_UNLOCK(sc); > 339 } > > > To get it working I tried this without success: > > 410 /* Configure all pins as input */ > 411 /* disable interrupts for all pins */ > 412 GPIO_WRITE(sc, AR71XX_GPIO_INT_MASK, 0); > 413 GPIO_WRITE(sc, AR71XX_GPIO_INT_MASK, (1 << 22)); > > > I didn=E2=80=99t managed to come up with pin 22 as input either. I am tha= nkful for any help! Sebastian, I'm adding GPIO interrupt support and ar71xx is one of my reference platforms so this should be working soon. I'm using kqueue to delivery the interrupt notification to userland, but eventually i'll also support devctl_notify(). The patch(es) should be posted soon now. Luiz