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