├── .cproject ├── .gitattributes ├── .gitignore ├── .project ├── .settings ├── org.eclipse.cdt.codan.core.prefs ├── org.eclipse.cdt.core.prefs ├── org.eclipse.cdt.managedbuilder.core.prefs ├── org.eclipse.cdt.ui.prefs └── org.eclipse.core.resources.prefs ├── APP ├── inc │ ├── app_task.h │ ├── cpuusage.h │ ├── delay_conf.h │ ├── rtconfig.h │ ├── stm32f10x_conf.h │ └── stm32f10x_it.h └── src │ ├── app.c │ ├── app_task.c │ └── stm32f10x_it.c ├── BSP ├── inc │ ├── bsp.h │ ├── gpio.h │ └── usart.h └── src │ ├── bsp.c │ ├── gpio.c │ └── usart.c ├── EWARM ├── FreeModbus_Slave&Master+RTT+STM32.dep ├── FreeModbus_Slave&Master+RTT+STM32.ewd ├── FreeModbus_Slave&Master+RTT+STM32.ewp ├── FreeModbus_Slave&Master+RTT+STM32.eww ├── FreeModbus_Slave&Master+RTT+STM32CustomSfr.sfr └── settings │ ├── FreeModbus_Slave&Master+RTT+STM32.cspy.bat │ ├── FreeModbus_Slave&Master+RTT+STM32.dbgdt │ ├── FreeModbus_Slave&Master+RTT+STM32.dni │ ├── FreeModbus_Slave&Master+RTT+STM32.wsdt │ ├── FreeModbus_Slave&Master+RTT+STM32_Debug.jlink │ └── FreeModbus_Slave&Master+RTT+STM32_EncodingOverride.xml ├── FreeModbus 主机分析图.vsd ├── FreeModbus 从机分析图.vsd ├── FreeModbus ├── bsd.txt ├── gpl.txt ├── lgpl.txt ├── modbus │ ├── ascii │ │ ├── mbascii.c │ │ └── mbascii.h │ ├── functions │ │ ├── mbfunccoils.c │ │ ├── mbfunccoils_m.c │ │ ├── mbfuncdiag.c │ │ ├── mbfuncdisc.c │ │ ├── mbfuncdisc_m.c │ │ ├── mbfuncholding.c │ │ ├── mbfuncholding_m.c │ │ ├── mbfuncinput.c │ │ ├── mbfuncinput_m.c │ │ ├── mbfuncother.c │ │ └── mbutils.c │ ├── include │ │ ├── mb.h │ │ ├── mb_m.h │ │ ├── mbconfig.h │ │ ├── mbframe.h │ │ ├── mbfunc.h │ │ ├── mbport.h │ │ ├── mbproto.h │ │ └── mbutils.h │ ├── mb.c │ ├── mb_m.c │ ├── rtu │ │ ├── mbcrc.c │ │ ├── mbcrc.h │ │ ├── mbrtu.c │ │ ├── mbrtu.h │ │ └── mbrtu_m.c │ └── tcp │ │ ├── mbtcp.c │ │ └── mbtcp.h └── port │ ├── port.h │ ├── rtt │ ├── port.c │ ├── portevent.c │ ├── portevent_m.c │ ├── portserial.c │ ├── portserial_m.c │ ├── porttimer.c │ └── porttimer_m.c │ ├── user_mb_app.c │ ├── user_mb_app.h │ └── user_mb_app_m.c ├── FreeModbus_Slave&Master+RTT+STM32CustomSfr.sfr ├── LICENSE ├── Libaries ├── CMSIS_EWARM │ ├── CM3 │ │ └── DeviceSupport │ │ │ └── ST │ │ │ └── STM32F10x │ │ │ ├── Release_Notes.html │ │ │ ├── startup │ │ │ └── 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 │ │ │ ├── stm32f10x.h │ │ │ ├── system_stm32f10x.c │ │ │ └── system_stm32f10x.h │ ├── CMSIS END USER LICENCE AGREEMENT.pdf │ ├── CMSIS debug support.htm │ ├── CMSIS_changes.htm │ ├── Documentation │ │ └── CMSIS_Core.htm │ ├── 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 │ ├── License.doc │ ├── README.txt │ ├── index.htm │ └── readme_patch.txt ├── CMSIS_MDK │ ├── CM3 │ │ ├── CoreSupport │ │ │ ├── core_cm3.c │ │ │ └── core_cm3.h │ │ └── DeviceSupport │ │ │ └── ST │ │ │ ├── Release_Notes_for_STM32F10x_CMSIS.html │ │ │ └── STM32F10x │ │ │ ├── Release_Notes.html │ │ │ ├── startup │ │ │ └── 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 │ │ │ ├── stm32f10x.h │ │ │ ├── system_stm32f10x.c │ │ │ └── system_stm32f10x.h │ ├── CMSIS debug support.htm │ ├── CMSIS_changes.htm │ ├── Documentation │ │ └── CMSIS_Core.htm │ └── License.doc ├── SConscript ├── STM32F10x_StdPeriph_Driver │ ├── Release_Notes.html │ ├── Release_Notes_for_STM32F10x_StdPeriph_Driver.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 └── USB-FS-Device_Driver │ ├── inc │ ├── otgd_fs_cal.h │ ├── otgd_fs_dev.h │ ├── otgd_fs_int.h │ ├── otgd_fs_pcd.h │ ├── otgd_fs_regs.h │ ├── 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 │ ├── otgd_fs_cal.c │ ├── otgd_fs_dev.c │ ├── otgd_fs_int.c │ ├── otgd_fs_pcd.c │ ├── usb_core.c │ ├── usb_init.c │ ├── usb_int.c │ ├── usb_mem.c │ ├── usb_regs.c │ └── usb_sil.c ├── README.md ├── RT-Thread-1.2.2 ├── AUTHORS ├── COPYING ├── components │ ├── CMSIS │ │ ├── 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 │ │ │ ├── SConscript │ │ │ ├── cmsis_os.h │ │ │ └── cmsis_rtthread.c │ │ └── SConscript │ ├── SConscript │ ├── drivers │ │ ├── SConscript │ │ ├── i2c │ │ │ ├── SConscript │ │ │ ├── i2c-bit-ops.c │ │ │ ├── i2c_core.c │ │ │ └── i2c_dev.c │ │ ├── include │ │ │ ├── drivers │ │ │ │ ├── alarm.h │ │ │ │ ├── i2c-bit-ops.h │ │ │ │ ├── i2c.h │ │ │ │ ├── i2c_dev.h │ │ │ │ ├── mmcsd_card.h │ │ │ │ ├── mmcsd_cmd.h │ │ │ │ ├── mmcsd_core.h │ │ │ │ ├── mmcsd_host.h │ │ │ │ ├── mtd_nand.h │ │ │ │ ├── mtd_nor.h │ │ │ │ ├── pin.h │ │ │ │ ├── rtc.h │ │ │ │ ├── sd.h │ │ │ │ ├── sdio.h │ │ │ │ ├── sdio_func_ids.h │ │ │ │ ├── serial.h │ │ │ │ ├── spi.h │ │ │ │ ├── usb_common.h │ │ │ │ ├── usb_device.h │ │ │ │ ├── usb_host.h │ │ │ │ └── watchdog.h │ │ │ └── rtdevice.h │ │ ├── misc │ │ │ ├── SConscript │ │ │ └── pin.c │ │ ├── mtd │ │ │ ├── SConscript │ │ │ ├── mtd_nand.c │ │ │ └── mtd_nor.c │ │ ├── rtc │ │ │ ├── SConscript │ │ │ ├── alarm.c │ │ │ └── rtc.c │ │ ├── sdio │ │ │ ├── SConscript │ │ │ ├── block_dev.c │ │ │ ├── mmcsd_core.c │ │ │ ├── sd.c │ │ │ └── sdio.c │ │ ├── serial │ │ │ ├── SConscript │ │ │ └── serial.c │ │ ├── spi │ │ │ ├── SConscript │ │ │ ├── spi_core.c │ │ │ └── spi_dev.c │ │ ├── src │ │ │ ├── SConscript │ │ │ ├── completion.c │ │ │ ├── dataqueue.c │ │ │ ├── pipe.c │ │ │ ├── portal.c │ │ │ ├── ringbuffer.c │ │ │ └── wrokqueue.c │ │ └── usb │ │ │ ├── SConscript │ │ │ ├── usbdevice │ │ │ ├── SConscript │ │ │ ├── class │ │ │ │ ├── cdc.h │ │ │ │ ├── cdc_vcom.c │ │ │ │ ├── mstorage.c │ │ │ │ └── mstorage.h │ │ │ └── core │ │ │ │ ├── core.c │ │ │ │ └── usbdevice.c │ │ │ └── usbhost │ │ │ ├── SConscript │ │ │ ├── class │ │ │ ├── adk.c │ │ │ └── adk.h │ │ │ └── core │ │ │ ├── core.c │ │ │ ├── driver.c │ │ │ ├── hub.c │ │ │ └── usbhost.c │ ├── finsh │ │ ├── SConscript │ │ ├── cmd.c │ │ ├── finsh.h │ │ ├── finsh_compiler.c │ │ ├── finsh_error.c │ │ ├── finsh_error.h │ │ ├── finsh_heap.c │ │ ├── finsh_heap.h │ │ ├── finsh_init.c │ │ ├── finsh_node.c │ │ ├── finsh_node.h │ │ ├── finsh_ops.c │ │ ├── finsh_ops.h │ │ ├── finsh_parser.c │ │ ├── finsh_parser.h │ │ ├── finsh_token.c │ │ ├── finsh_token.h │ │ ├── finsh_var.c │ │ ├── finsh_var.h │ │ ├── finsh_vm.c │ │ ├── finsh_vm.h │ │ ├── msh.c │ │ ├── msh.h │ │ ├── msh_cmd.c │ │ ├── shell.c │ │ ├── shell.h │ │ └── symbol.c │ ├── init │ │ ├── SConscript │ │ ├── components.c │ │ └── components.h │ ├── libc │ │ ├── SConscript │ │ ├── armlibc │ │ │ ├── SConscript │ │ │ ├── mem_std.c │ │ │ └── stubs.c │ │ ├── minilibc │ │ │ ├── SConscript │ │ │ ├── ctype.c │ │ │ ├── ctype.h │ │ │ ├── errno.h │ │ │ ├── inttypes.h │ │ │ ├── math.c │ │ │ ├── math.h │ │ │ ├── qsort.c │ │ │ ├── rand.c │ │ │ ├── stddef.h │ │ │ ├── stdint.h │ │ │ ├── stdio.h │ │ │ ├── stdlib.c │ │ │ ├── stdlib.h │ │ │ ├── string.c │ │ │ ├── string.h │ │ │ ├── sys │ │ │ │ ├── stat.h │ │ │ │ ├── time.h │ │ │ │ └── types.h │ │ │ ├── time.c │ │ │ └── time.h │ │ └── newlib │ │ │ ├── SConscript │ │ │ ├── libc.c │ │ │ ├── libc.h │ │ │ ├── sys │ │ │ ├── dirent.h │ │ │ ├── fcntl.h │ │ │ └── statfs.h │ │ │ └── syscalls.c │ ├── libdl │ │ ├── SConscript │ │ ├── dlclose.c │ │ ├── dlerror.c │ │ ├── dlfcn.h │ │ ├── dlopen.c │ │ └── dlsym.c │ ├── pthreads │ │ ├── SConscript │ │ ├── clock_time.c │ │ ├── mqueue.c │ │ ├── mqueue.h │ │ ├── posix_types.h │ │ ├── pthread.c │ │ ├── pthread.h │ │ ├── pthread_attr.c │ │ ├── pthread_barrier.c │ │ ├── pthread_cond.c │ │ ├── pthread_internal.h │ │ ├── pthread_mutex.c │ │ ├── pthread_rwlock.c │ │ ├── pthread_spin.c │ │ ├── pthread_tls.c │ │ ├── sched.c │ │ ├── sched.h │ │ ├── semaphore.c │ │ └── semaphore.h │ └── utilities │ │ ├── SConscript │ │ ├── logtrace │ │ ├── SConscript │ │ ├── log_file.c │ │ ├── log_trace.c │ │ └── log_trace.h │ │ ├── ymodem │ │ ├── SConscript │ │ ├── ymodem.c │ │ └── ymodem.h │ │ └── zmodem │ │ ├── crc.h │ │ ├── rz.c │ │ ├── sz.c │ │ ├── zcore.c │ │ ├── zdef.h │ │ ├── zdevice.c │ │ └── zstart.c ├── include │ ├── cpuusage.h │ ├── rtdebug.h │ ├── rtdef.h │ ├── rthw.h │ ├── rtm.h │ ├── rtservice.h │ └── rtthread.h ├── libcpu │ ├── SConscript │ ├── arm │ │ ├── AT91SAM7S │ │ │ ├── AT91SAM7S.h │ │ │ ├── context_gcc.S │ │ │ ├── context_rvds.S │ │ │ ├── cpu.c │ │ │ ├── interrupt.c │ │ │ ├── serial.c │ │ │ ├── serial.h │ │ │ ├── stack.c │ │ │ ├── start_gcc.S │ │ │ ├── start_rvds.S │ │ │ └── trap.c │ │ ├── AT91SAM7X │ │ │ ├── context_gcc.S │ │ │ ├── context_rvds.S │ │ │ ├── cpu.c │ │ │ ├── interrupt.c │ │ │ ├── stack.c │ │ │ ├── start_gcc.S │ │ │ ├── start_rvds.S │ │ │ └── trap.c │ │ ├── am335x │ │ │ ├── am33xx.h │ │ │ ├── context_gcc.S │ │ │ ├── cp15_gcc.S │ │ │ ├── cpu.c │ │ │ ├── interrupt.c │ │ │ ├── interrupt.h │ │ │ ├── mmu.c │ │ │ ├── stack.c │ │ │ ├── start_gcc.S │ │ │ ├── trap.c │ │ │ └── vector_gcc.S │ │ ├── arm926 │ │ │ ├── context_gcc.S │ │ │ ├── context_rvds.S │ │ │ ├── cpuport.c │ │ │ ├── mmu.c │ │ │ ├── mmu.h │ │ │ └── stack.c │ │ ├── common │ │ │ ├── backtrace.c │ │ │ ├── div0.c │ │ │ ├── divsi3.S │ │ │ └── showmem.c │ │ ├── cortex-m0 │ │ │ ├── context_gcc.S │ │ │ ├── context_iar.S │ │ │ ├── context_rvds.S │ │ │ └── cpuport.c │ │ ├── cortex-m3 │ │ │ ├── context_gcc.S │ │ │ ├── context_iar.S │ │ │ ├── context_rvds.S │ │ │ └── cpuport.c │ │ ├── cortex-m4 │ │ │ ├── context_gcc.S │ │ │ ├── context_iar.S │ │ │ ├── context_rvds.S │ │ │ └── cpuport.c │ │ ├── cortex-r4 │ │ │ ├── armv7.h │ │ │ ├── context_ccs.asm │ │ │ ├── context_gcc.S │ │ │ ├── cpu.c │ │ │ ├── interrupt.c │ │ │ ├── stack.c │ │ │ ├── start_ccs.asm │ │ │ ├── start_gcc.S │ │ │ ├── trap.c │ │ │ ├── vector_ccs.asm │ │ │ └── vector_gcc.S │ │ ├── lpc214x │ │ │ ├── context_gcc.S │ │ │ ├── context_rvds.S │ │ │ ├── cpuport.c │ │ │ ├── lpc214x.h │ │ │ ├── start_rvds.S │ │ │ └── startup_gcc.S │ │ ├── lpc24xx │ │ │ ├── LPC24xx.h │ │ │ ├── context_gcc.S │ │ │ ├── context_rvds.S │ │ │ ├── cpu.c │ │ │ ├── interrupt.c │ │ │ ├── stack.c │ │ │ ├── start_gcc.S │ │ │ ├── start_rvds.S │ │ │ └── trap.c │ │ ├── s3c24x0 │ │ │ ├── context_gcc.S │ │ │ ├── context_rvds.S │ │ │ ├── cpu.c │ │ │ ├── interrupt.c │ │ │ ├── mmu.c │ │ │ ├── rtc.c │ │ │ ├── rtc.h │ │ │ ├── s3c24x0.h │ │ │ ├── serial.c │ │ │ ├── serial.h │ │ │ ├── stack.c │ │ │ ├── start_gcc.S │ │ │ ├── start_rvds.S │ │ │ ├── system_clock.c │ │ │ └── trap.c │ │ ├── s3c44b0 │ │ │ ├── context_gcc.S │ │ │ ├── context_rvds.S │ │ │ ├── cpu.c │ │ │ ├── interrupt.c │ │ │ ├── s3c44b0.h │ │ │ ├── serial.c │ │ │ ├── stack.c │ │ │ ├── start_gcc.S │ │ │ ├── start_rvds.S │ │ │ └── trap.c │ │ └── sep4020 │ │ │ ├── clk.c │ │ │ ├── context_rvds.S │ │ │ ├── cpu.c │ │ │ ├── interrupt.c │ │ │ ├── sep4020.h │ │ │ ├── serial.c │ │ │ ├── serial.h │ │ │ ├── stack.c │ │ │ ├── start_rvds.S │ │ │ └── trap.c │ ├── avr32 │ │ └── uc3 │ │ │ ├── context_gcc.S │ │ │ ├── cpu.c │ │ │ ├── exception_gcc.S │ │ │ ├── interrupt.c │ │ │ ├── serial.c │ │ │ ├── serial.h │ │ │ └── stack.c │ ├── blackfin │ │ └── bf53x │ │ │ ├── context_vdsp.S │ │ │ ├── cpuport.c │ │ │ ├── serial.c │ │ │ └── serial.h │ ├── ia32 │ │ ├── __udivsi3.c │ │ ├── __umodsi3.c │ │ ├── backtrace.c │ │ ├── context_gcc.S │ │ ├── hdisr_gcc.S │ │ ├── interrupt.c │ │ ├── showmem.c │ │ ├── stack.c │ │ ├── start_gcc.S │ │ ├── trap.c │ │ └── trapisr_gcc.S │ ├── m16c │ │ └── m16c62p │ │ │ ├── context_gcc.S │ │ │ ├── context_iar.S │ │ │ ├── context_iar.asm │ │ │ └── cpuport.c │ ├── mips │ │ ├── common │ │ │ ├── asm.h │ │ │ ├── cache.c │ │ │ ├── cache.h │ │ │ ├── exception.h │ │ │ ├── mips.inc │ │ │ ├── mipscfg.h │ │ │ ├── mipsregs.h │ │ │ └── stackframe.h │ │ ├── jz47xx │ │ │ ├── cache.c │ │ │ ├── cache.h │ │ │ ├── cache_gcc.S │ │ │ ├── context_gcc.S │ │ │ ├── cpu.c │ │ │ ├── exception.c │ │ │ ├── interrupt.c │ │ │ ├── jz4740.h │ │ │ ├── jz4755.h │ │ │ ├── jz47xx.h │ │ │ ├── mipscfg.c │ │ │ ├── stack.c │ │ │ └── start_gcc.S │ │ ├── loongson │ │ │ ├── cache.c │ │ │ ├── cache.h │ │ │ ├── cache.inc │ │ │ ├── cache_gcc.S │ │ │ ├── context_gcc.S │ │ │ ├── cpu.c │ │ │ ├── exception.c │ │ │ ├── interrupt.c │ │ │ ├── mipscfg.c │ │ │ ├── soc3210.h │ │ │ ├── stack.c │ │ │ └── start_gcc.S │ │ ├── loongson_1b │ │ │ ├── cache.c │ │ │ ├── cache.h │ │ │ ├── cache_gcc.S │ │ │ ├── context_gcc.S │ │ │ ├── cpuport.c │ │ │ ├── exception.c │ │ │ ├── interrupt.c │ │ │ ├── ls1b.h │ │ │ ├── mipscfg.c │ │ │ └── start_gcc.S │ │ └── pic32 │ │ │ ├── context_gcc.S │ │ │ ├── cpuport.c │ │ │ └── exceptions.c │ ├── nios │ │ └── nios_ii │ │ │ ├── context_gcc.S │ │ │ ├── interrupt.c │ │ │ ├── stack.c │ │ │ └── vector.S │ ├── ppc │ │ ├── common │ │ │ ├── ptrace.h │ │ │ └── stack.c │ │ └── ppc405 │ │ │ ├── cache.h │ │ │ ├── cache_gcc.S │ │ │ ├── context.h │ │ │ ├── context_gcc.S │ │ │ ├── dcr_gcc.S │ │ │ ├── include │ │ │ ├── asm │ │ │ │ ├── ppc405.h │ │ │ │ ├── ppc4xx-intvec.h │ │ │ │ ├── ppc4xx-uic.h │ │ │ │ ├── ppc4xx.h │ │ │ │ ├── ppc_defs.h │ │ │ │ ├── processor.h │ │ │ │ ├── ptrace.h │ │ │ │ └── types.h │ │ │ └── config.h │ │ │ ├── interrupt.c │ │ │ ├── io.h │ │ │ ├── serial.c │ │ │ ├── start_gcc.S │ │ │ └── traps.c │ ├── sim │ │ ├── posix │ │ │ └── cpu_port.c │ │ └── win32 │ │ │ ├── cpu_port.c │ │ │ └── cpu_port.h │ ├── unicore32 │ │ └── sep6200 │ │ │ ├── context_gcc.S │ │ │ ├── cpu.c │ │ │ ├── interrupt.c │ │ │ ├── sep6200.h │ │ │ ├── serial.c │ │ │ ├── serial.h │ │ │ ├── stack.c │ │ │ ├── start_gcc.S │ │ │ ├── trace.c │ │ │ └── trap.c │ ├── v850 │ │ └── 70f34 │ │ │ ├── context_iar.S │ │ │ ├── context_iar.asm │ │ │ ├── cpuport.c │ │ │ └── macdefs.inc │ └── xilinx │ │ └── microblaze │ │ ├── context_gcc.S │ │ ├── cpu.c │ │ ├── microblaze.inc │ │ ├── serial.c │ │ ├── serial.h │ │ ├── stack.c │ │ └── trap.c └── src │ ├── SConscript │ ├── clock.c │ ├── cpuusage.c │ ├── device.c │ ├── idle.c │ ├── ipc.c │ ├── irq.c │ ├── kservice.c │ ├── mem.c │ ├── memheap.c │ ├── mempool.c │ ├── module.c │ ├── module.h │ ├── object.c │ ├── scheduler.c │ ├── slab.c │ ├── thread.c │ └── timer.c ├── RVMDK ├── FreeModbus_Slave&Master+RTT+STM32.uvopt ├── FreeModbus_Slave&Master+RTT+STM32.uvproj ├── FreeModbus_Slave&Master+RTT+STM32_uvopt.bak ├── FreeModbus_Slave&Master+RTT+STM32_uvproj.bak ├── JLink Regs CM3.txt ├── JLinkLog.txt └── JLinkSettings.ini └── settings ├── FreeModbus_Slave&Master+RTT+STM32.dni ├── FreeModbus_Slave&Master+RTT+STM32_Eclipse Debug.jlink ├── FreeModbus_Slaver&Master+RTT+STM32.dni └── FreeModbus_Slaver&Master+RTT+STM32_Eclipse Debug.jlink /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.S text 4 | *.asm text 5 | *.c text 6 | *.cc text 7 | *.cpp text 8 | *.cxx text 9 | *.h text 10 | *.htm text 11 | *.html text 12 | *.in text 13 | *.ld text 14 | *.m4 text 15 | *.mak text 16 | *.mk text 17 | *.py text 18 | *.rb text 19 | *.s text 20 | *.sct text 21 | *.sh text 22 | *.txt text 23 | *.xml text 24 | Makefile text 25 | AUTHORS text 26 | COPYING text 27 | 28 | *.LZO -text 29 | *.Opt -text 30 | *.Uv2 -text 31 | *.ewp -text 32 | *.eww -text 33 | *.vcproj -text 34 | *.bat -text 35 | *.dos -text 36 | *.icf -text 37 | *.inf -text 38 | *.ini -text 39 | *.sct -text 40 | *.xsd -text 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /RVMDK/Output 2 | /Debug 3 | /Release 4 | /EWARM/Debug 5 | -------------------------------------------------------------------------------- /.settings/org.eclipse.cdt.managedbuilder.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | environment/buildEnvironmentInclude/iar.arm.toolchain.project.exe.configuration.debug.v5.4.0.1797449233/C_INCLUDE/delimiter=; 3 | environment/buildEnvironmentInclude/iar.arm.toolchain.project.exe.configuration.debug.v5.4.0.1797449233/C_INCLUDE/operation=remove 4 | environment/buildEnvironmentInclude/iar.arm.toolchain.project.exe.configuration.debug.v5.4.0.1797449233/append=true 5 | environment/buildEnvironmentInclude/iar.arm.toolchain.project.exe.configuration.debug.v5.4.0.1797449233/appendContributed=true 6 | environment/buildEnvironmentInclude/iar.arm.toolchain.project.exe.configuration.release.v5.4.0.1401199975/C_INCLUDE/delimiter=; 7 | environment/buildEnvironmentInclude/iar.arm.toolchain.project.exe.configuration.release.v5.4.0.1401199975/C_INCLUDE/operation=remove 8 | environment/buildEnvironmentInclude/iar.arm.toolchain.project.exe.configuration.release.v5.4.0.1401199975/append=true 9 | environment/buildEnvironmentInclude/iar.arm.toolchain.project.exe.configuration.release.v5.4.0.1401199975/appendContributed=true 10 | environment/buildEnvironmentLibrary/iar.arm.toolchain.project.exe.configuration.debug.v5.4.0.1797449233/LIBRARY_PATH/delimiter=; 11 | environment/buildEnvironmentLibrary/iar.arm.toolchain.project.exe.configuration.debug.v5.4.0.1797449233/LIBRARY_PATH/operation=remove 12 | environment/buildEnvironmentLibrary/iar.arm.toolchain.project.exe.configuration.debug.v5.4.0.1797449233/append=true 13 | environment/buildEnvironmentLibrary/iar.arm.toolchain.project.exe.configuration.debug.v5.4.0.1797449233/appendContributed=true 14 | environment/buildEnvironmentLibrary/iar.arm.toolchain.project.exe.configuration.release.v5.4.0.1401199975/LIBRARY_PATH/delimiter=; 15 | environment/buildEnvironmentLibrary/iar.arm.toolchain.project.exe.configuration.release.v5.4.0.1401199975/LIBRARY_PATH/operation=remove 16 | environment/buildEnvironmentLibrary/iar.arm.toolchain.project.exe.configuration.release.v5.4.0.1401199975/append=true 17 | environment/buildEnvironmentLibrary/iar.arm.toolchain.project.exe.configuration.release.v5.4.0.1401199975/appendContributed=true 18 | -------------------------------------------------------------------------------- /.settings/org.eclipse.cdt.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | formatter_profile=org.eclipse.cdt.ui.default.allman_profile 3 | formatter_settings_version=1 4 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/README.md=UTF-8 3 | -------------------------------------------------------------------------------- /APP/inc/app_task.h: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************* 2 | // NCLUDE FILES 3 | *********************************************************************************************************/ 4 | #ifndef APP_TASK_H 5 | #define APP_TASK_H 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include "bsp.h" 13 | #include "delay_conf.h" 14 | #include "cpuusage.h" 15 | #include "user_mb_app.h" 16 | 17 | /*******************************************************************************************************/ 18 | // DEFINES 19 | /*******************************************************************************************************/ 20 | 21 | 22 | #define success 0 23 | #define fail 1 24 | 25 | #define false 0 26 | #define true 1 27 | 28 | 29 | extern uint16_t ucSDiscInBuf[] ; 30 | extern uint16_t ucSCoilBuf[] ; 31 | extern uint16_t usSRegInBuf[] ; 32 | extern uint16_t usSRegHoldBuf[] ; 33 | 34 | 35 | 36 | 37 | extern void cpu_usage_get(rt_uint8_t *major, rt_uint8_t *minor); 38 | extern void cpu_usage_init(void); 39 | 40 | 41 | 42 | void rtthread_startup(void); 43 | 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /APP/inc/cpuusage.h: -------------------------------------------------------------------------------- 1 | #ifndef CPUUSAGE_H 2 | #define CPUUSAGE_H 3 | 4 | 5 | static void cpu_usage_idle_hook(void); 6 | void cpu_usage_get(rt_uint8_t *major, rt_uint8_t *minor); 7 | void cpu_usage_init(void); 8 | 9 | #endif 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /APP/inc/delay_conf.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************************************************/ 2 | // Filename : delay_config.h 3 | // Version : V1.00 4 | // Programmer(s) : Liuqiuhu 5 | // funcion : This file is used to configure the delay time 6 | /*********************************************************************************************************/ 7 | #ifndef __DELAY_CONF_H__ 8 | #define __DELAY_CONF_H__ 9 | 10 | #include"rtconfig.h" 11 | 12 | #if RT_TICK_PER_SECOND == 1 13 | #define DELAY_1S (RT_TICK_PER_SECOND) 14 | #define DELAY_S(X) (X*DELAY_1S) 15 | 16 | #elif RT_TICK_PER_SECOND == 10 17 | #define DELAY_100MS(X) (X) 18 | #define DELAY_S(X) (X*10) 19 | 20 | #elif RT_TICK_PER_SECOND == 100 21 | #define DELAY_10MS(X) (X) 22 | #define DELAY_100MS(X) (X*10) 23 | #define DELAY_S(X) (X*100) 24 | 25 | #elif (RT_TICK_PER_SECOND == 1000) 26 | 27 | #define DELAY_1MS (RT_TICK_PER_SECOND/1000) 28 | #define DELAY_MS(X) (X*DELAY_1MS) 29 | #define DELAY_S(X) (X*1000*DELAY_1MS) 30 | 31 | #elif (RT_TICK_PER_SECOND == 10000) 32 | #define DELAY_100US(X) (X*RT_TICK_PER_SECOND/10000) 33 | #define DELAY_1MS (RT_TICK_PER_SECOND/1000) 34 | #define DELAY_MS(X) (X*DELAY_1MS) 35 | #define DELAY_S(X) (X*1000*DELAY_1MS) 36 | 37 | #endif 38 | 39 | #define DELAY_SYS_RUN_LED DELAY_MS(500) 40 | #define DELAY_SYS_SLEEP_LED DELAY_MS(1000) 41 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /APP/inc/rtconfig.h: -------------------------------------------------------------------------------- 1 | /* RT-Thread config file */ 2 | #ifndef __RTTHREAD_CFG_H__ 3 | #define __RTTHREAD_CFG_H__ 4 | 5 | /* RT_NAME_MAX*/ 6 | #define RT_NAME_MAX 24 7 | 8 | /* RT_ALIGN_SIZE*/ 9 | #define RT_ALIGN_SIZE 8 10 | 11 | /* PRIORITY_MAX */ 12 | #define RT_THREAD_PRIORITY_MAX 32 13 | 14 | /* Tick per Second */ 15 | #define RT_TICK_PER_SECOND 10000 //0.1ms 16 | 17 | /* SECTION: RT_DEBUG */ 18 | /* Thread Debug */ 19 | #define RT_DEBUG 20 | #define RT_THREAD_DEBUG 21 | 22 | #define RT_USING_OVERFLOW_CHECK 23 | 24 | /* Using Hook */ 25 | #define RT_USING_HOOK 26 | 27 | /* Using Software Timer */ 28 | #define RT_USING_TIMER_SOFT 29 | #define RT_TIMER_THREAD_PRIO 4 30 | #define RT_TIMER_THREAD_STACK_SIZE 512 31 | #define RT_TIMER_TICK_PER_SECOND 1000 32 | 33 | /* SECTION: IPC */ 34 | /* Using Semaphore*/ 35 | #define RT_USING_SEMAPHORE 36 | 37 | /* Using Mutex */ 38 | #define RT_USING_MUTEX 39 | 40 | /* Using Event */ 41 | #define RT_USING_EVENT 42 | 43 | /* Using MailBox */ 44 | //#define RT_USING_MAILBOX 45 | 46 | /* Using Message Queue */ 47 | //#define RT_USING_MESSAGEQUEUE 48 | 49 | /* SECTION: Memory Management */ 50 | /* Using Memory Pool Management*/ 51 | //#define RT_USING_MEMPOOL 52 | 53 | /* Using Dynamic Heap Management */ 54 | #define RT_USING_HEAP 55 | 56 | /* Using Small MM */ 57 | #define RT_USING_SMALL_MEM 58 | 59 | /* SECTION: Device System */ 60 | /* Using Device System */ 61 | #define RT_USING_DEVICE 62 | // 63 | #define RT_USING_DEVICE_IPC 64 | // 65 | #define RT_USING_SERIAL 66 | 67 | /* Using GPIO pin framework */ 68 | #define RT_USING_PIN 69 | 70 | /* SECTION: Console options */ 71 | /* the buffer size of console*/ 72 | #define RT_CONSOLEBUF_SIZE 128 73 | 74 | /* SECTION: finsh, a C-Express shell */ 75 | //#define RT_USING_FINSH 76 | /* Using symbol table */ 77 | //#define FINSH_USING_SYMTAB 78 | //#define FINSH_USING_DESCRIPTION 79 | 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /APP/inc/stm32f10x_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/Template/stm32f10x_it.h 4 | * @author MCD Application Team 5 | * @version V3.1.0 6 | * @date 06/19/2009 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @copy 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2009 STMicroelectronics

19 | */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32F10x_IT_H 23 | #define __STM32F10x_IT_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | 31 | #include "bsp.h" 32 | 33 | /* Exported types ------------------------------------------------------------*/ 34 | /* Exported constants --------------------------------------------------------*/ 35 | /* Exported macro ------------------------------------------------------------*/ 36 | /* Exported functions ------------------------------------------------------- */ 37 | 38 | void NMI_Handler(void); 39 | void HardFault_Handler(void); 40 | void MemManage_Handler(void); 41 | void BusFault_Handler(void); 42 | void UsageFault_Handler(void); 43 | void SVC_Handler(void); 44 | void DebugMon_Handler(void); 45 | void PendSV_Handler(void); 46 | void SysTick_Handler(void); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* __STM32F10x_IT_H */ 53 | 54 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 55 | -------------------------------------------------------------------------------- /APP/src/app.c: -------------------------------------------------------------------------------- 1 | #include "app_task.h" 2 | 3 | int main(void) 4 | { 5 | rt_uint32_t UNUSED level; 6 | 7 | /* disable interrupt first */ 8 | level = rt_hw_interrupt_disable(); 9 | 10 | /* init system setting */ 11 | SystemInit(); 12 | 13 | /* startup RT-Thread RTOS */ 14 | rtthread_startup(); 15 | 16 | return 0; 17 | } 18 | 19 | 20 | -------------------------------------------------------------------------------- /BSP/inc/gpio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : gpio.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2015, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2015-02-02 Armink the first version 13 | */ 14 | #ifndef GPIO_H__ 15 | #define GPIO_H__ 16 | 17 | int stm32_hw_pin_init(void); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /BSP/inc/usart.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : usart.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2009, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2009-01-05 Bernard the first version 13 | */ 14 | 15 | #ifndef __USART_H__ 16 | #define __USART_H__ 17 | 18 | void stm32_hw_usart_init(void); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /EWARM/FreeModbus_Slave&Master+RTT+STM32.eww: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $WS_DIR$\FreeModbus_Slave&Master+RTT+STM32.ewp 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /EWARM/FreeModbus_Slave&Master+RTT+STM32CustomSfr.sfr: -------------------------------------------------------------------------------- 1 | [Sfr] 2 | 3 | 4 | [SfrGroupInfo] -------------------------------------------------------------------------------- /EWARM/settings/FreeModbus_Slave&Master+RTT+STM32.cspy.bat: -------------------------------------------------------------------------------- 1 | @REM This batch file has been generated by the IAR Embedded Workbench 2 | @REM C-SPY Debugger, as an aid to preparing a command line for running 3 | @REM the cspybat command line utility using the appropriate settings. 4 | @REM 5 | @REM Note that this file is generated every time a new debug session 6 | @REM is initialized, so you may want to move or rename the file before 7 | @REM making changes. 8 | @REM 9 | @REM You can launch cspybat by typing the name of this batch file followed 10 | @REM by the name of the debug file (usually an ELF/DWARF or UBROF file). 11 | @REM 12 | @REM Read about available command line parameters in the C-SPY Debugging 13 | @REM Guide. Hints about additional command line parameters that may be 14 | @REM useful in specific cases: 15 | @REM --download_only Downloads a code image without starting a debug 16 | @REM session afterwards. 17 | @REM --silent Omits the sign-on message. 18 | @REM --timeout Limits the maximum allowed execution time. 19 | @REM 20 | 21 | 22 | "C:\Program Files\IAR Systems\Embedded Workbench 6.5\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 6.5\arm\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 6.5\arm\bin\armjlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 6.5\arm\bin\armbat.dll" --macro "C:\Program Files\IAR Systems\Embedded Workbench 6.5\arm\config\debugger\ST\Trace_STM32F1xx.dmac" --backend -B "--endian=little" "--cpu=Cortex-M3" "--fpu=None" "-p" "C:\Program Files\IAR Systems\Embedded Workbench 6.5\arm\CONFIG\debugger\ST\STM32F103xB.ddf" "--semihosting" "--device=STM32F103xB" "--drv_communication=USB0" "--jlink_speed=auto" "--jlink_initial_speed=32" "--jlink_reset_strategy=0,0" "--drv_catch_exceptions=0x000" "--drv_swo_clock_setup=72000000,0,2000000" 23 | 24 | 25 | -------------------------------------------------------------------------------- /EWARM/settings/FreeModbus_Slave&Master+RTT+STM32.dni: -------------------------------------------------------------------------------- 1 | [Stack] 2 | FillEnabled=0 3 | OverflowWarningsEnabled=1 4 | WarningThreshold=90 5 | SpWarningsEnabled=1 6 | WarnLogOnly=1 7 | UseTrigger=1 8 | TriggerName=main 9 | LimitSize=0 10 | ByteLimit=50 11 | [DebugChecksum] 12 | Checksum=340144999 13 | [Exceptions] 14 | StopOnUncaught=_ 0 15 | StopOnThrow=_ 0 16 | [CallStack] 17 | ShowArgs=0 18 | [Disassembly] 19 | MixedMode=1 20 | [JLinkDriver] 21 | CStepIntDis=_ 0 22 | [InterruptLog] 23 | LogEnabled=0 24 | SumEnabled=0 25 | GraphEnabled=0 26 | ShowTimeLog=1 27 | ShowTimeSum=1 28 | SumSortOrder=0 29 | [DataLog] 30 | LogEnabled=0 31 | SumEnabled=0 32 | GraphEnabled=0 33 | ShowTimeLog=1 34 | ShowTimeSum=1 35 | [Interrupts] 36 | Enabled=1 37 | [MemoryMap] 38 | Enabled=0 39 | Base=0 40 | UseAuto=0 41 | TypeViolation=1 42 | UnspecRange=1 43 | ActionState=1 44 | [Trace1] 45 | Enabled=0 46 | ShowSource=1 47 | [watch_formats] 48 | Fmt0={W}0:CpuUsageMinor 3 0 49 | Fmt1={W}42:CpuUsageMajor 3 0 50 | Fmt2={W}42:CpuUsageMinor 3 0 51 | [Log file] 52 | LoggingEnabled=_ 0 53 | LogFile=_ "" 54 | Category=_ 0 55 | [TermIOLog] 56 | LoggingEnabled=_ 0 57 | LogFile=_ "" 58 | [CallStackLog] 59 | Enabled=0 60 | [DriverProfiling] 61 | Enabled=0 62 | Mode=0 63 | Graph=0 64 | Symbiont=0 65 | Exclusions= 66 | [Disassemble mode] 67 | mode=0 68 | [Breakpoints2] 69 | Count=0 70 | [Aliases] 71 | Count=0 72 | SuppressDialog=0 73 | -------------------------------------------------------------------------------- /EWARM/settings/FreeModbus_Slave&Master+RTT+STM32_Debug.jlink: -------------------------------------------------------------------------------- 1 | [BREAKPOINTS] 2 | ShowInfoWin = 1 3 | EnableFlashBP = 2 4 | BPDuringExecution = 0 5 | [CFI] 6 | CFISize = 0x00 7 | CFIAddr = 0x00 8 | [CPU] 9 | OverrideMemMap = 0 10 | AllowSimulation = 1 11 | ScriptFile="" 12 | [FLASH] 13 | MinNumBytesFlashDL = 0 14 | SkipProgOnCRCMatch = 1 15 | VerifyDownload = 1 16 | AllowCaching = 1 17 | EnableFlashDL = 2 18 | Override = 0 19 | Device="UNSPECIFIED" 20 | [GENERAL] 21 | WorkRAMSize = 0x00 22 | WorkRAMAddr = 0x00 23 | [SWO] 24 | SWOLogFile="" 25 | [MEM] 26 | RdOverrideOrMask = 0x00 27 | RdOverrideAndMask = 0xFFFFFFFF 28 | RdOverrideAddr = 0xFFFFFFFF 29 | WrOverrideOrMask = 0x00 30 | WrOverrideAndMask = 0xFFFFFFFF 31 | WrOverrideAddr = 0xFFFFFFFF 32 | -------------------------------------------------------------------------------- /EWARM/settings/FreeModbus_Slave&Master+RTT+STM32_EncodingOverride.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | E:\Program\Repository\FreeModbus_Slaver-Master-RTT-STM32\APP\src\app_task.c 6 | GB2312 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /FreeModbus 主机分析图.vsd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/FreeModbus 主机分析图.vsd -------------------------------------------------------------------------------- /FreeModbus 从机分析图.vsd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/FreeModbus 从机分析图.vsd -------------------------------------------------------------------------------- /FreeModbus/bsd.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006 Christian Walter 2 | Copyright (c) 2013-2019 Armink 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. The name of the author may not be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | -------------------------------------------------------------------------------- /FreeModbus/modbus/functions/mbfuncdiag.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. 3 | * Copyright (c) 2006-2018 Christian Walter 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | * File: $Id: mbfuncdiag.c,v 1.3 2006/12/07 22:10:34 wolti Exp $ 29 | */ 30 | -------------------------------------------------------------------------------- /FreeModbus/modbus/rtu/mbcrc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeModbus Libary: A portable Modbus implementation for Modbus ASCII/RTU. 3 | * Copyright (c) 2006-2018 Christian Walter 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | * 28 | * File: $Id: mbcrc.h,v 1.5 2006/12/07 22:10:34 wolti Exp $ 29 | */ 30 | 31 | #ifndef _MB_CRC_H 32 | #define _MB_CRC_H 33 | 34 | USHORT usMBCRC16( UCHAR * pucFrame, USHORT usLen ); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /FreeModbus/port/port.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeModbus Libary: BARE Port 3 | * Copyright (C) 2013 Armink 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | * 19 | * File: $Id: port.h ,v 1.60 2013/08/13 15:07:05 Armink add Master Functions $ 20 | */ 21 | 22 | #ifndef _PORT_H 23 | #define _PORT_H 24 | 25 | #include 26 | #include "mbconfig.h" 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | 33 | #define INLINE 34 | #define PR_BEGIN_EXTERN_C extern "C" { 35 | #define PR_END_EXTERN_C } 36 | 37 | #define ENTER_CRITICAL_SECTION() EnterCriticalSection() 38 | #define EXIT_CRITICAL_SECTION() ExitCriticalSection() 39 | 40 | typedef uint8_t BOOL; 41 | 42 | typedef unsigned char UCHAR; 43 | typedef char CHAR; 44 | 45 | typedef uint16_t USHORT; 46 | typedef int16_t SHORT; 47 | 48 | typedef uint32_t ULONG; 49 | typedef int32_t LONG; 50 | 51 | #ifndef TRUE 52 | #define TRUE 1 53 | #endif 54 | 55 | #ifndef FALSE 56 | #define FALSE 0 57 | #endif 58 | 59 | void EnterCriticalSection(void); 60 | void ExitCriticalSection(void); 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /FreeModbus/port/rtt/port.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeModbus Libary: RT-Thread Port 3 | * Copyright (C) 2013 Armink 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2.1 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public 16 | * License along with this library; if not, write to the Free Software 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | * 19 | * File: $Id: port.c,v 1.60 2015/02/01 9:18:05 Armink $ 20 | */ 21 | 22 | /* ----------------------- System includes --------------------------------*/ 23 | 24 | /* ----------------------- Modbus includes ----------------------------------*/ 25 | #include "port.h" 26 | /* ----------------------- Variables ----------------------------------------*/ 27 | 28 | /* ----------------------- Start implementation -----------------------------*/ 29 | void EnterCriticalSection(void) 30 | { 31 | rt_enter_critical(); 32 | } 33 | 34 | void ExitCriticalSection(void) 35 | { 36 | rt_exit_critical(); 37 | } 38 | 39 | -------------------------------------------------------------------------------- /FreeModbus/port/user_mb_app.h: -------------------------------------------------------------------------------- 1 | #ifndef USER_APP 2 | #define USER_APP 3 | /* ----------------------- Modbus includes ----------------------------------*/ 4 | #include "mb.h" 5 | #include "mb_m.h" 6 | #include "mbconfig.h" 7 | #include "mbframe.h" 8 | #include "mbutils.h" 9 | 10 | /* -----------------------Slave Defines -------------------------------------*/ 11 | #define S_DISCRETE_INPUT_START 0 12 | #define S_DISCRETE_INPUT_NDISCRETES 16 13 | #define S_COIL_START 0 14 | #define S_COIL_NCOILS 64 15 | #define S_REG_INPUT_START 0 16 | #define S_REG_INPUT_NREGS 100 17 | #define S_REG_HOLDING_START 0 18 | #define S_REG_HOLDING_NREGS 100 19 | /* salve mode: holding register's all address */ 20 | #define S_HD_RESERVE 0 21 | #define S_HD_CPU_USAGE_MAJOR 1 22 | #define S_HD_CPU_USAGE_MINOR 2 23 | /* salve mode: input register's all address */ 24 | #define S_IN_RESERVE 0 25 | /* salve mode: coil's all address */ 26 | #define S_CO_RESERVE 0 27 | /* salve mode: discrete's all address */ 28 | #define S_DI_RESERVE 0 29 | 30 | /* -----------------------Master Defines -------------------------------------*/ 31 | #define M_DISCRETE_INPUT_START 0 32 | #define M_DISCRETE_INPUT_NDISCRETES 16 33 | #define M_COIL_START 0 34 | #define M_COIL_NCOILS 64 35 | #define M_REG_INPUT_START 0 36 | #define M_REG_INPUT_NREGS 100 37 | #define M_REG_HOLDING_START 0 38 | #define M_REG_HOLDING_NREGS 100 39 | /* master mode: holding register's all address */ 40 | #define M_HD_RESERVE 0 41 | /* master mode: input register's all address */ 42 | #define M_IN_RESERVE 0 43 | /* master mode: coil's all address */ 44 | #define M_CO_RESERVE 0 45 | /* master mode: discrete's all address */ 46 | #define M_DI_RESERVE 0 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /FreeModbus_Slave&Master+RTT+STM32CustomSfr.sfr: -------------------------------------------------------------------------------- 1 | [Sfr] 2 | 3 | 4 | [SfrGroupInfo] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006 Christian Walter 2 | Copyright (c) 2013-2019 Armink 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. The name of the author may not be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | -------------------------------------------------------------------------------- /Libaries/CMSIS_EWARM/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/Libaries/CMSIS_EWARM/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h -------------------------------------------------------------------------------- /Libaries/CMSIS_EWARM/CMSIS END USER LICENCE AGREEMENT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/Libaries/CMSIS_EWARM/CMSIS END USER LICENCE AGREEMENT.pdf -------------------------------------------------------------------------------- /Libaries/CMSIS_EWARM/CMSIS debug support.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/Libaries/CMSIS_EWARM/CMSIS debug support.htm -------------------------------------------------------------------------------- /Libaries/CMSIS_EWARM/Documentation/CMSIS_Core.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/Libaries/CMSIS_EWARM/Documentation/CMSIS_Core.htm -------------------------------------------------------------------------------- /Libaries/CMSIS_EWARM/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 | -------------------------------------------------------------------------------- /Libaries/CMSIS_EWARM/License.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/Libaries/CMSIS_EWARM/License.doc -------------------------------------------------------------------------------- /Libaries/CMSIS_EWARM/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 | -------------------------------------------------------------------------------- /Libaries/CMSIS_EWARM/index.htm: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /Libaries/CMSIS_EWARM/readme_patch.txt: -------------------------------------------------------------------------------- 1 | No CMSIS patch is included in this version. 2 | -------------------------------------------------------------------------------- /Libaries/CMSIS_MDK/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/Libaries/CMSIS_MDK/CM3/DeviceSupport/ST/STM32F10x/stm32f10x.h -------------------------------------------------------------------------------- /Libaries/CMSIS_MDK/CMSIS debug support.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/Libaries/CMSIS_MDK/CMSIS debug support.htm -------------------------------------------------------------------------------- /Libaries/CMSIS_MDK/Documentation/CMSIS_Core.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/Libaries/CMSIS_MDK/Documentation/CMSIS_Core.htm -------------------------------------------------------------------------------- /Libaries/CMSIS_MDK/License.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/Libaries/CMSIS_MDK/License.doc -------------------------------------------------------------------------------- /Libaries/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/Libaries/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c -------------------------------------------------------------------------------- /Libaries/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/Libaries/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c -------------------------------------------------------------------------------- /Libaries/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/Libaries/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c -------------------------------------------------------------------------------- /Libaries/USB-FS-Device_Driver/inc/usb_int.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : usb_int.h 3 | * Author : MCD Application Team 4 | * Version : V3.2.1 5 | * Date : 07/05/2010 6 | * Description : Endpoint CTR (Low and High) interrupt's service routines 7 | * prototypes 8 | ******************************************************************************** 9 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 10 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 11 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 12 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 13 | * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 14 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 15 | *******************************************************************************/ 16 | 17 | /* Define to prevent recursive inclusion -------------------------------------*/ 18 | #ifndef __USB_INT_H 19 | #define __USB_INT_H 20 | 21 | /* Includes ------------------------------------------------------------------*/ 22 | /* Exported types ------------------------------------------------------------*/ 23 | /* Exported constants --------------------------------------------------------*/ 24 | /* Exported macro ------------------------------------------------------------*/ 25 | /* Exported functions ------------------------------------------------------- */ 26 | void CTR_LP(void); 27 | void CTR_HP(void); 28 | 29 | /* External variables --------------------------------------------------------*/ 30 | 31 | #endif /* __USB_INT_H */ 32 | 33 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 34 | -------------------------------------------------------------------------------- /Libaries/USB-FS-Device_Driver/inc/usb_mem.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : usb_mem.h 3 | * Author : MCD Application Team 4 | * Version : V3.2.1 5 | * Date : 07/05/2010 6 | * Description : Utility prototypes functions for memory/PMA transfers 7 | ******************************************************************************** 8 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | /* Define to prevent recursive inclusion -------------------------------------*/ 17 | #ifndef __USB_MEM_H 18 | #define __USB_MEM_H 19 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | /* Exported types ------------------------------------------------------------*/ 22 | /* Exported constants --------------------------------------------------------*/ 23 | /* Exported macro ------------------------------------------------------------*/ 24 | /* Exported functions ------------------------------------------------------- */ 25 | void UserToPMABufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes); 26 | void PMAToUserBufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes); 27 | 28 | /* External variables --------------------------------------------------------*/ 29 | 30 | #endif /*__USB_MEM_H*/ 31 | 32 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 33 | -------------------------------------------------------------------------------- /Libaries/USB-FS-Device_Driver/inc/usb_sil.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** 2 | * File Name : usb_sil.h 3 | * Author : MCD Application Team 4 | * Version : V3.2.1 5 | * Date : 07/05/2010 6 | * Description : Simplified Interface Layer function prototypes. 7 | ******************************************************************************** 8 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | 16 | /* Define to prevent recursive inclusion -------------------------------------*/ 17 | #ifndef __USB_SIL_H 18 | #define __USB_SIL_H 19 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | /* Exported types ------------------------------------------------------------*/ 22 | /* Exported constants --------------------------------------------------------*/ 23 | /* Exported macro ------------------------------------------------------------*/ 24 | /* Exported functions ------------------------------------------------------- */ 25 | 26 | uint32_t USB_SIL_Init(void); 27 | uint32_t USB_SIL_Write(uint8_t bEpAddr, uint8_t* pBufferPointer, uint32_t wBufferSize); 28 | uint32_t USB_SIL_Read(uint8_t bEpAddr, uint8_t* pBufferPointer); 29 | 30 | /* External variables --------------------------------------------------------*/ 31 | 32 | #endif /* __USB_SIL_H */ 33 | 34 | /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 35 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/AUTHORS: -------------------------------------------------------------------------------- 1 | Kernel Design & Implementation 2 | - Bernard Xiong 3 | 4 | LwIP 1.3.0/1.3.1/1.3.2/1.4.0 5 | - Porting 6 | Qiu Yi 7 | Mbbill 8 | - Testing 9 | Bernard Xiong 10 | 11 | Filesystem 12 | - Porting and Add Virtual Filesystem 13 | - Testing 14 | Qiu Yi 15 | prife 16 | 17 | RTGUI 18 | - Design and Implemenation 19 | Bernard Xiong 20 | Grissiom 21 | 22 | BSP 23 | Bernard Xiong 24 | - ATMEL AT91SAM7S64 & AT91SAM7X256 Porting 25 | - STM32 Porting 26 | - S3C4510 Porting 27 | 28 | Mbbill 29 | - ATMEL AT91SAM7X256 30 | 31 | Xulong Cao 32 | - QEMU/x86 33 | 34 | Aozima 35 | - LPC 2148 Porting 36 | - STM32 Porting 37 | 38 | Jing Lee 39 | - LPC 2478 Porting 40 | 41 | Qiu Yi 42 | - S3C2410 & S3C2440 Porting 43 | - TI LM3S 44 | 45 | others... 46 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/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 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/CMSIS/RTOS/SConscript: -------------------------------------------------------------------------------- 1 | from building import * 2 | 3 | cwd = GetCurrentDir() 4 | src = Glob('*.c') 5 | CPPPATH = [cwd] 6 | group = DefineGroup('CMSIS_OS', src, depend = ['RT_USING_CMSIS_OS'], CPPPATH = CPPPATH) 7 | 8 | Return('group') 9 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/CMSIS/SConscript: -------------------------------------------------------------------------------- 1 | # for module compiling 2 | import os 3 | from building import * 4 | 5 | cwd = GetCurrentDir() 6 | objs = [] 7 | list = os.listdir(cwd) 8 | 9 | for d in list: 10 | path = os.path.join(cwd, d) 11 | if os.path.isfile(os.path.join(path, 'SConscript')): 12 | objs = objs + SConscript(os.path.join(d, 'SConscript')) 13 | 14 | Return('objs') 15 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/SConscript: -------------------------------------------------------------------------------- 1 | # for module compiling 2 | import os 3 | Import('remove_components') 4 | from building import * 5 | 6 | objs = [] 7 | cwd = GetCurrentDir() 8 | list = os.listdir(cwd) 9 | 10 | for item in list: 11 | if item in remove_components: 12 | continue 13 | 14 | if os.path.isfile(os.path.join(cwd, item, 'SConscript')): 15 | objs = objs + SConscript(os.path.join(item, 'SConscript')) 16 | 17 | Return('objs') 18 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/SConscript: -------------------------------------------------------------------------------- 1 | # for module compiling 2 | import os 3 | from building import * 4 | 5 | cwd = GetCurrentDir() 6 | objs = [] 7 | list = os.listdir(cwd) 8 | 9 | for d in list: 10 | path = os.path.join(cwd, d) 11 | if os.path.isfile(os.path.join(path, 'SConscript')): 12 | objs = objs + SConscript(os.path.join(d, 'SConscript')) 13 | 14 | Return('objs') 15 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/i2c/SConscript: -------------------------------------------------------------------------------- 1 | Import('RTT_ROOT') 2 | from building import * 3 | 4 | cwd = GetCurrentDir() 5 | src = Split(""" 6 | i2c_core.c 7 | i2c_dev.c 8 | """) 9 | 10 | if GetDepend('RT_USING_I2C_BITOPS'): 11 | src = src + ['i2c-bit-ops.c'] 12 | 13 | # The set of source files associated with this SConscript file. 14 | path = [cwd + '/../include'] 15 | 16 | group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_I2C'], CPPPATH = path) 17 | 18 | Return('group') 19 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/include/drivers/i2c-bit-ops.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : i2c-bit-ops.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | * 2012-04-25 weety first version 23 | */ 24 | 25 | #ifndef __I2C_BIT_OPS_H__ 26 | #define __I2C_BIT_OPS_H__ 27 | 28 | #ifdef __cplusplus 29 | extern "C" { 30 | #endif 31 | 32 | struct rt_i2c_bit_ops 33 | { 34 | void *data; /* private data for lowlevel routines */ 35 | void (*set_sda)(void *data, rt_int32_t state); 36 | void (*set_scl)(void *data, rt_int32_t state); 37 | rt_int32_t (*get_sda)(void *data); 38 | rt_int32_t (*get_scl)(void *data); 39 | 40 | void (*udelay)(rt_uint32_t us); 41 | 42 | rt_uint32_t delay_us; /* scl and sda line delay */ 43 | rt_uint32_t timeout; /* in tick */ 44 | }; 45 | 46 | rt_err_t rt_i2c_bit_add_bus(struct rt_i2c_bus_device *bus, 47 | const char *bus_name); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/include/drivers/i2c_dev.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : i2c_dev.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | * 2012-04-25 weety first version 23 | */ 24 | 25 | #ifndef __I2C_DEV_H__ 26 | #define __I2C_DEV_H__ 27 | 28 | #include 29 | 30 | #ifdef __cplusplus 31 | extern "C" { 32 | #endif 33 | 34 | #define RT_I2C_DEV_CTRL_10BIT 0x20 35 | #define RT_I2C_DEV_CTRL_ADDR 0x21 36 | #define RT_I2C_DEV_CTRL_TIMEOUT 0x22 37 | #define RT_I2C_DEV_CTRL_RW 0x23 38 | 39 | struct rt_i2c_priv_data 40 | { 41 | struct rt_i2c_msg *msgs; 42 | rt_size_t number; 43 | }; 44 | 45 | rt_err_t rt_i2c_bus_device_device_init(struct rt_i2c_bus_device *bus, 46 | const char *name); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/include/drivers/rtc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : rtc.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | * 2012-10-10 aozima first version. 23 | */ 24 | 25 | #ifndef RTC_H_INCLUDED 26 | #define RTC_H_INCLUDED 27 | 28 | extern rt_err_t set_date(rt_uint32_t year, 29 | rt_uint32_t month, 30 | rt_uint32_t day); 31 | 32 | extern rt_err_t set_time(rt_uint32_t hour, 33 | rt_uint32_t minute, 34 | rt_uint32_t second); 35 | 36 | #endif // RTC_H_INCLUDED 37 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/include/drivers/sd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : sd.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | * 2011-07-25 weety first version 23 | */ 24 | 25 | #ifndef __SD_H__ 26 | #define __SD_H__ 27 | 28 | #include 29 | #include 30 | 31 | #ifdef __cplusplus 32 | extern "C" { 33 | #endif 34 | 35 | rt_err_t mmcsd_send_if_cond(struct rt_mmcsd_host *host, rt_uint32_t ocr); 36 | rt_err_t mmcsd_send_app_op_cond(struct rt_mmcsd_host *host, rt_uint32_t ocr, rt_uint32_t *rocr); 37 | rt_int32_t init_sd(struct rt_mmcsd_host *host, rt_uint32_t ocr); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/include/drivers/spi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/RT-Thread-1.2.2/components/drivers/include/drivers/spi.h -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/misc/SConscript: -------------------------------------------------------------------------------- 1 | from building import * 2 | 3 | cwd = GetCurrentDir() 4 | src = [] 5 | CPPPATH = [cwd + '/../include'] 6 | group = [] 7 | 8 | if GetDepend(['RT_USING_PIN']): 9 | src = src + ['pin.c'] 10 | 11 | if len(src): 12 | group = DefineGroup('DeviceDrivers', src, depend = [''], CPPPATH = CPPPATH) 13 | 14 | Return('group') 15 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/mtd/SConscript: -------------------------------------------------------------------------------- 1 | Import('RTT_ROOT') 2 | Import('rtconfig') 3 | from building import * 4 | 5 | cwd = GetCurrentDir() 6 | src = [] 7 | 8 | mtd_nor = ['mtd_nor.c'] 9 | 10 | mtd_nand = ['mtd_nand.c'] 11 | 12 | CPPPATH = [cwd + '/../include'] 13 | group = [] 14 | 15 | if GetDepend(['RT_USING_MTD_NOR']): 16 | src = src + mtd_nor 17 | group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_MTD_NOR'], CPPPATH = CPPPATH) 18 | if GetDepend(['RT_USING_MTD_NAND']): 19 | src = src + mtd_nand 20 | group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_MTD_NAND'], CPPPATH = CPPPATH) 21 | 22 | Return('group') 23 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/rtc/SConscript: -------------------------------------------------------------------------------- 1 | from building import * 2 | 3 | cwd = GetCurrentDir() 4 | src = [] 5 | 6 | rtc = ['rtc.c'] 7 | 8 | rtc_alarm = ['alarm.c'] 9 | 10 | CPPPATH = [cwd + '/../include'] 11 | group = [] 12 | 13 | if GetDepend(['RT_USING_RTC']): 14 | src = src + rtc 15 | if GetDepend(['RT_USING_ALARM']): 16 | src = src + rtc_alarm 17 | 18 | group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_RTC'], CPPPATH = CPPPATH) 19 | 20 | Return('group') -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/sdio/SConscript: -------------------------------------------------------------------------------- 1 | Import('RTT_ROOT') 2 | from building import * 3 | 4 | cwd = GetCurrentDir() 5 | src = Split(""" 6 | block_dev.c 7 | mmcsd_core.c 8 | sd.c 9 | sdio.c 10 | """) 11 | 12 | # The set of source files associated with this SConscript file. 13 | path = [cwd + '/../include'] 14 | 15 | group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_SDIO'], CPPPATH = path) 16 | 17 | Return('group') 18 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/serial/SConscript: -------------------------------------------------------------------------------- 1 | from building import * 2 | 3 | cwd = GetCurrentDir() 4 | src = Glob('*.c') 5 | CPPPATH = [cwd + '/../include'] 6 | group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_SERIAL'], CPPPATH = CPPPATH) 7 | 8 | Return('group') 9 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/spi/SConscript: -------------------------------------------------------------------------------- 1 | from building import * 2 | 3 | cwd = GetCurrentDir() 4 | src = Glob('*.c') 5 | CPPPATH = [cwd + '/../include'] 6 | group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_SPI'], CPPPATH = CPPPATH) 7 | 8 | Return('group') 9 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/src/SConscript: -------------------------------------------------------------------------------- 1 | from building import * 2 | 3 | cwd = GetCurrentDir() 4 | src = Glob('*.c') 5 | CPPPATH = [cwd + '/../include'] 6 | group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_DEVICE_IPC'], CPPPATH = CPPPATH) 7 | 8 | Return('group') 9 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/usb/SConscript: -------------------------------------------------------------------------------- 1 | # for module compiling 2 | import os 3 | from building import * 4 | 5 | cwd = GetCurrentDir() 6 | objs = [] 7 | list = os.listdir(cwd) 8 | 9 | for d in list: 10 | path = os.path.join(cwd, d) 11 | if os.path.isfile(os.path.join(path, 'SConscript')): 12 | objs = objs + SConscript(os.path.join(d, 'SConscript')) 13 | 14 | Return('objs') 15 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/usb/usbdevice/SConscript: -------------------------------------------------------------------------------- 1 | Import('RTT_ROOT') 2 | from building import * 3 | 4 | cwd = GetCurrentDir() 5 | src = Split(""" 6 | core/core.c 7 | core/usbdevice.c 8 | """) 9 | 10 | if GetDepend('RT_USB_DEVICE_CDC'): 11 | src += Glob('class/cdc_vcom.c') 12 | 13 | if GetDepend('RT_USB_DEVICE_MSTORAGE'): 14 | src += Glob('class/mstorage.c') 15 | 16 | if GetDepend('RT_USB_DEVICE_RNDIS'): 17 | src += Glob('class/rndis.c') 18 | 19 | CPPPATH = [cwd] 20 | 21 | group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_USB_DEVICE'], CPPPATH = CPPPATH) 22 | 23 | Return('group') 24 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/usb/usbhost/SConscript: -------------------------------------------------------------------------------- 1 | Import('RTT_ROOT') 2 | from building import * 3 | 4 | cwd = GetCurrentDir() 5 | src = Split(""" 6 | core/core.c 7 | core/driver.c 8 | core/usbhost.c 9 | core/hub.c 10 | """) 11 | 12 | if GetDepend('RT_USB_CLASS_ADK'): 13 | src += Glob('class/adk.c') 14 | src += Glob('udev/adkapp.c') 15 | 16 | if GetDepend('RT_USB_CLASS_MASS_STORAGE'): 17 | src += Glob('class/mass.c') 18 | src += Glob('udev/udisk.c') 19 | 20 | if GetDepend('RT_USB_CLASS_HID'): 21 | src += Glob('class/hid.c') 22 | 23 | if GetDepend('RT_USB_HID_MOUSE'): 24 | src += Glob('udev/umouse.c') 25 | 26 | if GetDepend('RT_USB_HID_KEYBOARD'): 27 | src += Glob('udev/ukbd.c') 28 | 29 | CPPPATH = [cwd, cwd + '/class', cwd + '/core', \ 30 | cwd + '/include', cwd + '../../../include'] 31 | 32 | group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_USB_HOST'], CPPPATH = CPPPATH) 33 | 34 | Return('group') 35 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/drivers/usb/usbhost/class/adk.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : adk.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2011, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | * 2011-12-12 Yi Qiu first version 23 | */ 24 | 25 | #ifndef __HID_H__ 26 | #define __HID_H__ 27 | 28 | #include 29 | 30 | struct uadkinst 31 | { 32 | upipe_t pipe_in; 33 | upipe_t pipe_out; 34 | 35 | struct rt_device device; 36 | }; 37 | typedef struct uadkinst* uadkinst_t; 38 | 39 | #define USB_ACCESSORY_VENDOR_ID 0x18D1 40 | #define USB_ACCESSORY_PRODUCT_ID 0x2D00 41 | #define USB_ACCESSORY_ADB_PRODUCT_ID 0x2D01 42 | 43 | #define ACCESSORY_STRING_MANUFACTURER 0 44 | #define ACCESSORY_STRING_MODEL 1 45 | #define ACCESSORY_STRING_DESCRIPTION 2 46 | #define ACCESSORY_STRING_VERSION 3 47 | #define ACCESSORY_STRING_URI 4 48 | #define ACCESSORY_STRING_SERIAL 5 49 | 50 | #define USB_REQ_GET_PROTOCOL 51 51 | #define USB_REQ_SEND_STRING 52 52 | #define USB_REQ_START 53 53 | 54 | #define USB_CLASS_ADK 0xff 55 | 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/finsh/SConscript: -------------------------------------------------------------------------------- 1 | Import('rtconfig') 2 | from building import * 3 | 4 | cwd = GetCurrentDir() 5 | src = Split(''' 6 | shell.c 7 | symbol.c 8 | cmd.c 9 | ''') 10 | 11 | fsh_src = Split(''' 12 | finsh_compiler.c 13 | finsh_error.c 14 | finsh_heap.c 15 | finsh_init.c 16 | finsh_node.c 17 | finsh_ops.c 18 | finsh_parser.c 19 | finsh_var.c 20 | finsh_vm.c 21 | finsh_token.c 22 | ''') 23 | 24 | msh_src = Split(''' 25 | msh_cmd.c 26 | msh.c 27 | ''') 28 | 29 | CPPPATH = [cwd] 30 | if rtconfig.CROSS_TOOL == 'keil': 31 | LINKFLAGS = ' --keep __fsym_*' 32 | 33 | if not GetDepend('FINSH_USING_MSH_ONLY'): 34 | LINKFLAGS = LINKFLAGS + ' --keep __vsym_* ' 35 | else: 36 | LINKFLAGS = '' 37 | 38 | if GetDepend('FINSH_USING_MSH'): 39 | src = src + msh_src 40 | if not GetDepend('FINSH_USING_MSH_ONLY'): 41 | src = src + fsh_src 42 | 43 | group = DefineGroup('finsh', src, depend = ['RT_USING_FINSH'], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS) 44 | 45 | Return('group') 46 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/finsh/finsh_error.c: -------------------------------------------------------------------------------- 1 | /* 2 | * error number for finsh shell. 3 | * 4 | * COPYRIGHT (C) 2013, Shanghai Real-Thread Technology Co., Ltd 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2010-03-22 Bernard first version 28 | */ 29 | #include "finsh_error.h" 30 | 31 | u_char global_errno; 32 | 33 | static const char * finsh_error_string_table[] = 34 | { 35 | "No error", 36 | "Invalid token", 37 | "Expect a type", 38 | "Unknown type", 39 | "Variable exist", 40 | "Expect a operater", 41 | "Memory full", 42 | "Unknown operator", 43 | "Unknown node", 44 | "Expect a character", 45 | "Unexpect end", 46 | "Unknown token", 47 | "Float not supported", 48 | "Unknown symbol", 49 | "Null node" 50 | }; 51 | 52 | int finsh_error_init() 53 | { 54 | global_errno = FINSH_ERROR_OK; 55 | 56 | return 0; 57 | } 58 | 59 | int finsh_error_set(u_char type) 60 | { 61 | global_errno = type; 62 | 63 | return 0; 64 | } 65 | 66 | u_char finsh_errno() 67 | { 68 | return global_errno; 69 | } 70 | 71 | const char* finsh_error_string(u_char type) 72 | { 73 | return finsh_error_string_table[type]; 74 | } 75 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/finsh/finsh_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * error number for finsh shell. 3 | * 4 | * COPYRIGHT (C) 2013, Shanghai Real-Thread Technology Co., Ltd 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2010-03-22 Bernard first version 28 | */ 29 | #ifndef __FINSH_ERROR_H__ 30 | #define __FINSH_ERROR_H__ 31 | 32 | #include 33 | 34 | int finsh_error_init(void); 35 | 36 | /* get error number */ 37 | u_char finsh_errno(void); 38 | 39 | int finsh_error_set(u_char type); 40 | const char* finsh_error_string(u_char type); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/finsh/finsh_heap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * heap management in finsh shell. 3 | * 4 | * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2010-03-22 Bernard first version 28 | */ 29 | #include 30 | 31 | #ifndef __FINSH_HEAP_H__ 32 | #define __FINSH_HEAP_H__ 33 | 34 | int finsh_heap_init(void); 35 | void* finsh_heap_allocate(size_t size); 36 | void finsh_heap_free(void*ptr); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/finsh/finsh_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Initialization procedure for finsh shell. 3 | * 4 | * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2010-03-22 Bernard first version 28 | */ 29 | #include 30 | 31 | #include "finsh_node.h" 32 | #include "finsh_vm.h" 33 | #include "finsh_parser.h" 34 | #include "finsh_var.h" 35 | #include "finsh_error.h" 36 | #include "finsh_heap.h" 37 | 38 | int finsh_init(struct finsh_parser* parser) 39 | { 40 | finsh_parser_init(parser); 41 | 42 | /* finsh init */ 43 | finsh_node_init(); 44 | finsh_var_init(); 45 | finsh_error_init(); 46 | finsh_heap_init(); 47 | 48 | return 0; 49 | } 50 | 51 | long finsh_stack_bottom() 52 | { 53 | return finsh_vm_stack[0].long_value; 54 | } 55 | 56 | int finsh_flush(struct finsh_parser* parser) 57 | { 58 | finsh_parser_init(parser); 59 | 60 | /* finsh init */ 61 | finsh_node_init(); 62 | finsh_error_init(); 63 | 64 | return 0; 65 | } 66 | 67 | int finsh_reset(struct finsh_parser* parser) 68 | { 69 | /* finsh init */ 70 | finsh_node_init(); 71 | finsh_var_init(); 72 | finsh_error_init(); 73 | finsh_heap_init(); 74 | 75 | return 0; 76 | } 77 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/finsh/finsh_parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * script parser for finsh shell. 3 | * 4 | * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2010-03-22 Bernard first version 28 | */ 29 | #ifndef __FINSH_PARSER_H__ 30 | #define __FINSH_PARSER_H__ 31 | 32 | #include 33 | 34 | int finsh_parser_init(struct finsh_parser* self); 35 | void finsh_parser_run(struct finsh_parser* self, const u_char* string); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/finsh/finsh_var.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Variable implementation in finsh shell. 3 | * 4 | * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2010-03-22 Bernard first version 28 | */ 29 | #ifndef __FINSH_VAR_H__ 30 | #define __FINSH_VAR_H__ 31 | 32 | #include 33 | 34 | /* 35 | * The variable in finsh is put in data segment as a global variable. 36 | * The 'finsh_var' structure presents the structure of variable in data segment. 37 | */ 38 | struct finsh_var 39 | { 40 | char name[FINSH_NAME_MAX + 1]; /* the name of variable */ 41 | 42 | u_char type; /* the type of variable */ 43 | 44 | /* variable value */ 45 | union { 46 | char char_value; 47 | short short_value; 48 | int int_value; 49 | long long_value; 50 | void* ptr; 51 | }value; 52 | }; 53 | extern struct finsh_var global_variable[]; 54 | 55 | int finsh_var_init(void); 56 | int finsh_var_insert(const char* name, int type); 57 | int finsh_var_delete(const char* name); 58 | struct finsh_var* finsh_var_lookup(const char* name); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/finsh/finsh_vm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Virtual machine finsh shell. 3 | * 4 | * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2010-03-22 Bernard first version 28 | */ 29 | #ifndef __FINSH_VM_H__ 30 | #define __FINSH_VM_H__ 31 | 32 | #include 33 | 34 | #include "finsh_var.h" 35 | 36 | union finsh_value { 37 | char char_value; 38 | short short_value; 39 | long long_value; 40 | void* ptr; 41 | }; 42 | 43 | extern union finsh_value* finsh_sp; /* stack pointer */ 44 | extern u_char* finsh_pc; /* PC */ 45 | 46 | /* stack */ 47 | extern union finsh_value finsh_vm_stack[FINSH_STACK_MAX]; 48 | /* text segment */ 49 | extern u_char text_segment[FINSH_TEXT_MAX]; 50 | 51 | void finsh_vm_run(void); 52 | //void finsh_disassemble(void); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/finsh/msh.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RT-Thread module shell implementation. 3 | * 4 | * COPYRIGHT (C) 2013, Shanghai Real-Thread Technology Co., Ltd 5 | * 6 | * This file is part of RT-Thread (http://www.rt-thread.org) 7 | * Maintainer: bernard.xiong 8 | * 9 | * All rights reserved. 10 | * 11 | * This program is free software; you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation; either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License along 22 | * with this program; if not, write to the Free Software Foundation, Inc., 23 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 | * 25 | * Change Logs: 26 | * Date Author Notes 27 | * 2013-03-30 Bernard the first verion for FinSH 28 | */ 29 | 30 | #ifndef __M_SHELL__ 31 | #define __M_SHELL__ 32 | 33 | #include 34 | 35 | rt_bool_t msh_is_used(void); 36 | int msh_exec(char* cmd, rt_size_t length); 37 | void msh_auto_complete(char *prefix); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/init/SConscript: -------------------------------------------------------------------------------- 1 | Import('rtconfig') 2 | from building import * 3 | 4 | cwd = GetCurrentDir() 5 | src = Glob('*.c') 6 | CPPPATH = [cwd] 7 | if rtconfig.CROSS_TOOL == 'keil': 8 | LINKFLAGS = ' --keep __rt_init* ' 9 | else: 10 | LINKFLAGS = '' 11 | 12 | group = DefineGroup('Components', src, depend = ['RT_USING_COMPONENTS_INIT'], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS) 13 | 14 | Return('group') 15 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/SConscript: -------------------------------------------------------------------------------- 1 | # for libc component 2 | import os 3 | Import('RTT_ROOT') 4 | 5 | objs = [] 6 | list = os.listdir(os.path.join(RTT_ROOT, 'components', 'libc')) 7 | 8 | for d in list: 9 | path = os.path.join(RTT_ROOT, 'components', 'libc', d) 10 | if os.path.isfile(os.path.join(path, 'SConscript')): 11 | objs = objs + SConscript(os.path.join(d, 'SConscript')) 12 | 13 | Return('objs') 14 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/armlibc/SConscript: -------------------------------------------------------------------------------- 1 | Import('rtconfig') 2 | from building import * 3 | 4 | if GetDepend('RT_USING_ARM_LIBC') and rtconfig.CROSS_TOOL != 'keil': 5 | print '================ERROR==============================' 6 | print 'Please use ARM CC compiler if using ARM C library' 7 | print '===================================================' 8 | exit(0) 9 | 10 | cwd = GetCurrentDir() 11 | src = Glob('*.c') 12 | CPPPATH = [cwd] 13 | 14 | group = DefineGroup('libc', src, depend = ['RT_USING_ARM_LIBC'], CPPPATH = CPPPATH) 15 | 16 | Return('group') 17 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/armlibc/mem_std.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File: mem_std.c 3 | * Brief: Replace memory management functions of arm standard c library 4 | * 5 | */ 6 | 7 | #include "rtthread.h" 8 | 9 | /* avoid the heap and heap-using library functions supplied by arm */ 10 | #pragma import(__use_no_heap) 11 | 12 | void * malloc(int n) 13 | { 14 | return rt_malloc(n); 15 | } 16 | 17 | void * realloc(void *rmem, rt_size_t newsize) 18 | { 19 | return rt_realloc(rmem, newsize); 20 | } 21 | 22 | void free(void *rmem) 23 | { 24 | rt_free(rmem); 25 | } 26 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/minilibc/SConscript: -------------------------------------------------------------------------------- 1 | Import('RTT_ROOT') 2 | from building import * 3 | 4 | src = Glob('*.c') 5 | CPPPATH = [RTT_ROOT + '/components/libc/minilibc'] 6 | CPPDEFINES = ['RT_USING_MINILIBC'] 7 | group = DefineGroup('minilibc', src, 8 | depend = ['RT_USING_MINILIBC'], 9 | CPPPATH = CPPPATH, 10 | CPPDEFINES = CPPDEFINES 11 | ) 12 | 13 | Return('group') 14 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/minilibc/ctype.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : ctype.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2008, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2008-08-14 Bernard the first version 13 | */ 14 | 15 | #include 16 | #include 17 | 18 | #if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC) 19 | #include "ctype.h" 20 | 21 | int isprint (int ch) 22 | { 23 | ch&=0x7f; 24 | return (ch>=32 && ch<127); 25 | } 26 | 27 | int isalpha(int ch) 28 | { 29 | return (unsigned int)((ch | 0x20) - 'a') < 26u; 30 | } 31 | 32 | int isdigit (int ch) 33 | { 34 | return (unsigned int)(ch - '0') < 10u; 35 | } 36 | 37 | int isspace(int ch) 38 | { 39 | switch(ch) 40 | { 41 | case ' ': 42 | case '\n': 43 | case '\f': 44 | case '\r': 45 | case '\t': 46 | case '\v': 47 | return 1; 48 | default: 49 | return 0; 50 | } 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/minilibc/ctype.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : ctype.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2008, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2008-08-14 Bernard the first version 13 | */ 14 | #ifndef __CTYPE_H__ 15 | #define __CTYPE_H__ 16 | 17 | int isprint(int c) __attribute__ ((__const__)); 18 | int isalpha (int c) __attribute__ ((__const__)); 19 | int isdigit (int ch) __attribute__ ((__const__)); 20 | int isspace(int ch) __attribute__ ((__const__)); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/minilibc/inttypes.h: -------------------------------------------------------------------------------- 1 | #ifndef __INTTYPES_H__ 2 | #define __INTTYPES_H__ 3 | 4 | #include "stdint.h" 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/minilibc/math.h: -------------------------------------------------------------------------------- 1 | #ifndef __MATH_H__ 2 | #define __MATH_H__ 3 | 4 | #define M_PI 3.141592653589793238462643 5 | 6 | double sin(double x); 7 | double cos(double x); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/minilibc/qsort.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static void exch(char* base,size_t size,size_t a,size_t b) { 5 | char* x=base+a*size; 6 | char* y=base+b*size; 7 | while (size) { 8 | char z=*x; 9 | *x=*y; 10 | *y=z; 11 | --size; ++x; ++y; 12 | } 13 | } 14 | 15 | /* Quicksort with 3-way partitioning, ala Sedgewick */ 16 | /* Blame him for the scary variable names */ 17 | /* http://www.cs.princeton.edu/~rs/talks/QuicksortIsOptimal.pdf */ 18 | static void quicksort(char* base,size_t size,ssize_t l,ssize_t r, 19 | int (*compar)(const void*,const void*)) { 20 | ssize_t i=l-1, j=r, p=l-1, q=r, k; 21 | char* v=base+r*size; 22 | if (r<=l) return; 23 | for (;;) { 24 | while (++i != r && compar(base+i*size,v)<0) ; 25 | while (compar(v,base+(--j)*size)<0) if (j == l) break; 26 | if (i >= j) break; 27 | exch(base,size,i,j); 28 | if (compar(base+i*size,v)==0) exch(base,size,++p,i); 29 | if (compar(v,base+j*size)==0) exch(base,size,j,--q); 30 | } 31 | exch(base,size,i,r); j = i-1; ++i; 32 | for (k=l; kq; k--, i++) exch(base,size,i,k); 34 | quicksort(base,size,l,j,compar); 35 | quicksort(base,size,i,r,compar); 36 | } 37 | 38 | void qsort(void* base,size_t nmemb,size_t size,int (*compar)(const void*,const void*)) { 39 | /* check for integer overflows */ 40 | if (nmemb >= (((size_t)-1)>>1) || 41 | size >= (((size_t)-1)>>1)) return; 42 | if (nmemb>1) 43 | quicksort(base,size,0,nmemb-1,compar); 44 | } 45 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/minilibc/rand.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static unsigned int _seed=1; 6 | 7 | /* Knuth's TAOCP section 3.6 */ 8 | #define M ((1U<<31) -1) 9 | #define A 48271 10 | #define Q 44488 // M/A 11 | #define R 3399 // M%A; R < Q !!! 12 | 13 | int rand_r(unsigned int* seed) 14 | { int32_t X; 15 | 16 | X = *seed; 17 | X = A*(X%Q) - R * (int32_t) (X/Q); 18 | if (X < 0) 19 | X += M; 20 | 21 | *seed = X; 22 | return X; 23 | } 24 | 25 | int rand(void) { 26 | return rand_r(&_seed); 27 | } 28 | 29 | void srand(unsigned int i) 30 | { 31 | _seed=i; 32 | } 33 | 34 | int random(void) __attribute__((alias("rand"))); 35 | void srandom(unsigned int i) __attribute__((alias("srand"))); 36 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/minilibc/stddef.h: -------------------------------------------------------------------------------- 1 | #ifndef __STDDEF_H__ 2 | #define __STDDEF_H__ 3 | 4 | #include 5 | typedef signed long ptrdiff_t; 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/minilibc/stdint.h: -------------------------------------------------------------------------------- 1 | #ifndef __STDINT_H__ 2 | #define __STDINT_H__ 3 | 4 | #include 5 | 6 | typedef rt_int8_t int8_t; 7 | typedef rt_uint8_t uint8_t; 8 | typedef rt_int16_t int16_t; 9 | typedef rt_uint16_t uint16_t; 10 | typedef rt_int32_t int32_t; 11 | typedef rt_uint32_t uint32_t; 12 | typedef long long int64_t; 13 | typedef unsigned long long uint64_t; 14 | 15 | /* 16 | * 7.18.2 Limits of specified-width integer types. 17 | * 18 | * The following object-like macros specify the minimum and maximum limits 19 | * of integer types corresponding to the typedef names defined above. 20 | */ 21 | 22 | /* 7.18.2.1 Limits of exact-width integer types */ 23 | #define INT8_MIN (-0x7f - 1) 24 | #define INT16_MIN (-0x7fff - 1) 25 | #define INT32_MIN (-0x7fffffff - 1) 26 | 27 | #define INT8_MAX 0x7f 28 | #define INT16_MAX 0x7fff 29 | #define INT32_MAX 0x7fffffff 30 | 31 | #define UINT8_MAX 0xff 32 | #define UINT16_MAX 0xffff 33 | #define UINT32_MAX 0xffffffffU 34 | 35 | #ifndef __INT_MAX__ 36 | #define __INT_MAX__ 2147483647 37 | #endif 38 | #define INT_MIN (-1 - INT_MAX) 39 | #define INT_MAX (__INT_MAX__) 40 | #define UINT_MAX (INT_MAX * 2U + 1U) 41 | 42 | #define LONG_MAX ((long)(~0UL>>1)) 43 | #define LONG_MIN (-LONG_MAX - 1) 44 | #define ULONG_MAX (~0UL) 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/minilibc/stdio.h: -------------------------------------------------------------------------------- 1 | #ifndef __STDIO_H__ 2 | #define __STDIO_H__ 3 | 4 | #define BUFSIZ 128 5 | #define EOF (-1) 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/minilibc/stdlib.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : stdlib.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2008, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2008-08-14 Bernard the first version 13 | */ 14 | 15 | #include 16 | 17 | #if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC) 18 | #include "stdlib.h" 19 | 20 | int atoi(const char* s) 21 | { 22 | long int v=0; 23 | int sign=1; 24 | while ( *s == ' ' || (unsigned int)(*s - 9) < 5u) s++; 25 | switch (*s) 26 | { 27 | case '-': 28 | sign=-1; 29 | case '+': 30 | ++s; 31 | } 32 | while ((unsigned int) (*s - '0') < 10u) 33 | { 34 | v=v*10+*s-'0'; 35 | ++s; 36 | } 37 | return sign==-1?-v:v; 38 | } 39 | 40 | long int atol(const char* s) 41 | { 42 | long int v=0; 43 | int sign=0; 44 | while ( *s == ' ' || (unsigned int)(*s - 9) < 5u) ++s; 45 | switch (*s) 46 | { 47 | case '-': sign=-1; 48 | case '+': ++s; 49 | } 50 | while ((unsigned int) (*s - '0') < 10u) 51 | { 52 | v=v*10+*s-'0'; ++s; 53 | } 54 | return sign?-v:v; 55 | } 56 | 57 | void *malloc(size_t size) 58 | { 59 | return rt_malloc(size); 60 | } 61 | 62 | void free(void *ptr) 63 | { 64 | rt_free(ptr); 65 | } 66 | 67 | void *realloc(void *ptr, size_t size) 68 | { 69 | return rt_realloc(ptr, size); 70 | } 71 | 72 | void *calloc(size_t nelem, size_t elsize) 73 | { 74 | return rt_calloc(nelem, elsize); 75 | } 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/minilibc/stdlib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : stdlib.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2008, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2008-08-14 Bernard the first version 13 | */ 14 | 15 | #ifndef __STDLIB_H__ 16 | #define __STDLIB_H__ 17 | 18 | #include 19 | 20 | #if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC) 21 | int atoi(const char *nptr); 22 | long int atol(const char *nptr); 23 | 24 | int rand(void); 25 | int rand_r(unsigned int *seed); 26 | void srand(unsigned int seed); 27 | 28 | void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); 29 | 30 | void *malloc(size_t size); 31 | void free(void *ptr); 32 | void *realloc(void *ptr, size_t size); 33 | void *calloc(size_t nelem, size_t elsize); 34 | void abort(void); 35 | #endif 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/minilibc/sys/stat.h: -------------------------------------------------------------------------------- 1 | #ifndef __STAT_H__ 2 | #define __STAT_H__ 3 | 4 | #include 5 | 6 | #ifdef RT_USING_DFS 7 | #include 8 | #else 9 | #define _FREAD 0x0001 /* read enabled */ 10 | #define _FWRITE 0x0002 /* write enabled */ 11 | #define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */ 12 | #define _FMARK 0x0010 /* internal; mark during gc() */ 13 | #define _FDEFER 0x0020 /* internal; defer for next gc pass */ 14 | #define _FASYNC 0x0040 /* signal pgrp when data ready */ 15 | #define _FSHLOCK 0x0080 /* BSD flock() shared lock present */ 16 | #define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */ 17 | #define _FCREAT 0x0200 /* open with file create */ 18 | #define _FTRUNC 0x0400 /* open with truncation */ 19 | #define _FEXCL 0x0800 /* error on open if file exists */ 20 | #define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */ 21 | #define _FSYNC 0x2000 /* do all writes synchronously */ 22 | #define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ 23 | #define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */ 24 | #define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ 25 | 26 | #define O_RDONLY 0 /* +1 == FREAD */ 27 | #define O_WRONLY 1 /* +1 == FWRITE */ 28 | #define O_RDWR 2 /* +1 == FREAD|FWRITE */ 29 | #define O_APPEND _FAPPEND 30 | #define O_CREAT _FCREAT 31 | #define O_TRUNC _FTRUNC 32 | #define O_EXCL _FEXCL 33 | #define O_SYNC _FSYNC 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/minilibc/sys/time.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_TIME_H_ 2 | #define _SYS_TIME_H_ 3 | 4 | #include 5 | 6 | /* 7 | * Structure returned by gettimeofday(2) system call, 8 | * and used in other calls. 9 | */ 10 | struct timeval { 11 | long tv_sec; /* seconds */ 12 | long tv_usec; /* and microseconds */ 13 | }; 14 | 15 | /* 16 | * Structure defined by POSIX.1b to be like a timeval. 17 | */ 18 | struct timespec { 19 | time_t tv_sec; /* seconds */ 20 | long tv_nsec; /* and nanoseconds */ 21 | }; 22 | 23 | struct timezone { 24 | int tz_minuteswest; /* minutes west of Greenwich */ 25 | int tz_dsttime; /* type of dst correction */ 26 | }; 27 | 28 | struct tm { 29 | int tm_sec; /* Seconds. [0-60] (1 leap second) */ 30 | int tm_min; /* Minutes. [0-59] */ 31 | int tm_hour; /* Hours. [0-23] */ 32 | int tm_mday; /* Day. [1-31] */ 33 | int tm_mon; /* Month. [0-11] */ 34 | int tm_year; /* Year - 1900. */ 35 | int tm_wday; /* Day of week. [0-6] */ 36 | int tm_yday; /* Days in year.[0-365] */ 37 | int tm_isdst; /* DST. [-1/0/1]*/ 38 | 39 | long int tm_gmtoff; /* Seconds east of UTC. */ 40 | const char *tm_zone; /* Timezone abbreviation. */ 41 | }; 42 | 43 | int gettimeofday(struct timeval *tp, void *ignore); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/minilibc/sys/types.h: -------------------------------------------------------------------------------- 1 | #ifndef __TYPES_H__ 2 | #define __TYPES_H__ 3 | 4 | #include 5 | 6 | typedef long off_t; 7 | typedef rt_size_t size_t; 8 | typedef signed long ssize_t; /* Used for a count of bytes or an error indication. */ 9 | 10 | typedef rt_uint8_t u_char; 11 | typedef rt_uint16_t u_short; 12 | typedef rt_ubase_t u_int; 13 | typedef rt_uint32_t u_long; 14 | 15 | typedef rt_time_t time_t; 16 | typedef int mode_t; 17 | 18 | typedef unsigned long clockid_t; 19 | typedef int pid_t; 20 | 21 | #ifndef NULL 22 | #define NULL RT_NULL 23 | #endif 24 | 25 | #define __u_char_defined 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/minilibc/time.h: -------------------------------------------------------------------------------- 1 | #ifndef __TIME_H__ 2 | #define __TIME_H__ 3 | 4 | #include 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/newlib/SConscript: -------------------------------------------------------------------------------- 1 | Import('rtconfig') 2 | from building import * 3 | 4 | if GetDepend('RT_USING_NEWLIB') and rtconfig.CROSS_TOOL != 'gcc': 5 | print '================ERROR============================' 6 | print 'Please use GNU GCC compiler if using newlib' 7 | print '=================================================' 8 | exit(0) 9 | 10 | cwd = GetCurrentDir() 11 | src = Glob('*.c') 12 | CPPPATH = [cwd] 13 | 14 | # link with libc and libm: 15 | # libm is a frequently used lib. Newlib is compiled with -ffunction-sections in 16 | # recent GCC tool chains. The linker would just link in the functions that have 17 | # been referenced. So setting this won't result in bigger text size. 18 | LIBS = ['c', 'm'] 19 | 20 | group = DefineGroup('newlib', src, depend = ['RT_USING_NEWLIB'], 21 | CPPPATH = CPPPATH, LIBS = LIBS) 22 | 23 | Return('group') 24 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/newlib/libc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "libc.h" 7 | 8 | #ifdef RT_USING_PTHREADS 9 | #include 10 | #endif 11 | 12 | void libc_system_init(const char* tty_name) 13 | { 14 | #ifdef RT_USING_DFS 15 | int fd; 16 | 17 | #ifndef RT_USING_DFS_DEVFS 18 | #error Please enable devfs by defining RT_USING_DFS_DEVFS in rtconfig.h 19 | #endif 20 | 21 | /* init console device */ 22 | rt_console_init(tty_name); 23 | 24 | /* open console as stdin/stdout/stderr */ 25 | fd = open("/dev/console", O_RDONLY, 0); /* for stdin */ 26 | fd = open("/dev/console", O_WRONLY, 0); /* for stdout */ 27 | fd = open("/dev/console", O_WRONLY, 0); /* for stderr */ 28 | #endif 29 | 30 | /* set PATH and HOME */ 31 | putenv("PATH=/"); 32 | putenv("HOME=/"); 33 | 34 | #ifdef RT_USING_PTHREADS 35 | pthread_system_init(); 36 | #endif 37 | } 38 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/newlib/libc.h: -------------------------------------------------------------------------------- 1 | #ifndef __RTT_LIBC_H__ 2 | #define __RTT_LIBC_H__ 3 | 4 | #include 5 | 6 | #define MILLISECOND_PER_SECOND 1000UL 7 | #define MICROSECOND_PER_SECOND 1000000UL 8 | #define NANOSECOND_PER_SECOND 1000000000UL 9 | 10 | #define MILLISECOND_PER_TICK (MILLISECOND_PER_SECOND / RT_TICK_PER_SECOND) 11 | #define MICROSECOND_PER_TICK (MICROSECOND_PER_SECOND / RT_TICK_PER_SECOND) 12 | #define NANOSECOND_PER_TICK (NANOSECOND_PER_SECOND / RT_TICK_PER_SECOND) 13 | 14 | void libc_system_init(const char* tty_name); 15 | 16 | /* some time related function */ 17 | int libc_set_time(const struct timespec *time); 18 | int libc_get_time(struct timespec *time); 19 | int libc_time_to_tick(const struct timespec *time); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/newlib/sys/dirent.h: -------------------------------------------------------------------------------- 1 | #ifndef __RTT_DIRENT_H__ 2 | #define __RTT_DIRENT_H__ 3 | 4 | #include 5 | 6 | /* 7 | * dirent.h - format of directory entries 8 | * Ref: http://www.opengroup.org/onlinepubs/009695399/basedefs/dirent.h.html 9 | */ 10 | 11 | /* File types */ 12 | #define FT_REGULAR 0 /* regular file */ 13 | #define FT_SOCKET 1 /* socket file */ 14 | #define FT_DIRECTORY 2 /* directory */ 15 | #define FT_USER 3 /* user defined */ 16 | 17 | #define DT_UNKNOWN 0x00 18 | #define DT_REG 0x01 19 | #define DT_DIR 0x02 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | #ifndef HAVE_DIR_STRUCTURE 26 | typedef struct 27 | { 28 | int fd; /* directory file */ 29 | char buf[512]; 30 | int num; 31 | int cur; 32 | } DIR; 33 | #endif 34 | 35 | #ifndef HAVE_DIRENT_STRUCTURE 36 | struct dirent 37 | { 38 | rt_uint8_t d_type; /* The type of the file */ 39 | rt_uint8_t d_namlen; /* The length of the not including the terminating null file name */ 40 | rt_uint16_t d_reclen; /* length of this record */ 41 | char d_name[256]; /* The null-terminated file name */ 42 | }; 43 | #endif 44 | 45 | int closedir(DIR *); 46 | DIR *opendir(const char *); 47 | struct dirent *readdir(DIR *); 48 | int readdir_r(DIR *, struct dirent *, struct dirent **); 49 | void rewinddir(DIR *); 50 | void seekdir(DIR *, long int); 51 | long telldir(DIR *); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/newlib/sys/fcntl.h: -------------------------------------------------------------------------------- 1 | #ifndef __RTT_FCNTL_H__ 2 | #define __RTT_FCNTL_H__ 3 | 4 | /* Operation flags */ 5 | #define O_RDONLY 0x0000000 6 | #define O_WRONLY 0x0000001 7 | #define O_RDWR 0x0000002 8 | #define O_ACCMODE 0x0000003 9 | #define O_CREAT 0x0000100 10 | #define O_EXCL 0x0000200 11 | #define O_TRUNC 0x0001000 12 | #define O_APPEND 0x0002000 13 | #define O_DIRECTORY 0x0200000 14 | #define O_BINARY 0x0008000 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libc/newlib/sys/statfs.h: -------------------------------------------------------------------------------- 1 | #ifndef __RTT_STATFS_H__ 2 | #define __RTT_STATFS_H__ 3 | 4 | #include 5 | 6 | struct statfs 7 | { 8 | rt_size_t f_bsize; /* block size */ 9 | rt_size_t f_blocks; /* total data blocks in file system */ 10 | rt_size_t f_bfree; /* free blocks in file system */ 11 | }; 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libdl/SConscript: -------------------------------------------------------------------------------- 1 | Import('RTT_ROOT') 2 | Import('rtconfig') 3 | from building import * 4 | 5 | src = Glob('*.c') 6 | CPPPATH = [RTT_ROOT + '/components/libdl'] 7 | group = DefineGroup('libdl', src, depend = ['RT_USING_MODULE', 'RT_USING_LIBDL'], CPPPATH = CPPPATH) 8 | 9 | Return('group') 10 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libdl/dlclose.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : dlclose.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-11-17 yi.qiu first version 13 | */ 14 | 15 | #include 16 | #include 17 | 18 | int dlclose (void *handle) 19 | { 20 | rt_module_t module; 21 | 22 | RT_ASSERT(handle != RT_NULL); 23 | 24 | module = (rt_module_t)handle; 25 | module->nref--; 26 | 27 | if(module->nref <= 0) 28 | { 29 | rt_module_unload(module); 30 | } 31 | 32 | return RT_TRUE; 33 | } 34 | 35 | RTM_EXPORT(dlclose) 36 | 37 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libdl/dlerror.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : dlerror.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-11-17 yi.qiu first version 13 | */ 14 | 15 | #include 16 | #include 17 | 18 | const char *dlerror(void) 19 | { 20 | return "TODO"; 21 | } 22 | 23 | RTM_EXPORT(dlerror) 24 | 25 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libdl/dlfcn.h: -------------------------------------------------------------------------------- 1 | #ifndef __DLFCN_H_ 2 | #define __DLFCN_H_ 3 | 4 | #define RTLD_LAZY 0x00000 5 | #define RTLD_NOW 0x00001 6 | 7 | #define RTLD_LOCAL 0x00000 8 | #define RTLD_GLOBAL 0x10000 9 | 10 | #define RTLD_DEFAULT ((void*)1) 11 | #define RTLD_NEXT ((void*)2) 12 | 13 | void *dlopen (const char *filename, int flag); 14 | const char *dlerror(void); 15 | void *dlsym(void *handle, const char *symbol); 16 | int dlclose (void *handle); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libdl/dlopen.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : dlopen.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-11-17 yi.qiu first version 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #define MODULE_ROOT_DIR "/module/lib" 20 | 21 | void* dlopen(const char *filename, int flags) 22 | { 23 | rt_module_t module; 24 | char *fullpath; 25 | const char*def_path = MODULE_ROOT_DIR; 26 | 27 | /* check parameters */ 28 | RT_ASSERT(filename != RT_NULL); 29 | 30 | if (filename[0] != '/') /* it's a absolute path, use it directly */ 31 | { 32 | fullpath = rt_malloc(strlen(def_path) + strlen(filename) + 2); 33 | 34 | /* join path and file name */ 35 | rt_snprintf(fullpath, strlen(def_path) + strlen(filename) + 2, 36 | "%s/%s", def_path, filename); 37 | } 38 | else 39 | { 40 | rt_kprintf("use absolute path\n"); 41 | return RT_NULL; 42 | } 43 | 44 | /* find in module list */ 45 | module = rt_module_find(fullpath); 46 | 47 | if(module != RT_NULL) module->nref++; 48 | else module = rt_module_open(fullpath); 49 | 50 | rt_free(fullpath); 51 | return (void*)module; 52 | } 53 | 54 | RTM_EXPORT(dlopen) 55 | 56 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/libdl/dlsym.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : dlsym.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-11-17 yi.qiu first version 13 | */ 14 | 15 | #include 16 | #include 17 | 18 | void* dlsym(void *handle, const char* symbol) 19 | { 20 | int i; 21 | rt_module_t module; 22 | 23 | RT_ASSERT(handle != RT_NULL); 24 | 25 | module = (rt_module_t)handle; 26 | 27 | for(i=0; insym; i++) 28 | { 29 | if (rt_strcmp(module->symtab[i].name, symbol) == 0) 30 | return (void*)module->symtab[i].addr; 31 | } 32 | 33 | return RT_NULL; 34 | } 35 | 36 | RTM_EXPORT(dlsym) 37 | 38 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/pthreads/SConscript: -------------------------------------------------------------------------------- 1 | Import('RTT_ROOT') 2 | from building import * 3 | 4 | src = Glob('*.c') 5 | CPPPATH = [RTT_ROOT + '/components/pthreads'] 6 | group = DefineGroup('pthreads', src, depend = ['RT_USING_PTHREADS'], CPPPATH = CPPPATH) 7 | 8 | Return('group') 9 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/pthreads/pthread_spin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : pthread_spin.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | * 2010-10-26 Bernard the first version 23 | */ 24 | 25 | #include 26 | 27 | int pthread_spin_init (pthread_spinlock_t *lock, int pshared) 28 | { 29 | if (!lock) 30 | return EINVAL; 31 | 32 | lock->lock = 0; 33 | 34 | return 0; 35 | } 36 | 37 | int pthread_spin_destroy (pthread_spinlock_t *lock) 38 | { 39 | if (!lock) 40 | return EINVAL; 41 | 42 | return 0; 43 | } 44 | 45 | int pthread_spin_lock (pthread_spinlock_t *lock) 46 | { 47 | if (!lock) 48 | return EINVAL; 49 | 50 | while (!(lock->lock)) 51 | { 52 | lock->lock = 1; 53 | } 54 | 55 | return 0; 56 | } 57 | 58 | int pthread_spin_trylock (pthread_spinlock_t *lock) 59 | { 60 | if (!lock) 61 | return EINVAL; 62 | 63 | if (!(lock->lock)) 64 | { 65 | lock->lock = 1; 66 | 67 | return 0; 68 | } 69 | 70 | return EBUSY; 71 | } 72 | 73 | int pthread_spin_unlock (pthread_spinlock_t *lock) 74 | { 75 | if (!lock) 76 | return EINVAL; 77 | if (!(lock->lock)) 78 | return EPERM; 79 | 80 | lock->lock = 0; 81 | 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/pthreads/sched.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : sched.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | */ 23 | 24 | #include 25 | 26 | int sched_yield(void) 27 | { 28 | rt_thread_yield(); 29 | 30 | return 0; 31 | } 32 | RTM_EXPORT(sched_yield); 33 | 34 | int sched_get_priority_min(int policy) 35 | { 36 | if (policy != SCHED_FIFO && policy != SCHED_RR) 37 | return EINVAL; 38 | 39 | return 0; 40 | } 41 | RTM_EXPORT(sched_get_priority_min); 42 | 43 | int sched_get_priority_max(int policy) 44 | { 45 | if (policy != SCHED_FIFO && policy != SCHED_RR) 46 | return EINVAL; 47 | 48 | return RT_THREAD_PRIORITY_MAX - 1; 49 | } 50 | RTM_EXPORT(sched_get_priority_max); 51 | 52 | int sched_setscheduler(pid_t pid, int policy) 53 | { 54 | return EOPNOTSUPP; 55 | } 56 | RTM_EXPORT(sched_setscheduler); 57 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/pthreads/sched.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : sched.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | */ 23 | 24 | #ifndef __SCHED_H__ 25 | #define __SCHED_H__ 26 | 27 | #include 28 | #include 29 | 30 | /* Thread scheduling policies */ 31 | enum 32 | { 33 | SCHED_OTHER = 0, 34 | SCHED_FIFO, 35 | SCHED_RR, 36 | SCHED_MIN = SCHED_OTHER, 37 | SCHED_MAX = SCHED_RR 38 | }; 39 | 40 | struct sched_param 41 | { 42 | int sched_priority; 43 | }; 44 | 45 | #ifdef __cplusplus 46 | extern "C" 47 | { 48 | #endif 49 | 50 | int sched_yield(void); 51 | int sched_get_priority_min(int policy); 52 | int sched_get_priority_max(int policy); 53 | int sched_setscheduler(pid_t pid, int policy); 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/pthreads/semaphore.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : semaphore.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | * 2010-10-26 Bernard the first version 23 | */ 24 | 25 | #ifndef __POSIX_SEMAPHORE_H__ 26 | #define __POSIX_SEMAPHORE_H__ 27 | 28 | #include 29 | #include 30 | 31 | struct posix_sem 32 | { 33 | /* reference count and unlinked */ 34 | rt_uint16_t refcount; 35 | rt_uint8_t unlinked; 36 | rt_uint8_t unamed; 37 | 38 | /* RT-Thread semaphore */ 39 | rt_sem_t sem; 40 | 41 | /* next posix semaphore */ 42 | struct posix_sem* next; 43 | }; 44 | typedef struct posix_sem sem_t; 45 | 46 | int sem_close(sem_t *sem); 47 | int sem_destroy(sem_t *sem); 48 | int sem_getvalue(sem_t *sem, int *sval); 49 | int sem_init(sem_t *sem, int pshared, unsigned int value); 50 | sem_t *sem_open(const char *name, int oflag, ...); 51 | int sem_post(sem_t *sem); 52 | int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout); 53 | int sem_trywait(sem_t *sem); 54 | int sem_unlink(const char *name); 55 | int sem_wait(sem_t *sem); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/utilities/SConscript: -------------------------------------------------------------------------------- 1 | # RT-Thread building script for bridge 2 | 3 | import os 4 | from building import * 5 | 6 | cwd = GetCurrentDir() 7 | objs = [] 8 | list = os.listdir(cwd) 9 | 10 | for d in list: 11 | path = os.path.join(cwd, d) 12 | if os.path.isfile(os.path.join(path, 'SConscript')): 13 | objs = objs + SConscript(os.path.join(d, 'SConscript')) 14 | 15 | Return('objs') 16 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/utilities/logtrace/SConscript: -------------------------------------------------------------------------------- 1 | from building import * 2 | 3 | cwd = GetCurrentDir() 4 | src = Glob('*.c') 5 | CPPPATH = [cwd] 6 | 7 | group = DefineGroup('Utilities', src, depend = ['RT_USING_LOGTRACE'], CPPPATH = CPPPATH) 8 | 9 | Return('group') 10 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/components/utilities/ymodem/SConscript: -------------------------------------------------------------------------------- 1 | from building import * 2 | 3 | cwd = GetCurrentDir() 4 | src = Glob('*.c') 5 | CPPPATH = [cwd] 6 | group = DefineGroup('Utilities', src, depend = ['RT_USING_RYM'], CPPPATH = CPPPATH) 7 | 8 | Return('group') 9 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/include/cpuusage.h: -------------------------------------------------------------------------------- 1 | #ifndef CPUUSAGE_H 2 | #define CPUUSAGE_H 3 | 4 | 5 | static void cpu_usage_idle_hook(void); 6 | void cpu_usage_get(rt_uint8_t *major, rt_uint8_t *minor); 7 | void cpu_usage_init(void); 8 | 9 | #endif 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/include/rtm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : rtm.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | */ 20 | 21 | #ifndef __RTM_H__ 22 | #define __RTM_H__ 23 | 24 | #include 25 | #include 26 | 27 | #ifdef RT_USING_MODULE 28 | struct rt_module_symtab 29 | { 30 | void *addr; 31 | const char *name; 32 | }; 33 | 34 | #if defined(_MSC_VER) 35 | #pragma section("RTMSymTab$f",read) 36 | #define RTM_EXPORT(symbol) \ 37 | __declspec(allocate("RTMSymTab$f"))const char __rtmsym_##symbol##_name[] = "__vs_rtm_"#symbol; 38 | #pragma comment(linker, "/merge:RTMSymTab=mytext") 39 | 40 | #elif defined(__MINGW32__) 41 | #define RTM_EXPORT(symbol) 42 | 43 | #else 44 | #define RTM_EXPORT(symbol) \ 45 | const char __rtmsym_##symbol##_name[] = #symbol; \ 46 | const struct rt_module_symtab __rtmsym_##symbol SECTION("RTMSymTab")= \ 47 | { \ 48 | (void *)&symbol, \ 49 | __rtmsym_##symbol##_name \ 50 | }; 51 | #endif 52 | 53 | #else 54 | #define RTM_EXPORT(symbol) 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/SConscript: -------------------------------------------------------------------------------- 1 | Import('RTT_ROOT') 2 | Import('rtconfig') 3 | from building import * 4 | 5 | comm = rtconfig.ARCH + '/common' 6 | path = rtconfig.ARCH + '/' + rtconfig.CPU 7 | 8 | # The set of source files associated with this SConscript file. 9 | if rtconfig.PLATFORM == 'armcc': 10 | src = Glob(path + '/*.c') + Glob(path + '/*_rvds.S') + Glob(comm + '/*.c') 11 | 12 | if rtconfig.PLATFORM == 'gcc': 13 | src = Glob(path + '/*.c') + Glob(path + '/*_gcc.S') + Glob(comm + '/*.c') + Glob(path + '/*_init.S') 14 | 15 | if rtconfig.PLATFORM == 'iar': 16 | src = Glob(path + '/*.c') + Glob(path + '/*_iar.S') + Glob(comm + '/*.c') 17 | 18 | if rtconfig.PLATFORM == 'cl': 19 | src = Glob(path + '/*.c') 20 | 21 | if rtconfig.PLATFORM == 'mingw': 22 | src = Glob(path + '/*.c') 23 | 24 | CPPPATH = [RTT_ROOT + '/libcpu/' + rtconfig.ARCH + '/' + rtconfig.CPU, RTT_ROOT + '/libcpu/' + rtconfig.ARCH + '/common'] 25 | group = DefineGroup(rtconfig.CPU.upper(), src, depend = [''], CPPPATH = CPPPATH) 26 | 27 | Return('group') 28 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/AT91SAM7S/cpu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : cpu.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Develop Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2006-08-23 Bernard first version 13 | */ 14 | 15 | #include 16 | #include "AT91SAM7S.h" 17 | 18 | /** 19 | * @addtogroup AT91SAM7 20 | */ 21 | /*@{*/ 22 | 23 | /** 24 | * this function will reset CPU 25 | * 26 | */ 27 | void rt_hw_cpu_reset() 28 | { 29 | } 30 | 31 | /** 32 | * this function will shutdown CPU 33 | * 34 | */ 35 | void rt_hw_cpu_shutdown() 36 | { 37 | rt_kprintf("shutdown...\n"); 38 | 39 | while (1); 40 | } 41 | 42 | /*@}*/ 43 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/AT91SAM7S/stack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : stack.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://openlab.rt-thread.com/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2006-08-23 Bernard the first version 13 | */ 14 | #include 15 | #include "AT91SAM7S.h" 16 | 17 | /** 18 | * @addtogroup AT91SAM7 19 | */ 20 | /*@{*/ 21 | 22 | /** 23 | * This function will initialize thread stack 24 | * 25 | * @param tentry the entry of thread 26 | * @param parameter the parameter of entry 27 | * @param stack_addr the beginning stack address 28 | * @param texit the function will be called when thread exit 29 | * 30 | * @return stack address 31 | */ 32 | rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, 33 | rt_uint8_t *stack_addr, void *texit) 34 | { 35 | unsigned long *stk; 36 | 37 | stk = (unsigned long *)stack_addr; 38 | *(stk) = (unsigned long)tentry; /* entry point */ 39 | *(--stk) = (unsigned long)texit; /* lr */ 40 | *(--stk) = 0; /* r12 */ 41 | *(--stk) = 0; /* r11 */ 42 | *(--stk) = 0; /* r10 */ 43 | *(--stk) = 0; /* r9 */ 44 | *(--stk) = 0; /* r8 */ 45 | *(--stk) = 0; /* r7 */ 46 | *(--stk) = 0; /* r6 */ 47 | *(--stk) = 0; /* r5 */ 48 | *(--stk) = 0; /* r4 */ 49 | *(--stk) = 0; /* r3 */ 50 | *(--stk) = 0; /* r2 */ 51 | *(--stk) = 0; /* r1 */ 52 | *(--stk) = (unsigned long)parameter; /* r0 : argument */ 53 | *(--stk) = SVCMODE; /* cpsr */ 54 | *(--stk) = SVCMODE; /* spsr */ 55 | 56 | /* return task's current stack address */ 57 | return (rt_uint8_t *)stk; 58 | } 59 | 60 | /*@}*/ 61 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/AT91SAM7S/trap.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : trap.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://openlab.rt-thread.com/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2006-08-25 Bernard first version 13 | */ 14 | 15 | #include 16 | #include 17 | 18 | #include "AT91SAM7S.h" 19 | 20 | /** 21 | * @addtogroup AT91SAM7 22 | */ 23 | /*@{*/ 24 | 25 | void rt_hw_trap_irq() 26 | { 27 | rt_isr_handler_t hander = (rt_isr_handler_t)AT91C_AIC_IVR; 28 | 29 | hander(AT91C_AIC_ISR); 30 | 31 | /* end of interrupt */ 32 | AT91C_AIC_EOICR = 0; 33 | } 34 | 35 | void rt_hw_trap_fiq() 36 | { 37 | rt_kprintf("fast interrupt request\n"); 38 | } 39 | 40 | /*@}*/ 41 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/AT91SAM7X/cpu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : cpu.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Develop Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2006-08-23 Bernard first version 13 | */ 14 | 15 | #include 16 | 17 | 18 | /** 19 | * @addtogroup AT91SAM7X 20 | */ 21 | /*@{*/ 22 | 23 | /** 24 | * this function will reset CPU 25 | * 26 | */ 27 | void rt_hw_cpu_reset() 28 | { 29 | } 30 | 31 | /** 32 | * this function will shutdown CPU 33 | * 34 | */ 35 | void rt_hw_cpu_shutdown() 36 | { 37 | rt_kprintf("shutdown...\n"); 38 | 39 | while (1); 40 | } 41 | 42 | /*@}*/ 43 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/AT91SAM7X/stack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : stack.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://openlab.rt-thread.com/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2006-08-23 Bernard the first version 13 | */ 14 | #include 15 | 16 | #define SVCMODE 0x13 17 | 18 | /** 19 | * @addtogroup AT91SAM7 20 | */ 21 | /*@{*/ 22 | 23 | /** 24 | * This function will initialize thread stack 25 | * 26 | * @param tentry the entry of thread 27 | * @param parameter the parameter of entry 28 | * @param stack_addr the beginning stack address 29 | * @param texit the function will be called when thread exit 30 | * 31 | * @return stack address 32 | */ 33 | rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, 34 | rt_uint8_t *stack_addr, void *texit) 35 | { 36 | unsigned long *stk; 37 | 38 | stk = (unsigned long *)stack_addr; 39 | *(stk) = (unsigned long)tentry; /* entry point */ 40 | *(--stk) = (unsigned long)texit; /* lr */ 41 | *(--stk) = 0; /* r12 */ 42 | *(--stk) = 0; /* r11 */ 43 | *(--stk) = 0; /* r10 */ 44 | *(--stk) = 0; /* r9 */ 45 | *(--stk) = 0; /* r8 */ 46 | *(--stk) = 0; /* r7 */ 47 | *(--stk) = 0; /* r6 */ 48 | *(--stk) = 0; /* r5 */ 49 | *(--stk) = 0; /* r4 */ 50 | *(--stk) = 0; /* r3 */ 51 | *(--stk) = 0; /* r2 */ 52 | *(--stk) = 0; /* r1 */ 53 | *(--stk) = (unsigned long)parameter; /* r0 : argument */ 54 | *(--stk) = SVCMODE; /* cpsr */ 55 | *(--stk) = SVCMODE; /* spsr */ 56 | 57 | /* return task's current stack address */ 58 | return (rt_uint8_t *)stk; 59 | } 60 | 61 | /*@}*/ 62 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/AT91SAM7X/trap.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : trap.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://openlab.rt-thread.com/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2006-08-25 Bernard first version 13 | */ 14 | 15 | #include 16 | #include 17 | 18 | #include "AT91SAM7X256.h" 19 | 20 | /** 21 | * @addtogroup AT91SAM7 22 | */ 23 | /*@{*/ 24 | 25 | void rt_hw_trap_irq(void) 26 | { 27 | int irqno; 28 | extern struct rt_irq_desc irq_desc[]; 29 | 30 | /* get interrupt number */ 31 | irqno = AT91C_BASE_AIC->AIC_ISR; 32 | 33 | /* invoke isr with parameters */ 34 | irq_desc[irqno].handler(irqno, irq_desc[irqno].param); 35 | 36 | /* end of interrupt */ 37 | AT91C_BASE_AIC->AIC_EOICR = 0; 38 | } 39 | 40 | void rt_hw_trap_fiq(void) 41 | { 42 | rt_kprintf("fast interrupt request\n"); 43 | } 44 | 45 | extern struct rt_thread* rt_current_thread; 46 | void rt_hw_trap_abort(void) 47 | { 48 | rt_kprintf("Abort occured!!! Thread [%s] suspended.\n",rt_current_thread->name); 49 | rt_thread_suspend(rt_current_thread); 50 | rt_schedule(); 51 | 52 | } 53 | /*@}*/ 54 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/am335x/stack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : stack.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2011, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2011-09-23 Bernard the first version 13 | * 2011-10-05 Bernard add thumb mode 14 | */ 15 | #include 16 | #include "am33xx.h" 17 | 18 | /** 19 | * @addtogroup AM33xx 20 | */ 21 | /*@{*/ 22 | 23 | /** 24 | * This function will initialize thread stack 25 | * 26 | * @param tentry the entry of thread 27 | * @param parameter the parameter of entry 28 | * @param stack_addr the beginning stack address 29 | * @param texit the function will be called when thread exit 30 | * 31 | * @return stack address 32 | */ 33 | rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, 34 | rt_uint8_t *stack_addr, void *texit) 35 | { 36 | rt_uint32_t *stk; 37 | 38 | stk = (rt_uint32_t*)stack_addr; 39 | *(stk) = (rt_uint32_t)tentry; /* entry point */ 40 | *(--stk) = (rt_uint32_t)texit; /* lr */ 41 | *(--stk) = 0; /* r12 */ 42 | *(--stk) = 0; /* r11 */ 43 | *(--stk) = 0; /* r10 */ 44 | *(--stk) = 0; /* r9 */ 45 | *(--stk) = 0; /* r8 */ 46 | *(--stk) = 0; /* r7 */ 47 | *(--stk) = 0; /* r6 */ 48 | *(--stk) = 0; /* r5 */ 49 | *(--stk) = 0; /* r4 */ 50 | *(--stk) = 0; /* r3 */ 51 | *(--stk) = 0; /* r2 */ 52 | *(--stk) = 0; /* r1 */ 53 | *(--stk) = (rt_uint32_t)parameter; /* r0 : argument */ 54 | 55 | /* cpsr */ 56 | if ((rt_uint32_t)tentry & 0x01) 57 | *(--stk) = SVCMODE | 0x20; /* thumb mode */ 58 | else 59 | *(--stk) = SVCMODE; /* arm mode */ 60 | 61 | /* return task's current stack address */ 62 | return (rt_uint8_t *)stk; 63 | } 64 | 65 | /*@}*/ 66 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/am335x/vector_gcc.S: -------------------------------------------------------------------------------- 1 | /* 2 | * File : vector_gcc.S 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2013, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | * 2013-07-05 Bernard the first version 23 | */ 24 | 25 | .section .vectors, "ax" 26 | .code 32 27 | 28 | .globl system_vectors 29 | system_vectors: 30 | ldr pc, _vector_reset 31 | ldr pc, _vector_undef 32 | ldr pc, _vector_swi 33 | ldr pc, _vector_pabt 34 | ldr pc, _vector_dabt 35 | ldr pc, _vector_resv 36 | ldr pc, _vector_irq 37 | ldr pc, _vector_fiq 38 | 39 | .globl _reset 40 | .globl vector_undef 41 | .globl vector_swi 42 | .globl vector_pabt 43 | .globl vector_dabt 44 | .globl vector_resv 45 | .globl vector_irq 46 | .globl vector_fiq 47 | 48 | _vector_reset: 49 | .word _reset 50 | _vector_undef: 51 | .word vector_undef 52 | _vector_swi: 53 | .word vector_swi 54 | _vector_pabt: 55 | .word vector_pabt 56 | _vector_dabt: 57 | .word vector_dabt 58 | _vector_resv: 59 | .word vector_resv 60 | _vector_irq: 61 | .word vector_irq 62 | _vector_fiq: 63 | .word vector_fiq 64 | 65 | .balignl 16,0xdeadbeef 66 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/common/backtrace.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : backtrace.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, 2008 RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://openlab.rt-thread.com/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2008-07-29 Bernard first version from QiuYi implementation 13 | */ 14 | 15 | #include 16 | 17 | #ifdef __GNUC__ 18 | /* 19 | -->High Address,Stack Top 20 | PC<-----| 21 | LR | 22 | IP | 23 | FP | 24 | ...... | 25 | PC<-| | 26 | LR | | 27 | IP | | 28 | FP---|-- | 29 | ...... | 30 | PC | 31 | LR | 32 | IP | 33 | FP--- 34 | -->Low Address,Stack Bottom 35 | */ 36 | void rt_hw_backtrace(rt_uint32_t *fp, rt_uint32_t thread_entry) 37 | { 38 | rt_uint32_t i, pc, func_entry; 39 | 40 | pc = *fp; 41 | rt_kprintf("[0x%x]\n", pc-0xC); 42 | 43 | for(i=0; i<10; i++) 44 | { 45 | fp = (rt_uint32_t *)*(fp - 3); 46 | pc = *fp ; 47 | 48 | func_entry = pc - 0xC; 49 | 50 | if(func_entry <= 0x30000000) break; 51 | 52 | if((func_entry == thread_entry)) 53 | { 54 | rt_kprintf("EntryPoint:0x%x\n", func_entry); 55 | 56 | break; 57 | } 58 | 59 | rt_kprintf("[0x%x]\n", func_entry); 60 | } 61 | } 62 | #else 63 | void rt_hw_backtrace(rt_uint32_t *fp, rt_uint32_t thread_entry) 64 | { 65 | /* old compiler implementation */ 66 | } 67 | #endif 68 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/common/div0.c: -------------------------------------------------------------------------------- 1 | void __div0 (void) 2 | { 3 | while (1) ; 4 | } 5 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/common/showmem.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : showmem.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, 2008 RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://openlab.rt-thread.com/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2008-07-29 Bernard first version from QiuYi implementation 13 | */ 14 | 15 | #include 16 | 17 | void rt_hw_show_memory(rt_uint32_t addr, rt_uint32_t size) 18 | { 19 | int i = 0, j =0; 20 | 21 | RT_ASSERT(addr); 22 | 23 | addr = addr & ~0xF; 24 | size = 4*((size + 3)/4); 25 | 26 | while(i < size) 27 | { 28 | rt_kprintf("0x%08x: ", addr ); 29 | 30 | for(j=0; j<4; j++) 31 | { 32 | rt_kprintf("0x%08x ", *(rt_uint32_t *)addr); 33 | 34 | addr += 4; 35 | i++; 36 | } 37 | 38 | rt_kprintf("\n"); 39 | } 40 | 41 | return; 42 | } 43 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/cortex-r4/armv7.h: -------------------------------------------------------------------------------- 1 | #ifndef __ARMV7_H__ 2 | #define __ARMV7_H__ 3 | 4 | #ifndef VFP_DATA_NR 5 | #define VFP_DATA_NR 32 6 | #endif 7 | 8 | /* the exception stack without VFP registers */ 9 | struct rt_hw_exp_stack 10 | { 11 | unsigned long r0; 12 | unsigned long r1; 13 | unsigned long r2; 14 | unsigned long r3; 15 | unsigned long r4; 16 | unsigned long r5; 17 | unsigned long r6; 18 | unsigned long r7; 19 | unsigned long r8; 20 | unsigned long r9; 21 | unsigned long r10; 22 | unsigned long fp; 23 | unsigned long ip; 24 | unsigned long sp; 25 | unsigned long lr; 26 | unsigned long pc; 27 | unsigned long cpsr; 28 | }; 29 | 30 | #define USERMODE 0x10 31 | #define FIQMODE 0x11 32 | #define IRQMODE 0x12 33 | #define SVCMODE 0x13 34 | #define MONITORMODE 0x16 35 | #define ABORTMODE 0x17 36 | #define HYPMODE 0x1b 37 | #define UNDEFMODE 0x1b 38 | #define MODEMASK 0x1f 39 | #define NOINT 0xc0 40 | 41 | #define T_Bit (1<<5) 42 | #define F_Bit (1<<6) 43 | #define I_Bit (1<<7) 44 | #define A_Bit (1<<8) 45 | #define E_Bit (1<<9) 46 | #define J_Bit (1<<24) 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/cortex-r4/vector_ccs.asm: -------------------------------------------------------------------------------- 1 | ;------------------------------------------------------------------------------- 2 | ; sys_intvecs.asm 3 | ; 4 | ; (c) Texas Instruments 2009-2013, All rights reserved. 5 | ; 6 | 7 | .sect ".intvecs" 8 | .arm 9 | 10 | ;------------------------------------------------------------------------------- 11 | ; import reference for interrupt routines 12 | 13 | .ref _reset 14 | .ref turnon_VFP 15 | .ref vector_svc 16 | .ref vector_pabort 17 | .ref vector_dabort 18 | .ref vector_resv 19 | .ref IRQ_Handler 20 | 21 | ;------------------------------------------------------------------------------- 22 | ; interrupt vectors 23 | .def resetEntry 24 | resetEntry 25 | b _reset 26 | b turnon_VFP 27 | b vector_svc 28 | b vector_pabort 29 | b vector_dabort 30 | b vector_resv 31 | b IRQ_Handler 32 | ldr pc,[pc,#-0x1b0] 33 | 34 | ;------------------------------------------------------------------------------- 35 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/cortex-r4/vector_gcc.S: -------------------------------------------------------------------------------- 1 | @------------------------------------------------------------------------------- 2 | @ sys_intvecs.asm 3 | @ 4 | @ (c) Texas Instruments 2009-2013, All rights reserved. 5 | @ 6 | 7 | .section .vectors, "ax" 8 | .code 32 9 | 10 | @------------------------------------------------------------------------------- 11 | @ import reference for interrupt routines 12 | 13 | .globl _reset 14 | .globl turnon_VFP 15 | .globl vector_svc 16 | .globl vector_pabort 17 | .globl vector_dabort 18 | .globl vector_resv 19 | .globl IRQ_Handler 20 | 21 | 22 | .globl system_vectors 23 | system_vectors: 24 | b _reset 25 | b turnon_VFP 26 | b vector_svc 27 | b vector_pabort 28 | b vector_dabort 29 | b vector_resv 30 | b IRQ_Handler 31 | ldr pc,[pc,#-0x1b0] 32 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/lpc214x/context_gcc.S: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/RT-Thread-1.2.2/libcpu/arm/lpc214x/context_gcc.S -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/lpc214x/startup_gcc.S: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/RT-Thread-1.2.2/libcpu/arm/lpc214x/startup_gcc.S -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/lpc24xx/cpu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : cpu.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Develop Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://openlab.rt-thread.com/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2008-12-11 XuXinming first version 13 | */ 14 | 15 | #include 16 | #include "LPC24xx.h" 17 | 18 | /** 19 | * @addtogroup LPC2478 20 | */ 21 | /*@{*/ 22 | 23 | /** 24 | * this function will reset CPU 25 | * 26 | */ 27 | void rt_hw_cpu_reset() 28 | { 29 | } 30 | 31 | /** 32 | * this function will shutdown CPU 33 | * 34 | */ 35 | void rt_hw_cpu_shutdown() 36 | { 37 | rt_kprintf("shutdown...\n"); 38 | 39 | while (1); 40 | } 41 | 42 | /*@}*/ 43 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/lpc24xx/stack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : stack.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://openlab.rt-thread.com/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2008-12-11 XuXinming first version 13 | */ 14 | #include 15 | #include "LPC24xx.h" 16 | 17 | /** 18 | * @addtogroup LPC2478 19 | */ 20 | /*@{*/ 21 | 22 | /** 23 | * This function will initialize thread stack 24 | * 25 | * @param tentry the entry of thread 26 | * @param parameter the parameter of entry 27 | * @param stack_addr the beginning stack address 28 | * @param texit the function will be called when thread exit 29 | * 30 | * @return stack address 31 | */ 32 | rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, 33 | rt_uint8_t *stack_addr, void *texit) 34 | { 35 | unsigned long *stk; 36 | 37 | stk = (unsigned long *)stack_addr; 38 | *(stk) = (unsigned long)tentry; /* entry point */ 39 | *(--stk) = (unsigned long)texit; /* lr */ 40 | *(--stk) = 0; /* r12 */ 41 | *(--stk) = 0; /* r11 */ 42 | *(--stk) = 0; /* r10 */ 43 | *(--stk) = 0; /* r9 */ 44 | *(--stk) = 0; /* r8 */ 45 | *(--stk) = 0; /* r7 */ 46 | *(--stk) = 0; /* r6 */ 47 | *(--stk) = 0; /* r5 */ 48 | *(--stk) = 0; /* r4 */ 49 | *(--stk) = 0; /* r3 */ 50 | *(--stk) = 0; /* r2 */ 51 | *(--stk) = 0; /* r1 */ 52 | *(--stk) = (unsigned long)parameter; /* r0 : argument */ 53 | 54 | /* cpsr */ 55 | if ((rt_uint32_t)tentry & 0x01) 56 | *(--stk) = SVCMODE | 0x20; /* thumb mode */ 57 | else 58 | *(--stk) = SVCMODE; /* arm mode */ 59 | 60 | /* return task's current stack address */ 61 | return (rt_uint8_t *)stk; 62 | } 63 | 64 | /*@}*/ 65 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/s3c24x0/rtc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : rtc.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2009, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-03-20 yi.qiu the first version 13 | */ 14 | 15 | #ifndef __RTC_H__ 16 | #define __RTC_H__ 17 | 18 | void rt_hw_rtc_init(void); 19 | 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/s3c24x0/serial.h: -------------------------------------------------------------------------------- 1 | #ifndef __RT_HW_SERIAL_H__ 2 | #define __RT_HW_SERIAL_H__ 3 | 4 | #include 5 | #include 6 | 7 | #include "s3c24x0.h" 8 | 9 | #define USTAT_RCV_READY 0x01 /* receive data ready */ 10 | #define USTAT_TXB_EMPTY 0x02 /* tx buffer empty */ 11 | #define BPS 115200 /* serial baudrate */ 12 | 13 | #define UART_RX_BUFFER_SIZE 64 14 | #define UART_TX_BUFFER_SIZE 64 15 | 16 | struct serial_int_rx 17 | { 18 | rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE]; 19 | rt_uint32_t read_index, save_index; 20 | }; 21 | 22 | struct serial_int_tx 23 | { 24 | rt_uint8_t tx_buffer[UART_TX_BUFFER_SIZE]; 25 | rt_uint32_t write_index, save_index; 26 | }; 27 | 28 | typedef struct uartport 29 | { 30 | volatile rt_uint32_t ulcon; 31 | volatile rt_uint32_t ucon; 32 | volatile rt_uint32_t ufcon; 33 | volatile rt_uint32_t umcon; 34 | volatile rt_uint32_t ustat; 35 | volatile rt_uint32_t urxb; 36 | volatile rt_uint32_t ufstat; 37 | volatile rt_uint32_t umstat; 38 | volatile rt_uint32_t utxh; 39 | volatile rt_uint32_t urxh; 40 | volatile rt_uint32_t ubrd; 41 | }uartport; 42 | 43 | struct serial_device 44 | { 45 | uartport* uart_device; 46 | 47 | /* rx structure */ 48 | struct serial_int_rx* int_rx; 49 | 50 | /* tx structure */ 51 | struct serial_int_tx* int_tx; 52 | }; 53 | 54 | rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct serial_device *serial); 55 | 56 | void rt_hw_serial_isr(rt_device_t device); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/s3c24x0/stack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : stack.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://openlab.rt-thread.com/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2006-03-13 Bernard the first version 13 | */ 14 | #include 15 | #include "s3c24x0.h" 16 | 17 | /** 18 | * @addtogroup S3C24X0 19 | */ 20 | /*@{*/ 21 | 22 | /** 23 | * This function will initialize thread stack 24 | * 25 | * @param tentry the entry of thread 26 | * @param parameter the parameter of entry 27 | * @param stack_addr the beginning stack address 28 | * @param texit the function will be called when thread exit 29 | * 30 | * @return stack address 31 | */ 32 | rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, 33 | rt_uint8_t *stack_addr, void *texit) 34 | { 35 | rt_uint32_t *stk; 36 | 37 | stk = (rt_uint32_t*)stack_addr; 38 | *(stk) = (rt_uint32_t)tentry; /* entry point */ 39 | *(--stk) = (rt_uint32_t)texit; /* lr */ 40 | *(--stk) = 0; /* r12 */ 41 | *(--stk) = 0; /* r11 */ 42 | *(--stk) = 0; /* r10 */ 43 | *(--stk) = 0; /* r9 */ 44 | *(--stk) = 0; /* r8 */ 45 | *(--stk) = 0; /* r7 */ 46 | *(--stk) = 0; /* r6 */ 47 | *(--stk) = 0; /* r5 */ 48 | *(--stk) = 0; /* r4 */ 49 | *(--stk) = 0; /* r3 */ 50 | *(--stk) = 0; /* r2 */ 51 | *(--stk) = 0; /* r1 */ 52 | *(--stk) = (rt_uint32_t)parameter; /* r0 : argument */ 53 | *(--stk) = SVCMODE; /* cpsr */ 54 | *(--stk) = SVCMODE; /* spsr */ 55 | 56 | /* return task's current stack address */ 57 | return (rt_uint8_t *)stk; 58 | } 59 | 60 | /*@}*/ 61 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/s3c44b0/stack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : stack.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://openlab.rt-thread.com/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2006-09-06 XuXinming first version 13 | */ 14 | #include 15 | #include "s3c44b0.h" 16 | 17 | /** 18 | * @addtogroup S3C44B0 19 | */ 20 | /*@{*/ 21 | 22 | /** 23 | * This function will initialize thread stack 24 | * 25 | * @param tentry the entry of thread 26 | * @param parameter the parameter of entry 27 | * @param stack_addr the beginning stack address 28 | * @param texit the function will be called when thread exit 29 | * 30 | * @return stack address 31 | */ 32 | rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, 33 | rt_uint8_t *stack_addr, void *texit) 34 | { 35 | unsigned long *stk; 36 | 37 | stk = (unsigned long *)stack_addr; 38 | *(stk) = (unsigned long)tentry; /* entry point */ 39 | *(--stk) = (unsigned long)texit; /* lr */ 40 | *(--stk) = 0; /* r12 */ 41 | *(--stk) = 0; /* r11 */ 42 | *(--stk) = 0; /* r10 */ 43 | *(--stk) = 0; /* r9 */ 44 | *(--stk) = 0; /* r8 */ 45 | *(--stk) = 0; /* r7 */ 46 | *(--stk) = 0; /* r6 */ 47 | *(--stk) = 0; /* r5 */ 48 | *(--stk) = 0; /* r4 */ 49 | *(--stk) = 0; /* r3 */ 50 | *(--stk) = 0; /* r2 */ 51 | *(--stk) = 0; /* r1 */ 52 | *(--stk) = (unsigned long)parameter; /* r0 : argument */ 53 | *(--stk) = SVCMODE; /* cpsr */ 54 | *(--stk) = SVCMODE; /* spsr */ 55 | 56 | /* return task's current stack address */ 57 | return (rt_uint8_t *)stk; 58 | } 59 | 60 | /*@}*/ 61 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/sep4020/sep4020.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/RT-Thread-1.2.2/libcpu/arm/sep4020/sep4020.h -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/sep4020/stack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : stack.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://openlab.rt-thread.com/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2006-03-13 Bernard the first version 13 | */ 14 | #include 15 | #include 16 | /** 17 | * @addtogroup S3C24X0 18 | */ 19 | /*@{*/ 20 | 21 | /** 22 | * This function will initialize thread stack 23 | * 24 | * @param tentry the entry of thread 25 | * @param parameter the parameter of entry 26 | * @param stack_addr the beginning stack address 27 | * @param texit the function will be called when thread exit 28 | * 29 | * @return stack address 30 | */ 31 | rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, 32 | rt_uint8_t *stack_addr, void *texit) 33 | { 34 | rt_uint32_t *stk; 35 | 36 | stk = (rt_uint32_t*)stack_addr; 37 | *(stk) = (rt_uint32_t)tentry; /* entry point */ 38 | *(--stk) = (rt_uint32_t)texit; /* lr */ 39 | *(--stk) = 0; /* r12 */ 40 | *(--stk) = 0; /* r11 */ 41 | *(--stk) = 0; /* r10 */ 42 | *(--stk) = 0; /* r9 */ 43 | *(--stk) = 0; /* r8 */ 44 | *(--stk) = 0; /* r7 */ 45 | *(--stk) = 0; /* r6 */ 46 | *(--stk) = 0; /* r5 */ 47 | *(--stk) = 0; /* r4 */ 48 | *(--stk) = 0; /* r3 */ 49 | *(--stk) = 0; /* r2 */ 50 | *(--stk) = 0; /* r1 */ 51 | *(--stk) = (rt_uint32_t)parameter; /* r0 : argument */ 52 | *(--stk) = Mode_SVC; /* cpsr */ 53 | *(--stk) = Mode_SVC; /* spsr */ 54 | 55 | /* return task's current stack address */ 56 | return (rt_uint8_t *)stk; 57 | } 58 | 59 | /*@}*/ 60 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/arm/sep4020/start_rvds.S: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/RT-Thread-1.2.2/libcpu/arm/sep4020/start_rvds.S -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/avr32/uc3/cpu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : cpu.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2010, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-03-30 Kyle First version 13 | */ 14 | 15 | #include 16 | 17 | /** 18 | * @addtogroup AVR32UC3 19 | */ 20 | /*@{*/ 21 | 22 | /** 23 | * reset cpu by dog's time-out 24 | * 25 | */ 26 | void rt_hw_cpu_reset() 27 | { 28 | /*NOTREACHED*/ 29 | } 30 | 31 | /** 32 | * shutdown CPU 33 | * 34 | */ 35 | void rt_hw_cpu_shutdown() 36 | { 37 | rt_kprintf("shutdown...\n"); 38 | 39 | RT_ASSERT(0); 40 | } 41 | 42 | /*@}*/ 43 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/avr32/uc3/interrupt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : interrupt.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2010, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-03-30 Kyle Ported from STM32 to AVR32. 13 | */ 14 | 15 | #include 16 | #include "compiler.h" 17 | 18 | rt_uint32_t rt_interrupt_from_thread, rt_interrupt_to_thread; 19 | rt_uint32_t rt_thread_switch_interrupt_flag; 20 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/avr32/uc3/serial.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : serial.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2009 - 2010, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2009-01-05 Bernard first version 13 | * 2010-03-29 Bernard remove interrupt tx and DMA rx mode. 14 | * 2010-03-30 Kyle Ported from STM32 to AVR32. 15 | */ 16 | #ifndef __RT_HW_SERIAL_H__ 17 | #define __RT_HW_SERIAL_H__ 18 | 19 | #include 20 | #include 21 | #include "compiler.h" 22 | #include "usart.h" 23 | 24 | #define UART_RX_BUFFER_SIZE 64 25 | #define UART_TX_DMA_NODE_SIZE 4 26 | 27 | /* data node for Tx Mode */ 28 | struct avr32_serial_data_node 29 | { 30 | rt_uint8_t *data_ptr; 31 | rt_size_t data_size; 32 | struct avr32_serial_data_node *next, *prev; 33 | }; 34 | 35 | struct avr32_serial_int_rx 36 | { 37 | rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE]; 38 | rt_uint32_t read_index, save_index; 39 | }; 40 | 41 | struct avr32_serial_device 42 | { 43 | avr32_usart_t *uart_device; 44 | 45 | /* rx structure */ 46 | struct avr32_serial_int_rx* int_rx; 47 | }; 48 | 49 | rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct avr32_serial_device *serial); 50 | 51 | void rt_hw_serial_isr(); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/avr32/uc3/stack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : stack.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2010, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-03-30 Kyle First version 13 | */ 14 | #include 15 | 16 | /** 17 | * @addtogroup AVR32UC3 18 | */ 19 | /*@{*/ 20 | 21 | /** 22 | * This function will initialize thread stack 23 | * 24 | * @param tentry the entry of thread 25 | * @param parameter the parameter of entry 26 | * @param stack_addr the beginning stack address 27 | * @param texit the function will be called when thread exit 28 | * 29 | * @return stack address 30 | */ 31 | rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_addr, void *texit) 32 | { 33 | unsigned long *stk; 34 | 35 | stk = (unsigned long *)stack_addr; 36 | *(stk) = 0; /* r8 */ 37 | *(--stk) = 0; /* r9 */ 38 | *(--stk) = 0; /* r10 */ 39 | *(--stk) = 0; /* r11 */ 40 | *(--stk) = 0; /* r12 */ 41 | *(--stk) = (unsigned long)texit; /* lr */ 42 | *(--stk) = (unsigned long)tentry; /* entry point, pc */ 43 | *(--stk) = 0x00600000; /* sr */ 44 | *(--stk) = 0; /* r0 */ 45 | *(--stk) = 0; /* r1 */ 46 | *(--stk) = 0; /* r2 */ 47 | *(--stk) = 0; /* r3 */ 48 | *(--stk) = 0; /* r4 */ 49 | *(--stk) = 0; /* r5 */ 50 | *(--stk) = 0; /* r6 */ 51 | *(--stk) = 0; /* r7 */ 52 | 53 | /* return task's current stack address */ 54 | return (rt_uint8_t *)stk; 55 | } 56 | 57 | /*@}*/ 58 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/blackfin/bf53x/serial.h: -------------------------------------------------------------------------------- 1 | #ifndef __RT_HW_SERIAL_H__ 2 | #define __RT_HW_SERIAL_H__ 3 | 4 | #include 5 | #include 6 | 7 | #define USTAT_RCV_READY 0x01 /* receive data ready */ 8 | #define USTAT_TXB_EMPTY 0x02 /* tx buffer empty */ 9 | #define BPS 115200 /* serial baudrate */ 10 | 11 | #define UART_RX_BUFFER_SIZE 64 12 | #define UART_TX_BUFFER_SIZE 64 13 | 14 | struct serial_int_rx 15 | { 16 | rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE]; 17 | rt_uint32_t read_index, save_index; 18 | }; 19 | 20 | struct serial_int_tx 21 | { 22 | rt_uint8_t tx_buffer[UART_TX_BUFFER_SIZE]; 23 | rt_uint32_t write_index, save_index; 24 | }; 25 | 26 | typedef struct uartport 27 | { 28 | volatile rt_uint16_t rbr_thr; //receive buffer register and transmit hold register 29 | volatile rt_uint16_t reserved0; 30 | volatile rt_uint16_t reserved1; 31 | volatile rt_uint16_t reserved2; 32 | volatile rt_uint16_t reserved3; 33 | volatile rt_uint16_t reserved4; 34 | volatile rt_uint16_t reserved5; 35 | volatile rt_uint16_t reserved6; 36 | volatile rt_uint16_t reserved7; 37 | volatile rt_uint16_t reserved8; 38 | volatile rt_uint16_t lsr; //line status register 39 | }uartport; 40 | 41 | struct serial_device 42 | { 43 | uartport* uart_device; 44 | 45 | /* rx structure */ 46 | struct serial_int_rx* int_rx; 47 | 48 | /* tx structure */ 49 | struct serial_int_tx* int_tx; 50 | }; 51 | 52 | rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct serial_device *serial); 53 | 54 | void rt_hw_serial_isr(rt_device_t device); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/ia32/__udivsi3.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : __udivsi3.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Develop Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://openlab.rt-thread.com/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2006-10-09 Bernard the first version for i386 13 | */ 14 | 15 | #include 16 | 17 | typedef rt_uint32_t uint32_t; 18 | typedef rt_int32_t int32_t; 19 | 20 | uint32_t __udivsi3(uint32_t num, uint32_t den) 21 | { 22 | uint32_t quot = 0, qbit = 1; 23 | 24 | if (den == 0) 25 | { 26 | asm volatile ("int $0"); 27 | return 0; /* If trap returns... */ 28 | } 29 | 30 | /* Left-justify denominator and count shift */ 31 | while ((int32_t) den >= 0) 32 | { 33 | den <<= 1; 34 | qbit <<= 1; 35 | } 36 | 37 | while (qbit) 38 | { 39 | if (den <= num) 40 | { 41 | num -= den; 42 | quot += qbit; 43 | } 44 | den >>= 1; 45 | qbit >>= 1; 46 | } 47 | 48 | return quot; 49 | } 50 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/ia32/__umodsi3.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : __umodsi3.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Develop Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://openlab.rt-thread.com/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2006-10-09 Bernard the first version for i386 13 | */ 14 | 15 | #include 16 | 17 | typedef rt_uint32_t uint32_t; 18 | typedef rt_int32_t int32_t; 19 | 20 | uint32_t __umodsi3(uint32_t num, uint32_t den) 21 | { 22 | register uint32_t quot = 0, qbit = 1; 23 | 24 | if (den == 0) 25 | { 26 | asm volatile ("int $0"); 27 | return 0; /* if trap returns... */ 28 | } 29 | 30 | /* left-justify denominator and count shift */ 31 | while ((int32_t) den >= 0) 32 | { 33 | den <<= 1; 34 | qbit <<= 1; 35 | } 36 | 37 | while (qbit) 38 | { 39 | if (den <= num) 40 | { 41 | num -= den; 42 | quot += qbit; 43 | } 44 | den >>= 1; 45 | qbit >>= 1; 46 | } 47 | 48 | return num; 49 | } 50 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/ia32/backtrace.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : backtrace.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, 2008 RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://openlab.rt-thread.com/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2008-07-29 Bernard first version 13 | */ 14 | 15 | #include 16 | 17 | void rt_hw_backtrace(rt_uint32_t *fp, rt_uint32_t thread_entry) 18 | { 19 | /* no implementation */ 20 | } 21 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/ia32/showmem.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : showmem.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, 2008 RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://openlab.rt-thread.com/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2008-07-29 Bernard first version from QiuYi implementation 13 | */ 14 | 15 | #include 16 | 17 | void rt_hw_show_memory(rt_uint32_t addr, rt_uint32_t size) 18 | { 19 | int i = 0, j =0; 20 | 21 | RT_ASSERT(addr); 22 | 23 | addr = addr & ~0xF; 24 | size = 4*((size + 3)/4); 25 | 26 | while(i < size) 27 | { 28 | rt_kprintf("0x%08x: ", addr ); 29 | 30 | for(j=0; j<4; j++) 31 | { 32 | rt_kprintf("0x%08x ", *(rt_uint32_t *)addr); 33 | 34 | addr += 4; 35 | i++; 36 | } 37 | 38 | rt_kprintf("\n"); 39 | } 40 | 41 | return; 42 | } 43 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/ia32/stack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : stack.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://openlab.rt-thread.com/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | */ 13 | 14 | #include 15 | 16 | #include 17 | 18 | /** 19 | * @addtogroup I386 20 | */ 21 | /*@{*/ 22 | 23 | /** 24 | * This function will initialize thread stack 25 | * 26 | * @param tentry the entry of thread 27 | * @param parameter the parameter of entry 28 | * @param stack_addr the beginning stack address 29 | * @param texit the function will be called when thread exit 30 | * 31 | * @return stack address 32 | */ 33 | rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, 34 | rt_uint8_t *stack_addr, void *texit) 35 | { 36 | unsigned long *stk; 37 | 38 | stk = (unsigned long *)stack_addr; 39 | *(--stk) = (unsigned long)parameter; 40 | *(--stk) = (unsigned long)texit; 41 | *(--stk) = 0x200; /*flags*/ 42 | *(--stk) = 0x08; /*cs*/ 43 | *(--stk) = (unsigned long)tentry; /*eip*/ 44 | *(--stk) = 0; /*irqno*/ 45 | *(--stk) = 0x10; /*ds*/ 46 | *(--stk) = 0x10; /*es*/ 47 | *(--stk) = 0; /*eax*/ 48 | *(--stk) = 0; /*ecx*/ 49 | *(--stk) = 0; /*edx*/ 50 | *(--stk) = 0; /*ebx*/ 51 | *(--stk) = 0; /*esp*/ 52 | *(--stk) = 0; /*ebp*/ 53 | *(--stk) = 0; /*esi*/ 54 | *(--stk) = 0; /*edi*/ 55 | 56 | /* return task's current stack address */ 57 | return (rt_uint8_t *)stk; 58 | } 59 | /*@}*/ 60 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/ia32/start_gcc.S: -------------------------------------------------------------------------------- 1 | /* 2 | * File : start.S 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2006-09-15 QiuYi The first version. 13 | * 2012-02-15 aozima update. 14 | */ 15 | 16 | /* the magic number for the multiboot header. */ 17 | #define MULTIBOOT_HEADER_MAGIC 0x1BADB002 18 | 19 | /* the flags for the multiboot header. */ 20 | #define MULTIBOOT_HEADER_FLAGS 0x00000003 21 | 22 | #define CONFIG_STACKSIZE 8192 23 | 24 | /** 25 | * @addtogroup I386 26 | */ 27 | /*@{*/ 28 | 29 | .section .init, "ax" 30 | 31 | /* the system entry */ 32 | .globl _start 33 | _start: 34 | jmp multiboot_entry 35 | 36 | /* Align 32 bits boundary. */ 37 | .align 4 38 | 39 | /* multiboot header. */ 40 | multiboot_header: 41 | /* magic */ 42 | .long MULTIBOOT_HEADER_MAGIC 43 | /* flags */ 44 | .long MULTIBOOT_HEADER_FLAGS 45 | /* checksum */ 46 | .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) 47 | 48 | multiboot_entry: 49 | movl $(_end + 0x1000),%esp 50 | 51 | /* reset eflags. */ 52 | pushl $0 53 | popf 54 | 55 | /*rebuild globe describe table*/ 56 | lgdt mygdtdesc 57 | 58 | movl $0x10,%eax 59 | movw %ax,%ds 60 | movw %ax,%es 61 | movw %ax,%ss 62 | ljmp $0x08, $relocated 63 | 64 | relocated: 65 | /* push the pointer to the multiboot information structure. */ 66 | pushl %ebx 67 | 68 | /* push the magic value. */ 69 | pushl %eax 70 | 71 | call rtthread_startup 72 | 73 | /* never get here */ 74 | spin: 75 | hlt 76 | jmp spin 77 | 78 | .data 79 | .p2align 2 80 | mygdt: 81 | .word 0,0,0,0 82 | 83 | .word 0x07FF /* 8Mb - limit=2047 */ 84 | .word 0x0000 85 | .word 0x9A00 /* code read/exec */ 86 | .word 0x00C0 87 | 88 | .word 0x07FF /* 8Mb - limit=2047 */ 89 | .word 0x0000 90 | .word 0x9200 /* data read/write */ 91 | .word 0x00C0 92 | 93 | mygdtdesc: 94 | .word 0x17 95 | .long mygdt 96 | 97 | /*@}*/ 98 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/m16c/m16c62p/context_gcc.S: -------------------------------------------------------------------------------- 1 | /* 2 | * File : context.asm 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2009, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-04-09 fify the first version 13 | * 2010-04-19 fify rewrite rt_hw_interrupt_disable/enable fuction 14 | * 2010-04-20 fify move peripheral ISR to bsp/interrupts.s34 15 | */ 16 | 17 | .section .text 18 | 19 | .globl _rt_interrupt_from_thread 20 | .globl _rt_interrupt_to_thread 21 | .global _os_context_switch 22 | .type _os_context_switch, @function 23 | _os_context_switch: 24 | PUSHM R0,R1,R2,R3,A0,A1,SB,FB 25 | 26 | MOV.W _rt_interrupt_from_thread, A0 27 | STC ISP, [A0] 28 | MOV.W _rt_interrupt_to_thread, A0 29 | LDC [A0], ISP 30 | 31 | POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore registers from the new task's stack 32 | REIT ; Return from interrup 33 | 34 | /* 35 | * void rt_hw_context_switch_to(rt_uint32 to); 36 | * this fucntion is used to perform the first thread switch 37 | */ 38 | .global _rt_hw_context_switch_to 39 | .type _rt_hw_context_switch_to, @function 40 | _rt_hw_context_switch_to: 41 | ENTER #0x0 42 | MOV.W 0x5[FB], A0 43 | LDC [A0], ISP 44 | POPM R0,R1,R2,R3,A0,A1,SB,FB 45 | REIT 46 | 47 | .end 48 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/m16c/m16c62p/context_iar.S: -------------------------------------------------------------------------------- 1 | /* 2 | * File : context.asm 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2009, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-04-09 fify the first version 13 | * 2010-04-19 fify rewrite rt_hw_interrupt_disable/enable fuction 14 | * 2010-04-20 fify move peripheral ISR to bsp/interrupts.s34 15 | * 16 | * For : Renesas M16C 17 | * Toolchain : IAR's EW for M16C v3.401 18 | */ 19 | 20 | RSEG CSTACK 21 | 22 | RSEG ISTACK 23 | 24 | RSEG CODE(1) 25 | 26 | EXTERN rt_interrupt_from_thread 27 | EXTERN rt_interrupt_to_thread 28 | 29 | PUBLIC rt_hw_interrupt_disable 30 | PUBLIC rt_hw_interrupt_enable 31 | PUBLIC rt_hw_context_switch_to 32 | PUBLIC os_context_switch 33 | 34 | rt_hw_interrupt_disable: 35 | STC FLG, R0 ;fify 20100419 36 | FCLR I 37 | RTS 38 | 39 | rt_hw_interrupt_enable: 40 | LDC R0, FLG ;fify 20100419 41 | RTS 42 | 43 | .EVEN 44 | os_context_switch: 45 | PUSHM R0,R1,R2,R3,A0,A1,SB,FB 46 | 47 | MOV.W rt_interrupt_from_thread, A0 48 | STC ISP, [A0] 49 | MOV.W rt_interrupt_to_thread, A0 50 | LDC [A0], ISP 51 | 52 | POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore registers from the new task's stack 53 | REIT ; Return from interrup 54 | 55 | /* 56 | * void rt_hw_context_switch_to(rt_uint32 to); 57 | * r0 --> to 58 | * this fucntion is used to perform the first thread switch 59 | */ 60 | rt_hw_context_switch_to: 61 | MOV.W R0, A0 62 | LDC [A0], ISP 63 | POPM R0,R1,R2,R3,A0,A1,SB,FB 64 | REIT 65 | 66 | END 67 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/m16c/m16c62p/context_iar.asm: -------------------------------------------------------------------------------- 1 | /* 2 | * File : context.asm 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2009, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-04-09 fify the first version 13 | * 2010-04-19 fify rewrite rt_hw_interrupt_disable/enable fuction 14 | * 2010-04-20 fify move peripheral ISR to bsp/interrupts.s34 15 | * 16 | * For : Renesas M16C 17 | * Toolchain : IAR's EW for M16C v3.401 18 | */ 19 | 20 | RSEG CSTACK 21 | 22 | RSEG ISTACK 23 | 24 | RSEG CODE(1) 25 | 26 | EXTERN rt_interrupt_from_thread 27 | EXTERN rt_interrupt_to_thread 28 | 29 | PUBLIC rt_hw_interrupt_disable 30 | PUBLIC rt_hw_interrupt_enable 31 | PUBLIC rt_hw_context_switch_to 32 | PUBLIC os_context_switch 33 | 34 | rt_hw_interrupt_disable: 35 | STC FLG, R0 ;fify 20100419 36 | FCLR I 37 | RTS 38 | 39 | rt_hw_interrupt_enable: 40 | LDC R0, FLG ;fify 20100419 41 | RTS 42 | 43 | .EVEN 44 | os_context_switch: 45 | PUSHM R0,R1,R2,R3,A0,A1,SB,FB 46 | 47 | MOV.W rt_interrupt_from_thread, A0 48 | STC ISP, [A0] 49 | MOV.W rt_interrupt_to_thread, A0 50 | LDC [A0], ISP 51 | 52 | POPM R0,R1,R2,R3,A0,A1,SB,FB ; Restore registers from the new task's stack 53 | REIT ; Return from interrup 54 | 55 | /* 56 | * void rt_hw_context_switch_to(rt_uint32 to); 57 | * r0 --> to 58 | * this fucntion is used to perform the first thread switch 59 | */ 60 | rt_hw_context_switch_to: 61 | MOV.W R0, A0 62 | LDC [A0], ISP 63 | POPM R0,R1,R2,R3,A0,A1,SB,FB 64 | REIT 65 | 66 | END 67 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/mips/common/mips.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * File : mips.inc 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2010, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-05-17 sangwei first version 13 | */ 14 | #ifndef __MIPS_INC__ 15 | #define __MIPS_INC__ 16 | 17 | #define zero $0 /* wired zero */ 18 | // #define at $1 19 | #define v0 $2 /* return value */ 20 | #define v1 $3 21 | #define a0 $4 /* argument registers */ 22 | #define a1 $5 23 | #define a2 $6 24 | #define a3 $7 25 | #define t0 $8 /* caller saved */ 26 | #define t1 $9 27 | #define t2 $10 28 | #define t3 $11 29 | #define t4 $12 30 | #define t5 $13 31 | #define t6 $14 32 | #define t7 $15 33 | #define s0 $16 /* callee saved */ 34 | #define s1 $17 35 | #define s2 $18 36 | #define s3 $19 37 | #define s4 $20 38 | #define s5 $21 39 | #define s6 $22 40 | #define s7 $23 41 | #define t8 $24 /* caller saved */ 42 | #define t9 $25 43 | #define jp $25 /* PIC jump register */ 44 | #define k0 $26 /* kernel scratch */ 45 | #define k1 $27 46 | #define gp $28 /* global pointer */ 47 | #define sp $29 /* stack pointer */ 48 | #define fp $30 /* frame pointer */ 49 | #define s8 $30 /* same like fp! */ 50 | #define ra $31 /* return address */ 51 | 52 | #endif /* end of __MIPS_INC__ */ 53 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/mips/common/mipscfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : mipscfg.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2010, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-05-27 swkyer first version 13 | */ 14 | #ifndef __MIPSCFG_H__ 15 | #define __MIPSCFG_H__ 16 | 17 | 18 | typedef struct mips32_core_cfg 19 | { 20 | rt_uint16_t icache_line_size; 21 | rt_uint16_t icache_lines_per_way; 22 | rt_uint16_t icache_ways; 23 | rt_uint16_t dcache_line_size; 24 | rt_uint16_t dcache_lines_per_way; 25 | rt_uint16_t dcache_ways; 26 | 27 | rt_uint16_t max_tlb_entries; /* number of tlb entry */ 28 | } mips32_core_cfg_t; 29 | 30 | extern mips32_core_cfg_t g_mips_core; 31 | 32 | #endif /* end of __MIPSCFG_H__ */ 33 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/mips/jz47xx/cache.h: -------------------------------------------------------------------------------- 1 | #ifndef __CACHE_H__ 2 | #define __CACHE_H__ 3 | 4 | /* 5 | * Cache Operations 6 | */ 7 | #define Index_Invalidate_I 0x00 8 | #define Index_Writeback_Inv_D 0x01 9 | #define Index_Invalidate_SI 0x02 10 | #define Index_Writeback_Inv_SD 0x03 11 | #define Index_Load_Tag_I 0x04 12 | #define Index_Load_Tag_D 0x05 13 | #define Index_Load_Tag_SI 0x06 14 | #define Index_Load_Tag_SD 0x07 15 | #define Index_Store_Tag_I 0x08 16 | #define Index_Store_Tag_D 0x09 17 | #define Index_Store_Tag_SI 0x0A 18 | #define Index_Store_Tag_SD 0x0B 19 | #define Create_Dirty_Excl_D 0x0d 20 | #define Create_Dirty_Excl_SD 0x0f 21 | #define Hit_Invalidate_I 0x10 22 | #define Hit_Invalidate_D 0x11 23 | #define Hit_Invalidate_SI 0x12 24 | #define Hit_Invalidate_SD 0x13 25 | #define Fill 0x14 26 | #define Hit_Writeback_Inv_D 0x15 27 | /* 0x16 is unused */ 28 | #define Hit_Writeback_Inv_SD 0x17 29 | #define Hit_Writeback_I 0x18 30 | #define Hit_Writeback_D 0x19 31 | /* 0x1a is unused */ 32 | #define Hit_Writeback_SD 0x1b 33 | /* 0x1c is unused */ 34 | /* 0x1e is unused */ 35 | #define Hit_Set_Virtual_SI 0x1e 36 | #define Hit_Set_Virtual_SD 0x1f 37 | 38 | void rt_hw_cache_init(void); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/mips/jz47xx/cache_gcc.S: -------------------------------------------------------------------------------- 1 | /* 2 | * File : cache_init.S 3 | * Change Logs: 4 | * Date Author Notes 5 | * 2010-05-17 swkyer first version 6 | */ 7 | #include "../common/mips.inc" 8 | #include "../common/mipsregs.h" 9 | #include "../common/stackframe.h" 10 | 11 | .text 12 | .set noreorder 13 | 14 | .globl cache_init 15 | .ent cache_init 16 | cache_init: 17 | .set noreorder 18 | mtc0 zero, CP0_TAGLO 19 | move t0, a0 // cache total size 20 | move t1, a1 // cache line size 21 | li t2, 0x80000000 22 | addu t3, t0, t2 23 | 24 | _cache_init_loop: 25 | cache 8, 0(t2) // icache_index_store_tag 26 | cache 9, 0(t2) // dcache_index_store_tag 27 | addu t2, t1 28 | bne t2, t3, _cache_init_loop 29 | nop 30 | 31 | mfc0 t0, CP0_CONFIG 32 | li t1, 0x7 33 | not t1 34 | and t0, t0, t1 35 | or t0, 0x3 // cacheable, noncoherent, write-back, write allocate 36 | mtc0 t0, CP0_CONFIG 37 | 38 | jr ra 39 | nop 40 | 41 | .set reorder 42 | .end cache_init 43 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/mips/jz47xx/cpu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : cpu.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-07-09 Bernard first version 13 | * 2010-09-11 Bernard add CPU reset implementation 14 | */ 15 | #include 16 | #include 17 | 18 | /* Watchdog definitions */ 19 | #define WDT_CLK_PRESCALE_CLK1 ( 0x0 << 3) 20 | #define WDT_CLK_PRESCALE_CLK4 ( 0x1 << 3) 21 | #define WDT_CLK_PRESCALE_CLK16 ( 0x2 << 3) 22 | #define WDT_CLK_PRESCALE_CLK64 ( 0x3 << 3) 23 | #define WDT_CLK_PRESCALE_CLK256 ( 0x4 << 3) 24 | #define WDT_CLK_PRESCALE_CLK1024 ( 0x5 << 3) 25 | #define WDT_CLK_PRESCALE_MASK ( 0x3F << 3) 26 | 27 | #define WDT_CLK_EXTAL ( 0x1 << 2) 28 | #define WDT_CLK_RTC ( 0x1 << 1) 29 | #define WDT_CLK_PCLK ( 0x1 << 0) 30 | #define WDT_CLK_MASK ( 7 ) 31 | 32 | #define WDT_ENABLE ( 1 << 0 ) 33 | 34 | /** 35 | * @addtogroup Jz47xx 36 | */ 37 | /*@{*/ 38 | 39 | /** 40 | * this function will reset CPU 41 | * 42 | */ 43 | void rt_hw_cpu_reset() 44 | { 45 | /* open the watch-dog */ 46 | WDT_TCSR = WDT_CLK_EXTAL; 47 | WDT_TCSR |= WDT_CLK_PRESCALE_CLK1024; 48 | WDT_TDR = 0x03; 49 | WDT_TCNT = 0x00; 50 | WDT_TCER |= WDT_ENABLE; 51 | 52 | rt_kprintf("reboot system...\n"); 53 | while (1); 54 | } 55 | 56 | /** 57 | * this function will shutdown CPU 58 | * 59 | */ 60 | void rt_hw_cpu_shutdown() 61 | { 62 | rt_kprintf("shutdown...\n"); 63 | 64 | while (1); 65 | } 66 | 67 | /*@}*/ 68 | 69 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/mips/jz47xx/exception.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : exception.c 3 | * Change Logs: 4 | * Date Author Notes 5 | * 2010-05-17 swkyer first version 6 | */ 7 | #include 8 | #include 9 | #include "../common/exception.h" 10 | #include "../common/mipsregs.h" 11 | 12 | /** 13 | * @addtogroup Jz47xx 14 | */ 15 | /*@{*/ 16 | 17 | /** 18 | * exception handle table 19 | */ 20 | exception_func_t sys_exception_handlers[33]; 21 | 22 | /** 23 | * setup the exception handle 24 | */ 25 | exception_func_t rt_set_except_vector(int n, exception_func_t func) 26 | { 27 | exception_func_t old_handler = sys_exception_handlers[n]; 28 | 29 | if ((n == 0) || (n > 32) || (!func)) 30 | { 31 | return 0; 32 | } 33 | 34 | sys_exception_handlers[n] = func; 35 | 36 | return old_handler; 37 | } 38 | 39 | void tlb_refill_handler(void) 40 | { 41 | rt_kprintf("tlb-miss happens, epc: 0x%08x\n", read_c0_epc()); 42 | rt_hw_cpu_shutdown(); 43 | } 44 | 45 | void cache_error_handler(void) 46 | { 47 | rt_kprintf("cache exception happens, epc: 0x%08x\n", read_c0_epc()); 48 | rt_hw_cpu_shutdown(); 49 | } 50 | 51 | static void unhandled_exception_handle(pt_regs_t *regs) 52 | { 53 | rt_kprintf("exception happens, epc: 0x%08x\n", regs->cp0_epc); 54 | } 55 | 56 | void install_default_execpt_handle(void) 57 | { 58 | rt_int32_t i; 59 | 60 | for (i=0; i<33; i++) 61 | sys_exception_handlers[i] = (exception_func_t)unhandled_exception_handle; 62 | } 63 | 64 | /*@}*/ 65 | 66 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/mips/jz47xx/jz4740.h: -------------------------------------------------------------------------------- 1 | #ifndef __JZ4740_H__ 2 | #define __JZ4740_H__ 3 | 4 | #include "jz47xx.h" 5 | 6 | #define WDT_BASE 0xB0002000 7 | 8 | /* Watchdog */ 9 | #define WDT_TDR __REG16(WDT_BASE + 0x00) /* Watchdog Timer Data Register */ 10 | #define WDT_TCER __REG8(WDT_BASE + 0x04) /* Watchdog Counter Enable Register */ 11 | #define WDT_TCNT __REG16(WDT_BASE + 0x08) /* Watchdog Timer Counter Register */ 12 | #define WDT_TCSR __REG16(WDT_BASE + 0x0C) /* Watchdog Timer Control Register */ 13 | 14 | /* Clock Gate Register Definitions */ 15 | #define CPM_CLKGR_UART1 (1 << 15) 16 | #define CPM_CLKGR_UHC (1 << 14) 17 | #define CPM_CLKGR_IPU (1 << 13) 18 | #define CPM_CLKGR_DMAC (1 << 12) 19 | #define CPM_CLKGR_UDC (1 << 11) 20 | #define CPM_CLKGR_LCD (1 << 10) 21 | #define CPM_CLKGR_CIM (1 << 9) 22 | #define CPM_CLKGR_SADC (1 << 8) 23 | #define CPM_CLKGR_MSC (1 << 7) 24 | #define CPM_CLKGR_AIC1 (1 << 6) 25 | #define CPM_CLKGR_AIC2 (1 << 5) 26 | #define CPM_CLKGR_SSI (1 << 4) 27 | #define CPM_CLKGR_I2C (1 << 3) 28 | #define CPM_CLKGR_RTC (1 << 2) 29 | #define CPM_CLKGR_TCU (1 << 1) 30 | #define CPM_CLKGR_UART0 (1 << 0) 31 | 32 | /* Interrupt Definitions */ 33 | #define IRQ_I2C 1 34 | #define IRQ_UHC 3 35 | #define IRQ_UART0 9 36 | #define IRQ_SADC 12 37 | #define IRQ_MSC 14 38 | #define IRQ_RTC 15 39 | #define IRQ_SSI 16 40 | #define IRQ_CIM 17 41 | #define IRQ_AIC 18 42 | #define IRQ_ETH 19 43 | #define IRQ_DMAC 20 44 | #define IRQ_TCU2 21 45 | #define IRQ_TCU1 22 46 | #define IRQ_TCU0 23 47 | #define IRQ_UDC 24 48 | #define IRQ_GPIO3 25 49 | #define IRQ_GPIO2 26 50 | #define IRQ_GPIO1 27 51 | #define IRQ_GPIO0 28 52 | #define IRQ_IPU 29 53 | #define IRQ_LCD 30 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/mips/jz47xx/mipscfg.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : mipscfg.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2010, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-05-27 swkyer first version 13 | */ 14 | #include 15 | #include "../common/mipsregs.h" 16 | #include "../common/mipscfg.h" 17 | 18 | mips32_core_cfg_t g_mips_core = 19 | { 20 | 16, /* icache_line_size */ 21 | 256, /* icache_lines_per_way */ 22 | 4, /* icache_ways */ 23 | 16, /* dcache_line_size */ 24 | 256, /* dcache_lines_per_way */ 25 | 4, /* dcache_ways */ 26 | 16, /* max_tlb_entries */ 27 | }; 28 | 29 | static rt_uint16_t m_pow(rt_uint16_t b, rt_uint16_t n) 30 | { 31 | rt_uint16_t rets = 1; 32 | 33 | while (n--) 34 | rets *= b; 35 | 36 | return rets; 37 | } 38 | 39 | static rt_uint16_t m_log2(rt_uint16_t b) 40 | { 41 | rt_uint16_t rets = 0; 42 | 43 | while (b != 1) 44 | { 45 | b /= 2; 46 | rets++; 47 | } 48 | 49 | return rets; 50 | } 51 | 52 | /** 53 | * read core attribute 54 | */ 55 | void mips32_cfg_init(void) 56 | { 57 | rt_uint16_t val; 58 | rt_uint32_t cp0_config1; 59 | 60 | cp0_config1 = read_c0_config(); 61 | if (cp0_config1 & 0x80000000) 62 | { 63 | cp0_config1 = read_c0_config1(); 64 | 65 | val = (cp0_config1 & (7<<22))>>22; 66 | g_mips_core.icache_lines_per_way = 64 * m_pow(2, val); 67 | val = (cp0_config1 & (7<<19))>>19; 68 | g_mips_core.icache_line_size = 2 * m_pow(2, val); 69 | val = (cp0_config1 & (7<<16))>>16; 70 | g_mips_core.icache_ways = val + 1; 71 | 72 | val = (cp0_config1 & (7<<13))>>13; 73 | g_mips_core.dcache_lines_per_way = 64 * m_pow(2, val); 74 | val = (cp0_config1 & (7<<10))>>10; 75 | g_mips_core.dcache_line_size = 2 * m_pow(2, val); 76 | val = (cp0_config1 & (7<<7))>>7; 77 | g_mips_core.dcache_ways = val + 1; 78 | 79 | val = (cp0_config1 & (0x3F<<25))>>25; 80 | g_mips_core.max_tlb_entries = val + 1; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/mips/loongson/cache.h: -------------------------------------------------------------------------------- 1 | #ifndef __CACHE_H__ 2 | #define __CACHE_H__ 3 | 4 | /* 5 | * Cache Operations 6 | */ 7 | #define Index_Invalidate_I 0x00 8 | #define Index_Writeback_Inv_D 0x01 9 | #define Index_Invalidate_SI 0x02 10 | #define Index_Writeback_Inv_SD 0x03 11 | #define Index_Load_Tag_I 0x04 12 | #define Index_Load_Tag_D 0x05 13 | #define Index_Load_Tag_SI 0x06 14 | #define Index_Load_Tag_SD 0x07 15 | #define Index_Store_Tag_I 0x08 16 | #define Index_Store_Tag_D 0x09 17 | #define Index_Store_Tag_SI 0x0A 18 | #define Index_Store_Tag_SD 0x0B 19 | #define Create_Dirty_Excl_D 0x0d 20 | #define Create_Dirty_Excl_SD 0x0f 21 | #define Hit_Invalidate_I 0x10 22 | #define Hit_Invalidate_D 0x11 23 | #define Hit_Invalidate_SI 0x12 24 | #define Hit_Invalidate_SD 0x13 25 | #define Fill 0x14 26 | #define Hit_Writeback_Inv_D 0x15 27 | /* 0x16 is unused */ 28 | #define Hit_Writeback_Inv_SD 0x17 29 | #define Hit_Writeback_I 0x18 30 | #define Hit_Writeback_D 0x19 31 | /* 0x1a is unused */ 32 | #define Hit_Writeback_SD 0x1b 33 | /* 0x1c is unused */ 34 | /* 0x1e is unused */ 35 | #define Hit_Set_Virtual_SI 0x1e 36 | #define Hit_Set_Virtual_SD 0x1f 37 | 38 | extern void Clear_TagLo (void); 39 | 40 | extern void Invalidate_Icache_Gc3210I (unsigned int); 41 | extern void Invalidate_Dcache_ClearTag_Gc3210I (unsigned int); 42 | extern void Invalidate_Dcache_Fill_Gc3210I(unsigned int); 43 | extern void Writeback_Invalidate_Dcache(unsigned int); 44 | 45 | void rt_hw_cache_init(void); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/mips/loongson/cache.inc: -------------------------------------------------------------------------------- 1 | #ifndef __CACHE_H__ 2 | #define __CACHE_H__ 3 | 4 | /* 5 | * Cache Operations 6 | */ 7 | #define Index_Invalidate_I 0x00 8 | #define Index_Writeback_Inv_D 0x01 9 | #define Index_Invalidate_SI 0x02 10 | #define Index_Writeback_Inv_SD 0x03 11 | #define Index_Load_Tag_I 0x04 12 | #define Index_Load_Tag_D 0x05 13 | #define Index_Load_Tag_SI 0x06 14 | #define Index_Load_Tag_SD 0x07 15 | #define Index_Store_Tag_I 0x08 16 | #define Index_Store_Tag_D 0x09 17 | #define Index_Store_Tag_SI 0x0A 18 | #define Index_Store_Tag_SD 0x0B 19 | #define Create_Dirty_Excl_D 0x0d 20 | #define Create_Dirty_Excl_SD 0x0f 21 | #define Hit_Invalidate_I 0x10 22 | #define Hit_Invalidate_D 0x11 23 | #define Hit_Invalidate_SI 0x12 24 | #define Hit_Invalidate_SD 0x13 25 | #define Fill 0x14 26 | #define Hit_Writeback_Inv_D 0x15 27 | /* 0x16 is unused */ 28 | #define Hit_Writeback_Inv_SD 0x17 29 | #define Hit_Writeback_I 0x18 30 | #define Hit_Writeback_D 0x19 31 | /* 0x1a is unused */ 32 | #define Hit_Writeback_SD 0x1b 33 | /* 0x1c is unused */ 34 | /* 0x1e is unused */ 35 | #define Hit_Set_Virtual_SI 0x1e 36 | #define Hit_Set_Virtual_SD 0x1f 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/mips/loongson/cpu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : cpu.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2010, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-07-09 Bernard first version 13 | * 2010-09-11 Bernard add CPU reset implementation 14 | */ 15 | #include 16 | #include 17 | 18 | /** 19 | * @addtogroup Loongson SoC3210 20 | */ 21 | 22 | /*@{*/ 23 | 24 | /** 25 | * this function will reset CPU 26 | * 27 | */ 28 | void rt_hw_cpu_reset(void) 29 | { 30 | /* open the watch-dog */ 31 | WD_TIMER = 0x01; /* watch dog will be timeout after 1 tick */ 32 | WD_CTRL |= 0x01; 33 | 34 | rt_kprintf("reboot system...\n"); 35 | while (1); 36 | } 37 | 38 | /** 39 | * this function will shutdown CPU 40 | * 41 | */ 42 | void rt_hw_cpu_shutdown(void) 43 | { 44 | rt_kprintf("shutdown...\n"); 45 | 46 | while (1); 47 | } 48 | 49 | /*@}*/ 50 | 51 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/mips/loongson/exception.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : exception.c 3 | * Change Logs: 4 | * Date Author Notes 5 | * 2010-05-17 swkyer first version 6 | */ 7 | #include 8 | #include 9 | #include "../common/exception.h" 10 | #include "../common/mipsregs.h" 11 | 12 | /** 13 | * @addtogroup SoC3210 14 | */ 15 | /*@{*/ 16 | 17 | /** 18 | * exception handle table 19 | */ 20 | #define RT_EXCEPTION_MAX 8 21 | exception_func_t sys_exception_handlers[RT_EXCEPTION_MAX]; 22 | 23 | /** 24 | * setup the exception handle 25 | */ 26 | exception_func_t rt_set_except_vector(int n, exception_func_t func) 27 | { 28 | exception_func_t old_handler = sys_exception_handlers[n]; 29 | 30 | if ((n == 0) || (n > RT_EXCEPTION_MAX) || (!func)) 31 | { 32 | return 0; 33 | } 34 | 35 | sys_exception_handlers[n] = func; 36 | 37 | return old_handler; 38 | } 39 | 40 | void tlb_refill_handler(void) 41 | { 42 | rt_kprintf("tlb-miss happens, epc: 0x%08x\n", read_c0_epc()); 43 | rt_hw_cpu_shutdown(); 44 | } 45 | 46 | void cache_error_handler(void) 47 | { 48 | rt_kprintf("cache exception happens, epc: 0x%08x\n", read_c0_epc()); 49 | rt_hw_cpu_shutdown(); 50 | } 51 | 52 | static void unhandled_exception_handle(pt_regs_t *regs) 53 | { 54 | rt_kprintf("exception happens, epc: 0x%08x, cause: 0x%08x\n", regs->cp0_epc, read_c0_cause()); 55 | } 56 | 57 | void install_default_execpt_handle(void) 58 | { 59 | rt_int32_t i; 60 | 61 | for (i=0; i> 8; 72 | 73 | for (index = RT_EXCEPTION_MAX; index > 0; index --) 74 | { 75 | if (cause & (1 << index)) 76 | { 77 | sys_exception_handlers[index](regs); 78 | cause &= ~(1 << index); 79 | } 80 | } 81 | } 82 | 83 | /*@}*/ 84 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/mips/loongson/mipscfg.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : mipscfg.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2010, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-05-27 swkyer first version 13 | */ 14 | #include 15 | #include "../common/mipsregs.h" 16 | #include "../common/mipscfg.h" 17 | 18 | mips32_core_cfg_t g_mips_core = 19 | { 20 | 16, /* icache_line_size */ 21 | 256, /* icache_lines_per_way */ 22 | 4, /* icache_ways */ 23 | 16, /* dcache_line_size */ 24 | 256, /* dcache_lines_per_way */ 25 | 4, /* dcache_ways */ 26 | 16, /* max_tlb_entries */ 27 | }; 28 | 29 | static rt_uint16_t m_pow(rt_uint16_t b, rt_uint16_t n) 30 | { 31 | rt_uint16_t rets = 1; 32 | 33 | while (n--) 34 | rets *= b; 35 | 36 | return rets; 37 | } 38 | 39 | static rt_uint16_t m_log2(rt_uint16_t b) 40 | { 41 | rt_uint16_t rets = 0; 42 | 43 | while (b != 1) 44 | { 45 | b /= 2; 46 | rets++; 47 | } 48 | 49 | return rets; 50 | } 51 | 52 | /** 53 | * read core attribute 54 | */ 55 | void mips32_cfg_init(void) 56 | { 57 | rt_uint16_t val; 58 | rt_uint32_t cp0_config1; 59 | 60 | cp0_config1 = read_c0_config(); 61 | if (cp0_config1 & 0x80000000) 62 | { 63 | cp0_config1 = read_c0_config1(); 64 | 65 | val = (cp0_config1 & (7<<22))>>22; 66 | g_mips_core.icache_lines_per_way = 64 * m_pow(2, val); 67 | val = (cp0_config1 & (7<<19))>>19; 68 | g_mips_core.icache_line_size = 2 * m_pow(2, val); 69 | val = (cp0_config1 & (7<<16))>>16; 70 | g_mips_core.icache_ways = val + 1; 71 | 72 | val = (cp0_config1 & (7<<13))>>13; 73 | g_mips_core.dcache_lines_per_way = 64 * m_pow(2, val); 74 | val = (cp0_config1 & (7<<10))>>10; 75 | g_mips_core.dcache_line_size = 2 * m_pow(2, val); 76 | val = (cp0_config1 & (7<<7))>>7; 77 | g_mips_core.dcache_ways = val + 1; 78 | 79 | val = (cp0_config1 & (0x3F<<25))>>25; 80 | g_mips_core.max_tlb_entries = val + 1; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/mips/loongson_1b/cache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File : cache.h 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2011, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-07-09 Bernard first version 13 | * 2011-08-08 lgnq modified for LS1B 14 | */ 15 | #ifndef __CACHE_H__ 16 | #define __CACHE_H__ 17 | 18 | /* 19 | * Cache Operations 20 | */ 21 | #define Index_Invalidate_I 0x00 22 | #define Index_Writeback_Inv_D 0x01 23 | #define Index_Invalidate_SI 0x02 24 | #define Index_Writeback_Inv_SD 0x03 25 | #define Index_Load_Tag_I 0x04 26 | #define Index_Load_Tag_D 0x05 27 | #define Index_Load_Tag_SI 0x06 28 | #define Index_Load_Tag_SD 0x07 29 | #define Index_Store_Tag_I 0x08 30 | #define Index_Store_Tag_D 0x09 31 | #define Index_Store_Tag_SI 0x0A 32 | #define Index_Store_Tag_SD 0x0B 33 | #define Create_Dirty_Excl_D 0x0d 34 | #define Create_Dirty_Excl_SD 0x0f 35 | #define Hit_Invalidate_I 0x10 36 | #define Hit_Invalidate_D 0x11 37 | #define Hit_Invalidate_SI 0x12 38 | #define Hit_Invalidate_SD 0x13 39 | #define Fill 0x14 40 | #define Hit_Writeback_Inv_D 0x15 41 | /* 0x16 is unused */ 42 | #define Hit_Writeback_Inv_SD 0x17 43 | #define Hit_Writeback_I 0x18 44 | #define Hit_Writeback_D 0x19 45 | /* 0x1a is unused */ 46 | #define Hit_Writeback_SD 0x1b 47 | /* 0x1c is unused */ 48 | /* 0x1e is unused */ 49 | #define Hit_Set_Virtual_SI 0x1e 50 | #define Hit_Set_Virtual_SD 0x1f 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/mips/loongson_1b/mipscfg.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : mipscfg.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2011, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2010-05-27 swkyer first version 13 | */ 14 | #include 15 | #include "../common/mipsregs.h" 16 | #include "../common/mipscfg.h" 17 | 18 | mips32_core_cfg_t g_mips_core = 19 | { 20 | 16, /* icache_line_size */ 21 | 256, /* icache_lines_per_way */ 22 | 4, /* icache_ways */ 23 | 16, /* dcache_line_size */ 24 | 256, /* dcache_lines_per_way */ 25 | 4, /* dcache_ways */ 26 | 16, /* max_tlb_entries */ 27 | }; 28 | 29 | static rt_uint16_t m_pow(rt_uint16_t b, rt_uint16_t n) 30 | { 31 | rt_uint16_t rets = 1; 32 | 33 | while (n--) 34 | rets *= b; 35 | 36 | return rets; 37 | } 38 | 39 | static rt_uint16_t m_log2(rt_uint16_t b) 40 | { 41 | rt_uint16_t rets = 0; 42 | 43 | while (b != 1) 44 | { 45 | b /= 2; 46 | rets++; 47 | } 48 | 49 | return rets; 50 | } 51 | 52 | /** 53 | * read core attribute 54 | */ 55 | void mips32_cfg_init(void) 56 | { 57 | rt_uint16_t val; 58 | rt_uint32_t cp0_config1; 59 | 60 | cp0_config1 = read_c0_config(); 61 | if (cp0_config1 & 0x80000000) 62 | { 63 | cp0_config1 = read_c0_config1(); 64 | 65 | val = (cp0_config1 & (7<<22))>>22; 66 | g_mips_core.icache_lines_per_way = 64 * m_pow(2, val); 67 | val = (cp0_config1 & (7<<19))>>19; 68 | g_mips_core.icache_line_size = 2 * m_pow(2, val); 69 | val = (cp0_config1 & (7<<16))>>16; 70 | g_mips_core.icache_ways = val + 1; 71 | 72 | val = (cp0_config1 & (7<<13))>>13; 73 | g_mips_core.dcache_lines_per_way = 64 * m_pow(2, val); 74 | val = (cp0_config1 & (7<<10))>>10; 75 | g_mips_core.dcache_line_size = 2 * m_pow(2, val); 76 | val = (cp0_config1 & (7<<7))>>7; 77 | g_mips_core.dcache_ways = val + 1; 78 | 79 | val = (cp0_config1 & (0x3F<<25))>>25; 80 | g_mips_core.max_tlb_entries = val + 1; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/mips/pic32/exceptions.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/armink/FreeModbus_Slave-Master-RTT-STM32/39dfef0eee063e1ef0f517446b6ba8682f55cf01/RT-Thread-1.2.2/libcpu/mips/pic32/exceptions.c -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/nios/nios_ii/interrupt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : interrupt.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2009, RT-Thread Development Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2009-01-05 Bernard first version 13 | */ 14 | 15 | #include 16 | 17 | /* exception and interrupt handler table */ 18 | rt_uint32_t rt_interrupt_from_thread, rt_interrupt_to_thread; 19 | rt_uint32_t rt_thread_switch_interrupt_flag; 20 | rt_uint32_t rt_current_thread_entry; 21 | 22 | /*@}*/ 23 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/nios/nios_ii/vector.S: -------------------------------------------------------------------------------- 1 | .set noat 2 | 3 | .globl .Lexception_exit 4 | 5 | .section .exceptions.exit.label 6 | .Lexception_exit: 7 | .section .exceptions.exit, "xa" 8 | ldw r5, 68(sp) 9 | 10 | /* get exception back */ 11 | ldw ea, 72(sp) 12 | 13 | /* if(rt_thread_switch_interrupt_flag == 0) goto no_need_context */ 14 | ldw r4,%gprel(rt_thread_switch_interrupt_flag)(gp) 15 | beq r4,zero,no_need_context 16 | 17 | need_context: 18 | movia ea, rt_hw_context_switch_interrupt_do 19 | /* disable interrupt */ 20 | mov r5, zero 21 | 22 | no_need_context: 23 | ldw ra, 0(sp) 24 | 25 | wrctl estatus, r5 26 | 27 | /* 28 | * Leave a gap in the stack frame at 4(sp) for the muldiv handler to 29 | * store zero into. 30 | */ 31 | 32 | ldw r1, 8(sp) 33 | ldw r2, 12(sp) 34 | ldw r3, 16(sp) 35 | ldw r4, 20(sp) 36 | ldw r5, 24(sp) 37 | ldw r6, 28(sp) 38 | ldw r7, 32(sp) 39 | ldw r8, 36(sp) 40 | ldw r9, 40(sp) 41 | ldw r10, 44(sp) 42 | ldw r11, 48(sp) 43 | ldw r12, 52(sp) 44 | ldw r13, 56(sp) 45 | ldw r14, 60(sp) 46 | ldw r15, 64(sp) 47 | 48 | addi sp, sp, 76 49 | 50 | eret 51 | 52 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/ppc/ppc405/cache.h: -------------------------------------------------------------------------------- 1 | #ifndef __CACHE_H__ 2 | #define __CACHE_H__ 3 | 4 | #include 5 | 6 | #if !defined(__ASSEMBLY__) 7 | void flush_dcache_range(unsigned long start, unsigned long stop); 8 | void clean_dcache_range(unsigned long start, unsigned long stop); 9 | void invalidate_dcache_range(unsigned long start, unsigned long stop); 10 | void flush_dcache(void); 11 | void invalidate_dcache(void); 12 | void invalidate_icache(void); 13 | 14 | void icache_enable(void); 15 | void icache_disable(void); 16 | unsigned long icache_status(void); 17 | 18 | void dcache_enable(void); 19 | void dcache_disable(void); 20 | unsigned long dcache_status(void); 21 | #endif 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/ppc/ppc405/context.h: -------------------------------------------------------------------------------- 1 | #ifndef __CONTEXT_H__ 2 | #define __CONTEXT_H__ 3 | 4 | #define MSR_ME (1<<12) /* Machine Check Enable */ 5 | #define MSR_EE (1<<15) /* External Interrupt Enable */ 6 | #define MSR_CE (1<<17) /* Critical Interrupt Enable */ 7 | 8 | #define GPR0 0 9 | #define GPR2 4 10 | #define GPR3 8 11 | #define GPR4 12 12 | #define GPR5 16 13 | #define GPR6 20 14 | #define GPR7 24 15 | #define GPR8 28 16 | #define GPR9 32 17 | #define GPR10 36 18 | #define GPR11 40 19 | #define GPR12 44 20 | #define GPR13 48 21 | #define GPR14 52 22 | #define GPR15 56 23 | #define GPR16 60 24 | #define GPR17 64 25 | #define GPR18 68 26 | #define GPR19 72 27 | #define GPR20 76 28 | #define GPR21 80 29 | #define GPR22 84 30 | #define GPR23 88 31 | #define GPR24 92 32 | #define GPR25 96 33 | #define GPR26 100 34 | #define GPR27 104 35 | #define GPR28 108 36 | #define GPR29 112 37 | #define GPR30 116 38 | #define GPR31 120 39 | #define USPRG0 (GPR31 + 4) 40 | #define CR (USPRG0 + 4) 41 | #define XER (CR + 4) 42 | #define CTR (XER + 4) 43 | #define LR (CTR + 4) 44 | #define SRR0 (LR + 4) 45 | #define SRR1 (SRR0 + 4) 46 | #define STACK_FRAME_SIZE (SRR1 + 4) 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/ppc/ppc405/include/asm/ppc4xx-intvec.h: -------------------------------------------------------------------------------- 1 | #ifndef _VECNUMS_H_ 2 | #define _VECNUMS_H_ 3 | 4 | #define VECNUM_U0 0 /* UART0 */ 5 | #define VECNUM_U1 1 /* UART1 */ 6 | #define VECNUM_D0 5 /* DMA channel 0 */ 7 | #define VECNUM_D1 6 /* DMA channel 1 */ 8 | #define VECNUM_D2 7 /* DMA channel 2 */ 9 | #define VECNUM_D3 8 /* DMA channel 3 */ 10 | #define VECNUM_EWU0 9 /* Ethernet wakeup */ 11 | #define VECNUM_MS 10 /* MAL SERR */ 12 | #define VECNUM_MTE 11 /* MAL TXEOB */ 13 | #define VECNUM_MRE 12 /* MAL RXEOB */ 14 | #define VECNUM_TXDE 13 /* MAL TXDE */ 15 | #define VECNUM_RXDE 14 /* MAL RXDE */ 16 | #define VECNUM_ETH0 15 /* Ethernet interrupt status */ 17 | #define VECNUM_EIR0 25 /* External interrupt 0 */ 18 | #define VECNUM_EIR1 26 /* External interrupt 1 */ 19 | #define VECNUM_EIR2 27 /* External interrupt 2 */ 20 | #define VECNUM_EIR3 28 /* External interrupt 3 */ 21 | #define VECNUM_EIR4 29 /* External interrupt 4 */ 22 | #define VECNUM_EIR5 30 /* External interrupt 5 */ 23 | #define VECNUM_EIR6 31 /* External interrupt 6 */ 24 | 25 | #endif /* _VECNUMS_H_ */ 26 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/ppc/ppc405/include/asm/ppc4xx-uic.h: -------------------------------------------------------------------------------- 1 | #ifndef _PPC4xx_UIC_H_ 2 | #define _PPC4xx_UIC_H_ 3 | 4 | /* 5 | * Define the number of UIC's 6 | */ 7 | #define UIC_MAX 1 8 | #define IRQ_MAX UIC_MAX * 32 9 | 10 | /* UIC0 dcr base address */ 11 | #define UIC0_DCR_BASE 0xc0 12 | 13 | /* 14 | * UIC register 15 | */ 16 | #define UIC_SR 0x0 /* UIC status */ 17 | #define UIC_ER 0x2 /* UIC enable */ 18 | #define UIC_CR 0x3 /* UIC critical */ 19 | #define UIC_PR 0x4 /* UIC polarity */ 20 | #define UIC_TR 0x5 /* UIC triggering */ 21 | #define UIC_MSR 0x6 /* UIC masked status */ 22 | #define UIC_VR 0x7 /* UIC vector */ 23 | #define UIC_VCR 0x8 /* UIC vector configuration */ 24 | 25 | #define uic0sr (UIC0_DCR_BASE+0x0) /* UIC0 status */ 26 | #define uic0er (UIC0_DCR_BASE+0x2) /* UIC0 enable */ 27 | #define uic0cr (UIC0_DCR_BASE+0x3) /* UIC0 critical */ 28 | #define uic0pr (UIC0_DCR_BASE+0x4) /* UIC0 polarity */ 29 | #define uic0tr (UIC0_DCR_BASE+0x5) /* UIC0 triggering */ 30 | #define uic0msr (UIC0_DCR_BASE+0x6) /* UIC0 masked status */ 31 | #define uic0vr (UIC0_DCR_BASE+0x7) /* UIC0 vector */ 32 | #define uic0vcr (UIC0_DCR_BASE+0x8) /* UIC0 vector configuration */ 33 | 34 | /* The following is for compatibility with 405 code */ 35 | #define uicsr uic0sr 36 | #define uicer uic0er 37 | #define uiccr uic0cr 38 | #define uicpr uic0pr 39 | #define uictr uic0tr 40 | #define uicmsr uic0msr 41 | #define uicvr uic0vr 42 | #define uicvcr uic0vcr 43 | 44 | /* the interrupt vector definitions */ 45 | #define VECNUM_MAL_SERR 10 46 | #define VECNUM_MAL_TXEOB 11 47 | #define VECNUM_MAL_RXEOB 12 48 | #define VECNUM_MAL_TXDE 13 49 | #define VECNUM_MAL_RXDE 14 50 | #define VECNUM_ETH0 15 51 | #define VECNUM_ETH1_OFFS 2 52 | #define VECNUM_EIRQ6 29 53 | 54 | /* 55 | * Mask definitions (used for example in 4xx_enet.c) 56 | */ 57 | #define UIC_MASK(vec) (0x80000000 >> ((vec) & 0x1f)) 58 | /* UIC_NR won't work for 440GX because of its specific UIC DCR addresses */ 59 | #define UIC_NR(vec) ((vec) >> 5) 60 | 61 | #endif /* _PPC4xx_UIC_H_ */ 62 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/ppc/ppc405/include/asm/ppc_defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * (C) Copyright 2000 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 4 | * 5 | * See file CREDITS for list of people who contributed to this 6 | * project. 7 | * 8 | * This program is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU General Public License as 10 | * published by the Free Software Foundation; either version 2 of 11 | * the License, or (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 21 | * MA 02111-1307 USA 22 | */ 23 | 24 | /* 25 | * WARNING! This file is automatically generated - DO NOT EDIT! 26 | */ 27 | #define STACK_FRAME_OVERHEAD 16 28 | #define INT_FRAME_SIZE 192 29 | #define GPR0 16 30 | #define GPR1 20 31 | #define GPR2 24 32 | #define GPR3 28 33 | #define GPR4 32 34 | #define GPR5 36 35 | #define GPR6 40 36 | #define GPR7 44 37 | #define GPR8 48 38 | #define GPR9 52 39 | #define GPR10 56 40 | #define GPR11 60 41 | #define GPR12 64 42 | #define GPR13 68 43 | #define GPR14 72 44 | #define GPR15 76 45 | #define GPR16 80 46 | #define GPR17 84 47 | #define GPR18 88 48 | #define GPR19 92 49 | #define GPR20 96 50 | #define GPR21 100 51 | #define GPR22 104 52 | #define GPR23 108 53 | #define GPR24 112 54 | #define GPR25 116 55 | #define GPR26 120 56 | #define GPR27 124 57 | #define GPR28 128 58 | #define GPR29 132 59 | #define GPR30 136 60 | #define GPR31 140 61 | #define _NIP 144 62 | #define _MSR 148 63 | #define ORIG_GPR3 152 64 | #define _CTR 156 65 | #define _LINK 160 66 | #define _XER 164 67 | #define _CCR 168 68 | #define _MQ 172 69 | #define TRAP 176 70 | #define _DAR 180 71 | #define _DSISR 184 72 | #define RESULT 188 73 | 74 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/ppc/ppc405/include/asm/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _PPC_TYPES_H 2 | #define _PPC_TYPES_H 3 | 4 | 5 | #ifndef __ASSEMBLY__ 6 | 7 | typedef enum bool 8 | { 9 | FALSE = 0, 10 | TRUE = 1 11 | }BOOL; 12 | 13 | typedef unsigned short umode_t; 14 | 15 | typedef __signed__ char __s8; 16 | typedef unsigned char __u8; 17 | 18 | typedef __signed__ short __s16; 19 | typedef unsigned short __u16; 20 | 21 | typedef __signed__ int __s32; 22 | typedef unsigned int __u32; 23 | 24 | #if defined(__GNUC__) 25 | __extension__ typedef __signed__ long long __s64; 26 | __extension__ typedef unsigned long long __u64; 27 | #endif 28 | 29 | typedef struct { 30 | __u32 u[4]; 31 | } __attribute__((aligned(16))) vector128; 32 | 33 | #ifdef __KERNEL__ 34 | /* 35 | * These aren't exported outside the kernel to avoid name space clashes 36 | */ 37 | typedef signed char s8; 38 | typedef unsigned char u8; 39 | 40 | typedef signed short s16; 41 | typedef unsigned short u16; 42 | 43 | typedef signed int s32; 44 | typedef unsigned int u32; 45 | 46 | typedef signed long long s64; 47 | typedef unsigned long long u64; 48 | 49 | typedef char INT8; 50 | typedef short INT16; 51 | typedef int INT32; 52 | typedef long long INT64; 53 | typedef unsigned char UINT8; 54 | typedef unsigned short UINT16; 55 | typedef unsigned int UINT32; 56 | typedef unsigned long long UINT64; 57 | 58 | #define BITS_PER_LONG 32 59 | 60 | /* DMA addresses are 32-bits wide */ 61 | typedef u32 dma_addr_t; 62 | 63 | #ifdef CONFIG_PHYS_64BIT 64 | typedef unsigned long long phys_addr_t; 65 | typedef unsigned long long phys_size_t; 66 | #else 67 | typedef unsigned long phys_addr_t; 68 | typedef unsigned long phys_size_t; 69 | #endif 70 | 71 | #endif /* __KERNEL__ */ 72 | #endif /* __ASSEMBLY__ */ 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/sim/win32/cpu_port.h: -------------------------------------------------------------------------------- 1 | /* 2 | ************************************************************************************************************************ 3 | * File : cpu_port.h 4 | * By : xyou 5 | * Version : V1.00.00 6 | ************************************************************************************************************************ 7 | */ 8 | 9 | 10 | 11 | #ifndef _CPU_PORT_H_ 12 | #define _CPU_PORT_H_ 13 | 14 | 15 | /* 16 | ********************************************************************************************************* 17 | * CPU INTERRUPT PRIORITY 18 | ********************************************************************************************************* 19 | */ 20 | #define CPU_INTERRUPT_YIELD 0x00 21 | #define CPU_INTERRUPT_TICK 0x01 22 | 23 | 24 | 25 | /* 26 | ********************************************************************************************************* 27 | * FUNCTION PROTOTYPES 28 | ********************************************************************************************************* 29 | */ 30 | void TriggerSimulateInterrupt(rt_uint32_t IntIndex); 31 | 32 | void WinThreadScheduler(void); 33 | #endif /* _CPU_PORT_H_ */ 34 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/unicore32/sep6200/trace.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : trace.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License along 17 | * with this program; if not, write to the Free Software Foundation, Inc., 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | * 20 | * Change Logs: 21 | * Date Author Notes 22 | * 2017-07-17 Peng Fan sep6200 implementation 23 | */ 24 | #include 25 | 26 | void rt_hw_backtrace(rt_uint32_t *fp, rt_uint32_t thread_entry) 27 | { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/xilinx/microblaze/cpu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * File : cpu.c 3 | * This file is part of RT-Thread RTOS 4 | * COPYRIGHT (C) 2006, RT-Thread Develop Team 5 | * 6 | * The license and distribution terms for this file may be 7 | * found in the file LICENSE in this distribution or at 8 | * http://www.rt-thread.org/license/LICENSE 9 | * 10 | * Change Logs: 11 | * Date Author Notes 12 | * 2006-08-23 Bernard first version 13 | */ 14 | 15 | #include 16 | 17 | /** 18 | * this function will reset CPU 19 | * 20 | */ 21 | void rt_hw_cpu_reset() 22 | { 23 | } 24 | 25 | /** 26 | * this function will shutdown CPU 27 | * 28 | */ 29 | void rt_hw_cpu_shutdown() 30 | { 31 | rt_kprintf("shutdown...\n"); 32 | 33 | while (1); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/libcpu/xilinx/microblaze/serial.h: -------------------------------------------------------------------------------- 1 | #ifndef __RT_SERIAL_H__ 2 | #define __RT_SERIAL_H__ 3 | #include "xuartlite_l.h" 4 | #include "xparameters.h" 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/src/SConscript: -------------------------------------------------------------------------------- 1 | Import('RTT_ROOT') 2 | Import('rtconfig') 3 | from building import * 4 | 5 | src = Glob('*.c') 6 | 7 | CPPPATH = [RTT_ROOT + '/include'] 8 | if rtconfig.CROSS_TOOL == 'keil' and GetDepend('RT_USING_MODULE') == True: 9 | LINKFLAGS = ' --keep __rtmsym_* ' 10 | else: 11 | LINKFLAGS = '' 12 | 13 | if GetDepend('RT_USING_MODULE') == False: 14 | SrcRemove(src, ['module.c']) 15 | 16 | if GetDepend('RT_USING_HEAP') == False or GetDepend('RT_USING_SMALL_MEM') == False: 17 | SrcRemove(src, ['mem.c']) 18 | 19 | if GetDepend('RT_USING_HEAP') == False or GetDepend('RT_USING_SLAB') == False: 20 | SrcRemove(src, ['slab.c']) 21 | 22 | if GetDepend('RT_USING_MEMPOOL') == False: 23 | SrcRemove(src, ['mempool.c']) 24 | 25 | if GetDepend('RT_USING_MEMHEAP') == False: 26 | SrcRemove(src, ['memheap.c']) 27 | if GetDepend('RT_USING_MEMHEAP_AS_HEAP'): 28 | SrcRemove(src, ['mem.c']) 29 | 30 | if GetDepend('RT_USING_DEVICE') == False: 31 | SrcRemove(src, ['device.c']) 32 | 33 | group = DefineGroup('Kernel', src, depend = [''], CPPPATH = CPPPATH, LINKFLAGS = LINKFLAGS) 34 | 35 | Return('group') 36 | -------------------------------------------------------------------------------- /RT-Thread-1.2.2/src/cpuusage.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define CPU_USAGE_CALC_TICK 10 5 | #define CPU_USAGE_LOOP 100 6 | 7 | static rt_uint8_t cpu_usage_major = 0, cpu_usage_minor= 0; 8 | static rt_uint32_t total_count = 0; 9 | 10 | static void cpu_usage_idle_hook() 11 | { 12 | rt_tick_t tick; 13 | rt_uint32_t count; 14 | volatile rt_uint32_t loop; 15 | 16 | if (total_count == 0) 17 | { 18 | /* get total count */ 19 | rt_enter_critical(); 20 | tick = rt_tick_get(); 21 | while(rt_tick_get() - tick < CPU_USAGE_CALC_TICK) 22 | { 23 | total_count ++; 24 | loop = 0; 25 | while (loop < CPU_USAGE_LOOP) loop ++; 26 | } 27 | rt_exit_critical(); 28 | } 29 | 30 | count = 0; 31 | /* get CPU usage */ 32 | tick = rt_tick_get(); 33 | while (rt_tick_get() - tick < CPU_USAGE_CALC_TICK) 34 | { 35 | count ++; 36 | loop = 0; 37 | while (loop < CPU_USAGE_LOOP) loop ++; 38 | } 39 | 40 | /* calculate major and minor */ 41 | if (count < total_count) 42 | { 43 | count = total_count - count; 44 | cpu_usage_major = (count * 100) / total_count; 45 | cpu_usage_minor = ((count * 100) % total_count) * 100 / total_count; 46 | } 47 | else 48 | { 49 | total_count = count; 50 | 51 | /* no CPU usage */ 52 | cpu_usage_major = 0; 53 | cpu_usage_minor = 0; 54 | } 55 | } 56 | 57 | void cpu_usage_get(rt_uint8_t *major, rt_uint8_t *minor) 58 | { 59 | RT_ASSERT(major != RT_NULL); 60 | RT_ASSERT(minor != RT_NULL); 61 | 62 | *major = cpu_usage_major; 63 | *minor = cpu_usage_minor; 64 | } 65 | 66 | void cpu_usage_init() 67 | { 68 | /* set idle thread hook */ 69 | rt_thread_idle_sethook(cpu_usage_idle_hook); 70 | } 71 | -------------------------------------------------------------------------------- /RVMDK/JLink Regs CM3.txt: -------------------------------------------------------------------------------- 1 | 0: R0: 0x00 2 | 1: R1: 0x01 3 | 2: R2: 0x02 4 | 3: R3: 0x03 5 | 4: R4: 0x04 6 | 5: R5: 0x05 7 | 6: R6: 0x06 8 | 7: R7: 0x07 9 | 8: R8: 0x08 10 | 9: R9: 0x09 11 | 10: R10: 0x0a 12 | 11: R11: 0x0b 13 | 12: R12: 0x0c 14 | 13: R13: 0x0d 15 | 14: R14: 0x0e 16 | 15: R15: 0x0f 17 | 16: XPSR: 0x10 18 | 17: MSP: 0x11 19 | 18: PSP: 0x12 20 | 19: RAZ: 0x13 21 | 20: CFBP: 0x14 22 | 21: APSR: 0x15 23 | 22: EPSR: 0x16 24 | 23: IPSR: 0x17 25 | 24: PRIMASK: 0x18 26 | 25: BASEPRI: 0x19 27 | 26: FAULTMASK: 0x1a 28 | 27: CONTROL: 0x1b 29 | 28: BASEPRI_MAX: 0x1c 30 | 29: IAPSR: 0x1d 31 | 30: EAPSR: 0x1e 32 | 31: IEPSR: 0x1f 33 | -------------------------------------------------------------------------------- /RVMDK/JLinkSettings.ini: -------------------------------------------------------------------------------- 1 | [FLASH] 2 | SkipProgOnCRCMatch = 1 3 | VerifyDownload = 1 4 | AllowCaching = 1 5 | EnableFlashDL = 2 6 | Override = 0 7 | Device="ADUC7020X62" 8 | [BREAKPOINTS] 9 | ShowInfoWin = 1 10 | EnableFlashBP = 2 11 | BPDuringExecution = 0 12 | [CPU] 13 | OverrideMemMap = 0 14 | AllowSimulation = 1 15 | ScriptFile="" 16 | [SWO] 17 | SWOLogFile="" 18 | -------------------------------------------------------------------------------- /settings/FreeModbus_Slave&Master+RTT+STM32_Eclipse Debug.jlink: -------------------------------------------------------------------------------- 1 | [BREAKPOINTS] 2 | ShowInfoWin = 1 3 | EnableFlashBP = 2 4 | BPDuringExecution = 0 5 | [CFI] 6 | CFISize = 0x00 7 | CFIAddr = 0x00 8 | [CPU] 9 | OverrideMemMap = 0 10 | AllowSimulation = 1 11 | ScriptFile="" 12 | [FLASH] 13 | MinNumBytesFlashDL = 0 14 | SkipProgOnCRCMatch = 1 15 | VerifyDownload = 1 16 | AllowCaching = 1 17 | EnableFlashDL = 2 18 | Override = 0 19 | Device="UNSPECIFIED" 20 | [GENERAL] 21 | WorkRAMSize = 0x00 22 | WorkRAMAddr = 0x00 23 | [SWO] 24 | SWOLogFile="" 25 | [MEM] 26 | RdOverrideOrMask = 0x00 27 | RdOverrideAndMask = 0xFFFFFFFF 28 | RdOverrideAddr = 0xFFFFFFFF 29 | WrOverrideOrMask = 0x00 30 | WrOverrideAndMask = 0xFFFFFFFF 31 | WrOverrideAddr = 0xFFFFFFFF 32 | -------------------------------------------------------------------------------- /settings/FreeModbus_Slaver&Master+RTT+STM32.dni: -------------------------------------------------------------------------------- 1 | [Stack] 2 | FillEnabled=0 3 | OverflowWarningsEnabled=1 4 | WarningThreshold=90 5 | SpWarningsEnabled=1 6 | WarnLogOnly=1 7 | UseTrigger=1 8 | TriggerName=main 9 | LimitSize=0 10 | ByteLimit=50 11 | [CallStack] 12 | ShowArgs=0 13 | [Disassembly] 14 | MixedMode=1 15 | [JLinkDriver] 16 | CStepIntDis=_ 0 17 | [SWOTraceHWSettings] 18 | OverrideDefaultClocks=0 19 | CpuClock=72000000 20 | ClockAutoDetect=0 21 | ClockWanted=2000000 22 | JtagSpeed=2000000 23 | Prescaler=36 24 | TimeStampPrescIndex=0 25 | TimeStampPrescData=0 26 | PcSampCYCTAP=1 27 | PcSampPOSTCNT=15 28 | PcSampIndex=0 29 | DataLogMode=0 30 | ITMportsEnable=0 31 | ITMportsTermIO=0 32 | ITMportsLogFile=0 33 | ITMlogFile=$PROJ_DIR$\ITM.log 34 | [PowerLog] 35 | LogEnabled=0 36 | GraphEnabled=0 37 | ShowTimeLog=1 38 | ShowTimeSum=0 39 | Title0=I0 40 | Symbol0=0 4 41 | LiveEnabled=0 42 | LiveFile=PowerLogLive.log 43 | [DataLog] 44 | LogEnabled=0 45 | SumEnabled=0 46 | GraphEnabled=0 47 | ShowTimeLog=1 48 | ShowTimeSum=1 49 | [EventLog] 50 | LogEnabled=0 51 | SumEnabled=0 52 | GraphEnabled=0 53 | ShowTimeLog=1 54 | ShowTimeSum=1 55 | Title0=Ch0 56 | Symbol0=0 4 57 | Title1=Ch1 58 | Symbol1=0 4 59 | Title2=Ch2 60 | Symbol2=0 4 61 | Title3=Ch3 62 | Symbol3=0 4 63 | SumSortOrder=0 64 | Event0=1 1 1 65 | Event1=1 1 1 66 | Event2=1 1 1 67 | Event3=1 1 1 68 | [InterruptLog] 69 | LogEnabled=0 70 | SumEnabled=0 71 | GraphEnabled=0 72 | ShowTimeLog=1 73 | ShowTimeSum=1 74 | SumSortOrder=0 75 | [Trace2] 76 | Enabled=0 77 | ShowSource=0 78 | [SWOTraceWindow] 79 | PcSampling=0 80 | InterruptLogs=0 81 | ForcedTimeStamps=0 82 | EventCPI=0 83 | EventEXC=0 84 | EventFOLD=0 85 | EventLSU=0 86 | EventSLEEP=0 87 | [PowerProbe] 88 | Frequency=10000 89 | Probe0=I0 90 | ProbeSetup0=2 1 1 2 0 0 91 | [Breakpoints2] 92 | Count=0 93 | [CallStackLog] 94 | Enabled=0 95 | [DriverProfiling] 96 | Enabled=0 97 | Mode=0 98 | Graph=0 99 | Symbiont=0 100 | Exclusions= 101 | -------------------------------------------------------------------------------- /settings/FreeModbus_Slaver&Master+RTT+STM32_Eclipse Debug.jlink: -------------------------------------------------------------------------------- 1 | [BREAKPOINTS] 2 | ShowInfoWin = 1 3 | EnableFlashBP = 2 4 | BPDuringExecution = 0 5 | [CFI] 6 | CFISize = 0x00 7 | CFIAddr = 0x00 8 | [CPU] 9 | OverrideMemMap = 0 10 | AllowSimulation = 1 11 | ScriptFile="" 12 | [FLASH] 13 | MinNumBytesFlashDL = 0 14 | SkipProgOnCRCMatch = 1 15 | VerifyDownload = 1 16 | AllowCaching = 1 17 | EnableFlashDL = 2 18 | Override = 0 19 | Device="UNSPECIFIED" 20 | [GENERAL] 21 | WorkRAMSize = 0x00 22 | WorkRAMAddr = 0x00 23 | [SWO] 24 | SWOLogFile="" 25 | [MEM] 26 | RdOverrideOrMask = 0x00 27 | RdOverrideAndMask = 0xFFFFFFFF 28 | RdOverrideAddr = 0xFFFFFFFF 29 | WrOverrideOrMask = 0x00 30 | WrOverrideAndMask = 0xFFFFFFFF 31 | WrOverrideAddr = 0xFFFFFFFF 32 | --------------------------------------------------------------------------------