1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-25 16:15:55 +02:00
Commit Graph

1028 Commits

Author SHA1 Message Date
Werner Almesberger
42483d67b4 atusb/fw/: added improved support for interrupt synchronization
At an interrupt barrier, the host must be able to ensure that no
interrupt generated before reaching the barrier is still pending and
will be delivered after crossing the barrier.

For this, we introduce the following concept:

- interrupts have a serial number. This number is sent to the host
  on EP 1 (currently bulk) to signal the interrupt, instead of the
  zero byte we used previously.

- the new request ATUSB_SPI_WRITE2_SYNC returns the interrupt
  serial number from after the register write (the register write
  itself is the interrupt barrier).

- the host can now check if the serial indicated from bulk and the
  serial from ATUSB_SPI_WRITE2_SYNC are the same. If yes, interrupts
  are synchronized. If not, it has to wait for the interrupt to be
  signaled on EP 1.

We should also consider the case that the interrupt serial has gotten
ahead of ATUSB_SPI_WRITE2_SYNC. But that seems to happen rarely. In
any case, it's something for the host driver to worry about, not for
the firmware.

- board.h (irq_serial), board_app.c (irq_serial, INT0_vect): count
  the interrupt serial number and return it when signaling the
  interrupt
- include/atusb/ep0.h (ATUSB_SPI_WRITE2_SYNC), ep0.c (my_setup):
  new request ATUSB_SPI_WRITE2_SYNC that does a register write, then
  returns the interrupt serial
2011-07-07 15:51:07 -03:00
Werner Almesberger
50595979f5 Revert "tools/atrf-id/atrf-id.c: new option -D to read atusb debug log"
This reverts commit 391c37f587.

The log isn't so useful in its present state because we may have to
unplug/replug to get out of a troublesome condition.
2011-07-05 19:40:43 -03:00
Werner Almesberger
ead7ade51e Revert "atusb/fw/: added optional debug log with request ATUSB_READ_LOG"
This reverts commit 39e3d4e61a.

The log isn't so useful in its present state because we may have to
unplug/replug to get out of a troublesome condition.
2011-07-05 19:39:25 -03:00
Werner Almesberger
391c37f587 tools/atrf-id/atrf-id.c: new option -D to read atusb debug log 2011-07-05 18:53:32 -03:00
Werner Almesberger
39e3d4e61a atusb/fw/: added optional debug log with request ATUSB_READ_LOG 2011-07-05 18:52:56 -03:00
Werner Almesberger
e610a9ec20 TODO: removed EPERM, added usb_read_bulk vs. signal, toolchain, DFU on U1010 2011-07-05 08:28:20 -03:00
Werner Almesberger
f535a80c56 tools/lib/atben.c: check if the 8:10 slot is available and fail if it isn't
- atben.c (MMC_PATH, AT86RF230_PATH, find_file, slot_in_use): check
  if the MMC or AT86RF230 kernel driver uses the 8:10 card slot and
  print a detailed error message if it is
- atben.c (atben_open): fail if the 8:10 card slot is busy
2011-07-05 07:47:56 -03:00
Werner Almesberger
17f7b66f7b install/INSTALL-Ben: switch linux-zigbee tools source from (old) tarball to git 2011-07-05 07:24:59 -03:00
Werner Almesberger
1615375dce tools/lib/atusb-common.c (atusb_open): give more detailed error message on EPERM 2011-07-05 00:17:20 -03:00
Werner Almesberger
e549ee4911 AUTHORS: werner@openmoko.org is now werner@almesberger.net 2011-07-04 22:53:28 -03:00
Werner Almesberger
298f0848c7 COPYING mentioned COPYING.GPLv2, COPYING.LGPLv21 which weren't included. Added them. 2011-07-04 22:51:17 -03:00
Werner Almesberger
f279907156 Merge branch 'master' of projects.qi-hardware.com:ben-wpan 2011-07-04 20:36:32 -03:00
Werner Almesberger
10f618ac60 tools/atrf-rssi/gui.c (gui): accept keyboard input both from stdin and SDL 2011-07-04 20:29:22 -03:00
Werner Almesberger
56f8b2d038 tools/: moved get_key from atrf-path/gui.c to libatrf, for sharing
The old "raw" function becomes get_key_init. Calling get_key_init is
only necessary if one wants to control the moment standard input is
switched to raw mode. If get_key is invoked without a prior call to
get_key_init, it will initialize automatically.

- atrf-path/gui.c (raw, main): renamed "raw" to get_key_init
- atrf-path/gui.c (old_term, restore_term, get_key_init, get_key):
  moved to include/getkey.h and lib/getkey.c
- lib/getkey.c (get_key_init, get_key): made calling get_key_init
  optional
- lib/Makefile (OBJS): added getkey.o
2011-07-04 20:29:22 -03:00
Werner Almesberger
6d1198cccd xxx 2011-07-04 20:29:22 -03:00
Werner Almesberger
71f095d8de tools/Makefile (BEN_DIRS): add dirtpan iff its lowpan tools dependency is met 2011-07-04 20:29:22 -03:00
Werner Almesberger
ae348fb5cc switch linux-zigbee tools source from (old) tarball to git repository
- install/INSTALL-PC: updated build process of lowpan-tools to
  use the git repository
- tools/dirtpan/Makefile (CFLAGS): added include path for lowpan
  tools from git
2011-07-04 20:29:22 -03:00
Werner Almesberger
848e5af33a Merge branch 'master' of projects.qi-hardware.com:ben-wpan 2011-07-04 14:46:55 -03:00
Werner Almesberger
0c77658006 install/ben-wpan-config-2.6.38: enabled CONFIG_PROC_PAGE_MONITOR
ubb-vga and possibly mplayer need /proc/self/pagemap
2011-07-04 14:31:50 -03:00
Werner Almesberger
c705bf0939 xxx 2011-07-01 12:55:28 -03:00
Werner Almesberger
e3066d7a21 tools/Makefile (BEN_DIRS): add dirtpan iff its lowpan tools dependency is met 2011-07-01 12:52:04 -03:00
Werner Almesberger
2d961523f2 switch linux-zigbee tools source from (old) tarball to git repository
- install/INSTALL-PC: updated build process of lowpan-tools to
  use the git repository
- tools/dirtpan/Makefile (CFLAGS): added include path for lowpan
  tools from git
2011-07-01 12:18:34 -03:00
Werner Almesberger
d94ac9587d TODO: various updates 2011-06-30 16:02:08 -03:00
Werner Almesberger
673d29a29a tools/Makefile (BEN_DIRS): comment out dirtpan again, to avoid hdr dependency 2011-06-30 15:56:54 -03:00
Werner Almesberger
b3b037e18d TODO: update for switch to spi_atben 2011-06-26 07:24:18 -03:00
Werner Almesberger
0eff1587b5 install/ben-wpan-config-2.6.38: updated for spi_atben driver 2011-06-26 07:21:52 -03:00
Werner Almesberger
865d3bb264 TODO: updated 2011-06-26 07:13:22 -03:00
Werner Almesberger
8f949842db atusb/fw/: remove unused items when building the USB driver for the boot loader
- usb/atu2.c (NUM_EPS), board.h (NUM_EPS): moved definition to
  board.h
- board.h (NUM_EPS): use one EP for the boot loader, two for the
  application
- usb/atu2.c (ep_init): initialize EP 1 only in an application build
2011-06-26 06:59:13 -03:00
Werner Almesberger
6909fc232a atusb/fw/Makefile: introduce target-specific compliation variants
- Makefile (USB_OBJS): moved into OBJS and BOOT_OBJS
- Makefile (OBJS): atu2.o is now app-atu2.o
- Makefile (BOOT_OBJS): atu2.o is now boot-atu2.o
- Makefile (MKDEP, %.o): moved dependency generation to macro $(MKDEP)
- Makefile (app-%.o): build from usb/%.c
- Makefile (boot -%.o): build from usb/%.c and set -DBOOT_LOADER
2011-06-26 06:56:01 -03:00
Werner Almesberger
0194dc1a05 tools/dirtpan/: added statistics collection, SIGUSR1 to dump, SIGUSR2 to reset
- dirtpan.c (stats, send_frame, send_more, send_ack, rx_pck, tx_pck,
  ack_timeout, reass_timeout): gather extensive statistics
- dirtpan.c (handle_usr1, main): if running in the foreground, dump
  statistics on standard error on SIGUSR1
- dirtpan.c (handle_usr2, main): if running in the foreground, reset
  statistics to zero on SIGUSR2
2011-06-26 00:03:56 -03:00
Werner Almesberger
417d12ce05 tools/Makefile (BEN_DIRS): added "dirtpan", so it's now included by default 2011-06-26 00:03:07 -03:00
Werner Almesberger
5392401c0a tools/atrf-rssi/: added menu for regulation area selection
- gui.c (area_off, gui): don't show a regulation area by default
- letter.h, letter.c: drawing of limited character set
- Makefile (OBJS_host, OBJS_ben_jlime): added letter.o
- gui.c (print, area_selector, gui): show regulation area selector
2011-06-24 22:29:17 -03:00
Werner Almesberger
9af0f937de tools/atrf-rssi/: added WLAN channel display (US, EU, and JP)
- gui.c (wlan_area): the currently displayed regulation domain
- gui.c (wlan_channels): return the number of WLAN channels
- gui.c (show_wlan_channel): determine whether the specified channel
  should be used in the currently displayed regulation domain
- gui.c (label_wlan_channels): show WLAN channel numbers and their
  width
- gui.c (gui): switch regulation domain with E (Europe), J (Japan),
  and U (US)
- gui.c (gui): quit now only if Q is pressed instead of any key
- gui.c (gui): call label_wlan_channels to display the WLAN channels
2011-06-24 21:50:28 -03:00
Werner Almesberger
7c12bf02c1 tools/atrf-xmit/atrf-xmit.c: cleaned up timeouts and interrupt polling
- atrf-xmit.c (xfer_one): wait 10 ms for the packet to be sent (1 ms
  was clearly too short)
- atrf-xmit.c (xfer_one): use wait_for_interrupt instead of
  atrf_interrupt_wait, so that the retry logic can do its work
2011-06-23 13:21:25 -03:00
Werner Almesberger
d8363d853c tools/lib/misctxrx.c (wait_for_interrupt): enforce a minimum timeout of 10 ms
Seems that just one millisecond isn't enough to get a byte from
the USB device, even if the byte is already waiting in the endpoint
FIFO there.
2011-06-23 13:21:05 -03:00
Werner Almesberger
8a2d80a93c tools/lib/atusb-common.c: updated for new interrupt handling in firmware
- atusb-common.c (atusb_interrupt_wait): the atusb firmware no longer
  reads and accumulates IRQs for us. We now just wait for the
  notification, then read IRQ_STATUS. Let higher layers take care of
  retries and all that.
- atusb-common.c (atusb_open): clear any pending interrupts
2011-06-23 13:14:39 -03:00
Werner Almesberger
23c592250e atusb/fw/board_app.c: do not read and accumulate IRQs; flash LED when EP1 busy
To indicate an interrupt, we just send a zero byte.
2011-06-23 13:03:34 -03:00
Werner Almesberger
27fc0a0e2c atusb/fw/: aggregate interrupts while waiting
- board_app.c (INT0_vect): always read IRQ_STATUS, even if an
  interrupt is already enqueued
- board_app.c (INT0_vect): if an interrupt is enqueued, accumulate
  the interrupts signaled since
- board_app.c (irqs_more): when a pending transfer completes, send
  interrupts accumulated since (if any)
2011-06-23 09:41:40 -03:00
Werner Almesberger
15db279ca2 TODO: updated with current tasks 2011-06-21 09:24:55 -03:00
Werner Almesberger
b0b04ed226 tools/atrf-gpio/atusb.c (restore_gpios): send ATUSB_GPIO_CLEANUP 2011-06-20 23:15:30 -03:00
Werner Almesberger
f7b9a18917 atusb/fw/: new request ATUSB_GPIO_CLEANUP to re-enable INT0
- board.h (gpio_cleanup), board_app.c (gpio_cleanup): restore INT0
  when done manipulating GPIOs
- board.c (gpio): updated comment explaining how to restore INT0
- include/atusb/ep0.h (enum atspi_requests), ep0.c
  (ATUSB_GPIO_CLEANUP): new request to return to normal operation
  after ATUSB_GPIO
2011-06-20 23:11:09 -03:00
Werner Almesberger
f8f2f890d9 tools/lib/atusb-common.c (atusb_interrupt_wait): don't try to pull more irqs
ausb_bulk_read may lose data when timing out. We therefore try to
minimize the number of times we time out. Reading until no more
interrupts arrive may have looked like a good idea, but it just
causes trouble for now.
2011-06-20 22:58:46 -03:00
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
b2c7727c57 prod/atusb (led): show keys to press in reverse
Before, it read "... [P]ass ... [F]ail ...", and the closing
square brackets could be mistaked for lower-case ells.
2011-06-20 22:36:24 -03:00
Werner Almesberger
f4ca3aed63 tools/atrf-proxy/: make WAIT 0 wait forever
- PROTOCOL: corrected obsolete part of WAIT behaviour
- PROTOCOL: mention that WAIT 0 waits forever
- atrf-proxy.c (cmd_more): don't convert WAIT argument 0 to 1
2011-06-20 22:14:52 -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
12fef1b196 atusb/fw/: disable INT0 if manipulating GPIOs (tentative)
Since GPIO manipulations may cause stray INT0 activity, we turn off
INT0 handing on ATUSB_GPIO. The MCU must be reset to restore access
to INT0.

There are still issues to resolve with the GPIO test. It may turn
out that there's a less invasive solution than just turning off
INT0 completely.

- board_app.c (gpio): mask INT0 before manipulating GPIOs
- board_app.c (board_app_init): make it clearer that EIMSK is a bit
  mask
2011-06-20 20:50:22 -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