diff options
author | Harald Welte <laforge@gnumonks.org> | 2018-05-16 09:22:31 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-05-16 19:39:37 +0200 |
commit | c853db4ca17d1ed3633e776ffe64d51cb902c235 (patch) | |
tree | d36c1a615ed0aa35f23d5f7c2c9b79e96ffa5545 /sam/applications/sam_e1/sam4sd32c_sam4s_xplained_pro/conf_usb.h | |
parent | 3634cc8e5d3124e3cf6cf46c0f1d5385ff511426 (diff) |
initial "sam_e1" application for an USB E1 adapter
Diffstat (limited to 'sam/applications/sam_e1/sam4sd32c_sam4s_xplained_pro/conf_usb.h')
-rw-r--r-- | sam/applications/sam_e1/sam4sd32c_sam4s_xplained_pro/conf_usb.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/sam/applications/sam_e1/sam4sd32c_sam4s_xplained_pro/conf_usb.h b/sam/applications/sam_e1/sam4sd32c_sam4s_xplained_pro/conf_usb.h new file mode 100644 index 00000000..d2efa366 --- /dev/null +++ b/sam/applications/sam_e1/sam4sd32c_sam4s_xplained_pro/conf_usb.h @@ -0,0 +1,114 @@ +#ifndef _CONF_USB_H_ +#define _CONF_USB_H_ + +#include "compiler.h" + +#define USB_DEVICE_EP_CTRL_SIZE 8 +#define USB_DEVICE_NB_INTERFACE 3 +#define USB_DEVICE_MAX_EP 7 + + +#define UDI_CDC_DATA_EP_IN_0 (1 | USB_EP_DIR_IN) +#define UDI_CDC_DATA_EP_OUT_0 (2 | USB_EP_DIR_OUT) +#define UDI_CDC_COMM_EP_0 (3 | USB_EP_DIR_IN) + +#define UDI_VENDOR_EP_ISO_IN (4 | USB_EP_DIR_IN) +#define UDI_VENDOR_EP_ISO_OUT (5 | USB_EP_DIR_OUT) +//#define UDI_VENDOR_EP_ISO_IN_FB (6 | USB_EP_DIR_OUT) + +#define UDI_COMPOSITE_DESC_T \ + udi_cdc_comm_desc_t udi_cdc_comm; \ + udi_cdc_data_desc_t udi_cdc_data; \ + udi_vendor_desc_t udi_vendor; + + +#define UDI_COMPOSITE_DESC_FS \ + .udi_cdc_comm = UDI_CDC_COMM_DESC_0, \ + .udi_cdc_data = UDI_CDC_DATA_DESC_0_FS, \ + .udi_vendor = UDI_VENDOR_DESC_FS, + +#define UDI_COMPOSITE_API \ + &udi_api_cdc_comm, \ + &udi_api_cdc_data, \ + &udi_api_vendor, + + + +/* USB Device Configuration */ + +//! Device definition (mandatory) +#define USB_DEVICE_VENDOR_ID USB_VID_ATMEL +#define USB_DEVICE_PRODUCT_ID USB_PID_ATMEL_ASF_MSC +#define USB_DEVICE_MAJOR_VERSION 1 +#define USB_DEVICE_MINOR_VERSION 0 +#define USB_DEVICE_POWER 200 // Consumption on Vbus line (mA) +#define USB_DEVICE_ATTR \ + (USB_CONFIG_ATTR_BUS_POWERED) + +//! USB Device string definitions (Optional) +#define USB_DEVICE_MANUFACTURE_NAME "sysmocom - s.f.m.c. GmbH" +#define USB_DEVICE_PRODUCT_NAME "osmo-e1-interface" +#define USB_DEVICE_SERIAL_NAME "2342" + +/* USB Device Callbacks definitions (Optional) */ +#define UDC_VBUS_EVENT(b_vbus_high) +#define UDC_SOF_EVENT() +#define UDC_SUSPEND_EVENT() +#define UDC_RESUME_EVENT() +//! When a extra string descriptor must be supported +//! other than manufacturer, product and serial string +// #define UDC_GET_EXTRA_STRING() + + + + + +/* USB Interface Configuration (CDC) */ + +#define UDI_CDC_PORT_NB 1 +#define UDI_CDC_ENABLE_EXT(port) main_cdc_enable(port) +#define UDI_CDC_DISABLE_EXT(port) main_cdc_disable(port) +#define UDI_CDC_RX_NOTIFY(port) main_cdc_rx_notify(port) +#define UDI_CDC_TX_EMPTY_NOTIFY(port) +#define UDI_CDC_SET_CODING_EXT(port,cfg) +#define UDI_CDC_SET_DTR_EXT(port,set) main_cdc_set_dtr(port,set) +#define UDI_CDC_SET_RTS_EXT(port,set) + +#define UDI_CDC_DEFAULT_RATE 115200 +#define UDI_CDC_DEFAULT_STOPBITS 1 +#define UDI_CDC_DEFAULT_PARITY CDC_PAR_NONE +#define UDI_CDC_DEFAULT_DATABITS 8 + +//#define UDI_CDC_IAD_STRING_ID 4 + +#define UDI_CDC_COMM_IFACE_NUMBER_0 0 +#define UDI_CDC_DATA_IFACE_NUMBER_0 1 + + + + + +/* USB Interface Configuration (Vendor) */ + +#define UDI_VENDOR_ENABLE_EXT() usb_vendor_e1_enable() +#define UDI_VENDOR_DISABLE_EXT() usb_vendor_e1_disable() +#define UDI_VENDOR_SETUP_IN_RECEIVED() false +#define UDI_VENDOR_SETUP_OUT_RECEIVED() false + + +#define UDI_VENDOR_EPS_SIZE_ISO_FS 256 +#define UDI_VENDOR_EPS_SIZE_INT_FS 0 +#define UDI_VENDOR_EPS_SIZE_BULK_FS 0 +#define UDI_VENDOR_IFACE_NUMBER 2 + + +/* USB Device Driver Configuration */ + + +//! The includes of classes and other headers must be done at the end of this file to avoid compile error +#include "udi_cdc.h" +#include "udi_cdc.h" +#include "udi_vendor.h" +#include "main.h" + +#endif // _CONF_USB_H_ |