]> git.feebdaed.xyz Git - linuxyz.git/commitdiff
testing gpio int
authorseantywork <seantywork@gmail.com>
Thu, 29 May 2025 12:19:44 +0000 (13:19 +0100)
committerseantywork <seantywork@gmail.com>
Thu, 29 May 2025 12:19:44 +0000 (13:19 +0100)
kgpio-irqsock/ins.conf
kgpio-irqsock/ins.sh
kgpio-irqsock/kgpio_irqsk.c

index e4b27cedf7d16ec9405f50ddf10ad8411be4e419..271c2950852218bed76856ab326e73a984ec6883 100644 (file)
@@ -1,2 +1,2 @@
 CTLOUT=GPIO17
-CTLIN=GPIO27
\ No newline at end of file
+CTLIN=0
index 2764374444c6c9a20f73c1161a120bf19265dcc0..9e707c6a6d777b38fdf288e93aefce24c723331b 100755 (executable)
@@ -1,11 +1,19 @@
 #!/bin/bash 
 
-source ./ins.conf
-
+CTLOUT="0"
+CTLIN="0"
 DEV="n"
 CTLOUT_LINE=""
 CTLIN_LINE=""
 
+if [ ! -f ./ins.conf ]
+then
+    echo "ins.con not found"
+    exit 1
+fi
+
+source ./ins.conf
+
 if [[ "$CTLOUT" == "0" ]]
 then 
     DEV="y"
index da1d352faaa6045a9b913fce5271c0b06538ea60..1b17acd90f6c1d5323540ba42d2864ac7982bc3d 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/sched.h>
 #include <linux/time.h>
 #include <linux/delay.h>
+#include <asm/atomic.h>
 
 static DECLARE_WAIT_QUEUE_HEAD(this_wq);
 
@@ -26,14 +27,21 @@ module_param(gpio_ctl_i, int, 0664);
 
 static unsigned int gpio_ctl_i_irq;
 
+static int comms_mode = 0;
+static int ctl_bits_count = 0;
+static int data_bits_count = 0;
+
 static void job_handler(struct work_struct* work){
 
 
     printk(KERN_INFO "waitqueue handler: %s\n", __FUNCTION__);
 
-    msleep(5000);
+       for(int i = 0; i < 10; i++){
+
+               gpio_set_value(gpio_ctl_o, IRQF_TRIGGER_RISING);
 
-       gpio_set_value(gpio_ctl_o, IRQF_TRIGGER_RISING);
+               msleep(1000);
+       }
 
     printk(KERN_INFO "up after 5000ms\n");
 
@@ -45,7 +53,9 @@ static void job_handler(struct work_struct* work){
 }
 
 static irqreturn_t gpio_irq_handler(int irq, void *dev_id) {
-       printk("gpio irqsk: interrupt was triggered and ISR was called\n");
+       printk("gpio irqsk: interrupt\n");
+       ctl_bits_count += 1;
+       printk("gpio irqsk: ctl bits count: %d\n", ctl_bits_count);
        return IRQ_HANDLED;
 }