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

207 Commits

Author SHA1 Message Date
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
e77658fe26 tools/dirtpan/dirtpan.c: cleaned up embarrassing explanation of control byte
- dirtpan.c: changed control byte from innovative 7 bit layout to the
  more common 8 bits. My, haven't we had our morning coffee yet ?
- dirtpan.c: added explanation that the two highest bits of the
  control byte have to be zero, to avoid conflicting with RFC4944
2011-06-19 08:40:56 -03:00
Werner Almesberger
a800eb8794 tools/dirtpan/dirtpan.c: added missing #include "daemon.h", oops 2011-06-13 20:01:31 -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
4d4e132f0a atrf-xmit: tightened checking of interrupt behaviour
- atrf-xmit.c (xfer_one): also check that also the sender has no
  pending interrupts before we start sending
- atrf-xmit.c (xfer_one): interrupt poll loop (now disabled) checked
  the sender, not the receiver. oops.
- atrf-xmit.c (xfer_one): upon reception, check that the sender has
  finished (IRQ_TRX_END) as well
2011-06-09 21:08:14 -03:00
Werner Almesberger
78ab017990 tools/atrf-proxy/atrf-proxy.c (cmd_zero): reduce poll delay from 100 ms to 2 ms
The overly generous delay has the effect of encouraging dubious
optimizations elsewhere. Not a good idea.
2011-06-09 20:54:07 -03:00
Werner Almesberger
abe923d2ef atrf-xmit: use receive interrupt instead of polling
- atrf-xmit.c (xfer_one): use wait_for_interrupt instead of polling
- atrf-xmit.c (xfer_one): fail if there's an unexpected receiver
  interrupt
2011-06-09 20:49:36 -03:00
Werner Almesberger
703ce81dfc atrf-xmit.c (xfer_one): pulse SLP_TR instead of sending TRX_CMD_TX_START
This makes sure we use SLP_TR just like the kernel does.
2011-06-09 20:39:24 -03:00
Werner Almesberger
6ca63fc6e7 atrf-path: accept keyboard input both from stdin and SDL
- gui.c (old_term, restore_term, raw, get_key): raw and non-blocking
  console input
- gui,c (gui): accept console input in addition to keypressed in the
  SDL window
2011-06-06 20:22:57 -03:00
Werner Almesberger
8f20b1fb87 atrf-gpio: cleaned up usage
- atrf-gpio.c (usage): added newline after synopsis
- atrf-gpio.c (usage): description of option -p was missing
- atrf-gpio.c (main): invocation without patterns/commands is now an
  error
2011-06-06 19:42:31 -03:00
Werner Almesberger
533dc58824 atrf-gpio.c: rename anything "reg_op" to "command"
- atrf-gpio.c (bad_reg_op, reg_op): renamed "bad_reg_op" to
  "bad_command"
- atrf-gpio.c (bad_command): error message is now "invalid command"
- atrf-gpio.c (reg_op, main): renamed "reg_op" to "command"
2011-06-06 19:38:42 -03:00
Werner Almesberger
7a2e09187f atrf-gpio: option -c to cycle through the pattern sequence with pass/fail input
- atrf-gpio.c: added section titles
- atrf-gpio.c (DEFAULT_DELAY_MS, reg_op, usage): the "delay" command
  now accept an optional delay argument
- atrf-gpio.c (old_term, restore_term, raw, pass_fail): make standard
  input non-blocking and raw, and poll for pass/fail input
- atrf-gpio.c (usage, main): new option -c to cycle through the
  pattern sequence, waiting for pass/fail input
2011-06-06 19:33:11 -03:00
Werner Almesberger
14215f5b12 atrf-gpio: added control commands; register read can now be masked
- atrf-gpio.c (reg_op, usage): new command "delay" to add a 10 ms
  delay
- atrf-gpio.c (reg_op, usage): new command "frame" to write one
  byte to the frame buffer
- atrf-gpio.c (reg_op, usage): new command "reset" to reset the
  transceiver (via atrf_reset_rf)
- atrf-gpio.c (reg_op, usage): new command "slp_tr" to pulse SLP_TR
  (via atrf_slp_tr)
- atrf-gpio.c (reg_op, usage): register read can now be followed by a
  mask value
2011-06-06 00:27:41 -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
33b0400e53 atrf-gpio: accept 'o' as an alias for 'l'
This, while being slightly unsystematic, reduces the risk of confusing
"1" (one) and "l" (lower-case ell).

- tools/atrf-gpio/atben.c (do_atben), tools/atrf-gpio/atusb.c
  (do_atusb): treat 'o' as an alias of 'l'
- tools/atrf-gpio/atrf-gpio.c (usage): list 'o' as alternative for 'l'
2011-06-05 21:47:02 -03:00
Werner Almesberger
e9debdd4ab tools/atrf-gpio/atusb.c (gpio): _exit after USB error, to avoid futile cleanup 2011-06-05 21:37:46 -03:00
Werner Almesberger
a73a8a2044 tools/atrf-gpio/atusb.c: if ATUSB_GPIO fails, show the attempted setting
- atusb.c (dump_port, gpio): dump the attempted setting if ATUSB_GPIO
  fails (assuming it is that setting that caused the failure)
2011-06-05 21:32:14 -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
87e06b4e4e tools/atrf-gpio/atusb.c: various bug fixes and improvements
- atusb.c (name): clarified that PC3 is unconnected
- atusb.c (gpio): "dir" and "data" were swapped
- atusb.c (gpio): complain if ATUSB_GPIO returns the wrong amount of data
- atusb.c (dump, main): show the pin configuration as well
- atusb.c (dump): show "-" for values where we don't expect a specific
  result
- atusb.c (dump): removed extra newline on mismatch
2011-06-05 18:30:13 -03:00
Werner Almesberger
6bf03fe0a6 tools/atrf-gpio/atben.c: made error report easier to read
- atben.c (decode_cfg): report pull-up as "R" instead of "P"
- atben.c (dump_pd): show "-" for values where we don't expect a
  specific result
2011-06-04 10:53:44 -03:00
Werner Almesberger
b0f3cb099b tools/atrf-gpio/atusb.c: ATUSB driver (using ATUSB_GPIO) 2011-06-04 10:29:10 -03:00
Werner Almesberger
4924755a15 atrf-gpio: new utility to directly access GPIOs (for now atben-only)
- tools/atrf-gpio/: new utility to directly access GPIOs
- tools/Makefile (BEN_DIRS): added atrf-gpio
2011-06-04 09:50:27 -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
61e656e143 atrf-xtal: added atusb support (via ATUSB_TIMER)
- Makefile: removed limitation to Ben and added host build
- atusb.c: atusb-specific acquisition and calculations
- atrf-xtal.h (do_atusb): interface to atusb.c
- atrf-xtal.c (atben, atusb, main): added switch to board-specific driver
- atrf-xtal.c (usage, main): added support for atusb
2011-05-30 19:17:43 -03:00
Werner Almesberger
bdca20479b atrf-xtal: moved atben-specific code to atben.c
- atrf-xtal.c (cmp, eval, do_atben): moved to atben.c
- atrf-xtal.c (setup, sample, cleanup): removed wrappers
- atrf-xtal.c (usage): cast strlen result, for x86-64 compatibility
- atrf-xtal.h (atben_setup, atben_sample, atben_cleanup), atrf-xtal.c:
  device interface functions are now "static"
- atrf-xtal.h (do_atben): do_atben is now our new interface
2011-05-30 19:13:24 -03:00
Werner Almesberger
5a6aae57cb atrf-xtal.c (do_atben, main): moved board-specific code to separate function 2011-05-30 00:17:49 -03:00
Werner Almesberger
45746fdfa5 dropped f32xbase dependency on Makefile.common
This means that we only depend on f32xbase for atusb-sil (defunct) and
cntr (needs updating), but not for any of the project's main parts.

- makefiles/Makefile.basic: copied over from
  f32xbase/lib/Makefile.common
- makefiles/Makefile.basic (LDLIBS): removed inclusion of libusb
- tools/Makefile.common: use makefiles/Makefile.basic
- install/INSTALL-Ben, prod/doc/setup.hmac: removed f32xbase
  dependency
2011-05-29 06:03:11 -03:00
Werner Almesberger
0eec747510 atrf-path: added visual history of dumps
- gui.c (segment, draw, gui): make caller provide color, to ease sharing
- gui.c (dump, gui): moved call to print_sweep to separate function
- gui.c (DUMP_RGBA, dumps, n_dumps, dump, draw_dumps, gui): record all
  dumps and display them in the background
2011-05-28 12:21:56 -03:00
Werner Almesberger
b82472bb01 tools/atrf-path: added interactive dumping with D
- sweep.h (print_sweep), atrf-path.c (print_sweep): make global, for
  sharing with gui.c
- gui.c (gui): dump the sweep results to standard output if "D" is
  pressed
2011-05-28 12:03:23 -03:00
Werner Almesberger
ff6c8340c8 tools/atrf-xtal/: new option -b for relative result; -p for pass/fail
- atrf-xtal.c (eval): return the value instead of printing it
- atrf-xtal.c (usage, main): new option -b for reporting the deviation
  from a base count
- atrf-xtal.c (eval): new option -p to report an error for deviations
  outside the specified bound
2011-05-18 23:04:54 -03:00
Werner Almesberger
558017e34d tools/atrf-xmit/atrf-xmit.c (xfer_one, usage, main): new option -v (verbose) 2011-05-18 16:49:38 -03:00
Werner Almesberger
81a8e138c7 tools/dirtpan/dirtpan.c: new option -b to background/daemonize
- dirtpan.c (usage): added detailed description of the arguments
- dirtpan.c (usage, main): new option -b to daemonize after initialization
2011-05-18 14:07:05 -03:00
Werner Almesberger
1bfe86ac1b tools/atrf-proxy/atrf-proxy.c: new option -b to background/daemonize
- atrf-proxy.c (usage): added detailed description of the arguments
- atrf-proxy.c (usage, main): new option -b to daemonize after
  initialization
2011-05-18 13:53:01 -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
7e2c576f7b tools/dirtpan/: rewritten for simultaneous reception and transmission
Note that the PHY is still half-duplex, but we don't need to insist
on the entire packet reception/transmission to finish before letting
the peer have its say.
2011-05-12 16:26:38 -03:00
Werner Almesberger
de72af351f tools/dirtpan/: if given an interface conf command, run it with tunX in $ITF
- dirtpan.c (open_tun): if a command is given, set the environment
  variable ITF to the interface name and system(3) the command
- dirtpan.c (usage, main): accept an interface configuration command as
  the 4th command-line argument
2011-05-11 16:46:29 -03:00
Werner Almesberger
e17881c91b tools/dirtpan/dirtpan.c (rx_pck): break tie if both sides are in s_tx
Note that we still waste at least one perfectly good frame. However,
instead of implementing some fancy arbitration, it's better if we
just make the whole thing bidirectional in the future.
2011-05-11 16:29:26 -03:00
Werner Almesberger
2c7d06f6f2 tools/dirtpan/dirtpan.c (rx_pck): immediately ack all data packets
We basically take care of the acking the 802.15.4 layer should do.
2011-05-11 16:25:10 -03:00
Werner Almesberger
354789da8d tools/dirtpan/dirtpan.c (timeout): fencepost error when normalizing tv_usec 2011-05-11 15:43:07 -03:00