IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Git Source Tree
Root/
| Source at commit 5c5a93686b7e8985872ed451f53933f5303eba1c created 7 years 1 month ago. By Stefan Schmidt, atusb/fw: update changelog for 0.3 firmware release | |
|---|---|
| 1 | #!/usr/bin/perl |
| 2 | # |
| 3 | # atrf-path/genpathprof - Generate profile for atrf-path |
| 4 | # |
| 5 | # Written 2011 by Werner Almesberger |
| 6 | # Copyright 2011 Werner Almesberger |
| 7 | # |
| 8 | # This program is free software; you can redistribute it and/or modify |
| 9 | # it under the terms of the GNU General Public License as published by |
| 10 | # the Free Software Foundation; either version 2 of the License, or |
| 11 | # (at your option) any later version. |
| 12 | # |
| 13 | |
| 14 | sub usage |
| 15 | { |
| 16 | print STDERR <<"END" |
| 17 | usage: $0 below above [file ...] |
| 18 | |
| 19 | below/above define either absolute values or clearances: |
| 20 | 10 = 10.0 dBm |
| 21 | -3.5 = -3.5 dBm |
| 22 | +5 = 5 dBm below or above the minimum/maximum measurement |
| 23 | END |
| 24 | ; |
| 25 | exit(1); |
| 26 | } |
| 27 | |
| 28 | $below = shift @ARGV; |
| 29 | $above = shift @ARGV; |
| 30 | |
| 31 | &usage unless defined $below && defined $above; |
| 32 | |
| 33 | while (<>) { |
| 34 | next unless /^(\d+)\.5\s+(-?\d+(\.\d*))\s+/; |
| 35 | $f = int(($1+2.5)/5)*5; |
| 36 | $min{$f} = $2 if $min{$f} > $2 || !defined $min{$f}; |
| 37 | $max{$f} = $2 if $max{$f} < $2 || !defined $max{$f}; |
| 38 | } |
| 39 | print "# min\tmax\t Chan\tMHz\n"; |
| 40 | for ($i = 0; $i != 16; $i++) { |
| 41 | $f = 2405+5*$i; |
| 42 | if ($below =~ /^\+/) { |
| 43 | $min = $min{$f}-$'; |
| 44 | } else { |
| 45 | $min = $below; |
| 46 | } |
| 47 | if ($above =~ /^\+/) { |
| 48 | $max = $max{$f}+$'; |
| 49 | } else { |
| 50 | $max = $above; |
| 51 | } |
| 52 | printf("%.2f\t%.2f\t# %d\t%d\n", $min, $max, $i+11, $f); |
| 53 | } |
| 54 | |
