├── .gitignore ├── COMPILING ├── Design ├── Case │ ├── Enclosure.scad │ ├── Enclosure_bottom.stl │ ├── Enclosure_lid.stl │ ├── Enclosure_rev0.scad │ ├── Enclosure_top.stl │ └── Modem_case.stl ├── Eagle │ ├── Gerber │ │ ├── Modem.GBL │ │ ├── Modem.GBO │ │ ├── Modem.GBP │ │ ├── Modem.GBS │ │ ├── Modem.GML │ │ ├── Modem.GTL │ │ ├── Modem.GTO │ │ ├── Modem.GTP │ │ ├── Modem.GTS │ │ ├── Modem.TXT │ │ ├── Modem.dri │ │ └── Modem.gpi │ ├── Gerber_a1 │ │ ├── Gerber_a1.zip │ │ ├── Modem_rev_a1.GBL │ │ ├── Modem_rev_a1.GBO │ │ ├── Modem_rev_a1.GBP │ │ ├── Modem_rev_a1.GBS │ │ ├── Modem_rev_a1.GML │ │ ├── Modem_rev_a1.GTL │ │ ├── Modem_rev_a1.GTO │ │ ├── Modem_rev_a1.GTP │ │ ├── Modem_rev_a1.GTS │ │ ├── Modem_rev_a1.TXT │ │ ├── Modem_rev_a1.dri │ │ └── Modem_rev_a1.gpi │ ├── Modem.b#1 │ ├── Modem.b#2 │ ├── Modem.b#3 │ ├── Modem.b#4 │ ├── Modem.b#5 │ ├── Modem.b#6 │ ├── Modem.b#7 │ ├── Modem.b#8 │ ├── Modem.b#9 │ ├── Modem.brd │ ├── Modem.s#1 │ ├── Modem.s#2 │ ├── Modem.s#3 │ ├── Modem.s#4 │ ├── Modem.s#5 │ ├── Modem.s#6 │ ├── Modem.s#7 │ ├── Modem.sch │ ├── Modem_rev_a1.b#1 │ ├── Modem_rev_a1.b#2 │ ├── Modem_rev_a1.b#3 │ ├── Modem_rev_a1.b#4 │ ├── Modem_rev_a1.b#5 │ ├── Modem_rev_a1.b#6 │ ├── Modem_rev_a1.b#7 │ ├── Modem_rev_a1.b#8 │ ├── Modem_rev_a1.b#9 │ ├── Modem_rev_a1.brd │ ├── Modem_rev_a1.s#1 │ ├── Modem_rev_a1.s#2 │ ├── Modem_rev_a1.s#3 │ ├── Modem_rev_a1.s#4 │ ├── Modem_rev_a1.sch │ ├── Modem_rev_b0.b#1 │ ├── Modem_rev_b0.b#2 │ ├── Modem_rev_b0.b#3 │ ├── Modem_rev_b0.b#4 │ ├── Modem_rev_b0.b#5 │ ├── Modem_rev_b0.b#6 │ ├── Modem_rev_b0.b#7 │ ├── Modem_rev_b0.b#8 │ ├── Modem_rev_b0.b#9 │ ├── Modem_rev_b0.s## │ ├── Modem_rev_b0.s#1 │ ├── Modem_rev_b0.s#2 │ ├── Modem_rev_b0.s#3 │ ├── Modem_rev_b0.s#4 │ ├── Modem_rev_b0.s#5 │ ├── Modem_rev_b0.s#6 │ ├── Modem_rev_b0.s#7 │ ├── Modem_rev_b0.s#8 │ ├── Modem_rev_b0.sch │ └── eagle.epf ├── Fritzing │ ├── Modem_Arduino.fzz │ ├── Modem_Microduino.fzz │ ├── PCB_Arduino.pdf │ ├── PCB_Microduino.pdf │ ├── Schematic_Arduino.pdf │ └── Schematic_Microduino.pdf ├── Images │ ├── 1.jpg │ ├── 2.jpg │ ├── 3-lo.jpg │ ├── 3.jpg │ ├── 4.jpg │ ├── PCB-lo.png │ ├── PCB.png │ └── fsk.png ├── Modem_rev_a1.pdf ├── PCB.pdf ├── Partlist.txt └── Schematic.pdf ├── Documentation ├── Quickstart.odt └── Quickstart.pdf ├── LICENSE ├── Makefile ├── Modem ├── .spec ├── Modem.mk ├── Modem_user.mk ├── afsk.c ├── afsk.h ├── cfg │ ├── cfg_formatwr.h │ ├── cfg_kfile.h │ ├── cfg_monitor.h │ ├── cfg_proc.h │ ├── cfg_signal.h │ └── cfg_wdt.h ├── compression │ ├── heatshrink_common.h │ ├── heatshrink_config.h │ ├── heatshrink_decoder.c │ ├── heatshrink_decoder.h │ ├── heatshrink_encoder.c │ └── heatshrink_encoder.h ├── config.h ├── hardware.c ├── hardware.h ├── main.c └── protocol │ ├── mp1.c │ └── mp1.h ├── README.md ├── bertos ├── cfg │ ├── cfg_adc.h │ ├── cfg_arch.h │ ├── cfg_attr.h │ ├── cfg_ax25.h │ ├── cfg_boot.h │ ├── cfg_context_switch.h │ ├── cfg_debug.h │ ├── cfg_heap.h │ ├── cfg_kern.h │ ├── cfg_ser.h │ ├── cfg_timer.h │ ├── compiler.h │ ├── debug.h │ ├── depend.h │ ├── kfile_debug.c │ ├── kfile_debug.h │ ├── log.h │ ├── macros.h │ ├── module.h │ ├── os.h │ └── test.h ├── config.mk ├── cpu │ ├── attr.h │ ├── avr │ │ ├── drv │ │ │ ├── adc_avr.c │ │ │ ├── adc_avr.h │ │ │ ├── flash_avr.c │ │ │ ├── flash_avr.h │ │ │ ├── i2c_avr.c │ │ │ ├── i2c_avr.h │ │ │ ├── kdebug_avr.c │ │ │ ├── kdebug_mega.c │ │ │ ├── kdebug_xmega.c │ │ │ ├── pwm_avr.c │ │ │ ├── pwm_avr.h │ │ │ ├── ser_avr.c │ │ │ ├── ser_avr.h │ │ │ ├── ser_mega.c │ │ │ ├── ser_mega.h │ │ │ ├── ser_simple_avr.c │ │ │ ├── ser_simple_avr.h │ │ │ ├── ser_xmega.c │ │ │ ├── ser_xmega.h │ │ │ ├── stepper_avr.c │ │ │ ├── stepper_avr.h │ │ │ ├── timer_avr.c │ │ │ ├── timer_avr.h │ │ │ ├── timer_mega.c │ │ │ ├── timer_mega.h │ │ │ ├── timer_simple_avr.c │ │ │ ├── timer_simple_avr.h │ │ │ ├── timer_xmega.c │ │ │ ├── timer_xmega.h │ │ │ └── wdt_avr.h │ │ ├── hw │ │ │ ├── init_xmega.c │ │ │ ├── switch_avr.S │ │ │ └── switch_ctx_avr.S │ │ └── info │ │ │ ├── ATmega103.cdef │ │ │ ├── ATmega128.cdef │ │ │ ├── ATmega1280.cdef │ │ │ ├── ATmega1281.cdef │ │ │ ├── ATmega168.cdef │ │ │ ├── ATmega2560.cdef │ │ │ ├── ATmega32.cdef │ │ │ ├── ATmega328P.cdef │ │ │ ├── ATmega64.cdef │ │ │ ├── ATmega8.cdef │ │ │ ├── ATxmega32D4.cdef │ │ │ ├── avr.common │ │ │ ├── avr_post.common │ │ │ └── mega.common │ ├── byteorder.h │ ├── byteorder_test.c │ ├── detect.h │ ├── frame.h │ ├── irq.h │ ├── newcore │ ├── path.common │ ├── pgm.h │ ├── power.h │ └── types.h ├── drv │ ├── adc.c │ ├── adc.h │ ├── dac.h │ ├── kdebug.c │ ├── ser.c │ ├── ser.h │ ├── ser_p.h │ ├── timer.c │ ├── timer.h │ ├── timer_test.c │ └── wdt.h ├── hw │ ├── hw_boot.h │ ├── hw_cpufreq.h │ ├── hw_ser.h │ └── hw_timer.h ├── io │ ├── kblock.c │ ├── kblock.h │ ├── kblock_posix.c │ ├── kblock_posix.h │ ├── kblock_ram.c │ ├── kblock_ram.h │ ├── kfile.c │ ├── kfile.h │ ├── kfile_block.c │ ├── kfile_block.h │ ├── kfile_test.c │ ├── reblock.c │ └── reblock.h ├── kern │ ├── coop.c │ ├── irq.c │ ├── irq.h │ ├── kfile.h │ ├── monitor.c │ ├── monitor.h │ ├── msg.h │ ├── msg_test.c │ ├── preempt.c │ ├── proc.c │ ├── proc.h │ ├── proc_p.h │ ├── proc_test.c │ ├── proc_test │ │ ├── coop_heap_test.c │ │ ├── coop_msg_test.c │ │ ├── coop_pri_heap_test.c │ │ ├── coop_pri_test.c │ │ ├── coop_sem_test.c │ │ ├── coop_signal_test.c │ │ ├── coop_test.c │ │ ├── preempt_heap_test.c │ │ ├── preempt_msg_test.c │ │ ├── preempt_pri_heap_test.c │ │ ├── preempt_pri_test.c │ │ ├── preempt_sem_test.c │ │ ├── preempt_signal_test.c │ │ └── preempt_test.c │ ├── sem.c │ ├── sem.h │ ├── sem_test.c │ ├── signal.c │ ├── signal.h │ └── signal_test.c ├── mware │ ├── blanker.c │ ├── blanker.h │ ├── byteorder.h │ ├── cmd_hunk.h │ ├── event.c │ ├── event.h │ ├── except.h │ ├── formatwr.c │ ├── formatwr.h │ ├── hex.c │ ├── hex.h │ ├── ini_reader.c │ ├── ini_reader.h │ ├── ini_reader_test.c │ ├── messages.c │ ├── messages.h │ ├── observer.c │ ├── observer.h │ ├── parser.c │ ├── parser.h │ ├── pgm.h │ ├── readline.c │ ├── readline.h │ ├── resource.c │ ├── resource.h │ ├── rle.h │ ├── sprintf.c │ ├── sprintf_test.c │ ├── strtol10.c │ └── strtol10.h ├── net │ ├── ax25.c │ ├── ax25.h │ └── ax25_test.c ├── remote_merge ├── rules.mk ├── struct │ ├── bitarray.h │ ├── bitarray_test.c │ ├── fifobuf.h │ ├── hashtable.c │ ├── hashtable.h │ ├── hashtable_test.c │ ├── heap.c │ ├── heap.h │ ├── heap_test.c │ ├── kfile_fifo.c │ ├── kfile_fifo.h │ ├── kfile_fifo_test.c │ ├── kfile_mem.c │ ├── kfile_mem.h │ ├── list.h │ └── pool.h ├── verstag.c └── verstag.h ├── buildrev.h ├── flash └── images ├── Modem.bin ├── Modem.elf ├── Modem.hex ├── Modem.map └── Modem.s19 /.gitignore: -------------------------------------------------------------------------------- 1 | obj 2 | *.project 3 | *.workspace 4 | resources 5 | -------------------------------------------------------------------------------- /COMPILING: -------------------------------------------------------------------------------- 1 | -= Compiling with make =- 2 | 3 | To compile you need a the gcc-avr toolchain and standard make utilities. 4 | On Ubuntu/Debian this can be installed with: 5 | 6 | apt-get install build-essential gcc-avr avr-libc binutils-avr avrdude 7 | 8 | After that execute "make" in the main directory, and the modem firmware should compile. 9 | 10 | You can use avrdude to flash to an Arduino compatible board. Have a look at the "flash" script, it makes this easy. If your board is connected to /dev/ttyUSB0, simply run: 11 | 12 | ./flash USB0 13 | 14 | And avrdude should upload the firmware to the board. 15 | 16 | 17 | -= Eclipse =- 18 | 19 | If you want to use the Eclipse IDE, follow these steps: 20 | 21 | - Install the AVR-eclipse plugin from http://avr-eclipse.sourceforge.net/wiki/index.php/Plugin_Download 22 | - In eclipse, create a new project (File -> New -> Project…) 23 | - In the new project box, select C/C++ -> “Makefile Project with Existing Code” 24 | - Select a name, and locate the MicroModem folder for “Existing Code Location” 25 | - Select “AVR-GCC Toolchain” in “Toolchain for indexer settings” 26 | - Click “Finish” 27 | 28 | 29 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber/Modem.GBO: -------------------------------------------------------------------------------- 1 | G75* 2 | %MOIN*% 3 | %OFA0B0*% 4 | %FSLAX24Y24*% 5 | %IPPOS*% 6 | %LPD*% 7 | %AMOC8* 8 | 5,1,8,0,0,1.08239X$1,22.5* 9 | % 10 | %ADD10C,0.0000*% 11 | D10* 12 | X000100Y000100D02* 13 | X000100Y009596D01* 14 | X010470Y009596D01* 15 | X010470Y000100D01* 16 | X000100Y000100D01* 17 | M02* 18 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber/Modem.GBP: -------------------------------------------------------------------------------- 1 | G75* 2 | %MOIN*% 3 | %OFA0B0*% 4 | %FSLAX24Y24*% 5 | %IPPOS*% 6 | %LPD*% 7 | %AMOC8* 8 | 5,1,8,0,0,1.08239X$1,22.5* 9 | % 10 | %ADD10C,0.0000*% 11 | D10* 12 | X000100Y000100D02* 13 | X000100Y009596D01* 14 | X010470Y009596D01* 15 | X010470Y000100D01* 16 | X000100Y000100D01* 17 | M02* 18 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber/Modem.GBS: -------------------------------------------------------------------------------- 1 | G75* 2 | %MOIN*% 3 | %OFA0B0*% 4 | %FSLAX24Y24*% 5 | %IPPOS*% 6 | %LPD*% 7 | %AMOC8* 8 | 5,1,8,0,0,1.08239X$1,22.5* 9 | % 10 | %ADD10C,0.0000*% 11 | %ADD11OC8,0.0560*% 12 | %ADD12OC8,0.0670*% 13 | %ADD13C,0.0670*% 14 | %ADD14OC8,0.0740*% 15 | %ADD15C,0.0640*% 16 | %ADD16OC8,0.0800*% 17 | D10* 18 | X000100Y000100D02* 19 | X000100Y009596D01* 20 | X010470Y009596D01* 21 | X010470Y000100D01* 22 | X000100Y000100D01* 23 | D11* 24 | X003350Y003850D03* 25 | X004350Y003850D03* 26 | X005100Y002850D03* 27 | X005100Y001850D03* 28 | X006350Y001850D03* 29 | X006350Y002850D03* 30 | X006100Y004100D03* 31 | X007100Y004100D03* 32 | X007850Y004100D03* 33 | X008850Y004100D03* 34 | X008850Y003100D03* 35 | X007850Y003100D03* 36 | X008850Y001850D03* 37 | X009850Y001850D03* 38 | X008850Y006850D03* 39 | X008850Y007850D03* 40 | X007850Y007850D03* 41 | X006850Y007850D03* 42 | X006850Y006850D03* 43 | X007850Y006850D03* 44 | X005850Y006850D03* 45 | X004850Y006850D03* 46 | X004850Y007850D03* 47 | X005850Y007850D03* 48 | X003600Y007850D03* 49 | X002850Y007350D03* 50 | X003600Y006850D03* 51 | X003350Y005850D03* 52 | X003350Y004850D03* 53 | D12* 54 | X002850Y002850D03* 55 | X002850Y001850D03* 56 | X006350Y005350D03* 57 | X007850Y005350D03* 58 | X008850Y005350D03* 59 | D13* 60 | X005350Y005350D03* 61 | D14* 62 | X004850Y008850D03* 63 | X003850Y008850D03* 64 | X002850Y008850D03* 65 | X001850Y008850D03* 66 | X000850Y008850D03* 67 | X000850Y007850D03* 68 | X000850Y006850D03* 69 | X000850Y005850D03* 70 | X000850Y004850D03* 71 | X000850Y003850D03* 72 | X000850Y002850D03* 73 | X000850Y001850D03* 74 | X000850Y000850D03* 75 | X001850Y000850D03* 76 | X002850Y000850D03* 77 | X003850Y000850D03* 78 | X004850Y000850D03* 79 | X005850Y000850D03* 80 | X006850Y000850D03* 81 | X007850Y000850D03* 82 | X008850Y000850D03* 83 | X009850Y000850D03* 84 | X009850Y008850D03* 85 | X008850Y008850D03* 86 | X007850Y008850D03* 87 | X006850Y008850D03* 88 | X005850Y008850D03* 89 | D15* 90 | X001850Y004850D03* 91 | X001850Y003850D03* 92 | X001850Y002850D03* 93 | D16* 94 | X001850Y005850D03* 95 | X001850Y006850D03* 96 | M02* 97 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber/Modem.GML: -------------------------------------------------------------------------------- 1 | G75* 2 | %MOIN*% 3 | %OFA0B0*% 4 | %FSLAX24Y24*% 5 | %IPPOS*% 6 | %LPD*% 7 | %AMOC8* 8 | 5,1,8,0,0,1.08239X$1,22.5* 9 | % 10 | %ADD10C,0.0000*% 11 | D10* 12 | X000100Y000100D02* 13 | X000100Y009596D01* 14 | X010470Y009596D01* 15 | X010470Y000100D01* 16 | X000100Y000100D01* 17 | M02* 18 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber/Modem.GTL: -------------------------------------------------------------------------------- 1 | G75* 2 | %MOIN*% 3 | %OFA0B0*% 4 | %FSLAX24Y24*% 5 | %IPPOS*% 6 | %LPD*% 7 | %AMOC8* 8 | 5,1,8,0,0,1.08239X$1,22.5* 9 | % 10 | %ADD10C,0.0000*% 11 | %ADD11OC8,0.0520*% 12 | %ADD12OC8,0.0630*% 13 | %ADD13C,0.0630*% 14 | %ADD14OC8,0.0700*% 15 | %ADD15C,0.0600*% 16 | %ADD16OC8,0.0760*% 17 | %ADD17C,0.0160*% 18 | %ADD18R,0.0356X0.0356*% 19 | D10* 20 | X000100Y000100D02* 21 | X000100Y009596D01* 22 | X010470Y009596D01* 23 | X010470Y000100D01* 24 | X000100Y000100D01* 25 | D11* 26 | X003350Y003850D03* 27 | X004350Y003850D03* 28 | X005100Y002850D03* 29 | X005100Y001850D03* 30 | X006350Y001850D03* 31 | X006350Y002850D03* 32 | X006100Y004100D03* 33 | X007100Y004100D03* 34 | X007850Y004100D03* 35 | X008850Y004100D03* 36 | X008850Y003100D03* 37 | X007850Y003100D03* 38 | X008850Y001850D03* 39 | X009850Y001850D03* 40 | X008850Y006850D03* 41 | X008850Y007850D03* 42 | X007850Y007850D03* 43 | X006850Y007850D03* 44 | X006850Y006850D03* 45 | X007850Y006850D03* 46 | X005850Y006850D03* 47 | X004850Y006850D03* 48 | X004850Y007850D03* 49 | X005850Y007850D03* 50 | X003600Y007850D03* 51 | X002850Y007350D03* 52 | X003600Y006850D03* 53 | X003350Y005850D03* 54 | X003350Y004850D03* 55 | D12* 56 | X002850Y002850D03* 57 | X002850Y001850D03* 58 | X006350Y005350D03* 59 | X007850Y005350D03* 60 | X008850Y005350D03* 61 | D13* 62 | X005350Y005350D03* 63 | D14* 64 | X004850Y008850D03* 65 | X003850Y008850D03* 66 | X002850Y008850D03* 67 | X001850Y008850D03* 68 | X000850Y008850D03* 69 | X000850Y007850D03* 70 | X000850Y006850D03* 71 | X000850Y005850D03* 72 | X000850Y004850D03* 73 | X000850Y003850D03* 74 | X000850Y002850D03* 75 | X000850Y001850D03* 76 | X000850Y000850D03* 77 | X001850Y000850D03* 78 | X002850Y000850D03* 79 | X003850Y000850D03* 80 | X004850Y000850D03* 81 | X005850Y000850D03* 82 | X006850Y000850D03* 83 | X007850Y000850D03* 84 | X008850Y000850D03* 85 | X009850Y000850D03* 86 | X009850Y008850D03* 87 | X008850Y008850D03* 88 | X007850Y008850D03* 89 | X006850Y008850D03* 90 | X005850Y008850D03* 91 | D15* 92 | X001850Y004850D03* 93 | X001850Y003850D03* 94 | X001850Y002850D03* 95 | D16* 96 | X001850Y005850D03* 97 | X001850Y006850D03* 98 | D17* 99 | X003350Y005850D02* 100 | X004850Y005850D01* 101 | X005350Y005350D01* 102 | X006350Y005350D02* 103 | X007850Y005350D01* 104 | X007850Y006850D01* 105 | X006850Y006850D01* 106 | X005850Y006850D01* 107 | X007850Y005350D02* 108 | X007850Y004100D01* 109 | X007350Y002350D02* 110 | X008350Y002350D01* 111 | X008850Y001850D01* 112 | X003350Y003850D02* 113 | X003350Y004850D01* 114 | D18* 115 | X007350Y002350D03* 116 | M02* 117 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber/Modem.GTP: -------------------------------------------------------------------------------- 1 | G75* 2 | %MOIN*% 3 | %OFA0B0*% 4 | %FSLAX24Y24*% 5 | %IPPOS*% 6 | %LPD*% 7 | %AMOC8* 8 | 5,1,8,0,0,1.08239X$1,22.5* 9 | % 10 | %ADD10C,0.0000*% 11 | D10* 12 | X000100Y000100D02* 13 | X000100Y009596D01* 14 | X010470Y009596D01* 15 | X010470Y000100D01* 16 | X000100Y000100D01* 17 | M02* 18 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber/Modem.GTS: -------------------------------------------------------------------------------- 1 | G75* 2 | %MOIN*% 3 | %OFA0B0*% 4 | %FSLAX24Y24*% 5 | %IPPOS*% 6 | %LPD*% 7 | %AMOC8* 8 | 5,1,8,0,0,1.08239X$1,22.5* 9 | % 10 | %ADD10C,0.0000*% 11 | %ADD11OC8,0.0560*% 12 | %ADD12OC8,0.0670*% 13 | %ADD13C,0.0670*% 14 | %ADD14OC8,0.0740*% 15 | %ADD15C,0.0640*% 16 | %ADD16OC8,0.0800*% 17 | D10* 18 | X000100Y000100D02* 19 | X000100Y009596D01* 20 | X010470Y009596D01* 21 | X010470Y000100D01* 22 | X000100Y000100D01* 23 | D11* 24 | X003350Y003850D03* 25 | X004350Y003850D03* 26 | X005100Y002850D03* 27 | X005100Y001850D03* 28 | X006350Y001850D03* 29 | X006350Y002850D03* 30 | X006100Y004100D03* 31 | X007100Y004100D03* 32 | X007850Y004100D03* 33 | X008850Y004100D03* 34 | X008850Y003100D03* 35 | X007850Y003100D03* 36 | X008850Y001850D03* 37 | X009850Y001850D03* 38 | X008850Y006850D03* 39 | X008850Y007850D03* 40 | X007850Y007850D03* 41 | X006850Y007850D03* 42 | X006850Y006850D03* 43 | X007850Y006850D03* 44 | X005850Y006850D03* 45 | X004850Y006850D03* 46 | X004850Y007850D03* 47 | X005850Y007850D03* 48 | X003600Y007850D03* 49 | X002850Y007350D03* 50 | X003600Y006850D03* 51 | X003350Y005850D03* 52 | X003350Y004850D03* 53 | D12* 54 | X002850Y002850D03* 55 | X002850Y001850D03* 56 | X006350Y005350D03* 57 | X007850Y005350D03* 58 | X008850Y005350D03* 59 | D13* 60 | X005350Y005350D03* 61 | D14* 62 | X004850Y008850D03* 63 | X003850Y008850D03* 64 | X002850Y008850D03* 65 | X001850Y008850D03* 66 | X000850Y008850D03* 67 | X000850Y007850D03* 68 | X000850Y006850D03* 69 | X000850Y005850D03* 70 | X000850Y004850D03* 71 | X000850Y003850D03* 72 | X000850Y002850D03* 73 | X000850Y001850D03* 74 | X000850Y000850D03* 75 | X001850Y000850D03* 76 | X002850Y000850D03* 77 | X003850Y000850D03* 78 | X004850Y000850D03* 79 | X005850Y000850D03* 80 | X006850Y000850D03* 81 | X007850Y000850D03* 82 | X008850Y000850D03* 83 | X009850Y000850D03* 84 | X009850Y008850D03* 85 | X008850Y008850D03* 86 | X007850Y008850D03* 87 | X006850Y008850D03* 88 | X005850Y008850D03* 89 | D15* 90 | X001850Y004850D03* 91 | X001850Y003850D03* 92 | X001850Y002850D03* 93 | D16* 94 | X001850Y005850D03* 95 | X001850Y006850D03* 96 | M02* 97 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber/Modem.TXT: -------------------------------------------------------------------------------- 1 | % 2 | M48 3 | M72 4 | T01C0.0236 5 | T02C0.0320 6 | T03C0.0400 7 | % 8 | T01 9 | X7350Y2350 10 | T02 11 | X7850Y3100 12 | X8850Y3100 13 | X8850Y4100 14 | X7850Y4100 15 | X7100Y4100 16 | X6100Y4100 17 | X6350Y2850 18 | X6350Y1850 19 | X5100Y1850 20 | X5100Y2850 21 | X4350Y3850 22 | X3350Y3850 23 | X2850Y2850 24 | X2850Y1850 25 | X3350Y4850 26 | X3350Y5850 27 | X3600Y6850 28 | X2850Y7350 29 | X3600Y7850 30 | X4850Y7850 31 | X5850Y7850 32 | X5850Y6850 33 | X4850Y6850 34 | X5350Y5350 35 | X6350Y5350 36 | X7850Y5350 37 | X8850Y5350 38 | X8850Y6850 39 | X8850Y7850 40 | X7850Y7850 41 | X6850Y7850 42 | X6850Y6850 43 | X7850Y6850 44 | X8850Y1850 45 | X9850Y1850 46 | T03 47 | X850Y850 48 | X1850Y850 49 | X2850Y850 50 | X3850Y850 51 | X4850Y850 52 | X5850Y850 53 | X6850Y850 54 | X7850Y850 55 | X8850Y850 56 | X9850Y850 57 | X1850Y2850 58 | X1850Y3850 59 | X850Y3850 60 | X850Y2850 61 | X850Y1850 62 | X850Y4850 63 | X850Y5850 64 | X850Y6850 65 | X850Y7850 66 | X1850Y6850 67 | X1850Y5850 68 | X1850Y4850 69 | X1850Y8850 70 | X2850Y8850 71 | X3850Y8850 72 | X4850Y8850 73 | X5850Y8850 74 | X6850Y8850 75 | X7850Y8850 76 | X8850Y8850 77 | X9850Y8850 78 | X850Y8850 79 | M30 80 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber/Modem.dri: -------------------------------------------------------------------------------- 1 | Generated by EAGLE CAM Processor 6.5.0 2 | 3 | Drill Station Info File: /home/markqvist/Source/eagle/ModemMicroduino/Modem.dri 4 | 5 | Date : 4/30/14 1:15 PM 6 | Drills : generated 7 | Device : Excellon drill station 8 | 9 | Parameter settings: 10 | 11 | Tolerance Drill + : 0.00 % 12 | Tolerance Drill - : 0.00 % 13 | Rotate : no 14 | Mirror : no 15 | Optimize : yes 16 | Auto fit : yes 17 | OffsetX : 0inch 18 | OffsetY : 0inch 19 | Layers : Drills Holes 20 | 21 | Drill File Info: 22 | 23 | Data Mode : Absolute 24 | Units : 1/10000 Inch 25 | 26 | Drills used: 27 | 28 | Code Size used 29 | 30 | T01 0.0236inch 1 31 | T02 0.0320inch 35 32 | T03 0.0400inch 32 33 | 34 | Total number of drills: 68 35 | 36 | Plotfiles: 37 | 38 | /home/markqvist/Source/eagle/ModemMicroduino/Modem.TXT 39 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber/Modem.gpi: -------------------------------------------------------------------------------- 1 | Generated by EAGLE CAM Processor 6.5.0 2 | 3 | Photoplotter Info File: /home/markqvist/Source/eagle/ModemMicroduino/Modem.gpi 4 | 5 | Date : 4/30/14 1:15 PM 6 | Plotfile : /home/markqvist/Source/eagle/ModemMicroduino/Modem.GTL 7 | Apertures : generated: 8 | Device : Gerber RS-274-X photoplotter, coordinate format 2.4 inch 9 | 10 | Parameter settings: 11 | 12 | Emulate Apertures : no 13 | Tolerance Draw + : 0.00 % 14 | Tolerance Draw - : 0.00 % 15 | Tolerance Flash + : 0.00 % 16 | Tolerance Flash - : 0.00 % 17 | Rotate : no 18 | Mirror : no 19 | Optimize : yes 20 | Auto fit : yes 21 | OffsetX : 0inch 22 | OffsetY : 0inch 23 | 24 | Plotfile Info: 25 | 26 | Coordinate Format : 2.4 27 | Coordinate Units : Inch 28 | Data Mode : Absolute 29 | Zero Suppression : None 30 | End Of Block : * 31 | 32 | Apertures used: 33 | 34 | Code Shape Size used 35 | 36 | D10 draw 0.0000inch 4 37 | D11 octagon 0.0520inch 29 38 | D12 octagon 0.0630inch 5 39 | D13 round 0.0630inch 1 40 | D14 octagon 0.0700inch 27 41 | D15 round 0.0600inch 3 42 | D16 octagon 0.0760inch 2 43 | D17 draw 0.0160inch 10 44 | D18 square 0.0356inch 1 45 | 46 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber_a1/Gerber_a1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Eagle/Gerber_a1/Gerber_a1.zip -------------------------------------------------------------------------------- /Design/Eagle/Gerber_a1/Modem_rev_a1.GBO: -------------------------------------------------------------------------------- 1 | G75* 2 | %MOIN*% 3 | %OFA0B0*% 4 | %FSLAX24Y24*% 5 | %IPPOS*% 6 | %LPD*% 7 | %AMOC8* 8 | 5,1,8,0,0,1.08239X$1,22.5* 9 | % 10 | %ADD10C,0.0000*% 11 | D10* 12 | X000100Y000100D02* 13 | X000100Y009596D01* 14 | X010470Y009596D01* 15 | X010470Y000100D01* 16 | X000100Y000100D01* 17 | M02* 18 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber_a1/Modem_rev_a1.GBP: -------------------------------------------------------------------------------- 1 | G75* 2 | %MOIN*% 3 | %OFA0B0*% 4 | %FSLAX24Y24*% 5 | %IPPOS*% 6 | %LPD*% 7 | %AMOC8* 8 | 5,1,8,0,0,1.08239X$1,22.5* 9 | % 10 | %ADD10C,0.0000*% 11 | D10* 12 | X000100Y000100D02* 13 | X000100Y009596D01* 14 | X010470Y009596D01* 15 | X010470Y000100D01* 16 | X000100Y000100D01* 17 | M02* 18 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber_a1/Modem_rev_a1.GML: -------------------------------------------------------------------------------- 1 | G75* 2 | %MOIN*% 3 | %OFA0B0*% 4 | %FSLAX24Y24*% 5 | %IPPOS*% 6 | %LPD*% 7 | %AMOC8* 8 | 5,1,8,0,0,1.08239X$1,22.5* 9 | % 10 | %ADD10C,0.0000*% 11 | D10* 12 | X000100Y000100D02* 13 | X000100Y009596D01* 14 | X010470Y009596D01* 15 | X010470Y000100D01* 16 | X000100Y000100D01* 17 | M02* 18 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber_a1/Modem_rev_a1.GTP: -------------------------------------------------------------------------------- 1 | G75* 2 | %MOIN*% 3 | %OFA0B0*% 4 | %FSLAX24Y24*% 5 | %IPPOS*% 6 | %LPD*% 7 | %AMOC8* 8 | 5,1,8,0,0,1.08239X$1,22.5* 9 | % 10 | %ADD10C,0.0000*% 11 | D10* 12 | X000100Y000100D02* 13 | X000100Y009596D01* 14 | X010470Y009596D01* 15 | X010470Y000100D01* 16 | X000100Y000100D01* 17 | M02* 18 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber_a1/Modem_rev_a1.TXT: -------------------------------------------------------------------------------- 1 | % 2 | M48 3 | M72 4 | T01C0.0236 5 | T02C0.0320 6 | T03C0.0400 7 | T04C0.0600 8 | % 9 | T01 10 | X7350Y2350 11 | T02 12 | X7850Y3100 13 | X8850Y3100 14 | X8850Y4100 15 | X7850Y4100 16 | X7100Y4100 17 | X6100Y4100 18 | X5850Y5350 19 | X6850Y5350 20 | X7850Y5350 21 | X8850Y5350 22 | X8850Y6850 23 | X8850Y7850 24 | X7850Y7850 25 | X6850Y7850 26 | X6850Y6850 27 | X7850Y6850 28 | X5850Y6850 29 | X4850Y6850 30 | X4850Y7850 31 | X5850Y7850 32 | X3777Y7527 33 | X2893Y7350 34 | X3600Y6643 35 | X3350Y5350 36 | X4350Y5350 37 | X4600Y3600 38 | X5100Y2850 39 | X5100Y1850 40 | X6350Y1850 41 | X6350Y2850 42 | X8850Y1850 43 | X9850Y1850 44 | X3600Y3600 45 | X2850Y2850 46 | X2850Y1850 47 | T03 48 | X1850Y2850 49 | X1850Y3850 50 | X1850Y4850 51 | X1850Y5850 52 | X1850Y6850 53 | T04 54 | X850Y850 55 | X1850Y850 56 | X2850Y850 57 | X3850Y850 58 | X4850Y850 59 | X5850Y850 60 | X6850Y850 61 | X7850Y850 62 | X8850Y850 63 | X9850Y850 64 | X9850Y8850 65 | X8850Y8850 66 | X7850Y8850 67 | X6850Y8850 68 | X5850Y8850 69 | X4850Y8850 70 | X3850Y8850 71 | X2850Y8850 72 | X1850Y8850 73 | X850Y8850 74 | X850Y7850 75 | X850Y6850 76 | X850Y5850 77 | X850Y4850 78 | X850Y3850 79 | X850Y2850 80 | X850Y1850 81 | M30 82 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber_a1/Modem_rev_a1.dri: -------------------------------------------------------------------------------- 1 | Generated by EAGLE CAM Processor 6.5.0 2 | 3 | Drill Station Info File: /home/markqvist/Source/eagle/ModemMicroduino/Modem_rev_a1.dri 4 | 5 | Date : 10/12/14 11:44 PM 6 | Drills : generated 7 | Device : Excellon drill station 8 | 9 | Parameter settings: 10 | 11 | Tolerance Drill + : 0.00 % 12 | Tolerance Drill - : 0.00 % 13 | Rotate : no 14 | Mirror : no 15 | Optimize : yes 16 | Auto fit : yes 17 | OffsetX : 0inch 18 | OffsetY : 0inch 19 | Layers : Drills Holes 20 | 21 | Drill File Info: 22 | 23 | Data Mode : Absolute 24 | Units : 1/10000 Inch 25 | 26 | Drills used: 27 | 28 | Code Size used 29 | 30 | T01 0.0236inch 1 31 | T02 0.0320inch 35 32 | T03 0.0400inch 5 33 | T04 0.0600inch 27 34 | 35 | Total number of drills: 68 36 | 37 | Plotfiles: 38 | 39 | /home/markqvist/Source/eagle/ModemMicroduino/Modem_rev_a1.TXT 40 | -------------------------------------------------------------------------------- /Design/Eagle/Gerber_a1/Modem_rev_a1.gpi: -------------------------------------------------------------------------------- 1 | Generated by EAGLE CAM Processor 6.5.0 2 | 3 | Photoplotter Info File: /home/markqvist/Source/eagle/ModemMicroduino/Modem_rev_a1.gpi 4 | 5 | Date : 10/12/14 11:44 PM 6 | Plotfile : /home/markqvist/Source/eagle/ModemMicroduino/Modem_rev_a1.GTL 7 | Apertures : generated: 8 | Device : Gerber RS-274-X photoplotter, coordinate format 2.4 inch 9 | 10 | Parameter settings: 11 | 12 | Emulate Apertures : no 13 | Tolerance Draw + : 0.00 % 14 | Tolerance Draw - : 0.00 % 15 | Tolerance Flash + : 0.00 % 16 | Tolerance Flash - : 0.00 % 17 | Rotate : no 18 | Mirror : no 19 | Optimize : yes 20 | Auto fit : yes 21 | OffsetX : 0inch 22 | OffsetY : 0inch 23 | 24 | Plotfile Info: 25 | 26 | Coordinate Format : 2.4 27 | Coordinate Units : Inch 28 | Data Mode : Absolute 29 | Zero Suppression : None 30 | End Of Block : * 31 | 32 | Emulated Apertures: 33 | 34 | -------- Requested Aperture -------- ------ Used Aperture ------ 35 | 36 | Shape Size used Code Shape Size 37 | 38 | octagon 0.0520inch 3 D14 draw 0.0104inch 39 | 40 | Apertures used: 41 | 42 | Code Shape Size used 43 | 44 | D10 draw 0.0000inch 4 45 | D11 octagon 0.0520inch 26 46 | D12 octagon 0.0630inch 5 47 | D13 round 0.0630inch 1 48 | D14 draw 0.0104inch 3 49 | D15 octagon 0.0900inch 27 50 | D16 round 0.0600inch 3 51 | D17 octagon 0.0760inch 2 52 | D18 draw 0.0160inch 11 53 | D19 square 0.0356inch 1 54 | 55 | -------------------------------------------------------------------------------- /Design/Fritzing/Modem_Arduino.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Fritzing/Modem_Arduino.fzz -------------------------------------------------------------------------------- /Design/Fritzing/Modem_Microduino.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Fritzing/Modem_Microduino.fzz -------------------------------------------------------------------------------- /Design/Fritzing/PCB_Arduino.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Fritzing/PCB_Arduino.pdf -------------------------------------------------------------------------------- /Design/Fritzing/PCB_Microduino.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Fritzing/PCB_Microduino.pdf -------------------------------------------------------------------------------- /Design/Fritzing/Schematic_Arduino.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Fritzing/Schematic_Arduino.pdf -------------------------------------------------------------------------------- /Design/Fritzing/Schematic_Microduino.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Fritzing/Schematic_Microduino.pdf -------------------------------------------------------------------------------- /Design/Images/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Images/1.jpg -------------------------------------------------------------------------------- /Design/Images/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Images/2.jpg -------------------------------------------------------------------------------- /Design/Images/3-lo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Images/3-lo.jpg -------------------------------------------------------------------------------- /Design/Images/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Images/3.jpg -------------------------------------------------------------------------------- /Design/Images/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Images/4.jpg -------------------------------------------------------------------------------- /Design/Images/PCB-lo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Images/PCB-lo.png -------------------------------------------------------------------------------- /Design/Images/PCB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Images/PCB.png -------------------------------------------------------------------------------- /Design/Images/fsk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Images/fsk.png -------------------------------------------------------------------------------- /Design/Modem_rev_a1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Modem_rev_a1.pdf -------------------------------------------------------------------------------- /Design/PCB.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/PCB.pdf -------------------------------------------------------------------------------- /Design/Partlist.txt: -------------------------------------------------------------------------------- 1 | Partlist 2 | 3 | Exported from Modem.sch at 9/18/14 8:45 PM 4 | 5 | EAGLE Version 6.5.0 Copyright (c) 1988-2013 CadSoft 6 | 7 | Assembly variant: 8 | 9 | Part Value Device Package Library Sheet 10 | 11 | C1 100nF C2.5/2 C2.5-2 capacitor 1 12 | C2 4.7uF CPOL-EUE2.5-5V E2,5-4R capacitor-pol 1 13 | C3 1uF C2.5/2 C2.5-2 capacitor 1 14 | Q1 2N7000 2N7000 TO92 transistor 1 15 | R1 1k R-EU_0204/2V 0204V resistor 1 16 | R2 2k2 R-EU_0204/2V 0204V resistor 1 17 | R3 3k9 R-EU_0204/2V 0204V resistor 1 18 | R4 8k2 R-EU_0204/2V 0204V resistor 1 19 | R5 100k R-EU_0204/2V 0204V resistor 1 20 | R6 1k R-EU_0204/2V 0204V resistor 1 21 | R7 270 R-EU_0204/2V 0204V resistor 1 22 | R8 270 R-EU_0204/2V 0204V resistor 1 23 | R9 10k R-EU_0204/2V 0204V rcl 1 24 | R10 100k R-EU_0204/2V 0204V rcl 1 25 | R11 100k R-EU_0204/2V 0204V rcl 1 26 | RX LED_ELD260 LED_LD260 eagle-ltspice 1 27 | TX LED_ELD260 LED_LD260 eagle-ltspice 1 28 | 29 | RADIO PINHD-1X3 1X03 adafruit 1 30 | MICRODUINO_BTM PINHD-1X9 1X09-BIG adafruit 1 31 | MICRODUINO_LFT PINHD-1X9 1X09-BIG adafruit 1 32 | MICRODUINO_TOP PINHD-1X9 1X09-BIG adafruit 1 33 | PTT+ PINHD-1X1 1X01 adafruit 1 34 | PTT- PINHD-1X1 1X01 adafruit 1 35 | -------------------------------------------------------------------------------- /Design/Schematic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Design/Schematic.pdf -------------------------------------------------------------------------------- /Documentation/Quickstart.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Documentation/Quickstart.odt -------------------------------------------------------------------------------- /Documentation/Quickstart.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/Documentation/Quickstart.pdf -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2009 Develer S.r.l. (http://www.develer.com/) 3 | # All rights reserved. 4 | # 5 | # Author: Lorenzo Berni 6 | # 7 | 8 | # Set to 1 for verbose build output, 0 for terse output 9 | V := 0 10 | 11 | default: all 12 | 13 | include bertos/config.mk 14 | 15 | include Modem/Modem.mk 16 | 17 | include bertos/rules.mk 18 | -------------------------------------------------------------------------------- /Modem/.spec: -------------------------------------------------------------------------------- 1 | name = 'empty preset' 2 | advanced = True 3 | description=""" 4 |

5 | This is a minimalist project, it just initializes the hardware of the 6 | supported board and proposes an empty main. 7 | <\p> 8 | """ 9 | -------------------------------------------------------------------------------- /Modem/Modem_user.mk: -------------------------------------------------------------------------------- 1 | # 2 | # User makefile. 3 | # Edit this file to change compiler options and related stuff. 4 | # 5 | 6 | # Programmer interface configuration, see http://dev.bertos.org/wiki/ProgrammerInterface for help 7 | Modem_PROGRAMMER_TYPE = none 8 | Modem_PROGRAMMER_PORT = none 9 | 10 | # Files included by the user. 11 | Modem_USER_CSRC = \ 12 | $(Modem_SRC_PATH)/main.c \ 13 | $(Modem_HW_PATH)/hardware.c \ 14 | $(Modem_HW_PATH)/afsk.c \ 15 | $(Modem_HW_PATH)/protocol/mp1.c \ 16 | $(Modem_HW_PATH)/compression/heatshrink_decoder.c \ 17 | $(Modem_HW_PATH)/compression/heatshrink_encoder.c \ 18 | # 19 | 20 | # Files included by the user. 21 | Modem_USER_PCSRC = \ 22 | # 23 | 24 | # Files included by the user. 25 | Modem_USER_CPPASRC = \ 26 | # 27 | 28 | # Files included by the user. 29 | Modem_USER_CXXSRC = \ 30 | # 31 | 32 | # Files included by the user. 33 | Modem_USER_ASRC = \ 34 | # 35 | 36 | # Flags included by the user. 37 | Modem_USER_LDFLAGS = \ 38 | # 39 | 40 | # Flags included by the user. 41 | Modem_USER_CPPAFLAGS = \ 42 | # 43 | 44 | # Flags included by the user. 45 | Modem_USER_CPPFLAGS = \ 46 | -fno-strict-aliasing \ 47 | -fwrapv \ 48 | # 49 | -------------------------------------------------------------------------------- /Modem/cfg/cfg_formatwr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Configuration file for formatted write module. 34 | * 35 | * \author Daniele Basile 36 | */ 37 | 38 | #ifndef CFG_FORMATWR_H 39 | #define CFG_FORMATWR_H 40 | 41 | /** 42 | * printf()-style formatter configuration. 43 | * $WIZ$ type = "enum"; value_list = "printf_list" 44 | * 45 | * \sa PRINTF_DISABLED 46 | * \sa PRINTF_NOMODIFIERS 47 | * \sa PRINTF_REDUCED 48 | * \sa PRINTF_NOFLOAT 49 | * \sa PRINTF_FULL 50 | */ 51 | #define CONFIG_PRINTF PRINTF_FULL 52 | 53 | /** 54 | * Size of buffer to format "%" sequences in printf. 55 | * 56 | * Warning: no check on buffer size is done when formatting, be careful especially 57 | * with big numbers and %f formatting. 58 | * 59 | * $WIZ$ type = "int" 60 | * $WIZ$ min = 4 61 | */ 62 | #define CONFIG_FRMWRI_BUFSIZE 134 63 | 64 | #endif /* CFG_FORMATWR_H */ 65 | 66 | -------------------------------------------------------------------------------- /Modem/cfg/cfg_kfile.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Configuration file for KFile interface module. 34 | * 35 | * \author Daniele Basile 36 | */ 37 | 38 | #ifndef CFG_KFILE_H 39 | #define CFG_KFILE_H 40 | 41 | /** 42 | * Module logging level. 43 | * $WIZ$ type = "enum" 44 | * $WIZ$ value_list = "log_level" 45 | */ 46 | #define KFILE_LOG_LEVEL LOG_LVL_INFO 47 | 48 | /** 49 | * Module logging format. 50 | * $WIZ$ type = "enum" 51 | * $WIZ$ value_list = "log_format" 52 | */ 53 | #define KFILE_LOG_FORMAT LOG_FMT_TERSE 54 | 55 | /** 56 | * Enable the gets function with echo. 57 | * $WIZ$ type = "boolean" 58 | */ 59 | #define CONFIG_KFILE_GETS 0 60 | 61 | #endif /* CFG_KFILE_H */ 62 | -------------------------------------------------------------------------------- /Modem/cfg/cfg_monitor.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Kernel monitor configuration parameters 34 | * 35 | * \author Bernie Innocenti 36 | */ 37 | 38 | #ifndef CFG_MONITOR_H 39 | #define CFG_MONITOR_H 40 | 41 | /** 42 | * Process monitor. 43 | * $WIZ$ type = "autoenabled" 44 | */ 45 | #define CONFIG_KERN_MONITOR 0 46 | 47 | #endif /* CFG_MONITOR_H */ 48 | -------------------------------------------------------------------------------- /Modem/cfg/cfg_signal.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Kernel signals configuration parameters 34 | * 35 | * \author Bernie Innocenti 36 | */ 37 | 38 | #ifndef CFG_SIGNAL_H 39 | #define CFG_SIGNAL_H 40 | 41 | /** 42 | * Inter-process signals. 43 | * $WIZ$ type = "autoenabled" 44 | */ 45 | #define CONFIG_KERN_SIGNALS 0 46 | 47 | #endif /* CFG_SIGNAL_H */ 48 | -------------------------------------------------------------------------------- /Modem/cfg/cfg_wdt.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Configuration file for watchdog module. 34 | * 35 | * 36 | * \author Daniele Basile 37 | */ 38 | 39 | #ifndef CFG_WDT_H 40 | #define CFG_WDT_H 41 | 42 | /// Enable watchdog timer. $WIZ$ type = "autoenabled" 43 | #define CONFIG_WATCHDOG 0 44 | 45 | #endif /* CFG_WDT_H */ 46 | 47 | 48 | -------------------------------------------------------------------------------- /Modem/compression/heatshrink_common.h: -------------------------------------------------------------------------------- 1 | #ifndef HEATSHRINK_H 2 | #define HEATSHRINK_H 3 | 4 | #define HEATSHRINK_AUTHOR "Scott Vokes " 5 | 6 | /* Version 0.3.0 */ 7 | #define HEATSHRINK_VERSION_MAJOR 0 8 | #define HEATSHRINK_VERSION_MINOR 3 9 | #define HEATSHRINK_VERSION_PATCH 0 10 | 11 | #define HEATSHRINK_MIN_WINDOW_BITS 4 12 | #define HEATSHRINK_MAX_WINDOW_BITS 15 13 | 14 | #define HEATSHRINK_MIN_LOOKAHEAD_BITS 2 15 | 16 | #define HEATSHRINK_LITERAL_MARKER 0x01 17 | #define HEATSHRINK_BACKREF_MARKER 0x00 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /Modem/compression/heatshrink_config.h: -------------------------------------------------------------------------------- 1 | #ifndef HEATSHRINK_CONFIG_H 2 | #define HEATSHRINK_CONFIG_H 3 | 4 | /* Should functionality assuming dynamic allocation be used? */ 5 | #define HEATSHRINK_DYNAMIC_ALLOC 1 6 | 7 | #if HEATSHRINK_DYNAMIC_ALLOC 8 | /* Optional replacement of malloc/free */ 9 | #define HEATSHRINK_MALLOC(SZ) malloc(SZ) 10 | #define HEATSHRINK_FREE(P, SZ) free(P) 11 | #else 12 | /* Required parameters for static configuration */ 13 | #define HEATSHRINK_STATIC_INPUT_BUFFER_SIZE 200 14 | #define HEATSHRINK_STATIC_WINDOW_BITS 8 15 | #define HEATSHRINK_STATIC_LOOKAHEAD_BITS 4 16 | #endif 17 | 18 | /* Turn on logging for debugging. */ 19 | #define HEATSHRINK_DEBUGGING_LOGS 0 20 | 21 | /* Use indexing for faster compression. (This requires additional space.) */ 22 | #define HEATSHRINK_USE_INDEX 0 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /Modem/config.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef FSK_CFG 3 | #define FSK_CFG 4 | 5 | // Debug & test options 6 | #define SERIAL_DEBUG false 7 | #define PASSALL false 8 | #define AUTOREPLY false 9 | 10 | // Modem options 11 | #define TX_MAXWAIT 2UL // How many milliseconds should pass with no 12 | // no incoming data before it is transmitted 13 | #define CONFIG_AFSK_RX_BUFLEN 64 // The size of the modems receive buffer 14 | #define CONFIG_AFSK_TX_BUFLEN 64 // The size of the modems transmit buffer 15 | #define CONFIG_AFSK_DAC_SAMPLERATE 9600 // The samplerate of the DAC. Note that 16 | // changing it here will not change the 17 | // actual sample rate. It is defined here 18 | // so various functions can use it. 19 | #define CONFIG_AFSK_RXTIMEOUT 0 // How long a read operation from the modem 20 | // will wait for data before timing out. 21 | 22 | #define CONFIG_AFSK_PREAMBLE_LEN 350UL // The length of the packet preamble in milliseconds 23 | #define CONFIG_AFSK_TRAILER_LEN 50UL // The length of the packet tail in milliseconds 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /Modem/hardware.h: -------------------------------------------------------------------------------- 1 | ////////////////////////////////////////////////////// 2 | // First things first, all the includes we need // 3 | ////////////////////////////////////////////////////// 4 | 5 | #ifndef FSK_MODEM_HW 6 | #define FSK_MODEM_HW 7 | 8 | #include "cfg/cfg_arch.h" // Architecture configuration 9 | 10 | #include // AVR IO functions from BertOS 11 | 12 | ////////////////////////////////////////////////////// 13 | // Definitions and some useful macros // 14 | ////////////////////////////////////////////////////// 15 | 16 | // Forward declaration of our modem "object" 17 | struct Afsk; 18 | 19 | // Function declarations 20 | void hw_afsk_adcInit(int ch, struct Afsk *_ctx); 21 | void hw_afsk_dacInit(int ch, struct Afsk *_ctx); 22 | 23 | // Here's some macros for controlling the RX/TX LEDs 24 | // THE _INIT() functions writes to the DDRB register 25 | // to configure the pins as output pins, and the _ON() 26 | // and _OFF() functions writes to the PORT registers 27 | // to turn the pins on or off. 28 | #define LED_TX_INIT() do { DDRB |= BV(1); } while (0) 29 | #define LED_TX_ON() do { PORTB |= BV(1); } while (0) 30 | #define LED_TX_OFF() do { PORTB &= ~BV(1); } while (0) 31 | 32 | #define LED_RX_INIT() do { DDRB |= BV(2); } while (0) 33 | #define LED_RX_ON() do { PORTB |= BV(2); } while (0) 34 | #define LED_RX_OFF() do { PORTB &= ~BV(2); } while (0) 35 | 36 | // A shorthand macro for initializing the ADC. 37 | // It just calls the actual ADC initialization code 38 | // in "hardware.c" 39 | #define AFSK_ADC_INIT(ch, ctx) hw_afsk_adcInit(ch, ctx) 40 | 41 | // Initialization of the DAC pins. The DDRD register 42 | // configures pins 0 through 7 for input or output. 43 | // DDR stands for Data Direction Register. By setting 44 | // it to 0xF8 we set 11111000, which means the pins 45 | // 3, 4, 5, 6 and 7 will be set to output. 46 | #define AFSK_DAC_INIT() do { DDRD |= 0xF8; } while (0) 47 | 48 | // These two macros start and stop the DAC routine 49 | // being called in our timer interrupt. For starting 50 | // it, we set a boolean flag to true, and false for 51 | // stopping it. We also turn on and off pin 3 to trigger 52 | // the PTT of the radio. 53 | #define AFSK_DAC_IRQ_START() do { extern bool hw_afsk_dac_isr; PORTD |= BV(3); hw_afsk_dac_isr = true; } while (0) 54 | #define AFSK_DAC_IRQ_STOP() do { extern bool hw_afsk_dac_isr; PORTD &= ~BV(3); hw_afsk_dac_isr = false; } while (0) 55 | 56 | #define AFSK_HW_PTT_ON() do { extern bool hw_ptt_on; hw_ptt_on = true; } while (0) 57 | #define AFSK_HW_PTT_OFF() do { extern bool hw_ptt_on; hw_ptt_on = false; } while (0) 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | MicroModem - Deprecated Firmware 2 | ========== 3 | 4 | *Please note that the firmware in this repo is deprecated! For a newer, much better general purpose firmware, use [MicroModemGP](https://github.com/markqvist/MicroModemGP). For an APRS-oriented firmware use [MicroAPRS](https://github.com/markqvist/MicroAPRS)* 5 | 6 | *There is now a completely reworked hardware and software platform based on the legacy of MicroModem, called [OpenModem](https://github.com/markqvist/openmodem/), with many more features and a more flexible implementation.* 7 | 8 | MicroModem is an educational implementation of a 1200-baud AFSK modem. This implementation is targeted at the Atmega 328p microprocessor used in many Arduino boards and spinoffs. It can be build very easily with an Arduino board based on the Atmega 328p, and around 15 common electronics components. 9 | 10 | Please read the "Quickstart.pdf" in the Documentation folder for some pointers on building the modem! 11 | 12 | If you want to use MicroModem for APRS, check out the [MicroAPRS](https://github.com/markqvist/MicroAPRS). This fork is created specifically for APRS. 13 | 14 | ![MicroModem](https://raw.githubusercontent.com/markqvist/MicroModem/master/Design/Images/1.jpg) 15 | 16 | The repository contains schematics and Eagle PCB files for a Microduino module. There is also fritzing sketches for both an Arduino shield and a Microduino module, with notes so they are easier to understand. I have had the eagle PCB fabricated, and it is working great, so you can use that if want to make your own board. 17 | 18 | ![MicroModem](https://raw.githubusercontent.com/markqvist/MicroModem/master/Design/Images/PCB-lo.png) 19 | 20 | I am currently writing an illustrated tutorial to go along with the source-code, but even now, the source code is extremely well documented, and all the concepts are explained in great detail in the comments. 21 | 22 | By default MicroModem uses a very simple protocol dubbed MP1. The protocol enables end-to-end transport with forward error-correction and compression. Compression is courtesy of the excellent [Heatshrink](https://github.com/atomicobject/heatshrink) library. MP1 can also encapsulate TCP/IP traffic from a host computer with SLIP. 23 | 24 | MicroModem was created as an easy to build, low-cost and very flexible radio-modem. It also supports the AX.25 implementation in BertOS, so it can be used with that for APRS and the likes very easily. 25 | 26 | While this project is based on Arduino hardware, it does not use the Arduino IDE. The project has been implemented in your normal C with makefile style, and uses libraries from the open source BertOS. 27 | 28 | Visit [my site](http://unsigned.io) for questions, comments and other details. 29 | -------------------------------------------------------------------------------- /bertos/cfg/cfg_arch.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 33 | * 34 | * \brief Set system configuration. 35 | * 36 | * 37 | * \author Bernie Innocenti 38 | * 39 | */ 40 | 41 | 42 | #ifndef CFG_ARCH_CONFIG_H 43 | #define CFG_ARCH_CONFIG_H 44 | 45 | #define ARCH_DEFAULT (1<<0) ///< Default architecture 46 | 47 | #define ARCH_EMUL (1<<2) ///< EMUL architecture 48 | #define ARCH_QT (1<<3) ///< QT architecture 49 | #define ARCH_UNITTEST (1<<4) ///< UNITTEST architecture 50 | #define ARCH_NIGHTTEST (1<<5) ///< NIGHTTEST architecture 51 | 52 | #endif /* CFG_ARCH_CONFIG_H */ 53 | -------------------------------------------------------------------------------- /bertos/cfg/cfg_attr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Configuration file for Debug module. 34 | * 35 | * 36 | * \author Daniele Basile 37 | */ 38 | 39 | #ifndef CFG_ATTR_H 40 | #define CFG_ATTR_H 41 | 42 | /// Put a function or critical code in fast memory. 43 | #define CONFIG_FAST_MEM 0 44 | 45 | 46 | #endif /* CFG_ATTR_H */ 47 | -------------------------------------------------------------------------------- /bertos/cfg/cfg_ax25.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Configuration file for the AX25 protocol module. 34 | * 35 | * \author Francesco Sacchi 36 | */ 37 | 38 | #ifndef CFG_AX25_H 39 | #define CFG_AX25_H 40 | 41 | /** 42 | * Module logging level. 43 | * 44 | * $WIZ$ type = "enum" 45 | * $WIZ$ value_list = "log_level" 46 | */ 47 | #define AX25_LOG_LEVEL LOG_LVL_WARN 48 | 49 | /** 50 | * Module logging format. 51 | * 52 | * $WIZ$ type = "enum" 53 | * $WIZ$ value_list = "log_format" 54 | */ 55 | #define AX25_LOG_FORMAT LOG_FMT_TERSE 56 | 57 | /** 58 | * AX25 frame buffer lenght. 59 | * 60 | * $WIZ$ type = "int" 61 | * $WIZ$ min = 18 62 | */ 63 | #define CONFIG_AX25_FRAME_BUF_LEN 330 64 | 65 | 66 | /** 67 | * Enable repeaters listing in AX25 frames. 68 | * If enabled use 56 addtional bytes of RAM 69 | * for each message received. 70 | * 71 | * $WIZ$ type = "boolean" 72 | */ 73 | #define CONFIG_AX25_RPT_LST 1 74 | 75 | #endif /* CFG_AX25_H */ 76 | -------------------------------------------------------------------------------- /bertos/cfg/cfg_boot.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 31 | * 32 | * \author Daniele Basile 33 | * 34 | * \brief Configuration file for bootloader module. 35 | */ 36 | 37 | #ifndef CFG_BOOT_H 38 | #define CFG_BOOT_H 39 | 40 | /// Bootloader log level 41 | #define CONFIG_BOOT_LOG_LEVEL LOG_LVL_INFO 42 | 43 | /// Bootoloader log format 44 | #define CONFIG_BOOT_LOG_FORMAT LOG_FMT_TERSE 45 | 46 | #endif /* CFG_FLASH_AT91_H */ 47 | -------------------------------------------------------------------------------- /bertos/cfg/cfg_context_switch.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Configuration file for the context switch benchmark. 34 | * 35 | * \author Daniele Basile 36 | */ 37 | 38 | #ifndef CFG_CONTEXT_SWITCH_H 39 | #define CFG_CONTEXT_SWITCH_H 40 | 41 | /** 42 | * Use hp timer for the bechmark. 43 | * 44 | * $WIZ$ type = "boolean" 45 | * $WIZ$ module= "boolean" 46 | * $WIZ$ conditional_deps = "ser" 47 | */ 48 | #define CONFIG_USE_HP_TIMER 1 49 | 50 | 51 | /** 52 | * Use board led for benchmark. 53 | * 54 | * $WIZ$ type = "boolean" 55 | */ 56 | #define CONFIG_USE_LED 1 57 | 58 | 59 | /** 60 | * Debug console port. 61 | * $WIZ$ type = "int"; min = 0 62 | */ 63 | #define CONFIG_CTX_DEBUG_PORT 0 64 | 65 | /** 66 | * Baudrate for the debug console. 67 | * $WIZ$ type = "int"; min = 300 68 | */ 69 | #define CONFIG_CTX_DEBUG_BAUDRATE 115200UL 70 | 71 | #endif /* CFG_CONTEXT_SWITCH_H */ 72 | -------------------------------------------------------------------------------- /bertos/cfg/cfg_debug.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Configuration file for Debug module. 34 | * 35 | * 36 | * \author Daniele Basile 37 | */ 38 | 39 | #ifndef CFG_DEBUG_H 40 | #define CFG_DEBUG_H 41 | 42 | /** 43 | * Debug console port. 44 | * $WIZ$ type = "int"; min = 0 45 | */ 46 | #define CONFIG_KDEBUG_PORT 0 47 | 48 | /** 49 | * Baudrate for the debug console. 50 | * $WIZ$ type = "int"; min = 300 51 | */ 52 | #define CONFIG_KDEBUG_BAUDRATE 57600UL 53 | 54 | /** 55 | * Clock source for the UART module. You need to write the code to reprogram the respective clock at the required frequency in your project before calling kdbg_init(). 56 | * 57 | * $WIZ$ type = "enum" 58 | * $WIZ$ value_list = "kdbg_clk_src" 59 | * $WIZ$ supports = "msp430" 60 | */ 61 | #define CONFIG_KDEBUG_CLOCK_SOURCE KDBG_UART_SMCLK 62 | 63 | /** 64 | * Clock frequency. (Only if different from MCLK's frequency, otherwise leave it zero) 65 | * $WIZ$ type = "int"; min = 0 66 | * $WIZ$ supports = "msp430" 67 | */ 68 | #define CONFIG_KDEBUG_CLOCK_FREQ 0UL 69 | 70 | #endif /* CFG_DEBUG_H */ 71 | -------------------------------------------------------------------------------- /bertos/cfg/cfg_heap.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Configuration file for heap module. 34 | * 35 | * 36 | * \author Daniele Basile 37 | */ 38 | 39 | #ifndef CFG_HEAP_H 40 | #define CFG_HEAP_H 41 | 42 | /** 43 | * Enable malloc/free like API. 44 | * $WIZ$ type = "boolean" 45 | */ 46 | #define CONFIG_HEAP_MALLOC 1 47 | 48 | #endif /* CFG_HEAP_H */ 49 | 50 | 51 | -------------------------------------------------------------------------------- /bertos/cfg/cfg_kern.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Kernel configuration parameters (deprecated) 34 | * 35 | * \author Bernie Innocenti 36 | */ 37 | 38 | #ifndef CFG_KERN_H 39 | #define CFG_KERN_H 40 | 41 | #warning This file is deprecated, you should use the correct combination of cfg_proc.h, cfg_sem.h, cfg_signal.h and cfg_monitor.h 42 | #include "cfg_proc.h" 43 | #include "cfg_sem.h" 44 | #include "cfg_signal.h" 45 | #include "cfg_monitor.h" 46 | 47 | 48 | /** 49 | * Left for backwards compatibility. 50 | * Do not use this anymore, will be deprecated soon. 51 | */ 52 | #define CONFIG_KERN_SCHED CONFIG_KERN 53 | 54 | #endif /* CFG_KERN_H */ 55 | -------------------------------------------------------------------------------- /bertos/cfg/cfg_timer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Configuration file for timer module. 34 | * 35 | * 36 | * \author Daniele Basile 37 | */ 38 | 39 | #ifndef CFG_TIMER_H 40 | #define CFG_TIMER_H 41 | 42 | /** 43 | * Hardware timer selection for drv/timer.c. 44 | * $WIZ$ type = "enum" 45 | * $WIZ$ value_list = "timer_select" 46 | */ 47 | #define CONFIG_TIMER TIMER_DEFAULT 48 | 49 | /** 50 | * Debug timer interrupt using a strobe pin. 51 | * $WIZ$ type = "boolean" 52 | */ 53 | #define CONFIG_TIMER_STROBE 0 54 | 55 | /** 56 | * Enable asynchronous timers. 57 | * $WIZ$ type = "boolean" 58 | */ 59 | #define CONFIG_TIMER_EVENTS 1 60 | 61 | /** 62 | * Support hi-res timer_usleep(). 63 | * $WIZ$ type = "boolean" 64 | */ 65 | #define CONFIG_TIMER_UDELAY 1 66 | 67 | #endif /* CFG_TIMER_H */ 68 | -------------------------------------------------------------------------------- /bertos/cfg/depend.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Depend module. 34 | * 35 | * \author Bernie Innocenti 36 | * 37 | */ 38 | 39 | #ifndef CFG_DEPEND_H 40 | #define CFG_DEPEND_H 41 | 42 | #include // STATIC_ASSERT() 43 | 44 | /** 45 | * Compile-time enforcement of dependencies between configuration options 46 | */ 47 | #define CONFIG_DEPEND(FEATURE, DEPS) STATIC_ASSERT(!(FEATURE) || !!(DEPS)) 48 | 49 | #endif // CFG_DEPEND_H 50 | -------------------------------------------------------------------------------- /bertos/cfg/kfile_debug.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief KFile interface over debug. 34 | * 35 | * \author Francesco Sacchi 36 | */ 37 | 38 | #include "kfile_debug.h" 39 | 40 | #include 41 | 42 | #include 43 | 44 | 45 | static size_t kfiledebug_write(struct KFile *_fd, const void *buf, size_t size) 46 | { 47 | KFILEDEBUG_CAST(_fd); 48 | 49 | kprintf("%.*s", (int)size, (const char *)buf); 50 | 51 | return size; 52 | } 53 | 54 | void kfiledebug_init(KFileDebug *kd) 55 | { 56 | ASSERT(kd); 57 | 58 | memset(kd, 0, sizeof(*kd)); 59 | 60 | kfile_init(&kd->fd); 61 | kd->fd.write = kfiledebug_write; 62 | DB(kd->fd._type = KFT_KFILEDEBUG); 63 | } 64 | -------------------------------------------------------------------------------- /bertos/cfg/kfile_debug.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief KFile interface over a debug console. 34 | * 35 | * 36 | * \author Francesco Sacchi 37 | * 38 | * $WIZ$ module_name = "kfiledebug" 39 | * $WIZ$ module_depends = "kfile" 40 | */ 41 | 42 | #ifndef CFG_KFILE_DEBUG 43 | #define CFG_KFILE_DEBUG 44 | 45 | #include 46 | 47 | /** 48 | * Context for KFile over debug console. 49 | */ 50 | typedef struct KFileDebug 51 | { 52 | KFile fd; ///< KFile base class 53 | } KFileDebug; 54 | 55 | /** 56 | * ID for KFileDebug. 57 | */ 58 | #define KFT_KFILEDEBUG MAKE_ID('K', 'D', 'B', 'G') 59 | 60 | /** 61 | * Convert + ASSERT from generic KFile to KFileDebug. 62 | */ 63 | INLINE KFileDebug * KFILEDEBUG_CAST(KFile *fd) 64 | { 65 | ASSERT(fd->_type == KFT_KFILEDEBUG); 66 | return (KFileDebug *)fd; 67 | } 68 | 69 | /** 70 | * Initialize KFileMem struct. 71 | * 72 | * \param km Interface to initialize. 73 | */ 74 | void kfiledebug_init(KFileDebug *km); 75 | 76 | #endif /* CFG_KFILE_DEBUG */ 77 | -------------------------------------------------------------------------------- /bertos/cpu/avr/drv/adc_avr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 31 | * 32 | * \brief ADC hardware-specific definition 33 | * 34 | * \author Francesco Sacchi 35 | */ 36 | 37 | #ifndef DRV_ADC_AVR_H 38 | #define DRV_ADC_AVR_H 39 | 40 | #include 41 | 42 | #if CPU_AVR_ATMEGA1280 || CPU_AVR_ATMEGA2560 43 | /* 16 channels aivailable */ 44 | #define ADC_MUX_MAXCH 15 45 | #else 46 | /* only 8 channels aivailable */ 47 | #define ADC_MUX_MAXCH 7 48 | #endif 49 | #define ADC_BITS 10 50 | 51 | void adc_hw_select_ch(uint8_t ch); 52 | uint16_t adc_hw_read(void); 53 | void adc_hw_init(void); 54 | 55 | #endif /* DRV_ADC_AVR_H */ 56 | -------------------------------------------------------------------------------- /bertos/cpu/avr/drv/flash_avr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \author Francesco Sacchi 34 | * \author Daniele Basile 35 | * 36 | * \brief AVR Internal flash read/write driver. 37 | */ 38 | 39 | #ifndef FLASH_AVR_H 40 | #define FLASH_AVR_H 41 | 42 | #include "cfg/cfg_emb_flash.h" 43 | 44 | #if !CONFIG_FLASH_DISABLE_OLD_API 45 | 46 | /* For backwards compatibility */ 47 | #define FlashAvr Flash 48 | #define flash_avr_init(fls) flash_init(fls); 49 | #endif /* !CONFIG_FLASH_DISABLE_OLD_API */ 50 | 51 | #endif /* DRV_FLASH_AVR_H */ 52 | -------------------------------------------------------------------------------- /bertos/cpu/avr/drv/i2c_avr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Driver for the AVR ATMega TWI (implementation) 34 | * 35 | * \author Daniele Basile 36 | */ 37 | 38 | #ifndef I2C_AVR_H 39 | #define I2C_AVR_H 40 | 41 | #include 42 | 43 | /** 44 | * \name I2C devices enum 45 | */ 46 | enum 47 | { 48 | I2C0, 49 | 50 | I2C_CNT /**< Number of serial ports */ 51 | }; 52 | 53 | #endif /* I2C_LM3S_H */ 54 | 55 | -------------------------------------------------------------------------------- /bertos/cpu/avr/drv/kdebug_avr.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * 34 | * \author Luca Ottaviano 35 | * 36 | * \brief Low-level kdebug module for AVR (inplementation). 37 | */ 38 | 39 | #include 40 | 41 | #if CPU_AVR_MEGA 42 | #include "kdebug_mega.c" 43 | #elif CPU_AVR_XMEGA 44 | #include "kdebug_xmega.c" 45 | #else 46 | #error Unknown CPU 47 | #endif 48 | -------------------------------------------------------------------------------- /bertos/cpu/avr/drv/pwm_avr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Low-level PWM module for AVR (interface). 34 | * 35 | * 36 | * \author Daniele Basile 37 | * 38 | */ 39 | 40 | #ifndef DRV_PWM_AVR_H 41 | #define DRV_PWM_AVR_H 42 | 43 | #include "hw/pwm_map.h" 44 | 45 | #include 46 | 47 | #define PWM_HW_MAX_PRESCALER_STEP 10 48 | #define PWM_HW_MAX_PERIOD 0xFFFF 49 | 50 | /** 51 | * Type definition for pwm period. 52 | */ 53 | typedef uint16_t pwm_period_t; 54 | 55 | /** 56 | * Structur definition for pwm driver. 57 | */ 58 | typedef struct PwmChannel 59 | { 60 | /* */ 61 | } PwmChannel; 62 | 63 | 64 | void pwm_hw_init(void); 65 | void pwm_hw_setFrequency(PwmDev dev, uint32_t freq); 66 | void pwm_hw_setDutyUnlock(PwmDev dev, uint16_t duty); 67 | void pwm_hw_disable(PwmDev dev); 68 | void pwm_hw_enable(PwmDev dev); 69 | void pwm_hw_setPolarity(PwmDev dev, bool pol); 70 | pwm_period_t pwm_hw_getPeriod(PwmDev dev); 71 | 72 | #endif /* DRV_ADC_AT91_H */ 73 | -------------------------------------------------------------------------------- /bertos/cpu/avr/drv/ser_avr.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 33 | * 34 | * \brief AVR UART and SPI I/O driver (Implementation) 35 | * 36 | * \author Onno 37 | * 38 | * This module is automatically included so no need to include 39 | * in test list. 40 | * notest: avr 41 | */ 42 | 43 | #ifndef WIZ_AUTOGEN 44 | #warning This file is deprecated, you should probably use ser_mega.c 45 | 46 | #include 47 | 48 | #if CPU_AVR_MEGA 49 | #include "ser_mega.c" 50 | #elif CPU_AVR_XMEGA 51 | #include "ser_xmega.c" 52 | /*#elif Add other AVR families here */ 53 | #else 54 | #error Unknown CPU 55 | #endif 56 | #endif /* WIZ_AUTOGEN */ 57 | -------------------------------------------------------------------------------- /bertos/cpu/avr/drv/ser_avr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * 34 | * \author Onno 35 | * 36 | * \brief Low-level serial module for AVR (interface). 37 | * 38 | */ 39 | #ifndef SER_AVR_H_ 40 | #define SER_AVR_H_ 41 | 42 | #include 43 | 44 | #if CPU_AVR_MEGA 45 | #include "ser_mega.h" 46 | #elif CPU_AVR_XMEGA 47 | #include "ser_xmega.h" 48 | /*#elif Add other AVR families here */ 49 | #else 50 | #error Unknown CPU 51 | #endif 52 | 53 | #endif /* SER_AVR_H_ */ 54 | -------------------------------------------------------------------------------- /bertos/cpu/avr/drv/stepper_avr.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Low-level stepper timer module for AVR (inplementation). 34 | * 35 | * 36 | * \author Daniele Basile 37 | * 38 | */ 39 | 40 | #include "stepper_avr.h" 41 | 42 | #include "cfg/cfg_stepper.h" 43 | #include 44 | #include 45 | 46 | #include 47 | #include 48 | 49 | 50 | #warning TODO:This is an example, you must implement it! 51 | 52 | ///< Static array of timer counter struct for stepper. 53 | /* 54 | static struct TimerCounter stepper_timers[CONFIG_TC_STEPPER_MAX_NUM] = 55 | { 56 | { //Timer Counter settings for TIO0 output pin 57 | // fill with stepper timer channel settings 58 | } 59 | 60 | // Add here other stepper timer channel settings 61 | }; 62 | */ 63 | 64 | /** 65 | * Timer couter setup. 66 | * 67 | * This function apply to select timer couter all needed settings. 68 | * Every settings are stored in stepper_timers[]. 69 | */ 70 | void stepper_tc_setup(int index, stepper_isr_t callback, struct Stepper *motor) 71 | { 72 | /* Put here the code to setup the stepper timer drive */ 73 | 74 | //Only for test remove when implement this function 75 | (void)index; 76 | (void)callback; 77 | (void)motor; 78 | } 79 | 80 | /** 81 | * Timer counter init. 82 | */ 83 | void stepper_tc_init(void) 84 | { 85 | /* Put here the code to init the stepper timer drive */ 86 | } 87 | 88 | -------------------------------------------------------------------------------- /bertos/cpu/avr/drv/timer_avr.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \author Onno 34 | * 35 | * \brief Low-level timer module for AVR (implementation). 36 | * 37 | * This module is automatically included so no need to include 38 | * in test list. 39 | * notest: avr 40 | */ 41 | 42 | 43 | #ifndef WIZ_AUTOGEN 44 | #warning This file is deprecated, you should probably use timer_mega.c 45 | 46 | #include 47 | 48 | #if CPU_AVR_MEGA 49 | #include "timer_mega.c" 50 | #elif CPU_AVR_XMEGA 51 | #include "timer_xmega.c" 52 | /*#elif Add other AVR families here */ 53 | #else 54 | #error Unknown CPU 55 | #endif 56 | #endif /* WIZ_AUTOGEN */ 57 | 58 | -------------------------------------------------------------------------------- /bertos/cpu/avr/drv/timer_avr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 33 | * 34 | * \brief Low-level timer module for AVR (interface). 35 | * 36 | * \author Onno 37 | * 38 | */ 39 | 40 | #ifndef TIMER_AVR_H_ 41 | #define TIMER_AVR_H_ 42 | 43 | #include 44 | 45 | #if CPU_AVR_MEGA 46 | #include "timer_mega.h" 47 | #elif CPU_AVR_XMEGA 48 | #include "timer_xmega.h" 49 | /*#elif Add other AVR families here */ 50 | #else 51 | #error Unknown CPU 52 | #endif 53 | 54 | 55 | #endif /* TIMER_AVR_H_ */ 56 | -------------------------------------------------------------------------------- /bertos/cpu/avr/drv/timer_simple_avr.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Some simple delay routines. 34 | * 35 | * Simple serial driver 36 | * \author Francesco Sacchi 37 | */ 38 | 39 | #warning FIXME:This module is obsolete, yuo must refactor it. 40 | 41 | #if 0 42 | #include 43 | #include "timer_simple_avr.h" 44 | #include 45 | #include 46 | #include /* BV() */ 47 | 48 | #include 49 | 50 | 51 | #define MS_PER_SEC 1000UL 52 | #define TIMER_PRESCALER 64UL 53 | #define TIMER_DELAY_1MS (255 - CPU_FREQ / TIMER_PRESCALER / MS_PER_SEC) 54 | 55 | /** 56 | * Wait \a time ms using timer 0. 57 | * 58 | */ 59 | void timer_delay(mtime_t time) 60 | { 61 | /* Set timer clock to clock_freq/64 */ 62 | TCCR0 = BV(CS02); 63 | 64 | while (time--) 65 | { 66 | /* Initialize timer counter register */ 67 | TCNT0 = TIMER_DELAY_1MS; 68 | /* Clear overflow bit. */ 69 | TIFR |= BV(TOV0); 70 | /* Wait overflow. */ 71 | while (!(TIFR & BV(TOV0))); 72 | #if CONFIG_WATCHDOG 73 | wdt_reset(); 74 | #endif 75 | } 76 | } 77 | #endif 78 | 79 | -------------------------------------------------------------------------------- /bertos/cpu/avr/drv/timer_simple_avr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 31 | * 32 | * \brief Simple delay routine 33 | * 34 | * \author Francesco Sacchi 35 | */ 36 | 37 | #ifndef DRV_TIMER_SIMPLE_AVR_H 38 | #define DRV_TIMER_SIMPLE_AVR_H 39 | 40 | #warning FIXME:This module is obsolete, yuo must refactor it. 41 | 42 | #if 0 43 | #include 44 | 45 | extern void timer_delay(mtime_t time); 46 | 47 | #endif /* TIMER_SIMPLE_H */ 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /bertos/cpu/avr/drv/wdt_avr.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Watchdog interface for AVR architecture. 34 | * 35 | * \note The avr-libc already provide an api to manage the watchdog on AVR architecture. 36 | * In avr-libc are also available several constants used to set the timeout value 37 | * (see documentation for more detail). 38 | * 39 | * 40 | * \author Daniele Basile 41 | * 42 | */ 43 | 44 | #ifndef DRV_WDT_AVR_H 45 | #define DRV_WDT_AVR_H 46 | 47 | #include "cfg/cfg_wdt.h" 48 | 49 | #include // INLINE 50 | 51 | #include 52 | #include 53 | 54 | /** 55 | * Reset the watchdog timer. 56 | * 57 | * This functions is already defind in avr-libc. 58 | */ 59 | // void wdt_reset(void) 60 | 61 | /** 62 | * Start the watchdog timer that fire at the select 63 | * timeout. 64 | * 65 | * \param _timeout you can use the macro that are defineded in 66 | * avr/wdt.h. 67 | * 68 | * (from avr libc documentation) 69 | * WDTO_15MS 70 | * WDTO_30MS 71 | * WDTO_60MS 72 | * WDTO_120MS 73 | * WDTO_250MS 74 | * WDTO_500MS 75 | * WDTO_1S 76 | * WDTO_2S 77 | * WDTO_4S 78 | * WDTO_8S 79 | */ 80 | INLINE void wdt_start(uint32_t _timeout) 81 | { 82 | uint8_t timeout = _timeout; 83 | 84 | wdt_enable(timeout); 85 | } 86 | 87 | /** 88 | * Stop watchdog timer. 89 | */ 90 | INLINE void wdt_stop(void) 91 | { 92 | wdt_disable(); 93 | } 94 | 95 | 96 | #endif /* DRV_WDT_AVR_H */ 97 | -------------------------------------------------------------------------------- /bertos/cpu/avr/hw/init_xmega.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * 34 | * \author Luca Ottaviano 35 | * 36 | * \brief AVR XMega initialization routine. 37 | * notest:all 38 | */ 39 | #include 40 | #include 41 | 42 | void __init(void) NAKED __attribute__ ((section (".init3"))); 43 | 44 | /* 45 | * Initialize all interrupt priorities present in AVR XMega CPU. 46 | */ 47 | void __init(void) 48 | { 49 | PMIC.CTRL |= PMIC_LOLVLEX_bm | PMIC_MEDLVLEX_bm | PMIC_HILVLEX_bm; 50 | } 51 | -------------------------------------------------------------------------------- /bertos/cpu/avr/hw/switch_avr.S: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #if !(ARCH & ARCH_NIGHTTEST) 4 | #warning This file is deprecated, use switch_ctx_avr.S 5 | #include "switch_ctx_avr.S" 6 | #endif 7 | -------------------------------------------------------------------------------- /bertos/cpu/avr/info/ATmega103.cdef: -------------------------------------------------------------------------------- 1 | # 2 | #-*- coding: utf-8 -*- 3 | # 4 | # \file 5 | # 34 | # 35 | # Cpu info of the ATMega103. 36 | # 37 | # This file contain all info for the BeRTOS wizard. 38 | # 39 | # \author Daniele Basile 40 | # 41 | # 42 | 43 | # Import the common settings for the path. 44 | include("mega.common") 45 | 46 | # Short description of the cpu. 47 | CPU_DESC += [ "128 Kbyte in-System Programmable Flash", 48 | "4 Kbytes internal SRAM memory", 49 | "4 Kbytes EEPROM memory" ] 50 | 51 | # If we use the GCC compiler we should pass some flags. 52 | CORE_CPU = "atmega103" 53 | 54 | include("avr_post.common") 55 | -------------------------------------------------------------------------------- /bertos/cpu/avr/info/ATmega128.cdef: -------------------------------------------------------------------------------- 1 | # 2 | #-*- coding: utf-8 -*- 3 | # 4 | # \file 5 | # 34 | # 35 | # Cpu info of the ATMega128. 36 | # 37 | # This file contain all info for the BeRTOS wizard. 38 | # 39 | # \author Daniele Basile 40 | # 41 | # 42 | 43 | # Import the common settings for the path. 44 | include("mega.common") 45 | 46 | # Short description of the cpu. 47 | CPU_DESC += [ "128 Kbyte in-System Programmable Flash", 48 | "4 Kbytes internal SRAM memory", 49 | "4 bytes EEPROM memory" ] 50 | 51 | # If we use the GCC compiler we should pass some flags. 52 | CORE_CPU = "atmega128" 53 | 54 | include("avr_post.common") 55 | -------------------------------------------------------------------------------- /bertos/cpu/avr/info/ATmega1280.cdef: -------------------------------------------------------------------------------- 1 | # 2 | #-*- coding: utf-8 -*- 3 | # 4 | # \file 5 | # 34 | # 35 | # Cpu info of the ATMega1280. 36 | # 37 | # This file contain all info for the BeRTOS wizard. 38 | # 39 | # \author Daniele Basile 40 | # 41 | # 42 | 43 | 44 | # Import the common settings for the path. 45 | include("mega.common") 46 | 47 | # Short description of the cpu. 48 | CPU_DESC += [ "128 Kbyte in-System Programmable Flash", 49 | "8 Kbytes internal SRAM memory", 50 | "4 Kbytes EEPROM memory" ] 51 | 52 | # If we use the GCC compiler we should pass some flags. 53 | CORE_CPU = "atmega1280" 54 | 55 | include("avr_post.common") 56 | -------------------------------------------------------------------------------- /bertos/cpu/avr/info/ATmega1281.cdef: -------------------------------------------------------------------------------- 1 | # 2 | #-*- coding: utf-8 -*- 3 | # 4 | # \file 5 | # 34 | # 35 | # Cpu info of the ATMega1281. 36 | # 37 | # This file contain all info for the BeRTOS wizard. 38 | # 39 | # \author Daniele Basile 40 | # 41 | # 42 | 43 | 44 | # Import the common settings for the path. 45 | include("mega.common") 46 | 47 | # Short description of the cpu. 48 | CPU_DESC += [ "128 Kbyte in-System Programmable Flash", 49 | "8 Kbytes internal SRAM memory", 50 | "4 Kbytes EEPROM memory" ] 51 | 52 | # If we use the GCC compiler we should pass some flags. 53 | CORE_CPU = "atmega1281" 54 | 55 | include("avr_post.common") 56 | -------------------------------------------------------------------------------- /bertos/cpu/avr/info/ATmega168.cdef: -------------------------------------------------------------------------------- 1 | # 2 | #-*- coding: utf-8 -*- 3 | # 4 | # \file 5 | # 34 | # 35 | # Cpu info of the ATMega168. 36 | # 37 | # This file contain all info for the BeRTOS wizard. 38 | # 39 | # \author Daniele Basile 40 | # 41 | # 42 | 43 | # Import the common settings for the path. 44 | include("mega.common") 45 | 46 | # Short description of the cpu. 47 | CPU_DESC += [ "16 Kbyte in-System Programmable Flash", 48 | "1 Kbytes internal SRAM memory", 49 | "512 bytes EEPROM memory" ] 50 | 51 | # If we use the GCC compiler we should pass some flags. 52 | CORE_CPU = "atmega168" 53 | 54 | include("avr_post.common") 55 | -------------------------------------------------------------------------------- /bertos/cpu/avr/info/ATmega2560.cdef: -------------------------------------------------------------------------------- 1 | # 2 | #-*- coding: utf-8 -*- 3 | # 4 | # \file 5 | # 34 | # 35 | # Cpu info of the ATMega2560. 36 | # 37 | # This file contain all info for the BeRTOS wizard. 38 | # 39 | # \author Daniele Basile 40 | # 41 | # 42 | 43 | 44 | # Import the common settings for the path. 45 | include("mega.common") 46 | 47 | # Short description of the cpu. 48 | CPU_DESC += [ "256 Kbyte in-System Programmable Flash", 49 | "8 Kbytes internal SRAM memory", 50 | "4 Kbytes EEPROM memory" ] 51 | 52 | # If we use the GCC compiler we should pass some flags. 53 | CORE_CPU = "atmega2560" 54 | 55 | include("avr_post.common") 56 | -------------------------------------------------------------------------------- /bertos/cpu/avr/info/ATmega32.cdef: -------------------------------------------------------------------------------- 1 | # 2 | #-*- coding: utf-8 -*- 3 | # 4 | # \file 5 | # 34 | # 35 | # Cpu info of the ATMega32. 36 | # 37 | # This file contain all info for the BeRTOS wizard. 38 | # 39 | # \author Daniele Basile 40 | # 41 | # 42 | 43 | # Import the common settings for the path. 44 | include("mega.common") 45 | 46 | # Short description of the cpu. 47 | CPU_DESC += [ "32 Kbyte in-System Programmable Flash", 48 | "2 Kbytes internal SRAM memory", 49 | "1 Kbytes EEPROM memory" ] 50 | 51 | # If we use the GCC compiler we should pass some flags. 52 | CORE_CPU = "atmega32" 53 | 54 | include("avr_post.common") 55 | -------------------------------------------------------------------------------- /bertos/cpu/avr/info/ATmega328P.cdef: -------------------------------------------------------------------------------- 1 | # 2 | #-*- coding: utf-8 -*- 3 | # 4 | # \file 5 | # 34 | # 35 | # Cpu info of the ATMega328P. 36 | # 37 | # This file contain all info for the BeRTOS wizard. 38 | # 39 | # \author Luca Ottaviano 40 | # 41 | # 42 | 43 | # Import the common settings for the path. 44 | include("mega.common") 45 | 46 | # Short description of the cpu. 47 | CPU_DESC += [ "Arduino Duemilanove", 48 | "32 Kbyte in-System Programmable Flash", 49 | "2 Kbytes internal SRAM memory", 50 | "1 Kbyte EEPROM memory" ] 51 | 52 | # If we use the GCC compiler we should pass some flags. 53 | CORE_CPU = "atmega328p" 54 | 55 | include("avr_post.common") 56 | -------------------------------------------------------------------------------- /bertos/cpu/avr/info/ATmega64.cdef: -------------------------------------------------------------------------------- 1 | # 2 | #-*- coding: utf-8 -*- 3 | # 4 | # \file 5 | # 34 | # 35 | # Cpu info of the ATMega64. 36 | # 37 | # This file contain all info for the BeRTOS wizard. 38 | # 39 | # \author Daniele Basile 40 | # 41 | # 42 | 43 | # Import the common settings for the path. 44 | include("mega.common") 45 | 46 | # Short description of the cpu. 47 | CPU_DESC += [ "64 Kbyte in-System Programmable Flash", 48 | "4 Kbytes internal SRAM memory", 49 | "2 Kbytes EEPROM memory" ] 50 | 51 | # If we use the GCC compiler we should pass some flags. 52 | CORE_CPU = "atmega64" 53 | 54 | include("avr_post.common") 55 | -------------------------------------------------------------------------------- /bertos/cpu/avr/info/ATmega8.cdef: -------------------------------------------------------------------------------- 1 | # 2 | #-*- coding: utf-8 -*- 3 | # 4 | # \file 5 | # 34 | # 35 | # Cpu info of the ATMega8. 36 | # 37 | # This file contain all info for the BeRTOS wizard. 38 | # 39 | # \author Daniele Basile 40 | # 41 | # 42 | 43 | # Import the common settings for the path. 44 | include("mega.common") 45 | 46 | # Short description of the cpu. 47 | CPU_DESC += [ "8 Kbyte in-System Programmable Flash", 48 | "1 Kbytes internal SRAM memory", 49 | "512 bytes EEPROM memory" ] 50 | 51 | # If we use the GCC compiler we should pass some flags. 52 | CORE_CPU = "atmega8" 53 | 54 | include("avr_post.common") 55 | -------------------------------------------------------------------------------- /bertos/cpu/avr/info/ATxmega32D4.cdef: -------------------------------------------------------------------------------- 1 | # 2 | #-*- coding: utf-8 -*- 3 | # 4 | # \file 5 | # 32 | # 33 | # Cpu info of the ATxmega32D4. 34 | # 35 | # This file contain all info for the BeRTOS wizard. 36 | # 37 | # \author Onno 38 | # 39 | # 40 | 41 | 42 | # Import the common settings for the path. 43 | include("avr.common") 44 | 45 | # Short description of the cpu. 46 | CPU_DESC += [ "32 Kbyte in-System Programmable Flash", 47 | "4 Kbyte Boot Code Section with Independent Lock Bits", 48 | "4 Kbyte internal SRAM memory", 49 | "1 Kbyte EEPROM memory" ] 50 | 51 | # If we use the GCC compiler we should pass some flags. 52 | CORE_CPU = "atxmega32d4" 53 | HW_DIR = CPU_DIR + "avr/hw/" 54 | MK_CPU_CSRC = HW_DIR + "init_xmega.c" 55 | 56 | include("avr_post.common") 57 | -------------------------------------------------------------------------------- /bertos/cpu/avr/info/avr.common: -------------------------------------------------------------------------------- 1 | # 2 | #-*- coding: utf-8 -*- 3 | # 4 | # \file 5 | # 34 | # 35 | # General CPU info denfinition AVR family. 36 | # 37 | # This file contain all info for the BeRTOS wizard. 38 | # 39 | # \author Daniele Basile 40 | # 41 | # 42 | 43 | # Import the common settings for the path. 44 | include("../../path.common") 45 | 46 | # Short description of the cpu. 47 | CPU_DESC = [ "ATMEL AVR Microcontroller ", 48 | "8-bit RISC Architecture"] 49 | 50 | # Type of the toolchain we should use to compile the source for this CPU. 51 | TOOLCHAIN = "avr" 52 | 53 | # Special CPU related tags. 54 | CPU_TAGS = ["harvard", TOOLCHAIN] 55 | 56 | # CPU default clock frequency 57 | CPU_DEFAULT_FREQ = "8000000UL" 58 | 59 | # Where are locate the bertos directories 60 | SCRIPT_DIR = CPU_DIR + "avr/scripts/" 61 | 62 | MK_FLASH_SCRIPT = PRG_SCRIPTS_DIR + "avr/flash.sh" 63 | MK_STOPFLASH_SCRIPT = PRG_SCRIPTS_DIR + "avr/stopflash.sh" 64 | MK_DEBUG_SCRIPT = PRG_SCRIPTS_DIR + "nodebug.sh" 65 | MK_STOPDEBUG_SCRIPT = PRG_SCRIPTS_DIR + "none.sh" 66 | 67 | # Common GCC flags. 68 | MK_CPU_CPPFLAGS = "-Os -I" + CPU_DIR + "avr/" 69 | 70 | -------------------------------------------------------------------------------- /bertos/cpu/avr/info/avr_post.common: -------------------------------------------------------------------------------- 1 | 2 | # CPU type used for flashing 3 | MK_PROGRAMMER_CPU = CORE_CPU 4 | 5 | # Name of the flag used by the build system to pass to the compiler the CPU type. 6 | MK_MCU = CORE_CPU 7 | 8 | # Add CPU core to tags 9 | CPU_TAGS += [ CORE_CPU ] 10 | -------------------------------------------------------------------------------- /bertos/cpu/avr/info/mega.common: -------------------------------------------------------------------------------- 1 | # 2 | #-*- coding: utf-8 -*- 3 | # 4 | # \file 5 | # 34 | # 35 | # General CPU info denfinition AVR family. 36 | # 37 | # This file contain all info for the BeRTOS wizard. 38 | # 39 | # \author Daniele Basile 40 | # 41 | # 42 | 43 | # Import the common settings for the path. 44 | include("avr.common") 45 | 46 | # Special CPU related tags. 47 | CPU_TAGS += ["mega"] 48 | 49 | -------------------------------------------------------------------------------- /bertos/cpu/byteorder_test.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief byteorder.h macros test. 34 | * 35 | * \author Francesco Sacchi 36 | */ 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | #include "byteorder.h" 43 | 44 | int byteorder_testSetup(void) 45 | { 46 | kdbg_init(); 47 | return 0; 48 | } 49 | 50 | int byteorder_testTearDown(void) 51 | { 52 | return 0; 53 | } 54 | 55 | int byteorder_testRun(void) 56 | { 57 | float a; 58 | float b; 59 | float c; 60 | 61 | for (a = 0; a < 12345; a += 0.01) 62 | { 63 | b = swab_float(a); 64 | c = swab_float(b); 65 | // kprintf("a=%08lX, b=%08lX, c=%08lX\n", *((uint32_t *)&a), *((uint32_t *)&b), *((uint32_t *)&c)); 66 | ASSERT(a == c); 67 | } 68 | return 0; 69 | } 70 | 71 | TEST_MAIN(byteorder); 72 | -------------------------------------------------------------------------------- /bertos/cpu/newcore: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIRS="drv hw io scripts" 4 | if [ $# != 1 ]; then 5 | echo "Create a new core tree with subdirs:" 6 | echo $DIRS 7 | echo "usage $0 " 8 | exit 1 9 | fi 10 | CORE=$1 11 | mkdir $CORE 12 | cd $CORE 13 | for dir in $DIRS 14 | do 15 | mkdir $dir 16 | done 17 | cd .. 18 | -------------------------------------------------------------------------------- /bertos/cpu/path.common: -------------------------------------------------------------------------------- 1 | # 2 | #-*- coding: utf-8 -*- 3 | # 4 | # \file 5 | # 34 | # 35 | # BeRTOS common path info. 36 | # 37 | # This file contain all info for the BeRTOS wizard. 38 | # 39 | # \author Daniele Basile 40 | # 41 | # 42 | 43 | # BeRTOS cpu directory 44 | CPU_DIR = "bertos/cpu/" 45 | 46 | PRG_SCRIPTS_DIR = "bertos/prg_scripts/" 47 | -------------------------------------------------------------------------------- /bertos/drv/adc.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief ADC driver (implementation) 34 | * 35 | * \author Francesco Sacchi 36 | */ 37 | 38 | #include 39 | 40 | #ifndef WIZ_AUTOGEN 41 | #warning Deprecated: now you should include adc_ directly in the makefile. Remove this line and the following once done. 42 | #include CPU_CSOURCE(adc) 43 | #else 44 | #include CPU_HEADER(adc) 45 | #endif 46 | 47 | #include // ASSERT() 48 | #include // MIN() 49 | #include 50 | #include 51 | 52 | /** 53 | * Read the ADC channel \a ch. 54 | */ 55 | adcread_t adc_read(adc_ch_t ch) 56 | { 57 | ASSERT(ch <= (adc_ch_t)ADC_MUX_MAXCH); 58 | ch = MIN(ch, (adc_ch_t)ADC_MUX_MAXCH); 59 | 60 | adc_hw_select_ch(ch); 61 | 62 | return(adc_hw_read()); 63 | } 64 | 65 | MOD_DEFINE(adc); 66 | 67 | /** 68 | * Initialize the ADC hardware. 69 | */ 70 | void adc_init(void) 71 | { 72 | adc_hw_init(); 73 | 74 | MOD_INIT(adc); 75 | } 76 | -------------------------------------------------------------------------------- /bertos/drv/adc.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \defgroup adc Generic ADC driver 34 | * \ingroup drivers 35 | * \{ 36 | * \brief Analog to Digital Converter driver (ADC). 37 | * 38 | * Configuration file: cfg_adc.h 39 | * 40 | * \author Francesco Sacchi 41 | * 42 | * $WIZ$ module_name = "adc" 43 | * $WIZ$ module_configuration = "bertos/cfg/cfg_adc.h" 44 | * $WIZ$ module_supports = "not atmega103" 45 | */ 46 | 47 | 48 | #ifndef DRV_ADC_H 49 | #define DRV_ADC_H 50 | 51 | #include 52 | #include 53 | #include 54 | #include CPU_HEADER(adc) 55 | 56 | /** Type for ADC return value. */ 57 | typedef uint16_t adcread_t; 58 | 59 | /** Type for channel */ 60 | typedef uint8_t adc_ch_t; 61 | 62 | #define adc_bits() ADC_BITS 63 | 64 | adcread_t adc_read(adc_ch_t ch); 65 | void adc_init(void); 66 | 67 | /** 68 | * Macro used to convert data from adc range (0...(2 ^ADC_BITS - 1)) to 69 | * \a y1 ... \a y2 range. 70 | * \note \a y1, \a y2 can be negative, and put in ascending or descending order as well. 71 | * \note \a data and \a y2 are evaluated only once, \a y1 twice. 72 | */ 73 | #define ADC_RANGECONV(data, y1, y2) (((((int32_t)(data)) * ((y2) - (y1))) / ((1 << ADC_BITS) - 1)) + (y1)) 74 | 75 | /** \} */ //defgroup adc 76 | #endif /* DRV_ADC_H */ 77 | -------------------------------------------------------------------------------- /bertos/drv/ser_p.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Hardware dependent serial driver (interface) 34 | * 35 | * 36 | * \author Stefano Fedrigo 37 | * \author Giovanni Bajo 38 | */ 39 | 40 | 41 | #ifndef DRV_SER_P_H 42 | #define DRV_SER_P_H 43 | 44 | #include /* size_t */ 45 | 46 | 47 | 48 | struct SerialHardware; 49 | struct Serial; 50 | 51 | struct SerialHardwareVT 52 | { 53 | void (*init)(struct SerialHardware *ctx, struct Serial *ser); 54 | void (*cleanup)(struct SerialHardware *ctx); 55 | void (*setBaudrate)(struct SerialHardware *ctx, unsigned long rate); 56 | void (*setParity)(struct SerialHardware *ctx, int parity); 57 | void (*txStart)(struct SerialHardware *ctx); 58 | bool (*txSending)(struct SerialHardware *ctx); 59 | }; 60 | 61 | struct SerialHardware 62 | { 63 | const struct SerialHardwareVT *table; 64 | unsigned char *txbuffer; 65 | unsigned char *rxbuffer; 66 | size_t txbuffer_size; 67 | size_t rxbuffer_size; 68 | }; 69 | 70 | struct SerialHardware *ser_hw_getdesc(int unit); 71 | 72 | 73 | 74 | #endif /* DRV_SER_P_H */ 75 | -------------------------------------------------------------------------------- /bertos/hw/hw_boot.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Bootloader hardware specific definition. 34 | * 35 | * \author Daniele Basile 36 | */ 37 | 38 | #ifndef HW_BOOT_H 39 | #define HW_BOOT_H 40 | 41 | /** 42 | * Define bootloader flash size. 43 | * 44 | * Note: Remember that this size should be comply 45 | * to size defined in linker script, otherwise you 46 | * could not find the main program application. 47 | */ 48 | #define FLASH_BOOT_SIZE 0x8000 // 32kbyte 49 | 50 | #endif /* HW_BOOT_H */ 51 | -------------------------------------------------------------------------------- /bertos/hw/hw_cpufreq.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Hardware-specific definitions 34 | * 35 | * 36 | * \author Francesco Sacchi 37 | */ 38 | 39 | #ifndef HW_CPUFREQ_H 40 | #define HW_CPUFREQ_H 41 | 42 | #ifndef CPU_FREQ 43 | #warning CPU_FREQ is not defined, you should upgrade to the newer clock frequency defining method. 44 | 45 | /* 46 | * This file is DEPRECATED, it will be removed in the next major release. 47 | * We have set up a new cpu frequency definition method. 48 | * The new macro CPU_FREQ should be defined as a compiler flag in the 49 | * makefile instead of the old CLOCK_FREQ macro. With new projects you should only 50 | * use the CPU_FREQ macro. 51 | * 52 | * With gcc you should add something like this: 53 | * 54 | * -D'CPU_FREQ=(12288000UL)' 55 | * 56 | * For backward compatibility the old method is still supported. 57 | */ 58 | #include "hw/hw_cpu.h" 59 | 60 | #define CPU_FREQ (CLOCK_FREQ) 61 | #endif /* CPU_FREQ */ 62 | 63 | #endif /* HW_CPUFREQ_H */ 64 | -------------------------------------------------------------------------------- /bertos/hw/hw_ser.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Serial hardware-specific definitions 34 | * 35 | * 36 | * \author Daniele Basile 37 | */ 38 | 39 | #ifndef HW_SER_H 40 | #define HW_SER_H 41 | 42 | #include "cfg/cfg_ser.h" 43 | 44 | #if CONFIG_SER_STROBE 45 | #warning FIXME: this is an example implementation, you must implement it 46 | 47 | #define SER_STROBE_INIT do { /* implement me */ } while (0) 48 | #define SER_STROBE_ON do { /* implement me */ } while (0) 49 | #define SER_STROBE_OFF do { /* implement me */ } while (0) 50 | #endif 51 | 52 | #endif /* HW_SER_H */ 53 | -------------------------------------------------------------------------------- /bertos/hw/hw_timer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Timer hardware-specific definitions 34 | * 35 | * 36 | * \author Francesco Sacchi 37 | */ 38 | 39 | #ifndef HW_TIMER_H 40 | #define HW_TIMER_H 41 | 42 | #include "cfg/cfg_timer.h" 43 | 44 | #if CONFIG_TIMER_STROBE 45 | #warning TODO:This is an example implementation, you must implement it! 46 | #define TIMER_STROBE_INIT do { /* implement me */ } while (0) 47 | #define TIMER_STROBE_ON do { /* implement me */ } while (0) 48 | #define TIMER_STROBE_OFF do { /* implement me */ } while (0) 49 | #endif 50 | 51 | #endif /* HW_TIMER_H */ 52 | -------------------------------------------------------------------------------- /bertos/io/kblock_posix.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \author Francesco Sacchi 34 | * 35 | * \brief KBlock interface on POSIX file. 36 | * 37 | * \author Francesco Sacchi 38 | * 39 | * $WIZ$ module_name = "kfile_posix" 40 | * $WIZ$ module_depends = "kblock" 41 | */ 42 | 43 | #ifndef KBLOCK_POSIX_H 44 | #define KBLOCK_POSIX_H 45 | 46 | #include "kblock.h" 47 | 48 | #include 49 | 50 | typedef struct KBlockPosix 51 | { 52 | KBlock b; 53 | FILE *fp; 54 | } KBlockPosix; 55 | 56 | #define KBT_KBLOCKPOSIX MAKE_ID('K', 'B', 'F', 'L') 57 | 58 | 59 | INLINE KBlockPosix *KBLOCKPOSIX_CAST(KBlock *b) 60 | { 61 | ASSERT(b->priv.type == KBT_KBLOCKPOSIX); 62 | return (KBlockPosix *)b; 63 | } 64 | 65 | void kblockposix_init(KBlockPosix *f, FILE *fp, bool hwbuf, void *buf, size_t block_size, block_idx_t block_count); 66 | 67 | #endif /* KBLOCK_POSIX_H */ 68 | -------------------------------------------------------------------------------- /bertos/io/kblock_ram.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief KBlock interface 34 | * 35 | * \author Francesco Sacchi 36 | */ 37 | 38 | #ifndef KBLOCK_RAM_H 39 | #define KBLOCK_RAM_H 40 | 41 | #include "kblock.h" 42 | 43 | 44 | typedef struct KBlockRam 45 | { 46 | KBlock b; 47 | uint8_t *membuf; 48 | } KBlockRam; 49 | 50 | #define KBT_KBLOCKRAM MAKE_ID('K', 'B', 'R', 'M') 51 | 52 | 53 | INLINE KBlockRam *KBLOCKRAM_CAST(KBlock *b) 54 | { 55 | ASSERT(b->priv.type == KBT_KBLOCKRAM); 56 | return (KBlockRam *)b; 57 | } 58 | 59 | void kblockram_init(KBlockRam *ram, void *buf, size_t size, size_t block_size, bool buffered, bool hwbuffered); 60 | 61 | #endif /* KBLOCK_RAM_H */ 62 | -------------------------------------------------------------------------------- /bertos/io/reblock.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief KBlock block size reducer 34 | * 35 | * \author Stefano Fedrigo 36 | * 37 | * $WIZ$ module_name = "reblock" 38 | * $WIZ$ module_depends = "kblock" 39 | */ 40 | 41 | #ifndef REBLOCK_H 42 | #define REBLOCK_H 43 | 44 | #include "kblock.h" 45 | 46 | 47 | typedef struct Reblock 48 | { 49 | KBlock fd; 50 | KBlock *native_fd; 51 | } Reblock; 52 | 53 | #define KBT_REBLOCK MAKE_ID('R', 'E', 'B', 'L') 54 | 55 | 56 | INLINE Reblock *REBLOCK_CAST(KBlock *b) 57 | { 58 | ASSERT(b->priv.type == KBT_REBLOCK); 59 | return (Reblock *)b; 60 | } 61 | 62 | void reblock_init(Reblock *rbl, KBlock *native_fd, size_t native_blk_size); 63 | 64 | #endif /* REBLOCK_H */ 65 | -------------------------------------------------------------------------------- /bertos/kern/coop.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | */ 33 | -------------------------------------------------------------------------------- /bertos/kern/irq.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 31 | * 32 | * \brief Process scheduler (public interface). 33 | * 34 | * \author Bernie Innocenti 35 | * 36 | * Still in development, disable nightly test for now 37 | * notest: avr 38 | * notest: arm 39 | */ 40 | #include "irq.h" 41 | 42 | #include 43 | #include 44 | #include 45 | 46 | #include "cfg/cfg_proc.h" 47 | 48 | #include // FIXME: move POSIX stuff to irq_posix.h 49 | 50 | MOD_DEFINE(irq) 51 | 52 | // FIXME 53 | static void (*irq_handlers[100])(void); 54 | 55 | /* signal handler */ 56 | void irq_entry(int signum) 57 | { 58 | irq_handlers[signum](); 59 | } 60 | 61 | void irq_register(int irq, void (*callback)(void)) 62 | { 63 | irq_handlers[irq] = callback; 64 | } 65 | 66 | void irq_init(void) 67 | { 68 | struct sigaction act; 69 | 70 | act.sa_handler = irq_entry; 71 | sigemptyset(&act.sa_mask); 72 | //sigaddset(&act.sa_mask, irq); 73 | act.sa_flags = SA_RESTART; // | SA_SIGINFO; 74 | 75 | sigaction(SIGUSR1, &act, NULL); 76 | sigaction(SIGALRM, &act, NULL); 77 | 78 | MOD_INIT(irq); 79 | } 80 | -------------------------------------------------------------------------------- /bertos/kern/irq.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 31 | * 32 | * \brief Process scheduler (public interface). 33 | * 34 | * \author Bernie Innocenti 35 | */ 36 | #ifndef KERN_IRQ_H 37 | #define KERN_IRQ_H 38 | 39 | void irq_entry(int irq); 40 | void irq_register(int irq, void (*handler)(void)); 41 | void irq_init(void); 42 | 43 | #endif // KERN_IRQ_H 44 | -------------------------------------------------------------------------------- /bertos/kern/kfile.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * notest: all 33 | * 34 | */ 35 | 36 | #warning "This file is deprecated, include the new " 37 | #include 38 | -------------------------------------------------------------------------------- /bertos/kern/preempt.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | */ 33 | -------------------------------------------------------------------------------- /bertos/kern/proc_test/coop_msg_test.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Message test. 34 | * 35 | * 36 | * \author Daniele Basile 37 | * 38 | * $test$: cp bertos/cfg/cfg_proc.h $cfgdir/ 39 | * $test$: echo "#undef CONFIG_KERN" >> $cfgdir/cfg_proc.h 40 | * $test$: echo "#define CONFIG_KERN 1" >> $cfgdir/cfg_proc.h 41 | * $test$: cp bertos/cfg/cfg_signal.h $cfgdir/ 42 | * $test$: echo "#undef CONFIG_KERN_SIGNALS" >> $cfgdir/cfg_signal.h 43 | * $test$: echo "#define CONFIG_KERN_SIGNALS 1" >> $cfgdir/cfg_signal.h 44 | * 45 | * notest: all 46 | */ 47 | 48 | #include "../msg_test.c" 49 | -------------------------------------------------------------------------------- /bertos/kern/proc_test/coop_sem_test.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 31 | * 32 | * \brief Semaphore test. 33 | * 34 | * 35 | * \author Daniele Basile 36 | * \author Stefano Fedrigo 37 | * 38 | * $test$: cp bertos/cfg/cfg_proc.h $cfgdir/ 39 | * $test$: echo "#undef CONFIG_KERN" >> $cfgdir/cfg_proc.h 40 | * $test$: echo "#define CONFIG_KERN 1" >> $cfgdir/cfg_proc.h 41 | * $test$: cp bertos/cfg/cfg_sem.h $cfgdir/ 42 | * $test$: echo "#undef CONFIG_KERN_SEMAPHORES" >> $cfgdir/cfg_sem.h 43 | * $test$: echo "#define CONFIG_KERN_SEMAPHORES 1" >> $cfgdir/cfg_sem.h 44 | * 45 | * notest:all 46 | */ 47 | 48 | #include "../sem_test.c" 49 | -------------------------------------------------------------------------------- /bertos/kern/proc_test/coop_signal_test.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Signals test. 34 | * 35 | * 36 | * \author Daniele Basile 37 | * 38 | * $test$: cp bertos/cfg/cfg_proc.h $cfgdir/ 39 | * $test$: echo "#undef CONFIG_KERN" >> $cfgdir/cfg_proc.h 40 | * $test$: echo "#define CONFIG_KERN 1" >> $cfgdir/cfg_proc.h 41 | * $test$: cp bertos/cfg/cfg_signal.h $cfgdir/ 42 | * $test$: echo "#undef CONFIG_KERN_SIGNALS" >> $cfgdir/cfg_signal.h 43 | * $test$: echo "#define CONFIG_KERN_SIGNALS 1" >> $cfgdir/cfg_signal.h 44 | * 45 | * notest: all 46 | */ 47 | 48 | #include "../signal_test.c" 49 | -------------------------------------------------------------------------------- /bertos/kern/proc_test/coop_test.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 31 | * 32 | * 33 | * \brief Test kernel preemption. 34 | * 35 | * This testcase spawns TASKS parallel threads that runs for TIME seconds. They 36 | * continuously spin updating a global counter (one counter for each thread). 37 | * 38 | * At exit each thread checks if the others have been che chance to update 39 | * their own counter. If not, it means the preemption didn't occur and the 40 | * testcase returns an error message. 41 | * 42 | * Otherwise, if all the threads have been able to update their own counter it 43 | * means preemption successfully occurs, since there is no active sleep inside 44 | * each thread's implementation. 45 | * 46 | * \author Andrea Righi 47 | * 48 | * $test$: cp bertos/cfg/cfg_proc.h $cfgdir/ 49 | * $test$: echo "#undef CONFIG_KERN" >> $cfgdir/cfg_proc.h 50 | * $test$: echo "#define CONFIG_KERN 1" >> $cfgdir/cfg_proc.h 51 | * $test$: cp bertos/cfg/cfg_monitor.h $cfgdir/ 52 | * $test$: sed -i "s/CONFIG_KERN_MONITOR 0/CONFIG_KERN_MONITOR 1/" $cfgdir/cfg_monitor.h 53 | * $test$: cp bertos/cfg/cfg_signal.h $cfgdir/ 54 | * $test$: echo "#undef CONFIG_KERN_SIGNALS" >> $cfgdir/cfg_signal.h 55 | * $test$: echo "#define CONFIG_KERN_SIGNALS 1" >> $cfgdir/cfg_signal.h 56 | * 57 | * notest: all 58 | */ 59 | 60 | #include "../proc_test.c" 61 | -------------------------------------------------------------------------------- /bertos/kern/proc_test/preempt_msg_test.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Message test. 34 | * 35 | * 36 | * \author Daniele Basile 37 | * 38 | * $test$: cp bertos/cfg/cfg_proc.h $cfgdir/ 39 | * $test$: echo "#undef CONFIG_KERN" >> $cfgdir/cfg_proc.h 40 | * $test$: echo "#define CONFIG_KERN 1" >> $cfgdir/cfg_proc.h 41 | * $test$: echo "#undef CONFIG_KERN_PREEMPT" >> $cfgdir/cfg_proc.h 42 | * $test$: echo "#define CONFIG_KERN_PREEMPT 1" >> $cfgdir/cfg_proc.h 43 | * $test$: cp bertos/cfg/cfg_signal.h $cfgdir/ 44 | * $test$: echo "#undef CONFIG_KERN_SIGNALS" >> $cfgdir/cfg_signal.h 45 | * $test$: echo "#define CONFIG_KERN_SIGNALS 1" >> $cfgdir/cfg_signal.h 46 | * 47 | * notest:all 48 | */ 49 | 50 | #include "../msg_test.c" 51 | -------------------------------------------------------------------------------- /bertos/kern/proc_test/preempt_sem_test.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 31 | * 32 | * \brief Semaphore test. 33 | * 34 | * 35 | * \author Daniele Basile 36 | * \author Stefano Fedrigo 37 | * 38 | * $test$: cp bertos/cfg/cfg_proc.h $cfgdir/ 39 | * $test$: echo "#undef CONFIG_KERN" >> $cfgdir/cfg_proc.h 40 | * $test$: echo "#define CONFIG_KERN 1" >> $cfgdir/cfg_proc.h 41 | * $test$: echo "#undef CONFIG_KERN_PREEMPT" >> $cfgdir/cfg_proc.h 42 | * $test$: echo "#define CONFIG_KERN_PREEMPT 1" >> $cfgdir/cfg_proc.h 43 | * $test$: cp bertos/cfg/cfg_sem.h $cfgdir/ 44 | * $test$: echo "#undef CONFIG_KERN_SEMAPHORES" >> $cfgdir/cfg_sem.h 45 | * $test$: echo "#define CONFIG_KERN_SEMAPHORES 1" >> $cfgdir/cfg_sem.h 46 | * 47 | * notest:all 48 | */ 49 | 50 | #include "../sem_test.c" 51 | -------------------------------------------------------------------------------- /bertos/kern/proc_test/preempt_signal_test.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Signals test. 34 | * 35 | * 36 | * \author Daniele Basile 37 | * 38 | * $test$: cp bertos/cfg/cfg_proc.h $cfgdir/ 39 | * $test$: echo "#undef CONFIG_KERN" >> $cfgdir/cfg_proc.h 40 | * $test$: echo "#define CONFIG_KERN 1" >> $cfgdir/cfg_proc.h 41 | * $test$: echo "#undef CONFIG_KERN_PREEMPT" >> $cfgdir/cfg_proc.h 42 | * $test$: echo "#define CONFIG_KERN_PREEMPT 1" >> $cfgdir/cfg_proc.h 43 | * $test$: cp bertos/cfg/cfg_signal.h $cfgdir/ 44 | * $test$: echo "#undef CONFIG_KERN_SIGNALS" >> $cfgdir/cfg_signal.h 45 | * $test$: echo "#define CONFIG_KERN_SIGNALS 1" >> $cfgdir/cfg_signal.h 46 | * 47 | * notest: all 48 | */ 49 | 50 | #include "../signal_test.c" 51 | -------------------------------------------------------------------------------- /bertos/kern/sem.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 33 | * 34 | * \defgroup kern_sem Mutually exclusive semaphores 35 | * \ingroup kern 36 | * \{ 37 | * \brief Mutually exclusive semaphores. 38 | * Shared locking not supported in this implementation. 39 | * 40 | * 41 | * \author Bernie Innocenti 42 | * 43 | * $WIZ$ module_name = "semaphores" 44 | * $WIZ$ module_depends = "kernel" 45 | * $WIZ$ module_configuration = "bertos/cfg/cfg_sem.h" 46 | */ 47 | 48 | 49 | #ifndef KERN_SEM_H 50 | #define KERN_SEM_H 51 | 52 | #include 53 | #include 54 | 55 | /* Fwd decl */ 56 | struct Process; 57 | 58 | 59 | typedef struct Semaphore 60 | { 61 | struct Process *owner; 62 | List wait_queue; 63 | int nest_count; 64 | } Semaphore; 65 | 66 | /** 67 | * \name Process synchronization services 68 | * \{ 69 | */ 70 | void sem_init(struct Semaphore *s); 71 | bool sem_attempt(struct Semaphore *s); 72 | void sem_obtain(struct Semaphore *s); 73 | void sem_release(struct Semaphore *s); 74 | /* \} */ 75 | /* \} */ //defgroup kern_sem 76 | 77 | int sem_testRun(void); 78 | int sem_testSetup(void); 79 | int sem_testTearDown(void); 80 | 81 | #endif /* KERN_SEM_H */ 82 | -------------------------------------------------------------------------------- /bertos/mware/blanker.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Display Blanker (implementation). 34 | * 35 | * 36 | * \author Bernie Innocenti 37 | */ 38 | #ifndef MWARE_BLANKER_H 39 | #define MWARE_BLANKER_H 40 | 41 | extern void blk_enable(void); 42 | extern void blk_disable(void); 43 | extern void blk_retrigger(void); 44 | 45 | #endif /* MWARE_BLANKER_H */ 46 | -------------------------------------------------------------------------------- /bertos/mware/byteorder.h: -------------------------------------------------------------------------------- 1 | #warning This header is OBSOLETE 2 | #include 3 | -------------------------------------------------------------------------------- /bertos/mware/hex.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 31 | * 32 | * \brief Poor man's hex arrays (implementation). 33 | * 34 | * \author Bernie Innocenti 35 | */ 36 | 37 | 38 | #include "hex.h" 39 | 40 | const char hex_tab[16] = { '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f' }; 41 | const char HEX_tab[16] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' }; 42 | -------------------------------------------------------------------------------- /bertos/mware/hex.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Poor man's hex arrays (implementation). 34 | * 35 | * 36 | * \author Bernie Innocenti 37 | */ 38 | 39 | #ifndef MWARE_HEX_H 40 | #define MWARE_HEX_H 41 | 42 | extern const char hex_tab[16]; 43 | extern const char HEX_tab[16]; 44 | 45 | #endif /* MWARE_HEX_H */ 46 | -------------------------------------------------------------------------------- /bertos/mware/messages.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Messages for LCD. 34 | * 35 | * 36 | * \author Bernie Innocenti 37 | * \author Stefano Fedrigo 38 | */ 39 | 40 | #include "messages.h" 41 | 42 | /** 43 | * Array of pointers to localized strings. Should be filled 44 | * by localization stuff, but not for now. 45 | */ 46 | const char *msg_strings[MSG_COUNT] = { 47 | 0, 48 | // TODO: add your strings here 49 | }; 50 | 51 | /* Buffer for catalog file */ 52 | /* char msg_buf[MSG_BUFSIZE]; */ 53 | 54 | 55 | /* The following does not work (move string tables into the DMSG/CMSG segments) 56 | * #pragma memory=dataseg(DMSG) 57 | * #pragma memory=constseg(CMSG) 58 | */ 59 | 60 | 61 | /** 62 | * Untranslated constant strings used more than once are 63 | * grouped here to save ROM space. 64 | */ 65 | const char str_empty[] = ""; 66 | 67 | -------------------------------------------------------------------------------- /bertos/mware/messages.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Definitions of constant string messages. 34 | * 35 | * 36 | * \author Bernie Innocenti 37 | * \author Stefano Fedrigo 38 | */ 39 | 40 | #ifndef MWARE_MESSAGES_H 41 | #define MWARE_MESSAGES_H 42 | 43 | enum 44 | { 45 | MSG_NULL, 46 | 47 | // TODO: add your labels here. 48 | 49 | MSG_COUNT 50 | }; 51 | 52 | #warning FIXME:Revise me! 53 | 54 | #define MSG_BUFSIZE 6144 /* FIXME: how much? */ 55 | 56 | /* String tables */ 57 | /* extern const char *msg_strings const [MSG_COUNT]; */ 58 | /* extern char msg_buf[MSG_BUFSIZE]; */ 59 | 60 | 61 | /* Macros to access translated messages */ 62 | #define MSG(x) msg_strings[x] 63 | #define PTRMSG(x) ((x) < (const_iptr_t)256 ? msg_strings[(unsigned int)(x)] : (const char *)(x)) 64 | 65 | 66 | #endif /* MWARE_MESSAGES_H */ 67 | 68 | -------------------------------------------------------------------------------- /bertos/mware/observer.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Simple notifier for the observer/subject pattern (implementation) 34 | * 35 | * \author Bernie Innocenti 36 | */ 37 | 38 | #include "observer.h" 39 | #include // IRQ_DISABLE/IRQ_ENABLE 40 | 41 | 42 | void observer_SetEvent(Observer *observer, void (*event)(int event_id, void *param)) 43 | { 44 | observer->event = event; 45 | } 46 | 47 | void observer_InitSubject(Subject *subject) 48 | { 49 | LIST_INIT(&subject->observers); 50 | } 51 | 52 | void observer_Subscribe(Subject *subject, Observer *observer) 53 | { 54 | ATOMIC(ADDHEAD(&subject->observers, &observer->link)); 55 | } 56 | 57 | void observer_Unsubscribe(UNUSED_ARG(Subject *,subject), Observer *observer) 58 | { 59 | ATOMIC(REMOVE(&observer->link)); 60 | } 61 | 62 | void observer_notify(Subject *subject, int event_id, void *param) 63 | { 64 | Observer *observer; 65 | cpu_flags_t irqstate; 66 | IRQ_SAVE_DISABLE(irqstate); 67 | 68 | /* 69 | * Run over list with protection against other 70 | * threads, but re-enable irqs in callbacks. 71 | */ 72 | FOREACH_NODE(observer, &subject->observers) 73 | { 74 | IRQ_RESTORE(irqstate); 75 | observer->event(event_id, param); 76 | IRQ_SAVE_DISABLE(irqstate); 77 | } 78 | 79 | IRQ_RESTORE(irqstate); 80 | } 81 | -------------------------------------------------------------------------------- /bertos/mware/pgm.h: -------------------------------------------------------------------------------- 1 | #warning This header is OBSOLETE 2 | #include 3 | -------------------------------------------------------------------------------- /bertos/mware/resource.c: -------------------------------------------------------------------------------- 1 | 2 | #include "resource.h" 3 | #include 4 | 5 | /** 6 | * Internal structure for building a priority queue 7 | * of processes waiting for the resource to become free. 8 | */ 9 | typedef struct ResourceWaiter 10 | { 11 | PriNode link; 12 | struct Observer *owner; 13 | 14 | } ResourceWaiter; 15 | 16 | 17 | bool ResMan_Alloc(Resource *res, int pri, ResMan_time_t timeout, struct Observer *releaseRequest) 18 | { 19 | bool success = false; 20 | 21 | ASSERT(releaseRequest); 22 | 23 | sem_obtain(&res->lock); 24 | 25 | if (res->owner == releaseRequest) 26 | { 27 | // Already ours 28 | res->pri = pri; 29 | success = true; 30 | } 31 | else if (!res->owner) 32 | { 33 | // Trivial acquire: nobody was owning the resource 34 | res->pri = pri; 35 | res->owner = releaseRequest; 36 | success = true; 37 | } 38 | else 39 | { 40 | ResourceWaiter waiter; 41 | 42 | // Setup waiter structure and enqueue it to resource 43 | waiter.owner = releaseRequest; 44 | waiter.link.pri = pri; 45 | LIST_ENQUEUE(&res->queue, &waiter.link); 46 | 47 | // Resource busy: are we eligible for preemption? 48 | if ((res->pri < pri) && res->owner->event) 49 | res->owner->event(EVENT_RELEASE, res); 50 | 51 | // Wait in the queue until the timeout occurs. 52 | do 53 | { 54 | sem_release(&res->lock); 55 | // TODO: use a semaphore here instead 56 | ResMan_sleep(); 57 | sem_obtain(&res->lock); 58 | 59 | // Check for ownership 60 | if (res->owner == releaseRequest) 61 | { 62 | success = true; 63 | break; 64 | } 65 | } 66 | while (timeout--); 67 | 68 | // Remove pending waiter 69 | if (!success) 70 | REMOVE(&waiter.link.link); 71 | } 72 | 73 | sem_release(&res->lock); 74 | return success; 75 | } 76 | 77 | void ResMan_Free(Resource *res) 78 | { 79 | ResourceWaiter *waiter; 80 | 81 | sem_obtain(&res->lock); 82 | 83 | 84 | ASSERT(res->owner); 85 | //TODO: check for real owner calling free 86 | 87 | // Check for new owner candidates. 88 | if ((waiter = (ResourceWaiter *)list_remHead(&res->queue))) 89 | { 90 | // Transfer ownership of the resource 91 | res->owner = waiter->owner; 92 | res->pri = waiter->link.pri; 93 | //ResMan_wakeup(waiter); 94 | } 95 | else 96 | { 97 | // Nobody waiting, free the resource 98 | res->owner = NULL; 99 | res->pri = -1; 100 | } 101 | 102 | sem_release(&res->lock); 103 | } 104 | 105 | void ResMan_Init(Resource *res) 106 | { 107 | res->owner = NULL; 108 | res->pri = -1; 109 | 110 | sem_init(&res->lock); 111 | LIST_INIT(&res->queue); 112 | } 113 | 114 | -------------------------------------------------------------------------------- /bertos/mware/rle.h: -------------------------------------------------------------------------------- 1 | #warning This header is OBSOLETE 2 | #include 3 | -------------------------------------------------------------------------------- /bertos/mware/strtol10.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief Poor man's hex arrays (implementation). 34 | * 35 | * \author Bernie Innocenti 36 | */ 37 | 38 | 39 | #ifndef MWARE_STRTOL10_H 40 | #define MWARE_STRTOL10_H 41 | 42 | #include /* bool */ 43 | 44 | bool strtoul10(const char *first, const char *last, unsigned long *val); 45 | bool strtol10(const char *first, const char *last, long *val); 46 | 47 | /** 48 | * Replacement for standard library function atol(). 49 | */ 50 | INLINE long atol(const char *str) 51 | { 52 | long val; 53 | strtol10(str, NULL, &val); 54 | return val; 55 | } 56 | 57 | /** 58 | * Replacement for standard library function atoi(). 59 | */ 60 | INLINE int atoi(const char *str) 61 | { 62 | return (int)atol(str); 63 | } 64 | 65 | #endif /* MWARE_STRTOL10_H */ 66 | -------------------------------------------------------------------------------- /bertos/remote_merge: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #set -x 3 | 4 | if [ $# -lt 2 ] ; then 5 | printf "\nMerge remote url commits into local BeRTOS svn repository.\n" 6 | printf "Usage: $0 []\n" 7 | printf "If remote end revision is not supplied HEAD will be used.\n" 8 | exit 1 9 | fi 10 | 11 | 12 | MERGE_URL="$1" 13 | START_REV="$2" 14 | if [ z"$3" = z ] ; then 15 | END_REV=HEAD 16 | else 17 | END_REV="$3" 18 | fi 19 | 20 | #Check for local uncommitted modifications 21 | STATUS=`svn status -q` 22 | if [[ z"$STATUS" != z && "${STATUS:0:1}" != $'\n' ]] ; then 23 | printf "Project has local modifications, it must be clean\n" 24 | exit 1 25 | fi 26 | 27 | #Get list of revisions to merge. 28 | REV_LIST=`svn log $MERGE_URL -r$START_REV:$END_REV --quiet 2>&1| perl -ne 'if(m/^r([0-9]+)/) {print $1, "\n";}'` 29 | 30 | printf "Merged from external project:\n" > header 31 | for rev in $REV_LIST 32 | do 33 | #Get commit log message only 34 | #svn pg --revprop -r$rev svn:log $MERGE_URL > tmp_msg 35 | 36 | #Get revision commit log with date and author 37 | svn log -r$rev $MERGE_URL > tmp_msg 38 | #Replace leading and trailing banners "---------------------..." 39 | sed -i 's/^-\+/\*\*\*\*\*\*\*\*\*\*/' tmp_msg 40 | #Indent all message 41 | sed -i 's/\(^.*\)/\t\1/' tmp_msg 42 | cat header tmp_msg > commit_msg 43 | #Try to merge ... 44 | svn merge $MERGE_URL -c$rev || exit 1 45 | #and commit! 46 | svn ci -Fcommit_msg 47 | done 48 | rm -rf header tmp_msg commit_msg 49 | -------------------------------------------------------------------------------- /bertos/struct/kfile_fifo.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief KFile interface over a FIFO buffer. 34 | * 35 | * \author Francesco Sacchi 36 | */ 37 | 38 | #include "kfile_fifo.h" 39 | #include "fifobuf.h" 40 | 41 | #include 42 | 43 | #include 44 | 45 | static size_t kfilefifo_read(struct KFile *_fd, void *_buf, size_t size) 46 | { 47 | KFileFifo *fd = KFILEFIFO_CAST(_fd); 48 | uint8_t *buf = (uint8_t *)_buf; 49 | 50 | while (size-- && !fifo_isempty_locked(fd->fifo)) 51 | *buf++ = fifo_pop_locked(fd->fifo); 52 | 53 | return buf - (uint8_t *)_buf; 54 | } 55 | 56 | static size_t kfilefifo_write(struct KFile *_fd, const void *_buf, size_t size) 57 | { 58 | KFileFifo *fd = KFILEFIFO_CAST(_fd); 59 | const uint8_t *buf = (const uint8_t *)_buf; 60 | 61 | while (size-- && !fifo_isfull_locked(fd->fifo)) 62 | fifo_push_locked(fd->fifo, *buf++); 63 | 64 | return buf - (const uint8_t *)_buf; 65 | } 66 | 67 | void kfilefifo_init(KFileFifo *kf, FIFOBuffer *fifo) 68 | { 69 | memset(kf, 0, sizeof(*kf)); 70 | 71 | kf->fifo = fifo; 72 | kf->fd.read = kfilefifo_read; 73 | kf->fd.write = kfilefifo_write; 74 | DB(kf->fd._type = KFT_KFILEFIFO); 75 | } 76 | -------------------------------------------------------------------------------- /bertos/struct/kfile_mem.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief KFile interface over a memory buffer. 34 | * 35 | * \author Francesco Sacchi 36 | */ 37 | 38 | #include "kfile_mem.h" 39 | 40 | #include 41 | 42 | #include 43 | 44 | static size_t kfilemem_read(struct KFile *_fd, void *buf, size_t size) 45 | { 46 | KFileMem *fd = KFILEMEM_CAST(_fd); 47 | 48 | size = MIN((kfile_off_t)size, fd->fd.size - fd->fd.seek_pos); 49 | uint8_t *mem = (uint8_t *)fd->mem; 50 | memcpy(buf, mem + fd->fd.seek_pos, size); 51 | fd->fd.seek_pos += size; 52 | 53 | return size; 54 | } 55 | 56 | static size_t kfilemem_write(struct KFile *_fd, const void *buf, size_t size) 57 | { 58 | KFileMem *fd = KFILEMEM_CAST(_fd); 59 | 60 | size = MIN((kfile_off_t)size, fd->fd.size - fd->fd.seek_pos); 61 | uint8_t *mem = (uint8_t *)fd->mem; 62 | memcpy(mem + fd->fd.seek_pos, buf, size); 63 | fd->fd.seek_pos += size; 64 | 65 | return size; 66 | } 67 | 68 | void kfilemem_init(KFileMem *km, void *mem, size_t len) 69 | { 70 | ASSERT(km); 71 | ASSERT(mem); 72 | ASSERT(len); 73 | 74 | memset(km, 0, sizeof(*km)); 75 | 76 | km->mem = mem; 77 | kfile_init(&km->fd); 78 | km->fd.read = kfilemem_read; 79 | km->fd.write = kfilemem_write; 80 | km->fd.size = len; 81 | DB(km->fd._type = KFT_KFILEMEM); 82 | } 83 | -------------------------------------------------------------------------------- /bertos/struct/kfile_mem.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * \brief KFile interface over a memory buffer. 34 | * 35 | * Convenient way to access a memory region using the KFile interface. 36 | * 37 | * 38 | * \author Francesco Sacchi 39 | * 40 | * $WIZ$ module_name = "kfilemem" 41 | * $WIZ$ module_depends = "kfile" 42 | */ 43 | 44 | #ifndef STRUCT_KFILE_MEM 45 | #define STRUCT_KFILE_MEM 46 | 47 | #include 48 | 49 | /** 50 | * Context for KFile over memory buffer. 51 | */ 52 | typedef struct KFileMem 53 | { 54 | KFile fd; ///< KFile base class 55 | void *mem; ///< Pointer to the memory buffer used. 56 | } KFileMem; 57 | 58 | /** 59 | * ID for KFile Mem. 60 | */ 61 | #define KFT_KFILEMEM MAKE_ID('M', 'E', 'M', '0') 62 | 63 | /** 64 | * Convert + ASSERT from generic KFile to KFileMem. 65 | */ 66 | INLINE KFileMem * KFILEMEM_CAST(KFile *fd) 67 | { 68 | ASSERT(fd->_type == KFT_KFILEMEM); 69 | return (KFileMem *)fd; 70 | } 71 | 72 | /** 73 | * Initialize KFileMem struct. 74 | * 75 | * \param km Interface to initialize. 76 | * \param mem Pointer to the memory buffer to operate on. 77 | * \param len Size of the buffer 78 | */ 79 | void kfilemem_init(KFileMem *km, void *mem, size_t len); 80 | 81 | #endif /* STRUCT_KFILE_MEM */ 82 | -------------------------------------------------------------------------------- /bertos/verstag.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 32 | * 33 | * 34 | * \author Bernie Innocenti 35 | * 36 | * \brief Define application version strings 37 | */ 38 | #include 39 | 40 | /* 41 | * "buildrev.h" is auto-generated by the build infrastructure, 42 | * incrementing VERS_BUILD each time the project is rebuilt. 43 | */ 44 | #include "buildrev.h" 45 | 46 | const char vers_tag[] = VERS_TAG; 47 | const char vers_build_str[] = _STRINGIZE(VERS_BUILD); 48 | const char vers_host[] = VERS_HOST; 49 | const int vers_build_nr = VERS_BUILD; 50 | 51 | -------------------------------------------------------------------------------- /buildrev.h: -------------------------------------------------------------------------------- 1 | #define VERS_BUILD 1775 2 | #define VERS_HOST "shard" 3 | -------------------------------------------------------------------------------- /flash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | avrdude -p m328p -c arduino -P /dev/tty$1 -b 115200 -F -U flash:w:images/Modem.hex 3 | -------------------------------------------------------------------------------- /images/Modem.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/images/Modem.bin -------------------------------------------------------------------------------- /images/Modem.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/markqvist/MicroModem/8d66322629f8957fd90d7aeeb16fc065f71c8304/images/Modem.elf --------------------------------------------------------------------------------