32 lines
1.2 KiB
C
32 lines
1.2 KiB
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
#define MAX_ENDPOINTS 7
|
|
|
|
int avr_usb_device_configure_pll(void);
|
|
|
|
static inline void avr_usb_device_enable_padreg(void) { UHWCON |= _BV(UVREGE); };
|
|
static inline void avr_usb_device_disable_padreg(void) { UHWCON &= ~_BV(UVREGE); };
|
|
|
|
static inline void avr_usb_device_enable_macro(void) { USBCON |= _BV(USBE); };
|
|
static inline void avr_usb_device_disable_macro(void) { USBCON &= ~_BV(USBE); };
|
|
|
|
static inline void avr_usb_device_enable_vbuspad(void) { USBCON |= _BV(OTGPADE); };
|
|
static inline void avr_usb_device_disable_vbuspad(void) { USBCON &= ~_BV(OTGPADE); };
|
|
|
|
|
|
static inline void avr_usb_device_freeze_clock(void) { USBCON |= _BV(FRZCLK); };
|
|
static inline void avr_usb_device_unfreeze_clock(void) { USBCON &= ~_BV(FRZCLK); };
|
|
|
|
|
|
/*** AT90USBXXXX Errata: Wrong VBUSTI & IDTI handling, must not be used as IRQ source! ***/
|
|
static inline void avr_usb_device_enable_vbusti(void) { }; // USBCON |= _BV(VBUSTE); };
|
|
static inline void avr_usb_device_disable_vbusti(void) { }; // USBCON &= ~_BV(VBUSTE); };
|
|
|
|
void avr_usb_device_vbusti(void);
|
|
|
|
static inline uint8_t avr_usb_device_bus_is_connected(void) { return (USBSTA & _BV(VBUS)) ? -1 : 0; };
|
|
|
|
|