Root/cntr/fw/include/cntr/ep0.h

1/*
2 * include/cntr/ep0.h - EP0 extension protocol
3 *
4 * Written 2008-2010 by Werner Almesberger
5 * Copyright 2008-2010 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 CNTR_ID - - 3
21 * ->host CNTR_BUILD - - #bytes
22 * host-> CNTR_RESET - - 0
23 *
24 * ->host CNTR_READ - 0 12
25 */
26
27/*
28 * EP0 protocol:
29 *
30 * 0.0 initial release
31 */
32
33#define EP0CNTR_MAJOR 0 /* EP0 protocol, major revision */
34#define EP0CNTR_MINOR 0 /* EP0 protocol, minor revision */
35
36
37/*
38 * bmRequestType:
39 *
40 * D7 D6..5 D4...0
41 * | | |
42 * direction (0 = host->dev)
43 * type (2 = vendor)
44 * recipient (0 = device)
45 */
46
47
48#define CNTR_TO_DEV(req) (0x40 | (req) << 8)
49#define CNTR_FROM_DEV(req) (0xc0 | (req) << 8)
50
51
52enum cntr_requests {
53    CNTR_ID = 0x00,
54    CNTR_BUILD,
55    CNTR_RESET,
56    CNTR_READ = 0x10,
57};
58
59
60void ep0_init(void);
61
62#endif /* !EP0_H */
63

Archive Download this file



interactive