/**
 * \file
 *
 * \brief USB configuration file for CDC application
 *
 * Copyright (c) 2009-2018 Microchip Technology Inc. and its subsidiaries.
 *
 * \asf_license_start
 *
 * \page License
 *
 * Subject to your compliance with these terms, you may use Microchip
 * software and any derivatives exclusively with Microchip products.
 * It is your responsibility to comply with third party license terms applicable
 * to your use of third party software (including open source software) that
 * may accompany Microchip software.
 *
 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
 * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
 * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
 * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
 * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
 * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
 * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
 * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE.  TO THE FULLEST EXTENT
 * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
 * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
 *
 * \asf_license_stop
 *
 */
/*
 * Support and FAQ: visit <a href="https://www.microchip.com/support/">Microchip Support</a>
 */

#ifndef _CONF_USB_H_
#define _CONF_USB_H_

#include "compiler.h"

//#warning You must refill the following definitions with a correct values

/**
 * USB Device Configuration
 * @{
 */

//! Control endpoint size (Endpoint 0)
#define  USB_DEVICE_EP_CTRL_SIZE       64

//! Three interfaces - Audio Control, Audio Streaming, HID
#define USB_DEVICE_NB_INTERFACE			3

//! Just the one HID interface
#define CRASHDUMP_USB_DEVICE_NB_INTERFACE	1

#define USB_AUDIO_CONTROL_IFACE_NUMBER		0
#define USB_AUDIO_STREAMING_IFACE_NUMBER	1
#define UDI_HID_GENERIC_IFACE_NUMBER		2
#define UDI_HID_CRASHDUMP_IFACE_NUMBER		0

#define USB_DEVICE_MAX_EP					5 // Highest endpoint number on SAMG55 devices

//! Device definition (mandatory)
#define  USB_DEVICE_VENDOR_ID             (0x35BD) // Bigscreen, Inc. assigned by USB-IF
#define  USB_DEVICE_PRODUCT_ID            (0x0101)
#define  CRASHDUMP_USB_DEVICE_PRODUCT_ID  (0x1001) // special mode for crash dumping
#define  USB_DEVICE_MAJOR_VERSION         1
#define  USB_DEVICE_MINOR_VERSION         0
#define  USB_DEVICE_POWER                 100 // Consumption on Vbus line (mA)
#define  USB_DEVICE_ATTR                  \
	(USB_CONFIG_ATTR_SELF_POWERED)
// (USB_CONFIG_ATTR_BUS_POWERED)
// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_SELF_POWERED)
// (USB_CONFIG_ATTR_REMOTE_WAKEUP|USB_CONFIG_ATTR_BUS_POWERED)

//! USB Device string definitions (Optional)
 #define  USB_DEVICE_MANUFACTURE_NAME      "Bigscreen"
 #define  USB_DEVICE_PRODUCT_NAME          "Beyond"
// #define  USB_DEVICE_SERIAL_NAME           "12...EF"
#define USB_DEVICE_GET_SERIAL_NAME_POINTER	usb_serial_name_ptr
#define USB_DEVICE_GET_SERIAL_NAME_LENGTH	16 // Fixed length is required. Can always pad with zeroes.

/**
 * Device speeds support
 * Low speed not supported by CDC
 * @{
 */
//! To authorize the High speed
#if (UC3A3||UC3A4)
#define  USB_DEVICE_HS_SUPPORT
#endif
//@}


/**
 * USB Device Callbacks definitions (Optional)
 * @{
 */
// #define  UDC_VBUS_EVENT(b_vbus_high)      user_callback_vbus_action(b_vbus_high)
// extern void user_callback_vbus_action(bool b_vbus_high);
// #define  UDC_SOF_EVENT()                  user_callback_sof_action()
// extern void user_callback_sof_action(void);
// #define  UDC_SUSPEND_EVENT()              user_callback_suspend_action()
// extern void user_callback_suspend_action(void);
// #define  UDC_RESUME_EVENT()               user_callback_resume_action()
// extern void user_callback_resume_action(void);
// Mandatory when USB_DEVICE_ATTR authorizes remote wakeup feature
// #define  UDC_REMOTEWAKEUP_ENABLE()        user_callback_remotewakeup_enable()
// extern void user_callback_remotewakeup_enable(void);
// #define  UDC_REMOTEWAKEUP_DISABLE()       user_callback_remotewakeup_disable()
// extern void user_callback_remotewakeup_disable(void);
// When a extra string descriptor must be supported
// other than manufacturer, product and serial string
// #define  UDC_GET_EXTRA_STRING()
//@}

//@}


/**
 * USB Interface Configuration
 * @{
 */


/**
 * USB Device Driver Configuration
 * @{
 */
//@}
#include "udi_audio.h"
#include "udi_hid.h"
#include "udi_hid_generic.h"
//! USB Interfaces descriptor structure
#define UDI_COMPOSITE_DESC_T \
	usb_iad_desc_t udi_audio_iad; \
	udi_audio_control_desc_t udi_audio_control; \
	udi_audio_streaming_desc_t udi_audio_streaming; \
	udi_hid_desc_t udi_hid
	
//! USB Interfaces for Full Speed
#define UDI_COMPOSITE_DESC_FS \
	.udi_audio_iad			= UDI_AUDIO_IAD_DESC, \
	.udi_audio_control		= UDI_AUDIO_CONTROL_DESC, \
	.udi_audio_streaming	= UDI_AUDIO_STREAMING_DESC, \
	.udi_hid				= UDI_HID_DESC
	
//! USB Interface APIs
#define UDI_COMPOSITE_API \
	&udi_api_audio_control, \
	&udi_api_audio_streaming, \
	&udi_api_hid

//! The includes of classes and other headers must be done at the end of this file to avoid compile error

#include "udi_audio_conf.h"
#include "udi_hid_generic_conf.h"
#include "main.h"

#endif // _CONF_USB_H_
