1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-09 08:34:03 +02:00
Commit Graph

94 Commits

Author SHA1 Message Date
Werner Almesberger
cb20c55231 tools/lib/misctxrx.c (wait_for_interrupt): don't fragment timeouts
usb_bulk_read may lose data when timing out. We therefore try to
minimize the number of times we time out.
2011-06-20 22:56:59 -03:00
Werner Almesberger
70715a15d9 tools/lib/atben.c (atben_interrupt_wait): don't time out if timeout_ms == 0 2011-06-20 22:11:29 -03:00
Werner Almesberger
10b6d88af9 libatrf: simplify use of atrf_interrupt_wait now this it is mandatory
- lib/atrf.c (atrf_interrupt_wait): interrupt_wait is no longer
  optional
- atrf-proxy/atrf-proxy.c (cmd_more): we no longer need to handle
  atrf_interrupt_wait being unsupported
- lib/atusb-common.c (atusb_interrupt_wait): clarify what we don't
  want to return -1 on error
2011-06-20 21:14:14 -03:00
Werner Almesberger
d0fb1a8992 tools/: the great removal of atrf_interrupt
- atrf-proxy/PROTOCOL, atrf-proxy/atrf-proxy.c (cmd_zero): removed the
  POLL command
- lib/atben.c (atben_driver): don't export atben_interrupt anymore (we
  still use it internally)
- lib/atnet.c (atnet_interrupt, atnet_driver): removed atnet_interrupt
- lib/atusb-common.h (atusb_interrupt), lib/atusb-common.h
  (atusb_interrupt), lib/atusb-spi.c (atusb_spi_driver),
  lib/atusb.c (atusb_driver): removed atusb_interrupt
- lib/driver.h (struct atrf_driver): removed "interrupt"
- include/atrf.h (atrf_interrupt), lib/atrf.c (atrf_interrupt): removed
2011-06-20 21:10:41 -03:00
Werner Almesberger
76707d6b37 tools/lib/misctxrx.c (flush_interrupts): don't fall back to reading IRQ_STATUS
We now implement atrf_interrupt_wait in all drivers and don't need
the dubious fallback anymore.
2011-06-20 20:48:15 -03:00
Werner Almesberger
9952a20fda tools/lib/atben.c (atben_interrupt_wait): complain about stray interrupts
If INT_RF is high but IRQ_STATUS is clear, something strange is
happening. We complain but continue waiting.
2011-06-20 20:46:52 -03:00
Werner Almesberger
b4a6e8ef46 tools/: major overhaul of wait_for_interrupt; uses atrf_interrupt_wait now
- include/misctxrx.h (wait_for_interrupt), lib/misctxrx.c
  (wait_for_interrupt): replaced sleep_us*timeout limiting mechanism
  with a single timeout value in milliseconds
- lib/misctxrx.c (wait_for_interrupt): use atrf_interrupt_wait instead
  of polling
- lib/misctxrx.c (wait_for_interrupt): cleaned up control flow
- lib/misctxrx.c (run, die, wait_for_interrupt): renamed variable "run"
  to more specific "sigint"
- atrf-txrx/atrf-txrx.c (ping_rx, ping): pass timeout in milliseconds,
  not deciseconds
- atrf-rssi/atrf-rssi.c (sweep), atrf-rssi/gui.c (sweep),
  atrf-txrx/atrf-txrx.c (init_txrx, receive_message, receive_pcap,
  receive, transmit, transmit_pattern, ping_tx, ping_rx),
  atrf-xmit/atrf-xmit.c (init_tx, init_rx, xfer_one),
  lib/cwtest.c (enter_test_mode_230, start_test_mode_231):
  updated use of wait_for_interrupt
2011-06-20 20:08:42 -03:00
Werner Almesberger
55354c7f91 tools/lib/atben.c: added support for interrupt_wait (polled)
- atben.c (atben_interrupt_wait): loop until either the timeout has
  been reached or an interrupt has occurred
- atben.c (atben_driver): added atben_interrupt_wait
2011-06-20 20:08:42 -03:00
Werner Almesberger
4d4cec6a67 tools/lib/timeout.h, tools/lib/timeout.c: added timeout/deadline functions 2011-06-20 19:11:51 -03:00
Werner Almesberger
106ef7ff7f tools/atrf-xmit/atrf-xmit.c: corrected title comment 2011-06-20 18:22:29 -03:00
Werner Almesberger
668d8c61cf tools/: added interrupt_wait support to atnet and atrf-proxy (untested)
- atrf-proxy/PROTOCOL: WAIT is now implemented and takes a timeout
  argument
- atrf-proxy/atrf-proxy.c (cmd_more): implemented WAIT command using
  atrf_interrupt_wait
- lib/atnet.c (atnet_interrupt_wait, atnet_driver): added
  interrupt_wait (using WAIT)
2011-06-20 17:42:48 -03:00
Werner Almesberger
620709a20a libatrf: new function to reliably flush interrupts
- misctxrx.h (flush_interrupts), misctxrx.c: reliably flush interrupts
  on all drivers (with the exception of atnet talking to an atusb)
2011-06-20 17:21:40 -03:00
Werner Almesberger
110ecf67a1 tools/lib/: added interrupt_wait support to atusb and atusb-spi driver
- atusb-common.c (atusb_open): claim interface, so that we can do bulk
  I/O without complaints from the kernel
- atusb-common.h (atusb_interrupt_wait), atusb-common.c: blocking read
  for interrupt status byte on EP1
- atusb.c (atusb_driver), atusb-spi.c (atusb_spi_driver): provide the
  interrupt_wait operation
2011-06-20 17:10:29 -03:00
Werner Almesberger
e6f0a1d410 libatrf: new function atrf_interrupt_wait for interrupt-driven wait for interrupt
- tools/lib/driver.h (struct atrf_driver): new driver operation
  interrupt_wait
- include/atrf.h (atrf_interrupt_wait), atrf.c: new function to
  wait for a transceiver interrupt without polling
2011-06-20 17:10:29 -03:00
Werner Almesberger
a37bba8755 tools/lib: added USB-SPI driver for ATUSB
- atusb-spi.c: ATUSB driver that uses the ATUSB_SPI_* functions instead
  of ATUSB_{REG,BUF,SRAM}_*
- driver.h, atrf.c (drivers, atrf_usb_handle): added atusb_spi_driver
- Makefile (OBJS): added atusb-spi.o
2011-06-19 15:50:50 -03:00
Werner Almesberger
13f031be25 tools/lib/: split non-SPI code from atusb.c in preparation for SPI-based driver
- atusb.c (atusb_error, atusb_clear_error, atusb_open, atusb_close,
  atusb_reset, atusb_reset_rf, atusb_test_mode, atusb_slp_tr,
  atusb_interrupt, atusb_set_clkm, atusb_dev_handle): moved to
  atusb-common.c
- atusb-common.c (atusb_set_clkm): pass atusb_reg_write via
  atusb_driver.reg_write instead
- atusb.c (FROM_DEV, TO_DEV, struct atusb_dsc): moved to atusb-common.h
- Makefile (OBJS): added atusb-common.o
2011-06-19 14:06:00 -03:00
Werner Almesberger
9746205fd9 tools/lib/atusb.c: added missing standard #includes 2011-06-19 13:09:45 -03:00
Werner Almesberger
9ef447865b tools/: rearranged cwtest/atrf-path to be more clear about reset and do re-init
- include/cwtest.h (cw_test_needs_reset), lib/cwtest.c
  (cw_test_needs_reset): new function to indicate all cases where the
  transceiver needs to be reset (instead of using SLP_TR)
- lib/cwtest.c (cw_test_end): use cw_test_needs_reset instead of
  open-coding the decision
- lib/cwtest.c (enter_test_mode_230, start_test_mode_231): always wait
  for the PLL to lock. Contrary to the assumption in the previous
  commit, we should always see this interrupt.
- atrf-path/atrf-path.c (sample): initialize the transceiver if we had
  to reset it
- atrf-path/atrf-path.c (sample), atrf-path/atrf-path.c (do_half_sweep):
  moved the tTR19 delay to "sweep", so that all branches share it and it
  is taken only once
2011-06-13 14:24:59 -03:00
Werner Almesberger
8c00833542 lib/cwtest.c (start_test_mode_231): don't insist on IRQ_PLL_LOCK
We seem to have a path where the PLL is already locked when we get
there. We thus never get an interrupt and hang.

Pending further investigation, just use a timeout that is longer
than the worst-case PLL lock time.
2011-06-13 12:37:42 -03:00
Werner Almesberger
2a4f7a155f tools/lib/cwtest.c (cw_test_end): use reset also on USB devices
ATUSB can't use sleep mode because that would cut the AVR's clock.
The old SiLabs-based boards would not have that issue, but there,
the SLP_TR method is unproven. Besides, reset is as fast on USB.
2011-06-05 23:00:40 -03:00
Werner Almesberger
52657edf38 lib/atusb.c (atusb_slp_tr, atusb_driver): implemented SLP_TR pulse 2011-06-05 22:37:03 -03:00
Werner Almesberger
1a3f169e89 libatrf: add option to send a pulse with atrf_slp_tr
- include/atrf.h (atrf_slp_tr), lib/atrf.c (atrf_slp_tr): added pulse
  argument
- atrf-proxy/PROTOCOL, atrf-proxy/atrf-proxy.c (cmd_two, cmd_more):
  added second argument to SLP_TR command
- atrf-xtal/atben.c (atben_sample), lib/cwtest.c (cw_test_end): updated
  for API change
- lib/driver.h (struct atrf_driver): added "pulse" argument to slp_tr
- lib/atben.c (atben_slp_tr), lib/atnet.c (atnet_slp_tr): added support
  for pulse mode
2011-06-05 21:08:48 -03:00
Werner Almesberger
565fadf258 tools/lib/atusb.c: added SRAM access to atusb driver
- tools/atrf-proxy/PROTOCOL: documented new commands GETRAM and SETRAM
  for SRAM access
- tools/atrf-proxy/atrf-proxy.c (cmd_two, cmd_more): added "setram"
  command
- tools/atrf-proxy/atrf-proxy.c (cmd_more): added "getram" command
- tools/lib/atnet.c (atnet_sram_write, atnet_sram_read): SRAM access
  functions
- tools/lub/atnet.c (atnet_driver): added new functions to driver
  operations
2011-06-03 14:35:21 -03:00
Werner Almesberger
4aff7af370 tools/lib/atusb.c: added SRAM access to atusb driver
- atusb.c (atusb_sram_write, atusb_sram_read): SRAM access functions
- atusb.c (atusb_driver): added new functions to driver operations
2011-06-03 14:26:47 -03:00
Werner Almesberger
6b447f805c tools/lib/atben.c: added SRAM access to atben driver
- atben.c (atben_sram_write, atben_sram_read): SRAM access functions
- atben.c (atben_driver): added new functions to driver operations
2011-06-03 14:24:00 -03:00
Werner Almesberger
472e18294c libatrf: added SRAM access functions
- tools/include/atrf.h (atrf_sram_write, atrf_sram_read),
  tools/lib/atrf.c: single-byte SRAM access front-end functions
- tools/lib/driver.h (struct atrf_driver): new driver functions
  sram_write and sram_read
2011-06-03 13:52:13 -03:00
Werner Almesberger
43f179d6d8 tools/lib/: new helper function for daemonification
- include/daemon.h (daemonize), lib/daemon.c: shed all ties with the
  process' previous surroundings
- lib/Makefile (OBJS): added daemon.o
2011-05-18 13:34:26 -03:00
Werner Almesberger
b24a189189 tools/lib/atnet.c (atnet_set_clkm): corrected return code (1 means success here) 2011-05-18 00:20:00 -03:00
Werner Almesberger
55d220b400 tools/lib/usbopen.c: make vendor and/or product optional
- 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
2011-05-11 03:40:03 -03:00
Werner Almesberger
3deac4165e libatrf: new function usb_rescan to force next open_usb to scan tree again
- 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
2011-05-11 03:22:53 -03:00
Werner Almesberger
6fc212848a tools/lib/usbopen.h: moved to tools/include/, to allow for sharing 2011-05-11 03:20:36 -03:00
Werner Almesberger
89bcd3cfa8 tools/lib/atben.c (atben_open): corrected comment claiming the clock was 316 MHz 2011-04-25 23:52:08 -03:00
Werner Almesberger
2961482cac tools: atrf-id option -s to retrieve driver spec, with necessary infrastructure
- 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.
2011-04-20 08:58:17 -03:00
Werner Almesberger
4fa909debc libatrf: renamed driver specification argument from "arg" to "spec"
- tools/include/atrf.h (atrf_open), tools/lib/atrf.c (select_driver,
  atrf_open): renamed "arg" argument to "spec"
2011-04-20 08:15:19 -03:00
Werner Almesberger
a15ab43b1c tools/lib/atrf.c (select_driver): "default" selects the default driver 2011-04-19 23:37:44 -03:00
Werner Almesberger
16a48d6931 libatrf: cw test mode can now be resumed, with lower overhead (231 only)
- 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
2011-04-13 12:17:02 -03:00
Werner Almesberger
4244af265c tools/lib/cwtest.c (cw_test_end): try "quick reset" on AT86RF231
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)
2011-04-13 11:54:26 -03:00
Werner Almesberger
09e5d28768 xxx 2011-04-12 19:17:43 -03:00
Werner Almesberger
1618868f9f libatrf: further modularized transmit power setting and exported conversion
- 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
2011-04-12 18:41:03 -03:00
Werner Almesberger
8934c062a9 tools/: moved function to set transmit power from atrf-txrx to libatrf
- 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
2011-04-12 16:37:05 -03:00
Werner Almesberger
8f7e5cdefe tools/lib/atnet.c: eliminated global variables to allow for multiple sessions
- 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 "+"
2011-04-12 09:45:34 -03:00
Werner Almesberger
920fe3407f tools/lib/atnet.c (dialog_vsend): plugged memory leak 2011-04-12 09:32:26 -03:00
Werner Almesberger
95c8fce729 tools/lib/atusb.c: eliminated global variable to allow for multiple sessions
- 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
2011-04-12 09:22:40 -03:00
Werner Almesberger
4246535456 tools/lib/: atnet now works (tried atrf-txrx send and receive, atrf-rssi)
- atrf-proxy/atrf-proxy.c (cmd_two): "SET" wrote the wrong value
- lib/atnet.c (atnet_buf_read): cleaned up the logic and fixed some
  small bugs
2011-04-11 10:40:44 -03:00
Werner Almesberger
5dd2b4ae58 tools/lib/atusb.c (atusb_interrupt): if we have an error, report it immediately 2011-04-10 19:55:48 -03:00
Werner Almesberger
39319e145a tools/lib/: added network proxy-based driver (in progress)
- 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
2011-04-10 19:55:48 -03:00
Werner Almesberger
7be700df11 tools/lib/atrf.c: perform driver-specific operations only if using that driver
- atrf.c (atrf_usb_handle): only return the handle if using the atusb
  driver
- atrf.c (atrf_ben_regs): only call atben_regs if using the atben driver
2011-04-10 19:55:48 -03:00
Werner Almesberger
641567e393 tools/lib/atrf.c: moved declaration of driver operations to driver.h 2011-04-10 19:55:47 -03:00
Werner Almesberger
3b0ee3c00a tools/: added network (TCP) I/O helper functions
- include/netio.h, lib/netio.c: network I/O helper functions
- lib/Makefile (OBJS): added netio.o
2011-04-10 17:28:09 -03:00
Werner Almesberger
4190aded8c tools/lib/: added mechanism to remove USB restrictions (enabling multiple sessions)
- usbopen.h (usb_unrestrict), usbusb.c (usb_unrestrict): drop ID and
  path restrictions
- atusb.c (atusb_open): call usb_unrestrict to remove restrictions
2011-04-10 10:55:49 -03:00