blob: 76f6c403387ce9a8f1b463b2dc8b3ee447f42322 [file] [log] [blame]
Christina Quastb123d742014-12-23 13:03:36 +01001/* ----------------------------------------------------------------------------
2 * ATMEL Microcontroller Software Support
3 * ----------------------------------------------------------------------------
4 * Copyright (c) 2009, Atmel Corporation
5 *
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * - Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the disclaimer below.
13 *
14 * Atmel's name may not be used to endorse or promote products derived from
15 * this software without specific prior written permission.
16 *
17 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
20 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * ----------------------------------------------------------------------------
28 */
29
30#ifndef USBD_HAL_H
31#define USBD_HAL_H
32
33/**
34 * \file
35 *
36 * This file defines functions for USB Device Hardware Access Level.
37 */
38
39/** \addtogroup usbd_hal
40 *@{*/
41
42/*----------------------------------------------------------------------------
43 * Headers
44 *----------------------------------------------------------------------------*/
45
46/* Introduced in C99 by working group ISO/IEC JTC1/SC22/WG14. */
47#include <stdbool.h>
48#include <stdint.h>
49#include <stdio.h>
50
51#include "USBD.h"
52#include <USBDescriptors.h>
53#include <USBRequests.h>
54
55/*----------------------------------------------------------------------------
56 * Consts
57 *----------------------------------------------------------------------------*/
58
59/*----------------------------------------------------------------------------
60 * Macros
61 *----------------------------------------------------------------------------*/
62
63/** Get bitmap for an endpoint */
64#define bmEP(bEP) (1 << (bEP))
65
66/*----------------------------------------------------------------------------
67 * Types
68 *----------------------------------------------------------------------------*/
69
70/*----------------------------------------------------------------------------
71 * Exported functoins
72 *----------------------------------------------------------------------------*/
73
74extern void USBD_HAL_Init(void);
75extern void USBD_HAL_Connect(void);
76extern void USBD_HAL_Disconnect(void);
77
78extern void USBD_HAL_RemoteWakeUp(void);
79extern void USBD_HAL_SetConfiguration(uint8_t cfgnum);
80extern void USBD_HAL_SetAddress(uint8_t address);
81extern uint8_t USBD_HAL_IsHighSpeed(void);
82
83extern void USBD_HAL_Suspend(void);
84extern void USBD_HAL_Activate(void);
85
86extern void USBD_HAL_ResetEPs(uint32_t bmEPs,uint8_t bStatus, uint8_t bKeepCfg);
87extern void USBD_HAL_CancelIo(uint32_t bmEPs);
88extern uint8_t USBD_HAL_ConfigureEP(const USBEndpointDescriptor * pDescriptor);
89
90extern uint8_t USBD_HAL_SetTransferCallback(uint8_t bEP,
91 TransferCallback fCallback,
92 void * pCbData);
93extern uint8_t USBD_HAL_SetupMblTransfer(uint8_t bEndpoint,
94 USBDTransferBuffer * pMbList,
95 uint16_t mblSize,
96 uint16_t startOffset);
97extern uint8_t USBD_HAL_Write(uint8_t bEndpoint,
98 const void * pData,
99 uint32_t dLength);
100extern uint8_t USBD_HAL_Read(uint8_t bEndpoint,
101 void * pData,
102 uint32_t dLength);
103extern uint8_t USBD_HAL_Stall(uint8_t bEP);
104extern uint8_t USBD_HAL_Halt(uint8_t bEndpoint,uint8_t ctl);
105/**@}*/
106
107#endif // #define USBD_HAL_H