1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2025-01-10 12:50:14 +02:00
ben-wpan/cntr/fw/include/cntr/ep0.h
Werner Almesberger c7303e4ac1 Made communication with CNTR board more robust. Added documentation.
- cntr/README: description of the counter board and its application
- cntr/fw/common/crc32.c: variant of CRC32-IEEE802.3 shared by firmware and
  measurement application
- cntr/fw/cntr/ep0.c (my_setup), cntr/tools/cntr/cntr.c (get_sample):
  protect the counter value with a CRC and an one's complement copy
- cntr/fw/include/cntr/ep0.h: oops, wasn't checked into repository
- cntr/tools/cntr/cntr.c: added section titles
- cntr/tools/cntr/cntr.c (measure): show communication statistics at the end
- cntr/tools/cntr/cntr.c (measure, usage, main): new option -d to enable
  reporting of communication errors
- cntr/tools/cntr/cntr.c (set_stop, measure): let user stop measurement with
  SIGINT
- cntr/tools/cntr/cntr.c (measure): get multiple "first samples" and keep
  the one with the shortest round-trip time
- cntr/tools/cntr/cntr.c (measure): changed unit "ppk" (1/1000) to percent
  (1/100)
- cntr/tools/cntr/cntr.c (usage, main): command-line argument is now the
  accuracy goal, while the system clock deviation is set with the new
  option -c
- TODO: some more things to do
2010-08-25 18:47:45 -03:00

63 lines
1.1 KiB
C

/*
* include/cntr/ep0.h - EP0 extension protocol
*
* Written 2008-2010 by Werner Almesberger
* Copyright 2008-2010 Werner Almesberger
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef EP0_H
#define EP0_H
/*
* Direction bRequest wValue wIndex wLength
*
* ->host CNTR_ID - - 3
* ->host CNTR_BUILD - - #bytes
* host-> CNTR_RESET - - 0
*
* ->host CNTR_READ - 0 12
*/
/*
* EP0 protocol:
*
* 0.0 initial release
*/
#define EP0CNTR_MAJOR 0 /* EP0 protocol, major revision */
#define EP0CNTR_MINOR 0 /* EP0 protocol, minor revision */
/*
* bmRequestType:
*
* D7 D6..5 D4...0
* | | |
* direction (0 = host->dev)
* type (2 = vendor)
* recipient (0 = device)
*/
#define CNTR_TO_DEV(req) (0x40 | (req) << 8)
#define CNTR_FROM_DEV(req) (0xc0 | (req) << 8)
enum cntr_requests {
CNTR_ID = 0x00,
CNTR_BUILD,
CNTR_RESET,
CNTR_READ = 0x10,
};
void ep0_init(void);
#endif /* !EP0_H */