/* ---------------------------------------------------------------------------- * SAM Software Package License * ---------------------------------------------------------------------------- * Copyright (c) 2011-2012, Atmel Corporation * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following condition is met: * * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the disclaimer below. * * Atmel's name may not be used to endorse or promote products derived from * this software without specific prior written permission. * * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ---------------------------------------------------------------------------- */ #ifndef USB_DEVICE_H_INCLUDED #define USB_DEVICE_H_INCLUDED #ifdef __cplusplus extern "C" { #endif #include #include "USB/samd21_device.h" // bEndpointAddress in Endpoint Descriptor #define USB_ENDPOINT_DIRECTION_MASK 0x80 #define USB_ENDPOINT_OUT(addr) ((addr) | 0x00) #define USB_ENDPOINT_IN(addr) ((addr) | 0x80) #define USB_ENDPOINT_TYPE_MASK 0x03 #define USB_ENDPOINT_TYPE_CONTROL 0x00 #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01 #define USB_ENDPOINT_TYPE_BULK 0x02 #define USB_ENDPOINT_TYPE_INTERRUPT 0x03 extern void UDD_ClearIN(void); extern uint32_t UDD_FifoByteCount(uint32_t ep); extern void UDD_ReleaseRX(uint32_t ep); extern void UDD_ReleaseTX(uint32_t ep); extern uint32_t UDD_Send(uint32_t ep, const void* data, uint32_t len); extern uint8_t UDD_Recv8(uint32_t ep); extern void UDD_Recv(uint32_t ep, uint8_t** data); extern void UDD_Init(void); extern void UDD_InitEP( uint32_t ul_ep, uint32_t ul_ep_cfg ); extern void send_zlp (void); extern void UDD_Attach(void); extern void UDD_Detach(void); extern void UDD_SetAddress(uint32_t addr); extern void UDD_Stall(uint32_t ep); extern uint32_t UDD_GetFrameNumber(void); #ifdef __cplusplus } #endif #endif /* USB_DEVICE_H_INCLUDED */