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

Source at commit dcfa689936afb14fd0fdf804ba0aad08fa03f8f9 created 9 years 7 months ago.
By Werner Almesberger, atusb/fw2/: assigned hardware revision code point; some cleanup
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 *
28 * host-> ATUSB_REG_WRITE value addr 0
29 * ->host ATUSB_REG_READ - addr 1
30 * host-> ATUSB_BUF_WRITE - - #bytes
31 * ->host ATUSB_BUF_READ - - #bytes
32 * host-> ATUSB_SRAM_WRITE - addr #bytes
33 * ->host ATUSB_SRAM_READ - addr #bytes
34 */
35
36/*
37 * EP0 protocol:
38 *
39 * 0.0 initial release
40 * 0.1 addition of ATUSB_TEST
41 */
42
43#define EP0ATUSB_MAJOR 0 /* EP0 protocol, major revision */
44#define EP0ATUSB_MINOR 1 /* EP0 protocol, minor revision */
45
46#define HW_TYPE_100813 0 /* 2010-08-13 */
47#define HW_TYPE_101216 1 /* 2010-12-16 */
48#define HW_TYPE_110131 2 /* 2011-01-31, ATmega32U2-based */
49
50
51/*
52 * bmRequestType:
53 *
54 * D7 D6..5 D4...0
55 * | | |
56 * direction (0 = host->dev)
57 * type (2 = vendor)
58 * recipient (0 = device)
59 */
60
61
62#define ATUSB_TO_DEV(req) (0x40 | (req) << 8)
63#define ATUSB_FROM_DEV(req) (0xc0 | (req) << 8)
64
65
66enum atspi_requests {
67    ATUSB_ID = 0x00,
68    ATUSB_BUILD,
69    ATUSB_RESET,
70    ATUSB_RF_RESET = 0x10,
71    ATUSB_POLL_INT,
72    ATUSB_TEST,
73    ATUSB_REG_WRITE = 0x20,
74    ATUSB_REG_READ,
75    ATUSB_BUF_WRITE,
76    ATUSB_BUF_READ,
77    ATUSB_SRAM_WRITE,
78    ATUSB_SRAM_READ,
79};
80
81
82void ep0_init(void);
83
84#endif /* !EP0_H */
85

Archive Download this file



interactive