├── README ├── abstrax ├── .gitignore ├── presets ├── simulator │ ├── Makefile │ ├── SDLMain.h │ ├── SDLMain.m │ └── main.c ├── ui │ ├── .gitignore │ ├── Package.StoreAssociation.xml │ ├── images │ │ ├── logo.png │ │ ├── smalllogo.png │ │ ├── splashscreen.png │ │ └── storelogo.png │ ├── metro.jsproj │ ├── metro.sln │ ├── metro │ │ ├── default.css │ │ ├── default.html │ │ ├── default.js │ │ └── navigator.js │ ├── package.appxmanifest │ ├── server.js │ └── static │ │ ├── index.html │ │ ├── osc.css │ │ ├── osc.js │ │ ├── platform.js │ │ └── ui.js └── web │ └── testserver.py ├── boot ├── .gitignore ├── Makefile ├── crc32.c ├── dfu.h ├── enter_app.s ├── inc │ ├── minilib.h │ ├── stdarg.h │ ├── stdint.h │ ├── string.h │ └── usbdebug.h ├── lib │ ├── lpc17xx │ │ ├── lpc1758.lds │ │ ├── startup_LPC17xx.s │ │ └── system_LPC17xx.h │ └── lpcusb │ │ ├── usbhw_lpc.c │ │ └── usbinit.c ├── main.c ├── minilib.c ├── stacker.cfg ├── usboot_iap.c └── usboot_iap.h ├── common ├── fatfs_readme.txt ├── inc │ ├── LPC17xx.h │ ├── LPC17xx_bits.h │ ├── assert.h │ ├── attrib.h │ ├── core_cm3.h │ ├── diskio.h │ ├── ff.h │ ├── ffconf.h │ ├── hardware.h │ ├── panic.h │ ├── sdcard.h │ ├── serial.h │ ├── tables.h │ ├── usbapi.h │ ├── usbhw_lpc.h │ └── usbstruct.h ├── lib │ ├── .gitignore │ ├── build_id.c │ ├── ccsbcs.c │ ├── core_cm3.c │ ├── diskio.c │ ├── eeprom.c │ ├── ff.c │ ├── hardware.c │ ├── sdcard.c │ ├── serial.c │ ├── usbcontrol.c │ ├── usbhw_lpc.c │ ├── usbstdreq.c │ └── vsnprintf.c ├── openocd.cfg ├── protocol.h └── settings.h ├── doc ├── CMSIS_V1P30 │ ├── CMSIS changes.htm │ ├── CMSIS debug support.htm │ ├── CMSIS_Core.htm │ └── License.doc └── vm-setup ├── driver ├── .gitignore ├── README.md ├── ilda-player │ ├── Makefile │ ├── ilda.cpp │ ├── ilda.hpp │ └── play.cpp ├── libetherdream │ ├── .gitignore │ ├── Makefile │ ├── etherdream.c │ ├── etherdream.h │ └── test.c └── wav-player │ ├── Makefile │ ├── README.txt │ ├── gl-render.cpp │ ├── gl-render.hpp │ ├── wav8.cpp │ ├── wav8.hpp │ └── wplay.cpp ├── firmware ├── .gitignore ├── .indent.pro ├── Makefile ├── abstract │ ├── io.c │ └── render.c ├── drivers │ ├── include │ │ ├── debug_frmwrk.h │ │ ├── lpc17xx_adc.h │ │ ├── lpc17xx_can.h │ │ ├── lpc17xx_clkpwr.h │ │ ├── lpc17xx_dac.h │ │ ├── lpc17xx_emac.h │ │ ├── lpc17xx_exti.h │ │ ├── lpc17xx_gpdma.h │ │ ├── lpc17xx_gpio.h │ │ ├── lpc17xx_i2c.h │ │ ├── lpc17xx_i2s.h │ │ ├── lpc17xx_libcfg_default.h │ │ ├── lpc17xx_mcpwm.h │ │ ├── lpc17xx_nvic.h │ │ ├── lpc17xx_pinsel.h │ │ ├── lpc17xx_pwm.h │ │ ├── lpc17xx_qei.h │ │ ├── lpc17xx_rit.h │ │ ├── lpc17xx_rtc.h │ │ ├── lpc17xx_spi.h │ │ ├── lpc17xx_ssp.h │ │ ├── lpc17xx_systick.h │ │ ├── lpc17xx_timer.h │ │ ├── lpc17xx_uart.h │ │ ├── lpc17xx_wdt.h │ │ ├── lpc_types.h │ │ └── mdio.h │ └── source │ │ ├── debug_frmwrk.c │ │ ├── lpc17xx_adc.c │ │ ├── lpc17xx_can.c │ │ ├── lpc17xx_clkpwr.c │ │ ├── lpc17xx_dac.c │ │ ├── lpc17xx_emac.c │ │ ├── lpc17xx_exti.c │ │ ├── lpc17xx_gpdma.c │ │ ├── lpc17xx_gpio.c │ │ ├── lpc17xx_i2c.c │ │ ├── lpc17xx_i2s.c │ │ ├── lpc17xx_libcfg_default.c │ │ ├── lpc17xx_mcpwm.c │ │ ├── lpc17xx_nvic.c │ │ ├── lpc17xx_pinsel.c │ │ ├── lpc17xx_pwm.c │ │ ├── lpc17xx_qei.c │ │ ├── lpc17xx_rit.c │ │ ├── lpc17xx_rtc.c │ │ ├── lpc17xx_spi.c │ │ ├── lpc17xx_ssp.c │ │ ├── lpc17xx_systick.c │ │ ├── lpc17xx_timer.c │ │ ├── lpc17xx_uart.c │ │ ├── lpc17xx_wdt.c │ │ ├── makefile │ │ └── mdio.c ├── file │ ├── autoplay.c │ ├── ild-player.c │ └── playback.c ├── inc │ ├── arch │ │ ├── cc.h │ │ └── perf.h │ ├── broadcast.h │ ├── dac.h │ ├── dac_settings.h │ ├── dmx.h │ ├── dp83848.h │ ├── ether.h │ ├── ether_private.h │ ├── file_player.h │ ├── fixpoint.h │ ├── lightengine.h │ ├── lwipopts.h │ ├── osc.h │ ├── param.h │ ├── playback.h │ ├── render.h │ ├── skub-zones.h │ ├── skub.h │ ├── transform.h │ └── usbdebug.h ├── lib │ ├── dac.c │ ├── dac_asm.s │ ├── dmx.c │ ├── ether.c │ ├── fatfs.c │ ├── fixpoint.c │ ├── lightengine.c │ ├── lpc17xx │ │ ├── lpc1758.lds │ │ ├── startup_LPC17xx.s │ │ └── system_LPC17xx.h │ ├── lpcusb │ │ ├── USB_CDC.c │ │ ├── type.h │ │ ├── usbhw_lpc.c │ │ ├── usbinit.c │ │ └── usbtest.c │ ├── network.c │ ├── panic.c │ ├── playback.c │ ├── skub.c │ └── transform.c ├── lwip-1.3.2 │ ├── CHANGELOG │ ├── COPYING │ ├── FILES │ ├── README │ ├── doc │ │ ├── FILES │ │ ├── contrib.txt │ │ ├── rawapi.txt │ │ ├── savannah.txt │ │ ├── snmp_agent.txt │ │ └── sys_arch.txt │ └── src │ │ ├── FILES │ │ ├── api │ │ ├── api_lib.c │ │ ├── api_msg.c │ │ ├── err.c │ │ ├── netbuf.c │ │ ├── netdb.c │ │ ├── netifapi.c │ │ ├── sockets.c │ │ └── tcpip.c │ │ ├── core │ │ ├── dhcp.c │ │ ├── dns.c │ │ ├── init.c │ │ ├── ipv4 │ │ │ ├── autoip.c │ │ │ ├── icmp.c │ │ │ ├── igmp.c │ │ │ ├── inet.c │ │ │ ├── inet_chksum.c │ │ │ ├── ip.c │ │ │ ├── ip_addr.c │ │ │ └── ip_frag.c │ │ ├── ipv6 │ │ │ ├── README │ │ │ ├── icmp6.c │ │ │ ├── inet6.c │ │ │ ├── ip6.c │ │ │ └── ip6_addr.c │ │ ├── mem.c │ │ ├── memp.c │ │ ├── netif.c │ │ ├── pbuf.c │ │ ├── raw.c │ │ ├── snmp │ │ │ ├── asn1_dec.c │ │ │ ├── asn1_enc.c │ │ │ ├── mib2.c │ │ │ ├── mib_structs.c │ │ │ ├── msg_in.c │ │ │ └── msg_out.c │ │ ├── stats.c │ │ ├── sys.c │ │ ├── tcp.c │ │ ├── tcp_in.c │ │ ├── tcp_out.c │ │ └── udp.c │ │ ├── include │ │ ├── ipv4 │ │ │ └── lwip │ │ │ │ ├── autoip.h │ │ │ │ ├── icmp.h │ │ │ │ ├── igmp.h │ │ │ │ ├── inet.h │ │ │ │ ├── inet_chksum.h │ │ │ │ ├── ip.h │ │ │ │ ├── ip_addr.h │ │ │ │ └── ip_frag.h │ │ ├── ipv6 │ │ │ └── lwip │ │ │ │ ├── icmp.h │ │ │ │ ├── inet.h │ │ │ │ ├── ip.h │ │ │ │ └── ip_addr.h │ │ ├── lwip │ │ │ ├── api.h │ │ │ ├── api_msg.h │ │ │ ├── arch.h │ │ │ ├── debug.h │ │ │ ├── def.h │ │ │ ├── dhcp.h │ │ │ ├── dns.h │ │ │ ├── err.h │ │ │ ├── init.h │ │ │ ├── mem.h │ │ │ ├── memp.h │ │ │ ├── memp_std.h │ │ │ ├── netbuf.h │ │ │ ├── netdb.h │ │ │ ├── netif.h │ │ │ ├── netifapi.h │ │ │ ├── opt.h │ │ │ ├── pbuf.h │ │ │ ├── raw.h │ │ │ ├── sio.h │ │ │ ├── snmp.h │ │ │ ├── snmp_asn1.h │ │ │ ├── snmp_msg.h │ │ │ ├── snmp_structs.h │ │ │ ├── sockets.h │ │ │ ├── stats.h │ │ │ ├── sys.h │ │ │ ├── tcp.h │ │ │ ├── tcpip.h │ │ │ └── udp.h │ │ └── netif │ │ │ ├── etharp.h │ │ │ ├── loopif.h │ │ │ ├── ppp_oe.h │ │ │ └── slipif.h │ │ └── netif │ │ ├── FILES │ │ ├── etharp.c │ │ ├── ethernetif.c │ │ ├── loopif.c │ │ └── slipif.c ├── main.c ├── net │ ├── abstract-osc.c │ ├── bpm.c │ ├── broadcast.c │ ├── correction-osc.c │ ├── ifconfig-osc.c │ ├── ilda-osc.c │ ├── osc.c │ ├── point-stream.c │ └── sink.c ├── old │ ├── README.txt │ ├── ildatest.c │ └── patterns.c ├── pc.c ├── stacker.cfg └── unix │ ├── dac.c │ ├── rawif.c │ ├── sdcard.c │ └── tapif.c ├── releases └── v0.3.0 │ ├── j4cDAC.bin │ ├── j4cDAC.elf │ └── j4cDAC.hex └── tools ├── .gitignore ├── f0ad ├── .gitignore ├── Makefile └── f0ad.c ├── flasher.py ├── ilda ├── mkilda.py └── rainbowcircle.ild ├── image.py ├── intelhex ├── .gitignore ├── README.txt ├── __init__.py ├── bench.py └── test.py ├── j4cDAC-phone.touchosc ├── j4cDAC.touchosc ├── miniterm ├── copyright ├── miniterm.py └── readme.txt ├── osc.c ├── sitter ├── build.bat ├── sitter.py └── sitter.spec ├── tester ├── .gitignore ├── dac.py ├── talk.py └── watch.py ├── updater ├── .gitignore ├── EtherDreamUSB.inf ├── build.bat ├── cmd-updater.py ├── dfu │ ├── __init__.py │ ├── dfu.py │ └── update.py ├── update.py └── update.spec ├── wav2ilda.py └── webui └── html ├── controls.js ├── index.html └── uilib.js /README: -------------------------------------------------------------------------------- 1 | To build this, you will want to have the CodeSourcery ARM toolchain: 2 | http://www.codesourcery.com/sgpp/lite/arm/portal/release1592 3 | 4 | And lpc21isp for programming: 5 | svn co https://lpc21isp.svn.sourceforge.net/svnroot/lpc21isp lpc21isp 6 | -------------------------------------------------------------------------------- /abstrax/.gitignore: -------------------------------------------------------------------------------- 1 | abstrax 2 | -------------------------------------------------------------------------------- /abstrax/presets: -------------------------------------------------------------------------------- 1 | Some presets I've come up with... 2 | 3 | 0. 2rainbow 4 | master:6553600 x:6555056 y:6540519 z:6532004 red:3:-1352240273 green:3:4424000 blue:3:1442897174 blank:13097162 xrot:-253403070 yrot:0 blankwfm:2 mode:1 5 | 1. 5rainbow 6 | master:6848512 x:6878360 y:6848512 z:6832121 red:11:-1355104273 green:11:51536146 blue:11:1438473174 blank:34355770 xrot:-730144440 yrot:605590389 blankwfm:2 mode:1 7 | 2. 3bits 8 | master:4554752 x:18218925 y:27338551 z:4554236 red:3:1075470120 green:3:-1787841411 blue:3:-356185646 blank:6:731705883 xrot:-554050781 yrot:382252089 blankwfm:2 mode:1 9 | 3. wellbehaved 10 | master:3309568 x:5:-551068081 y:4976262 z:5:-714685883 red:3:-1343029456 green:3:-415861913 blue:3:320418195 blank:11:-70423492 xrot:261993005 yrot:446676599 mode:3 blankwfm:0 11 | 4. ybstar 12 | master:9502720 x:9495442 y:9515175 z:11:-264508561 red:3:1310470372 green:3:1261220555 blue:3:-1348318906 blank:11:-270898195 xrot:-73014444 yrot:429496730 mode:2 blankwfm:2 13 | 5. helix 14 | master:2949120 x:4:595909531 y:8854141 z:11:431341913 red:3:-1436538174 green:3:-2145548648 blue:3:-2145548648 blank:11:-304938195 xrot:-133143986 yrot:523986010 mode:6 blankwfm:0 15 | 6. dancers 16 | master:3899392 x:3:289008745 y:15606127 z:4:1357799456 red:11:905086417 green:9:-2087348648 blue:7:6002958 blank:23365728 xrot:511101108 yrot:-42949673 mode:6 blankwfm:1 17 | 7. strangeloop 18 | master:7634944 x:15281591 y:11452883 z:5:30243408 red:0 green:7639134 blue:0 blank:7634944 xrot:8589935 yrot:-408021893 mode:5 blankwfm:0 19 | 8. rings 20 | master:6553600 x:5:38128000 y:13107735 z:3280144 red:9:1111237570 green:10:-1338437456 blue:10:2016000 blank:7:-841392051 xrot:-712964571 yrot:403726926 mode:3 blankwfm:3 21 | 9. scape 22 | master:6553600 x:9:-434497180 y:6553867 z:2181674 red:3:1133301570 green:3:-1322085456 blue:3:20488000 blank:7:-751280051 xrot:-919123001 yrot:42949673 mode:5 blankwfm:3 23 | 10. universe 24 | master:6553600 x:3:-1061613120 y:3:9712000 z:15000 red:9:1525206357 green:9:-1340841174 blue:9:100609408 blank:65693227 xrot:171798692 yrot:42949673 mode:2 blankwfm:3 25 | 26 | Known issues: 27 | -- ybstar and scape are too fast 28 | -- 5rainbow changes too fast 29 | -------------------------------------------------------------------------------- /abstrax/simulator/Makefile: -------------------------------------------------------------------------------- 1 | SRCS = \ 2 | ../../firmware/lib/fixpoint.c \ 3 | ../../firmware/abstract/io.c \ 4 | ../../firmware/abstract/render.c \ 5 | main.c 6 | 7 | SDL_FLAGS = -framework SDL -framework Cocoa -framework OpenGL -I/Library/Frameworks/SDL.framework/Headers 8 | 9 | abstrax: $(SRCS) SDLmain.m 10 | gcc $(SRCS) SDLmain.m -I../../firmware/inc -I../../common -Wall $(SDL_FLAGS) -o $@ 11 | 12 | clean: 13 | rm -f abstrax 14 | -------------------------------------------------------------------------------- /abstrax/simulator/SDLMain.h: -------------------------------------------------------------------------------- 1 | /* SDLMain.m - main entry point for our Cocoa-ized SDL app 2 | Initial Version: Darrell Walisser 3 | Non-NIB-Code & other changes: Max Horn 4 | 5 | Feel free to customize this file to suit your needs 6 | */ 7 | 8 | #ifndef _SDLMain_h_ 9 | #define _SDLMain_h_ 10 | 11 | #import 12 | 13 | @interface SDLMain : NSObject 14 | @end 15 | 16 | #endif /* _SDLMain_h_ */ 17 | -------------------------------------------------------------------------------- /abstrax/ui/.gitignore: -------------------------------------------------------------------------------- 1 | AppPackages 2 | bin 3 | bld 4 | *.pfx 5 | *.user 6 | *.suo 7 | -------------------------------------------------------------------------------- /abstrax/ui/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j4cbo/j4cDAC/12ecbe565fcaa88f771b1bfdfb1852baca38fbe6/abstrax/ui/images/logo.png -------------------------------------------------------------------------------- /abstrax/ui/images/smalllogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j4cbo/j4cDAC/12ecbe565fcaa88f771b1bfdfb1852baca38fbe6/abstrax/ui/images/smalllogo.png -------------------------------------------------------------------------------- /abstrax/ui/images/splashscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j4cbo/j4cDAC/12ecbe565fcaa88f771b1bfdfb1852baca38fbe6/abstrax/ui/images/splashscreen.png -------------------------------------------------------------------------------- /abstrax/ui/images/storelogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j4cbo/j4cDAC/12ecbe565fcaa88f771b1bfdfb1852baca38fbe6/abstrax/ui/images/storelogo.png -------------------------------------------------------------------------------- /abstrax/ui/metro.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "metro", "metro.jsproj", "{05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Debug|ARM = Debug|ARM 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|Any CPU = Release|Any CPU 13 | Release|ARM = Release|ARM 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 21 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Debug|ARM.ActiveCfg = Debug|ARM 22 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Debug|ARM.Build.0 = Debug|ARM 23 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Debug|ARM.Deploy.0 = Debug|ARM 24 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Debug|x64.ActiveCfg = Debug|x64 25 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Debug|x64.Build.0 = Debug|x64 26 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Debug|x64.Deploy.0 = Debug|x64 27 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Debug|x86.ActiveCfg = Debug|x86 28 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Debug|x86.Build.0 = Debug|x86 29 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Debug|x86.Deploy.0 = Debug|x86 30 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Release|Any CPU.ActiveCfg = Release|Any CPU 31 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Release|Any CPU.Build.0 = Release|Any CPU 32 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Release|Any CPU.Deploy.0 = Release|Any CPU 33 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Release|ARM.ActiveCfg = Release|ARM 34 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Release|ARM.Build.0 = Release|ARM 35 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Release|ARM.Deploy.0 = Release|ARM 36 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Release|x64.ActiveCfg = Release|x64 37 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Release|x64.Build.0 = Release|x64 38 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Release|x64.Deploy.0 = Release|x64 39 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Release|x86.ActiveCfg = Release|x86 40 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Release|x86.Build.0 = Release|x86 41 | {05624A14-0C78-4AC2-9B3C-2D9CA60C6DBC}.Release|x86.Deploy.0 = Release|x86 42 | EndGlobalSection 43 | GlobalSection(SolutionProperties) = preSolution 44 | HideSolutionNode = FALSE 45 | EndGlobalSection 46 | EndGlobal 47 | -------------------------------------------------------------------------------- /abstrax/ui/metro/default.css: -------------------------------------------------------------------------------- 1 | #contenthost { 2 | height: 100%; 3 | width: 100%; 4 | } 5 | 6 | .fragment { 7 | /* Define a grid with rows for a banner and a body */ 8 | -ms-grid-columns: 1fr; 9 | -ms-grid-rows: 128px 1fr; 10 | display: -ms-grid; 11 | height: 100%; 12 | width: 100%; 13 | } 14 | 15 | .fragment header[role=banner] { 16 | /* Define a grid with columns for the back button and page title. */ 17 | -ms-grid-columns: 120px 1fr; 18 | -ms-grid-rows: 1fr; 19 | display: -ms-grid; 20 | } 21 | 22 | .fragment header[role=banner] .win-backbutton { 23 | margin-left: 39px; 24 | margin-top: 59px; 25 | } 26 | 27 | .fragment header[role=banner] .titlearea { 28 | -ms-grid-column: 2; 29 | margin-top: 37px; 30 | } 31 | 32 | .fragment header[role=banner] .titlearea .pagetitle { 33 | width: calc(100% - 20px); 34 | } 35 | 36 | .fragment section[role=main] { 37 | -ms-grid-row: 2; 38 | height: 100%; 39 | width: 100%; 40 | } 41 | 42 | @media screen and (-ms-view-state: snapped) { 43 | .fragment header[role=banner] { 44 | -ms-grid-columns: auto 1fr; 45 | margin-left: 20px; 46 | } 47 | 48 | .fragment header[role=banner] .win-backbutton { 49 | margin: 0; 50 | margin-right: 10px; 51 | margin-top: 76px; 52 | } 53 | 54 | .fragment header[role=banner] .win-backbutton:disabled { 55 | display: none; 56 | } 57 | 58 | .fragment header[role=banner] .titlearea { 59 | -ms-grid-column: 2; 60 | margin-left: 0; 61 | margin-top: 68px; 62 | } 63 | } 64 | 65 | @media screen and (-ms-view-state: fullscreen-portrait) { 66 | .fragment header[role=banner] { 67 | -ms-grid-columns: 100px 1fr; 68 | } 69 | 70 | .fragment header[role=banner] .win-backbutton { 71 | margin-left: 29px; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /abstrax/ui/metro/default.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /abstrax/ui/metro/default.js: -------------------------------------------------------------------------------- 1 | // For an introduction to the Navigation template, see the following documentation: 2 | // http://go.microsoft.com/fwlink/?LinkId=232506 3 | (function () { 4 | "use strict"; 5 | 6 | WinJS.Binding.optimizeBindingReferences = true; 7 | 8 | var app = WinJS.Application; 9 | var activation = Windows.ApplicationModel.Activation; 10 | var nav = WinJS.Navigation; 11 | 12 | app.addEventListener("activated", function (args) { 13 | if (args.detail.kind === activation.ActivationKind.launch) { 14 | if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) { 15 | // TODO: This application has been newly launched. Initialize 16 | // your application here. 17 | } else { 18 | // TODO: This application has been reactivated from suspension. 19 | // Restore application state here. 20 | } 21 | 22 | if (app.sessionState.history) { 23 | nav.history = app.sessionState.history; 24 | } 25 | args.setPromise(WinJS.UI.processAll().then(function () { 26 | if (nav.location) { 27 | nav.history.current.initialPlaceholder = true; 28 | return nav.navigate(nav.location, nav.state); 29 | } else { 30 | return nav.navigate(Application.navigator.home); 31 | } 32 | })); 33 | } 34 | }); 35 | 36 | app.oncheckpoint = function (args) { 37 | // TODO: This application is about to be suspended. Save any state 38 | // that needs to persist across suspensions here. If you need to 39 | // complete an asynchronous operation before your application is 40 | // suspended, call args.setPromise(). 41 | app.sessionState.history = nav.history; 42 | }; 43 | 44 | app.start(); 45 | })(); 46 | -------------------------------------------------------------------------------- /abstrax/ui/package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Ether Dream Abstract 6 | Andrew Drake 7 | images\storelogo.png 8 | 9 | 10 | 6.2.1 11 | 6.2.1 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /abstrax/ui/server.js: -------------------------------------------------------------------------------- 1 | /* Ether Dream socket.io <-> OSC relay 2 | * 3 | * Copyright 2012 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | var static = require('node-static') 19 | , http = require('http') 20 | , osc = require('node-osc') 21 | , fs = require('fs') 22 | , socketio = require('socket.io'); 23 | 24 | var ip = '255.255.255.255'; 25 | if (process.argv[2]) { 26 | ip = process.argv[2]; 27 | } 28 | console.log(ip); 29 | 30 | var oscClient1 = new osc.Client(ip, 60000); 31 | var oscClient2 = new osc.Client('127.0.0.1', 60000); 32 | oscClient2._sock.bind(); 33 | oscClient2._sock.setBroadcast(true); 34 | 35 | var state = {}; 36 | 37 | 38 | function dump() { 39 | var kvpairs = []; 40 | for (var k in state) { 41 | kvpairs.push(k + ":" + state[k]); 42 | } 43 | return kvpairs.join(" "); 44 | } 45 | 46 | function updateState(msg) { 47 | var sections = msg.split(" "); 48 | for (var i in sections) { 49 | var c = sections[i].indexOf(":"); 50 | if (c == -1) continue; 51 | state[sections[i].substr(0, c)] = sections[i].substr(c + 1); 52 | } 53 | } 54 | 55 | var staticFiles = new(static.Server)("./static", { cache: false }); 56 | var presetFiles = new(static.Server)("./presets", { cache: false }); 57 | 58 | var server = http.createServer(function(req, res) { 59 | if (req.url == "/state.txt") { 60 | res.writeHead(200, { 'Content-Type': 'text/plain' }); 61 | res.write(dump()); 62 | res.end(); 63 | } else if (req.url.substr(0, 3) == "/s/") { 64 | req.url = req.url.substr(2); 65 | req.addListener('end', function() { 66 | presetFiles.serve(req, res); 67 | }); 68 | } else { 69 | req.addListener('end', function() { 70 | staticFiles.serve(req, res); 71 | }); 72 | } 73 | }).listen(8080); 74 | 75 | socketio.listen(server).on('connection', function (socket) { 76 | socket.on('message', function (msg) { 77 | if (msg.substr(0, 5) == "save:") { 78 | var fname = "presets/" + msg.substr(5).replace(/[^a-zA-Z0-9. ]/g, "") + ".preset"; 79 | var state = dump() + "\n"; 80 | var f = fs.openSync(fname, "w"); 81 | fs.writeSync(f, state, 0, state.length, 0); 82 | fs.closeSync(f); 83 | } else { 84 | updateState(msg); 85 | socket.broadcast.emit('message', msg); 86 | console.log(dump()); 87 | oscClient1.send('/abstract/conf', msg); 88 | oscClient2.send('/abstract/conf', msg); 89 | } 90 | }); 91 | }); 92 | -------------------------------------------------------------------------------- /abstrax/ui/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Ether Dream Abstract 11 | 12 | 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /abstrax/ui/static/platform.js: -------------------------------------------------------------------------------- 1 | // Platform detection 2 | var pointerApi = "portable"; 3 | if (window.navigator.msPointerEnabled) { 4 | pointerApi = "mspointer"; 5 | } 6 | 7 | var socketApi = "socket.io"; 8 | if ("Windows" in window) { 9 | socketApi = "winrt"; 10 | } 11 | -------------------------------------------------------------------------------- /abstrax/web/testserver.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # j4cDAC abstract generator tester 4 | # 5 | # Copyright 2011 Jacob Potter 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, version 3. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | 19 | import time 20 | import sys 21 | import BaseHTTPServer 22 | 23 | port = 1234 24 | 25 | class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): 26 | def do_GET(s): 27 | """Respond to a GET request.""" 28 | s.send_response(200) 29 | s.send_header("Content-type", "text/plain") 30 | s.end_headers() 31 | 32 | if s.path.startswith("/"): 33 | s.path = s.path[1:] 34 | 35 | pathsec = s.path.rpartition("?")[0].split("/") 36 | 37 | if pathsec[0] != "set": 38 | return 39 | 40 | print " ".join(pathsec[1:]) 41 | sys.stdout.flush() 42 | 43 | def log_message(fmt, *args, **kwargs): 44 | pass 45 | 46 | if __name__ == '__main__': 47 | server_class = BaseHTTPServer.HTTPServer 48 | httpd = server_class(("0.0.0.0", port), MyHandler) 49 | try: 50 | httpd.serve_forever() 51 | except KeyboardInterrupt: 52 | pass 53 | httpd.server_close() 54 | -------------------------------------------------------------------------------- /boot/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.boot.o 3 | boot.elf 4 | boot.hex 5 | boot.map 6 | -------------------------------------------------------------------------------- /boot/Makefile: -------------------------------------------------------------------------------- 1 | PREFIX = arm-none-eabi- 2 | 3 | CFLAGS = -Iinc -Ilib/lpc17xx -I../common/inc -fno-common -mcpu=cortex-m3 -mthumb -Os -g -Inet 4 | CFLAGS += -Wall -ffunction-sections -fdata-sections -fshort-enums -gdwarf-2 -gstrict-dwarf -Wl,--gc-sections -nostdlib -nostdinc -Werror -Wno-unused -Wno-address 5 | LDFLAGS = -Tlib/lpc17xx/lpc1758.lds -mcpu=cortex-m3 -mthumb -fwhole-program -gdwarf-2 -gstrict-dwarf -Wl,-Map=boot.map -Wl,--gc-sections -nostdlib -nostdinc 6 | 7 | # Cortex-M3 support code 8 | CFLAGS += -Ilib/lpc17xx 9 | SRCS += ../common/lib/core_cm3.c lib/lpc17xx/startup_LPC17xx.s \ 10 | ../common/lib/serial.c ../common/lib/hardware.c 11 | #lib/lpc17xx/system_LPC17xx.c 12 | 13 | # Mach printf. Much more lightweight than newlib's. 14 | SRCS += ../common/lib/vsnprintf.c minilib.c 15 | 16 | # LPCUSB 17 | SRCS += ../common/lib/usbstdreq.c ../common/lib/usbcontrol.c \ 18 | ../common/lib/usbhw_lpc.c \ 19 | lib/lpcusb/usbhw_lpc.c lib/lpcusb/usbinit.c 20 | 21 | SRCS += ../common/lib/ff.c ../common/lib/ccsbcs.c ../common/lib/diskio.c 22 | SRCS += ../common/lib/sdcard.c 23 | SRCS += ../common/lib/eeprom.c 24 | 25 | SRCS += usboot_iap.c main.c enter_app.s crc32.c 26 | 27 | OBJS1 = $(SRCS:.c=.boot.o) 28 | OBJS = $(OBJS1:.s=.boot.o) 29 | 30 | all: boot.hex size 31 | 32 | %.boot.o: %.c 33 | $(PREFIX)gcc $(CFLAGS) -c $< -o $@ 34 | 35 | %.boot.o: %.s 36 | $(PREFIX)gcc $(CFLAGS) -c $< -o $@ 37 | 38 | boot.hex: boot.elf 39 | $(PREFIX)objcopy -O ihex -R .eeprom -R .fuse -R .lock $< $@ 40 | 41 | boot.elf: $(OBJS) 42 | $(PREFIX)gcc $(LDFLAGS) $(OBJS) -o boot.elf 43 | 44 | .PHONY: clean flash size term 45 | 46 | clean: 47 | rm -f boot.elf boot.hex boot.map $(OBJS) 48 | 49 | flash: 50 | ~/lpc21isp/lpc21isp -debug3 boot.hex /dev/ttyUSB0 230400 14746 51 | 52 | size: 53 | $(PREFIX)size -A boot.elf 54 | $(PREFIX)nm -anS --size-sort -t d boot.elf | grep ^2 | tail -20 55 | 56 | term: 57 | ../tools/miniterm/miniterm.py -b 230400 -p /dev/ttyUSB0 --rts=0 58 | -------------------------------------------------------------------------------- /boot/crc32.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* code derived from http://www.ietf.org/rfc/rfc1952.txt */ 4 | 5 | static uint32_t crc_table[256]; 6 | static int crc_table_computed = 0; 7 | 8 | /* Make the table for a fast CRC. */ 9 | static void make_crc_table() { 10 | uint32_t c; 11 | int n, k; 12 | for (n = 0; n < 256; n++) { 13 | c = (uint32_t) n; 14 | for (k = 0; k < 8; k++) { 15 | if (c & 1) { 16 | c = 0xedb88320L ^ (c >> 1); 17 | } else { 18 | c = c >> 1; 19 | } 20 | } 21 | crc_table[n] = c; 22 | } 23 | } 24 | 25 | uint32_t crc32(uint32_t crc, uint8_t *buf, int len) { 26 | uint32_t c = crc ^ 0xffffffffL; 27 | int n; 28 | 29 | if (!crc_table_computed) 30 | make_crc_table(); 31 | 32 | for (n = 0; n < len; n++) { 33 | c = crc_table[(c ^ buf[n]) & 0xff] ^ (c >> 8); 34 | } 35 | 36 | return c ^ 0xffffffffL; 37 | } 38 | -------------------------------------------------------------------------------- /boot/dfu.h: -------------------------------------------------------------------------------- 1 | enum dfu_state { 2 | appIDLE = 0, 3 | appDETACH = 1, 4 | dfuIDLE = 2, 5 | dfuDNLOAD_SYNC = 3, 6 | dfuDNBUSY = 4, 7 | dfuDNLOAD_IDLE = 5, 8 | dfuMANIFEST_SYNC = 6, 9 | dfuMANIFEST = 7, 10 | dfuMANIFEST_WAIT_RESET = 8, 11 | dfuUPLOAD_IDLE = 9, 12 | dfuERROR = 10 13 | }; 14 | 15 | enum dfu_status { 16 | OK = 0, 17 | errTARGET = 1, 18 | errFILE = 2, 19 | errWRITE = 3, 20 | errERASE = 4, 21 | errCHECK_ERASED = 5, 22 | errPROG = 6, 23 | errVERIFY = 7, 24 | errADDRESS = 8, 25 | errNOTDONE = 9, 26 | errFIRMWARE = 10, 27 | errVENDOR = 11, 28 | errUSBR = 12, 29 | errPOR = 13, 30 | errUNKNOWN = 14, 31 | errSTALLEDPKT = 15, 32 | }; 33 | -------------------------------------------------------------------------------- /boot/enter_app.s: -------------------------------------------------------------------------------- 1 | /* Enter the application. */ 2 | .section ".text" 3 | .thumb_func 4 | .globl enter_app 5 | .type enter_app, %function 6 | 7 | enter_app: 8 | mov r0, sp 9 | bx r1 10 | -------------------------------------------------------------------------------- /boot/inc/minilib.h: -------------------------------------------------------------------------------- 1 | /* minilib.h 2 | * Definitions for a very small libc 3 | * NetWatch system management mode administration console 4 | * 5 | * Copyright (c) 2008 Jacob Potter and Joshua Wise. All rights reserved. 6 | * This program is free software; you can redistribute and/or modify it under 7 | * the terms found in the file LICENSE in the root of this source tree. 8 | * 9 | */ 10 | 11 | #ifndef MINILIB_H 12 | #define MINILIB_H 13 | 14 | #include 15 | 16 | #ifndef NULL 17 | #define NULL 0 18 | #endif 19 | 20 | typedef __SIZE_TYPE__ size_t; 21 | 22 | extern void *memcpy(void *dest, const void *src, size_t bytes); 23 | extern void *memset(void *dest, int data, size_t bytes); 24 | extern void *memchr(const void *buf, int c, size_t maxlen); 25 | extern void *memmove(void *dest, void *src, size_t bytes); 26 | extern int memcmp(const char *a2, const char *a1, size_t bytes); 27 | extern int strcmp(const char *a2, const char *a1); 28 | extern int strncmp(const char *a2, const char *a1, int n); 29 | extern int strlen(const char *c); 30 | extern char *strcat(char *dest, char *src); 31 | extern char *strcpy(char *a2, const char *a1); 32 | extern void tohex(char *s, unsigned long l); 33 | extern void btohex(char *s, unsigned char c); 34 | extern void puthex(unsigned long l); 35 | extern int vsprintf(char *s, const char *fmt, va_list args); 36 | extern int vsnprintf(char *s, unsigned int size, const char *fmt, va_list args); 37 | extern int sprintf(char *s, const char *fmt, ...); 38 | extern int snprintf(char *s, int size, const char *fmt, ...); 39 | extern unsigned short htons(unsigned short in); 40 | extern unsigned int htonl(unsigned int in); 41 | 42 | static inline int isspace(int c) { 43 | return (c == ' ') || (c == '\t') || (c == '\r') || (c == '\t'); 44 | } 45 | 46 | static inline int isprint(int c) { 47 | return (c >= ' ') && (c <= '~'); 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /boot/inc/stdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDARG_H_ 2 | #define _STDARG_H_ 3 | 4 | /* stdarg.h 5 | * Copyright (c) 2008, Wes Filardo. 6 | * 7 | * This program is free software. It comes without any warranty, to 8 | * the extent permitted by applicable law. You can redistribute it 9 | * and/or modify it under the terms of the Do What The Fuck You Want 10 | * To Public License, Version 2, as reproduced below: 11 | * 12 | * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 13 | * Version 2, December 2004 14 | * 15 | * Copyright (C) 2004 Sam Hocevar 16 | * 14 rue de Plaisance, 75014 Paris, France 17 | * Everyone is permitted to copy and distribute verbatim or modified 18 | * copies of this license document, and changing it is allowed as long 19 | * as the name is changed. 20 | * 21 | * DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 22 | * TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 23 | * 24 | * 0. You just DO WHAT THE FUCK YOU WANT TO. 25 | * 26 | */ 27 | 28 | /* This is awful, but really these are compiler intrinsics, so we use the 29 | * GNU compiler intrinsics. 30 | */ 31 | 32 | #ifdef __GNUC__ 33 | typedef __builtin_va_list va_list; 34 | #define va_start(v,l) __builtin_va_start(v,l) 35 | #define va_end(v) __builtin_va_end(v) 36 | #define va_arg(v,l) __builtin_va_arg(v,l) 37 | #define va_copy(d,s) __builtin_va_copy(d,s) 38 | #else 39 | #error "Don't know how to use varargs not on GNUC, sorry." 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /boot/inc/stdint.h: -------------------------------------------------------------------------------- 1 | /* stdint.h 2 | * Standard integer types 3 | * NetWatch system management mode administration console 4 | * 5 | * Copyright (c) 2008 Jacob Potter and Joshua Wise. All rights reserved. 6 | * This program is free software; you can redistribute and/or modify it under 7 | * the terms found in the file LICENSE in the root of this source tree. 8 | * 9 | */ 10 | 11 | #ifndef _STDINT_H 12 | #define _STDINT_H 13 | 14 | typedef signed char int8_t; 15 | typedef unsigned char uint8_t; 16 | 17 | typedef signed short int16_t; 18 | typedef unsigned short uint16_t; 19 | 20 | typedef signed long int32_t; 21 | typedef unsigned long uint32_t; 22 | 23 | typedef signed long long int64_t; 24 | typedef unsigned long long uint64_t; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /boot/inc/string.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /boot/inc/usbdebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | LPCUSB, an USB device driver for LPC microcontrollers 3 | Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. The name of the author may not be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #include 29 | 30 | //#define ASSERT(x) if(!(x)){outputf("\nAssertion '%s' failed in %s:%s#%d!\n",#x,__FILE__,__FUNCTION__,__LINE__);while(1);} 31 | #define ASSERT(x) 32 | #define DBG(x ...) 33 | -------------------------------------------------------------------------------- /boot/lib/lpc17xx/lpc1758.lds: -------------------------------------------------------------------------------- 1 | /* j4cDAC linker script */ 2 | 3 | OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") 4 | ENTRY(_rom_reset) 5 | SEARCH_DIR(.) 6 | 7 | MEMORY { 8 | rom (rx): ORIGIN = 0x00000000, LENGTH = 16K 9 | ram (rwx): ORIGIN = 0x10000000, LENGTH = 32K 10 | ahb_sram_0 (rwx): ORIGIN = 0x2007C000, LENGTH = 32K 11 | } 12 | 13 | /* These force the linker to search for particular symbols from 14 | * the start of the link process and thus ensure the user's 15 | * overrides are picked up 16 | */ 17 | 18 | SECTIONS { 19 | 20 | _rom_reset = _reset - 0x10000000; 21 | 22 | .text : { 23 | CREATE_OBJECT_SYMBOLS 24 | 25 | __interrupt_vector_start = .; 26 | KEEP(*(.interrupt_vector)); 27 | 28 | /* Make sure we pulled in an interrupt vector. */ 29 | ASSERT (. != __interrupt_vector_start, "No interrupt vector"); 30 | 31 | *(.rom) 32 | *(.rom.b) 33 | 34 | *(.text) 35 | *(.text.*) 36 | 37 | *(.reset) 38 | 39 | /* Make sure we pulled in some reset code. */ 40 | ASSERT (. != _reset, "No reset code"); 41 | 42 | *(.text .text.* .gnu.linkonce.t.*) 43 | *(.rodata .rodata.* .gnu.linkonce.r.*) 44 | 45 | . = ALIGN(4); 46 | KEEP(*(.init)) 47 | } >ram AT >rom 48 | 49 | .data : { 50 | *(.cs3.region-head.ram) 51 | KEEP(*(.jcr)) 52 | *(.got.plt) *(.got) 53 | *(.shdata) 54 | *(.data .data.* .gnu.linkonce.d.*) 55 | *(.ram) 56 | . = ALIGN (8); 57 | _edata = .; 58 | 59 | _copy_end = .; 60 | 61 | } >ram AT>rom 62 | 63 | .bss : 64 | { 65 | _bss_start = .; 66 | *(.shbss) 67 | *(.bss SORT_BY_ALIGNMENT(.bss.*) .gnu.linkonce.b.*) 68 | *(COMMON) 69 | *(.ram.b) 70 | . = ALIGN (8); 71 | _end = .; 72 | } >ram AT>rom 73 | 74 | .stack : 75 | { 76 | *(.stack) 77 | } >ram 78 | 79 | .ahb_sram_0 (NOLOAD) : 80 | { 81 | *(.ahb_sram_0) 82 | } > ahb_sram_0 83 | 84 | .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } 85 | .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) } 86 | /DISCARD/ : { *(.note.GNU-stack) } 87 | } 88 | -------------------------------------------------------------------------------- /boot/lib/lpc17xx/system_LPC17xx.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file system_LPC17xx.h 3 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer Header File 4 | * for the NXP LPC17xx Device Series 5 | * @version V1.02 6 | * @date 08. September 2009 7 | * 8 | * @note 9 | * Copyright (C) 2009 ARM Limited. All rights reserved. 10 | * 11 | * @par 12 | * ARM Limited (ARM) is supplying this software for use with Cortex-M 13 | * processor based microcontrollers. This file can be freely distributed 14 | * within development tools that are supporting such ARM based processors. 15 | * 16 | * @par 17 | * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED 18 | * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. 20 | * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR 21 | * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. 22 | * 23 | ******************************************************************************/ 24 | 25 | 26 | #ifndef __SYSTEM_LPC17xx_H 27 | #define __SYSTEM_LPC17xx_H 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #include 34 | 35 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 36 | 37 | 38 | /** 39 | * Initialize the system 40 | * 41 | * @param none 42 | * @return none 43 | * 44 | * @brief Setup the microcontroller system. 45 | * Initialize the System and update the SystemCoreClock variable. 46 | */ 47 | extern void SystemInit (void); 48 | 49 | /** 50 | * Update SystemCoreClock variable 51 | * 52 | * @param none 53 | * @return none 54 | * 55 | * @brief Updates the SystemCoreClock with current core Clock 56 | * retrieved from cpu registers. 57 | */ 58 | extern void SystemCoreClockUpdate (void); 59 | 60 | #ifdef __cplusplus 61 | } 62 | #endif 63 | 64 | #endif /* __SYSTEM_LPC17xx_H */ 65 | -------------------------------------------------------------------------------- /boot/lib/lpcusb/usbinit.c: -------------------------------------------------------------------------------- 1 | /* 2 | LPCUSB, an USB device driver for LPC microcontrollers 3 | Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. The name of the author may not be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | 29 | /** @file 30 | USB stack initialisation 31 | */ 32 | 33 | 34 | #include "usbdebug.h" 35 | #include "usbapi.h" 36 | #include 37 | #include 38 | 39 | 40 | /** data storage area for standard requests */ 41 | static unsigned char abStdReqData[8]; 42 | 43 | 44 | /** 45 | Initialises the USB hardware and sets up the USB stack by 46 | installing default callbacks. 47 | */ 48 | void usb_init(void) 49 | { 50 | // init hardware 51 | USBHwInit(); 52 | 53 | // register bus reset handler 54 | // USBHwRegisterDevIntHandler(HandleUsbReset); 55 | 56 | // register control transfer handler on EP0 57 | USBHwRegisterEPIntHandler(0x00, USBHandleControlTransfer); 58 | USBHwRegisterEPIntHandler(0x80, USBHandleControlTransfer); 59 | 60 | // setup control endpoints 61 | USBHwEPConfig(0x00, MAX_PACKET_SIZE0); 62 | USBHwEPConfig(0x80, MAX_PACKET_SIZE0); 63 | 64 | // register standard request handler 65 | USBRegisterRequestHandler(REQTYPE_TYPE_STANDARD, USBHandleStandardRequest_FPV_usb_reqhdlr, abStdReqData); 66 | } 67 | -------------------------------------------------------------------------------- /boot/stacker.cfg: -------------------------------------------------------------------------------- 1 | [stacker] 2 | src = . 3 | binary = boot.elf 4 | prefix = arm-none-eabi- 5 | 6 | [entry] 7 | entries = main *_Handler *_IRQHandler 8 | 9 | [targets] 10 | FPA_(.*) = (.*)_FPV_\1 11 | USBHandleStandardRequest = 12 | USBHwISR = USBHandleStandardRequest 13 | 14 | [tables] 15 | _pattern_ = INITIALIZER\s*\((.*),\s*(.*)\) 16 | FPA_init = hardware protocol 17 | main = poll 18 | -------------------------------------------------------------------------------- /boot/usboot_iap.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** usboot_iap.h 3 | ** 4 | ** Made by dave madden 5 | ** Login 6 | ** 7 | ** Started on Fri Oct 17 21:16:04 2008 dave madden 8 | ** Last update Fri Oct 17 21:16:04 2008 dave madden 9 | */ 10 | 11 | #ifndef USBOOT_IAP_H_ 12 | # define USBOOT_IAP_H_ 13 | 14 | /* 15 | * IMPORTANT: You MUST NOT reference Flash during an Erase or 16 | * CopyToFlash operation. Disable interrupts or make sure everything 17 | * is in RAM (interrupt vector table and ISR). 18 | */ 19 | 20 | #define IAP ((void (*)(unsigned int[], unsigned int[]))0x1fff1ff1) 21 | 22 | #ifndef numberof 23 | # define numberof(x) (sizeof(x)/sizeof(*(x))) 24 | #endif 25 | 26 | /* 27 | * IAP Commands 28 | */ 29 | #define IAP_PREPARE_SECTOR 50 30 | #define IAP_COPY_RAM_TO_FLASH 51 31 | #define IAP_ERASE_SECTOR 52 32 | #define IAP_BLANK_CHECK_SECTOR 53 33 | #define IAP_READ_PART_ID 54 34 | #define IAP_READ_BOOT_CODE_VERSION 55 35 | #define IAP_COMPARE 56 36 | #define IAP_REINVOKE_ISP 57 37 | #define IAP_READ_SERIAL 58 38 | 39 | /* 40 | * IAP Error Codes 41 | */ 42 | #define IAP_CMD_SUCCESS 0 43 | #define IAP_INVALID_COMMAND 1 44 | #define IAP_SRC_ADDR_ERROR 2 45 | #define IAP_DST_ADDR_ERROR 3 46 | #define IAP_SRC_ADDR_NOT_MAPPED 4 47 | #define IAP_DST_ADDR_NOT_MAPPED 5 48 | #define IAP_COUNT_ERROR 6 49 | #define IAP_INVALID_SECTOR 7 50 | #define IAP_SECTOR_NOT_BLANK 8 51 | #define IAP_SECTOR_NOT_PREPARED 9 52 | #define IAP_COMPARE_ERROR 10 53 | #define IAP_BUSY 11 54 | #define IAP_PARAM_ERROR 12 55 | #define IAP_ADDR_ERROR 13 56 | #define IAP_ADDR_NOT_MAPPED 14 57 | #define IAP_CMD_LOCKED 15 58 | #define IAP_INVALID_CODE 16 59 | #define IAP_INALID_BAUD_RATE 17 60 | #define IAP_INVALID_STOP_BIT 18 61 | #define IAP_CODE_READ_PROTECTION 19 62 | 63 | typedef struct { 64 | unsigned long base; 65 | unsigned long size; 66 | } IAPSector; 67 | 68 | extern int iapFindSector( unsigned long addr, 69 | unsigned long *base, 70 | unsigned long *size ); 71 | 72 | extern unsigned int iapErase( unsigned long dst, 73 | unsigned len, 74 | unsigned int clk_khz ); 75 | 76 | extern unsigned int iapWrite( unsigned long dst, 77 | const void *src, 78 | unsigned len, 79 | unsigned int clk_khz ); 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /common/inc/LPC17xx_bits.h: -------------------------------------------------------------------------------- 1 | #ifndef LPC17XX_BITS_H 2 | #define LPC17XX_BITS_H 3 | 4 | #define PCLK_CCLK4 0 5 | #define PCLK_CCLK 1 6 | #define PCLK_CCLK2 2 7 | #define PCLK_CCLK8 3 8 | #define PCLK_UART0(n) ((n) << 6) 9 | #define PCLK_SSP1(n) ((n) << 20) 10 | 11 | #define SCS_OSCRANGE (1 << 4) 12 | #define SCS_OSCEN (1 << 5) 13 | #define SCS_OSCSTAT (1 << 6) 14 | 15 | #define PLLnCON_Enable (1 << 0) 16 | #define PLLnCON_Connect (1 << 1) 17 | 18 | #define TnTCR_Counter_Enable (1 << 0) 19 | #define TnTCR_Counter_Reset (1 << 1) 20 | 21 | #define SSPnSR_Transmit_Empty (1 << 0) 22 | #define SSPnSR_Transmit_Not_Full (1 << 1) 23 | 24 | #define UARTnFCR_FIFO_Enable (1 << 0) 25 | #define UARTnFCR_RX_Reset (1 << 1) 26 | #define UARTnFCR_TX_Reset (1 << 2) 27 | #define UARTnTER_TX_Enable (1 << 7) 28 | #define UARTnLCR_8bit (3 << 0) 29 | #define UARTnLCR_2stop (1 << 2) 30 | #define UARTnLCR_DLAB (1 << 7) 31 | #define UARTnLSR_THR_Empty (1 << 5) 32 | 33 | #define WDMOD_WDEN (1 << 0) 34 | #define WDMOD_WDRESET (1 << 1) 35 | #define WDMOD_WDTOF (1 << 2) 36 | #define WDMOD_WDINT (1 << 3) 37 | #define WDSEL_WDLOCK (1 << 31) 38 | 39 | #define SSP_SR_TFE (1 << 0) 40 | #define SSP_SR_TNF (1 << 1) 41 | #define SSP_SR_RNE (1 << 2) 42 | #define SSP_SR_RFF (1 << 3) 43 | #define SSP_SR_BSY (1 << 4) 44 | 45 | #define SSP_CR0_DSS_8 (7) 46 | #define SSP_CR0_DSS_16 (15) 47 | #define SSP_CR1_SSP_EN (1 << 1) 48 | 49 | #define I2C_I2CONSET_AA (1 << 2) 50 | #define I2C_I2CONSET_SI (1 << 3) 51 | #define I2C_I2CONSET_STO (1 << 4) 52 | #define I2C_I2CONSET_STA (1 << 5) 53 | #define I2C_I2CONSET_I2EN (1 << 6) 54 | #define I2C_I2CONCLR_AAC (1 << 2) 55 | #define I2C_I2CONCLR_SIC (1 << 3) 56 | #define I2C_I2CONCLR_STAC (1 << 5) 57 | #define I2C_I2CONCLR_I2ENC (1 << 6) 58 | 59 | #define DMACC_Control_SBSIZE_1 (0 << 12) 60 | #define DMACC_Control_DBSIZE_1 (0 << 15) 61 | #define DMACC_Control_SBSIZE_4 (1 << 12) 62 | #define DMACC_Control_DBSIZE_4 (1 << 15) 63 | #define DMACC_Control_SBSIZE_8 (2 << 12) 64 | #define DMACC_Control_DBSIZE_8 (2 << 15) 65 | #define DMACC_Control_SWIDTH_8 (0 << 18) 66 | #define DMACC_Control_DWIDTH_8 (0 << 21) 67 | #define DMACC_Control_SI (1 << 26) 68 | #define DMACC_Control_DI (1 << 27) 69 | 70 | #define DMACC_Config_SrcPeripheral_SSP0Rx (1 << 1) 71 | #define DMACC_Config_SrcPeripheral_UART1Rx (11 << 1) 72 | #define DMACC_Config_DestPeripheral_SSP0Tx (0 << 6) 73 | #define DMACC_Config_DestPeripheral_UART1Tx (10 << 6) 74 | #define DMACC_Config_DestPeripheral_UART2Tx (12 << 6) 75 | #define DMACC_Config_DestPeripheral_UART3Tx (14 << 6) 76 | #define DMACC_Config_M2P (1 << 11) 77 | #define DMACC_Config_P2M (2 << 11) 78 | #define DMACC_Config_E (1 << 0) 79 | #define DMACC_Config_H (1 << 18) 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /common/inc/assert.h: -------------------------------------------------------------------------------- 1 | /* assert()-style macros. 2 | * 3 | * Copyright (c) 2009-2010 Jacob Potter. 4 | * 5 | * ASSERT(exp) is a standard assert macro, like assert(). 6 | * 7 | * ASSERT_EQUAL(), ASSERT_NOT_EQUAL(), ASSERT_NULL(), and ASSERT_NOT_NULL() 8 | * are designed to be more helpful; they print the offending values if they 9 | * fail. 10 | */ 11 | 12 | #ifndef ASSERT_H 13 | #define ASSERT_H 14 | 15 | #include 16 | 17 | #if 1 18 | 19 | #define likely(x) __builtin_expect((x),1) 20 | #define unlikely(x) __builtin_expect((x),0) 21 | 22 | #define ASSERT(exp) ((void)(likely(exp) ? 0 \ 23 | : panic("%s:%d: Failed assertion \"%s\"", __FILE__, __LINE__, #exp))) 24 | 25 | #define ASSERT_EQUAL(e1, e2) do { \ 26 | int _a_v1 = (e1), _a_v2 = (e2); \ 27 | if (unlikely(_a_v1 != _a_v2)) \ 28 | panic("%s:%d: Failed assertion \"%s == %s\": %d != %d", \ 29 | __FILE__, __LINE__, #e1, #e2, _a_v1, _a_v2); \ 30 | } while(0) 31 | 32 | #define ASSERT_EQUAL_P(e1, e2) do { \ 33 | void * _a_v1 = (e1), * _a_v2 = (e2); \ 34 | if (unlikely(_a_v1 != _a_v2)) \ 35 | panic("%s:%d: Failed assertion \"%s == %s\": %p != %p", \ 36 | __FILE__, __LINE__, #e1, #e2, _a_v1, _a_v2); \ 37 | } while(0) 38 | 39 | #define ASSERT_NOT_EQUAL(e1, e2) do { \ 40 | int _a_v1 = (e1), _a_v2 = (e2); \ 41 | if (unlikely(_a_v1 == _a_v2)) \ 42 | panic("%s:%d: Failed assertion \"%s != %s\": both %d", \ 43 | __FILE__, __LINE__, #e1, #e2, _a_v1); \ 44 | } while(0) 45 | 46 | #define ASSERT_NULL(e) do { \ 47 | void * _a_p = (e); \ 48 | if (unlikely(_a_p != NULL)) \ 49 | panic("%s:%d: Failed assertion \"%s == NULL\": got %p", \ 50 | __FILE__, __LINE__, #e, _a_p); \ 51 | } while(0) 52 | 53 | #define ASSERT_NOT_NULL(e) do { \ 54 | void * _a_p = (e); \ 55 | if (unlikely(_a_p == NULL)) \ 56 | panic("%s:%d: Failed assertion \"%s != NULL\"", \ 57 | __FILE__, __LINE__, #e); \ 58 | } while(0) 59 | 60 | #define ASSERT_BIT(e) do { \ 61 | void * _a_p = (e); \ 62 | if (unlikely(_a_p != NULL)) \ 63 | panic("%s:%d: Failed assertion \"%s != NULL\"", \ 64 | __FILE__, __LINE__, #e); \ 65 | } while(0) 66 | 67 | #define ASSERT_OK(e) ASSERT_EQUAL(e, 0) 68 | 69 | #else 70 | 71 | #define ASSERT(exp) 72 | #define ASSERT_EQUAL(e1, e2) 73 | #define ASSERT_EQUAL_P(e1, e2) 74 | #define ASSERT_NOT_EQUAL(e1, e2) 75 | #define ASSERT_NULL(e) 76 | #define ASSERT_NOT_NULL(e) 77 | #define ASSERT_BIT(e) 78 | 79 | #endif 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /common/inc/diskio.h: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------- 2 | / Low level disk interface modlue include file R0.07 (C)ChaN, 2009 3 | /-----------------------------------------------------------------------*/ 4 | 5 | #ifndef _DISKIO 6 | 7 | #define _READONLY 0 /* 1: Read-only mode */ 8 | #define _USE_IOCTL 1 9 | 10 | #include "ff.h" 11 | 12 | /* Status of Disk Functions */ 13 | typedef BYTE DSTATUS; 14 | 15 | /* Results of Disk Functions */ 16 | typedef enum { 17 | RES_OK = 0, /* 0: Successful */ 18 | RES_ERROR, /* 1: R/W Error */ 19 | RES_WRPRT, /* 2: Write Protected */ 20 | RES_NOTRDY, /* 3: Not Ready */ 21 | RES_PARERR /* 4: Invalid Parameter */ 22 | } DRESULT; 23 | 24 | 25 | /*---------------------------------------*/ 26 | /* Prototypes for disk control functions */ 27 | 28 | DSTATUS disk_initialize (BYTE); 29 | DSTATUS disk_status (BYTE); 30 | DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE); 31 | #if _READONLY == 0 32 | DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE); 33 | #endif 34 | DRESULT disk_ioctl (BYTE, BYTE, void*); 35 | 36 | 37 | 38 | /* Disk Status Bits (DSTATUS) */ 39 | 40 | #define STA_NOINIT 0x01 /* Drive not initialized */ 41 | #define STA_NODISK 0x02 /* No medium in the drive */ 42 | #define STA_PROTECT 0x04 /* Write protected */ 43 | 44 | 45 | /* Command code for disk_ioctrl() */ 46 | 47 | /* Generic command */ 48 | #define CTRL_SYNC 0 /* Mandatory for write functions */ 49 | #define GET_SECTOR_COUNT 1 /* Mandatory for only f_mkfs() */ 50 | #define GET_SECTOR_SIZE 2 /* Mandatory for multiple sector size cfg */ 51 | #define GET_BLOCK_SIZE 3 /* Mandatory for only f_mkfs() */ 52 | #define CTRL_POWER 4 53 | #define CTRL_LOCK 5 54 | #define CTRL_EJECT 6 55 | /* MMC/SDC command */ 56 | #define MMC_GET_TYPE 10 57 | #define MMC_GET_CSD 11 58 | #define MMC_GET_CID 12 59 | #define MMC_GET_OCR 13 60 | #define MMC_GET_SDSTAT 14 61 | /* ATA/CF command */ 62 | #define ATA_GET_REV 20 63 | #define ATA_GET_MODEL 21 64 | #define ATA_GET_SN 22 65 | 66 | 67 | #define _DISKIO 68 | #endif 69 | -------------------------------------------------------------------------------- /common/inc/hardware.h: -------------------------------------------------------------------------------- 1 | /* j4cDAC common hardware functions 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of either the GNU General Public License version 2 7 | * or 3, or the GNU Lesser General Public License version 3, as published 8 | * by the Free Software Foundation, at your option. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | #ifndef COMMON_HARDWARE_H 20 | #define COMMON_HARDWARE_H 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | enum hw_board_rev { 27 | HW_REV_PROTO = 0, 28 | HW_REV_MP1 = 1, 29 | HW_REV_MP2 = 2, 30 | }; 31 | 32 | extern enum hw_board_rev hw_board_rev; 33 | 34 | void hw_get_board_rev(); 35 | void hw_dac_init(void); 36 | void hw_dac_zero_all_channels(void); 37 | void hw_open_interlock_forever(void) __attribute__((noreturn)); 38 | 39 | int clock_init(void); 40 | 41 | void led_set_frontled(int state); 42 | void led_set_backled(int state); 43 | void led_init(void); 44 | 45 | static inline void __attribute__((always_inline, unused)) 46 | hw_dac_write(uint16_t word) { 47 | while (!(LPC_SSP1->SR & SSPnSR_Transmit_Not_Full)); 48 | LPC_SSP1->DR = word; 49 | } 50 | 51 | static inline void __attribute__((always_inline, unused)) 52 | hw_dac_write32(uint32_t word) { 53 | while (!(LPC_SSP1->SR & SSPnSR_Transmit_Empty)); 54 | LPC_GPIO0->FIOCLR = (1 << 6); 55 | LPC_SSP1->DR = word >> 16; 56 | LPC_SSP1->DR = word & 0xFFFF; 57 | while ((LPC_SSP1->SR & SSP_SR_BSY)); 58 | LPC_GPIO0->FIOSET = (1 << 6); 59 | } 60 | 61 | void watchdog_init(void); 62 | void watchdog_feed(void); 63 | 64 | #define FORCE_BOOTLOAD_FLAG (*(volatile uint32_t *)0x20083FFC) 65 | #define FORCE_BOOTLOAD_VALUE 0xF0ADF0AD 66 | 67 | #define PCLKSEL0_INIT_VALUE PCLK_UART0(PCLK_CCLK) | PCLK_SSP1(PCLK_CCLK) 68 | #define PCLKSEL1_INIT_VALUE 0 69 | #define PCONP_INIT_VALUE 0xE7A884DE 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /common/inc/panic.h: -------------------------------------------------------------------------------- 1 | /* j4cDAC - panic! 2 | * 3 | * Copyright 2010 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef PANIC_H 19 | #define PANIC_H 20 | 21 | void panic(const char *fmt, ...) __attribute__((noreturn)); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /common/inc/sdcard.h: -------------------------------------------------------------------------------- 1 | /* LPC1758 SD driver 2 | * 3 | * Jacob Potter 4 | * December 2010 5 | * 6 | * Based on code from NXP app note AN10916. 7 | */ 8 | 9 | #ifndef SDCARD_H 10 | #define SDCARD_H 11 | 12 | #include 13 | 14 | #define SD_SECTOR_SIZE 512 15 | 16 | struct sdcard_config { 17 | uint32_t size; // size=sectorsize*sectorcnt 18 | uint32_t sectorcnt; // 19 | uint32_t blocksize; // erase block size 20 | uint8_t ocr[4]; 21 | uint8_t cid[16]; 22 | uint8_t csd[16]; 23 | }; 24 | 25 | extern struct sdcard_config sdcard_config; 26 | 27 | /* Card type flags (sdcard_card_type) */ 28 | #define CT_NONE 0x00 29 | #define CT_MMC 0x01 30 | #define CT_SD1 0x02 31 | #define CT_SD2 0x04 32 | #define CT_SDC (CT_SD1|CT_SD2) 33 | #define CT_BLOCK 0x08 34 | extern uint8_t sdcard_card_type; 35 | 36 | int sdcard_init(void); 37 | int sdcard_wait_for_ready(void); 38 | int sdcard_read(uint8_t * buf, int sector, int count); 39 | int sdcard_write(const uint8_t * buf, int sector, int count); 40 | int sdcard_get_sd_status(uint8_t * buf); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /common/inc/serial.h: -------------------------------------------------------------------------------- 1 | #ifndef SERIAL_H 2 | #define SERIAL_H 3 | 4 | #ifndef NULL 5 | #define NULL 0 6 | #endif 7 | 8 | #include 9 | 10 | void debugf(const char *fmt, ...); 11 | void outputf(const char *fmt, ...); 12 | void hexdump(const char * data, int len); 13 | void serial_init(); 14 | void serial_send(const char *buf, int len); 15 | 16 | static inline void serial_send_str(const char *buf) { 17 | serial_send(buf, strlen(buf)); 18 | } 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /common/lib/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.boot.o 3 | -------------------------------------------------------------------------------- /common/lib/build_id.c: -------------------------------------------------------------------------------- 1 | const char build[32] = BUILDID; 2 | -------------------------------------------------------------------------------- /common/lib/diskio.c: -------------------------------------------------------------------------------- 1 | /* Adapter between SD card driver and FatFs interface 2 | * 3 | * Jacob Potter 4 | * December 2010 5 | * 6 | * Based on code from NXP app note AN10916. 7 | */ 8 | 9 | #include "ff.h" 10 | #include "diskio.h" 11 | #include 12 | #include 13 | 14 | static volatile BYTE Stat = STA_NOINIT; 15 | 16 | /* disk_initialize 17 | * 18 | * Set up the disk. 19 | */ 20 | DSTATUS disk_initialize (BYTE drv) { 21 | if (drv == 0 && sdcard_init() == 0) { 22 | Stat &= ~STA_NOINIT; 23 | } 24 | 25 | return Stat; 26 | } 27 | 28 | /* disk_read 29 | * 30 | * Read some sectors. 31 | */ 32 | DRESULT disk_read (BYTE drv, BYTE *buf, DWORD sector, BYTE count) { 33 | if (drv || !count) return RES_PARERR; 34 | if (Stat & STA_NOINIT) return RES_NOTRDY; 35 | if (sdcard_read(buf, sector, count) == 0) 36 | return RES_OK; 37 | else 38 | return RES_ERROR; 39 | } 40 | 41 | /* disk_write 42 | * 43 | * Write some sectors. 44 | */ 45 | DRESULT disk_write (BYTE drv, const BYTE *buf, DWORD sector, BYTE count) { 46 | if (drv || !count) return RES_PARERR; 47 | if (Stat & STA_NOINIT) return RES_NOTRDY; 48 | if (sdcard_write(buf, sector, count) == 0) 49 | return RES_OK; 50 | else 51 | return RES_ERROR; 52 | } 53 | 54 | /* disk_status 55 | * 56 | * Check the status of this drive. All we know how to say is "initialized" 57 | * vs "uninitialized". 58 | */ 59 | DSTATUS disk_status (BYTE drv) { 60 | if (drv) return STA_NOINIT; 61 | return Stat; 62 | } 63 | 64 | /* disk_ioctl 65 | * 66 | * Everything else. 67 | */ 68 | DRESULT disk_ioctl (BYTE drv, BYTE ctrl, void *buf) { 69 | DRESULT res; 70 | 71 | if (drv) return RES_PARERR; 72 | if (Stat & STA_NOINIT) return RES_NOTRDY; 73 | 74 | res = RES_ERROR; 75 | 76 | switch (ctrl) { 77 | case CTRL_SYNC: 78 | /* Make sure that no pending write process */ 79 | if (sdcard_wait_for_ready() == 0) 80 | res = RES_OK; 81 | break; 82 | 83 | case GET_SECTOR_COUNT: 84 | /* Get number of sectors on the disk (DWORD) */ 85 | *(DWORD*)buf = sdcard_config.sectorcnt; 86 | res = RES_OK; 87 | break; 88 | 89 | case GET_SECTOR_SIZE: 90 | /* Get R/W sector size (WORD) */ 91 | *(WORD*)buf = 512; 92 | res = RES_OK; 93 | break; 94 | 95 | case GET_BLOCK_SIZE: 96 | /* Get erase block size in unit of sector (DWORD) */ 97 | *(DWORD*)buf = sdcard_config.blocksize; 98 | res = RES_OK; 99 | break; 100 | 101 | case MMC_GET_TYPE: 102 | /* Get card type flags (1 byte) */ 103 | *(BYTE*)buf = sdcard_card_type; 104 | res = RES_OK; 105 | break; 106 | 107 | case MMC_GET_CSD: 108 | /* Receive CSD as a data block (16 bytes) */ 109 | memcpy(buf, sdcard_config.csd, sizeof(sdcard_config.csd)); 110 | res = RES_OK; 111 | break; 112 | 113 | case MMC_GET_CID: 114 | /* Receive CID as a data block (16 bytes) */ 115 | memcpy(buf, sdcard_config.cid, sizeof(sdcard_config.cid)); 116 | res = RES_OK; 117 | break; 118 | 119 | case MMC_GET_OCR: 120 | /* Receive OCR as an R3 resp (4 bytes) */ 121 | memcpy(buf, sdcard_config.ocr, sizeof(sdcard_config.ocr)); 122 | res = RES_OK; 123 | break; 124 | 125 | case MMC_GET_SDSTAT: 126 | /* Receive SD status as a data block (64 bytes) */ 127 | if (sdcard_get_sd_status(buf) == 0) 128 | res = RES_OK; 129 | break; 130 | 131 | default: 132 | res = RES_PARERR; 133 | } 134 | 135 | return res; 136 | } 137 | -------------------------------------------------------------------------------- /common/lib/eeprom.c: -------------------------------------------------------------------------------- 1 | /* j4cDAC - i2c EEPROM driver 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #define I2C LPC_I2C1 23 | #define I2C_FREQ 50000 24 | 25 | /* Default MAC address for prototype boards */ 26 | uint8_t mac_address[] = { 0x10, 0x1f, 0xe0, 0x12, 0x1d, 0x0c }; 27 | 28 | static void eeprom_i2c_start(void) { 29 | I2C->I2CONCLR = I2C_I2CONCLR_SIC; 30 | I2C->I2CONSET = I2C_I2CONSET_STA; 31 | 32 | // Wait for complete 33 | while (!(I2C->I2CONSET & I2C_I2CONSET_SI)); 34 | I2C->I2CONCLR = I2C_I2CONCLR_STAC; 35 | } 36 | 37 | static void eeprom_i2c_stop(void) { 38 | if (I2C->I2CONSET & I2C_I2CONSET_STA) 39 | I2C->I2CONCLR = I2C_I2CONCLR_STAC; 40 | I2C->I2CONSET = I2C_I2CONSET_STO; 41 | I2C->I2CONCLR = I2C_I2CONCLR_SIC; 42 | } 43 | 44 | static void eeprom_i2c_send(uint8_t data) { 45 | if (I2C->I2CONSET & I2C_I2CONSET_STA) 46 | I2C->I2CONCLR = I2C_I2CONCLR_STAC; 47 | I2C->I2DAT = data; 48 | I2C->I2CONCLR = I2C_I2CONCLR_SIC; 49 | 50 | while (!(I2C->I2CONSET & I2C_I2CONSET_SI)); 51 | } 52 | 53 | static uint8_t eeprom_i2c_recv() { 54 | I2C->I2CONSET = I2C_I2CONSET_AA; 55 | I2C->I2CONCLR = I2C_I2CONCLR_SIC; 56 | 57 | while (!(I2C->I2CONSET & I2C_I2CONSET_SI)); 58 | return I2C->I2DAT; 59 | } 60 | 61 | static uint8_t eeprom_i2c_recvnak() { 62 | I2C->I2CONCLR = (I2C_I2CONCLR_AAC | I2C_I2CONCLR_SIC); 63 | 64 | while (!(I2C->I2CONSET & I2C_I2CONSET_SI)); 65 | return I2C->I2DAT; 66 | } 67 | 68 | void eeprom_init(void) { 69 | 70 | /* If we don't have an EEPROM, just use the default */ 71 | if (hw_board_rev == HW_REV_PROTO) 72 | return; 73 | 74 | /* Turn on peripheral */ 75 | I2C->I2SCLH = SystemCoreClock / (4 * I2C_FREQ); 76 | I2C->I2SCLL = SystemCoreClock / (4 * I2C_FREQ); 77 | I2C->I2CONCLR = I2C_I2CONCLR_AAC | I2C_I2CONCLR_STAC \ 78 | | I2C_I2CONCLR_I2ENC; 79 | I2C->I2CONSET = I2C_I2CONSET_I2EN; 80 | 81 | /* Set pins */ 82 | LPC_PINCON->PINSEL0 |= (3 << 0) | (3 << 2); 83 | LPC_PINCON->PINMODE_OD0 |= 3; 84 | 85 | /* Read MAC */ 86 | eeprom_i2c_start(); 87 | eeprom_i2c_send(0xA0); 88 | eeprom_i2c_send(0xFA); 89 | eeprom_i2c_start(); 90 | eeprom_i2c_send(0xA1); 91 | 92 | int i; 93 | for (i = 0; i < 5; i++) { 94 | mac_address[i] = eeprom_i2c_recv(); 95 | } 96 | mac_address[5] = eeprom_i2c_recvnak(); 97 | 98 | eeprom_i2c_stop(); 99 | 100 | outputf("MAC address: %02x:%02x:%02x:%02x:%02x:%02x", 101 | mac_address[0], mac_address[1], mac_address[2], 102 | mac_address[3], mac_address[4], mac_address[5]); 103 | } 104 | 105 | INITIALIZER(hardware, eeprom_init); 106 | -------------------------------------------------------------------------------- /common/lib/serial.c: -------------------------------------------------------------------------------- 1 | #include "LPC17xx.h" 2 | #include "LPC17xx_bits.h" 3 | #include 4 | #include 5 | 6 | #define DEBUG_UART LPC_UART0 7 | 8 | int vsnprintf(char *buf, unsigned int len, const char *fmt, va_list va); 9 | 10 | void serial_init() { 11 | /* Configure pins */ 12 | LPC_PINCON->PINSEL0 = 13 | (LPC_PINCON->PINSEL0 & ~((3 << 4) | (3 << 6))) 14 | | (1 << 4) | (1 << 6); 15 | 16 | /* Reset FIFOs */ 17 | DEBUG_UART->FCR = UARTnFCR_FIFO_Enable | UARTnFCR_RX_Reset \ 18 | | UARTnFCR_TX_Reset; 19 | DEBUG_UART->FCR = 0; 20 | DEBUG_UART->IER = 0; 21 | DEBUG_UART->ACR = 0; 22 | 23 | uint32_t inputclock = SystemCoreClock >> 4; 24 | uint32_t baudrate = 230400; 25 | 26 | /* Calculate baud rate - there's a fractional baud rate generator 27 | * in the LPC17xx UART, so we brute-force search for the best setting 28 | * for it. */ 29 | int div, mul; 30 | int bestError = baudrate, bestDiv = 0, bestMul = 0, bestDivisor = 0; 31 | for (mul = 1; mul < 16; mul++) { 32 | for (div = 0; div < mul; div++) { 33 | int frac = (inputclock * mul) / (mul + div); 34 | int divisor = frac / baudrate; 35 | if ((frac * baudrate) / (baudrate / 2)) 36 | divisor++; 37 | if (divisor >= 65536) 38 | continue; 39 | if (divisor < 1) 40 | continue; 41 | 42 | int resultbaud = frac / divisor; 43 | int error = resultbaud - baudrate; 44 | if (error < 0) 45 | error = -error; 46 | 47 | if (error < bestError) { 48 | bestError = error; 49 | bestMul = mul; 50 | bestDiv = div; 51 | bestDivisor = divisor; 52 | } 53 | 54 | if (!error) 55 | break; 56 | } 57 | } 58 | 59 | DEBUG_UART->LCR |= UARTnLCR_DLAB; 60 | DEBUG_UART->DLM = (bestDivisor >> 8) & 0xff; 61 | DEBUG_UART->DLL = bestDivisor & 0xff; 62 | DEBUG_UART->LCR &= ~UARTnLCR_DLAB; 63 | DEBUG_UART->FDR = (bestMul << 4) | bestDiv; 64 | DEBUG_UART->LCR = UARTnLCR_8bit; 65 | DEBUG_UART->FCR = UARTnFCR_FIFO_Enable; 66 | DEBUG_UART->TER |= UARTnTER_TX_Enable; 67 | } 68 | 69 | void serial_send(const char *buf, int len) { 70 | while (len--) { 71 | while (!(DEBUG_UART->LSR & UARTnLSR_THR_Empty)); 72 | DEBUG_UART->THR = ((uint8_t)*buf); 73 | buf++; 74 | } 75 | } 76 | 77 | void outputf(const char *fmt, ...) { 78 | va_list va; 79 | char buffer[80]; 80 | int n; 81 | 82 | va_start(va, fmt); 83 | n = vsnprintf(buffer, sizeof(buffer) - 2, fmt, va); 84 | 85 | if (n > (sizeof(buffer) - 2)) 86 | n = sizeof(buffer) - 2; 87 | 88 | if (n > 1 && !buffer[n-1] && buffer[n-2] == '\n') 89 | n -= 2; 90 | 91 | buffer[n] = '\r'; 92 | buffer[n + 1] = '\n'; 93 | 94 | serial_send(buffer, n + 2); 95 | } 96 | 97 | void debugf(const char *fmt, ...) { 98 | va_list va; 99 | char buffer[80]; 100 | int n; 101 | 102 | va_start(va, fmt); 103 | n = vsnprintf(buffer, sizeof(buffer), fmt, va); 104 | 105 | if (n > (sizeof(buffer))) 106 | n = sizeof(buffer); 107 | 108 | serial_send(buffer, n); 109 | } 110 | 111 | static const char hexarr[] = "0123456789ABCDEF"; 112 | 113 | void hexdump(const char *data, int len) { 114 | int i; 115 | char c, buf[2]; 116 | 117 | for (i = 0; i < len; i++) { 118 | c = data[i]; 119 | buf[0] = hexarr[c >> 4]; 120 | buf[1] = hexarr[c & 0xF]; 121 | serial_send(buf, 2); 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /common/openocd.cfg: -------------------------------------------------------------------------------- 1 | interface ft2232 2 | 3 | source [find interface/olimex-jtag-tiny.cfg] 4 | source [find target/lpc1768.cfg] 5 | 6 | proc dac_erase { } { 7 | flash erase_sector 0 0 last 8 | } 9 | 10 | proc flash_bootloader { } { 11 | flash write_image erase ../boot/bootrom.hex 12 | } 13 | -------------------------------------------------------------------------------- /common/protocol.h: -------------------------------------------------------------------------------- 1 | /* j4cDAC protocol definition 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of either the GNU General Public License version 2 7 | * or 3, or the GNU Lesser General Public License version 3, as published 8 | * by the Free Software Foundation, at your option. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | #ifndef PROTOCOL_H 20 | #define PROTOCOL_H 21 | 22 | #include 23 | 24 | #ifdef _MSC_VER 25 | typedef unsigned int uint32_t; 26 | typedef unsigned short uint16_t; 27 | typedef short int16_t; 28 | typedef unsigned char uint8_t; 29 | #pragma pack(1) 30 | #define __attribute__(x) 31 | #else 32 | #include 33 | #endif 34 | 35 | typedef struct dac_point { 36 | uint16_t control; 37 | int16_t x; 38 | int16_t y; 39 | uint16_t r; 40 | uint16_t g; 41 | uint16_t b; 42 | uint16_t i; 43 | uint16_t u1; 44 | uint16_t u2; 45 | } dac_point_t; 46 | 47 | #define DAC_CTRL_RATE_CHANGE 0x8000 48 | 49 | struct dac_status { 50 | uint8_t protocol; 51 | uint8_t light_engine_state; 52 | uint8_t playback_state; 53 | uint8_t source; 54 | uint16_t light_engine_flags; 55 | uint16_t playback_flags; 56 | uint16_t source_flags; 57 | uint16_t buffer_fullness; 58 | uint32_t point_rate; 59 | uint32_t point_count; 60 | } __attribute__ ((packed)); 61 | 62 | struct dac_broadcast { 63 | uint8_t mac_address[6]; 64 | uint16_t hw_revision; 65 | uint16_t sw_revision; 66 | uint16_t buffer_capacity; 67 | uint32_t max_point_rate; 68 | struct dac_status status; 69 | } __attribute__ ((packed)); 70 | 71 | struct begin_command { 72 | uint8_t command; /* 'b' (0x62) */ 73 | uint16_t low_water_mark; 74 | uint32_t point_rate; 75 | } __attribute__ ((packed)); 76 | 77 | struct queue_command { 78 | uint8_t command; /* 'q' (0x74) */ 79 | uint32_t point_rate; 80 | } __attribute__ ((packed)); 81 | 82 | struct data_command { 83 | uint8_t command; /* 'd' (0x64) */ 84 | uint16_t npoints; 85 | struct dac_point data[]; 86 | } __attribute__ ((packed)); 87 | 88 | struct data_command_header { 89 | uint8_t command; /* 'd' (0x64) */ 90 | uint16_t npoints; 91 | } __attribute__ ((packed)); 92 | 93 | struct dac_response { 94 | uint8_t response; 95 | uint8_t command; 96 | struct dac_status dac_status; 97 | } __attribute__ ((packed)); 98 | 99 | #define CONNCLOSED_USER (1) 100 | #define CONNCLOSED_UNKNOWNCMD (2) 101 | #define CONNCLOSED_SENDFAIL (3) 102 | #define CONNCLOSED_MASK (0xF) 103 | 104 | #define RESP_ACK 'a' 105 | #define RESP_NAK_FULL 'F' 106 | #define RESP_NAK_INVL 'I' 107 | #define RESP_NAK_ESTOP '!' 108 | 109 | #define PLUGIN_SIZE 600 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /common/settings.h: -------------------------------------------------------------------------------- 1 | /* j4cDAC configurable state 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of either the GNU General Public License version 2 7 | * or 3, or the GNU Lesser General Public License version 3, as published 8 | * by the Free Software Foundation, at your option. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | #ifndef SETTINGS_H 20 | #define SETTINGS_H 21 | 22 | typedef struct dac_settings_s { 23 | /* IP config. To use DHCP, set ip_addr to 0.0.0.0; other fields will 24 | * then be ignored. */ 25 | uint8_t ip_addr[4]; 26 | uint8_t ip_netmask[4]; 27 | uint8_t ip_gateway[4]; 28 | 29 | /* Color delay lines */ 30 | uint8_t r_delay; 31 | uint8_t g_delay; 32 | uint8_t b_delay; 33 | uint8_t i_delay; 34 | 35 | /* Geometric correction */ 36 | int32_t transform_x[4]; 37 | int32_t transform_y[4]; 38 | 39 | } dac_settings_t; 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /doc/CMSIS_V1P30/CMSIS debug support.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j4cbo/j4cDAC/12ecbe565fcaa88f771b1bfdfb1852baca38fbe6/doc/CMSIS_V1P30/CMSIS debug support.htm -------------------------------------------------------------------------------- /doc/CMSIS_V1P30/CMSIS_Core.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j4cbo/j4cDAC/12ecbe565fcaa88f771b1bfdfb1852baca38fbe6/doc/CMSIS_V1P30/CMSIS_Core.htm -------------------------------------------------------------------------------- /doc/CMSIS_V1P30/License.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j4cbo/j4cDAC/12ecbe565fcaa88f771b1bfdfb1852baca38fbe6/doc/CMSIS_V1P30/License.doc -------------------------------------------------------------------------------- /doc/vm-setup: -------------------------------------------------------------------------------- 1 | Start with debian-507-i386-netinst.iso; install a minimal system. 2 | 3 | As root: 4 | 5 | apt-get install git-core sudo python-serial openssh-server wget bzip2 subversion 6 | cd /usr/local 7 | wget -O- http://www.codesourcery.com/sgpp/lite/arm/portal/package7813/public/arm-none-eabi/arm-2010.09-51-arm-none-eabi-i686-pc-linux-gnu.tar.bz2 | tar xvj 8 | cd bin; for i in /usr/local/arm-2010.09/bin/*; do ln -s $i; done 9 | 10 | Then, as the user you've created: 11 | 12 | git clone https://j4cbo@github.com/j4cbo/j4cDAC.git 13 | svn co https://lpc21isp.svn.sourceforge.net/svnroot/lpc21isp 14 | -------------------------------------------------------------------------------- /driver/.gitignore: -------------------------------------------------------------------------------- 1 | EtherDream.dll 2 | -------------------------------------------------------------------------------- /driver/README.md: -------------------------------------------------------------------------------- 1 | Reference Linux driver and WAV player. 2 | 3 | The Windows driver is located here: https://github.com/j4cbo/etherdream-driver 4 | -------------------------------------------------------------------------------- /driver/ilda-player/Makefile: -------------------------------------------------------------------------------- 1 | SRCS = play.cpp ilda.cpp ../libetherdream/etherdream.c 2 | 3 | CFLAGS := -I../../common -I../libetherdream 4 | 5 | FLAGS = $(CFLAGS) 6 | 7 | play: $(SRCS) 8 | $(CXX) -std=c++1y $(SRCS) -I../src -Wall $(FLAGS) -o $@ 9 | 10 | .PHONY: clean 11 | clean: 12 | rm -f play 13 | -------------------------------------------------------------------------------- /driver/ilda-player/ilda.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include "etherdream.h" 6 | 7 | class ILDAFile { 8 | public: 9 | struct Palette { 10 | static const Palette ilda64; 11 | static const Palette ilda256; 12 | 13 | const uint8_t data[256*3]; 14 | }; 15 | 16 | ILDAFile(const char * filename, 17 | bool do_repeat, 18 | const Palette & palette = Palette::ilda64); 19 | ~ILDAFile(); 20 | 21 | double get_rate() const { return 30000; /* ew */ } 22 | 23 | size_t read(size_t max, 24 | std::vector & point_buf); 25 | 26 | private: 27 | struct Impl; 28 | const std::unique_ptr m_impl; 29 | }; 30 | -------------------------------------------------------------------------------- /driver/libetherdream/.gitignore: -------------------------------------------------------------------------------- 1 | etherdream.dylib 2 | etherdream.o 3 | test 4 | test.dSYM 5 | -------------------------------------------------------------------------------- /driver/libetherdream/Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | CFLAGS = -I../../common -Wall -Wextra -ansi -pedantic -std=c99 -lm -lpthread 3 | 4 | UNAME = $(shell uname) 5 | 6 | ifneq ($(UNAME), Darwin) 7 | CFLAGS += -lrt 8 | endif 9 | 10 | all: test 11 | 12 | ifeq ($(UNAME), Darwin) 13 | all: etherdream.dylib 14 | endif 15 | 16 | test: etherdream.c etherdream.h test.c 17 | $(CC) $(CFLAGS) -g etherdream.c test.c -o $@ 18 | 19 | etherdream.dylib: etherdream.c 20 | gcc $(CFLAGS) -dynamiclib etherdream.c -o etherdream.dylib 21 | 22 | .PHONY: clean 23 | 24 | clean: 25 | rm -rf etherdream.dylib etherdream.c.* test test.dSYM 26 | -------------------------------------------------------------------------------- /driver/wav-player/Makefile: -------------------------------------------------------------------------------- 1 | SRCS = wplay.cpp gl-render.cpp wav8.cpp ../libetherdream/etherdream.c 2 | 3 | CFLAGS := -I../../common -I../libetherdream 4 | 5 | FLAGS = $(CFLAGS) -F/Library/Frameworks -framework SDL2 -framework Cocoa -framework OpenGL -I/usr/local/include -L/usr/local/lib -laudiofile 6 | 7 | wplay: $(SRCS) 8 | $(CXX) -std=c++1y $(SRCS) -I../src -Wall $(FLAGS) -o $@ 9 | 10 | .PHONY: clean 11 | clean: 12 | rm -f wplay 13 | -------------------------------------------------------------------------------- /driver/wav-player/README.txt: -------------------------------------------------------------------------------- 1 | Stuff you'll need: 2 | - Xcode (I'm using 6.2; later versions should work just fine too) 3 | - libaudiofile ('brew install audiofile') 4 | - SDL2 5 | 6 | Then just 'make' and './wplay whateer.flac' 7 | -------------------------------------------------------------------------------- /driver/wav-player/gl-render.cpp: -------------------------------------------------------------------------------- 1 | #include "gl-render.hpp" 2 | #include 3 | #include 4 | 5 | static SDL_Window * win; 6 | 7 | void glr_draw(const std::vector & pts) { 8 | glClear(GL_COLOR_BUFFER_BIT); 9 | 10 | glBegin(GL_LINE_STRIP); 11 | 12 | for (const auto & pt : pts) { 13 | glColor3f(pt.r / 65536.0, pt.g / 65536.0, pt.b / 65536.0); 14 | glVertex2f(pt.x / 32768.0, pt.y / 32768.0); 15 | } 16 | 17 | glEnd(); 18 | SDL_GL_SwapWindow(win); 19 | } 20 | 21 | void glr_init() { 22 | 23 | const int width = 600; 24 | 25 | win = SDL_CreateWindow("wplay", 26 | SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 27 | width, width, 28 | SDL_WINDOW_OPENGL); 29 | 30 | SDL_GL_CreateContext(win); 31 | 32 | glEnable(GL_TEXTURE_2D); 33 | glViewport(0, 0, width, width); 34 | glClearColor(0.0f, 0.0f, 0.0f, 0.0f); 35 | glClear(GL_COLOR_BUFFER_BIT); 36 | glMatrixMode(GL_PROJECTION); 37 | glLoadIdentity(); 38 | glOrtho(0.0f, width, width, 0.0f, -1.0f, 1.0f); 39 | glMatrixMode(GL_MODELVIEW); 40 | glLoadIdentity(); 41 | glTranslatef(width / 2, width / 2, 0); 42 | glScalef(width / -2, width / -2, 0); 43 | } 44 | -------------------------------------------------------------------------------- /driver/wav-player/gl-render.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "etherdream.h" 5 | 6 | void glr_init(); 7 | void glr_draw(const std::vector & vec); 8 | -------------------------------------------------------------------------------- /driver/wav-player/wav8.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | struct etherdream_point; 7 | 8 | class WAV8File { 9 | public: 10 | WAV8File(const char * filename, double initial_seek = 0); 11 | ~WAV8File(); 12 | 13 | double get_rate() const { return m_rate; } 14 | 15 | size_t read(size_t max, 16 | std::vector & point_buf, 17 | std::vector> & audio_buf); 18 | 19 | private: 20 | struct Impl; 21 | const std::unique_ptr m_impl; 22 | const double m_rate; 23 | }; 24 | -------------------------------------------------------------------------------- /firmware/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.elf 3 | *.hex 4 | *.bin 5 | *.binhex 6 | *.map 7 | pc 8 | -------------------------------------------------------------------------------- /firmware/.indent.pro: -------------------------------------------------------------------------------- 1 | -kr -i8 -l78 -lc78 -brf -cp0 -il0 2 | -------------------------------------------------------------------------------- /firmware/abstract/io.c: -------------------------------------------------------------------------------- 1 | /* j4cDAC abstract generator 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include "render.h" 22 | 23 | #define MAX_FIELDS 5 24 | 25 | void dump_state(char *out, int len) { 26 | oscillator_t * const * oscp = oscillators; 27 | while (*oscp) { 28 | oscillator_t *osc = *oscp; 29 | int seclen; 30 | 31 | if (osc->slave_multiplier >= 0) { 32 | int mul = get_mul(osc->slave_multiplier); 33 | seclen = snprintf(out, len, "%s:%d:%lu ", 34 | osc->name, 35 | osc->slave_multiplier, 36 | (long unsigned)(osc->pos - (osc_master.pos * mul)) 37 | ); 38 | } else { 39 | seclen = snprintf(out, len, "%s:%lu ", 40 | osc->name, 41 | (long unsigned)osc->freq 42 | ); 43 | } 44 | 45 | if (seclen >= len) return; 46 | len -= seclen; 47 | out += seclen; 48 | 49 | oscp++; 50 | } 51 | 52 | param_t * const *param = params; 53 | while (*param) { 54 | param_t *p = *param; 55 | int seclen = snprintf(out, len, "%s:%lu ", p->name, 56 | (long unsigned)p->value); 57 | if (seclen >= len) return; 58 | len -= seclen; 59 | out += seclen; 60 | param++; 61 | } 62 | } 63 | 64 | static void parse_update(char **argv) { 65 | if (!argv[0] || !argv[1]) return; 66 | 67 | oscillator_t *osc = get_oscillator(argv[0]); 68 | if (!osc) { 69 | param_t *param = get_param(argv[0]); 70 | if (!param) return; 71 | param->value = atoi(argv[1]); 72 | return; 73 | } 74 | 75 | if (argv[2]) { 76 | osc->slave_multiplier = atoi(argv[1]); 77 | int mul = get_mul(osc->slave_multiplier); 78 | fixed f = atoi(argv[2]); 79 | osc->freq = osc_master.freq * mul / MUL_DENOM; 80 | osc->pos = (osc_master.pos * mul) + f; 81 | } else { 82 | osc->freq = atoi(argv[1]); 83 | osc->slave_multiplier = -1; 84 | } 85 | } 86 | 87 | void abs_parse_line(char *line) { 88 | char *end = line + strlen(line); 89 | 90 | while (end != line && (end[-1] == '\r' || end[-1] == '\n')) 91 | (end--)[-1] = '\0'; 92 | 93 | char *ap; 94 | 95 | /* Split out each space-delimited specifier in the input line */ 96 | while ((ap = strsep(&line, " "))) { 97 | char **avp, *argv[MAX_FIELDS + 1]; 98 | avp = argv; 99 | 100 | /* Split the line into colon-delimited fields */ 101 | while ((*avp = strsep(&ap, ":"))) { 102 | if (**avp == '\0') 103 | continue; 104 | if (++avp >= &argv[MAX_FIELDS]) 105 | break; 106 | } 107 | 108 | *avp = NULL; 109 | 110 | parse_update(argv); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /firmware/drivers/include/debug_frmwrk.h: -------------------------------------------------------------------------------- 1 | /***********************************************************************//** 2 | * @file debug_frmwrk.h 3 | * @brief Contains some utilities that used for debugging through UART 4 | * @version 2.0 5 | * @date 21. May. 2010 6 | * @author NXP MCU SW Application Team 7 | *---------------------------------------------------------------------------- 8 | * Software that is described herein is for illustrative purposes only 9 | * which provides customers with programming information regarding the 10 | * products. This software is supplied "AS IS" without any warranties. 11 | * NXP Semiconductors assumes no responsibility or liability for the 12 | * use of the software, conveys no license or title under any patent, 13 | * copyright, or mask work right to the product. NXP Semiconductors 14 | * reserves the right to make changes in the software without 15 | * notification. NXP Semiconductors also make no representation or 16 | * warranty that such application will be suitable for the specified 17 | * use without further testing or modification. 18 | **********************************************************************/ 19 | 20 | #ifndef DEBUG_FRMWRK_H_ 21 | #define DEBUG_FRMWRK_H_ 22 | 23 | //#include 24 | #include "lpc17xx_uart.h" 25 | 26 | #define USED_UART_DEBUG_PORT 0 27 | 28 | #if (USED_UART_DEBUG_PORT==0) 29 | #define DEBUG_UART_PORT LPC_UART0 30 | #elif (USED_UART_DEBUG_PORT==1) 31 | #define DEBUG_UART_PORT LPC_UART1 32 | #endif 33 | 34 | #define _DBG(x) _db_msg(DEBUG_UART_PORT, x) 35 | #define _DBG_(x) _db_msg_(DEBUG_UART_PORT, x) 36 | #define _DBC(x) _db_char(DEBUG_UART_PORT, x) 37 | #define _DBD(x) _db_dec(DEBUG_UART_PORT, x) 38 | #define _DBD16(x) _db_dec_16(DEBUG_UART_PORT, x) 39 | #define _DBD32(x) _db_dec_32(DEBUG_UART_PORT, x) 40 | #define _DBH(x) _db_hex(DEBUG_UART_PORT, x) 41 | #define _DBH16(x) _db_hex_16(DEBUG_UART_PORT, x) 42 | #define _DBH32(x) _db_hex_32(DEBUG_UART_PORT, x) 43 | #define _DG _db_get_char(DEBUG_UART_PORT) 44 | //void _printf (const char *format, ...); 45 | 46 | extern void (*_db_msg)(LPC_UART_TypeDef *UARTx, const void *s); 47 | extern void (*_db_msg_)(LPC_UART_TypeDef *UARTx, const void *s); 48 | extern void (*_db_char)(LPC_UART_TypeDef *UARTx, uint8_t ch); 49 | extern void (*_db_dec)(LPC_UART_TypeDef *UARTx, uint8_t decn); 50 | extern void (*_db_dec_16)(LPC_UART_TypeDef *UARTx, uint16_t decn); 51 | extern void (*_db_dec_32)(LPC_UART_TypeDef *UARTx, uint32_t decn); 52 | extern void (*_db_hex)(LPC_UART_TypeDef *UARTx, uint8_t hexn); 53 | extern void (*_db_hex_16)(LPC_UART_TypeDef *UARTx, uint16_t hexn); 54 | extern void (*_db_hex_32)(LPC_UART_TypeDef *UARTx, uint32_t hexn); 55 | extern uint8_t (*_db_get_char)(LPC_UART_TypeDef *UARTx); 56 | 57 | void UARTPutChar (LPC_UART_TypeDef *UARTx, uint8_t ch); 58 | void UARTPuts(LPC_UART_TypeDef *UARTx, const void *str); 59 | void UARTPuts_(LPC_UART_TypeDef *UARTx, const void *str); 60 | void UARTPutDec(LPC_UART_TypeDef *UARTx, uint8_t decnum); 61 | void UARTPutDec16(LPC_UART_TypeDef *UARTx, uint16_t decnum); 62 | void UARTPutDec32(LPC_UART_TypeDef *UARTx, uint32_t decnum); 63 | void UARTPutHex (LPC_UART_TypeDef *UARTx, uint8_t hexnum); 64 | void UARTPutHex16 (LPC_UART_TypeDef *UARTx, uint16_t hexnum); 65 | void UARTPutHex32 (LPC_UART_TypeDef *UARTx, uint32_t hexnum); 66 | uint8_t UARTGetChar (LPC_UART_TypeDef *UARTx); 67 | void debug_frmwrk_init(void); 68 | 69 | #endif /* DEBUG_FRMWRK_H_ */ 70 | -------------------------------------------------------------------------------- /firmware/drivers/include/lpc17xx_clkpwr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j4cbo/j4cDAC/12ecbe565fcaa88f771b1bfdfb1852baca38fbe6/firmware/drivers/include/lpc17xx_clkpwr.h -------------------------------------------------------------------------------- /firmware/drivers/include/lpc17xx_dac.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j4cbo/j4cDAC/12ecbe565fcaa88f771b1bfdfb1852baca38fbe6/firmware/drivers/include/lpc17xx_dac.h -------------------------------------------------------------------------------- /firmware/drivers/include/lpc17xx_nvic.h: -------------------------------------------------------------------------------- 1 | /***********************************************************************//** 2 | * @file lpc17xx_nvic.h 3 | * @brief Contains all macro definitions and function prototypes 4 | * support for Nesting Vectored Interrupt firmware library 5 | * on LPC17xx 6 | * @version 2.0 7 | * @date 21. May. 2010 8 | * @author NXP MCU SW Application Team 9 | ************************************************************************** 10 | * Software that is described herein is for illustrative purposes only 11 | * which provides customers with programming information regarding the 12 | * products. This software is supplied "AS IS" without any warranties. 13 | * NXP Semiconductors assumes no responsibility or liability for the 14 | * use of the software, conveys no license or title under any patent, 15 | * copyright, or mask work right to the product. NXP Semiconductors 16 | * reserves the right to make changes in the software without 17 | * notification. NXP Semiconductors also make no representation or 18 | * warranty that such application will be suitable for the specified 19 | * use without further testing or modification. 20 | **************************************************************************/ 21 | 22 | /* Peripheral group ----------------------------------------------------------- */ 23 | /** @defgroup NVIC NVIC 24 | * @ingroup LPC1700CMSIS_FwLib_Drivers 25 | * @{ 26 | */ 27 | 28 | #ifndef LPC17XX_NVIC_H_ 29 | #define LPC17XX_NVIC_H_ 30 | 31 | /* Includes ------------------------------------------------------------------- */ 32 | #include "LPC17xx.h" 33 | #include "lpc_types.h" 34 | 35 | #ifdef __cplusplus 36 | extern "C" 37 | { 38 | #endif 39 | 40 | 41 | /* Public Functions ----------------------------------------------------------- */ 42 | /** @defgroup NVIC_Public_Functions NVIC Public Functions 43 | * @{ 44 | */ 45 | 46 | void NVIC_DeInit(void); 47 | void NVIC_SCBDeInit(void); 48 | void NVIC_SetVTOR(uint32_t offset); 49 | 50 | /** 51 | * @} 52 | */ 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* LPC17XX_NVIC_H_ */ 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | /* --------------------------------- End Of File ------------------------------ */ 65 | -------------------------------------------------------------------------------- /firmware/drivers/include/mdio.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * @file: mdio.h 3 | * @purpose: CMSIS Cortex-M3 Core Peripheral Access Layer Header File for 4 | * NXP LPC17xx Device Series 5 | * @version: V1.1 6 | * @date: 14th May 2009 7 | *---------------------------------------------------------------------------- */ 8 | 9 | #ifndef __mdio_H__ 10 | #define __mdio_H__ 11 | 12 | 13 | typedef unsigned int U32; 14 | typedef long long S64; 15 | typedef unsigned long long U64; 16 | typedef unsigned char BIT; 17 | typedef unsigned int BOOL; 18 | #ifndef __TRUE 19 | #define __TRUE 1 20 | #endif 21 | #ifndef __FALSE 22 | #define __FALSE 0 23 | #endif 24 | 25 | U32 mdio_read(int PhyReg); 26 | void mdio_write(int PhyReg, int Value); 27 | 28 | 29 | #endif // __mdio_H__ 30 | -------------------------------------------------------------------------------- /firmware/drivers/source/lpc17xx_libcfg_default.c: -------------------------------------------------------------------------------- 1 | /***********************************************************************//** 2 | * @file lpc17xx_libcfg_default.c 3 | * @brief Library configuration source file (default), 4 | * used to build library without examples. 5 | * @version 2.0 6 | * @date 21. May. 2010 7 | * @author NXP MCU SW Application Team 8 | ************************************************************************** 9 | * Software that is described herein is for illustrative purposes only 10 | * which provides customers with programming information regarding the 11 | * products. This software is supplied "AS IS" without any warranties. 12 | * NXP Semiconductors assumes no responsibility or liability for the 13 | * use of the software, conveys no license or title under any patent, 14 | * copyright, or mask work right to the product. NXP Semiconductors 15 | * reserves the right to make changes in the software without 16 | * notification. NXP Semiconductors also make no representation or 17 | * warranty that such application will be suitable for the specified 18 | * use without further testing or modification. 19 | **************************************************************************/ 20 | 21 | /* Library group ----------------------------------------------------------- */ 22 | /** @addtogroup LIBCFG_DEFAULT 23 | * @{ 24 | */ 25 | 26 | /* Includes ------------------------------------------------------------------- */ 27 | #include "lpc17xx_libcfg_default.h" 28 | 29 | /* Public Functions ----------------------------------------------------------- */ 30 | /** @addtogroup LIBCFG_DEFAULT_Public_Functions 31 | * @{ 32 | */ 33 | 34 | #ifndef __BUILD_WITH_EXAMPLE__ 35 | 36 | #ifdef DEBUG 37 | /******************************************************************************* 38 | * @brief Reports the name of the source file and the source line number 39 | * where the CHECK_PARAM error has occurred. 40 | * @param[in] file Pointer to the source file name 41 | * @param[in] line assert_param error line source number 42 | * @return None 43 | *******************************************************************************/ 44 | void check_failed(uint8_t *file, uint32_t line) 45 | { 46 | /* User can add his own implementation to report the file name and line number, 47 | ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ 48 | 49 | /* Infinite loop */ 50 | while(1); 51 | } 52 | #endif /* DEBUG */ 53 | 54 | #endif /* __BUILD_WITH_EXAMPLE__ */ 55 | 56 | /** 57 | * @} 58 | */ 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | /* --------------------------------- End Of File ------------------------------ */ 65 | -------------------------------------------------------------------------------- /firmware/drivers/source/makefile: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | # $Id:: makefile 814 2008-06-19 19:57:32Z pdurgesh $ 3 | # 4 | # Project: Standard compile makefile 5 | # 6 | # Description: 7 | # Makefile 8 | # 9 | ######################################################################## 10 | # Software that is described herein is for illustrative purposes only 11 | # which provides customers with programming information regarding the 12 | # products. This software is supplied "AS IS" without any warranties. 13 | # NXP Semiconductors assumes no responsibility or liability for the 14 | # use of the software, conveys no license or title under any patent, 15 | # copyright, or mask work right to the product. NXP Semiconductors 16 | # reserves the right to make changes in the software without 17 | # notification. NXP Semiconductors also make no representation or 18 | # warranty that such application will be suitable for the specified 19 | # use without further testing or modification. 20 | ######################################################################## 21 | 22 | ######################################################################## 23 | # 24 | # Pick up the configuration file in make section 25 | # 26 | ######################################################################## 27 | include ../../makesection/makeconfig 28 | 29 | ######################################################################## 30 | # 31 | # Pick up the default build rules 32 | # 33 | ######################################################################## 34 | 35 | include $(PROJ_ROOT)/makesection/makerule/$(DEVICE)/make.$(DEVICE).$(TOOL) 36 | 37 | ######################################################################## 38 | # 39 | # Pick up the assembler and C source files in the directory 40 | # 41 | ######################################################################## 42 | include $(PROJ_ROOT)\makesection\makerule\common\make.rules.ftypes 43 | AFLAGS +=-I../include 44 | CFLAGS +=-I../include 45 | 46 | 47 | ######################################################################## 48 | # 49 | # Build the library 50 | # 51 | ######################################################################## 52 | 53 | $(TARGET_FWLIB_LIB) : .vias $(OBJS) $(FWLIB_LIB_DIR) 54 | $(ECHO) "creating" $(FWLIB) "Firmware support package library" 55 | $(AR) $@ $(OBJS) 56 | 57 | $(FWLIB_LIB_DIR): 58 | $(MKDIR) $(FWLIB_LIB_DIR) 59 | 60 | # delete all targets this Makefile can make 61 | lib_clean: 62 | -@$(RM) $(TARGET_FWLIB_LIB) 63 | 64 | # delete all targets this Makefile can make and all built libraries 65 | # linked in 66 | lib_realclean: 67 | -@$(RM) $(FWLIB_LIB_DIR)/*.a 68 | -@$(RMDIR) $(FWLIB_LIB_DIR) 69 | 70 | clean: lib_clean 71 | realclean: lib_realclean 72 | 73 | ######################################################################## 74 | # 75 | # Compile the code base 76 | # 77 | ######################################################################## 78 | 79 | include $(PROJ_ROOT)/makesection/makerule/common/make.rules.build 80 | 81 | .PHONY: all lib_clean lib_realclean 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /firmware/file/playback.c: -------------------------------------------------------------------------------- 1 | /* j4cDAC file playback control 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | int ilda_open(const char * fname); 27 | 28 | int ilda_read_points(int max_points, packed_point_t *p); 29 | void ilda_reset_file(void); 30 | extern int fplay_error_detail; 31 | 32 | /* playback_refill 33 | * 34 | * If we're playing a file from the SD card, read some points from it 35 | * and refill the internal buffer. 36 | */ 37 | static void playback_refill(void) { 38 | int i; 39 | 40 | /* This function gets called on every main loop, but is only needed 41 | * in file playback mode... */ 42 | if (playback_src != SRC_ILDAPLAYER) 43 | return; 44 | 45 | /* How much data do we have room for? */ 46 | int dlen = dac_request(); 47 | packed_point_t *ptr = dac_request_addr(); 48 | 49 | /* Have we underflowed? */ 50 | if (dlen < 0) { 51 | if (le_get_state() != LIGHTENGINE_READY) 52 | return; 53 | 54 | outputf("*U*"); 55 | dac_prepare(); 56 | return; 57 | } 58 | 59 | /* If we don't have any more room... */ 60 | if (dlen == 0) { 61 | if (dac_get_state() == DAC_PREPARED) 62 | dac_start(); 63 | return; 64 | } 65 | 66 | if (!(playback_source_flags & ILDA_PLAYER_PLAYING)) 67 | return; 68 | 69 | /* 70 | if (dlen > 50) 71 | outputf("[!] %d", dlen); 72 | */ 73 | 74 | /* Read some points from the file. */ 75 | i = ilda_read_points(dlen, ptr); 76 | 77 | if (i < 0) { 78 | outputf((const char *)(-i), fplay_error_detail); 79 | playback_source_flags &= ~ILDA_PLAYER_PLAYING; 80 | } else if (i == 0) { 81 | ilda_reset_file(); 82 | 83 | if (playback_source_flags & ILDA_PLAYER_REPEAT) { 84 | outputf("rep"); 85 | } else { 86 | outputf("done"); 87 | 88 | /* If the whole file didn't fit in the 89 | * buffer, we may have to start it now. */ 90 | dlen = 0; 91 | 92 | playback_source_flags &= ~ILDA_PLAYER_PLAYING; 93 | } 94 | } else { 95 | dac_advance(i); 96 | } 97 | 98 | /* If the buffer is nearly full, start it up */ 99 | if (dlen < 200 && dac_get_state() == DAC_PREPARED) 100 | dac_start(); 101 | } 102 | 103 | INITIALIZER(poll, playback_refill) 104 | -------------------------------------------------------------------------------- /firmware/inc/arch/cc.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARCH_CC_H 2 | #define _ARCH_CC_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | /* Because lwIP is written by idiots. */ 9 | typedef uint8_t u8_t; 10 | typedef uint16_t u16_t; 11 | typedef uint32_t u32_t; 12 | typedef int8_t s8_t; 13 | typedef int16_t s16_t; 14 | typedef int32_t s32_t; 15 | typedef uint32_t mem_ptr_t; 16 | 17 | #define PACK_STRUCT_FIELD(x) x 18 | #define PACK_STRUCT_STRUCT __attribute__((packed)) 19 | #define PACK_STRUCT_BEGIN 20 | #define PACK_STRUCT_END 21 | 22 | #ifndef BYTE_ORDER 23 | #define BYTE_ORDER LITTLE_ENDIAN 24 | #endif 25 | 26 | #ifndef NULL 27 | #define NULL 0 28 | #endif 29 | 30 | static inline uint16_t LWIP_PLATFORM_HTONS(uint16_t in) { 31 | return rev16(in); 32 | } 33 | 34 | static inline uint32_t LWIP_PLATFORM_HTONL(uint32_t in) { 35 | return rev32(in); 36 | } 37 | 38 | #define LWIP_PLATFORM_BYTESWAP 1 39 | 40 | #define LWIP_PLATFORM_DIAG(x) outputf x 41 | #define LWIP_PLATFORM_ASSERT(x) // dologf("ASSERT FAILED: %s\n", (x)); 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /firmware/inc/arch/perf.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARCH_PERF_H 2 | #define _ARCH_PERF_H 3 | 4 | #define PERF_START 5 | #define PERF_STOP(x) 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /firmware/inc/broadcast.h: -------------------------------------------------------------------------------- 1 | /* j4cDAC periodic broadcast 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef BROADCAST_H 19 | #define BROADCAST_H 20 | 21 | #include 22 | 23 | void broadcast_init(void); 24 | void fill_status(struct dac_status *status); 25 | void broadcast_send(void); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /firmware/inc/dac_settings.h: -------------------------------------------------------------------------------- 1 | /* j4cDAC configurable state in DAC 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of either the GNU General Public License version 2 7 | * or 3, or the GNU Lesser General Public License version 3, as published 8 | * by the Free Software Foundation, at your option. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | #ifndef DAC_SETTINGS_H 20 | #define DAC_SETTINGS_H 21 | 22 | #include 23 | 24 | extern dac_settings_t settings; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /firmware/inc/dmx.h: -------------------------------------------------------------------------------- 1 | /* j4cDAC DMX driver 2 | * 3 | * Copyright 2012 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DMX_H 19 | #define DMX_H 20 | 21 | #include 22 | #include 23 | 24 | #define DMX_CHANNELS 512 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /firmware/inc/dp83848.h: -------------------------------------------------------------------------------- 1 | /* j4cDAC DP83848 bit definitions 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef DP83848_H 19 | #define DP83848_H 20 | 21 | #define DP83848_BMCR 0x00 22 | #define DP83848_BMSR 0x01 23 | #define DP83848_IDR1 0x02 24 | #define DP83848_IDR2 0x03 25 | #define DP83848_ANAR 0x04 26 | #define DP83848_ANLPAR 0x05 27 | #define DP83848_ANLPARNP 0x06 28 | #define DP83848_ANNPTR 0x07 29 | #define DP83848_PHYSTS 0x10 30 | #define DP83848_MICR 0x11 31 | #define DP83848_MISR 0x12 32 | #define DP83848_FCSCR 0x14 33 | #define DP83848_RECR 0x15 34 | #define DP83848_PCSR 0x16 35 | #define DP83848_RBR 0x17 36 | #define DP83848_LEDCR 0x18 37 | #define DP83848_PHYCR 0x19 38 | #define DP83848_10BTSCR 0x1A 39 | #define DP83848_CDCTRL1 0x1B 40 | #define DP83848_EDCR 0x1D 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /firmware/inc/ether.h: -------------------------------------------------------------------------------- 1 | /* LPC1758 Ethernet driver 2 | * 3 | * Jacob Potter 4 | * December 2010 5 | * 6 | * This file is based on "lpc17xx_emac.h", v2.0, 21 May 2010, by 7 | * the NXP MCU SW Application Team, which carries the following message: 8 | * 9 | ************************************************************************** 10 | * Software that is described herein is for illustrative purposes only 11 | * which provides customers with programming information regarding the 12 | * products. This software is supplied "AS IS" without any warranties. 13 | * NXP Semiconductors assumes no responsibility or liability for the 14 | * use of the software, conveys no license or title under any patent, 15 | * copyright, or mask work right to the product. NXP Semiconductors 16 | * reserves the right to make changes in the software without 17 | * notification. NXP Semiconductors also make no representation or 18 | * warranty that such application will be suitable for the specified 19 | * use without further testing or modification. 20 | **********************************************************************/ 21 | 22 | #ifndef ETHER_H 23 | #define ETHER_H 24 | 25 | #include "LPC17xx.h" 26 | #include "lpc_types.h" 27 | #include 28 | #include 29 | 30 | /* EMAC PHY status type definitions */ 31 | #define EMAC_PHY_STAT_LINK (0) /**< Link Status */ 32 | #define EMAC_PHY_STAT_SPEED (1) /**< Speed Status */ 33 | #define EMAC_PHY_STAT_DUP (2) /**< Duplex Status */ 34 | 35 | /* EMAC PHY device Speed definitions */ 36 | #define EMAC_MODE_AUTO (0) /**< Auto-negotiation mode */ 37 | #define EMAC_MODE_10M_FULL (1) /**< 10Mbps FullDuplex mode */ 38 | #define EMAC_MODE_10M_HALF (2) /**< 10Mbps HalfDuplex mode */ 39 | #define EMAC_MODE_100M_FULL (3) /**< 100Mbps FullDuplex mode */ 40 | #define EMAC_MODE_100M_HALF (4) /**< 100Mbps HalfDuplex mode */ 41 | 42 | /* EMAC Memory Buffer configuration for 16K Ethernet RAM */ 43 | #define EMAC_TX_FRAME_TOUT 0x00100000 /**< Frame Transmit timeout count */ 44 | 45 | /* PHY functions --------------*/ 46 | int32_t EMAC_CheckPHYStatus(uint32_t ulPHYState); 47 | int32_t EMAC_SetPHYMode(uint32_t ulPHYMode); 48 | int32_t EMAC_UpdatePHYStatus(void); 49 | 50 | /* Filter functions ----------*/ 51 | void EMAC_SetHashFilter(uint8_t dstMAC_addr[], FunctionalState NewState); 52 | void EMAC_SetFilterMode(uint32_t ulFilterMode, FunctionalState NewState); 53 | 54 | /* EMAC Interrupt functions -------*/ 55 | void EMAC_IntCmd(uint32_t ulIntType, FunctionalState NewState); 56 | IntStatus EMAC_IntGetStatus(uint32_t ulIntType); 57 | 58 | err_t eth_transmit_FPV_netif_linkoutput(struct netif * _info, struct pbuf * p); 59 | void eth_hardware_init(void); 60 | void eth_poll_1(void); 61 | void eth_poll_2(void); 62 | void eth_check_link(void); 63 | 64 | extern uint8_t mac_address[6]; 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /firmware/inc/file_player.h: -------------------------------------------------------------------------------- 1 | /* j4cDAC file player 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef FILE_PLAYER_H 19 | #define FILE_PLAYER_H 20 | 21 | int fplay_open(const char *fname); 22 | 23 | void ilda_set_fps_limit(int max_fps); 24 | 25 | extern int ilda_current_fps; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /firmware/inc/fixpoint.h: -------------------------------------------------------------------------------- 1 | /* Fixed point math utilities 2 | * 3 | * Copyright 2011 Dan Mills 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef FIXPOINT_INC 19 | #define FIXPOINT_INC 20 | 21 | #include 22 | #include 23 | 24 | // 16.16 format fixed point 25 | #define POINT (16) 26 | #define INTEGER (16) 27 | typedef int32_t fixed; 28 | 29 | #define FIXED(x) ((fixed)((x) * (1<> POINT) 32 | 33 | #define FIX_PI FIXED(3.1415926535) 34 | #define FIX_E FIXED(2.718281828) 35 | 36 | // use when one of the arguments is known to be |x| < FIX(1.0) 37 | static __attribute__((always_inline, unused)) fixed fix_mul_small (const fixed x, const fixed y) 38 | { 39 | return ((x * y) >> POINT); 40 | } 41 | /// general fixed point multiply 42 | static __attribute__((always_inline, unused)) fixed fix_mul (const fixed x, const fixed y) 43 | { 44 | return ((fixed)((((int64_t) x) * y)>> POINT)); 45 | } 46 | 47 | /* If compiling on a PC, this won't be present. */ 48 | #ifndef ASSERT_NOT_EQUAL 49 | #define ASSERT_NOT_EQUAL(x, y) 50 | #endif 51 | 52 | static __attribute__((always_inline, unused)) fixed fix_div (const fixed numerator, const fixed denom) 53 | { 54 | ASSERT_NOT_EQUAL(denom, 0); 55 | return ((((int64_t)numerator)<. 16 | */ 17 | 18 | #ifndef LIGHTENGINE_H 19 | #define LIGHTENGINE_H 20 | 21 | #include 22 | 23 | enum le_state { 24 | LIGHTENGINE_READY = 0, 25 | LIGHTENGINE_WARMUP = 1, 26 | LIGHTENGINE_COOLDOWN = 2, 27 | LIGHTENGINE_ESTOP = 3, 28 | }; 29 | 30 | extern enum le_state le_state; 31 | 32 | #define ESTOP_PACKET (1<<0) 33 | #define ESTOP_INPUT (1<<1) 34 | #define ESTOP_INPUT_CUR (1<<2) 35 | #define ESTOP_OVERTEMP (1<<3) 36 | #define ESTOP_OVERTEMP_CUR (1<<4) 37 | #define ESTOP_LINKLOST (1<<5) 38 | 39 | #define ESTOP_CLEAR_ALL (ESTOP_PACKET | ESTOP_INPUT | ESTOP_OVERTEMP \ 40 | | ESTOP_LINKLOST) 41 | 42 | void le_init(void); 43 | void le_estop(uint16_t condition); 44 | void le_estop_clear(uint16_t condition); 45 | 46 | enum le_state le_get_state(void); 47 | uint16_t le_get_flags(void); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /firmware/inc/lwipopts.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIPOPTS_H 2 | #define LWIPOPTS_H 3 | 4 | #define NO_SYS 1 5 | 6 | #define LWIP_DEBUG 1 7 | /* 8 | #define ETHARP_DEBUG LWIP_DBG_ON | LWIP_DBG_TRACE 9 | #define DHCP_DEBUG LWIP_DBG_ON | LWIP_DBG_TRACE 10 | #define AUTOIP_DEBUG LWIP_DBG_ON | LWIP_DBG_TRACE 11 | #define TCP_DEBUG LWIP_DBG_ON | LWIP_DBG_TRACE 12 | #define TCP_INPUT_DEBUG LWIP_DBG_ON | LWIP_DBG_TRACE 13 | #define MEMP_DEBUG LWIP_DBG_ON | LWIP_DBG_TRACE 14 | #define PBUF_DEBUG LWIP_DBG_ON | LWIP_DBG_TRACE 15 | #define MEM_DEBUG LWIP_DBG_ON | LWIP_DBG_TRACE 16 | 17 | */ 18 | #define TCP_QUEUE_OOSEQ 0 19 | 20 | #define ARP_TABLE_SIZE 8 21 | 22 | /* What do we enable? */ 23 | #define LWIP_SOCKET 0 24 | #define LWIP_NETCONN 0 25 | #define LWIP_SNMP 0 26 | #define LWIP_AUTOIP 1 27 | #define LWIP_DHCP_AUTOIP_COOP 1 28 | #define LWIP_DHCP 1 29 | #define LWIP_DHCP_AUTOIP_COOP_TRIES 1 30 | 31 | /* For big ones... */ 32 | #define MEMCPY(dst, src, len) memcpy(dst, src, len) 33 | 34 | /* We will never be sending IP packets larger than the MTU... Note that 35 | * this doesn't disable *reassembly*, just fragmenting outgoing stuff. */ 36 | #define IP_FRAG 0 37 | 38 | /* Memory for listening TCP sockets. 39 | * 40 | * We will likely only use TCP for three protocols - sink, DAC streaming, 41 | * and HTTP. Everything else (OSC, ArtNet, status broadcasts...) is UDP. 42 | */ 43 | #define MEMP_NUM_TCP_PCB_LISTEN 3 44 | #define MEMP_NUM_TCP_SEG 31 45 | 46 | #define TCP_MSS 1460 47 | #define TCP_WND 7500 48 | #define TCP_SND_BUF (2 * TCP_MSS) 49 | #define TCP_SND_QUEUELEN 22 50 | 51 | #define LWIP_STATS 1 52 | #define LWIP_STATS_DISPLAY 1 53 | #define U16_F "u" 54 | #define S16_F "d" 55 | #define X16_F "x" 56 | #define U32_F "u" 57 | #define S32_F "d" 58 | #define X32_F "x" 59 | #define MEM_STATS 0 60 | #define MEMP_STATS 0 61 | 62 | #define LWIP_RAW 0 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /firmware/inc/osc.h: -------------------------------------------------------------------------------- 1 | /* j4cDAC OSC interface 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef OSC_H 19 | #define OSC_H 20 | 21 | #include 22 | #include 23 | 24 | void osc_init(void); 25 | 26 | void osc_send_int(const char *path, uint32_t value); 27 | void osc_send_int2(const char *path, uint32_t v1, uint32_t v2); 28 | void osc_send_fixed2(const char *path, fixed v1, fixed v2); 29 | void osc_send_string(const char *path, const char *value); 30 | 31 | extern struct udp_pcb osc_pcb; 32 | extern struct ip_addr *osc_last_source; 33 | extern uint16_t osc_last_port; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /firmware/inc/param.h: -------------------------------------------------------------------------------- 1 | /* j4cDAC parameter struct 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef PARAM_H 19 | #define PARAM_H 20 | 21 | #include 22 | #include 23 | 24 | #define PARAM_STRING -123 25 | 26 | typedef struct param_handler { 27 | const char *address; 28 | enum { 29 | PARAM_TYPE_0, 30 | PARAM_TYPE_I1, 31 | PARAM_TYPE_I2, 32 | PARAM_TYPE_I3, 33 | PARAM_TYPE_IN, 34 | PARAM_TYPE_BLOB, 35 | PARAM_TYPE_S1, 36 | PARAM_TYPE_S1I1 37 | } type; 38 | union { 39 | void (*f0) (const char *); 40 | void (*f1) (const char *, int32_t); 41 | void (*f2) (const char *, int32_t, int32_t); 42 | void (*f3) (const char *, int32_t, int32_t, int32_t); 43 | void (*fi) (const char *, int32_t *, int); 44 | void (*fb) (const char *, uint8_t *, int); 45 | void (*fs) (const char *, const char *); 46 | void (*fsi) (const char *, const char *, int32_t); 47 | }; 48 | enum { 49 | PARAM_MODE_INT, 50 | PARAM_MODE_FIXED 51 | } intmode; 52 | fixed min; 53 | fixed max; 54 | } param_handler; 55 | 56 | extern const int8_t param_count_required[]; 57 | 58 | int FPA_param(const volatile param_handler *h, const char *addr, int32_t *params, int n); 59 | void param_invocation_dump(const struct param_handler *h, 60 | const char *addr, int32_t *params); 61 | 62 | extern const volatile param_handler param_handler_table[0]; 63 | extern const volatile param_handler param_handler_table_end[0]; 64 | 65 | int osc_parameter_matches(const char *handler, const char *packet); 66 | 67 | #define foreach_matching_handler(h, cmpaddr) \ 68 | for (h = param_handler_table; h < param_handler_table_end; h++) \ 69 | if (h->f0 && osc_parameter_matches(h->address, cmpaddr)) 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /firmware/inc/playback.h: -------------------------------------------------------------------------------- 1 | /* j4cDAC playback sources 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef PLAYBACK_H 19 | #define PLAYBACK_H 20 | 21 | enum playback_source { 22 | SRC_NETWORK = 0, 23 | SRC_ILDAPLAYER = 1, 24 | SRC_ABSTRACT = 2 25 | }; 26 | 27 | extern enum playback_source playback_src; 28 | extern int playback_source_flags; 29 | 30 | int playback_set_src(enum playback_source new_src); 31 | 32 | #define ILDA_PLAYER_PLAYING 0x01 33 | #define ILDA_PLAYER_REPEAT 0x02 34 | 35 | #define ABSTRACT_PLAYING 0x01 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /firmware/inc/render.h: -------------------------------------------------------------------------------- 1 | /* j4cDAC abstract generator 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef RENDER_H 19 | #define RENDER_H 20 | 21 | #include "fixpoint.h" 22 | #include "protocol.h" 23 | 24 | #define PPS 30000 25 | #define FPS 30 26 | #define POINTS_PER_FRAME (PPS/FPS) 27 | 28 | #define PERSIST_POINTS 3000 29 | 30 | #define MUL_DENOM 12 31 | 32 | typedef struct { 33 | const char * name; 34 | fixed freq; 35 | uint32_t pos; 36 | int slave_multiplier; 37 | } oscillator_t; 38 | 39 | typedef struct { 40 | const char * name; 41 | uint32_t value; 42 | } param_t; 43 | 44 | oscillator_t * get_oscillator(const char * name); 45 | param_t * get_param(const char * name); 46 | 47 | int get_mul(int index); 48 | 49 | extern oscillator_t osc_master; 50 | 51 | extern oscillator_t * const oscillators[]; 52 | extern param_t * const params[]; 53 | 54 | void get_next_point(dac_point_t *p); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /firmware/inc/skub-zones.h: -------------------------------------------------------------------------------- 1 | /* j4cDAC skub allocator 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef SKUB_POOL_FIXED 19 | #error "skub-zones.h should only be included by skub.c / skub.h" 20 | #endif 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | SKUB_POOL_FIXED(AUTOIP, struct autoip, 2) 31 | SKUB_POOL_FIXED(PBUF, struct pbuf, 16) 32 | SKUB_POOL_FIXED(PBUF_POOL, u1536, 16) 33 | SKUB_POOL_FIXED(ARP_QUEUE, struct etharp_q_entry, 2) 34 | SKUB_POOL_FIXED(REASSDATA, struct ip_reassdata, MEMP_NUM_REASSDATA) 35 | SKUB_POOL_FIXED(TCP_PCB, struct tcp_pcb, MEMP_NUM_TCP_PCB) 36 | SKUB_POOL_FIXED(TCP_PCB_LISTEN, struct tcp_pcb_listen, MEMP_NUM_TCP_PCB_LISTEN) 37 | SKUB_POOL_FIXED(TCP_SEG, struct tcp_seg, MEMP_NUM_TCP_SEG) 38 | 39 | SKUB_POOL_VAR(128, 28, AHB0) 40 | SKUB_POOL_VAR(384, 2, AHB0) 41 | -------------------------------------------------------------------------------- /firmware/inc/skub.h: -------------------------------------------------------------------------------- 1 | #ifndef SKUB_H 2 | #define SKUB_H 3 | 4 | #include 5 | 6 | typedef struct { uint8_t x[1536]; } __attribute__ ((aligned (4))) u1536; 7 | 8 | /* Include skub-zones.h once, so any headers it needs are brought in */ 9 | #define SKUB_POOL_FIXED(name, typ, num) 10 | #define SKUB_POOL_VAR(sz, num, attr) 11 | #include 12 | #undef SKUB_POOL_FIXED 13 | 14 | /* Region types */ 15 | enum skub_type { 16 | #define SKUB_POOL_FIXED(name, typ, num) SKUB_##name, 17 | #include 18 | #undef SKUB_POOL_FIXED 19 | #undef SKUB_POOL_VAR 20 | SKUB_TYPE_MAX 21 | }; 22 | 23 | void skub_init(void); 24 | 25 | void * skub_alloc(enum skub_type region); 26 | void skub_free(enum skub_type region, void * ptr); 27 | 28 | void * skub_alloc_sz(int sz); 29 | void skub_free_sz(void * ptr); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /firmware/inc/transform.h: -------------------------------------------------------------------------------- 1 | /* j4cDAC geometric corrector 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef TRANSFORM_MAX 19 | 20 | #define COORD_MAX_EXP 15 21 | #define COORD_MAX (1 << COORD_MAX_EXP) 22 | 23 | #ifndef __ASSEMBLER__ 24 | 25 | #include 26 | #include 27 | 28 | #define COORD_TOO_CLOSE 150 29 | 30 | #define CORNER_TL 0 31 | #define CORNER_TR 1 32 | #define CORNER_BL 2 33 | #define CORNER_BR 3 34 | 35 | #define CORNER_FLIP_V(corner) ((corner) ^ 1) 36 | #define CORNER_FLIP_H(corner) ((corner) ^ 2) 37 | 38 | #define IS_TOP(corner) (((corner) & 2) == 0) 39 | #define IS_BOTTOM(corner) (((corner) & 2) == 2) 40 | #define IS_LEFT(corner) (((corner) & 1) == 0) 41 | #define IS_RIGHT(corner) (((corner) & 1) == 1) 42 | 43 | typedef int32_t transform[4]; 44 | 45 | void update_transform(void); 46 | 47 | extern int32_t transform_matrix[8]; 48 | 49 | static inline int32_t ALWAYS_INLINE translate(int32_t *c, int x, int y) { 50 | int32_t xy_scale = (x * y) >> COORD_MAX_EXP; 51 | return ((c[0]*x + c[1]*y + c[2]*xy_scale) >> COORD_MAX_EXP) + c[3]; 52 | } 53 | 54 | static inline int32_t ALWAYS_INLINE translate_x(int32_t x, int32_t y) { 55 | return translate(transform_matrix, x, y); 56 | } 57 | 58 | static inline int32_t ALWAYS_INLINE translate_y(int32_t x, int32_t y) { 59 | return translate(transform_matrix + 4, x, y); 60 | } 61 | 62 | #endif 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /firmware/inc/usbdebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | LPCUSB, an USB device driver for LPC microcontrollers 3 | Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. The name of the author may not be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #include 29 | #include 30 | 31 | // #define DBG outputf 32 | #define DBG(x ...) 33 | -------------------------------------------------------------------------------- /firmware/lib/fatfs.c: -------------------------------------------------------------------------------- 1 | /* j4cDAC fatfs setup 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | FATFS fs; 25 | 26 | void sd_init(void) { 27 | char filename_buf[64]; 28 | 29 | int res = disk_initialize(0); 30 | if (res) { 31 | outputf("SD initialization failed: %d", res); 32 | return; 33 | } 34 | 35 | /* This code sucks. It comes from the fatfs example code. */ 36 | memset(&fs, 0, sizeof(fs)); 37 | res = f_mount(0, &fs); 38 | if (res) { 39 | outputf("f_mount() failed: %d", res); 40 | return; 41 | } 42 | 43 | DIR dir; 44 | res = f_opendir(&dir, ""); 45 | if (res) 46 | return; 47 | 48 | FILINFO finfo; 49 | int num_subdirs = 0, num_files = 0, total_size = 0; 50 | 51 | while (1) { 52 | finfo.lfname = filename_buf; 53 | finfo.lfsize = sizeof(filename_buf); 54 | res = f_readdir(&dir, &finfo); 55 | if ((res != FR_OK) || !finfo.fname[0]) 56 | break; 57 | 58 | if (finfo.fattrib & AM_DIR) { 59 | num_subdirs++; 60 | } else { 61 | num_files++; 62 | total_size += finfo.fsize; 63 | } 64 | 65 | outputf("%c%c%c%c%c %u/%02u/%02u %02u:%02u %9lu %s %s", 66 | (finfo.fattrib & AM_DIR) ? 'D' : '-', 67 | (finfo.fattrib & AM_RDO) ? 'R' : '-', 68 | (finfo.fattrib & AM_HID) ? 'H' : '-', 69 | (finfo.fattrib & AM_SYS) ? 'S' : '-', 70 | (finfo.fattrib & AM_ARC) ? 'A' : '-', 71 | (finfo.fdate >> 9) + 1980, (finfo.fdate >> 5) & 15, 72 | finfo.fdate & 31, (finfo.ftime >> 11), 73 | (finfo.ftime >> 5) & 63, finfo.fsize, 74 | &(finfo.fname[0]), filename_buf); 75 | } 76 | outputf("%4u File(s),%10lu bytes total\n%4u Dir(s)", 77 | num_files, total_size, num_subdirs); 78 | } 79 | 80 | INITIALIZER(hardware, sd_init); 81 | -------------------------------------------------------------------------------- /firmware/lib/lightengine.c: -------------------------------------------------------------------------------- 1 | /* j4cDAC light engine state machine 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | enum le_state le_state; 23 | uint16_t le_flags; 24 | 25 | /* This is basically a stub at the moment, until thermal control is added. */ 26 | 27 | enum le_state le_get_state(void) { 28 | return le_state; 29 | } 30 | 31 | uint16_t le_get_flags(void) { 32 | return le_state; 33 | } 34 | 35 | void le_estop(uint16_t condition) { 36 | le_flags |= condition; 37 | le_state = LIGHTENGINE_ESTOP; 38 | dac_stop(DAC_FLAG_STOP_ESTOP); 39 | 40 | outputf("*** ESTOP 0x%x ***", le_flags); 41 | } 42 | 43 | void le_estop_clear(uint16_t condition) { 44 | le_flags &= ~condition; 45 | if (!le_flags) 46 | le_state = LIGHTENGINE_READY; 47 | } 48 | -------------------------------------------------------------------------------- /firmware/lib/lpc17xx/system_LPC17xx.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file system_LPC17xx.h 3 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer Header File 4 | * for the NXP LPC17xx Device Series 5 | * @version V1.02 6 | * @date 08. September 2009 7 | * 8 | * @note 9 | * Copyright (C) 2009 ARM Limited. All rights reserved. 10 | * 11 | * @par 12 | * ARM Limited (ARM) is supplying this software for use with Cortex-M 13 | * processor based microcontrollers. This file can be freely distributed 14 | * within development tools that are supporting such ARM based processors. 15 | * 16 | * @par 17 | * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED 18 | * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. 20 | * ARM SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR 21 | * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. 22 | * 23 | ******************************************************************************/ 24 | 25 | 26 | #ifndef __SYSTEM_LPC17xx_H 27 | #define __SYSTEM_LPC17xx_H 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | #include 34 | 35 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 36 | 37 | 38 | /** 39 | * Initialize the system 40 | * 41 | * @param none 42 | * @return none 43 | * 44 | * @brief Setup the microcontroller system. 45 | * Initialize the System and update the SystemCoreClock variable. 46 | */ 47 | extern void SystemInit (void); 48 | 49 | /** 50 | * Update SystemCoreClock variable 51 | * 52 | * @param none 53 | * @return none 54 | * 55 | * @brief Updates the SystemCoreClock with current core Clock 56 | * retrieved from cpu registers. 57 | */ 58 | extern void SystemCoreClockUpdate (void); 59 | 60 | void reenter_bootloader(void); 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif /* __SYSTEM_LPC17xx_H */ 67 | -------------------------------------------------------------------------------- /firmware/lib/lpcusb/type.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * type.h: Type definition Header file for NXP LPC17xx Family 3 | * Microprocessors 4 | * 5 | * Copyright(C) 2008, NXP Semiconductor 6 | * All rights reserved. 7 | * 8 | * History 9 | * 2008.08.21 ver 1.00 Prelimnary version, first Release 10 | * 11 | ******************************************************************************/ 12 | #ifndef __TYPE_H__ 13 | #define __TYPE_H__ 14 | 15 | /* Useful register settings, types, and LPC model defines */ 16 | #include "LPC17xx.h" 17 | 18 | #ifndef NULL 19 | #define NULL ((void *)0) 20 | #endif 21 | 22 | #ifndef FALSE 23 | #define FALSE (0) 24 | #endif 25 | 26 | #ifndef TRUE 27 | #define TRUE (1) 28 | #endif 29 | 30 | #if 0 31 | typedef unsigned char BYTE; 32 | typedef unsigned short WORD; 33 | typedef unsigned long DWORD; 34 | typedef unsigned int BOOL; 35 | 36 | typedef enum {RESET = 0, SET = !RESET} FlagStatus, ITStatus; 37 | typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState; 38 | 39 | /* Pointer to Function returning Void (any number of parameters) */ 40 | typedef void (*PFV)(); 41 | #endif 42 | 43 | #endif /* __TYPE_H__ */ 44 | -------------------------------------------------------------------------------- /firmware/lib/lpcusb/usbinit.c: -------------------------------------------------------------------------------- 1 | /* 2 | LPCUSB, an USB device driver for LPC microcontrollers 3 | Copyright (C) 2006 Bertrik Sikken (bertrik@sikken.nl) 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. The name of the author may not be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | 29 | /** @file 30 | USB stack initialisation 31 | */ 32 | 33 | 34 | #include "usbdebug.h" 35 | #include "usbapi.h" 36 | #include "usbhw_lpc.h" 37 | #include 38 | #include 39 | 40 | /** data storage area for standard requests */ 41 | static unsigned char abStdReqData[8]; 42 | 43 | 44 | /** 45 | USB reset handler 46 | 47 | @param [in] bDevStatus Device status 48 | */ 49 | static void HandleUsbReset(unsigned char bDevStatus) 50 | { 51 | if (bDevStatus & DEV_STATUS_RESET) { 52 | DBG("\n!"); 53 | } 54 | } 55 | 56 | 57 | /** 58 | Initialises the USB hardware and sets up the USB stack by 59 | installing default callbacks. 60 | */ 61 | void a_usb_init(void) 62 | { 63 | // init hardware 64 | USBHwInit(); 65 | 66 | // register bus reset handler 67 | USBHwRegisterDevIntHandler(HandleUsbReset); 68 | 69 | // register control transfer handler on EP0 70 | USBHwRegisterEPIntHandler(0x00, USBHandleControlTransfer); 71 | USBHwRegisterEPIntHandler(0x80, USBHandleControlTransfer); 72 | 73 | // setup control endpoints 74 | USBHwEPConfig(0x00, MAX_PACKET_SIZE0); 75 | USBHwEPConfig(0x80, MAX_PACKET_SIZE0); 76 | 77 | // register standard request handler 78 | USBRegisterRequestHandler(REQTYPE_TYPE_STANDARD, USBHandleStandardRequest_FPV_usb_reqhdlr, abStdReqData); 79 | } 80 | 81 | INITIALIZER(hardware, a_usb_init) 82 | -------------------------------------------------------------------------------- /firmware/lib/playback.c: -------------------------------------------------------------------------------- 1 | /* j4cDAC - playback source control 2 | * 3 | * Copyright 2010, 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | enum playback_source playback_src; 23 | int playback_source_flags; 24 | 25 | /* playback_set_src 26 | * 27 | * Change the playback source. This will be refused if the current source 28 | * is an active network stream. 29 | */ 30 | int playback_set_src(enum playback_source new_src) { 31 | /* Can't switch away from network while playing. */ 32 | if (playback_src == SRC_NETWORK && new_src != SRC_NETWORK 33 | && dac_get_state() != DAC_IDLE) { 34 | return -1; 35 | } 36 | 37 | if (playback_src == new_src) 38 | return 0; 39 | 40 | /* Stop the DAC and set playback_src_flags to 0, which will prevent 41 | * the abstract generator and ILDA player from producing output. */ 42 | dac_stop(DAC_FLAG_STOP_SRCSWITCH); 43 | playback_source_flags = 0; 44 | playback_src = new_src; 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/CHANGELOG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j4cbo/j4cDAC/12ecbe565fcaa88f771b1bfdfb1852baca38fbe6/firmware/lwip-1.3.2/CHANGELOG -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/COPYING: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, 2002 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | 33 | 34 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/FILES: -------------------------------------------------------------------------------- 1 | src/ - The source code for the lwIP TCP/IP stack. 2 | doc/ - The documentation for lwIP. 3 | 4 | See also the FILES file in each subdirectory. 5 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/doc/FILES: -------------------------------------------------------------------------------- 1 | savannah.txt - How to obtain the current development source code. 2 | contrib.txt - How to contribute to lwIP as a developer. 3 | rawapi.txt - The documentation for the core API of lwIP. 4 | Also provides an overview about the other APIs and multithreading. 5 | snmp_agent.txt - The documentation for the lwIP SNMP agent. 6 | sys_arch.txt - The documentation for a system abstraction layer of lwIP. 7 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/doc/contrib.txt: -------------------------------------------------------------------------------- 1 | 1 Introduction 2 | 3 | This document describes some guidelines for people participating 4 | in lwIP development. 5 | 6 | 2 How to contribute to lwIP 7 | 8 | Here is a short list of suggestions to anybody working with lwIP and 9 | trying to contribute bug reports, fixes, enhancements, platform ports etc. 10 | First of all as you may already know lwIP is a volunteer project so feedback 11 | to fixes or questions might often come late. Hopefully the bug and patch tracking 12 | features of Savannah help us not lose users' input. 13 | 14 | 2.1 Source code style: 15 | 16 | 1. do not use tabs. 17 | 2. indentation is two spaces per level (i.e. per tab). 18 | 3. end debug messages with a trailing newline (\n). 19 | 4. one space between keyword and opening bracket. 20 | 5. no space between function and opening bracket. 21 | 6. one space and no newline before opening curly braces of a block. 22 | 7. closing curly brace on a single line. 23 | 8. spaces surrounding assignment and comparisons. 24 | 9. don't initialize static and/or global variables to zero, the compiler takes care of that. 25 | 10. use current source code style as further reference. 26 | 27 | 2.2 Source code documentation style: 28 | 29 | 1. JavaDoc compliant and Doxygen compatible. 30 | 2. Function documentation above functions in .c files, not .h files. 31 | (This forces you to synchronize documentation and implementation.) 32 | 3. Use current documentation style as further reference. 33 | 34 | 2.3 Bug reports and patches: 35 | 36 | 1. Make sure you are reporting bugs or send patches against the latest 37 | sources. (From the latest release and/or the current CVS sources.) 38 | 2. If you think you found a bug make sure it's not already filed in the 39 | bugtracker at Savannah. 40 | 3. If you have a fix put the patch on Savannah. If it is a patch that affects 41 | both core and arch specific stuff please separate them so that the core can 42 | be applied separately while leaving the other patch 'open'. The prefered way 43 | is to NOT touch archs you can't test and let maintainers take care of them. 44 | This is a good way to see if they are used at all - the same goes for unix 45 | netifs except tapif. 46 | 4. Do not file a bug and post a fix to it to the patch area. Either a bug report 47 | or a patch will be enough. 48 | If you correct an existing bug then attach the patch to the bug rather than creating a new entry in the patch area. 49 | 5. Trivial patches (compiler warning, indentation and spelling fixes or anything obvious which takes a line or two) 50 | can go to the lwip-users list. This is still the fastest way of interaction and the list is not so crowded 51 | as to allow for loss of fixes. Putting bugs on Savannah and subsequently closing them is too much an overhead 52 | for reporting a compiler warning fix. 53 | 6. Patches should be specific to a single change or to related changes.Do not mix bugfixes with spelling and other 54 | trivial fixes unless the bugfix is trivial too.Do not reorganize code and rename identifiers in the same patch you 55 | change behaviour if not necessary.A patch is easier to read and understand if it's to the point and short than 56 | if it's not to the point and long :) so the chances for it to be applied are greater. 57 | 58 | 2.4 Platform porters: 59 | 60 | 1. If you have ported lwIP to a platform (an OS, a uC/processor or a combination of these) and 61 | you think it could benefit others[1] you might want discuss this on the mailing list. You 62 | can also ask for CVS access to submit and maintain your port in the contrib CVS module. 63 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/src/FILES: -------------------------------------------------------------------------------- 1 | api/ - The code for the high-level wrapper API. Not needed if 2 | you use the lowel-level call-back/raw API. 3 | 4 | core/ - The core of the TPC/IP stack; protocol implementations, 5 | memory and buffer management, and the low-level raw API. 6 | 7 | include/ - lwIP include files. 8 | 9 | netif/ - Generic network interface device drivers are kept here, 10 | as well as the ARP module. 11 | 12 | For more information on the various subdirectories, check the FILES 13 | file in each directory. 14 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/src/api/err.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Error Management module 4 | * 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Adam Dunkels 36 | * 37 | */ 38 | 39 | #include "lwip/err.h" 40 | 41 | #ifdef LWIP_DEBUG 42 | 43 | static const char *err_strerr[] = { 44 | "Ok.", /* ERR_OK 0 */ 45 | "Out of memory error.", /* ERR_MEM -1 */ 46 | "Buffer error.", /* ERR_BUF -2 */ 47 | "Timeout.", /* ERR_TIMEOUT -3 */ 48 | "Routing problem.", /* ERR_RTE -4 */ 49 | "Connection aborted.", /* ERR_ABRT -5 */ 50 | "Connection reset.", /* ERR_RST -6 */ 51 | "Connection closed.", /* ERR_CLSD -7 */ 52 | "Not connected.", /* ERR_CONN -8 */ 53 | "Illegal value.", /* ERR_VAL -9 */ 54 | "Illegal argument.", /* ERR_ARG -10 */ 55 | "Address in use.", /* ERR_USE -11 */ 56 | "Low-level netif error.", /* ERR_IF -12 */ 57 | "Already connected.", /* ERR_ISCONN -13 */ 58 | "Operation in progress." /* ERR_INPROGRESS -14 */ 59 | }; 60 | 61 | /** 62 | * Convert an lwip internal error to a string representation. 63 | * 64 | * @param err an lwip internal err_t 65 | * @return a string representation for err 66 | */ 67 | const char * 68 | lwip_strerr(err_t err) 69 | { 70 | return err_strerr[-err]; 71 | 72 | } 73 | 74 | #endif /* LWIP_DEBUG */ 75 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/src/core/ipv6/README: -------------------------------------------------------------------------------- 1 | IPv6 support in lwIP is very experimental. 2 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/src/core/ipv6/ip6_addr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | 33 | #include "lwip/opt.h" 34 | #include "lwip/ip_addr.h" 35 | #include "lwip/inet.h" 36 | 37 | u8_t 38 | ip_addr_netcmp(struct ip_addr *addr1, struct ip_addr *addr2, 39 | struct ip_addr *mask) 40 | { 41 | return((addr1->addr[0] & mask->addr[0]) == (addr2->addr[0] & mask->addr[0]) && 42 | (addr1->addr[1] & mask->addr[1]) == (addr2->addr[1] & mask->addr[1]) && 43 | (addr1->addr[2] & mask->addr[2]) == (addr2->addr[2] & mask->addr[2]) && 44 | (addr1->addr[3] & mask->addr[3]) == (addr2->addr[3] & mask->addr[3])); 45 | 46 | } 47 | 48 | u8_t 49 | ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2) 50 | { 51 | return(addr1->addr[0] == addr2->addr[0] && 52 | addr1->addr[1] == addr2->addr[1] && 53 | addr1->addr[2] == addr2->addr[2] && 54 | addr1->addr[3] == addr2->addr[3]); 55 | } 56 | 57 | void 58 | ip_addr_set(struct ip_addr *dest, struct ip_addr *src) 59 | { 60 | SMEMCPY(dest, src, sizeof(struct ip_addr)); 61 | /* dest->addr[0] = src->addr[0]; 62 | dest->addr[1] = src->addr[1]; 63 | dest->addr[2] = src->addr[2]; 64 | dest->addr[3] = src->addr[3];*/ 65 | } 66 | 67 | u8_t 68 | ip_addr_isany(struct ip_addr *addr) 69 | { 70 | if (addr == NULL) return 1; 71 | return((addr->addr[0] | addr->addr[1] | addr->addr[2] | addr->addr[3]) == 0); 72 | } 73 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/src/include/ipv4/lwip/inet_chksum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_INET_CHKSUM_H__ 33 | #define __LWIP_INET_CHKSUM_H__ 34 | 35 | #include "lwip/opt.h" 36 | 37 | #include "lwip/pbuf.h" 38 | #include "lwip/ip_addr.h" 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | u16_t inet_chksum(void *dataptr, u16_t len); 45 | u16_t inet_chksum_pbuf(struct pbuf *p); 46 | u16_t inet_chksum_pseudo(struct pbuf *p, 47 | struct ip_addr *src, struct ip_addr *dest, 48 | u8_t proto, u16_t proto_len); 49 | #if LWIP_UDPLITE 50 | u16_t inet_chksum_pseudo_partial(struct pbuf *p, 51 | struct ip_addr *src, struct ip_addr *dest, 52 | u8_t proto, u16_t proto_len, u16_t chksum_len); 53 | #endif 54 | 55 | #ifdef __cplusplus 56 | } 57 | #endif 58 | 59 | #endif /* __LWIP_INET_H__ */ 60 | 61 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/src/include/ipv4/lwip/ip_frag.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Jani Monoses 30 | * 31 | */ 32 | 33 | #ifndef __LWIP_IP_FRAG_H__ 34 | #define __LWIP_IP_FRAG_H__ 35 | 36 | #include "lwip/opt.h" 37 | #include "lwip/err.h" 38 | #include "lwip/pbuf.h" 39 | #include "lwip/netif.h" 40 | #include "lwip/ip_addr.h" 41 | #include "lwip/ip.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | #if IP_REASSEMBLY 48 | /* The IP reassembly timer interval in milliseconds. */ 49 | #define IP_TMR_INTERVAL 1000 50 | 51 | /* IP reassembly helper struct. 52 | * This is exported because memp needs to know the size. 53 | */ 54 | struct ip_reassdata { 55 | struct ip_reassdata *next; 56 | struct pbuf *p; 57 | struct ip_hdr iphdr; 58 | u16_t datagram_len; 59 | u8_t flags; 60 | u8_t timer; 61 | }; 62 | 63 | void ip_reass_init(void); 64 | void ip_reass_tmr(void); 65 | struct pbuf * ip_reass(struct pbuf *p); 66 | #endif /* IP_REASSEMBLY */ 67 | 68 | #if IP_FRAG 69 | err_t ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest); 70 | #endif /* IP_FRAG */ 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | 76 | #endif /* __LWIP_IP_FRAG_H__ */ 77 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/src/include/ipv6/lwip/icmp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_ICMP_H__ 33 | #define __LWIP_ICMP_H__ 34 | 35 | #include "lwip/opt.h" 36 | 37 | #if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */ 38 | 39 | #include "lwip/pbuf.h" 40 | #include "lwip/netif.h" 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #define ICMP6_DUR 1 47 | #define ICMP6_TE 3 48 | #define ICMP6_ECHO 128 /* echo */ 49 | #define ICMP6_ER 129 /* echo reply */ 50 | 51 | 52 | enum icmp_dur_type { 53 | ICMP_DUR_NET = 0, /* net unreachable */ 54 | ICMP_DUR_HOST = 1, /* host unreachable */ 55 | ICMP_DUR_PROTO = 2, /* protocol unreachable */ 56 | ICMP_DUR_PORT = 3, /* port unreachable */ 57 | ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */ 58 | ICMP_DUR_SR = 5 /* source route failed */ 59 | }; 60 | 61 | enum icmp_te_type { 62 | ICMP_TE_TTL = 0, /* time to live exceeded in transit */ 63 | ICMP_TE_FRAG = 1 /* fragment reassembly time exceeded */ 64 | }; 65 | 66 | void icmp_input(struct pbuf *p, struct netif *inp); 67 | 68 | void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t); 69 | void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t); 70 | 71 | struct icmp_echo_hdr { 72 | u8_t type; 73 | u8_t icode; 74 | u16_t chksum; 75 | u16_t id; 76 | u16_t seqno; 77 | }; 78 | 79 | struct icmp_dur_hdr { 80 | u8_t type; 81 | u8_t icode; 82 | u16_t chksum; 83 | u32_t unused; 84 | }; 85 | 86 | struct icmp_te_hdr { 87 | u8_t type; 88 | u8_t icode; 89 | u16_t chksum; 90 | u32_t unused; 91 | }; 92 | 93 | #ifdef __cplusplus 94 | } 95 | #endif 96 | 97 | #endif /* LWIP_ICMP */ 98 | 99 | #endif /* __LWIP_ICMP_H__ */ 100 | 101 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/src/include/ipv6/lwip/inet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_INET_H__ 33 | #define __LWIP_INET_H__ 34 | 35 | #include "lwip/opt.h" 36 | #include "lwip/pbuf.h" 37 | #include "lwip/ip_addr.h" 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | u16_t inet_chksum(void *data, u16_t len); 44 | u16_t inet_chksum_pbuf(struct pbuf *p); 45 | u16_t inet_chksum_pseudo(struct pbuf *p, 46 | struct ip_addr *src, struct ip_addr *dest, 47 | u8_t proto, u32_t proto_len); 48 | 49 | u32_t inet_addr(const char *cp); 50 | s8_t inet_aton(const char *cp, struct in_addr *addr); 51 | 52 | #ifndef _MACHINE_ENDIAN_H_ 53 | #ifndef _NETINET_IN_H 54 | #ifndef _LINUX_BYTEORDER_GENERIC_H 55 | u16_t htons(u16_t n); 56 | u16_t ntohs(u16_t n); 57 | u32_t htonl(u32_t n); 58 | u32_t ntohl(u32_t n); 59 | #endif /* _LINUX_BYTEORDER_GENERIC_H */ 60 | #endif /* _NETINET_IN_H */ 61 | #endif /* _MACHINE_ENDIAN_H_ */ 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif /* __LWIP_INET_H__ */ 68 | 69 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/src/include/lwip/def.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_DEF_H__ 33 | #define __LWIP_DEF_H__ 34 | 35 | /* this might define NULL already */ 36 | #include "lwip/arch.h" 37 | 38 | #define LWIP_MAX(x , y) (((x) > (y)) ? (x) : (y)) 39 | #define LWIP_MIN(x , y) (((x) < (y)) ? (x) : (y)) 40 | 41 | #ifndef NULL 42 | #define NULL ((void *)0) 43 | #endif 44 | 45 | 46 | #endif /* __LWIP_DEF_H__ */ 47 | 48 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/src/include/lwip/err.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_ERR_H__ 33 | #define __LWIP_ERR_H__ 34 | 35 | #include "lwip/opt.h" 36 | #include "lwip/arch.h" 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /** Define LWIP_ERR_T in cc.h if you want to use 43 | * a different type for your platform (must be signed). */ 44 | #ifdef LWIP_ERR_T 45 | typedef LWIP_ERR_T err_t; 46 | #else /* LWIP_ERR_T */ 47 | typedef s8_t err_t; 48 | #endif /* LWIP_ERR_T*/ 49 | 50 | /* Definitions for error constants. */ 51 | 52 | #define ERR_OK 0 /* No error, everything OK. */ 53 | #define ERR_MEM -1 /* Out of memory error. */ 54 | #define ERR_BUF -2 /* Buffer error. */ 55 | #define ERR_TIMEOUT -3 /* Timeout. */ 56 | #define ERR_RTE -4 /* Routing problem. */ 57 | 58 | #define ERR_IS_FATAL(e) ((e) < ERR_RTE) 59 | 60 | #define ERR_ABRT -5 /* Connection aborted. */ 61 | #define ERR_RST -6 /* Connection reset. */ 62 | #define ERR_CLSD -7 /* Connection closed. */ 63 | #define ERR_CONN -8 /* Not connected. */ 64 | 65 | #define ERR_VAL -9 /* Illegal value. */ 66 | 67 | #define ERR_ARG -10 /* Illegal argument. */ 68 | 69 | #define ERR_USE -11 /* Address in use. */ 70 | 71 | #define ERR_IF -12 /* Low-level netif error */ 72 | #define ERR_ISCONN -13 /* Already connected. */ 73 | 74 | #define ERR_INPROGRESS -14 /* Operation in progress */ 75 | 76 | 77 | #ifdef LWIP_DEBUG 78 | extern const char *lwip_strerr(err_t err); 79 | #else 80 | #define lwip_strerr(x) "" 81 | #endif /* LWIP_DEBUG */ 82 | 83 | #ifdef __cplusplus 84 | } 85 | #endif 86 | 87 | #endif /* __LWIP_ERR_H__ */ 88 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/src/include/lwip/init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __LWIP_INIT_H__ 33 | #define __LWIP_INIT_H__ 34 | 35 | #include "lwip/opt.h" 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /** X.x.x: Major version of the stack */ 42 | #define LWIP_VERSION_MAJOR 1U 43 | /** x.X.x: Minor version of the stack */ 44 | #define LWIP_VERSION_MINOR 3U 45 | /** x.x.X: Revision of the stack */ 46 | #define LWIP_VERSION_REVISION 2U 47 | /** For release candidates, this is set to 1..254 48 | * For official releases, this is set to 255 (LWIP_RC_RELEASE) 49 | * For development versions (CVS), this is set to 0 (LWIP_RC_DEVELOPMENT) */ 50 | #define LWIP_VERSION_RC 255U 51 | 52 | /** LWIP_VERSION_RC is set to LWIP_RC_RELEASE for official releases */ 53 | #define LWIP_RC_RELEASE 255U 54 | /** LWIP_VERSION_RC is set to LWIP_RC_DEVELOPMENT for CVS versions */ 55 | #define LWIP_RC_DEVELOPMENT 0U 56 | 57 | #define LWIP_VERSION_IS_RELEASE (LWIP_VERSION_RC == LWIP_RC_RELEASE) 58 | #define LWIP_VERSION_IS_DEVELOPMENT (LWIP_VERSION_RC == LWIP_RC_DEVELOPMENT) 59 | #define LWIP_VERSION_IS_RC ((LWIP_VERSION_RC != LWIP_RC_RELEASE) && (LWIP_VERSION_RC != LWIP_RC_DEVELOPMENT)) 60 | 61 | /** Provides the version of the stack */ 62 | #define LWIP_VERSION (LWIP_VERSION_MAJOR << 24 | LWIP_VERSION_MINOR << 16 | \ 63 | LWIP_VERSION_REVISION << 8 | LWIP_VERSION_RC) 64 | 65 | /* Modules initialization */ 66 | void lwip_init(void); 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif /* __LWIP_INIT_H__ */ 73 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/src/include/netif/loopif.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef __NETIF_LOOPIF_H__ 33 | #define __NETIF_LOOPIF_H__ 34 | 35 | #include "lwip/opt.h" 36 | #include "lwip/netif.h" 37 | #include "lwip/err.h" 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | #if !LWIP_NETIF_LOOPBACK_MULTITHREADING 44 | #define loopif_poll netif_poll 45 | #endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */ 46 | 47 | err_t loopif_init(struct netif *netif); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* __NETIF_LOOPIF_H__ */ 54 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/src/include/netif/slipif.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | */ 34 | #ifndef __NETIF_SLIPIF_H__ 35 | #define __NETIF_SLIPIF_H__ 36 | 37 | #include "lwip/netif.h" 38 | 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | err_t slipif_init(struct netif * netif); 44 | void slipif_poll(struct netif *netif); 45 | 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | #endif 51 | 52 | -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/src/netif/FILES: -------------------------------------------------------------------------------- 1 | This directory contains generic network interface device drivers that 2 | do not contain any hardware or architecture specific code. The files 3 | are: 4 | 5 | etharp.c 6 | Implements the ARP (Address Resolution Protocol) over 7 | Ethernet. The code in this file should be used together with 8 | Ethernet device drivers. Note that this module has been 9 | largely made Ethernet independent so you should be able to 10 | adapt this for other link layers (such as Firewire). 11 | 12 | ethernetif.c 13 | An example of how an Ethernet device driver could look. This 14 | file can be used as a "skeleton" for developing new Ethernet 15 | network device drivers. It uses the etharp.c ARP code. 16 | 17 | loopif.c 18 | A "loopback" network interface driver. It requires configuration 19 | through the define LWIP_LOOPIF_MULTITHREADING (see opt.h). 20 | 21 | slipif.c 22 | A generic implementation of the SLIP (Serial Line IP) 23 | protocol. It requires a sio (serial I/O) module to work. 24 | 25 | ppp/ Point-to-Point Protocol stack 26 | The PPP stack has been ported from ucip (http://ucip.sourceforge.net). 27 | It matches quite well to pppd 2.3.1 (http://ppp.samba.org), although 28 | compared to that, it has some modifications for embedded systems and 29 | the source code has been reordered a bit. -------------------------------------------------------------------------------- /firmware/lwip-1.3.2/src/netif/loopif.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Loop Interface 4 | * 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Adam Dunkels 36 | * 37 | */ 38 | #include "lwip/opt.h" 39 | 40 | #if LWIP_HAVE_LOOPIF 41 | 42 | #include "netif/loopif.h" 43 | #include "lwip/snmp.h" 44 | 45 | /** 46 | * Initialize a lwip network interface structure for a loopback interface 47 | * 48 | * @param netif the lwip network interface structure for this loopif 49 | * @return ERR_OK if the loopif is initialized 50 | * ERR_MEM if private data couldn't be allocated 51 | */ 52 | err_t 53 | loopif_init(struct netif *netif) 54 | { 55 | /* initialize the snmp variables and counters inside the struct netif 56 | * ifSpeed: no assumption can be made! 57 | */ 58 | NETIF_INIT_SNMP(netif, snmp_ifType_softwareLoopback, 0); 59 | 60 | netif->name[0] = 'l'; 61 | netif->name[1] = 'o'; 62 | netif->output = netif_loop_output; 63 | return ERR_OK; 64 | } 65 | 66 | #endif /* LWIP_HAVE_LOOPIF */ 67 | -------------------------------------------------------------------------------- /firmware/net/abstract-osc.c: -------------------------------------------------------------------------------- 1 | /* j4cDAC abstract control via OSC 2 | * 3 | * Copyright 2012 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | void abs_parse_line(char *line); 29 | 30 | static void abstract_conf_FPV_param(const char *path, const char *str) { 31 | 32 | /* Start running abstract */ 33 | if (playback_set_src(SRC_ABSTRACT) < 0) { 34 | outputf("src switch err\n"); 35 | return; 36 | } 37 | 38 | /* XXX this is no good, abs_parse_line modifies the line */ 39 | abs_parse_line((char *)str); 40 | 41 | playback_source_flags |= ABSTRACT_PLAYING; 42 | 43 | /* go! */ 44 | dac_set_rate(30000); 45 | int state = dac_get_state(); 46 | if (state == DAC_IDLE) { 47 | outputf("prep %d", dac_prepare()); 48 | outputf("start %d", dac_start()); 49 | } else if (state == DAC_PREPARED) { 50 | outputf("start %d", dac_start()); 51 | } 52 | } 53 | 54 | TABLE_ITEMS(param_handler, abstract_osc_handlers, 55 | { "/abstract/conf", PARAM_TYPE_S1, { .fs = abstract_conf_FPV_param } }, 56 | ) 57 | -------------------------------------------------------------------------------- /firmware/net/broadcast.c: -------------------------------------------------------------------------------- 1 | /* j4cDAC periodic broadcast 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #define BROADCAST_PORT 7654 30 | 31 | static struct udp_pcb broadcast_pcb; 32 | 33 | /* fill_status 34 | * 35 | * Fill in a struct dac_status with the current state of things. 36 | */ 37 | void fill_status(struct dac_status *status) { 38 | status->protocol = 0; 39 | status->light_engine_state = le_get_state(); 40 | status->playback_state = dac_get_state(); 41 | status->playback_flags = dac_flags; 42 | status->light_engine_flags = le_get_flags(); 43 | status->buffer_fullness = dac_fullness(); 44 | 45 | /* Only report a point rate if currently playing */ 46 | if (status->playback_state == DAC_PLAYING) 47 | status->point_rate = dac_current_pps; 48 | else 49 | status->point_rate = 0; 50 | 51 | status->point_count = dac_get_count(); 52 | 53 | status->source = playback_src; 54 | status->source_flags = playback_source_flags; 55 | } 56 | 57 | /* broadcast_send 58 | * 59 | * Fire off a broadcast packet with information about this DAC. 60 | */ 61 | void broadcast_send(void) { 62 | /* Because lwip is an enormous steaming pile of the finest software 63 | * engineering, it is not possible to just allocate *one* pbuf 64 | * during initialization - udp_send modifies the pbuf it is given 65 | * and changes, among other things, its total length. (??!) So we 66 | * allocatea fresh one each time. 67 | */ 68 | 69 | udp_new(&broadcast_pcb); 70 | 71 | udp_bind(&broadcast_pcb, IP_ADDR_ANY, BROADCAST_PORT); 72 | 73 | udp_connect(&broadcast_pcb, IP_ADDR_BROADCAST, BROADCAST_PORT); 74 | 75 | struct pbuf * p = pbuf_alloc(PBUF_TRANSPORT, sizeof(struct 76 | dac_broadcast), PBUF_RAM); 77 | 78 | /* Shamefully bail out. */ 79 | if (!p) 80 | return; 81 | 82 | struct dac_broadcast *pkt = (struct dac_broadcast *) p->payload; 83 | 84 | memcpy(pkt->mac_address, mac_address, sizeof(mac_address)); 85 | fill_status(&pkt->status); 86 | pkt->buffer_capacity = DAC_BUFFER_POINTS - 1; 87 | pkt->max_point_rate = DAC_MAX_POINT_RATE; 88 | 89 | pkt->hw_revision = hw_board_rev; 90 | pkt->sw_revision = 2; 91 | 92 | udp_send(&broadcast_pcb, p); 93 | pbuf_free(p); 94 | 95 | udp_remove(&broadcast_pcb); 96 | } 97 | -------------------------------------------------------------------------------- /firmware/net/ifconfig-osc.c: -------------------------------------------------------------------------------- 1 | /* Ether Dream static IP configuration 2 | * 3 | * Copyright 2013 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include "lwip/netif.h" 25 | #include "lwip/dhcp.h" 26 | 27 | extern struct netif ether_netif; 28 | extern uint8_t ether_manual_ip; 29 | 30 | static void net_ipaddr_FPV_param(const char *path, const char *ip) { 31 | dhcp_stop(ðer_netif); 32 | ether_manual_ip = 1; 33 | struct in_addr addr; 34 | if (inet_aton(ip, &addr)) { 35 | netif_set_ipaddr(ðer_netif, (struct ip_addr *)&addr); 36 | } else { 37 | outputf("bad ip %s", ip); 38 | } 39 | } 40 | static void net_netmask_FPV_param(const char *path, const char *ip) { 41 | dhcp_stop(ðer_netif); 42 | ether_manual_ip = 1; 43 | struct in_addr addr; 44 | if (inet_aton(ip, &addr)) { 45 | netif_set_netmask(ðer_netif, (struct ip_addr *)&addr); 46 | } else { 47 | outputf("bad netmask %s", ip); 48 | } 49 | } 50 | static void net_gateway_FPV_param(const char *path, const char *ip) { 51 | dhcp_stop(ðer_netif); 52 | ether_manual_ip = 1; 53 | struct in_addr addr; 54 | if (inet_aton(ip, &addr)) { 55 | netif_set_gw(ðer_netif, (struct ip_addr *)&addr); 56 | } else { 57 | outputf("bad gateway %s", ip); 58 | } 59 | } 60 | 61 | TABLE_ITEMS(param_handler, ifconfig_params, 62 | { "/net/ipaddr", PARAM_TYPE_S1, { .fs = net_ipaddr_FPV_param } }, 63 | { "/net/netmask", PARAM_TYPE_S1, { .fs = net_netmask_FPV_param } }, 64 | { "/net/gateway", PARAM_TYPE_S1, { .fs = net_gateway_FPV_param } }, 65 | ) 66 | -------------------------------------------------------------------------------- /firmware/net/sink.c: -------------------------------------------------------------------------------- 1 | /* j4cDAC data sink - for performance testing 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | static err_t sink_recv_FPV_tcp_recv(struct tcp_pcb * pcb, struct pbuf * pbuf, 24 | err_t err) { 25 | 26 | if (pbuf == NULL) { 27 | outputf("ps: connection closed"); 28 | tcp_recv(pcb, NULL); 29 | tcp_close(pcb); 30 | return ERR_OK; 31 | } 32 | 33 | /* Tell lwIP we're done with this packet. */ 34 | tcp_recved(pcb, pbuf->tot_len); 35 | pbuf_free(pbuf); 36 | 37 | return ERR_OK; 38 | } 39 | 40 | static err_t sink_accept_FPV_tcp_accept(void *arg, struct tcp_pcb *pcb, err_t err) { 41 | LWIP_UNUSED_ARG(err); 42 | LWIP_UNUSED_ARG(arg); 43 | 44 | tcp_recv(pcb, sink_recv_FPV_tcp_recv); 45 | 46 | return ERR_OK; 47 | } 48 | 49 | void sink_init(void) { 50 | struct tcp_pcb *pcb; 51 | 52 | pcb = tcp_new(); 53 | tcp_bind(pcb, IP_ADDR_ANY, 9); 54 | pcb = tcp_listen(pcb); 55 | tcp_accept(pcb, sink_accept_FPV_tcp_accept); 56 | } 57 | 58 | INITIALIZER(protocol, sink_init); 59 | -------------------------------------------------------------------------------- /firmware/old/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains files that are not currently used in the firmware, 2 | but that we may want again. 3 | -------------------------------------------------------------------------------- /firmware/old/patterns.c: -------------------------------------------------------------------------------- 1 | /* j4cDAC built-in test patterns 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | static int tp_position; 23 | 24 | extern const unsigned char ildatest_bts[7164]; 25 | 26 | void tp_trianglewave_run() { 27 | dac_point_t *ptr = 0; 28 | int dlen = dac_request(&ptr); 29 | 30 | if (dlen < 0) { 31 | outputf("*** UNDERFLOW ***"); 32 | dac_prepare(); 33 | return; 34 | } 35 | 36 | if (dlen < 10 && dac_get_state() != DAC_PLAYING) { 37 | dac_start(30000); 38 | } 39 | 40 | if (dlen == 0) 41 | return; 42 | 43 | int i; 44 | for (i = 0; i < dlen; i++) { 45 | ptr[i].x = tp_position; 46 | ptr[i].y = tp_position; 47 | ptr[i].r = 65535; 48 | ptr[i].g = 0; 49 | ptr[i].b = 0; 50 | ptr[i].i = 0; 51 | ptr[i].u1 = 0; 52 | ptr[i].u2 = 0; 53 | 54 | tp_position += 256; 55 | } 56 | 57 | dac_advance(dlen); 58 | } 59 | 60 | void tp_ilda_run() { 61 | dac_point_t *ptr = 0; 62 | int dlen = dac_request(&ptr); 63 | 64 | if (dlen < 0) { 65 | outputf("*** UNDERFLOW ***"); 66 | dac_prepare(); 67 | return; 68 | } 69 | 70 | if (dlen < 10 && dac_get_state() != DAC_PLAYING) { 71 | dac_start(30000); 72 | } 73 | 74 | if (dlen == 0) 75 | return; 76 | 77 | int ctr = tp_position, i; 78 | for (i = 0; i < dlen; i++) { 79 | const unsigned char *w = &ildatest_bts[ctr]; 80 | uint16_t x = ((w[3] << 8) & 0xF000) | (w[4] << 4); 81 | uint16_t y = ((w[3] << 12) & 0xF000) | (w[5] << 4); 82 | ptr[i].x = x; 83 | ptr[i].y = y; 84 | ptr[i].r = w[0] << 4; 85 | ptr[i].g = w[1] << 4; 86 | ptr[i].b = w[2] << 4; 87 | ptr[i].i = 0; 88 | ptr[i].u1 = 0; 89 | ptr[i].u2 = 0; 90 | 91 | ctr += 6; 92 | 93 | if (ctr >= 7164) 94 | ctr = 0; 95 | } 96 | 97 | dac_advance(dlen); 98 | 99 | tp_position = i; 100 | } 101 | -------------------------------------------------------------------------------- /firmware/stacker.cfg: -------------------------------------------------------------------------------- 1 | [stacker] 2 | src = . 3 | binary = j4cDAC.elf 4 | prefix = arm-none-eabi- 5 | 6 | [entry] 7 | entries = main *_Handler *_IRQHandler dac_handle_abstract 8 | 9 | [targets] 10 | FPA_(.*) = (.*)_FPV_\1 11 | check_periodic_timers = (.*)_tmr 12 | 13 | [tables] 14 | _pattern_ = INITIALIZER\s*\((.*),\s*(.*)\) 15 | FPA_init = hardware protocol 16 | main = poll 17 | 18 | [ignore_callees] 19 | panic = panic_internal 20 | 21 | [ignore_confusions] 22 | __aeabi_fdiv = unknown-op 23 | __cs3_reset = unknown-op 24 | _start = unknown-op 25 | __libc_init_array = indirect-jump 26 | reenter_bootloader = unknown-op 27 | strcpy = ret-with-stack conditional-ret 28 | -------------------------------------------------------------------------------- /firmware/unix/dac.c: -------------------------------------------------------------------------------- 1 | /* j4cDAC DAC shim 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | int dac_set_rate(int points_per_second) { 24 | outputf(" set rate %d\n", points_per_second); 25 | return 0; 26 | } 27 | 28 | int dac_start(void) { 29 | outputf(" start\n"); 30 | return 0; 31 | } 32 | 33 | int dac_rate_queue(int points_per_second) { 34 | outputf(" queue rate %d\n", points_per_second); 35 | return 0; 36 | } 37 | 38 | int dac_request(void) { 39 | usleep(5000); 40 | return 0; 41 | } 42 | 43 | packed_point_t *dac_request_addr(void) { 44 | return NULL; 45 | } 46 | 47 | void dac_advance(int count) { 48 | outputf(" advance %d\n", count); 49 | } 50 | 51 | void dac_init() { 52 | } 53 | 54 | int dac_prepare(void) { 55 | outputf(" prepare\n"); 56 | return 0; 57 | } 58 | 59 | void dac_stop(int flags) { 60 | outputf(" stop %d\n", flags); 61 | } 62 | 63 | enum dac_state dac_get_state(void) { 64 | return DAC_IDLE; 65 | } 66 | 67 | int dac_fullness(void) { 68 | return 0; 69 | } 70 | 71 | void shutter_set(int state) { 72 | } 73 | -------------------------------------------------------------------------------- /firmware/unix/sdcard.c: -------------------------------------------------------------------------------- 1 | /* j4cDAC file-based SD shim 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | struct sdcard_config sdcard_config; 26 | uint8_t sdcard_card_type; 27 | 28 | static FILE * sdcard_file; 29 | 30 | int sdcard_wait_for_ready(void) { 31 | return 0; 32 | } 33 | 34 | int sdcard_init(void) { 35 | sdcard_file = fopen("sdcard.img", "rw"); 36 | if (!sdcard_file) 37 | return -1; 38 | 39 | struct stat st; 40 | fstat(fileno(sdcard_file), &st); 41 | 42 | sdcard_config.blocksize = 512; 43 | sdcard_config.size = st.st_size; 44 | sdcard_config.sectorcnt = st.st_size / 512; 45 | outputf("%d blocks.\n", sdcard_config.sectorcnt); 46 | return 0; 47 | } 48 | 49 | int sdcard_read(uint8_t * buf, int sector, int count) { 50 | outputf(" reading %d from %d\n", count, sector); 51 | int res = fseek(sdcard_file, sector * 512, SEEK_SET); 52 | if (res < 0) { 53 | perror("fseek"); 54 | return -1; 55 | } 56 | res = fread(buf, 512, count, sdcard_file); 57 | if (res < 0) { 58 | perror("fread"); 59 | return -1; 60 | } 61 | return 0; 62 | } 63 | 64 | int sdcard_write(const uint8_t * buf, int sector, int count) { 65 | outputf(" writing %d to %d\n", count, sector); 66 | int res = fseek(sdcard_file, sector * 512, SEEK_SET); 67 | if (res < 0) { 68 | perror("fseek"); 69 | return -1; 70 | } 71 | res = fwrite(buf, 512, count, sdcard_file); 72 | if (res < 0) { 73 | perror("fwrite"); 74 | return -1; 75 | } 76 | return 0; 77 | } 78 | 79 | int sdcard_get_sd_status(uint8_t * buf) { 80 | return 0; 81 | } 82 | -------------------------------------------------------------------------------- /releases/v0.3.0/j4cDAC.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j4cbo/j4cDAC/12ecbe565fcaa88f771b1bfdfb1852baca38fbe6/releases/v0.3.0/j4cDAC.bin -------------------------------------------------------------------------------- /releases/v0.3.0/j4cDAC.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j4cbo/j4cDAC/12ecbe565fcaa88f771b1bfdfb1852baca38fbe6/releases/v0.3.0/j4cDAC.elf -------------------------------------------------------------------------------- /tools/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | dist 3 | *.log 4 | *.exe 5 | *.pyc 6 | *.app 7 | *.zip 8 | warn*.txt 9 | */tk.pkg 10 | -------------------------------------------------------------------------------- /tools/f0ad/.gitignore: -------------------------------------------------------------------------------- 1 | f0ad 2 | -------------------------------------------------------------------------------- /tools/f0ad/Makefile: -------------------------------------------------------------------------------- 1 | f0ad: f0ad.c 2 | gcc f0ad.c -o f0ad -Wall -lusb-1.0 3 | -------------------------------------------------------------------------------- /tools/f0ad/f0ad.c: -------------------------------------------------------------------------------- 1 | /* j4cDAC reenter-bootloader tool 2 | * 3 | * Copyright 2011 Jacob Potter 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, version 3. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include 19 | #include 20 | 21 | int main() { 22 | libusb_init(NULL); 23 | libusb_set_debug(NULL, 3); 24 | 25 | libusb_device_handle *h = libusb_open_device_with_vid_pid(NULL, 0xffff, 0x0005); 26 | 27 | if (!h) { 28 | printf("No device found.\n"); 29 | return -1; 30 | } 31 | 32 | printf("F0AD!\n"); 33 | libusb_control_transfer(h, LIBUSB_REQUEST_TYPE_STANDARD, 34 | LIBUSB_REQUEST_SET_FEATURE, 0xF0AD, 0xF0AD, NULL, 0, 0); 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /tools/flasher.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # j4cDAC flash tools 4 | # 5 | # Copyright 2010, 2011 Jacob Potter 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, version 3. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | 19 | # This is an unfinished tool to frob the Flash check word in an image. It 20 | # is not currently used - lpc17isp will do this manipulation for us - but 21 | # may be needed in the future. 22 | 23 | import intelhex 24 | import serial 25 | import struct 26 | import sys 27 | 28 | 29 | def lpc1758_fixup(hexfile): 30 | # Read vectors 0 through 6 31 | checksum = 0 32 | for i in xrange(0, 7): 33 | vec_data = hexfile.gets(i * 4, 4) 34 | (vec_value, ) = struct.unpack("hhh", x, y, 0) 55 | else: 56 | out = struct.pack(">hh", x, y) 57 | 58 | if mode in (0, 1): 59 | out += struct.pack(">H", pick_palette_color(r, g, b)) 60 | else: 61 | out += struct.pack("BBBB", 0, b, g, r) 62 | 63 | return out 64 | 65 | def make_circlepoint(mode, i): 66 | x = int(sin(i*2*pi) * 30000) 67 | y = int(cos(i*2*pi) * 30000) 68 | r, g, b = rainbow(i) 69 | return pack_point(mode, x, y, r, g, b) 70 | 71 | def make_frame(mode, npts, framenum, frames): 72 | ostr = "ILDA" + struct.pack(">I", mode) + "crcltest j4cbo" 73 | ostr += struct.pack(">hhhh", npts, framenum, frames, 0) 74 | return ostr + "".join( 75 | make_circlepoint(mode, float(i) / npts) 76 | for i in xrange(npts) 77 | ) 78 | 79 | def make_spec(): 80 | for mode in (0, 1, 4, 5): 81 | for npts in range(50, 500, 5): 82 | yield mode, npts 83 | 84 | frames = list(make_spec()) 85 | sys.stderr.write("Producing %d frames\n" % (len(frames))) 86 | 87 | for i, (mode, npts) in enumerate(frames): 88 | sys.stdout.write(make_frame(mode, npts, i + 1, len(frames))) 89 | -------------------------------------------------------------------------------- /tools/ilda/rainbowcircle.ild: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j4cbo/j4cDAC/12ecbe565fcaa88f771b1bfdfb1852baca38fbe6/tools/ilda/rainbowcircle.ild -------------------------------------------------------------------------------- /tools/image.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # j4cDAC flash tools 4 | # 5 | # Copyright 2010, 2011 Jacob Potter 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, version 3. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | 19 | import intelhex 20 | import StringIO 21 | import zlib 22 | import struct 23 | import sys 24 | 25 | APP_START = 0x4000 26 | 27 | IMAGE_ROUND = 256 28 | 29 | def main(): 30 | if len(sys.argv) != 3: 31 | print "Usage: %s [hexfile] [outfile]" % (sys.argv[0], ) 32 | sys.exit(1) 33 | 34 | hexfile = intelhex.IntelHex(sys.argv[1]) 35 | 36 | if hexfile.minaddr() != APP_START: 37 | print "Error: image does not start at %x" % (APP_START, ) 38 | sys.exit(1) 39 | 40 | # Find the actual data length 41 | imagelen = (hexfile.maxaddr() - APP_START + IMAGE_ROUND) 42 | imagelen -= (imagelen % IMAGE_ROUND) 43 | 44 | # Insert data length as vector 8 45 | data_len = struct.pack("; 2 | All Rights Reserved. 3 | 4 | This is the Python license. In short, you can use this product in 5 | commercial and non-commercial applications, modify it, redistribute it. 6 | A notification to the author when you use and/or modify it is welcome. 7 | 8 | 9 | TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING THIS SOFTWARE 10 | =================================================================== 11 | 12 | LICENSE AGREEMENT 13 | ----------------- 14 | 15 | 1. This LICENSE AGREEMENT is between the copyright holder of this 16 | product, and the Individual or Organization ("Licensee") accessing 17 | and otherwise using this product in source or binary form and its 18 | associated documentation. 19 | 20 | 2. Subject to the terms and conditions of this License Agreement, 21 | the copyright holder hereby grants Licensee a nonexclusive, 22 | royalty-free, world-wide license to reproduce, analyze, test, 23 | perform and/or display publicly, prepare derivative works, distribute, 24 | and otherwise use this product alone or in any derivative version, 25 | provided, however, that copyright holders License Agreement and 26 | copyright holders notice of copyright are retained in this product 27 | alone or in any derivative version prepared by Licensee. 28 | 29 | 3. In the event Licensee prepares a derivative work that is based on 30 | or incorporates this product or any part thereof, and wants to make 31 | the derivative work available to others as provided herein, then 32 | Licensee hereby agrees to include in any such work a brief summary of 33 | the changes made to this product. 34 | 35 | 4. The copyright holder is making this product available to Licensee on 36 | an "AS IS" basis. THE COPYRIGHT HOLDER MAKES NO REPRESENTATIONS OR 37 | WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, 38 | THE COPYRIGHT HOLDER MAKES NO AND DISCLAIMS ANY REPRESENTATION OR 39 | WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR 40 | THAT THE USE OF THIS PRODUCT WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 41 | 42 | 5. THE COPYRIGHT HOLDER SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER 43 | USERS OF THIS PRODUCT FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL 44 | DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE 45 | USING THIS PRODUCT, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE 46 | POSSIBILITY THEREOF. 47 | 48 | 6. This License Agreement will automatically terminate upon a material 49 | breach of its terms and conditions. 50 | 51 | 7. Nothing in this License Agreement shall be deemed to create any 52 | relationship of agency, partnership, or joint venture between the 53 | copyright holder and Licensee. This License Agreement does not grant 54 | permission to use trademarks or trade names from the copyright holder 55 | in a trademark sense to endorse or promote products or services of 56 | Licensee, or any third party. 57 | 58 | 8. By copying, installing or otherwise using this product, Licensee 59 | agrees to be bound by the terms and conditions of this License 60 | Agreement. 61 | -------------------------------------------------------------------------------- /tools/miniterm/readme.txt: -------------------------------------------------------------------------------- 1 | miniterm.py was copied out of the python-serial Debian package (version 2 | 2.3-1). It has not been modified further. 3 | 4 | You will need to install pyserial to use this. 5 | -------------------------------------------------------------------------------- /tools/osc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2004 Steve Harris, Uwe Koloska 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * $Id: example_client.c,v 1.1.1.1 2004/08/07 22:21:02 theno23 Exp $ 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | #include "lo/lo.h" 22 | 23 | int main(int argc, char *argv[]) { 24 | if (argc != 3) { 25 | printf("Usage: %s path value\n", argv[0]); 26 | return 1; 27 | } 28 | 29 | /* an address to send messages to. sometimes it is better to let the server 30 | * pick a port number for you by passing NULL as the last argument */ 31 | lo_address t = lo_address_new("169.254.13.29", "60000"); 32 | 33 | return lo_send(t, argv[1], "i", atoi(argv[2])); 34 | } 35 | -------------------------------------------------------------------------------- /tools/sitter/build.bat: -------------------------------------------------------------------------------- 1 | C:\Python26\python.exe c:\pyi\Makespec.py -w -F --tk sitter.py 2 | C:\Python26\python.exe c:\pyi\Build.py sitter.spec 3 | -------------------------------------------------------------------------------- /tools/sitter/sitter.spec: -------------------------------------------------------------------------------- 1 | # -*- mode: python -*- 2 | a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'), os.path.join(HOMEPATH,'support\\unpackTK.py'), os.path.join(HOMEPATH,'support\\useTK.py'), os.path.join(HOMEPATH,'support\\useUnicode.py'), 'sitter.py', os.path.join(HOMEPATH,'support\\removeTK.py')], 3 | pathex=['Z:\\j4cDAC\\tools\\sitter']) 4 | pyz = PYZ(a.pure) 5 | exe = EXE(TkPKG(), pyz, 6 | a.scripts, 7 | a.binaries, 8 | a.zipfiles, 9 | a.datas, 10 | name=os.path.join('dist', 'sitter.exe'), 11 | debug=False, 12 | strip=False, 13 | upx=True, 14 | console=False ) 15 | app = BUNDLE(exe, 16 | name=os.path.join('dist', 'sitter.exe.app')) 17 | -------------------------------------------------------------------------------- /tools/tester/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /tools/tester/talk.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # j4cDAC test code 4 | # 5 | # Copyright 2011 Jacob Potter 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, version 3. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | 19 | import dac 20 | 21 | class SquarePointStream(object): 22 | def produce(self): 23 | pmax = 8600 24 | pstep = 100 25 | cmax = 60000 26 | while True: 27 | for x in xrange(-pmax, pmax, pstep): 28 | yield (x, pmax, cmax, cmax, cmax, cmax) 29 | for y in xrange(pmax, -pmax, -pstep): 30 | yield (pmax, y, cmax, cmax, cmax, cmax) 31 | for x in xrange(pmax, -pmax, -pstep): 32 | yield (x, -pmax, cmax, cmax, cmax, cmax) 33 | for y in xrange(-pmax, pmax, pstep): 34 | yield (-pmax, y, cmax, cmax, cmax, cmax) 35 | 36 | def __init__(self): 37 | self.stream = self.produce() 38 | 39 | def read(self, n): 40 | return [self.stream.next() for i in xrange(n)] 41 | 42 | class NullPointStream(object): 43 | def read(self, n): 44 | return [(0, 0, 0, 0, 0)] * n 45 | 46 | #dac.find_dac() 47 | 48 | d = dac.DAC(dac.find_first_dac()) 49 | 50 | d.play_stream(SquarePointStream()) 51 | -------------------------------------------------------------------------------- /tools/tester/watch.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # j4cDAC test code 4 | # 5 | # Copyright 2011 Jacob Potter 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation, version 3. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | 19 | import dac 20 | 21 | dac.find_dac() 22 | -------------------------------------------------------------------------------- /tools/updater/.gitignore: -------------------------------------------------------------------------------- 1 | j4cDAC.bin 2 | -------------------------------------------------------------------------------- /tools/updater/EtherDreamUSB.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j4cbo/j4cDAC/12ecbe565fcaa88f771b1bfdfb1852baca38fbe6/tools/updater/EtherDreamUSB.inf -------------------------------------------------------------------------------- /tools/updater/build.bat: -------------------------------------------------------------------------------- 1 | c:\Python26\python.exe C:\pyi\Build.py update.spec 2 | -------------------------------------------------------------------------------- /tools/updater/cmd-updater.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | from dfu import dfu, update 3 | import sys 4 | import time 5 | 6 | def msg(s): 7 | print s 8 | 9 | def run(argv): 10 | if len(sys.argv) != 2: 11 | print "Usage: %s [updatefile]" % (sys.argv[0], ) 12 | sys.exit(1) 13 | 14 | dev = False 15 | while not dev: 16 | dev = update.check_device(msg) 17 | if not dev: time.sleep(1) 18 | 19 | dfu.download(dev, sys.argv[1], msg) 20 | 21 | if __name__ == "__main__": 22 | run(sys.argv) 23 | -------------------------------------------------------------------------------- /tools/updater/dfu/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j4cbo/j4cDAC/12ecbe565fcaa88f771b1bfdfb1852baca38fbe6/tools/updater/dfu/__init__.py -------------------------------------------------------------------------------- /tools/updater/dfu/update.py: -------------------------------------------------------------------------------- 1 | import time 2 | import usb 3 | 4 | def look_for_device(msg): 5 | dev = usb.core.find(idVendor=0xffff, idProduct=0x0005) 6 | 7 | if dev is None: 8 | msg("No DAC found.") 9 | return None 10 | 11 | isBoot = (dev[0][(0,0)].bInterfaceClass == 254 12 | and dev[0][(0,0)].bInterfaceSubClass == 1) 13 | 14 | if not isBoot: 15 | msg("Resetting...") 16 | dev.ctrl_transfer(0, 3, 0xf0ad, 0xf0ad) 17 | time.sleep(.1) 18 | dev.reset() 19 | return None 20 | 21 | msg("Ready.") 22 | return dev 23 | 24 | def check_device(msg): 25 | try: 26 | return look_for_device(msg) 27 | except usb.USBError, e: 28 | return None 29 | -------------------------------------------------------------------------------- /tools/updater/update.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | from Tkinter import * 3 | from dfu import dfu, update 4 | import thread 5 | import Queue 6 | import time 7 | 8 | # Queues for communication between threads 9 | to_ui = Queue.Queue() 10 | from_ui = Queue.Queue() 11 | 12 | # Set up the basic window 13 | root = Tk() 14 | root.title("Ether Dream") 15 | root.resizable(FALSE, FALSE) 16 | frame = Frame(root) 17 | frame.grid() 18 | label = Label(frame, text=" ") 19 | label['width'] = 30 20 | label.grid(row=0, column=0, padx=10, pady=20) 21 | go_button = None 22 | 23 | def pressed(): 24 | from_ui.put(True) 25 | go_button.configure(state=DISABLED, text="Updating...") 26 | 27 | go_button = Button(frame, text="Update", command=pressed) 28 | go_button.grid(row=1, column=0) 29 | 30 | # Copy lines from the update thread into the window 31 | q = Queue.Queue() 32 | def queue_check(): 33 | try: 34 | while True: 35 | state, text, btn = to_ui.get_nowait() 36 | label['text'] = text 37 | if state == "quit": 38 | root.quit() 39 | elif state: 40 | go_button.configure(state=NORMAL, text=btn) 41 | else: 42 | go_button.configure(state=DISABLED, text=btn) 43 | except Queue.Empty: 44 | root.after(200, queue_check) 45 | 46 | root.after(100, queue_check) 47 | 48 | def msg(s): 49 | print s 50 | to_ui.put((False, s, "Update")) 51 | 52 | # USB thread 53 | def usb_thread(): 54 | while True: 55 | dev = update.check_device(msg) 56 | if not dev: 57 | time.sleep(1) 58 | continue 59 | 60 | to_ui.put((True, "Ready.", "Update")) 61 | 62 | # Wait for button 63 | from_ui.get() 64 | 65 | dfu.download(dev, "j4cDAC.bin", msg) 66 | 67 | to_ui.put((True, "Done.", "Exit")) 68 | from_ui.get() 69 | to_ui.put(("quit", None, None)) 70 | 71 | 72 | thread.start_new(usb_thread, ()) 73 | 74 | root.mainloop() 75 | -------------------------------------------------------------------------------- /tools/updater/update.spec: -------------------------------------------------------------------------------- 1 | # -*- mode: python -*- 2 | a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'), os.path.join(HOMEPATH,'support\\unpackTK.py'), os.path.join(HOMEPATH,'support\\useTK.py'), os.path.join(HOMEPATH,'support\\useUnicode.py'), 'update.py', os.path.join(HOMEPATH,'support\\removeTK.py')], 3 | pathex=['Z:\\j4cDAC\\tools\\updater']) 4 | a.datas += [('j4cDAC.bin', 'j4cDAC.bin', 'DATA')] 5 | pyz = PYZ(a.pure) 6 | exe = EXE(TkPKG(), pyz, 7 | a.scripts, 8 | a.binaries, 9 | a.zipfiles, 10 | a.datas, 11 | name=os.path.join('dist', 'update.exe'), 12 | debug=False, 13 | strip=False, 14 | upx=True, 15 | console=False) 16 | app = BUNDLE(exe, 17 | name=os.path.join('dist', 'update.exe.app')) 18 | -------------------------------------------------------------------------------- /tools/webui/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 32 | Ether Dream 33 | 34 | 35 | 36 | 37 | 38 | 39 | --------------------------------------------------------------------------------