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

890 Commits

Author SHA1 Message Date
Werner Almesberger
f9681e5b4f atusb/fw/usb/atu2.c: use implicit race-free "and" when writing to UDINT/UEINTX
The old code could accidently acknowledge interrupts that appeared
between the read and the write in UxINTx &= mask.

- atu2.c (handle_ep): writing to UEINTX implies a race-free "and"
- atu2.c (usb_poll): writing to UDINT implies a race-free "and"
2011-06-11 08:16:23 -03:00
Werner Almesberger
a69916da52 atusb/fw/: make timer code use interrupts instead of polling
- board_app.c (timer_poll): replaced with interrupt handler
- board_app.c (__timer_read): merged polling of timer_poll into the
  read loop (so it works as before, provided that interrupts are
  disabled)
- board_app.c (timer_read): run __timer_read with interrupts disabled
- board_app.c (timer_init): enable timer 1 overflow interrupt
- atusb.c (main): enabled global interrupts
- atusb.c (main): don't call poll_timer anymore
- board.h (timer_poll): removed
2011-06-11 08:13:31 -03:00
Werner Almesberger
2acdaca218 atusb/fw/: moved timer initialization to board_app.c as well
- board.c (board_init), board_app.h (timer_init), board_app.c
  (timer_init): moved timer initialization from board_init to
  new function timer_init
- atusb.c (main): call timer_init
2011-06-11 01:52:16 -03:00
Werner Almesberger
2d7ee91430 atusb/fw/: added transition from runtime to DFU mode according to DFU spec
- descr.c (config_descriptor): added DFU interface descriptor
- ep0.c (my_dfu_setup, my_set_interface, ep0_init): added DFU
  interface switching
- ep0.c (my_reset, ep0_init): CPU-reset (into boot loader) on
  USB bus reset when in appDETACH
- Makefile (OBJS): added dfu_common.o
2011-06-10 23:26:36 -03:00
Werner Almesberger
5f50611735 atusb/fw/usb/: DFU_ITF_DESCR also needs a protocol argument
- dfu.h (enum dfu_itf_proto): bInterfaceProtocol values for DFU
  functional descriptor
- dfu.h (DFU_ITF_DESCR): added protocol argument
- dfu.c (config_descriptor): pass protocol to DFU_ITF_DESCR
2011-06-10 23:15:51 -03:00
Werner Almesberger
2544004a86 atusb/fw/: moved common elements of DFU processing to dfu_common.c
- dfu.c (functional_descriptor, dfu, my_descr), dfu.h (dfu_my_descr):
  moved to dfu_common.c
- dfu.c (my_setup), dfu.h (dfu_setup_common), dfu_common.c
  (dfu_setup_common): moved handling of DFU_GETSTATUS, DFU_CLRSTATUS,
  and DFU_GETSTATE from my_setup to dfu_setup_common
- dfu_common.c (my_descr), dfu.c (dfu_init): renamed my_descr to
  dfu_my_descr
- Makefile (BOOT_OBJS): added dfu_common.o
2011-06-10 22:04:12 -03:00
Werner Almesberger
bbe27fc357 atusb/fw: revert most of the user_setups change and use simple callback instead
This allows us to do other things as well, e.g., change state.

- ep0.c (ep0_init), usb/dfu.c (dfu_init): use user_setup
- usb/atu2.c (usb_poll): no need to reset user_setup - the user's
  reset function can do that
- usb/usb.h (user_setups), usb/usb.c (handle_setup): removed
  user_setups
- usb/usb.h (user_set_interface), usb/usb.c (user_set_interface,
  handle_setup): callback for SET_INTERFACE
2011-06-10 21:50:42 -03:00
Werner Almesberger
7a2c785e29 atusb/fw/usb/dfu.h: define DFU interface descriptor, for later sharing
- dfu.h (DFU_ITF_DESCR): define DFU interface descriptor
- dfu.c (config_descriptor): use DFU_ITF_DESCR instead of open-coding
  the descriptor
2011-06-10 19:33:24 -03:00
Werner Almesberger
3cc92cc4a6 atusb/fw/: define USB bus current (40 mA) in board.h based on measured value
The measured values are:

board idle, looping	  9 mA
LED on			+ 5 mA
TX CW (+3 dBm)		+14 mA
			------
			 28 mA
			======

Adding a margin of 12 mA, we get 40 mA. DFU used 30 mA so far, the
application 50 mA.

- board.h (BOARD_MAX_mA): define maximum USB bus current
- descr.c (config_descriptor), usb/dfu.c (config_descriptor):
  use BOARD_MAX_mA for bMaxPower instead of hard-coding values
2011-06-10 19:33:24 -03:00
Werner Almesberger
89d13ce8f8 atusb/fw/: SET_INTERFACE can now select among interfaces (changes user_setup)
- ep0.c (ep0_init), usb/dfu.c (dfu_init): set user_setups[0] instead
  of user_setup
- usb/atu2.c (usb_poll): reset user_setup on bus reset
- usb/usb.h (user_setups), usb/usb.c (user_setups): array of
  interface-specific setup functions
- usb/usb.c (handle_setup): in SET_INTERFACE, select setup function
  from user_setups according to interface
- usb/usb.c (handle_setup): if user_setup is not set (e.g., the
  optional SET_INTERFACE was never issued), fall back to user_setups[0]
2011-06-10 17:12:57 -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
256ac01ab2 atusb/fw/board.c (reset_rf): increased 1 us delays to nominally 2 us
They should be at least 625 ns. Can't hurt to have a little tolerance.
2011-06-09 20:55:33 -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
ec7c93789a atusb/fw/: added "lazy enabling" of UART-SPI after ATUSB_GPIO
- spi.h (spi_off), spi.c: disable the UART
- spi.c (spi_initialized, spi_begin, spi_init): initialize the UART
  if necessary
- board_app.c (gpio): call spi_off to disable the UART instead of
  open-coding the operation
- board_app.c (gpio): don't explicitly re-enable the UART but defer it
  to the next communication
2011-06-09 14:02:26 -03:00
Werner Almesberger
814cf6fd78 atusb/fw/boot.c (main): reset_rf implies spi_init - no need to call it here 2011-06-09 12:52:51 -03:00
Werner Almesberger
ed6d43bb35 atusb/fw/board_app.c: removed unnecessary includes 2011-06-09 12:51:13 -03:00
Werner Almesberger
e678401ac3 atusb/fw/: split board functions into app-only/shared part (boot overlflowed)
- board.c (timer_h, reset_cpu, read_irq, slp_tr, timer_poll,
  timer_read, gpio): moved to new file board_app.c
- Makefile (OBJS): added board_app.o
2011-06-09 12:48:44 -03:00
Werner Almesberger
b41076135c atusb: include the position of fiducials in atusb-pos.csv (for fab)
The SMT fab was looking there for the positions (alas, in vain).
Seems as good a place as any.

- atusb.brd: bumped file version to 20110607 (didn't change the version
  printed on the layout since the layout itself didn't change)
- atusb.brd: changed fiducials from "virtual" to "normal+insert", to
  include them in the position report
- atusb.brd: renamed the fiducials to give them unique names
- Makefile: bumped fab files version to 20110607
2011-06-07 16:51:26 -03:00
Werner Almesberger
9f9e77d025 atben: include the position of fiducials in atben-pos.csv
The fab was looking there for the positions (alas, in vain). Seems as
good a place as any.

- atben.brd: bumped file version to 20110607 (didn't change the version
  printed on the layout since the layout itself didn't change)
- atben.brd: changed fiducials from "virtual" to "insert+place", to
  include them in the position report
- atben.brd: renamed the fiducials to give them unique names
- Makefile: bumped fab files version to 20110607
2011-06-07 16:39:17 -03:00
Werner Almesberger
66fb9d808c prod/: use positive and negative offset in spectrum test
This way, we can also spot issues in the digital interface leading to
mis-configurations. E.g., this one would be a defective SLP_TR line
in atusb:
http://downloads.qi-hardware.com/people/werner/wpan/tmp/jagged.png

- prod/Makefile, prod/Common: removed "-T +0.5" to use both offsets
- prod/Makefile (spectrum): print a direction indication before
  running atrf-path
2011-06-07 08:09:20 -03:00
Werner Almesberger
6e3edf3d2e prod/Common: try to obtain more consistent handling of \033 in echo
- Common (g_echo): wrapper for /bin/echo -e
- Common (pass, fail, todo): use g_echo instead of regular "echo" for
  strings containing escape sequences
2011-06-06 21:55:47 -03:00
Werner Almesberger
90ee726285 prod/doc/: atrf-path now accepts keypresses from all the usual places
- setup.hmac, test.hmac: it's no longer necessary to "type into the
  window" (i.e., with the focus there)
2011-06-06 20:26:18 -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
9a32c66faa prod/doc/test.hmac: we now also have the LED test 2011-06-06 20:06:32 -03:00
Werner Almesberger
ba6dd86b24 prod/atusb (led): added the LED test 2011-06-06 19:58:13 -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
0eb5fb1097 prod/doc/: updated for latest GPIO scan development
- setup.hmac: new atusb firmware 38a08c0
- test.hmac: the GPIO scan is now implemented
- test.hmac: updated error dump for change from "l" to "o"
2011-06-06 01:09:49 -03:00
Werner Almesberger
38a08c09ca prod/atusb: added GPIO test 2011-06-06 00:49:53 -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
dea973056c prod/atben: quote command containing !, to make it easier to copy & paste 2011-06-06 00:15:55 -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
e42203b723 atusb/fw/: new request ATUSB_SLP_TR to pulse SLP_TR
- include/atusb/ep0.h (enum atspi_requests): added ATUSB_SLP_TR
- ep0.c (my_setup): call slp_tr on ATUSB_SLP_TR
- board.h (slp_tr), board.c: pulse SLP_TR high
2011-06-05 22:34:49 -03:00
Werner Almesberger
e7dfb38fce prod/atben: changed 'l' to 'o' in all patterns 2011-06-05 21:57:32 -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
e6f7d85e8a atudb/fw: disable the UART in ATUSB_GPIO
- board.c (gpio): split GPIO setup and probing
- board.c (gpio): disable the UART while probing GPIOs
2011-06-05 18:27:40 -03:00
Werner Almesberger
d1dd611d1e prod/doc/test.hmac: expanded GPIO scan section (in progress) 2011-06-04 11:19:46 -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
370cd320ef atusb/fw: new request ATUSB_GPIO for direct GPIO access
reset_rf now resets all GPIOs to their default state. This way, we
can easily recover from an incomplete or incorrect use of ATUSB_GPIO.

- atusb.c (main), board.c (reset_rf): moved call to spi_init into
  reset_rf
- board.c (reset_rf, board_init): moved GPIO setup to reset_rf
- board.c (reset_rf): set GPIOs to reset defaults
- board.h (gpio), board.c: read/modify/write all settings of GPIO
  ports
- include/atusb/ep0.h (enum atspi_requests): added new request
  ATUSB_GPIO
- ep0.c (my_setup): ATUSB_GPIO reads/reconfigures a GPIO port
2011-06-04 10:29:10 -03:00
Werner Almesberger
59469a458d prod/atben: added GPIO test 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