sam_usb.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Koen Zandberg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
22 #ifndef SAM_USB_H
23 #define SAM_USB_H
24 
25 #include <stdint.h>
26 #include <stdlib.h>
27 #include "periph_cpu.h"
28 #include "periph/usbdev.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
37 #define SAM_USB_BUF_SPACE USBDEV_EP_BUF_SPACE
38 
42 #define SAM_USB_NUM_EP USBDEV_NUM_ENDPOINTS
43 
47 typedef struct {
50  UsbDeviceDescBank banks[2 * SAM_USB_NUM_EP];
51  usbdev_ep_t endpoints[2 * SAM_USB_NUM_EP];
52  size_t used;
54  __attribute__ ((aligned(4)))
55  uint8_t buffer[SAM_USB_BUF_SPACE];
57  bool suspended;
59 
60 #ifdef __cplusplus
61 }
62 #endif
63 #endif /* SAM_USB_H */
64 
SAM_USB_BUF_SPACE
#define SAM_USB_BUF_SPACE
USB endpoint buffer space.
Definition: sam_usb.h:37
usbdev.h
Definitions low-level USB driver interface.
usbdev
usbdev device descriptor
Definition: usbdev.h:217
sam0_common_usb_t::usbdev
usbdev_t usbdev
Inherited usbdev struct.
Definition: sam_usb.h:48
sam0_common_usb_config_t
USB peripheral parameters.
Definition: periph_cpu_common.h:774
sam0_common_usb_t
sam0 usb peripheral device context
Definition: sam_usb.h:47
usbdev_ep
usbdev endpoint descriptor
Definition: usbdev.h:229
sam0_common_usb_t::config
const sam0_common_usb_config_t * config
USB peripheral config
Definition: sam_usb.h:49
SAM_USB_NUM_EP
#define SAM_USB_NUM_EP
Number of USB IN and OUT endpoints.
Definition: sam_usb.h:42
sam0_common_usb_t::used
size_t used
Number of bytes from the buffer that are used
Definition: sam_usb.h:52