#!/usr/bin/perl -w use strict qw(refs vars); use POSIX; use IO::Handle; our @pin2otherdesc; while () { m/^(\d+)\t(\S.*\S)\s+/ or die; $pin2otherdesc[$1]= $2; } our @boards; foreach (@ARGV) { m/^(\w+)\:(\d+)$/ or die "$_ ?"; foreach (my $i=0; $i<$2; $i++) { push @boards, $1; } } our %boardpin2point; our %boardpin2indiv; our @pinboard2other; foreach my $board (0..$#boards) { my $bkind= $boards[$board]; next if exists $boardpin2point{$bkind}; open NI, "$bkind.net-info" or die "$bkind $!"; while () { next if m/^\#/; while (s/\\\n$//) { $_ .= ; } next unless m/\S/; chomp; my ($netname, $type, $pins) = m/^(\w+)\s+(\w+)\s+(\S.*)?$/ or die "$_ ?"; next unless defined $pins; $pins= " $pins "; $pins =~ m/\sPIC-(\d+)\s/ or next; my $pin= $1; my $indivpin; $indivpin=$1 if $pins =~ m/\sINDIV0-(\d+)\s/; $netname= "__${netname}__"; $netname =~ s/__pt(\d+)__/__/ or next; my $point= $1; $netname =~ s/^__//; $netname =~ s/__$//; $netname =~ s,__,/,g; $boardpin2point{$bkind}[$pin]= $point; $boardpin2indiv{$bkind}[$pin]= $indivpin; $pinboard2other[$pin]{$bkind}= $netname; } NI->error and die "$bkind $!"; close NI; } print < $pin, Others => $netnames, Priority => ($netnames !~ /\S/ ? -10 : -($netnames =~ m/spare/g)) }; } foreach my $outrow (sort { $a->{Priority} <=> $b->{Priority} || $a->{Others} cmp $b->{Others} || $a->{Pin} <=> $b->{Pin} } @outrows) { my $pin= $outrow->{Pin}; my $netnames= $outrow->{Others}; startrow(); cell('indent { right }', $pin); my $desc= $pin2otherdesc[$pin]; my $cell= "{Courier Base} \@Font \"$netnames\""; $cell .= "//1fx \"$desc\"" if $netnames =~ /\S/ && defined $desc; cell('margin { 0.1f }', "10p \@Font {$cell}"); foreach my $board (0..$#boards) { my $bkind= $boards[$board]; my $point= $boardpin2point{$bkind}[$pin]; my $indivpin= $boardpin2indiv{$bkind}[$pin]; my $rhs= defined($indivpin) ? "I.$indivpin" : '"*"'; if (!defined $point) { cell('paint { lightgrey }', ''); } else { cell('margin { 0.1f }', "10p \@Font { PT$point //1vx $rhs }"); } } cell('indent { right }', $pin); endrow(); } print "{\n",$body,"}\n"; my $revid= `../.git-revid`; chomp($revid) or die $?; $revid =~ s/[\"\\]/\\$&/g; print <error and die $!; __DATA__ 40 (useable for point only) 39 (useable for point only) 36 (GPIO) 24 (GPIO) 38 (Interrupt on change) 37 (Interrupt on change) 35 External Interrupt 2 34 External Interrupt 1 33 External Interrupt 0 30 ECCP1 PWM output D 29 ECCP1 PWM output C 28 ECCP1 PWM output B 27 ECCP1 PWM output A 26 RS232 RX 25 RS232 TX 22 Comparator 2 input 2 Analogue in 0 / Comparator ref out 3 Analogue in 1 15 Timer 1 osc out / Timer 1,3 ext clock in 16 Timer 1 osc in