├── README.bak ├── README.md ├── SDCC_licenses.txt ├── adc_demo1 ├── Makefile ├── adc_demo_01.c ├── adc_pfs154.h └── uart.h ├── adc_demo2 ├── Makefile ├── adc_demo_02.c ├── adc_pfs154.h ├── seg7mpx_dig2.h └── uart.h ├── adc_demo3 ├── Makefile ├── adc_demo_03.c ├── adc_pfs154.h └── seg7mpx_dig4.h ├── blink ├── Makefile └── blink.c ├── blink_int ├── Makefile ├── blink_int.c └── blink_intb.c ├── blink_int2 ├── Makefile ├── blink_int2.c └── t16.txt ├── charlie16_plexing ├── Makefile ├── charlie16.h └── charlie16_demo.c ├── charlie16_uart ├── Makefile ├── charle16_pc │ ├── Makefile │ ├── charlie16_send.c │ ├── minirs232.c │ └── minirs232.h ├── charlie16.h ├── charlie16_send └── charlie16_uart.c ├── charlie20_plexing ├── Makefile ├── charlie20.h └── charlie20_demo.c ├── cide.cfg ├── cide.dsk ├── cide.ini ├── doc └── pfsprog.doc ├── gerber_files ├── gerberfiles.zip ├── pfs154_layout_view.jpg ├── pfs154_programmer_foto.jpg └── pfs154_progshield_schematic.gif ├── i2c_busscan ├── Makefile ├── i2c.h ├── i2c_scan.c └── uart.h ├── i2c_pcf8574 ├── Makefile ├── i2c.h ├── pcf8574_lauf.c ├── pcf8574_readtest.c └── uart.h ├── include ├── adc_pfs154.h ├── auto_sysclock.h ├── charlie16.h ├── charlie20.h ├── delay.h ├── easy-pdk │ ├── README.md │ ├── calibrate.h │ └── serial_num.h ├── hd44780.h ├── hx1838.h ├── hx1838_nec.h ├── i2c.h ├── my_printf.h ├── n5110.h ├── oled1306_i2c.h ├── pdk │ ├── README.md │ ├── device.h │ ├── device │ │ ├── periph │ │ │ ├── accumulator.h │ │ │ ├── adc.h │ │ │ ├── bandgap.h │ │ │ ├── clock.h │ │ │ ├── comparator.h │ │ │ ├── external_oscillator.h │ │ │ ├── interrupt.h │ │ │ ├── misc.h │ │ │ ├── misc2.h │ │ │ ├── misclvr.h │ │ │ ├── misclvr_basic.h │ │ │ ├── multiplier.h │ │ │ ├── port_a.h │ │ │ ├── port_b.h │ │ │ ├── port_c.h │ │ │ ├── pwmg_0.h │ │ │ ├── pwmg_1.h │ │ │ ├── pwmg_2.h │ │ │ ├── pwmg_basic.h │ │ │ ├── rop.h │ │ │ ├── stack.h │ │ │ ├── timer_16.h │ │ │ ├── timer_2.h │ │ │ └── timer_3.h │ │ ├── pfs154.h │ │ ├── pfs172.h │ │ ├── pfs173.h │ │ ├── pms131.h │ │ ├── pms150c.h │ │ ├── pms152.h │ │ ├── pms154b.h │ │ ├── pms154c.h │ │ └── pms171b.h │ ├── factory_calibration.h │ ├── fuse.h │ ├── sysclock.h │ └── util.h ├── pdk_init.h ├── pfs1xx_gpio.h ├── rda5807.h ├── seg7mpx_dig2.h ├── seg7mpx_dig3.h ├── seg7mpx_dig4.h ├── tm1637_seg7.h ├── toene.h └── uart.h ├── ir_nec ├── Makefile ├── hx1838_nec.h ├── ir_receiver_switch.c └── tm1637_seg7.h ├── ir_receiver ├── Makefile ├── hx1838.h ├── ir_receiver_demo.c └── tm1637_seg7.h ├── ir_receiver_2 ├── Makefile ├── hx1838.h ├── ir_receiver_switch.c └── tm1637_seg7.h ├── lauflicht ├── Makefile └── lauflicht.c ├── lauflicht_shooter ├── Makefile └── laufgame1.c ├── leuchtband ├── Makefile ├── comp_registers.txt ├── leuchtband.c ├── picture │ ├── nf_gleichrichter_simulation.png │ ├── pfs154_spgteiler_intern.png │ └── vu_meter_pfs154.gif ├── simulator │ └── audio_gleichrichter.txt └── xls │ └── pfs154_spannungsteiler2.xls ├── lm75_demo ├── Makefile ├── i2c.h ├── lm75_demo.c ├── n5110.h └── uart.h ├── lm75_demo2 ├── Makefile ├── dig3_demo.c ├── i2c.h ├── lm75_demo2.c └── seg7mpx_dig3.h ├── makefile.mk ├── melody ├── Makefile ├── toene.h └── yamep.c ├── n5110_demo ├── Makefile ├── n5110.h └── n5110_demo.c ├── notes ├── SDCC_licenses.txt ├── adc_funktionsweise.txt ├── comparator_registers.txt ├── ntctable_readme.txt └── pinmapping.dok ├── ntc ├── Makefile ├── adc_pfs154.h ├── divers │ ├── adc_funktionsweise.txt │ ├── ntc10k_3950.lut │ ├── ntc10k_3977.lut │ ├── ntc_excel_scr.png │ ├── ntc_values.xls │ ├── ntctable │ ├── ntctable_readme.txt │ ├── ntctable_src │ │ ├── Makefile │ │ ├── ntctable.c │ │ └── readme.txt │ ├── padauk_thermometer_02.gif │ └── temp_schaetzometer.jpg ├── i2c.h ├── ntc10k_3950.lut ├── ntc10k_3977.lut ├── ntc_vers_02.c ├── seg7mpx_dig2.h └── uart.h ├── oled1306_i2c ├── Makefile ├── i2c.h ├── oled1306_i2c.h └── oled_demo.c ├── pfs154_pinout.txt ├── pfsprog_arduino_sketch ├── README.md └── pfs154_prog2.ino ├── pfsprog_arduinobased_programmer ├── Makefile ├── firmware │ ├── Makefile │ ├── avr_gpio.h │ ├── makefile.mk │ ├── my_printf.c │ ├── my_printf.h │ ├── my_printf.o │ ├── pfs154_prog2.c │ ├── pfs154_prog2.elf │ ├── pfs154_prog2.hex │ ├── pfs154_prog2.o │ ├── uart_all.c │ ├── uart_all.h │ └── uart_all.o ├── jedi.inc ├── pfsprog ├── pfsprog.pas ├── pictures │ ├── pfs154_programmer_shield_3.gif │ ├── pfs154_progshield_schematic.jpg │ ├── pfs_progshield_bestueck_kl.jpg │ ├── pfs_progshield_loet_kl.jpg │ └── pfsprog_lochstreifen.gif ├── synafpc.pas ├── synaser.pas └── synautil.pas ├── pwm ├── Makefile ├── pwm.c └── timer_2_3_reg.txt ├── rda5807_ukw ├── Makefile ├── i2c.h ├── rda5807.h └── ukw_radio.c ├── readme.txt ├── seg7_2_digit ├── Makefile ├── seg7_demo.c └── seg7mpx_dig2.h ├── seg7_3_digit ├── Makefile ├── dig3_demo.c └── seg7mpx_dig3.h ├── seg7_4_digit ├── Makefile ├── dig4_demo.c └── seg7mpx_dig4.h ├── servo ├── Makefile ├── timer3_servo.c └── timer_2_3_reg.txt ├── setup32 ├── setup64 ├── shiftreg ├── Makefile └── shiftreg_demo.c ├── src ├── adc_pfs154.c ├── charlie16.c ├── charlie20.c ├── delay.c ├── hd44780.c ├── hx1838.c ├── hx1838_nec.c ├── i2c.c ├── i2c_b.c ├── my_printf.c ├── n5110.c ├── oled1306_i2c.c ├── rda5807.c ├── seg7mpx_dig2.c ├── seg7mpx_dig4.c ├── tm1637_seg7.c ├── toene.c └── uart.c ├── timer2_demo ├── Makefile ├── timer2_blink.c └── timer_2_3_reg.txt ├── tms1637_4digit ├── Makefile ├── tm1637_demo.c └── tm1637_seg7.h ├── tools ├── bin │ ├── ch340reset │ ├── easypdkprog │ ├── makebin │ ├── packihx │ ├── pfsprog │ ├── pfsreadhex │ ├── sdaspdk13 │ ├── sdaspdk14 │ ├── sdaspdk15 │ ├── sdcc │ ├── sdcdb │ ├── sdcdb.el │ ├── sdcdbsrc.el │ ├── sdcpp │ ├── sdld │ ├── sdldpdk │ ├── sdobjcopy │ ├── sdranlib │ └── spdk ├── bin32 │ ├── ch340reset │ ├── easypdkprog │ ├── makebin │ ├── packihx │ ├── pfsprog │ ├── pfsreadhex │ ├── sdaspdk13 │ ├── sdaspdk14 │ ├── sdaspdk15 │ ├── sdcc │ ├── sdcdb │ ├── sdcdb.el │ ├── sdcdbsrc.el │ ├── sdcpp │ ├── sdld │ ├── sdldpdk │ ├── sdobjcopy │ ├── sdranlib │ └── spdk ├── bin64 │ ├── ch340reset │ ├── easypdkprog │ ├── makebin │ ├── packihx │ ├── pfsprog │ ├── pfsreadhex │ ├── sdaspdk13 │ ├── sdaspdk14 │ ├── sdaspdk15 │ ├── sdcc │ ├── sdcdb │ ├── sdcdb.el │ ├── sdcdbsrc.el │ ├── sdcpp │ ├── sdld │ ├── sdldpdk │ ├── sdobjcopy │ ├── sdranlib │ └── spdk ├── ch340reset │ ├── Makefile │ ├── ch340reset.c │ ├── ch340reset.h │ ├── device.c │ ├── endpoint.c │ ├── interface.c │ ├── list.h │ ├── makefile.mk │ ├── raw.c │ ├── short_types.h │ └── usb.h ├── doc │ ├── ChangeLog.head │ └── README ├── include │ ├── asm │ │ ├── assert.h │ │ ├── ctype.h │ │ ├── default │ │ │ └── features.h │ │ ├── ds80c390.h │ │ ├── errno.h │ │ ├── float.h │ │ ├── iso646.h │ │ ├── limits.h │ │ ├── math.h │ │ ├── sdcc-lib.h │ │ ├── setjmp.h │ │ ├── signal.h │ │ ├── stdalign.h │ │ ├── stdarg.h │ │ ├── stdatomic.h │ │ ├── stdbool.h │ │ ├── stddef.h │ │ ├── stdint.h │ │ ├── stdio.h │ │ ├── stdlib.h │ │ ├── stdnoreturn.h │ │ ├── string.h │ │ ├── time.h │ │ ├── tinibios.h │ │ ├── typeof.h │ │ ├── uchar.h │ │ └── wchar.h │ ├── assert.h │ ├── ctype.h │ ├── ds80c390.h │ ├── errno.h │ ├── float.h │ ├── iso646.h │ ├── limits.h │ ├── math.h │ ├── sdcc-lib.h │ ├── setjmp.h │ ├── signal.h │ ├── stdalign.h │ ├── stdarg.h │ ├── stdatomic.h │ ├── stdbool.h │ ├── stddef.h │ ├── stdint.h │ ├── stdio.h │ ├── stdlib.h │ ├── stdnoreturn.h │ ├── string.h │ ├── time.h │ ├── tinibios.h │ ├── typeof.h │ ├── uchar.h │ └── wchar.h ├── lib │ ├── pdk13.lib │ ├── pdk13 │ │ └── pdk13.lib │ ├── pdk14.lib │ ├── pdk14 │ │ └── pdk14.lib │ ├── pdk15-stack-auto │ │ └── pdk15.lib │ ├── pdk15.lib │ └── pdk15 │ │ └── pdk15.lib ├── pfsprog │ ├── Makefile │ ├── firmware │ │ ├── Makefile │ │ ├── avr_gpio.h │ │ ├── makefile.mk │ │ ├── my_printf.c │ │ ├── my_printf.h │ │ ├── pfs154_prog2_1.c │ │ ├── pfs154_prog2_1.hex │ │ ├── uart_all.c │ │ └── uart_all.h │ ├── jedi.inc │ ├── pfsprog │ ├── pfsprog.pas │ ├── pictures │ │ ├── pfs154_programmer_shield_3.gif │ │ ├── pfs154_progshield_schematic.gif │ │ ├── pfs_progshield_bestueck_kl.jpg │ │ ├── pfs_progshield_loet_kl.jpg │ │ └── pfsprog_lochstreifen.gif │ ├── synafpc.pas │ ├── synaser.pas │ └── synautil.pas └── pfsreadhex │ ├── Makefile │ └── pfsreadhex.c ├── txt_lcd ├── Makefile ├── hd44780.h └── txtlcd_demo.c ├── uart_demo ├── Makefile ├── uart.h └── uart_demo.c └── vu_meter ├── Makefile ├── comp_registers.txt ├── pfs154_spgteiler_intern.png └── vu_meter.c /adc_demo1/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = adc_demo_01 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | 14 | # hier alle zusaetzlichen Softwaremodule angegeben 15 | SRCS = ../src/delay.rel 16 | SRCS += ../src/uart.rel 17 | SRCS += ../src/my_printf.rel 18 | SRCS += ../src/adc_pfs154.rel 19 | 20 | INC_DIR = -I./ -I../include 21 | 22 | # benutzbare Programmer: 23 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 24 | # 2 : pfsprog ==> benoetigt serielle Portangabe 25 | 26 | PROGRAMMER = 2 27 | SERPORT = /dev/ttyUSB0 28 | CH340RESET = 1 29 | 30 | include ../makefile.mk 31 | -------------------------------------------------------------------------------- /adc_demo2/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = adc_demo_02 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | 14 | # hier alle zusaetzlichen Softwaremodule angegeben 15 | SRCS = ../src/delay.rel 16 | SRCS += ../src/uart.rel 17 | SRCS += ../src/my_printf.rel 18 | SRCS += ../src/adc_pfs154.rel 19 | SRCS += ../src/seg7mpx_dig2.rel 20 | 21 | INC_DIR = -I./ -I../include 22 | 23 | # benutzbare Programmer: 24 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 25 | # 2 : pfsprog ==> benoetigt serielle Portangabe 26 | 27 | PROGRAMMER = 2 28 | SERPORT = /dev/ttyUSB0 29 | CH340RESET = 1 30 | 31 | include ../makefile.mk 32 | -------------------------------------------------------------------------------- /adc_demo3/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = adc_demo_03 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | 14 | # hier alle zusaetzlichen Softwaremodule angegeben 15 | SRCS = ../src/delay.rel 16 | SRCS += ../src/adc_pfs154.rel 17 | SRCS += ../src/seg7mpx_dig4.rel 18 | 19 | INC_DIR = -I./ -I../include 20 | 21 | # benutzbare Programmer: 22 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 23 | # 2 : pfsprog ==> benoetigt serielle Portangabe 24 | 25 | PROGRAMMER = 2 26 | SERPORT = /dev/ttyUSB0 27 | CH340RESET = 1 28 | 29 | 30 | include ../makefile.mk 31 | -------------------------------------------------------------------------------- /adc_demo3/seg7mpx_dig4.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------- 2 | seg7mpx_dig4.h 3 | 4 | Header fuer Softwaremodul einer 4-stelligen gemultiplexten 5 | 7-Segmentanzeige mit gemeinsamer Kathode 6 | 7 | verwendet 8-Bit Timer2 8 | 9 | Compiler : SDCC 4.0.3 10 | MCU : PFS154 / PFS173 11 | 12 | Mittels defines (Kommentare beachten) kann zwischen 13 | Anzeigen mit gemeinsamer Anode und gemeinsamer Kathode 14 | umgeschaltet werden. 15 | 16 | 02.11.2020 R. Seelig 17 | -------------------------------------------------------------- */ 18 | 19 | #ifndef in_seg7mpx_dig4 20 | #define in_seg7mpx_dig4 21 | 22 | #include 23 | #include 24 | #include "pfs1xx_gpio.h" 25 | 26 | // -------------------------------------------------------- 27 | // 28 | // Anschlussbelegung der 7-Segmentanzeige an den 29 | // Controller 30 | // 31 | // PB0..PB6 fuer die 7-Segmentanzeige; 32 | // PB0: Segment a, B6: Segment g 33 | // Pxx: Dezimalpunk (DP) 34 | // PA0: MPX Digit0 35 | // PA7: MPX Digit1 36 | // PA6: MPX Digit2 37 | // PA5: MPX digit3 38 | // -------------------------------------------------------- 39 | 40 | #define seg7_pin_init() { PBC= 0xff; PAC= 0xf1; } 41 | 42 | #define mpx0_set() PA0_clr() 43 | #define mpx0_clr() PA0_set() 44 | #define mpx1_set() PA7_clr() 45 | #define mpx1_clr() PA7_set() 46 | #define mpx2_set() PA6_clr() 47 | #define mpx2_clr() PA6_set() 48 | #define mpx3_set() PA5_clr() 49 | #define mpx3_clr() PA5_set() 50 | 51 | #define dp_set() ( PB7_set() ) 52 | #define dp_clr() ( PB7_clr() ) 53 | 54 | enum {zmode, smode}; 55 | 56 | // -------------------------------------------------------- 57 | // globale Variable 58 | // -------------------------------------------------------- 59 | extern uint16_t s7buf; // nimmt den Zahlenwert auf, der hexadezimal auf der 60 | // 2-stelligen Anzeige angezeigt wird 61 | // Bit7 nimmt bei verfuegbarem Dezimalpunkt eben diesen auf 62 | 63 | extern uint8_t seg7_dp; // nimmt die Position des Dezimalpunktes auf 64 | 65 | // -------------------------------------------------------- 66 | // Prototypen 67 | // -------------------------------------------------------- 68 | 69 | void seg7_init(void); 70 | void seg7_mpx(void); 71 | uint16_t hex2bcd16(uint16_t value); 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /blink/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = blink 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | 16 | INC_DIR = -I./ -I../include 17 | 18 | # benutzbare Programmer: 19 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 20 | # 2 : pfsprog ==> benoetigt serielle Portangabe 21 | 22 | PROGRAMMER = 2 23 | SERPORT = /dev/ttyUSB0 24 | CH340RESET = 1 25 | 26 | 27 | include ../makefile.mk 28 | -------------------------------------------------------------------------------- /blink/blink.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------- 2 | blink.c 3 | 4 | erstes Blinky - Demoprogramm fuer den Padauk PFS154 5 | "Ulta-Low-Cost" Controller. 6 | 7 | Blinkprogramm mit 2 unterschiedlichen Blinkfrequenzen 8 | die mittels Taster ausgewaehlt werden koennen. 9 | 10 | Compiler : SDCC 4.0.3 11 | MCU : PFS154 12 | 13 | 07.10.2020 R. Seelig 14 | 15 | -------------------------------------------------------- */ 16 | 17 | #include 18 | #include "pdk_init.h" 19 | #include "pfs1xx_gpio.h" 20 | #include "delay.h" 21 | 22 | // LED-Anschlusspin 23 | 24 | #define led_init() PA0_output_init() 25 | #define led_set() PA0_set() 26 | #define led_clr() PA0_clr() 27 | #define led_toggle() PA0_toggle() 28 | 29 | 30 | #define speed1 1000 31 | 32 | 33 | /* -------------------------------------------------- 34 | main 35 | -------------------------------------------------- */ 36 | void main(void) 37 | { 38 | 39 | led_init(); 40 | 41 | while(1) 42 | { 43 | /* 44 | led_toggle(); 45 | delay(speed1); 46 | */ 47 | 48 | led_clr(); 49 | delay(speed1); 50 | led_set(); 51 | delay(speed1); 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /blink_int/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = blink_intb 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | 14 | 15 | # hier alle zusaetzlichen Softwaremodule angegeben 16 | SRCS = 17 | 18 | INC_DIR = -I./ -I../include 19 | 20 | # benutzbare Programmer: 21 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 22 | # 2 : pfsprog ==> benoetigt serielle Portangabe 23 | 24 | PROGRAMMER = 2 25 | SERPORT = /dev/ttyUSB0 26 | CH340RESET = 1 27 | 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /blink_int2/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = blink_int2 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | 14 | 15 | # hier alle zusaetzlichen Softwaremodule angegeben 16 | SRCS = 17 | 18 | INC_DIR = -I./ -I../include 19 | 20 | # benutzbare Programmer: 21 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 22 | # 2 : pfsprog ==> benoetigt serielle Portangabe 23 | 24 | PROGRAMMER = 2 25 | SERPORT = /dev/ttyUSB0 26 | CH340RESET = 1 27 | 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /charlie16_plexing/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = charlie16_demo 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | SRCS += ../src/charlie16.rel 16 | 17 | INC_DIR = -I./ -I../include 18 | 19 | # benutzbare Programmer: 20 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 21 | # 2 : pfsprog ==> benoetigt serielle Portangabe 22 | 23 | PROGRAMMER = 2 24 | SERPORT = /dev/ttyUSB0 25 | CH340RESET = 1 26 | 27 | include ../makefile.mk 28 | -------------------------------------------------------------------------------- /charlie16_plexing/charlie16_demo.c: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------- 2 | charlie_demo.c 3 | 4 | Demoprogramm fuer Ansteuerung von 20 LED's mittels 5 | Charlieplexing 6 | 7 | Compiler : SDCC 4.0.3 8 | MCU : PFS154 9 | 10 | 19.10.2020 R. Seelig 11 | ------------------------------------------------------ */ 12 | 13 | #include 14 | 15 | #include 16 | #include "pdk_init.h" 17 | #include "pfs1xx_gpio.h" 18 | 19 | #include "delay.h" 20 | #include "charlie16.h" 21 | 22 | 23 | 24 | /* -------------------------------------------------------- 25 | interrupt 26 | 27 | der Interrupt-Handler 28 | 29 | Leider hat sich (scheinbar) ein BUG in SDCC 4.0.3 30 | bzgl. des Schreibens eines 16-Bit Timerwertes ein- 31 | geschlichen und deshalb wird das Zaehlerregister 32 | des Timers mittels Maschinenbefehle beschrieben 33 | 34 | Interrupt wird jede Millisekunde aufgerufen (Reload- 35 | wert in charlie20.c) 36 | 37 | -------------------------------------------------------- */ 38 | void interrupt(void) __interrupt(0) 39 | { 40 | 41 | if (INTRQ & INTRQ_T16) 42 | { 43 | 44 | // Reloadwert des 16-Bit Timers setzen 45 | __asm 46 | 47 | mov a,_reload+0 48 | mov __t16c+0,a 49 | mov a,_reload+1 50 | mov __t16c+1,a 51 | 52 | stt16 __t16c 53 | __endasm; 54 | 55 | // Aufruf der einzelnen Charlieplexing-Linien 56 | charlie16_mpxlines(); 57 | 58 | INTRQ &= ~INTRQ_T16; // Interruptanforderung quittieren 59 | } 60 | } 61 | 62 | 63 | 64 | /* ------------------------------------------------------ 65 | main 66 | ------------------------------------------------------ */ 67 | int main(void) 68 | { 69 | uint16_t i; 70 | 71 | charlie16_init(); 72 | 73 | while(1) 74 | { 75 | charlie16_buf= 1; 76 | for (i= 0; i< 15; i++) 77 | { 78 | delay(300); 79 | charlie16_buf = charlie16_buf << 1; 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /charlie16_uart/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = charlie16_uart 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | SRCS += ../src/charlie16.rel 16 | 17 | INC_DIR = -I./ -I../include 18 | 19 | # benutzbare Programmer: 20 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 21 | # 2 : pfsprog ==> benoetigt serielle Portangabe 22 | 23 | PROGRAMMER = 2 24 | SERPORT = /dev/ttyUSB0 25 | CH340RESET = 1 26 | 27 | include ../makefile.mk 28 | -------------------------------------------------------------------------------- /charlie16_uart/charle16_pc/Makefile: -------------------------------------------------------------------------------- 1 | # --------------------------------------------- 2 | # erzeugt charlie16_send 3 | # --------------------------------------------- 4 | all: 5 | make build 6 | 7 | build: 8 | gcc charlie16_send.c minirs232.c -o charlie16_send 9 | 10 | clean: 11 | rm -f *.o 12 | rm -f charlie16_send 13 | 14 | -------------------------------------------------------------------------------- /charlie16_uart/charle16_pc/charlie16_send.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------- 2 | charlie16_send.c 3 | 4 | Sendet 16-Bit hexadezimale Werte an den 5 | Charlie16_Plexing Empfaenger mit 2400 Bd. 6 | 7 | PC-Konsolenprogramm zum Testen der Funktionsfaehigkeit 8 | der charliegeplexten Anzeige 9 | 10 | 11 | 17.12.2020 R. Seelig 12 | ---------------------------------------------------------- */ 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include "minirs232.h" 20 | 21 | #define baudrate 2400 22 | 23 | #define my_usleep(anz) ({ usleep(anz); fflush(stdout);} ) 24 | 25 | 26 | /* --------------------------------------------------------------------------- 27 | existfile 28 | stellt fest, ob eine Datei vorhanden ist oder nicht 29 | --------------------------------------------------------------------------- */ 30 | char existfile(char *dname) 31 | { 32 | FILE *tdat; 33 | 34 | tdat= fopen(dname,"r"); 35 | if (tdat== 0) 36 | { 37 | return 0; 38 | } 39 | else 40 | { 41 | fclose(tdat); 42 | return 1; 43 | } 44 | } 45 | 46 | 47 | /* --------------------------------------------------------------------------- 48 | M A I N 49 | --------------------------------------------------------------------------- */ 50 | int main(int argc, char **argv) 51 | { 52 | 53 | char portname[256]; 54 | char string[256]; 55 | int error_nr; 56 | unsigned int inp; 57 | int i; 58 | uint16_t w; 59 | 60 | if (argc == 3) 61 | { 62 | // Valueargument als Hexwert interpretieren 63 | // (wuerde man evtl. als htoi bezeichnen koennen); 64 | strcpy(string,argv[2]); 65 | sscanf(string, "%x", &i); 66 | w= i & 0xffff; 67 | 68 | strcpy(portname,argv[1]); 69 | error_nr= existfile(&portname[0]); 70 | if (!error_nr) 71 | { 72 | printf("\n serialport not found: %s\n\n", portname); 73 | return 1; 74 | } 75 | 76 | error_nr= serial_init(&portname[0], baudrate); 77 | if (error_nr) 78 | { 79 | printf("\nerror: serialport %s\n\n",portname[0]); 80 | return 3; 81 | } 82 | 83 | printf("\n\n Port: %s | Value: %x \n\n", portname, w); 84 | serial_putchar(w >> 8); 85 | my_usleep(40000); 86 | serial_putchar(w & 0xff); 87 | serial_close(); 88 | } 89 | else 90 | { 91 | printf("\n Syntax : charlie16_send port hexvalue"); 92 | printf("\n Example: charlie16_send /dev/ttyUSB0 3C09\n\n"); 93 | } 94 | } 95 | 96 | -------------------------------------------------------------------------------- /charlie16_uart/charlie16_send: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/charlie16_uart/charlie16_send -------------------------------------------------------------------------------- /charlie20_plexing/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = charlie20_demo 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | SRCS += ../src/charlie20.rel 16 | 17 | INC_DIR = -I./ -I../include 18 | 19 | 20 | # benutzbare Programmer: 21 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 22 | # 2 : pfsprog ==> benoetigt serielle Portangabe 23 | 24 | PROGRAMMER = 2 25 | SERPORT = /dev/ttyUSB0 26 | CH340RESET = 1 27 | 28 | include ../makefile.mk 29 | -------------------------------------------------------------------------------- /charlie20_plexing/charlie20_demo.c: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------- 2 | charlie_demo.c 3 | 4 | Demoprogramm fuer Ansteuerung von 20 LED's mittels 5 | Charlieplexing 6 | 7 | Compiler : SDCC 4.0.3 8 | MCU : PFS154 / PFS173 9 | 10 | 19.10.2020 R. Seelig 11 | ------------------------------------------------------ */ 12 | 13 | #include 14 | 15 | #include 16 | #include "pdk_init.h" 17 | #include "pfs1xx_gpio.h" 18 | 19 | #include "delay.h" 20 | #include "charlie20.h" 21 | 22 | 23 | 24 | /* -------------------------------------------------------- 25 | interrupt 26 | 27 | der Interrupt-Handler 28 | 29 | Leider hat sich (scheinbar) ein BUG in SDCC 4.0.3 30 | bzgl. des Schreibens eines 16-Bit Timerwertes ein- 31 | geschlichen und deshalb wird das Zaehlerregister 32 | des Timers mittels Maschinenbefehle beschrieben 33 | 34 | Interrupt wird jede Millisekunde aufgerufen (Reload- 35 | wert in charlie20.c) 36 | 37 | -------------------------------------------------------- */ 38 | void interrupt(void) __interrupt(0) 39 | { 40 | 41 | if (INTRQ & INTRQ_T16) 42 | { 43 | 44 | // Reloadwert des 16-Bit Timers setzen 45 | __asm 46 | 47 | mov a,_reload+0 48 | mov __t16c+0,a 49 | mov a,_reload+1 50 | mov __t16c+1,a 51 | 52 | stt16 __t16c 53 | __endasm; 54 | 55 | // Aufruf der einzelnen Charlieplexing-Linien 56 | charlie20_mpxlines(); 57 | 58 | INTRQ &= ~INTRQ_T16; // Interruptanforderung quittieren 59 | } 60 | } 61 | 62 | 63 | 64 | /* ------------------------------------------------------ 65 | main 66 | ------------------------------------------------------ */ 67 | int main(void) 68 | { 69 | uint16_t i,i2; 70 | 71 | charlie20_init(); 72 | 73 | 74 | while(1) 75 | { 76 | charlie20_buf= 1; 77 | for (i= 0; i< 20; i++) 78 | { 79 | delay(50); 80 | charlie20_buf = charlie20_buf << 1; 81 | } 82 | 83 | for (i2= 0; i2< 5; i2++) 84 | { 85 | charlie20_buf= 1; 86 | for (i= 0; i< 20; i++) 87 | { 88 | delay(20); 89 | charlie20_buf = charlie20_buf << 1; 90 | charlie20_buf++; 91 | } 92 | delay(300); 93 | charlie20_buf= 0; 94 | delay(300); 95 | } 96 | delay(500); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /cide.cfg: -------------------------------------------------------------------------------- 1 | # Automatically created file, don't edit. 2 | #IFDEF NORMAL 3 | -TLinux 4 | -Mfpc 5 | -Sg 6 | -Si 7 | -Os 8 | -CpATHLON64 9 | -OpATHLON64 10 | -g- 11 | -p- 12 | -b- 13 | #ENDIF 14 | 15 | #IFDEF DEBUG 16 | -TLinux 17 | -Mfpc 18 | -Sg 19 | -Si 20 | -Sa 21 | -Cr 22 | -Ci 23 | -Co 24 | -CR 25 | -Os 26 | -CpATHLON64 27 | -OpATHLON64 28 | -g 29 | -p- 30 | -b- 31 | #ENDIF 32 | 33 | #IFDEF RELEASE 34 | -TLinux 35 | -Mfpc 36 | -Sg 37 | -Si 38 | -CX 39 | -Os 40 | -CpATHLON64 41 | -OpATHLON64 42 | -XX 43 | -Xs 44 | -g- 45 | -p- 46 | -b- 47 | #ENDIF 48 | 49 | -------------------------------------------------------------------------------- /cide.dsk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/cide.dsk -------------------------------------------------------------------------------- /cide.ini: -------------------------------------------------------------------------------- 1 | [Run] 2 | RunDirectory=RecentFile9 3 | Parameters=RecentFile9 4 | 5 | [Compile] 6 | CompileMode=NORMAL 7 | 8 | [Help] 9 | Files="/usr/share/doc/cide/cidehelp.htx|HTML Index" 10 | 11 | [Editor] 12 | DefaultTabSize=8 13 | DefaultIndentSize=1 14 | DefaultFlags=20599 15 | 16 | [Highlight] 17 | Exts="*.c;*.cpp;*.h" 18 | NeedsTabs="" 19 | 20 | [SourcePath] 21 | SourceList="" 22 | 23 | [Mouse] 24 | DoubleDelay=8 25 | ReverseButtons=0 26 | AltClickAction=6 27 | CtrlClickAction=1 28 | 29 | [Keyboard] 30 | EditKeys=microsoft 31 | 32 | [Search] 33 | FindFlags=4 34 | 35 | [Preferences] 36 | DesktopFileFlags=209 37 | CenterCurrentLineWhileDebugging=1 38 | AutoSaveFlags=6 39 | MiscOptions=6 40 | DesktopLocation=1 41 | 42 | [Misc] 43 | ShowReadme=0 44 | 45 | [Files] 46 | OpenExts="*.c;*.cpp;*.h;*.md" 47 | PrinterDevice=prn 48 | -------------------------------------------------------------------------------- /doc/pfsprog.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/doc/pfsprog.doc -------------------------------------------------------------------------------- /gerber_files/gerberfiles.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/gerber_files/gerberfiles.zip -------------------------------------------------------------------------------- /gerber_files/pfs154_layout_view.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/gerber_files/pfs154_layout_view.jpg -------------------------------------------------------------------------------- /gerber_files/pfs154_programmer_foto.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/gerber_files/pfs154_programmer_foto.jpg -------------------------------------------------------------------------------- /gerber_files/pfs154_progshield_schematic.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/gerber_files/pfs154_progshield_schematic.gif -------------------------------------------------------------------------------- /i2c_busscan/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = i2c_scan 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | SRCS += ../src/my_printf.rel 16 | SRCS += ../src/uart.rel 17 | SRCS += ../src/i2c.rel 18 | 19 | INC_DIR = -I./ -I../include 20 | 21 | # benutzbare Programmer: 22 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 23 | # 2 : pfsprog ==> benoetigt serielle Portangabe 24 | 25 | PROGRAMMER = 2 26 | SERPORT = /dev/ttyUSB0 27 | CH340RESET = 1 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /i2c_pcf8574/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = pcf8574_readtest 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | SRCS += ../src/i2c.rel 16 | SRCS += ../src/uart.rel 17 | SRCS += ../src/my_printf.rel 18 | 19 | INC_DIR = -I./ -I../include 20 | 21 | # benutzbare Programmer: 22 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 23 | # 2 : pfsprog ==> benoetigt serielle Portangabe 24 | 25 | PROGRAMMER = 2 26 | SERPORT = /dev/ttyUSB0 27 | CH340RESET = 1 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /include/auto_sysclock.h: -------------------------------------------------------------------------------- 1 | #ifndef __AUTO_SYSCLOCK_H__ 2 | #define __AUTO_SYSCLOCK_H__ 3 | 4 | #include 5 | 6 | #if !defined(F_CPU) 7 | #error "F_CPU is not defined!" 8 | #endif 9 | 10 | // AUTO_INIT_SYSCLOCK() 11 | #if (F_CPU > 12000000) 12 | #define AUTO_INIT_SYSCLOCK() PDK_SET_SYSCLOCK(SYSCLOCK_IHRC_16MHZ) 13 | #elif (F_CPU > 6000000) 14 | #define AUTO_INIT_SYSCLOCK() PDK_SET_SYSCLOCK(SYSCLOCK_IHRC_8MHZ) 15 | #elif (F_CPU > 3000000) 16 | #define AUTO_INIT_SYSCLOCK() PDK_SET_SYSCLOCK(SYSCLOCK_IHRC_4MHZ) 17 | #elif (F_CPU > 1500000) 18 | #define AUTO_INIT_SYSCLOCK() PDK_SET_SYSCLOCK(SYSCLOCK_IHRC_2MHZ) 19 | #elif (F_CPU > 750000) 20 | #define AUTO_INIT_SYSCLOCK() PDK_SET_SYSCLOCK(SYSCLOCK_IHRC_1MHZ) 21 | #elif (F_CPU > 375000) 22 | #define AUTO_INIT_SYSCLOCK() PDK_SET_SYSCLOCK(SYSCLOCK_IHRC_500KHZ) 23 | #elif (F_CPU > 150000) 24 | #define AUTO_INIT_SYSCLOCK() PDK_SET_SYSCLOCK(SYSCLOCK_IHRC_250KHZ) 25 | #elif (F_CPU > ILRC_FREQ/2) 26 | #define AUTO_INIT_SYSCLOCK() PDK_SET_SYSCLOCK(SYSCLOCK_ILRC) 27 | #elif (F_CPU > ILRC_FREQ/8) 28 | #define AUTO_INIT_SYSCLOCK() PDK_SET_SYSCLOCK(SYSCLOCK_ILRC_DIV4) 29 | #else 30 | #define AUTO_INIT_SYSCLOCK() PDK_SET_SYSCLOCK(SYSCLOCK_ILRC_DIV16) 31 | #endif 32 | 33 | // AUTO_CALIBRATE_SYSCLOCK(vdd_mv) 34 | #if (F_CPU > 150000) 35 | #define AUTO_CALIBRATE_SYSCLOCK(vdd_mv) EASY_PDK_CALIBRATE_IHRC(F_CPU,vdd_mv) 36 | #else 37 | #define AUTO_CALIBRATE_SYSCLOCK(vdd_mv) EASY_PDK_CALIBRATE_ILRC(F_CPU,vdd_mv) 38 | #endif 39 | 40 | #endif //__AUTO_SYSCLOCK_H__ 41 | -------------------------------------------------------------------------------- /include/delay.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------ 2 | delay.h 3 | 4 | Header fuer Verzoegerungsschleifen mittels 5 | Warteloops 6 | 7 | Compiler : SDCC 4.0.3 8 | MCU : PFS154 / PFS173 9 | 10 | 13.10.2020 R. Seelig 11 | 12 | ------------------------------------------------------- */ 13 | 14 | 15 | #ifndef __DELAY_H__ 16 | #define __DELAY_H__ 17 | 18 | #if !defined(F_CPU) 19 | #error "F_CPU is not defined!" 20 | #endif 21 | 22 | #include 23 | 24 | #if !defined(MAX) 25 | #define MAX(a,b) ((a)>(b)?(a):(b)) 26 | #endif 27 | 28 | #define NS_TO_CYCLES(ns) ((ns)/(1000000000L/F_CPU)) 29 | #define US_TO_CYCLES(us) (NS_TO_CYCLES(us*1000L)) 30 | #define MS_TO_CYCLES(ms) (NS_TO_CYCLES(ms*1000000L)) 31 | 32 | #define LOOP_CTR(cycles,ovh,lp) (MAX(0,(cycles-ovh-lp)/lp)+1) 33 | #define LOOP_CTR_8(cycles) LOOP_CTR(cycles,7,3) 34 | #define LOOP_CTR_16(cycles) LOOP_CTR(cycles,9,8) 35 | #define LOOP_CTR_32(cycles) LOOP_CTR(cycles,13,12) 36 | 37 | #define _delay_us(us) \ 38 | (LOOP_CTR_8(US_TO_CYCLES(us)) < 256L) ? \ 39 | _delay_loop_8((uint8_t)LOOP_CTR_8(US_TO_CYCLES(us))) : \ 40 | _delay_loop_16((uint16_t)LOOP_CTR_16(US_TO_CYCLES(us))) 41 | 42 | #define _delay_ms(ms) \ 43 | (LOOP_CTR_16(MS_TO_CYCLES(ms)) < 65536L) ? \ 44 | _delay_loop_16((uint16_t)LOOP_CTR_16(MS_TO_CYCLES(ms))) : \ 45 | _delay_loop_32((uint32_t)LOOP_CTR_32(MS_TO_CYCLES(ms))) 46 | 47 | #define delay(ms) _delay_ms(ms) 48 | #define delay_us(us) _delay_us(us) 49 | 50 | /* -------------------------------------------------- 51 | Prototyps 52 | -------------------------------------------------- */ 53 | 54 | void _delay_loop_8(uint8_t loop_ctr); 55 | void _delay_loop_16(uint16_t loop_ctr); 56 | void _delay_loop_32(uint32_t loop_ctr); 57 | 58 | 59 | 60 | 61 | #endif //__DELAY_H__ 62 | -------------------------------------------------------------------------------- /include/easy-pdk/README.md: -------------------------------------------------------------------------------- 1 | This contains a local copy of the 'easy-pdk-includes' repository: 2 | https://github.com/free-pdk/easy-pdk-includes 3 | -------------------------------------------------------------------------------- /include/easy-pdk/serial_num.h: -------------------------------------------------------------------------------- 1 | /* 2 | serial_num.h: Macros to allow Easy PDK Programmer to insert serial numbers without re-compilation. 3 | 4 | Copyright (C) 2020 serisman 5 | Copyright (C) 2019-2020 freepdk https://free-pdk.github.io 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library. If not, see . 18 | 19 | As a special exception, if you link this library with other files, 20 | some of which are compiled with SDCC, to produce an executable, 21 | this library does not by itself cause the resulting executable to 22 | be covered by the GNU General Public License. This exception does 23 | not however invalidate any other reasons why the executable file 24 | might be covered by the GNU General Public License. 25 | */ 26 | 27 | #ifndef __EASY_PDK_SERIAL_NUM_H__ 28 | #define __EASY_PDK_SERIAL_NUM_H__ 29 | 30 | // Placeholder for serial number inserted by easypdkprog 31 | #define EASY_PDK_SERIAL_NUM(sname) static const uint8_t sname[8] = {'F','P','S','E','R','I','A','L'} 32 | 33 | #endif //__EASY_PDK_SERIAL_NUM_H__ 34 | -------------------------------------------------------------------------------- /include/my_printf.h: -------------------------------------------------------------------------------- 1 | /* ------------------------------------------------------- 2 | my_printf.h 3 | 4 | Library-Header eine eigene (sehr kleine) printf- 5 | Funktion. 6 | 7 | Compiler : SDCC 8 | 9 | fuer | myprintf | muss im Hauptprogramm irgendwo 10 | ein putchar vorhanden sein. 11 | 12 | Bsp.: 13 | 14 | void putchar(char ch) 15 | { 16 | uart_putchar(ch); 17 | } 18 | 19 | 19.05.2016 R. Seelig 20 | ------------------------------------------------------ */ 21 | 22 | #ifndef in_myprintf 23 | #define in_myprintf 24 | 25 | #include 26 | #include 27 | 28 | extern char printfkomma; 29 | 30 | extern void my_putchar(char ch); 31 | void putint(int i, char komma); 32 | void hexnibbleout(uint8_t b); 33 | void puthex(uint16_t h); 34 | void putstring(char *p); 35 | void my_printf(const char *s,...); 36 | 37 | #define printf my_printf 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /include/pdk/README.md: -------------------------------------------------------------------------------- 1 | This contains a local copy of the 'pdk-includes' repository: 2 | https://github.com/free-pdk/pdk-includes 3 | -------------------------------------------------------------------------------- /include/pdk/device.h: -------------------------------------------------------------------------------- 1 | /* 2 | device.h: Factory to pull in appropriate device/xxx.h (and other common) include files. 3 | 4 | Copyright (C) 2020 serisman 5 | Copyright (C) 2019-2020 freepdk https://free-pdk.github.io 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library. If not, see . 18 | 19 | As a special exception, if you link this library with other files, 20 | some of which are compiled with SDCC, to produce an executable, 21 | this library does not by itself cause the resulting executable to 22 | be covered by the GNU General Public License. This exception does 23 | not however invalidate any other reasons why the executable file 24 | might be covered by the GNU General Public License. 25 | */ 26 | 27 | #ifndef __PDK_DEVICE_H__ 28 | #define __PDK_DEVICE_H__ 29 | 30 | #if defined(PFS154) 31 | #include "device/pfs154.h" 32 | #elif defined(PFS172) 33 | #include "device/pfs172.h" 34 | #elif defined(PFS173) 35 | #include "device/pfs173.h" 36 | #elif defined(PMS131) 37 | #include "device/pms131.h" 38 | #elif defined(PMS150C) 39 | #include "device/pms150c.h" 40 | #elif defined(PMS15A) 41 | #include "device/pms150c.h" 42 | #elif defined(PMS152) 43 | #include "device/pms152.h" 44 | #elif defined(PMS154B) 45 | #include "device/pms154b.h" 46 | #elif defined(PMS154C) 47 | #include "device/pms154c.h" 48 | #elif defined(PMS171B) 49 | #include "device/pms171b.h" 50 | #else 51 | #error "Unknown device. Please define device!" 52 | #endif 53 | 54 | #include "util.h" 55 | #include "fuse.h" 56 | #include "factory_calibration.h" 57 | #include "sysclock.h" 58 | 59 | #endif //__PDK_DEVICE_H__ 60 | -------------------------------------------------------------------------------- /include/pdk/device/periph/accumulator.h: -------------------------------------------------------------------------------- 1 | /* 2 | accumulator.h: Definitions for the Accumulator related register (FLAG) used by Padauk microcontrollers. 3 | 4 | Copyright (C) 2020 serisman 5 | Copyright (C) 2019-2020 freepdk https://free-pdk.github.io 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library. If not, see . 18 | 19 | As a special exception, if you link this library with other files, 20 | some of which are compiled with SDCC, to produce an executable, 21 | this library does not by itself cause the resulting executable to 22 | be covered by the GNU General Public License. This exception does 23 | not however invalidate any other reasons why the executable file 24 | might be covered by the GNU General Public License. 25 | */ 26 | 27 | #ifndef __PDK_DEVICE_PERIPH_ACCUMULATOR_H__ 28 | #define __PDK_DEVICE_PERIPH_ACCUMULATOR_H__ 29 | 30 | #if !defined(__PDK_DEVICE_H__) 31 | #error "You must #include "pdk/device.h" instead of "pdk/device/periph/accumulator.h" by itself." 32 | #endif 33 | 34 | // __sfr definitions 35 | __sfr __at(FLAG_ADDR) _flag; 36 | 37 | #define FLAG _flag 38 | 39 | // FLAG (ACC Status Flag) register definitions 40 | #define FLAG_Z_BIT 0 41 | #define FLAG_C_BIT 1 42 | #define FLAG_AC_BIT 2 43 | #define FLAG_OV_BIT 3 44 | 45 | #define FLAG_Z (1 << FLAG_Z_BIT) 46 | #define FLAG_C (1 << FLAG_C_BIT) 47 | #define FLAG_AC (1 << FLAG_AC_BIT) 48 | #define FLAG_OV (1 << FLAG_OV_BIT) 49 | 50 | #endif //__PDK_DEVICE_PERIPH_ACCUMULATOR_H__ 51 | -------------------------------------------------------------------------------- /include/pdk/device/periph/bandgap.h: -------------------------------------------------------------------------------- 1 | /* 2 | bandgap.h: Definitions for the Bandgap register (BGTR) used by Padauk microcontrollers. 3 | 4 | Copyright (C) 2020 serisman 5 | Copyright (C) 2019-2020 freepdk https://free-pdk.github.io 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library. If not, see . 18 | 19 | As a special exception, if you link this library with other files, 20 | some of which are compiled with SDCC, to produce an executable, 21 | this library does not by itself cause the resulting executable to 22 | be covered by the GNU General Public License. This exception does 23 | not however invalidate any other reasons why the executable file 24 | might be covered by the GNU General Public License. 25 | */ 26 | 27 | #ifndef __PDK_DEVICE_PERIPH_BANDGAP_H__ 28 | #define __PDK_DEVICE_PERIPH_BANDGAP_H__ 29 | 30 | #if !defined(__PDK_DEVICE_H__) 31 | #error "You must #include "pdk/device.h" instead of "pdk/device/periph/bandgap.h" by itself." 32 | #endif 33 | 34 | // __sfr definitions 35 | __sfr __at(BGTR_ADDR) _bgtr; 36 | 37 | #define BGTR _bgtr 38 | 39 | #endif //__PDK_DEVICE_PERIPH_BANDGAP_H__ 40 | -------------------------------------------------------------------------------- /include/pdk/device/periph/external_oscillator.h: -------------------------------------------------------------------------------- 1 | /* 2 | external_oscillator.h: Definitions for the External Oscillator related register used by Padauk microcontrollers. 3 | 4 | Copyright (C) 2020 serisman 5 | Copyright (C) 2019-2020 freepdk https://free-pdk.github.io 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library. If not, see . 18 | 19 | As a special exception, if you link this library with other files, 20 | some of which are compiled with SDCC, to produce an executable, 21 | this library does not by itself cause the resulting executable to 22 | be covered by the GNU General Public License. This exception does 23 | not however invalidate any other reasons why the executable file 24 | might be covered by the GNU General Public License. 25 | */ 26 | 27 | #ifndef __PDK_DEVICE_PERIPH_EXTERNAL_OSCILLATOR_H__ 28 | #define __PDK_DEVICE_PERIPH_EXTERNAL_OSCILLATOR_H__ 29 | 30 | #if !defined(__PDK_DEVICE_H__) 31 | #error "You must #include "pdk/device.h" instead of "pdk/device/periph/exernal_oscillator.h" by itself." 32 | #endif 33 | 34 | // __sfr definitions 35 | __sfr __at(EOSCR_ADDR) _eoscr; 36 | #define EOSCR _eoscr 37 | 38 | // EOSC (External Oscillator Setting) register definitions 39 | #define EOSC_BG_LVR_SHUTDOWN_BIT 0 40 | #if defined(__PDK_HAS_EOSC) 41 | #define EOSC_CRYSTAL_SEL_BIT0 5 42 | #define EOSC_ENABLE_BIT 7 43 | #endif 44 | 45 | #define EOSC_BG_LVR_SHUTDOWN (1 << EOSC_BG_LVR_SHUTDOWN_BIT) 46 | #if defined(__PDK_HAS_EOSC) 47 | #define EOSC_32KHZ_CRYSTAL (1 << EOSC_CRYSTAL_SEL_BIT0) 48 | #define EOSC_1MHZ_CRYSTAL (2 << EOSC_CRYSTAL_SEL_BIT0) 49 | #define EOSC_4MHZ_CRYSTAL (3 << EOSC_CRYSTAL_SEL_BIT0) 50 | #define EOSC_ENABLE (1 << EOSC_BG_LVR_SHUTDOWN_BIT) 51 | #endif 52 | 53 | #endif //__PDK_DEVICE_PERIPH_EXTERNAL_OSCILLATOR_H__ 54 | -------------------------------------------------------------------------------- /include/pdk/device/periph/misc.h: -------------------------------------------------------------------------------- 1 | /* 2 | misc.h: Definitions for the MISC register used by Padauk microcontrollers. 3 | 4 | Copyright (C) 2020 serisman 5 | Copyright (C) 2019-2020 freepdk https://free-pdk.github.io 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library. If not, see . 18 | 19 | As a special exception, if you link this library with other files, 20 | some of which are compiled with SDCC, to produce an executable, 21 | this library does not by itself cause the resulting executable to 22 | be covered by the GNU General Public License. This exception does 23 | not however invalidate any other reasons why the executable file 24 | might be covered by the GNU General Public License. 25 | */ 26 | 27 | #ifndef __PDK_DEVICE_PERIPH_MISC_H__ 28 | #define __PDK_DEVICE_PERIPH_MISC_H__ 29 | 30 | #if !defined(__PDK_DEVICE_H__) 31 | #error "You must #include "pdk/device.h" instead of "pdk/device/periph/misc.h" by itself." 32 | #endif 33 | 34 | // __sfr definitions 35 | __sfr __at(MISC_ADDR) _misc; 36 | 37 | #define MISC _misc 38 | 39 | // MISC register definitions 40 | #define MISC_WATCHDOG_BIT0 0 41 | #define MISC_LVR_DISABLE_BIT 2 42 | #define MISC_FAST_WAKEUP_ENABLE_BIT 5 43 | 44 | #define MISC_WATCHDOG_8K_ILRC 0x00 45 | #define MISC_WATCHDOG_16K_ILRC (1 << MISC_WATCHDOG_BIT0) 46 | #define MISC_WATCHDOG_64K_ILRC (2 << MISC_WATCHDOG_BIT0) 47 | #define MISC_WATCHDOG_256K_ILRC (3 << MISC_WATCHDOG_BIT0) 48 | 49 | #define MISC_LVR_ENABLE 0x00 50 | #define MISC_LVR_DISABLE (1 << MISC_LVR_DISABLE_BIT) 51 | 52 | #define MISC_FAST_WAKEUP_DISABLE 0x00 53 | #define MISC_FAST_WAKEUP_ENABLE (1 << MISC_FAST_WAKEUP_ENABLE_BIT) 54 | 55 | #if defined(__PDK_HAS_LCD) 56 | #define MISC_LCD_ENABLE_BIT 4 57 | #define MISC_LCD_DISABLE 0x00 58 | #define MISC_LCD_ENABLE (1 << MISC_LCD_ENABLE_BIT) 59 | #endif 60 | 61 | #endif //__PDK_DEVICE_PERIPH_MISC_H__ 62 | -------------------------------------------------------------------------------- /include/pdk/device/periph/misc2.h: -------------------------------------------------------------------------------- 1 | /* 2 | misc2.h: Definitions for the MISC2 register used by Padauk microcontrollers. 3 | 4 | Copyright (C) 2020 serisman 5 | Copyright (C) 2019-2020 freepdk https://free-pdk.github.io 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library. If not, see . 18 | 19 | As a special exception, if you link this library with other files, 20 | some of which are compiled with SDCC, to produce an executable, 21 | this library does not by itself cause the resulting executable to 22 | be covered by the GNU General Public License. This exception does 23 | not however invalidate any other reasons why the executable file 24 | might be covered by the GNU General Public License. 25 | */ 26 | 27 | #ifndef __PDK_DEVICE_PERIPH_MISC2_H__ 28 | #define __PDK_DEVICE_PERIPH_MISC2_H__ 29 | 30 | #if !defined(__PDK_DEVICE_H__) 31 | #error "You must #include "pdk/device.h" instead of "pdk/device/periph/misc2.h" by itself." 32 | #endif 33 | 34 | // __sfr definitions 35 | __sfr __at(MISC2_ADDR) _misc2; 36 | 37 | #define MISC2 _misc2 38 | 39 | // MISC2 register definitions 40 | #define MISC2_COMP_EDGE_SEL_BIT0 5 41 | 42 | #define MISC2_COMP_EDGE_INT_BOTH 0x00 43 | #define MISC2_COMP_EDGE_INT_RISE (1 << MISC2_COMP_EDGE_SEL_BIT0) 44 | #define MISC2_COMP_EDGE_INT_FALL (2 << MISC2_COMP_EDGE_SEL_BIT0) 45 | 46 | #endif //__PDK_DEVICE_PERIPH_MISC2_H__ 47 | -------------------------------------------------------------------------------- /include/pdk/device/periph/misclvr_basic.h: -------------------------------------------------------------------------------- 1 | /* 2 | misclvr_basic.h: Definitions for the (basic) MISCLVR register used by Padauk microcontrollers. 3 | 4 | Copyright (C) 2020 serisman 5 | Copyright (C) 2019-2020 freepdk https://free-pdk.github.io 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library. If not, see . 18 | 19 | As a special exception, if you link this library with other files, 20 | some of which are compiled with SDCC, to produce an executable, 21 | this library does not by itself cause the resulting executable to 22 | be covered by the GNU General Public License. This exception does 23 | not however invalidate any other reasons why the executable file 24 | might be covered by the GNU General Public License. 25 | */ 26 | 27 | #ifndef __PDK_DEVICE_PERIPH_MISCLVR_BASIC_H__ 28 | #define __PDK_DEVICE_PERIPH_MISCLVR_BASIC_H__ 29 | 30 | #if !defined(__PDK_DEVICE_H__) 31 | #error "You must #include "pdk/device.h" instead of "pdk/device/periph/misclvr_basic.h" by itself." 32 | #endif 33 | 34 | // __sfr definitions 35 | __sfr __at(MISCLVR_ADDR) _misclvr; 36 | 37 | #define MISCLVR _misclvr 38 | 39 | // MISCLVR register definitions 40 | #define MISCLVR_LVR_BIT0 5 41 | 42 | #define MISCLVR_4V 0x00 43 | #define MISCLVR_3V5 (1 << MISCLVR_LVR_BIT0) 44 | #define MISCLVR_3V (2 << MISCLVR_LVR_BIT0) 45 | #define MISCLVR_2V75 (3 << MISCLVR_LVR_BIT0) 46 | #define MISCLVR_2V5 (4 << MISCLVR_LVR_BIT0) 47 | #define MISCLVR_1V8 (5 << MISCLVR_LVR_BIT0) 48 | #define MISCLVR_2V2 (6 << MISCLVR_LVR_BIT0) 49 | #define MISCLVR_2V (7 << MISCLVR_LVR_BIT0) 50 | 51 | #endif //__PDK_DEVICE_PERIPH_MISCLVR_BASIC_H__ 52 | -------------------------------------------------------------------------------- /include/pdk/device/periph/multiplier.h: -------------------------------------------------------------------------------- 1 | /* 2 | multiplier.h: Definitions for the Multiplier related registers used by Padauk microcontrollers. 3 | 4 | Copyright (C) 2020 serisman 5 | Copyright (C) 2019-2020 freepdk https://free-pdk.github.io 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library. If not, see . 18 | 19 | As a special exception, if you link this library with other files, 20 | some of which are compiled with SDCC, to produce an executable, 21 | this library does not by itself cause the resulting executable to 22 | be covered by the GNU General Public License. This exception does 23 | not however invalidate any other reasons why the executable file 24 | might be covered by the GNU General Public License. 25 | */ 26 | 27 | #ifndef __PDK_DEVICE_PERIPH_MULTIPLIER_H__ 28 | #define __PDK_DEVICE_PERIPH_MULTIPLIER_H__ 29 | 30 | #if !defined(__PDK_DEVICE_H__) 31 | #error "You must #include "pdk/device.h" instead of "pdk/device/periph/multiplier.h" by itself." 32 | #endif 33 | 34 | // __sfr definitions 35 | __sfr __at(MULOP_ADDR) _mulop; 36 | __sfr __at(MULRH_ADDR) _mulrh; 37 | 38 | #define MULOP _mulop 39 | #define MULRH _mulrh 40 | 41 | #endif //__PDK_DEVICE_PERIPH_MULTIPLIER_H__ 42 | -------------------------------------------------------------------------------- /include/pdk/device/periph/port_a.h: -------------------------------------------------------------------------------- 1 | /* 2 | port_a.h: Definitions for the Port A related registers used by Padauk microcontrollers. 3 | 4 | Copyright (C) 2020 serisman 5 | Copyright (C) 2019-2020 freepdk https://free-pdk.github.io 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library. If not, see . 18 | 19 | As a special exception, if you link this library with other files, 20 | some of which are compiled with SDCC, to produce an executable, 21 | this library does not by itself cause the resulting executable to 22 | be covered by the GNU General Public License. This exception does 23 | not however invalidate any other reasons why the executable file 24 | might be covered by the GNU General Public License. 25 | */ 26 | 27 | #ifndef __PDK_DEVICE_PERIPH_PORT_A_H__ 28 | #define __PDK_DEVICE_PERIPH_PORT_A_H__ 29 | 30 | #if !defined(__PDK_DEVICE_H__) 31 | #error "You must #include "pdk/device.h" instead of "pdk/device/periph/port_a.h" by itself." 32 | #endif 33 | 34 | // __sfr definitions 35 | __sfr __at(PADIER_ADDR) _padier; 36 | __sfr __at(PA_ADDR) _pa; 37 | __sfr __at(PAC_ADDR) _pac; 38 | __sfr __at(PAPH_ADDR) _paph; 39 | 40 | #define PADIER _padier 41 | #define PA _pa 42 | #define PAC _pac 43 | #define PAPH _paph 44 | 45 | #endif //__PDK_DEVICE_PERIPH_PORT_A_H__ 46 | -------------------------------------------------------------------------------- /include/pdk/device/periph/port_b.h: -------------------------------------------------------------------------------- 1 | /* 2 | port_b.h: Definitions for the Port B related registers used by Padauk microcontrollers. 3 | 4 | Copyright (C) 2020 serisman 5 | Copyright (C) 2019-2020 freepdk https://free-pdk.github.io 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library. If not, see . 18 | 19 | As a special exception, if you link this library with other files, 20 | some of which are compiled with SDCC, to produce an executable, 21 | this library does not by itself cause the resulting executable to 22 | be covered by the GNU General Public License. This exception does 23 | not however invalidate any other reasons why the executable file 24 | might be covered by the GNU General Public License. 25 | */ 26 | 27 | #ifndef __PDK_DEVICE_PERIPH_PORT_B_H__ 28 | #define __PDK_DEVICE_PERIPH_PORT_B_H__ 29 | 30 | #if !defined(__PDK_DEVICE_H__) 31 | #error "You must #include "pdk/device.h" instead of "pdk/device/periph/port_b.h" by itself." 32 | #endif 33 | 34 | // __sfr definitions 35 | __sfr __at(PBDIER_ADDR) _pbdier; 36 | __sfr __at(PB_ADDR) _pb; 37 | __sfr __at(PBC_ADDR) _pbc; 38 | __sfr __at(PBPH_ADDR) _pbph; 39 | 40 | #define PBDIER _pbdier 41 | #define PB _pb 42 | #define PBC _pbc 43 | #define PBPH _pbph 44 | 45 | #if defined(PBPL_ADDR) 46 | __sfr __at(PBPL_ADDR) _pbpl; 47 | #define PBPL _pbpl 48 | #endif 49 | 50 | #endif //__PDK_DEVICE_PERIPH_PORT_B_H__ 51 | -------------------------------------------------------------------------------- /include/pdk/device/periph/port_c.h: -------------------------------------------------------------------------------- 1 | /* 2 | port_c.h: Definitions for the Port C related registers used by Padauk microcontrollers. 3 | 4 | Copyright (C) 2020 serisman 5 | Copyright (C) 2019-2020 freepdk https://free-pdk.github.io 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library. If not, see . 18 | 19 | As a special exception, if you link this library with other files, 20 | some of which are compiled with SDCC, to produce an executable, 21 | this library does not by itself cause the resulting executable to 22 | be covered by the GNU General Public License. This exception does 23 | not however invalidate any other reasons why the executable file 24 | might be covered by the GNU General Public License. 25 | */ 26 | 27 | #ifndef __PDK_DEVICE_PERIPH_PORT_C_H__ 28 | #define __PDK_DEVICE_PERIPH_PORT_C_H__ 29 | 30 | #if !defined(__PDK_DEVICE_H__) 31 | #error "You must #include "pdk/device.h" instead of "pdk/device/periph/port_c.h" by itself." 32 | #endif 33 | 34 | // __sfr definitions 35 | __sfr __at(PCDIER_ADDR) _pcdier; 36 | __sfr __at(PC_ADDR) _pc; 37 | __sfr __at(PCC_ADDR) _pcc; 38 | __sfr __at(PCPH_ADDR) _pcph; 39 | 40 | #define PCDIER _pcdier 41 | #define PC _pc 42 | #define PCC _pcc 43 | #define PCPH _pcph 44 | 45 | #if defined(PCPL_ADDR) 46 | __sfr __at(PCPL_ADDR) _pcpl; 47 | #define PCPL _pcpl 48 | #endif 49 | 50 | #endif //__PDK_DEVICE_PERIPH_PORT_C_H__ 51 | -------------------------------------------------------------------------------- /include/pdk/device/periph/stack.h: -------------------------------------------------------------------------------- 1 | /* 2 | stack.h: Definitions for the Stack related register (SP) used by Padauk microcontrollers. 3 | 4 | Copyright (C) 2020 serisman 5 | Copyright (C) 2019-2020 freepdk https://free-pdk.github.io 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library. If not, see . 18 | 19 | As a special exception, if you link this library with other files, 20 | some of which are compiled with SDCC, to produce an executable, 21 | this library does not by itself cause the resulting executable to 22 | be covered by the GNU General Public License. This exception does 23 | not however invalidate any other reasons why the executable file 24 | might be covered by the GNU General Public License. 25 | */ 26 | 27 | #ifndef __PDK_DEVICE_PERIPH_STACK_H__ 28 | #define __PDK_DEVICE_PERIPH_STACK_H__ 29 | 30 | #if !defined(__PDK_DEVICE_H__) 31 | #error "You must #include "pdk/device.h" instead of "pdk/device/periph/stack.h" by itself." 32 | #endif 33 | 34 | // __sfr definitions 35 | __sfr __at(SP_ADDR) _sp; 36 | 37 | #define SP _sp 38 | 39 | #endif //__PDK_DEVICE_PERIPH_STACK_H__ 40 | -------------------------------------------------------------------------------- /include/pdk/factory_calibration.h: -------------------------------------------------------------------------------- 1 | /* 2 | factory_calibration.h: Macros to allow using factory calibration values for internal oscillator (IHCR), and bandgap (BG). 3 | 4 | Copyright (C) 2020 serisman 5 | Copyright (C) 2019-2020 freepdk https://free-pdk.github.io 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library. If not, see . 18 | 19 | As a special exception, if you link this library with other files, 20 | some of which are compiled with SDCC, to produce an executable, 21 | this library does not by itself cause the resulting executable to 22 | be covered by the GNU General Public License. This exception does 23 | not however invalidate any other reasons why the executable file 24 | might be covered by the GNU General Public License. 25 | */ 26 | 27 | #ifndef __PDK_FACTORY_CALIBRATION_H__ 28 | #define __PDK_FACTORY_CALIBRATION_H__ 29 | 30 | #if !defined(__PDK_DEVICE_H__) 31 | #error "You must #include "pdk/device.h" instead of "pdk/factory_calibration.h" by itself." 32 | #endif 33 | 34 | typedef unsigned char (*getfactorycalibration_funcptr)(void); 35 | 36 | // Factory Calibration macros 37 | #if defined(FACTORY_IHRCR_ADDR) 38 | #define GET_FACTORY_IHRCR ((getfactorycalibration_funcptr)FACTORY_IHRCR_ADDR) 39 | #define PDK_USE_FACTORY_IHRCR_16MHZ() \ 40 | IHRCR = GET_FACTORY_IHRCR() 41 | #endif 42 | 43 | #if defined(FACTORY_BGTR_ADDR) 44 | #define GET_FACTORY_BGTR ((getfactorycalibration_funcptr)FACTORY_BGTR_ADDR) 45 | #define PDK_USE_FACTORY_BGTR() \ 46 | BGTR = GET_FACTORY_BGTR() 47 | #endif 48 | 49 | #endif //__PDK_FACTORY_CALIBRATION_H__ 50 | -------------------------------------------------------------------------------- /include/pdk/fuse.h: -------------------------------------------------------------------------------- 1 | /* 2 | fuse.h: Macros to allow setting the FUSE word at the appropriate location in the output file. 3 | 4 | Copyright (C) 2020 serisman 5 | Copyright (C) 2019-2020 freepdk https://free-pdk.github.io 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library. If not, see . 18 | 19 | As a special exception, if you link this library with other files, 20 | some of which are compiled with SDCC, to produce an executable, 21 | this library does not by itself cause the resulting executable to 22 | be covered by the GNU General Public License. This exception does 23 | not however invalidate any other reasons why the executable file 24 | might be covered by the GNU General Public License. 25 | */ 26 | 27 | #ifndef __PDK_FUSE_H__ 28 | #define __PDK_FUSE_H__ 29 | 30 | #if !defined(__PDK_DEVICE_H__) 31 | #error "You must #include "pdk/device.h" instead of "pdk/fuse.h" by itself." 32 | #endif 33 | 34 | // FUSE macros 35 | #if defined(FUSE_WORD_ADDR) && defined(FUSE_RES_BITS_HIGH) 36 | #define PDK_SET_FUSE(f) \ 37 | __asm__( \ 38 | ".area FUSE (ABS) \n" \ 39 | ".org ("_STR(FUSE_WORD_ADDR)"*2) \n" \ 40 | ".word ("_STR(FUSE_RES_BITS_HIGH)"|"_STR(f)") \n" \ 41 | ".area CODE \n" \ 42 | ) 43 | #endif 44 | 45 | #endif //__PDK_FUSE_H__ 46 | -------------------------------------------------------------------------------- /include/pdk/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | util.h: Macros to allow using defines in assembler strings, and definitions for built-in opcodes. 3 | 4 | Copyright (C) 2020 serisman 5 | Copyright (C) 2019-2020 freepdk https://free-pdk.github.io 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library. If not, see . 18 | 19 | As a special exception, if you link this library with other files, 20 | some of which are compiled with SDCC, to produce an executable, 21 | this library does not by itself cause the resulting executable to 22 | be covered by the GNU General Public License. This exception does 23 | not however invalidate any other reasons why the executable file 24 | might be covered by the GNU General Public License. 25 | */ 26 | 27 | #ifndef __PDK_UTIL_H__ 28 | #define __PDK_UTIL_H__ 29 | 30 | //macros so we can use defines in assembler strings 31 | #define _STRINGIFY(x) #x 32 | #define _STR(x) _STRINGIFY(x) 33 | #define _STR_VAR(x) "_"_STRINGIFY(x) 34 | #define _VAR(x) _ ## x 35 | 36 | //definitions for built in opcodes 37 | #define __nop() __asm__("nop\n") 38 | #define __engint() __asm__("engint\n") 39 | #define __disgint() __asm__("disgint\n") 40 | #define __stopsys() __asm__("stopsys\n") 41 | #define __stopexe() __asm__("stopexe\nnop\n") 42 | #define __reset() __asm__("reset\n") 43 | #define __wdreset() __asm__("wdreset\n") 44 | #define __set0(var,bit) __asm__("set0 "_STR_VAR(var)", #"_STR(bit)"\n") 45 | #define __set1(var,bit) __asm__("set1 "_STR_VAR(var)", #"_STR(bit)"\n") 46 | 47 | // BIT definitions 48 | #define BIT0 (1<<0) 49 | #define BIT1 (1<<1) 50 | #define BIT2 (1<<2) 51 | #define BIT3 (1<<3) 52 | #define BIT4 (1<<4) 53 | #define BIT5 (1<<5) 54 | #define BIT6 (1<<6) 55 | #define BIT7 (1<<7) 56 | 57 | #endif //__PDK_UTIL_H__ 58 | -------------------------------------------------------------------------------- /include/rda5807.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------- 2 | rda5807.h 3 | 4 | Header fuer grundsaetzliche Steuerungsfunktionen 5 | zum UKW-Receiver RDA5807 mit I2C Schnittstelle 6 | 7 | Compiler : SDCC 4.0.3 8 | MCU : PFS154 / PFS173 9 | 10 | 21.10.2020 R. Seelig 11 | ------------------------------------------------------ */ 12 | 13 | #ifndef in_rda 14 | #define in_rda 15 | 16 | #include 17 | #include "i2c.h" 18 | 19 | #define rda5807_adrs 0x20 // I2C-addr. fuer sequientielllen Zugriff 20 | #define rda5807_adrr 0x22 // I2C-addr. fuer wahlfreien Zugriff 21 | #define rda5807_adrt 0xc0 // I2C-addr. fuer TEA5767 kompatiblen Modus 22 | 23 | #define fbandmin 870 // 87.0 MHz unteres Frequenzende 24 | #define fbandmax 1080 // 108.0 MHz oberes Frequenzende 25 | #define sigschwelle 72 // Schwelle ab der ein Sender als "gut empfangen" gilt 26 | 27 | extern uint16_t aktfreq; // Startfrequenz ( 101.8 MHz fuer neue Welle) 28 | extern uint8_t aktvol; // Startlautstaerke 29 | 30 | 31 | void rda5807_writereg(void); 32 | void rda5807_write(void); 33 | void rda5807_reset(void); 34 | void rda5807_poweron(void); 35 | int rda5807_setfreq(); 36 | void rda5807_setvol(); 37 | void rda5807_setmono(void); 38 | void rda5807_setstereo(void); 39 | uint8_t rda5807_getsig(void); 40 | void rda5807_scandown(void); 41 | void rda5807_scanup(void); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /include/seg7mpx_dig4.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------- 2 | seg7mpx_dig4.h 3 | 4 | Header fuer Softwaremodul einer 4-stelligen gemultiplexten 5 | 7-Segmentanzeige mit gemeinsamer Kathode 6 | 7 | verwendet 8-Bit Timer2 8 | 9 | Compiler : SDCC 4.0.3 10 | MCU : PFS154 / PFS173 11 | 12 | Mittels defines (Kommentare beachten) kann zwischen 13 | Anzeigen mit gemeinsamer Anode und gemeinsamer Kathode 14 | umgeschaltet werden. 15 | 16 | 02.11.2020 R. Seelig 17 | -------------------------------------------------------------- */ 18 | 19 | #ifndef in_seg7mpx_dig4 20 | #define in_seg7mpx_dig4 21 | 22 | #include 23 | #include 24 | #include "pfs1xx_gpio.h" 25 | 26 | // -------------------------------------------------------- 27 | // 28 | // Anschlussbelegung der 7-Segmentanzeige an den 29 | // Controller 30 | // 31 | // PB0..PB6 fuer die 7-Segmentanzeige; 32 | // PB0: Segment a, B6: Segment g 33 | // Pxx: Dezimalpunk (DP) 34 | // PA0: MPX Digit0 35 | // PA7: MPX Digit1 36 | // PA6: MPX Digit2 37 | // PA5: MPX digit3 38 | // -------------------------------------------------------- 39 | 40 | #define seg7_pin_init() { PBC= 0xff; PAC= 0xf1; } 41 | 42 | #define mpx0_set() PA0_clr() 43 | #define mpx0_clr() PA0_set() 44 | #define mpx1_set() PA7_clr() 45 | #define mpx1_clr() PA7_set() 46 | #define mpx2_set() PA6_clr() 47 | #define mpx2_clr() PA6_set() 48 | #define mpx3_set() PA5_clr() 49 | #define mpx3_clr() PA5_set() 50 | 51 | #define dp_set() ( PB7_set() ) 52 | #define dp_clr() ( PB7_clr() ) 53 | 54 | enum {zmode, smode}; 55 | 56 | // -------------------------------------------------------- 57 | // globale Variable 58 | // -------------------------------------------------------- 59 | extern uint16_t s7buf; // nimmt den Zahlenwert auf, der hexadezimal auf der 60 | // 2-stelligen Anzeige angezeigt wird 61 | // Bit7 nimmt bei verfuegbarem Dezimalpunkt eben diesen auf 62 | 63 | extern uint8_t seg7_dp; // nimmt die Position des Dezimalpunktes auf 64 | 65 | // -------------------------------------------------------- 66 | // Prototypen 67 | // -------------------------------------------------------- 68 | 69 | void seg7_init(void); 70 | void seg7_mpx(void); 71 | uint16_t hex2bcd16(uint16_t value); 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /include/toene.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------- 2 | toene.c 3 | 4 | Header Notentongenerator und Abspielfunktion fuer 5 | in einem String enthaltene Noten 6 | 7 | Bsp. 8 | 9 | playstring("c4e2F4 + c2"); 10 | 11 | spielt hintereinander eine Viertelnote "c", halbe 12 | Note "e" und eine Viertelnote "Fis" ab. Das Plus- 13 | zeichen "+" erhoeht die Oktave, so dass zum Schluss 14 | eine Halbnote "c" der hoeheren Oktave gespielt 15 | wird. 16 | 17 | Grosse Buchstaben C,D,F,G,A sind Noten entsprechend 18 | Cis, Dis, Fis, Gis und Ais. 19 | 20 | Benoetigt den 16-Bit Timer 21 | 22 | Compiler : SDCC 4.0.3 23 | MCU : PFS154 / PFS173 24 | 25 | 13.10.2020 R. Seelig 26 | 27 | -------------------------------------------------------- */ 28 | 29 | #ifndef in_tone 30 | #define in_toene 31 | 32 | #include 33 | #include "pfs1xx_gpio.h" 34 | #include "delay.h" 35 | 36 | 37 | // Frequenzausgang-Anschlusspin 38 | #define fout_pin PA0 39 | 40 | // Flag zum An- Ausschalten der Tonerzeugung 41 | extern volatile char sound; 42 | extern uint16_t playtempo; 43 | 44 | 45 | // ---------------------------------------------------------------- 46 | // Prototypen 47 | // ---------------------------------------------------------------- 48 | 49 | void t16_setnewfreq(uint8_t freq); 50 | void t16_init(void); 51 | void interrupt(void) __interrupt(0); 52 | void tonlen(int w); 53 | void playnote(char note); 54 | void playstring(const uint8_t* const s); 55 | 56 | 57 | // ---------------------------------------------------------------- 58 | // Praeprozessormacros um 2 Stringtexte zur weiteren Verwendung 59 | // innerhalb des Praeprozessors zu verknuepfen 60 | // 61 | // Bsp.: 62 | // #define ionr 3 63 | // #define ioport CONC(PA, ionr) 64 | // 65 | // ioport wird nun als "PA3" behandelt 66 | #define CONC2EXP(a,b) a ## b 67 | #define CONC(a,b) CONC2EXP(a, b) 68 | // ---------------------------------------------------------------- 69 | 70 | #define fout_init() CONC(fout_pin,_output_init()) 71 | #define fout_set() CONC(fout_pin,_set()) 72 | #define fout_clr() CONC(fout_pin,_clr()) 73 | #define fout_toggle() CONC(fout_pin,_toggle()) 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /ir_nec/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = ir_receiver_switch 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | SRCS += ../src/tm1637_seg7.rel 16 | SRCS += ../src/hx1838_nec.rel 17 | 18 | INC_DIR = -I./ -I../include 19 | 20 | # benutzbare Programmer: 21 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 22 | # 2 : pfsprog ==> benoetigt serielle Portangabe 23 | 24 | PROGRAMMER = 2 25 | SERPORT = /dev/ttyUSB0 26 | CH340RESET = 1 27 | 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /ir_receiver/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = ir_receiver_demo 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | SRCS += ../src/tm1637_seg7.rel 16 | SRCS += ../src/hx1838.rel 17 | 18 | INC_DIR = -I./ -I../include 19 | 20 | # benutzbare Programmer: 21 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 22 | # 2 : pfsprog ==> benoetigt serielle Portangabe 23 | 24 | PROGRAMMER = 2 25 | SERPORT = /dev/ttyUSB0 26 | CH340RESET = 1 27 | 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /ir_receiver_2/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = ir_receiver_switch 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | SRCS += ../src/tm1637_seg7.rel 16 | SRCS += ../src/hx1838.rel 17 | 18 | INC_DIR = -I./ -I../include 19 | 20 | # benutzbare Programmer: 21 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 22 | # 2 : pfsprog ==> benoetigt serielle Portangabe 23 | 24 | PROGRAMMER = 2 25 | SERPORT = /dev/ttyUSB0 26 | CH340RESET = 1 27 | 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /lauflicht/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = lauflicht 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | 16 | INC_DIR = -I./ -I../include 17 | 18 | # benutzbare Programmer: 19 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 20 | # 2 : pfsprog ==> benoetigt serielle Portangabe 21 | 22 | PROGRAMMER = 2 23 | SERPORT = /dev/ttyUSB0 24 | CH340RESET = 1 25 | 26 | include ../makefile.mk 27 | -------------------------------------------------------------------------------- /lauflicht/lauflicht.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------- 2 | lauflicht.c 3 | 4 | 5 | Compiler : SDCC 4.0.3 6 | MCU : PFS154 7 | 8 | 07.10.2020 R. Seelig 9 | 10 | -------------------------------------------------------- */ 11 | 12 | #include 13 | #include "pdk_init.h" 14 | #include "pfs1xx_gpio.h" 15 | #include "delay.h" 16 | 17 | // LED-Ausgabe auf PortB, gemeinsame Anode an +Vcc 18 | 19 | #define ledband_init() ( PBC= 0xff ) 20 | #define ledband_set(value) { PB= value; } 21 | 22 | 23 | #define speed 100 24 | 25 | 26 | /* -------------------------------------------------- 27 | main 28 | -------------------------------------------------- */ 29 | void main(void) 30 | { 31 | uint8_t outval; 32 | 33 | ledband_init(); 34 | 35 | outval= 1; 36 | while(1) 37 | { 38 | while(outval) 39 | { 40 | ledband_set(~outval); 41 | delay(speed); 42 | outval = outval << 1; 43 | } 44 | outval= 0x40; 45 | while(outval) 46 | { 47 | ledband_set(~outval); 48 | delay(speed); 49 | outval = outval >> 1; 50 | } 51 | outval= 0x02; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lauflicht_shooter/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = laufgame1 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | #SRCS += ../src/tm1650.rel 16 | 17 | INC_DIR = -I./ -I../include 18 | 19 | # benutzbare Programmer: 20 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 21 | # 2 : pfsprog ==> benoetigt serielle Portangabe 22 | 23 | PROGRAMMER = 1 24 | SERPORT = /dev/ttyUSB0 25 | #SERPORT = /dev/ttyACM0 26 | CH340RESET = 0 27 | 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /leuchtband/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = leuchtband 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | 16 | INC_DIR = -I./ -I../include 17 | 18 | # benutzbare Programmer: 19 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 20 | # 2 : pfsprog ==> benoetigt serielle Portangabe 21 | 22 | PROGRAMMER = 2 23 | SERPORT = /dev/ttyUSB0 24 | CH340RESET = 1 25 | 26 | include ../makefile.mk 27 | -------------------------------------------------------------------------------- /leuchtband/picture/nf_gleichrichter_simulation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/leuchtband/picture/nf_gleichrichter_simulation.png -------------------------------------------------------------------------------- /leuchtband/picture/pfs154_spgteiler_intern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/leuchtband/picture/pfs154_spgteiler_intern.png -------------------------------------------------------------------------------- /leuchtband/picture/vu_meter_pfs154.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/leuchtband/picture/vu_meter_pfs154.gif -------------------------------------------------------------------------------- /leuchtband/simulator/audio_gleichrichter.txt: -------------------------------------------------------------------------------- 1 | Audio - Gleichrichter 2 | Code fuer Onlinesimulator: 3 | 4 | https://www.falstad.com/circuit/circuitjs.html 5 | 6 | Zeilen nach der Trennzeile per copy und paste auf der Simulationsseite als Text einfuegen 7 | ------------------------------------------------------------------------------------------ 8 | $ 1 0.000005 27.727228452313398 50 5 50 9 | r 240 0 240 96 0 47400 10 | r 240 128 240 208 0 6720 11 | g 240 208 240 256 0 12 | w 240 96 304 96 0 13 | p 304 96 304 192 1 0 0 14 | g 304 192 304 256 0 15 | R 240 0 240 -48 0 0 40 5 0 0 0.5 16 | x 205 58 226 61 4 16 R1 17 | x 206 195 227 198 4 16 R2 18 | c 240 96 176 96 0 0.000001 0.7129691782732757 19 | R 128 96 80 96 0 1 108.2 2.011 0 0 0.5 20 | s 128 96 176 96 0 0 false 21 | t 336 96 384 96 0 1 -6.288023887012426 -2.8915856082392324 100 22 | w 304 96 336 96 0 23 | w 384 80 384 0 0 24 | R 384 0 384 -48 0 0 40 5 0 0 0.5 25 | c 384 128 384 192 0 0.000047 1.6035617212268067 26 | w 384 112 384 128 0 27 | w 240 128 240 96 0 28 | w 384 192 384 224 0 29 | g 384 224 384 256 0 30 | w 384 128 448 128 0 31 | r 448 128 448 224 0 1003.6 32 | g 448 224 448 256 0 33 | r 448 128 544 128 0 12000 34 | c 544 128 544 224 0 0.000001 1.6293520694566723 35 | g 544 224 544 256 0 36 | w 544 128 624 128 0 37 | r 624 128 624 224 0 1000000 38 | g 624 224 624 256 0 39 | w 624 128 688 128 0 40 | p 688 128 688 224 1 0 0 41 | g 688 224 688 256 0 42 | p 128 96 128 192 1 1 0 43 | g 128 192 128 256 0 44 | x 462 207 483 210 4 16 R3 45 | o 33 64 0 4098 2.5 0.1 0 1 46 | o 31 64 0 4098 2.5 0.1 1 1 47 | 38 0 0 10000 120000 R1 48 | 38 1 0 4000 20000 R2 49 | 38 10 0 0.1 5 inp.\svoltage 50 | 38 10 3 20 200 Frequency 51 | 38 22 0 820 10000 Resistance 52 | -------------------------------------------------------------------------------- /leuchtband/xls/pfs154_spannungsteiler2.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/leuchtband/xls/pfs154_spannungsteiler2.xls -------------------------------------------------------------------------------- /lm75_demo/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = lm75_demo 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS += ../src/delay.rel 15 | SRCS += ../src/uart.rel 16 | SRCS += ../src/i2c.rel 17 | SRCS += ../src/n5110.rel 18 | 19 | INC_DIR = -I./ -I../include 20 | 21 | # benutzbare Programmer: 22 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 23 | # 2 : pfsprog ==> benoetigt serielle Portangabe 24 | 25 | PROGRAMMER = 2 26 | SERPORT = /dev/ttyUSB0 27 | CH340RESET = 1 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /lm75_demo2/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = lm75_demo2 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS += ../src/delay.rel 15 | SRCS += ../src/i2c.rel 16 | SRCS += ../src/seg7mpx_dig3.rel 17 | 18 | INC_DIR = -I./ -I../include 19 | 20 | # benutzbare Programmer: 21 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 22 | # 2 : pfsprog ==> benoetigt serielle Portangabe 23 | 24 | PROGRAMMER = 2 25 | SERPORT = /dev/ttyUSB0 26 | CH340RESET = 1 27 | 28 | include ../makefile.mk 29 | -------------------------------------------------------------------------------- /lm75_demo2/dig3_demo.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------- 2 | dig3_demo.c 3 | 4 | Demo fuer eine 4-stellige gemultiplexte 5 | 7-Segmentanzeige 6 | 7 | verwendet 8-Bit Timer2 8 | 9 | Anschluesse: 10 | PB0 .. PB6 : Segmente a -- g 11 | PB7 : Dezimalpunkt 12 | PA0 : MPX Digit 0 (LSB) 13 | PA7 : MPX Digit 1 14 | PA6 : MPX Digit 2 (MSB) 15 | 16 | Compiler : SDCC 4.0.3 17 | MCU : PFS154 / PFS173 18 | 19 | 18.12.2020 R. Seelig 20 | 21 | -------------------------------------------------------- */ 22 | 23 | #include 24 | #include "pdk_init.h" 25 | #include "pfs1xx_gpio.h" 26 | #include "delay.h" 27 | #include "seg7mpx_dig3.h" 28 | 29 | 30 | /* -------------------------------------------------------- 31 | interrupt 32 | 33 | der Interrupt-Handler. TM2 ruft den Interrupt mit 34 | ca. 1 kHz auf. 35 | 36 | Hier muss das Multiplexen der Anzeige eingehaengt 37 | werden. 38 | -------------------------------------------------------- */ 39 | void interrupt(void) __interrupt(0) 40 | { 41 | // Interruptquelle ist Timer2 42 | if (INTRQ & INTRQ_TM2) 43 | { 44 | seg7_mpx(); // Timergesteuertes multiplexen 45 | // der 2-stelligen Anzeige 46 | INTRQ &= ~INTRQ_TM2; // Interruptanforderung quittieren 47 | } 48 | } 49 | 50 | /* -------------------------------------------------------- 51 | main 52 | -------------------------------------------------------- */ 53 | void main(void) 54 | { 55 | static uint16_t cx; 56 | 57 | delay(300); 58 | seg7_init(); 59 | 60 | cx= 0; 61 | seg7_dp= 1; 62 | while(1) 63 | { 64 | s7buf= hex2bcd16(cx); 65 | delay(100); 66 | __disgint(); 67 | cx++; 68 | cx= cx % 1000; 69 | __engint(); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /melody/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = yamep 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | SRCS += ../src/toene.rel 16 | 17 | INC_DIR = -I./ -I../include 18 | 19 | # benutzbare Programmer: 20 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 21 | # 2 : pfsprog ==> benoetigt serielle Portangabe 22 | 23 | PROGRAMMER = 2 24 | SERPORT = /dev/ttyUSB0 25 | CH340RESET = 1 26 | 27 | include ../makefile.mk 28 | -------------------------------------------------------------------------------- /melody/toene.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------- 2 | toene.c 3 | 4 | Header Notentongenerator und Abspielfunktion fuer 5 | in einem String enthaltene Noten 6 | 7 | Bsp. 8 | 9 | playstring("c4e2F4 + c2"); 10 | 11 | spielt hintereinander eine Viertelnote "c", halbe 12 | Note "e" und eine Viertelnote "Fis" ab. Das Plus- 13 | zeichen "+" erhoeht die Oktave, so dass zum Schluss 14 | eine Halbnote "c" der hoeheren Oktave gespielt 15 | wird. 16 | 17 | Grosse Buchstaben C,D,F,G,A sind Noten entsprechend 18 | Cis, Dis, Fis, Gis und Ais. 19 | 20 | Benoetigt den 16-Bit Timer 21 | 22 | Compiler : SDCC 4.0.3 23 | MCU : PFS154 / PFS173 24 | 25 | 13.10.2020 R. Seelig 26 | 27 | -------------------------------------------------------- */ 28 | 29 | #ifndef in_tone 30 | #define in_toene 31 | 32 | #include 33 | #include "pfs1xx_gpio.h" 34 | #include "delay.h" 35 | 36 | 37 | // Frequenzausgang-Anschlusspin 38 | #define fout_pin PA0 39 | 40 | // Flag zum An- Ausschalten der Tonerzeugung 41 | extern volatile char sound; 42 | extern uint16_t playtempo; 43 | 44 | 45 | // ---------------------------------------------------------------- 46 | // Prototypen 47 | // ---------------------------------------------------------------- 48 | 49 | void t16_setnewfreq(uint8_t freq); 50 | void t16_init(void); 51 | void interrupt(void) __interrupt(0); 52 | void tonlen(int w); 53 | void playnote(char note); 54 | void playstring(const uint8_t* const s); 55 | 56 | 57 | // ---------------------------------------------------------------- 58 | // Praeprozessormacros um 2 Stringtexte zur weiteren Verwendung 59 | // innerhalb des Praeprozessors zu verknuepfen 60 | // 61 | // Bsp.: 62 | // #define ionr 3 63 | // #define ioport CONC(PA, ionr) 64 | // 65 | // ioport wird nun als "PA3" behandelt 66 | #define CONC2EXP(a,b) a ## b 67 | #define CONC(a,b) CONC2EXP(a, b) 68 | // ---------------------------------------------------------------- 69 | 70 | #define fout_init() CONC(fout_pin,_output_init()) 71 | #define fout_set() CONC(fout_pin,_set()) 72 | #define fout_clr() CONC(fout_pin,_clr()) 73 | #define fout_toggle() CONC(fout_pin,_toggle()) 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /melody/yamep.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------- 2 | yamep.c 3 | 4 | Yet another melody player 5 | 6 | Spielt einen String, der Noten in C-Dur und der 7 | Tonlaenge enthaelt mittels Rechteckfrequenzen 8 | ab. 9 | 10 | Bsp. 11 | 12 | playstring("c4e2F4 + c2"); 13 | 14 | spielt hintereinander eine Viertelnote "c", halbe 15 | Note "e" und eine Viertelnote "Fis" ab. Das Plus- 16 | zeichen "+" erhoeht die Oktave, so dass zum Schluss 17 | eine Halbnote "c" der hoeheren Oktave gespielt 18 | wird. 19 | 20 | Grosse Buchstaben C,D,F,G,A sind Noten entsprechend 21 | Cis, Dis, Fis, Gis und Ais. 22 | 23 | Der Anschluss eines Lautsprechers oder eines 24 | Lautsprechertreibers (Hardware) ist in toene.h 25 | anzugeben. 26 | 27 | Compiler : SDCC 4.0.3 28 | MCU : PFS154 / PFS173 29 | 30 | 13.10.2020 R. Seelig 31 | 32 | -------------------------------------------------------- */ 33 | 34 | #include 35 | #include "pdk_init.h" 36 | #include "pfs1xx_gpio.h" 37 | #include "delay.h" 38 | #include "toene.h" 39 | 40 | const uint8_t schneew[] = { "c4 d4 e2 g4 e2 g4 e1 d4" \ 41 | "e4 f2 g4 f2 g4 f1 g4 a4" \ 42 | "h2+f4-h2+f4-h1 a4 h4+c2" \ 43 | "e4 c2-a4 g1 e4 g4+c1-h1" \ 44 | "+d1 c1-a2+c4-a2+c4-a1" }; 45 | 46 | 47 | 48 | const uint8_t leise_rieselt[] = { "a4 a8 g8 a8 g8 f2 p8" \ 49 | "f4 d8 f8 e8 d8 c2 p8" \ 50 | "g8 F8 g8 A8 a8 g8 f2 p8" \ 51 | "g8 d9 d8 e8 d8 e8 f2" }; 52 | 53 | /* -------------------------------------------------- 54 | main 55 | -------------------------------------------------- */ 56 | void main(void) 57 | { 58 | char led_stat = 0; 59 | 60 | fout_init(); 61 | t16_init(); 62 | 63 | playtempo= 5; 64 | 65 | playstring(&schneew[0]); 66 | 67 | delay(1000); 68 | 69 | playtempo= 12; 70 | playstring(&leise_rieselt[0]); 71 | 72 | while(1); 73 | } 74 | -------------------------------------------------------------------------------- /n5110_demo/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = n5110_demo 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | 14 | # hier alle zusaetzlichen Softwaremodule angegeben 15 | SRCS = ../src/delay.rel 16 | SRCS += ../src/n5110.rel 17 | SRCS += ../src/my_printf.rel 18 | 19 | INC_DIR = -I./ -I../include 20 | 21 | # benutzbare Programmer: 22 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 23 | # 2 : pfsprog ==> benoetigt serielle Portangabe 24 | 25 | PROGRAMMER = 2 26 | SERPORT = /dev/ttyUSB0 27 | CH340RESET = 1 28 | 29 | 30 | include ../makefile.mk 31 | -------------------------------------------------------------------------------- /n5110_demo/n5110_demo.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------- 2 | n5110_demo.c 3 | 4 | Demo fuer N5110 Monochrom-LCD 84x48 5 | 6 | Compiler : SDCC 4.0.3 7 | MCU : PFS154 / PFS173 8 | 9 | 14.10.2020 R. Seelig 10 | 11 | -------------------------------------------------------- */ 12 | 13 | #include 14 | #include "pdk_init.h" 15 | #include "pfs1xx_gpio.h" 16 | #include "delay.h" 17 | #include "n5110.h" 18 | 19 | #include "my_printf.h" 20 | 21 | #define printf my_printf // "Umleitung" von printf auf my_printf, damit 22 | // im Quelltext wie gewohnt mittels printf 23 | // Ausgaben gemacht werden koennen 24 | 25 | /* -------------------------------------------------------- 26 | my_putchar 27 | 28 | wird von my-printf / printf aufgerufen und hier muss 29 | eine Zeichenausgabefunktion angegeben sein, auf das 30 | printf dann schreibt ! 31 | -------------------------------------------------------- */ 32 | void my_putchar(uint8_t ch) 33 | { 34 | lcd_putchar(ch); 35 | } 36 | 37 | 38 | /* -------------------------------------------------- 39 | main 40 | -------------------------------------------------- */ 41 | void main(void) 42 | { 43 | uint16_t cx; 44 | 45 | delay(150); 46 | lcd_init(); 47 | delay(10); 48 | clrscr(); 49 | 50 | gotoxy(0,0); printf("Padauk PFS154"); 51 | gotoxy(1,1); printf("16-Bit count"); 52 | gotoxy(0,2); printf("--------------"); 53 | cx= 0; 54 | gotoxy(0,4); printf("Counter:"); 55 | while(1) 56 | { 57 | gotoxy(9,4); printf("%d",cx); 58 | cx++; 59 | delay(500); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /notes/comparator_registers.txt: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------- 2 | Comparator Registers 3 | 4 | 5 | GPCC - Comparator Control Register 6 | Bit Bedeutung 7 | ---------------------------------------------------- 8 | 7 Enable comparator, 0/1 disable/enable 9 | 6 Komparatorergebnis, 0: +Ue < -Ue 10 | 1: +Ue > -ue 11 | 5 Output sampled by TM2_CLK 12 | 4 Ausgangsinvertierung 0: nichtinvert. 13 | 1: invertierend 14 | 3-1 Quelle -Ue 000: PA3 15 | 001: PA4 16 | 010: interne 1,2V Referenz 17 | 011: internens Widerstandsnetz 18 | 100: PB6 19 | 101: PB7 20 | 11x: reserved 21 | 22 | 0 Quelle +Ue 0 : internes Widerstandsnetz 23 | 1 : PA4 24 | 25 | 26 | GPCS - Comparator Selection Register 27 | Bit Bedeutung 28 | ---------------------------------------------------- 29 | 7 Output enable to PA0 30 | 6 reserviert 31 | 5 High range Widerstandsnetz 32 | 4 Low range Widerstandsnetz 33 | 3-0 Abgriff am Widerstandsnetz, 0000 : unterer Abgriff 34 | 1000 : oberer Abgriff 35 | 36 | ------------------------------------------------------------------------------ 37 | 38 | Das Widerstandsnetz besteht aus einem umschaltbargen 39 | Spannungsteiler, der zwischen Vdd und Vss liegt: 40 | 41 | | High Range | Spg.teiler 16 Abgriffe | Low Range | 42 | 43 | Vdd o--- 8R -- 8R GPCS.5=1 - --- R -- R ... R -- R GPCS.4= 0 8R ---o GND 44 | | | | | | | 45 | --- GPCS.5=0 - | | | | GPCS.4= 1 ------o GND 46 | | | | | 47 | 48 | Spannungsteiler besteht somit aus einem umschaltbaren 49 | Vorwiderstand mit 8*R (GPCS.5= 0) oder 16*R (GPCS.5= 1) 50 | 16 einzelnen Widerstaenden R und einem Widerstand gegen 51 | GND mit 8*R (GPCS.4= 0) oder 0*R (GPCS=1) 52 | 53 | Bsp.: 54 | GPCS.5= 0; GPCS4= 0; => U_hi8R = 1/4 Vdd, U_lo8R = 1/4 Vdd 55 | U_16R = 1/2 Vdd 56 | 57 | Somit koennen Spannungen am Abgriff von 1/4 Vdd 58 | (GPCS.3-0 = 0000) bis 3/4 Vdd (GPCS.3-0 = 1111) in 59 | 16 Stufen eingestellt werden: 60 | 61 | ((n+1/32) * Vdd) + 1/4 * Vdd // n = GPCS.3-0 in dezimal 62 | 63 | Vdd= 5V, GPCS.5= 0, GPCS.4= 0, GPCS.3-1= 0011 64 | 65 | GPCS= 0x03 => V_rintern= 1.71V 66 | -------------------------------------------------------- 67 | 68 | 69 | -------------------------------------------------------- */ 70 | -------------------------------------------------------------------------------- /notes/ntctable_readme.txt: -------------------------------------------------------------------------------- 1 | ntc_maketable 2 | --------------------------------------------------------------------------------- 3 | 4 | ntc_maketable ist ein Konsolenprogramm, das fuer einen gegebenen NTC Widerstand 5 | mit gegebenem B-Wert eine Stuetztabelle und eine C-Funktion zum Lesen dieser 6 | Stuetztabelle erzeugt. 7 | 8 | Die "Auswerteschaltung" besteht aus einem Spannungsteiler mit einem Pullup- 9 | widerstand und dem NTC. Der Knotenpunkt wird dem ADC-Pin des Controllers zu- 10 | gefuehrt. 11 | 12 | Syntax: 13 | -r value | R25 Widerstandswert NTC 14 | -R value | Popupwiderstand gegen Referenzspannung 15 | -b value | Betawert NTC (B 25/85) 16 | -A value | ADC-Aufloesung in Bit 17 | -h | diese Anzeige (Help) 18 | optional: 19 | -a | Sourcedatei fuer AVR-Conroller 20 | -l | Lookup-Table mit 32 Punkten (statt 16) 21 | 22 | 23 | Beispiel: 24 | 25 | Bestehender Spannungsteiler aus 10k Ohm Pullup-Widerstand und 10k Ohm NTC mit 26 | einem B-Wert von 3950. Es soll eine Lookuptabelle fuer ARM Controller (mit 27 | 12-Bit Aufloesung) erstellt werden: 28 | 29 | ntc_maketable -r 10000 -R 10000 -b 3950 -A 12 -l 30 | 31 | 32 | 12.11.2019 R. Seelig 33 | 34 | -------------------------------------------------------------------------------- /ntc/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = ntc_vers_02 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS += ../src/delay.rel 15 | SRCS += ../src/uart.rel 16 | SRCS += ../src/adc_pfs154.rel 17 | SRCS += ../src/seg7mpx_dig2.rel 18 | 19 | INC_DIR = -I./ -I../include 20 | 21 | # benutzbare Programmer: 22 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 23 | # 2 : pfsprog ==> benoetigt serielle Portangabe 24 | 25 | PROGRAMMER = 2 26 | SERPORT = /dev/ttyUSB0 27 | CH340RESET = 1 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /ntc/divers/ntc10k_3950.lut: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* ------------------------------------------------- 4 | Lookup-table fuer NTC-Widerstand 5 | R25-Wert: 10.00 kOhm 6 | Pullup-Widerstand: 10.00 kOhm 7 | Materialkonstante beta: 3950 8 | Aufloesung des ADC: 8 Bit 9 | Einheit eines Tabellenwertes: 0.1 Grad Celcius 10 | Temperaturfehler der Tabelle: 0.7 Grad Celcius 11 | -------------------------------------------------*/ 12 | const int ntctable[] = { 13 | 1269, 1016, 763, 621, 520, 439, 370, 308, 14 | 250, 194, 139, 83, 22, -47, -132, -256, 15 | -380 16 | }; 17 | 18 | /* ------------------------------------------------- 19 | ntc_gettemp 20 | 21 | zuordnen des Temperaturwertes aus gegebenem 22 | ADC-Wert. 23 | ------------------------------------------------- */ 24 | int ntc_gettemp(uint16_t adc_value) 25 | { 26 | int p1,p2; 27 | 28 | // Stuetzpunkt vor und nach dem ADC Wert ermitteln. 29 | p1 = ntctable[ (adc_value >> 4) ]; 30 | p2 = ntctable[ (adc_value >> 4) + 1]; 31 | 32 | // zwischen beiden Punkten interpolieren. 33 | return p1 - ( (p1-p2) * (adc_value & 0x000f) ) / 16; 34 | } 35 | -------------------------------------------------------------------------------- /ntc/divers/ntc10k_3977.lut: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* ------------------------------------------------- 4 | Lookup-table fuer NTC-Widerstand 5 | R25-Wert: 10.00 kOhm 6 | Pullup-Widerstand: 10.00 kOhm 7 | Materialkonstante beta: 3977 8 | Aufloesung des ADC: 8 Bit 9 | Einheit eines Tabellenwertes: 0.1 Grad Celcius 10 | Temperaturfehler der Tabelle: 0.7 Grad Celcius 11 | -------------------------------------------------*/ 12 | const int ntctable[] = { 13 | 1259, 1009, 759, 618, 518, 437, 369, 307, 14 | 250, 195, 140, 84, 23, -45, -130, -253, 15 | -376 16 | }; 17 | 18 | /* ------------------------------------------------- 19 | ntc_gettemp 20 | 21 | zuordnen des Temperaturwertes aus gegebenem 22 | ADC-Wert. 23 | ------------------------------------------------- */ 24 | int ntc_gettemp(uint16_t adc_value) 25 | { 26 | int p1,p2; 27 | 28 | // Stuetzpunkt vor und nach dem ADC Wert ermitteln. 29 | p1 = ntctable[ (adc_value >> 4) ]; 30 | p2 = ntctable[ (adc_value >> 4) + 1]; 31 | 32 | // zwischen beiden Punkten interpolieren. 33 | return p1 - ( (p1-p2) * (adc_value & 0x000f) ) / 16; 34 | } 35 | -------------------------------------------------------------------------------- /ntc/divers/ntc_excel_scr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/ntc/divers/ntc_excel_scr.png -------------------------------------------------------------------------------- /ntc/divers/ntc_values.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/ntc/divers/ntc_values.xls -------------------------------------------------------------------------------- /ntc/divers/ntctable: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/ntc/divers/ntctable -------------------------------------------------------------------------------- /ntc/divers/ntctable_readme.txt: -------------------------------------------------------------------------------- 1 | ntc_maketable 2 | --------------------------------------------------------------------------------- 3 | 4 | ntc_maketable ist ein Konsolenprogramm, das fuer einen gegebenen NTC Widerstand 5 | mit gegebenem B-Wert eine Stuetztabelle und eine C-Funktion zum Lesen dieser 6 | Stuetztabelle erzeugt. 7 | 8 | Die "Auswerteschaltung" besteht aus einem Spannungsteiler mit einem Pullup- 9 | widerstand und dem NTC. Der Knotenpunkt wird dem ADC-Pin des Controllers zu- 10 | gefuehrt. 11 | 12 | Syntax: 13 | -r value | R25 Widerstandswert NTC 14 | -R value | Popupwiderstand gegen Referenzspannung 15 | -b value | Betawert NTC (B 25/85) 16 | -A value | ADC-Aufloesung in Bit 17 | -h | diese Anzeige (Help) 18 | optional: 19 | -a | Sourcedatei fuer AVR-Conroller 20 | -l | Lookup-Table mit 32 Punkten (statt 16) 21 | 22 | 23 | Beispiel: 24 | 25 | Bestehender Spannungsteiler aus 10k Ohm Pullup-Widerstand und 10k Ohm NTC mit 26 | einem B-Wert von 3950. Es soll eine Lookuptabelle fuer ARM Controller (mit 27 | 12-Bit Aufloesung) erstellt werden: 28 | 29 | ntc_maketable -r 10000 -R 10000 -b 3950 -A 12 -l 30 | 31 | 32 | 12.11.2019 R. Seelig 33 | 34 | -------------------------------------------------------------------------------- /ntc/divers/ntctable_src/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = ntctable 8 | 9 | CC = gcc 10 | 11 | .PHONY: all clean 12 | 13 | all: clean 14 | $(CC) $(PROJECT).c -Os -lm -o $(PROJECT) 15 | 16 | clean: 17 | rm -f $(PROJECT) 18 | -------------------------------------------------------------------------------- /ntc/divers/ntctable_src/readme.txt: -------------------------------------------------------------------------------- 1 | ntc_maketable 2 | --------------------------------------------------------------------------------- 3 | 4 | ntc_maketable ist ein Konsolenprogramm, das fuer einen gegebenen NTC Widerstand 5 | mit gegebenem B-Wert eine Stuetztabelle und eine C-Funktion zum Lesen dieser 6 | Stuetztabelle erzeugt. 7 | 8 | Die "Auswerteschaltung" besteht aus einem Spannungsteiler mit einem Pullup- 9 | widerstand und dem NTC. Der Knotenpunkt wird dem ADC-Pin des Controllers zu- 10 | gefuehrt. 11 | 12 | Syntax: 13 | -r value | R25 Widerstandswert NTC 14 | -R value | Popupwiderstand gegen Referenzspannung 15 | -b value | Betawert NTC (B 25/85) 16 | -A value | ADC-Aufloesung in Bit 17 | -h | diese Anzeige (Help) 18 | optional: 19 | -a | Sourcedatei fuer AVR-Conroller 20 | -l | Lookup-Table mit 32 Punkten (statt 16) 21 | 22 | 23 | Beispiel: 24 | 25 | Bestehender Spannungsteiler aus 10k Ohm Pullup-Widerstand und 10k Ohm NTC mit 26 | einem B-Wert von 3950. Es soll eine Lookuptabelle fuer ARM Controller (mit 27 | 12-Bit Aufloesung) erstellt werden: 28 | 29 | ntc_maketable -r 10000 -R 10000 -b 3950 -A 12 -l 30 | 31 | 32 | 12.11.2019 R. Seelig 33 | 34 | -------------------------------------------------------------------------------- /ntc/divers/padauk_thermometer_02.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/ntc/divers/padauk_thermometer_02.gif -------------------------------------------------------------------------------- /ntc/divers/temp_schaetzometer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/ntc/divers/temp_schaetzometer.jpg -------------------------------------------------------------------------------- /ntc/ntc10k_3950.lut: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* ------------------------------------------------- 4 | Lookup-table fuer NTC-Widerstand 5 | R25-Wert: 10.00 kOhm 6 | Pullup-Widerstand: 10.00 kOhm 7 | Materialkonstante beta: 3950 8 | Aufloesung des ADC: 8 Bit 9 | Einheit eines Tabellenwertes: 0.1 Grad Celcius 10 | Temperaturfehler der Tabelle: 0.7 Grad Celcius 11 | -------------------------------------------------*/ 12 | const int ntctable[] = { 13 | 1269, 1016, 763, 621, 520, 439, 370, 308, 14 | 250, 194, 139, 83, 22, -47, -132, -256, 15 | -380 16 | }; 17 | 18 | /* ------------------------------------------------- 19 | ntc_gettemp 20 | 21 | zuordnen des Temperaturwertes aus gegebenem 22 | ADC-Wert. 23 | ------------------------------------------------- */ 24 | int ntc_gettemp(uint16_t adc_value) 25 | { 26 | int p1,p2; 27 | 28 | // Stuetzpunkt vor und nach dem ADC Wert ermitteln. 29 | p1 = ntctable[ (adc_value >> 4) ]; 30 | p2 = ntctable[ (adc_value >> 4) + 1]; 31 | 32 | // zwischen beiden Punkten interpolieren. 33 | return p1 - ( (p1-p2) * (adc_value & 0x000f) ) / 16; 34 | } 35 | -------------------------------------------------------------------------------- /ntc/ntc10k_3977.lut: -------------------------------------------------------------------------------- 1 | 2 | 3 | /* ------------------------------------------------- 4 | Lookup-table fuer NTC-Widerstand 5 | R25-Wert: 10.00 kOhm 6 | Pullup-Widerstand: 10.00 kOhm 7 | Materialkonstante beta: 3977 8 | Aufloesung des ADC: 8 Bit 9 | Einheit eines Tabellenwertes: 0.1 Grad Celcius 10 | Temperaturfehler der Tabelle: 0.7 Grad Celcius 11 | -------------------------------------------------*/ 12 | const int ntctable[] = { 13 | 1259, 1009, 759, 618, 518, 437, 369, 307, 14 | 250, 195, 140, 84, 23, -45, -130, -253, 15 | -376 16 | }; 17 | 18 | /* ------------------------------------------------- 19 | ntc_gettemp 20 | 21 | zuordnen des Temperaturwertes aus gegebenem 22 | ADC-Wert. 23 | ------------------------------------------------- */ 24 | int ntc_gettemp(uint16_t adc_value) 25 | { 26 | int p1,p2; 27 | 28 | // Stuetzpunkt vor und nach dem ADC Wert ermitteln. 29 | p1 = ntctable[ (adc_value >> 4) ]; 30 | p2 = ntctable[ (adc_value >> 4) + 1]; 31 | 32 | // zwischen beiden Punkten interpolieren. 33 | return p1 - ( (p1-p2) * (adc_value & 0x000f) ) / 16; 34 | } 35 | -------------------------------------------------------------------------------- /oled1306_i2c/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = oled_demo 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | SRCS += ../src/i2c.rel 16 | SRCS += ../src/oled1306_i2c.rel 17 | 18 | INC_DIR = -I./ -I../include 19 | 20 | # benutzbare Programmer: 21 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 22 | # 2 : pfsprog ==> benoetigt serielle Portangabe 23 | 24 | PROGRAMMER = 2 25 | SERPORT = /dev/ttyUSB0 26 | CH340RESET = 1 27 | 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /pfs154_pinout.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | +----------------+ 4 | PB4 | 1 |___| 16 | PB3 5 | PB5 | 2 15 | PB2 6 | PB6 | 3 14 | PB1 7 | PB7 | 4 PFS154 13 | PB0 8 | ------------- 9 | VDD | 5 (1) (8) 12 | GND 10 | PA7 | 6 (2) (7) 11 | PA0 11 | ICPDA / PA6 | 7 (3) (6) 10 | PA4 12 | Vpp / PA5 | 8 (4) (5) 9 | PA3 / ICPCK 13 | +----------------+ 14 | -------------------------------------------------------------------------------- /pfsprog_arduino_sketch/README.md: -------------------------------------------------------------------------------- 1 |
2 | pfs154_prog2.ino ist ein Pseudo-Arduino Sketch, welches innerhalb des Arduino-Frameworks 3 | uebersetzt werden kann.
4 |
5 | Dieser Sketch ist ein an sich ein reines C-Programm (und hat von daher auch keine typische 6 | Funktion "setup" oder "loop" eines Arduino-Sketches).
7 |
8 | Das Arduino-Framework kann jedoch (weil der zugrunde liegende Compiler ein AVR-GCC ist) auch 9 | Dateien uebersetzen, die reinen C-Code darstellen.
10 |
11 | Hiervon wurde hier Gebrauch gemacht und so kann die Arduino-IDE diesen Sketch zum einen 12 | kompilieren und (an sich wichtiger) das Kompilat auch zu einem Arduino-UNO transferieren.
13 |
14 | Dieses sollte fuer alle die hilfreich sein, die zwar eine Arduino-Installation auf dem 15 | Computer haben, aber keine systemweite AVR-GCC Installation. 16 | -------------------------------------------------------------------------------- /pfsprog_arduinobased_programmer/Makefile: -------------------------------------------------------------------------------- 1 | # --------------------------------------------- 2 | # erzeugt flash51n2 und flash51ide 3 | # --------------------------------------------- 4 | all: 5 | make build 6 | 7 | build: 8 | fpc pfsprog.pas 9 | 10 | clean: 11 | rm -f *.o 12 | rm -f *.ppu 13 | rm -f pfsprog 14 | 15 | -------------------------------------------------------------------------------- /pfsprog_arduinobased_programmer/firmware/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = pfs154_prog2 8 | 9 | 10 | INC_DIR = -I./ -I../include 11 | 12 | # hier alle zusaetzlichen Softwaremodule angegeben 13 | 14 | SRCS = ./my_printf.o 15 | SRCS += ./uart_all.o 16 | 17 | PRINT_FL = 0 18 | SCAN_FL = 0 19 | MATH = 0 20 | 21 | # fuer Compiler / Linker 22 | FREQ = 16000000ul 23 | MCU = atmega328p 24 | 25 | # fuer AVRDUDE 26 | PROGRAMMER = arduino 27 | PROGPORT = /dev/ttyUSB0 28 | BRATE = 115200 29 | DUDEOPTS = -B1 30 | 31 | include ./makefile.mk 32 | 33 | -------------------------------------------------------------------------------- /pfsprog_arduinobased_programmer/firmware/my_printf.h: -------------------------------------------------------------------------------- 1 | /* --------------------------- my_printf.h ---------------------------- 2 | 3 | Implementierung einer sehr minimalistischen (und im Funktionsumfang 4 | eingeschraenkten) Version von printf zur urspruenglichen Verwendung 5 | im ATtiny2313 (sollte allerdings auch mit allen anderen AVR- 6 | Controllern funktionieren) 7 | 8 | Benoetigt "irgendwo" im Gesamtprogram ein 9 | 10 | my_putchar(char c); 11 | 12 | 13 | 22.04.2016 R. Seelig 14 | 15 | Danke an www.mikrocontroller.net (Dr.Sommer, beric) 16 | 17 | letzte Aenderung: 18 | --------------------------------------------------- 19 | 20 | Anpassung an die my-printf Versionen von STM8 und STM32 Versionen 21 | mit Angabe der Nachkommastellen bei Verwendung des %k Platzhalters 22 | (Implementation der globalen Variable printfkomma und veraenderte 23 | < putint > Funktion 24 | 25 | 29.08.2018 R. Seelig 26 | 27 | --------------------------------------------------------------------- */ 28 | 29 | #ifndef in_myprintf 30 | #define in_myprintf 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | extern char printfkomma; 37 | 38 | extern void my_putchar(char c); 39 | void putint(int16_t i, char komma); 40 | void hexnibbleout(uint8_t b); 41 | void puthex(uint16_t h); 42 | void my_putramstring(uint8_t *p); 43 | 44 | void own_printf(const uint8_t *s,...); 45 | 46 | #define tiny_printf(str,...) (own_printf(PSTR(str), ## __VA_ARGS__)) 47 | #define my_printf tiny_printf 48 | 49 | 50 | #endif 51 | 52 | 53 | -------------------------------------------------------------------------------- /pfsprog_arduinobased_programmer/firmware/my_printf.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/pfsprog_arduinobased_programmer/firmware/my_printf.o -------------------------------------------------------------------------------- /pfsprog_arduinobased_programmer/firmware/pfs154_prog2.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/pfsprog_arduinobased_programmer/firmware/pfs154_prog2.elf -------------------------------------------------------------------------------- /pfsprog_arduinobased_programmer/firmware/pfs154_prog2.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/pfsprog_arduinobased_programmer/firmware/pfs154_prog2.o -------------------------------------------------------------------------------- /pfsprog_arduinobased_programmer/firmware/uart_all.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/pfsprog_arduinobased_programmer/firmware/uart_all.o -------------------------------------------------------------------------------- /pfsprog_arduinobased_programmer/pfsprog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/pfsprog_arduinobased_programmer/pfsprog -------------------------------------------------------------------------------- /pfsprog_arduinobased_programmer/pictures/pfs154_programmer_shield_3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/pfsprog_arduinobased_programmer/pictures/pfs154_programmer_shield_3.gif -------------------------------------------------------------------------------- /pfsprog_arduinobased_programmer/pictures/pfs154_progshield_schematic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/pfsprog_arduinobased_programmer/pictures/pfs154_progshield_schematic.jpg -------------------------------------------------------------------------------- /pfsprog_arduinobased_programmer/pictures/pfs_progshield_bestueck_kl.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/pfsprog_arduinobased_programmer/pictures/pfs_progshield_bestueck_kl.jpg -------------------------------------------------------------------------------- /pfsprog_arduinobased_programmer/pictures/pfs_progshield_loet_kl.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/pfsprog_arduinobased_programmer/pictures/pfs_progshield_loet_kl.jpg -------------------------------------------------------------------------------- /pfsprog_arduinobased_programmer/pictures/pfsprog_lochstreifen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/pfsprog_arduinobased_programmer/pictures/pfsprog_lochstreifen.gif -------------------------------------------------------------------------------- /pfsprog_arduinobased_programmer/synautil.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/pfsprog_arduinobased_programmer/synautil.pas -------------------------------------------------------------------------------- /pwm/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = pwm 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | 14 | 15 | # hier alle zusaetzlichen Softwaremodule angegeben 16 | SRCS = 17 | 18 | INC_DIR = -I./ -I../include 19 | 20 | # benutzbare Programmer: 21 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 22 | # 2 : pfsprog ==> benoetigt serielle Portangabe 23 | 24 | PROGRAMMER = 2 25 | SERPORT = /dev/ttyUSB0 26 | CH340RESET = 1 27 | 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /pwm/pwm.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------- 2 | pwm.c 3 | 4 | Verwendung eines 8-Bit Timer als PWM, hier Timer2. 5 | 6 | Timer3 hat andere moegliche Ausgangspins, an- 7 | sonsten sind die Timer identisch, sieh 8 | timer2_3_reg.txt 9 | 10 | Compiler : SDCC 4.0.3 11 | MCU : PFS154 12 | 13 | 17.12.2020 R. Seelig 14 | 15 | -------------------------------------------------------- */ 16 | 17 | #include 18 | #include "pdk_init.h" 19 | #include "pfs1xx_gpio.h" 20 | 21 | // PWM Ausgangsanschluesse 22 | #define pwmout_init() PB2_output_init() 23 | 24 | // der Spannungspegel [mv], den ein Hi-Level besitzt 25 | #define own_ub 4920 26 | 27 | 28 | /* -------------------------------------------------------- 29 | tim2_init 30 | 31 | Beteiligte Register: TM2C (timer2 control register) 32 | TM2C (timer2 counter register) 33 | TM2S (timer2 scalar reigster) 34 | -------------------------------------------------------- */ 35 | void tim2_init(void) 36 | { 37 | // TM2C 38 | // 0010 01 10 = 0x26 39 | // IHRC output PB2 pwm-mode / no invers 40 | TM2C = 0x26; 41 | // ----------------------------------------------- 42 | 43 | // TM2S 44 | // 0 00 0001 = 0x01 45 | // PWM-8 Prescale divisior 46 | // f_pwmc = IHRC / 256 = 16MHz / 256 = 62.5 kHz 47 | // f_pwm = f_pwm / Prescale / (divisor+1) = 31.25 / 1 / 2 =15.625 48 | // f_timer= sysclock / 64 / 5 = 25 kHz 49 | TM2S = 0x00; 50 | // ----------------------------------------------- 51 | 52 | // TM2B 53 | // 160 = 0xa0 Teile Hi, 255-160 Teile LO 54 | // 128 = 0x80 Teile Hi, 255-128 Teile LO 55 | TM2B = 0x80; 56 | 57 | } 58 | 59 | /* -------------------------------------------------- 60 | voltage_set 61 | 62 | setzt ein PWM-Signal, dass einen RMS Wert von 63 | Value entspricht. Um aus diesem PWM-Signal mit 64 | der angegebenen Spannung eine reale analoge 65 | Spannung erzeugt werden, muss dieses PWM-Signal 66 | mindestens mit einem RC-Tiefpassfilter gefiltert 67 | werden. 68 | 69 | Uebergabe: 70 | value : Spannung in Milivolt 71 | -------------------------------------------------- */ 72 | void voltage_set(uint32_t value) 73 | { 74 | uint32_t r; 75 | 76 | r= (value * 255) / own_ub; 77 | TM2B= (uint8_t)r; 78 | } 79 | 80 | 81 | /* -------------------------------------------------- 82 | main 83 | -------------------------------------------------- */ 84 | void main(void) 85 | { 86 | pwmout_init(); 87 | tim2_init(); 88 | voltage_set(3220); 89 | 90 | while(1); 91 | } 92 | -------------------------------------------------------------------------------- /rda5807_ukw/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = ukw_radio 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | 14 | # hier alle zusaetzlichen Softwaremodule angegeben 15 | SRCS = ../src/delay.rel 16 | SRCS += ../src/i2c.rel 17 | SRCS += ../src/rda5807.rel 18 | 19 | INC_DIR = -I./ -I../include 20 | 21 | # benutzbare Programmer: 22 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 23 | # 2 : pfsprog ==> benoetigt serielle Portangabe 24 | 25 | PROGRAMMER = 2 26 | SERPORT = /dev/ttyUSB0 27 | CH340RESET = 1 28 | 29 | 30 | include ../makefile.mk 31 | -------------------------------------------------------------------------------- /rda5807_ukw/rda5807.h: -------------------------------------------------------------------------------- 1 | /* ----------------------------------------------------- 2 | rda5807.h 3 | 4 | Header fuer grundsaetzliche Steuerungsfunktionen 5 | zum UKW-Receiver RDA5807 mit I2C Schnittstelle 6 | 7 | Compiler : SDCC 4.0.3 8 | MCU : PFS154 / PFS173 9 | 10 | 21.10.2020 R. Seelig 11 | ------------------------------------------------------ */ 12 | 13 | #ifndef in_rda 14 | #define in_rda 15 | 16 | #include 17 | #include "i2c.h" 18 | 19 | #define rda5807_adrs 0x20 // I2C-addr. fuer sequientielllen Zugriff 20 | #define rda5807_adrr 0x22 // I2C-addr. fuer wahlfreien Zugriff 21 | #define rda5807_adrt 0xc0 // I2C-addr. fuer TEA5767 kompatiblen Modus 22 | 23 | #define fbandmin 870 // 87.0 MHz unteres Frequenzende 24 | #define fbandmax 1080 // 108.0 MHz oberes Frequenzende 25 | #define sigschwelle 72 // Schwelle ab der ein Sender als "gut empfangen" gilt 26 | 27 | extern uint16_t aktfreq; // Startfrequenz ( 101.8 MHz fuer neue Welle) 28 | extern uint8_t aktvol; // Startlautstaerke 29 | 30 | 31 | void rda5807_writereg(void); 32 | void rda5807_write(void); 33 | void rda5807_reset(void); 34 | void rda5807_poweron(void); 35 | int rda5807_setfreq(); 36 | void rda5807_setvol(); 37 | void rda5807_setmono(void); 38 | void rda5807_setstereo(void); 39 | uint8_t rda5807_getsig(void); 40 | void rda5807_scandown(void); 41 | void rda5807_scanup(void); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /seg7_2_digit/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = seg7_demo 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | 14 | # hier alle zusaetzlichen Softwaremodule angegeben 15 | SRCS = ../src/delay.rel 16 | SRCS += ../src/seg7mpx_dig2.rel 17 | 18 | INC_DIR = -I./ -I../include 19 | 20 | # benutzbare Programmer: 21 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 22 | # 2 : pfsprog ==> benoetigt serielle Portangabe 23 | 24 | PROGRAMMER = 2 25 | SERPORT = /dev/ttyUSB0 26 | CH340RESET = 1 27 | 28 | 29 | 30 | include ../makefile.mk 31 | -------------------------------------------------------------------------------- /seg7_3_digit/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = dig3_demo 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | 14 | # hier alle zusaetzlichen Softwaremodule angegeben 15 | SRCS = ../src/delay.rel 16 | SRCS += ../src/seg7mpx_dig3.rel 17 | 18 | INC_DIR = -I./ -I../include 19 | 20 | # benutzbare Programmer: 21 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 22 | # 2 : pfsprog ==> benoetigt serielle Portangabe 23 | 24 | PROGRAMMER = 2 25 | SERPORT = /dev/ttyUSB0 26 | CH340RESET = 1 27 | 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /seg7_3_digit/dig3_demo.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------- 2 | dig3_demo.c 3 | 4 | Demo fuer eine 4-stellige gemultiplexte 5 | 7-Segmentanzeige 6 | 7 | verwendet 8-Bit Timer2 8 | 9 | Anschluesse: 10 | PB0 .. PB6 : Segmente a -- g 11 | PB7 : Dezimalpunkt 12 | PA0 : MPX Digit 0 (LSB) 13 | PA7 : MPX Digit 1 14 | PA6 : MPX Digit 2 (MSB) 15 | 16 | Compiler : SDCC 4.0.3 17 | MCU : PFS154 / PFS173 18 | 19 | 18.12.2020 R. Seelig 20 | 21 | -------------------------------------------------------- */ 22 | 23 | #include 24 | #include "pdk_init.h" 25 | #include "pfs1xx_gpio.h" 26 | #include "delay.h" 27 | #include "seg7mpx_dig3.h" 28 | 29 | 30 | /* -------------------------------------------------------- 31 | interrupt 32 | 33 | der Interrupt-Handler. TM2 ruft den Interrupt mit 34 | ca. 1 kHz auf. 35 | 36 | Hier muss das Multiplexen der Anzeige eingehaengt 37 | werden. 38 | -------------------------------------------------------- */ 39 | void interrupt(void) __interrupt(0) 40 | { 41 | // Interruptquelle ist Timer2 42 | if (INTRQ & INTRQ_TM2) 43 | { 44 | seg7_mpx(); // Timergesteuertes multiplexen 45 | // der 2-stelligen Anzeige 46 | INTRQ &= ~INTRQ_TM2; // Interruptanforderung quittieren 47 | } 48 | } 49 | 50 | /* -------------------------------------------------------- 51 | main 52 | -------------------------------------------------------- */ 53 | void main(void) 54 | { 55 | static uint16_t cx; 56 | 57 | delay(300); 58 | seg7_init(); 59 | 60 | cx= 0; 61 | seg7_dp= 1; 62 | while(1) 63 | { 64 | s7buf= hex2bcd16(cx); 65 | delay(100); 66 | __disgint(); 67 | cx++; 68 | cx= cx % 1000; 69 | __engint(); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /seg7_4_digit/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = dig4_demo 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | 14 | # hier alle zusaetzlichen Softwaremodule angegeben 15 | SRCS = ../src/delay.rel 16 | SRCS += ../src/seg7mpx_dig4.rel 17 | 18 | INC_DIR = -I./ -I../include 19 | 20 | # benutzbare Programmer: 21 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 22 | # 2 : pfsprog ==> benoetigt serielle Portangabe 23 | 24 | PROGRAMMER = 2 25 | SERPORT = /dev/ttyUSB0 26 | CH340RESET = 1 27 | 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /seg7_4_digit/dig4_demo.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------- 2 | dig4_demo.c 3 | 4 | Demo fuer eine 4-stellige gemultiplexte 5 | 7-Segmentanzeige 6 | 7 | verwendet 8-Bit Timer2 8 | 9 | Anschluesse: 10 | PB0 .. PB6 : Segmente a -- g 11 | PB7 : Dezimalpunkt 12 | PA0 : MPX Digit 0 (LSB) 13 | PA7 : MPX Digit 1 14 | PA6 : MPX Digit 2 15 | PA5 : MPX Digit 4 (MSB) 16 | 17 | Compiler : SDCC 4.0.3 18 | MCU : PFS154 / PFS173 19 | 20 | 02.11.2020 R. Seelig 21 | 22 | -------------------------------------------------------- */ 23 | 24 | #include 25 | #include "pdk_init.h" 26 | #include "pfs1xx_gpio.h" 27 | #include "delay.h" 28 | #include "seg7mpx_dig4.h" 29 | 30 | 31 | /* -------------------------------------------------------- 32 | interrupt 33 | 34 | der Interrupt-Handler. TM2 ruft den Interrupt mit 35 | ca. 1 kHz auf. 36 | 37 | Hier muss das Multiplexen der Anzeige eingehaengt 38 | werden. 39 | -------------------------------------------------------- */ 40 | void interrupt(void) __interrupt(0) 41 | { 42 | // Interruptquelle ist Timer2 43 | if (INTRQ & INTRQ_TM2) 44 | { 45 | seg7_mpx(); // Timergesteuertes multiplexen 46 | // der 2-stelligen Anzeige 47 | INTRQ &= ~INTRQ_TM2; // Interruptanforderung quittieren 48 | } 49 | } 50 | 51 | /* -------------------------------------------------------- 52 | main 53 | -------------------------------------------------------- */ 54 | void main(void) 55 | { 56 | static uint16_t cx; 57 | 58 | delay(300); 59 | seg7_init(); 60 | 61 | cx= 0; 62 | seg7_dp= 0; 63 | // Zaehler mit wanderndem Dezimalpunkt 64 | while(1) 65 | { 66 | s7buf= hex2bcd16(cx); 67 | delay(500); 68 | cx++; 69 | seg7_dp++; 70 | if (seg7_dp== 4) seg7_dp= 0; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /seg7_4_digit/seg7mpx_dig4.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------------- 2 | seg7mpx_dig4.h 3 | 4 | Header fuer Softwaremodul einer 4-stelligen gemultiplexten 5 | 7-Segmentanzeige mit gemeinsamer Kathode 6 | 7 | verwendet 8-Bit Timer2 8 | 9 | Compiler : SDCC 4.0.3 10 | MCU : PFS154 / PFS173 11 | 12 | Mittels defines (Kommentare beachten) kann zwischen 13 | Anzeigen mit gemeinsamer Anode und gemeinsamer Kathode 14 | umgeschaltet werden. 15 | 16 | 02.11.2020 R. Seelig 17 | -------------------------------------------------------------- */ 18 | 19 | #ifndef in_seg7mpx_dig4 20 | #define in_seg7mpx_dig4 21 | 22 | #include 23 | #include 24 | #include "pfs1xx_gpio.h" 25 | 26 | // -------------------------------------------------------- 27 | // 28 | // Anschlussbelegung der 7-Segmentanzeige an den 29 | // Controller 30 | // 31 | // PB0..PB6 fuer die 7-Segmentanzeige; 32 | // PB0: Segment a, B6: Segment g 33 | // Pxx: Dezimalpunk (DP) 34 | // PA0: MPX Digit0 35 | // PA7: MPX Digit1 36 | // PA6: MPX Digit2 37 | // PA5: MPX digit3 38 | // -------------------------------------------------------- 39 | 40 | #define seg7_pin_init() { PBC= 0xff; PAC= 0xff; } 41 | 42 | #define mpx0_set() PA0_clr() 43 | #define mpx0_clr() PA0_set() 44 | #define mpx1_set() PA7_clr() 45 | #define mpx1_clr() PA7_set() 46 | #define mpx2_set() PA6_clr() 47 | #define mpx2_clr() PA6_set() 48 | #define mpx3_set() PA5_clr() 49 | #define mpx3_clr() PA5_set() 50 | 51 | #define dp_set() ( PB7_set() ) 52 | #define dp_clr() ( PB7_clr() ) 53 | 54 | enum {zmode, smode}; 55 | 56 | // -------------------------------------------------------- 57 | // globale Variable 58 | // -------------------------------------------------------- 59 | extern uint16_t s7buf; // nimmt den Zahlenwert auf, der hexadezimal auf der 60 | // 2-stelligen Anzeige angezeigt wird 61 | // Bit7 nimmt bei verfuegbarem Dezimalpunkt eben diesen auf 62 | 63 | extern uint8_t seg7_dp; // nimmt die Position des Dezimalpunktes auf 64 | 65 | // -------------------------------------------------------- 66 | // Prototypen 67 | // -------------------------------------------------------- 68 | 69 | void seg7_init(void); 70 | void seg7_mpx(void); 71 | uint16_t hex2bcd16(uint16_t value); 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /servo/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = timer3_servo 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | 14 | 15 | # hier alle zusaetzlichen Softwaremodule angegeben 16 | SRCS = ../src/delay.rel 17 | 18 | INC_DIR = -I./ -I../include 19 | 20 | # benutzbare Programmer: 21 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 22 | # 2 : pfsprog ==> benoetigt serielle Portangabe 23 | 24 | PROGRAMMER = 2 25 | SERPORT = /dev/ttyUSB0 26 | CH340RESET = 1 27 | 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /setup32: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "--------------------------------------------------------------" 3 | echo " setup32" 4 | echo "" 5 | echo " richtet die Toolchain fuer ein 32-Bit Linux ein. Sollte" 6 | echo " dies faelschlicherweise aufgerufen worden sein und es sollte" 7 | echo " eine 64-Bit Toolchain eingerichtet werden, so einfach" 8 | echo " setup64 aufrufen" 9 | echo "--------------------------------------------------------------" 10 | rm -f -r ./tools/bin 11 | mkdir -p ./tools/bin 12 | cp ./tools/bin32/* ./tools/bin 13 | echo "" 14 | echo "... done" 15 | echo "" 16 | -------------------------------------------------------------------------------- /setup64: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "--------------------------------------------------------------" 3 | echo " setup64" 4 | echo "" 5 | echo " richtet die Toolchain fuer ein 64-Bit Linux ein. Sollte" 6 | echo " dies faelschlicherweise aufgerufen worden sein und es sollte" 7 | echo " eine 32-Bit Toolchain eingerichtet werden, so einfach" 8 | echo " setup32 aufrufen" 9 | echo "--------------------------------------------------------------" 10 | rm -f -r ./tools/bin 11 | mkdir -p ./tools/bin 12 | cp ./tools/bin64/* ./tools/bin 13 | echo "" 14 | echo "... done" 15 | echo "" 16 | -------------------------------------------------------------------------------- /shiftreg/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = shiftreg_demo 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | 16 | INC_DIR = -I./ -I../include 17 | 18 | # benutzbare Programmer: 19 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 20 | # 2 : pfsprog ==> benoetigt serielle Portangabe 21 | 22 | PROGRAMMER = 2 23 | SERPORT = /dev/ttyUSB0 24 | CH340RESET = 1 25 | 26 | 27 | include ../makefile.mk 28 | -------------------------------------------------------------------------------- /timer2_demo/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = timer2_blink 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | 14 | 15 | # hier alle zusaetzlichen Softwaremodule angegeben 16 | SRCS = 17 | 18 | INC_DIR = -I./ -I../include 19 | 20 | # benutzbare Programmer: 21 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 22 | # 2 : pfsprog ==> benoetigt serielle Portangabe 23 | 24 | PROGRAMMER = 2 25 | SERPORT = /dev/ttyUSB0 26 | CH340RESET = 1 27 | 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /tms1637_4digit/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = tm1637_demo 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | SRCS += ../src/tm1637_seg7.rel 16 | 17 | INC_DIR = -I./ -I../include 18 | 19 | # benutzbare Programmer: 20 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 21 | # 2 : pfsprog ==> benoetigt serielle Portangabe 22 | 23 | PROGRAMMER = 2 24 | SERPORT = /dev/ttyUSB0 25 | CH340RESET = 1 26 | 27 | 28 | include ../makefile.mk 29 | -------------------------------------------------------------------------------- /tools/bin/ch340reset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/ch340reset -------------------------------------------------------------------------------- /tools/bin/easypdkprog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/easypdkprog -------------------------------------------------------------------------------- /tools/bin/makebin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/makebin -------------------------------------------------------------------------------- /tools/bin/packihx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/packihx -------------------------------------------------------------------------------- /tools/bin/pfsprog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/pfsprog -------------------------------------------------------------------------------- /tools/bin/pfsreadhex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/pfsreadhex -------------------------------------------------------------------------------- /tools/bin/sdaspdk13: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/sdaspdk13 -------------------------------------------------------------------------------- /tools/bin/sdaspdk14: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/sdaspdk14 -------------------------------------------------------------------------------- /tools/bin/sdaspdk15: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/sdaspdk15 -------------------------------------------------------------------------------- /tools/bin/sdcc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/sdcc -------------------------------------------------------------------------------- /tools/bin/sdcdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/sdcdb -------------------------------------------------------------------------------- /tools/bin/sdcpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/sdcpp -------------------------------------------------------------------------------- /tools/bin/sdld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/sdld -------------------------------------------------------------------------------- /tools/bin/sdldpdk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/sdldpdk -------------------------------------------------------------------------------- /tools/bin/sdobjcopy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/sdobjcopy -------------------------------------------------------------------------------- /tools/bin/sdranlib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/sdranlib -------------------------------------------------------------------------------- /tools/bin/spdk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin/spdk -------------------------------------------------------------------------------- /tools/bin32/ch340reset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/ch340reset -------------------------------------------------------------------------------- /tools/bin32/easypdkprog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/easypdkprog -------------------------------------------------------------------------------- /tools/bin32/makebin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/makebin -------------------------------------------------------------------------------- /tools/bin32/packihx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/packihx -------------------------------------------------------------------------------- /tools/bin32/pfsprog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/pfsprog -------------------------------------------------------------------------------- /tools/bin32/pfsreadhex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/pfsreadhex -------------------------------------------------------------------------------- /tools/bin32/sdaspdk13: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/sdaspdk13 -------------------------------------------------------------------------------- /tools/bin32/sdaspdk14: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/sdaspdk14 -------------------------------------------------------------------------------- /tools/bin32/sdaspdk15: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/sdaspdk15 -------------------------------------------------------------------------------- /tools/bin32/sdcc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/sdcc -------------------------------------------------------------------------------- /tools/bin32/sdcdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/sdcdb -------------------------------------------------------------------------------- /tools/bin32/sdcpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/sdcpp -------------------------------------------------------------------------------- /tools/bin32/sdld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/sdld -------------------------------------------------------------------------------- /tools/bin32/sdldpdk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/sdldpdk -------------------------------------------------------------------------------- /tools/bin32/sdobjcopy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/sdobjcopy -------------------------------------------------------------------------------- /tools/bin32/sdranlib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/sdranlib -------------------------------------------------------------------------------- /tools/bin32/spdk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin32/spdk -------------------------------------------------------------------------------- /tools/bin64/ch340reset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/ch340reset -------------------------------------------------------------------------------- /tools/bin64/easypdkprog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/easypdkprog -------------------------------------------------------------------------------- /tools/bin64/makebin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/makebin -------------------------------------------------------------------------------- /tools/bin64/packihx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/packihx -------------------------------------------------------------------------------- /tools/bin64/pfsprog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/pfsprog -------------------------------------------------------------------------------- /tools/bin64/pfsreadhex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/pfsreadhex -------------------------------------------------------------------------------- /tools/bin64/sdaspdk13: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/sdaspdk13 -------------------------------------------------------------------------------- /tools/bin64/sdaspdk14: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/sdaspdk14 -------------------------------------------------------------------------------- /tools/bin64/sdaspdk15: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/sdaspdk15 -------------------------------------------------------------------------------- /tools/bin64/sdcc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/sdcc -------------------------------------------------------------------------------- /tools/bin64/sdcdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/sdcdb -------------------------------------------------------------------------------- /tools/bin64/sdcpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/sdcpp -------------------------------------------------------------------------------- /tools/bin64/sdld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/sdld -------------------------------------------------------------------------------- /tools/bin64/sdldpdk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/sdldpdk -------------------------------------------------------------------------------- /tools/bin64/sdobjcopy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/sdobjcopy -------------------------------------------------------------------------------- /tools/bin64/sdranlib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/sdranlib -------------------------------------------------------------------------------- /tools/bin64/spdk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/bin64/spdk -------------------------------------------------------------------------------- /tools/ch340reset/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = ch340reset 8 | 9 | # hier alle zusaetzlichen Softwaremodule angegeben 10 | SRCS = device.o 11 | SRCS += interface.o 12 | SRCS += endpoint.o 13 | SRCS += raw.o 14 | 15 | 16 | INCLUDE_PATHS = -I./ 17 | 18 | MATH = 0 19 | NCURSES = 0 20 | SDL = 0 21 | 22 | ADD_LIBS = -ludev 23 | 24 | 25 | include ./makefile.mk 26 | -------------------------------------------------------------------------------- /tools/ch340reset/ch340reset.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _LSUSB_H 3 | #define _LSUSB_H 4 | 5 | /* From the kernel file, include/linux/stringify.h */ 6 | #define __stringify_1(x...) #x 7 | #define __stringify(x...) __stringify_1(x) 8 | 9 | /* Functions in the core */ 10 | void *robust_malloc(size_t size); 11 | char *get_dev_string(struct udev_device *device, const char *name); 12 | extern struct udev *udev; 13 | 14 | /* device.c */ 15 | void create_usb_device(struct udev_device *device); 16 | void free_usb_devices(void); 17 | void sort_usb_devices(void); 18 | void print_usb_devices(void); 19 | void get_buspathname(char *vid, char *pid, char *pathname); 20 | 21 | 22 | /* interface.c */ 23 | void create_usb_interface(struct udev_device *device, struct usb_device *usb_device); 24 | void free_usb_interface(struct usb_interface *usb_intf); 25 | 26 | /* endpoint.c */ 27 | struct usb_endpoint *create_usb_endpoint(struct udev_device *device, 28 | const char *endpoint_name); 29 | void free_usb_endpoint(struct usb_endpoint *usb_endpoint); 30 | 31 | /* raw.c */ 32 | void read_raw_usb_descriptor(struct udev_device *device, struct usb_device *usb_device); 33 | 34 | #endif /* define _LSUSB_H */ 35 | -------------------------------------------------------------------------------- /tools/ch340reset/endpoint.c: -------------------------------------------------------------------------------- 1 | /* 2 | * endpoint.c 3 | * 4 | * Handle all struct usb_endpoint logic 5 | * 6 | * Copyright (C) 2009 Greg Kroah-Hartman 7 | * 8 | * This program is free software; you can redistribute it and/or 9 | * modify it under the terms of the GNU General Public License, 10 | * version 2, as published by the Free Software Foundation. 11 | */ 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE 31 | 32 | #include 33 | #include "list.h" 34 | #include "usb.h" 35 | #include "ch340reset.h" 36 | 37 | 38 | 39 | static struct usb_endpoint *new_usb_endpoint(void) 40 | { 41 | return robust_malloc(sizeof(struct usb_endpoint)); 42 | } 43 | 44 | void free_usb_endpoint(struct usb_endpoint *usb_endpoint) 45 | { 46 | free(usb_endpoint->bEndpointAddress); 47 | free(usb_endpoint->bInterval); 48 | free(usb_endpoint->bLength); 49 | free(usb_endpoint->bmAttributes); 50 | free(usb_endpoint->direction); 51 | free(usb_endpoint->type); 52 | free(usb_endpoint->wMaxPacketSize); 53 | free(usb_endpoint); 54 | } 55 | 56 | struct usb_endpoint *create_usb_endpoint(struct udev_device *device, const char *endpoint_name) 57 | { 58 | struct usb_endpoint *ep; 59 | char filename[PATH_MAX]; 60 | 61 | ep = new_usb_endpoint(); 62 | 63 | #define get_endpoint_string(string) \ 64 | sprintf(filename, "%s/"__stringify(string), endpoint_name); \ 65 | ep->string = get_dev_string(device, filename); 66 | 67 | get_endpoint_string(bEndpointAddress); 68 | get_endpoint_string(bInterval); 69 | get_endpoint_string(bLength); 70 | get_endpoint_string(bmAttributes); 71 | get_endpoint_string(direction); 72 | get_endpoint_string(type); 73 | get_endpoint_string(wMaxPacketSize); 74 | 75 | return ep; 76 | } 77 | -------------------------------------------------------------------------------- /tools/ch340reset/makefile.mk: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # 3 | # Makefile 4 | # 5 | # 6 | # Dieses Makefile muss folgende benutzerdefinierte Angaben enthalten: 7 | # 8 | # PROJECT 9 | # Der Name des Hauptprogramms (welches u.a. die main - Funktion 10 | # beinhaltet OHNE jegliche Erweiterung 11 | # 12 | # SRCS 13 | # hier sind die zu erzeugenden Dateien anzugeben (Hauptprogramm 14 | # welches die Funktion Main enthaellt plus zusaetzliche Software- 15 | # module ohne weiteren "Trenner": 16 | # 17 | # SRCS = ../src/serial_demo.o 18 | # SRCS += ../src/readint.o 19 | # 20 | # Die Dateien serial_demo.c und readint.c werden zu Objektdateien 21 | # uebersetzt und dem Gesamtprogramm hinzugelinkt 22 | # 23 | # 24 | # NCURSES 25 | # = 1 NCURSES Bibliothek wird eingebunden 26 | # = 0 wird nicht eingebunden 27 | # 28 | # MATH 29 | # = 1 MATH Bibliothek (libm) wird eingebunden 30 | # = 0 wird nicht eingebunden 31 | # 32 | # Aufrufoption des Makefiles: 33 | # make oder make all : erstellt alle .o und das ausfuehrbare Programm 34 | # make compile : compiliert nur das Hauptprogramm ohne weitere 35 | # Bibliotheken 36 | # make clean : loescht alle erstellten Dateien (sinnvoll, 37 | # wenn Softwaremodule / Bibliotheken veraendert 38 | # wurden) 39 | # 40 | # 41 | # August 2017, R. Seelig 42 | # 43 | ############################################################################### 44 | 45 | CC = gcc 46 | LD = ld 47 | 48 | 49 | OBJECTS = ./$(PROJECT).o $(SRCS) 50 | 51 | CC_FLAGS = -c -Os -std=gnu99 52 | 53 | CC_SYMBOLS = 54 | LD_FLAGS = $(ADD_LIBS) 55 | 56 | ifeq ($(NCURSES), 1) 57 | LD_FLAGS += -lncurses -lpanel -lmenu 58 | endif 59 | 60 | ifeq ($(MATH), 1) 61 | LD_FLAGS += -lm 62 | endif 63 | 64 | ifeq ($(SDL), 1) 65 | LD_FLAGS += -lSDL -lSDL_image 66 | endif 67 | 68 | 69 | .PHONY: all clean compile flash 70 | 71 | all: clean $(PROJECT) 72 | 73 | compile: 74 | $(CC) $(PROJECT).c $(CC_FLAGS) $(CC_SYMBOLS) $(INCLUDE_PATHS) -o $(PROJECT).o 75 | 76 | clean: 77 | rm -f $(PROJECT).o $(PROJECT) 78 | rm -f $(SRCS) 79 | 80 | .c.o: 81 | $(CC) $< $(CC_FLAGS) $(CC_SYMBOLS) $(INCLUDE_PATHS) -o $@ 82 | 83 | 84 | $(PROJECT): $(OBJECTS) 85 | $(CC) $(LD_FLAGS) $^ -Os -o $@ 86 | 87 | flash: 88 | @echo "PC / Raspi can't be flashed" 89 | -------------------------------------------------------------------------------- /tools/ch340reset/short_types.h: -------------------------------------------------------------------------------- 1 | #ifndef CCAN_SHORT_TYPES_H 2 | #define CCAN_SHORT_TYPES_H 3 | #include 4 | 5 | /** 6 | * u64/s64/u32/s32/u16/s16/u8/s8 - short names for explicitly-sized types. 7 | */ 8 | typedef uint64_t u64; 9 | typedef int64_t s64; 10 | typedef uint32_t u32; 11 | typedef int32_t s32; 12 | typedef uint16_t u16; 13 | typedef int16_t s16; 14 | typedef uint8_t u8; 15 | typedef int8_t s8; 16 | 17 | /** 18 | * be64/be32/be16 - 64/32/16 bit big-endian representation. 19 | */ 20 | typedef uint64_t be64; 21 | typedef uint32_t be32; 22 | typedef uint16_t be16; 23 | 24 | /** 25 | * le64/le32/le16 - 64/32/16 bit little-endian representation. 26 | */ 27 | typedef uint64_t le64; 28 | typedef uint32_t le32; 29 | typedef uint16_t le16; 30 | 31 | #endif /* CCAN_SHORT_TYPES_H */ 32 | -------------------------------------------------------------------------------- /tools/ch340reset/usb.h: -------------------------------------------------------------------------------- 1 | #ifndef _USB_H 2 | #define _USB_H 3 | 4 | #include "short_types.h" 5 | 6 | struct usb_endpoint { 7 | struct list_head list; 8 | char *bEndpointAddress; 9 | char *bInterval; 10 | char *bLength; 11 | char *bmAttributes; 12 | char *direction; 13 | char *type; 14 | char *wMaxPacketSize; 15 | }; 16 | 17 | struct usb_config { 18 | struct list_head list; 19 | u8 bLength; 20 | u8 bDescriptorType; 21 | u16 wTotalLength; 22 | u8 bNumInterfaces; 23 | u8 bConfigurationValue; 24 | u8 iConfiguration; 25 | u8 bmAttributes; 26 | u8 bMaxPower; 27 | }; 28 | 29 | struct usb_interface { 30 | struct list_head list; 31 | struct list_head endpoints; 32 | unsigned int configuration; 33 | unsigned int ifnum; 34 | 35 | char *sysname; 36 | char *bAlternateSetting; 37 | char *bInterfaceClass; 38 | char *bInterfaceNumber; 39 | char *bInterfaceProtocol; 40 | char *bInterfaceSubClass; 41 | char *bNumEndpoints; 42 | 43 | char *name; 44 | char *driver; 45 | }; 46 | 47 | struct usb_device_qualifier { 48 | char *bLength; 49 | char *bDescriptorType; 50 | char *bcdUSB; 51 | char *bDeviceClass; 52 | char *bDeviceSubClass; 53 | char *bDeviceProtocol; 54 | char *bMaxPacketSize0; 55 | char *bNumConfigurations; 56 | }; 57 | 58 | struct usb_device { 59 | struct list_head list; /* connect devices independant of the bus */ 60 | struct list_head interfaces; 61 | 62 | char *idProduct; 63 | char *idVendor; 64 | char *busnum; 65 | char *devnum; 66 | char *maxchild; 67 | char *quirks; 68 | char *speed; 69 | char *version; 70 | 71 | char *bConfigurationValue; 72 | char *bDeviceClass; 73 | char *bDeviceProtocol; 74 | char *bDeviceSubClass; 75 | char *bNumConfigurations; 76 | char *bNumInterfaces; 77 | char *bmAttributes; 78 | char *bMaxPacketSize0; 79 | char *bMaxPower; 80 | char *manufacturer; 81 | char *bcdDevice; 82 | char *product; 83 | char *serial; 84 | 85 | struct usb_endpoint *ep0; 86 | struct usb_device_qualifier *qualifier; 87 | char *name; 88 | char *driver; /* always "usb" but hey, it's nice to be complete */ 89 | }; 90 | 91 | #endif /* #define _USB_H */ 92 | -------------------------------------------------------------------------------- /tools/doc/README: -------------------------------------------------------------------------------- 1 | There is no documentation included in the snapshot archives. 2 | 3 | You can download the full documentation archive at: 4 | 5 | http://sdcc.sourceforge.net/snapshots/docs/sdcc-doc.tar.gz 6 | 7 | 8 | For Windoze character set and line ending: 9 | 10 | http://sdcc.sourceforge.net/snapshots/docs/sdcc-doc.zip 11 | 12 | 13 | Online: 14 | 15 | http://sdcc.sourceforge.net/doc/ 16 | -------------------------------------------------------------------------------- /tools/include/asm/assert.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | assert.h - header file for assert ANSI routine 3 | 4 | Copyright (C) 2018, Philipp Klaus Krause . pkk@spth.de 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | #undef assert 30 | 31 | #ifdef NDEBUG 32 | 33 | /* Debugging disabled -- do not evaluate assertions. */ 34 | #define assert(x) ((void)0) 35 | 36 | #else 37 | 38 | /* Debugging enabled -- verify assertions at run time. */ 39 | void __assert(const char *expression, const char *functionname, const char *filename, unsigned int linenumber); 40 | #define assert(x) ((x) ? (void)0 : __assert(#x, __func__, __FILE__, __LINE__)) 41 | 42 | #if __STDC_VERSION__ >= 201112L 43 | #define static_assert _Static_assert 44 | #endif 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /tools/include/asm/default/features.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | features.h - default features. 3 | 4 | Copyright (C) 2001, Michael Hope 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | #ifndef __SDC51_ASM_FEATURES_H 30 | #define __SDC51_ASM_FEATURES_H 1 31 | 32 | #define _REENTRANT __reentrant 33 | #define _CODE __code 34 | #define _AUTOMEM 35 | #define _STATMEM 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /tools/include/asm/errno.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | errno.h: Error codes used in the math functions 3 | 4 | Copyright (C) 2001, Jesus Calvino-Fraga, jesusc@ieee.org 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | /* Version 1.0 - Initial release */ 30 | 31 | #ifndef _INC_ERRNO 32 | #define _INC_ERRNO 33 | 34 | extern int errno; 35 | 36 | /* Error Codes: */ 37 | 38 | #define EDOM 33 /* Math argument out of domain of functions */ 39 | #define ERANGE 34 /* Math result not representable */ 40 | #define EILSEQ 84 /* Illegal byte sequence */ 41 | 42 | /* Bounds-checking interfaces from annex K of the C11 standard. */ 43 | #if defined (__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ 44 | 45 | #ifndef __ERRNO_T_DEFINED 46 | #define __ERRNO_T_DEFINED 47 | typedef int errno_t; 48 | #endif 49 | 50 | #endif 51 | 52 | #endif /* _INC_ERRNO */ 53 | 54 | -------------------------------------------------------------------------------- /tools/include/asm/iso646.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | iso646.h 3 | 4 | Copyright (C) 2011, Philipp Klaus Krause . pkk@spth.de 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | #ifndef __SDCC_ISO646_H 30 | #define __SDCC_ISO646_H 31 | 32 | #define and && 33 | #define and_eq &= 34 | #define bitand & 35 | #define bitor | 36 | #define compl ~ 37 | #define not ! 38 | #define not_eq != 39 | #define or || 40 | #define or_eq |= 41 | #define xor ^ 42 | #define xor_eq ^= 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /tools/include/asm/limits.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | limits.h - ANSI defines constants for sizes of integral types 3 | 4 | Copyright (C) 1999, Sandeep Dutta . sandeep.dutta@usa.net 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | #ifndef __SDC51_LIMITS_H 30 | #define __SDC51_LIMITS_H 1 31 | 32 | #define CHAR_BIT 8 /* bits in a char */ 33 | #define SCHAR_MAX 127 34 | #define SCHAR_MIN -128 35 | #define UCHAR_MAX 0xff 36 | 37 | #ifdef __SDCC_CHAR_UNSIGNED 38 | #define CHAR_MAX UCHAR_MAX 39 | #define CHAR_MIN 0 40 | #else 41 | #define CHAR_MAX SCHAR_MAX 42 | #define CHAR_MIN SCHAR_MIN 43 | #endif 44 | 45 | #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199409L 46 | #define MB_LEN_MAX 4 47 | #endif 48 | 49 | #define INT_MIN (-32767 - 1) 50 | #define INT_MAX 32767 51 | #define SHRT_MAX INT_MAX 52 | #define SHRT_MIN INT_MIN 53 | #define UINT_MAX 0xffff 54 | #define UINT_MIN 0 55 | #define USHRT_MAX UINT_MAX 56 | #define USHRT_MIN UINT_MIN 57 | #define LONG_MIN (-2147483647L-1) 58 | #define LONG_MAX 2147483647L 59 | #define ULONG_MAX 0xffffffff 60 | #define ULONG_MIN 0 61 | 62 | #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 63 | #define LLONG_MIN (-9223372036854775807LL-1) 64 | #define LLONG_MAX 9223372036854775807LL 65 | #define ULLONG_MAX 18446744073709551615ULL 66 | #endif 67 | 68 | #endif 69 | 70 | -------------------------------------------------------------------------------- /tools/include/asm/sdcc-lib.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | sdcc-lib.h - Top level header file for the sdcc libraries that enables 3 | target specific features. 4 | 5 | Copyright (C) 2004, Maarten Brock, sourceforge.brock@dse.nl 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any 10 | later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this library; see the file COPYING. If not, write to the 19 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 20 | MA 02110-1301, USA. 21 | 22 | As a special exception, if you link this library with other files, 23 | some of which are compiled with SDCC, to produce an executable, 24 | this library does not by itself cause the resulting executable to 25 | be covered by the GNU General Public License. This exception does 26 | not however invalidate any other reasons why the executable file 27 | might be covered by the GNU General Public License. 28 | -------------------------------------------------------------------------*/ 29 | 30 | #ifndef __SDC51_SDCC_LIB_H 31 | #define __SDC51_SDCC_LIB_H 1 32 | 33 | #if defined(__SDCC_z80) || defined(__SDCC_z180) || defined(__SDCC_ez80_z80) || defined(__SDCC_z80n) 34 | #include 35 | 36 | #elif defined(__SDCC_r2k) || defined(__SDCC_r2ka) 37 | #include 38 | 39 | #elif defined(__SDCC_r3ka) 40 | #include 41 | 42 | #elif defined(__SDCC_tlcs90) 43 | #include 44 | 45 | #elif defined(__SDCC_gbz80) 46 | #include 47 | 48 | #elif defined(__SDCC_mcs51) 49 | #include 50 | 51 | #elif defined(__SDCC_ds390) 52 | #include 53 | 54 | #elif defined(__SDCC_stm8) 55 | #include 56 | 57 | #else 58 | /* PENDING */ 59 | #include 60 | 61 | #endif 62 | 63 | #endif 64 | 65 | -------------------------------------------------------------------------------- /tools/include/asm/signal.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | stdint.h - ISO C99 7.14 Signal handing 3 | 4 | Copyright (C) 2019, Philipp Klaus Krause, krauseph@informatik.uni-freiburg.de 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | #ifndef _SIGNAL_H 30 | #define _SIGNAL_H 1 31 | 32 | typedef unsigned char sig_atomic_t; 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /tools/include/asm/stdalign.h: -------------------------------------------------------------------------------- 1 | #ifndef __SDCC_STDALIGN_H 2 | #define __SDCC_STDALIGN_H 1 3 | 4 | #ifndef __alignas_is_defined 5 | #define __alignas_is_defined 1 6 | 7 | #define alignas _Alignas 8 | 9 | #endif 10 | 11 | 12 | #ifndef __alignof_is_defined 13 | #define __alignof_is_defined 1 14 | 15 | #define alignof _Alignof 16 | 17 | #endif 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /tools/include/asm/stdatomic.h: -------------------------------------------------------------------------------- 1 | #ifndef __SDCC_STDATOMIC_H 2 | #define __SDCC_STDATOMIC_H 1 3 | 4 | typedef struct {unsigned char flag;} atomic_flag; 5 | 6 | #if defined(__SDCC_z80) || defined(__SDCC_z180) || defined(__SDCC_ez80_z80) || defined(__SDCC_z80n) || defined(__SDCC_gbz80) || defined(__SDCC_tlcs90) || defined(__SDCC_r2k) || defined(__SDCC_r2ka) || defined(__SDCC_r3ka) || defined(__SDCC_stm8) || defined(__SDCC_hc08) || defined(__SDCC_s08) 7 | 8 | #define ATOMIC_FLAG_INIT {1} 9 | _Bool atomic_flag_test_and_set(volatile atomic_flag *object); 10 | 11 | void atomic_flag_clear(volatile atomic_flag *object); 12 | 13 | #elif defined(__SDCC_mcs51) 14 | 15 | #define ATOMIC_FLAG_INIT {0} 16 | _Bool atomic_flag_test_and_set(volatile atomic_flag __idata *object) __nonbanked; 17 | 18 | void atomic_flag_clear(volatile atomic_flag __idata *object) __nonbanked; 19 | 20 | #elif defined(__SDCC_ds390) 21 | 22 | #define ATOMIC_FLAG_INIT {0} 23 | _Bool atomic_flag_test_and_set(volatile atomic_flag __idata *object); 24 | 25 | void atomic_flag_clear(volatile atomic_flag __idata *object); 26 | 27 | #else 28 | 29 | #error Support for atomic_flag not implemented 30 | 31 | #endif 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /tools/include/asm/stdbool.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | stdbool.h - ANSI functions forward declarations 3 | 4 | Copyright (C) 2004, Maarten Brock, sourceforge.brock@dse.nl 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | #ifndef __SDC51_STDBOOL_H 30 | #define __SDC51_STDBOOL_H 1 31 | 32 | /* Define true and false of type _Bool in a way compatible with the preprocessor (see N 2229 for details). */ 33 | #define true ((_Bool)+1) 34 | #define false ((_Bool)+0) 35 | 36 | #define bool _Bool 37 | #define __bool_true_false_are_defined 1 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /tools/include/asm/stddef.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | stddef.h - ANSI functions forward declarations 3 | 4 | Copyright (C) 2004, Maarten Brock / sourceforge.brock@dse.nl 5 | Copyright (C) 2011, Philipp Klaus Krause / pkk@spth.de 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any 10 | later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this library; see the file COPYING. If not, write to the 19 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 20 | MA 02110-1301, USA. 21 | 22 | As a special exception, if you link this library with other files, 23 | some of which are compiled with SDCC, to produce an executable, 24 | this library does not by itself cause the resulting executable to 25 | be covered by the GNU General Public License. This exception does 26 | not however invalidate any other reasons why the executable file 27 | might be covered by the GNU General Public License. 28 | -------------------------------------------------------------------------*/ 29 | 30 | #ifndef __SDCC_STDDEF_H 31 | #define __SDCC_STDDEF_H 1 32 | 33 | #ifndef NULL 34 | #define NULL (void *)0 35 | #endif 36 | 37 | #ifndef __PTRDIFF_T_DEFINED 38 | #define __PTRDIFF_T_DEFINED 39 | #if defined (__SDCC_mcs51) || defined (__SDCC_ds390) 40 | typedef long int ptrdiff_t; 41 | #else 42 | typedef int ptrdiff_t; 43 | #endif 44 | #endif 45 | 46 | #ifndef __SIZE_T_DEFINED 47 | #define __SIZE_T_DEFINED 48 | typedef unsigned int size_t; 49 | #endif 50 | 51 | #if __STDC_VERSION__ >= 201112L 52 | typedef unsigned char max_align_t; 53 | #endif 54 | 55 | #ifndef __WCHAR_T_DEFINED 56 | #define __WCHAR_T_DEFINED 57 | typedef unsigned long int wchar_t; 58 | #endif 59 | 60 | /* Bounds-checking interfaces from annex K of the C11 standard. */ 61 | #if defined (__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ 62 | 63 | #ifndef __RSIZE_T_DEFINED 64 | #define __RSIZE_T_DEFINED 65 | typedef size_t rsize_t; 66 | #endif 67 | 68 | #ifndef __ERRNO_T_DEFINED 69 | #define __ERRNO_T_DEFINED 70 | typedef int errno_t; 71 | #endif 72 | 73 | #endif 74 | 75 | #define offsetof(s, m) __builtin_offsetof (s, m) 76 | 77 | #endif 78 | 79 | -------------------------------------------------------------------------------- /tools/include/asm/stdnoreturn.h: -------------------------------------------------------------------------------- 1 | #ifndef __SDCC_STDNORETURN_H 2 | #define __SDCC_STDNORETURN_H 1 3 | 4 | #define noreturn _Noreturn 5 | 6 | #endif 7 | 8 | -------------------------------------------------------------------------------- /tools/include/asm/typeof.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | typeof.h - Contains enumerations of values returned by __typeof 3 | 4 | Copyright (C) 2001, Sandeep Dutta . sandeep.dutta@usa.net 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | #ifndef __SDC51_TYPEOF_H 30 | #define __SDC51_TYPEOF_H 1 31 | 32 | #define TYPEOF_INT 1 33 | #define TYPEOF_SHORT 2 34 | #define TYPEOF_CHAR 3 35 | #define TYPEOF_LONG 4 36 | #define TYPEOF_FLOAT 5 37 | #define TYPEOF_FIXED16X16 6 38 | #define TYPEOF_BIT 7 39 | #define TYPEOF_BITFIELD 8 40 | #define TYPEOF_SBIT 9 41 | #define TYPEOF_SFR 10 42 | #define TYPEOF_VOID 11 43 | #define TYPEOF_STRUCT 12 44 | #define TYPEOF_ARRAY 13 45 | #define TYPEOF_FUNCTION 14 46 | #define TYPEOF_POINTER 15 47 | #define TYPEOF_FPOINTER 16 48 | #define TYPEOF_CPOINTER 17 49 | #define TYPEOF_GPOINTER 18 50 | #define TYPEOF_PPOINTER 19 51 | #define TYPEOF_IPOINTER 20 52 | #define TYPEOF_EEPPOINTER 21 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /tools/include/asm/uchar.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | uchar.h: Unicode utilities (ISO C 11 7.28) 3 | 4 | Copyright (C) 2015-2016, Philipp Klaus Krause, pkk@spth.de 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | #ifndef __SDCC_UCHAR_H 30 | #define __SDCC_UCHAR_H 1 31 | 32 | #ifndef __MBSTATE_T_DEFINED 33 | #define __MBSTATE_T_DEFINED 34 | typedef struct {unsigned char c[3];} mbstate_t; 35 | #endif 36 | 37 | #ifndef __SIZE_T_DEFINED 38 | #define __SIZE_T_DEFINED 39 | typedef unsigned int size_t; 40 | #endif 41 | 42 | #ifndef __CHAR16_T_DEFINED 43 | #define __CHAR16_T_DEFINED 44 | typedef unsigned int char16_t; 45 | #endif 46 | 47 | #ifndef __CHAR32_T_DEFINED 48 | #define __CHAR32_T_DEFINED 49 | typedef unsigned long int char32_t; 50 | #endif 51 | 52 | size_t mbrtoc16(char16_t *restrict pc16, const char *restrict s, size_t n, mbstate_t *restrict ps); 53 | size_t c16rtomb(char *restrict s, char16_t c16, mbstate_t *restrict ps); 54 | size_t mbrtoc32(char32_t *restrict pc32, const char *restrict s, size_t n, mbstate_t *restrict ps); 55 | size_t c32rtomb(char *restrict s, char32_t c32, mbstate_t *restrict ps); 56 | 57 | size_t __mbstoc16s(char16_t *restrict c16s, const char *restrict s, size_t n); 58 | size_t __c16stombs(char *restrict s, const char16_t *restrict c16s, size_t n); 59 | 60 | #endif 61 | 62 | -------------------------------------------------------------------------------- /tools/include/assert.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | assert.h - header file for assert ANSI routine 3 | 4 | Copyright (C) 2018, Philipp Klaus Krause . pkk@spth.de 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | #undef assert 30 | 31 | #ifdef NDEBUG 32 | 33 | /* Debugging disabled -- do not evaluate assertions. */ 34 | #define assert(x) ((void)0) 35 | 36 | #else 37 | 38 | /* Debugging enabled -- verify assertions at run time. */ 39 | void __assert(const char *expression, const char *functionname, const char *filename, unsigned int linenumber); 40 | #define assert(x) ((x) ? (void)0 : __assert(#x, __func__, __FILE__, __LINE__)) 41 | 42 | #if __STDC_VERSION__ >= 201112L 43 | #define static_assert _Static_assert 44 | #endif 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /tools/include/errno.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | errno.h: Error codes used in the math functions 3 | 4 | Copyright (C) 2001, Jesus Calvino-Fraga, jesusc@ieee.org 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | /* Version 1.0 - Initial release */ 30 | 31 | #ifndef _INC_ERRNO 32 | #define _INC_ERRNO 33 | 34 | extern int errno; 35 | 36 | /* Error Codes: */ 37 | 38 | #define EDOM 33 /* Math argument out of domain of functions */ 39 | #define ERANGE 34 /* Math result not representable */ 40 | #define EILSEQ 84 /* Illegal byte sequence */ 41 | 42 | /* Bounds-checking interfaces from annex K of the C11 standard. */ 43 | #if defined (__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ 44 | 45 | #ifndef __ERRNO_T_DEFINED 46 | #define __ERRNO_T_DEFINED 47 | typedef int errno_t; 48 | #endif 49 | 50 | #endif 51 | 52 | #endif /* _INC_ERRNO */ 53 | 54 | -------------------------------------------------------------------------------- /tools/include/iso646.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | iso646.h 3 | 4 | Copyright (C) 2011, Philipp Klaus Krause . pkk@spth.de 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | #ifndef __SDCC_ISO646_H 30 | #define __SDCC_ISO646_H 31 | 32 | #define and && 33 | #define and_eq &= 34 | #define bitand & 35 | #define bitor | 36 | #define compl ~ 37 | #define not ! 38 | #define not_eq != 39 | #define or || 40 | #define or_eq |= 41 | #define xor ^ 42 | #define xor_eq ^= 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /tools/include/limits.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | limits.h - ANSI defines constants for sizes of integral types 3 | 4 | Copyright (C) 1999, Sandeep Dutta . sandeep.dutta@usa.net 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | #ifndef __SDC51_LIMITS_H 30 | #define __SDC51_LIMITS_H 1 31 | 32 | #define CHAR_BIT 8 /* bits in a char */ 33 | #define SCHAR_MAX 127 34 | #define SCHAR_MIN -128 35 | #define UCHAR_MAX 0xff 36 | 37 | #ifdef __SDCC_CHAR_UNSIGNED 38 | #define CHAR_MAX UCHAR_MAX 39 | #define CHAR_MIN 0 40 | #else 41 | #define CHAR_MAX SCHAR_MAX 42 | #define CHAR_MIN SCHAR_MIN 43 | #endif 44 | 45 | #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199409L 46 | #define MB_LEN_MAX 4 47 | #endif 48 | 49 | #define INT_MIN (-32767 - 1) 50 | #define INT_MAX 32767 51 | #define SHRT_MAX INT_MAX 52 | #define SHRT_MIN INT_MIN 53 | #define UINT_MAX 0xffff 54 | #define UINT_MIN 0 55 | #define USHRT_MAX UINT_MAX 56 | #define USHRT_MIN UINT_MIN 57 | #define LONG_MIN (-2147483647L-1) 58 | #define LONG_MAX 2147483647L 59 | #define ULONG_MAX 0xffffffff 60 | #define ULONG_MIN 0 61 | 62 | #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 63 | #define LLONG_MIN (-9223372036854775807LL-1) 64 | #define LLONG_MAX 9223372036854775807LL 65 | #define ULLONG_MAX 18446744073709551615ULL 66 | #endif 67 | 68 | #endif 69 | 70 | -------------------------------------------------------------------------------- /tools/include/sdcc-lib.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | sdcc-lib.h - Top level header file for the sdcc libraries that enables 3 | target specific features. 4 | 5 | Copyright (C) 2004, Maarten Brock, sourceforge.brock@dse.nl 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any 10 | later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this library; see the file COPYING. If not, write to the 19 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 20 | MA 02110-1301, USA. 21 | 22 | As a special exception, if you link this library with other files, 23 | some of which are compiled with SDCC, to produce an executable, 24 | this library does not by itself cause the resulting executable to 25 | be covered by the GNU General Public License. This exception does 26 | not however invalidate any other reasons why the executable file 27 | might be covered by the GNU General Public License. 28 | -------------------------------------------------------------------------*/ 29 | 30 | #ifndef __SDC51_SDCC_LIB_H 31 | #define __SDC51_SDCC_LIB_H 1 32 | 33 | #if defined(__SDCC_z80) || defined(__SDCC_z180) || defined(__SDCC_ez80_z80) || defined(__SDCC_z80n) 34 | #include 35 | 36 | #elif defined(__SDCC_r2k) || defined(__SDCC_r2ka) 37 | #include 38 | 39 | #elif defined(__SDCC_r3ka) 40 | #include 41 | 42 | #elif defined(__SDCC_tlcs90) 43 | #include 44 | 45 | #elif defined(__SDCC_gbz80) 46 | #include 47 | 48 | #elif defined(__SDCC_mcs51) 49 | #include 50 | 51 | #elif defined(__SDCC_ds390) 52 | #include 53 | 54 | #elif defined(__SDCC_stm8) 55 | #include 56 | 57 | #else 58 | /* PENDING */ 59 | #include 60 | 61 | #endif 62 | 63 | #endif 64 | 65 | -------------------------------------------------------------------------------- /tools/include/signal.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | stdint.h - ISO C99 7.14 Signal handing 3 | 4 | Copyright (C) 2019, Philipp Klaus Krause, krauseph@informatik.uni-freiburg.de 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | #ifndef _SIGNAL_H 30 | #define _SIGNAL_H 1 31 | 32 | typedef unsigned char sig_atomic_t; 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /tools/include/stdalign.h: -------------------------------------------------------------------------------- 1 | #ifndef __SDCC_STDALIGN_H 2 | #define __SDCC_STDALIGN_H 1 3 | 4 | #ifndef __alignas_is_defined 5 | #define __alignas_is_defined 1 6 | 7 | #define alignas _Alignas 8 | 9 | #endif 10 | 11 | 12 | #ifndef __alignof_is_defined 13 | #define __alignof_is_defined 1 14 | 15 | #define alignof _Alignof 16 | 17 | #endif 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /tools/include/stdatomic.h: -------------------------------------------------------------------------------- 1 | #ifndef __SDCC_STDATOMIC_H 2 | #define __SDCC_STDATOMIC_H 1 3 | 4 | typedef struct {unsigned char flag;} atomic_flag; 5 | 6 | #if defined(__SDCC_z80) || defined(__SDCC_z180) || defined(__SDCC_ez80_z80) || defined(__SDCC_z80n) || defined(__SDCC_gbz80) || defined(__SDCC_tlcs90) || defined(__SDCC_r2k) || defined(__SDCC_r2ka) || defined(__SDCC_r3ka) || defined(__SDCC_stm8) || defined(__SDCC_hc08) || defined(__SDCC_s08) 7 | 8 | #define ATOMIC_FLAG_INIT {1} 9 | _Bool atomic_flag_test_and_set(volatile atomic_flag *object); 10 | 11 | void atomic_flag_clear(volatile atomic_flag *object); 12 | 13 | #elif defined(__SDCC_mcs51) 14 | 15 | #define ATOMIC_FLAG_INIT {0} 16 | _Bool atomic_flag_test_and_set(volatile atomic_flag __idata *object) __nonbanked; 17 | 18 | void atomic_flag_clear(volatile atomic_flag __idata *object) __nonbanked; 19 | 20 | #elif defined(__SDCC_ds390) 21 | 22 | #define ATOMIC_FLAG_INIT {0} 23 | _Bool atomic_flag_test_and_set(volatile atomic_flag __idata *object); 24 | 25 | void atomic_flag_clear(volatile atomic_flag __idata *object); 26 | 27 | #else 28 | 29 | #error Support for atomic_flag not implemented 30 | 31 | #endif 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /tools/include/stdbool.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | stdbool.h - ANSI functions forward declarations 3 | 4 | Copyright (C) 2004, Maarten Brock, sourceforge.brock@dse.nl 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | #ifndef __SDC51_STDBOOL_H 30 | #define __SDC51_STDBOOL_H 1 31 | 32 | /* Define true and false of type _Bool in a way compatible with the preprocessor (see N 2229 for details). */ 33 | #define true ((_Bool)+1) 34 | #define false ((_Bool)+0) 35 | 36 | #define bool _Bool 37 | #define __bool_true_false_are_defined 1 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /tools/include/stddef.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | stddef.h - ANSI functions forward declarations 3 | 4 | Copyright (C) 2004, Maarten Brock / sourceforge.brock@dse.nl 5 | Copyright (C) 2011, Philipp Klaus Krause / pkk@spth.de 6 | 7 | This library is free software; you can redistribute it and/or modify it 8 | under the terms of the GNU General Public License as published by the 9 | Free Software Foundation; either version 2, or (at your option) any 10 | later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | GNU General Public License for more details. 16 | 17 | You should have received a copy of the GNU General Public License 18 | along with this library; see the file COPYING. If not, write to the 19 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 20 | MA 02110-1301, USA. 21 | 22 | As a special exception, if you link this library with other files, 23 | some of which are compiled with SDCC, to produce an executable, 24 | this library does not by itself cause the resulting executable to 25 | be covered by the GNU General Public License. This exception does 26 | not however invalidate any other reasons why the executable file 27 | might be covered by the GNU General Public License. 28 | -------------------------------------------------------------------------*/ 29 | 30 | #ifndef __SDCC_STDDEF_H 31 | #define __SDCC_STDDEF_H 1 32 | 33 | #ifndef NULL 34 | #define NULL (void *)0 35 | #endif 36 | 37 | #ifndef __PTRDIFF_T_DEFINED 38 | #define __PTRDIFF_T_DEFINED 39 | #if defined (__SDCC_mcs51) || defined (__SDCC_ds390) 40 | typedef long int ptrdiff_t; 41 | #else 42 | typedef int ptrdiff_t; 43 | #endif 44 | #endif 45 | 46 | #ifndef __SIZE_T_DEFINED 47 | #define __SIZE_T_DEFINED 48 | typedef unsigned int size_t; 49 | #endif 50 | 51 | #if __STDC_VERSION__ >= 201112L 52 | typedef unsigned char max_align_t; 53 | #endif 54 | 55 | #ifndef __WCHAR_T_DEFINED 56 | #define __WCHAR_T_DEFINED 57 | typedef unsigned long int wchar_t; 58 | #endif 59 | 60 | /* Bounds-checking interfaces from annex K of the C11 standard. */ 61 | #if defined (__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ 62 | 63 | #ifndef __RSIZE_T_DEFINED 64 | #define __RSIZE_T_DEFINED 65 | typedef size_t rsize_t; 66 | #endif 67 | 68 | #ifndef __ERRNO_T_DEFINED 69 | #define __ERRNO_T_DEFINED 70 | typedef int errno_t; 71 | #endif 72 | 73 | #endif 74 | 75 | #define offsetof(s, m) __builtin_offsetof (s, m) 76 | 77 | #endif 78 | 79 | -------------------------------------------------------------------------------- /tools/include/stdnoreturn.h: -------------------------------------------------------------------------------- 1 | #ifndef __SDCC_STDNORETURN_H 2 | #define __SDCC_STDNORETURN_H 1 3 | 4 | #define noreturn _Noreturn 5 | 6 | #endif 7 | 8 | -------------------------------------------------------------------------------- /tools/include/typeof.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | typeof.h - Contains enumerations of values returned by __typeof 3 | 4 | Copyright (C) 2001, Sandeep Dutta . sandeep.dutta@usa.net 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | #ifndef __SDC51_TYPEOF_H 30 | #define __SDC51_TYPEOF_H 1 31 | 32 | #define TYPEOF_INT 1 33 | #define TYPEOF_SHORT 2 34 | #define TYPEOF_CHAR 3 35 | #define TYPEOF_LONG 4 36 | #define TYPEOF_FLOAT 5 37 | #define TYPEOF_FIXED16X16 6 38 | #define TYPEOF_BIT 7 39 | #define TYPEOF_BITFIELD 8 40 | #define TYPEOF_SBIT 9 41 | #define TYPEOF_SFR 10 42 | #define TYPEOF_VOID 11 43 | #define TYPEOF_STRUCT 12 44 | #define TYPEOF_ARRAY 13 45 | #define TYPEOF_FUNCTION 14 46 | #define TYPEOF_POINTER 15 47 | #define TYPEOF_FPOINTER 16 48 | #define TYPEOF_CPOINTER 17 49 | #define TYPEOF_GPOINTER 18 50 | #define TYPEOF_PPOINTER 19 51 | #define TYPEOF_IPOINTER 20 52 | #define TYPEOF_EEPPOINTER 21 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /tools/include/uchar.h: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------- 2 | uchar.h: Unicode utilities (ISO C 11 7.28) 3 | 4 | Copyright (C) 2015-2016, Philipp Klaus Krause, pkk@spth.de 5 | 6 | This library is free software; you can redistribute it and/or modify it 7 | under the terms of the GNU General Public License as published by the 8 | Free Software Foundation; either version 2, or (at your option) any 9 | later version. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this library; see the file COPYING. If not, write to the 18 | Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 | MA 02110-1301, USA. 20 | 21 | As a special exception, if you link this library with other files, 22 | some of which are compiled with SDCC, to produce an executable, 23 | this library does not by itself cause the resulting executable to 24 | be covered by the GNU General Public License. This exception does 25 | not however invalidate any other reasons why the executable file 26 | might be covered by the GNU General Public License. 27 | -------------------------------------------------------------------------*/ 28 | 29 | #ifndef __SDCC_UCHAR_H 30 | #define __SDCC_UCHAR_H 1 31 | 32 | #ifndef __MBSTATE_T_DEFINED 33 | #define __MBSTATE_T_DEFINED 34 | typedef struct {unsigned char c[3];} mbstate_t; 35 | #endif 36 | 37 | #ifndef __SIZE_T_DEFINED 38 | #define __SIZE_T_DEFINED 39 | typedef unsigned int size_t; 40 | #endif 41 | 42 | #ifndef __CHAR16_T_DEFINED 43 | #define __CHAR16_T_DEFINED 44 | typedef unsigned int char16_t; 45 | #endif 46 | 47 | #ifndef __CHAR32_T_DEFINED 48 | #define __CHAR32_T_DEFINED 49 | typedef unsigned long int char32_t; 50 | #endif 51 | 52 | size_t mbrtoc16(char16_t *restrict pc16, const char *restrict s, size_t n, mbstate_t *restrict ps); 53 | size_t c16rtomb(char *restrict s, char16_t c16, mbstate_t *restrict ps); 54 | size_t mbrtoc32(char32_t *restrict pc32, const char *restrict s, size_t n, mbstate_t *restrict ps); 55 | size_t c32rtomb(char *restrict s, char32_t c32, mbstate_t *restrict ps); 56 | 57 | size_t __mbstoc16s(char16_t *restrict c16s, const char *restrict s, size_t n); 58 | size_t __c16stombs(char *restrict s, const char16_t *restrict c16s, size_t n); 59 | 60 | #endif 61 | 62 | -------------------------------------------------------------------------------- /tools/lib/pdk13.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/lib/pdk13.lib -------------------------------------------------------------------------------- /tools/lib/pdk13/pdk13.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/lib/pdk13/pdk13.lib -------------------------------------------------------------------------------- /tools/lib/pdk14.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/lib/pdk14.lib -------------------------------------------------------------------------------- /tools/lib/pdk14/pdk14.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/lib/pdk14/pdk14.lib -------------------------------------------------------------------------------- /tools/lib/pdk15-stack-auto/pdk15.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/lib/pdk15-stack-auto/pdk15.lib -------------------------------------------------------------------------------- /tools/lib/pdk15.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/lib/pdk15.lib -------------------------------------------------------------------------------- /tools/lib/pdk15/pdk15.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/lib/pdk15/pdk15.lib -------------------------------------------------------------------------------- /tools/pfsprog/Makefile: -------------------------------------------------------------------------------- 1 | # --------------------------------------------- 2 | # erzeugt flash51n2 und flash51ide 3 | # --------------------------------------------- 4 | all: 5 | make build 6 | 7 | build: 8 | fpc pfsprog.pas 9 | 10 | clean: 11 | rm -f *.o 12 | rm -f *.ppu 13 | rm -f pfsprog 14 | 15 | -------------------------------------------------------------------------------- /tools/pfsprog/firmware/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = pfs154_prog2_1 8 | 9 | 10 | INC_DIR = -I./ -I../include 11 | 12 | # hier alle zusaetzlichen Softwaremodule angegeben 13 | 14 | SRCS = ./my_printf.o 15 | SRCS += ./uart_all.o 16 | 17 | PRINT_FL = 0 18 | SCAN_FL = 0 19 | MATH = 0 20 | 21 | # fuer Compiler / Linker 22 | FREQ = 16000000ul 23 | MCU = atmega328p 24 | 25 | # fuer AVRDUDE 26 | PROGRAMMER = arduino 27 | PROGPORT = /dev/ttyUSB0 28 | BRATE = 115200 29 | DUDEOPTS = -B1 30 | 31 | include ./makefile.mk 32 | 33 | -------------------------------------------------------------------------------- /tools/pfsprog/firmware/my_printf.h: -------------------------------------------------------------------------------- 1 | /* --------------------------- my_printf.h ---------------------------- 2 | 3 | Implementierung einer sehr minimalistischen (und im Funktionsumfang 4 | eingeschraenkten) Version von printf zur urspruenglichen Verwendung 5 | im ATtiny2313 (sollte allerdings auch mit allen anderen AVR- 6 | Controllern funktionieren) 7 | 8 | Benoetigt "irgendwo" im Gesamtprogram ein 9 | 10 | my_putchar(char c); 11 | 12 | 13 | 22.04.2016 R. Seelig 14 | 15 | Danke an www.mikrocontroller.net (Dr.Sommer, beric) 16 | 17 | letzte Aenderung: 18 | --------------------------------------------------- 19 | 20 | Anpassung an die my-printf Versionen von STM8 und STM32 Versionen 21 | mit Angabe der Nachkommastellen bei Verwendung des %k Platzhalters 22 | (Implementation der globalen Variable printfkomma und veraenderte 23 | < putint > Funktion 24 | 25 | 29.08.2018 R. Seelig 26 | 27 | --------------------------------------------------------------------- */ 28 | 29 | #ifndef in_myprintf 30 | #define in_myprintf 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | extern char printfkomma; 37 | 38 | extern void my_putchar(char c); 39 | void putint(int16_t i, char komma); 40 | void hexnibbleout(uint8_t b); 41 | void puthex(uint16_t h); 42 | void my_putramstring(uint8_t *p); 43 | 44 | void own_printf(const uint8_t *s,...); 45 | 46 | #define tiny_printf(str,...) (own_printf(PSTR(str), ## __VA_ARGS__)) 47 | #define my_printf tiny_printf 48 | 49 | 50 | #endif 51 | 52 | 53 | -------------------------------------------------------------------------------- /tools/pfsprog/pfsprog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/pfsprog/pfsprog -------------------------------------------------------------------------------- /tools/pfsprog/pictures/pfs154_programmer_shield_3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/pfsprog/pictures/pfs154_programmer_shield_3.gif -------------------------------------------------------------------------------- /tools/pfsprog/pictures/pfs154_progshield_schematic.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/pfsprog/pictures/pfs154_progshield_schematic.gif -------------------------------------------------------------------------------- /tools/pfsprog/pictures/pfs_progshield_bestueck_kl.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/pfsprog/pictures/pfs_progshield_bestueck_kl.jpg -------------------------------------------------------------------------------- /tools/pfsprog/pictures/pfs_progshield_loet_kl.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/pfsprog/pictures/pfs_progshield_loet_kl.jpg -------------------------------------------------------------------------------- /tools/pfsprog/pictures/pfsprog_lochstreifen.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/pfsprog/pictures/pfsprog_lochstreifen.gif -------------------------------------------------------------------------------- /tools/pfsprog/synautil.pas: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/tools/pfsprog/synautil.pas -------------------------------------------------------------------------------- /tools/pfsreadhex/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = pfsreadhex 8 | 9 | CC = gcc 10 | 11 | .PHONY: all clean 12 | 13 | all: clean 14 | $(CC) $(PROJECT).c -Os -lm -o $(PROJECT) 15 | 16 | clean: 17 | rm -f $(PROJECT) 18 | -------------------------------------------------------------------------------- /txt_lcd/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = txtlcd_demo 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | SRCS += ../src/my_printf.rel 16 | SRCS += ../src/hd44780.rel 17 | 18 | INC_DIR = -I./ -I../include 19 | 20 | # benutzbare Programmer: 21 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 22 | # 2 : pfsprog ==> benoetigt serielle Portangabe 23 | 24 | PROGRAMMER = 2 25 | SERPORT = /dev/ttyUSB0 26 | CH340RESET = 1 27 | 28 | 29 | include ../makefile.mk 30 | -------------------------------------------------------------------------------- /uart_demo/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = uart_demo 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/my_printf.rel 15 | SRCS += ../src/uart.rel 16 | 17 | INC_DIR = -I./ -I../include 18 | 19 | # benutzbare Programmer: 20 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 21 | # 2 : pfsprog ==> benoetigt serielle Portangabe 22 | 23 | PROGRAMMER = 2 24 | SERPORT = /dev/ttyUSB0 25 | CH340RESET = 1 26 | 27 | include ../makefile.mk 28 | -------------------------------------------------------------------------------- /uart_demo/uart_demo.c: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------------------- 2 | uart_demo.c 3 | 4 | Demoprogramm fuer serielle Schnittstelle und Ausgabe 5 | mittels abgespecktem printf. 6 | 7 | Compiler : SDCC 4.0.3 8 | MCU : PFS154 / PFS173 9 | 10 | 03.11.2020 R. Seelig 11 | 12 | ToDo: Delay-Zeiten fuer PFS173 muessen noch ausge- 13 | messen werden 14 | 15 | -------------------------------------------------------- */ 16 | 17 | #include 18 | #include "pdk_init.h" 19 | #include "pfs1xx_gpio.h" 20 | 21 | #include "uart.h" 22 | #include "my_printf.h" 23 | 24 | 25 | #define printf my_printf 26 | 27 | 28 | /* -------------------------------------------------------- 29 | my_putchar 30 | 31 | wird von my-printf / printf aufgerufen und hier muss 32 | eine Zeichenausgabefunktion angegeben sein, auf das 33 | printf dann schreibt ! 34 | -------------------------------------------------------- */ 35 | void my_putchar(char ch) 36 | { 37 | uart_putchar(ch); 38 | } 39 | 40 | /* -------------------------------------------------------- 41 | main 42 | -------------------------------------------------------- */ 43 | void main(void) 44 | { 45 | uint16_t counter = 0; 46 | char ch; 47 | 48 | uart_init(); 49 | 50 | // Endlosschleife 51 | while(1) 52 | { 53 | uart_puts("Taste: "); 54 | ch= uart_getchar(); 55 | printf("\n\r ==> Taste war: %c\n\r", ch); 56 | 57 | printf("Counter: %d\n\r", counter); 58 | counter++; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /vu_meter/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################ 2 | # 3 | # Makefile 4 | # 5 | ############################################################ 6 | 7 | PROJECT = vu_meter 8 | MCU = PFS154 9 | MEMORG = pdk14 10 | F_CPU = 8000000 11 | FACTORYCAL = 1 12 | 13 | # hier alle zusaetzlichen Softwaremodule angegeben 14 | SRCS = ../src/delay.rel 15 | 16 | INC_DIR = -I./ -I../include 17 | 18 | # benutzbare Programmer: 19 | # 1 : easypdkprogrammer ==> serielle Portangabe kann frei bleiben 20 | # 2 : pfsprog ==> benoetigt serielle Portangabe 21 | 22 | PROGRAMMER = 2 23 | SERPORT = /dev/ttyUSB0 24 | CH340RESET = 1 25 | 26 | include ../makefile.mk 27 | -------------------------------------------------------------------------------- /vu_meter/pfs154_spgteiler_intern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jjflash65/Padauk-pfs154/57c8e7eefdbdc83cac8313f35224bbc57607b00f/vu_meter/pfs154_spgteiler_intern.png --------------------------------------------------------------------------------