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/>.
36 // add port number to get the real IRQ
37 #define AVR_IOCTL_USB_WRITE AVR_IOCTL_DEF('u','s','b','w')
38 #define AVR_IOCTL_USB_READ AVR_IOCTL_DEF('u','s','b','r')
39 #define AVR_IOCTL_USB_SETUP AVR_IOCTL_DEF('u','s','b','s')
40 #define AVR_IOCTL_USB_RESET AVR_IOCTL_DEF('u','s','b','R')
41 #define AVR_IOCTL_USB_VBUS AVR_IOCTL_DEF('u','s','b','V')
42 #define AVR_IOCTL_USB_GETIRQ() AVR_IOCTL_DEF('u','s','b',' ')
47 uint8_t * buf; //[in/out]
49 #define AVR_IOCTL_USB_NAK -2
50 #define AVR_IOCTL_USB_STALL -3
51 #define AVR_IOCTL_USB_OK 0
53 typedef struct avr_usb_t {
56 avr_regbit_t disabled; // bit in the PRR
57 avr_regbit_t usbrf; // bit in the MCUSR
58 avr_io_addr_t r_usbcon; // every usb reg is an offset of this.
59 avr_io_addr_t r_pllcsr;
65 struct usb_internal_state * state;
68 void avr_usb_init(avr_t * avr, avr_usb_t * port);
74 #endif /*__AVR_USB_H__*/