├── Makefile ├── README ├── clibrary.c ├── cstdlib ├── ctype.c ├── errno.c ├── math.c ├── stdbool.c ├── stdio.c ├── stdlib.c ├── string.c ├── time.c └── unistd.c ├── debug.c ├── expression.c ├── heap.c ├── include.c ├── interpreter.h ├── lex.c ├── msvc └── picoc │ ├── picoc.sdf │ ├── picoc.sln │ ├── picoc.suo │ ├── picoc.v11.suo │ ├── picoc.vcxproj │ ├── picoc.vcxproj.filters │ └── picoc.vcxproj.user ├── parse.c ├── picoc.c ├── picoc.h ├── platform.c ├── platform.h ├── platform ├── library_ffox.c ├── library_msvc.c ├── library_srv1.c ├── library_surveyor.c ├── library_unix.c ├── platform_ffox.c ├── platform_msvc.c ├── platform_surveyor.c └── platform_unix.c ├── ports ├── .gitignore ├── EFM32 │ ├── Device │ │ ├── Changes-EnergyMicro.txt │ │ ├── EnergyMicro │ │ │ ├── EFM32G │ │ │ │ ├── Include │ │ │ │ │ ├── efm32.h │ │ │ │ │ ├── efm32g200f16.h │ │ │ │ │ ├── efm32g200f32.h │ │ │ │ │ ├── efm32g200f64.h │ │ │ │ │ ├── efm32g210f128.h │ │ │ │ │ ├── efm32g222f128.h │ │ │ │ │ ├── efm32g222f32.h │ │ │ │ │ ├── efm32g222f64.h │ │ │ │ │ ├── efm32g230f128.h │ │ │ │ │ ├── efm32g230f32.h │ │ │ │ │ ├── efm32g230f64.h │ │ │ │ │ ├── efm32g232f128.h │ │ │ │ │ ├── efm32g232f32.h │ │ │ │ │ ├── efm32g232f64.h │ │ │ │ │ ├── efm32g280f128.h │ │ │ │ │ ├── efm32g280f32.h │ │ │ │ │ ├── efm32g280f64.h │ │ │ │ │ ├── efm32g290f128.h │ │ │ │ │ ├── efm32g290f32.h │ │ │ │ │ ├── efm32g290f64.h │ │ │ │ │ ├── efm32g840f128.h │ │ │ │ │ ├── efm32g840f32.h │ │ │ │ │ ├── efm32g840f64.h │ │ │ │ │ ├── efm32g842f128.h │ │ │ │ │ ├── efm32g842f32.h │ │ │ │ │ ├── efm32g842f64.h │ │ │ │ │ ├── efm32g880f128.h │ │ │ │ │ ├── efm32g880f32.h │ │ │ │ │ ├── efm32g880f64.h │ │ │ │ │ ├── efm32g890f128.h │ │ │ │ │ ├── efm32g890f32.h │ │ │ │ │ ├── efm32g890f64.h │ │ │ │ │ ├── efm32g_acmp.h │ │ │ │ │ ├── efm32g_adc.h │ │ │ │ │ ├── efm32g_aes.h │ │ │ │ │ ├── efm32g_af_pins.h │ │ │ │ │ ├── efm32g_af_ports.h │ │ │ │ │ ├── efm32g_calibrate.h │ │ │ │ │ ├── efm32g_cmu.h │ │ │ │ │ ├── efm32g_dac.h │ │ │ │ │ ├── efm32g_devinfo.h │ │ │ │ │ ├── efm32g_dma.h │ │ │ │ │ ├── efm32g_dma_ch.h │ │ │ │ │ ├── efm32g_dma_descriptor.h │ │ │ │ │ ├── efm32g_dmactrl.h │ │ │ │ │ ├── efm32g_dmareq.h │ │ │ │ │ ├── efm32g_ebi.h │ │ │ │ │ ├── efm32g_emu.h │ │ │ │ │ ├── efm32g_gpio.h │ │ │ │ │ ├── efm32g_gpio_p.h │ │ │ │ │ ├── efm32g_i2c.h │ │ │ │ │ ├── efm32g_lcd.h │ │ │ │ │ ├── efm32g_letimer.h │ │ │ │ │ ├── efm32g_leuart.h │ │ │ │ │ ├── efm32g_msc.h │ │ │ │ │ ├── efm32g_pcnt.h │ │ │ │ │ ├── efm32g_prs.h │ │ │ │ │ ├── efm32g_prs_ch.h │ │ │ │ │ ├── efm32g_prs_signals.h │ │ │ │ │ ├── efm32g_rmu.h │ │ │ │ │ ├── efm32g_romtable.h │ │ │ │ │ ├── efm32g_rtc.h │ │ │ │ │ ├── efm32g_timer.h │ │ │ │ │ ├── efm32g_timer_cc.h │ │ │ │ │ ├── efm32g_uart.h │ │ │ │ │ ├── efm32g_usart.h │ │ │ │ │ ├── efm32g_vcmp.h │ │ │ │ │ ├── efm32g_wdog.h │ │ │ │ │ ├── em_device.h │ │ │ │ │ └── system_efm32g.h │ │ │ │ └── Source │ │ │ │ │ ├── ARM │ │ │ │ │ └── startup_efm32g.s │ │ │ │ │ ├── G++ │ │ │ │ │ ├── efm32g.ld │ │ │ │ │ └── startup_efm32g.s │ │ │ │ │ ├── GCC │ │ │ │ │ ├── efm32g.ld │ │ │ │ │ └── startup_efm32g.S │ │ │ │ │ ├── IAR │ │ │ │ │ ├── startup_efm32g.c │ │ │ │ │ └── startup_efm32g.s │ │ │ │ │ └── system_efm32g.c │ │ │ ├── EFM32GG │ │ │ │ ├── Include │ │ │ │ │ ├── efm32.h │ │ │ │ │ ├── efm32gg230f1024.h │ │ │ │ │ ├── efm32gg230f512.h │ │ │ │ │ ├── efm32gg232f1024.h │ │ │ │ │ ├── efm32gg232f512.h │ │ │ │ │ ├── efm32gg280f1024.h │ │ │ │ │ ├── efm32gg280f512.h │ │ │ │ │ ├── efm32gg290f1024.h │ │ │ │ │ ├── efm32gg290f512.h │ │ │ │ │ ├── efm32gg295f1024.h │ │ │ │ │ ├── efm32gg295f512.h │ │ │ │ │ ├── efm32gg330f1024.h │ │ │ │ │ ├── efm32gg330f512.h │ │ │ │ │ ├── efm32gg332f1024.h │ │ │ │ │ ├── efm32gg332f512.h │ │ │ │ │ ├── efm32gg380f1024.h │ │ │ │ │ ├── efm32gg380f512.h │ │ │ │ │ ├── efm32gg390f1024.h │ │ │ │ │ ├── efm32gg390f512.h │ │ │ │ │ ├── efm32gg395f1024.h │ │ │ │ │ ├── efm32gg395f512.h │ │ │ │ │ ├── efm32gg840f1024.h │ │ │ │ │ ├── efm32gg840f512.h │ │ │ │ │ ├── efm32gg842f1024.h │ │ │ │ │ ├── efm32gg842f512.h │ │ │ │ │ ├── efm32gg880f1024.h │ │ │ │ │ ├── efm32gg880f512.h │ │ │ │ │ ├── efm32gg890f1024.h │ │ │ │ │ ├── efm32gg890f512.h │ │ │ │ │ ├── efm32gg895f1024.h │ │ │ │ │ ├── efm32gg895f512.h │ │ │ │ │ ├── efm32gg940f1024.h │ │ │ │ │ ├── efm32gg940f512.h │ │ │ │ │ ├── efm32gg942f1024.h │ │ │ │ │ ├── efm32gg942f512.h │ │ │ │ │ ├── efm32gg980f1024.h │ │ │ │ │ ├── efm32gg980f512.h │ │ │ │ │ ├── efm32gg990f1024.h │ │ │ │ │ ├── efm32gg990f512.h │ │ │ │ │ ├── efm32gg995f1024.h │ │ │ │ │ ├── efm32gg995f512.h │ │ │ │ │ ├── efm32gg_acmp.h │ │ │ │ │ ├── efm32gg_adc.h │ │ │ │ │ ├── efm32gg_aes.h │ │ │ │ │ ├── efm32gg_af_pins.h │ │ │ │ │ ├── efm32gg_af_ports.h │ │ │ │ │ ├── efm32gg_burtc.h │ │ │ │ │ ├── efm32gg_burtc_ret.h │ │ │ │ │ ├── efm32gg_calibrate.h │ │ │ │ │ ├── efm32gg_cmu.h │ │ │ │ │ ├── efm32gg_dac.h │ │ │ │ │ ├── efm32gg_devinfo.h │ │ │ │ │ ├── efm32gg_dma.h │ │ │ │ │ ├── efm32gg_dma_ch.h │ │ │ │ │ ├── efm32gg_dma_descriptor.h │ │ │ │ │ ├── efm32gg_dmactrl.h │ │ │ │ │ ├── efm32gg_dmareq.h │ │ │ │ │ ├── efm32gg_ebi.h │ │ │ │ │ ├── efm32gg_emu.h │ │ │ │ │ ├── efm32gg_etm.h │ │ │ │ │ ├── efm32gg_gpio.h │ │ │ │ │ ├── efm32gg_gpio_p.h │ │ │ │ │ ├── efm32gg_i2c.h │ │ │ │ │ ├── efm32gg_lcd.h │ │ │ │ │ ├── efm32gg_lesense.h │ │ │ │ │ ├── efm32gg_lesense_buf.h │ │ │ │ │ ├── efm32gg_lesense_ch.h │ │ │ │ │ ├── efm32gg_lesense_st.h │ │ │ │ │ ├── efm32gg_letimer.h │ │ │ │ │ ├── efm32gg_leuart.h │ │ │ │ │ ├── efm32gg_msc.h │ │ │ │ │ ├── efm32gg_pcnt.h │ │ │ │ │ ├── efm32gg_prs.h │ │ │ │ │ ├── efm32gg_prs_ch.h │ │ │ │ │ ├── efm32gg_prs_signals.h │ │ │ │ │ ├── efm32gg_rmu.h │ │ │ │ │ ├── efm32gg_romtable.h │ │ │ │ │ ├── efm32gg_rtc.h │ │ │ │ │ ├── efm32gg_timer.h │ │ │ │ │ ├── efm32gg_timer_cc.h │ │ │ │ │ ├── efm32gg_uart.h │ │ │ │ │ ├── efm32gg_usart.h │ │ │ │ │ ├── efm32gg_usb.h │ │ │ │ │ ├── efm32gg_usb_diep.h │ │ │ │ │ ├── efm32gg_usb_doep.h │ │ │ │ │ ├── efm32gg_usb_hc.h │ │ │ │ │ ├── efm32gg_vcmp.h │ │ │ │ │ ├── efm32gg_wdog.h │ │ │ │ │ ├── em_device.h │ │ │ │ │ └── system_efm32gg.h │ │ │ │ └── Source │ │ │ │ │ ├── ARM │ │ │ │ │ └── startup_efm32gg.s │ │ │ │ │ ├── G++ │ │ │ │ │ ├── efm32gg.ld │ │ │ │ │ └── startup_efm32gg.s │ │ │ │ │ ├── GCC │ │ │ │ │ ├── efm32gg.ld │ │ │ │ │ └── startup_efm32gg.S │ │ │ │ │ ├── IAR │ │ │ │ │ ├── startup_efm32gg.c │ │ │ │ │ └── startup_efm32gg.s │ │ │ │ │ └── system_efm32gg.c │ │ │ ├── EFM32LG │ │ │ │ ├── Include │ │ │ │ │ ├── efm32.h │ │ │ │ │ ├── efm32lg230f128.h │ │ │ │ │ ├── efm32lg230f256.h │ │ │ │ │ ├── efm32lg230f64.h │ │ │ │ │ ├── efm32lg232f128.h │ │ │ │ │ ├── efm32lg232f256.h │ │ │ │ │ ├── efm32lg232f64.h │ │ │ │ │ ├── efm32lg280f128.h │ │ │ │ │ ├── efm32lg280f256.h │ │ │ │ │ ├── efm32lg280f64.h │ │ │ │ │ ├── efm32lg290f128.h │ │ │ │ │ ├── efm32lg290f256.h │ │ │ │ │ ├── efm32lg290f64.h │ │ │ │ │ ├── efm32lg295f128.h │ │ │ │ │ ├── efm32lg295f256.h │ │ │ │ │ ├── efm32lg295f64.h │ │ │ │ │ ├── efm32lg330f128.h │ │ │ │ │ ├── efm32lg330f256.h │ │ │ │ │ ├── efm32lg330f64.h │ │ │ │ │ ├── efm32lg332f128.h │ │ │ │ │ ├── efm32lg332f256.h │ │ │ │ │ ├── efm32lg332f64.h │ │ │ │ │ ├── efm32lg380f128.h │ │ │ │ │ ├── efm32lg380f256.h │ │ │ │ │ ├── efm32lg380f64.h │ │ │ │ │ ├── efm32lg390f128.h │ │ │ │ │ ├── efm32lg390f256.h │ │ │ │ │ ├── efm32lg390f64.h │ │ │ │ │ ├── efm32lg395f128.h │ │ │ │ │ ├── efm32lg395f256.h │ │ │ │ │ ├── efm32lg395f64.h │ │ │ │ │ ├── efm32lg840f128.h │ │ │ │ │ ├── efm32lg840f256.h │ │ │ │ │ ├── efm32lg840f64.h │ │ │ │ │ ├── efm32lg842f128.h │ │ │ │ │ ├── efm32lg842f256.h │ │ │ │ │ ├── efm32lg842f64.h │ │ │ │ │ ├── efm32lg880f128.h │ │ │ │ │ ├── efm32lg880f256.h │ │ │ │ │ ├── efm32lg880f64.h │ │ │ │ │ ├── efm32lg890f128.h │ │ │ │ │ ├── efm32lg890f256.h │ │ │ │ │ ├── efm32lg890f64.h │ │ │ │ │ ├── efm32lg895f128.h │ │ │ │ │ ├── efm32lg895f256.h │ │ │ │ │ ├── efm32lg895f64.h │ │ │ │ │ ├── efm32lg940f128.h │ │ │ │ │ ├── efm32lg940f256.h │ │ │ │ │ ├── efm32lg940f64.h │ │ │ │ │ ├── efm32lg942f128.h │ │ │ │ │ ├── efm32lg942f256.h │ │ │ │ │ ├── efm32lg942f64.h │ │ │ │ │ ├── efm32lg980f128.h │ │ │ │ │ ├── efm32lg980f256.h │ │ │ │ │ ├── efm32lg980f64.h │ │ │ │ │ ├── efm32lg990f128.h │ │ │ │ │ ├── efm32lg990f256.h │ │ │ │ │ ├── efm32lg990f64.h │ │ │ │ │ ├── efm32lg995f128.h │ │ │ │ │ ├── efm32lg995f256.h │ │ │ │ │ ├── efm32lg995f64.h │ │ │ │ │ ├── efm32lg_acmp.h │ │ │ │ │ ├── efm32lg_adc.h │ │ │ │ │ ├── efm32lg_aes.h │ │ │ │ │ ├── efm32lg_af_pins.h │ │ │ │ │ ├── efm32lg_af_ports.h │ │ │ │ │ ├── efm32lg_burtc.h │ │ │ │ │ ├── efm32lg_burtc_ret.h │ │ │ │ │ ├── efm32lg_calibrate.h │ │ │ │ │ ├── efm32lg_cmu.h │ │ │ │ │ ├── efm32lg_dac.h │ │ │ │ │ ├── efm32lg_devinfo.h │ │ │ │ │ ├── efm32lg_dma.h │ │ │ │ │ ├── efm32lg_dma_ch.h │ │ │ │ │ ├── efm32lg_dma_descriptor.h │ │ │ │ │ ├── efm32lg_dmactrl.h │ │ │ │ │ ├── efm32lg_dmareq.h │ │ │ │ │ ├── efm32lg_ebi.h │ │ │ │ │ ├── efm32lg_emu.h │ │ │ │ │ ├── efm32lg_etm.h │ │ │ │ │ ├── efm32lg_gpio.h │ │ │ │ │ ├── efm32lg_gpio_p.h │ │ │ │ │ ├── efm32lg_i2c.h │ │ │ │ │ ├── efm32lg_lcd.h │ │ │ │ │ ├── efm32lg_lesense.h │ │ │ │ │ ├── efm32lg_lesense_buf.h │ │ │ │ │ ├── efm32lg_lesense_ch.h │ │ │ │ │ ├── efm32lg_lesense_st.h │ │ │ │ │ ├── efm32lg_letimer.h │ │ │ │ │ ├── efm32lg_leuart.h │ │ │ │ │ ├── efm32lg_msc.h │ │ │ │ │ ├── efm32lg_pcnt.h │ │ │ │ │ ├── efm32lg_prs.h │ │ │ │ │ ├── efm32lg_prs_ch.h │ │ │ │ │ ├── efm32lg_prs_signals.h │ │ │ │ │ ├── efm32lg_rmu.h │ │ │ │ │ ├── efm32lg_romtable.h │ │ │ │ │ ├── efm32lg_rtc.h │ │ │ │ │ ├── efm32lg_timer.h │ │ │ │ │ ├── efm32lg_timer_cc.h │ │ │ │ │ ├── efm32lg_uart.h │ │ │ │ │ ├── efm32lg_usart.h │ │ │ │ │ ├── efm32lg_usb.h │ │ │ │ │ ├── efm32lg_usb_diep.h │ │ │ │ │ ├── efm32lg_usb_doep.h │ │ │ │ │ ├── efm32lg_usb_hc.h │ │ │ │ │ ├── efm32lg_vcmp.h │ │ │ │ │ ├── efm32lg_wdog.h │ │ │ │ │ ├── em_device.h │ │ │ │ │ └── system_efm32lg.h │ │ │ │ └── Source │ │ │ │ │ ├── ARM │ │ │ │ │ └── startup_efm32lg.s │ │ │ │ │ ├── G++ │ │ │ │ │ ├── efm32lg.ld │ │ │ │ │ └── startup_efm32lg.s │ │ │ │ │ ├── GCC │ │ │ │ │ ├── efm32lg.ld │ │ │ │ │ └── startup_efm32lg.S │ │ │ │ │ ├── IAR │ │ │ │ │ ├── startup_efm32lg.c │ │ │ │ │ └── startup_efm32lg.s │ │ │ │ │ └── system_efm32lg.c │ │ │ └── EFM32TG │ │ │ │ ├── Include │ │ │ │ ├── efm32.h │ │ │ │ ├── efm32tg108f16.h │ │ │ │ ├── efm32tg108f32.h │ │ │ │ ├── efm32tg108f4.h │ │ │ │ ├── efm32tg108f8.h │ │ │ │ ├── efm32tg110f16.h │ │ │ │ ├── efm32tg110f32.h │ │ │ │ ├── efm32tg110f4.h │ │ │ │ ├── efm32tg110f8.h │ │ │ │ ├── efm32tg210f16.h │ │ │ │ ├── efm32tg210f32.h │ │ │ │ ├── efm32tg210f8.h │ │ │ │ ├── efm32tg222f16.h │ │ │ │ ├── efm32tg222f32.h │ │ │ │ ├── efm32tg222f8.h │ │ │ │ ├── efm32tg225f16.h │ │ │ │ ├── efm32tg225f32.h │ │ │ │ ├── efm32tg225f8.h │ │ │ │ ├── efm32tg230f16.h │ │ │ │ ├── efm32tg230f32.h │ │ │ │ ├── efm32tg230f8.h │ │ │ │ ├── efm32tg232f16.h │ │ │ │ ├── efm32tg232f32.h │ │ │ │ ├── efm32tg232f8.h │ │ │ │ ├── efm32tg822f16.h │ │ │ │ ├── efm32tg822f32.h │ │ │ │ ├── efm32tg822f8.h │ │ │ │ ├── efm32tg825f16.h │ │ │ │ ├── efm32tg825f32.h │ │ │ │ ├── efm32tg825f8.h │ │ │ │ ├── efm32tg840f16.h │ │ │ │ ├── efm32tg840f32.h │ │ │ │ ├── efm32tg840f8.h │ │ │ │ ├── efm32tg842f16.h │ │ │ │ ├── efm32tg842f32.h │ │ │ │ ├── efm32tg842f8.h │ │ │ │ ├── efm32tg_acmp.h │ │ │ │ ├── efm32tg_adc.h │ │ │ │ ├── efm32tg_aes.h │ │ │ │ ├── efm32tg_af_pins.h │ │ │ │ ├── efm32tg_af_ports.h │ │ │ │ ├── efm32tg_calibrate.h │ │ │ │ ├── efm32tg_cmu.h │ │ │ │ ├── efm32tg_dac.h │ │ │ │ ├── efm32tg_devinfo.h │ │ │ │ ├── efm32tg_dma.h │ │ │ │ ├── efm32tg_dma_ch.h │ │ │ │ ├── efm32tg_dma_descriptor.h │ │ │ │ ├── efm32tg_dmactrl.h │ │ │ │ ├── efm32tg_dmareq.h │ │ │ │ ├── efm32tg_emu.h │ │ │ │ ├── efm32tg_gpio.h │ │ │ │ ├── efm32tg_gpio_p.h │ │ │ │ ├── efm32tg_i2c.h │ │ │ │ ├── efm32tg_lcd.h │ │ │ │ ├── efm32tg_lesense.h │ │ │ │ ├── efm32tg_lesense_buf.h │ │ │ │ ├── efm32tg_lesense_ch.h │ │ │ │ ├── efm32tg_lesense_st.h │ │ │ │ ├── efm32tg_letimer.h │ │ │ │ ├── efm32tg_leuart.h │ │ │ │ ├── efm32tg_msc.h │ │ │ │ ├── efm32tg_pcnt.h │ │ │ │ ├── efm32tg_prs.h │ │ │ │ ├── efm32tg_prs_ch.h │ │ │ │ ├── efm32tg_prs_signals.h │ │ │ │ ├── efm32tg_rmu.h │ │ │ │ ├── efm32tg_romtable.h │ │ │ │ ├── efm32tg_rtc.h │ │ │ │ ├── efm32tg_timer.h │ │ │ │ ├── efm32tg_timer_cc.h │ │ │ │ ├── efm32tg_usart.h │ │ │ │ ├── efm32tg_vcmp.h │ │ │ │ ├── efm32tg_wdog.h │ │ │ │ ├── em_device.h │ │ │ │ └── system_efm32tg.h │ │ │ │ └── Source │ │ │ │ ├── ARM │ │ │ │ └── startup_efm32tg.s │ │ │ │ ├── G++ │ │ │ │ ├── efm32tg.ld │ │ │ │ └── startup_efm32tg.s │ │ │ │ ├── GCC │ │ │ │ ├── efm32tg.ld │ │ │ │ └── startup_efm32tg.S │ │ │ │ ├── IAR │ │ │ │ ├── startup_efm32tg.c │ │ │ │ └── startup_efm32tg.s │ │ │ │ └── system_efm32tg.c │ │ └── ReadMe-EnergyMicro.txt │ ├── STK3700 │ │ └── segmentlcdconfig.h │ ├── emlib │ │ ├── Changes_emlib.txt │ │ ├── ReadMe_emlib.txt │ │ ├── inc │ │ │ ├── em_acmp.h │ │ │ ├── em_adc.h │ │ │ ├── em_aes.h │ │ │ ├── em_assert.h │ │ │ ├── em_bitband.h │ │ │ ├── em_burtc.h │ │ │ ├── em_chip.h │ │ │ ├── em_cmu.h │ │ │ ├── em_common.h │ │ │ ├── em_dac.h │ │ │ ├── em_dbg.h │ │ │ ├── em_dma.h │ │ │ ├── em_ebi.h │ │ │ ├── em_emu.h │ │ │ ├── em_gpio.h │ │ │ ├── em_i2c.h │ │ │ ├── em_int.h │ │ │ ├── em_lcd.h │ │ │ ├── em_lesense.h │ │ │ ├── em_letimer.h │ │ │ ├── em_leuart.h │ │ │ ├── em_mpu.h │ │ │ ├── em_msc.h │ │ │ ├── em_opamp.h │ │ │ ├── em_part.h │ │ │ ├── em_pcnt.h │ │ │ ├── em_prs.h │ │ │ ├── em_rmu.h │ │ │ ├── em_rtc.h │ │ │ ├── em_system.h │ │ │ ├── em_timer.h │ │ │ ├── em_usart.h │ │ │ ├── em_vcmp.h │ │ │ ├── em_version.h │ │ │ └── em_wdog.h │ │ └── src │ │ │ ├── em_acmp.c │ │ │ ├── em_adc.c │ │ │ ├── em_aes.c │ │ │ ├── em_assert.c │ │ │ ├── em_burtc.c │ │ │ ├── em_cmu.c │ │ │ ├── em_dac.c │ │ │ ├── em_dbg.c │ │ │ ├── em_dma.c │ │ │ ├── em_ebi.c │ │ │ ├── em_emu.c │ │ │ ├── em_gpio.c │ │ │ ├── em_i2c.c │ │ │ ├── em_int.c │ │ │ ├── em_lcd.c │ │ │ ├── em_lesense.c │ │ │ ├── em_letimer.c │ │ │ ├── em_leuart.c │ │ │ ├── em_mpu.c │ │ │ ├── em_msc.c │ │ │ ├── em_opamp.c │ │ │ ├── em_pcnt.c │ │ │ ├── em_prs.c │ │ │ ├── em_rmu.c │ │ │ ├── em_rtc.c │ │ │ ├── em_system.c │ │ │ ├── em_timer.c │ │ │ ├── em_usart.c │ │ │ ├── em_vcmp.c │ │ │ └── em_wdog.c │ ├── hardware.h │ ├── library_efm32.c │ ├── platform_efm32.c │ ├── segmentlcd.c │ └── segmentlcd.h ├── STM32 │ ├── CMSIS │ │ ├── Device │ │ │ └── ST │ │ │ │ ├── STM32F10x │ │ │ │ ├── Include │ │ │ │ │ ├── stm32f10x.h │ │ │ │ │ └── system_stm32f10x.h │ │ │ │ ├── Release_Notes.html │ │ │ │ └── Source │ │ │ │ │ └── Templates │ │ │ │ │ ├── TASKING │ │ │ │ │ └── cstart_thumb2.asm │ │ │ │ │ ├── TrueSTUDIO │ │ │ │ │ ├── startup_stm32f10x_cl.s │ │ │ │ │ ├── startup_stm32f10x_hd.s │ │ │ │ │ ├── startup_stm32f10x_hd_vl.s │ │ │ │ │ ├── startup_stm32f10x_ld.s │ │ │ │ │ ├── startup_stm32f10x_ld_vl.s │ │ │ │ │ ├── startup_stm32f10x_md.s │ │ │ │ │ ├── startup_stm32f10x_md_vl.s │ │ │ │ │ └── startup_stm32f10x_xl.s │ │ │ │ │ ├── arm │ │ │ │ │ ├── startup_stm32f10x_cl.s │ │ │ │ │ ├── startup_stm32f10x_hd.s │ │ │ │ │ ├── startup_stm32f10x_hd_vl.s │ │ │ │ │ ├── startup_stm32f10x_ld.s │ │ │ │ │ ├── startup_stm32f10x_ld_vl.s │ │ │ │ │ ├── startup_stm32f10x_md.s │ │ │ │ │ ├── startup_stm32f10x_md_vl.s │ │ │ │ │ └── startup_stm32f10x_xl.s │ │ │ │ │ ├── gcc_ride7 │ │ │ │ │ ├── startup_stm32f10x_cl.s │ │ │ │ │ ├── startup_stm32f10x_hd.s │ │ │ │ │ ├── startup_stm32f10x_hd_vl.s │ │ │ │ │ ├── startup_stm32f10x_ld.s │ │ │ │ │ ├── startup_stm32f10x_ld_vl.s │ │ │ │ │ ├── startup_stm32f10x_md.s │ │ │ │ │ ├── startup_stm32f10x_md_vl.s │ │ │ │ │ └── startup_stm32f10x_xl.s │ │ │ │ │ ├── iar │ │ │ │ │ ├── startup_stm32f10x_cl.s │ │ │ │ │ ├── startup_stm32f10x_hd.s │ │ │ │ │ ├── startup_stm32f10x_hd_vl.s │ │ │ │ │ ├── startup_stm32f10x_ld.s │ │ │ │ │ ├── startup_stm32f10x_ld_vl.s │ │ │ │ │ ├── startup_stm32f10x_md.s │ │ │ │ │ ├── startup_stm32f10x_md_vl.s │ │ │ │ │ └── startup_stm32f10x_xl.s │ │ │ │ │ └── system_stm32f10x.c │ │ │ │ └── STM32L1xx │ │ │ │ ├── Include │ │ │ │ ├── stm32l1xx.h │ │ │ │ └── system_stm32l1xx.h │ │ │ │ ├── Release_Notes.html │ │ │ │ └── Source │ │ │ │ └── Templates │ │ │ │ ├── TASKING │ │ │ │ └── cstart_thumb2.asm │ │ │ │ ├── TrueSTUDIO │ │ │ │ ├── startup_stm32l1xx_hd.s │ │ │ │ ├── startup_stm32l1xx_md.s │ │ │ │ └── startup_stm32l1xx_mdp.s │ │ │ │ ├── arm │ │ │ │ ├── startup_stm32l1xx_hd.s │ │ │ │ ├── startup_stm32l1xx_md.s │ │ │ │ └── startup_stm32l1xx_mdp.s │ │ │ │ ├── gcc_ride7 │ │ │ │ ├── startup_stm32l1xx_hd.s │ │ │ │ ├── startup_stm32l1xx_md.s │ │ │ │ └── startup_stm32l1xx_mdp.s │ │ │ │ ├── iar │ │ │ │ ├── startup_stm32l1xx_hd.s │ │ │ │ ├── startup_stm32l1xx_md.s │ │ │ │ └── startup_stm32l1xx_mdp.s │ │ │ │ └── system_stm32l1xx.c │ │ └── Include │ │ │ ├── arm_common_tables.h │ │ │ ├── arm_math.h │ │ │ ├── core_cm0.h │ │ │ ├── core_cm3.h │ │ │ ├── core_cm4.h │ │ │ ├── core_cm4_simd.h │ │ │ ├── core_cmFunc.h │ │ │ └── core_cmInstr.h │ ├── STM32F10x_StdPeriph_Driver │ │ ├── Release_Notes.html │ │ ├── inc │ │ │ ├── misc.h │ │ │ ├── stm32f10x_adc.h │ │ │ ├── stm32f10x_bkp.h │ │ │ ├── stm32f10x_can.h │ │ │ ├── stm32f10x_cec.h │ │ │ ├── stm32f10x_crc.h │ │ │ ├── stm32f10x_dac.h │ │ │ ├── stm32f10x_dbgmcu.h │ │ │ ├── stm32f10x_dma.h │ │ │ ├── stm32f10x_exti.h │ │ │ ├── stm32f10x_flash.h │ │ │ ├── stm32f10x_fsmc.h │ │ │ ├── stm32f10x_gpio.h │ │ │ ├── stm32f10x_i2c.h │ │ │ ├── stm32f10x_iwdg.h │ │ │ ├── stm32f10x_pwr.h │ │ │ ├── stm32f10x_rcc.h │ │ │ ├── stm32f10x_rtc.h │ │ │ ├── stm32f10x_sdio.h │ │ │ ├── stm32f10x_spi.h │ │ │ ├── stm32f10x_tim.h │ │ │ ├── stm32f10x_usart.h │ │ │ └── stm32f10x_wwdg.h │ │ └── src │ │ │ ├── misc.c │ │ │ ├── stm32f10x_adc.c │ │ │ ├── stm32f10x_bkp.c │ │ │ ├── stm32f10x_can.c │ │ │ ├── stm32f10x_cec.c │ │ │ ├── stm32f10x_crc.c │ │ │ ├── stm32f10x_dac.c │ │ │ ├── stm32f10x_dbgmcu.c │ │ │ ├── stm32f10x_dma.c │ │ │ ├── stm32f10x_exti.c │ │ │ ├── stm32f10x_flash.c │ │ │ ├── stm32f10x_fsmc.c │ │ │ ├── stm32f10x_gpio.c │ │ │ ├── stm32f10x_i2c.c │ │ │ ├── stm32f10x_iwdg.c │ │ │ ├── stm32f10x_pwr.c │ │ │ ├── stm32f10x_rcc.c │ │ │ ├── stm32f10x_rtc.c │ │ │ ├── stm32f10x_sdio.c │ │ │ ├── stm32f10x_spi.c │ │ │ ├── stm32f10x_tim.c │ │ │ ├── stm32f10x_usart.c │ │ │ └── stm32f10x_wwdg.c │ ├── STM32L1xx_StdPeriph_Driver │ │ ├── inc │ │ │ ├── misc.h │ │ │ ├── stm32l1xx_adc.h │ │ │ ├── stm32l1xx_aes.h │ │ │ ├── stm32l1xx_comp.h │ │ │ ├── stm32l1xx_crc.h │ │ │ ├── stm32l1xx_dac.h │ │ │ ├── stm32l1xx_dbgmcu.h │ │ │ ├── stm32l1xx_dma.h │ │ │ ├── stm32l1xx_exti.h │ │ │ ├── stm32l1xx_flash.h │ │ │ ├── stm32l1xx_fsmc.h │ │ │ ├── stm32l1xx_gpio.h │ │ │ ├── stm32l1xx_i2c.h │ │ │ ├── stm32l1xx_iwdg.h │ │ │ ├── stm32l1xx_lcd.h │ │ │ ├── stm32l1xx_opamp.h │ │ │ ├── stm32l1xx_pwr.h │ │ │ ├── stm32l1xx_rcc.h │ │ │ ├── stm32l1xx_rtc.h │ │ │ ├── stm32l1xx_sdio.h │ │ │ ├── stm32l1xx_spi.h │ │ │ ├── stm32l1xx_syscfg.h │ │ │ ├── stm32l1xx_tim.h │ │ │ ├── stm32l1xx_usart.h │ │ │ └── stm32l1xx_wwdg.h │ │ └── src │ │ │ ├── misc.c │ │ │ ├── stm32l1xx_adc.c │ │ │ ├── stm32l1xx_aes.c │ │ │ ├── stm32l1xx_aes_util.c │ │ │ ├── stm32l1xx_comp.c │ │ │ ├── stm32l1xx_crc.c │ │ │ ├── stm32l1xx_dac.c │ │ │ ├── stm32l1xx_dbgmcu.c │ │ │ ├── stm32l1xx_dma.c │ │ │ ├── stm32l1xx_exti.c │ │ │ ├── stm32l1xx_flash.c │ │ │ ├── stm32l1xx_flash_ramfunc.c │ │ │ ├── stm32l1xx_fsmc.c │ │ │ ├── stm32l1xx_gpio.c │ │ │ ├── stm32l1xx_i2c.c │ │ │ ├── stm32l1xx_iwdg.c │ │ │ ├── stm32l1xx_lcd.c │ │ │ ├── stm32l1xx_opamp.c │ │ │ ├── stm32l1xx_pwr.c │ │ │ ├── stm32l1xx_rcc.c │ │ │ ├── stm32l1xx_rtc.c │ │ │ ├── stm32l1xx_sdio.c │ │ │ ├── stm32l1xx_spi.c │ │ │ ├── stm32l1xx_syscfg.c │ │ │ ├── stm32l1xx_tim.c │ │ │ ├── stm32l1xx_usart.c │ │ │ └── stm32l1xx_wwdg.c │ ├── hardware.h │ ├── library_stm32.c │ ├── platform_stm32.c │ ├── startup_stm32f10x_hd.s │ ├── stm32f10x_conf.h │ └── system_stm32f10x.c ├── hardware_common.h ├── library_common.c ├── main.c ├── picoC.uvproj └── platform_common.c ├── table.c ├── tests ├── 00_assignment.c ├── 00_assignment.expect ├── 01_comment.c ├── 01_comment.expect ├── 02_printf.c ├── 02_printf.expect ├── 03_struct.c ├── 03_struct.expect ├── 04_for.c ├── 04_for.expect ├── 05_array.c ├── 05_array.expect ├── 06_case.c ├── 06_case.expect ├── 07_function.c ├── 07_function.expect ├── 08_while.c ├── 08_while.expect ├── 09_do_while.c ├── 09_do_while.expect ├── 10_pointer.c ├── 10_pointer.expect ├── 11_precedence.c ├── 11_precedence.expect ├── 12_hashdefine.c ├── 12_hashdefine.expect ├── 13_integer_literals.c ├── 13_integer_literals.expect ├── 14_if.c ├── 14_if.expect ├── 15_recursion.c ├── 15_recursion.expect ├── 16_nesting.c ├── 16_nesting.expect ├── 17_enum.c ├── 17_enum.expect ├── 18_include.c ├── 18_include.expect ├── 18_include.h ├── 19_pointer_arithmetic.c ├── 19_pointer_arithmetic.expect ├── 20_pointer_comparison.c ├── 20_pointer_comparison.expect ├── 21_char_array.c ├── 21_char_array.expect ├── 22_floating_point.c ├── 22_floating_point.expect ├── 23_type_coercion.c ├── 23_type_coercion.expect ├── 24_math_library.c ├── 24_math_library.expect ├── 25_quicksort.c ├── 25_quicksort.expect ├── 26_character_constants.c ├── 26_character_constants.expect ├── 27_sizeof.c ├── 27_sizeof.expect ├── 28_strings.c ├── 28_strings.expect ├── 29_array_address.c ├── 29_array_address.expect ├── 30_hanoi.c ├── 30_hanoi.expect ├── 31_args.c ├── 31_args.expect ├── 32_led.c ├── 32_led.expect ├── 33_ternary_op.c ├── 33_ternary_op.expect ├── 34_array_assignment.c ├── 34_array_assignment.expect ├── 35_sizeof.c ├── 35_sizeof.expect ├── 36_array_initialisers.c ├── 36_array_initialisers.expect ├── 37_sprintf.c ├── 37_sprintf.expect ├── 38_multiple_array_index.c ├── 38_multiple_array_index.expect ├── 39_typedef.c ├── 39_typedef.expect ├── 40_stdio.c ├── 40_stdio.expect ├── 41_hashif.c ├── 41_hashif.expect ├── 42_function_pointer.c ├── 43_void_param.c ├── 43_void_param.expect ├── 44_scoped_declarations.c ├── 44_scoped_declarations.expect ├── 45_empty_for.c ├── 45_empty_for.expect ├── 46_grep.c ├── 47_switch_return.c ├── 47_switch_return.expect ├── 48_nested_break.c ├── 48_nested_break.expect ├── 49_bracket_evaluation.c ├── 49_bracket_evaluation.expect ├── 50_logical_second_arg.c ├── 50_logical_second_arg.expect ├── 51_static.c ├── 51_static.expect ├── 52_unnamed_enum.c ├── 52_unnamed_enum.expect ├── 54_goto.c ├── 54_goto.expect ├── 55_array_initialiser.c ├── 55_array_initialiser.expect ├── 56_cross_structure.c ├── 56_cross_structure.expect └── Makefile ├── type.c └── variable.c /Makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | CFLAGS=-Wall -pedantic -g -DUNIX_HOST -DVER=\"`svnversion -n`\" 3 | LIBS=-lm -lreadline 4 | 5 | TARGET = picoc 6 | SRCS = picoc.c table.c lex.c parse.c expression.c heap.c type.c \ 7 | variable.c clibrary.c platform.c include.c debug.c \ 8 | platform/platform_unix.c platform/library_unix.c \ 9 | cstdlib/stdio.c cstdlib/math.c cstdlib/string.c cstdlib/stdlib.c \ 10 | cstdlib/time.c cstdlib/errno.c cstdlib/ctype.c cstdlib/stdbool.c \ 11 | cstdlib/unistd.c 12 | OBJS := $(SRCS:%.c=%.o) 13 | 14 | all: $(TARGET) 15 | 16 | $(TARGET): $(OBJS) 17 | $(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(LIBS) 18 | 19 | test: all 20 | (cd tests; make test) 21 | 22 | clean: 23 | rm -f $(TARGET) $(OBJS) *~ 24 | 25 | count: 26 | @echo "Core:" 27 | @cat picoc.h interpreter.h picoc.c table.c lex.c parse.c expression.c platform.c heap.c type.c variable.c include.c debug.c | grep -v '^[ ]*/\*' | grep -v '^[ ]*$$' | wc 28 | @echo "" 29 | @echo "Everything:" 30 | @cat $(SRCS) *.h */*.h | wc 31 | 32 | .PHONY: clibrary.c 33 | 34 | picoc.o: picoc.c picoc.h 35 | table.o: table.c interpreter.h platform.h 36 | lex.o: lex.c interpreter.h platform.h 37 | parse.o: parse.c picoc.h interpreter.h platform.h 38 | expression.o: expression.c interpreter.h platform.h 39 | heap.o: heap.c interpreter.h platform.h 40 | type.o: type.c interpreter.h platform.h 41 | variable.o: variable.c interpreter.h platform.h 42 | clibrary.o: clibrary.c picoc.h interpreter.h platform.h 43 | platform.o: platform.c picoc.h interpreter.h platform.h 44 | include.o: include.c picoc.h interpreter.h platform.h 45 | debug.o: debug.c interpreter.h platform.h 46 | platform/platform_unix.o: platform/platform_unix.c picoc.h interpreter.h platform.h 47 | platform/library_unix.o: platform/library_unix.c interpreter.h platform.h 48 | cstdlib/stdio.o: cstdlib/stdio.c interpreter.h platform.h 49 | cstdlib/math.o: cstdlib/math.c interpreter.h platform.h 50 | cstdlib/string.o: cstdlib/string.c interpreter.h platform.h 51 | cstdlib/stdlib.o: cstdlib/stdlib.c interpreter.h platform.h 52 | cstdlib/time.o: cstdlib/time.c interpreter.h platform.h 53 | cstdlib/errno.o: cstdlib/errno.c interpreter.h platform.h 54 | cstdlib/ctype.o: cstdlib/ctype.c interpreter.h platform.h 55 | cstdlib/stdbool.o: cstdlib/stdbool.c interpreter.h platform.h 56 | cstdlib/unistd.o: cstdlib/unistd.c interpreter.h platform.h 57 | -------------------------------------------------------------------------------- /cstdlib/stdbool.c: -------------------------------------------------------------------------------- 1 | /* string.h library for large systems - small embedded systems use clibrary.c instead */ 2 | #include "../interpreter.h" 3 | 4 | #ifndef BUILTIN_MINI_STDLIB 5 | 6 | static int trueValue = 1; 7 | static int falseValue = 0; 8 | 9 | 10 | /* structure definitions */ 11 | const char StdboolDefs[] = "typedef int bool;"; 12 | 13 | /* creates various system-dependent definitions */ 14 | void StdboolSetupFunc(Picoc *pc) 15 | { 16 | /* defines */ 17 | VariableDefinePlatformVar(pc, NULL, "true", &pc->IntType, (union AnyValue *)&trueValue, FALSE); 18 | VariableDefinePlatformVar(pc, NULL, "false", &pc->IntType, (union AnyValue *)&falseValue, FALSE); 19 | VariableDefinePlatformVar(pc, NULL, "__bool_true_false_are_defined", &pc->IntType, (union AnyValue *)&trueValue, FALSE); 20 | } 21 | 22 | #endif /* !BUILTIN_MINI_STDLIB */ 23 | -------------------------------------------------------------------------------- /msvc/picoc/picoc.sdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/x893/picoC/a1b6e72b1a4ed7c35412a3232078323b64db44d7/msvc/picoc/picoc.sdf -------------------------------------------------------------------------------- /msvc/picoc/picoc.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 11 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "picoc", "picoc.vcxproj", "{C0156FB3-55AB-4F82-8A97-A776DFC57951}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {C0156FB3-55AB-4F82-8A97-A776DFC57951}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {C0156FB3-55AB-4F82-8A97-A776DFC57951}.Debug|Win32.Build.0 = Debug|Win32 14 | {C0156FB3-55AB-4F82-8A97-A776DFC57951}.Release|Win32.ActiveCfg = Release|Win32 15 | {C0156FB3-55AB-4F82-8A97-A776DFC57951}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /msvc/picoc/picoc.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/x893/picoC/a1b6e72b1a4ed7c35412a3232078323b64db44d7/msvc/picoc/picoc.suo -------------------------------------------------------------------------------- /msvc/picoc/picoc.v11.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/x893/picoC/a1b6e72b1a4ed7c35412a3232078323b64db44d7/msvc/picoc/picoc.v11.suo -------------------------------------------------------------------------------- /msvc/picoc/picoc.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -i 5 | WindowsLocalDebugger 6 | 7 | -------------------------------------------------------------------------------- /picoc.h: -------------------------------------------------------------------------------- 1 | /* picoc external interface. This should be the only header you need to use if 2 | * you're using picoc as a library. Internal details are in interpreter.h */ 3 | #ifndef PICOC_H 4 | #define PICOC_H 5 | 6 | /* picoc version number */ 7 | #ifdef VER 8 | #define PICOC_VERSION "v2.2 beta r" VER /* VER is the subversion version number, obtained via the Makefile */ 9 | #else 10 | #define PICOC_VERSION "v2.2" 11 | #endif 12 | 13 | /* handy definitions */ 14 | #ifndef TRUE 15 | #define TRUE 1 16 | #define FALSE 0 17 | #endif 18 | 19 | #include "interpreter.h" 20 | 21 | 22 | #if defined(UNIX_HOST) || defined(WIN32) 23 | #include 24 | 25 | /* this has to be a macro, otherwise errors will occur due to the stack being corrupt */ 26 | #define PicocPlatformSetExitPoint(pc) setjmp((pc)->PicocExitBuf) 27 | #else 28 | #ifdef SURVEYOR_HOST 29 | /* mark where to end the program for platforms which require this */ 30 | extern int PicocExitBuf[]; 31 | 32 | #define PicocPlatformSetExitPoint(pc) setjmp((pc)->PicocExitBuf) 33 | #else 34 | #ifdef EMBEDDED_HOST 35 | /* mark where to end the program for platforms which require this */ 36 | #define PicocPlatformSetExitPoint(pc) setjmp((pc)->PicocExitBuf) 37 | #endif 38 | #endif 39 | #endif 40 | 41 | /* parse.c */ 42 | void PicocParse(Picoc *pc, const char *FileName, const char *Source, int SourceLen, int RunIt, int CleanupNow, int CleanupSource, int EnableDebugger); 43 | void PicocParseInteractive(Picoc *pc); 44 | 45 | /* platform.c */ 46 | void PicocCallMain(Picoc *pc, int argc, char **argv); 47 | void PicocInitialise(Picoc *pc, int StackSize); 48 | void PicocCleanup(Picoc *pc); 49 | void PicocPlatformScanFile(Picoc *pc, const char *FileName); 50 | 51 | /* include.c */ 52 | void PicocIncludeAllSystemHeaders(Picoc *pc); 53 | 54 | #endif /* PICOC_H */ 55 | -------------------------------------------------------------------------------- /platform/library_ffox.c: -------------------------------------------------------------------------------- 1 | #include "../interpreter.h" 2 | 3 | /* list of all library functions and their prototypes */ 4 | struct LibraryFunction PlatformLibrary[] = 5 | { 6 | { NULL, NULL } 7 | }; 8 | 9 | void PlatformLibraryInit() 10 | { 11 | LibraryAdd(&GlobalTable, "platform library", &PlatformLibrary); 12 | } 13 | 14 | -------------------------------------------------------------------------------- /platform/library_msvc.c: -------------------------------------------------------------------------------- 1 | #include "../interpreter.h" 2 | 3 | void MsvcSetupFunc(Picoc *pc) 4 | { 5 | } 6 | 7 | void CTest (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) 8 | { 9 | printf("test(%d)\n", Param[0]->Val->Integer); 10 | Param[0]->Val->Integer = 1234; 11 | } 12 | 13 | void CLineNo (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) 14 | { 15 | ReturnValue->Val->Integer = Parser->Line; 16 | } 17 | 18 | /* list of all library functions and their prototypes */ 19 | struct LibraryFunction MsvcFunctions[] = 20 | { 21 | { CTest, "void Test(int);" }, 22 | { CLineNo, "int LineNo();" }, 23 | { NULL, NULL } 24 | }; 25 | 26 | void PlatformLibraryInit(Picoc *pc) 27 | { 28 | IncludeRegister(pc, "picoc_msvc.h", &MsvcSetupFunc, &MsvcFunctions[0], NULL); 29 | } 30 | 31 | -------------------------------------------------------------------------------- /platform/library_unix.c: -------------------------------------------------------------------------------- 1 | #include "../interpreter.h" 2 | 3 | void UnixSetupFunc() 4 | { 5 | } 6 | 7 | void Ctest (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) 8 | { 9 | printf("test(%d)\n", Param[0]->Val->Integer); 10 | Param[0]->Val->Integer = 1234; 11 | } 12 | 13 | void Clineno (struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs) 14 | { 15 | ReturnValue->Val->Integer = Parser->Line; 16 | } 17 | 18 | /* list of all library functions and their prototypes */ 19 | struct LibraryFunction UnixFunctions[] = 20 | { 21 | { Ctest, "void test(int);" }, 22 | { Clineno, "int lineno();" }, 23 | { NULL, NULL } 24 | }; 25 | 26 | void PlatformLibraryInit(Picoc *pc) 27 | { 28 | IncludeRegister(pc, "picoc_unix.h", &UnixSetupFunc, &UnixFunctions[0], NULL); 29 | } 30 | -------------------------------------------------------------------------------- /platform/platform_ffox.c: -------------------------------------------------------------------------------- 1 | #include "../interpreter.h" 2 | 3 | /* deallocate any storage */ 4 | void PlatformCleanup() 5 | { 6 | } 7 | 8 | /* get a line of interactive input */ 9 | char *PlatformGetLine(char *Buf, int MaxLen) 10 | { 11 | // XXX - unimplemented so far 12 | return NULL; 13 | } 14 | 15 | /* get a character of interactive input */ 16 | int PlatformGetCharacter() 17 | { 18 | // XXX - unimplemented so far 19 | return 0; 20 | } 21 | 22 | /* write a character to the console */ 23 | void PlatformPutc(unsigned char OutCh, union OutputStreamInfo *Stream) 24 | { 25 | // XXX - unimplemented so far 26 | } 27 | 28 | /* read a file into memory */ 29 | char *PlatformReadFile(const char *FileName) 30 | { 31 | // XXX - unimplemented so far 32 | return NULL; 33 | } 34 | 35 | /* read and scan a file for definitions */ 36 | void PlatformScanFile(const char *FileName) 37 | { 38 | char *SourceStr = PlatformReadFile(FileName); 39 | Parse(FileName, SourceStr, strlen(SourceStr), TRUE); 40 | //free(SourceStr); 41 | } 42 | 43 | /* mark where to end the program for platforms which require this */ 44 | jmp_buf ExitBuf; 45 | 46 | /* exit the program */ 47 | void PlatformExit() 48 | { 49 | longjmp(ExitBuf, 1); 50 | } 51 | 52 | -------------------------------------------------------------------------------- /platform/platform_msvc.c: -------------------------------------------------------------------------------- 1 | #include "../picoc.h" 2 | #include "../interpreter.h" 3 | 4 | /* mark where to end the program for platforms which require this */ 5 | jmp_buf PicocExitBuf; 6 | 7 | void PlatformInit(Picoc *pc) 8 | { 9 | } 10 | 11 | void PlatformCleanup(Picoc *pc) 12 | { 13 | } 14 | 15 | /* get a line of interactive input */ 16 | char *PlatformGetLine(char *Buf, int MaxLen, const char *Prompt) 17 | { 18 | if (Prompt != NULL) 19 | printf("%s", Prompt); 20 | 21 | fflush(stdout); 22 | return fgets(Buf, MaxLen, stdin); 23 | } 24 | 25 | /* get a character of interactive input */ 26 | int PlatformGetCharacter() 27 | { 28 | fflush(stdout); 29 | return getchar(); 30 | } 31 | 32 | /* write a character to the console */ 33 | void PlatformPutc(unsigned char OutCh, union OutputStreamInfo *Stream) 34 | { 35 | putchar(OutCh); 36 | } 37 | 38 | /* read a file into memory */ 39 | char *PlatformReadFile(Picoc *pc, const char *FileName) 40 | { 41 | struct stat FileInfo; 42 | char *ReadText; 43 | FILE *InFile; 44 | int BytesRead; 45 | char *p; 46 | 47 | if (stat(FileName, &FileInfo)) 48 | ProgramFailNoParser(pc, "can't read file %s\n", FileName); 49 | 50 | ReadText = (char*)malloc(FileInfo.st_size + 1); 51 | if (ReadText == NULL) 52 | ProgramFailNoParser(pc, "out of memory\n"); 53 | 54 | InFile = fopen(FileName, "r"); 55 | if (InFile == NULL) 56 | ProgramFailNoParser(pc, "can't read file %s\n", FileName); 57 | 58 | BytesRead = fread(ReadText, 1, FileInfo.st_size, InFile); 59 | if (BytesRead == 0) 60 | ProgramFailNoParser(pc, "can't read file %s\n", FileName); 61 | 62 | ReadText[BytesRead] = '\0'; 63 | fclose(InFile); 64 | 65 | if ((ReadText[0] == '#') && (ReadText[1] == '!')) 66 | { 67 | for (p = ReadText; (*p != '\r') && (*p != '\n'); ++p) 68 | { 69 | *p = ' '; 70 | } 71 | } 72 | 73 | return ReadText; 74 | } 75 | 76 | /* read and scan a file for definitions */ 77 | void PicocPlatformScanFile(Picoc *pc, const char *FileName) 78 | { 79 | char *SourceStr = PlatformReadFile(pc, FileName); 80 | PicocParse(pc, FileName, SourceStr, strlen(SourceStr), TRUE, FALSE, TRUE, TRUE); 81 | } 82 | 83 | /* exit the program */ 84 | void PlatformExit(Picoc *pc, int RetVal) 85 | { 86 | pc->PicocExitValue = RetVal; 87 | longjmp(pc->PicocExitBuf, 1); 88 | } 89 | -------------------------------------------------------------------------------- /platform/platform_surveyor.c: -------------------------------------------------------------------------------- 1 | #include "../interpreter.h" 2 | #include "../picoc.h" 3 | 4 | /* mark where to end the program for platforms which require this */ 5 | int PicocExitBuf[41]; 6 | 7 | /* deallocate any storage */ 8 | void PlatformCleanup() 9 | { 10 | } 11 | 12 | /* get a line of interactive input */ 13 | char *PlatformGetLine(char *Buf, int MaxLen, const char *Prompt) 14 | { 15 | int ix; 16 | char ch, *cp; 17 | 18 | printf(Prompt); 19 | 20 | ix = 0; 21 | cp = 0; 22 | 23 | // If the first character is \n or \r, eat it 24 | ch = getch(); 25 | if (ch == '\n' || ch == '\r') 26 | { 27 | // And get the next character 28 | ch = getch(); 29 | } 30 | 31 | while (ix++ < MaxLen) { 32 | 33 | if (ch == 0x1B || ch == 0x03) { // ESC character or ctrl-c (to avoid problem with TeraTerm) - exit 34 | printf("Leaving PicoC\n"); 35 | return NULL; 36 | } 37 | if (ch == '\n') { 38 | *cp++ = '\n'; // if newline, send newline character followed by null 39 | *cp = 0; 40 | return Buf; 41 | } 42 | *cp++ = ch; 43 | ix++; 44 | ch = getch(); 45 | } 46 | return NULL; 47 | } 48 | 49 | /* write a character to the console */ 50 | void PlatformPutc(unsigned char OutCh, union OutputStreamInfo *Stream) 51 | { 52 | if (OutCh == '\n') 53 | putchar('\r'); 54 | 55 | putchar(OutCh); 56 | } 57 | 58 | /* read a character */ 59 | int PlatformGetCharacter() 60 | { 61 | return getch(); 62 | } 63 | 64 | /* exit the program */ 65 | void PlatformExit(int RetVal) 66 | { 67 | PicocExitValue = RetVal; 68 | PicocExitBuf[40] = 1; 69 | longjmp(PicocExitBuf, 1); 70 | } 71 | 72 | -------------------------------------------------------------------------------- /ports/.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Eclipse 3 | ################# 4 | 5 | *.pydevproject 6 | .project 7 | .metadata 8 | bin/ 9 | tmp/ 10 | *.tmp 11 | *.bak 12 | *.swp 13 | *~.nib 14 | local.properties 15 | .classpath 16 | .settings/ 17 | .loadpath 18 | 19 | # External tool builders 20 | .externalToolBuilders/ 21 | 22 | # Locally stored "Eclipse launch configurations" 23 | *.launch 24 | 25 | # CDT-specific 26 | .cproject 27 | 28 | # PDT-specific 29 | .buildpath 30 | 31 | 32 | ################# 33 | ## Visual Studio 34 | ################# 35 | 36 | ## Ignore Visual Studio temporary files, build results, and 37 | ## files generated by popular Visual Studio add-ons. 38 | 39 | # User-specific files 40 | *.suo 41 | *.user 42 | *.sln.docstates 43 | 44 | # Build results 45 | [Dd]ebug/ 46 | [Rr]elease/ 47 | *_i.c 48 | *_p.c 49 | *.ilk 50 | *.meta 51 | *.obj 52 | *.pch 53 | *.pdb 54 | *.pgc 55 | *.pgd 56 | *.rsp 57 | *.sbr 58 | *.tlb 59 | *.tli 60 | *.tlh 61 | *.tmp 62 | *.vspscc 63 | .builds 64 | *.dotCover 65 | 66 | ## TODO: If you have NuGet Package Restore enabled, uncomment this 67 | #packages/ 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | 76 | # Visual Studio profiler 77 | *.psess 78 | *.vsp 79 | 80 | # ReSharper is a .NET coding add-in 81 | _ReSharper* 82 | 83 | # Installshield output folder 84 | [Ee]xpress 85 | 86 | # DocProject is a documentation generator add-in 87 | DocProject/buildhelp/ 88 | DocProject/Help/*.HxT 89 | DocProject/Help/*.HxC 90 | DocProject/Help/*.hhc 91 | DocProject/Help/*.hhk 92 | DocProject/Help/*.hhp 93 | DocProject/Help/Html2 94 | DocProject/Help/html 95 | 96 | # Click-Once directory 97 | publish 98 | 99 | # Others 100 | [Bb]in 101 | [Oo]bj 102 | sql 103 | TestResults 104 | *.Cache 105 | ClientBin 106 | stylecop.* 107 | ~$* 108 | *.dbmdl 109 | Generated_Code #added for RIA/Silverlight projects 110 | 111 | # Backup & report files from converting an old project file to a newer 112 | # Visual Studio version. Backup files are not needed, because we have git ;-) 113 | _UpgradeReport_Files/ 114 | Backup*/ 115 | UpgradeLog*.XML 116 | 117 | 118 | 119 | ############ 120 | ## Windows 121 | ############ 122 | 123 | # Windows image file caches 124 | Thumbs.db 125 | 126 | # Folder config file 127 | Desktop.ini 128 | 129 | 130 | ############# 131 | ## Python 132 | ############# 133 | 134 | *.py[co] 135 | 136 | # Packages 137 | *.egg 138 | *.egg-info 139 | dist 140 | build 141 | eggs 142 | parts 143 | bin 144 | var 145 | sdist 146 | develop-eggs 147 | .installed.cfg 148 | 149 | # Installer logs 150 | pip-log.txt 151 | 152 | # Unit test / coverage reports 153 | .coverage 154 | .tox 155 | 156 | #Translations 157 | *.mo 158 | 159 | #Mr Developer 160 | .mr.developer.cfg 161 | 162 | # Mac crap 163 | .DS_Store 164 | 165 | ############# 166 | ## Keil 167 | ############# 168 | *.dep 169 | *.bak 170 | *.lst 171 | *.d 172 | *.crf 173 | *.map 174 | *.plg 175 | *.idx 176 | *.uvopt 177 | *.uvgui.* 178 | *.__i 179 | *._ia 180 | *.tra 181 | *.lnp 182 | *.axf 183 | *Log.txt 184 | *Settings.ini 185 | [Bb]uild/ 186 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32G/Include/efm32.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief CMSIS Cortex-M0/M3 Peripheral Access Layer for EFM32 device series 4 | * 5 | * This is a convenience header file for defining the EFM32 part number on the 6 | * build command line, instead of specifying the part specific header file. 7 | * @verbatim 8 | * Example: Add "-DEFM32G890F128" to your build options, to define part 9 | * Add "#include "efm32.h" to your source files 10 | * @endverbatim 11 | * @author Energy Micro AS 12 | * @version 3.0.2 13 | ****************************************************************************** 14 | * @section License 15 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 16 | ****************************************************************************** 17 | * 18 | * Permission is granted to anyone to use this software for any purpose, 19 | * including commercial applications, and to alter it and redistribute it 20 | * freely, subject to the following restrictions: 21 | * 22 | * 1. The origin of this software must not be misrepresented; you must not 23 | * claim that you wrote the original software. 24 | * 2. Altered source versions must be plainly marked as such, and must not be 25 | * misrepresented as being the original software. 26 | * 3. This notice may not be removed or altered from any source distribution. 27 | * 28 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 29 | * obligation to support this Software. Energy Micro AS is providing the 30 | * Software "AS IS", with no express or implied warranties of any kind, 31 | * including, but not limited to, any implied warranties of merchantability 32 | * or fitness for any particular purpose or warranties against infringement 33 | * of any proprietary rights of a third party. 34 | * 35 | * Energy Micro AS will not be liable for any consequential, incidental, or 36 | * special damages, or any other relief, or for any claim by any third party, 37 | * arising from your use of this Software. 38 | * 39 | *****************************************************************************/ 40 | 41 | #ifndef __EFM32_H 42 | #define __EFM32_H 43 | 44 | /* This file is kept for backwards compability. */ 45 | 46 | #include "em_device.h" 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32G/Include/efm32g_calibrate.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32g_calibrate Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @defgroup EFM32G_CALIBRATE 35 | * @{ 36 | *****************************************************************************/ 37 | #define CALIBRATE_MAX_REGISTERS 50 /**< Max number of address/value pairs for calibration */ 38 | 39 | typedef struct 40 | { 41 | __I uint32_t ADDRESS; /**< Address of calibration register */ 42 | __I uint32_t VALUE; /**< Default value for calibration register */ 43 | } CALIBRATE_TypeDef; /** @} */ 44 | 45 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32G/Include/efm32g_dma_ch.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32g_dma_.h Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief DMA_CH EFM32G DMA CH 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTRL; /**< Channel Control Register */ 39 | } DMA_CH_TypeDef; 40 | 41 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32G/Include/efm32g_dma_descriptor.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32g_dma_descriptor Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @defgroup EFM32G_DMA_DESCRIPTOR 35 | * @{ 36 | *****************************************************************************/ 37 | typedef struct 38 | { 39 | /* Note! Use of double __IO (volatile) qualifier to ensure that both */ 40 | /* pointer and referenced memory are declared volatile. */ 41 | __IO void * __IO SRCEND; /**< DMA source address end */ 42 | __IO void * __IO DSTEND; /**< DMA destination address end */ 43 | __IO uint32_t CTRL; /**< DMA control register */ 44 | __IO uint32_t USER; /**< DMA padding register, available for user */ 45 | } DMA_DESCRIPTOR_TypeDef; /** @} */ 46 | 47 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32G/Include/efm32g_gpio_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32g_gpio_p Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief GPIO_P EFM32G GPIO P 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTRL; /**< Port Control Register */ 39 | __IO uint32_t MODEL; /**< Port Pin Mode Low Register */ 40 | __IO uint32_t MODEH; /**< Port Pin Mode High Register */ 41 | __IO uint32_t DOUT; /**< Port Data Out Register */ 42 | __O uint32_t DOUTSET; /**< Port Data Out Set Register */ 43 | __O uint32_t DOUTCLR; /**< Port Data Out Clear Register */ 44 | __O uint32_t DOUTTGL; /**< Port Data Out Toggle Register */ 45 | __I uint32_t DIN; /**< Port Data In Register */ 46 | __IO uint32_t PINLOCKN; /**< Port Unlocked Pins Register */ 47 | } GPIO_P_TypeDef; 48 | 49 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32G/Include/efm32g_prs_ch.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32g_prs_.h Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief PRS_CH EFM32G PRS CH 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTRL; /**< Channel Control Register */ 39 | } PRS_CH_TypeDef; 40 | 41 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32G/Include/efm32g_timer_cc.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32g_timer_cc Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief TIMER_CC EFM32G TIMER CC 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTRL; /**< CC Channel Control Register */ 39 | __IO uint32_t CCV; /**< CC Channel Value Register */ 40 | __I uint32_t CCVP; /**< CC Channel Value Peek Register */ 41 | __IO uint32_t CCVB; /**< CC Channel Buffer Register */ 42 | } TIMER_CC_TypeDef; 43 | 44 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32GG/Include/efm32.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief CMSIS Cortex-M0/M3 Peripheral Access Layer for EFM32 device series 4 | * 5 | * This is a convenience header file for defining the EFM32 part number on the 6 | * build command line, instead of specifying the part specific header file. 7 | * @verbatim 8 | * Example: Add "-DEFM32G890F128" to your build options, to define part 9 | * Add "#include "efm32.h" to your source files 10 | * @endverbatim 11 | * @author Energy Micro AS 12 | * @version 3.0.2 13 | ****************************************************************************** 14 | * @section License 15 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 16 | ****************************************************************************** 17 | * 18 | * Permission is granted to anyone to use this software for any purpose, 19 | * including commercial applications, and to alter it and redistribute it 20 | * freely, subject to the following restrictions: 21 | * 22 | * 1. The origin of this software must not be misrepresented; you must not 23 | * claim that you wrote the original software. 24 | * 2. Altered source versions must be plainly marked as such, and must not be 25 | * misrepresented as being the original software. 26 | * 3. This notice may not be removed or altered from any source distribution. 27 | * 28 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 29 | * obligation to support this Software. Energy Micro AS is providing the 30 | * Software "AS IS", with no express or implied warranties of any kind, 31 | * including, but not limited to, any implied warranties of merchantability 32 | * or fitness for any particular purpose or warranties against infringement 33 | * of any proprietary rights of a third party. 34 | * 35 | * Energy Micro AS will not be liable for any consequential, incidental, or 36 | * special damages, or any other relief, or for any claim by any third party, 37 | * arising from your use of this Software. 38 | * 39 | *****************************************************************************/ 40 | 41 | #ifndef __EFM32_H 42 | #define __EFM32_H 43 | 44 | /* This file is kept for backwards compability. */ 45 | 46 | #include "em_device.h" 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32GG/Include/efm32gg_burtc_ret.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32gg_burtc_ret Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief BURTC_RET EFM32GG BURTC RET 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t REG; /**< Retention register */ 39 | } BURTC_RET_TypeDef; 40 | 41 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32GG/Include/efm32gg_calibrate.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32gg_calibrate Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @defgroup EFM32GG_CALIBRATE 35 | * @{ 36 | *****************************************************************************/ 37 | #define CALIBRATE_MAX_REGISTERS 50 /**< Max number of address/value pairs for calibration */ 38 | 39 | typedef struct 40 | { 41 | __I uint32_t ADDRESS; /**< Address of calibration register */ 42 | __I uint32_t VALUE; /**< Default value for calibration register */ 43 | } CALIBRATE_TypeDef; /** @} */ 44 | 45 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32GG/Include/efm32gg_dma_ch.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32gg_dma_.h Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief DMA_CH EFM32GG DMA CH 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTRL; /**< Channel Control Register */ 39 | } DMA_CH_TypeDef; 40 | 41 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32GG/Include/efm32gg_dma_descriptor.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32gg_dma_descriptor Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @defgroup EFM32GG_DMA_DESCRIPTOR 35 | * @{ 36 | *****************************************************************************/ 37 | typedef struct 38 | { 39 | /* Note! Use of double __IO (volatile) qualifier to ensure that both */ 40 | /* pointer and referenced memory are declared volatile. */ 41 | __IO void * __IO SRCEND; /**< DMA source address end */ 42 | __IO void * __IO DSTEND; /**< DMA destination address end */ 43 | __IO uint32_t CTRL; /**< DMA control register */ 44 | __IO uint32_t USER; /**< DMA padding register, available for user */ 45 | } DMA_DESCRIPTOR_TypeDef; /** @} */ 46 | 47 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32GG/Include/efm32gg_gpio_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32gg_gpio_p Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief GPIO_P EFM32GG GPIO P 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTRL; /**< Port Control Register */ 39 | __IO uint32_t MODEL; /**< Port Pin Mode Low Register */ 40 | __IO uint32_t MODEH; /**< Port Pin Mode High Register */ 41 | __IO uint32_t DOUT; /**< Port Data Out Register */ 42 | __O uint32_t DOUTSET; /**< Port Data Out Set Register */ 43 | __O uint32_t DOUTCLR; /**< Port Data Out Clear Register */ 44 | __O uint32_t DOUTTGL; /**< Port Data Out Toggle Register */ 45 | __I uint32_t DIN; /**< Port Data In Register */ 46 | __IO uint32_t PINLOCKN; /**< Port Unlocked Pins Register */ 47 | } GPIO_P_TypeDef; 48 | 49 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32GG/Include/efm32gg_lesense_buf.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32gg_lesense_buf Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief LESENSE_BUF EFM32GG LESENSE BUF 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t DATA; /**< Scan results */ 39 | } LESENSE_BUF_TypeDef; 40 | 41 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32GG/Include/efm32gg_lesense_ch.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32gg_lesense_.h Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief LESENSE_CH EFM32GG LESENSE CH 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t TIMING; /**< Scan configuration */ 39 | __IO uint32_t INTERACT; /**< Scan configuration */ 40 | __IO uint32_t EVAL; /**< Scan configuration */ 41 | 42 | uint32_t RESERVED0[1]; /**< Reserved future */ 43 | } LESENSE_CH_TypeDef; 44 | 45 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32GG/Include/efm32gg_lesense_st.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32gg_lesense_st Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief LESENSE_ST EFM32GG LESENSE ST 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t TCONFA; /**< State transition configuration A */ 39 | __IO uint32_t TCONFB; /**< State transition configuration B */ 40 | } LESENSE_ST_TypeDef; 41 | 42 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32GG/Include/efm32gg_prs_ch.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32gg_prs_.h Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief PRS_CH EFM32GG PRS CH 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTRL; /**< Channel Control Register */ 39 | } PRS_CH_TypeDef; 40 | 41 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32GG/Include/efm32gg_timer_cc.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32gg_timer_cc Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief TIMER_CC EFM32GG TIMER CC 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTRL; /**< CC Channel Control Register */ 39 | __IO uint32_t CCV; /**< CC Channel Value Register */ 40 | __I uint32_t CCVP; /**< CC Channel Value Peek Register */ 41 | __IO uint32_t CCVB; /**< CC Channel Buffer Register */ 42 | } TIMER_CC_TypeDef; 43 | 44 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32GG/Include/efm32gg_usb_diep.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32gg_usb_diep Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief USB_DIEP EFM32GG USB DIEP 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTL; /**< Device IN Endpoint x+1 Control Register */ 39 | uint32_t RESERVED0[1]; /**< Reserved for future use **/ 40 | __IO uint32_t INT; /**< Device IN Endpoint x+1 Interrupt Register */ 41 | uint32_t RESERVED1[1]; /**< Reserved for future use **/ 42 | __IO uint32_t TSIZ; /**< Device IN Endpoint x+1 Transfer Size Register */ 43 | __IO uint32_t DMAADDR; /**< Device IN Endpoint x+1 DMA Address Register */ 44 | __I uint32_t TXFSTS; /**< Device IN Endpoint x+1 Transmit FIFO Status Register */ 45 | 46 | uint32_t RESERVED2[1]; /**< Reserved future */ 47 | } USB_DIEP_TypeDef; 48 | 49 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32GG/Include/efm32gg_usb_doep.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32gg_usb_doep Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief USB_DOEP EFM32GG USB DOEP 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTL; /**< Device OUT Endpoint x+1 Control Register */ 39 | uint32_t RESERVED0[1]; /**< Reserved for future use **/ 40 | __IO uint32_t INT; /**< Device OUT Endpoint x+1 Interrupt Register */ 41 | uint32_t RESERVED1[1]; /**< Reserved for future use **/ 42 | __IO uint32_t TSIZ; /**< Device OUT Endpoint x+1 Transfer Size Register */ 43 | __IO uint32_t DMAADDR; /**< Device OUT Endpoint x+1 DMA Address Register */ 44 | 45 | uint32_t RESERVED2[2]; /**< Reserved future */ 46 | } USB_DOEP_TypeDef; 47 | 48 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32GG/Include/efm32gg_usb_hc.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32gg_usbc.h Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief USB_HC EFM32GG USB HC 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CHAR; /**< Host Channel x Characteristics Register */ 39 | uint32_t RESERVED0[1]; /**< Reserved for future use **/ 40 | __IO uint32_t INT; /**< Host Channel x Interrupt Register */ 41 | __IO uint32_t INTMSK; /**< Host Channel x Interrupt Mask Register */ 42 | __IO uint32_t TSIZ; /**< Host Channel x Transfer Size Register */ 43 | __IO uint32_t DMAADDR; /**< Host Channel x DMA Address Register */ 44 | 45 | uint32_t RESERVED1[2]; /**< Reserved future */ 46 | } USB_HC_TypeDef; 47 | 48 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32LG/Include/efm32.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief CMSIS Cortex-M0/M3 Peripheral Access Layer for EFM32 device series 4 | * 5 | * This is a convenience header file for defining the EFM32 part number on the 6 | * build command line, instead of specifying the part specific header file. 7 | * @verbatim 8 | * Example: Add "-DEFM32G890F128" to your build options, to define part 9 | * Add "#include "efm32.h" to your source files 10 | * @endverbatim 11 | * @author Energy Micro AS 12 | * @version 3.0.2 13 | ****************************************************************************** 14 | * @section License 15 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 16 | ****************************************************************************** 17 | * 18 | * Permission is granted to anyone to use this software for any purpose, 19 | * including commercial applications, and to alter it and redistribute it 20 | * freely, subject to the following restrictions: 21 | * 22 | * 1. The origin of this software must not be misrepresented; you must not 23 | * claim that you wrote the original software. 24 | * 2. Altered source versions must be plainly marked as such, and must not be 25 | * misrepresented as being the original software. 26 | * 3. This notice may not be removed or altered from any source distribution. 27 | * 28 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 29 | * obligation to support this Software. Energy Micro AS is providing the 30 | * Software "AS IS", with no express or implied warranties of any kind, 31 | * including, but not limited to, any implied warranties of merchantability 32 | * or fitness for any particular purpose or warranties against infringement 33 | * of any proprietary rights of a third party. 34 | * 35 | * Energy Micro AS will not be liable for any consequential, incidental, or 36 | * special damages, or any other relief, or for any claim by any third party, 37 | * arising from your use of this Software. 38 | * 39 | *****************************************************************************/ 40 | 41 | #ifndef __EFM32_H 42 | #define __EFM32_H 43 | 44 | /* This file is kept for backwards compability. */ 45 | 46 | #include "em_device.h" 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32LG/Include/efm32lg_burtc_ret.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32lg_burtc_ret Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief BURTC_RET EFM32LG BURTC RET 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t REG; /**< Retention register */ 39 | } BURTC_RET_TypeDef; 40 | 41 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32LG/Include/efm32lg_calibrate.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32lg_calibrate Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @defgroup EFM32LG_CALIBRATE 35 | * @{ 36 | *****************************************************************************/ 37 | #define CALIBRATE_MAX_REGISTERS 50 /**< Max number of address/value pairs for calibration */ 38 | 39 | typedef struct 40 | { 41 | __I uint32_t ADDRESS; /**< Address of calibration register */ 42 | __I uint32_t VALUE; /**< Default value for calibration register */ 43 | } CALIBRATE_TypeDef; /** @} */ 44 | 45 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32LG/Include/efm32lg_dma_ch.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32lg_dma_.h Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief DMA_CH EFM32LG DMA CH 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTRL; /**< Channel Control Register */ 39 | } DMA_CH_TypeDef; 40 | 41 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32LG/Include/efm32lg_dma_descriptor.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32lg_dma_descriptor Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @defgroup EFM32LG_DMA_DESCRIPTOR 35 | * @{ 36 | *****************************************************************************/ 37 | typedef struct 38 | { 39 | /* Note! Use of double __IO (volatile) qualifier to ensure that both */ 40 | /* pointer and referenced memory are declared volatile. */ 41 | __IO void * __IO SRCEND; /**< DMA source address end */ 42 | __IO void * __IO DSTEND; /**< DMA destination address end */ 43 | __IO uint32_t CTRL; /**< DMA control register */ 44 | __IO uint32_t USER; /**< DMA padding register, available for user */ 45 | } DMA_DESCRIPTOR_TypeDef; /** @} */ 46 | 47 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32LG/Include/efm32lg_gpio_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32lg_gpio_p Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief GPIO_P EFM32LG GPIO P 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTRL; /**< Port Control Register */ 39 | __IO uint32_t MODEL; /**< Port Pin Mode Low Register */ 40 | __IO uint32_t MODEH; /**< Port Pin Mode High Register */ 41 | __IO uint32_t DOUT; /**< Port Data Out Register */ 42 | __O uint32_t DOUTSET; /**< Port Data Out Set Register */ 43 | __O uint32_t DOUTCLR; /**< Port Data Out Clear Register */ 44 | __O uint32_t DOUTTGL; /**< Port Data Out Toggle Register */ 45 | __I uint32_t DIN; /**< Port Data In Register */ 46 | __IO uint32_t PINLOCKN; /**< Port Unlocked Pins Register */ 47 | } GPIO_P_TypeDef; 48 | 49 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32LG/Include/efm32lg_lesense_buf.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32lg_lesense_buf Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief LESENSE_BUF EFM32LG LESENSE BUF 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t DATA; /**< Scan results */ 39 | } LESENSE_BUF_TypeDef; 40 | 41 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32LG/Include/efm32lg_lesense_ch.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32lg_lesense_.h Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief LESENSE_CH EFM32LG LESENSE CH 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t TIMING; /**< Scan configuration */ 39 | __IO uint32_t INTERACT; /**< Scan configuration */ 40 | __IO uint32_t EVAL; /**< Scan configuration */ 41 | 42 | uint32_t RESERVED0[1]; /**< Reserved future */ 43 | } LESENSE_CH_TypeDef; 44 | 45 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32LG/Include/efm32lg_lesense_st.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32lg_lesense_st Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief LESENSE_ST EFM32LG LESENSE ST 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t TCONFA; /**< State transition configuration A */ 39 | __IO uint32_t TCONFB; /**< State transition configuration B */ 40 | } LESENSE_ST_TypeDef; 41 | 42 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32LG/Include/efm32lg_prs_ch.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32lg_prs_.h Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief PRS_CH EFM32LG PRS CH 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTRL; /**< Channel Control Register */ 39 | } PRS_CH_TypeDef; 40 | 41 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32LG/Include/efm32lg_timer_cc.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32lg_timer_cc Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief TIMER_CC EFM32LG TIMER CC 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTRL; /**< CC Channel Control Register */ 39 | __IO uint32_t CCV; /**< CC Channel Value Register */ 40 | __I uint32_t CCVP; /**< CC Channel Value Peek Register */ 41 | __IO uint32_t CCVB; /**< CC Channel Buffer Register */ 42 | } TIMER_CC_TypeDef; 43 | 44 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32LG/Include/efm32lg_usb_diep.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32lg_usb_diep Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief USB_DIEP EFM32LG USB DIEP 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTL; /**< Device IN Endpoint x+1 Control Register */ 39 | uint32_t RESERVED0[1]; /**< Reserved for future use **/ 40 | __IO uint32_t INT; /**< Device IN Endpoint x+1 Interrupt Register */ 41 | uint32_t RESERVED1[1]; /**< Reserved for future use **/ 42 | __IO uint32_t TSIZ; /**< Device IN Endpoint x+1 Transfer Size Register */ 43 | __IO uint32_t DMAADDR; /**< Device IN Endpoint x+1 DMA Address Register */ 44 | __I uint32_t TXFSTS; /**< Device IN Endpoint x+1 Transmit FIFO Status Register */ 45 | 46 | uint32_t RESERVED2[1]; /**< Reserved future */ 47 | } USB_DIEP_TypeDef; 48 | 49 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32LG/Include/efm32lg_usb_doep.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32lg_usb_doep Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief USB_DOEP EFM32LG USB DOEP 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTL; /**< Device OUT Endpoint x+1 Control Register */ 39 | uint32_t RESERVED0[1]; /**< Reserved for future use **/ 40 | __IO uint32_t INT; /**< Device OUT Endpoint x+1 Interrupt Register */ 41 | uint32_t RESERVED1[1]; /**< Reserved for future use **/ 42 | __IO uint32_t TSIZ; /**< Device OUT Endpoint x+1 Transfer Size Register */ 43 | __IO uint32_t DMAADDR; /**< Device OUT Endpoint x+1 DMA Address Register */ 44 | 45 | uint32_t RESERVED2[2]; /**< Reserved future */ 46 | } USB_DOEP_TypeDef; 47 | 48 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32LG/Include/efm32lg_usb_hc.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32lg_usbc.h Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief USB_HC EFM32LG USB HC 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CHAR; /**< Host Channel x Characteristics Register */ 39 | uint32_t RESERVED0[1]; /**< Reserved for future use **/ 40 | __IO uint32_t INT; /**< Host Channel x Interrupt Register */ 41 | __IO uint32_t INTMSK; /**< Host Channel x Interrupt Mask Register */ 42 | __IO uint32_t TSIZ; /**< Host Channel x Transfer Size Register */ 43 | __IO uint32_t DMAADDR; /**< Host Channel x DMA Address Register */ 44 | 45 | uint32_t RESERVED1[2]; /**< Reserved future */ 46 | } USB_HC_TypeDef; 47 | 48 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32TG/Include/efm32.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief CMSIS Cortex-M0/M3 Peripheral Access Layer for EFM32 device series 4 | * 5 | * This is a convenience header file for defining the EFM32 part number on the 6 | * build command line, instead of specifying the part specific header file. 7 | * @verbatim 8 | * Example: Add "-DEFM32G890F128" to your build options, to define part 9 | * Add "#include "efm32.h" to your source files 10 | * @endverbatim 11 | * @author Energy Micro AS 12 | * @version 3.0.2 13 | ****************************************************************************** 14 | * @section License 15 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 16 | ****************************************************************************** 17 | * 18 | * Permission is granted to anyone to use this software for any purpose, 19 | * including commercial applications, and to alter it and redistribute it 20 | * freely, subject to the following restrictions: 21 | * 22 | * 1. The origin of this software must not be misrepresented; you must not 23 | * claim that you wrote the original software. 24 | * 2. Altered source versions must be plainly marked as such, and must not be 25 | * misrepresented as being the original software. 26 | * 3. This notice may not be removed or altered from any source distribution. 27 | * 28 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 29 | * obligation to support this Software. Energy Micro AS is providing the 30 | * Software "AS IS", with no express or implied warranties of any kind, 31 | * including, but not limited to, any implied warranties of merchantability 32 | * or fitness for any particular purpose or warranties against infringement 33 | * of any proprietary rights of a third party. 34 | * 35 | * Energy Micro AS will not be liable for any consequential, incidental, or 36 | * special damages, or any other relief, or for any claim by any third party, 37 | * arising from your use of this Software. 38 | * 39 | *****************************************************************************/ 40 | 41 | #ifndef __EFM32_H 42 | #define __EFM32_H 43 | 44 | /* This file is kept for backwards compability. */ 45 | 46 | #include "em_device.h" 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32TG/Include/efm32tg_calibrate.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32tg_calibrate Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @defgroup EFM32TG_CALIBRATE 35 | * @{ 36 | *****************************************************************************/ 37 | #define CALIBRATE_MAX_REGISTERS 50 /**< Max number of address/value pairs for calibration */ 38 | 39 | typedef struct 40 | { 41 | __I uint32_t ADDRESS; /**< Address of calibration register */ 42 | __I uint32_t VALUE; /**< Default value for calibration register */ 43 | } CALIBRATE_TypeDef; /** @} */ 44 | 45 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32TG/Include/efm32tg_dma_ch.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32tg_dma_.h Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief DMA_CH EFM32TG DMA CH 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTRL; /**< Channel Control Register */ 39 | } DMA_CH_TypeDef; 40 | 41 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32TG/Include/efm32tg_dma_descriptor.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32tg_dma_descriptor Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @defgroup EFM32TG_DMA_DESCRIPTOR 35 | * @{ 36 | *****************************************************************************/ 37 | typedef struct 38 | { 39 | /* Note! Use of double __IO (volatile) qualifier to ensure that both */ 40 | /* pointer and referenced memory are declared volatile. */ 41 | __IO void * __IO SRCEND; /**< DMA source address end */ 42 | __IO void * __IO DSTEND; /**< DMA destination address end */ 43 | __IO uint32_t CTRL; /**< DMA control register */ 44 | __IO uint32_t USER; /**< DMA padding register, available for user */ 45 | } DMA_DESCRIPTOR_TypeDef; /** @} */ 46 | 47 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32TG/Include/efm32tg_gpio_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32tg_gpio_p Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief GPIO_P EFM32TG GPIO P 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTRL; /**< Port Control Register */ 39 | __IO uint32_t MODEL; /**< Port Pin Mode Low Register */ 40 | __IO uint32_t MODEH; /**< Port Pin Mode High Register */ 41 | __IO uint32_t DOUT; /**< Port Data Out Register */ 42 | __O uint32_t DOUTSET; /**< Port Data Out Set Register */ 43 | __O uint32_t DOUTCLR; /**< Port Data Out Clear Register */ 44 | __O uint32_t DOUTTGL; /**< Port Data Out Toggle Register */ 45 | __I uint32_t DIN; /**< Port Data In Register */ 46 | __IO uint32_t PINLOCKN; /**< Port Unlocked Pins Register */ 47 | } GPIO_P_TypeDef; 48 | 49 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32TG/Include/efm32tg_lesense_buf.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32tg_lesense_buf Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief LESENSE_BUF EFM32TG LESENSE BUF 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t DATA; /**< Scan results */ 39 | } LESENSE_BUF_TypeDef; 40 | 41 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32TG/Include/efm32tg_lesense_ch.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32tg_lesense_.h Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief LESENSE_CH EFM32TG LESENSE CH 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t TIMING; /**< Scan configuration */ 39 | __IO uint32_t INTERACT; /**< Scan configuration */ 40 | __IO uint32_t EVAL; /**< Scan configuration */ 41 | 42 | uint32_t RESERVED0[1]; /**< Reserved future */ 43 | } LESENSE_CH_TypeDef; 44 | 45 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32TG/Include/efm32tg_lesense_st.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32tg_lesense_st Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief LESENSE_ST EFM32TG LESENSE ST 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t TCONFA; /**< State transition configuration A */ 39 | __IO uint32_t TCONFB; /**< State transition configuration B */ 40 | } LESENSE_ST_TypeDef; 41 | 42 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32TG/Include/efm32tg_prs_ch.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32tg_prs_.h Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief PRS_CH EFM32TG PRS CH 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTRL; /**< Channel Control Register */ 39 | } PRS_CH_TypeDef; 40 | 41 | -------------------------------------------------------------------------------- /ports/EFM32/Device/EnergyMicro/EFM32TG/Include/efm32tg_timer_cc.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief efm32tg_timer_cc Register and Bit Field definitions 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ****************************************************************************** 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | *****************************************************************************/ 33 | /**************************************************************************//** 34 | * @brief TIMER_CC EFM32TG TIMER CC 35 | *****************************************************************************/ 36 | typedef struct 37 | { 38 | __IO uint32_t CTRL; /**< CC Channel Control Register */ 39 | __IO uint32_t CCV; /**< CC Channel Value Register */ 40 | __I uint32_t CCVP; /**< CC Channel Value Peek Register */ 41 | __IO uint32_t CCVB; /**< CC Channel Buffer Register */ 42 | } TIMER_CC_TypeDef; 43 | 44 | -------------------------------------------------------------------------------- /ports/EFM32/emlib/ReadMe_emlib.txt: -------------------------------------------------------------------------------- 1 | ================ Energy Micro Peripheral Library ============================ 2 | 3 | This directory, "emlib", contains the Energy Micro Peripheral Support 4 | library for the EFM32 series of microcontrollers and EFR4 series for RF 5 | transceivers and System-On-Chip devices. 6 | 7 | The "emlib" SW is designed to support all Energy Micro EFM and EFR devices, 8 | from Gecko revision B and forward. 9 | 10 | Some design guidelines for this library: 11 | 12 | * Follow the guidelines established by ARM's and Energy Micro's adaptation 13 | of the CMSIS (see below) standard. 14 | 15 | * Be usable as a starting point for developing richer, more target specific 16 | functionality (i.e. copy and modify further). 17 | 18 | * Ability to be used as a standalone software component, to be used by other 19 | drivers, that should cover "the most common cases". 20 | 21 | * Readability of the code and usability preferred before optimization for speed 22 | and size or covering a particular "narrow" purpose. 23 | 24 | * As little "cross-dependency" between modules as possible, to enable users to 25 | pick and choose what they want. 26 | 27 | ================ About CMSIS ================================================ 28 | 29 | These APIs are based on EFM32_CMSIS "Device" header file structure. 30 | 31 | As a result of this, the library requires basic C99-support. You might have 32 | to enable C99 support in your compiler. Comments are in doxygen compatible 33 | format. 34 | 35 | The EFM32_CMSIS library contains all peripheral module registers and bit field 36 | descriptors. 37 | 38 | To download EFM32_CMSIS, go to 39 | http://www.energymicro.com/downloads 40 | 41 | For more information about CMSIS see 42 | http://www.onarm.com 43 | http://www.arm.com/products/CPUs/CMSIS.html 44 | 45 | The requirements for using CMSIS also apply to this package. 46 | 47 | ================ File structure ============================================== 48 | 49 | inc/ - header files 50 | src/ - source files 51 | 52 | ================ Licenses ==================================================== 53 | 54 | See the top of each file for SW license. Basically you are free to use the 55 | Energy Micro code for any project using Energy Micro devices. Parts of the 56 | CMSIS library is copyrighted by ARM Inc. See "License.doc" for ARM's CMSIS 57 | license. 58 | 59 | ================ Software updates ============================================ 60 | 61 | Energy Micro continually works to provide updated and improved emlib, example 62 | code and other software of use for Energy Micro customers. Please check the 63 | download section of Energy Micro's web site at 64 | 65 | http://www.energymicro.com/downloads 66 | 67 | for the latest releases, news and updates. If you download and install the 68 | Simplicity Studio application, you will be notified about updates when 69 | available. 70 | 71 | 72 | (C) Copyright Energy Micro AS, 2012 73 | -------------------------------------------------------------------------------- /ports/EFM32/emlib/inc/em_acmp.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/x893/picoC/a1b6e72b1a4ed7c35412a3232078323b64db44d7/ports/EFM32/emlib/inc/em_acmp.h -------------------------------------------------------------------------------- /ports/EFM32/emlib/inc/em_assert.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************//** 2 | * @file 3 | * @brief EFM32 peripheral API "assert" implementation. 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | * 7 | * @details 8 | * By default, EFM32 library assert usage is not included in order to reduce 9 | * footprint and processing overhead. Further, EFM32 assert usage is decoupled 10 | * from ISO C assert handling (NDEBUG usage), to allow a user to use ISO C 11 | * assert without including EFM32 assert statements. 12 | * 13 | * Below are available defines for controlling EFM32 assert inclusion. The defines 14 | * are typically defined for a project to be used by the preprocessor. 15 | * 16 | * @li If DEBUG_EFM is defined, the internal EFM32 library assert handling will 17 | * be used, which may be a quite rudimentary implementation. 18 | * 19 | * @li If DEBUG_EFM_USER is defined instead, the user must provide its own EFM32 20 | * assert handling routine (assertEFM()). 21 | * 22 | * As indicated above, if none of the above defines are used, EFM32 assert 23 | * statements are not compiled. 24 | ******************************************************************************* 25 | * @section License 26 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 27 | ******************************************************************************* 28 | * 29 | * Permission is granted to anyone to use this software for any purpose, 30 | * including commercial applications, and to alter it and redistribute it 31 | * freely, subject to the following restrictions: 32 | * 33 | * 1. The origin of this software must not be misrepresented; you must not 34 | * claim that you wrote the original software. 35 | * 2. Altered source versions must be plainly marked as such, and must not be 36 | * misrepresented as being the original software. 37 | * 3. This notice may not be removed or altered from any source distribution. 38 | * 39 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 40 | * obligation to support this Software. Energy Micro AS is providing the 41 | * Software "AS IS", with no express or implied warranties of any kind, 42 | * including, but not limited to, any implied warranties of merchantability 43 | * or fitness for any particular purpose or warranties against infringement 44 | * of any proprietary rights of a third party. 45 | * 46 | * Energy Micro AS will not be liable for any consequential, incidental, or 47 | * special damages, or any other relief, or for any claim by any third party, 48 | * arising from your use of this Software. 49 | * 50 | ******************************************************************************/ 51 | #ifndef __EM_ASSERT_H 52 | #define __EM_ASSERT_H 53 | 54 | #ifdef __cplusplus 55 | extern "C" { 56 | #endif 57 | 58 | /** @cond DO_NOT_INCLUDE_WITH_DOXYGEN */ 59 | 60 | #if defined(DEBUG_EFM) || defined(DEBUG_EFM_USER) 61 | /* Due to footprint considerations, we only pass file name and line number, */ 62 | /* not the assert expression (nor function name (C99)) */ 63 | void assertEFM(const char *file, int line); 64 | #define EFM_ASSERT(expr) ((expr) ? ((void)0) : assertEFM(__FILE__, __LINE__)) 65 | #else 66 | #define EFM_ASSERT(expr) ((void)0) 67 | #endif /* defined(DEBUG_EFM) || defined(DEBUG_EFM_USER) */ 68 | 69 | /** @endcond */ 70 | 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | 75 | #endif /* __EM_ASSERT_H */ 76 | -------------------------------------------------------------------------------- /ports/EFM32/emlib/inc/em_part.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************//** 2 | * @file 3 | * @brief Verify that part specific main header files are supported and included 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ******************************************************************************* 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ******************************************************************************* 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | ******************************************************************************/ 33 | #ifndef __EM_PART_H 34 | #define __EM_PART_H 35 | 36 | /* This file is kept for backwards compability. */ 37 | 38 | #include "em_device.h" 39 | 40 | #endif /* __EM_PART_H */ 41 | -------------------------------------------------------------------------------- /ports/EFM32/emlib/inc/em_version.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************//** 2 | * @file 3 | * @brief Assign correct part number for include file 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ******************************************************************************* 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ******************************************************************************* 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | ******************************************************************************/ 33 | #ifndef __EM_VERSION_H 34 | #define __EM_VERSION_H 35 | 36 | #include "em_device.h" 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /***************************************************************************//** 43 | * @addtogroup EM_Library 44 | * @{ 45 | ******************************************************************************/ 46 | 47 | /***************************************************************************//** 48 | * @addtogroup Version 49 | * @{ 50 | ******************************************************************************/ 51 | 52 | /** Version number of emlib peripheral API */ 53 | #define _EMLIB_VERSION 3.0.2 54 | /** Major version of emlib */ 55 | #define _EMLIB_VERSION_MAJOR 3 56 | /** Minor version of emlib */ 57 | #define _EMLIB_VERSION_MINOR 0 58 | /** Patch revision of emlib */ 59 | #define _EMLIB_VERSION_PATCH 2 60 | 61 | /** @} (end addtogroup Version) */ 62 | /** @} (end addtogroup EM_Library) */ 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | #endif /* __EM_VERSION_H */ 69 | -------------------------------------------------------------------------------- /ports/EFM32/emlib/src/em_assert.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************//** 2 | * @file 3 | * @brief Assert API 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ******************************************************************************* 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ******************************************************************************* 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | ******************************************************************************/ 33 | #include "em_assert.h" 34 | 35 | #if defined(DEBUG_EFM) 36 | #warning "DEBUG_EFM" 37 | 38 | /***************************************************************************//** 39 | * @brief 40 | * EFM internal assert handling. 41 | * 42 | * This function is invoked through EFM_ASSERT() macro usage only, it should 43 | * not be used explicitly. 44 | * 45 | * Currently this implementation only enters an indefinite loop, allowing 46 | * the use of a debugger to determine cause of failure. By defining 47 | * DEBUG_EFM_USER to the preprocessor for all files, a user defined version 48 | * of this function must be defined and will be invoked instead, possibly 49 | * providing output of assertion location. 50 | * 51 | * Please notice that this function is not used unless DEBUG_EFM is defined 52 | * during preprocessing of EFM_ASSERT() usage. 53 | * 54 | * @par file 55 | * Name of source file where assertion failed. 56 | * 57 | * @par line 58 | * Line number in source file where assertion failed. 59 | ******************************************************************************/ 60 | void assertEFM(const char *file, int line) 61 | { 62 | (void)file; /* Unused parameter */ 63 | (void)line; /* Unused parameter */ 64 | 65 | while (1) 66 | ; 67 | } 68 | 69 | #endif /* DEBUG_EFM */ 70 | -------------------------------------------------------------------------------- /ports/EFM32/emlib/src/em_int.c: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief Interrupt enable/disable unit API 4 | * @author Energy Micro AS 5 | * @version 3.0.2 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ******************************************************************************* 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 22 | * obligation to support this Software. Energy Micro AS is providing the 23 | * Software "AS IS", with no express or implied warranties of any kind, 24 | * including, but not limited to, any implied warranties of merchantability 25 | * or fitness for any particular purpose or warranties against infringement 26 | * of any proprietary rights of a third party. 27 | * 28 | * Energy Micro AS will not be liable for any consequential, incidental, or 29 | * special damages, or any other relief, or for any claim by any third party, 30 | * arising from your use of this Software. 31 | * 32 | ******************************************************************************/ 33 | #include 34 | #include "em_int.h" 35 | 36 | /***************************************************************************//** 37 | * @addtogroup EM_Library 38 | * @{ 39 | ******************************************************************************/ 40 | 41 | /***************************************************************************//** 42 | * @addtogroup INT 43 | * @brief Safe nesting interrupt disable/enable API 44 | * @details 45 | * This module contains functions to safely disable and enable interrupts 46 | * at cpu level. INT_Disable() disables interrupts and increments a lock 47 | * level counter. INT_Enable() decrements the lock level counter and enable 48 | * interrupts if the counter was decremented to zero. 49 | * 50 | * These functions would normally be used to secure critical regions. 51 | * 52 | * These functions should also be used inside interrupt handlers: 53 | * @verbatim 54 | * void SysTick_Handler(void) 55 | * { 56 | * INT_Disable(); 57 | * . 58 | * . 59 | * . 60 | * INT_Enable(); 61 | * } 62 | * @endverbatim 63 | ******************************************************************************/ 64 | 65 | /** Interrupt lock level counter. Set to zero initially as we normally enter 66 | * main with interrupts enabled */ 67 | uint32_t INT_LockCnt = 0; 68 | 69 | 70 | /** @} (end addtogroup INT) */ 71 | /** @} (end addtogroup EM_Library) */ 72 | -------------------------------------------------------------------------------- /ports/EFM32/hardware.h: -------------------------------------------------------------------------------- 1 | #ifndef __HARDWARE_H__ 2 | #define __HARDWARE_H__ 3 | 4 | #include "em_gpio.h" 5 | #include "em_usart.h" 6 | 7 | #define CONSOLE_PORT USART1 8 | #define CONSOLE_CLK cmuClock_USART1 9 | #define CONSOLE_GPIO gpioPortD 10 | #define CONSOLE_RxPin 1 11 | #define CONSOLE_TxPin 0 12 | #define CONSOLE_RxIRQn USART1_RX_IRQn 13 | #define CONSOLE_TxIRQn USART1_TX_IRQn 14 | #define CONSOLE_RxIRQHandler USART1_RX_IRQHandler 15 | #define CONSOLE_TxIRQHandler USART1_TX_IRQHandler 16 | 17 | #define CONSOLE_BUFFER_SIZE 128 18 | 19 | #include "../hardware_common.h" 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /ports/EFM32/segmentlcd.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file 3 | * @brief EFM32TG_STK3300 Segment LCD Display driver, header file 4 | * @author Energy Micro AS 5 | * @version 1.0.0 6 | ****************************************************************************** 7 | * @section License 8 | * (C) Copyright 2012 Energy Micro AS, http://www.energymicro.com 9 | ******************************************************************************* 10 | * 11 | * Permission is granted to anyone to use this software for any purpose, 12 | * including commercial applications, and to alter it and redistribute it 13 | * freely, subject to the following restrictions: 14 | * 15 | * 1. The origin of this software must not be misrepresented; you must not 16 | * claim that you wrote the original software. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 4. The source and compiled code may only be used on Energy Micro "EFM32" 21 | * microcontrollers and "EFR4" radios. 22 | * 23 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no 24 | * obligation to support this Software. Energy Micro AS is providing the 25 | * Software "AS IS", with no express or implied warranties of any kind, 26 | * including, but not limited to, any implied warranties of merchantability 27 | * or fitness for any particular purpose or warranties against infringement 28 | * of any proprietary rights of a third party. 29 | * 30 | * Energy Micro AS will not be liable for any consequential, incidental, or 31 | * special damages, or any other relief, or for any claim by any third party, 32 | * arising from your use of this Software. 33 | * 34 | *****************************************************************************/ 35 | #ifndef __SEGMENTLCD_H 36 | #define __SEGMENTLCD_H 37 | 38 | #include 39 | #include 40 | 41 | #include "STK3700/segmentlcdconfig.h" 42 | 43 | /***************************************************************************//** 44 | * @addtogroup Drivers 45 | * @{ 46 | ******************************************************************************/ 47 | 48 | /***************************************************************************//** 49 | * @addtogroup SegmentLcd 50 | * @{ 51 | ******************************************************************************/ 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif 56 | 57 | /* Regular functions */ 58 | void SegmentLCD_Init(bool useBoost); 59 | void SegmentLCD_Disable(void); 60 | void SegmentLCD_AllOff(void); 61 | void SegmentLCD_AllOn(void); 62 | void SegmentLCD_ARing(int anum, int on); 63 | void SegmentLCD_Battery(int batteryLevel); 64 | void SegmentLCD_EnergyMode(int em, int on); 65 | void SegmentLCD_Number(int value); 66 | void SegmentLCD_NumberOff(void); 67 | void SegmentLCD_AlphaNumberOff(void); 68 | void SegmentLCD_Symbol(lcdSymbol s, int on); 69 | void SegmentLCD_Write(char *string); 70 | void SegmentLCD_UnsignedHex(uint16_t value); 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | 76 | /** @} (end group SegmentLcd) */ 77 | /** @} (end group Drivers) */ 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /ports/STM32/CMSIS/Device/ST/STM32F10x/Include/stm32f10x.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/x893/picoC/a1b6e72b1a4ed7c35412a3232078323b64db44d7/ports/STM32/CMSIS/Device/ST/STM32F10x/Include/stm32f10x.h -------------------------------------------------------------------------------- /ports/STM32/CMSIS/Device/ST/STM32F10x/Include/system_stm32f10x.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @version V3.6.1 6 | * @date 09-March-2012 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /** @addtogroup CMSIS 29 | * @{ 30 | */ 31 | 32 | /** @addtogroup stm32f10x_system 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @brief Define to prevent recursive inclusion 38 | */ 39 | #ifndef __SYSTEM_STM32F10X_H 40 | #define __SYSTEM_STM32F10X_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /** @addtogroup STM32F10x_System_Includes 47 | * @{ 48 | */ 49 | 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @addtogroup STM32F10x_System_Exported_types 56 | * @{ 57 | */ 58 | 59 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | /** @addtogroup STM32F10x_System_Exported_Constants 66 | * @{ 67 | */ 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @addtogroup STM32F10x_System_Exported_Macros 74 | * @{ 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @addtogroup STM32F10x_System_Exported_Functions 82 | * @{ 83 | */ 84 | 85 | extern void SystemInit(void); 86 | extern void SystemCoreClockUpdate(void); 87 | /** 88 | * @} 89 | */ 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif /*__SYSTEM_STM32F10X_H */ 96 | 97 | /** 98 | * @} 99 | */ 100 | 101 | /** 102 | * @} 103 | */ 104 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 105 | -------------------------------------------------------------------------------- /ports/STM32/CMSIS/Device/ST/STM32L1xx/Include/stm32l1xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/x893/picoC/a1b6e72b1a4ed7c35412a3232078323b64db44d7/ports/STM32/CMSIS/Device/ST/STM32L1xx/Include/stm32l1xx.h -------------------------------------------------------------------------------- /ports/STM32/CMSIS/Device/ST/STM32L1xx/Include/system_stm32l1xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32l1xx.h 4 | * @author MCD Application Team 5 | * @version V1.1.1 6 | * @date 09-March-2012 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /** @addtogroup CMSIS 29 | * @{ 30 | */ 31 | 32 | /** @addtogroup stm32l1xx_system 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @brief Define to prevent recursive inclusion 38 | */ 39 | #ifndef __SYSTEM_STM32L1XX_H 40 | #define __SYSTEM_STM32L1XX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /** @addtogroup STM32L1xx_System_Includes 47 | * @{ 48 | */ 49 | 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @addtogroup STM32L1xx_System_Exported_types 56 | * @{ 57 | */ 58 | 59 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | /** @addtogroup STM32L1xx_System_Exported_Constants 66 | * @{ 67 | */ 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @addtogroup STM32L1xx_System_Exported_Macros 74 | * @{ 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @addtogroup STM32L1xx_System_Exported_Functions 82 | * @{ 83 | */ 84 | 85 | extern void SystemInit(void); 86 | extern void SystemCoreClockUpdate(void); 87 | /** 88 | * @} 89 | */ 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif /*__SYSTEM_STM32L1XX_H */ 96 | 97 | /** 98 | * @} 99 | */ 100 | 101 | /** 102 | * @} 103 | */ 104 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 105 | -------------------------------------------------------------------------------- /ports/STM32/CMSIS/Device/ST/STM32L1xx/Release_Notes.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/x893/picoC/a1b6e72b1a4ed7c35412a3232078323b64db44d7/ports/STM32/CMSIS/Device/ST/STM32L1xx/Release_Notes.html -------------------------------------------------------------------------------- /ports/STM32/CMSIS/Include/arm_common_tables.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 11. November 2010 5 | * $Revision: V1.0.2 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_common_tables.h 9 | * 10 | * Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3 13 | * 14 | * Version 1.0.2 2010/11/11 15 | * Documentation updated. 16 | * 17 | * Version 1.0.1 2010/10/05 18 | * Production release and review comments incorporated. 19 | * 20 | * Version 1.0.0 2010/09/20 21 | * Production release and review comments incorporated. 22 | * -------------------------------------------------------------------- */ 23 | 24 | #ifndef _ARM_COMMON_TABLES_H 25 | #define _ARM_COMMON_TABLES_H 26 | 27 | #include "arm_math.h" 28 | 29 | extern uint16_t armBitRevTable[256]; 30 | extern q15_t armRecipTableQ15[64]; 31 | extern q31_t armRecipTableQ31[64]; 32 | extern const q31_t realCoefAQ31[1024]; 33 | extern const q31_t realCoefBQ31[1024]; 34 | 35 | #endif /* ARM_COMMON_TABLES_H */ 36 | -------------------------------------------------------------------------------- /ports/STM32/STM32F10x_StdPeriph_Driver/inc/stm32f10x_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_CRC_H 25 | #define __STM32F10x_CRC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup CRC 39 | * @{ 40 | */ 41 | 42 | /** @defgroup CRC_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup CRC_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @defgroup CRC_Exported_Macros 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup CRC_Exported_Functions 67 | * @{ 68 | */ 69 | 70 | void CRC_ResetDR(void); 71 | uint32_t CRC_CalcCRC(uint32_t Data); 72 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 73 | uint32_t CRC_GetCRC(void); 74 | void CRC_SetIDRegister(uint8_t IDValue); 75 | uint8_t CRC_GetIDRegister(void); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif /* __STM32F10x_CRC_H */ 82 | /** 83 | * @} 84 | */ 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 95 | -------------------------------------------------------------------------------- /ports/STM32/STM32F10x_StdPeriph_Driver/inc/stm32f10x_wwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_wwdg.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the WWDG firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_WWDG_H 25 | #define __STM32F10x_WWDG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup WWDG 39 | * @{ 40 | */ 41 | 42 | /** @defgroup WWDG_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup WWDG_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** @defgroup WWDG_Prescaler 55 | * @{ 56 | */ 57 | 58 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000) 59 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080) 60 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100) 61 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180) 62 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \ 63 | ((PRESCALER) == WWDG_Prescaler_2) || \ 64 | ((PRESCALER) == WWDG_Prescaler_4) || \ 65 | ((PRESCALER) == WWDG_Prescaler_8)) 66 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F) 67 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F)) 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup WWDG_Exported_Macros 78 | * @{ 79 | */ 80 | /** 81 | * @} 82 | */ 83 | 84 | /** @defgroup WWDG_Exported_Functions 85 | * @{ 86 | */ 87 | 88 | void WWDG_DeInit(void); 89 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler); 90 | void WWDG_SetWindowValue(uint8_t WindowValue); 91 | void WWDG_EnableIT(void); 92 | void WWDG_SetCounter(uint8_t Counter); 93 | void WWDG_Enable(uint8_t Counter); 94 | FlagStatus WWDG_GetFlagStatus(void); 95 | void WWDG_ClearFlag(void); 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | 101 | #endif /* __STM32F10x_WWDG_H */ 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 116 | -------------------------------------------------------------------------------- /ports/STM32/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/x893/picoC/a1b6e72b1a4ed7c35412a3232078323b64db44d7/ports/STM32/STM32F10x_StdPeriph_Driver/src/stm32f10x_flash.c -------------------------------------------------------------------------------- /ports/STM32/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/x893/picoC/a1b6e72b1a4ed7c35412a3232078323b64db44d7/ports/STM32/STM32F10x_StdPeriph_Driver/src/stm32f10x_i2c.c -------------------------------------------------------------------------------- /ports/STM32/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/x893/picoC/a1b6e72b1a4ed7c35412a3232078323b64db44d7/ports/STM32/STM32F10x_StdPeriph_Driver/src/stm32f10x_usart.c -------------------------------------------------------------------------------- /ports/STM32/STM32L1xx_StdPeriph_Driver/inc/stm32l1xx_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l1xx_crc.h 4 | * @author MCD Application Team 5 | * @version V1.1.1 6 | * @date 05-March-2012 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT 2012 STMicroelectronics

13 | * 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 15 | * You may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at: 17 | * 18 | * http://www.st.com/software_license_agreement_liberty_v2 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | * 26 | ****************************************************************************** 27 | */ 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __STM32L1xx_CRC_H 31 | #define __STM32L1xx_CRC_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32l1xx.h" 39 | 40 | /** @addtogroup STM32L1xx_StdPeriph_Driver 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup CRC 45 | * @{ 46 | */ 47 | 48 | /* Exported types ------------------------------------------------------------*/ 49 | /* Exported constants --------------------------------------------------------*/ 50 | 51 | /** @defgroup CRC_Exported_Constants 52 | * @{ 53 | */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /* Exported macro ------------------------------------------------------------*/ 60 | /* Exported functions ------------------------------------------------------- */ 61 | 62 | void CRC_ResetDR(void); 63 | uint32_t CRC_CalcCRC(uint32_t Data); 64 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 65 | uint32_t CRC_GetCRC(void); 66 | void CRC_SetIDRegister(uint8_t IDValue); 67 | uint8_t CRC_GetIDRegister(void); 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | 73 | #endif /* __STM32L1xx_CRC_H */ 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 84 | -------------------------------------------------------------------------------- /ports/STM32/hardware.h: -------------------------------------------------------------------------------- 1 | #ifndef __HARDWARE_H__ 2 | #define __HARDWARE_H__ 3 | 4 | #include "stm32f10x.h" 5 | 6 | #define CONSOLE_PORT USART1 7 | #define CONSOLE_CLK2 RCC_APB2Periph_USART1 8 | #define CONSOLE_GPIO_CLK2 RCC_APB2Periph_GPIOA 9 | #define CONSOLE_GPIO GPIOA 10 | #define CONSOLE_RxPin GPIO_Pin_10 11 | #define CONSOLE_TxPin GPIO_Pin_9 12 | #define CONSOLE_IRQn USART1_IRQn 13 | #define CONSOLE_IRQHandler USART1_IRQHandler 14 | #define CONSOLE_BUFFER_SIZE 128 15 | 16 | #include "../hardware_common.h" 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /ports/STM32/stm32f10x_conf.h: -------------------------------------------------------------------------------- 1 | #ifndef __STM32F10x_CONF_H 2 | #define __STM32F10x_CONF_H 3 | 4 | /* Includes ------------------------------------------------------------------*/ 5 | /* Uncomment the line below to enable peripheral header file inclusion */ 6 | #include "stm32f10x_adc.h" 7 | #include "stm32f10x_bkp.h" 8 | #include "stm32f10x_can.h" 9 | #include "stm32f10x_crc.h" 10 | #include "stm32f10x_dac.h" 11 | #include "stm32f10x_dbgmcu.h" 12 | #include "stm32f10x_dma.h" 13 | #include "stm32f10x_exti.h" 14 | #include "stm32f10x_flash.h" 15 | #include "stm32f10x_fsmc.h" 16 | #include "stm32f10x_gpio.h" 17 | #include "stm32f10x_i2c.h" 18 | #include "stm32f10x_iwdg.h" 19 | #include "stm32f10x_pwr.h" 20 | #include "stm32f10x_rcc.h" 21 | #include "stm32f10x_rtc.h" 22 | #include "stm32f10x_sdio.h" 23 | #include "stm32f10x_spi.h" 24 | #include "stm32f10x_tim.h" 25 | #include "stm32f10x_usart.h" 26 | #include "stm32f10x_wwdg.h" 27 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 28 | 29 | /* Exported types ------------------------------------------------------------*/ 30 | /* Exported constants --------------------------------------------------------*/ 31 | /* Uncomment the line below to expanse the "assert_param" macro in the 32 | Standard Peripheral Library drivers code */ 33 | /* #define USE_FULL_ASSERT 1 */ 34 | 35 | /* Exported macro ------------------------------------------------------------*/ 36 | #ifdef USE_FULL_ASSERT 37 | 38 | /******************************************************************************* 39 | * Macro Name : assert_param 40 | * Description : The assert_param macro is used for function's parameters check. 41 | * Input : - expr: If expr is false, it calls assert_failed function 42 | * which reports the name of the source file and the source 43 | * line number of the call that failed. 44 | * If expr is true, it returns no value. 45 | * Return : None 46 | *******************************************************************************/ 47 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 48 | /* Exported functions ------------------------------------------------------- */ 49 | void assert_failed(uint8_t* file, uint32_t line); 50 | #else 51 | #define assert_param(expr) ((void)0) 52 | #endif /* USE_FULL_ASSERT */ 53 | 54 | #endif /* __STM32F10x_CONF_H */ 55 | 56 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 57 | -------------------------------------------------------------------------------- /ports/hardware_common.h: -------------------------------------------------------------------------------- 1 | #ifndef __HARD_COMMON_H__ 2 | #define __HARD_COMMON_H__ 3 | 4 | #ifdef CONSOLE_PORT 5 | typedef struct RingBuffer_s { 6 | uint8_t data[CONSOLE_BUFFER_SIZE]; 7 | volatile uint16_t idx_in; 8 | volatile uint16_t idx_out; 9 | bool overflow; 10 | } RingBuffer_t; 11 | 12 | extern RingBuffer_t ConsoleTxBuffer; 13 | extern RingBuffer_t ConsoleRxBuffer; 14 | #endif 15 | 16 | #define PORTA (0 * 16) 17 | #define PORTB (1 * 16) 18 | #define PORTC (2 * 16) 19 | #define PORTD (3 * 16) 20 | #define PORTE (4 * 16) 21 | 22 | const extern uint8_t PNONE; 23 | const extern uint8_t PA0; 24 | const extern uint8_t PA1; 25 | const extern uint8_t PA2; 26 | const extern uint8_t PA3; 27 | const extern uint8_t PA4; 28 | const extern uint8_t PA5; 29 | const extern uint8_t PA6; 30 | const extern uint8_t PA7; 31 | const extern uint8_t PA8; 32 | const extern uint8_t PA9; 33 | const extern uint8_t PA10; 34 | const extern uint8_t PA11; 35 | const extern uint8_t PA12; 36 | const extern uint8_t PA13; 37 | const extern uint8_t PA14; 38 | const extern uint8_t PA15; 39 | 40 | const extern uint8_t PB0; 41 | const extern uint8_t PB1; 42 | const extern uint8_t PB2; 43 | const extern uint8_t PB3; 44 | const extern uint8_t PB4; 45 | const extern uint8_t PB5; 46 | const extern uint8_t PB6; 47 | const extern uint8_t PB7; 48 | const extern uint8_t PB8; 49 | const extern uint8_t PB9; 50 | const extern uint8_t PB10; 51 | const extern uint8_t PB11; 52 | const extern uint8_t PB12; 53 | const extern uint8_t PB13; 54 | const extern uint8_t PB14; 55 | const extern uint8_t PB15; 56 | 57 | const extern uint8_t PC0; 58 | const extern uint8_t PC1; 59 | const extern uint8_t PC2; 60 | const extern uint8_t PC3; 61 | const extern uint8_t PC4; 62 | const extern uint8_t PC5; 63 | const extern uint8_t PC6; 64 | const extern uint8_t PC7; 65 | const extern uint8_t PC8; 66 | const extern uint8_t PC9; 67 | const extern uint8_t PC10; 68 | const extern uint8_t PC11; 69 | const extern uint8_t PC12; 70 | const extern uint8_t PC13; 71 | const extern uint8_t PC14; 72 | const extern uint8_t PC15; 73 | 74 | const extern uint8_t PD0; 75 | const extern uint8_t PD1; 76 | const extern uint8_t PD2; 77 | const extern uint8_t PD3; 78 | const extern uint8_t PD4; 79 | const extern uint8_t PD5; 80 | const extern uint8_t PD6; 81 | const extern uint8_t PD7; 82 | const extern uint8_t PD8; 83 | const extern uint8_t PD9; 84 | const extern uint8_t PD10; 85 | const extern uint8_t PD11; 86 | const extern uint8_t PD12; 87 | const extern uint8_t PD13; 88 | const extern uint8_t PD14; 89 | const extern uint8_t PD15; 90 | 91 | const extern uint8_t PE0; 92 | const extern uint8_t PE1; 93 | const extern uint8_t PE2; 94 | const extern uint8_t PE3; 95 | const extern uint8_t PE4; 96 | const extern uint8_t PE5; 97 | const extern uint8_t PE6; 98 | const extern uint8_t PE7; 99 | const extern uint8_t PE8; 100 | const extern uint8_t PE9; 101 | const extern uint8_t PE10; 102 | const extern uint8_t PE11; 103 | const extern uint8_t PE12; 104 | const extern uint8_t PE13; 105 | const extern uint8_t PE14; 106 | const extern uint8_t PE15; 107 | 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /ports/main.c: -------------------------------------------------------------------------------- 1 | #include "../picoc.h" 2 | 3 | extern int picoc(char *SourceStr); 4 | // Example code for STK-3700 5 | // http://www.energymicro.com/tools/efm32-giant-gecko-starter-kit-efm32gg-stk3700 6 | const char *TestC = \ 7 | "#include \n" \ 8 | "#include \n" \ 9 | "void test(void)\n" \ 10 | "{\n" \ 11 | " int i;\n" \ 12 | " printf(\"\\n\");\n" \ 13 | "\n" \ 14 | " lcdInit();\n" \ 15 | " lcdWrite(\"EFM32 C\");\n" \ 16 | " delay_ms(1000);\n" \ 17 | "\n" \ 18 | " printf(\"Flash PE2 0ms delay\\n\");\n" \ 19 | " lcdWrite(\"FAST\");\n" \ 20 | " pinMode(PE2, 4, 0);\n" \ 21 | " pinMode(PE3, 4, 0);\n" \ 22 | " for(i = 0; i < 10000; i++)\n" \ 23 | " pinToggle(PE2);\n" \ 24 | " delay_ms(1000);\n" \ 25 | "\n" \ 26 | " printf(\"Flash PE2 500ms delay\\n\");\n" \ 27 | " lcdWrite(\"500ms\");\n" \ 28 | " for(i = 0; i < 10; i++)\n" \ 29 | " {\n" \ 30 | " delay_ms(500);\n" \ 31 | " pinToggle(PE2);\n" \ 32 | " }\n" \ 33 | "\n" \ 34 | " lcdWrite(\"DONE\");\n" \ 35 | "\n" \ 36 | " printf(\"Set PE3\\n\\n\");\n" \ 37 | " pinOut(PE3,1);\n" \ 38 | "}\n" \ 39 | "test();\n"; 40 | 41 | int main(void) 42 | { 43 | picoc((char *)TestC); 44 | 45 | while(1) 46 | { 47 | // Enter to interactive mode 48 | picoc(NULL); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /tests/00_assignment.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int a; 4 | a = 42; 5 | printf("%d\n", a); 6 | 7 | int b = 64; 8 | printf("%d\n", b); 9 | 10 | int c = 12, d = 34; 11 | printf("%d, %d\n", c, d); 12 | 13 | void main() {} 14 | -------------------------------------------------------------------------------- /tests/00_assignment.expect: -------------------------------------------------------------------------------- 1 | 42 2 | 64 3 | 12, 34 4 | -------------------------------------------------------------------------------- /tests/01_comment.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | printf("Hello\n"); 4 | printf("Hello\n"); /* this is a comment */ printf("Hello\n"); 5 | printf("Hello\n"); 6 | // this is also a comment sayhello(); 7 | printf("Hello\n"); 8 | 9 | 10 | void main() {} 11 | -------------------------------------------------------------------------------- /tests/01_comment.expect: -------------------------------------------------------------------------------- 1 | Hello 2 | Hello 3 | Hello 4 | Hello 5 | Hello 6 | -------------------------------------------------------------------------------- /tests/02_printf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | printf("Hello world\n"); 4 | 5 | int Count; 6 | for (Count = -5; Count <= 5; Count++) 7 | printf("Count = %d\n", Count); 8 | 9 | printf("String 'hello', 'there' is '%s', '%s'\n", "hello", "there"); 10 | printf("Character 'A' is '%c'\n", 65); 11 | printf("Character 'a' is '%c'\n", 'a'); 12 | 13 | void main() {} 14 | -------------------------------------------------------------------------------- /tests/02_printf.expect: -------------------------------------------------------------------------------- 1 | Hello world 2 | Count = -5 3 | Count = -4 4 | Count = -3 5 | Count = -2 6 | Count = -1 7 | Count = 0 8 | Count = 1 9 | Count = 2 10 | Count = 3 11 | Count = 4 12 | Count = 5 13 | String 'hello', 'there' is 'hello', 'there' 14 | Character 'A' is 'A' 15 | Character 'a' is 'a' 16 | -------------------------------------------------------------------------------- /tests/03_struct.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct fred 4 | { 5 | int boris; 6 | int natasha; 7 | }; 8 | 9 | struct fred bloggs; 10 | 11 | bloggs.boris = 12; 12 | bloggs.natasha = 34; 13 | 14 | printf("%d\n", bloggs.boris); 15 | printf("%d\n", bloggs.natasha); 16 | 17 | //struct fred jones[2]; 18 | //jones[0].boris = 12; 19 | //jones[0].natasha = 34; 20 | 21 | void main() {} 22 | -------------------------------------------------------------------------------- /tests/03_struct.expect: -------------------------------------------------------------------------------- 1 | 12 2 | 34 3 | -------------------------------------------------------------------------------- /tests/04_for.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int Count; 4 | 5 | for (Count = 1; Count <= 10; Count++) 6 | { 7 | printf("%d\n", Count); 8 | } 9 | 10 | void main() {} 11 | -------------------------------------------------------------------------------- /tests/04_for.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | -------------------------------------------------------------------------------- /tests/05_array.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int Count; 4 | int Array[10]; 5 | 6 | for (Count = 1; Count <= 10; Count++) 7 | { 8 | Array[Count-1] = Count * Count; 9 | } 10 | 11 | for (Count = 0; Count < 10; Count++) 12 | { 13 | printf("%d\n", Array[Count]); 14 | } 15 | 16 | void main() {} 17 | -------------------------------------------------------------------------------- /tests/05_array.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 4 3 | 9 4 | 16 5 | 25 6 | 36 7 | 49 8 | 64 9 | 81 10 | 100 11 | -------------------------------------------------------------------------------- /tests/06_case.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int Count; 4 | 5 | for (Count = 0; Count < 4; Count++) 6 | { 7 | printf("%d\n", Count); 8 | switch (Count) 9 | { 10 | case 1: 11 | printf("%d\n", 1); 12 | break; 13 | 14 | case 2: 15 | printf("%d\n", 2); 16 | break; 17 | 18 | default: 19 | printf("%d\n", 0); 20 | break; 21 | } 22 | } 23 | 24 | void main() {} 25 | -------------------------------------------------------------------------------- /tests/06_case.expect: -------------------------------------------------------------------------------- 1 | 0 2 | 0 3 | 1 4 | 1 5 | 2 6 | 2 7 | 3 8 | 0 9 | -------------------------------------------------------------------------------- /tests/07_function.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int myfunc(int x) 4 | { 5 | return x * x; 6 | } 7 | 8 | printf("%d\n", myfunc(3)); 9 | printf("%d\n", myfunc(4)); 10 | 11 | void vfunc(int a) 12 | { 13 | printf("a=%d\n", a); 14 | } 15 | 16 | vfunc(1234); 17 | 18 | void qfunc() 19 | { 20 | printf("qfunc()\n"); 21 | } 22 | 23 | qfunc(); 24 | 25 | void main() {} 26 | -------------------------------------------------------------------------------- /tests/07_function.expect: -------------------------------------------------------------------------------- 1 | 9 2 | 16 3 | a=1234 4 | qfunc() 5 | -------------------------------------------------------------------------------- /tests/08_while.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int a; 4 | int p; 5 | int t; 6 | 7 | a = 1; 8 | p = 0; 9 | t = 0; 10 | 11 | while (a < 100) 12 | { 13 | printf("%d\n", a); 14 | t = a; 15 | a = t + p; 16 | p = t; 17 | } 18 | 19 | void main() {} 20 | -------------------------------------------------------------------------------- /tests/08_while.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 2 4 | 3 5 | 5 6 | 8 7 | 13 8 | 21 9 | 34 10 | 55 11 | 89 12 | -------------------------------------------------------------------------------- /tests/09_do_while.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int a; 4 | int p; 5 | int t; 6 | 7 | a = 1; 8 | p = 0; 9 | t = 0; 10 | 11 | do 12 | { 13 | printf("%d\n", a); 14 | t = a; 15 | a = t + p; 16 | p = t; 17 | } while (a < 100); 18 | 19 | 20 | void main() {} 21 | -------------------------------------------------------------------------------- /tests/09_do_while.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 1 3 | 2 4 | 3 5 | 5 6 | 8 7 | 13 8 | 21 9 | 34 10 | 55 11 | 89 12 | -------------------------------------------------------------------------------- /tests/10_pointer.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int a; 4 | int *b; 5 | int c; 6 | 7 | a = 42; 8 | b = &a; 9 | printf("a = %d\n", *b); 10 | 11 | struct ziggy 12 | { 13 | int a; 14 | int b; 15 | int c; 16 | } bolshevic; 17 | 18 | bolshevic.a = 12; 19 | bolshevic.b = 34; 20 | bolshevic.c = 56; 21 | 22 | printf("bolshevic.a = %d\n", bolshevic.a); 23 | printf("bolshevic.b = %d\n", bolshevic.b); 24 | printf("bolshevic.c = %d\n", bolshevic.c); 25 | 26 | struct ziggy *tsar = &bolshevic; 27 | 28 | printf("tsar->a = %d\n", tsar->a); 29 | printf("tsar->b = %d\n", tsar->b); 30 | printf("tsar->c = %d\n", tsar->c); 31 | 32 | /* 33 | b = &(bolshevic.b); 34 | printf("bolshevic.b = %d\n", *b); 35 | */ 36 | 37 | void main() {} 38 | -------------------------------------------------------------------------------- /tests/10_pointer.expect: -------------------------------------------------------------------------------- 1 | a = 42 2 | bolshevic.a = 12 3 | bolshevic.b = 34 4 | bolshevic.c = 56 5 | tsar->a = 12 6 | tsar->b = 34 7 | tsar->c = 56 8 | -------------------------------------------------------------------------------- /tests/11_precedence.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int a; 4 | int b; 5 | int c; 6 | int d; 7 | int e; 8 | int f; 9 | int x; 10 | int y; 11 | 12 | a = 12; 13 | b = 34; 14 | c = 56; 15 | d = 78; 16 | e = 0; 17 | f = 1; 18 | 19 | printf("%d\n", c + d); 20 | printf("%d\n", (y = c + d)); 21 | /* printf("%d\n", a ? b+c : c+d); 22 | printf("%d\n", a ? b+c : c+d); 23 | printf("%d\n", a || b ? b+c : c+d); */ 24 | printf("%d\n", e || e && f); 25 | printf("%d\n", e || f && f); 26 | printf("%d\n", e && e || f); 27 | printf("%d\n", e && f || f); 28 | printf("%d\n", a && f | f); 29 | printf("%d\n", a | b ^ c & d); 30 | printf("%d, %d\n", a == a, a == b); 31 | printf("%d, %d\n", a != a, a != b); 32 | printf("%d\n", a != b && c != d); 33 | printf("%d\n", a + b * c / f); 34 | printf("%d\n", a + b * c / f); 35 | printf("%d\n", (4 << 4)); 36 | printf("%d\n", (64 >> 4)); 37 | 38 | void main() {} 39 | -------------------------------------------------------------------------------- /tests/11_precedence.expect: -------------------------------------------------------------------------------- 1 | 134 2 | 134 3 | 0 4 | 1 5 | 1 6 | 1 7 | 1 8 | 46 9 | 1, 0 10 | 0, 1 11 | 1 12 | 1916 13 | 1916 14 | 64 15 | 4 16 | -------------------------------------------------------------------------------- /tests/12_hashdefine.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define FRED 12 4 | #define BLOGGS(x) (12*(x)) 5 | 6 | printf("%d\n", FRED); 7 | printf("%d, %d, %d\n", BLOGGS(1), BLOGGS(2), BLOGGS(3)); 8 | 9 | 10 | void main() {} 11 | -------------------------------------------------------------------------------- /tests/12_hashdefine.expect: -------------------------------------------------------------------------------- 1 | 12 2 | 12, 24, 36 3 | -------------------------------------------------------------------------------- /tests/13_integer_literals.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int a = 24680; 4 | int b = 01234567; 5 | int c = 0x2468ac; 6 | int d = 0x2468AC; 7 | int e = 0b010101010101; 8 | 9 | printf("%d\n", a); 10 | printf("%d\n", b); 11 | printf("%d\n", c); 12 | printf("%d\n", d); 13 | printf("%d\n", e); 14 | 15 | 16 | void main() {} 17 | -------------------------------------------------------------------------------- /tests/13_integer_literals.expect: -------------------------------------------------------------------------------- 1 | 24680 2 | 342391 3 | 2386092 4 | 2386092 5 | 1365 6 | -------------------------------------------------------------------------------- /tests/14_if.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int a = 1; 4 | 5 | if (a) 6 | printf("a is true\n"); 7 | else 8 | printf("a is false\n"); 9 | 10 | int b = 0; 11 | if (b) 12 | printf("b is true\n"); 13 | else 14 | printf("b is false\n"); 15 | 16 | 17 | void main() {} 18 | -------------------------------------------------------------------------------- /tests/14_if.expect: -------------------------------------------------------------------------------- 1 | a is true 2 | b is false 3 | -------------------------------------------------------------------------------- /tests/15_recursion.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int factorial(int i) 4 | { 5 | if (i < 2) 6 | return i; 7 | else 8 | return i * factorial(i - 1); 9 | } 10 | 11 | int Count; 12 | 13 | for (Count = 1; Count <= 10; Count++) 14 | printf("%d\n", factorial(Count)); 15 | 16 | void main() {} 17 | -------------------------------------------------------------------------------- /tests/15_recursion.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 6 4 | 24 5 | 120 6 | 720 7 | 5040 8 | 40320 9 | 362880 10 | 3628800 11 | -------------------------------------------------------------------------------- /tests/16_nesting.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int x, y, z; 4 | 5 | for (x = 0; x < 2; x++) 6 | { 7 | for (y = 0; y < 3; y++) 8 | { 9 | for (z = 0; z < 3; z++) 10 | { 11 | printf("%d %d %d\n", x, y, z); 12 | } 13 | } 14 | } 15 | 16 | void main() {} 17 | -------------------------------------------------------------------------------- /tests/16_nesting.expect: -------------------------------------------------------------------------------- 1 | 0 0 0 2 | 0 0 1 3 | 0 0 2 4 | 0 1 0 5 | 0 1 1 6 | 0 1 2 7 | 0 2 0 8 | 0 2 1 9 | 0 2 2 10 | 1 0 0 11 | 1 0 1 12 | 1 0 2 13 | 1 1 0 14 | 1 1 1 15 | 1 1 2 16 | 1 2 0 17 | 1 2 1 18 | 1 2 2 19 | -------------------------------------------------------------------------------- /tests/17_enum.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | enum fred 4 | { 5 | a, 6 | b, 7 | c, 8 | d, 9 | e = 54, 10 | f = 73, 11 | g, 12 | h 13 | }; 14 | 15 | enum fred frod; 16 | 17 | printf("%d %d %d %d %d %d %d %d\n", a, b, c, d, e, f, g, h); 18 | printf("%d\n", frod); 19 | frod = 12; 20 | printf("%d\n", frod); 21 | frod = e; 22 | printf("%d\n", frod); 23 | 24 | void main() {} 25 | -------------------------------------------------------------------------------- /tests/17_enum.expect: -------------------------------------------------------------------------------- 1 | 0 1 2 3 54 73 74 75 2 | 0 3 | 12 4 | 54 5 | -------------------------------------------------------------------------------- /tests/18_include.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | printf("including\n"); 4 | #include "18_include.h" 5 | printf("done\n"); 6 | 7 | void main() {} 8 | -------------------------------------------------------------------------------- /tests/18_include.expect: -------------------------------------------------------------------------------- 1 | including 2 | included 3 | done 4 | -------------------------------------------------------------------------------- /tests/18_include.h: -------------------------------------------------------------------------------- 1 | printf("included\n"); 2 | -------------------------------------------------------------------------------- /tests/19_pointer_arithmetic.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int a; 4 | int *b; 5 | int *c; 6 | 7 | a = 42; 8 | b = &a; 9 | c = NULL; 10 | 11 | printf("%d\n", *b); 12 | 13 | if (b == NULL) 14 | printf("b is NULL\n"); 15 | else 16 | printf("b is not NULL\n"); 17 | 18 | if (c == NULL) 19 | printf("c is NULL\n"); 20 | else 21 | printf("c is not NULL\n"); 22 | 23 | 24 | void main() {} 25 | -------------------------------------------------------------------------------- /tests/19_pointer_arithmetic.expect: -------------------------------------------------------------------------------- 1 | 42 2 | b is not NULL 3 | c is NULL 4 | -------------------------------------------------------------------------------- /tests/20_pointer_comparison.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int a; 4 | int b; 5 | int *d; 6 | int *e; 7 | d = &a; 8 | e = &b; 9 | a = 12; 10 | b = 34; 11 | printf("%d\n", *d); 12 | printf("%d\n", *e); 13 | printf("%d\n", d == e); 14 | printf("%d\n", d != e); 15 | d = e; 16 | printf("%d\n", d == e); 17 | printf("%d\n", d != e); 18 | 19 | 20 | void main() {} 21 | -------------------------------------------------------------------------------- /tests/20_pointer_comparison.expect: -------------------------------------------------------------------------------- 1 | 12 2 | 34 3 | 0 4 | 1 5 | 1 6 | 0 7 | -------------------------------------------------------------------------------- /tests/21_char_array.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int x = 'a'; 4 | char y = x; 5 | 6 | char *a = "hello"; 7 | 8 | printf("%s\n", a); 9 | 10 | int c; 11 | c = *a; 12 | 13 | char *b; 14 | for (b = a; *b != 0; b++) 15 | printf("%c: %d\n", *b, *b); 16 | 17 | char destarray[10]; 18 | char *dest = &destarray[0]; 19 | char *src = a; 20 | 21 | while (*src != 0) 22 | *dest++ = *src++; 23 | 24 | *dest = 0; 25 | 26 | printf("copied string is %s\n", destarray); 27 | 28 | 29 | void main() {} 30 | -------------------------------------------------------------------------------- /tests/21_char_array.expect: -------------------------------------------------------------------------------- 1 | hello 2 | h: 104 3 | e: 101 4 | l: 108 5 | l: 108 6 | o: 111 7 | copied string is hello 8 | -------------------------------------------------------------------------------- /tests/22_floating_point.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // variables 5 | float a = 12.34 + 56.78; 6 | printf("%f\n", a); 7 | 8 | // infix operators 9 | printf("%f\n", 12.34 + 56.78); 10 | printf("%f\n", 12.34 - 56.78); 11 | printf("%f\n", 12.34 * 56.78); 12 | printf("%f\n", 12.34 / 56.78); 13 | 14 | // comparison operators 15 | printf("%d %d %d %d %d %d\n", 12.34 < 56.78, 12.34 <= 56.78, 12.34 == 56.78, 12.34 >= 56.78, 12.34 > 56.78, 12.34 != 56.78); 16 | printf("%d %d %d %d %d %d\n", 12.34 < 12.34, 12.34 <= 12.34, 12.34 == 12.34, 12.34 >= 12.34, 12.34 > 12.34, 12.34 != 12.34); 17 | printf("%d %d %d %d %d %d\n", 56.78 < 12.34, 56.78 <= 12.34, 56.78 == 12.34, 56.78 >= 12.34, 56.78 > 12.34, 56.78 != 12.34); 18 | 19 | // assignment operators 20 | a = 12.34; 21 | a += 56.78; 22 | printf("%f\n", a); 23 | 24 | a = 12.34; 25 | a -= 56.78; 26 | printf("%f\n", a); 27 | 28 | a = 12.34; 29 | a *= 56.78; 30 | printf("%f\n", a); 31 | 32 | a = 12.34; 33 | a /= 56.78; 34 | printf("%f\n", a); 35 | 36 | // prefix operators 37 | printf("%f\n", +12.34); 38 | printf("%f\n", -12.34); 39 | 40 | // type coercion 41 | a = 2; 42 | printf("%f\n", a); 43 | printf("%f\n", sin(2)); 44 | 45 | void main() {} 46 | -------------------------------------------------------------------------------- /tests/22_floating_point.expect: -------------------------------------------------------------------------------- 1 | 69.120000 2 | 69.120000 3 | -44.440000 4 | 700.665200 5 | 0.217330 6 | 1 1 0 0 0 1 7 | 0 1 1 1 0 0 8 | 0 0 0 1 1 1 9 | 69.120000 10 | -44.440000 11 | 700.665200 12 | 0.217330 13 | 12.340000 14 | -12.340000 15 | 2.000000 16 | 0.909297 17 | -------------------------------------------------------------------------------- /tests/23_type_coercion.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void charfunc(char a) 4 | { 5 | printf("char: %c\n", a); 6 | } 7 | 8 | void intfunc(int a) 9 | { 10 | printf("int: %d\n", a); 11 | } 12 | 13 | void floatfunc(float a) 14 | { 15 | printf("float: %f\n", a); 16 | } 17 | 18 | charfunc('a'); 19 | charfunc(98); 20 | charfunc(99.0); 21 | 22 | intfunc('a'); 23 | intfunc(98); 24 | intfunc(99.0); 25 | 26 | floatfunc('a'); 27 | floatfunc(98); 28 | floatfunc(99.0); 29 | 30 | printf("%c %d %f\n", 'a', 'b', 'c'); 31 | printf("%c %d %f\n", 97, 98, 99); 32 | printf("%c %d %f\n", 97.0, 98.0, 99.0); 33 | 34 | char b = 97; 35 | char c = 97.0; 36 | 37 | printf("%d %d\n", b, c); 38 | 39 | int d = 'a'; 40 | int e = 97.0; 41 | 42 | printf("%d %d\n", d, e); 43 | 44 | float f = 'a'; 45 | float g = 97; 46 | 47 | printf("%f %f\n", f, g); 48 | 49 | void main() {} 50 | -------------------------------------------------------------------------------- /tests/23_type_coercion.expect: -------------------------------------------------------------------------------- 1 | char: a 2 | char: b 3 | char: c 4 | int: 97 5 | int: 98 6 | int: 99 7 | float: 97.000000 8 | float: 98.000000 9 | float: 99.000000 10 | a 98 99.000000 11 | a 98 99.000000 12 | a 98 99.000000 13 | 97 97 14 | 97 97 15 | 97.000000 97.000000 16 | -------------------------------------------------------------------------------- /tests/24_math_library.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | printf("%f\n", sin(0.12)); 5 | printf("%f\n", cos(0.12)); 6 | printf("%f\n", tan(0.12)); 7 | printf("%f\n", asin(0.12)); 8 | printf("%f\n", acos(0.12)); 9 | printf("%f\n", atan(0.12)); 10 | printf("%f\n", sinh(0.12)); 11 | printf("%f\n", cosh(0.12)); 12 | printf("%f\n", tanh(0.12)); 13 | printf("%f\n", exp(0.12)); 14 | printf("%f\n", fabs(-0.12)); 15 | printf("%f\n", log(0.12)); 16 | printf("%f\n", log10(0.12)); 17 | printf("%f\n", pow(0.12, 0.12)); 18 | printf("%f\n", sqrt(0.12)); 19 | printf("%f\n", round(12.34)); 20 | printf("%f\n", ceil(12.34)); 21 | printf("%f\n", floor(12.34)); 22 | 23 | void main() {} 24 | -------------------------------------------------------------------------------- /tests/24_math_library.expect: -------------------------------------------------------------------------------- 1 | 0.119712 2 | 0.992809 3 | 0.120579 4 | 0.120290 5 | 1.450506 6 | 0.119429 7 | 0.120288 8 | 1.007209 9 | 0.119427 10 | 1.127497 11 | 0.120000 12 | -2.120264 13 | -0.920819 14 | 0.775357 15 | 0.346410 16 | 12.000000 17 | 13.000000 18 | 12.000000 19 | -------------------------------------------------------------------------------- /tests/25_quicksort.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int array[16]; 4 | 5 | //Swap integer values by array indexes 6 | void swap(int a, int b) 7 | { 8 | int tmp = array[a]; 9 | array[a] = array[b]; 10 | array[b] = tmp; 11 | } 12 | 13 | //Partition the array into two halves and return the 14 | //index about which the array is partitioned 15 | int partition(int left, int right) 16 | { 17 | int pivotIndex = left; 18 | int pivotValue = array[pivotIndex]; 19 | int index = left; 20 | int i; 21 | 22 | swap(pivotIndex, right); 23 | for(i = left; i < right; i++) 24 | { 25 | if(array[i] < pivotValue) 26 | { 27 | swap(i, index); 28 | index += 1; 29 | } 30 | } 31 | swap(right, index); 32 | 33 | return index; 34 | } 35 | 36 | //Quicksort the array 37 | void quicksort(int left, int right) 38 | { 39 | if(left >= right) 40 | return; 41 | 42 | int index = partition(left, right); 43 | quicksort(left, index - 1); 44 | quicksort(index + 1, right); 45 | } 46 | 47 | void main() 48 | { 49 | int i; 50 | 51 | array[0] = 62; 52 | array[1] = 83; 53 | array[2] = 4; 54 | array[3] = 89; 55 | array[4] = 36; 56 | array[5] = 21; 57 | array[6] = 74; 58 | array[7] = 37; 59 | array[8] = 65; 60 | array[9] = 33; 61 | array[10] = 96; 62 | array[11] = 38; 63 | array[12] = 53; 64 | array[13] = 16; 65 | array[14] = 74; 66 | array[15] = 55; 67 | 68 | for (i = 0; i < 16; i++) 69 | printf("%d ", array[i]); 70 | 71 | printf("\n"); 72 | 73 | quicksort(0, 15); 74 | 75 | for (i = 0; i < 16; i++) 76 | printf("%d ", array[i]); 77 | 78 | printf("\n"); 79 | } 80 | 81 | -------------------------------------------------------------------------------- /tests/25_quicksort.expect: -------------------------------------------------------------------------------- 1 | 62 83 4 89 36 21 74 37 65 33 96 38 53 16 74 55 2 | 4 16 21 33 36 37 38 53 55 62 65 74 74 83 89 96 3 | -------------------------------------------------------------------------------- /tests/26_character_constants.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | printf("%d\n", '\1'); 4 | printf("%d\n", '\10'); 5 | printf("%d\n", '\100'); 6 | printf("%d\n", '\x01'); 7 | printf("%d\n", '\x0e'); 8 | printf("%d\n", '\x10'); 9 | printf("%d\n", '\x40'); 10 | printf("test \x407\n"); 11 | 12 | 13 | void main() {} 14 | -------------------------------------------------------------------------------- /tests/26_character_constants.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 8 3 | 64 4 | 1 5 | 14 6 | 16 7 | 64 8 | test @7 9 | -------------------------------------------------------------------------------- /tests/27_sizeof.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char a; 4 | int b; 5 | double c; 6 | 7 | printf("%d\n", sizeof(a)); 8 | printf("%d\n", sizeof(b)); 9 | printf("%d\n", sizeof(c)); 10 | 11 | 12 | void main() {} 13 | -------------------------------------------------------------------------------- /tests/27_sizeof.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 4 3 | 8 4 | -------------------------------------------------------------------------------- /tests/28_strings.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char a[10]; 5 | 6 | strcpy(a, "hello"); 7 | printf("%s\n", a); 8 | 9 | strncpy(a, "gosh", 2); 10 | printf("%s\n", a); 11 | 12 | printf("%d\n", strcmp(a, "apple") > 0); 13 | printf("%d\n", strcmp(a, "goere") > 0); 14 | printf("%d\n", strcmp(a, "zebra") < 0); 15 | 16 | printf("%d\n", strlen(a)); 17 | 18 | strcat(a, "!"); 19 | printf("%s\n", a); 20 | 21 | printf("%d\n", strncmp(a, "apple", 2) > 0); 22 | printf("%d\n", strncmp(a, "goere", 2) == 0); 23 | printf("%d\n", strncmp(a, "goerg", 2) == 0); 24 | printf("%d\n", strncmp(a, "zebra", 2) < 0); 25 | 26 | printf("%s\n", index(a, 'o')); 27 | printf("%s\n", rindex(a, 'l')); 28 | printf("%d\n", rindex(a, 'x') == NULL); 29 | 30 | memset(&a[1], 'r', 4); 31 | printf("%s\n", a); 32 | 33 | memcpy(&a[2], a, 2); 34 | printf("%s\n", a); 35 | 36 | printf("%d\n", memcmp(a, "apple", 4) > 0); 37 | printf("%d\n", memcmp(a, "grgr", 4) == 0); 38 | printf("%d\n", memcmp(a, "zebra", 4) < 0); 39 | 40 | 41 | void main() {} 42 | -------------------------------------------------------------------------------- /tests/28_strings.expect: -------------------------------------------------------------------------------- 1 | hello 2 | gollo 3 | 1 4 | 1 5 | 1 6 | 5 7 | gollo! 8 | 1 9 | 1 10 | 1 11 | 1 12 | ollo! 13 | lo! 14 | 1 15 | grrrr! 16 | grgrr! 17 | 1 18 | 1 19 | 1 20 | -------------------------------------------------------------------------------- /tests/29_array_address.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char a[10]; 5 | strcpy(a, "abcdef"); 6 | printf("%s\n", &a[1]); 7 | 8 | void main() {} 9 | -------------------------------------------------------------------------------- /tests/29_array_address.expect: -------------------------------------------------------------------------------- 1 | bcdef 2 | -------------------------------------------------------------------------------- /tests/30_hanoi.expect: -------------------------------------------------------------------------------- 1 | Solution of Tower of Hanoi Problem with 4 Disks 2 | 3 | Starting state: 4 | A: 1 2 3 4 5 | B: 0 0 0 0 6 | C: 0 0 0 0 7 | ------------------------------------------ 8 | 9 | 10 | Subsequent states: 11 | 12 | A: 0 2 3 4 13 | B: 0 0 0 0 14 | C: 0 0 0 1 15 | ------------------------------------------ 16 | A: 0 0 3 4 17 | B: 0 0 0 2 18 | C: 0 0 0 1 19 | ------------------------------------------ 20 | A: 0 0 3 4 21 | B: 0 0 1 2 22 | C: 0 0 0 0 23 | ------------------------------------------ 24 | A: 0 0 0 4 25 | B: 0 0 1 2 26 | C: 0 0 0 3 27 | ------------------------------------------ 28 | A: 0 0 1 4 29 | B: 0 0 0 2 30 | C: 0 0 0 3 31 | ------------------------------------------ 32 | A: 0 0 1 4 33 | B: 0 0 0 0 34 | C: 0 0 2 3 35 | ------------------------------------------ 36 | A: 0 0 0 4 37 | B: 0 0 0 0 38 | C: 0 1 2 3 39 | ------------------------------------------ 40 | A: 0 0 0 0 41 | B: 0 0 0 4 42 | C: 0 1 2 3 43 | ------------------------------------------ 44 | A: 0 0 0 0 45 | B: 0 0 1 4 46 | C: 0 0 2 3 47 | ------------------------------------------ 48 | A: 0 0 0 2 49 | B: 0 0 1 4 50 | C: 0 0 0 3 51 | ------------------------------------------ 52 | A: 0 0 1 2 53 | B: 0 0 0 4 54 | C: 0 0 0 3 55 | ------------------------------------------ 56 | A: 0 0 1 2 57 | B: 0 0 3 4 58 | C: 0 0 0 0 59 | ------------------------------------------ 60 | A: 0 0 0 2 61 | B: 0 0 3 4 62 | C: 0 0 0 1 63 | ------------------------------------------ 64 | A: 0 0 0 0 65 | B: 0 2 3 4 66 | C: 0 0 0 1 67 | ------------------------------------------ 68 | A: 0 0 0 0 69 | B: 1 2 3 4 70 | C: 0 0 0 0 71 | ------------------------------------------ 72 | -------------------------------------------------------------------------------- /tests/31_args.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int argc, char **argv) 4 | { 5 | int Count; 6 | 7 | printf("hello world %d\n", argc); 8 | for (Count = 0; Count < argc; Count++) 9 | printf("arg %d: %s\n", Count, argv[Count]); 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /tests/31_args.expect: -------------------------------------------------------------------------------- 1 | hello world 5 2 | arg 0: - 3 | arg 1: arg1 4 | arg 2: arg2 5 | arg 3: arg3 6 | arg 4: arg4 7 | -------------------------------------------------------------------------------- /tests/32_led.expect: -------------------------------------------------------------------------------- 1 | _ _ _ _ 2 | | _| _| |_| |_ |_ | 3 | | |_ _| | _| |_| | 4 | 5 | -------------------------------------------------------------------------------- /tests/33_ternary_op.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int Count; 4 | 5 | for (Count = 0; Count < 10; Count++) 6 | { 7 | printf("%d\n", (Count < 5) ? (Count*Count) : (Count * 3)); 8 | } 9 | 10 | void main() {} 11 | -------------------------------------------------------------------------------- /tests/33_ternary_op.expect: -------------------------------------------------------------------------------- 1 | 0 2 | 1 3 | 4 4 | 9 5 | 16 6 | 15 7 | 18 8 | 21 9 | 24 10 | 27 11 | -------------------------------------------------------------------------------- /tests/34_array_assignment.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int a[4]; 4 | 5 | a[0] = 12; 6 | a[1] = 23; 7 | a[2] = 34; 8 | a[3] = 45; 9 | 10 | printf("%d %d %d %d\n", a[0], a[1], a[2], a[3]); 11 | 12 | int b[4]; 13 | 14 | b = a; 15 | 16 | printf("%d %d %d %d\n", b[0], b[1], b[2], b[3]); 17 | 18 | void main() {} 19 | -------------------------------------------------------------------------------- /tests/34_array_assignment.expect: -------------------------------------------------------------------------------- 1 | 12 23 34 45 2 | 12 23 34 45 3 | -------------------------------------------------------------------------------- /tests/35_sizeof.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char a; 4 | short b; 5 | 6 | printf("%d %d\n", sizeof(char), sizeof(a)); 7 | printf("%d %d\n", sizeof(short), sizeof(b)); 8 | 9 | void main() {} 10 | -------------------------------------------------------------------------------- /tests/35_sizeof.expect: -------------------------------------------------------------------------------- 1 | 1 1 2 | 2 2 3 | -------------------------------------------------------------------------------- /tests/36_array_initialisers.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int Count; 4 | 5 | int Array[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753 }; 6 | 7 | for (Count = 0; Count < 10; Count++) 8 | printf("%d: %d\n", Count, Array[Count]); 9 | 10 | int Array2[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753, }; 11 | 12 | for (Count = 0; Count < 10; Count++) 13 | printf("%d: %d\n", Count, Array2[Count]); 14 | 15 | 16 | void main() {} 17 | -------------------------------------------------------------------------------- /tests/36_array_initialisers.expect: -------------------------------------------------------------------------------- 1 | 0: 12 2 | 1: 34 3 | 2: 56 4 | 3: 78 5 | 4: 90 6 | 5: 123 7 | 6: 456 8 | 7: 789 9 | 8: 8642 10 | 9: 9753 11 | 0: 12 12 | 1: 34 13 | 2: 56 14 | 3: 78 15 | 4: 90 16 | 5: 123 17 | 6: 456 18 | 7: 789 19 | 8: 8642 20 | 9: 9753 21 | -------------------------------------------------------------------------------- /tests/37_sprintf.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char Buf[100]; 4 | int Count; 5 | 6 | for (Count = 1; Count <= 20; Count++) 7 | { 8 | sprintf(Buf, "->%02d<-\n", Count); 9 | printf("%s", Buf); 10 | } 11 | 12 | void main() {} 13 | -------------------------------------------------------------------------------- /tests/37_sprintf.expect: -------------------------------------------------------------------------------- 1 | ->01<- 2 | ->02<- 3 | ->03<- 4 | ->04<- 5 | ->05<- 6 | ->06<- 7 | ->07<- 8 | ->08<- 9 | ->09<- 10 | ->10<- 11 | ->11<- 12 | ->12<- 13 | ->13<- 14 | ->14<- 15 | ->15<- 16 | ->16<- 17 | ->17<- 18 | ->18<- 19 | ->19<- 20 | ->20<- 21 | -------------------------------------------------------------------------------- /tests/38_multiple_array_index.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int a[4][4]; 4 | int b = 0; 5 | int x; 6 | int y; 7 | 8 | for (x = 0; x < 4; x++) 9 | { 10 | for (y = 0; y < 4; y++) 11 | { 12 | b++; 13 | a[x][y] = b; 14 | } 15 | } 16 | 17 | 18 | 19 | for (x = 0; x < 4; x++) 20 | { 21 | printf("x=%d: ", x); 22 | for (y = 0; y < 4; y++) 23 | { 24 | printf("%d ", a[x][y]); 25 | } 26 | printf("\n"); 27 | } 28 | 29 | void main() {} 30 | -------------------------------------------------------------------------------- /tests/38_multiple_array_index.expect: -------------------------------------------------------------------------------- 1 | x=0: 1 2 3 4 2 | x=1: 5 6 7 8 3 | x=2: 9 10 11 12 4 | x=3: 13 14 15 16 5 | -------------------------------------------------------------------------------- /tests/39_typedef.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | typedef int MyInt; 4 | 5 | MyInt a = 1; 6 | printf("%d\n", a); 7 | 8 | struct FunStruct 9 | { 10 | int i; 11 | int j; 12 | }; 13 | 14 | typedef struct FunStruct MyFunStruct; 15 | 16 | MyFunStruct b; 17 | b.i = 12; 18 | b.j = 34; 19 | printf("%d,%d\n", b.i, b.j); 20 | 21 | typedef MyFunStruct *MoreFunThanEver; 22 | 23 | MoreFunThanEver c = &b; 24 | printf("%d,%d\n", c->i, c->j); 25 | 26 | void main() {} 27 | -------------------------------------------------------------------------------- /tests/39_typedef.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 12,34 3 | 12,34 4 | -------------------------------------------------------------------------------- /tests/40_stdio.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | FILE *f = fopen("fred.txt", "w"); 4 | fwrite("hello\nhello\n", 1, 12, f); 5 | fclose(f); 6 | 7 | char freddy[7]; 8 | f = fopen("fred.txt", "r"); 9 | if (fread(freddy, 1, 6, f) != 6) 10 | printf("couldn't read fred.txt\n"); 11 | 12 | freddy[6] = '\0'; 13 | fclose(f); 14 | 15 | printf("%s", freddy); 16 | 17 | char InChar; 18 | char ShowChar; 19 | f = fopen("fred.txt", "r"); 20 | while ( (InChar = fgetc(f)) != EOF) 21 | { 22 | ShowChar = InChar; 23 | if (ShowChar < ' ') 24 | ShowChar = '.'; 25 | 26 | printf("ch: %d '%c'\n", InChar, ShowChar); 27 | } 28 | fclose(f); 29 | 30 | f = fopen("fred.txt", "r"); 31 | while ( (InChar = getc(f)) != EOF) 32 | { 33 | ShowChar = InChar; 34 | if (ShowChar < ' ') 35 | ShowChar = '.'; 36 | 37 | printf("ch: %d '%c'\n", InChar, ShowChar); 38 | } 39 | fclose(f); 40 | 41 | f = fopen("fred.txt", "r"); 42 | while (fgets(freddy, sizeof(freddy), f) != NULL) 43 | printf("x: %s", freddy); 44 | 45 | fclose(f); 46 | 47 | void main() {} 48 | -------------------------------------------------------------------------------- /tests/40_stdio.expect: -------------------------------------------------------------------------------- 1 | hello 2 | ch: 104 'h' 3 | ch: 101 'e' 4 | ch: 108 'l' 5 | ch: 108 'l' 6 | ch: 111 'o' 7 | ch: 10 '.' 8 | ch: 104 'h' 9 | ch: 101 'e' 10 | ch: 108 'l' 11 | ch: 108 'l' 12 | ch: 111 'o' 13 | ch: 10 '.' 14 | ch: 104 'h' 15 | ch: 101 'e' 16 | ch: 108 'l' 17 | ch: 108 'l' 18 | ch: 111 'o' 19 | ch: 10 '.' 20 | ch: 104 'h' 21 | ch: 101 'e' 22 | ch: 108 'l' 23 | ch: 108 'l' 24 | ch: 111 'o' 25 | ch: 10 '.' 26 | x: hello 27 | x: hello 28 | -------------------------------------------------------------------------------- /tests/41_hashif.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | printf("#include test\n"); 4 | 5 | #if 1 6 | #if 0 7 | printf("a\n"); 8 | #else 9 | printf("b\n"); 10 | #endif 11 | #else 12 | #if 0 13 | printf("c\n"); 14 | #else 15 | printf("d\n"); 16 | #endif 17 | #endif 18 | 19 | #if 0 20 | #if 1 21 | printf("e\n"); 22 | #else 23 | printf("f\n"); 24 | #endif 25 | #else 26 | #if 1 27 | printf("g\n"); 28 | #else 29 | printf("h\n"); 30 | #endif 31 | #endif 32 | 33 | #define DEF 34 | 35 | #ifdef DEF 36 | #ifdef DEF 37 | printf("i\n"); 38 | #else 39 | printf("j\n"); 40 | #endif 41 | #else 42 | #ifdef DEF 43 | printf("k\n"); 44 | #else 45 | printf("l\n"); 46 | #endif 47 | #endif 48 | 49 | #ifndef DEF 50 | #ifndef DEF 51 | printf("m\n"); 52 | #else 53 | printf("n\n"); 54 | #endif 55 | #else 56 | #ifndef DEF 57 | printf("o\n"); 58 | #else 59 | printf("p\n"); 60 | #endif 61 | #endif 62 | 63 | #define ONE 1 64 | #define ZERO 0 65 | 66 | #if ONE 67 | #if ZERO 68 | printf("q\n"); 69 | #else 70 | printf("r\n"); 71 | #endif 72 | #else 73 | #if ZERO 74 | printf("s\n"); 75 | #else 76 | printf("t\n"); 77 | #endif 78 | #endif 79 | 80 | void main() {} 81 | -------------------------------------------------------------------------------- /tests/41_hashif.expect: -------------------------------------------------------------------------------- 1 | #include test 2 | b 3 | g 4 | i 5 | p 6 | r 7 | -------------------------------------------------------------------------------- /tests/42_function_pointer.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int fred(int p) 4 | { 5 | printf("yo %d\n", p); 6 | return 42; 7 | } 8 | 9 | int (*f)(int) = &fred; 10 | 11 | int main() 12 | { 13 | printf("%d\n", (*f)(24)); 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /tests/43_void_param.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void fred(void) 4 | { 5 | printf("yo\n"); 6 | } 7 | 8 | fred(); 9 | 10 | void main() {} 11 | -------------------------------------------------------------------------------- /tests/43_void_param.expect: -------------------------------------------------------------------------------- 1 | yo 2 | -------------------------------------------------------------------------------- /tests/44_scoped_declarations.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int a; 4 | 5 | for (a = 0; a < 2; a++) 6 | { 7 | int b = a; 8 | } 9 | 10 | printf("it's all good\n"); 11 | 12 | void main() {} 13 | -------------------------------------------------------------------------------- /tests/44_scoped_declarations.expect: -------------------------------------------------------------------------------- 1 | it's all good 2 | -------------------------------------------------------------------------------- /tests/45_empty_for.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int Count = 0; 6 | 7 | for (;;) 8 | { 9 | Count++; 10 | printf("%d\n", Count); 11 | if (Count >= 10) 12 | break; 13 | } 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /tests/45_empty_for.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | 3 4 | 4 5 | 5 6 | 6 7 | 7 8 | 8 9 | 9 10 | 10 11 | -------------------------------------------------------------------------------- /tests/47_switch_return.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void fred(int x) 4 | { 5 | switch (x) 6 | { 7 | case 1: printf("1\n"); return; 8 | case 2: printf("2\n"); break; 9 | case 3: printf("3\n"); return; 10 | } 11 | 12 | printf("out\n"); 13 | } 14 | 15 | int main() 16 | { 17 | fred(1); 18 | fred(2); 19 | fred(3); 20 | 21 | return 0; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /tests/47_switch_return.expect: -------------------------------------------------------------------------------- 1 | 1 2 | 2 3 | out 4 | 3 5 | -------------------------------------------------------------------------------- /tests/48_nested_break.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int a; 4 | char b; 5 | 6 | a = 0; 7 | while (a < 2) 8 | { 9 | printf("%d", a++); 10 | break; 11 | 12 | b = 'A'; 13 | while (b < 'C') 14 | { 15 | printf("%c", b++); 16 | } 17 | printf("e"); 18 | } 19 | printf("\n"); 20 | 21 | int main() 22 | { 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /tests/48_nested_break.expect: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /tests/49_bracket_evaluation.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct point 4 | { 5 | double x; 6 | double y; 7 | }; 8 | 9 | struct point point_array[100]; 10 | 11 | int main() 12 | { 13 | int my_point = 10; 14 | 15 | point_array[my_point].x = 12.34; 16 | point_array[my_point].y = 56.78; 17 | 18 | printf("%f, %f\n", point_array[my_point].x, point_array[my_point].y); 19 | 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /tests/49_bracket_evaluation.expect: -------------------------------------------------------------------------------- 1 | 12.340000, 56.780000 2 | -------------------------------------------------------------------------------- /tests/50_logical_second_arg.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int fred() 4 | { 5 | printf("fred\n"); 6 | return 0; 7 | } 8 | 9 | int joe() 10 | { 11 | printf("joe\n"); 12 | return 1; 13 | } 14 | 15 | int main() 16 | { 17 | printf("%d\n", fred() && joe()); 18 | printf("%d\n", fred() || joe()); 19 | printf("%d\n", joe() && fred()); 20 | printf("%d\n", joe() || fred()); 21 | printf("%d\n", fred() && (1 + joe())); 22 | printf("%d\n", fred() || (0 + joe())); 23 | printf("%d\n", joe() && (0 + fred())); 24 | printf("%d\n", joe() || (1 + fred())); 25 | 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /tests/50_logical_second_arg.expect: -------------------------------------------------------------------------------- 1 | fred 2 | 0 3 | fred 4 | joe 5 | 1 6 | joe 7 | fred 8 | 0 9 | joe 10 | 1 11 | fred 12 | 0 13 | fred 14 | joe 15 | 1 16 | joe 17 | fred 18 | 0 19 | joe 20 | 1 21 | -------------------------------------------------------------------------------- /tests/51_static.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static int fred = 1234; 4 | static int joe; 5 | 6 | void henry() 7 | { 8 | static int fred = 4567; 9 | 10 | printf("%d\n", fred); 11 | fred++; 12 | } 13 | 14 | void main() 15 | { 16 | printf("%d\n", fred); 17 | henry(); 18 | henry(); 19 | henry(); 20 | henry(); 21 | printf("%d\n", fred); 22 | fred = 8901; 23 | joe = 2345; 24 | printf("%d\n", fred); 25 | printf("%d\n", joe); 26 | } 27 | -------------------------------------------------------------------------------- /tests/51_static.expect: -------------------------------------------------------------------------------- 1 | 1234 2 | 4567 3 | 4568 4 | 4569 5 | 4570 6 | 1234 7 | 8901 8 | 2345 9 | -------------------------------------------------------------------------------- /tests/52_unnamed_enum.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | enum fred { a, b, c }; 4 | 5 | printf("a=%d\n", a); 6 | printf("b=%d\n", b); 7 | printf("c=%d\n", c); 8 | 9 | enum fred d; 10 | 11 | typedef enum { e, f, g } h; 12 | typedef enum { i, j, k } m; 13 | 14 | printf("e=%d\n", e); 15 | printf("f=%d\n", f); 16 | printf("g=%d\n", g); 17 | 18 | printf("i=%d\n", i); 19 | printf("j=%d\n", j); 20 | printf("k=%d\n", k); 21 | 22 | void main() 23 | { 24 | } 25 | -------------------------------------------------------------------------------- /tests/52_unnamed_enum.expect: -------------------------------------------------------------------------------- 1 | a=0 2 | b=1 3 | c=2 4 | e=0 5 | f=1 6 | g=2 7 | i=0 8 | j=1 9 | k=2 10 | -------------------------------------------------------------------------------- /tests/54_goto.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void fred() 4 | { 5 | printf("In fred()\n"); 6 | goto done; 7 | printf("In middle\n"); 8 | done: 9 | printf("At end\n"); 10 | } 11 | 12 | void joe() 13 | { 14 | int b = 5678; 15 | 16 | printf("In joe()\n"); 17 | 18 | { 19 | int c = 1234; 20 | printf("c = %d\n", c); 21 | goto outer; 22 | printf("uh-oh\n"); 23 | } 24 | 25 | outer: 26 | 27 | printf("done\n"); 28 | } 29 | 30 | void henry() 31 | { 32 | int a; 33 | 34 | printf("In henry()\n"); 35 | goto inner; 36 | 37 | { 38 | int b; 39 | inner: 40 | b = 1234; 41 | printf("b = %d\n", b); 42 | } 43 | 44 | printf("done\n"); 45 | } 46 | 47 | void main() 48 | { 49 | fred(); 50 | joe(); 51 | henry(); 52 | } 53 | -------------------------------------------------------------------------------- /tests/54_goto.expect: -------------------------------------------------------------------------------- 1 | In fred() 2 | At end 3 | In joe() 4 | c = 1234 5 | done 6 | In henry() 7 | b = 1234 8 | done 9 | -------------------------------------------------------------------------------- /tests/55_array_initialiser.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int fred[3] = { 12, 34, 56 }; 6 | double joe[] = { 23.4, 56.7, 89.0 }; 7 | 8 | printf("%d %d %d\n", fred[0], fred[1], fred[2]); 9 | printf("%f %f %f\n", joe[0], joe[1], joe[2]); 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /tests/55_array_initialiser.expect: -------------------------------------------------------------------------------- 1 | 12 34 56 2 | 23.400000 56.700000 89.000000 3 | -------------------------------------------------------------------------------- /tests/56_cross_structure.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct s1; 4 | 5 | struct s2 6 | { 7 | struct s1 *s; 8 | }; 9 | 10 | struct s1 11 | { 12 | struct s2 *s; 13 | }; 14 | 15 | void main() 16 | { 17 | printf("ok\n"); 18 | } 19 | -------------------------------------------------------------------------------- /tests/56_cross_structure.expect: -------------------------------------------------------------------------------- 1 | ok 2 | -------------------------------------------------------------------------------- /tests/Makefile: -------------------------------------------------------------------------------- 1 | TESTS= 00_assignment.test \ 2 | 01_comment.test \ 3 | 02_printf.test \ 4 | 03_struct.test \ 5 | 04_for.test \ 6 | 05_array.test \ 7 | 06_case.test \ 8 | 07_function.test \ 9 | 08_while.test \ 10 | 09_do_while.test \ 11 | 10_pointer.test \ 12 | 11_precedence.test \ 13 | 12_hashdefine.test \ 14 | 13_integer_literals.test \ 15 | 14_if.test \ 16 | 15_recursion.test \ 17 | 16_nesting.test \ 18 | 17_enum.test \ 19 | 18_include.test \ 20 | 19_pointer_arithmetic.test \ 21 | 20_pointer_comparison.test \ 22 | 21_char_array.test \ 23 | 22_floating_point.test \ 24 | 23_type_coercion.test \ 25 | 24_math_library.test \ 26 | 25_quicksort.test \ 27 | 26_character_constants.test \ 28 | 28_strings.test \ 29 | 29_array_address.test \ 30 | 30_hanoi.test \ 31 | 31_args.test \ 32 | 32_led.test \ 33 | 33_ternary_op.test \ 34 | 34_array_assignment.test \ 35 | 35_sizeof.test \ 36 | 36_array_initialisers.test \ 37 | 37_sprintf.test \ 38 | 38_multiple_array_index.test \ 39 | 39_typedef.test \ 40 | 40_stdio.test \ 41 | 41_hashif.test \ 42 | 43_void_param.test \ 43 | 44_scoped_declarations.test \ 44 | 45_empty_for.test \ 45 | 47_switch_return.test \ 46 | 48_nested_break.test \ 47 | 49_bracket_evaluation.test \ 48 | 50_logical_second_arg.test \ 49 | 51_static.test \ 50 | 52_unnamed_enum.test \ 51 | 54_goto.test \ 52 | 55_array_initialiser.test \ 53 | 56_cross_structure.test 54 | 55 | %.test: %.expect %.c 56 | @echo Test: $*... 57 | @if [ "x`echo $* | grep args`" != "x" ]; \ 58 | then \ 59 | ../picoc $*.c - arg1 arg2 arg3 arg4 2>&1 >$*.output; \ 60 | else \ 61 | ../picoc $*.c 2>&1 >$*.output; \ 62 | fi 63 | @if [ "x`diff -qbu $*.expect $*.output`" != "x" ]; \ 64 | then \ 65 | echo "error in test $*"; \ 66 | diff -u $*.expect $*.output; \ 67 | rm -f $*.output; \ 68 | exit 1; \ 69 | fi; \ 70 | rm -f $*.output 71 | 72 | all: test 73 | 74 | test: $(TESTS) 75 | @echo "test passed" 76 | --------------------------------------------------------------------------------