Port-arm archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bcmgpio_fdt_intrstr: interrupt type
Hello,
Why not the following? The output of sys/dev/fdt/fdt_intr.c:fdtbus_intr_str would be consistent with that of sys/dev/gpio/gpio.c:gpio_intr_str and the type is valuable information.
This may be done for other board.
diff --git a/sys/arch/arm/broadcom/bcm2835_gpio.c b/sys/arch/arm/broadcom/bcm2835_gpio.c
index 367625c1d3af..609b56e82230 100644
--- a/sys/arch/arm/broadcom/bcm2835_gpio.c
+++ b/sys/arch/arm/broadcom/bcm2835_gpio.c
@@ -671,16 +671,31 @@ bcmgpio_fdt_intrstr(device_t dev, u_int *specifier, char *buf, size_t buflen)
{
/* 1st cell is the GPIO number */
- /* 3rd cell is flags */
+ /* 2rd cell is flags */
if (!specifier)
return (false);
const u_int bank = be32toh(specifier[0]) / 32;
const u_int pin = be32toh(specifier[0]) % 32;
+ const u_int type = be32toh(specifier[1]) & 0xf;
+ char const* typestr;
if (bank >= BCMGPIO_NBANKS)
return (false);
- snprintf(buf, buflen, "GPIO %u", (bank * 32) + pin);
+ if (type & FDT_INTR_DOUBLE_EDGE)
+ typestr = "double edge";
+ else if (type & FDT_INTR_TYPE_POS_EDGE)
+ typestr = "positive edge";
+ else if (type & FDT_INTR_TYPE_NEG_EDGE)
+ typestr = "negative edge";
+ else if (type & FDT_INTR_TYPE_HIGH_LEVEL)
+ typestr = "high level";
+ else if (type & FDT_INTR_TYPE_LOW_LEVEL)
+ typestr = "low level";
+ else:
+ return (false);
+
+ snprintf(buf, buflen, "GPIO %u (%s)", (bank * 32) + pin, typestr);
return (true);
}
Thank you
yarl
Home |
Main Index |
Thread Index |
Old Index