1 /* vim: set sts=4:sw=4:ts=4:noexpandtab
4 Copyright 2012 Torbjorn Tyridal <ttyridal@gmail.com>
6 This file is part of simavr.
8 simavr is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 simavr is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with simavr. If not, see <http://www.gnu.org/licenses/>.
32 // add port number to get the real IRQ
33 #define AVR_IOCTL_USB_WRITE AVR_IOCTL_DEF('u','s','b','w')
34 #define AVR_IOCTL_USB_READ AVR_IOCTL_DEF('u','s','b','r')
35 #define AVR_IOCTL_USB_SETUP AVR_IOCTL_DEF('u','s','b','s')
36 #define AVR_IOCTL_USB_RESET AVR_IOCTL_DEF('u','s','b','R')
37 #define AVR_IOCTL_USB_VBUS AVR_IOCTL_DEF('u','s','b','V')
38 #define AVR_IOCTL_USB_GETIRQ() AVR_IOCTL_DEF('u','s','b',' ')
43 uint8_t * buf; //[in/out]
45 #define AVR_IOCTL_USB_NAK -2
46 #define AVR_IOCTL_USB_STALL -3
47 #define AVR_IOCTL_USB_OK 0
49 typedef struct avr_usb_t {
52 avr_regbit_t disabled; // bit in the PRR
53 avr_regbit_t usbrf; // bit in the MCUSR
54 avr_io_addr_t r_usbcon; // every usb reg is an offset of this.
55 avr_io_addr_t r_pllcsr;
61 struct usb_internal_state * state;
64 void avr_usb_init(avr_t * avr, avr_usb_t * port);
66 #endif /* AVR_USB_H_ */