Root/usbboot/xburst_include/usb/udc.h

1/*
2 * Copyright (C) 2009 Qi Hardware Inc.,
3 * Author: Xiangfu Liu <xiangfu@sharism.cc>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 3 as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA
18 */
19#ifndef __UDC_H__
20#define __UDC_H__
21
22#include "usb.h"
23#define MAX_EP0_SIZE 64
24#define MAX_EP1_SIZE 512
25
26#define USB_HS 0
27#define USB_FS 1
28#define USB_LS 2
29
30//definitions of EP0
31#define USB_EP0_IDLE 0
32#define USB_EP0_RX 1
33#define USB_EP0_TX 2
34/* Define maximum packet size for endpoint 0 */
35#define M_EP0_MAXP 64
36/* Endpoint 0 status structure */
37
38
39
40static __inline__ void usb_setb(u32 port, u8 val)
41{
42    volatile u8 *ioport = (volatile u8 *)(port);
43    *ioport = (*ioport) | val;
44}
45
46static __inline__ void usb_clearb(u32 port, u8 val)
47{
48    volatile u8 *ioport = (volatile u8 *)(port);
49    *ioport = (*ioport) & ~val;
50}
51
52static __inline__ void usb_setw(u32 port, u16 val)
53{
54    volatile u16 *ioport = (volatile u16 *)(port);
55    *ioport = (*ioport) | val;
56}
57
58static __inline__ void usb_clearw(u32 port, u16 val)
59{
60    volatile u16 *ioport = (volatile u16 *)(port);
61    *ioport = (*ioport) & ~val;
62}
63
64#endif //__UDC_H__
65

Archive Download this file



interactive