diff --git a/demo/es32/usb_device/ES32F369x/Inc/ald_conf.h b/demo/es32/usb_device/ES32F369x/Inc/ald_conf.h new file mode 100644 index 00000000..e0123e76 --- /dev/null +++ b/demo/es32/usb_device/ES32F369x/Inc/ald_conf.h @@ -0,0 +1,213 @@ +/** + ********************************************************************************* + * + * @file ald_conf.h + * @brief Enable/Disable the peripheral module. + * + * @version V1.0 + * @date 26 Jun 2019 + * @author AE Team + * @note + * Change Logs: + * Date Author Notes + * 26 Jun 2019 AE Team The first version + * + * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ********************************************************************************** + */ + + +#ifndef __ALD_CONF_H__ +#define __ALD_CONF_H__ + + +#define ALD_DMA +#define ALD_GPIO +#define ALD_UART +#define ALD_I2C +#define ALD_CMU +#define ALD_RMU +#define ALD_PMU +#define ALD_WDT +#define ALD_LCD +#define ALD_RTC +#define ALD_CAN +#define ALD_FLASH +#define ALD_ADC +#define ALD_CRC +#define ALD_CRYPT +#define ALD_TIMER +#define ALD_LPTIM +#define ALD_PIS +#define ALD_SPI +#define ALD_CALC +#define ALD_ACMP +#define ALD_OPAMP +#define ALD_TRNG +#define ALD_TSENSE +#define ALD_BKPC +#define ALD_DAC +#define ALD_IAP +#define ALD_I2S +#define ALD_ECC +#define ALD_NAND +#define ALD_QSPI +#define ALD_NOR +#define ALD_SRAM +#define ALD_USB +#define ALD_NOR_LCD +#define ALD_SYSCFG +#define ALD_RTCHW +#if defined(ALD_NAND) || defined(ALD_NOR) || defined(ALD_SRAM) +#define ALD_EBI +#endif + +#ifdef ALD_GPIO + #include "ald_gpio.h" +#endif /*ALD_GPIO */ + +#ifdef ALD_DMA + #include "ald_dma.h" +#endif /* ALD_DMA */ + +#ifdef ALD_UART + #include "ald_uart.h" +#endif /* ALD_UART */ + +#ifdef ALD_I2C + #include "ald_i2c.h" +#endif /* ALD_I2C */ + +#ifdef ALD_CMU + #include "ald_cmu.h" +#endif /* ALD_CMU */ + +#ifdef ALD_RMU + #include "ald_rmu.h" +#endif /* ALD_RMU */ + +#ifdef ALD_PMU + #include "ald_pmu.h" +#endif /* ALD_PUM */ + +#ifdef ALD_WDT + #include "ald_wdt.h" +#endif /* ALD_WDT */ + +#ifdef ALD_RTC + #include "ald_rtc.h" +#endif /* ALD_RTC */ + +#ifdef ALD_FLASH + #include "ald_flash.h" +#endif /*ALD_FLASH*/ + +#ifdef ALD_ADC + #include "ald_adc.h" +#endif /* ALD_ADC */ + +#ifdef ALD_CRC + #include "ald_crc.h" +#endif /* ALD_CRC */ + +#ifdef ALD_CRYPT + #include "ald_crypt.h" +#endif /* ALD_CRYPT */ + +#ifdef ALD_TIMER + #include "ald_timer.h" +#endif /* ALD_TIMER */ + +#ifdef ALD_PIS + #include "ald_pis.h" +#endif /* ALD_PIS */ + +#ifdef ALD_SPI + #include "ald_spi.h" +#endif /* ALD_SPI */ + +#ifdef ALD_CALC + #include "ald_calc.h" +#endif /* ALD_CALC */ + +#ifdef ALD_ACMP + #include "ald_acmp.h" +#endif /* ALD_ACMP */ + +#ifdef ALD_TRNG + #include "ald_trng.h" +#endif /* ALD_TRNG */ + +#ifdef ALD_TSENSE + #include "ald_tsense.h" +#endif /* ALD_TSENSE */ + +#ifdef ALD_BKPC + #include "ald_bkpc.h" +#endif /* ALD_BKPC */ + +#ifdef ALD_DAC + #include "ald_dac.h" +#endif /* ALD_DAC */ + +#ifdef ALD_IAP + #include "ald_iap.h" +#endif /* ALD_IAP */ + +#ifdef ALD_CAN + #include "ald_can.h" +#endif /* ALD_CAN */ + +#ifdef ALD_QSPI + #include "ald_qspi.h" +#endif /* ALD_QSPI */ + +#ifdef ALD_USB + #include "ald_usb.h" +#endif /* ALD_USB */ + +#ifdef ALD_SRAM + #include "ald_sram.h" +#endif /* ALD_SRAM */ + +#ifdef ALD_EBI + #include "ald_ebi.h" +#endif /* ALD_EBI */ + +#ifdef ALD_NAND + #include "ald_nand.h" +#endif /* ALD_NAND */ + +#ifdef ALD_NOR_LCD + #include "ald_nor_lcd.h" +#endif /* ALD_NOR_LCD */ + +#ifdef ALD_I2S + #include "ald_i2s.h" +#endif /* ALD_I2S */ + +#ifdef ALD_SYSCFG + #include "ald_syscfg.h" +#endif /* ALD_SYSCFG */ + +#ifdef ALD_RTCHW + #include "ald_rtchw.h" +#endif /* ALD_RTCHW */ + +#define TICK_INT_PRIORITY 3 + +#endif diff --git a/demo/es32/usb_device/ES32F369x/Inc/main.h b/demo/es32/usb_device/ES32F369x/Inc/main.h new file mode 100644 index 00000000..6060da8b --- /dev/null +++ b/demo/es32/usb_device/ES32F369x/Inc/main.h @@ -0,0 +1,47 @@ +/** + ********************************************************************************* + * + * @file main.h + * @brief Header file for DEMO + * + * @version V1.0 + * @date 26 Jun 2019 + * @author AE Team + * @note + * Change Logs: + * Date Author Notes + * 26 Jun 2019 AE Team The first version + * + * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ********************************************************************************** + */ + +#ifndef __MAIN_H__ +#define __MAIN_H__ + +#include "ald_conf.h" + +typedef struct env_s { + uint8_t conn; + uint8_t update; + uint32_t button; + int32_t x_pos; + int32_t y_pos; +} env_t; + +extern env_t env; +#endif diff --git a/demo/es32/usb_device/ES32F369x/MDK-ARM/example.uvoptx b/demo/es32/usb_device/ES32F369x/MDK-ARM/example.uvoptx new file mode 100644 index 00000000..efd32625 --- /dev/null +++ b/demo/es32/usb_device/ES32F369x/MDK-ARM/example.uvoptx @@ -0,0 +1,513 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj; *.o + *.lib + *.txt; *.h; *.inc; *.md + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + target + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 255 + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 0 + 0 + 6 + + + + + + + + + + + STLink\ST-LINKIII-KEIL_SWO.dll + + + + 0 + ST-LINKIII-KEIL_SWO + -U066EFF555453774987091527 -O207 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0es32f36xx.FLM -FS00 -FL080000 -FP0($$Device:ES32F3696LT$Flash\es32f36xx.FLM) + + + 0 + CMSIS_AGDI + -X"essemi CMSIS-DAP" -U0001A000000A -O495 -S0 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0es32f36xx.FLM -FS00 -FL080000 -FP0($$Device:ES32F3696LT$Flash\es32f36xx.FLM) + + + 0 + DLGUARM + (105=-1,-1,-1,-1,0) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 ) -FN1 -FC1000 -FD20000000 -FF0es32f36xx -FL080000 -FS00 -FP0($$Device:ES32F3696LT$Flash\es32f36xx.FLM) + + + 0 + JL2CM3 + -U788594195 -O78 -S5 -ZTIFSpeedSel1000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO23 -FD20000000 -FC4000 -FN1 -FF0es32f36xx.FLM -FS00 -FL080000 -FP0($$Device:ES32F3696LT$Flash\es32f36xx.FLM) + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGDARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0) + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + -T0 + + + + + 0 + 0 + 319 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\..\port\musb\usb_dc_musb.c + + +
+ + 1 + 0 + 320 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + ..\..\..\..\..\port\musb\usb_dc_musb.c + + +
+
+ + + 1 + 1 + 0x40086510 + 0 + + + + + 2 + 2 + 0x40000000 + 0 + + + + + 3 + 2 + 0x00000000 + 0 + + + + + 4 + 2 + 0x5000 + 0 + + + + 0 + + + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + 0 + 0 + 0 + + + + + + + + +
+
+ + + startup + 0 + 0 + 0 + 0 + + 1 + 1 + 2 + 0 + 0 + 0 + ..\Drivers\CMSIS\Device\EastSoft\ES32F36xx\Startup\keil\startup_es32f36xx.s + startup_es32f36xx.s + 0 + 0 + + + + + ald + 1 + 0 + 0 + 0 + + 2 + 2 + 1 + 0 + 0 + 0 + ..\Drivers\ALD\ES32F36xx\Source\ald_bkpc.c + ald_bkpc.c + 0 + 0 + + + 2 + 3 + 1 + 0 + 0 + 0 + ..\Drivers\ALD\ES32F36xx\Source\ald_cmu.c + ald_cmu.c + 0 + 0 + + + 2 + 4 + 1 + 0 + 0 + 0 + ..\Drivers\ALD\ES32F36xx\Source\ald_dma.c + ald_dma.c + 0 + 0 + + + 2 + 5 + 1 + 0 + 0 + 0 + ..\Drivers\ALD\ES32F36xx\Source\ald_gpio.c + ald_gpio.c + 0 + 0 + + + 2 + 6 + 1 + 0 + 0 + 0 + ..\Drivers\ALD\ES32F36xx\Source\ald_pmu.c + ald_pmu.c + 0 + 0 + + + 2 + 7 + 1 + 0 + 0 + 0 + ..\Drivers\ALD\ES32F36xx\Source\ald_rmu.c + ald_rmu.c + 0 + 0 + + + 2 + 8 + 1 + 0 + 0 + 0 + ..\Drivers\ALD\ES32F36xx\Source\ald_uart.c + ald_uart.c + 0 + 0 + + + 2 + 9 + 1 + 0 + 0 + 0 + ..\Drivers\ALD\ES32F36xx\Source\ald_usb.c + ald_usb.c + 0 + 0 + + + 2 + 10 + 1 + 0 + 0 + 0 + ..\Drivers\ALD\ES32F36xx\Source\ald_iap.c + ald_iap.c + 0 + 0 + + + 2 + 11 + 1 + 0 + 0 + 0 + ..\Drivers\ALD\ES32F36xx\Source\utils.c + utils.c + 0 + 0 + + + + + app + 1 + 0 + 0 + 0 + + 3 + 12 + 1 + 0 + 0 + 0 + ..\Src\main.c + main.c + 0 + 0 + + + 3 + 13 + 1 + 0 + 0 + 0 + ..\Src\irq.c + irq.c + 0 + 0 + + + 3 + 14 + 1 + 0 + 0 + 0 + ..\..\..\..\cdc_acm_template.c + cdc_acm_template.c + 0 + 0 + + + + + CherryUSB + 1 + 0 + 0 + 0 + + 4 + 15 + 1 + 0 + 0 + 0 + ..\..\..\..\..\core\usbd_core.c + usbd_core.c + 0 + 0 + + + 4 + 16 + 1 + 0 + 0 + 0 + ..\..\..\..\..\class\cdc\usbd_cdc.c + usbd_cdc.c + 0 + 0 + + + 4 + 17 + 1 + 0 + 0 + 0 + ..\..\..\..\..\port\musb\usb_dc_musb.c + usb_dc_musb.c + 0 + 0 + + + +
diff --git a/demo/es32/usb_device/ES32F369x/MDK-ARM/example.uvprojx b/demo/es32/usb_device/ES32F369x/MDK-ARM/example.uvprojx new file mode 100644 index 00000000..0f57c065 --- /dev/null +++ b/demo/es32/usb_device/ES32F369x/MDK-ARM/example.uvprojx @@ -0,0 +1,524 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + target + 0x4 + ARM-ADS + 6140001::V6.14.1::ARMCLANG + 6140001::V6.14.1::ARMCLANG + 1 + + + ES32F3696LT + Eastsoft + Eastsoft.ES32_DFP.1.0.10 + http://www.essemi.com/index/article/download?id=921 + IRAM(0x20000000,0x00018000) IROM(0x00000000,0x00080000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0es32f36xx -FS00 -FL080000 -FP0($$Device:ES32F3696LT$Flash\es32f36xx.FLM)) + 0 + $$Device:ES32F3696LT$Device\Include\es32f36xx.h + + + + + + + + + + $$Device:ES32F3696LT$SVD\es32f3xx.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\obj\ + out + 1 + 0 + 1 + 1 + 1 + .\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -MPU + DCM.DLL + -pCM3 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM3 + + + + 1 + 0 + 0 + 0 + 16 + + + + + 1 + 0 + 0 + 1 + 1 + 4096 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M3" + + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 8 + 1 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x18000 + + + 1 + 0x0 + 0x80000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x80000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x18000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 2 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 3 + 0 + 0 + 0 + 0 + 0 + 3 + 3 + 1 + 1 + 0 + 0 + 0 + + + USE_ASSERT,ES32F36xx,USBD_CDC_HS + + ..\Drivers\CMSIS\Include;..\Drivers\CMSIS\Device\EastSoft\ES32F36xx\Include;..\Drivers\ALD\ES32F36xx\Include;..\Inc;..\..\..\..\..\common;..\..\..\..\..\core;..\..\..\..\..\class\cdc + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 4 + + + + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0x00000000 + 0x00000000 + + + + + + + + + + + + + startup + + + startup_es32f36xx.s + 2 + ..\Drivers\CMSIS\Device\EastSoft\ES32F36xx\Startup\keil\startup_es32f36xx.s + + + + + ald + + + ald_bkpc.c + 1 + ..\Drivers\ALD\ES32F36xx\Source\ald_bkpc.c + + + ald_cmu.c + 1 + ..\Drivers\ALD\ES32F36xx\Source\ald_cmu.c + + + ald_dma.c + 1 + ..\Drivers\ALD\ES32F36xx\Source\ald_dma.c + + + ald_gpio.c + 1 + ..\Drivers\ALD\ES32F36xx\Source\ald_gpio.c + + + ald_pmu.c + 1 + ..\Drivers\ALD\ES32F36xx\Source\ald_pmu.c + + + ald_rmu.c + 1 + ..\Drivers\ALD\ES32F36xx\Source\ald_rmu.c + + + ald_uart.c + 1 + ..\Drivers\ALD\ES32F36xx\Source\ald_uart.c + + + ald_usb.c + 1 + ..\Drivers\ALD\ES32F36xx\Source\ald_usb.c + + + ald_iap.c + 1 + ..\Drivers\ALD\ES32F36xx\Source\ald_iap.c + + + utils.c + 1 + ..\Drivers\ALD\ES32F36xx\Source\utils.c + + + + + app + + + main.c + 1 + ..\Src\main.c + + + irq.c + 1 + ..\Src\irq.c + + + cdc_acm_template.c + 1 + ..\..\..\..\cdc_acm_template.c + + + + + CherryUSB + + + usbd_core.c + 1 + ..\..\..\..\..\core\usbd_core.c + + + usbd_cdc.c + 1 + ..\..\..\..\..\class\cdc\usbd_cdc.c + + + usb_dc_musb.c + 1 + ..\..\..\..\..\port\musb\usb_dc_musb.c + + + + + + + + + + + + + RTE\Device\ES32F0031XNLN\startup_es32f0xx.s + + + + + + RTE\Device\ES32F0334LX\startup_es32f0xx.s + + + + + + RTE\Device\ES32F0356NLXN\startup_es32f0xx.s + + + + + + RTE\Device\ES32F0396XNLN\startup_es32f0xx.s + + + + + + + +
diff --git a/demo/es32/usb_device/ES32F369x/Src/irq.c b/demo/es32/usb_device/ES32F369x/Src/irq.c new file mode 100644 index 00000000..3b7f32b4 --- /dev/null +++ b/demo/es32/usb_device/ES32F369x/Src/irq.c @@ -0,0 +1,177 @@ +/** + ********************************************************************************* + * + * @file irq.c + * @brief Interrupt handler + * + * @version V1.0 + * @date 26 Jun 2019 + * @author AE Team + * @note + * Change Logs: + * Date Author Notes + * 26 Jun 2019 AE Team The first version + * + * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ********************************************************************************** + */ + +#include "main.h" +#include "utils.h" +#include "ald_cmu.h" +#ifdef ALD_DMA +#include "ald_dma.h" +#endif + + +/** @addtogroup Projects_Examples_ALD + * @{ + */ + +/** @addtogroup Examples + * @{ + */ + +/** + * @brief NMI IRQ handler + * @retval None + */ +void NMI_Handler(void) +{ + /* Added Emergency operation */ + return; +} + +/** + * @brief Hardfault IRQ handler + * @retval None + */ +void HardFault_Handler(void) +{ + /* Added debug information */ + while (1) + ; +} + +/** + * @brief MemManage IRQ handler + * @retval None + */ +void MemManage_Handler(void) +{ + /* Added debug information */ + while (1) + ; +} + +/** + * @brief BusFault IRQ handler + * @retval None + */ +void BusFault_Handler(void) +{ + /* Added debug information */ + while (1) + ; +} + +/** + * @brief UsageFault IRQ handler + * @retval None + */ +void UsageFault_Handler(void) +{ + /* Added debug information */ + while (1) + ; +} + +/** + * @brief Supervisor Call IRQ handler + * @retval None + */ +void SVC_Handler(void) +{ + /* Added system callback */ + return; +} + +/** + * @brief Debug Monitor IRQ handler + * @retval None + */ +void DebugMon_Handler(void) +{ + /* Added debug operation */ + return; +} + +/** + * @brief PendSV IRQ handler + * @retval None + */ +void PendSV_Handler(void) +{ + /* Added thread switching operation */ + return; +} + +/** + * @brief SysTick IRQ handler + * @retval None + */ +void SysTick_Handler(void) +{ + ald_inc_tick(); + return; +} + +#ifdef ALD_DMA +/** + * @brief DMA IRQ#66 handler + * @retval None + */ +void DMA_Handler(void) +{ + ald_dma_irq_handler(); +} +#endif + + +/** + * @brief USB IRQ#70 handler + * @retval None + */ +//void USB_INT_Handler() +//{ +// usb0_device_int_handler(); +//} + +/** + * @brief USB_DMA IRQ#71 handler + * @retval None + */ +//void USB_DMA_Handler() +//{ +// usb0_dma_int_handler(); +//} +/** + * @} + */ +/** + * @} + */ diff --git a/demo/es32/usb_device/ES32F369x/Src/main.c b/demo/es32/usb_device/ES32F369x/Src/main.c new file mode 100644 index 00000000..eabad9c7 --- /dev/null +++ b/demo/es32/usb_device/ES32F369x/Src/main.c @@ -0,0 +1,164 @@ +/** + ********************************************************************************* + * + * @file main.c + * @brief Main file for DEMO + * + * @version V1.0 + * @date 26 Jun 2019 + * @author AE Team + * @note + * Change Logs: + * Date Author Notes + * 26 Jun 2019 AE Team The first version + * + * Copyright (C) Shanghai Eastsoft Microelectronics Co. Ltd. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + ********************************************************************************** + */ + +#include +#include "stdio.h" +#include "main.h" +#include "usbd_core.h" +#include "usbd_cdc.h" + uart_handle_t h_uart = {0}; +/** @addtogroup Projects_Examples_USB + * @{ + */ +int fputc(int ch, FILE *f) +{ + ald_uart_send(&h_uart, (uint8_t*)&ch, 1, 1000); + return ch; +} + +/** + * @brief Initializate pin of USB. + * @retval None + */ +void usb_pin_init(void) +{ + gpio_init_t x; + + /* Initialize vbus pin */ + x.mode = GPIO_MODE_OUTPUT; + x.odos = GPIO_PUSH_PULL; + x.pupd = GPIO_PUSH_UP; + x.podrv = GPIO_OUT_DRIVE_6; + x.nodrv = GPIO_OUT_DRIVE_6; + x.flt = GPIO_FILTER_DISABLE; + x.type = GPIO_TYPE_TTL; + x.func = GPIO_FUNC_5; + ald_gpio_init(GPIOB, GPIO_PIN_15, &x); + + return; +} +/** + * @brief Initializate pin of uart module. + * @retval None + */ +void uart_pin_init(void) +{ + gpio_init_t x; + + /* Initialize tx pin */ + x.mode = GPIO_MODE_OUTPUT; + x.odos = GPIO_PUSH_PULL; + x.pupd = GPIO_PUSH_UP; + x.podrv = GPIO_OUT_DRIVE_1; + x.nodrv = GPIO_OUT_DRIVE_0_1; + x.flt = GPIO_FILTER_DISABLE; + x.type = GPIO_TYPE_TTL; + x.func = GPIO_FUNC_3; + ald_gpio_init(GPIOB, GPIO_PIN_10, &x); + + /* Initialize rx pin */ + x.mode = GPIO_MODE_INPUT; + x.odos = GPIO_PUSH_PULL; + x.pupd = GPIO_PUSH_UP; + x.podrv = GPIO_OUT_DRIVE_1; + x.nodrv = GPIO_OUT_DRIVE_0_1; + x.flt = GPIO_FILTER_DISABLE; + x.type = GPIO_TYPE_TTL; + x.func = GPIO_FUNC_3; + ald_gpio_init(GPIOB, GPIO_PIN_11, &x); + + /* Initialize uart */ + h_uart.perh = UART0; + h_uart.init.baud = 115200; + h_uart.init.word_length = UART_WORD_LENGTH_8B; + h_uart.init.stop_bits = UART_STOP_BITS_1; + h_uart.init.parity = UART_PARITY_NONE; + h_uart.init.mode = UART_MODE_UART; + h_uart.init.fctl = UART_HW_FLOW_CTL_DISABLE; + h_uart.tx_cplt_cbk = NULL; + h_uart.rx_cplt_cbk = NULL; + h_uart.error_cbk = NULL; + ald_uart_init(&h_uart); + +} + +void usb_dc_low_level_init(void) +{ + ald_pmu_perh_power_config(PMU_POWER_USB, ENABLE); + ald_cmu_perh_clock_config(CMU_PERH_USB, ENABLE); + ald_cmu_perh_clock_config(CMU_PERH_GPIO, ENABLE); + ald_cmu_usb_clock_config(CMU_USB_CLOCK_SEL_HOSC, CMU_USB_DIV_1); + ald_rmu_reset_periperal(RMU_PERH_USB); + ald_mcu_irq_config(USB_INT_IRQn, 2, 2, ENABLE); + ald_mcu_irq_config(USB_DMA_IRQn, 2, 2, ENABLE); + usb_pin_init(); +} + +void delay(uint32_t delay_us) +{ +while(delay_us--) +{} +} +/** + * @brief Test main function + * @retval Status. + */ +int main() +{ + int i; + + /* Initialize ALD */ + ald_cmu_init(); + /* Configure system clock */ + ald_cmu_pll1_config(CMU_PLL1_INPUT_HOSC_3, CMU_PLL1_OUTPUT_48M); + ald_cmu_clock_config(CMU_CLOCK_PLL1, 48000000); + ald_cmu_perh_clock_config(CMU_PERH_ALL, ENABLE); + + uart_pin_init(); + printf("\rSystem start...\r\n"); + + extern void cdc_acm_init(void); + cdc_acm_init(); + + while (1) { + extern void cdc_acm_data_send_with_dtr_test(void); + cdc_acm_data_send_with_dtr_test(); + delay(0xfffffff); + } +} + +/** + * @} + */ +/** + * @} + */ diff --git a/demo/es32/usb_device/ES32F369x/copy Drivers from es32 sdk here.txt b/demo/es32/usb_device/ES32F369x/copy Drivers from es32 sdk here.txt new file mode 100644 index 00000000..e69de29b