- usbwait.c (need_removal, wait_for_usb): if need_removal is set, wait
for the device to be removed before trying to find it
- usbwait.c (usage, main): new option -r to set need_removal
- usbwait/usbwait.c: update the USB device tree until the specified
device is detected
- usbwait/Makefile: build usbwait (host only)
- Makefile (DIRS, BEN_DIRS, upload): separated subdirectories with tools
that can run on the Ben from those that can't
- Makefile (DIRS): added usbwait/
- usbopen.c (open_usb): determine vendor and product objective outside
the loop
- usbopen.c (open_usb): check vendor and product only if non-zero
- usbopen.c (bad_id, parse_usb_id): vendor and product can now be
omitted
- tools/include/usbopen.h (usb_rescan), tools/lib/usbopen.c (initialized,
initialize, usb_rescan): usb_rescan forces a re-initialization of
libusb and a new scan of the USB device tree
- include/atrf.h (atrf_driver_spec), lib/atrf.c (atrf_driver_spec):
new function to retrieve the local or remote/final driver spec
- lib/atrf.c (struct atrf_dsc, atrf_open, atrf_close): record the local
driver spec
- lib/driver.h (struct atrf_driver): new driver function "driver_spec"
to retrieve the driver spec
- lib/atnet.c (struct atnet_dsc, atnet_open, atnet_close): maintain a
cache for the driver spec
- lib/atnet.c (atnet_driver_spec, atnet_driver): added support for the
"driver_spec" function
- atrf-proxy/PROTOCOL, atrf-proxy/atrf-proxy.c (cmd_zero): added command
SPEC to retrieve the (final) driver spec
- atrf-id/atrf-id.c (usage, main): added option -s to retrieve the
driver spec. One -s retrieves the local spec, -s -s the remote/final.
- Makefile (DIRS): added atrf-xmit
- atrf-xmit/Makefile, atrf-xmit/atrf-xmit.c: new utility atrf-xmit to
rapidly send packets from one device to another and analyze the outcome
- gui.c (disc, indicate): moved drawing of disc to separate function
- gui.c (triangle, up, down): draw an up/down triangle
- gui.c (indicate): use up/down triangle for over/under
- atrf-path.c (do_sweeps): return a pass/fail/undecided value
- gui.h (gui), gui.c (gui): return a pass/fail/undecided value
- gui.c (gui): return pass/fail when P or F is pressed; exit
unconditionally if Q is pressed
- atrf-path.c (main): according to the decision of "gui" or "do_sweeps",
print "#PASS", "#FAIL", or nothing
- gui.c (avg2y, segment): moved mapping from measurement to y position
to separate function, to allow for sharing
- gui.c (LIMIT_RGBA, draw_limit, gui): draw the limits
- sweep.h (MIN_DIFF, MAX_DIFF, struct sweep): added min/max profile
- sweep.h (do_sweep), atrf-path.c (do_half_sweep, do_sweep): compare
result against limits and return pass/fail decision
- sweep.h (N_CHAN), atrf-path.c (do_half_sweep, do_sweeps), gui.c
(N_CHAN): declare number of channels in one central place instead of
scattering it all around the program
- atrf-path.c (do_read_profile, read_profile, usage, main): new option -P
to read a min/max profile
- gui.c (indicate, main): moved indicator to separate function and
improved blink logic
- gui.c (OVER_RGBA, UNDER_RGBA, indicate, main): change color to indicate
pass/fail
atrf-path -T +0.5 -g ... 10 10 time:
before: 0.32-0.33 s
after: 0.27-0.29 s (88%)
- atrf-path.c (sample): force cw test setup if never done before
- atrf-path.c (do_half_sweep): only request cw test setup if sweeping
both offsets
atrf-path -T +0.5 -g ... 10 10 time:
before (both offsets) 0.65 s
after (one offset) 0.32-0.33 s (50%)
- atrf-path.c (usage, main): new option -T to specify which offset to
sweep (default: sweep both)
- atrf-path.c (do_half_sweep): only sample points with the desired offset
- atrf-path.c (print_sweep): only prints points we've sweeped
- gui.c (segment, draw): inverted flag logic from "have_last" to "first"
- gui.c (draw): only plot points we've sweeped
- gui.c (gui): pass the offset selection to "draw"
atrf-path -g ... 10 10 time:
before 1.92 s
after 0.65 s (34%)
- atrf-path.c (do_sweep): separate -0.5 MHz and +0.5 MHz sweep
- atrf-path.c (sample, do_sweep): set up cw test mode only twice per
sweep (once for each offset), and simply resume in all other cases
atrf-path -g ... 10 10 time is now stable at 1.92 s
- atrf-path.c (sample): commented-out init sequence needed for AT86RF230
- atrf-path.c (sample, do_sweep): set TX channel only once per +/-0.5 MHz
pair
- atrf-path.c (sample, do_sweep): "sample" no longer needs the channel
argument
- atrf-path.c (sample, main): do TX init only once
- lib/cwtest.c (enter_test_mode_231, prepare_test_mode_231,
start_test_mode_231, cw_test_begin): broke enter_test_mode_231 into
a slow setup component and a fast start/resume component
- include/cwtest.h (cw_test_resume), lib/cwtest.c (cw_test_resume):
resume transmission in a previously set up test mode
atrf-path -g ... 10 10 time:
before 2.08 s
after 1.92-1.93 s (92-93%)
- atrf-path.c (set_channel, init_common): moved setting of the channel
to separate function, for better granularity
- atrf-path.c (init_common, init_tx, init_rx, sample, do_sweep): the
init_* functions no longer set the channel; use set_channel
- atrf-path.c (main): initialize the receiver only once
- atrf-path.c (usage, main): new option -g to invoke the GUI
- atrf-path.c (usage, main): in GUI mode, the number of sweeps is optional
(default: infinite)
- atrf-path.c (main), gui.h (gui), gui.c (gui): exit after the specified
number of sweeps
The transceiver reset takes quite a while. It seems that also going into
sleep mode has the effect of stopping cw test mode and it's much faster.
This has only been tried on the AT86RF231. For AT86RF230, we therefore
still use the reset.
Performance improvement:
Measurement: atrf-path sweep time in GUI mode, averaging over 10 samples.
Running on PC with remote ATBEN transceivers.
before 7.36-7.68 s
after 2.08 s (27-28% of previous time)
- gui.h, gui.c: plot sweep results with SDL_gfx
- Makefile: added target-specific variables for SDL and SDL_gfx
- atrf-path.c (main): invoke the GUI if the number of sweeps is zero
- sweep.h (struct sweep ), atrf-path.c (sample, do_sweeps, main): pass
sweep parameters via a struct
- sweep.h (do_sweep), atrf-path.c (do_sweep, do_sweeps): separated single
sweep and made it public
- sweep.h (struct sample), atrf-path.c (sample, print_sweep, do_sweeps):
made "sample" and do_sweep return the sample value/vector and moved
output from "sample" to print_sweep
- atrf-path.c (rssi_to_dBm, sample): moved RSSI value to dBm conversion to
separate function
- atrf-path.c (sample): corrected calculation of average
- atrf-path.c (sample): also output minimum and maximum value
- plot: new option -e to display extremal values
- plot: added comment to explain y range
- lib/misctxrx.c (tx_pwr_230, tx_pwr_231): declare tables as "const"
- lib/misctxrx.c (POWER_TABLE_SIZE, set_power_dBm): don't open-code the
table size calculation
- lib/misctxrx.c (tx_power_table, set_power_dBm): moved transmit power
table selection out of set_power_dBm
- include/misctxrx.h (tx_power_dBm2step, tx_power_step2dBm),
lib/misctxrx.c (tx_power_dBm2step, tx_power_step2dBm, set_power_dBm):
moved conversion functions out of set_power_dBm and made them globally
available
- atrf-txrx/atrf-txrx.c (tx_pwr_230, tx_pwr_231, set_power): moved to
lib/misctxrx.c
- include/misctxrx.h, lib/misctxr.c (set_power_step, set_power_dBm):
separated dBm to index conversion from the actual operation
- atrf-txrx/atrf-txrx.c (main): use new set_power_dBm instead of old
set_power
- atnet.c: introduced descriptor structure, replacing direct netio handle
- atnet.c (reply, error): moved global variables into descriptor
- atnet.c (atnet_reg_read, atnet_interrupt): when complaining about an
invalid response, skip the leading "+"
- atusb.c: introduced descriptor structure, replacing direct USB device
handle
- atusb.c (error): moved global variable into descriptor
- driver.h (atusb_dev_handle), atusb.c (atusb_dev_handle), atrf.c
(atrf_usb_handle): call driver to perform the no longer trivial
translation
- atnet.c: driver "net", which accessed hardware via atrf-proxy
- Makefile (OBJS): added atnet.o
- driver.h (atnet_driver), atrf.c (drivers): added the atnet driver
- atrf.c (drivers): moved the driver list closer to the top
- usbopen.h (usb_unrestrict), usbusb.c (usb_unrestrict): drop ID and
path restrictions
- atusb.c (atusb_open): call usb_unrestrict to remove restrictions
- lib/Makefile (OBJS), include/cwtest.h (cw_test_begin, cw_test_end),
lib/cwtest.c (enter_test_mode_230, enter_test_mode_231,
cw_test_begin, cw_test_end): moved constant wave test mode setup
over from atrf-txrx.c
- atrf-txrx/atrf-txrx.c (transmit_pattern): use functions from cwtest.o
Examples:
usb:1/6 select logical device 6 on bus 1
usb:1-3.1.4 starting at bus 1, choose ports 3, 1, and 4
- usbopen.c (initialize, open_usb): moved libusb initialization to
separate function, to allow for sharing
- usbopen.h (restrict_usb_path), usbopen.c (restricted_path, open_usb,
restrict_usb_dev, restrict_usb_by_dev, read_num, restrict_usb_by_port,
restrict_usb_path): added mechanism to restrict USB path
- atusb.c (atusb_open): if an argument is given, call restrict_usb_path
with it
We shared it across projects so far, but since the code will be further
customized, it's better to keep it local (at least for a while).
- usbopen.h, usbopen.c: moved over f32xbase/include/usb.h and
f32xbase/lib/usb.c (for further customization)
- Makefile (CFLAGS, OBJS_host): use usbopen.o instead of usb.o from
f32xbase
- atusb.c: use usbopen.h instead of usb.h from f32xbase (also removes
include path ambiguity)
- include/atrf.h (atrf_ben_regs), lib/atrf.c (atrf_ben_regs),
lib/driver.h (atben_regs), lib/atben.c (atben_regs): new function to
get the mmap'ed registers in a less disgusting way
- atrf-xtal/atben.c (base, ben_setup): cleaned up the horrible layering
violation
- include/atrf.h (atrf_default_driver_name),
lib/atrf.c (atrf_default_driver_name): return the name of the default
driver, or "none" if no drivers are defined
Case-sensitive is the Unix way, and so is avoiding unnecessary upper-case.
- atben.c (atben_driver): changed name from "Ben" to "ben"
- atusb.c (atusb_driver): changed name from "USB" to "usb"
- atrf.c (select_driver): made driver name matching case-sensitive
atrf_open(NULL) maintains the old behaviour. To select a driver, use
atrf_open("name") or atrf_open("name:driver-specific-arguments")
The driver name is "ben" or "usb".
- include/atrf.h (atrf_open), lib/atrf.c (do_atrf_open, atrf_open):
atrf_open now requires the string argument for driver selection
- atrf-id/atrf-id.c (main), atrf-reset/atrf-reset.c (main),
atrf-rssi/atrf-rssi.c (main), atrf-trim/atrf-trim.c (main),
atrf-txrx/atrf-txrx.c (main), atrf-xtal/atrf-xtal.c (main):
changed atrf_open() to atrf_open(NULL)
- atrf.c (atrf_open, select_driver, do_atrf_open): added infrastructure
for passing the driver name and further parameters to atrf_open
- atrf.c (struct atrf_dsc): made "driver" constant
- driver.h (struct atrf_driver), atben.c (atben_open), atusb.c
(atusb_open): added string argument to the "open" function
- atusb.c (atusb_driver): corrected unterminated comment
- Makefile (DIRS): added atrf-xtal
- atrf-xtal/Makefile: build atrf-xtal for the Ben or do nothing elsewhere
- atrf-xtal/atrf-xtal.h, atrf-xtal/atrf-xtal.c: diagnostic utility to
determine the transceiver's crystal frequency
- atrf-xtal/atben.c: dirty low-level driver for ATBEN
- include/atrf.h, lib/atrf.c (atrf_slp_tr): new function to set the SLP_TR
line
- lib/driver.h (struct atrf_driver): added driver function slp_tr
- lib/atusb.c (atusb_driver): we dont support slp_tr yet
- lib/atben.c (atben_slp_tr, atben_driver): implement SLP_TR control
- include/atrf.h (atrf_set_clkm), lib/atrf.c (atrf_set_clkm): set or
disable CLKM
- lib/driver.h (atrf_set_clkm_generic), lib/atrf.c (atrf_set_clkm_generic):
generic function to set CLKM without restrictions
- lib/driver.h (struct atrf_driver): added driver operation "set_clkm"
to set CLKM
- lib/atusb.c (atusb_set_clkm, atusb_driver): restrict CLKM on ATmega32U2
boards
- atrf-txrx/atrf-txrx.c (init_txrx): use atrf_set_clkm to set CLKM
- atrf-txrx/atrf-txrx.c (init_txrx, main): pass CLKM frequency in MHz
instead of code point
- atrf.c (struct atrf_dsc): added field "chip_id" to cache chip ID
- atrf.c (identify, atrf_identify): moved identification logic to new
function
- atrf.c (atrf_open, atrf_identify): cache chip ID when opening the
device and return ID from cache
- atrf-txrx.c (set_rate, main): allow setting a non-standard high data
rate on the AT86RF231
- atrf-txrx.c (usage, main): added option -r to select the data rate
- atrf-txrx.c (struct ping, enum rx_res, ping_tx, ping_rx, ping): send
back a packet containing a locally generated sequence number and the
last sequence number received whenever a packet arrives
- atrf-txrx.c (usage, main): added option -P to select ping mode
- Makefile: added perdump
- perdump.h, perdump.c: read and analyze a PER dump in pcap format
- per-text.c: report PER test results as text on the console
When some interrupt(s) happened but the one(s) wait_for_interrupt was
waiting for weren't among them, it printed the list of interrupts
even if they were all in "ignore". This made sequences like RX_START
followed by TRX_END unnecessarily noisy.
Now, wait_for_interrupt only prints the pending interrupts if at
least one of them is not in "ignore".
- atrf-txrx.c (usage, main): changed option -B to -P
- atrf-txrx.c (usage): "BER test mode" is now "PER test mode"
- atrf-txrx.c (main): mode_ber is now mode_per
- pcap.h (PCAP_FILE_MAGIC): define the pcap file magic number
- atrf-txrx.c (write_pcap_hdr): use PCAP_FILE_MAGIC instead of open-coding
the magic number
- atrf-txrx.c (main): indicate mode of operation in variable "mode" instead
of dual-using "cont_tx"
- atrf-txrx.c (usage, main): added option -B to enter BER test pattern
transit mode
- atrf-txrx.c (transmit_pattern): transmit raw frames with a cyclic frame
number
- pcap.h: basic pcap file structure definitions
- atrf-txrx.c (usage, main): added option "-o file" to write received
frames to a pcap file instead of displaying them
- atrf-txrx.c (receive): moved code to receive and display a single message
into new function receive_message
- atrf-txrx.c (write_pcap_hdr, write_pcap_rec, receive_pcap): receive
messages into a pcap file
- atrf-txrx.c (usage): split options and arguments for different modi into
separate sections
- atrf-txrx.c (usage): moved details for common options to a separate
section
- atrf-txrx.c (usage): added -C mhz to synopsis
- Makefile.common (MACROS_ben_jlime, MACROS_ben_openwrt), lib/atrf.c
(atrf_open): changed HAVE_USD to HAVE_BEN
- lib/atben.c: changed "uSD version" in title to "Ben 8:10 card version"
- lib/atrf.c, lib/atben.c: changed all occurrences of "atusd" to "atben"
- lib/atusd.c: renamed CLK to SLP_TR
- lib/atusd.c (atusd_cycle, atusd_cycle, atusd_open, atusd_close):
#ifdef'ed all uses of CLK and changed them to SLP_TR (along with the
change in function)
- atrf-txrx/atrf-txrx.c (init_txrx): always use the crystal oscillator
According to the data sheet, it has to be enabled. The Software Model
doesn't mention it. Experiments show that it's indeed useless and just
adds noise.