[224] | 1 | /*
|
---|
| 2 | Copyright (c) 2014 Arduino LLC. All right reserved.
|
---|
[136] | 3 |
|
---|
[224] | 4 | This library is free software; you can redistribute it and/or
|
---|
| 5 | modify it under the terms of the GNU Lesser General Public
|
---|
| 6 | License as published by the Free Software Foundation; either
|
---|
| 7 | version 2.1 of the License, or (at your option) any later version.
|
---|
| 8 |
|
---|
| 9 | This library is distributed in the hope that it will be useful,
|
---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 12 | See the GNU Lesser General Public License for more details.
|
---|
| 13 |
|
---|
| 14 | You should have received a copy of the GNU Lesser General Public
|
---|
| 15 | License along with this library; if not, write to the Free Software
|
---|
| 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
---|
| 17 | */
|
---|
| 18 | /*
|
---|
| 19 | **Modified 04/04/2016 by Arduino.org development team
|
---|
| 20 | */
|
---|
| 21 |
|
---|
[136] | 22 | #ifndef USB_HOST_H_INCLUDED
|
---|
| 23 | #define USB_HOST_H_INCLUDED
|
---|
| 24 |
|
---|
| 25 | #include <stdint.h>
|
---|
[224] | 26 | #include "samd21_host.h"
|
---|
[136] | 27 | #ifdef __cplusplus
|
---|
| 28 | extern "C" {
|
---|
| 29 | #endif
|
---|
| 30 |
|
---|
[224] | 31 | #define tokSETUP USB_HOST_PCFG_PTOKEN_SETUP
|
---|
| 32 | #define tokIN USB_HOST_PCFG_PTOKEN_IN
|
---|
| 33 | #define tokOUT USB_HOST_PCFG_PTOKEN_OUT
|
---|
| 34 | #define tokINHS USB_HOST_PCFG_PTOKEN_IN
|
---|
| 35 | #define tokOUTHS USB_HOST_PCFG_PTOKEN_OUT
|
---|
[136] | 36 |
|
---|
| 37 | //! \brief Device speed
|
---|
| 38 | /*typedef enum {
|
---|
| 39 | UHD_SPEED_LOW = 0,
|
---|
| 40 | UHD_SPEED_FULL = 1,
|
---|
| 41 | UHD_SPEED_HIGH = 2,
|
---|
| 42 | } uhd_speed_t;*/
|
---|
| 43 |
|
---|
| 44 | //! States of USBB interface
|
---|
| 45 | typedef enum {
|
---|
| 46 | UHD_STATE_NO_VBUS = 0,
|
---|
| 47 | UHD_STATE_DISCONNECTED = 1,
|
---|
| 48 | UHD_STATE_CONNECTED = 2,
|
---|
| 49 | UHD_STATE_ERROR = 3,
|
---|
| 50 | } uhd_vbus_state_t;
|
---|
| 51 |
|
---|
| 52 | extern void UHD_Init(void);
|
---|
[224] | 53 | extern void UHD_Handler(void);
|
---|
| 54 | extern void USB_SetHandler(void (*pf_isr)(void));
|
---|
[136] | 55 | extern uhd_vbus_state_t UHD_GetVBUSState(void);
|
---|
| 56 | extern uint32_t UHD_Pipe0_Alloc(uint32_t ul_add, uint32_t ul_ep_size);
|
---|
| 57 | 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);
|
---|
[224] | 58 | extern void UHD_Pipe_CountZero(uint32_t ul_pipe);
|
---|
[136] | 59 | extern void UHD_Pipe_Free(uint32_t ul_pipe);
|
---|
| 60 | extern uint32_t UHD_Pipe_Read(uint32_t ul_pipe, uint32_t ul_size, uint8_t* data);
|
---|
| 61 | extern void UHD_Pipe_Write(uint32_t ul_pipe, uint32_t ul_size, uint8_t* data);
|
---|
| 62 | extern void UHD_Pipe_Send(uint32_t ul_pipe, uint32_t ul_token_type);
|
---|
| 63 | extern uint32_t UHD_Pipe_Is_Transfer_Complete(uint32_t ul_pipe, uint32_t ul_token_type);
|
---|
| 64 |
|
---|
| 65 | #ifdef __cplusplus
|
---|
| 66 | }
|
---|
| 67 | #endif
|
---|
| 68 |
|
---|
| 69 | #endif /* USB_HOST_H_INCLUDED */
|
---|