Project

General

Profile

Download (1.65 KB) Statistics
| Branch: | Tag: | Revision:
1 1bc85442 (no author)
#ifndef _OPCD_USB_H
2
#define _OPCD_USB_H
3 f57b548d (no author)
4 43d61cf0 (no author)
#include <lib_AT91SAM7.h>
5 caf50003 (no author)
#include <sys/types.h>
6 43d61cf0 (no author)
#include <asm/atomic.h>
7
#include "openpcd.h"
8 a97e460b laforge
#include <dfu/dfu.h>
9 43d61cf0 (no author)
10 706ffa9f laforge
#define AT91C_EP_OUT 1
11
#define AT91C_EP_OUT_SIZE 0x40
12
#define AT91C_EP_IN  2
13
#define AT91C_EP_IN_SIZE 0x40
14
#define AT91C_EP_INT  3
15
16
17 43d61cf0 (no author)
struct req_ctx;
18
19 b0317c72 (no author)
extern void udp_open(void);
20 0d69fadb laforge
extern int udp_refill_ep(int ep);
21 fa5c8c7c (no author)
extern void udp_unthrottle(void);
22 43d61cf0 (no author)
extern void udp_reset(void);
23
24 d1dd3611 laforge
extern void udp_pullup_off(void);
25
extern void udp_pullup_on(void);
26
27 43d61cf0 (no author)
struct ep_ctx {
28
	atomic_t pkts_in_transit;
29 514b0f72 laforge
	struct {
30
		struct req_ctx *rctx;
31
		unsigned int bytes_sent;
32
	} incomplete;
33 43d61cf0 (no author)
};
34
35
struct udp_pcd {
36
	AT91PS_UDP pUdp;
37 9f45ae4e laforge
	enum usb_device_state state;
38 43d61cf0 (no author)
	unsigned char cur_config;
39 9f45ae4e laforge
	unsigned char cur_interface;
40
	unsigned char cur_altsett;
41 43d61cf0 (no author)
	unsigned int  cur_rcv_bank;
42
	struct ep_ctx ep[4];
43
};
44
45
/* USB standard request code */
46
47
#define STD_GET_STATUS_ZERO           0x0080
48
#define STD_GET_STATUS_INTERFACE      0x0081
49
#define STD_GET_STATUS_ENDPOINT       0x0082
50
51
#define STD_CLEAR_FEATURE_ZERO        0x0100
52
#define STD_CLEAR_FEATURE_INTERFACE   0x0101
53
#define STD_CLEAR_FEATURE_ENDPOINT    0x0102
54
55
#define STD_SET_FEATURE_ZERO          0x0300
56
#define STD_SET_FEATURE_INTERFACE     0x0301
57
#define STD_SET_FEATURE_ENDPOINT      0x0302
58
59
#define STD_SET_ADDRESS               0x0500
60
#define STD_GET_DESCRIPTOR            0x0680
61
#define STD_SET_DESCRIPTOR            0x0700
62
#define STD_GET_CONFIGURATION         0x0880
63
#define STD_SET_CONFIGURATION         0x0900
64
#define STD_GET_INTERFACE             0x0A81
65
#define STD_SET_INTERFACE             0x0B01
66
#define STD_SYNCH_FRAME               0x0C82
67
68
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
69
70 f57b548d (no author)
71 1bc85442 (no author)
#endif 
Add picture from clipboard (Maximum size: 48.8 MB)