├── CPLD └── DSO_LA │ ├── dso.qpf │ ├── dso.qsf │ ├── dso.sdc │ ├── src │ ├── addr_gen.v │ ├── cntn.v │ ├── dsc.v │ ├── dso.v │ ├── dso_trig.v │ ├── la_trig.v │ ├── mux21n.v │ ├── reg_rw.v │ ├── rw_ctrl.v │ ├── smpl_deci.v │ ├── sspi.v │ └── wave_trig.v │ └── testbench │ ├── addr_tb.v │ ├── deci_tb.v │ ├── dso_tb.v │ ├── rw_tb.v │ ├── sspi_tb.v │ └── trig_tb.v ├── Doc ├── CPLD寄存器定义.xlsx ├── DSO种类规划.txt ├── WiDSO规划.txt ├── 时序 │ ├── readme.txt │ ├── trig.tim │ ├── wave_rd_div5.tim │ ├── wave_rw_div5.tim │ ├── wave_wr_div5.tim │ └── wr_end.tim └── 管脚分配和关联.xlsx ├── Hardware └── WiDSC │ ├── DSPComm.Harness │ ├── DSPComm.SchDoc │ ├── ExtConn.SchDoc │ ├── PowerMisc.SchDoc │ ├── SampleCtrl.Harness │ ├── SampleCtrl.SchDoc │ ├── WiDSO.PcbDoc │ ├── WiDSO.PcbLib │ ├── WiDSO.PrjPcb │ ├── WiDSO.SchDoc │ └── WiDSO.SchLib ├── Image ├── WiDSC_3D.jpg ├── WiDSC_PCB.jpg ├── jtag_bitbang.jpg └── jtag_shift.jpg ├── LICENSE.txt ├── MCU ├── BootLoader │ ├── MDK-ARM │ │ ├── RTE │ │ │ └── RTE_Components.h │ │ ├── USBBootLoader.uvoptx │ │ └── USBBootLoader.uvprojx │ ├── clean.bat │ ├── drv │ │ ├── base.h │ │ ├── config.h │ │ ├── led.c │ │ ├── led.h │ │ ├── spi_flash.c │ │ ├── spi_flash.h │ │ ├── timebase.c │ │ └── timebase.h │ ├── readme.txt │ ├── src │ │ └── main.c │ ├── sys │ │ ├── startup_stm32f10x_md.s │ │ ├── stm32_it.c │ │ ├── stm32_it.h │ │ ├── stm32f10x_conf.h │ │ └── system_stm32f10x.c │ └── udisk │ │ ├── hw_config.c │ │ ├── hw_config.h │ │ ├── mass_mal.c │ │ ├── mass_mal.h │ │ ├── memory.c │ │ ├── memory.h │ │ ├── scsi_data.c │ │ ├── usb_bot.c │ │ ├── usb_bot.h │ │ ├── usb_conf.h │ │ ├── usb_desc.c │ │ ├── usb_desc.h │ │ ├── usb_endp.c │ │ ├── usb_istr.c │ │ ├── usb_istr.h │ │ ├── usb_prop.c │ │ ├── usb_prop.h │ │ ├── usb_pwr.c │ │ ├── usb_pwr.h │ │ ├── usb_scsi.c │ │ └── usb_scsi.h ├── Libraries │ ├── CMSIS │ │ ├── CMSIS END USER LICENCE AGREEMENT.pdf │ │ ├── Device │ │ │ └── ST │ │ │ │ └── STM32F10x │ │ │ │ ├── Include │ │ │ │ ├── stm32f10x.h │ │ │ │ └── system_stm32f10x.h │ │ │ │ ├── Release_Notes.html │ │ │ │ └── Source │ │ │ │ └── Templates │ │ │ │ ├── TASKING │ │ │ │ └── cstart_thumb2.asm │ │ │ │ ├── TrueSTUDIO │ │ │ │ ├── startup_stm32f10x_cl.s │ │ │ │ ├── startup_stm32f10x_hd.s │ │ │ │ ├── startup_stm32f10x_hd_vl.s │ │ │ │ ├── startup_stm32f10x_ld.s │ │ │ │ ├── startup_stm32f10x_ld_vl.s │ │ │ │ ├── startup_stm32f10x_md.s │ │ │ │ ├── startup_stm32f10x_md_vl.s │ │ │ │ └── startup_stm32f10x_xl.s │ │ │ │ ├── arm │ │ │ │ ├── startup_stm32f10x_cl.s │ │ │ │ ├── startup_stm32f10x_hd.s │ │ │ │ ├── startup_stm32f10x_hd_vl.s │ │ │ │ ├── startup_stm32f10x_ld.s │ │ │ │ ├── startup_stm32f10x_ld_vl.s │ │ │ │ ├── startup_stm32f10x_md.s │ │ │ │ ├── startup_stm32f10x_md_vl.s │ │ │ │ └── startup_stm32f10x_xl.s │ │ │ │ ├── gcc_ride7 │ │ │ │ ├── startup_stm32f10x_cl.s │ │ │ │ ├── startup_stm32f10x_hd.s │ │ │ │ ├── startup_stm32f10x_hd_vl.s │ │ │ │ ├── startup_stm32f10x_ld.s │ │ │ │ ├── startup_stm32f10x_ld_vl.s │ │ │ │ ├── startup_stm32f10x_md.s │ │ │ │ ├── startup_stm32f10x_md_vl.s │ │ │ │ └── startup_stm32f10x_xl.s │ │ │ │ ├── iar │ │ │ │ ├── startup_stm32f10x_cl.s │ │ │ │ ├── startup_stm32f10x_hd.s │ │ │ │ ├── startup_stm32f10x_hd_vl.s │ │ │ │ ├── startup_stm32f10x_ld.s │ │ │ │ ├── startup_stm32f10x_ld_vl.s │ │ │ │ ├── startup_stm32f10x_md.s │ │ │ │ ├── startup_stm32f10x_md_vl.s │ │ │ │ └── startup_stm32f10x_xl.s │ │ │ │ └── system_stm32f10x.c │ │ ├── Include │ │ │ ├── arm_common_tables.h │ │ │ ├── arm_math.h │ │ │ ├── core_cm0.h │ │ │ ├── core_cm0plus.h │ │ │ ├── core_cm3.h │ │ │ ├── core_cm4.h │ │ │ ├── core_cm4_simd.h │ │ │ ├── core_cmFunc.h │ │ │ ├── core_cmInstr.h │ │ │ ├── core_sc000.h │ │ │ └── core_sc300.h │ │ ├── README.txt │ │ ├── RTOS │ │ │ └── cmsis_os.h │ │ ├── SVD │ │ │ ├── ARM_Sample.svd │ │ │ ├── ARM_Sample_1_1.svd │ │ │ ├── CMSIS-SVD_Schema_1_0.xsd │ │ │ ├── CMSIS-SVD_Schema_1_1_draft.xsd │ │ │ └── SVDConv.exe │ │ └── index.html │ ├── STM32F10x_StdPeriph_Driver │ │ ├── Release_Notes.html │ │ ├── inc │ │ │ ├── misc.h │ │ │ ├── stm32f10x_adc.h │ │ │ ├── stm32f10x_bkp.h │ │ │ ├── stm32f10x_can.h │ │ │ ├── stm32f10x_cec.h │ │ │ ├── stm32f10x_crc.h │ │ │ ├── stm32f10x_dac.h │ │ │ ├── stm32f10x_dbgmcu.h │ │ │ ├── stm32f10x_dma.h │ │ │ ├── stm32f10x_exti.h │ │ │ ├── stm32f10x_flash.h │ │ │ ├── stm32f10x_fsmc.h │ │ │ ├── stm32f10x_gpio.h │ │ │ ├── stm32f10x_i2c.h │ │ │ ├── stm32f10x_iwdg.h │ │ │ ├── stm32f10x_pwr.h │ │ │ ├── stm32f10x_rcc.h │ │ │ ├── stm32f10x_rtc.h │ │ │ ├── stm32f10x_sdio.h │ │ │ ├── stm32f10x_spi.h │ │ │ ├── stm32f10x_tim.h │ │ │ ├── stm32f10x_usart.h │ │ │ └── stm32f10x_wwdg.h │ │ └── src │ │ │ ├── misc.c │ │ │ ├── stm32f10x_adc.c │ │ │ ├── stm32f10x_bkp.c │ │ │ ├── stm32f10x_can.c │ │ │ ├── stm32f10x_cec.c │ │ │ ├── stm32f10x_crc.c │ │ │ ├── stm32f10x_dac.c │ │ │ ├── stm32f10x_dbgmcu.c │ │ │ ├── stm32f10x_dma.c │ │ │ ├── stm32f10x_exti.c │ │ │ ├── stm32f10x_flash.c │ │ │ ├── stm32f10x_fsmc.c │ │ │ ├── stm32f10x_gpio.c │ │ │ ├── stm32f10x_i2c.c │ │ │ ├── stm32f10x_iwdg.c │ │ │ ├── stm32f10x_pwr.c │ │ │ ├── stm32f10x_rcc.c │ │ │ ├── stm32f10x_rtc.c │ │ │ ├── stm32f10x_sdio.c │ │ │ ├── stm32f10x_spi.c │ │ │ ├── stm32f10x_tim.c │ │ │ ├── stm32f10x_usart.c │ │ │ └── stm32f10x_wwdg.c │ └── STM32_USB-FS-Device_Driver │ │ ├── Release_Notes.html │ │ ├── inc │ │ ├── usb_core.h │ │ ├── usb_def.h │ │ ├── usb_init.h │ │ ├── usb_int.h │ │ ├── usb_lib.h │ │ ├── usb_mem.h │ │ ├── usb_regs.h │ │ ├── usb_sil.h │ │ └── usb_type.h │ │ └── src │ │ ├── usb_core.c │ │ ├── usb_init.c │ │ ├── usb_int.c │ │ ├── usb_mem.c │ │ ├── usb_regs.c │ │ └── usb_sil.c ├── USB-Blaster │ ├── MDK-ARM │ │ ├── App.uvoptx │ │ ├── App.uvprojx │ │ └── RTE │ │ │ └── RTE_Components.h │ ├── clean.bat │ ├── drv │ │ ├── base.h │ │ ├── bitband.h │ │ ├── led.c │ │ ├── led.h │ │ ├── platform_config.h │ │ ├── timebase.c │ │ └── timebase.h │ ├── readme.txt │ ├── src │ │ ├── blaster.c │ │ ├── blaster.h │ │ ├── blaster_port.c │ │ ├── blaster_port.h │ │ ├── ft245rom.c │ │ ├── ft245rom.h │ │ ├── main.c │ │ ├── ringbuf.c │ │ └── ringbuf.h │ ├── sys │ │ ├── startup_stm32f10x_md.s │ │ ├── stm32_it.c │ │ ├── stm32_it.h │ │ ├── stm32f10x_conf.h │ │ ├── system_stm32f10x.c │ │ └── system_stm32f10x_iap.c │ └── usb │ │ ├── hw_config.c │ │ ├── hw_config.h │ │ ├── usb_conf.h │ │ ├── usb_desc.c │ │ ├── usb_desc.h │ │ ├── usb_endp.c │ │ ├── usb_istr.c │ │ ├── usb_istr.h │ │ ├── usb_prop.c │ │ ├── usb_prop.h │ │ ├── usb_pwr.c │ │ └── usb_pwr.h └── VirtualCOMPort │ ├── MDK-ARM │ ├── App.uvoptx │ ├── App.uvprojx │ └── RTE │ │ └── RTE_Components.h │ ├── clean.bat │ ├── drv │ ├── base.h │ ├── bitband.h │ ├── led.c │ ├── led.h │ ├── platform_config.h │ ├── timebase.c │ └── timebase.h │ ├── readme.txt │ ├── src │ ├── main.c │ ├── ringbuf.c │ ├── ringbuf.h │ ├── vcp.c │ └── vcp.h │ ├── sys │ ├── startup_stm32f10x_md.s │ ├── stm32_it.c │ ├── stm32_it.h │ ├── stm32f10x_conf.h │ ├── system_stm32f10x.c │ └── system_stm32f10x_iap.c │ └── usb │ ├── hw_config.c │ ├── hw_config.h │ ├── usb_conf.h │ ├── usb_desc.c │ ├── usb_desc.h │ ├── usb_endp.c │ ├── usb_istr.c │ ├── usb_istr.h │ ├── usb_prop.c │ ├── usb_prop.h │ ├── usb_pwr.c │ └── usb_pwr.h └── README.md /CPLD/DSO_LA/dso.qpf: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- # 2 | # 3 | # Copyright (C) 1991-2013 Altera Corporation 4 | # Your use of Altera Corporation's design tools, logic functions 5 | # and other software and tools, and its AMPP partner logic 6 | # functions, and any output files from any of the foregoing 7 | # (including device programming or simulation files), and any 8 | # associated documentation or information are expressly subject 9 | # to the terms and conditions of the Altera Program License 10 | # Subscription Agreement, Altera MegaCore Function License 11 | # Agreement, or other applicable license agreement, including, 12 | # without limitation, that your use is for the sole purpose of 13 | # programming logic devices manufactured by Altera and sold by 14 | # Altera or its authorized distributors. Please refer to the 15 | # applicable agreement for further details. 16 | # 17 | # -------------------------------------------------------------------------- # 18 | # 19 | # Quartus II 64-Bit 20 | # Version 13.1.0 Build 162 10/23/2013 SJ Full Version 21 | # Date created = 23:28:54 December 26, 2015 22 | # 23 | # -------------------------------------------------------------------------- # 24 | 25 | QUARTUS_VERSION = "13.1" 26 | DATE = "23:28:54 December 26, 2015" 27 | 28 | # Revisions 29 | 30 | PROJECT_REVISION = "dso" 31 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/dso.sdc: -------------------------------------------------------------------------------- 1 | ## Generated SDC file "dso.sdc" 2 | 3 | ## Copyright (C) 1991-2013 Altera Corporation 4 | ## Your use of Altera Corporation's design tools, logic functions 5 | ## and other software and tools, and its AMPP partner logic 6 | ## functions, and any output files from any of the foregoing 7 | ## (including device programming or simulation files), and any 8 | ## associated documentation or information are expressly subject 9 | ## to the terms and conditions of the Altera Program License 10 | ## Subscription Agreement, Altera MegaCore Function License 11 | ## Agreement, or other applicable license agreement, including, 12 | ## without limitation, that your use is for the sole purpose of 13 | ## programming logic devices manufactured by Altera and sold by 14 | ## Altera or its authorized distributors. Please refer to the 15 | ## applicable agreement for further details. 16 | 17 | 18 | ## VENDOR "Altera" 19 | ## PROGRAM "Quartus II" 20 | ## VERSION "Version 13.1.0 Build 162 10/23/2013 SJ Full Version" 21 | 22 | ## DATE "Thu Apr 28 23:05:10 2016" 23 | 24 | ## 25 | ## DEVICE "EPM240T100C5" 26 | ## 27 | 28 | 29 | #************************************************************** 30 | # Time Information 31 | #************************************************************** 32 | 33 | set_time_format -unit ns -decimal_places 3 34 | 35 | 36 | 37 | #************************************************************** 38 | # Create Clock 39 | #************************************************************** 40 | 41 | create_clock -name {fx_in} -period 5.000 -waveform { 0.000 2.500 } [get_ports { fx_in }] 42 | create_clock -name {clk} -period 9.000 -waveform { 0.000 4.500 } [get_ports { clk }] 43 | 44 | 45 | #************************************************************** 46 | # Create Generated Clock 47 | #************************************************************** 48 | 49 | 50 | 51 | #************************************************************** 52 | # Set Clock Latency 53 | #************************************************************** 54 | 55 | 56 | 57 | #************************************************************** 58 | # Set Clock Uncertainty 59 | #************************************************************** 60 | 61 | 62 | 63 | #************************************************************** 64 | # Set Input Delay 65 | #************************************************************** 66 | 67 | 68 | 69 | #************************************************************** 70 | # Set Output Delay 71 | #************************************************************** 72 | 73 | 74 | 75 | #************************************************************** 76 | # Set Clock Groups 77 | #************************************************************** 78 | 79 | 80 | 81 | #************************************************************** 82 | # Set False Path 83 | #************************************************************** 84 | 85 | 86 | 87 | #************************************************************** 88 | # Set Multicycle Path 89 | #************************************************************** 90 | 91 | 92 | 93 | #************************************************************** 94 | # Set Maximum Delay 95 | #************************************************************** 96 | 97 | 98 | 99 | #************************************************************** 100 | # Set Minimum Delay 101 | #************************************************************** 102 | 103 | 104 | 105 | #************************************************************** 106 | # Set Input Transition 107 | #************************************************************** 108 | 109 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/src/addr_gen.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/10ps 2 | 3 | /* 4 | 功能:读写地址生成 5 | 输入:nrst-0复位 6 | clk-时钟 7 | wr_en-允许写 8 | wr_inc-1写地址自增 9 | load_w2r-加载写地址到读地址 10 | rd_inc-读地址自增 11 | rd_step-读地址自增大小,有符号数,负数为地址减小 12 | 输出:addr_wr-写地址 13 | addr_rd-读地址 14 | wr_end-1写满(写地址到达读地址) 15 | 修改:eleqian 2016-01-22 16 | */ 17 | module addr_gen(nrst, clk, wr_en, wr_inc, load_w2r, rd_inc, rd_step, addr_wr, addr_rd, wr_end); 18 | input nrst; 19 | input clk; 20 | input wr_en; 21 | input wr_inc; 22 | input load_w2r; 23 | input rd_inc; 24 | input [7:0] rd_step; 25 | output [17:0] addr_wr; 26 | output [17:0] addr_rd; 27 | output wr_end; 28 | 29 | wire [17:0] addr_wr; 30 | wire [17:0] addr_rd; 31 | wire [17:0] rd_step_ex; 32 | reg wr_end; 33 | wire wr_inc_sig; 34 | wire reach; 35 | 36 | // 写地址返回到读地址表示写满,实现预触发深度调整是触发后立即修改读地址到需要位置 37 | assign reach = (addr_wr == addr_rd); 38 | assign wr_inc_sig = wr_en & wr_inc & ~wr_end; 39 | 40 | assign rd_step_ex = {{11{rd_step[7]}}, rd_step[6:0]}; 41 | 42 | // 写地址自增 43 | cntn #(18) u_wrcnt(.nrst(nrst), .clk(clk), 44 | .en(wr_inc_sig), .step(1), .load(0), .cin(0), .cnt(addr_wr)); 45 | 46 | // 触发时设置读地址为写地址,否则自增或自减 47 | cntn #(18) u_rdcnt(.nrst(nrst), .clk(clk), 48 | .en(rd_inc), .step(rd_step_ex), .load(load_w2r), .cin(addr_wr), .cnt(addr_rd)); 49 | 50 | // 生成采样完成信号,在停止采样时清除 51 | always @(posedge clk or negedge nrst) begin 52 | if (~nrst) begin 53 | wr_end <= 1'b0; 54 | end else if (reach) begin 55 | wr_end <= 1'b1; 56 | end else if (~wr_en) begin 57 | wr_end <= 1'b0; 58 | end 59 | end 60 | endmodule 61 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/src/cntn.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/10ps 2 | 3 | /* 4 | 功能:多位计数器 5 | 输入:nrst-0异步清除 6 | clk-时钟 7 | en-1使能计数 8 | step-计数步进 9 | load-使能置数 10 | cin-置数值 11 | 输出:cnt-计数值 12 | */ 13 | module cntn(nrst, clk, en, step, load, cin, cnt); 14 | parameter width = 8; 15 | 16 | input nrst; 17 | input clk; 18 | input en; 19 | input [width-1:0] step; 20 | input load; 21 | input [width-1:0] cin; 22 | output reg [width-1:0] cnt; 23 | 24 | always @(posedge clk or negedge nrst) begin 25 | if (~nrst) begin 26 | cnt <= 0; 27 | end else if (load) begin 28 | cnt <= cin; 29 | end else if (en) begin 30 | cnt <= cnt + step; 31 | end 32 | end 33 | endmodule 34 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/src/dsc.v: -------------------------------------------------------------------------------- 1 | 2 | module dsc(nrst, clk, 3 | spi_cs, spi_sck, spi_si, spi_so, 4 | sram_addr, sram_dio, sram_nce, sram_noe, sram_nwe, sram_nlb, sram_nub, 5 | ch1d, ch2d, misc, nirq, led); 6 | // 全局信号 7 | input nrst; 8 | input clk; 9 | // SPI 10 | input spi_cs; 11 | input spi_sck; 12 | input spi_si; 13 | output spi_so; 14 | // SRAM 15 | output [18:0] sram_addr; 16 | inout [15:0] sram_dio; 17 | output sram_nce; 18 | output sram_noe; 19 | output sram_nwe; 20 | output sram_nlb; 21 | output sram_nub; 22 | // 扩展口 23 | inout [11:0] ch1d; 24 | inout [11:0] ch2d; 25 | // 其它 26 | inout [2:0] misc; 27 | output [1:0] nirq; 28 | output led; 29 | 30 | // 扩展口功能映射 31 | wire [7:0] adc_in; 32 | wire adc_clk; 33 | wire adc_pd; 34 | wire fx_in; 35 | wire fx_out; 36 | wire [7:0] la_in; 37 | wire trig_in; 38 | wire trig_out; 39 | 40 | assign fx_in = ch1d[0]; 41 | assign ch1d[0] = 1'bz; 42 | assign ch1d[2] = adc_pd; 43 | assign ch1d[3] = adc_clk; 44 | assign adc_in[7:0] = ch1d[11:4]; 45 | assign ch1d[11:4] = 8'bz; 46 | 47 | assign la_in[7:0] = ch2d[7:0]; 48 | assign trig_in = ch2d[8]; 49 | assign ch2d[8:0] = 9'bz; 50 | assign ch2d[9] = trig_out; 51 | 52 | assign misc[0] = fx_out; 53 | assign sram_addr[18] = 0; 54 | 55 | dso uut(.nrst(nrst), .clk(clk), 56 | .spi_cs(spi_cs), .spi_sck(spi_sck), .spi_si(spi_si), .spi_so(spi_so), .spi_nirq(nirq[0]), 57 | .sram_addr(sram_addr[17:0]), .sram_dio(sram_dio), .sram_nce(sram_nce), .sram_noe(sram_noe), 58 | .sram_nwe(sram_nwe), .sram_nlb(sram_nlb), .sram_nub(sram_nub), 59 | .adc_in(adc_in), .adc_clk(adc_clk), .adc_pd(adc_pd), 60 | .la_in(la_in), .fx_in(fx_in), .fx_out(fx_out), .trig_in(trig_in), .trig_out(trig_out), .led(led)); 61 | endmodule 62 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/src/dso_trig.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/10ps 2 | 3 | /* 4 | 功能:示波器触发器 5 | 输入:nrst-0复位 6 | clk-时钟 7 | wave_trig-波形触发输入 8 | wave_bypass-1不关心波形触发 9 | la_trig-逻辑触发输入 10 | trig_clr-清除触发状态 11 | 输出:trig_sta-触发状态输出,1已触发 12 | trig_pluse-触发脉冲输出 13 | 修改:eleqian 2016-01-20 14 | */ 15 | module dso_trig(nrst, clk, wave_trig, wave_bypass, la_trig, ext_trig, ext_bypass, 16 | trig_clr, trig_sta, trig_pluse); 17 | input nrst; 18 | input clk; 19 | input wave_trig; 20 | input wave_bypass; 21 | input la_trig; 22 | input ext_trig; 23 | input ext_bypass; 24 | input trig_clr; 25 | output trig_sta; 26 | output trig_pluse; 27 | 28 | reg trig_sta; 29 | reg trig_last; 30 | wire trig_cap; 31 | 32 | assign trig_cap = (wave_trig | wave_bypass) & (ext_trig | ext_bypass) & la_trig; 33 | assign trig_pluse = trig_sta & ~trig_last; 34 | 35 | always @(posedge clk or negedge nrst) begin 36 | if (~nrst) begin 37 | trig_sta <= 1'b0; 38 | end else if (trig_clr) begin 39 | trig_sta <= 1'b0; 40 | end else if (trig_cap) begin 41 | trig_sta <= 1'b1; 42 | end 43 | end 44 | 45 | always @(posedge clk or negedge nrst) begin 46 | if (~nrst) begin 47 | trig_last <= 1'b0; 48 | end else begin 49 | trig_last <= trig_sta; 50 | end 51 | end 52 | endmodule 53 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/src/la_trig.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/10ps 2 | 3 | /* 4 | 功能:逻辑分析仪触发器 5 | 输入:nrst-0复位 6 | clk-时钟 7 | din-数据输入 8 | level_sel-触发电平选择,0低电平,1高电平 9 | level_mask-电平触发掩码,1为不关心 10 | edge_sel-边沿触发通道选择,0~7 11 | edge_mask-边沿触发掩码,1为不关心 12 | 输出:trig_out-1成功触发 13 | 修改:eleqian 2016-01-22 14 | */ 15 | module la_trig(nrst, clk, din, level_sel, level_mask, edge_sel, edge_mask, trig_out); 16 | input nrst; 17 | input clk; 18 | input [7:0] din; 19 | input [7:0] level_sel; 20 | input [7:0] level_mask; 21 | input [2:0] edge_sel; 22 | input edge_mask; 23 | output trig_out; 24 | 25 | reg d_last; 26 | wire d_sel; 27 | wire d_edge; 28 | wire m_edge; 29 | 30 | wire [7:0] d_level; 31 | wire [7:0] m_level; 32 | wire s_level; 33 | 34 | // 选择单个信号检测边沿 35 | assign d_sel = din[edge_sel]; 36 | 37 | // 延迟一个clk以检测边沿 38 | always @(posedge clk or negedge nrst) begin 39 | if (~nrst) begin 40 | d_last <= 1'b0; 41 | end else begin 42 | d_last <= d_sel; 43 | end 44 | end 45 | 46 | // 边沿检测 47 | assign d_edge = d_last ^ d_sel; 48 | // 边沿掩码 49 | assign m_edge = d_edge | edge_mask; 50 | // 电平选择 51 | assign d_level = ~(din ^ level_sel); 52 | // 电平掩码 53 | assign m_level = d_level | level_mask; 54 | // 各电平为与 55 | assign trig_out = &m_level & m_edge; 56 | endmodule 57 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/src/mux21n.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/10ps 2 | 3 | // 多路2选1 4 | module mux21n(sel, din0, din1, dout); 5 | parameter width = 1; 6 | input sel; 7 | input [width-1:0] din0; 8 | input [width-1:0] din1; 9 | output [width-1:0] dout; 10 | 11 | assign dout = (0 == sel) ? din0 : din1; 12 | endmodule 13 | 14 | // 带输出寄存器的多路2选1 15 | module mux21nr(nrst, clk, en, sel, din0, din1, dout); 16 | parameter width = 1; 17 | input nrst; 18 | input clk; 19 | input en; 20 | input sel; 21 | input [width-1:0] din0; 22 | input [width-1:0] din1; 23 | output reg [width-1:0] dout; 24 | 25 | always @(posedge clk or negedge nrst) begin 26 | if (~nrst) begin 27 | dout <= 0; 28 | end else if (en) begin 29 | dout <= (0 == sel) ? din0 : din1; 30 | end 31 | end 32 | endmodule 33 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/src/reg_rw.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/10ps 2 | 3 | // 38译码 4 | module decode38(en, din, dout); 5 | input en; 6 | input [2:0] din; 7 | output reg [7:0] dout; 8 | 9 | always @(*) begin 10 | if (~en) begin 11 | dout <= 8'b0; 12 | end else begin 13 | dout <= 8'b1 << din; 14 | end 15 | end 16 | endmodule 17 | 18 | // 单个寄存器(x bits) 19 | module regxb(nrst, clk, en, din, regout); 20 | parameter bits = 1; 21 | input nrst; 22 | input clk; 23 | input en; 24 | input [bits-1:0] din; 25 | output reg [bits-1:0] regout; 26 | 27 | always @(posedge clk or negedge nrst) begin 28 | if (~nrst) begin 29 | regout <= 0; 30 | end else if (en) begin 31 | regout <= din; 32 | end 33 | end 34 | endmodule 35 | 36 | // 写寄存器 37 | module dso_regw(nrst, clk, addr, din, we, sel, 38 | reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7); 39 | 40 | input nrst; 41 | input clk; 42 | input [2:0] addr; 43 | input [7:0] din; 44 | input we; 45 | output [7:0] sel; 46 | output [7:0] reg0; 47 | output [7:0] reg1; 48 | output [7:0] reg2; 49 | output [7:0] reg3; 50 | output [7:0] reg4; 51 | output [7:0] reg5; 52 | output [7:0] reg6; 53 | output [7:0] reg7; 54 | wire [7:0] addr_dec; 55 | 56 | decode38 dec(.en(we), .din(addr), .dout(addr_dec)); 57 | assign sel = addr_dec; 58 | 59 | regxb #(8) r0(.nrst(nrst), .clk(clk), .en(addr_dec[0]), .din(din), .regout(reg0)); 60 | regxb #(8) r1(.nrst(nrst), .clk(clk), .en(addr_dec[1]), .din(din), .regout(reg1)); 61 | regxb #(8) r2(.nrst(nrst), .clk(clk), .en(addr_dec[2]), .din(din), .regout(reg2)); 62 | regxb #(8) r3(.nrst(nrst), .clk(clk), .en(addr_dec[3]), .din(din), .regout(reg3)); 63 | regxb #(8) r4(.nrst(nrst), .clk(clk), .en(addr_dec[4]), .din(din), .regout(reg4)); 64 | regxb #(8) r5(.nrst(nrst), .clk(clk), .en(addr_dec[5]), .din(din), .regout(reg5)); 65 | regxb #(8) r6(.nrst(nrst), .clk(clk), .en(addr_dec[6]), .din(din), .regout(reg6)); 66 | regxb #(8) r7(.nrst(nrst), .clk(clk), .en(addr_dec[7]), .din(din), .regout(reg7)); 67 | endmodule 68 | 69 | // 读寄存器 70 | module dso_regr(addr, dout, 71 | reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7); 72 | 73 | input [2:0] addr; 74 | output reg [7:0] dout; 75 | input [7:0] reg0; 76 | input [7:0] reg1; 77 | input [7:0] reg2; 78 | input [7:0] reg3; 79 | input [7:0] reg4; 80 | input [7:0] reg5; 81 | input [7:0] reg6; 82 | input [7:0] reg7; 83 | 84 | always @(*) begin 85 | case (addr) 86 | 3'h0: dout <= reg0; 87 | 3'h1: dout <= reg1; 88 | 3'h2: dout <= reg2; 89 | 3'h3: dout <= reg3; 90 | 3'h4: dout <= reg4; 91 | 3'h5: dout <= reg5; 92 | 3'h6: dout <= reg6; 93 | 3'h7: dout <= reg7; 94 | default: dout <= 8'b0; 95 | endcase 96 | end 97 | endmodule 98 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/src/rw_ctrl.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/10ps 2 | 3 | /* 4 | 功能:读写请求控制,写优先级高于读 5 | 输入:nrst-0复位 6 | clk-时钟 7 | wr_req-写请求 8 | rd_req-读请求 9 | 输出:wr_sta-写状态,1可写 10 | rd_sta-读状态,1可读 11 | 修改:eleqian 2016-01-22 12 | */ 13 | module rw_ctrl(nrst, clk, wr_req, rd_req, wr_sta, rd_sta); 14 | input nrst; 15 | input clk; 16 | input wr_req; 17 | input rd_req; 18 | output wr_sta; // 处于写状态 19 | output rd_sta; // 处于读状态 20 | 21 | reg wr_sta; 22 | reg rd_pend; // 读请求pending信号 23 | 24 | // 写状态转换 25 | always @(posedge clk or negedge nrst) begin 26 | if (~nrst) begin 27 | wr_sta <= 1'b0; 28 | end else begin 29 | wr_sta <= wr_req; 30 | end 31 | end 32 | 33 | // 读pending状态转换 34 | always @(posedge clk or negedge nrst) begin 35 | if (~nrst) begin 36 | rd_pend <= 1'b0; 37 | end else if (rd_req) begin 38 | rd_pend <= 1'b1; 39 | end else if (rd_sta) begin 40 | rd_pend <= 1'b0; 41 | end 42 | end 43 | 44 | // 当写状态无效且读pending时才可读 45 | assign rd_sta = rd_pend & ~wr_sta; 46 | endmodule 47 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/src/smpl_deci.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/10ps 2 | 3 | // 采样数据抽取信号,降低实际采样率 4 | module smpl_deci(nrst, clk, en, div2, num, out, out2); 5 | input nrst; 6 | input clk; 7 | input en; 8 | input div2; 9 | input [15:0] num; 10 | output reg out; 11 | output out2; 12 | 13 | wire [15:0] cnt; 14 | reg outdiv; 15 | wire cnt_end; 16 | wire load; 17 | wire out_sig; 18 | 19 | assign cnt_end = (16'b0 == cnt); 20 | assign load = !en | cnt_end; 21 | assign out_sig = en & cnt_end; 22 | 23 | // 减计数到0 24 | cntn #(16) u_decicnt(.nrst(nrst), .clk(clk), 25 | .en(1), .step(-1), .load(load), .cin(num), .cnt(cnt)); 26 | 27 | always @(posedge clk or negedge nrst) begin 28 | if (~nrst) begin 29 | out <= 0; 30 | end else begin 31 | out <= out_sig; 32 | end 33 | end 34 | 35 | always @(posedge clk or negedge nrst) begin 36 | if (~nrst) begin 37 | outdiv <= 0; 38 | end else if (out_sig) begin 39 | outdiv <= ~outdiv; 40 | end 41 | end 42 | 43 | assign out2 = out & (~outdiv | ~div2); 44 | endmodule 45 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/src/wave_trig.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/10ps 2 | 3 | /* 4 | 功能:波形触发器 5 | 输入:nrst-0复位 6 | clk-时钟 7 | din-数据输入 8 | level-触发电平 9 | edge_sel-触发边沿选择,0下降沿,1上升沿 10 | 输出:trig_out-1成功触发 11 | 修改:eleqian 2016-01-20 12 | */ 13 | module wave_trig(nrst, clk, din, level, edge_sel, trig_out); 14 | input nrst; 15 | input clk; 16 | input [7:0] din; 17 | input [7:0] level; 18 | input edge_sel; 19 | output trig_out; 20 | 21 | reg trig_out; 22 | wire edge_cap; 23 | 24 | assign edge_cap = edge_sel ^ (din < level); 25 | 26 | always @(posedge clk or negedge nrst) begin 27 | if (~nrst) begin 28 | trig_out <= 1'b0; 29 | end else if (trig_out ^ edge_cap) begin 30 | trig_out <= edge_cap; 31 | end 32 | end 33 | endmodule 34 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/testbench/addr_tb.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/10ps 2 | 3 | module addr_tb; 4 | reg clkx; 5 | reg clks; 6 | reg clr; 7 | reg ss; 8 | wire sta; 9 | wire ovx; 10 | wire ovs; 11 | wire [19:0] cntx; 12 | wire [19:0] cnts; 13 | 14 | // 100MHz 15 | initial begin 16 | forever #5 clks = !clks; 17 | end 18 | 19 | // xMHz 20 | initial begin 21 | forever #99 clkx = !clkx; 22 | end 23 | 24 | initial begin 25 | clkx = 1'b0; 26 | clks = 1'b0; 27 | ss = 1'b0; 28 | #18 clr = 1'b1; 29 | #18 clr = 1'b0; 30 | #18 ss = 1'b1; 31 | #1000 ss = 1'b0; 32 | #100 $stop; 33 | end 34 | 35 | fmeter fmuut(.fx(clkx), .fs(clks), 36 | .clr(clr), .ss(ss), .sta(sta), 37 | .ovx(ovx), .ovs(ovs), 38 | .cntx(cntx), .cnts(cnts)); 39 | endmodule 40 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/testbench/deci_tb.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/10ps 2 | 3 | module deci_tb; 4 | reg nrst; 5 | reg clk; 6 | reg en; 7 | reg div2; 8 | reg [15:0] deci_num; 9 | wire out; 10 | wire out2; 11 | 12 | smpl_deci uut_deci(.nrst(nrst), .clk(clk), 13 | .en(en), .div2(div2), .num(deci_num), .out(out), .out2(out2)); 14 | 15 | // 100MHz 16 | initial begin 17 | forever #5 clk = ~clk; 18 | end 19 | 20 | initial begin 21 | nrst = 1'b0; 22 | clk = 1'b0; 23 | en = 1'b0; 24 | div2 = 1'b0; 25 | deci_num = 16'h5; 26 | #20 27 | nrst = 1'b1; 28 | $stop; 29 | #15 30 | en = 1'b1; 31 | #200 32 | div2 = 1'b1; 33 | #200 34 | en = 1'b0; 35 | div2 = 1'b0; 36 | deci_num = 16'h0; 37 | #15 38 | en = 1'b1; 39 | #100 40 | div2 = 1'b1; 41 | #100 42 | $stop; 43 | end 44 | endmodule 45 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/testbench/dso_tb.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/10ps 2 | 3 | module dso_tb; 4 | reg clkx; 5 | reg clks; 6 | reg clr; 7 | reg ss; 8 | wire sta; 9 | wire ovx; 10 | wire ovs; 11 | wire [19:0] cntx; 12 | wire [19:0] cnts; 13 | 14 | // 100MHz 15 | initial begin 16 | forever #5 clks = !clks; 17 | end 18 | 19 | // xMHz 20 | initial begin 21 | forever #99 clkx = !clkx; 22 | end 23 | 24 | initial begin 25 | clkx = 1'b0; 26 | clks = 1'b0; 27 | ss = 1'b0; 28 | #18 clr = 1'b1; 29 | #18 clr = 1'b0; 30 | #18 ss = 1'b1; 31 | #1000 ss = 1'b0; 32 | #100 $stop; 33 | end 34 | 35 | fmeter fmuut(.fx(clkx), .fs(clks), 36 | .clr(clr), .ss(ss), .sta(sta), 37 | .ovx(ovx), .ovs(ovs), 38 | .cntx(cntx), .cnts(cnts)); 39 | endmodule 40 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/testbench/rw_tb.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/10ps 2 | 3 | module rw_tb; 4 | reg nrst; 5 | reg clk; 6 | reg wr_req; 7 | reg rd_req; 8 | wire wr_sta; 9 | wire rd_sta; 10 | 11 | rw_ctrl uut_rw(.nrst(nrst), .clk(clk), 12 | .wr_req(wr_req), .rd_req(rd_req), .wr_sta(wr_sta), .rd_sta(rd_sta)); 13 | 14 | // 100MHz 15 | initial begin 16 | forever #5 clk = ~clk; 17 | end 18 | 19 | initial begin 20 | nrst = 1'b0; 21 | clk = 1'b0; 22 | wr_req = 1'b0; 23 | rd_req = 1'b0; 24 | #20 25 | 26 | nrst = 1'b1; 27 | $stop; 28 | #20 29 | 30 | wr_req = 1'b1; 31 | #10 32 | wr_req = 1'b0; 33 | #50 34 | 35 | rd_req = 1'b1; 36 | #10 37 | rd_req = 1'b0; 38 | #50 39 | 40 | wr_req = 1'b1; 41 | rd_req = 1'b1; 42 | #10 43 | wr_req = 1'b0; 44 | rd_req = 1'b0; 45 | #50 46 | 47 | wr_req = 1'b1; 48 | #10 49 | wr_req = 1'b0; 50 | rd_req = 1'b1; 51 | #10 52 | rd_req = 1'b0; 53 | #50 54 | 55 | rd_req = 1'b1; 56 | #10 57 | rd_req = 1'b0; 58 | wr_req = 1'b1; 59 | #10 60 | wr_req = 1'b0; 61 | #50 62 | 63 | $stop; 64 | end 65 | endmodule 66 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/testbench/sspi_tb.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/10ps 2 | 3 | module sspi_tb; 4 | reg nrst; 5 | reg clk; 6 | reg cs; 7 | reg sck; 8 | reg si; 9 | wire so; 10 | wire [6:0] addr; 11 | reg [7:0] din; 12 | wire [7:0] dout; 13 | wire rd; 14 | wire we; 15 | integer i; 16 | integer j; 17 | reg [7:0] spi_send; 18 | reg [7:0] spi_recv; 19 | reg [7:0] data_rw; 20 | 21 | sspi uut0(.nrst(nrst), .clk(clk), .cs(cs), .sck(sck), .si(si), .so(so), 22 | .addr(addr), .din(din), .dout(dout), .rd(rd), .we(we)); 23 | 24 | task gensck; 25 | for (i = 0; i < 8; i = i + 1) begin 26 | #28 27 | sck = 0; 28 | j = i; 29 | #28 30 | sck = 1; 31 | end 32 | endtask 33 | 34 | initial begin 35 | i = 0; 36 | j = 0; 37 | clk = 0; 38 | nrst = 1; 39 | cs = 0; 40 | sck = 1; 41 | si = 0; 42 | din = 8'h00; 43 | data_rw = 8'h0; 44 | spi_send = 8'h0; 45 | spi_recv = 8'h0; 46 | #10 47 | nrst = 0; 48 | #10 49 | nrst = 1; 50 | cs = 1; 51 | 52 | $stop; 53 | 54 | #20 55 | cs = 0; 56 | #100 57 | spi_send = {7'd1, 1'b0}; 58 | spi_recv = 8'h0; 59 | gensck(); 60 | spi_send = 8'h3e; 61 | spi_recv = 8'h0; 62 | gensck(); 63 | #100 64 | spi_recv = 8'h0; 65 | gensck(); 66 | #100 67 | cs = 1; 68 | #100 69 | gensck(); 70 | 71 | #20 72 | cs = 0; 73 | #100 74 | spi_send = {7'd2, 1'b1}; 75 | spi_recv = 8'h0; 76 | gensck(); 77 | #100 78 | spi_send = 8'hc7; 79 | gensck(); 80 | #100 81 | spi_send = 8'h4d; 82 | gensck(); 83 | #100 84 | cs = 1; 85 | #100 86 | gensck(); 87 | 88 | #20 $stop; 89 | end 90 | 91 | initial begin 92 | forever #5 clk = !clk; 93 | end 94 | 95 | always @(negedge sck) begin 96 | si <= spi_send[7 - i]; 97 | end 98 | 99 | always @(posedge sck) begin 100 | spi_recv[7 - j] <= so; 101 | end 102 | 103 | always @(*) begin 104 | case (addr[1:0]) 105 | 'h0: 106 | din <= 8'h5a; 107 | 'h1: 108 | din <= 8'hcc; 109 | 'h2: 110 | din <= 8'h38; 111 | 'h3: 112 | din <= 8'h67; 113 | default: 114 | din <= 8'hzz; 115 | endcase 116 | end 117 | 118 | always @(posedge clk) begin 119 | if (we) begin 120 | data_rw <= dout; 121 | end 122 | end 123 | endmodule 124 | -------------------------------------------------------------------------------- /CPLD/DSO_LA/testbench/trig_tb.v: -------------------------------------------------------------------------------- 1 | `timescale 1ns/10ps 2 | 3 | module fmeter_tb; 4 | reg clkx; 5 | reg clks; 6 | reg clr; 7 | reg ss; 8 | wire sta; 9 | wire ovx; 10 | wire ovs; 11 | wire [19:0] cntx; 12 | wire [19:0] cnts; 13 | 14 | // 100MHz 15 | initial begin 16 | forever #5 clks = !clks; 17 | end 18 | 19 | // xMHz 20 | initial begin 21 | forever #99 clkx = !clkx; 22 | end 23 | 24 | initial begin 25 | clkx = 1'b0; 26 | clks = 1'b0; 27 | ss = 1'b0; 28 | #18 clr = 1'b1; 29 | #18 clr = 1'b0; 30 | #18 ss = 1'b1; 31 | #1000 ss = 1'b0; 32 | #100 $stop; 33 | end 34 | 35 | fmeter fmuut(.fx(clkx), .fs(clks), 36 | .clr(clr), .ss(ss), .sta(sta), 37 | .ovx(ovx), .ovs(ovs), 38 | .cntx(cntx), .cnts(cnts)); 39 | endmodule 40 | -------------------------------------------------------------------------------- /Doc/CPLD寄存器定义.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Doc/CPLD寄存器定义.xlsx -------------------------------------------------------------------------------- /Doc/DSO种类规划.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Doc/DSO种类规划.txt -------------------------------------------------------------------------------- /Doc/WiDSO规划.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Doc/WiDSO规划.txt -------------------------------------------------------------------------------- /Doc/时序/readme.txt: -------------------------------------------------------------------------------- 1 | open with tool TimeGen 3.2 -------------------------------------------------------------------------------- /Doc/时序/trig.tim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Doc/时序/trig.tim -------------------------------------------------------------------------------- /Doc/时序/wave_rd_div5.tim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Doc/时序/wave_rd_div5.tim -------------------------------------------------------------------------------- /Doc/时序/wave_rw_div5.tim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Doc/时序/wave_rw_div5.tim -------------------------------------------------------------------------------- /Doc/时序/wave_wr_div5.tim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Doc/时序/wave_wr_div5.tim -------------------------------------------------------------------------------- /Doc/时序/wr_end.tim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Doc/时序/wr_end.tim -------------------------------------------------------------------------------- /Doc/管脚分配和关联.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Doc/管脚分配和关联.xlsx -------------------------------------------------------------------------------- /Hardware/WiDSC/DSPComm.Harness: -------------------------------------------------------------------------------- 1 | JTAG=TCK,TDO,TDI,TMS 2 | SPI=NCS,SCK,MISO,MOSI 3 | -------------------------------------------------------------------------------- /Hardware/WiDSC/DSPComm.SchDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Hardware/WiDSC/DSPComm.SchDoc -------------------------------------------------------------------------------- /Hardware/WiDSC/ExtConn.SchDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Hardware/WiDSC/ExtConn.SchDoc -------------------------------------------------------------------------------- /Hardware/WiDSC/PowerMisc.SchDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Hardware/WiDSC/PowerMisc.SchDoc -------------------------------------------------------------------------------- /Hardware/WiDSC/SampleCtrl.Harness: -------------------------------------------------------------------------------- 1 | JTAG=TMS,TCK,TDO,TDI 2 | SPI=MOSI,MISO,SCK,NCS 3 | -------------------------------------------------------------------------------- /Hardware/WiDSC/SampleCtrl.SchDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Hardware/WiDSC/SampleCtrl.SchDoc -------------------------------------------------------------------------------- /Hardware/WiDSC/WiDSO.PcbDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Hardware/WiDSC/WiDSO.PcbDoc -------------------------------------------------------------------------------- /Hardware/WiDSC/WiDSO.PcbLib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Hardware/WiDSC/WiDSO.PcbLib -------------------------------------------------------------------------------- /Hardware/WiDSC/WiDSO.PrjPcb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Hardware/WiDSC/WiDSO.PrjPcb -------------------------------------------------------------------------------- /Hardware/WiDSC/WiDSO.SchDoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Hardware/WiDSC/WiDSO.SchDoc -------------------------------------------------------------------------------- /Hardware/WiDSC/WiDSO.SchLib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Hardware/WiDSC/WiDSO.SchLib -------------------------------------------------------------------------------- /Image/WiDSC_3D.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Image/WiDSC_3D.jpg -------------------------------------------------------------------------------- /Image/WiDSC_PCB.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Image/WiDSC_PCB.jpg -------------------------------------------------------------------------------- /Image/jtag_bitbang.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Image/jtag_bitbang.jpg -------------------------------------------------------------------------------- /Image/jtag_shift.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/Image/jtag_shift.jpg -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Yongqian Tang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /MCU/BootLoader/MDK-ARM/RTE/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Component Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'USBBootLoader' 7 | * Target: 'USBBootLoader' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | #endif /* RTE_COMPONENTS_H */ 15 | -------------------------------------------------------------------------------- /MCU/BootLoader/clean.bat: -------------------------------------------------------------------------------- 1 | del /S /Q MDK-ARM\lst\*.* 2 | del /S /Q MDK-ARM\out\*.* 3 | del /S /Q MDK-ARM\*.bak -------------------------------------------------------------------------------- /MCU/BootLoader/drv/base.h: -------------------------------------------------------------------------------- 1 | #ifndef __BASE_H__ 2 | #define __BASE_H__ 3 | 4 | #include "config.h" 5 | 6 | #include 7 | 8 | /*typedef signed char int8_t; 9 | typedef unsigned char uint8_t; 10 | typedef signed short int16_t; 11 | typedef unsigned short uint16_t; 12 | typedef signed long int32_t; 13 | typedef unsigned long uint32_t;*/ 14 | 15 | #ifndef TRUE 16 | typedef unsigned char BOOL; 17 | typedef unsigned char bool; 18 | #define TRUE 1 19 | #define FALSE 0 20 | #endif 21 | 22 | #ifndef NULL 23 | #define NULL ((void*)0) 24 | #endif 25 | 26 | #ifndef MIN 27 | #define MIN(a,b) ((a)<=(b)?(a):(b)) 28 | #endif 29 | 30 | #ifndef MAX 31 | #define MAX(a,b) ((a)>=(b)?(a):(b)) 32 | #endif 33 | 34 | #define BITS_SET(v,b) ((v) |= (b)) 35 | #define BITS_CLR(v,b) ((v) &= ~(b)) 36 | #define BITS_CHK(v,b) (((v) & (b)) == (b)) 37 | 38 | #endif // __BASE_H__ 39 | -------------------------------------------------------------------------------- /MCU/BootLoader/drv/config.h: -------------------------------------------------------------------------------- 1 | #ifndef __CONFIG_H__ 2 | #define __CONFIG_H__ 3 | 4 | #define MCU_STM32F103C8 5 | #include "stm32f10x.h" 6 | 7 | #endif // __CONFIG_H__ 8 | -------------------------------------------------------------------------------- /MCU/BootLoader/drv/led.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/BootLoader/drv/led.c -------------------------------------------------------------------------------- /MCU/BootLoader/drv/led.h: -------------------------------------------------------------------------------- 1 | #ifndef __LED_H__ 2 | #define __LED_H__ 3 | 4 | #include "base.h" 5 | 6 | void LED_Init(void); 7 | 8 | void LED_Exec(void); 9 | 10 | void LED_Light(BOOL isLight); 11 | 12 | void LED_Flash(uint16_t period, uint16_t pulse, uint16_t cycles); 13 | 14 | #endif //__LED_H__ 15 | -------------------------------------------------------------------------------- /MCU/BootLoader/drv/spi_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/BootLoader/drv/spi_flash.c -------------------------------------------------------------------------------- /MCU/BootLoader/drv/spi_flash.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/BootLoader/drv/spi_flash.h -------------------------------------------------------------------------------- /MCU/BootLoader/drv/timebase.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/BootLoader/drv/timebase.c -------------------------------------------------------------------------------- /MCU/BootLoader/drv/timebase.h: -------------------------------------------------------------------------------- 1 | #ifndef __TIMEBASE_H__ 2 | #define __TIMEBASE_H__ 3 | 4 | #include "base.h" 5 | 6 | void TimeBase_Init(void); 7 | 8 | uint32_t micros(void); 9 | 10 | uint32_t millis(void); 11 | 12 | void delay_us(uint32_t us); 13 | 14 | void delay_ms(uint32_t ms); 15 | 16 | #endif //__TIMEBASE_H__ 17 | -------------------------------------------------------------------------------- /MCU/BootLoader/readme.txt: -------------------------------------------------------------------------------- 1 | USB BootLoader for WiDSC. -------------------------------------------------------------------------------- /MCU/BootLoader/src/main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/BootLoader/src/main.c -------------------------------------------------------------------------------- /MCU/BootLoader/sys/stm32_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32_it.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32_IT_H 31 | #define __STM32_IT_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "base.h" 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | /* Exported macro ------------------------------------------------------------*/ 39 | /* Exported functions ------------------------------------------------------- */ 40 | 41 | void NMI_Handler(void); 42 | void HardFault_Handler(void); 43 | void MemManage_Handler(void); 44 | void BusFault_Handler(void); 45 | void UsageFault_Handler(void); 46 | void SVC_Handler(void); 47 | void DebugMon_Handler(void); 48 | void PendSV_Handler(void); 49 | void SysTick_Handler(void); 50 | void USB_HP_CAN1_TX_IRQHandler(void); 51 | void USB_LP_CAN1_RX0_IRQHandler(void); 52 | 53 | #if defined(STM32F10X_HD) || defined(STM32F10X_XL) || defined(STM32L1XX_HD)|| defined(STM32L1XX_MD_PLUS) 54 | void SDIO_IRQHandler(void); 55 | void SD_SDIO_DMA_IRQHANDLER(void); 56 | #endif /* STM32F10X_HD | STM32F10X_XL */ 57 | 58 | #endif /* __STM32_IT_H */ 59 | 60 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 61 | 62 | -------------------------------------------------------------------------------- /MCU/BootLoader/sys/stm32f10x_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_conf.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_CONF_H 31 | #define __STM32F10x_CONF_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Uncomment the line below to enable peripheral header file inclusion */ 35 | #include "stm32f10x_adc.h" 36 | #include "stm32f10x_bkp.h" 37 | #include "stm32f10x_can.h" 38 | #include "stm32f10x_crc.h" 39 | #include "stm32f10x_dac.h" 40 | #include "stm32f10x_dbgmcu.h" 41 | #include "stm32f10x_dma.h" 42 | #include "stm32f10x_exti.h" 43 | #include "stm32f10x_flash.h" 44 | #include "stm32f10x_fsmc.h" 45 | #include "stm32f10x_gpio.h" 46 | #include "stm32f10x_i2c.h" 47 | #include "stm32f10x_iwdg.h" 48 | #include "stm32f10x_pwr.h" 49 | #include "stm32f10x_rcc.h" 50 | #include "stm32f10x_rtc.h" 51 | #include "stm32f10x_sdio.h" 52 | #include "stm32f10x_spi.h" 53 | #include "stm32f10x_tim.h" 54 | #include "stm32f10x_usart.h" 55 | #include "stm32f10x_wwdg.h" 56 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 57 | 58 | /* Exported types ------------------------------------------------------------*/ 59 | /* Exported constants --------------------------------------------------------*/ 60 | /* Uncomment the line below to expanse the "assert_param" macro in the 61 | Standard Peripheral Library drivers code */ 62 | /* #define USE_FULL_ASSERT 1 */ 63 | 64 | /* Exported macro ------------------------------------------------------------*/ 65 | #ifdef USE_FULL_ASSERT 66 | 67 | /******************************************************************************* 68 | * Macro Name : assert_param 69 | * Description : The assert_param macro is used for function's parameters check. 70 | * Input : - expr: If expr is false, it calls assert_failed function 71 | * which reports the name of the source file and the source 72 | * line number of the call that failed. 73 | * If expr is true, it returns no value. 74 | * Return : None 75 | *******************************************************************************/ 76 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 77 | /* Exported functions ------------------------------------------------------- */ 78 | void assert_failed(uint8_t* file, uint32_t line); 79 | #else 80 | #define assert_param(expr) ((void)0) 81 | #endif /* USE_FULL_ASSERT */ 82 | 83 | #endif /* __STM32F10x_CONF_H */ 84 | 85 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 86 | -------------------------------------------------------------------------------- /MCU/BootLoader/udisk/hw_config.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/BootLoader/udisk/hw_config.c -------------------------------------------------------------------------------- /MCU/BootLoader/udisk/hw_config.h: -------------------------------------------------------------------------------- 1 | #ifndef __HW_CONFIG_H__ 2 | #define __HW_CONFIG_H__ 3 | 4 | #include "base.h" 5 | 6 | void USB_SetSystem(void); 7 | void USB_SetClock(void); 8 | void Enter_LowPowerMode(void); 9 | void Leave_LowPowerMode(void); 10 | void USB_Interrupts_Config(void); 11 | void USB_Led_Config(void); 12 | void USB_Led_RW_ON(void); 13 | void USB_Led_RW_OFF(void); 14 | void USB_Configured_LED(void); 15 | void USB_NotConfigured_LED(void); 16 | void USB_Disconnect_Config(void); 17 | void USB_Cable_Config (FunctionalState NewState); 18 | void Get_SerialNum(void); 19 | 20 | #endif /*__HW_CONFIG_H__*/ 21 | -------------------------------------------------------------------------------- /MCU/BootLoader/udisk/mass_mal.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/BootLoader/udisk/mass_mal.c -------------------------------------------------------------------------------- /MCU/BootLoader/udisk/mass_mal.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/BootLoader/udisk/mass_mal.h -------------------------------------------------------------------------------- /MCU/BootLoader/udisk/memory.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/BootLoader/udisk/memory.c -------------------------------------------------------------------------------- /MCU/BootLoader/udisk/memory.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file memory.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Memory management layer 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __memory_H 31 | #define __memory_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "hw_config.h" 35 | /* Exported types ------------------------------------------------------------*/ 36 | /* Exported constants --------------------------------------------------------*/ 37 | #define TXFR_IDLE 0 38 | #define TXFR_ONGOING 1 39 | 40 | /* Exported macro ------------------------------------------------------------*/ 41 | /* Exported functions ------------------------------------------------------- */ 42 | void Write_Memory (uint8_t lun, uint32_t Memory_Offset, uint32_t Transfer_Length); 43 | void Read_Memory (uint8_t lun, uint32_t Memory_Offset, uint32_t Transfer_Length); 44 | #endif /* __memory_H */ 45 | 46 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 47 | -------------------------------------------------------------------------------- /MCU/BootLoader/udisk/scsi_data.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/BootLoader/udisk/scsi_data.c -------------------------------------------------------------------------------- /MCU/BootLoader/udisk/usb_bot.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_bot.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief BOT State Machine management 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_BOT_H 30 | #define __USB_BOT_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "base.h" 34 | 35 | /* Exported types ------------------------------------------------------------*/ 36 | /* Bulk-only Command Block Wrapper */ 37 | typedef struct _Bulk_Only_CBW { 38 | uint32_t dSignature; 39 | uint32_t dTag; 40 | uint32_t dDataLength; 41 | uint8_t bmFlags; 42 | uint8_t bLUN; 43 | uint8_t bCBLength; 44 | uint8_t CB[16]; 45 | } Bulk_Only_CBW; 46 | 47 | /* Bulk-only Command Status Wrapper */ 48 | typedef struct _Bulk_Only_CSW { 49 | uint32_t dSignature; 50 | uint32_t dTag; 51 | uint32_t dDataResidue; 52 | uint8_t bStatus; 53 | } Bulk_Only_CSW; 54 | /* Exported constants --------------------------------------------------------*/ 55 | 56 | /*****************************************************************************/ 57 | /*********************** Bulk-Only Transfer State machine ********************/ 58 | /*****************************************************************************/ 59 | #define BOT_IDLE 0 /* Idle state */ 60 | #define BOT_DATA_OUT 1 /* Data Out state */ 61 | #define BOT_DATA_IN 2 /* Data In state */ 62 | #define BOT_DATA_IN_LAST 3 /* Last Data In Last */ 63 | #define BOT_CSW_Send 4 /* Command Status Wrapper */ 64 | #define BOT_ERROR 5 /* error state */ 65 | 66 | #define BOT_CBW_SIGNATURE 0x43425355 67 | #define BOT_CSW_SIGNATURE 0x53425355 68 | #define BOT_CBW_PACKET_LENGTH 31 69 | 70 | #define CSW_DATA_LENGTH 0x000D 71 | 72 | /* CSW Status Definitions */ 73 | #define CSW_CMD_PASSED 0x00 74 | #define CSW_CMD_FAILED 0x01 75 | #define CSW_PHASE_ERROR 0x02 76 | 77 | #define SEND_CSW_DISABLE 0 78 | #define SEND_CSW_ENABLE 1 79 | 80 | #define DIR_IN 0 81 | #define DIR_OUT 1 82 | #define BOTH_DIR 2 83 | 84 | #define BULK_MAX_PACKET_SIZE 0x00000040 85 | 86 | /* Exported macro ------------------------------------------------------------*/ 87 | /* Exported functions ------------------------------------------------------- */ 88 | void Mass_Storage_In(void); 89 | void Mass_Storage_Out(void); 90 | void CBW_Decode(void); 91 | void Transfer_Data_Request(uint8_t *Data_Pointer, uint16_t Data_Len); 92 | void Set_CSW(uint8_t CSW_Status, uint8_t Send_Permission); 93 | void Bot_Abort(uint8_t Direction); 94 | 95 | #endif /* __USB_BOT_H */ 96 | 97 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 98 | 99 | -------------------------------------------------------------------------------- /MCU/BootLoader/udisk/usb_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_conf.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Mass Storage Demo configuration header 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_CONF_H 30 | #define __USB_CONF_H 31 | 32 | /*-------------------------------------------------------------*/ 33 | /* EP_NUM */ 34 | /* defines how many endpoints are used by the device */ 35 | /*-------------------------------------------------------------*/ 36 | #define EP_NUM (3) 37 | 38 | /*-------------------------------------------------------------*/ 39 | /* -------------- Buffer Description Table -----------------*/ 40 | /*-------------------------------------------------------------*/ 41 | /* buffer table base address */ 42 | 43 | #define BTABLE_ADDRESS (0x00) 44 | 45 | /* EP0 */ 46 | /* rx/tx buffer base address */ 47 | #define ENDP0_RXADDR (0x18) 48 | #define ENDP0_TXADDR (0x58) 49 | 50 | /* EP1 */ 51 | /* tx buffer base address */ 52 | #define ENDP1_TXADDR (0x98) 53 | 54 | /* EP2 */ 55 | /* Rx buffer base address */ 56 | #define ENDP2_RXADDR (0xD8) 57 | 58 | /* ISTR events */ 59 | /* IMR_MSK */ 60 | /* mask defining which events has to be handled */ 61 | /* by the device application software */ 62 | #define IMR_MSK (CNTR_CTRM | CNTR_RESETM /*| CNTR_WKUPM | CNTR_SUSPM | CNTR_ERRM | CNTR_SOFM \ 63 | | CNTR_ESOFM*/) 64 | 65 | /* CTR service routines */ 66 | /* associated to defined endpoints */ 67 | //#define EP1_IN_Callback NOP_Process 68 | #define EP2_IN_Callback NOP_Process 69 | #define EP3_IN_Callback NOP_Process 70 | #define EP4_IN_Callback NOP_Process 71 | #define EP5_IN_Callback NOP_Process 72 | #define EP6_IN_Callback NOP_Process 73 | #define EP7_IN_Callback NOP_Process 74 | 75 | #define EP1_OUT_Callback NOP_Process 76 | //#define EP2_OUT_Callback NOP_Process 77 | #define EP3_OUT_Callback NOP_Process 78 | #define EP4_OUT_Callback NOP_Process 79 | #define EP5_OUT_Callback NOP_Process 80 | #define EP6_OUT_Callback NOP_Process 81 | #define EP7_OUT_Callback NOP_Process 82 | 83 | #endif /* __USB_CONF_H */ 84 | 85 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 86 | -------------------------------------------------------------------------------- /MCU/BootLoader/udisk/usb_desc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_desc.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Descriptor Header for Mass Storage Device 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_DESC_H 31 | #define __USB_DESC_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "hw_config.h" 35 | /* Exported types ------------------------------------------------------------*/ 36 | /* Exported constants --------------------------------------------------------*/ 37 | /* Exported macro ------------------------------------------------------------*/ 38 | /* Exported define -----------------------------------------------------------*/ 39 | #define MASS_SIZ_DEVICE_DESC 18 40 | #define MASS_SIZ_CONFIG_DESC 32 41 | 42 | #define MASS_SIZ_STRING_LANGID 4 43 | #define MASS_SIZ_STRING_VENDOR 38 44 | #define MASS_SIZ_STRING_PRODUCT 34 45 | #define MASS_SIZ_STRING_SERIAL 26 46 | #define MASS_SIZ_STRING_INTERFACE 16 47 | 48 | /* Exported functions ------------------------------------------------------- */ 49 | extern const uint8_t MASS_DeviceDescriptor[MASS_SIZ_DEVICE_DESC]; 50 | extern const uint8_t MASS_ConfigDescriptor[MASS_SIZ_CONFIG_DESC]; 51 | 52 | extern const uint8_t MASS_StringLangID[MASS_SIZ_STRING_LANGID]; 53 | extern const uint8_t MASS_StringVendor[MASS_SIZ_STRING_VENDOR]; 54 | extern const uint8_t MASS_StringProduct[MASS_SIZ_STRING_PRODUCT]; 55 | extern uint8_t MASS_StringSerial[MASS_SIZ_STRING_SERIAL]; 56 | extern const uint8_t MASS_StringInterface[MASS_SIZ_STRING_INTERFACE]; 57 | 58 | #endif /* __USB_DESC_H */ 59 | 60 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 61 | 62 | 63 | -------------------------------------------------------------------------------- /MCU/BootLoader/udisk/usb_endp.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_endp.c 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Endpoint routines 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "usb_lib.h" 30 | #include "usb_bot.h" 31 | #include "usb_istr.h" 32 | 33 | /* Private typedef -----------------------------------------------------------*/ 34 | /* Private define ------------------------------------------------------------*/ 35 | /* Private macro -------------------------------------------------------------*/ 36 | /* Private variables ---------------------------------------------------------*/ 37 | /* Private function prototypes -----------------------------------------------*/ 38 | /* Private functions ---------------------------------------------------------*/ 39 | 40 | /******************************************************************************* 41 | * Function Name : EP1_IN_Callback 42 | * Description : EP1 IN Callback Routine 43 | * Input : None. 44 | * Output : None. 45 | * Return : None. 46 | *******************************************************************************/ 47 | void EP1_IN_Callback(void) 48 | { 49 | Mass_Storage_In(); 50 | } 51 | 52 | /******************************************************************************* 53 | * Function Name : EP2_OUT_Callback. 54 | * Description : EP2 OUT Callback Routine. 55 | * Input : None. 56 | * Output : None. 57 | * Return : None. 58 | *******************************************************************************/ 59 | void EP2_OUT_Callback(void) 60 | { 61 | Mass_Storage_Out(); 62 | } 63 | 64 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 65 | -------------------------------------------------------------------------------- /MCU/BootLoader/udisk/usb_istr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_istr.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief This file includes the peripherals header files in the user application. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_ISTR_H 31 | #define __USB_ISTR_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usb_conf.h" 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | /* Exported macro ------------------------------------------------------------*/ 39 | /* Exported functions ------------------------------------------------------- */ 40 | 41 | void USB_Istr(void); 42 | 43 | /* function prototypes Automatically built defining related macros */ 44 | 45 | void EP1_IN_Callback(void); 46 | void EP2_IN_Callback(void); 47 | void EP3_IN_Callback(void); 48 | void EP4_IN_Callback(void); 49 | void EP5_IN_Callback(void); 50 | void EP6_IN_Callback(void); 51 | void EP7_IN_Callback(void); 52 | 53 | void EP1_OUT_Callback(void); 54 | void EP2_OUT_Callback(void); 55 | void EP3_OUT_Callback(void); 56 | void EP4_OUT_Callback(void); 57 | void EP5_OUT_Callback(void); 58 | void EP6_OUT_Callback(void); 59 | void EP7_OUT_Callback(void); 60 | 61 | #ifdef CTR_CALLBACK 62 | void CTR_Callback(void); 63 | #endif 64 | 65 | #ifdef DOVR_CALLBACK 66 | void DOVR_Callback(void); 67 | #endif 68 | 69 | #ifdef ERR_CALLBACK 70 | void ERR_Callback(void); 71 | #endif 72 | 73 | #ifdef WKUP_CALLBACK 74 | void WKUP_Callback(void); 75 | #endif 76 | 77 | #ifdef SUSP_CALLBACK 78 | void SUSP_Callback(void); 79 | #endif 80 | 81 | #ifdef RESET_CALLBACK 82 | void RESET_Callback(void); 83 | #endif 84 | 85 | #ifdef SOF_CALLBACK 86 | void SOF_Callback(void); 87 | #endif 88 | 89 | #ifdef ESOF_CALLBACK 90 | void ESOF_Callback(void); 91 | #endif 92 | 93 | #endif /*__USB_ISTR_H*/ 94 | 95 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 96 | -------------------------------------------------------------------------------- /MCU/BootLoader/udisk/usb_prop.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_prop.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief All processing related to Mass Storage Demo (Endpoint 0) 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_PROP_H 31 | #define __USB_PROP_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | 36 | /* Exported constants --------------------------------------------------------*/ 37 | #define Mass_Storage_GetConfiguration NOP_Process 38 | /* #define Mass_Storage_SetConfiguration NOP_Process*/ 39 | #define Mass_Storage_GetInterface NOP_Process 40 | #define Mass_Storage_SetInterface NOP_Process 41 | #define Mass_Storage_GetStatus NOP_Process 42 | /* #define Mass_Storage_ClearFeature NOP_Process*/ 43 | #define Mass_Storage_SetEndPointFeature NOP_Process 44 | #define Mass_Storage_SetDeviceFeature NOP_Process 45 | /*#define Mass_Storage_SetDeviceAddress NOP_Process*/ 46 | 47 | /* MASS Storage Requests*/ 48 | #define GET_MAX_LUN 0xFE 49 | #define MASS_STORAGE_RESET 0xFF 50 | #define LUN_DATA_LENGTH 1 51 | 52 | /* Exported macro ------------------------------------------------------------*/ 53 | /* Exported functions ------------------------------------------------------- */ 54 | void MASS_init(void); 55 | void MASS_Reset(void); 56 | void Mass_Storage_SetConfiguration(void); 57 | void Mass_Storage_ClearFeature(void); 58 | void Mass_Storage_SetDeviceAddress (void); 59 | void MASS_Status_In (void); 60 | void MASS_Status_Out (void); 61 | RESULT MASS_Data_Setup(uint8_t); 62 | RESULT MASS_NoData_Setup(uint8_t); 63 | RESULT MASS_Get_Interface_Setting(uint8_t Interface, uint8_t AlternateSetting); 64 | uint8_t *MASS_GetDeviceDescriptor(uint16_t ); 65 | uint8_t *MASS_GetConfigDescriptor(uint16_t); 66 | uint8_t *MASS_GetStringDescriptor(uint16_t); 67 | uint8_t *Get_Max_Lun(uint16_t Length); 68 | 69 | 70 | #endif /* __USB_PROP_H */ 71 | 72 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 73 | -------------------------------------------------------------------------------- /MCU/BootLoader/udisk/usb_pwr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_pwr.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Connection/disconnection & power management header 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_PWR_H 30 | #define __USB_PWR_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_type.h" 34 | #include "usb_core.h" 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | typedef enum _RESUME_STATE { 38 | RESUME_EXTERNAL, 39 | RESUME_INTERNAL, 40 | RESUME_LATER, 41 | RESUME_WAIT, 42 | RESUME_START, 43 | RESUME_ON, 44 | RESUME_OFF, 45 | RESUME_ESOF 46 | } RESUME_STATE; 47 | 48 | typedef enum _DEVICE_STATE { 49 | UNCONNECTED, 50 | ATTACHED, 51 | POWERED, 52 | SUSPENDED, 53 | ADDRESSED, 54 | CONFIGURED 55 | } DEVICE_STATE; 56 | 57 | /* Exported constants --------------------------------------------------------*/ 58 | /* Exported macro ------------------------------------------------------------*/ 59 | /* Exported functions ------------------------------------------------------- */ 60 | void Suspend(void); 61 | void Resume_Init(void); 62 | void Resume(RESUME_STATE eResumeSetVal); 63 | RESULT PowerOn(void); 64 | RESULT PowerOff(void); 65 | 66 | /* External variables --------------------------------------------------------*/ 67 | extern __IO uint32_t bDeviceState; /* USB device status */ 68 | extern __IO bool fSuspendEnabled; /* true when suspend is possible */ 69 | 70 | #endif /*__USB_PWR_H*/ 71 | 72 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 73 | -------------------------------------------------------------------------------- /MCU/BootLoader/udisk/usb_scsi.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/BootLoader/udisk/usb_scsi.c -------------------------------------------------------------------------------- /MCU/Libraries/CMSIS/CMSIS END USER LICENCE AGREEMENT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/Libraries/CMSIS/CMSIS END USER LICENCE AGREEMENT.pdf -------------------------------------------------------------------------------- /MCU/Libraries/CMSIS/Device/ST/STM32F10x/Include/stm32f10x.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/Libraries/CMSIS/Device/ST/STM32F10x/Include/stm32f10x.h -------------------------------------------------------------------------------- /MCU/Libraries/CMSIS/Device/ST/STM32F10x/Include/system_stm32f10x.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 09-March-2012 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /** @addtogroup CMSIS 29 | * @{ 30 | */ 31 | 32 | /** @addtogroup stm32f10x_system 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @brief Define to prevent recursive inclusion 38 | */ 39 | #ifndef __SYSTEM_STM32F10X_H 40 | #define __SYSTEM_STM32F10X_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /** @addtogroup STM32F10x_System_Includes 47 | * @{ 48 | */ 49 | 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @addtogroup STM32F10x_System_Exported_types 56 | * @{ 57 | */ 58 | 59 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | /** @addtogroup STM32F10x_System_Exported_Constants 66 | * @{ 67 | */ 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @addtogroup STM32F10x_System_Exported_Macros 74 | * @{ 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @addtogroup STM32F10x_System_Exported_Functions 82 | * @{ 83 | */ 84 | 85 | extern void SystemInit(void); 86 | extern void SystemCoreClockUpdate(void); 87 | /** 88 | * @} 89 | */ 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif /*__SYSTEM_STM32F10X_H */ 96 | 97 | /** 98 | * @} 99 | */ 100 | 101 | /** 102 | * @} 103 | */ 104 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 105 | -------------------------------------------------------------------------------- /MCU/Libraries/CMSIS/Device/ST/STM32F10x/Source/Templates/TASKING/cstart_thumb2.asm: -------------------------------------------------------------------------------- 1 | 2 | 3 | ;; NOTE: To allow the use of this file for both ARMv6M and ARMv7M, 4 | ;; we will only use 16-bit Thumb intructions. 5 | 6 | .extern _lc_ub_stack ; usr/sys mode stack pointer 7 | .extern _lc_ue_stack ; symbol required by debugger 8 | .extern _lc_ub_table ; ROM to RAM copy table 9 | .extern main 10 | .extern _Exit 11 | .extern exit 12 | .weak exit 13 | .global __get_argcv 14 | .weak __get_argcv 15 | .extern __argcvbuf 16 | .weak __argcvbuf 17 | ;;.extern __init_hardware 18 | .extern SystemInit 19 | 20 | .if @defined('__PROF_ENABLE__') 21 | .extern __prof_init 22 | .endif 23 | .if @defined('__POSIX__') 24 | .extern posix_main 25 | .extern _posix_boot_stack_top 26 | .endif 27 | 28 | .global _START 29 | 30 | .section .text.cstart 31 | 32 | .thumb 33 | _START: 34 | ;; anticipate possible ROM/RAM remapping 35 | ;; by loading the 'real' program address 36 | ldr r1,=_Next 37 | bx r1 38 | _Next: 39 | ;; initialize the stack pointer 40 | ldr r1,=_lc_ub_stack ; TODO: make this part of the vector table 41 | mov sp,r1 42 | 43 | ;; call a user function which initializes function. 44 | bl SystemInit 45 | 46 | ;; copy initialized sections from ROM to RAM 47 | ;; and clear uninitialized data sections in RAM 48 | 49 | ldr r3,=_lc_ub_table 50 | movs r0,#0 51 | cploop: 52 | ldr r4,[r3,#0] ; load type 53 | ldr r5,[r3,#4] ; dst address 54 | ldr r6,[r3,#8] ; src address 55 | ldr r7,[r3,#12] ; size 56 | 57 | cmp r4,#1 58 | beq copy 59 | cmp r4,#2 60 | beq clear 61 | b done 62 | 63 | copy: 64 | subs r7,r7,#1 65 | ldrb r1,[r6,r7] 66 | strb r1,[r5,r7] 67 | bne copy 68 | 69 | adds r3,r3,#16 70 | b cploop 71 | 72 | clear: 73 | subs r7,r7,#1 74 | strb r0,[r5,r7] 75 | bne clear 76 | 77 | adds r3,r3,#16 78 | b cploop 79 | 80 | done: 81 | 82 | .if @defined('__POSIX__') 83 | 84 | ;; posix stack buffer for system upbringing 85 | ldr r0,=_posix_boot_stack_top 86 | ldr r0, [r0] 87 | mov sp,r0 88 | 89 | .else 90 | 91 | ;; load r10 with end of USR/SYS stack, which is 92 | ;; needed in case stack overflow checking is on 93 | ;; NOTE: use 16-bit instructions only, for ARMv6M 94 | ldr r0,=_lc_ue_stack 95 | mov r10,r0 96 | 97 | .endif 98 | 99 | .if @defined('__PROF_ENABLE__') 100 | bl __prof_init 101 | .endif 102 | 103 | .if @defined('__POSIX__') 104 | ;; call posix_main with no arguments 105 | bl posix_main 106 | .else 107 | ;; retrieve argc and argv (default argv[0]==NULL & argc==0) 108 | bl __get_argcv 109 | ldr r1,=__argcvbuf 110 | ;; call main 111 | bl main 112 | .endif 113 | 114 | ;; call exit using the return value from main() 115 | ;; Note. Calling exit will also run all functions 116 | ;; that were supplied through atexit(). 117 | bl exit 118 | 119 | __get_argcv: ; weak definition 120 | movs r0,#0 121 | bx lr 122 | 123 | .ltorg 124 | .endsec 125 | 126 | .calls '_START', ' ' 127 | .calls '_START','__init_vector_table' 128 | .if @defined('__PROF_ENABLE__') 129 | .calls '_START','__prof_init' 130 | .endif 131 | .if @defined('__POSIX__') 132 | .calls '_START','posix_main' 133 | .else 134 | .calls '_START','__get_argcv' 135 | .calls '_START','main' 136 | .endif 137 | .calls '_START','exit' 138 | .calls '_START','',0 139 | 140 | .end 141 | -------------------------------------------------------------------------------- /MCU/Libraries/CMSIS/Include/arm_common_tables.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 11. November 2010 5 | * $Revision: V1.0.2 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_common_tables.h 9 | * 10 | * Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3 13 | * 14 | * Version 1.0.2 2010/11/11 15 | * Documentation updated. 16 | * 17 | * Version 1.0.1 2010/10/05 18 | * Production release and review comments incorporated. 19 | * 20 | * Version 1.0.0 2010/09/20 21 | * Production release and review comments incorporated. 22 | * -------------------------------------------------------------------- */ 23 | 24 | #ifndef _ARM_COMMON_TABLES_H 25 | #define _ARM_COMMON_TABLES_H 26 | 27 | #include "arm_math.h" 28 | 29 | extern const uint16_t armBitRevTable[1024]; 30 | extern const q15_t armRecipTableQ15[64]; 31 | extern const q31_t armRecipTableQ31[64]; 32 | extern const q31_t realCoefAQ31[1024]; 33 | extern const q31_t realCoefBQ31[1024]; 34 | extern const float32_t twiddleCoef[6144]; 35 | extern const q31_t twiddleCoefQ31[6144]; 36 | extern const q15_t twiddleCoefQ15[6144]; 37 | 38 | #endif /* ARM_COMMON_TABLES_H */ 39 | -------------------------------------------------------------------------------- /MCU/Libraries/CMSIS/README.txt: -------------------------------------------------------------------------------- 1 | * ------------------------------------------------------------------- 2 | * Copyright (C) 2011-2012 ARM Limited. All rights reserved. 3 | * 4 | * Date: 07 March 2012 5 | * Revision: V3.01 6 | * 7 | * Project: Cortex Microcontroller Software Interface Standard (CMSIS) 8 | * Title: Release Note for CMSIS 9 | * 10 | * ------------------------------------------------------------------- 11 | 12 | 13 | NOTE - Open the index.html file to access CMSIS documentation 14 | 15 | 16 | The Cortex Microcontroller Software Interface Standard (CMSIS) provides a single standard across all 17 | Cortex-Mx processor series vendors. It enables code re-use and code sharing across software projects 18 | and reduces time-to-market for new embedded applications. 19 | 20 | CMSIS is released under the terms of the end user license agreement ("CMSIS END USER LICENCE AGREEMENT.pdf"). 21 | Any user of the software package is bound to the terms and conditions of the end user license agreement. 22 | 23 | 24 | You will find the following sub-directories: 25 | 26 | Documentation - Contains CMSIS documentation. 27 | 28 | DSP_Lib - MDK project files, Examples and source files etc.. to build the 29 | CMSIS DSP Software Library for Cortex-M0, Cortex-M3, Cortex-M4 processors. 30 | 31 | Include - CMSIS Core Support and CMSIS DSP Include Files. 32 | 33 | Lib - CMSIS DSP Libraries. 34 | 35 | RTOS - CMSIS RTOS API template header file. 36 | 37 | SVD - CMSIS SVD Schema files and Conversion Utility. 38 | -------------------------------------------------------------------------------- /MCU/Libraries/CMSIS/SVD/SVDConv.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/Libraries/CMSIS/SVD/SVDConv.exe -------------------------------------------------------------------------------- /MCU/Libraries/CMSIS/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Redirect to the CMSIS main page after 0 seconds 5 | 6 | 7 | 8 | 9 | 10 | 11 | If the automatic redirection is failing, click open CMSIS Documentation. 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_CRC_H 31 | #define __STM32F10x_CRC_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f10x.h" 39 | 40 | /** @addtogroup STM32F10x_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup CRC 45 | * @{ 46 | */ 47 | 48 | /** @defgroup CRC_Exported_Types 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup CRC_Exported_Constants 57 | * @{ 58 | */ 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | /** @defgroup CRC_Exported_Macros 65 | * @{ 66 | */ 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | /** @defgroup CRC_Exported_Functions 73 | * @{ 74 | */ 75 | 76 | void CRC_ResetDR(void); 77 | uint32_t CRC_CalcCRC(uint32_t Data); 78 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 79 | uint32_t CRC_GetCRC(void); 80 | void CRC_SetIDRegister(uint8_t IDValue); 81 | uint8_t CRC_GetIDRegister(void); 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | #endif /* __STM32F10x_CRC_H */ 88 | /** 89 | * @} 90 | */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 101 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_dbgmcu.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_dbgmcu.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file contains all the functions prototypes for the DBGMCU 8 | * firmware library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_DBGMCU_H 31 | #define __STM32F10x_DBGMCU_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f10x.h" 39 | 40 | /** @addtogroup STM32F10x_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup DBGMCU 45 | * @{ 46 | */ 47 | 48 | /** @defgroup DBGMCU_Exported_Types 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup DBGMCU_Exported_Constants 57 | * @{ 58 | */ 59 | 60 | #define DBGMCU_SLEEP ((uint32_t)0x00000001) 61 | #define DBGMCU_STOP ((uint32_t)0x00000002) 62 | #define DBGMCU_STANDBY ((uint32_t)0x00000004) 63 | #define DBGMCU_IWDG_STOP ((uint32_t)0x00000100) 64 | #define DBGMCU_WWDG_STOP ((uint32_t)0x00000200) 65 | #define DBGMCU_TIM1_STOP ((uint32_t)0x00000400) 66 | #define DBGMCU_TIM2_STOP ((uint32_t)0x00000800) 67 | #define DBGMCU_TIM3_STOP ((uint32_t)0x00001000) 68 | #define DBGMCU_TIM4_STOP ((uint32_t)0x00002000) 69 | #define DBGMCU_CAN1_STOP ((uint32_t)0x00004000) 70 | #define DBGMCU_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00008000) 71 | #define DBGMCU_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00010000) 72 | #define DBGMCU_TIM8_STOP ((uint32_t)0x00020000) 73 | #define DBGMCU_TIM5_STOP ((uint32_t)0x00040000) 74 | #define DBGMCU_TIM6_STOP ((uint32_t)0x00080000) 75 | #define DBGMCU_TIM7_STOP ((uint32_t)0x00100000) 76 | #define DBGMCU_CAN2_STOP ((uint32_t)0x00200000) 77 | #define DBGMCU_TIM15_STOP ((uint32_t)0x00400000) 78 | #define DBGMCU_TIM16_STOP ((uint32_t)0x00800000) 79 | #define DBGMCU_TIM17_STOP ((uint32_t)0x01000000) 80 | #define DBGMCU_TIM12_STOP ((uint32_t)0x02000000) 81 | #define DBGMCU_TIM13_STOP ((uint32_t)0x04000000) 82 | #define DBGMCU_TIM14_STOP ((uint32_t)0x08000000) 83 | #define DBGMCU_TIM9_STOP ((uint32_t)0x10000000) 84 | #define DBGMCU_TIM10_STOP ((uint32_t)0x20000000) 85 | #define DBGMCU_TIM11_STOP ((uint32_t)0x40000000) 86 | 87 | #define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0x800000F8) == 0x00) && ((PERIPH) != 0x00)) 88 | /** 89 | * @} 90 | */ 91 | 92 | /** @defgroup DBGMCU_Exported_Macros 93 | * @{ 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | /** @defgroup DBGMCU_Exported_Functions 101 | * @{ 102 | */ 103 | 104 | uint32_t DBGMCU_GetREVID(void); 105 | uint32_t DBGMCU_GetDEVID(void); 106 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState); 107 | 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | 112 | #endif /* __STM32F10x_DBGMCU_H */ 113 | /** 114 | * @} 115 | */ 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /** 122 | * @} 123 | */ 124 | 125 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 126 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_iwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_iwdg.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file contains all the functions prototypes for the IWDG 8 | * firmware library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_IWDG_H 31 | #define __STM32F10x_IWDG_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f10x.h" 39 | 40 | /** @addtogroup STM32F10x_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup IWDG 45 | * @{ 46 | */ 47 | 48 | /** @defgroup IWDG_Exported_Types 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup IWDG_Exported_Constants 57 | * @{ 58 | */ 59 | 60 | /** @defgroup IWDG_WriteAccess 61 | * @{ 62 | */ 63 | 64 | #define IWDG_WriteAccess_Enable ((uint16_t)0x5555) 65 | #define IWDG_WriteAccess_Disable ((uint16_t)0x0000) 66 | #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \ 67 | ((ACCESS) == IWDG_WriteAccess_Disable)) 68 | /** 69 | * @} 70 | */ 71 | 72 | /** @defgroup IWDG_prescaler 73 | * @{ 74 | */ 75 | 76 | #define IWDG_Prescaler_4 ((uint8_t)0x00) 77 | #define IWDG_Prescaler_8 ((uint8_t)0x01) 78 | #define IWDG_Prescaler_16 ((uint8_t)0x02) 79 | #define IWDG_Prescaler_32 ((uint8_t)0x03) 80 | #define IWDG_Prescaler_64 ((uint8_t)0x04) 81 | #define IWDG_Prescaler_128 ((uint8_t)0x05) 82 | #define IWDG_Prescaler_256 ((uint8_t)0x06) 83 | #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \ 84 | ((PRESCALER) == IWDG_Prescaler_8) || \ 85 | ((PRESCALER) == IWDG_Prescaler_16) || \ 86 | ((PRESCALER) == IWDG_Prescaler_32) || \ 87 | ((PRESCALER) == IWDG_Prescaler_64) || \ 88 | ((PRESCALER) == IWDG_Prescaler_128)|| \ 89 | ((PRESCALER) == IWDG_Prescaler_256)) 90 | /** 91 | * @} 92 | */ 93 | 94 | /** @defgroup IWDG_Flag 95 | * @{ 96 | */ 97 | 98 | #define IWDG_FLAG_PVU ((uint16_t)0x0001) 99 | #define IWDG_FLAG_RVU ((uint16_t)0x0002) 100 | #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU)) 101 | #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF) 102 | /** 103 | * @} 104 | */ 105 | 106 | /** 107 | * @} 108 | */ 109 | 110 | /** @defgroup IWDG_Exported_Macros 111 | * @{ 112 | */ 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | /** @defgroup IWDG_Exported_Functions 119 | * @{ 120 | */ 121 | 122 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess); 123 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler); 124 | void IWDG_SetReload(uint16_t Reload); 125 | void IWDG_ReloadCounter(void); 126 | void IWDG_Enable(void); 127 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG); 128 | 129 | #ifdef __cplusplus 130 | } 131 | #endif 132 | 133 | #endif /* __STM32F10x_IWDG_H */ 134 | /** 135 | * @} 136 | */ 137 | 138 | /** 139 | * @} 140 | */ 141 | 142 | /** 143 | * @} 144 | */ 145 | 146 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 147 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_pwr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_pwr.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file contains all the functions prototypes for the PWR firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_PWR_H 31 | #define __STM32F10x_PWR_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f10x.h" 39 | 40 | /** @addtogroup STM32F10x_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup PWR 45 | * @{ 46 | */ 47 | 48 | /** @defgroup PWR_Exported_Types 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup PWR_Exported_Constants 57 | * @{ 58 | */ 59 | 60 | /** @defgroup PVD_detection_level 61 | * @{ 62 | */ 63 | 64 | #define PWR_PVDLevel_2V2 ((uint32_t)0x00000000) 65 | #define PWR_PVDLevel_2V3 ((uint32_t)0x00000020) 66 | #define PWR_PVDLevel_2V4 ((uint32_t)0x00000040) 67 | #define PWR_PVDLevel_2V5 ((uint32_t)0x00000060) 68 | #define PWR_PVDLevel_2V6 ((uint32_t)0x00000080) 69 | #define PWR_PVDLevel_2V7 ((uint32_t)0x000000A0) 70 | #define PWR_PVDLevel_2V8 ((uint32_t)0x000000C0) 71 | #define PWR_PVDLevel_2V9 ((uint32_t)0x000000E0) 72 | #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_2V2) || ((LEVEL) == PWR_PVDLevel_2V3)|| \ 73 | ((LEVEL) == PWR_PVDLevel_2V4) || ((LEVEL) == PWR_PVDLevel_2V5)|| \ 74 | ((LEVEL) == PWR_PVDLevel_2V6) || ((LEVEL) == PWR_PVDLevel_2V7)|| \ 75 | ((LEVEL) == PWR_PVDLevel_2V8) || ((LEVEL) == PWR_PVDLevel_2V9)) 76 | /** 77 | * @} 78 | */ 79 | 80 | /** @defgroup Regulator_state_is_STOP_mode 81 | * @{ 82 | */ 83 | 84 | #define PWR_Regulator_ON ((uint32_t)0x00000000) 85 | #define PWR_Regulator_LowPower ((uint32_t)0x00000001) 86 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \ 87 | ((REGULATOR) == PWR_Regulator_LowPower)) 88 | /** 89 | * @} 90 | */ 91 | 92 | /** @defgroup STOP_mode_entry 93 | * @{ 94 | */ 95 | 96 | #define PWR_STOPEntry_WFI ((uint8_t)0x01) 97 | #define PWR_STOPEntry_WFE ((uint8_t)0x02) 98 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE)) 99 | 100 | /** 101 | * @} 102 | */ 103 | 104 | /** @defgroup PWR_Flag 105 | * @{ 106 | */ 107 | 108 | #define PWR_FLAG_WU ((uint32_t)0x00000001) 109 | #define PWR_FLAG_SB ((uint32_t)0x00000002) 110 | #define PWR_FLAG_PVDO ((uint32_t)0x00000004) 111 | #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \ 112 | ((FLAG) == PWR_FLAG_PVDO)) 113 | 114 | #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB)) 115 | /** 116 | * @} 117 | */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** @defgroup PWR_Exported_Macros 124 | * @{ 125 | */ 126 | 127 | /** 128 | * @} 129 | */ 130 | 131 | /** @defgroup PWR_Exported_Functions 132 | * @{ 133 | */ 134 | 135 | void PWR_DeInit(void); 136 | void PWR_BackupAccessCmd(FunctionalState NewState); 137 | void PWR_PVDCmd(FunctionalState NewState); 138 | void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel); 139 | void PWR_WakeUpPinCmd(FunctionalState NewState); 140 | void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry); 141 | void PWR_EnterSTANDBYMode(void); 142 | FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG); 143 | void PWR_ClearFlag(uint32_t PWR_FLAG); 144 | 145 | #ifdef __cplusplus 146 | } 147 | #endif 148 | 149 | #endif /* __STM32F10x_PWR_H */ 150 | /** 151 | * @} 152 | */ 153 | 154 | /** 155 | * @} 156 | */ 157 | 158 | /** 159 | * @} 160 | */ 161 | 162 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 163 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_rtc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_rtc.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file contains all the functions prototypes for the RTC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_RTC_H 31 | #define __STM32F10x_RTC_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f10x.h" 39 | 40 | /** @addtogroup STM32F10x_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup RTC 45 | * @{ 46 | */ 47 | 48 | /** @defgroup RTC_Exported_Types 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup RTC_Exported_Constants 57 | * @{ 58 | */ 59 | 60 | /** @defgroup RTC_interrupts_define 61 | * @{ 62 | */ 63 | 64 | #define RTC_IT_OW ((uint16_t)0x0004) /*!< Overflow interrupt */ 65 | #define RTC_IT_ALR ((uint16_t)0x0002) /*!< Alarm interrupt */ 66 | #define RTC_IT_SEC ((uint16_t)0x0001) /*!< Second interrupt */ 67 | #define IS_RTC_IT(IT) ((((IT) & (uint16_t)0xFFF8) == 0x00) && ((IT) != 0x00)) 68 | #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_OW) || ((IT) == RTC_IT_ALR) || \ 69 | ((IT) == RTC_IT_SEC)) 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup RTC_interrupts_flags 75 | * @{ 76 | */ 77 | 78 | #define RTC_FLAG_RTOFF ((uint16_t)0x0020) /*!< RTC Operation OFF flag */ 79 | #define RTC_FLAG_RSF ((uint16_t)0x0008) /*!< Registers Synchronized flag */ 80 | #define RTC_FLAG_OW ((uint16_t)0x0004) /*!< Overflow flag */ 81 | #define RTC_FLAG_ALR ((uint16_t)0x0002) /*!< Alarm flag */ 82 | #define RTC_FLAG_SEC ((uint16_t)0x0001) /*!< Second flag */ 83 | #define IS_RTC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFF0) == 0x00) && ((FLAG) != 0x00)) 84 | #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_RTOFF) || ((FLAG) == RTC_FLAG_RSF) || \ 85 | ((FLAG) == RTC_FLAG_OW) || ((FLAG) == RTC_FLAG_ALR) || \ 86 | ((FLAG) == RTC_FLAG_SEC)) 87 | #define IS_RTC_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFFFF) 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** 94 | * @} 95 | */ 96 | 97 | /** @defgroup RTC_Exported_Macros 98 | * @{ 99 | */ 100 | 101 | /** 102 | * @} 103 | */ 104 | 105 | /** @defgroup RTC_Exported_Functions 106 | * @{ 107 | */ 108 | 109 | void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState); 110 | void RTC_EnterConfigMode(void); 111 | void RTC_ExitConfigMode(void); 112 | uint32_t RTC_GetCounter(void); 113 | void RTC_SetCounter(uint32_t CounterValue); 114 | void RTC_SetPrescaler(uint32_t PrescalerValue); 115 | void RTC_SetAlarm(uint32_t AlarmValue); 116 | uint32_t RTC_GetDivider(void); 117 | void RTC_WaitForLastTask(void); 118 | void RTC_WaitForSynchro(void); 119 | FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG); 120 | void RTC_ClearFlag(uint16_t RTC_FLAG); 121 | ITStatus RTC_GetITStatus(uint16_t RTC_IT); 122 | void RTC_ClearITPendingBit(uint16_t RTC_IT); 123 | 124 | #ifdef __cplusplus 125 | } 126 | #endif 127 | 128 | #endif /* __STM32F10x_RTC_H */ 129 | /** 130 | * @} 131 | */ 132 | 133 | /** 134 | * @} 135 | */ 136 | 137 | /** 138 | * @} 139 | */ 140 | 141 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 142 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32F10x_StdPeriph_Driver/inc/stm32f10x_wwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_wwdg.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file contains all the functions prototypes for the WWDG firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_WWDG_H 31 | #define __STM32F10x_WWDG_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f10x.h" 39 | 40 | /** @addtogroup STM32F10x_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup WWDG 45 | * @{ 46 | */ 47 | 48 | /** @defgroup WWDG_Exported_Types 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup WWDG_Exported_Constants 57 | * @{ 58 | */ 59 | 60 | /** @defgroup WWDG_Prescaler 61 | * @{ 62 | */ 63 | 64 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000) 65 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080) 66 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100) 67 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180) 68 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \ 69 | ((PRESCALER) == WWDG_Prescaler_2) || \ 70 | ((PRESCALER) == WWDG_Prescaler_4) || \ 71 | ((PRESCALER) == WWDG_Prescaler_8)) 72 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F) 73 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F)) 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | /** @defgroup WWDG_Exported_Macros 84 | * @{ 85 | */ 86 | /** 87 | * @} 88 | */ 89 | 90 | /** @defgroup WWDG_Exported_Functions 91 | * @{ 92 | */ 93 | 94 | void WWDG_DeInit(void); 95 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler); 96 | void WWDG_SetWindowValue(uint8_t WindowValue); 97 | void WWDG_EnableIT(void); 98 | void WWDG_SetCounter(uint8_t Counter); 99 | void WWDG_Enable(uint8_t Counter); 100 | FlagStatus WWDG_GetFlagStatus(void); 101 | void WWDG_ClearFlag(void); 102 | 103 | #ifdef __cplusplus 104 | } 105 | #endif 106 | 107 | #endif /* __STM32F10x_WWDG_H */ 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 122 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_crc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.c 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 05-March-2012 7 | * @brief This file provides all the CRC firmware functions. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32f10x_crc.h" 30 | 31 | /** @addtogroup STM32F10x_StdPeriph_Driver 32 | * @{ 33 | */ 34 | 35 | /** @defgroup CRC 36 | * @brief CRC driver modules 37 | * @{ 38 | */ 39 | 40 | /** @defgroup CRC_Private_TypesDefinitions 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | /** @defgroup CRC_Private_Defines 49 | * @{ 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup CRC_Private_Macros 57 | * @{ 58 | */ 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | /** @defgroup CRC_Private_Variables 65 | * @{ 66 | */ 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | /** @defgroup CRC_Private_FunctionPrototypes 73 | * @{ 74 | */ 75 | 76 | /** 77 | * @} 78 | */ 79 | 80 | /** @defgroup CRC_Private_Functions 81 | * @{ 82 | */ 83 | 84 | /** 85 | * @brief Resets the CRC Data register (DR). 86 | * @param None 87 | * @retval None 88 | */ 89 | void CRC_ResetDR(void) 90 | { 91 | /* Reset CRC generator */ 92 | CRC->CR = CRC_CR_RESET; 93 | } 94 | 95 | /** 96 | * @brief Computes the 32-bit CRC of a given data word(32-bit). 97 | * @param Data: data word(32-bit) to compute its CRC 98 | * @retval 32-bit CRC 99 | */ 100 | uint32_t CRC_CalcCRC(uint32_t Data) 101 | { 102 | CRC->DR = Data; 103 | 104 | return (CRC->DR); 105 | } 106 | 107 | /** 108 | * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit). 109 | * @param pBuffer: pointer to the buffer containing the data to be computed 110 | * @param BufferLength: length of the buffer to be computed 111 | * @retval 32-bit CRC 112 | */ 113 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength) 114 | { 115 | uint32_t index = 0; 116 | 117 | for(index = 0; index < BufferLength; index++) 118 | { 119 | CRC->DR = pBuffer[index]; 120 | } 121 | return (CRC->DR); 122 | } 123 | 124 | /** 125 | * @brief Returns the current CRC value. 126 | * @param None 127 | * @retval 32-bit CRC 128 | */ 129 | uint32_t CRC_GetCRC(void) 130 | { 131 | return (CRC->DR); 132 | } 133 | 134 | /** 135 | * @brief Stores a 8-bit data in the Independent Data(ID) register. 136 | * @param IDValue: 8-bit value to be stored in the ID register 137 | * @retval None 138 | */ 139 | void CRC_SetIDRegister(uint8_t IDValue) 140 | { 141 | CRC->IDR = IDValue; 142 | } 143 | 144 | /** 145 | * @brief Returns the 8-bit data stored in the Independent Data(ID) register 146 | * @param None 147 | * @retval 8-bit value of the ID register 148 | */ 149 | uint8_t CRC_GetIDRegister(void) 150 | { 151 | return (CRC->IDR); 152 | } 153 | 154 | /** 155 | * @} 156 | */ 157 | 158 | /** 159 | * @} 160 | */ 161 | 162 | /** 163 | * @} 164 | */ 165 | 166 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 167 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c -------------------------------------------------------------------------------- /MCU/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c -------------------------------------------------------------------------------- /MCU/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/Libraries/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c -------------------------------------------------------------------------------- /MCU/Libraries/STM32_USB-FS-Device_Driver/inc/usb_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_def.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Definitions related to USB Core 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_DEF_H 30 | #define __USB_DEF_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | /* Exported types ------------------------------------------------------------*/ 34 | typedef enum _RECIPIENT_TYPE 35 | { 36 | DEVICE_RECIPIENT, /* Recipient device */ 37 | INTERFACE_RECIPIENT, /* Recipient interface */ 38 | ENDPOINT_RECIPIENT, /* Recipient endpoint */ 39 | OTHER_RECIPIENT 40 | } RECIPIENT_TYPE; 41 | 42 | 43 | typedef enum _STANDARD_REQUESTS 44 | { 45 | GET_STATUS = 0, 46 | CLEAR_FEATURE, 47 | RESERVED1, 48 | SET_FEATURE, 49 | RESERVED2, 50 | SET_ADDRESS, 51 | GET_DESCRIPTOR, 52 | SET_DESCRIPTOR, 53 | GET_CONFIGURATION, 54 | SET_CONFIGURATION, 55 | GET_INTERFACE, 56 | SET_INTERFACE, 57 | TOTAL_sREQUEST, /* Total number of Standard request */ 58 | SYNCH_FRAME = 12 59 | } STANDARD_REQUESTS; 60 | 61 | /* Definition of "USBwValue" */ 62 | typedef enum _DESCRIPTOR_TYPE 63 | { 64 | DEVICE_DESCRIPTOR = 1, 65 | CONFIG_DESCRIPTOR, 66 | STRING_DESCRIPTOR, 67 | INTERFACE_DESCRIPTOR, 68 | ENDPOINT_DESCRIPTOR 69 | } DESCRIPTOR_TYPE; 70 | 71 | /* Feature selector of a SET_FEATURE or CLEAR_FEATURE */ 72 | typedef enum _FEATURE_SELECTOR 73 | { 74 | ENDPOINT_STALL, 75 | DEVICE_REMOTE_WAKEUP 76 | } FEATURE_SELECTOR; 77 | 78 | /* Exported constants --------------------------------------------------------*/ 79 | /* Definition of "USBbmRequestType" */ 80 | #define REQUEST_TYPE 0x60 /* Mask to get request type */ 81 | #define STANDARD_REQUEST 0x00 /* Standard request */ 82 | #define CLASS_REQUEST 0x20 /* Class request */ 83 | #define VENDOR_REQUEST 0x40 /* Vendor request */ 84 | 85 | #define RECIPIENT 0x1F /* Mask to get recipient */ 86 | 87 | /* Exported macro ------------------------------------------------------------*/ 88 | /* Exported functions ------------------------------------------------------- */ 89 | 90 | #endif /* __USB_DEF_H */ 91 | 92 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 93 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32_USB-FS-Device_Driver/inc/usb_init.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_init.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Initialization routines & global variables 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_INIT_H 31 | #define __USB_INIT_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported functions ------------------------------------------------------- */ 38 | void USB_Init(void); 39 | 40 | /* External variables --------------------------------------------------------*/ 41 | /* The number of current endpoint, it will be used to specify an endpoint */ 42 | extern uint8_t EPindex; 43 | /* The number of current device, it is an index to the Device_Table */ 44 | /*extern uint8_t Device_no; */ 45 | /* Points to the DEVICE_INFO structure of current device */ 46 | /* The purpose of this register is to speed up the execution */ 47 | extern DEVICE_INFO* pInformation; 48 | /* Points to the DEVICE_PROP structure of current device */ 49 | /* The purpose of this register is to speed up the execution */ 50 | extern DEVICE_PROP* pProperty; 51 | /* Temporary save the state of Rx & Tx status. */ 52 | /* Whenever the Rx or Tx state is changed, its value is saved */ 53 | /* in this variable first and will be set to the EPRB or EPRA */ 54 | /* at the end of interrupt process */ 55 | extern USER_STANDARD_REQUESTS *pUser_Standard_Requests; 56 | 57 | extern uint16_t SaveState ; 58 | extern uint16_t wInterrupt_Mask; 59 | 60 | #endif /* __USB_INIT_H */ 61 | 62 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 63 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32_USB-FS-Device_Driver/inc/usb_int.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_int.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Endpoint CTR (Low and High) interrupt's service routines prototypes 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_INT_H 31 | #define __USB_INT_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported functions ------------------------------------------------------- */ 38 | void CTR_LP(void); 39 | void CTR_HP(void); 40 | 41 | /* External variables --------------------------------------------------------*/ 42 | 43 | #endif /* __USB_INT_H */ 44 | 45 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 46 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32_USB-FS-Device_Driver/inc/usb_lib.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_lib.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief USB library include files 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_LIB_H 31 | #define __USB_LIB_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "hw_config.h" 35 | #include "usb_type.h" 36 | #include "usb_regs.h" 37 | #include "usb_def.h" 38 | #include "usb_core.h" 39 | #include "usb_init.h" 40 | #include "usb_sil.h" 41 | #include "usb_mem.h" 42 | #include "usb_int.h" 43 | 44 | /* Exported types ------------------------------------------------------------*/ 45 | /* Exported constants --------------------------------------------------------*/ 46 | /* Exported macro ------------------------------------------------------------*/ 47 | /* Exported functions ------------------------------------------------------- */ 48 | /* External variables --------------------------------------------------------*/ 49 | 50 | #endif /* __USB_LIB_H */ 51 | 52 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 53 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32_USB-FS-Device_Driver/inc/usb_mem.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_mem.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Utility prototypes functions for memory/PMA transfers 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_MEM_H 31 | #define __USB_MEM_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported functions ------------------------------------------------------- */ 38 | void UserToPMABufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes); 39 | void PMAToUserBufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes); 40 | 41 | /* External variables --------------------------------------------------------*/ 42 | 43 | #endif /*__USB_MEM_H*/ 44 | 45 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 46 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32_USB-FS-Device_Driver/inc/usb_sil.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_sil.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Simplified Interface Layer function prototypes. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_SIL_H 31 | #define __USB_SIL_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported functions ------------------------------------------------------- */ 38 | 39 | uint32_t USB_SIL_Init(void); 40 | uint32_t USB_SIL_Write(uint8_t bEpAddr, uint8_t* pBufferPointer, uint32_t wBufferSize); 41 | uint32_t USB_SIL_Read(uint8_t bEpAddr, uint8_t* pBufferPointer); 42 | 43 | /* External variables --------------------------------------------------------*/ 44 | 45 | #endif /* __USB_SIL_H */ 46 | 47 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 48 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32_USB-FS-Device_Driver/inc/usb_type.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_type.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Type definitions used by the USB Library 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_TYPE_H 31 | #define __USB_TYPE_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usb_conf.h" 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | 39 | #ifndef __BASE_H__ 40 | #ifndef NULL 41 | #define NULL ((void *)0) 42 | #endif 43 | 44 | typedef enum 45 | { 46 | FALSE = 0, 47 | TRUE = !FALSE 48 | } bool; 49 | #endif 50 | 51 | /* Exported macro ------------------------------------------------------------*/ 52 | /* Exported functions ------------------------------------------------------- */ 53 | /* External variables --------------------------------------------------------*/ 54 | 55 | #endif /* __USB_TYPE_H */ 56 | 57 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 58 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32_USB-FS-Device_Driver/src/usb_init.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_init.c 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Initialization routines & global variables 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "usb_lib.h" 31 | 32 | /* Private typedef -----------------------------------------------------------*/ 33 | /* Private define ------------------------------------------------------------*/ 34 | /* Private macro -------------------------------------------------------------*/ 35 | /* Private variables ---------------------------------------------------------*/ 36 | /* The number of current endpoint, it will be used to specify an endpoint */ 37 | uint8_t EPindex; 38 | /* The number of current device, it is an index to the Device_Table */ 39 | /* uint8_t Device_no; */ 40 | /* Points to the DEVICE_INFO structure of current device */ 41 | /* The purpose of this register is to speed up the execution */ 42 | DEVICE_INFO *pInformation; 43 | /* Points to the DEVICE_PROP structure of current device */ 44 | /* The purpose of this register is to speed up the execution */ 45 | DEVICE_PROP *pProperty; 46 | /* Temporary save the state of Rx & Tx status. */ 47 | /* Whenever the Rx or Tx state is changed, its value is saved */ 48 | /* in this variable first and will be set to the EPRB or EPRA */ 49 | /* at the end of interrupt process */ 50 | uint16_t SaveState ; 51 | uint16_t wInterrupt_Mask; 52 | DEVICE_INFO Device_Info; 53 | USER_STANDARD_REQUESTS *pUser_Standard_Requests; 54 | 55 | /* Extern variables ----------------------------------------------------------*/ 56 | /* Private function prototypes -----------------------------------------------*/ 57 | /* Private functions ---------------------------------------------------------*/ 58 | 59 | /******************************************************************************* 60 | * Function Name : USB_Init 61 | * Description : USB system initialization 62 | * Input : None. 63 | * Output : None. 64 | * Return : None. 65 | *******************************************************************************/ 66 | void USB_Init(void) 67 | { 68 | pInformation = &Device_Info; 69 | pInformation->ControlState = 2; 70 | pProperty = &Device_Property; 71 | pUser_Standard_Requests = &User_Standard_Requests; 72 | /* Initialize devices one by one */ 73 | pProperty->Init(); 74 | } 75 | 76 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 77 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32_USB-FS-Device_Driver/src/usb_mem.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_mem.c 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Utility functions for memory transfers to/from PMA 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "usb_lib.h" 30 | 31 | /* Private typedef -----------------------------------------------------------*/ 32 | /* Private define ------------------------------------------------------------*/ 33 | /* Private macro -------------------------------------------------------------*/ 34 | /* Private variables ---------------------------------------------------------*/ 35 | /* Extern variables ----------------------------------------------------------*/ 36 | /* Private function prototypes -----------------------------------------------*/ 37 | /* Private functions ---------------------------------------------------------*/ 38 | 39 | /******************************************************************************* 40 | * Function Name : UserToPMABufferCopy 41 | * Description : Copy a buffer from user memory area to packet memory area (PMA) 42 | * Input : - pbUsrBuf: pointer to user memory area. 43 | * - wPMABufAddr: address into PMA. 44 | * - wNBytes: no. of bytes to be copied. 45 | * Output : None. 46 | * Return : None . 47 | *******************************************************************************/ 48 | void UserToPMABufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes) 49 | { 50 | uint32_t n = (wNBytes + 1) >> 1; /* n = (wNBytes + 1) / 2 */ 51 | uint32_t i, temp1, temp2; 52 | uint16_t *pdwVal; 53 | pdwVal = (uint16_t *)(wPMABufAddr * 2 + PMAAddr); 54 | for (i = n; i != 0; i--) 55 | { 56 | temp1 = (uint16_t) * pbUsrBuf; 57 | pbUsrBuf++; 58 | temp2 = temp1 | (uint16_t) * pbUsrBuf << 8; 59 | *pdwVal++ = temp2; 60 | pdwVal++; 61 | pbUsrBuf++; 62 | } 63 | } 64 | 65 | /******************************************************************************* 66 | * Function Name : PMAToUserBufferCopy 67 | * Description : Copy a buffer from user memory area to packet memory area (PMA) 68 | * Input : - pbUsrBuf = pointer to user memory area. 69 | * - wPMABufAddr = address into PMA. 70 | * - wNBytes = no. of bytes to be copied. 71 | * Output : None. 72 | * Return : None. 73 | *******************************************************************************/ 74 | void PMAToUserBufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes) 75 | { 76 | uint32_t n = (wNBytes + 1) >> 1;/* /2*/ 77 | uint32_t i; 78 | uint32_t *pdwVal; 79 | pdwVal = (uint32_t *)(wPMABufAddr * 2 + PMAAddr); 80 | for (i = n; i != 0; i--) 81 | { 82 | *(uint16_t*)pbUsrBuf++ = *pdwVal++; 83 | pbUsrBuf++; 84 | } 85 | } 86 | 87 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 88 | -------------------------------------------------------------------------------- /MCU/Libraries/STM32_USB-FS-Device_Driver/src/usb_sil.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_sil.c 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Simplified Interface Layer for Global Initialization and Endpoint 8 | * Rea/Write operations. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "usb_lib.h" 32 | 33 | /* Private typedef -----------------------------------------------------------*/ 34 | /* Private define ------------------------------------------------------------*/ 35 | /* Private macro -------------------------------------------------------------*/ 36 | /* Private variables ---------------------------------------------------------*/ 37 | /* Extern variables ----------------------------------------------------------*/ 38 | /* Private function prototypes -----------------------------------------------*/ 39 | /* Private functions ---------------------------------------------------------*/ 40 | 41 | /******************************************************************************* 42 | * Function Name : USB_SIL_Init 43 | * Description : Initialize the USB Device IP and the Endpoint 0. 44 | * Input : None. 45 | * Output : None. 46 | * Return : Status. 47 | *******************************************************************************/ 48 | uint32_t USB_SIL_Init(void) 49 | { 50 | /* USB interrupts initialization */ 51 | /* clear pending interrupts */ 52 | _SetISTR(0); 53 | wInterrupt_Mask = IMR_MSK; 54 | /* set interrupts mask */ 55 | _SetCNTR(wInterrupt_Mask); 56 | return 0; 57 | } 58 | 59 | /******************************************************************************* 60 | * Function Name : USB_SIL_Write 61 | * Description : Write a buffer of data to a selected endpoint. 62 | * Input : - bEpAddr: The address of the non control endpoint. 63 | * - pBufferPointer: The pointer to the buffer of data to be written 64 | * to the endpoint. 65 | * - wBufferSize: Number of data to be written (in bytes). 66 | * Output : None. 67 | * Return : Status. 68 | *******************************************************************************/ 69 | uint32_t USB_SIL_Write(uint8_t bEpAddr, uint8_t* pBufferPointer, uint32_t wBufferSize) 70 | { 71 | /* Use the memory interface function to write to the selected endpoint */ 72 | UserToPMABufferCopy(pBufferPointer, GetEPTxAddr(bEpAddr & 0x7F), wBufferSize); 73 | 74 | /* Update the data length in the control register */ 75 | SetEPTxCount((bEpAddr & 0x7F), wBufferSize); 76 | 77 | return 0; 78 | } 79 | 80 | /******************************************************************************* 81 | * Function Name : USB_SIL_Read 82 | * Description : Read a buffer of data from a selected endpoint. 83 | * Input : - bEpAddr: The address of the non control endpoint. 84 | * - pBufferPointer: The pointer to which will be saved the 85 | * received data buffer. 86 | * Output : None. 87 | * Return : Number of received data (in Bytes). 88 | *******************************************************************************/ 89 | uint32_t USB_SIL_Read(uint8_t bEpAddr, uint8_t* pBufferPointer) 90 | { 91 | uint32_t DataLength = 0; 92 | 93 | /* Get the number of received data on the selected Endpoint */ 94 | DataLength = GetEPRxCount(bEpAddr & 0x7F); 95 | 96 | /* Use the memory interface function to write to the selected endpoint */ 97 | PMAToUserBufferCopy(pBufferPointer, GetEPRxAddr(bEpAddr & 0x7F), DataLength); 98 | 99 | /* Return the number of received data */ 100 | return DataLength; 101 | } 102 | 103 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 104 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/MDK-ARM/RTE/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Component Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'App' 7 | * Target: 'App_Stand' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | #endif /* RTE_COMPONENTS_H */ 15 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/clean.bat: -------------------------------------------------------------------------------- 1 | del /S /Q MDK-ARM\lst\*.* 2 | del /S /Q MDK-ARM\out\*.* 3 | del /S /Q MDK-ARM\*.bak -------------------------------------------------------------------------------- /MCU/USB-Blaster/drv/base.h: -------------------------------------------------------------------------------- 1 | #ifndef __BASE_H__ 2 | #define __BASE_H__ 3 | 4 | #include "platform_config.h" 5 | 6 | #include 7 | 8 | /*typedef signed char int8_t; 9 | typedef unsigned char uint8_t; 10 | typedef signed short int16_t; 11 | typedef unsigned short uint16_t; 12 | typedef signed long int32_t; 13 | typedef unsigned long uint32_t;*/ 14 | 15 | #ifndef INLINE 16 | #define INLINE 17 | #endif 18 | 19 | #ifndef TRUE 20 | typedef unsigned char BOOL; 21 | #define TRUE 1 22 | #define FALSE 0 23 | #endif 24 | 25 | #ifndef NULL 26 | #define NULL ((void*)0) 27 | #endif 28 | 29 | #ifndef MIN 30 | #define MIN(a,b) ((a)<=(b)?(a):(b)) 31 | #endif 32 | 33 | #ifndef MAX 34 | #define MAX(a,b) ((a)>=(b)?(a):(b)) 35 | #endif 36 | 37 | #define BITS_SET(v,b) ((v) |= (b)) 38 | #define BITS_CLR(v,b) ((v) &= ~(b)) 39 | #define BITS_CHK(v,b) (((v) & (b)) == (b)) 40 | 41 | #endif // __BASE_H__ 42 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/drv/bitband.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/USB-Blaster/drv/bitband.h -------------------------------------------------------------------------------- /MCU/USB-Blaster/drv/led.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/USB-Blaster/drv/led.c -------------------------------------------------------------------------------- /MCU/USB-Blaster/drv/led.h: -------------------------------------------------------------------------------- 1 | /* 2 | led.h 3 | 4 | MIT License 5 | 6 | Copyright (c) 2016 Yongqian Tang 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | */ 26 | #ifndef __LED_H__ 27 | #define __LED_H__ 28 | 29 | #include "base.h" 30 | 31 | void led_init(void); 32 | 33 | void led_update(void); 34 | 35 | void led_light(BOOL is_light); 36 | 37 | void led_flash(uint16_t period, uint16_t pulse, uint16_t cycles); 38 | 39 | #endif //__LED_H__ 40 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/drv/platform_config.h: -------------------------------------------------------------------------------- 1 | #ifndef __PLATFORM_CONFIG_H__ 2 | #define __PLATFORM_CONFIG_H__ 3 | 4 | #include "stm32f10x.h" 5 | 6 | #endif // __PLATFORM_CONFIG_H__ 7 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/drv/timebase.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/USB-Blaster/drv/timebase.c -------------------------------------------------------------------------------- /MCU/USB-Blaster/drv/timebase.h: -------------------------------------------------------------------------------- 1 | /* 2 | timebase.h 3 | 4 | MIT License 5 | 6 | Copyright (c) 2016 Yongqian Tang 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | */ 26 | #ifndef __TIMEBASE_H__ 27 | #define __TIMEBASE_H__ 28 | 29 | #include "base.h" 30 | 31 | void timebase_init(void); 32 | 33 | uint32_t ticks(void); 34 | 35 | uint32_t micros(void); 36 | 37 | uint32_t millis(void); 38 | 39 | void delay_us(uint32_t us); 40 | 41 | void delay_ms(uint32_t ms); 42 | 43 | #endif //__TIMEBASE_H__ 44 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/USB-Blaster/readme.txt -------------------------------------------------------------------------------- /MCU/USB-Blaster/src/blaster.h: -------------------------------------------------------------------------------- 1 | /* 2 | blaster.c - USB-Blaster core header 3 | 4 | MIT License 5 | 6 | Copyright (c) 2016 Yongqian Tang 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | */ 26 | #ifndef __BLASTER_H__ 27 | #define __BLASTER_H__ 28 | 29 | void blaster_init(void); 30 | 31 | void blaster_exec(void); 32 | 33 | #endif //__BLASTER_H__ 34 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/src/blaster_port.h: -------------------------------------------------------------------------------- 1 | /* 2 | blaster_port.h - USB-Blaster IO port header 3 | 4 | MIT License 5 | 6 | Copyright (c) 2016 Yongqian Tang 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | */ 26 | #ifndef __BLASTER_PORT_H__ 27 | #define __BLASTER_PORT_H__ 28 | 29 | #include "base.h" 30 | 31 | // mode set 32 | #define BLASTER_STA_SHIFT (0x80) 33 | #define BLASTER_STA_READ (0x40) 34 | #define BLASTER_STA_CNT_MASK (0x3f) 35 | 36 | // bit-bang out 37 | #define BLASTER_STA_OUT_OE (0x20) 38 | #define BLASTER_STA_OUT_TDI (0x10) 39 | #define BLASTER_STA_OUT_NCS (0x08) 40 | #define BLASTER_STA_OUT_NCE (0x04) 41 | #define BLASTER_STA_OUT_TMS (0x02) 42 | #define BLASTER_STA_OUT_TCK (0x01) 43 | 44 | // bit-bang in 45 | #define BLASTER_STA_IN_TDO (0x01) 46 | #define BLASTER_STA_IN_DATAOUT (0x02) 47 | 48 | #define BLASTER_STA_IN_TDO_BIT (0) 49 | #define BLASTER_STA_IN_DATAOUT_BIT (1) 50 | 51 | void bport_init(void); 52 | 53 | void bport_state_set(uint8_t d); 54 | uint8_t bport_state_get(void); 55 | 56 | void bport_shift_out(uint8_t d); 57 | uint8_t bport_shift_io(uint8_t d); 58 | 59 | #endif //__BLASTER_PORT_H__ 60 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/src/ft245rom.c: -------------------------------------------------------------------------------- 1 | /* 2 | ft245rom.c - emulate FT245B chip EEPROM within USB-Blaster 3 | 4 | MIT License 5 | 6 | Copyright (c) 2016 Yongqian Tang 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | */ 26 | 27 | #include "base.h" 28 | #include "usb_desc.h" 29 | #include "ft245rom.h" 30 | 31 | static uint8_t s_ft245rom_buf[FT245ROM_SIZE] = {0}; 32 | 33 | uint16_t ft245rom_checksum(const uint8_t *pbuf, uint8_t len) 34 | { 35 | size_t i; 36 | uint16_t checksum; 37 | 38 | checksum = 0xAAAA; 39 | 40 | for (i = 0; i < len; i += 2) { 41 | checksum ^= ((uint16_t)pbuf[i + 1] << 8) | (uint16_t)pbuf[i]; 42 | checksum = (checksum << 1) | (checksum >> 15); 43 | } 44 | 45 | return checksum; 46 | } 47 | 48 | int ft245rom_init(void) 49 | { 50 | size_t i; 51 | uint8_t offset = 0; 52 | uint16_t checksum; 53 | uint8_t *pbuf = s_ft245rom_buf; 54 | 55 | if (Blaster_StringVendor[0] + Blaster_StringProduct[0] + Blaster_StringSerial[0] > FT245ROM_STR_LIMIT) { 56 | return -1; 57 | } 58 | 59 | *pbuf++ = 0x0; 60 | *pbuf++ = 0x0; 61 | for (i = 0; i < 6; i++) { 62 | *pbuf++ = Blaster_DeviceDescriptor[8 + i]; // vid/pid/ver 63 | } 64 | *pbuf++ = Blaster_ConfigDescriptor[7]; // attr 65 | *pbuf++ = Blaster_ConfigDescriptor[8]; // pwr 66 | *pbuf++ = 0x1C; // chip config 67 | *pbuf++ = 0x00; 68 | *pbuf++ = Blaster_DeviceDescriptor[2]; // usb ver 69 | *pbuf++ = Blaster_DeviceDescriptor[3]; // usb ver 70 | 71 | // strings offset and length 72 | offset = 0x80 | (pbuf - s_ft245rom_buf + 2 * 3); 73 | *pbuf++ = offset; 74 | *pbuf++ = Blaster_StringVendor[0]; 75 | offset += Blaster_StringVendor[0]; 76 | *pbuf++ = offset; 77 | *pbuf++ = Blaster_StringProduct[0]; 78 | offset += Blaster_StringProduct[0]; 79 | *pbuf++ = offset; 80 | *pbuf++ = Blaster_StringSerial[0]; 81 | 82 | for (i = 0; i < Blaster_StringVendor[0]; i++) { 83 | *pbuf++ = Blaster_StringVendor[i]; // vendor string 84 | } 85 | for (i = 0; i < Blaster_StringProduct[0]; i++) { 86 | *pbuf++ = Blaster_StringProduct[i]; // product string 87 | } 88 | for (i = 0; i < Blaster_StringSerial[0]; i++) { 89 | *pbuf++ = Blaster_StringSerial[i]; // serial string 90 | } 91 | 92 | *pbuf++ = 0x2; 93 | *pbuf++ = 0x3; 94 | *pbuf++ = 0x1; 95 | *pbuf++ = 0x0; 96 | 97 | *pbuf++ = 'R'; 98 | *pbuf++ = 'E'; 99 | *pbuf++ = 'V'; 100 | *pbuf++ = 'B'; 101 | 102 | // fill zeros 103 | while ((pbuf - s_ft245rom_buf) < (FT245ROM_SIZE - 2)) { 104 | *pbuf++ = 0x0; 105 | } 106 | 107 | // checksum 108 | checksum = ft245rom_checksum(s_ft245rom_buf, FT245ROM_SIZE - 2); 109 | *pbuf++ = checksum & 0xFF; 110 | *pbuf++ = (checksum >> 8) & 0xFF; 111 | 112 | return 0; 113 | } 114 | 115 | uint16_t ft245rom_read(uint8_t addr) 116 | { 117 | return ((uint16_t)s_ft245rom_buf[addr + 1] << 8) | s_ft245rom_buf[addr]; 118 | } 119 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/src/ft245rom.h: -------------------------------------------------------------------------------- 1 | /* 2 | ft245rom.h 3 | 4 | MIT License 5 | 6 | Copyright (c) 2016 Yongqian Tang 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | */ 26 | #ifndef __FT245ROM_H__ 27 | #define __FT245ROM_H__ 28 | 29 | #include "base.h" 30 | 31 | #define FT245ROM_SIZE (128) 32 | #define FT245ROM_STR_LIMIT (100) 33 | 34 | int ft245rom_init(void); 35 | 36 | uint16_t ft245rom_read(uint8_t addr); 37 | 38 | #endif //__FT245ROM_H__ 39 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/src/main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/USB-Blaster/src/main.c -------------------------------------------------------------------------------- /MCU/USB-Blaster/src/ringbuf.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/USB-Blaster/src/ringbuf.c -------------------------------------------------------------------------------- /MCU/USB-Blaster/src/ringbuf.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/USB-Blaster/src/ringbuf.h -------------------------------------------------------------------------------- /MCU/USB-Blaster/sys/stm32_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32_it.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __STM32_IT_H 30 | #define __STM32_IT_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "stm32f10x.h" 34 | 35 | /* Exported types ------------------------------------------------------------*/ 36 | /* Exported constants --------------------------------------------------------*/ 37 | /* Exported macro ------------------------------------------------------------*/ 38 | /* Exported functions ------------------------------------------------------- */ 39 | 40 | void NMI_Handler(void); 41 | void HardFault_Handler(void); 42 | void MemManage_Handler(void); 43 | void BusFault_Handler(void); 44 | void UsageFault_Handler(void); 45 | void SVC_Handler(void); 46 | void DebugMon_Handler(void); 47 | void PendSV_Handler(void); 48 | void SysTick_Handler(void); 49 | void USB_HP_CAN1_TX_IRQHandler(void); 50 | void USB_LP_CAN1_RX0_IRQHandler(void); 51 | 52 | #endif /* __STM32_IT_H */ 53 | 54 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 55 | 56 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/sys/stm32f10x_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_conf.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_CONF_H 31 | #define __STM32F10x_CONF_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Uncomment the line below to enable peripheral header file inclusion */ 35 | #include "stm32f10x_adc.h" 36 | #include "stm32f10x_bkp.h" 37 | #include "stm32f10x_can.h" 38 | #include "stm32f10x_crc.h" 39 | #include "stm32f10x_dac.h" 40 | #include "stm32f10x_dbgmcu.h" 41 | #include "stm32f10x_dma.h" 42 | #include "stm32f10x_exti.h" 43 | #include "stm32f10x_flash.h" 44 | #include "stm32f10x_fsmc.h" 45 | #include "stm32f10x_gpio.h" 46 | #include "stm32f10x_i2c.h" 47 | #include "stm32f10x_iwdg.h" 48 | #include "stm32f10x_pwr.h" 49 | #include "stm32f10x_rcc.h" 50 | #include "stm32f10x_rtc.h" 51 | #include "stm32f10x_sdio.h" 52 | #include "stm32f10x_spi.h" 53 | #include "stm32f10x_tim.h" 54 | #include "stm32f10x_usart.h" 55 | #include "stm32f10x_wwdg.h" 56 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 57 | 58 | /* Exported types ------------------------------------------------------------*/ 59 | /* Exported constants --------------------------------------------------------*/ 60 | /* Uncomment the line below to expanse the "assert_param" macro in the 61 | Standard Peripheral Library drivers code */ 62 | /* #define USE_FULL_ASSERT 1 */ 63 | 64 | /* Exported macro ------------------------------------------------------------*/ 65 | #ifdef USE_FULL_ASSERT 66 | 67 | /******************************************************************************* 68 | * Macro Name : assert_param 69 | * Description : The assert_param macro is used for function's parameters check. 70 | * Input : - expr: If expr is false, it calls assert_failed function 71 | * which reports the name of the source file and the source 72 | * line number of the call that failed. 73 | * If expr is true, it returns no value. 74 | * Return : None 75 | *******************************************************************************/ 76 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 77 | /* Exported functions ------------------------------------------------------- */ 78 | void assert_failed(uint8_t* file, uint32_t line); 79 | #else 80 | #define assert_param(expr) ((void)0) 81 | #endif /* USE_FULL_ASSERT */ 82 | 83 | #endif /* __STM32F10x_CONF_H */ 84 | 85 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 86 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/usb/hw_config.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file hw_config.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Hardware Configuration & Setup 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __HW_CONFIG_H 31 | #define __HW_CONFIG_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "platform_config.h" 35 | #include "usb_type.h" 36 | 37 | /* Exported types ------------------------------------------------------------*/ 38 | /* Exported constants --------------------------------------------------------*/ 39 | /* Exported macro ------------------------------------------------------------*/ 40 | /* Exported define -----------------------------------------------------------*/ 41 | /* Exported functions ------------------------------------------------------- */ 42 | void USB_HW_Config(void); 43 | void USB_Clock_Config(void); 44 | void USB_Interrupts_Config(void); 45 | void USB_GPIO_Config(void); 46 | void USB_EXTI_Config(void); 47 | 48 | void USB_Cable_Ctrl(FunctionalState NewState); 49 | void Enter_LowPowerMode(void); 50 | void Leave_LowPowerMode(void); 51 | 52 | void Get_SerialNum(void); 53 | 54 | #endif /*__HW_CONFIG_H*/ 55 | 56 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 57 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/usb/usb_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_conf.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief USB Blaster configuration file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_CONF_H 31 | #define __USB_CONF_H 32 | 33 | #include "platform_config.h" 34 | 35 | /* Includes ------------------------------------------------------------------*/ 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | /* Exported macro ------------------------------------------------------------*/ 39 | /* Exported functions ------------------------------------------------------- */ 40 | /* External variables --------------------------------------------------------*/ 41 | /*-------------------------------------------------------------*/ 42 | /* EP_NUM */ 43 | /* defines how many endpoints are used by the device */ 44 | /*-------------------------------------------------------------*/ 45 | #define EP_NUM (3) 46 | 47 | /*-------------------------------------------------------------*/ 48 | /* -------------- Buffer Description Table -----------------*/ 49 | /*-------------------------------------------------------------*/ 50 | 51 | /* buffer table base address */ 52 | #define BTABLE_ADDRESS (0x00) 53 | 54 | /* EP0 */ 55 | /* rx/tx buffer base address */ 56 | #define ENDP0_RXADDR (0x20) 57 | #define ENDP0_TXADDR (0x60) 58 | #define ENDP0_SIZE (0x40) 59 | 60 | /* EP1 */ 61 | /* tx buffer base address */ 62 | #define ENDP1_TXADDR (0xA0) 63 | #define ENDP1_TXSIZE (0x40) 64 | 65 | /* EP2 */ 66 | /* rx buffer base address */ 67 | #define ENDP2_RXADDR0 (0x100) 68 | #define ENDP2_RXADDR1 (0x140) 69 | #define ENDP2_RXSIZE (0x40) 70 | 71 | /*-------------------------------------------------------------*/ 72 | /* ------------------- ISTR events -------------------------*/ 73 | /*-------------------------------------------------------------*/ 74 | 75 | /* IMR_MSK */ 76 | /* mask defining which events has to be handled */ 77 | /* by the device application software */ 78 | #define IMR_MSK (CNTR_CTRM | CNTR_RESETM /*| CNTR_WKUPM | CNTR_SUSPM | CNTR_ERRM | CNTR_SOFM | CNTR_ESOFM*/) 79 | 80 | //#define CTR_CALLBACK 81 | //#define DOVR_CALLBACK 82 | //#define ERR_CALLBACK 83 | //#define WKUP_CALLBACK 84 | //#define SUSP_CALLBACK 85 | //#define RESET_CALLBACK 86 | //#define SOF_CALLBACK 87 | //#define ESOF_CALLBACK 88 | 89 | /* CTR service routines */ 90 | /* associated to defined endpoints */ 91 | //#define EP1_IN_Callback NOP_Process 92 | #define EP2_IN_Callback NOP_Process 93 | #define EP3_IN_Callback NOP_Process 94 | #define EP4_IN_Callback NOP_Process 95 | #define EP5_IN_Callback NOP_Process 96 | #define EP6_IN_Callback NOP_Process 97 | #define EP7_IN_Callback NOP_Process 98 | 99 | #define EP1_OUT_Callback NOP_Process 100 | //#define EP2_OUT_Callback NOP_Process 101 | #define EP3_OUT_Callback NOP_Process 102 | #define EP4_OUT_Callback NOP_Process 103 | #define EP5_OUT_Callback NOP_Process 104 | #define EP6_OUT_Callback NOP_Process 105 | #define EP7_OUT_Callback NOP_Process 106 | 107 | #endif /*__USB_CONF_H*/ 108 | 109 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 110 | 111 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/usb/usb_desc.h: -------------------------------------------------------------------------------- 1 | /* Define to prevent recursive inclusion -------------------------------------*/ 2 | #ifndef __USB_DESC_H 3 | #define __USB_DESC_H 4 | 5 | /* Includes ------------------------------------------------------------------*/ 6 | /* Exported types ------------------------------------------------------------*/ 7 | /* Exported constants --------------------------------------------------------*/ 8 | /* Exported macro ------------------------------------------------------------*/ 9 | /* Exported define -----------------------------------------------------------*/ 10 | 11 | #define USB_DEVICE_DESCRIPTOR_TYPE 0x01 12 | #define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02 13 | #define USB_STRING_DESCRIPTOR_TYPE 0x03 14 | #define USB_INTERFACE_DESCRIPTOR_TYPE 0x04 15 | #define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05 16 | 17 | #define BLASTER_SIZ_DEVICE_DESC 18 18 | #define BLASTER_SIZ_CONFIG_DESC 32 19 | #define BLASTER_SIZ_STRING_LANGID 4 20 | #define BLASTER_SIZ_STRING_VENDOR 14 21 | #define BLASTER_SIZ_STRING_PRODUCT 24 22 | #define BLASTER_SIZ_STRING_SERIAL 18 23 | 24 | /* Exported functions ------------------------------------------------------- */ 25 | 26 | extern const uint8_t Blaster_DeviceDescriptor[BLASTER_SIZ_DEVICE_DESC]; 27 | extern const uint8_t Blaster_ConfigDescriptor[BLASTER_SIZ_CONFIG_DESC]; 28 | extern const uint8_t Blaster_StringLangID[BLASTER_SIZ_STRING_LANGID]; 29 | extern const uint8_t Blaster_StringVendor[BLASTER_SIZ_STRING_VENDOR]; 30 | extern const uint8_t Blaster_StringProduct[BLASTER_SIZ_STRING_PRODUCT]; 31 | extern uint8_t Blaster_StringSerial[BLASTER_SIZ_STRING_SERIAL]; 32 | 33 | #endif /* __USB_DESC_H */ 34 | 35 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/usb/usb_endp.c: -------------------------------------------------------------------------------- 1 | /* Includes ------------------------------------------------------------------*/ 2 | #include "base.h" 3 | #include "hw_config.h" 4 | #include "usb_lib.h" 5 | #include "usb_istr.h" 6 | 7 | /* Private typedef -----------------------------------------------------------*/ 8 | /* Private define ------------------------------------------------------------*/ 9 | /* Private macro -------------------------------------------------------------*/ 10 | /* Private variables ---------------------------------------------------------*/ 11 | extern __IO BOOL g_blaster_rx_req; 12 | extern __IO BOOL g_blaster_tx_ready; 13 | 14 | /* Private function prototypes -----------------------------------------------*/ 15 | /* Private functions ---------------------------------------------------------*/ 16 | 17 | /******************************************************************************* 18 | * Function Name : EP2_OUT_Callback. 19 | * Description : EP2 OUT Callback Routine. 20 | * Input : None. 21 | * Output : None. 22 | * Return : None. 23 | *******************************************************************************/ 24 | void EP2_OUT_Callback(void) 25 | { 26 | g_blaster_rx_req = TRUE; 27 | } 28 | 29 | /******************************************************************************* 30 | * Function Name : EP1_IN_Callback. 31 | * Description : EP1 IN Callback Routine. 32 | * Input : None. 33 | * Output : None. 34 | * Return : None. 35 | *******************************************************************************/ 36 | void EP1_IN_Callback(void) 37 | { 38 | g_blaster_tx_ready = TRUE; 39 | } 40 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/usb/usb_istr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_istr.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief This file includes the peripherals header files in the user application. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_ISTR_H 31 | #define __USB_ISTR_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usb_conf.h" 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | /* Exported macro ------------------------------------------------------------*/ 39 | /* Exported functions ------------------------------------------------------- */ 40 | 41 | void USB_Istr(void); 42 | 43 | /* function prototypes Automatically built defining related macros */ 44 | 45 | void EP1_IN_Callback(void); 46 | void EP2_IN_Callback(void); 47 | void EP3_IN_Callback(void); 48 | void EP4_IN_Callback(void); 49 | void EP5_IN_Callback(void); 50 | void EP6_IN_Callback(void); 51 | void EP7_IN_Callback(void); 52 | 53 | void EP1_OUT_Callback(void); 54 | void EP2_OUT_Callback(void); 55 | void EP3_OUT_Callback(void); 56 | void EP4_OUT_Callback(void); 57 | void EP5_OUT_Callback(void); 58 | void EP6_OUT_Callback(void); 59 | void EP7_OUT_Callback(void); 60 | 61 | #ifdef CTR_CALLBACK 62 | void CTR_Callback(void); 63 | #endif 64 | 65 | #ifdef DOVR_CALLBACK 66 | void DOVR_Callback(void); 67 | #endif 68 | 69 | #ifdef ERR_CALLBACK 70 | void ERR_Callback(void); 71 | #endif 72 | 73 | #ifdef WKUP_CALLBACK 74 | void WKUP_Callback(void); 75 | #endif 76 | 77 | #ifdef SUSP_CALLBACK 78 | void SUSP_Callback(void); 79 | #endif 80 | 81 | #ifdef RESET_CALLBACK 82 | void RESET_Callback(void); 83 | #endif 84 | 85 | #ifdef SOF_CALLBACK 86 | void SOF_Callback(void); 87 | #endif 88 | 89 | #ifdef ESOF_CALLBACK 90 | void ESOF_Callback(void); 91 | #endif 92 | 93 | #endif /*__USB_ISTR_H*/ 94 | 95 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 96 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/usb/usb_prop.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_prop.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief All processing related to USB Blaster 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_PROP_H 31 | #define __USB_PROP_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | 38 | #define FTDI_VEN_REQ_RESET 0x00 39 | #define FTDI_VEN_REQ_SET_BAUDRATE 0x01 40 | #define FTDI_VEN_REQ_SET_DATA_CHAR 0x02 41 | #define FTDI_VEN_REQ_SET_FLOW_CTRL 0x03 42 | #define FTDI_VEN_REQ_SET_MODEM_CTRL 0x04 43 | #define FTDI_VEN_REQ_GET_MODEM_STA 0x05 44 | #define FTDI_VEN_REQ_SET_EVENT_CHAR 0x06 45 | #define FTDI_VEN_REQ_SET_ERR_CHAR 0x07 46 | #define FTDI_VEN_REQ_SET_LAT_TIMER 0x09 47 | #define FTDI_VEN_REQ_GET_LAT_TIMER 0x0A 48 | #define FTDI_VEN_REQ_SET_BITMODE 0x0B 49 | #define FTDI_VEN_REQ_RD_PINS 0x0C 50 | #define FTDI_VEN_REQ_RD_EEPROM 0x90 51 | #define FTDI_VEN_REQ_WR_EEPROM 0x91 52 | #define FTDI_VEN_REQ_ES_EEPROM 0x92 53 | 54 | #define FTDI_MODEM_STA_SIZE 0x02 55 | #define FTDI_MODEM_STA_DUMMY0 0x01 56 | #define FTDI_MODEM_STA_DUMMY1 0x60 57 | 58 | /* Exported functions ------------------------------------------------------- */ 59 | 60 | void Blaster_Init(void); 61 | void Blaster_Reset(void); 62 | void Blaster_SetConfiguration(void); 63 | void Blaster_SetDeviceAddress (void); 64 | void Blaster_Status_In (void); 65 | void Blaster_Status_Out (void); 66 | RESULT Blaster_Data_Setup(uint8_t); 67 | RESULT Blaster_NoData_Setup(uint8_t); 68 | RESULT Blaster_Get_Interface_Setting(uint8_t Interface, uint8_t AlternateSetting); 69 | uint8_t *Blaster_GetDeviceDescriptor(uint16_t ); 70 | uint8_t *Blaster_GetConfigDescriptor(uint16_t); 71 | uint8_t *Blaster_GetStringDescriptor(uint16_t); 72 | 73 | /* Exported define -----------------------------------------------------------*/ 74 | 75 | #define Blaster_GetConfiguration NOP_Process 76 | //#define Blaster_SetConfiguration NOP_Process 77 | #define Blaster_GetInterface NOP_Process 78 | #define Blaster_SetInterface NOP_Process 79 | #define Blaster_GetStatus NOP_Process 80 | #define Blaster_ClearFeature NOP_Process 81 | #define Blaster_SetEndPointFeature NOP_Process 82 | #define Blaster_SetDeviceFeature NOP_Process 83 | //#define Blaster_SetDeviceAddress NOP_Process 84 | 85 | #endif /* __USB_PROP_H */ 86 | 87 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 88 | -------------------------------------------------------------------------------- /MCU/USB-Blaster/usb/usb_pwr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_pwr.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Connection/disconnection & power management header 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_PWR_H 30 | #define __USB_PWR_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_type.h" 34 | #include "usb_core.h" 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | typedef enum _RESUME_STATE 38 | { 39 | RESUME_EXTERNAL, 40 | RESUME_INTERNAL, 41 | RESUME_LATER, 42 | RESUME_WAIT, 43 | RESUME_START, 44 | RESUME_ON, 45 | RESUME_OFF, 46 | RESUME_ESOF 47 | } RESUME_STATE; 48 | 49 | typedef enum _DEVICE_STATE 50 | { 51 | UNCONNECTED, 52 | ATTACHED, 53 | POWERED, 54 | SUSPENDED, 55 | ADDRESSED, 56 | CONFIGURED 57 | } DEVICE_STATE; 58 | 59 | /* Exported constants --------------------------------------------------------*/ 60 | /* Exported macro ------------------------------------------------------------*/ 61 | /* Exported functions ------------------------------------------------------- */ 62 | void Suspend(void); 63 | void Resume_Init(void); 64 | void Resume(RESUME_STATE eResumeSetVal); 65 | RESULT PowerOn(void); 66 | RESULT PowerOff(void); 67 | /* External variables --------------------------------------------------------*/ 68 | extern __IO uint32_t bDeviceState; /* USB device status */ 69 | //extern __IO bool fSuspendEnabled; /* true when suspend is possible */ 70 | 71 | #endif /*__USB_PWR_H*/ 72 | 73 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 74 | -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/MDK-ARM/RTE/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Component Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'App' 7 | * Target: 'App_Stand' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | #endif /* RTE_COMPONENTS_H */ 15 | -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/clean.bat: -------------------------------------------------------------------------------- 1 | del /S /Q MDK-ARM\lst\*.* 2 | del /S /Q MDK-ARM\out\*.* 3 | del /S /Q MDK-ARM\*.bak -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/drv/base.h: -------------------------------------------------------------------------------- 1 | #ifndef __BASE_H__ 2 | #define __BASE_H__ 3 | 4 | #include "platform_config.h" 5 | 6 | #include 7 | 8 | /*typedef signed char int8_t; 9 | typedef unsigned char uint8_t; 10 | typedef signed short int16_t; 11 | typedef unsigned short uint16_t; 12 | typedef signed long int32_t; 13 | typedef unsigned long uint32_t;*/ 14 | 15 | #ifndef INLINE 16 | #define INLINE 17 | #endif 18 | 19 | #ifndef TRUE 20 | typedef unsigned char BOOL; 21 | #define TRUE 1 22 | #define FALSE 0 23 | #endif 24 | 25 | #ifndef NULL 26 | #define NULL ((void*)0) 27 | #endif 28 | 29 | #ifndef MIN 30 | #define MIN(a,b) ((a)<=(b)?(a):(b)) 31 | #endif 32 | 33 | #ifndef MAX 34 | #define MAX(a,b) ((a)>=(b)?(a):(b)) 35 | #endif 36 | 37 | #define BITS_SET(v,b) ((v) |= (b)) 38 | #define BITS_CLR(v,b) ((v) &= ~(b)) 39 | #define BITS_CHK(v,b) (((v) & (b)) == (b)) 40 | 41 | #endif // __BASE_H__ 42 | -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/drv/bitband.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/VirtualCOMPort/drv/bitband.h -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/drv/led.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/VirtualCOMPort/drv/led.c -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/drv/led.h: -------------------------------------------------------------------------------- 1 | /* 2 | led.h 3 | 4 | MIT License 5 | 6 | Copyright (c) 2016 Yongqian Tang 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | */ 26 | #ifndef __LED_H__ 27 | #define __LED_H__ 28 | 29 | #include "base.h" 30 | 31 | void led_init(void); 32 | 33 | void led_update(void); 34 | 35 | void led_light(BOOL is_light); 36 | 37 | void led_flash(uint16_t period, uint16_t pulse, uint16_t cycles); 38 | 39 | #endif //__LED_H__ 40 | -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/drv/platform_config.h: -------------------------------------------------------------------------------- 1 | #ifndef __PLATFORM_CONFIG_H__ 2 | #define __PLATFORM_CONFIG_H__ 3 | 4 | #include "stm32f10x.h" 5 | 6 | #endif // __PLATFORM_CONFIG_H__ 7 | -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/drv/timebase.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/VirtualCOMPort/drv/timebase.c -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/drv/timebase.h: -------------------------------------------------------------------------------- 1 | /* 2 | timebase.h 3 | 4 | MIT License 5 | 6 | Copyright (c) 2016 Yongqian Tang 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all 16 | copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | */ 26 | #ifndef __TIMEBASE_H__ 27 | #define __TIMEBASE_H__ 28 | 29 | #include "base.h" 30 | 31 | void timebase_init(void); 32 | 33 | uint32_t ticks(void); 34 | 35 | uint32_t micros(void); 36 | 37 | uint32_t millis(void); 38 | 39 | void delay_us(uint32_t us); 40 | 41 | void delay_ms(uint32_t ms); 42 | 43 | #endif //__TIMEBASE_H__ 44 | -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/VirtualCOMPort/readme.txt -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/src/main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/VirtualCOMPort/src/main.c -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/src/ringbuf.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/VirtualCOMPort/src/ringbuf.c -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/src/ringbuf.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/eleqian/WiDSO/4ac1296e64c27f88525baf4537c01e33a6641f94/MCU/VirtualCOMPort/src/ringbuf.h -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/src/vcp.h: -------------------------------------------------------------------------------- 1 | #ifndef __VCP_H__ 2 | #define __VCP_H__ 3 | 4 | #include "base.h" 5 | 6 | #define USART_RX_DATA_SIZE 2048 7 | 8 | #define VCP_LINE_STATE_DTR 0x1 9 | #define VCP_LINE_STATE_RTS 0x2 10 | 11 | typedef struct { 12 | uint32_t bitrate; /* bps */ 13 | uint8_t format; /* 0:1 Stop bit/1:1.5 Stop bits/2:2 Stop bits */ 14 | uint8_t paritytype; /* 0:None/1:Odd/2:Even/3:Mark/4:Space */ 15 | uint8_t datatype; /* 5, 6, 7, 8 or 16 */ 16 | } LINE_CODING; 17 | 18 | void vcp_init(void); 19 | void vcp_ctrl_line_set(u32 state); 20 | u32 vcp_com_reconfig(void); 21 | void USB_To_USART_Send_Data(uint8_t* data_buffer, uint8_t Nb_bytes); 22 | void USART_To_USB_Send_Data(void); 23 | void Handle_USBAsynchXfer (void); 24 | 25 | #endif //__VCP_H__ 26 | -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/sys/stm32_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32_it.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __STM32_IT_H 30 | #define __STM32_IT_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "stm32f10x.h" 34 | 35 | /* Exported types ------------------------------------------------------------*/ 36 | /* Exported constants --------------------------------------------------------*/ 37 | /* Exported macro ------------------------------------------------------------*/ 38 | /* Exported functions ------------------------------------------------------- */ 39 | 40 | void NMI_Handler(void); 41 | void HardFault_Handler(void); 42 | void MemManage_Handler(void); 43 | void BusFault_Handler(void); 44 | void UsageFault_Handler(void); 45 | void SVC_Handler(void); 46 | void DebugMon_Handler(void); 47 | void PendSV_Handler(void); 48 | void SysTick_Handler(void); 49 | void USB_HP_CAN1_TX_IRQHandler(void); 50 | void USB_LP_CAN1_RX0_IRQHandler(void); 51 | 52 | #endif /* __STM32_IT_H */ 53 | 54 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 55 | 56 | -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/sys/stm32f10x_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_conf.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32F10x_CONF_H 31 | #define __STM32F10x_CONF_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Uncomment the line below to enable peripheral header file inclusion */ 35 | #include "stm32f10x_adc.h" 36 | #include "stm32f10x_bkp.h" 37 | #include "stm32f10x_can.h" 38 | #include "stm32f10x_crc.h" 39 | #include "stm32f10x_dac.h" 40 | #include "stm32f10x_dbgmcu.h" 41 | #include "stm32f10x_dma.h" 42 | #include "stm32f10x_exti.h" 43 | #include "stm32f10x_flash.h" 44 | #include "stm32f10x_fsmc.h" 45 | #include "stm32f10x_gpio.h" 46 | #include "stm32f10x_i2c.h" 47 | #include "stm32f10x_iwdg.h" 48 | #include "stm32f10x_pwr.h" 49 | #include "stm32f10x_rcc.h" 50 | #include "stm32f10x_rtc.h" 51 | #include "stm32f10x_sdio.h" 52 | #include "stm32f10x_spi.h" 53 | #include "stm32f10x_tim.h" 54 | #include "stm32f10x_usart.h" 55 | #include "stm32f10x_wwdg.h" 56 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 57 | 58 | /* Exported types ------------------------------------------------------------*/ 59 | /* Exported constants --------------------------------------------------------*/ 60 | /* Uncomment the line below to expanse the "assert_param" macro in the 61 | Standard Peripheral Library drivers code */ 62 | /* #define USE_FULL_ASSERT 1 */ 63 | 64 | /* Exported macro ------------------------------------------------------------*/ 65 | #ifdef USE_FULL_ASSERT 66 | 67 | /******************************************************************************* 68 | * Macro Name : assert_param 69 | * Description : The assert_param macro is used for function's parameters check. 70 | * Input : - expr: If expr is false, it calls assert_failed function 71 | * which reports the name of the source file and the source 72 | * line number of the call that failed. 73 | * If expr is true, it returns no value. 74 | * Return : None 75 | *******************************************************************************/ 76 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 77 | /* Exported functions ------------------------------------------------------- */ 78 | void assert_failed(uint8_t* file, uint32_t line); 79 | #else 80 | #define assert_param(expr) ((void)0) 81 | #endif /* USE_FULL_ASSERT */ 82 | 83 | #endif /* __STM32F10x_CONF_H */ 84 | 85 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 86 | -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/usb/hw_config.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file hw_config.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Hardware Configuration & Setup 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __HW_CONFIG_H 31 | #define __HW_CONFIG_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "platform_config.h" 35 | #include "usb_type.h" 36 | 37 | /* Exported types ------------------------------------------------------------*/ 38 | /* Exported constants --------------------------------------------------------*/ 39 | /* Exported macro ------------------------------------------------------------*/ 40 | /* Exported define -----------------------------------------------------------*/ 41 | 42 | /* Exported functions ------------------------------------------------------- */ 43 | void USB_HW_Config(void); 44 | void USB_Cable_Ctrl(FunctionalState NewState); 45 | void Enter_LowPowerMode(void); 46 | void Leave_LowPowerMode(void); 47 | 48 | void Get_SerialNum(void); 49 | 50 | #endif /*__HW_CONFIG_H*/ 51 | 52 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 53 | -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/usb/usb_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_conf.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Virtual COM Port Demo configuration header 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_CONF_H 31 | #define __USB_CONF_H 32 | 33 | #include "platform_config.h" 34 | 35 | /* Includes ------------------------------------------------------------------*/ 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | /* Exported macro ------------------------------------------------------------*/ 39 | /* Exported functions ------------------------------------------------------- */ 40 | /* External variables --------------------------------------------------------*/ 41 | /*-------------------------------------------------------------*/ 42 | /* EP_NUM */ 43 | /* defines how many endpoints are used by the device */ 44 | /*-------------------------------------------------------------*/ 45 | 46 | #define EP_NUM (4) 47 | 48 | /*-------------------------------------------------------------*/ 49 | /* -------------- Buffer Description Table -----------------*/ 50 | /*-------------------------------------------------------------*/ 51 | 52 | /* buffer table base address */ 53 | #define BTABLE_ADDRESS (0x00) 54 | 55 | /* EP0 */ 56 | /* rx/tx buffer base address */ 57 | #define ENDP0_RXADDR (0x20) 58 | #define ENDP0_TXADDR (0x60) 59 | #define ENDP0_SIZE (0x40) 60 | 61 | /* EP1 */ 62 | /* tx buffer base address */ 63 | #define ENDP1_TXADDR (0xA0) 64 | #define ENDP1_TXSIZE (0x8) 65 | 66 | /* EP2 */ 67 | /* tx buffer base address */ 68 | #define ENDP2_TXADDR (0x100) 69 | #define ENDP2_RXSIZE (0x40) 70 | 71 | /* EP3 */ 72 | /* rx buffer base address */ 73 | #define ENDP3_RXADDR (0x140) 74 | #define ENDP3_RXSIZE (0x40) 75 | 76 | /*-------------------------------------------------------------*/ 77 | /* ------------------- ISTR events -------------------------*/ 78 | /*-------------------------------------------------------------*/ 79 | 80 | /* IMR_MSK */ 81 | /* mask defining which events has to be handled */ 82 | /* by the device application software */ 83 | #define IMR_MSK (CNTR_CTRM | CNTR_RESETM | CNTR_SOFM /*| CNTR_WKUPM | CNTR_SUSPM | CNTR_ERRM | CNTR_ESOFM*/) 84 | 85 | //#define CTR_CALLBACK 86 | //#define DOVR_CALLBACK 87 | //#define ERR_CALLBACK 88 | //#define WKUP_CALLBACK 89 | //#define SUSP_CALLBACK 90 | //#define RESET_CALLBACK 91 | #define SOF_CALLBACK 92 | //#define ESOF_CALLBACK 93 | 94 | /* CTR service routines */ 95 | /* associated to defined endpoints */ 96 | //#define EP1_IN_Callback NOP_Process 97 | //#define EP2_IN_Callback NOP_Process 98 | #define EP3_IN_Callback NOP_Process 99 | #define EP4_IN_Callback NOP_Process 100 | #define EP5_IN_Callback NOP_Process 101 | #define EP6_IN_Callback NOP_Process 102 | #define EP7_IN_Callback NOP_Process 103 | 104 | #define EP1_OUT_Callback NOP_Process 105 | #define EP2_OUT_Callback NOP_Process 106 | //#define EP3_OUT_Callback NOP_Process 107 | #define EP4_OUT_Callback NOP_Process 108 | #define EP5_OUT_Callback NOP_Process 109 | #define EP6_OUT_Callback NOP_Process 110 | #define EP7_OUT_Callback NOP_Process 111 | 112 | #endif /*__USB_CONF_H*/ 113 | 114 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 115 | 116 | -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/usb/usb_desc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_desc.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Descriptor Header for Virtual COM Port Device 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_DESC_H 31 | #define __USB_DESC_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported define -----------------------------------------------------------*/ 38 | #define USB_DEVICE_DESCRIPTOR_TYPE 0x01 39 | #define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02 40 | #define USB_STRING_DESCRIPTOR_TYPE 0x03 41 | #define USB_INTERFACE_DESCRIPTOR_TYPE 0x04 42 | #define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05 43 | 44 | #define VIRTUAL_COM_PORT_DATA_SIZE 64 45 | #define VIRTUAL_COM_PORT_INT_SIZE 8 46 | 47 | #define VIRTUAL_COM_PORT_SIZ_DEVICE_DESC 18 48 | #define VIRTUAL_COM_PORT_SIZ_CONFIG_DESC 67 49 | #define VIRTUAL_COM_PORT_SIZ_STRING_LANGID 4 50 | #define VIRTUAL_COM_PORT_SIZ_STRING_VENDOR 38 51 | #define VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT 50 52 | #define VIRTUAL_COM_PORT_SIZ_STRING_SERIAL 26 53 | 54 | #define STANDARD_ENDPOINT_DESC_SIZE 0x09 55 | 56 | /* Exported functions ------------------------------------------------------- */ 57 | extern const uint8_t Virtual_Com_Port_DeviceDescriptor[VIRTUAL_COM_PORT_SIZ_DEVICE_DESC]; 58 | extern const uint8_t Virtual_Com_Port_ConfigDescriptor[VIRTUAL_COM_PORT_SIZ_CONFIG_DESC]; 59 | 60 | extern const uint8_t Virtual_Com_Port_StringLangID[VIRTUAL_COM_PORT_SIZ_STRING_LANGID]; 61 | extern const uint8_t Virtual_Com_Port_StringVendor[VIRTUAL_COM_PORT_SIZ_STRING_VENDOR]; 62 | extern const uint8_t Virtual_Com_Port_StringProduct[VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT]; 63 | extern uint8_t Virtual_Com_Port_StringSerial[VIRTUAL_COM_PORT_SIZ_STRING_SERIAL]; 64 | 65 | #endif /* __USB_DESC_H */ 66 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 67 | -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/usb/usb_istr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_istr.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief This file includes the peripherals header files in the user application. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_ISTR_H 31 | #define __USB_ISTR_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usb_conf.h" 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | /* Exported macro ------------------------------------------------------------*/ 39 | /* Exported functions ------------------------------------------------------- */ 40 | 41 | void USB_Istr(void); 42 | 43 | /* function prototypes Automatically built defining related macros */ 44 | 45 | void EP1_IN_Callback(void); 46 | void EP2_IN_Callback(void); 47 | void EP3_IN_Callback(void); 48 | void EP4_IN_Callback(void); 49 | void EP5_IN_Callback(void); 50 | void EP6_IN_Callback(void); 51 | void EP7_IN_Callback(void); 52 | 53 | void EP1_OUT_Callback(void); 54 | void EP2_OUT_Callback(void); 55 | void EP3_OUT_Callback(void); 56 | void EP4_OUT_Callback(void); 57 | void EP5_OUT_Callback(void); 58 | void EP6_OUT_Callback(void); 59 | void EP7_OUT_Callback(void); 60 | 61 | #ifdef CTR_CALLBACK 62 | void CTR_Callback(void); 63 | #endif 64 | 65 | #ifdef DOVR_CALLBACK 66 | void DOVR_Callback(void); 67 | #endif 68 | 69 | #ifdef ERR_CALLBACK 70 | void ERR_Callback(void); 71 | #endif 72 | 73 | #ifdef WKUP_CALLBACK 74 | void WKUP_Callback(void); 75 | #endif 76 | 77 | #ifdef SUSP_CALLBACK 78 | void SUSP_Callback(void); 79 | #endif 80 | 81 | #ifdef RESET_CALLBACK 82 | void RESET_Callback(void); 83 | #endif 84 | 85 | #ifdef SOF_CALLBACK 86 | void SOF_Callback(void); 87 | #endif 88 | 89 | #ifdef ESOF_CALLBACK 90 | void ESOF_Callback(void); 91 | #endif 92 | 93 | #endif /*__USB_ISTR_H*/ 94 | 95 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 96 | -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/usb/usb_prop.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_prop.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief All processing related to Virtual COM Port Demo (Endpoint 0) 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_PROP_H 31 | #define __USB_PROP_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | /* Exported constants --------------------------------------------------------*/ 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported define -----------------------------------------------------------*/ 38 | 39 | #define Virtual_Com_Port_GetConfiguration NOP_Process 40 | //#define Virtual_Com_Port_SetConfiguration NOP_Process 41 | #define Virtual_Com_Port_GetInterface NOP_Process 42 | #define Virtual_Com_Port_SetInterface NOP_Process 43 | #define Virtual_Com_Port_GetStatus NOP_Process 44 | #define Virtual_Com_Port_ClearFeature NOP_Process 45 | #define Virtual_Com_Port_SetEndPointFeature NOP_Process 46 | #define Virtual_Com_Port_SetDeviceFeature NOP_Process 47 | //#define Virtual_Com_Port_SetDeviceAddress NOP_Process 48 | 49 | #define SEND_ENCAPSULATED_COMMAND 0x00 50 | #define GET_ENCAPSULATED_RESPONSE 0x01 51 | #define SET_COMM_FEATURE 0x02 52 | #define GET_COMM_FEATURE 0x03 53 | #define CLEAR_COMM_FEATURE 0x04 54 | #define SET_LINE_CODING 0x20 55 | #define GET_LINE_CODING 0x21 56 | #define SET_CONTROL_LINE_STATE 0x22 57 | #define SEND_BREAK 0x23 58 | 59 | /* Exported functions ------------------------------------------------------- */ 60 | void Virtual_Com_Port_init(void); 61 | void Virtual_Com_Port_Reset(void); 62 | void Virtual_Com_Port_SetConfiguration(void); 63 | void Virtual_Com_Port_SetDeviceAddress (void); 64 | void Virtual_Com_Port_Status_In (void); 65 | void Virtual_Com_Port_Status_Out (void); 66 | RESULT Virtual_Com_Port_Data_Setup(uint8_t); 67 | RESULT Virtual_Com_Port_NoData_Setup(uint8_t); 68 | RESULT Virtual_Com_Port_Get_Interface_Setting(uint8_t Interface, uint8_t AlternateSetting); 69 | uint8_t *Virtual_Com_Port_GetDeviceDescriptor(uint16_t ); 70 | uint8_t *Virtual_Com_Port_GetConfigDescriptor(uint16_t); 71 | uint8_t *Virtual_Com_Port_GetStringDescriptor(uint16_t); 72 | 73 | uint8_t *Virtual_Com_Port_GetLineCoding(uint16_t Length); 74 | uint8_t *Virtual_Com_Port_SetLineCoding(uint16_t Length); 75 | 76 | #endif /* __USB_PROP_H */ 77 | 78 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 79 | -------------------------------------------------------------------------------- /MCU/VirtualCOMPort/usb/usb_pwr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_pwr.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Connection/disconnection & power management header 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_PWR_H 30 | #define __USB_PWR_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usb_type.h" 34 | #include "usb_core.h" 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | typedef enum _RESUME_STATE 38 | { 39 | RESUME_EXTERNAL, 40 | RESUME_INTERNAL, 41 | RESUME_LATER, 42 | RESUME_WAIT, 43 | RESUME_START, 44 | RESUME_ON, 45 | RESUME_OFF, 46 | RESUME_ESOF 47 | } RESUME_STATE; 48 | 49 | typedef enum _DEVICE_STATE 50 | { 51 | UNCONNECTED, 52 | ATTACHED, 53 | POWERED, 54 | SUSPENDED, 55 | ADDRESSED, 56 | CONFIGURED 57 | } DEVICE_STATE; 58 | 59 | /* Exported constants --------------------------------------------------------*/ 60 | /* Exported macro ------------------------------------------------------------*/ 61 | /* Exported functions ------------------------------------------------------- */ 62 | void Suspend(void); 63 | void Resume_Init(void); 64 | void Resume(RESUME_STATE eResumeSetVal); 65 | RESULT PowerOn(void); 66 | RESULT PowerOff(void); 67 | /* External variables --------------------------------------------------------*/ 68 | extern __IO uint32_t bDeviceState; /* USB device status */ 69 | //extern __IO bool fSuspendEnabled; /* true when suspend is possible */ 70 | 71 | #endif /*__USB_PWR_H*/ 72 | 73 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 74 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WiDSO 2 | ## 简介 3 | 通过Wi-Fi/USB显示和控制的数字示波器(DSO)/逻辑分析仪(LA)/信号发生器(DDS)等。 4 | 由核心板(WiDSC)和扩展板两部分组成,最多可同时搭载两块扩展板。 5 | 6 | ### 核心板 7 | - 通信接口:Wi-Fi b/g/n,USB FS,UART 8 | - 扩展接口:两路,每路提供12个高速IO和4个ADC/PWM/SPI复用IO 9 | - 存储空间:512k字节@16bits位宽 10 | - 数据速率:采样/输出带宽之和最大100M字节/秒 11 | - 调试方式:内建USB-Blaster和CDC串口,支持U盘方式升级 12 | - 硬件组成:EPM240T100+IS61LV25616+STM32F103C8+ESP8266 13 | 14 | ### DSO扩展板(计划中) 15 | - 通道数:1CH(8位) 16 | - 采样率:100Mps Max 17 | - 模拟带宽:>20MHz 18 | - 输入幅度:+-4V(x1)/+-40V(x10) Max 19 | - 触发方式:上升沿/下降沿,手动/单次/自动,支持触发信号输入/输出 20 | - 硬件组成:ADC80100/AD9283-100,其余待定 21 | 22 | ### LA扩展板(计划中) 23 | - 通道数:8CH 24 | - 采样率:100Mps Max 25 | - 输入电平:1.2~5.5V 26 | - 逻辑触发:上升沿/下降沿/电平(任意通道组合),支持和DSO联合触发 27 | 28 | ### DDS扩展板(计划中) 29 | - 通道数:1CH(8位) 30 | - 采样率:100Mps Max 31 | - 模拟带宽:>20MHz 32 | - 输出幅度:+-4V Max,可调 33 | 34 | ### TFT扩展板(计划中) 35 | - 分辨率:240*320 36 | - 额外功能:Nor Flash/按键 37 | --------------------------------------------------------------------------------