1 | /* ----------------------------------------------------------------------------
|
---|
2 | * SAM Software Package License
|
---|
3 | * ----------------------------------------------------------------------------
|
---|
4 | * Copyright (c) 2011-2012, 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 condition is 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 USB_HOST_H_INCLUDED
|
---|
31 | #define USB_HOST_H_INCLUDED
|
---|
32 |
|
---|
33 | #include <stdint.h>
|
---|
34 |
|
---|
35 | #ifdef __cplusplus
|
---|
36 | extern "C" {
|
---|
37 | #endif
|
---|
38 |
|
---|
39 | #define tokSETUP UOTGHS_HSTPIPCFG_PTOKEN_SETUP
|
---|
40 | #define tokIN UOTGHS_HSTPIPCFG_PTOKEN_IN
|
---|
41 | #define tokOUT UOTGHS_HSTPIPCFG_PTOKEN_OUT
|
---|
42 | #define tokINHS UOTGHS_HSTPIPCFG_PTOKEN_IN
|
---|
43 | #define tokOUTHS UOTGHS_HSTPIPCFG_PTOKEN_OUT
|
---|
44 |
|
---|
45 | //! \brief Device speed
|
---|
46 | /*typedef enum {
|
---|
47 | UHD_SPEED_LOW = 0,
|
---|
48 | UHD_SPEED_FULL = 1,
|
---|
49 | UHD_SPEED_HIGH = 2,
|
---|
50 | } uhd_speed_t;*/
|
---|
51 |
|
---|
52 | //! States of USBB interface
|
---|
53 | typedef enum {
|
---|
54 | UHD_STATE_NO_VBUS = 0,
|
---|
55 | UHD_STATE_DISCONNECTED = 1,
|
---|
56 | UHD_STATE_CONNECTED = 2,
|
---|
57 | UHD_STATE_ERROR = 3,
|
---|
58 | } uhd_vbus_state_t;
|
---|
59 |
|
---|
60 | //extern uhd_speed_t uhd_get_speed(void);
|
---|
61 |
|
---|
62 | extern void UHD_SetStack(void (*pf_isr)(void));
|
---|
63 | extern void UHD_Init(void);
|
---|
64 | extern void UHD_BusReset(void);
|
---|
65 | extern uhd_vbus_state_t UHD_GetVBUSState(void);
|
---|
66 | extern uint32_t UHD_Pipe0_Alloc(uint32_t ul_add, uint32_t ul_ep_size);
|
---|
67 | extern uint32_t UHD_Pipe_Alloc(uint32_t ul_dev_addr, uint32_t ul_dev_ep, uint32_t ul_type, uint32_t ul_dir, uint32_t ul_maxsize, uint32_t ul_interval, uint32_t ul_nb_bank);
|
---|
68 | extern void UHD_Pipe_Free(uint32_t ul_pipe);
|
---|
69 | extern uint32_t UHD_Pipe_Read(uint32_t ul_pipe, uint32_t ul_size, uint8_t* data);
|
---|
70 | extern void UHD_Pipe_Write(uint32_t ul_pipe, uint32_t ul_size, uint8_t* data);
|
---|
71 | extern void UHD_Pipe_Send(uint32_t ul_pipe, uint32_t ul_token_type);
|
---|
72 | extern uint32_t UHD_Pipe_Is_Transfer_Complete(uint32_t ul_pipe, uint32_t ul_token_type);
|
---|
73 |
|
---|
74 | #ifdef __cplusplus
|
---|
75 | }
|
---|
76 | #endif
|
---|
77 |
|
---|
78 | #endif /* USB_HOST_H_INCLUDED */
|
---|