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

Source at commit f7b9a18917b8ed913f33bda55a33a87cf419c352 created 8 years 4 months ago.
By Werner Almesberger, atusb/fw/: new request ATUSB_GPIO_CLEANUP to re-enable INT0
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 */
43
44/*
45 * EP0 protocol:
46 *
47 * 0.0 initial release
48 * 0.1 addition of ATUSB_TEST
49 */
50
51#define EP0ATUSB_MAJOR 0 /* EP0 protocol, major revision */
52#define EP0ATUSB_MINOR 1 /* EP0 protocol, minor revision */
53
54#define HW_TYPE_100813 0 /* 2010-08-13 */
55#define HW_TYPE_101216 1 /* 2010-12-16 */
56#define HW_TYPE_110131 2 /* 2011-01-31, ATmega32U2-based */
57
58
59/*
60 * bmRequestType:
61 *
62 * D7 D6..5 D4...0
63 * | | |
64 * direction (0 = host->dev)
65 * type (2 = vendor)
66 * recipient (0 = device)
67 */
68
69
70#define ATUSB_TO_DEV(req) (0x40 | (req) << 8)
71#define ATUSB_FROM_DEV(req) (0xc0 | (req) << 8)
72
73
74enum atspi_requests {
75    ATUSB_ID = 0x00, /* system status/control grp */
76    ATUSB_BUILD,
77    ATUSB_RESET,
78    ATUSB_RF_RESET = 0x10, /* debug/test group */
79    ATUSB_POLL_INT,
80    ATUSB_TEST, /* atusb-sil only */
81    ATUSB_TIMER,
82    ATUSB_GPIO,
83    ATUSB_SLP_TR,
84    ATUSB_GPIO_CLEANUP,
85    ATUSB_REG_WRITE = 0x20, /* transceiver group */
86    ATUSB_REG_READ,
87    ATUSB_BUF_WRITE,
88    ATUSB_BUF_READ,
89    ATUSB_SRAM_WRITE,
90    ATUSB_SRAM_READ,
91    ATUSB_SPI_WRITE = 0x30, /* SPI group */
92    ATUSB_SPI_READ1,
93    ATUSB_SPI_READ2,
94};
95
96
97void ep0_init(void);
98
99#endif /* !EP0_H */
100

Archive Download this file



interactive