Title: [6525] scripts/make-irq-wiki-list: add script for generating the irq wiki table automatically
Revision
6525
Author
vapier
Date
2009-06-01 17:29:23 -0500 (Mon, 01 Jun 2009)

Log Message

add script for generating the irq wiki table automatically

Added Paths


Diff

Added: scripts/make-irq-wiki-list (0 => 6525)


--- scripts/make-irq-wiki-list	                        (rev 0)
+++ scripts/make-irq-wiki-list	2009-06-01 22:29:23 UTC (rev 6525)
@@ -0,0 +1,49 @@
+#!/bin/bash
+#
+# This creates the table used here:
+# https://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:interrupts
+#
+
+set -e
+cd ${0%/*}/../trunk/arch/blackfin
+
+bfs=$(echo mach-bf* | sed s:mach-::g)
+
+max=0
+for b in ${bfs} ; do
+	h="mach-$b/include/mach/irq.h"
+	irqs=$(cpp -P -dD $h | grep '^#define IRQ_P[[:alpha:]][[:digit:]]' | awk '{print $2 " " $2}')
+	eval $b=\( $(
+		eval printf "'%s\n'" \
+			$(printf 'x%s=$((%s))\n' ${irqs} | cpp -P -include $h -) \
+			| sed -e s:^x:: -e 's:=: :'
+	) \)
+	eval len=\${#${...@]}
+	[ ${len} -gt ${max} ] && max=$len
+done
+max=$((max / 2))
+
+# dump the header
+printf '| ^'
+for b in ${bfs} ; do
+	printf '  %s  ^^' $(echo ${b} | tr '[:lower:]' '[:upper:]')
+done
+printf '\n'
+printf '^  GPIO #  ^'
+for b in ${bfs} ; do
+	printf '  %s  ^  %s  ^' Define "IRQ #"
+done
+printf '\n'
+
+# build the list
+g=0
+while [ ${g} -lt ${max} ] ; do
+	printf '|  %3s  ' $g
+	i=$((g * 2))
+	for b in ${bfs} ; do
+		printf '|  %-8s  ' $(eval echo \${$b[$i]})
+		printf '|  %3s  ' $(eval echo \${$b[$((i+1))]})
+	done
+	((g++))
+	printf '|\n'
+done
Property changes on: scripts/make-irq-wiki-list
___________________________________________________________________
Name: svn:executable
   + *
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to