1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-07-05 04:28:55 +03:00
Commit Graph

110 Commits

Author SHA1 Message Date
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
02b80879bf atrf-proxy.c (loop): use SO_REUSEADDR to avoid "address already in use" 2011-04-12 06:58:55 -03:00
Werner Almesberger
8c5d21b0d7 tools/Makefile (DIRS): include atrf-proxy in builds 2011-04-12 06:58:20 -03:00
Werner Almesberger
6e0657ea71 tools/atrf-proxy/PROTOCOL: added specification of asynchronous WAIT command 2011-04-12 06:32:22 -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
0b0b5712e8 atrf-trim.c (main): passing the trim value is not a usage error 2011-04-10 19:55:47 -03:00
Werner Almesberger
4ad0383020 tools/atrf-proxy/: network proxy (untested) 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
a2f38c044e tools/: two small usage fixes
- atrf-id/atrf-id.c (usage): options were before the program name
- atrf-rssi/atrf-rssi.c (usage): the driver option was missing the "[-d"
2011-04-10 11:28:16 -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
Werner Almesberger
4b07e5c894 tools/: moved constant wave test mode code to libatrf (for sharing)
- 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
2011-04-10 10:24:24 -03:00
Werner Almesberger
fc1ad9fffd tools/lib: atusb can now be selected by bus/device or by bus-port path
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
2011-04-10 09:51:30 -03:00
Werner Almesberger
a75edf0cc0 tools/lib/: copied USB device opening code over from f32xbase
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)
2011-04-10 07:43:42 -03:00
Werner Almesberger
1a27e590d9 tools/: cleaned up the gross layering violation in atrf-xtal/atben.c
- 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
2011-04-10 07:28:27 -03:00
Werner Almesberger
7ff1a32ccf tools/: added option -d driver[:arg] to all tools
- atrf-id/atrf-id.c (main), atrf-reset/atrf-reset.c (main),
  atrf-trim/atrf-trim.c (main): changed command-line parsing to use
  "getopt"
- atrf-id/atrf-id.c (usage, main), atrf-reset/atrf-reset.c (usage, main),
  atrf-rssi/atrf-rssi.c (usage, main), atrf-trim/atrf-trim.c (usage,
  main), atrf-txrx/atrf-txrx.c (init_txrx, usage, main),
  atrf-xtal/atrf-xtal.c (usage, main): added option -d to select a driver
2011-04-10 07:28:27 -03:00
Werner Almesberger
1175923df7 tools/lib/atrf.c (select_driver): fixed name length calculation 2011-04-09 22:38:46 -03:00
Werner Almesberger
54edf17a1e libatrf: new function atrf_default_driver_name to get the default driver name
- 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
2011-04-09 22:35:29 -03:00
Werner Almesberger
1830454b49 atrf-xtal.c (usage, main): renamed option "d" (dump) to "r" (dump raw) 2011-04-09 21:36:52 -03:00
Werner Almesberger
adc14c4742 tools/lib/: make driver name matching case-sensitive and lower-case names
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
2011-04-09 21:18:31 -03:00
Werner Almesberger
5296fc8cf5 tools/: API change - atrf_open now requires a string argument (can be NULL)
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)
2011-04-09 21:13:11 -03:00
Werner Almesberger
4e64e7ad90 atrf-reset.c: title comment claimed this was atrf-rssi 2011-04-09 21:08:01 -03:00
Werner Almesberger
c18d3e58d2 tools/lib/: added driver selection and driver-specific parameters to backend
- 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
2011-04-09 21:00:48 -03:00
Werner Almesberger
bc6bce9923 atrf-xtal/atben.c: restructured the code for better clarity; added warnings 2011-04-04 09:42:03 -03:00
Werner Almesberger
28e7f25585 tools/atrf-xtal: new utility to measure the crystal frequency
- 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
2011-04-03 22:50:19 -03:00
Werner Almesberger
fe2720e63a tools/: new libatrf function atrf_slp_tr to control SLP_TR (for now only 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
2011-04-03 20:13:38 -03:00
Werner Almesberger
7cf2b0d352 Makefile.recurse: moved into makefiles/
- Makefile.recurse: moved into makefiles/
- tools/Makefile, cntr/tools/Makefile: updated path to Makefile.recurse
2011-03-22 12:37:16 -03:00
Werner Almesberger
da8962344c tools/atrf-txrx (DEFAULT_TRIM, usage, main): changed default trim from 0 to 8
As explained in ECN0002, atben and atusb are designed for the trim to
be set to the mid-range value. This just wasn't implemented so far.
2011-03-03 23:18:43 -03:00
Werner Almesberger
9552b9f4af tools/Makefile.common: offer LDLIBS_$(TARGET) twice (hack - needs more study) 2011-03-03 23:17:32 -03:00
Werner Almesberger
1d6fbcbd21 atrf-id.c (show_usb_info): pretty-print the MCU type for ATUSB boards 2011-02-10 23:43:36 -03:00
Werner Almesberger
19926ae32f tools/lib/Makefile (clean): didn't remove Ben-specific object files
- tools/lib/Makefile (clean): $(OBJS_ben) is now $(OBJS_ben_jlime) and
  $(OBJS_ben_openwrt)
2011-02-10 23:21:31 -03:00
Werner Almesberger
b0c15b7e7c tools: give the driver control over CLKM (for ATmega32U2 boards)
- 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
2011-02-10 23:11:34 -03:00
Werner Almesberger
e73ca5fcd5 tools/lib: cache chip ID in the descriptor
- 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
2011-02-10 21:15:05 -03:00
Werner Almesberger
705864d076 atrf-txrx: new option -r to select data rate
- 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
2011-01-20 19:42:52 -03:00
Werner Almesberger
f16224f575 atrf-txrx: new option -P to select ping mode
- 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
2011-01-20 19:42:52 -03:00
Werner Almesberger
fc226b2b51 atrf-txrc.c (usage, main): changed -P to -E to free -P for other use 2011-01-20 12:41:49 -03:00
Werner Almesberger
6282c334bc perdump: print relative receive timestamp
- perdump.h (struct result_ops), perdump.c (analyze, pcap_record): pass
  receive timestamp to reporter
- per-text.c (t_line, flush, text_undecided, text_packet): print relative
  receive timestamp before each packet
2011-01-19 19:34:16 -03:00
Werner Almesberger
6002759464 tools/atrf-txrx/perdump: new utility to analyze a PER dump
- 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
2011-01-19 18:29:14 -03:00
Werner Almesberger
1fb05c221d misctxrx.c (wait_for_interrupt): let "ignore" control printing more tightly
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".
2011-01-19 18:27:17 -03:00
Werner Almesberger
96e8fc6dbf atrf-txrx: renamed BER (bit error rate) test to PER (packet ...) test
- 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
2011-01-19 18:27:17 -03:00
Werner Almesberger
ea81e70cf9 atrf-txrx: define the pcap file magic number (0xa1b2c3d4) in pcap.h
- 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
2011-01-19 18:27:16 -03:00
Werner Almesberger
999ce5302e atrf-txrx: added BER test pattern transmit mode
- 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
2011-01-19 18:27:16 -03:00