USBD_HAL.h
Go to the documentation of this file.
1 /* ---------------------------------------------------------------------------- */
2 /* Atmel Microcontroller Software Support */
3 /* SAM Software Package License */
4 /* ---------------------------------------------------------------------------- */
5 /* Copyright (c) 2015, Atmel Corporation */
6 /* */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without */
10 /* modification, are permitted provided that the following condition is met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, */
13 /* this list of conditions and the disclaimer below. */
14 /* */
15 /* Atmel's name may not be used to endorse or promote products derived from */
16 /* this software without specific prior written permission. */
17 /* */
18 /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
19 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
20 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
21 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */
22 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
23 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
24 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
25 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
26 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
27 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28 /* ---------------------------------------------------------------------------- */
29 
30 #ifndef USBD_HAL_H
31 #define USBD_HAL_H
32 
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  * Macros
57  *----------------------------------------------------------------------------*/
58 
60 #define bmEP(bEP) (1 << (bEP))
61 
62 #define EndpointInt (USBHS_DEVISR_PEP_0 | USBHS_DEVISR_PEP_1 | USBHS_DEVISR_PEP_2 | USBHS_DEVISR_PEP_3 |\
63  USBHS_DEVISR_PEP_4 | USBHS_DEVISR_PEP_5 | USBHS_DEVISR_PEP_6 | USBHS_DEVISR_PEP_7 |\
64  USBHS_DEVISR_PEP_8 | USBHS_DEVISR_PEP_9 | USBHS_DEVISR_PEP_10 | USBHS_DEVISR_PEP_11 )
65 
66 #define DMAEndpointInt (USBHS_DEVISR_DMA_1 | USBHS_DEVISR_DMA_2 | USBHS_DEVISR_DMA_3 |\
67  USBHS_DEVISR_DMA_4 | USBHS_DEVISR_DMA_5 | USBHS_DEVISR_DMA_6 | USBHS_DEVISR_DMA_7 )
68 /*----------------------------------------------------------------------------
69  * Types
70  *----------------------------------------------------------------------------*/
71 
72 /*----------------------------------------------------------------------------
73  * Exported functions
74  *----------------------------------------------------------------------------*/
75 
76 extern void USBD_HAL_Init(void);
77 extern void USBD_HAL_Connect(void);
78 extern void USBD_HAL_Disconnect(void);
79 
80 extern void USBD_HAL_RemoteWakeUp(void);
81 extern void USBD_HAL_SetConfiguration(uint8_t cfgnum);
82 extern void USBD_HAL_SetAddress(uint8_t address);
83 extern uint8_t USBD_HAL_IsHighSpeed(void);
84 
85 extern void USBD_HAL_Suspend(void);
86 extern void USBD_HAL_Activate(void);
87 extern void USBD_HAL_WaitReadData(uint8_t bEndpoint);
88 extern void USBD_HAL_ResetEPs(uint32_t bmEPs,uint8_t bStatus, uint8_t bKeepCfg);
89 extern void USBD_HAL_CancelIo(uint32_t bmEPs);
90 extern uint8_t USBD_HAL_ConfigureEP(const USBEndpointDescriptor * pDescriptor);
91 
92 extern uint8_t USBD_HAL_SetTransferCallback(uint8_t bEP,
93  TransferCallback fCallback,
94  void * pCbData);
95 extern uint8_t USBD_HAL_SetupMblTransfer(uint8_t bEndpoint,
96  USBDTransferBuffer * pMbList,
97  uint16_t mblSize,
98  uint16_t startOffset);
99 extern uint8_t USBD_HAL_Write(uint8_t bEndpoint,
100  const void * pData,
101  uint32_t dLength);
102 extern uint8_t USBD_HAL_WrWithHdr(uint8_t bEndpoint,
103  const void * pHdr, uint8_t bHdrLen,
104  const void * pData, uint32_t dLength);
105 extern uint8_t USBD_HAL_Read(uint8_t bEndpoint,
106  void * pData,
107  uint32_t dLength);
108 extern uint8_t USBD_HAL_Stall(uint8_t bEP);
109 extern uint8_t USBD_HAL_Halt(uint8_t bEndpoint,uint8_t ctl);
110 extern void USBD_HAL_Test(uint8_t bIndex);
111 
112 void USBD_HAL_DetachUsb(void);
113 void USBD_HAL_AttachUsb(void);
114 void USBD_HAL_Disable(void);
115 void USBD_HAL_Enable(void);
118 #endif // #define USBD_HAL_H
void USBD_HAL_Enable(void)
Buffer struct used for multi-buffer-listed transfer.
Definition: USBD.h:155
uint8_t USBD_HAL_Read(uint8_t bEndpoint, void *pData, uint32_t dLength)
Definition: USBD_HAL.c:1618
uint8_t USBD_HAL_Write(uint8_t bEndpoint, const void *pData, uint32_t dLength)
Definition: USBD_HAL.c:1429
void USBD_HAL_Init(void)
Definition: USBD_HAL.c:1734
void USBD_HAL_Disconnect(void)
Disable Pull-up, disconnect.
Definition: USBD_HAL.c:1684
uint8_t USBD_HAL_IsHighSpeed(void)
Definition: USBD_HAL.c:1898
void USBD_HAL_Test(uint8_t bIndex)
Definition: USBD_HAL.c:1943
void USBD_HAL_DetachUsb(void)
uint8_t USBD_HAL_ConfigureEP(const USBEndpointDescriptor *pDescriptor)
Definition: USBD_HAL.c:1188
void USBD_HAL_Connect(void)
Enable Pull-up, connect.
Definition: USBD_HAL.c:1635
uint8_t USBD_HAL_SetTransferCallback(uint8_t bEP, TransferCallback fCallback, void *pCbData)
Definition: USBD_HAL.c:1340
void USBD_HAL_RemoteWakeUp(void)
Definition: USBD_HAL.c:1694
void USBD_HAL_AttachUsb(void)
void USBD_HAL_ResetEPs(uint32_t bmEPs, uint8_t bStatus, uint8_t bKeepCfg)
Reset endpoints and disable them.Terminate transfer if there is any, with given status;Reset the endp...
Definition: USBD_HAL.c:1119
void USBD_HAL_Suspend(void)
Definition: USBD_HAL.c:1910
uint8_t USBD_HAL_SetupMblTransfer(uint8_t bEndpoint, USBDTransferBuffer *pMbList, uint16_t mblSize, uint16_t startOffset)
Definition: USBD_HAL.c:1365
void(* TransferCallback)(void *pArg, uint8_t status, uint32_t transferred, uint32_t remaining)
Definition: USBD.h:200
void USBD_HAL_WaitReadData(uint8_t bEndpoint)
Definition: USBD_HAL.c:1887
uint8_t USBD_HAL_Halt(uint8_t bEndpoint, uint8_t ctl)
Definition: USBD_HAL.c:1809
void USBD_HAL_CancelIo(uint32_t bmEPs)
Definition: USBD_HAL.c:1163
void USBD_HAL_SetAddress(uint8_t address)
Definition: USBD_HAL.c:1711
void USBD_HAL_Disable(void)
Definition: USBD_HAL.c:1927
uint8_t USBD_HAL_Stall(uint8_t bEP)
Definition: USBD_HAL.c:1779
void USBD_HAL_Activate(void)
Definition: USBD_HAL.c:1922
void USBD_HAL_SetConfiguration(uint8_t cfgnum)
Definition: USBD_HAL.c:1725
uint8_t USBD_HAL_WrWithHdr(uint8_t bEndpoint, const void *pHdr, uint8_t bHdrLen, const void *pData, uint32_t dLength)
Definition: USBD_HAL.c:1458


inertial_sense_ros
Author(s):
autogenerated on Sat Sep 19 2020 03:19:05