diff --git a/firmware/applications/Makefile b/firmware/applications/Makefile index 6d034d3..25a35c4 100644 --- a/firmware/applications/Makefile +++ b/firmware/applications/Makefile @@ -42,6 +42,22 @@ LIBFILE=lib$(LIBNAME).a all: $(LIBFILE) +ifeq "$(APP)" "loadable" +ifndef LAPP +LAPP=blinktest +endif +LSRC=../loadable/$(LAPP).c +LOBJ=loadable_$(LAPP).o + +.PHONY: $(LOBJ) + +$(LOBJ): + $(CC) $(CFLAGS) -o $@ $(LSRC) + $(RM) $(LIBFILE) + +OBJS += $(LOBJ) +endif + $(LIBFILE): $(OBJS) $(WRAPOBJ) $(AR) rcs $@ $(OBJS) $(WRAPOBJ) diff --git a/firmware/applications/cbitset.h b/firmware/applications/cbitset.h new file mode 100644 index 0000000..4e76b82 --- /dev/null +++ b/firmware/applications/cbitset.h @@ -0,0 +1,53 @@ +#ifndef CBITFIELD_H +#define CBITFIELD_H + +#define BITSETCHUNKSIZE 32 + +#define one ((uint32_t)1) + +struct bitset { + uint16_t size; + uint32_t bits[BITSET_SIZE/BITSETCHUNKSIZE+1]; +}; + +static inline void bitset_set(struct bitset *bs,uint16_t index, uint8_t value) { + uint16_t base=index/BITSETCHUNKSIZE; + uint16_t offset=index%BITSETCHUNKSIZE; + if(value) { + bs->bits[base]|=(one<bits[base]&=~(one<bits[base]^=(one<bits[base]&(one< + +#include "basic/basic.h" + +//#include "lcd/render.h" +#include "lcd/display.h" +//#include "lcd/allfonts.h" + +#define BITSET_X (RESX+2) +#define BITSET_Y (RESY+2) +#define BITSET_SIZE (BITSET_X*BITSET_Y) + +#include "cbitset.h" + +typedef uint8_t uchar; + +unsigned char rnd1(); + +void draw_rect(char x0, char y0, char x1, char y1) { + for(char x=x0; x<=x1; ++x) { + lcdSetPixel(x,y0,true); + lcdSetPixel(x,y1,true); + } + for(char y=y0+1; y +#include + +#include "basic/basic.h" +#include "lcd/lcd.h" +#include "lcd/print.h" +#include "usb/usbmsc.h" + +/**************************************************************************/ +void gotoISP(void) { + DoString(0,0,"Enter ISP!"); + lcdDisplay(); + ISPandReset(); +} + +void lcd_mirror(void) { + lcdToggleFlag(LCD_MIRRORX); +}; + +void lcd_invert(void) { + lcdToggleFlag(LCD_INVERTED); +}; + +void adc_check(void) { + int dx=0; + int dy=8; + // Print Voltage + dx=DoString(0,dy,"Voltage:"); + while ((getInputRaw())==BTN_NONE){ + DoInt(dx,dy,GetVoltage()); + lcdDisplay(); + }; + dy+=8; + dx=DoString(0,dy,"Done."); +}; + +void msc_menu(void){ + DoString(0,8,"MSC Enabled."); + lcdDisplay(); + usbMSCInit(); + while(!getInputRaw())delayms(10); + DoString(0,16,"MSC Disabled."); + usbMSCOff(); +}; + +extern void (*ram)(void); + +const struct MENU_DEF menu_ISP = {"Invoke ISP", &gotoISP}; +const struct MENU_DEF menu_again = {"Run Loadable", &ram}; +const struct MENU_DEF menu_nop = {"---", NULL}; +const struct MENU_DEF menu_msc = {"MSC", &msc_menu}; +const struct MENU_DEF menu_volt = {"Akku", &adc_check}; +const struct MENU_DEF menu_mirror = {"Mirror", &lcd_mirror}; +const struct MENU_DEF menu_invert = {"Invert", &lcd_invert}; + +static menuentry menu[] = { + &menu_again, + &menu_ISP, + &menu_nop, + &menu_msc, + &menu_mirror, + &menu_invert, + &menu_volt, + NULL, +}; + +static const struct MENU mainmenu = {"Mainmenu", menu}; + + +/**************************************************************************/ + +void main_loadable(void) { + + lcdFill(0); // clear display buffer + lcdDisplay(); + handleMenu(&mainmenu); + gotoISP(); +}; diff --git a/firmware/applications/mkwrapper b/firmware/applications/mkwrapper index 50224fc..26830e1 100755 --- a/firmware/applications/mkwrapper +++ b/firmware/applications/mkwrapper @@ -1,6 +1,9 @@ #!/bin/sh for a in $* ; do + case $a in + loadable_*) continue;; + esac base=${a%.o} echo "void main_$base(void);" echo "void tick_$base(void);" @@ -10,6 +13,9 @@ echo echo "void wrapper(void){" for a in $* ; do + case $a in + loadable_*) continue;; + esac base=${a%.o} echo "main_$base();" done @@ -19,6 +25,9 @@ echo "}" echo "void tick_wrapper(void){" for a in $* ; do + case $a in + loadable_*) continue;; + esac base=${a%.o} grep -q \ tick_$base ${base}.c && echo "tick_$base();" done diff --git a/firmware/core/lpc134x.h b/firmware/core/lpc134x.h index 80b38ec..5a7332e 100644 --- a/firmware/core/lpc134x.h +++ b/firmware/core/lpc134x.h @@ -1937,8 +1937,13 @@ typedef struct #define NVIC ((NVIC_Type *) NVIC_BASE_ADDRESS) +#ifdef ARM static inline void __enable_irq() { __asm volatile ("cpsie i"); } static inline void __disable_irq() { __asm volatile ("cpsid i"); } +#else +void __enable_irq(); +void __disable_irq(); +#endif typedef enum IRQn { diff --git a/firmware/funk/openbeacon.c b/firmware/funk/openbeacon.c index 4c1810b..2b919bf 100644 --- a/firmware/funk/openbeacon.c +++ b/firmware/funk/openbeacon.c @@ -6,7 +6,7 @@ #include "filesystem/ff.h" //const uint32_t key[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}; -const uint32_t key[4] = { 0xB4595344,0xD3E119B6,0xA814D0EC,0xEFF5A24E }; +const uint32_t openbeaconkey[4] = { 0xB4595344,0xD3E119B6,0xA814D0EC,0xEFF5A24E }; const uint8_t useencryption = 1; const uint8_t mac[5] = {1,2,3,2,1}; @@ -83,7 +83,7 @@ uint8_t openbeaconSendPacket(uint32_t id, uint32_t seq, buf[12]=0xff; // salt (0xffff always?) buf[13]=0xff; - return nrf_snd_pkt_crc_encr(16,buf,useencryption?key:NULL); + return nrf_snd_pkt_crc_encr(16,buf,useencryption?openbeaconkey:NULL); } uint8_t openbeaconSend(void) diff --git a/simulat0r/Makefile b/simulat0r/Makefile new file mode 100644 index 0000000..ae22d3d --- /dev/null +++ b/simulat0r/Makefile @@ -0,0 +1,27 @@ +all : tui gui + +.PHONY : tui gui tui-core clean + +tui-core : + $(MAKE) -C firmware + $(MAKE) -C simcore + $(MAKE) -C tui + +tui : tui-core + $(MAKE) -C gui/build clean # workaround for buggy dependency of gui build on libapp + +.IGNORE : tui + +gui : tui gui/build/Makefile + $(MAKE) -C gui/build VERBOSE=1 + +# bootstrap build directory +gui/build/Makefile : tui-core + install -d gui/build && cd gui/build && cmake .. + + +clean: + $(MAKE) -C firmware clean + $(MAKE) -C tui clean + $(MAKE) -C simcore clean + $(MAKE) -C gui/build clean # workaround for buggy dependency of gui build on libapp diff --git a/simulat0r/bin/update-bridge-files.sh b/simulat0r/bin/update-bridge-files.sh new file mode 100755 index 0000000..f278dc5 --- /dev/null +++ b/simulat0r/bin/update-bridge-files.sh @@ -0,0 +1,46 @@ +#!/bin/sh +function verbmsg() +{ +true +# echo $1 +} + +if test ! -d simulat0r/firmware -o ! -d firmware +then +echo ERROR: +echo This script must be run from toplevel r0ket directory +exit +fi + +echo "Updating directories" +for i in `find firmware/ -type d ` +do +if test -d simulat0r/$i +then verbmsg "OK Directory already exists: $i" +else mkdir -v simulat0r/$i +fi +done + +echo "Updating bridge files for C source" +for i in `find firmware/ \! -path firmware/lcd/allfonts.h -type f -iname \*.[ch]` +do + if test -f simulat0r/$i; + then + verbmsg "OK File already exists: $i" + else + echo Writing bridge file simulat0r/$i + (printf "/* AUTOGENERATED SOURCE FILE */\n"; echo \#include \"`dirname $i | sed "s#[^/]*#..#g" `/../$i\") >simulat0r/$i + fi +done + +echo "Updating bridge files for Makefiles" +for i in `find firmware/ -type f -iname Makefile` +do + if test -f simulat0r/$i; + then + verbmsg "OK File already exists: $i" + else + echo Writing bridge file simulat0r/$i + (printf "# GENERATED INCLUDE BRIDGE/\n"; echo include `dirname $i | sed "s#[^/]*#..#g" `/../$i) >simulat0r/$i + fi +done diff --git a/simulat0r/firmware/Makefile b/simulat0r/firmware/Makefile new file mode 100644 index 0000000..3c50af5 --- /dev/null +++ b/simulat0r/firmware/Makefile @@ -0,0 +1,4 @@ +# GENERATED INCLUDE BRIDGE/ +include ../../firmware/Makefile + +.IGNORE: $(OUTFILE).elf $(OUTFILE).bin diff --git a/simulat0r/firmware/Makefile.inc b/simulat0r/firmware/Makefile.inc new file mode 100644 index 0000000..c444d46 --- /dev/null +++ b/simulat0r/firmware/Makefile.inc @@ -0,0 +1,46 @@ +########################################################################## +# User configuration and firmware specific object files +########################################################################## + +# The target, flash and ram of the LPC1xxx microprocessor. +# Use for the target the value: LPC11xx, LPC13xx or LPC17xx +TARGET = LPC13xx +FLASH = 32K +SRAM = 8K +RAMCODE=1K + +# For USB HID support the LPC134x reserves 384 bytes from the sram, +# if you don't want to use the USB features, just use 0 here. +SRAM_USB = 384 + +########################################################################## +# GNU GCC compiler prefix and location +########################################################################## + +#CROSS_COMPILE = arm-none-eabi- +AS = $(CROSS_COMPILE)gcc +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld +REALLD = $(CROSS_COMPILE)ld +SIZE = $(CROSS_COMPILE)size +OBJCOPY = $(CROSS_COMPILE)objcopy +OBJDUMP = $(CROSS_COMPILE)objdump +OUTFILE = firmware +LPCFIX = /bin/echo + +ifeq (LPC11xx,$(TARGET)) + CORTEX_TYPE=m0 +else + CORTEX_TYPE=m3 +endif + +#CPU_TYPE = cortex-$(CORTEX_TYPE) +#CPU_TYPE=i686 + +########################################################################## +# Compiler settings, parameters and flags +########################################################################## + +CFLAGS = -std=c99 -c -g -O0 $(INCLUDE_PATHS) -Wall -funsigned-char -ffunction-sections -fdata-sections -fmessage-length=0 -DRAMCODE=$(RAMCODE) -fno-builtin -DSIMULATOR -I$(ROOT_PATH)/../simcore -include libc-unc0llide.h +#LDFLAGS = -nostartfiles + diff --git a/simulat0r/firmware/Makefile.util b/simulat0r/firmware/Makefile.util new file mode 100644 index 0000000..d643ce6 --- /dev/null +++ b/simulat0r/firmware/Makefile.util @@ -0,0 +1 @@ +include $(ROOT_PATH)/../../firmware/Makefile.util diff --git a/simulat0r/firmware/applications/Makefile b/simulat0r/firmware/applications/Makefile new file mode 100644 index 0000000..adbca02 --- /dev/null +++ b/simulat0r/firmware/applications/Makefile @@ -0,0 +1,2 @@ +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/applications/Makefile diff --git a/simulat0r/firmware/applications/adc.c b/simulat0r/firmware/applications/adc.c new file mode 100644 index 0000000..65c9a12 --- /dev/null +++ b/simulat0r/firmware/applications/adc.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/adc.c" diff --git a/simulat0r/firmware/applications/bsx.c b/simulat0r/firmware/applications/bsx.c new file mode 100644 index 0000000..e1accac --- /dev/null +++ b/simulat0r/firmware/applications/bsx.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/bsx.c" diff --git a/simulat0r/firmware/applications/cbitset.h b/simulat0r/firmware/applications/cbitset.h new file mode 100644 index 0000000..913a87e --- /dev/null +++ b/simulat0r/firmware/applications/cbitset.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/cbitset.h" diff --git a/simulat0r/firmware/applications/cdc.c b/simulat0r/firmware/applications/cdc.c new file mode 100644 index 0000000..82f5543 --- /dev/null +++ b/simulat0r/firmware/applications/cdc.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/cdc.c" diff --git a/simulat0r/firmware/applications/default.c b/simulat0r/firmware/applications/default.c new file mode 100644 index 0000000..9c699bc --- /dev/null +++ b/simulat0r/firmware/applications/default.c @@ -0,0 +1,12 @@ +/* AUTOGENERATED SOURCE FILE */ +#define main_default _hideaway_main_default +#define lcdInitConfig _hide_lcdInitConfig +#include "../../../firmware/applications/default.c" +#undef lcdInitConfig +#undef main_default + +int lcdInitConfig() { +} + +void main_default() { +} diff --git a/simulat0r/firmware/applications/ecc.c b/simulat0r/firmware/applications/ecc.c new file mode 100644 index 0000000..9196867 --- /dev/null +++ b/simulat0r/firmware/applications/ecc.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/ecc.c" diff --git a/simulat0r/firmware/applications/exe.c b/simulat0r/firmware/applications/exe.c new file mode 100644 index 0000000..55419e7 --- /dev/null +++ b/simulat0r/firmware/applications/exe.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/exe.c" diff --git a/simulat0r/firmware/applications/executor.c b/simulat0r/firmware/applications/executor.c new file mode 100644 index 0000000..c1a0092 --- /dev/null +++ b/simulat0r/firmware/applications/executor.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/executor.c" diff --git a/simulat0r/firmware/applications/flame.c b/simulat0r/firmware/applications/flame.c new file mode 100644 index 0000000..2b63c47 --- /dev/null +++ b/simulat0r/firmware/applications/flame.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/flame.c" diff --git a/simulat0r/firmware/applications/font.c b/simulat0r/firmware/applications/font.c new file mode 100644 index 0000000..cca894f --- /dev/null +++ b/simulat0r/firmware/applications/font.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/font.c" diff --git a/simulat0r/firmware/applications/fs.c b/simulat0r/firmware/applications/fs.c new file mode 100644 index 0000000..93a5827 --- /dev/null +++ b/simulat0r/firmware/applications/fs.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/fs.c" diff --git a/simulat0r/firmware/applications/funk.c b/simulat0r/firmware/applications/funk.c new file mode 100644 index 0000000..75cbee3 --- /dev/null +++ b/simulat0r/firmware/applications/funk.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/funk.c" diff --git a/simulat0r/firmware/applications/iggy.c b/simulat0r/firmware/applications/iggy.c new file mode 100644 index 0000000..15f7694 --- /dev/null +++ b/simulat0r/firmware/applications/iggy.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/iggy.c" diff --git a/simulat0r/firmware/applications/life.c b/simulat0r/firmware/applications/life.c new file mode 100644 index 0000000..aeef110 --- /dev/null +++ b/simulat0r/firmware/applications/life.c @@ -0,0 +1 @@ +#include "../../../firmware/applications/life.c" diff --git a/simulat0r/firmware/applications/lilafisch.c b/simulat0r/firmware/applications/lilafisch.c new file mode 100644 index 0000000..796ba59 --- /dev/null +++ b/simulat0r/firmware/applications/lilafisch.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/lilafisch.c" diff --git a/simulat0r/firmware/applications/loadable.c b/simulat0r/firmware/applications/loadable.c new file mode 100644 index 0000000..1700a51 --- /dev/null +++ b/simulat0r/firmware/applications/loadable.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/loadable.c" diff --git a/simulat0r/firmware/applications/mandelbrot.c b/simulat0r/firmware/applications/mandelbrot.c new file mode 100644 index 0000000..9923b38 --- /dev/null +++ b/simulat0r/firmware/applications/mandelbrot.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/mandelbrot.c" diff --git a/simulat0r/firmware/applications/mandelbrot2.c b/simulat0r/firmware/applications/mandelbrot2.c new file mode 100644 index 0000000..2b68734 --- /dev/null +++ b/simulat0r/firmware/applications/mandelbrot2.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/mandelbrot2.c" diff --git a/simulat0r/firmware/applications/menutest.c b/simulat0r/firmware/applications/menutest.c new file mode 100644 index 0000000..1f8a850 --- /dev/null +++ b/simulat0r/firmware/applications/menutest.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/menutest.c" diff --git a/simulat0r/firmware/applications/minimal.c b/simulat0r/firmware/applications/minimal.c new file mode 100644 index 0000000..4fb22ea --- /dev/null +++ b/simulat0r/firmware/applications/minimal.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/minimal.c" diff --git a/simulat0r/firmware/applications/mkwrapper b/simulat0r/firmware/applications/mkwrapper new file mode 100755 index 0000000..adc805d --- /dev/null +++ b/simulat0r/firmware/applications/mkwrapper @@ -0,0 +1,2 @@ +#!/bin/sh +. ../../../firmware/applications/mkwrapper diff --git a/simulat0r/firmware/applications/rect.c b/simulat0r/firmware/applications/rect.c new file mode 100644 index 0000000..9d526bd --- /dev/null +++ b/simulat0r/firmware/applications/rect.c @@ -0,0 +1 @@ +#include "../../../firmware/applications/rect.c" diff --git a/simulat0r/firmware/applications/remote.c b/simulat0r/firmware/applications/remote.c new file mode 100644 index 0000000..eb451fe --- /dev/null +++ b/simulat0r/firmware/applications/remote.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/remote.c" diff --git a/simulat0r/firmware/applications/s.c b/simulat0r/firmware/applications/s.c new file mode 100644 index 0000000..c0fa7cf --- /dev/null +++ b/simulat0r/firmware/applications/s.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/s.c" diff --git a/simulat0r/firmware/applications/schneider.c b/simulat0r/firmware/applications/schneider.c new file mode 100644 index 0000000..10e93f0 --- /dev/null +++ b/simulat0r/firmware/applications/schneider.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/schneider.c" diff --git a/simulat0r/firmware/applications/scroll.c b/simulat0r/firmware/applications/scroll.c new file mode 100644 index 0000000..45234b9 --- /dev/null +++ b/simulat0r/firmware/applications/scroll.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/scroll.c" diff --git a/simulat0r/firmware/applications/sec.c b/simulat0r/firmware/applications/sec.c new file mode 100644 index 0000000..a7afb28 --- /dev/null +++ b/simulat0r/firmware/applications/sec.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/sec.c" diff --git a/simulat0r/firmware/applications/spaceinvaders.c b/simulat0r/firmware/applications/spaceinvaders.c new file mode 100644 index 0000000..ff36beb --- /dev/null +++ b/simulat0r/firmware/applications/spaceinvaders.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/spaceinvaders.c" diff --git a/simulat0r/firmware/applications/vcard.c b/simulat0r/firmware/applications/vcard.c new file mode 100644 index 0000000..c1e3972 --- /dev/null +++ b/simulat0r/firmware/applications/vcard.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/applications/vcard.c" diff --git a/simulat0r/firmware/applications/waldbrand.c b/simulat0r/firmware/applications/waldbrand.c new file mode 100644 index 0000000..91da7b6 --- /dev/null +++ b/simulat0r/firmware/applications/waldbrand.c @@ -0,0 +1 @@ +#include "../../../firmware/applications/waldbrand.c" diff --git a/simulat0r/firmware/basic/Makefile b/simulat0r/firmware/basic/Makefile new file mode 100644 index 0000000..64a786e --- /dev/null +++ b/simulat0r/firmware/basic/Makefile @@ -0,0 +1,2 @@ +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/basic/Makefile diff --git a/simulat0r/firmware/basic/basic.c b/simulat0r/firmware/basic/basic.c new file mode 100644 index 0000000..c04a2ff --- /dev/null +++ b/simulat0r/firmware/basic/basic.c @@ -0,0 +1,2 @@ +void rbInit() { +} diff --git a/simulat0r/firmware/basic/basic.h b/simulat0r/firmware/basic/basic.h new file mode 100644 index 0000000..c89232b --- /dev/null +++ b/simulat0r/firmware/basic/basic.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/basic/basic.h" diff --git a/simulat0r/firmware/basic/byteorder.c b/simulat0r/firmware/basic/byteorder.c new file mode 100644 index 0000000..86d53e5 --- /dev/null +++ b/simulat0r/firmware/basic/byteorder.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/basic/byteorder.c" diff --git a/simulat0r/firmware/basic/byteorder.h b/simulat0r/firmware/basic/byteorder.h new file mode 100644 index 0000000..753bd65 --- /dev/null +++ b/simulat0r/firmware/basic/byteorder.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/basic/byteorder.h" diff --git a/simulat0r/firmware/basic/crc.c b/simulat0r/firmware/basic/crc.c new file mode 100644 index 0000000..a441b12 --- /dev/null +++ b/simulat0r/firmware/basic/crc.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/basic/crc.c" diff --git a/simulat0r/firmware/basic/delayms.c b/simulat0r/firmware/basic/delayms.c new file mode 100644 index 0000000..a628242 --- /dev/null +++ b/simulat0r/firmware/basic/delayms.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/basic/delayms.c" diff --git a/simulat0r/firmware/basic/ecc.c b/simulat0r/firmware/basic/ecc.c new file mode 100644 index 0000000..d27fe0c --- /dev/null +++ b/simulat0r/firmware/basic/ecc.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/basic/ecc.c" diff --git a/simulat0r/firmware/basic/ecc.h b/simulat0r/firmware/basic/ecc.h new file mode 100644 index 0000000..f679817 --- /dev/null +++ b/simulat0r/firmware/basic/ecc.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/basic/ecc.h" diff --git a/simulat0r/firmware/basic/keyin.c b/simulat0r/firmware/basic/keyin.c new file mode 100644 index 0000000..9284cbf --- /dev/null +++ b/simulat0r/firmware/basic/keyin.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/basic/keyin.c" diff --git a/simulat0r/firmware/basic/menu.c b/simulat0r/firmware/basic/menu.c new file mode 100644 index 0000000..d1001d1 --- /dev/null +++ b/simulat0r/firmware/basic/menu.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/basic/menu.c" diff --git a/simulat0r/firmware/basic/reinvoke_isp.c b/simulat0r/firmware/basic/reinvoke_isp.c new file mode 100644 index 0000000..fb27202 --- /dev/null +++ b/simulat0r/firmware/basic/reinvoke_isp.c @@ -0,0 +1,12 @@ +#include + +void ReinvokeISP(void) { +} + +void EnableWatchdog(uint32_t ms) { +} + +void ISPandReset(int delay){ + EnableWatchdog(1000*delay); + ReinvokeISP(); +}; diff --git a/simulat0r/firmware/basic/uuid.c b/simulat0r/firmware/basic/uuid.c new file mode 100644 index 0000000..e54b164 --- /dev/null +++ b/simulat0r/firmware/basic/uuid.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/basic/uuid.c" diff --git a/simulat0r/firmware/basic/voltage.c b/simulat0r/firmware/basic/voltage.c new file mode 100644 index 0000000..a56ae54 --- /dev/null +++ b/simulat0r/firmware/basic/voltage.c @@ -0,0 +1,12 @@ +#include + +#include "basic/basic.h" + +uint32_t results=5000; + +void VoltageCheck(void){ +}; + +uint32_t GetVoltage(void){ + return results; +}; diff --git a/simulat0r/firmware/basic/xxtea.c b/simulat0r/firmware/basic/xxtea.c new file mode 100644 index 0000000..c315d35 --- /dev/null +++ b/simulat0r/firmware/basic/xxtea.c @@ -0,0 +1,4 @@ +/* use SAFE version instead of ARM asm */ +#define SAFE + +#include "../../../firmware/basic/xxtea.c" diff --git a/simulat0r/firmware/basic/xxtea.h b/simulat0r/firmware/basic/xxtea.h new file mode 100644 index 0000000..336bcda --- /dev/null +++ b/simulat0r/firmware/basic/xxtea.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/basic/xxtea.h" diff --git a/simulat0r/firmware/core/Makefile b/simulat0r/firmware/core/Makefile new file mode 100644 index 0000000..f85ccd8 --- /dev/null +++ b/simulat0r/firmware/core/Makefile @@ -0,0 +1,2 @@ +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/core/Makefile diff --git a/simulat0r/firmware/core/adc/adc.c b/simulat0r/firmware/core/adc/adc.c new file mode 100644 index 0000000..688d777 --- /dev/null +++ b/simulat0r/firmware/core/adc/adc.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/adc/adc.c" diff --git a/simulat0r/firmware/core/adc/adc.h b/simulat0r/firmware/core/adc/adc.h new file mode 100644 index 0000000..652dde3 --- /dev/null +++ b/simulat0r/firmware/core/adc/adc.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/adc/adc.h" diff --git a/simulat0r/firmware/core/cmd/cmd.c b/simulat0r/firmware/core/cmd/cmd.c new file mode 100644 index 0000000..10e1a8f --- /dev/null +++ b/simulat0r/firmware/core/cmd/cmd.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/cmd/cmd.c" diff --git a/simulat0r/firmware/core/cmd/cmd.h b/simulat0r/firmware/core/cmd/cmd.h new file mode 100644 index 0000000..ea4bb74 --- /dev/null +++ b/simulat0r/firmware/core/cmd/cmd.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/cmd/cmd.h" diff --git a/simulat0r/firmware/core/cpu/cpu.c b/simulat0r/firmware/core/cpu/cpu.c new file mode 100644 index 0000000..e75e97a --- /dev/null +++ b/simulat0r/firmware/core/cpu/cpu.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/cpu/cpu.c" diff --git a/simulat0r/firmware/core/cpu/cpu.h b/simulat0r/firmware/core/cpu/cpu.h new file mode 100644 index 0000000..39a503b --- /dev/null +++ b/simulat0r/firmware/core/cpu/cpu.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/cpu/cpu.h" diff --git a/simulat0r/firmware/core/gpio/gpio.c b/simulat0r/firmware/core/gpio/gpio.c new file mode 100644 index 0000000..2c8d214 --- /dev/null +++ b/simulat0r/firmware/core/gpio/gpio.c @@ -0,0 +1,65 @@ +#include +#include "basic/basic.h" +#include "../simcore/simulator.h" + +static bool compair(uint32_t a1, uint32_t a2, uint32_t b1, uint32_t b2) { + return a1==b1 && a2==b2; +} + +void gpioInit (void) { + printf("void gpioInit (void)\n"); +} + +void gpioSetDir (uint32_t portNum, uint32_t bitPos, gpioDirection_t dir) { + printf("void gpioSetDir (portNum %d, bitPos %d, dir %x)\n",portNum,bitPos,dir); +} + +uint32_t gpioGetValue (uint32_t portNum, uint32_t bitPos) { + if(compair(portNum, bitPos, RB_BTN3)) return simButtonPressed(BTN_UP); + if(compair(portNum, bitPos, RB_BTN2)) return simButtonPressed(BTN_DOWN); + if(compair(portNum, bitPos, RB_BTN4)) return simButtonPressed(BTN_ENTER); + if(compair(portNum, bitPos, RB_BTN0)) return simButtonPressed(BTN_LEFT); + if(compair(portNum, bitPos, RB_BTN1)) return simButtonPressed(BTN_RIGHT); + + if(compair(portNum, bitPos, RB_LED0)) return simGetLED(0); + if(compair(portNum, bitPos, RB_LED1)) return simGetLED(1); + if(compair(portNum, bitPos, RB_LED2)) return simGetLED(2); + if(compair(portNum, bitPos, RB_LED3)) return simGetLED(3); + + fprintf(stderr,"Unimplemented gpioGetValue portNum %d %x bit %d\n",portNum, portNum, bitPos); + return 0; +} + +void gpioSetValue (uint32_t portNum, uint32_t bitPos, uint32_t bitVal) { + if(compair(portNum, bitPos, RB_LED0)) return simSetLED(0,bitVal); + if(compair(portNum, bitPos, RB_LED1)) return simSetLED(1,bitVal); + if(compair(portNum, bitPos, RB_LED2)) return simSetLED(2,bitVal); + if(compair(portNum, bitPos, RB_LED3)) return simSetLED(3,bitVal); + + fprintf(stderr,"Unimplemented gpioSetValue portNum %d %x bit %d\n",portNum, portNum, bitPos); +} + +void gpioSetInterrupt (uint32_t portNum, uint32_t bitPos, gpioInterruptSense_t sense, gpioInterruptEdge_t edge, gpioInterruptEvent_t event) { + printf("void gpioSetInterrupt (uint32_t portNum, uint32_t bitPos, gpioInterruptSense_t sense, gpioInterruptEdge_t edge, gpioInterruptEvent_t event)\n"); +} + +void gpioIntEnable (uint32_t portNum, uint32_t bitPos) { + printf("void gpioIntEnable (uint32_t portNum, uint32_t bitPos)\n"); +} + +void gpioIntDisable (uint32_t portNum, uint32_t bitPos) { + printf("void gpioIntDisable (uint32_t portNum, uint32_t bitPos)\n"); +} + +uint32_t gpioIntStatus (uint32_t portNum, uint32_t bitPos) { + printf("uint32_t gpioIntStatus (uint32_t portNum, uint32_t bitPos)\n"); +} + +void gpioIntClear (uint32_t portNum, uint32_t bitPos) { + printf("void gpioIntClear (uint32_t portNum, uint32_t bitPos)\n"); +} + +void gpioSetPullup (volatile uint32_t *ioconRegister, gpioPullupMode_t mode) { + printf("void gpioSetPullup (volatile uint32_t *ioconRegister, gpioPullupMode_t mode)\n"); +} + diff --git a/simulat0r/firmware/core/gpio/gpio.h b/simulat0r/firmware/core/gpio/gpio.h new file mode 100644 index 0000000..39fb0c4 --- /dev/null +++ b/simulat0r/firmware/core/gpio/gpio.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/gpio/gpio.h" diff --git a/simulat0r/firmware/core/i2c/i2c.c b/simulat0r/firmware/core/i2c/i2c.c new file mode 100644 index 0000000..cca2ebc --- /dev/null +++ b/simulat0r/firmware/core/i2c/i2c.c @@ -0,0 +1,34 @@ + +// dummy implementation instead of #include "../../../../firmware/core/i2c/i2c.c" + + +#include "i2c.h" + +volatile uint32_t I2CMasterState = I2CSTATE_IDLE; +volatile uint32_t I2CSlaveState = I2CSTATE_IDLE; + +volatile uint8_t I2CMasterBuffer[I2C_BUFSIZE]; +volatile uint8_t I2CSlaveBuffer[I2C_BUFSIZE]; +volatile uint32_t I2CReadLength; +volatile uint32_t I2CWriteLength; + +volatile uint32_t RdIndex = 0; +volatile uint32_t WrIndex = 0; + + +void I2C_IRQHandler(void) { +} + +uint32_t i2cInit( uint32_t I2cMode ) { + return( TRUE ); +} + +uint32_t i2cEngine( void ) { + return I2CSTATE_IDLE; +} + +/****************************************************************************** +** End Of File +******************************************************************************/ + + diff --git a/simulat0r/firmware/core/i2c/i2c.h b/simulat0r/firmware/core/i2c/i2c.h new file mode 100644 index 0000000..5e51ba2 --- /dev/null +++ b/simulat0r/firmware/core/i2c/i2c.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/i2c/i2c.h" diff --git a/simulat0r/firmware/core/iap/iap.c b/simulat0r/firmware/core/iap/iap.c new file mode 100644 index 0000000..971a9bc --- /dev/null +++ b/simulat0r/firmware/core/iap/iap.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/iap/iap.c" diff --git a/simulat0r/firmware/core/iap/iap.h b/simulat0r/firmware/core/iap/iap.h new file mode 100644 index 0000000..05db4ad --- /dev/null +++ b/simulat0r/firmware/core/iap/iap.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/iap/iap.h" diff --git a/simulat0r/firmware/core/libc/ctype.c b/simulat0r/firmware/core/libc/ctype.c new file mode 100644 index 0000000..c29e933 --- /dev/null +++ b/simulat0r/firmware/core/libc/ctype.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/libc/ctype.c" diff --git a/simulat0r/firmware/core/libc/stdio.c b/simulat0r/firmware/core/libc/stdio.c new file mode 100644 index 0000000..bb0123b --- /dev/null +++ b/simulat0r/firmware/core/libc/stdio.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/libc/stdio.c" diff --git a/simulat0r/firmware/core/libc/string.c b/simulat0r/firmware/core/libc/string.c new file mode 100644 index 0000000..19df49e --- /dev/null +++ b/simulat0r/firmware/core/libc/string.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/libc/string.c" diff --git a/simulat0r/firmware/core/lpc134x.h b/simulat0r/firmware/core/lpc134x.h new file mode 100644 index 0000000..af0ada7 --- /dev/null +++ b/simulat0r/firmware/core/lpc134x.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/core/lpc134x.h" diff --git a/simulat0r/firmware/core/pmu/pmu.c b/simulat0r/firmware/core/pmu/pmu.c new file mode 100644 index 0000000..ec44b41 --- /dev/null +++ b/simulat0r/firmware/core/pmu/pmu.c @@ -0,0 +1,2 @@ +#define volatile(x) volatile("nop") +#include "../../../../firmware/core/pmu/pmu.c" diff --git a/simulat0r/firmware/core/pmu/pmu.h b/simulat0r/firmware/core/pmu/pmu.h new file mode 100644 index 0000000..1ebe126 --- /dev/null +++ b/simulat0r/firmware/core/pmu/pmu.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/pmu/pmu.h" diff --git a/simulat0r/firmware/core/projectconfig.h b/simulat0r/firmware/core/projectconfig.h new file mode 100644 index 0000000..8b1724c --- /dev/null +++ b/simulat0r/firmware/core/projectconfig.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/core/projectconfig.h" diff --git a/simulat0r/firmware/core/pwm/pwm.c b/simulat0r/firmware/core/pwm/pwm.c new file mode 100644 index 0000000..6c48899 --- /dev/null +++ b/simulat0r/firmware/core/pwm/pwm.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/pwm/pwm.c" diff --git a/simulat0r/firmware/core/pwm/pwm.h b/simulat0r/firmware/core/pwm/pwm.h new file mode 100644 index 0000000..195d7a7 --- /dev/null +++ b/simulat0r/firmware/core/pwm/pwm.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/pwm/pwm.h" diff --git a/simulat0r/firmware/core/rom_drivers.h b/simulat0r/firmware/core/rom_drivers.h new file mode 100644 index 0000000..99c8086 --- /dev/null +++ b/simulat0r/firmware/core/rom_drivers.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/core/rom_drivers.h" diff --git a/simulat0r/firmware/core/ssp/ssp.c b/simulat0r/firmware/core/ssp/ssp.c new file mode 100644 index 0000000..cd5018a --- /dev/null +++ b/simulat0r/firmware/core/ssp/ssp.c @@ -0,0 +1,23 @@ +#define sspInit _hideaway_sspInit +#define sspSend _hideaway_sspSend +#define sspReceive _hideaway_sspReceive +#define sspSendReceive _hideaway_sspSendReceive + +#include "../../../../firmware/core/ssp/ssp.c" + +#undef sspInit +#undef sspSend +#undef sspReceive +#undef sspSendReceive + +void sspInit (uint8_t portNum, sspClockPolarity_t polarity, sspClockPhase_t phase) { +} + +void sspSend (uint8_t portNum, const uint8_t *buf, uint32_t length) { +} + +void sspReceive (uint8_t portNum, uint8_t *buf, uint32_t length) { +} + +void sspSendReceive(uint8_t portNum, uint8_t *buf, uint32_t length) { +} diff --git a/simulat0r/firmware/core/ssp/ssp.h b/simulat0r/firmware/core/ssp/ssp.h new file mode 100644 index 0000000..65a74e0 --- /dev/null +++ b/simulat0r/firmware/core/ssp/ssp.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/ssp/ssp.h" diff --git a/simulat0r/firmware/core/sysdefs.h b/simulat0r/firmware/core/sysdefs.h new file mode 100644 index 0000000..5d5db18 --- /dev/null +++ b/simulat0r/firmware/core/sysdefs.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/core/sysdefs.h" diff --git a/simulat0r/firmware/core/sysinit.c b/simulat0r/firmware/core/sysinit.c new file mode 100644 index 0000000..470d282 --- /dev/null +++ b/simulat0r/firmware/core/sysinit.c @@ -0,0 +1,83 @@ +#include +#include +#include +#include +#include +#include + +//#define handle_error(msg) do { perror(msg); exit(EXIT_FAILURE); } while (0) +#define handle_error(msg) do { perror(msg); exit(EXIT_FAILURE); } while (0) + +#include "core/lpc134x.h" + +void testByte(void* addr) { + fprintf(stderr,"Testing address %x : read ",addr); + fprintf(stderr,"%x, write ",(int)(*((char*)addr))); + ++(*((char*)addr)); + fprintf(stderr,"%x",(int)(*((char*)addr))); + --(*((char*)addr)); + fprintf(stderr," OK\n"); +} + +void testMemoryHack(void* addr,long size) { + fprintf(stderr,"Testing memory range %x - %x\n",addr,addr+size); + for(void* p=addr; p= sb.st_size) { + fprintf(stderr, "offset is past end of file\n"); + exit(EXIT_FAILURE); + } + + length = size; + + addr = mmap(address, length + offset - pa_offset, PROT_READ | PROT_WRITE, + MAP_PRIVATE, fd, pa_offset); + if (addr == MAP_FAILED) + handle_error("mmap"); + if(addr!=address) { + fprintf(stderr, "mmap: wanted %x, got %x: ",address,addr); + handle_error("mmap address discrepancy"); + } + // testMemoryHack(address,size); + fprintf(stderr,"Range %x tested\n",addr); +} + + +void systemInit() +{ + // setupMemoryHack((void*)0x40000000,0x1000000); + // setupMemoryHack((void*)0x50000000,10*1024*1024); + // setupMemoryHack((void*)0x10000000,10*1024*1024); + // systick stuff unmappable setupMemoryHack((void*)0xe0000000,0x10000); + +#if 0 + printf("Test %d\n",SSP_SSP0CR0); + printf("Test2 %d\n",++SSP_SSP0CR0); + printf("Test3 pre %x\n",&SYSTICK_STRELOAD); + // printf("Test3 %d\n",++SYSTICK_STRELOAD); +#endif +} diff --git a/simulat0r/firmware/core/sysinit.h b/simulat0r/firmware/core/sysinit.h new file mode 100644 index 0000000..043ddd9 --- /dev/null +++ b/simulat0r/firmware/core/sysinit.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/core/sysinit.h" diff --git a/simulat0r/firmware/core/systick/systick.c b/simulat0r/firmware/core/systick/systick.c new file mode 100644 index 0000000..3d5bff6 --- /dev/null +++ b/simulat0r/firmware/core/systick/systick.c @@ -0,0 +1,231 @@ +#warning "cleanupthisfile" +#if 0 +#include "../../firmware/core/systick/systick.c" +#else + +/**************************************************************************/ +/*! + @file systick.c + @author K. Townsend (microBuilder.eu) + @date 22 March 2010 + @version 0.10 + + @section DESCRIPTION + + Controls the 24-bit 'system tick' clock, which can be used as a + generic timer or to control time sharing with an embedded real-time + operating system (such as FreeRTOS). + + @section Example + + @code + #include "core/cpu/cpu.h" + #include "core/systick/systick.h" + + void main (void) + { + cpuInit(); + + // Start systick timer with one tick every 10ms + systickInit(10); + + while(1) + { + } + } + @endcode + + @section LICENSE + + Software License Agreement (BSD License) + + Copyright (c) 2010, microBuilder SARL + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holders nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +/**************************************************************************/ + +#include "systick.h" + +volatile uint32_t systickTicks = 0; // 1ms tick counter +volatile uint32_t systickRollovers = 0; + +void tick_wrapper(void); + +/**************************************************************************/ +/*! + @brief Systick interrupt handler +*/ +/**************************************************************************/ +void SysTick_Handler (void) +{ + systickTicks++; + + // Increment rollover counter + if (systickTicks == 0xFFFFFFFF) systickRollovers++; + + tick_wrapper(); +} + +/**************************************************************************/ +/*! + @brief Configures the systick timer + + @param[in] ticks + The number of clock cycles between each tick of the + systick timer. for example, 'CFG_CPU_CCLK / 1000' = + 1 millisecond. This value must not exceed 0x00FFFFFF. +*/ +/**************************************************************************/ +static uint32_t systickConfig(uint32_t ticks) +{ + fprintf(stderr,"systickConfig: unimplemented\n"); + return 0; + + // Check if 'ticks' is greater than maximum value + if (ticks > SYSTICK_STRELOAD_MASK) + { + return (1); + } + + // Reset counter + systickTicks = 0; + + // Set reload register + SYSTICK_STRELOAD = (ticks & SYSTICK_STRELOAD_MASK) - 1; + + // Load the systick counter value + SYSTICK_STCURR = 0; + + // Enable systick IRQ and timer + SYSTICK_STCTRL = SYSTICK_STCTRL_CLKSOURCE | + SYSTICK_STCTRL_TICKINT | + SYSTICK_STCTRL_ENABLE; + + return (0); +} + +/**************************************************************************/ +/*! + @brief Initialises the systick timer + + @param[in] delayMs + The number of milliseconds between each tick of the systick + timer. + + @note The shortest possible delay is 1 millisecond, which will + allow fine grained delays, but will cause more load on the + system than a 10mS delay. The resolution of the systick + timer needs to be balanced with the amount of processing + time you can spare. The delay should really only be set + to 1 mS if you genuinely have a need for 1mS delays, + otherwise a higher value like 5 or 10 mS is probably + more appropriate. +*/ +/**************************************************************************/ +void systickInit (uint32_t delayMs) +{ + systickConfig ((CFG_CPU_CCLK / 1000) * delayMs); +} + +/**************************************************************************/ +/*! + @brief Causes a blocking delay for 'delayTicks' ticks on the + systick timer. For example: systickDelay(100) would cause + a blocking delay for 100 ticks of the systick timer. + + @param[in] delayTicks + The number of systick ticks to cause a blocking delay for + + @Note This function takes into account the fact that the tick + counter may eventually roll over to 0 once it reaches + 0xFFFFFFFF. +*/ +/**************************************************************************/ +void systickDelay (uint32_t delayTicks) +{ + uint32_t curTicks; + curTicks = systickTicks; + + // Make sure delay is at least 1 tick in case of division, etc. + if (delayTicks == 0) delayTicks = 1; + + if (curTicks > 0xFFFFFFFF - delayTicks) + { + // Rollover will occur during delay + while (systickTicks >= curTicks) + { + while (systickTicks < (delayTicks - (0xFFFFFFFF - curTicks))); + } + } + else + { + while ((systickTicks - curTicks) < delayTicks); + } +} + +/**************************************************************************/ +/*! + @brief Returns the current value of the systick timer counter. + This value is incremented by one every time an interrupt + fires for the systick timer. +*/ +/**************************************************************************/ +uint32_t systickGetTicks(void) +{ + return systickTicks; +} + +/**************************************************************************/ +/*! + @brief Returns the current value of the systick timer rollover + counter. This value is incremented by one every time the + tick counter rolls over from 0xFFFFFFFF to 0. +*/ +/**************************************************************************/ +uint32_t systickGetRollovers(void) +{ + return systickRollovers; +} + +/**************************************************************************/ +/*! + @brief Returns the approximate number of seconds that the + systick timer has been running. +*/ +/**************************************************************************/ +uint32_t systickGetSecondsActive(void) +{ + uint32_t currentTick = systickTicks; + uint32_t rollovers = systickRollovers; + uint32_t secsActive = currentTick / (1000 / CFG_SYSTICK_DELAY_IN_MS); + secsActive += rollovers * (0xFFFFFFFF / (1000 / CFG_SYSTICK_DELAY_IN_MS)); + + return secsActive; +} + + + +#endif + diff --git a/simulat0r/firmware/core/systick/systick.h b/simulat0r/firmware/core/systick/systick.h new file mode 100644 index 0000000..6f34ff9 --- /dev/null +++ b/simulat0r/firmware/core/systick/systick.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/systick/systick.h" diff --git a/simulat0r/firmware/core/timer16/timer16.c b/simulat0r/firmware/core/timer16/timer16.c new file mode 100644 index 0000000..0474a85 --- /dev/null +++ b/simulat0r/firmware/core/timer16/timer16.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/timer16/timer16.c" diff --git a/simulat0r/firmware/core/timer16/timer16.h b/simulat0r/firmware/core/timer16/timer16.h new file mode 100644 index 0000000..81bacb8 --- /dev/null +++ b/simulat0r/firmware/core/timer16/timer16.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/timer16/timer16.h" diff --git a/simulat0r/firmware/core/timer32/timer32.c b/simulat0r/firmware/core/timer32/timer32.c new file mode 100644 index 0000000..e16113e --- /dev/null +++ b/simulat0r/firmware/core/timer32/timer32.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/timer32/timer32.c" diff --git a/simulat0r/firmware/core/timer32/timer32.h b/simulat0r/firmware/core/timer32/timer32.h new file mode 100644 index 0000000..0b80aeb --- /dev/null +++ b/simulat0r/firmware/core/timer32/timer32.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/timer32/timer32.h" diff --git a/simulat0r/firmware/core/uart/uart.c b/simulat0r/firmware/core/uart/uart.c new file mode 100644 index 0000000..117d445 --- /dev/null +++ b/simulat0r/firmware/core/uart/uart.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/uart/uart.c" diff --git a/simulat0r/firmware/core/uart/uart.h b/simulat0r/firmware/core/uart/uart.h new file mode 100644 index 0000000..152ac0c --- /dev/null +++ b/simulat0r/firmware/core/uart/uart.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/uart/uart.h" diff --git a/simulat0r/firmware/core/uart/uart_buf.c b/simulat0r/firmware/core/uart/uart_buf.c new file mode 100644 index 0000000..f7baf07 --- /dev/null +++ b/simulat0r/firmware/core/uart/uart_buf.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/uart/uart_buf.c" diff --git a/simulat0r/firmware/core/usbcdc/cdc.h b/simulat0r/firmware/core/usbcdc/cdc.h new file mode 100644 index 0000000..e3ba7da --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/cdc.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/cdc.h" diff --git a/simulat0r/firmware/core/usbcdc/cdc_buf.c b/simulat0r/firmware/core/usbcdc/cdc_buf.c new file mode 100644 index 0000000..d462ebc --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/cdc_buf.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/cdc_buf.c" diff --git a/simulat0r/firmware/core/usbcdc/cdc_buf.h b/simulat0r/firmware/core/usbcdc/cdc_buf.h new file mode 100644 index 0000000..21ee87f --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/cdc_buf.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/cdc_buf.h" diff --git a/simulat0r/firmware/core/usbcdc/cdcuser.c b/simulat0r/firmware/core/usbcdc/cdcuser.c new file mode 100644 index 0000000..5c05857 --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/cdcuser.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/cdcuser.c" diff --git a/simulat0r/firmware/core/usbcdc/cdcuser.h b/simulat0r/firmware/core/usbcdc/cdcuser.h new file mode 100644 index 0000000..17608b2 --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/cdcuser.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/cdcuser.h" diff --git a/simulat0r/firmware/core/usbcdc/config.h b/simulat0r/firmware/core/usbcdc/config.h new file mode 100644 index 0000000..ee283d7 --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/config.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/config.h" diff --git a/simulat0r/firmware/core/usbcdc/usb.h b/simulat0r/firmware/core/usbcdc/usb.h new file mode 100644 index 0000000..71cda7a --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/usb.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/usb.h" diff --git a/simulat0r/firmware/core/usbcdc/usbcfg.h b/simulat0r/firmware/core/usbcdc/usbcfg.h new file mode 100644 index 0000000..cc8ee03 --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/usbcfg.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/usbcfg.h" diff --git a/simulat0r/firmware/core/usbcdc/usbcore.c b/simulat0r/firmware/core/usbcdc/usbcore.c new file mode 100644 index 0000000..9ed0796 --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/usbcore.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/usbcore.c" diff --git a/simulat0r/firmware/core/usbcdc/usbcore.h b/simulat0r/firmware/core/usbcdc/usbcore.h new file mode 100644 index 0000000..dc0494e --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/usbcore.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/usbcore.h" diff --git a/simulat0r/firmware/core/usbcdc/usbdesc.c b/simulat0r/firmware/core/usbcdc/usbdesc.c new file mode 100644 index 0000000..7b3a224 --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/usbdesc.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/usbdesc.c" diff --git a/simulat0r/firmware/core/usbcdc/usbdesc.h b/simulat0r/firmware/core/usbcdc/usbdesc.h new file mode 100644 index 0000000..2142f32 --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/usbdesc.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/usbdesc.h" diff --git a/simulat0r/firmware/core/usbcdc/usbhw.c b/simulat0r/firmware/core/usbcdc/usbhw.c new file mode 100644 index 0000000..c21603c --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/usbhw.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/usbhw.c" diff --git a/simulat0r/firmware/core/usbcdc/usbhw.h b/simulat0r/firmware/core/usbcdc/usbhw.h new file mode 100644 index 0000000..8914a79 --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/usbhw.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/usbhw.h" diff --git a/simulat0r/firmware/core/usbcdc/usbreg.h b/simulat0r/firmware/core/usbcdc/usbreg.h new file mode 100644 index 0000000..74b13d8 --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/usbreg.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/usbreg.h" diff --git a/simulat0r/firmware/core/usbcdc/usbuser.c b/simulat0r/firmware/core/usbcdc/usbuser.c new file mode 100644 index 0000000..4594cdb --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/usbuser.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/usbuser.c" diff --git a/simulat0r/firmware/core/usbcdc/usbuser.h b/simulat0r/firmware/core/usbcdc/usbuser.h new file mode 100644 index 0000000..21de413 --- /dev/null +++ b/simulat0r/firmware/core/usbcdc/usbuser.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/usbcdc/usbuser.h" diff --git a/simulat0r/firmware/core/wdt/wdt.c b/simulat0r/firmware/core/wdt/wdt.c new file mode 100644 index 0000000..866ab3c --- /dev/null +++ b/simulat0r/firmware/core/wdt/wdt.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/wdt/wdt.c" diff --git a/simulat0r/firmware/core/wdt/wdt.h b/simulat0r/firmware/core/wdt/wdt.h new file mode 100644 index 0000000..d9ac35e --- /dev/null +++ b/simulat0r/firmware/core/wdt/wdt.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/core/wdt/wdt.h" diff --git a/simulat0r/firmware/filesystem/Makefile b/simulat0r/firmware/filesystem/Makefile new file mode 100644 index 0000000..b6fed1f --- /dev/null +++ b/simulat0r/firmware/filesystem/Makefile @@ -0,0 +1,2 @@ +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/filesystem/Makefile diff --git a/simulat0r/firmware/filesystem/at45db041d.c b/simulat0r/firmware/filesystem/at45db041d.c new file mode 100644 index 0000000..4283942 --- /dev/null +++ b/simulat0r/firmware/filesystem/at45db041d.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/filesystem/at45db041d.c" diff --git a/simulat0r/firmware/filesystem/at45db041d.h b/simulat0r/firmware/filesystem/at45db041d.h new file mode 100644 index 0000000..ca44d1d --- /dev/null +++ b/simulat0r/firmware/filesystem/at45db041d.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/filesystem/at45db041d.h" diff --git a/simulat0r/firmware/filesystem/diskio.c b/simulat0r/firmware/filesystem/diskio.c new file mode 100644 index 0000000..31974b0 --- /dev/null +++ b/simulat0r/firmware/filesystem/diskio.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/filesystem/diskio.c" diff --git a/simulat0r/firmware/filesystem/diskio.h b/simulat0r/firmware/filesystem/diskio.h new file mode 100644 index 0000000..c312d4e --- /dev/null +++ b/simulat0r/firmware/filesystem/diskio.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/filesystem/diskio.h" diff --git a/simulat0r/firmware/filesystem/execute.c b/simulat0r/firmware/filesystem/execute.c new file mode 100644 index 0000000..c220e76 --- /dev/null +++ b/simulat0r/firmware/filesystem/execute.c @@ -0,0 +1,12 @@ +/* AUTOGENERATED SOURCE FILE */ + +#include +#include + +void execute_file (const char * fname, uint8_t checksignature, uint8_t decode){ + fprintf(stderr,"execute_file: unimplemented\n"); +} + +void executeSelect(char *ext){ + fprintf(stderr,"executeSelect: unimplemented\n"); +} diff --git a/simulat0r/firmware/filesystem/execute.h b/simulat0r/firmware/filesystem/execute.h new file mode 100644 index 0000000..5c6af99 --- /dev/null +++ b/simulat0r/firmware/filesystem/execute.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/filesystem/execute.h" diff --git a/simulat0r/firmware/filesystem/ff.c b/simulat0r/firmware/filesystem/ff.c new file mode 100644 index 0000000..29a0fc8 --- /dev/null +++ b/simulat0r/firmware/filesystem/ff.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/filesystem/ff.c" diff --git a/simulat0r/firmware/filesystem/ff.h b/simulat0r/firmware/filesystem/ff.h new file mode 100644 index 0000000..8291592 --- /dev/null +++ b/simulat0r/firmware/filesystem/ff.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/filesystem/ff.h" diff --git a/simulat0r/firmware/filesystem/ffconf.h b/simulat0r/firmware/filesystem/ffconf.h new file mode 100644 index 0000000..0caa938 --- /dev/null +++ b/simulat0r/firmware/filesystem/ffconf.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/filesystem/ffconf.h" diff --git a/simulat0r/firmware/filesystem/integer.h b/simulat0r/firmware/filesystem/integer.h new file mode 100644 index 0000000..23c0673 --- /dev/null +++ b/simulat0r/firmware/filesystem/integer.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/filesystem/integer.h" diff --git a/simulat0r/firmware/filesystem/iobase.c b/simulat0r/firmware/filesystem/iobase.c new file mode 100644 index 0000000..cebf5ea --- /dev/null +++ b/simulat0r/firmware/filesystem/iobase.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/filesystem/iobase.c" diff --git a/simulat0r/firmware/filesystem/iobase.h b/simulat0r/firmware/filesystem/iobase.h new file mode 100644 index 0000000..6c0433d --- /dev/null +++ b/simulat0r/firmware/filesystem/iobase.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/filesystem/iobase.h" diff --git a/simulat0r/firmware/filesystem/mmc.c b/simulat0r/firmware/filesystem/mmc.c new file mode 100644 index 0000000..fdde8e8 --- /dev/null +++ b/simulat0r/firmware/filesystem/mmc.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/filesystem/mmc.c" diff --git a/simulat0r/firmware/filesystem/mmc.h b/simulat0r/firmware/filesystem/mmc.h new file mode 100644 index 0000000..0fd458c --- /dev/null +++ b/simulat0r/firmware/filesystem/mmc.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/filesystem/mmc.h" diff --git a/simulat0r/firmware/filesystem/select.c b/simulat0r/firmware/filesystem/select.c new file mode 100644 index 0000000..6c54b5c --- /dev/null +++ b/simulat0r/firmware/filesystem/select.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/filesystem/select.c" diff --git a/simulat0r/firmware/filesystem/select.h b/simulat0r/firmware/filesystem/select.h new file mode 100644 index 0000000..c7b5e5c --- /dev/null +++ b/simulat0r/firmware/filesystem/select.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/filesystem/select.h" diff --git a/simulat0r/firmware/filesystem/util.c b/simulat0r/firmware/filesystem/util.c new file mode 100644 index 0000000..e5f2d9e --- /dev/null +++ b/simulat0r/firmware/filesystem/util.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/filesystem/util.c" diff --git a/simulat0r/firmware/funk/Makefile b/simulat0r/firmware/funk/Makefile new file mode 100644 index 0000000..e5dba98 --- /dev/null +++ b/simulat0r/firmware/funk/Makefile @@ -0,0 +1,2 @@ +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/funk/Makefile diff --git a/simulat0r/firmware/funk/filetransfer.c b/simulat0r/firmware/funk/filetransfer.c new file mode 100644 index 0000000..9e6d5c2 --- /dev/null +++ b/simulat0r/firmware/funk/filetransfer.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/funk/filetransfer.c" diff --git a/simulat0r/firmware/funk/filetransfer.h b/simulat0r/firmware/funk/filetransfer.h new file mode 100644 index 0000000..865e88b --- /dev/null +++ b/simulat0r/firmware/funk/filetransfer.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/funk/filetransfer.h" diff --git a/simulat0r/firmware/funk/nrf24l01p.c b/simulat0r/firmware/funk/nrf24l01p.c new file mode 100644 index 0000000..e8c5db4 --- /dev/null +++ b/simulat0r/firmware/funk/nrf24l01p.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/funk/nrf24l01p.c" diff --git a/simulat0r/firmware/funk/nrf24l01p.h b/simulat0r/firmware/funk/nrf24l01p.h new file mode 100644 index 0000000..06491f4 --- /dev/null +++ b/simulat0r/firmware/funk/nrf24l01p.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/funk/nrf24l01p.h" diff --git a/simulat0r/firmware/funk/openbeacon.c b/simulat0r/firmware/funk/openbeacon.c new file mode 100644 index 0000000..0c11675 --- /dev/null +++ b/simulat0r/firmware/funk/openbeacon.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/funk/openbeacon.c" diff --git a/simulat0r/firmware/funk/openbeacon.h b/simulat0r/firmware/funk/openbeacon.h new file mode 100644 index 0000000..b5ceaab --- /dev/null +++ b/simulat0r/firmware/funk/openbeacon.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/funk/openbeacon.h" diff --git a/simulat0r/firmware/funk/rftransfer.c b/simulat0r/firmware/funk/rftransfer.c new file mode 100644 index 0000000..f284b1d --- /dev/null +++ b/simulat0r/firmware/funk/rftransfer.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/funk/rftransfer.c" diff --git a/simulat0r/firmware/funk/rftransfer.h b/simulat0r/firmware/funk/rftransfer.h new file mode 100644 index 0000000..06483f9 --- /dev/null +++ b/simulat0r/firmware/funk/rftransfer.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/funk/rftransfer.h" diff --git a/simulat0r/firmware/lcd/Makefile b/simulat0r/firmware/lcd/Makefile new file mode 100644 index 0000000..d17981e --- /dev/null +++ b/simulat0r/firmware/lcd/Makefile @@ -0,0 +1,2 @@ +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/lcd/Makefile diff --git a/simulat0r/firmware/lcd/backlight.c b/simulat0r/firmware/lcd/backlight.c new file mode 100644 index 0000000..837d0de --- /dev/null +++ b/simulat0r/firmware/lcd/backlight.c @@ -0,0 +1,20 @@ +#include "basic/basic.h" + +uint32_t brightness = 100; + +void backlightInit(void) { +} + +int backlightSetBrightness(uint32_t percentage) { + if ((percentage < 0) || (percentage > 100)) { + /* brightness must be a value between 1 and 100 */ + return -1; + } + + brightness = percentage; + return 0; +} + +uint32_t backlightGetBrightness(void) { + return brightness; +} diff --git a/simulat0r/firmware/lcd/backlight.h b/simulat0r/firmware/lcd/backlight.h new file mode 100644 index 0000000..7474421 --- /dev/null +++ b/simulat0r/firmware/lcd/backlight.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/lcd/backlight.h" diff --git a/simulat0r/firmware/lcd/decoder.c b/simulat0r/firmware/lcd/decoder.c new file mode 100644 index 0000000..64311d8 --- /dev/null +++ b/simulat0r/firmware/lcd/decoder.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/lcd/decoder.c" diff --git a/simulat0r/firmware/lcd/decoder.h b/simulat0r/firmware/lcd/decoder.h new file mode 100644 index 0000000..9024b81 --- /dev/null +++ b/simulat0r/firmware/lcd/decoder.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/lcd/decoder.h" diff --git a/simulat0r/firmware/lcd/display.c b/simulat0r/firmware/lcd/display.c new file mode 100644 index 0000000..de1d975 --- /dev/null +++ b/simulat0r/firmware/lcd/display.c @@ -0,0 +1,14 @@ +#define lcdDisplay _hideaway_lcdDisplay +#define lcdInit _hideaway_lcdInit +#include "../../../firmware/lcd/display.c" +#undef lcdDisplay +#undef lcdInit + +#include "simulator.h" + +void lcdDisplay() { + simlcdDisplayUpdate(); +} + +void lcdInit() { +} diff --git a/simulat0r/firmware/lcd/display.h b/simulat0r/firmware/lcd/display.h new file mode 100644 index 0000000..06e7a42 --- /dev/null +++ b/simulat0r/firmware/lcd/display.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/lcd/display.h" diff --git a/simulat0r/firmware/lcd/fonts.h b/simulat0r/firmware/lcd/fonts.h new file mode 100644 index 0000000..f0985de --- /dev/null +++ b/simulat0r/firmware/lcd/fonts.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/lcd/fonts.h" diff --git a/simulat0r/firmware/lcd/fonts/invaders.c b/simulat0r/firmware/lcd/fonts/invaders.c new file mode 100644 index 0000000..2112d0c --- /dev/null +++ b/simulat0r/firmware/lcd/fonts/invaders.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/lcd/fonts/invaders.c" diff --git a/simulat0r/firmware/lcd/fonts/invaders.h b/simulat0r/firmware/lcd/fonts/invaders.h new file mode 100644 index 0000000..5e665e1 --- /dev/null +++ b/simulat0r/firmware/lcd/fonts/invaders.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/lcd/fonts/invaders.h" diff --git a/simulat0r/firmware/lcd/fonts/orbitron14.c b/simulat0r/firmware/lcd/fonts/orbitron14.c new file mode 100644 index 0000000..1d38808 --- /dev/null +++ b/simulat0r/firmware/lcd/fonts/orbitron14.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/lcd/fonts/orbitron14.c" diff --git a/simulat0r/firmware/lcd/fonts/orbitron14.h b/simulat0r/firmware/lcd/fonts/orbitron14.h new file mode 100644 index 0000000..9ddec83 --- /dev/null +++ b/simulat0r/firmware/lcd/fonts/orbitron14.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/lcd/fonts/orbitron14.h" diff --git a/simulat0r/firmware/lcd/fonts/smallfonts.c b/simulat0r/firmware/lcd/fonts/smallfonts.c new file mode 100644 index 0000000..b638b5f --- /dev/null +++ b/simulat0r/firmware/lcd/fonts/smallfonts.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/lcd/fonts/smallfonts.c" diff --git a/simulat0r/firmware/lcd/fonts/smallfonts.h b/simulat0r/firmware/lcd/fonts/smallfonts.h new file mode 100644 index 0000000..6bad3ff --- /dev/null +++ b/simulat0r/firmware/lcd/fonts/smallfonts.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/lcd/fonts/smallfonts.h" diff --git a/simulat0r/firmware/lcd/fonts/ubuntu18.c b/simulat0r/firmware/lcd/fonts/ubuntu18.c new file mode 100644 index 0000000..2a0d5a1 --- /dev/null +++ b/simulat0r/firmware/lcd/fonts/ubuntu18.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/lcd/fonts/ubuntu18.c" diff --git a/simulat0r/firmware/lcd/fonts/ubuntu18.h b/simulat0r/firmware/lcd/fonts/ubuntu18.h new file mode 100644 index 0000000..9cf868b --- /dev/null +++ b/simulat0r/firmware/lcd/fonts/ubuntu18.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/lcd/fonts/ubuntu18.h" diff --git a/simulat0r/firmware/lcd/fonts/ubuntu29.c b/simulat0r/firmware/lcd/fonts/ubuntu29.c new file mode 100644 index 0000000..e0c9c1f --- /dev/null +++ b/simulat0r/firmware/lcd/fonts/ubuntu29.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/lcd/fonts/ubuntu29.c" diff --git a/simulat0r/firmware/lcd/fonts/ubuntu29.h b/simulat0r/firmware/lcd/fonts/ubuntu29.h new file mode 100644 index 0000000..e08bd2b --- /dev/null +++ b/simulat0r/firmware/lcd/fonts/ubuntu29.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/lcd/fonts/ubuntu29.h" diff --git a/simulat0r/firmware/lcd/fonts/ubuntu36.c b/simulat0r/firmware/lcd/fonts/ubuntu36.c new file mode 100644 index 0000000..3ab93f4 --- /dev/null +++ b/simulat0r/firmware/lcd/fonts/ubuntu36.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/lcd/fonts/ubuntu36.c" diff --git a/simulat0r/firmware/lcd/fonts/ubuntu36.h b/simulat0r/firmware/lcd/fonts/ubuntu36.h new file mode 100644 index 0000000..86d3a6d --- /dev/null +++ b/simulat0r/firmware/lcd/fonts/ubuntu36.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../../firmware/lcd/fonts/ubuntu36.h" diff --git a/simulat0r/firmware/lcd/lcd.h b/simulat0r/firmware/lcd/lcd.h new file mode 100644 index 0000000..e7c2357 --- /dev/null +++ b/simulat0r/firmware/lcd/lcd.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/lcd/lcd.h" diff --git a/simulat0r/firmware/lcd/print.c b/simulat0r/firmware/lcd/print.c new file mode 100644 index 0000000..e286993 --- /dev/null +++ b/simulat0r/firmware/lcd/print.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/lcd/print.c" diff --git a/simulat0r/firmware/lcd/print.h b/simulat0r/firmware/lcd/print.h new file mode 100644 index 0000000..9752112 --- /dev/null +++ b/simulat0r/firmware/lcd/print.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/lcd/print.h" diff --git a/simulat0r/firmware/lcd/render.c b/simulat0r/firmware/lcd/render.c new file mode 100644 index 0000000..b787839 --- /dev/null +++ b/simulat0r/firmware/lcd/render.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/lcd/render.c" diff --git a/simulat0r/firmware/lcd/render.h b/simulat0r/firmware/lcd/render.h new file mode 100644 index 0000000..bf769b4 --- /dev/null +++ b/simulat0r/firmware/lcd/render.h @@ -0,0 +1,8 @@ +#include "../../../firmware/lcd/render.h" + +#undef flip +#define flip(c) do {\ + c = ((c>>1)&0x55)|((c<<1)&0xAA); \ + c = ((c>>2)&0x33)|((c<<2)&0xCC); \ + c = (c>>4) | (c<<4); \ + }while(0) diff --git a/simulat0r/firmware/libc-unc0llide.h b/simulat0r/firmware/libc-unc0llide.h new file mode 100644 index 0000000..0ca4b6a --- /dev/null +++ b/simulat0r/firmware/libc-unc0llide.h @@ -0,0 +1,58 @@ +/* +This header is "gcc -include"d for all compilations of firmware files when building as simulat0r. +*/ + +/* +The following symbols are expected from r0ket firmware to come from libc +*/ +#define siprintf sprintf + +/* +The following symbols were found to be defined within glibc. +Use different names within simulat0r to keep the firmware and simulat0r-host universes collision-free. + */ +#define buf __r0ket_buf +#define deselect __r0ket_deselect +#define ECIES_embedded_public_key_validation __r0ket_ECIES_embedded_public_key_validation +#define ECIES_generate_key_pair __r0ket_ECIES_generate_key_pair +#define ECIES_public_key_validation __r0ket_ECIES_public_key_validation +#define f_sync __r0ket_f_sync +#define getInput __r0ket_getInput +#define isalnum __r0ket_isalnum +#define isalpha __r0ket_isalpha +#define isascii __r0ket_isascii +#define isblank __r0ket_isblank +#define iscntrl __r0ket_iscntrl +#define isdigit __r0ket_isdigit +#define isgraph __r0ket_isgraph +#define islower __r0ket_islower +#define isprint __r0ket_isprint +#define ispunct __r0ket_ispunct +#define isspace __r0ket_isspace +#define isupper __r0ket_isupper +#define isxdigit __r0ket_isxdigit +#define key __r0ket_key +#define memcmp __r0ket_memcmp +#define memcpy __r0ket_memcpy +#define memmove __r0ket_memmove +#define memset __r0ket_memset +#define printf __r0ket_printf +#define select __r0ket_select +#define snprintf __r0ket_snprintf +#define sprintf __r0ket_sprintf +#define strchr __r0ket_strchr +#define strcmp __r0ket_strcmp +#define strcpy __r0ket_strcpy +#define strlen __r0ket_strlen +#define strncmp __r0ket_strncmp +#define strncpy __r0ket_strncpy +#define strrchr __r0ket_strrchr +#define strtok __r0ket_strtok +#define strtok_r __r0ket_strtok_r +#define sync __r0ket_sync +#define tolower __r0ket_tolower +#define toupper __r0ket_toupper +#define vprintf __r0ket_vprintf +#define vsnprintf __r0ket_vsnprintf +#define vsprintf __r0ket_vsprintf +#define XTEA_init_key __r0ket_XTEA_init_key diff --git a/simulat0r/firmware/loadable/Makefile b/simulat0r/firmware/loadable/Makefile new file mode 100644 index 0000000..38a36e7 --- /dev/null +++ b/simulat0r/firmware/loadable/Makefile @@ -0,0 +1,2 @@ +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/loadable/Makefile diff --git a/simulat0r/firmware/loadable/blinktest.c b/simulat0r/firmware/loadable/blinktest.c new file mode 100644 index 0000000..234eb92 --- /dev/null +++ b/simulat0r/firmware/loadable/blinktest.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/loadable/blinktest.c" diff --git a/simulat0r/firmware/loadable/blinktest2.c b/simulat0r/firmware/loadable/blinktest2.c new file mode 100644 index 0000000..ebd11b7 --- /dev/null +++ b/simulat0r/firmware/loadable/blinktest2.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/loadable/blinktest2.c" diff --git a/simulat0r/firmware/loadable/spaceinvaders.c b/simulat0r/firmware/loadable/spaceinvaders.c new file mode 100644 index 0000000..406d744 --- /dev/null +++ b/simulat0r/firmware/loadable/spaceinvaders.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/loadable/spaceinvaders.c" diff --git a/simulat0r/firmware/lpc1xxx/LPC11xx_handlers.c b/simulat0r/firmware/lpc1xxx/LPC11xx_handlers.c new file mode 100644 index 0000000..3b934a1 --- /dev/null +++ b/simulat0r/firmware/lpc1xxx/LPC11xx_handlers.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/lpc1xxx/LPC11xx_handlers.c" diff --git a/simulat0r/firmware/lpc1xxx/LPC13xx_handlers.c b/simulat0r/firmware/lpc1xxx/LPC13xx_handlers.c new file mode 100644 index 0000000..c6c48af --- /dev/null +++ b/simulat0r/firmware/lpc1xxx/LPC13xx_handlers.c @@ -0,0 +1,3 @@ +/* +#include "../../../firmware/lpc1xxx/LPC13xx_handlers.c" +*/ diff --git a/simulat0r/firmware/lpc1xxx/LPC1xxx_startup.c b/simulat0r/firmware/lpc1xxx/LPC1xxx_startup.c new file mode 100644 index 0000000..73deb8b --- /dev/null +++ b/simulat0r/firmware/lpc1xxx/LPC1xxx_startup.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/lpc1xxx/LPC1xxx_startup.c" diff --git a/simulat0r/firmware/main.c b/simulat0r/firmware/main.c new file mode 100644 index 0000000..1c4c1d1 --- /dev/null +++ b/simulat0r/firmware/main.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../firmware/main.c" diff --git a/simulat0r/firmware/sysdefs.h b/simulat0r/firmware/sysdefs.h new file mode 100644 index 0000000..b6c693d --- /dev/null +++ b/simulat0r/firmware/sysdefs.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../firmware/sysdefs.h" diff --git a/simulat0r/firmware/usb/Makefile b/simulat0r/firmware/usb/Makefile new file mode 100644 index 0000000..76d0639 --- /dev/null +++ b/simulat0r/firmware/usb/Makefile @@ -0,0 +1,2 @@ +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/usb/Makefile diff --git a/simulat0r/firmware/usb/usb.h b/simulat0r/firmware/usb/usb.h new file mode 100644 index 0000000..300b1e4 --- /dev/null +++ b/simulat0r/firmware/usb/usb.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usb/usb.h" diff --git a/simulat0r/firmware/usb/usbconfig.c b/simulat0r/firmware/usb/usbconfig.c new file mode 100644 index 0000000..dffd54f --- /dev/null +++ b/simulat0r/firmware/usb/usbconfig.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usb/usbconfig.c" diff --git a/simulat0r/firmware/usb/usbconfig.h b/simulat0r/firmware/usb/usbconfig.h new file mode 100644 index 0000000..f4660b7 --- /dev/null +++ b/simulat0r/firmware/usb/usbconfig.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usb/usbconfig.h" diff --git a/simulat0r/firmware/usb/usbhid.c b/simulat0r/firmware/usb/usbhid.c new file mode 100644 index 0000000..80a684b --- /dev/null +++ b/simulat0r/firmware/usb/usbhid.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usb/usbhid.c" diff --git a/simulat0r/firmware/usb/usbhid.h b/simulat0r/firmware/usb/usbhid.h new file mode 100644 index 0000000..223f407 --- /dev/null +++ b/simulat0r/firmware/usb/usbhid.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usb/usbhid.h" diff --git a/simulat0r/firmware/usb/usbmsc.c b/simulat0r/firmware/usb/usbmsc.c new file mode 100644 index 0000000..d660d22 --- /dev/null +++ b/simulat0r/firmware/usb/usbmsc.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usb/usbmsc.c" diff --git a/simulat0r/firmware/usb/usbmsc.h b/simulat0r/firmware/usb/usbmsc.h new file mode 100644 index 0000000..9e2784f --- /dev/null +++ b/simulat0r/firmware/usb/usbmsc.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usb/usbmsc.h" diff --git a/simulat0r/firmware/usbcdc/Makefile b/simulat0r/firmware/usbcdc/Makefile new file mode 100644 index 0000000..2bb4268 --- /dev/null +++ b/simulat0r/firmware/usbcdc/Makefile @@ -0,0 +1,2 @@ +# GENERATED INCLUDE BRIDGE/ +include ../../../firmware/usbcdc/Makefile diff --git a/simulat0r/firmware/usbcdc/cdc.h b/simulat0r/firmware/usbcdc/cdc.h new file mode 100644 index 0000000..a7a26ca --- /dev/null +++ b/simulat0r/firmware/usbcdc/cdc.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/cdc.h" diff --git a/simulat0r/firmware/usbcdc/cdc_buf.c b/simulat0r/firmware/usbcdc/cdc_buf.c new file mode 100644 index 0000000..e37d2fd --- /dev/null +++ b/simulat0r/firmware/usbcdc/cdc_buf.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/cdc_buf.c" diff --git a/simulat0r/firmware/usbcdc/cdc_buf.h b/simulat0r/firmware/usbcdc/cdc_buf.h new file mode 100644 index 0000000..b667b06 --- /dev/null +++ b/simulat0r/firmware/usbcdc/cdc_buf.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/cdc_buf.h" diff --git a/simulat0r/firmware/usbcdc/cdcuser.c b/simulat0r/firmware/usbcdc/cdcuser.c new file mode 100644 index 0000000..521d9c8 --- /dev/null +++ b/simulat0r/firmware/usbcdc/cdcuser.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/cdcuser.c" diff --git a/simulat0r/firmware/usbcdc/cdcuser.h b/simulat0r/firmware/usbcdc/cdcuser.h new file mode 100644 index 0000000..27728be --- /dev/null +++ b/simulat0r/firmware/usbcdc/cdcuser.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/cdcuser.h" diff --git a/simulat0r/firmware/usbcdc/config.h b/simulat0r/firmware/usbcdc/config.h new file mode 100644 index 0000000..4abc846 --- /dev/null +++ b/simulat0r/firmware/usbcdc/config.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/config.h" diff --git a/simulat0r/firmware/usbcdc/usb.h b/simulat0r/firmware/usbcdc/usb.h new file mode 100644 index 0000000..5c7cc8c --- /dev/null +++ b/simulat0r/firmware/usbcdc/usb.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/usb.h" diff --git a/simulat0r/firmware/usbcdc/usbcfg.h b/simulat0r/firmware/usbcdc/usbcfg.h new file mode 100644 index 0000000..a09a7c1 --- /dev/null +++ b/simulat0r/firmware/usbcdc/usbcfg.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/usbcfg.h" diff --git a/simulat0r/firmware/usbcdc/usbcore.c b/simulat0r/firmware/usbcdc/usbcore.c new file mode 100644 index 0000000..b22988c --- /dev/null +++ b/simulat0r/firmware/usbcdc/usbcore.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/usbcore.c" diff --git a/simulat0r/firmware/usbcdc/usbcore.h b/simulat0r/firmware/usbcdc/usbcore.h new file mode 100644 index 0000000..464271a --- /dev/null +++ b/simulat0r/firmware/usbcdc/usbcore.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/usbcore.h" diff --git a/simulat0r/firmware/usbcdc/usbdesc.c b/simulat0r/firmware/usbcdc/usbdesc.c new file mode 100644 index 0000000..9f7ec49 --- /dev/null +++ b/simulat0r/firmware/usbcdc/usbdesc.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/usbdesc.c" diff --git a/simulat0r/firmware/usbcdc/usbdesc.h b/simulat0r/firmware/usbcdc/usbdesc.h new file mode 100644 index 0000000..fc40d77 --- /dev/null +++ b/simulat0r/firmware/usbcdc/usbdesc.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/usbdesc.h" diff --git a/simulat0r/firmware/usbcdc/usbhw.c b/simulat0r/firmware/usbcdc/usbhw.c new file mode 100644 index 0000000..4dc5d92 --- /dev/null +++ b/simulat0r/firmware/usbcdc/usbhw.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/usbhw.c" diff --git a/simulat0r/firmware/usbcdc/usbhw.h b/simulat0r/firmware/usbcdc/usbhw.h new file mode 100644 index 0000000..a5f9cb7 --- /dev/null +++ b/simulat0r/firmware/usbcdc/usbhw.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/usbhw.h" diff --git a/simulat0r/firmware/usbcdc/usbreg.h b/simulat0r/firmware/usbcdc/usbreg.h new file mode 100644 index 0000000..f7cb480 --- /dev/null +++ b/simulat0r/firmware/usbcdc/usbreg.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/usbreg.h" diff --git a/simulat0r/firmware/usbcdc/usbuser.c b/simulat0r/firmware/usbcdc/usbuser.c new file mode 100644 index 0000000..2e37158 --- /dev/null +++ b/simulat0r/firmware/usbcdc/usbuser.c @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/usbuser.c" diff --git a/simulat0r/firmware/usbcdc/usbuser.h b/simulat0r/firmware/usbcdc/usbuser.h new file mode 100644 index 0000000..0f3be77 --- /dev/null +++ b/simulat0r/firmware/usbcdc/usbuser.h @@ -0,0 +1,2 @@ +/* AUTOGENERATED SOURCE FILE */ +#include "../../../firmware/usbcdc/usbuser.h" diff --git a/simulat0r/gui/CMakeLists.txt b/simulat0r/gui/CMakeLists.txt new file mode 100644 index 0000000..f209214 --- /dev/null +++ b/simulat0r/gui/CMakeLists.txt @@ -0,0 +1,60 @@ +project (qsimulat0r) +cmake_minimum_required(VERSION 2.4.0) +find_package(Qt4 REQUIRED) + +include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../firmware ${CMAKE_CURRENT_SOURCE_DIR}/../firmware/core) +link_directories(${CMAKE_CURRENT_BINARY_DIR} +../../firmware/applications +../../firmware/filesystem +../../firmware/lcd +../../firmware/funk +../../firmware/basic +../../firmware/core +../../firmware/usbcdc +../../firmware/usb) + +include(${QT_USE_FILE}) +set(qsimulat0r_SRCS + qsimulat0r.cc + simulat0rthread.cc +) + +set(MocHeaders + simulat0rthread.h +) + +qt4_automoc(${MocHeaders}) + +QT_WRAP_CPP(qsimulat0r MocSources ${qsimulat0r_SRCS}) + + +set(FIRMWARE_OBJS +../simcore/simcore.o +../simcore/misc.o +) + + +SET_SOURCE_FILES_PROPERTIES(${FIRMWARE_OBJS} PROPERTIES + GENERATED TRUE + EXTERNAL_OBJECT TRUE + OBJECT_DEPENDS TRUE +) + +add_executable(qsimulat0r ${qsimulat0r_SRCS} ${MocSources} + ${FIRMWARE_OBJS} +) + +target_link_libraries(qsimulat0r +${QT_LIBRARIES} +libapp.a +liblcd.a +libusb.a +libfat.a +libfunk.a +libusbcdc.a +libbasic.a +libcore.a +) + + + diff --git a/simulat0r/gui/qsimulat0r.cc b/simulat0r/gui/qsimulat0r.cc new file mode 100644 index 0000000..f519766 --- /dev/null +++ b/simulat0r/gui/qsimulat0r.cc @@ -0,0 +1,206 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +#include "simulat0rthread.h" + +extern "C" { +#include "basic/basic.h" +#include "lcd/display.h" +#include "../simcore/simulator.h" +extern int lcd_layout; +} + +time_t starttime; +long framecount=0; + +const int colorGreenLED=QColor(0,255,0).rgb(); +const int colorRedLED=QColor(255,0,0).rgb(); +const int colorOffLED=QColor(64,64,64).rgb(); + +const int colorPixelOn=QColor(255,192,0).rgb(); +const int colorPixelOff=QColor(64,64,64).rgb(); +const int colorInvertedPixelOn=QColor(128,128,128).rgb(); // inverted and on => dark +const int colorInvertedPixelOff=QColor(128,255,128).rgb(); // inverted and off => bright + +class LCD : public QWidget { +public: + static const int ledsize=10; + static const int ledsep=1; + static const int paddingx=10; + static const int paddingy=10; + static const int pixh=3; + static const int pixw=3; + static const int sep=1; + static const int rasterx=pixh+sep; + static const int rastery=pixw+sep; + static const int dimx=RESX; //96; + static const int dimy=RESY; + + void drawLED(QImage& pixmap,int led, int x, int y,int colorOn) { + int color=simGetLED(led)?colorOn:colorOffLED; + for(int minix=0; minixshowMessage("Initialized",5000); + statusBar()->showMessage("Temp",2000); + resize(2*LCD::paddingx+LCD::rasterx*RESX,2*LCD::paddingy+LCD::rastery*RESY+2*LCD::ledsize+2*LCD::ledsep+statusBar()->height()); + + show(); + setWindowTitle("r0ket simulat0r"); + } + + int buttonPressed(int button) { + return getAllBits(buttonState,button); + } + + int getAllBits(int i, int bit) { + return (i&bit)==bit; + } + + void setBit(int & i, int bit) { + statusBar()->showMessage("Set bit ",2000); + i=i|bit; + // setLowLevelButtonState(bit,1); + } + + void clearBit(int & i, int bit) { + statusBar()->showMessage("Clear bit ",2000); + i=i&(~bit); + // setLowLevelButtonState(bit,0); + } + + /* + void setLowLevelButtonState(int button, int state) { + if (button==BTN_UP) gpioSetValue(RB_BTN3, state); + if (button==BTN_DOWN) gpioSetValue(RB_BTN2, state); + if (button==BTN_ENTER) gpioSetValue(RB_BTN4, state); + if (button==BTN_LEFT) gpioSetValue(RB_BTN0, state); + if (button==BTN_RIGHT) gpioSetValue(RB_BTN1, state); + } + */ + + void keyPressEvent(QKeyEvent *event) { + if(event->isAutoRepeat()) return; + + if(event->key()==keyUp) clearBit(buttonState,BTN_UP); + if(event->key()==keyDown) clearBit(buttonState,BTN_DOWN); + if(event->key()==keyEnter) clearBit(buttonState,BTN_ENTER); + if(event->key()==keyAltEnter) clearBit(buttonState,BTN_ENTER); + if(event->key()==keyLeft) clearBit(buttonState,BTN_LEFT); + if(event->key()==keyRight) clearBit(buttonState,BTN_RIGHT); + } + void keyReleaseEvent(QKeyEvent *event) { + if(event->isAutoRepeat()) return; + + if(event->key()==keyUp) setBit(buttonState,BTN_UP); + if(event->key()==keyDown) setBit(buttonState,BTN_DOWN); + if(event->key()==keyEnter) setBit(buttonState,BTN_ENTER); + if(event->key()==keyAltEnter) setBit(buttonState,BTN_ENTER); + if(event->key()==keyLeft) setBit(buttonState,BTN_LEFT); + if(event->key()==keyRight) setBit(buttonState,BTN_RIGHT); + } + +}; + +extern "C" { +void simlcdDisplayUpdate() { + hackptr->update(); + usleep(10000); +} + +int simButtonPressed(int button) { + return r0ketWidget->buttonPressed(button); +} + +void simSetLEDHook(int led){ + hackptr->update(); +} +} + +int main(int argc, char *argv[]) +{ + cout<<"Starting r0ket simulat0r..."<start(); + return app.exec(); +} diff --git a/simulat0r/gui/simulat0rthread.cc b/simulat0r/gui/simulat0rthread.cc new file mode 100644 index 0000000..90c3aec --- /dev/null +++ b/simulat0r/gui/simulat0rthread.cc @@ -0,0 +1,19 @@ +#include "simulat0rthread.h" + +extern "C" { +void simulator_main(); +} + +#include +#include +using namespace std; + +extern QWidget* hackptr; + +Simulat0rThread::~Simulat0rThread() { +} + +void Simulat0rThread::run() +{ + simulator_main(); +} diff --git a/simulat0r/gui/simulat0rthread.h b/simulat0r/gui/simulat0rthread.h new file mode 100644 index 0000000..9e54692 --- /dev/null +++ b/simulat0r/gui/simulat0rthread.h @@ -0,0 +1,17 @@ +#ifndef SIMULAT0RTHREAD_H +#define SIMULAT0RTHREAD_H + +#include +#include + +class Simulat0rThread : public QThread +{ + long loop; + // Q_OBJECT + + protected: + virtual ~Simulat0rThread(); + virtual void run(); +}; + +#endif diff --git a/simulat0r/simcore/Makefile b/simulat0r/simcore/Makefile new file mode 100644 index 0000000..3fc4357 --- /dev/null +++ b/simulat0r/simcore/Makefile @@ -0,0 +1,19 @@ + + +CFLAGS += -std=gnu99 +CFLAGS += -I../firmware +CFLAGS += -I../firmware/core # for gpio.h including projectconfig.h without path +CFLAGS += -I../simcore + +OBJS+= ../firmware/basic/*.o +OBJS+= ../firmware/core/*.o +OBJS+= ../firmware/core/*/*.o +LDFLAGS+= -L../firmware/applications +LIBS+= ../firmware/applications/libapp.a +LDFLAGS+= -L../firmware/lcd +LIBS+= ../firmware/lcd/liblcd.a +LDFLAGS+= -L../firmware/usb +LIBS+= ../firmware/usb/libusb.a + +.PHONY : all +all : simcore.o misc.o #$(OBJS) $(LIBS) diff --git a/simulat0r/simcore/misc.c b/simulat0r/simcore/misc.c new file mode 100644 index 0000000..36c5cfb --- /dev/null +++ b/simulat0r/simcore/misc.c @@ -0,0 +1,5 @@ +void __disable_irq() { +} + +void __enable_irq() { +} diff --git a/simulat0r/simcore/simcore.c b/simulat0r/simcore/simcore.c new file mode 100644 index 0000000..937260c --- /dev/null +++ b/simulat0r/simcore/simcore.c @@ -0,0 +1,42 @@ + +#include "core/sysinit.h" + +#include "basic/basic.h" + +#include "lcd/render.h" + +#include "pmu/pmu.h" + +void ReinvokeISP(void); + +/**************************************************************************/ + +void wrapper(void); + +int simulator_main(void) { + + // Configure cpu and mandatory peripherals + systemInit(); + + // initialise basic badge functions + rbInit(); + + lcdInit(); // display + + lcdFill(0); + lcdDisplay(); + + wrapper(); // see module/ subdirectory +} + +static uint32_t ledstate[4]; + +int simGetLED(int led) { + return ledstate[led]; +} + +void simSetLED(int led,uint32_t bitVal) { + ledstate[led]=bitVal; + simSetLEDHook(led); +} + diff --git a/simulat0r/simcore/simulator.h b/simulat0r/simcore/simulator.h new file mode 100644 index 0000000..82b0d2f --- /dev/null +++ b/simulat0r/simcore/simulator.h @@ -0,0 +1,17 @@ +#ifndef SIMULATOR_H +#define SIMULATOR_H + +#include + +void simlcdDisplayUpdate(); + +int simButtonPressed(int button); + +int simGetLED(int led); +void simSetLED(int led,uint32_t bitVal); +void simSetLEDHook(int led); + + +int simulator_main(void); + +#endif diff --git a/simulat0r/tui/Makefile b/simulat0r/tui/Makefile new file mode 100644 index 0000000..194bae0 --- /dev/null +++ b/simulat0r/tui/Makefile @@ -0,0 +1,30 @@ +ROOT_PATH=../firmware +include ../firmware/Makefile.inc + +CFLAGS += -std=gnu99 +CFLAGS += -I../firmware +CFLAGS += -I../firmware/core # for gpio.h including projectconfig.h without path +CFLAGS += -I../simcore + +OBJS+= ../firmware/basic/*.o +OBJS+= ../firmware/core/*.o +OBJS+= ../firmware/core/*/*.o +LDFLAGS+= -L../firmware/applications +LIBS+= ../firmware/applications/libapp.a +LDFLAGS+= -L../firmware/lcd +LIBS+= ../firmware/lcd/liblcd.a +LDFLAGS+= -L../firmware/usb +LIBS+= ../firmware/usb/libusb.a + +#LIBS += -lm +LIBS += ../firmware/filesystem/libfat.a +LIBS += ../firmware/core/libcore.a + + +OBJS+=../simcore/simcore.o ../simcore/misc.o + +.PHONY : all +all : simulat0r + +simulat0r : simulat0r.o $(OBJS) $(LIBS) + diff --git a/simulat0r/tui/simulat0r.c b/simulat0r/tui/simulat0r.c new file mode 100644 index 0000000..526a3c2 --- /dev/null +++ b/simulat0r/tui/simulat0r.c @@ -0,0 +1,32 @@ +#include "simulator.h" +#include "../firmware/lcd/display.h" + +#include + +extern int lcd_layout; + +void simlcdDisplayUpdate() { + write(1,"\033[H",3); + for(int y=0; y