SAMV71 Xplained Ultra Software Package 1.4

USBD_HAL.h

Go to the documentation of this file.
00001 /* ----------------------------------------------------------------------------
00002  *         SAM Software Package License 
00003  * ----------------------------------------------------------------------------
00004  * Copyright (c) 2014, Atmel Corporation
00005  *
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions are met:
00010  *
00011  * - Redistributions of source code must retain the above copyright notice,
00012  * this list of conditions and the disclaimer below.
00013  *
00014  * Atmel's name may not be used to endorse or promote products derived from
00015  * this software without specific prior written permission.
00016  *
00017  * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00019  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
00020  * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00022  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
00023  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00024  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00025  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
00026  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  * ----------------------------------------------------------------------------
00028  */
00029 
00030 #ifndef USBD_HAL_H
00031 #define USBD_HAL_H
00032 
00033 /**
00034  *  \file
00035  *
00036  *  This file defines functions for USB Device Hardware Access Level.
00037  */
00038 
00039 /** \addtogroup usbd_hal
00040  *@{*/
00041 
00042 /*----------------------------------------------------------------------------
00043  *        Headers
00044  *----------------------------------------------------------------------------*/
00045 
00046 /* Introduced in C99 by working group ISO/IEC JTC1/SC22/WG14. */
00047 #include <stdbool.h>
00048 #include <stdint.h>
00049 #include <stdio.h>
00050 
00051 #include "USBD.h"
00052 #include <USBDescriptors.h>
00053 #include <USBRequests.h>
00054 
00055 /*----------------------------------------------------------------------------
00056  *        Macros
00057  *----------------------------------------------------------------------------*/
00058 
00059 /** Get bitmap for an endpoint */
00060 #define bmEP(bEP)   (1 << (bEP))
00061 
00062 #define EndpointInt     (USBHS_DEVISR_PEP_0 | USBHS_DEVISR_PEP_1 | USBHS_DEVISR_PEP_2 | USBHS_DEVISR_PEP_3 |\
00063                          USBHS_DEVISR_PEP_4 | USBHS_DEVISR_PEP_5 | USBHS_DEVISR_PEP_6 | USBHS_DEVISR_PEP_7 |\
00064                          USBHS_DEVISR_PEP_8 | USBHS_DEVISR_PEP_9 | USBHS_DEVISR_PEP_10 | USBHS_DEVISR_PEP_11 )
00065 
00066 #define DMAEndpointInt  (USBHS_DEVISR_DMA_1 | USBHS_DEVISR_DMA_2 | USBHS_DEVISR_DMA_3 |\
00067                          USBHS_DEVISR_DMA_4 | USBHS_DEVISR_DMA_5 | USBHS_DEVISR_DMA_6 | USBHS_DEVISR_DMA_7 )
00068 /*----------------------------------------------------------------------------
00069  *        Types
00070  *----------------------------------------------------------------------------*/
00071 
00072 /*----------------------------------------------------------------------------
00073  *        Exported functions
00074  *----------------------------------------------------------------------------*/
00075 
00076 extern void USBD_HAL_Init(void);
00077 extern void USBD_HAL_Connect(void);
00078 extern void USBD_HAL_Disconnect(void);
00079 
00080 extern void USBD_HAL_RemoteWakeUp(void);
00081 extern void USBD_HAL_SetConfiguration(uint8_t cfgnum);
00082 extern void USBD_HAL_SetAddress(uint8_t address);
00083 extern uint8_t USBD_HAL_IsHighSpeed(void);
00084 
00085 extern void USBD_HAL_Suspend(void);
00086 extern void USBD_HAL_Activate(void);
00087 
00088 extern void USBD_HAL_ResetEPs(uint32_t bmEPs,uint8_t bStatus, uint8_t bKeepCfg);
00089 extern void USBD_HAL_CancelIo(uint32_t bmEPs);
00090 extern uint8_t USBD_HAL_ConfigureEP(const USBEndpointDescriptor * pDescriptor);
00091 
00092 extern uint8_t USBD_HAL_SetTransferCallback(uint8_t bEP,
00093                                             TransferCallback fCallback,
00094                                             void * pCbData);
00095 extern uint8_t USBD_HAL_SetupMblTransfer(uint8_t bEndpoint,
00096                                          USBDTransferBuffer * pMbList,
00097                                          uint16_t mblSize,
00098                                          uint16_t startOffset);
00099 extern uint8_t USBD_HAL_Write(uint8_t bEndpoint,
00100                               const void * pData,
00101                               uint32_t dLength);
00102 extern uint8_t USBD_HAL_WrWithHdr(uint8_t bEndpoint,
00103                                   const void * pHdr, uint8_t bHdrLen,
00104                                   const void * pData, uint32_t dLength);
00105 extern uint8_t USBD_HAL_Read(uint8_t bEndpoint,
00106                              void * pData,
00107                              uint32_t dLength);
00108 extern uint8_t USBD_HAL_Stall(uint8_t bEP);
00109 extern uint8_t USBD_HAL_Halt(uint8_t bEndpoint,uint8_t ctl);
00110 extern void USBD_HAL_Test(uint8_t bIndex);
00111 
00112 void USBD_HAL_DetachUsb(void);
00113 void USBD_HAL_AttachUsb(void);
00114 void USBD_HAL_Disable(void);
00115 void USBD_HAL_Enable(void);
00116 /**@}*/
00117 
00118 #endif // #define USBD_HAL_H
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines