未验证 提交 9a8249bb 编写于 作者: R Rbb666 提交者: GitHub

【BSP】CY8CKIT-062S2-43012 (#6237)

英飞凌 CY8CKIT-062S2-43012 BSP
上级 38154c46
......@@ -37,6 +37,7 @@ jobs:
- {RTT_BSP: "at91/at91sam9g45", RTT_TOOL_CHAIN: "sourcery-arm"}
- {RTT_BSP: "at91/at91sam9260", RTT_TOOL_CHAIN: "sourcery-arm"}
- {RTT_BSP: "allwinner_tina", RTT_TOOL_CHAIN: "sourcery-arm"}
- {RTT_BSP: "cypress/psoc6-cy8cproto-4343w", RTT_TOOL_CHAIN: "sourcery-arm"}
- {RTT_BSP: "ft32/ft32f072xb-starter", RTT_TOOL_CHAIN: "sourcery-arm"}
- {RTT_BSP: "gd32/arm/gd32103c-eval", RTT_TOOL_CHAIN: "sourcery-arm"}
- {RTT_BSP: "gd32/arm/gd32105c-eval", RTT_TOOL_CHAIN: "sourcery-arm"}
......
......@@ -38,6 +38,9 @@ if GetDepend(['BSP_USING_SPI']):
if GetDepend(['BSP_USING_ADC']):
src += ['drv_adc.c']
if GetDepend(['BSP_USING_USBD']):
src += ['drv_usbd.c']
if GetDepend('BSP_USING_RTC'):
src += ['drv_rtc.c']
......@@ -46,6 +49,9 @@ if GetDepend('BSP_USING_ON_CHIP_FLASH'):
if GetDepend(['RT_USING_WDT']):
src += ['drv_wdt.c']
if GetDepend(['RT_USING_DAC']):
src += ['drv_dac.c']
if GetDepend(['BSP_USING_TIM']):
src += ['drv_hwtimer.c']
......
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-07-28 rtthread qiu first version
*/
#include "drv_dac.h"
#include "drv_common.h"
#include <rtthread.h>
#if defined(BSP_USING_DAC1) || defined(BSP_USING_DAC2)
#define LOG_TAG "drv.dac"
#include <drv_log.h>
struct cyp_dac
{
cy_stc_csdidac_config_t cyhal_dac_device;
struct rt_dac_device cyp_dac_device;
char *name;
};
static struct cyp_dac dac_config[] =
{
#ifdef BSP_USING_DAC1
DAC1_CONFIG,
#endif
#ifdef BSP_USING_DAC2
DAC2_CONFIG,
#endif
};
/*get dac channel*/
static rt_uint32_t cyp_dac_get_channel(rt_uint32_t channel)
{
rt_uint32_t cyp_dac_channel = 0;
switch (channel)
{
case 1:
cyp_dac_channel = CY_CSDIDAC_A;
break;
case 2:
cyp_dac_channel = CY_CSDIDAC_B;
break;
default:
RT_ASSERT(0);
break;
}
return cyp_dac_channel;
}
struct cyp_dac cyp_adc_obj[sizeof(dac_config) / sizeof(dac_config[0])];
cy_stc_csdidac_context_t csdidac_context;
/*dac device enable*/
static rt_err_t cyp_dac_enabled(struct rt_dac_device *device, rt_uint32_t channel)
{
cy_rslt_t result;
rt_uint32_t cyp_channel;
RT_ASSERT(device != RT_NULL);
cyhal_dac_t *dac_device;
dac_device = device->parent.user_data;
/* get current dac channel*/
cyp_channel = cyp_dac_get_channel(channel);
/*DAC device init*/
result = Cy_CSDIDAC_Init(&CSDIDAC_csdidac_config, &csdidac_context);
if (result != RT_EOK)
{
LOG_E("Cy_CSDIDAC_Init fail = %d\n", result);
return -RT_ENOSYS;
}
return RT_EOK;
}
/*dac device disable*/
static rt_err_t cyp_dac_disable(struct rt_dac_device *device, rt_uint32_t channel)
{
rt_uint32_t cyp_channel;
cy_rslt_t result;
RT_ASSERT(device != RT_NULL);
cyhal_dac_t *dac_device;
dac_device = device->parent.user_data;
cyp_channel = cyp_dac_get_channel(channel);
/*DAC free device*/
result = Cy_CSDIDAC_OutputDisable(cyp_channel, &csdidac_context);
if (result != RT_EOK)
{
LOG_E("DAC Outputdisable failed. Error: %d\n", result);
return -RT_ENOSYS;
}
return RT_EOK;
}
/*set dac output value*/
static rt_err_t cyp_adc_convert(struct rt_dac_device *device, rt_uint32_t channel, rt_uint32_t *value)
{
RT_ASSERT(device != RT_NULL);
cy_rslt_t result;
rt_uint32_t cyp_channel;
cyp_channel = cyp_dac_get_channel(channel);
result = Cy_CSDIDAC_OutputEnable(cyp_channel, *value, &csdidac_context);
if (result != RT_EOK)
{
LOG_E("DAC channel initialization failed. Error: %d\n", result);
return -RT_ENOSYS;
}
return RT_EOK;
}
static const struct rt_dac_ops cyp_dac_ops =
{
.disabled = cyp_dac_disable,
.enabled = cyp_dac_enabled,
.convert = cyp_adc_convert,
};
/*dac device init*/
static int rt_hw_dac_init(void)
{
int result = RT_EOK;
/* save dac name */
char name_buf[5] = {'d', 'a', 'c', '0', 0};
int i = 0;
i = sizeof(dac_config) / sizeof(dac_config[0]);
for (i = 0; i < sizeof(dac_config) / sizeof(dac_config[0]); i++)
{
#ifdef BSP_USING_DAC1
name_buf[3] = '1';
#endif
#ifdef BSP_USING_DAC2
name_buf[3] = '2';
#endif
/* register DAC device */
if (rt_hw_dac_register(&cyp_adc_obj[i].cyp_dac_device, name_buf, &cyp_dac_ops, RT_NULL) == RT_EOK)
{
LOG_E("dac device register success\n");
}
else
{
LOG_E("dac device register fail\n");
result = -RT_ERROR;
}
}
return result;
}
INIT_BOARD_EXPORT(rt_hw_dac_init);
#endif /* BSP_USING_DAC1 /BSP_USING_DAC2 */
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-07-28 rtthread qiu first version
*/
#ifndef __DRV__DAC_H__
#define __DRV__DAC_H__
#include "rtconfig.h"
#include "cycfg.h"
#include <rtthread.h>
#include "cy_csdidac.h"
#include "cycfg_peripherals.h"
static const cy_stc_csdidac_pin_t CSDIDAC_csdidac_a_pin =
{
.ioPcPtr = GPIO_PRT10,
.pin = 0u,
};
static const cy_stc_csdidac_pin_t CSDIDAC_csdidac_b_pin =
{
.ioPcPtr = GPIO_PRT10,
.pin = 0u,
};
const cy_stc_csdidac_config_t CSDIDAC_csdidac_config =
{
.base = CSD0,
.csdCxtPtr = &cy_csd_0_context,
.configA = CY_CSDIDAC_GPIO,
.configB = CY_CSDIDAC_GPIO,
.ptrPinA = (const cy_stc_csdidac_pin_t *)&CSDIDAC_csdidac_a_pin,
.ptrPinB = (const cy_stc_csdidac_pin_t *)&CSDIDAC_csdidac_b_pin,
.cpuClk = 100000000u,
.csdInitTime = 25u,
};
#ifdef BSP_USING_DAC1
#ifndef DAC1_CONFIG
#define DAC1_CONFIG \
{ \
.name = "dac1", \
}
#endif /* DAC1_CONFIG */
#endif /*BSP_USING_DAC2*/
#ifdef BSP_USING_DAC2
#ifndef DAC2_CONFIG
#define DAC2_CONFIG \
{ \
.name = "dac2", \
}
#endif /* DAC2_CONFIG */
#endif /*BSP_USING_DAC2*/
#endif /*__DRV__DAC_H__*/
......@@ -15,8 +15,6 @@
#include <rtdevice.h>
#include "drv_common.h"
#include "cy_retarget_io.h"
#include "cyhal_gpio.h"
#include "cyhal_irq_psoc.h"
#define GPIO_INTERRUPT_PRIORITY (7u)
......
......@@ -12,51 +12,50 @@
#include "drv_uart.h"
#include "uart_config.h"
#include "cy_retarget_io.h"
#include "cyhal_scb_common.h"
enum
{
#ifdef BSP_USING_UART0
#ifdef BSP_USING_UART0
UART0_INDEX,
#endif
#ifdef BSP_USING_UART1
#endif
#ifdef BSP_USING_UART1
UART1_INDEX,
#endif
#ifdef BSP_USING_UART2
#endif
#ifdef BSP_USING_UART2
UART2_INDEX,
#endif
#ifdef BSP_USING_UART3
#endif
#ifdef BSP_USING_UART3
UART3_INDEX,
#endif
#ifdef BSP_USING_UART4
#endif
#ifdef BSP_USING_UART4
UART4_INDEX,
#endif
#ifdef BSP_USING_UART5
#endif
#ifdef BSP_USING_UART5
UART5_INDEX,
#endif
#endif
};
static struct ifx_uart_config uart_config[] =
{
#ifdef BSP_USING_UART0
#ifdef BSP_USING_UART0
UART0_CONFIG,
#endif
#ifdef BSP_USING_UART1
#endif
#ifdef BSP_USING_UART1
UART1_CONFIG,
#endif
#ifdef BSP_USING_UART2
#endif
#ifdef BSP_USING_UART2
UART2_CONFIG,
#endif
#ifdef BSP_USING_UART3
#endif
#ifdef BSP_USING_UART3
UART3_CONFIG,
#endif
#ifdef BSP_USING_UART4
#endif
#ifdef BSP_USING_UART4
UART4_CONFIG,
#endif
#ifdef BSP_USING_UART5
#endif
#ifdef BSP_USING_UART5
UART5_CONFIG,
#endif
#endif
};
static struct ifx_uart uart_obj[sizeof(uart_config) / sizeof(uart_config[0])] = {0};
......@@ -196,20 +195,20 @@ static rt_err_t ifx_control(struct rt_serial_device *serial, int cmd, void *arg)
switch (cmd)
{
case RT_DEVICE_CTRL_CLR_INT:
case RT_DEVICE_CTRL_CLR_INT:
break;
break;
case RT_DEVICE_CTRL_SET_INT:
/* Unmasking only the RX fifo not empty interrupt bit */
uart->config->usart_x->INTR_RX_MASK = SCB_INTR_RX_MASK_NOT_EMPTY_Msk;
case RT_DEVICE_CTRL_SET_INT:
/* Unmasking only the RX fifo not empty interrupt bit */
uart->config->usart_x->INTR_RX_MASK = SCB_INTR_RX_MASK_NOT_EMPTY_Msk;
/* Interrupt Settings for UART */
Cy_SysInt_Init(uart->config->UART_SCB_IRQ_cfg, uart->config->userIsr);
/* Interrupt Settings for UART */
Cy_SysInt_Init(uart->config->UART_SCB_IRQ_cfg, uart->config->userIsr);
/* Enable the interrupt */
NVIC_EnableIRQ(uart->config->intrSrc);
break;
/* Enable the interrupt */
NVIC_EnableIRQ(uart->config->intrSrc);
break;
}
return (RT_EOK);
......
......@@ -15,7 +15,6 @@
#include <rtdevice.h>
#include "board.h"
#include "cycfg_peripherals.h"
#define uart_isr_callback(name) name##_isr_callback
......
......@@ -20,7 +20,7 @@ extern "C" {
#ifdef BSP_USING_UART0
/* UART0 device driver structure */
cy_stc_sysint_t UART2_SCB_IRQ_cfg =
cy_stc_sysint_t UART0_SCB_IRQ_cfg =
{
.intrSrc = (IRQn_Type) scb_0_interrupt_IRQn,
.intrPriority = (7u),
......
......@@ -19,8 +19,7 @@ src = Split('''
mtb-hal-cat1/source/cyhal_utils_psoc.c
mtb-hal-cat1/source/cyhal_utils.c
mtb-hal-cat1/source/cyhal_lptimer.c
mtb-hal-cat1/source/cyhal_irq_psoc.c
mtb-hal-cat1/include_pvt/cyhal_hw_types.h
mtb-hal-cat1/source/cyhal_irq_psoc.c
mtb-hal-cat1/COMPONENT_CAT1A/source/triggers/cyhal_triggers_psoc6_02.c
mtb-hal-cat1/COMPONENT_CAT1A/source/pin_packages/cyhal_psoc6_02_124_bga.c
mtb-pdl-cat1/devices/COMPONENT_CAT1A/source/cy_device.c
......@@ -37,8 +36,7 @@ src = Split('''
mtb-pdl-cat1/drivers/source/cy_ipc_sema.c
mtb-pdl-cat1/drivers/source/cy_ipc_drv.c
mtb-pdl-cat1/drivers/source/cy_trigmux.c
mtb-pdl-cat1/drivers/source/cy_prot.c
mtb-pdl-cat1/drivers/source/TOOLCHAIN_ARM/cy_syslib_mdk.s
mtb-pdl-cat1/drivers/source/cy_prot.c
TARGET_CY8CKIT-062S2-43012/cybsp.c
TARGET_CY8CKIT-062S2-43012/COMPONENT_CM4/system_psoc6_cm4.c
TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg.c
......@@ -95,6 +93,16 @@ if GetDepend(['RT_USING_SPI']):
if GetDepend(['RT_USING_I2C']):
src += ['mtb-hal-cat1/source/cyhal_i2c.c']
if GetDepend('BSP_USING_USBD'):
src += ['mtb_shared/usbdev/cy_usb_dev.c']
src += ['mtb_shared/usbdev/cy_usb_dev_hid.c']
src += ['mtb-hal-cat1/source/cyhal_usb_dev.c']
src += ['mtb-pdl-cat1/drivers/source/cy_dma.c']
src += ['mtb-pdl-cat1/drivers/source/cy_usbfs_dev_drv.c']
src += ['mtb-pdl-cat1/drivers/source/cy_usbfs_dev_drv_io.c']
src += ['mtb-pdl-cat1/drivers/source/cy_usbfs_dev_drv_io_dma.c']
src += ['TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource/cycfg_usbdev.c']
if GetDepend('BSP_USING_RTC'):
src += ['mtb-pdl-cat1/drivers/source/cy_rtc.c']
src += ['mtb-hal-cat1/source/cyhal_rtc.c']
......@@ -121,6 +129,9 @@ if GetDepend(['RT_USING_WDT']):
src += ['mtb-pdl-cat1/drivers/source/cy_wdt.c']
src += ['mtb-hal-cat1/source/cyhal_wdt.c']
if GetDepend(['RT_USING_DAC']):
src += ['mtb_shared/csdidac/cy_csdidac.c']
if GetDepend(['RT_USING_HWTIMER']):
src += ['mtb-hal-cat1/source/cyhal_timer.c']
......@@ -129,13 +140,14 @@ path = [cwd + '/capsense',
cwd + '/retarget-io',
cwd + '/core-lib/include',
cwd + '/mtb_shared/serial-flash',
cwd + '/mtb-hal-cat1/include',
cwd + '/mtb-hal-cat1/include_pvt',
cwd + '/mtb_shared/usbdev',
cwd + '/mtb_shared/csdidac',
cwd + '/mtb-pdl-cat1/cmsis/include',
cwd + '/mtb-pdl-cat1/drivers/include',
cwd + '/mtb-hal-cat1/COMPONENT_CAT1A/include',
cwd + '/mtb-pdl-cat1/devices/COMPONENT_CAT1A/include',
cwd + '/mtb-pdl-cat1/devices/COMPONENT_CAT1B/include',
cwd + '/mtb-hal-cat1/include_pvt',
cwd + '/mtb-hal-cat1/include',
cwd + '/mtb-hal-cat1/COMPONENT_CAT1A/include',
cwd + '/TARGET_CY8CKIT-062S2-43012',
cwd + '/TARGET_CY8CKIT-062S2-43012/COMPONENT_BSP_DESIGN_MODUS/GeneratedSource']
......
......@@ -38,7 +38,7 @@ extern "C"
{
#endif
CySCB_Type* const _CYHAL_SCB_BASE_ADDRESSES[_SCB_ARRAY_SIZE] =
CySCB_Type *const _CYHAL_SCB_BASE_ADDRESSES[_SCB_ARRAY_SIZE] =
{
#ifdef SCB0
SCB0,
......@@ -149,73 +149,93 @@ const _cyhal_system_irq_t _CYHAL_SCB_IRQ_N[_SCB_ARRAY_SIZE] =
/** The configuration structs for the resource in use on each SCB block */
static void *_cyhal_scb_config_structs[_SCB_ARRAY_SIZE];
/** The callback to use for each scb instance */
static bool (*_cyhal_scb_config_pm_callback[_SCB_ARRAY_SIZE]) (void *obj_ptr, cyhal_syspm_callback_state_t state, cy_en_syspm_callback_mode_t pdl_mode);
static bool (*_cyhal_scb_config_pm_callback[_SCB_ARRAY_SIZE])(void *obj_ptr, cyhal_syspm_callback_state_t state, cy_en_syspm_callback_mode_t pdl_mode);
static uint8_t _cyhal_scb_get_block_from_irqn(_cyhal_system_irq_t irqn)
{
switch (irqn)
{
#if (_SCB_ARRAY_SIZE > 0)
case scb_0_interrupt_IRQn: return 0;
case scb_0_interrupt_IRQn:
return 0;
#endif
#if (_SCB_ARRAY_SIZE > 1)
case scb_1_interrupt_IRQn: return 1;
case scb_1_interrupt_IRQn:
return 1;
#endif
#if (_SCB_ARRAY_SIZE > 2)
case scb_2_interrupt_IRQn: return 2;
case scb_2_interrupt_IRQn:
return 2;
#endif
#if (_SCB_ARRAY_SIZE > 3)
#if !defined(CY_DEVICE_PSOC6A256K)
case scb_3_interrupt_IRQn: return 3;
case scb_3_interrupt_IRQn:
return 3;
#endif
#endif
#if (_SCB_ARRAY_SIZE > 4)
case scb_4_interrupt_IRQn: return 4;
case scb_4_interrupt_IRQn:
return 4;
#endif
#if (_SCB_ARRAY_SIZE > 5)
case scb_5_interrupt_IRQn: return 5;
case scb_5_interrupt_IRQn:
return 5;
#endif
#if (_SCB_ARRAY_SIZE > 6)
case scb_6_interrupt_IRQn: return 6;
case scb_6_interrupt_IRQn:
return 6;
#endif
#if (_SCB_ARRAY_SIZE > 7)
case scb_7_interrupt_IRQn: return 7;
case scb_7_interrupt_IRQn:
return 7;
#endif
#if (_SCB_ARRAY_SIZE > 8)
case scb_8_interrupt_IRQn: return 8;
case scb_8_interrupt_IRQn:
return 8;
#endif
#if (_SCB_ARRAY_SIZE > 9)
case scb_9_interrupt_IRQn: return 9;
case scb_9_interrupt_IRQn:
return 9;
#endif
#if (_SCB_ARRAY_SIZE > 10)
case scb_10_interrupt_IRQn: return 10;
case scb_10_interrupt_IRQn:
return 10;
#endif
#if (_SCB_ARRAY_SIZE > 11)
case scb_11_interrupt_IRQn: return 11;
case scb_11_interrupt_IRQn:
return 11;
#endif
#if (_SCB_ARRAY_SIZE > 12)
case scb_12_interrupt_IRQn: return 12;
case scb_12_interrupt_IRQn:
return 12;
#endif
#if (_SCB_ARRAY_SIZE > 13)
case scb_13_interrupt_IRQn: return 13;
case scb_13_interrupt_IRQn:
return 13;
#endif
#if (_SCB_ARRAY_SIZE > 14)
case scb_14_interrupt_IRQn: return 14;
case scb_14_interrupt_IRQn:
return 14;
#endif
#if (_SCB_ARRAY_SIZE > 15)
case scb_15_interrupt_IRQn: return 15;
case scb_15_interrupt_IRQn:
return 15;
#endif
#if (_SCB_ARRAY_SIZE > 16)
case scb_16_interrupt_IRQn: return 16;
case scb_16_interrupt_IRQn:
return 16;
#endif
#if (_SCB_ARRAY_SIZE > 17)
case scb_17_interrupt_IRQn: return 17;
case scb_17_interrupt_IRQn:
return 17;
#endif
#if (_SCB_ARRAY_SIZE > 18)
case scb_18_interrupt_IRQn: return 18;
case scb_18_interrupt_IRQn:
return 18;
#endif
#if (_SCB_ARRAY_SIZE > 19)
case scb_19_interrupt_IRQn: return 19;
case scb_19_interrupt_IRQn:
return 19;
#endif
#if (_SCB_ARRAY_SIZE > 20)
#error "Unhandled scb count"
......@@ -281,7 +301,7 @@ uint32_t _cyhal_i2c_set_peri_divider(void *obj, bool is_i2c, uint32_t freq, bool
}
if (peri_freq > 0 && _cyhal_utils_peri_pclk_assign_divider(
_cyhal_scb_get_clock_index(block_num), clock) == CY_SYSCLK_SUCCESS)
_cyhal_scb_get_clock_index(block_num), clock) == CY_SYSCLK_SUCCESS)
{
cy_rslt_t status = CY_RSLT_SUCCESS;
......@@ -294,18 +314,18 @@ uint32_t _cyhal_i2c_set_peri_divider(void *obj, bool is_i2c, uint32_t freq, bool
status = cyhal_clock_set_enabled(clock, true, false);
}
if(status == CY_RSLT_SUCCESS)
if (status == CY_RSLT_SUCCESS)
{
data_rate = (is_slave)
? Cy_SCB_I2C_GetDataRate(base, cyhal_clock_get_frequency(clock))
: Cy_SCB_I2C_SetDataRate(base, freq, cyhal_clock_get_frequency(clock));
? Cy_SCB_I2C_GetDataRate(base, cyhal_clock_get_frequency(clock))
: Cy_SCB_I2C_SetDataRate(base, freq, cyhal_clock_get_frequency(clock));
}
}
}
return data_rate;
}
const cyhal_resource_pin_mapping_t* _cyhal_scb_find_map(cyhal_gpio_t pin, const cyhal_resource_pin_mapping_t *pin_map,
const cyhal_resource_pin_mapping_t *_cyhal_scb_find_map(cyhal_gpio_t pin, const cyhal_resource_pin_mapping_t *pin_map,
size_t count, const cyhal_resource_inst_t *block_res)
{
for (size_t i = 0; i < count; i++)
......@@ -356,17 +376,17 @@ uint32_t _cyhal_scb_check_pin_affiliation(cyhal_gpio_t pin, const cyhal_resource
cy_rslt_t _cyhal_scb_set_fifo_level(CySCB_Type *base, cyhal_scb_fifo_type_t type, uint16_t level)
{
if(!CY_SCB_IS_TRIGGER_LEVEL_VALID(base, level))
if (!CY_SCB_IS_TRIGGER_LEVEL_VALID(base, level))
return CYHAL_SCB_RSLT_ERR_BAD_ARGUMENT;
if(type == CYHAL_SCB_FIFO_RX)
if (type == CYHAL_SCB_FIFO_RX)
{
SCB_RX_FIFO_CTRL(base) &= ~SCB_RX_FIFO_CTRL_TRIGGER_LEVEL_Msk;
SCB_RX_FIFO_CTRL(base) |= _VAL2FLD(SCB_RX_FIFO_CTRL_TRIGGER_LEVEL, level);
return CY_RSLT_SUCCESS;
}
else if(type == CYHAL_SCB_FIFO_TX)
else if (type == CYHAL_SCB_FIFO_TX)
{
SCB_TX_FIFO_CTRL(base) &= ~SCB_TX_FIFO_CTRL_TRIGGER_LEVEL_Msk;
SCB_TX_FIFO_CTRL(base) |= _VAL2FLD(SCB_TX_FIFO_CTRL_TRIGGER_LEVEL, level);
......@@ -384,13 +404,13 @@ cy_rslt_t _cyhal_scb_enable_output(cyhal_resource_inst_t resource, cyhal_scb_out
// This just returns a proper cyhal_source_t. Use _cyhal_scb_set_fifo_level
// to actually set level.
cyhal_internal_source_t src_int;
if(output == CYHAL_SCB_OUTPUT_TRIGGER_RX_FIFO_LEVEL_REACHED)
if (output == CYHAL_SCB_OUTPUT_TRIGGER_RX_FIFO_LEVEL_REACHED)
{
#if defined(CY_DEVICE_PSOC6A256K)
// 256K devices have no SCB3
src_int = (resource.block_num < 3)
? (cyhal_internal_source_t)(_CYHAL_TRIGGER_SCB0_TR_RX_REQ + resource.block_num)
: (cyhal_internal_source_t)(_CYHAL_TRIGGER_SCB0_TR_RX_REQ + resource.block_num - 1);
? (cyhal_internal_source_t)(_CYHAL_TRIGGER_SCB0_TR_RX_REQ + resource.block_num)
: (cyhal_internal_source_t)(_CYHAL_TRIGGER_SCB0_TR_RX_REQ + resource.block_num - 1);
#else
src_int = (cyhal_internal_source_t)(_CYHAL_TRIGGER_SCB0_TR_RX_REQ + resource.block_num);
#endif
......@@ -400,13 +420,13 @@ cy_rslt_t _cyhal_scb_enable_output(cyhal_resource_inst_t resource, cyhal_scb_out
}
// This just returns a proper cyhal_source_t. Use _cyhal_scb_set_fifo_level
// to actually set level.
else if(output == CYHAL_SCB_OUTPUT_TRIGGER_TX_FIFO_LEVEL_REACHED)
else if (output == CYHAL_SCB_OUTPUT_TRIGGER_TX_FIFO_LEVEL_REACHED)
{
#if defined(CY_DEVICE_PSOC6A256K)
// 256K devices have no SCB3
src_int = (resource.block_num < 3)
? (cyhal_internal_source_t)(_CYHAL_TRIGGER_SCB0_TR_TX_REQ + resource.block_num)
: (cyhal_internal_source_t)(_CYHAL_TRIGGER_SCB0_TR_TX_REQ + resource.block_num - 1);
? (cyhal_internal_source_t)(_CYHAL_TRIGGER_SCB0_TR_TX_REQ + resource.block_num)
: (cyhal_internal_source_t)(_CYHAL_TRIGGER_SCB0_TR_TX_REQ + resource.block_num - 1);
#else
src_int = (cyhal_internal_source_t)(_CYHAL_TRIGGER_SCB0_TR_TX_REQ + resource.block_num);
#endif
......@@ -430,7 +450,7 @@ cy_rslt_t _cyhal_scb_disable_output(cyhal_scb_output_t output)
#if (defined(CY_IP_MXSCB) || defined(CY_DEVICE_PSOC4AMC) || defined(CY_DEVICE_PSOC4AS3) || defined(CY_DEVICE_PSOC4AS4))
// Noop: Use _cyhal_scb_set_fifo_level to actually set level
if (output == CYHAL_SCB_OUTPUT_TRIGGER_RX_FIFO_LEVEL_REACHED ||
output == CYHAL_SCB_OUTPUT_TRIGGER_TX_FIFO_LEVEL_REACHED)
output == CYHAL_SCB_OUTPUT_TRIGGER_TX_FIFO_LEVEL_REACHED)
{
return CY_RSLT_SUCCESS;
}
......@@ -456,7 +476,7 @@ static bool _cyhal_scb_pm_callback_index(uint8_t index, cyhal_syspm_callback_sta
return ((NULL != obj) && (callback != NULL)) ? callback(obj, state, pdl_mode) : true;
}
static bool _cyhal_scb_pm_callback_common(cyhal_syspm_callback_state_t state, cyhal_syspm_callback_mode_t mode, void* callback_arg)
static bool _cyhal_scb_pm_callback_common(cyhal_syspm_callback_state_t state, cyhal_syspm_callback_mode_t mode, void *callback_arg)
{
CY_UNUSED_PARAMETER(callback_arg);
bool allow = true;
......@@ -516,15 +536,15 @@ void _cyhal_scb_update_instance_data(uint8_t block_num, void *obj, cyhal_scb_ins
if (count == 0)
{
CY_ASSERT(obj == NULL);
#if (CYHAL_DRIVER_AVAILABLE_SYSPM)
#if (CYHAL_DRIVER_AVAILABLE_SYSPM)
_cyhal_syspm_unregister_peripheral_callback(&_cyhal_scb_pm_callback_data);
#endif
#endif
}
else if (count == 1 && obj != NULL)
{
#if (CYHAL_DRIVER_AVAILABLE_SYSPM)
#if (CYHAL_DRIVER_AVAILABLE_SYSPM)
_cyhal_syspm_register_peripheral_callback(&_cyhal_scb_pm_callback_data);
#endif
#endif
}
}
......
CYPRESS END USER LICENSE AGREEMENT
PLEASE READ THIS END USER LICENSE AGREEMENT ("Agreement") CAREFULLY BEFORE DOWNLOADING, INSTALLING, COPYING, OR USING THIS SOFTWARE AND ACCOMPANYING DOCUMENTATION. BY DOWNLOADING, INSTALLING, COPYING OR USING THE SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS AGREEMENT, PROMPTLY RETURN AND DO NOT USE THE SOFTWARE. IF YOU HAVE PURCHASED THIS LICENSE TO THE SOFTWARE, YOUR RIGHT TO RETURN THE SOFTWARE EXPIRES 30 DAYS AFTER YOUR PURCHASE AND APPLIES ONLY TO THE ORIGINAL PURCHASER.
1. Definitions.
"Software" means this software and any accompanying documentation, including any upgrades, updates, bug fixes or modified versions provided to you by Cypress.
"Source Code" means software in human-readable form.
"Binary Code" means the software in binary code form such as object code or an executable.
"Development Tools" means software that is intended to be installed on a personal computer and used to create programming code for Firmware, Drivers, or Host Applications. Examples of Development Tools are Cypress's PSoC Creator software, Cypress's WICED SDKs, and Cypress's Modus Toolbox software.
"Firmware" means software that executes on a Cypress hardware product.
"Driver" means software that enables the use of a Cypress hardware product on a particular host operating system such as GNU/Linux, Windows, MacOS, Android, and iOS.
"Host Application" means software that executes on a device other than a Cypress hardware product in order to program, control, or communicate with a Cypress hardware product.
"inf File" means a hardware setup information file (.inf file) created by the Software to allow a Microsoft Windows operating system to install the driver for a Cypress hardware product.
2. License. Subject to the terms and conditions of this Agreement, Cypress Semiconductor Corporation ("Cypress") and its suppliers grant to you a non-exclusive, non-transferable license under their copyright rights:
a. to use the Development Tools in object code form solely for the purpose of creating Firmware, Drivers, Host Applications, and inf Files for Cypress hardware products; and
b. (i) if provided in Source Code form, to copy, modify, and compile the Firmware Source Code to create Firmware for execution on a Cypress hardware product, and (ii) to distribute Firmware in binary code form only, only when installed onto a Cypress hardware product; and
c. (i) if provided in Source Code form, to copy, modify, and compile the Driver Source Code to create one or more Drivers to enable the use of a Cypress hardware product on a particular host operating system, and (ii) to distribute the Driver, in binary code form only, only when installed on a device that includes the Cypress hardware product that the Driver is intended to enable; and
d. (i) if provided in Source Code form, to copy, modify, and compile the Host Application Source Code to create one or more Host Applications to program, control, or communicate with a Cypress hardware product, and (ii) to distribute Host Applications, in binary code form only, only when installed on a device that includes a Cypress hardware product that the Host Application is intended to program, control, or communicate with; and
e. to freely distribute any inf File.
Any distribution of Software permitted under this Agreement must be made pursuant to your standard end user license agreement used for your proprietary (closed source) software products, such end user license agreement to include, at a minimum, provisions limiting your licensors' liability and prohibiting reverse engineering of the Software, consistent with such provisions in this Agreement.
3. Free and Open Source Software. Portions of the Software may be licensed under free and/or open source licenses such as the GNU General Public License or other licenses from third parties ("Third Party Software"). Third Party Software is subject to the applicable license agreement and not this Agreement. If you are entitled to receive the source code from Cypress for any Third Party Software included with the Software, either the source code will be included with the Software or you may obtain the source code at no charge from <http://www.cypress.com/go/opensource>. The applicable license terms will accompany each source code package. To review the license terms applicable to any Third Party Software for which Cypress is not required to provide you with source code, please see the Software's installation directory on your computer.
4. Proprietary Rights; Ownership. The Software, including all intellectual property rights therein, is and will remain the sole and exclusive property of Cypress or its suppliers. Cypress retains ownership of the Source Code and any compiled version thereof. Subject to Cypress' ownership of the underlying Software (including Source Code), you retain ownership of any modifications you make to the Source Code. You agree not to remove any Cypress copyright or other notices from the Source Code and any modifications thereof. You agree to keep the Source Code confidential. Any reproduction, modification, translation, compilation, or representation of the Source Code except as permitted in Section 2 ("License") is prohibited without the express written permission of Cypress. Except as otherwise expressly provided in this Agreement, you may not: (i) modify, adapt, or create derivative works based upon the Software; (ii) copy the Software; (iii) except and only to the extent explicitly permitted by applicable law despite this limitation, decompile, translate, reverse engineer, disassemble or otherwise reduce the Software to human-readable form; or (iv) use the Software or any sample code other than for the Purpose. You hereby covenant that you will not assert any claim that the Software, or derivative works thereof created by or for Cypress, infringe any intellectual property right owned or controlled by you
5. No Support. Cypress may, but is not required to, provide technical support for the Software.
6. Term and Termination. This Agreement is effective until terminated, and either party may terminate this Agreement at any time with or without cause. This Agreement and your license rights under this Agreement will terminate immediately without notice from Cypress if you fail to comply with any provision of this Agreement. Upon termination, you must destroy all copies of Software in your possession or control. The following paragraphs shall survive any termination of this Agreement: "Free and Open Source Software," "Proprietary Rights; Ownership," "Compliance With Law," "Disclaimer," "Limitation of Liability," and "General."
7. Compliance With Law. Each party agrees to comply with all applicable laws, rules and regulations in connection with its activities under this Agreement. Without limiting the foregoing, the Software may be subject to export control laws and regulations of the United States and other countries. You agree to comply strictly with all such laws and regulations and acknowledge that you have the responsibility to obtain licenses to export, re-export, or import the Software.
8. Disclaimer. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THE SOFTWARE, INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the right to make changes to the Software without notice. Cypress does not assume any liability arising out of the application or use of Software or any product or circuit described in the Software. It is the responsibility of the user of the Software to properly design, program, and test the functionality and safety of any application made of the Software and any resulting product. Cypress does not authorize its Software or products for use in any products where a malfunction or failure of the Software or Cypress product may reasonably be expected to result in significant property damage, injury or death (“High Risk Product”). If you include any Software or Cypress product in a High Risk Product, you assume all risk of such use and agree to indemnify Cypress and its suppliers against all liability. No computing device can be absolutely secure. Therefore, despite security measures implemented in Cypress hardware or software products, Cypress does not assume any liability arising out of any security breach, such as unauthorized access to or use of a Cypress product.
9. Limitation of Liability. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL CYPRESS OR ITS SUPPLIERS, RESELLERS, OR DISTRIBUTORS BE LIABLE FOR ANY LOST REVENUE, PROFIT, OR DATA, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL, OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO THE USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF CYPRESS OR ITS SUPPLIERS, RESELLERS, OR DISTRIBUTORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO EVENT SHALL CYPRESS' OR ITS SUPPLIERS’, RESELLERS’, OR DISTRIBUTORS’ TOTAL LIABILITY TO YOU, WHETHER IN CONTRACT, TORT (INCLUDING NEGLIGENCE), OR OTHERWISE, EXCEED THE GREATER OF US$500 OR THE PRICE PAID BY YOU FOR THE SOFTWARE. THE FOREGOING LIMITATIONS SHALL APPLY EVEN IF THE ABOVE-STATED WARRANTY FAILS OF ITS ESSENTIAL PURPOSE. BECAUSE SOME STATES OR JURISDICTIONS DO NOT ALLOW LIMITATION OR EXCLUSION OF CONSEQUENTIAL OR INCIDENTAL DAMAGES, ALL OR PORTIONS OF THE ABOVE LIMITATION MAY NOT APPLY TO YOU.
10. Restricted Rights. The Software is commercial computer software as that term is described in 48 C.F.R. 252.227-7014(a)(1). If the Software is being acquired by or on behalf of the U.S. Government or by a U.S. Government prime contractor or subcontractor (at any tier), then the Government's rights in Software shall be only those set forth in this Agreement.
11. Personal Information. You agree that information you provide through your registration on Cypress IoT Community Forum or other Cypress websites, including contact information or other personal information, may be collected and used by Cypress consistent with its Data Privacy Policy (www.cypress.com/privacy-policy), as updated or revised from time to time, and may be provided to its third party sales representatives, distributors and other entities conducting sales activities for Cypress for sales-related and other business purposes.
12. General. This Agreement will bind and inure to the benefit of each party’s successors and assigns, provided that you may not assign or transfer this Agreement, in whole or in part, without Cypress' written consent. This Agreement shall be governed by and construed in accordance with the laws of the State of California, United States of America, as if performed wholly within the state and without giving effect to the principles of conflict of law. The parties consent to personal and exclusive jurisdiction of and venue in, the state and federal courts within Santa Clara County, California; provided however, that nothing in this Agreement will limit Cypress' right to bring legal action in any venue in order to protect or enforce its intellectual property rights. No failure of either party to exercise or enforce any of its rights under this Agreement will act as a waiver of such rights. If any portion of this Agreement is found to be void or unenforceable, the remaining provisions of this Agreement shall remain in full force and effect. This Agreement is the complete and exclusive agreement between the parties with respect to the subject matter hereof, superseding and replacing any and all prior agreements, communications, and understandings (both written and oral) regarding such subject matter. Any notice to Cypress will be deemed effective when actually received and must be sent to Cypress Semiconductor Corporation, ATTN: Chief Legal Officer, 198 Champion Court, San Jose, CA 95134 USA.
# Cypress CSDIDAC Middleware Library
### Overview
The CSDIDAC provides an API that allows the CSD HW block IDAC functionality.
It can be useful for devices that do not include other DAC options.
### Features
* A two-channel IDAC with the 7-bit resolution
* The IDAC A and IDAC B channels can be enabled/disabled independently
* The IDAC A and IDAC B channels can be configured with sourcing/sinking current independently
* The IDAC A and IDAC B channels can be joined to increase a maximum output current
* The IDAC A and IDAC B channels can be enabled/disabled simultaneously by using the CY_CSDIDAC_AB option
* The 0 to 609.6 uA (609600 nA) current range is available for each IDAC channel
* Each IDAC can use independently one of the six available LSB depending on a desired output current
### Quick Start
The CSDIDAC could be configured by the ModusToolbox CSD personality. Refer to the [API Reference Guide Configuration Considerations](https://cypresssemiconductorco.github.io/csdidac/csdidac_api_reference_manual/html/index.html#group_csdidac_configuration).
### More information
The following resources contain more information:
* [CSDIDAC Middleware RELEASE.md](./RELEASE.md)
* [CSDIDAC Middleware API Reference Guide](https://cypresssemiconductorco.github.io/csdidac/csdidac_api_reference_manual/html/index.html)
* [ModusToolbox Software Environment, Quick Start Guide, Documentation, and Videos](https://www.cypress.com/products/modustoolbox-software-environment)
* [CSDIDAC Middleware Code Example for MBED OS](https://github.com/cypresssemiconductorco/mbed-os-example-csdidac)
* [ModusToolbox Device Configurator Tool Guide](https://www.cypress.com/ModusToolboxDeviceConfig)
* [CapSense Middleware API Reference Guide](https://cypresssemiconductorco.github.io/capsense/capsense_api_reference_manual/html/index.html)
* [CSDADC Middleware API Reference Guide](https://cypresssemiconductorco.github.io/csdadc/csdadc_api_reference_manual/html/index.html)
* [PSoC 6 Technical Reference Manual](https://www.cypress.com/documentation/technical-reference-manuals/psoc-6-mcu-psoc-63-ble-architecture-technical-reference)
* [PSoC 63 with BLE Datasheet Programmable System-on-Chip datasheet](http://www.cypress.com/ds218787)
* [PSoC 4000S Family: PSoC 4 Architecture Technical Reference Manual (TRM)](https://www.cypress.com/documentation/technical-reference-manuals/psoc-4000s-family-psoc-4-architecture-technical-reference)
* [PSoC 4100S and PSoC 4100S Plus: PSoC 4 Architecture Technical Reference Manual (TRM)](https://www.cypress.com/documentation/technical-reference-manuals/psoc-4100s-and-psoc-4100s-plus-psoc-4-architecture)
* [Cypress Semiconductor](http://www.cypress.com)
---
© Cypress Semiconductor Corporation, 2019.
# Cypress CSDIDAC Middleware Library 2.10
### What's Included?
Please refer to the [README.md](./README.md) and the [API Reference Guide](https://cypresssemiconductorco.github.io/csdidac/csdidac_api_reference_manual/html/index.html) for a complete description of the CSDIDAC Middleware.
The revision history of the CSDIDAC Middleware is also available on the [API Reference Guide Changelog](https://cypresssemiconductorco.github.io/csdidac/csdidac_api_reference_manual/html/index.html#group_csdidac_changelog).
New in this release:
* Added the support for the PSoC 4100S Plus devices
### Supported Software and Tools
This version of the CSDIDAC Middleware was validated for compatibility with the following Software and Tools:
| Software and Tools | Version |
| :--- | :----: |
| ModusToolbox Software Environment | 2.1 |
| - ModusToolbox Device Configurator | 2.1 |
| - ModusToolbox CSD Personality for PSoC4 devices in Device Configurator | 1.0 |
| - ModusToolbox CSD Personality for PSoC6 devices in Device Configurator | 2.0 |
| PSoC4 Peripheral Driver Library (PDL) | 1.0.0 |
| PSoC6 Peripheral Driver Library (PDL) | 1.5.0 |
| GCC Compiler | 7.2.1 |
| IAR Compiler | 8.32 |
| ARM Compiler 6 | 6.11 |
| MBED OS | 5.15.1 |
| FreeRTOS | 10.0.1 |
### More information
The following resources contain more information:
* [CSDIDAC Middleware RELEASE.md](./RELEASE.md)
* [CSDIDAC Middleware API Reference Guide](https://cypresssemiconductorco.github.io/csdidac/csdidac_api_reference_manual/html/index.html)
* [ModusToolbox Software Environment, Quick Start Guide, Documentation, and Videos](https://www.cypress.com/products/modustoolbox-software-environment)
* [CSDIDAC Middleware Code Example for MBED OS](https://github.com/cypresssemiconductorco/mbed-os-example-csdidac)
* [ModusToolbox Device Configurator Tool Guide](https://www.cypress.com/ModusToolboxDeviceConfig)
* [CapSense Middleware API Reference Guide](https://cypresssemiconductorco.github.io/capsense/capsense_api_reference_manual/html/index.html)
* [CSDADC Middleware API Reference Guide](https://cypresssemiconductorco.github.io/csdadc/csdadc_api_reference_manual/html/index.html)
* [PSoC 6 Technical Reference Manual](https://www.cypress.com/documentation/technical-reference-manuals/psoc-6-mcu-psoc-63-ble-architecture-technical-reference)
* [PSoC 63 with BLE Datasheet Programmable System-on-Chip datasheet](http://www.cypress.com/ds218787)
* [PSoC 4000S Family: PSoC 4 Architecture Technical Reference Manual (TRM)](https://www.cypress.com/documentation/technical-reference-manuals/psoc-4000s-family-psoc-4-architecture-technical-reference)
* [PSoC 4100S and PSoC 4100S Plus: PSoC 4 Architecture Technical Reference Manual (TRM)](https://www.cypress.com/documentation/technical-reference-manuals/psoc-4100s-and-psoc-4100s-plus-psoc-4-architecture)
* [Cypress Semiconductor](http://www.cypress.com)
---
© Cypress Semiconductor Corporation, 2019-2020.
CYPRESS (AN INFINEON COMPANY) END USER LICENSE AGREEMENT
PLEASE READ THIS END USER LICENSE AGREEMENT ("Agreement") CAREFULLY BEFORE
DOWNLOADING, INSTALLING, COPYING, OR USING THIS SOFTWARE AND ACCOMPANYING
DOCUMENTATION. BY DOWNLOADING, INSTALLING, COPYING OR USING THE SOFTWARE,
YOU ARE AGREEING TO BE BOUND BY THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL
OF THE TERMS OF THIS AGREEMENT, PROMPTLY RETURN AND DO NOT USE THE SOFTWARE.
IF YOU HAVE PURCHASED THIS LICENSE TO THE SOFTWARE, YOUR RIGHT TO RETURN THE
SOFTWARE EXPIRES 30 DAYS AFTER YOUR PURCHASE AND APPLIES ONLY TO THE ORIGINAL
PURCHASER.
1. Definitions.
"Software" means this software and any accompanying documentation,
including any upgrades, updates, bug fixes or modified versions provided
to you by Cypress.
"Source Code" means software in human-readable form.
"Binary Code" means the software in binary code form such as object code or
an executable.
"Development Tools" means software that is intended to be installed on a
personal computer and used to create programming code for Firmware,
Drivers, or Host Applications. Examples of Development Tools are
Cypress's PSoC Creator software, Cypress's WICED SDKs, and Cypress's
ModusToolbox software.
"Firmware" means software that executes on a Cypress hardware product.
"Driver" means software that enables the use of a Cypress hardware product
on a particular host operating system such as GNU/Linux, Windows, MacOS,
Android, and iOS.
"Host Application" means software that executes on a device other than a
Cypress hardware product in order to program, control, or communicate
with a Cypress hardware product.
"inf File" means a hardware setup information file (.inf file) created by
the Software to allow a Microsoft Windows operating system to install
the driver for a Cypress hardware product.
2. License. Subject to the terms and conditions of this Agreement, Cypress
Semiconductor Corporation ("Cypress") and its suppliers grant to you a
non-exclusive, non-transferable license under their copyright rights:
a. to use the Development Tools in object code form solely for the purpose
of creating Firmware, Drivers, Host Applications, and inf Files for
Cypress hardware products; and
b. (i) if provided in Source Code form, to copy, modify, and compile the
Firmware Source Code to create Firmware for execution on a Cypress
hardware product, and
(ii) to distribute Firmware in binary code form only, only when
installed onto a Cypress hardware product; and
c. (i) if provided in Source Code form, to copy, modify, and compile the
Driver Source Code to create one or more Drivers to enable the use
of a Cypress hardware product on a particular host operating
system, and
(ii) to distribute the Driver, in binary code form only, only when
installed on a device that includes the Cypress hardware product
that the Driver is intended to enable; and
d. (i) if provided in Source Code form, to copy, modify, and compile the
Host Application Source Code to create one or more Host
Applications to program, control, or communicate with a Cypress
hardware product, and
(ii) to distribute Host Applications, in binary code form only, only
when installed on a device that includes a Cypress hardware product
that the Host Application is intended to program, control, or
communicate with; and
e. to freely distribute any inf File.
Any distribution of Software permitted under this Agreement must be made
pursuant to your standard end user license agreement used for your proprietary
(closed source) software products, such end user license agreement to include,
at a minimum, provisions limiting your licensors' liability and prohibiting
reverse engineering of the Software, consistent with such provisions in this
Agreement.
3. Free and Open Source Software. Portions of the Software may be licensed
under free and/or open source licenses such as the GNU General Public License
or other licenses from third parties ("Third Party Software"). Third Party
Software is subject to the applicable license agreement and not this
Agreement. If you are entitled to receive the source code from Cypress for
any Third Party Software included with the Software, either the source code
will be included with the Software or you may obtain the source code at no
charge from <http://www.cypress.com/go/opensource>. The applicable license
terms will accompany each source code package. To review the license terms
applicable to any Third Party Software for which Cypress is not required to
provide you with source code, please see the Software's installation directory
on your computer.
4. Proprietary Rights; Ownership. The Software, including all intellectual
property rights therein, is and will remain the sole and exclusive property of
Cypress or its suppliers. Cypress retains ownership of the Source Code and
any compiled version thereof. Subject to Cypress' ownership of the underlying
Software (including Source Code), you retain ownership of any modifications
you make to the Source Code. You agree not to remove any Cypress copyright or
other notices from the Source Code and any modifications thereof. You agree
to keep the Source Code confidential. Any reproduction, modification,
translation, compilation, or representation of the Source Code except as
permitted in Section 2 ("License") is prohibited without the express written
permission of Cypress. Except as otherwise expressly provided in this
Agreement, you may not:
(i) modify, adapt, or create derivative works based upon the Software;
(ii) copy the Software;
(iii) except and only to the extent explicitly permitted by applicable
law despite this limitation, decompile, translate, reverse engineer,
disassemble or otherwise reduce the Software to human-readable form;
or
(iv) use the Software or any sample code other than for the Purpose.
You hereby covenant that you will not assert any claim that the Software, or
derivative works thereof created by or for Cypress, infringe any intellectual
property right owned or controlled by you
5. No Support. Cypress may, but is not required to, provide technical support
for the Software.
6. Term and Termination. This Agreement is effective until terminated, and
either party may terminate this Agreement at any time with or without cause.
This Agreement and your license rights under this Agreement will terminate
immediately without notice from Cypress if you fail to comply with any
provision of this Agreement. Upon termination, you must destroy all copies of
Software in your possession or control. The following paragraphs shall
survive any termination of this Agreement: "Free and Open Source Software,"
"Proprietary Rights; Ownership," "Compliance With Law," "Disclaimer,"
"Limitation of Liability," and "General."
7. Compliance With Law. Each party agrees to comply with all applicable laws,
rules and regulations in connection with its activities under this Agreement.
Without limiting the foregoing, the Software may be subject to export control
laws and regulations of the United States and other countries. You agree to
comply strictly with all such laws and regulations and acknowledge that you
have the responsibility to obtain licenses to export, re-export, or import the
Software.
8. Disclaimer. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS
MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THE
SOFTWARE, INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress
reserves the right to make changes to the Software without notice. Cypress
does not assume any liability arising out of the application or use of
Software or any product or circuit described in the Software. It is the
responsibility of the user of the Software to properly design, program, and
test the functionality and safety of any application made of the Software and
any resulting product. Cypress does not authorize its Software or products
for use in any products where a malfunction or failure of the Software or
Cypress product may reasonably be expected to result in significant property
damage, injury or death ("High Risk Product"). If you include any Software or
Cypress product in a High Risk Product, you assume all risk of such use and
agree to indemnify Cypress and its suppliers against all liability. No
computing device can be absolutely secure. Therefore, despite security
measures implemented in Cypress hardware or software products, Cypress does
not assume any liability arising out of any security breach, such as
unauthorized access to or use of a Cypress product.
9. Limitation of Liability. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE
LAW, IN NO EVENT WILL CYPRESS OR ITS SUPPLIERS, RESELLERS, OR DISTRIBUTORS BE
LIABLE FOR ANY LOST REVENUE, PROFIT, OR DATA, OR FOR SPECIAL, INDIRECT,
CONSEQUENTIAL, INCIDENTAL, OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS
OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO THE USE OF OR
INABILITY TO USE THE SOFTWARE EVEN IF CYPRESS OR ITS SUPPLIERS, RESELLERS, OR
DISTRIBUTORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO
EVENT SHALL CYPRESS' OR ITS SUPPLIERS', RESELLERS', OR DISTRIBUTORS' TOTAL
LIABILITY TO YOU, WHETHER IN CONTRACT, TORT (INCLUDING NEGLIGENCE), OR
OTHERWISE, EXCEED THE GREATER OF US$500 OR THE PRICE PAID BY YOU FOR THE
SOFTWARE. THE FOREGOING LIMITATIONS SHALL APPLY EVEN IF THE ABOVE-STATED
WARRANTY FAILS OF ITS ESSENTIAL PURPOSE. BECAUSE SOME STATES OR JURISDICTIONS
DO NOT ALLOW LIMITATION OR EXCLUSION OF CONSEQUENTIAL OR INCIDENTAL DAMAGES,
ALL OR PORTIONS OF THE ABOVE LIMITATION MAY NOT APPLY TO YOU.
10. Restricted Rights. The Software is commercial computer software as that
term is described in 48 C.F.R. 252.227-7014(a)(1). If the Software is being
acquired by or on behalf of the U.S. Government or by a U.S. Government prime
contractor or subcontractor (at any tier), then the Government's rights in
Software shall be only those set forth in this Agreement.
11. Personal Information. You agree that information you provide through your
registration on Cypress IoT Community Forum or other Cypress websites,
including contact information or other personal information, may be collected
and used by Cypress consistent with its Data Privacy Policy
(www.cypress.com/privacy-policy), as updated or revised from time to time, and
may be provided to its third party sales representatives, distributors and
other entities conducting sales activities for Cypress for sales-related and
other business purposes.
12. General. This Agreement will bind and inure to the benefit of each
party's successors and assigns, provided that you may not assign or transfer
this Agreement, in whole or in part, without Cypress' written consent. This
Agreement shall be governed by and construed in accordance with the laws of
the State of California, United States of America, as if performed wholly
within the state and without giving effect to the principles of conflict of
law. The parties consent to personal and exclusive jurisdiction of and venue
in, the state and federal courts within Santa Clara County, California;
provided however, that nothing in this Agreement will limit Cypress' right to
bring legal action in any venue in order to protect or enforce its
intellectual property rights. No failure of either party to exercise or
enforce any of its rights under this Agreement will act as a waiver of such
rights. If any portion of this Agreement is found to be void or
unenforceable, the remaining provisions of this Agreement shall remain in full
force and effect. This Agreement is the complete and exclusive agreement
between the parties with respect to the subject matter hereof, superseding and
replacing any and all prior agreements, communications, and understandings
(both written and oral) regarding such subject matter. Any notice to Cypress
will be deemed effective when actually received and must be sent to Cypress
Semiconductor Corporation, ATTN: Chief Legal Officer, 198 Champion Court, San
Jose, CA 95134 USA.
\ No newline at end of file
# USB Device Middleware Library
## Overview
The USB Device middleware provides a full-speed
[USB 2.0 Chapter 9 specification](https://usb.org/document-library/usb-20-specification)
compliant device framework. It uses the USBFS driver from
CAT1A/CAT2 Peripheral Driver Library to interface with the hardware.
The middleware provides support for Audio, CDC, HID and Vendor classes.
It also enables implementing support for other classes. The USB Configurator
tool makes it easy to construct a USB Device descriptor.
## Features
* USB Full-Speed Device Framework
* USB Device Configurator
* The following USB Classes are supported:
* Audio Class
* CDC: Communication Device Class
* HID: Human Interface Device
* Adding Custom Class Support
* Vendor-Specific Requests Support
* Power Status Reporting for Self-Powered Devices
* Blocking API Timeout Function Redefinition
* Compliance with [MISRA-C:2012 coding standard](https://www.misra.org.uk/)
## USB Device Specific Instructions
The user must ensure that the parameters selected in the USB Device personality
are aligned with the descriptor configuration in the USB Configurator, because
there is no connection between the USB Device personality in the Device
Configurator and USB Configurator.
Specifically, parameter "Endpoints Mask" in the USB personality must be aligned
with the endpoints selected in the USB Configurator. If DMA Automatic mode is
selected, parameter "Endpoint Buffer Size" must be aligned with the total size
of the endpoint buffers allocated in the USB Configurator.
## Quick Start
Configure the USB Device using the ModusToolbox™ USB Device personality and
USB Device Configurator. Refer to the
[API Reference Quick Start Guide](https://infineon.github.io/usbdev/usbfs_dev_api_reference_manual/html/index.html)
## More information
The following links provide more information:
* [USB Device Middleware Library Release Notes](./RELEASE.md)
* [USB Device Middleware Library API Reference](https://infineon.github.io/usbdev/usbfs_dev_api_reference_manual/html/index.html)
* [CAT1 Peripheral Driver Library API Reference](https://infineon.github.io/mtb-pdl-cat1/pdl_api_reference_manual/html/index.html)
* [CAT2 Peripheral Driver Library API Reference](https://infineon.github.io/mtb-pdl-cat2/pdl_api_reference_manual/html/index.html)
* [ModusToolbox™ Software Environment, Quick Start Guide, Documentation, and Videos](https://www.cypress.com/products/modustoolbox-software-environment)
* [PSoC™ 6 SDK Examples](https://github.com/Infineon?q=mtb-example-psoc6%20NOT%20Deprecated)
* [ModusToolbox™ USB Configurator Tool Guide](https://www.cypress.com/ModusToolboxUSBConfig)
* [ModusToolbox™ Device Configurator Tool Guide](https://www.cypress.com/ModusToolboxDeviceConfig)
* [PSoC™ 6 WiFi-BT Pioneer Kit](http://www.cypress.com/CY8CKIT-062-WiFi-BT)
* [PSoC™ 6 Wi-Fi BT Prototyping Kit](http://www.cypress.com/cy8cproto-062-4343w)
* [PSoC™ 6 MCU Datasheets](http://www.cypress.com/psoc6ds)
* [PSoC™ 6 MCU Application Notes](http://www.cypress.com/psoc6an)
* [PSoC™ 6 MCU Technical Reference Manuals](http://www.cypress.com/psoc6trm)
* [PMG1-S2 Prototyping Kit](http://www.cypress.com/CY7112)
* [PMG1-S3 Prototyping Kit](http://www.cypress.com/CY7113)
* [PMG1 Datasheets](https://www.cypress.com/PMG1DS)
* [CYPRESS™ Semiconductor](http://www.cypress.com)
---
© 2019-2021, CYPRESS™ Semiconductor Corporation (an Infineon company)
or an affiliate of CYPRESS™ Semiconductor Corporation.
# USB Device Middleware Library 2.10
## What's Included?
For a complete description of the USB Device Middleware, refer to
[README.md](./README.md) and the
[USB Device API Reference](https://infineon.github.io/usbdev/usbfs_dev_api_reference_manual/html/index.html).
The revision history of the USB Device Middleware is also available in the
[API Reference Changelog](https://infineon.github.io/usbdev/usbfs_dev_api_reference_manual/html/index.html#group_usb_dev_changelog).
New in this release:
* Updated the middleware to support configurations without any data endpoints.
* Added support for the PMG1 Family of MCUs.
* Updated the middleware to comply with MISRA-C:2012 standard.
## Defect Fixes
* Fixed an issue in vendor class request handling.
## USB Device Specific Instructions
The user must ensure that the parameters selected in the USB Device personality
are aligned with the descriptor configuration in the USB Configurator, because
there is no connection between the USB Device personality in the Device
Configurator and USB Configurator.
Specifically, parameter "Endpoints Mask" in the USB personality must be aligned
with the endpoints selected in the USB Configurator. If DMA Automatic mode is
selected, parameter "Endpoint Buffer Size" must be aligned with the total size
of the endpoint buffers allocated in the USB Configurator.
## Known Issues
| Problem | Workaround |
| ------- | ---------- |
| The USB Device ignores LPM requests after wake up from Deep Sleep. | Call USBFS driver Cy_USBFS_Dev_Drv_Lpm_SetResponse() after calling Cy_USBFS_Dev_Drv_Resume() to restore response to the LPM packets. |
| The USB Device modes with DMA do not work after wake up from Deep Sleep, due to incorrect restore of the ARB_CFG register. | Save ARB_CFG values before entering Deep Sleep and restore it after calling of Cy_USBFS_Dev_Drv_Resume. |
## Supported Software and Tools
This version of the USB Device Middleware was validated for compatibility with the following Software and Tools:
| Software and Tools | Version |
| :--- | :----: |
| ModusToolbox™ Software Environment | 2.3 |
| - ModusToolbox™ Device Configurator | 3.0 |
| - ModusToolbox™ USB Device Personality in Device Configurator | 1.1 |
| - ModusToolbox™ USB Device Configurator | 2.30 |
| MTB CAT1A Peripheral Driver Library (PDL) | 2.2.1 |
| MTB CAT2 Peripheral Driver Library (PDL) | 1.2.0 |
| GCC Compiler | 9.3.1 |
| IAR Compiler | 8.42.2 |
| ARM Compiler 6 | 6.16 |
## More information
For a more information, refer to [README.md](./README.md)
---
© 2019-2021, CYPRESS™ Semiconductor Corporation (an Infineon company)
or an affiliate of CYPRESS™ Semiconductor Corporation.
/***************************************************************************//**
* \file cy_usb_dev_audio.c
* \version 2.10
*
* Provides Audio class-specific API implementation.
*
********************************************************************************
* \copyright
* (c) 2018-2021, Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation. All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
*******************************************************************************/
#include "cy_usb_dev_audio.h"
#if (defined(CY_IP_MXUSBFS) || defined(CY_IP_M0S8USBDSS))
/*******************************************************************************
* Function Name: Cy_USB_Dev_Audio_Init
****************************************************************************//**
*
* Initializes the Audio class.
* This function must be called to enable USB Device Audio functionality.
*
* \param config
* Pass NULL as an argument (left for future purposes).
*
* \param context
* The pointer to the context structure \ref cy_stc_usb_dev_audio_context_t
* allocated by the user. The structure is used during the Audio Class operation
* for internal configuration and data retention. The user must not modify
* anything in this structure.
*
* \param devContext
* The pointer to the USB Device context structure \ref cy_stc_usb_dev_context_t.
*
* \return
* Status code of the function execution \ref cy_en_usb_dev_status_t.
*
*******************************************************************************/
cy_en_usb_dev_status_t Cy_USB_Dev_Audio_Init(void const *config,
cy_stc_usb_dev_audio_context_t *context,
cy_stc_usb_dev_context_t *devContext)
{
/* Suppress a compiler warning about unused variables */
(void) config;
if ((NULL == context) || (NULL == devContext))
{
return CY_USB_DEV_BAD_PARAM;
}
/* Store device context */
context->devContext = devContext;
return Cy_USB_Dev_RegisterClass(&context->classItem, &context->classObj, context, devContext);
}
#endif /* (defined(CY_IP_MXUSBFS) || defined(CY_IP_M0S8USBDSS)) */
/* [] END OF FILE */
/***************************************************************************//**
* \file cy_usb_dev_audio.h
* \version 2.10
*
* Provides Audio class-specific API declarations.
*
********************************************************************************
* \copyright
* (c) 2018-2021, Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation. All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
*******************************************************************************/
/**
* \addtogroup group_usb_dev_audio
* This section provides API description for the Audio class.
* \{
* \defgroup group_usb_dev_audio_macros Macros
* \defgroup group_usb_dev_audio_functions Functions
* \defgroup group_usb_dev_audio_data_structures Data Structures
* \}
*/
#if !defined(CY_USB_DEV_AUDIO_H)
#define CY_USB_DEV_AUDIO_H
#include "cy_usb_dev.h"
#if (defined(CY_IP_MXUSBFS) || defined(CY_IP_M0S8USBDSS))
#if defined(__cplusplus)
extern "C" {
#endif
/*******************************************************************************
* Enumerated Types
*******************************************************************************/
/*******************************************************************************
* Type Definitions
*******************************************************************************/
/**
* \addtogroup group_usb_dev_audio_data_structures
* \{
*/
/** Audio class context structure.
* All fields for the Audio context structure are internal. Firmware never reads or
* writes these values. Firmware allocates the structure and provides the
* address of the structure to the middleware in Audio function calls. Firmware
* must ensure that the defined instance of this structure remains in scope while
* the middleware is in use.
*/
typedef struct
{
/** \cond INTERNAL*/
/** Pointer to device context */
cy_stc_usb_dev_context_t *devContext;
/** Audio class functions pointers */
cy_stc_usb_dev_class_t classObj;
/** Audio class linked list item */
cy_stc_usb_dev_class_ll_item_t classItem;
/** \endcond */
} cy_stc_usb_dev_audio_context_t;
/** \} group_usb_dev_audio_data_structures */
/*******************************************************************************
* Function Prototypes
*******************************************************************************/
/**
* \addtogroup group_usb_dev_audio_functions
* \{
*/
cy_en_usb_dev_status_t Cy_USB_Dev_Audio_Init(void const *config,
cy_stc_usb_dev_audio_context_t *context,
cy_stc_usb_dev_context_t *devContext);
__STATIC_INLINE void Cy_USB_Dev_Audio_RegisterUserCallback(cy_cb_usb_dev_request_received_t requestReceivedHandle,
cy_cb_usb_dev_request_cmplt_t requestCompletedHandle,
cy_stc_usb_dev_audio_context_t *context);
__STATIC_INLINE cy_stc_usb_dev_class_t * Cy_USB_Dev_Audio_GetClass(cy_stc_usb_dev_audio_context_t *context);
/** \} group_usb_dev_audio_functions */
/*******************************************************************************
* API Constants
*******************************************************************************/
/**
* \addtogroup group_usb_dev_audio_macros
* \{
*/
#define CY_USB_DEV_AUDIO_RQST_GET_CUR (0x81u) /**< GET_CUR Audio v1.0 request */
#define CY_USB_DEV_AUDIO_RQST_GET_MIN (0x82u) /**< GET_MIN Audio v1.0 request */
#define CY_USB_DEV_AUDIO_RQST_GET_MAX (0x83u) /**< GET_MAX Audio v1.0 request */
#define CY_USB_DEV_AUDIO_RQST_GET_RES (0x84u) /**< GET_RES Audio v1.0 request */
#define CY_USB_DEV_AUDIO_RQST_GET_MEM (0x85u) /**< GET_MEM Audio v1.0 request */
#define CY_USB_DEV_AUDIO_RQST_GET_STAT (0xFFu) /**< GET_STAT Audio v1.0 request */
#define CY_USB_DEV_AUDIO_RQST_SET_CUR (0x01u) /**< SET_CUR Audio v1.0 request */
#define CY_USB_DEV_AUDIO_RQST_SET_MIN (0x02u) /**< SET_MIN Audio v1.0 request */
#define CY_USB_DEV_AUDIO_RQST_SET_MAX (0x03u) /**< SET_MAX Audio v1.0 request */
#define CY_USB_DEV_AUDIO_RQST_SET_RES (0x04u) /**< SET_RES Audio v1.0 request */
#define CY_USB_DEV_AUDIO_RQST_SET_MEM (0x05u) /**< SET_STAT Audio v1.0 request */
#define CY_USB_DEV_AUDIO2_RQST_CUR (0x01u) /**< CUR Audio v2.0 request */
#define CY_USB_DEV_AUDIO2_RQST_RANGE (0x02u) /**< RANGE Audio v2.0 request */
#define CY_USB_DEV_AUDIO2_RQST_MEM (0x03u) /**< MEM Audio v2.0 request */
#define CY_USB_DEV_AUDIO_MASTER_CHANNEL (0U) /**< Master channel */
#define CY_USB_DEV_AUDIO_VOLUME_MIN (0x8001U) /**< Volume minimum value */
#define CY_USB_DEV_AUDIO_VOLUME_MAX (0x7FFFU) /**< Volume maximum value */
#define CY_USB_DEV_AUDIO_VOLUME_SILENCE (0x8000U) /**< Volume value that represent silence (CUR attribute only) */
#define CY_USB_DEV_AUDIO_VOLUME_MIN_MSB (0x80U) /**< Volume minimum value MSB */
#define CY_USB_DEV_AUDIO_VOLUME_MIN_LSB (0x01U) /**< Volume minimum value LSB */
#define CY_USB_DEV_AUDIO_VOLUME_MAX_MSB (0x7FU) /**< Volume maximum value MSB */
#define CY_USB_DEV_AUDIO_VOLUME_MAX_LSB (0xFFU) /**< Volume maximum value LSB */
/** \} group_usb_dev_audio_macros */
/*******************************************************************************
* Internal Constants
*******************************************************************************/
/*******************************************************************************
* In-line Function Implementation
*******************************************************************************/
/**
* \addtogroup group_usb_dev_audio_functions
* \{
*/
/*******************************************************************************
* Function Name: Cy_USB_Dev_Audio_RegisterUserCallback
****************************************************************************//**
*
* Registers the user callbacks to handle Audio class requests.
*
* \param requestReceivedHandle
* The pointer to a callback function.
* This function is called when setup packet was received from the USB Host but was
* not recognized. Therefore this might require Audio class processing.
* To remove the callback function, pass a NULL as the function pointer.
*
* \param requestCompletedHandle
* The pointer to a callback function.
* This function is called when the USB Device received data from the USB Host
* as part of current request processing. The requestReceivedHandle function
* must enable notification to trigger this event. This makes sense only when class
* request processing requires a data stage.
* To remove the callback function, pass a NULL as the function pointer.
*
* \param context
* The pointer to the context structure \ref cy_stc_usb_dev_context_t allocated
* by the user. The structure is used during the Audio Class operation for
* internal configuration and data retention. The user must not modify anything
* in this structure.
*
*******************************************************************************/
__STATIC_INLINE void Cy_USB_Dev_Audio_RegisterUserCallback(cy_cb_usb_dev_request_received_t requestReceivedHandle,
cy_cb_usb_dev_request_cmplt_t requestCompletedHandle,
cy_stc_usb_dev_audio_context_t *context)
{
Cy_USB_Dev_RegisterClassRequestRcvdCallback(requestReceivedHandle, Cy_USB_Dev_Audio_GetClass(context));
Cy_USB_Dev_RegisterClassRequestCmpltCallback(requestCompletedHandle, Cy_USB_Dev_Audio_GetClass(context));
}
/*******************************************************************************
* Function Name: Cy_USB_Dev_Audio_GetClass
****************************************************************************//**
*
* Returns pointer to the class structure for Audio class.
*
* \param context
* The pointer to the context structure \ref cy_stc_usb_dev_context_t allocated
* by the user. The structure is used during the Audio Class operation for
* internal configuration and data retention. The user must not modify anything
* in this structure.
*
* \return
* Status pointer to the class \ref cy_stc_usb_dev_class_t.
*
*******************************************************************************/
__STATIC_INLINE cy_stc_usb_dev_class_t * Cy_USB_Dev_Audio_GetClass(cy_stc_usb_dev_audio_context_t *context)
{
return &(context->classObj);
}
/** \} group_usb_dev_audio_functions */
#if defined(__cplusplus)
}
#endif
#endif /* (defined(CY_IP_MXUSBFS) || defined(CY_IP_M0S8USBDSS)) */
#endif /* (CY_USB_DEV_AUDIO_H) */
/* [] END OF FILE */
/***************************************************************************//**
* \file cy_usb_dev_audio_descr.h
* \version 2.10
*
* Provides Audio class-specific descriptor defines.
*
********************************************************************************
* \copyright
* (c) 2018-2021, Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation. All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
*******************************************************************************/
#if !defined(CY_USB_DEV_AUDIO_DESCR_H)
#define CY_USB_DEV_AUDIO_DESCR_H
#if (defined(CY_IP_MXUSBFS) || defined(CY_IP_M0S8USBDSS))
#if defined(__cplusplus)
extern "C" {
#endif
/*******************************************************************************
* USB AUDIO
*******************************************************************************/
/** \cond INTERNAL */
/**
* Audio Interface Class, Subclass and Protocol Codes
*/
#define CY_USB_DEV_AUDIO_CLASS (0x01U)
#define CY_USB_DEV_AUDIO_SUBCLASS_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO_SUBCLASS_AUDIO_CONTROL (0x01U)
#define CY_USB_DEV_AUDIO_SUBCLASS_AUDIO_STREAMING (0x02U)
#define CY_USB_DEV_AUDIO_SUBCLASS_MIDI_STREAMING (0x03U)
#define CY_USB_DEV_AUDIO_PROTOCOL_UNDEFINED (0x00U)
/**
* Audio Class-Specific Descriptor Types
*/
#define CY_USB_DEV_AUDIO_CS_UNDEFINED (0x20U)
#define CY_USB_DEV_AUDIO_CS_DEVICE (0x21U)
#define CY_USB_DEV_AUDIO_CS_CONFIGURATION (0x22U)
#define CY_USB_DEV_AUDIO_CS_STRING (0x23U)
#define CY_USB_DEV_AUDIO_CS_INTERFACE (0x24U)
#define CY_USB_DEV_AUDIO_CS_ENDPOINT (0x25U)
/*******************************************************************************
* USB AUDIO version 1.0
*******************************************************************************/
/**
* Audio Class-Specific AC Interface Descriptor Subtypes
*/
#define CY_USB_DEV_AUDIO_AC_DESCRIPTOR_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO_HEADER (0x01U)
#define CY_USB_DEV_AUDIO_INPUT_TERMINAL (0x02U)
#define CY_USB_DEV_AUDIO_OUTPUT_TERMINAL (0x03U)
#define CY_USB_DEV_AUDIO_MIXER_UNIT (0x04U)
#define CY_USB_DEV_AUDIO_SELECTOR_UNIT (0x05U)
#define CY_USB_DEV_AUDIO_FEATURE_UNIT (0x06U)
#define CY_USB_DEV_AUDIO_PROCESSING_UNIT (0x07U)
#define CY_USB_DEV_AUDIO_EXTENSION_UNIT (0x08U)
/**
* Audio Class-Specific AS Interface Descriptor Subtypes
*/
#define CY_USB_DEV_AUDIO_AS_DESCRIPTOR_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO_AS_GENERAL (0x01U)
#define CY_USB_DEV_AUDIO_FORMAT_TYPE (0x02U)
#define CY_USB_DEV_AUDIO_FORMAT_SPECIFIC (0x03U)
/**
* Processing Unit Process Types
*/
#define CY_USB_DEV_AUDIO_PROCESS_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO_UP_DOWNMIX_PROCESS (0x01U)
#define CY_USB_DEV_AUDIO_DOLBY_PROLOGIC_PROCESS (0x02U)
#define CY_USB_DEV_AUDIO_3D_STEREO_EXTENDER_PROCESS (0x03U)
#define CY_USB_DEV_AUDIO_REVERBERATION_PROCESS (0x04U)
#define CY_USB_DEV_AUDIO_CHORUS_PROCESS (0x05U)
#define CY_USB_DEV_AUDIO_DYN_RANGE_COMP_PROCESS (0x06U)
/**
* Audio Class-Specific Endpoint Descriptor Subtypes
*/
#define CY_USB_DEV_AUDIO_DESCRIPTOR_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO_EP_GENERAL (0x01U)
/**
* Terminal Control Selectors
*/
#define USB_AUDIO_TE_CONTROL_UNDEFINED (0x00U)
#define USB_AUDIO_COPY_PROTECT_CONTROL (0x01U)
/**
* Feature Unit Control Selectors
*/
#define CY_USB_DEV_AUDIO_FU_CONTROL_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO_MUTE_CONTROL (0x01U)
#define CY_USB_DEV_AUDIO_VOLUME_CONTROL (0x02U)
#define CY_USB_DEV_AUDIO_BASS_CONTROL (0x03U)
#define CY_USB_DEV_AUDIO_MID_CONTROL (0x04U)
#define CY_USB_DEV_AUDIO_TREBLE_CONTROL (0x05U)
#define CY_USB_DEV_AUDIO_GRAPHIC_EQUALIZER_CONTROL (0x06U)
#define CY_USB_DEV_AUDIO_AUTOMATIC_GAIN_CONTROL (0x07U)
#define CY_USB_DEV_AUDIO_DELAY_CONTROL (0x08U)
#define CY_USB_DEV_AUDIO_BASS_BOOST_CONTROL (0x09U)
#define CY_USB_DEV_AUDIO_LOUDNESS_CONTROL (0x0AU)
/**
* Endpoint Control Selectors
*/
#define CY_USB_DEV_AUDIO_EP_CONTROL_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO_SAMPLING_FREQ_CONTROL (0x01U)
#define CY_USB_DEV_AUDIO_PITCH_CONTROL (0x02U)
/**
* Descriptor Sizes
*/
#define CY_USB_DEV_AUDIO_AC_HEADER_SIZE(a) (8U + (a))
#define CY_USB_DEV_AUDIO_AC_IN_TERM_LENGTH (0x0CU)
#define CY_USB_DEV_AUDIO_AC_FE_UNIT_LENGTH (0x09U)
#define CY_USB_DEV_AUDIO_AC_OUT_TERM_LENGTH (0x09U)
#define CY_USB_DEV_AUDIO_AS_GEN_IF_LENGTH (0x07U)
#define CY_USB_DEV_AUDIO_AS_FORMAT_I_LENGTH (0x0BU)
/**
* Endpoint Control Selectors (AUDIO Table A-19)
*/
#define CY_USB_DEV_AUDIO_CS_SAMPLING_FREQ_CTRL (0x01U) /**< Audio v1.0: sample frequency control selector */
#define CY_USB_DEV_AUDIO_CS_PITCH_CTRL (0x02U) /**< Audio v1.0: pitch control selector */
/**
* Feature Unit Control Selectors (AUDIO Table A-11)
*/
#define CY_USB_DEV_AUDIO_CS_MUTE_CONTROL (0x01U) /**< Audio v1.0: mute control selector */
#define CY_USB_DEV_AUDIO_CS_VOLUME_CONTROL (0x02U) /**< Audio v1.0: volume control selector */
#define CY_USB_DEV_AUDIO_CS_BASS_CONTROL (0x03U) /**< Audio v1.0: bass control selector */
#define CY_USB_DEV_AUDIO_CS_MID_CONTROL (0x04U) /**< Audio v1.0: mid control selector */
#define CY_USB_DEV_AUDIO_CS_TREBLE_CONTROL (0x05U) /**< Audio v1.0: treble control selector */
#define CY_USB_DEV_AUDIO_CS_GRAPHIC_EQUALIZER_CONTROL (0x06U) /**< Audio v1.0: graphic equalizer control selector */
#define CY_USB_DEV_AUDIO_CS_AUTOMATIC_GAIN_CONTROL (0x07U) /**< Audio v1.0: automatic gain control selector */
#define CY_USB_DEV_AUDIO_CS_DELAY_CONTROL (0x08U) /**< Audio v1.0: delay control selector */
#define CY_USB_DEV_AUDIO_CS_BASS_BOOST_CONTROL (0x09U) /**< Audio v1.0: bass control selector */
#define CY_USB_DEV_AUDIO_CS_LOUDNESS_CONTROL (0x0AU) /**< Audio v1.0: loudness control selector */
/*******************************************************************************
* USB AUDIO version 1.0
*******************************************************************************/
/**
* Audio Interface Protocol Codes
*/
#define CY_USB_DEV_AUDIO2_INTERFACE_PROTOCOL_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO2_IP_VERSION_02_00 (0x20U)
/**
* A.7 Audio Function Category Codes
*/
#define CY_USB_DEV_AUDIO2_FUNCTION_SUBCLASS_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO2_FUNCTION_DESKTOP_SPEAKER (0x01U)
#define CY_USB_DEV_AUDIO2_FUNCTION_HOME_THEATER (0x02U)
#define CY_USB_DEV_AUDIO2_FUNCTION_MICROPHONE (0x03U)
#define CY_USB_DEV_AUDIO2_FUNCTION_HEADSET (0x04U)
#define CY_USB_DEV_AUDIO2_FUNCTION_TELEPHONE (0x05U)
#define CY_USB_DEV_AUDIO2_FUNCTION_CONVERTER (0x06U)
#define CY_USB_DEV_AUDIO2_FUNCTION_SOUND_RECORDER (0x07U)
#define CY_USB_DEV_AUDIO2_FUNCTION_IO_BOX (0x08U)
#define CY_USB_DEV_AUDIO2_FUNCTION_MUSICAL_INSTRUMENT (0x09U)
#define CY_USB_DEV_AUDIO2_FUNCTION_PRO_AUDIO (0x0AU)
#define CY_USB_DEV_AUDIO2_FUNCTION_AUDIO_VIDEO (0x0BU)
#define CY_USB_DEV_AUDIO2_FUNCTION_CONTROL_PANEL (0x0CU)
#define CY_USB_DEV_AUDIO2_FUNCTION_OTHER (0xFFU)
/**
* A.9 Audio Class-Specific AC Interface Descriptor Subtypes
*/
#define CY_USB_DEV_AUDIO2_AC_DESCRIPTOR_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO2_HEADER (0x01U)
#define CY_USB_DEV_AUDIO2_INPUT_TERMINAL (0x02U)
#define CY_USB_DEV_AUDIO2_OUTPUT_TERMINAL (0x03U)
#define CY_USB_DEV_AUDIO2_MIXER_UNIT (0x04U)
#define CY_USB_DEV_AUDIO2_SELECTOR_UNIT (0x05U)
#define CY_USB_DEV_AUDIO2_FEATURE_UNIT (0x06U)
#define CY_USB_DEV_AUDIO2_EFFECT_UNIT (0x07U)
#define CY_USB_DEV_AUDIO2_PROCESSING_UNIT_V2 (0x08U)
#define CY_USB_DEV_AUDIO2_EXTENSION_UNIT_V2 (0x09U)
#define CY_USB_DEV_AUDIO2_CLOCK_SOURCE (0x0AU)
#define CY_USB_DEV_AUDIO2_CLOCK_SELECTOR (0x0BU)
#define CY_USB_DEV_AUDIO2_CLOCK_MULTIPLIER (0x0CU)
#define CY_USB_DEV_AUDIO2_SAMPLE_RATE_CONVERTER (0x0DU)
/**
* Audio Class-Specific AS Interface Descriptor Subtypes
*/
#define CY_USB_DEV_AUDIO2_AS_DESCRIPTOR_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO2_AS_GENERAL (0x01U)
#define CY_USB_DEV_AUDIO2_FORMAT_TYPE (0x02U)
#define CY_USB_DEV_AUDIO2_ENCODER (0x03U)
#define CY_USB_DEV_AUDIO2_DECODER (0x04U)
/**
* Audio Class-Specific Endpoint Descriptor Subtypes
*/
#define CY_USB_DEV_AUDIO2_DESCRIPTOR_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO2_EP_GENERAL (0x01U)
/**
* Clock Source Control Selectors
*/
#define CY_USB_DEV_AUDIO2_CS_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO2_CS_CONTROL_SAM_FREQ (0x01U)
#define CY_USB_DEV_AUDIO2_CS_CONTROL_CLOCK_VALID (0x02U)
/**
* Clock Selector Control Selectors
*/
#define CY_USB_DEV_AUDIO2_CX_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO2_CX_CLOCK_SELECTOR (0x01U)
/**
* Clock Multiplier Control Selectors
*/
#define CY_USB_DEV_AUDIO2_CM_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO2_CM_NUMERATOR (0x01U)
#define CY_USB_DEV_AUDIO2_CM_DENOMINTATOR (0x02U)
/**
* Terminal Control Selectors
*/
#define CY_USB_DEV_AUDIO2_TE_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO2_TE_COPY_PROTECT (0x01U)
#define CY_USB_DEV_AUDIO2_TE_CONNECTOR (0x02U)
#define CY_USB_DEV_AUDIO2_TE_OVERLOAD (0x03U)
#define CY_USB_DEV_AUDIO2_TE_CLUSTER (0x04U)
#define CY_USB_DEV_AUDIO2_TE_UNDERFLOW (0x05U)
#define CY_USB_DEV_AUDIO2_TE_OVERFLOW (0x06U)
#define CY_USB_DEV_AUDIO2_TE_LATENCY (0x07U)
/**
* AudioStreaming Interface Control Selectors
*/
#define CY_USB_DEV_AUDIO2_AS_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO2_AS_ACT_ALT_SETTING (0x01U)
#define CY_USB_DEV_AUDIO2_AS_VAL_ALT_SETTINGS (0x02U)
#define CY_USB_DEV_AUDIO2_AS_AUDIO_DATA_FORMAT (0x03U)
/**
* Endpoint Control Selectors
*/
#define CY_USB_DEV_AUDIO2_EP_CS_UNDEFINED (0x00U)
#define CY_USB_DEV_AUDIO2_EP_CS_PITCH (0x01U)
#define CY_USB_DEV_AUDIO2_EP_CS_DATA_OVERRUN (0x02U)
#define CY_USB_DEV_AUDIO2_EP_CS_DATA_UNDERRUN (0x03U)
/** \endcond */
#if defined(__cplusplus)
}
#endif
#endif /* (defined(CY_IP_MXUSBFS) || defined(CY_IP_M0S8USBDSS)) */
#endif /* (CY_USB_DEV_AUDIO_DESCR_H) */
/* [] END OF FILE */
/***************************************************************************//**
* \file cy_usb_dev_cdc_descr.h
* \version 2.10
*
* Provides CDC class-specific descriptor defines.
*
********************************************************************************
* \copyright
* (c) 2018-2021, Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation. All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
*******************************************************************************/
#if !defined(CY_USB_DEV_CDC_DESCR_H)
#define CY_USB_DEV_CDC_DESCR_H
#if (defined(CY_IP_MXUSBFS) || defined(CY_IP_M0S8USBDSS))
#if defined(__cplusplus)
extern "C" {
#endif
/*******************************************************************************
* API Constants
*******************************************************************************/
/** \cond INTERNAL */
/* CDC class */
#define CY_USB_DEV_CDC_CLASS (0x02U)
#define CY_USB_DEV_CDC_CLASS_DATA (0x0AU)
/** \endcond */
#if defined(__cplusplus)
}
#endif
#endif /* (defined(CY_IP_MXUSBFS) || defined(CY_IP_M0S8USBDSS)) */
#endif /* (CY_USB_DEV_CDC_DESCR_H) */
/* [] END OF FILE */
/***************************************************************************//**
* \file cy_usb_dev_descr.h
* \version 2.10
*
* Provides device definition structures and descriptors structures.
* The descriptor structures can be used to access particular descriptors.
*
********************************************************************************
* \copyright
* (c) 2018-2021, Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation. All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
*******************************************************************************/
#if !defined(CY_USB_DEV_DESCR_H)
#define CY_USB_DEV_DESCR_H
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "cy_usb_dev_audio_descr.h"
#include "cy_usb_dev_cdc_descr.h"
#include "cy_usb_dev_hid_descr.h"
#if (defined(CY_IP_MXUSBFS) || defined(CY_IP_M0S8USBDSS))
#if defined(__cplusplus)
extern "C" {
#endif
/*******************************************************************************
* Type Definitions
*******************************************************************************/
/**
* \addtogroup group_usb_dev_structures_device
* \{
*/
/** USBFS Device endpointDescriptor structure */
typedef struct
{
/** Pointer to the endpointDescriptor Descriptor in the Configuration Descriptor */
const uint8_t *endpointDescriptor;
} cy_stc_usb_dev_endpoint_t;
/** USBFS Device HID structure */
typedef struct
{
/** Pointer to the HID Class Descriptor in the Configuration Descriptor */
const uint8_t *hidDescriptor;
/** Pointer to uint8_t array that stores HID Report Descriptor */
const uint8_t *reportDescriptor;
/** HID Report Descriptor size */
uint16_t reportDescriptorSize;
/** Start position of input report IDs in the array */
uint8_t inputReportPos;
/** Number of input report IDs */
uint8_t numInputReports;
/** Array of indexes for input report IDs */
const uint8_t *inputReportIdx;
/** Number of elements in the array of indexes */
uint8_t inputReportIdxSize;
} cy_stc_usb_dev_hid_t;
/** USBFS Device Alternate Interface structure */
typedef struct
{
/** Pointer to the Interface Descriptor in the Configuration Descriptor */
const uint8_t *interfaceDescriptor;
/** Pointer to array of pointers to structure that stores Endpoints information */
const cy_stc_usb_dev_endpoint_t **endpoints;
/** Number of endpoints that belong to this interface alternates */
uint8_t numEndpoints;
/** Pointer to the HID information structure */
const cy_stc_usb_dev_hid_t *hid;
} cy_stc_usb_dev_alternate_t;
/** USBFS Device Interface structure */
typedef struct
{
/** Number of supported alternate settings */
uint8_t numAlternates;
/** Pointer to array of pointers to structure that stores Interface Alternates information */
const cy_stc_usb_dev_alternate_t **alternates;
/** Mask that represents endpoints that belong to Interface Alternates */
uint16_t endpointsMask;
} cy_stc_usb_dev_interface_t;
/** USBFS Device Configuration structure */
typedef struct
{
/** Number of supported interfaces */
uint8_t numInterfaces;
/** Pointer to uint8_t array that stores Configuration Descriptor */
const uint8_t *configDescriptor;
/** Pointer to array of pointers to structure that store Interface information */
const cy_stc_usb_dev_interface_t **interfaces;
} cy_stc_usb_dev_configuration_t;
/** USBFS Device MS OS String Descriptors structure */
typedef struct
{
/** Pointer to MS OS String descriptor */
const uint8_t *msOsDescriptor;
/** Vendor code to get Extended Compat ID and Properties OS Descriptors */
uint8_t msVendorCode;
/** Pointer to Extended Compat ID OS Descriptor */
const uint8_t *extCompatIdDescriptor;
/** Pointer to Extended Properties OS Descriptor */
const uint8_t *extPropertiesDescriptor;
} cy_stc_usb_dev_ms_os_string_t;
/** USBFS Device String Descriptors structure */
typedef struct
{
/** Number of String Descriptors */
uint8_t numStrings;
/** Defines whether the MS OS String is enabled */
bool enableWindowsOsDescriptor;
/** Defines MS OS Strings structures */
const cy_stc_usb_dev_ms_os_string_t *osStringDescriptors;
/** Pointer to array of pointers to String Descriptors */
const uint8_t **stringDescriptors;
} cy_stc_usb_dev_string_t;
/** USBFS Device structure */
typedef struct
{
/** Pointer to uint8_t array that stores Device Descriptor */
const uint8_t *deviceDescriptor;
/** Pointer to uint8_t array that stores BOS Descriptor */
const uint8_t *bosDescriptor;
/** Pointer to structure that stores Strings Descriptors information */
const cy_stc_usb_dev_string_t *strings;
/** Number of supported configurations */
uint8_t numConfigurations;
/** Pointer to array of pointers to structure that stores Configuration information */
const cy_stc_usb_dev_configuration_t **configurations;
} cy_stc_usb_dev_device_t;
/** \} group_usb_dev_structures_device */
/**
* \addtogroup group_usb_dev_structures_device_descr
* \{
*/
/** Device descriptor */
typedef struct
{
uint8_t bLength; /**< Size of the Descriptor in Bytes */
uint8_t bDescriptorType; /**< Constant Device Descriptor */
uint16_t bcdUSB; /**< USB Specification Number to which the device complies */
uint8_t bDeviceClass; /**< Class Code (Assigned by USB Org):
* If equal to Zero, each interface specifies its own class code
* If equal to 0xFF, the class code is vendor specified.
* Otherwise, field is valid Class Code.
*/
uint8_t bDeviceSubClass; /**< Subclass Code (Assigned by USB Org) */
uint8_t bDeviceProtocol; /**< Protocol Code (Assigned by USB Org) */
uint8_t bMaxPacketSize; /**< Maximum Packet Size for Zero Endpoint. Valid Sizes are 8, 16, 32, 64 */
uint16_t idVendor; /**< Vendor ID (Assigned by USB Org) */
uint16_t idProduct; /**< Product ID (Assigned by Manufacturer) */
uint16_t bcdDevice; /**< Release Number */
uint8_t iManufacturer; /**< Index of Manufacturer String Descriptor */
uint8_t iProduct; /**< Index of Product String Descriptor */
uint8_t iSerialNumber; /**< Index of Serial Number String Descriptor */
uint8_t bNumConfigurations;/**< Number of Possible Configurations */
} cy_stc_usbdev_device_descr_t;
/** Configuration descriptor */
typedef struct
{
uint8_t bLength; /**< Size of Descriptor in Bytes */
uint8_t bDescriptorType; /**< Configuration Descriptor */
uint16_t wTotalLength; /**< Total length in bytes of data returned */
uint8_t bNumInterfaces; /**< Number of Interfaces */
uint8_t bConfigurationValue; /**< Value to use as an argument to select this configuration */
uint8_t iConfiguration; /**< Index of String Descriptor describing this configuration */
uint8_t bmAttributes; /**< Bitmap:
* D7 Reserved, set to 1. (USB 1.0 Bus Powered)
* D6 Self Powered
* D5 Remote Wakeup
* D4..0 Reserved, set to 0.
*/
uint8_t bMaxPower; /**< Maximum Power Consumption in 2 mA units */
} cy_stc_usbdev_config_descr_t;
/** Interface descriptor */
typedef struct
{
uint8_t bLength; /**< Size of Descriptor in Bytes (9 Bytes) */
uint8_t bDescriptorType; /**< Interface Descriptor */
uint8_t bInterfaceNumber; /**< Number of Interface */
uint8_t bAlternateSetting; /**< Value used to select alternative setting */
uint8_t bNumEndpoints; /**< Number of Endpoints used for this interface */
uint8_t bInterfaceClass; /**< Class Code (Assigned by USB Org) */
uint8_t bInterfaceSubClass; /**< Subclass Code (Assigned by USB Org) */
uint8_t bInterfaceProtocol; /**< Protocol Code (Assigned by USB Org) */
uint8_t iInterface; /**< Index of String Descriptor describing this interface */
} cy_stc_usbdev_interface_descr_t;
/** Endpoint descriptor */
typedef struct
{
uint8_t bLength; /**< Size of Descriptor in Bytes */
uint8_t bDescriptorType; /**< Endpoint Descriptor */
uint8_t bEndpointAddress; /**< Endpoint Address:
* Bits 0..3 Endpoint Number.
* Bits 4..6 Reserved. Set to Zero
* Bit 7 Direction 0 = Out, 1 = In (Ignored for Control Endpoints)
*/
uint8_t bmAttributes; /**< Bitmap:
* Bits 0..1 Transfer Type: 00 = Control, 01 = Isochronous, 10 = Bulk, 11 = Interrupt
* Bits 2..7 are reserved. If Isochronous endpoint,
* Bits 3..2: Synchronization
* Type (Iso Mode): 00 = No Synchronization, 01 = Asynchronous, 10 = Adaptive, 11 = Synchronous
* Bits 5..4 = Usage Type (Iso Mode): 00 = Data Endpoint, 01 = Feedback Endpoint,
* 10 = Explicit Feedback Data Endpoint, 11 = Reserved
*/
uint16_t wMaxPacketSize; /**< Maximum Packet Size this endpoint is capable of sending or receiving */
uint8_t bInterval; /**< Interval for polling endpoint data transfers. Value in frame counts.
* Ignored for Bulk & Control Endpoints.
* Isochronous must equal 1 and field may range from 1 to 255 for interrupt endpoints.
*/
} cy_stc_usbdev_endpoint_descr_t;
/** \} group_usb_dev_structures_device_descr */
/*******************************************************************************
* Macro for generation code usage
*******************************************************************************/
/**
* \addtogroup group_usb_dev_macros_device_descr
* \{
*/
#define CY_USB_DEV_USB_VERSION_2_0 (0x0200U) /**< USB Specification Release Number 2.0 */
#define CY_USB_DEV_USB_VERSION_2_1 (0x0201U) /**< USB Specification Release Number 2.1 */
/* USB v2.0 spec: Table 9-5. Descriptor Types */
#define CY_USB_DEV_DEVICE_DESCR (1U) /**< Device Descriptor type */
#define CY_USB_DEV_CONFIG_DESCR (2U) /**< Device Configuration Descriptor type */
#define CY_USB_DEV_STRING_DESCR (3U) /**< Device String Descriptor type */
#define CY_USB_DEV_INTERFACE_DESCR (4U) /**< Device Interface Descriptor type */
#define CY_USB_DEV_ENDPOINT_DESCR (5U) /**< Device Endpoint Descriptor type */
#define CY_USB_DEV_DEVICE_QUALIFIER_DESCR (6U) /**< Device Qualifier Descriptor type */
#define CY_USB_DEV_OTHER_SPEED_CFG_DESCR (7U) /**< Device Other Speed Descriptor type */
#define CY_USB_DEV_INTERFACE_POWER_DESCR (8U) /**< Device Interface Power Descriptor type */
#define CY_USB_DEV_BOS_DESCR (15U) /**< Device BOS Descriptor type */
/* MS OS String Descriptors */
#define CY_USB_DEV_MS_OS_STRING_EXT_COMPAT_ID (4U) /**< Extended Compat ID OS Descriptor */
#define CY_USB_DEV_MS_OS_STRING_EXT_PROPERTEIS (5U) /**< Extended Properties OS Descriptor */
/* Standard descriptor lengths */
#define CY_USB_DEV_DEVICE_DESCR_LENGTH (18U) /**< Device Descriptor length */
#define CY_USB_DEV_CONFIG_DESCR_LENGTH (9U) /**< Device Configuration Descriptor length */
#define CY_USB_DEV_INTERFACE_DESCR_LENGTH (9U) /**< Device Interface Descriptor length */
#define CY_USB_DEV_ENDPOINT_DESCR_LENGTH (7U) /**< Device Endpoint Descriptor length */
#define CY_USB_DEV_BOS_DESCR_LENGTH (5U) /**< Device BOS Descriptor length */
/* String Language ID length */
#define CY_USB_DEV_STRING_DESCR_LANG_ID_LENGTH (4U) /**< Device String LANG ID Descriptor length */
/* bmAttributes in endpoint descriptor */
#define CY_USB_DEV_EP_CONTROL (0x00U) /**< Control Transfer type */
#define CY_USB_DEV_EP_ISOCHRONOUS (0x01U) /**< Isochronous Transfer type */
#define CY_USB_DEV_EP_BULK (0x02U) /**< Bulk Transfer type */
#define CY_USB_DEV_EP_INTERRUPT (0x03U) /**< Interrupt Transfer type */
#define CY_USB_DEV_EP_TRANS_TYPE_MASK (0x03U) /**< Transfer type mask */
/* For isochronous endpoints only */
#define CY_USB_DEV_EP_NO_SYNCHRONIZATION (0x00U) /**< No Synchronization of Isochronous endpoint */
#define CY_USB_DEV_EP_ASYNCHRONOUS (0x04U) /**< Asynchronous Isochronous endpoint */
#define CY_USB_DEV_EP_ADAPTIVE (0x08U) /**< Adaptive Isochronous endpoint */
#define CY_USB_DEV_EP_SYNCHRONOUS (0x0CU) /**< Synchronous Isochronous endpoint */
#define CY_USB_DEV_EP_DATA (0x00U) /**< Data Isochronous endpoint */
#define CY_USB_DEV_EP_FEEDBACK (0x10U) /**< Feedback Isochronous endpoint */
#define CY_USB_DEV_EP_IMPLICIT_FEEDBACK (0x20U) /**< Implicit feedback Isochronous endpoint */
/** \} group_usb_dev_macros_device_descr */
#if defined(__cplusplus)
}
#endif
#endif /* (defined(CY_IP_MXUSBFS) || defined(CY_IP_M0S8USBDSS)) */
#endif /* (CY_USB_DEV_DESCR_H) */
/* [] END OF FILE */
此差异已折叠。
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>psoc6-pioneerkit_modus</name>
<comment></comment>
<projects>
<name>dist_ide_project</name>
<comment />
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>com.cypress.studio.app.cymodusnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>com.cypress.studio.app.cymodusnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<linkedResources />
</projectDescription>
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册