Root/atusb/fw/include/atusb/ep0.h

Source at commit 42483d67b4b8800752870c261bc340896861a1db created 9 years 3 months ago.
By Werner Almesberger, atusb/fw/: added improved support for interrupt synchronization
1/*
2 * include/atusb/ep0.h - EP0 extension protocol
3 *
4 * Written 2008-2011 by Werner Almesberger
5 * Copyright 2008-2011 Werner Almesberger
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13
14#ifndef EP0_H
15#define EP0_H
16
17/*
18 * Direction bRequest wValue wIndex wLength
19 *
20 * ->host ATUSB_ID - - 3
21 * ->host ATUSB_BUILD - - #bytes
22 * host-> ATUSB_RESET - - 0
23 *
24 * host-> ATUSB_RF_RESET - - 0
25 * ->host ATUSB_POLL_INT - - 1
26 * host-> ATUSB_TEST - - 0
27 * ->host ATUSB_TIMER - - #bytes (6)
28 * ->host ATUSB_GPIO dir+data mask+p# 3
29 * host-> ATUSB_SLP_TR - - 0
30 * host-> ATUSB_GPIO_CLEANUP - - 0
31 *
32 * host-> ATUSB_REG_WRITE value addr 0
33 * ->host ATUSB_REG_READ - addr 1
34 * host-> ATUSB_BUF_WRITE - - #bytes
35 * ->host ATUSB_BUF_READ - - #bytes
36 * host-> ATUSB_SRAM_WRITE - addr #bytes
37 * ->host ATUSB_SRAM_READ - addr #bytes
38 *
39 * host-> ATUSB_SPI_WRITE byte0 byte1 #bytes
40 * ->host ATUSB_SPI_READ1 byte0 - #bytes
41 * ->host ATUSB_SPI_READ2 byte0 byte1 #bytes
42 * ->host ATUSB_SPI_WRITE2_SYNC byte0 bute1 0/1
43 */
44
45/*
46 * EP0 protocol:
47 *
48 * 0.0 initial release
49 * 0.1 addition of ATUSB_TEST
50 */
51
52#define EP0ATUSB_MAJOR 0 /* EP0 protocol, major revision */
53#define EP0ATUSB_MINOR 1 /* EP0 protocol, minor revision */
54
55#define HW_TYPE_100813 0 /* 2010-08-13 */
56#define HW_TYPE_101216 1 /* 2010-12-16 */
57#define HW_TYPE_110131 2 /* 2011-01-31, ATmega32U2-based */
58
59
60/*
61 * bmRequestType:
62 *
63 * D7 D6..5 D4...0
64 * | | |
65 * direction (0 = host->dev)
66 * type (2 = vendor)
67 * recipient (0 = device)
68 */
69
70
71#define ATUSB_TO_DEV(req) (0x40 | (req) << 8)
72#define ATUSB_FROM_DEV(req) (0xc0 | (req) << 8)
73
74
75enum atspi_requests {
76    ATUSB_ID = 0x00, /* system status/control grp */
77    ATUSB_BUILD,
78    ATUSB_RESET,
79    ATUSB_RF_RESET = 0x10, /* debug/test group */
80    ATUSB_POLL_INT,
81    ATUSB_TEST, /* atusb-sil only */
82    ATUSB_TIMER,
83    ATUSB_GPIO,
84    ATUSB_SLP_TR,
85    ATUSB_GPIO_CLEANUP,
86    ATUSB_REG_WRITE = 0x20, /* transceiver group */
87    ATUSB_REG_READ,
88    ATUSB_BUF_WRITE,
89    ATUSB_BUF_READ,
90    ATUSB_SRAM_WRITE,
91    ATUSB_SRAM_READ,
92    ATUSB_SPI_WRITE = 0x30, /* SPI group */
93    ATUSB_SPI_READ1,
94    ATUSB_SPI_READ2,
95    ATUSB_SPI_WRITE2_SYNC,
96};
97
98
99void ep0_init(void);
100
101#endif /* !EP0_H */
102

Archive Download this file



interactive