Initial transfer from sourceforge

This commit is contained in:
Telekatz 2017-07-01 21:56:25 +02:00
commit f2259c5424
415 changed files with 73200 additions and 0 deletions

78
.cproject Normal file
View file

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="0.481883884">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.481883884" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration buildProperties="" description="" id="0.481883884" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.481883884." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1715436414" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.1715436414.885904395" name=""/>
<builder id="org.eclipse.cdt.build.core.settings.default.builder.1224554298" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.736682923" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.1273008438" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.937300672" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.772385457" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1269038295" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.2137323592" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1752191090" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
</toolChain>
</folderInfo>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="Boop.null.506503339" name="Boop"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="0.481883884">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="debug" path="boop/trunk" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>debug</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="clean" path="boop/trunk" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="program" path="boop/trunk" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>program</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
</cproject>

27
.project Normal file
View file

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Boop</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,35 @@
SDCCPATH=/opt/sdcc/
SDCCBIN=$(SDCCPATH)/bin/
SDCCEXTRA=$(SDCCPATH)/share/sdcc/
SDCC=$(SDCCBIN)/sdcc
SDCCINC=$(SDCCEXTRA)/include/mcs51/
SDCCLIB=$(SDCCEXTRA)/lib/large/
SDCCMFLAGS=-mds390 --use-asix --opt-code-size --stack-size 0x80
SDCCLFLAGS=--xram-loc 0x0000 --xram-size 0x8000 --iram-size 0x80 --code-loc 0x000000 --code-size 0x080000 --stack-loc 0x80 --idata-loc 0x30
OBJECTS=cpu_ax110xx.rel interrupt_ax110xx.rel main.rel uart/uart.rel
all : asix.bin
asix.bin: asix.ihx
$(SDCCBIN)/makebin -p <asix.ihx >asix.bin
asix.ihx: $(OBJECTS)
$(SDCC) -I$(SDCCINC) $(SDCCMFLAGS) $(SDCCLFLAGS) $(OBJECTS) -o asix.ihx
cpu_ax110xx.rel: cpu_ax110xx.c cpu_ax110xx.h ax110xx.h
$(SDCC) -I$(SDCCINC) $(SDCCMFLAGS) -c cpu_ax110xx.c
interrupt_ax110xx.rel: interrupt_ax110xx.c interrupt_ax110xx.h ax110xx.h
$(SDCC) -I$(SDCCINC) $(SDCCMFLAGS) -c interrupt_ax110xx.c
main.rel: main.c ax110xx.h interrupt_ax110xx.h cpu_ax110xx.h
$(SDCC) -I$(SDCCINC) $(SDCCMFLAGS) -c main.c
uart/uart.rel: uart/uart.c ax110xx.h
$(SDCC) -I$(SDCCINC) $(SDCCMFLAGS) -c -o uart/ uart/uart.c
clean:
rm -f mon.ihx *.asm *.lst *.rel *.rst *.sym *.cdb *.map *.ihx *.lnk *.hex *.mem *.bin *~
cd uart; rm -f *.asm *.lst *.rel *.rst *.sym *.cdb *.map *.ihx *.lnk *.hex *.mem *.bin *~; cd ..

View file

@ -0,0 +1,35 @@
SDCCPATH=F:/Tools/SDCC
SDCCBIN=$(SDCCPATH)/bin
SDCCEXTRA=$(SDCCPATH)/share/sdcc/
SDCC=$(SDCCBIN)/sdcc
SDCCINC=$(SDCCPATH)/include/mcs51
SDCCLIB=$(SDCCPATH)/lib/large/
SDCCMFLAGS=-mds390 --use-asix --opt-code-size --stack-size 0x80
SDCCLFLAGS=--xram-loc 0x0000 --xram-size 0x8000 --iram-size 0x80 --code-loc 0x000000 --code-size 0x080000 --stack-loc 0x80 --idata-loc 0x30
OBJECTS=cpu_ax110xx.rel interrupt_ax110xx.rel main.rel uart/uart.rel
all : asix.bin
asix.bin: asix.ihx
$(SDCCBIN)/makebin -p <asix.ihx >asix.bin
asix.ihx: $(OBJECTS)
$(SDCC) -I$(SDCCINC) $(SDCCMFLAGS) $(SDCCLFLAGS) $(OBJECTS) -o asix.ihx
cpu_ax110xx.rel: cpu_ax110xx.c cpu_ax110xx.h ax110xx.h
$(SDCC) -I$(SDCCINC) $(SDCCMFLAGS) -c cpu_ax110xx.c
interrupt_ax110xx.rel: interrupt_ax110xx.c interrupt_ax110xx.h ax110xx.h
$(SDCC) -I$(SDCCINC) $(SDCCMFLAGS) -c interrupt_ax110xx.c
main.rel: main.c ax110xx.h interrupt_ax110xx.h cpu_ax110xx.h
$(SDCC) -I$(SDCCINC) $(SDCCMFLAGS) -c main.c
uart/uart.rel: uart/uart.c ax110xx.h
$(SDCC) -I$(SDCCINC) $(SDCCMFLAGS) -c -o uart/ uart/uart.c
clean:
rm -f mon.ihx *.asm *.lst *.rel *.rst *.sym *.cdb *.map *.ihx *.lnk *.hex *.mem *.bin *~
cd uart; rm -f *.asm *.lst *.rel *.rst *.sym *.cdb *.map *.ihx *.lnk *.hex *.mem *.bin *~; cd ..

View file

@ -0,0 +1,462 @@
#ifndef AX110XX_H
#define AX110XX_H
/* Byte Registers */
__sfr __at (0x80) P0; // Port 0
__sfr __at (0x81) SP; // Stack Pointer
__sfr __at (0x82) DPL0; // Data Pointer 0 Low Byte
__sfr __at (0x83) DPH0; // Data Pointer 0 High Byte
__sfr __at (0x82) DPL; // Data Pointer 0 Low Byte
__sfr __at (0x83) DPH; // Data Pointer 0 High Byte
__sfr __at (0x84) DPL1; // Data Pointer 1 Low Byte
__sfr __at (0x85) DPH1; // Data Pointer 1 High Byte
__sfr __at (0x86) DPS; // Data Pointers Select Register
__sfr __at (0x87) PCON; // Power Configuration Register
__sfr __at (0x88) TCON; // Timer 0,1 Configuration Register
__sfr __at (0x89) TMOD; // Timer 0,1 Control Mode Register
__sfr __at (0x8A) TL0; // Timer 0 Low Byte Counter
__sfr __at (0x8B) TL1; // Timer 1 Low Byte Counter
__sfr __at (0x8C) TH0; // Timer 0 High Byte Counter
__sfr __at (0x8D) TH1; // Timer 1 High Byte Counter
__sfr __at (0x8E) CKCON; // Clock Control Register
__sfr __at (0x8F) CSREPR; // Software Reset and External Program RAM Select Register
__sfr __at (0x90) P1; // Port 1
__sfr __at (0x91) EIF; // Extended Interrupt Flag Register
__sfr __at (0x92) WTST; // Program Wait States Register
__sfr __at (0x93) DPX0; // Data Pointer Extended Register 0
__sfr __at (0x93) DPX; // Data Pointer Extended Register 0
__sfr __at (0x94) SDSTSR; // Software Timer and Software DMA complete interrupt status
__sfr __at (0x95) DPX1; // Data Pointer Extended Register 1
__sfr __at (0x96) I2CCIR; // I2C Command Index Register
__sfr __at (0x97) I2CDR; // I2C Data Register
__sfr __at (0x98) SCON0; // UART 0 Configuration Register
__sfr __at (0x99) SBUF0; // UART 0 Buffer Register
__sfr __at (0x9A) DBAR; // DMA Bus Arbitration Register
__sfr __at (0x9B) DCIR; // DMA Command Index Register
__sfr __at (0x9C) DDR; // DMA Data Register
__sfr __at (0x9D) ACON; // Address Control Register
__sfr __at (0x9E) PISSR1; // Peripheral Interrupt Status Summary Register 1
__sfr __at (0x9F) PISSR2; // Peripheral Interrupt Status Summary Register 2
__sfr __at (0xA0) P2; // Port 2
/* Local Bus Master Mode */
__sfr __at (0xA1) LMSR; // Local Bus Mode Setup Register
__sfr __at (0xA2) LCR; // Local Bus Command Register
__sfr __at (0xA3) LSR; // Local Bus Status Register
__sfr __at (0xA4) LDALR; // Local Bus Device Address Low Register
__sfr __at (0xA5) LDAHR; // Local Bus Device Address High Register
__sfr __at (0xA6) LDCSR; // Local Bus Device Chip Select Register
/* Local Bus Slave Mode */
__sfr __at (0xA1) LSAIER; // Local Bus Slave mode Action and Interrupt Enable Register
__sfr __at (0xA2) LSCR; // Local Bus Slave mode Command Register
__sfr __at (0xA3) LSSR; // Local Bus Slave mode Status Register
__sfr __at (0xA4) XMWLR; // External Master Write-read Low Register
__sfr __at (0xA5) XMWHR; // External Master Write-read High Register
__sfr __at (0xA6) XMRLR; // External Master Read-only Low Register
__sfr __at (0xA7) XMRHR; // External Master Read-only High Register
__sfr __at (0xA8) IE; // Interrupt Enable register
__sfr __at (0xA9) LDLR; // Local Bus Data Low Register
__sfr __at (0xAA) LDHR; // Local Bus Data High Register
__sfr __at (0xAB) DMALR; // Local Bus DMA Address Low Register
__sfr __at (0xAC) DMAMR; // Local Bus DMA Address Medium Register
__sfr __at (0xAD) DMAHR; // Local Bus DMA Address High Register
__sfr __at (0xAE) TCIR; // TOE Command Index Register
__sfr __at (0xAF) TDR; // TOE Data Register
__sfr __at (0xB0) P3; // Port 3
__sfr __at (0xB1) CCAPL0; // PCA Module 0 Compare/Capture Low Byte Register
__sfr __at (0xB2) CCAPL1; // PCA Module 1 Compare/Capture Low Byte Register
__sfr __at (0xB3) CCAPL2; // PCA Module 2 Compare/Capture Low Byte Register
__sfr __at (0xB4) CCAPL3; // PCA Module 3 Compare/Capture Low Byte Register
__sfr __at (0xB5) CCAPL4; // PCA Module 4 Compare/Capture Low Byte Register
__sfr __at (0xB6) MCIR; // MAC Command Index Register
__sfr __at (0xB7) MDR; // MAC Data Register
__sfr __at (0xB8) IP; // Interrupt Priority Register
__sfr __at (0xB9) CCAPH0; // PCA Module 0 Compare/Capture High Byte Register
__sfr __at (0xBA) CCAPH1; // PCA Module 1 Compare/Capture High Byte Register
__sfr __at (0xBB) CCAPH2; // PCA Module 2 Compare/Capture High Byte Register
__sfr __at (0xBC) CCAPH3; // PCA Module 3 Compare/Capture High Byte Register
__sfr __at (0xBD) CCAPH4; // PCA Module 4 Compare/Capture High Byte Register
__sfr __at (0xBE) EPCR; // Ethernet PHY Command Index Register
__sfr __at (0xBF) EPDR; // Ethernet PHY Data Register
__sfr __at (0xC0) SCON1; // UART 1 Configuration Register
__sfr __at (0xC1) SBUF1; // UART 1 Buffer Register
__sfr __at (0xC2) CMOD; // PCA Timer/Counter Mode Register
__sfr __at (0xC3) CCON; // PCA Timer/Counter Control Register
__sfr __at (0xC4) CL; // PCA Timer/Counter Low
__sfr __at (0xC5) CH; // PCA Timer/Counter High
__sfr __at (0xC8) T2CON; // Timer 2 Configuration Register
__sfr __at (0xC9) T2IF; // Timer 2 Interrupt Flags
__sfr __at (0xCA) RLDL; // Timer 2 Reload Low Byte
__sfr __at (0xCB) RLDH; // Timer 2 Reload High Byte
__sfr __at (0xCC) TL2; // Timer 2 Low Byte Counter
__sfr __at (0xCD) TH2; // Timer 2 High Byte Counter
__sfr __at (0xCE) SPICIR; // SPI Command Index Register
__sfr __at (0xCF) SPIDR; // SPI Data Register
__sfr __at (0xD0) PSW; // Program Status Word
__sfr __at (0xD1) CCAPM0; // PCA Compare/Capture Module Mode Register 0
__sfr __at (0xD2) CCAPM1; // PCA Compare/Capture Module Mode Register 1
__sfr __at (0xD3) CCAPM2; // PCA Compare/Capture Module Mode Register 2
__sfr __at (0xD4) CCAPM3; // PCA Compare/Capture Module Mode Register 3
__sfr __at (0xD5) CCAPM4; // PCA Compare/Capture Module Mode Register 4
__sfr __at (0xD6) OWCIR; // OneWire Command Index Register
__sfr __at (0xD7) OWDR; // OneWire Data Register
__sfr __at (0xD8) WDCON; // Watchdog Configuration
__sfr __at (0xDE) CANCIR; // CAN Bus Command Index Register
__sfr __at (0xDF) CANDR; // CAN Bus Data Register
__sfr __at (0xE0) ACC; // Accumulator
/* UART2 registers */
__sfr __at (0xE1) UR2_DLL;// High Speed UART2 Divisor Latch Low Register
__sfr __at (0xE1) UR2_THR;// High Speed UART2 Transmit Holding Register for Writing
__sfr __at (0xE1) UR2_RBR;// High Speed UART2 Receive Buffer Register for Reading
__sfr __at (0xE2) UR2_DLH;// High Speed UART2 Divisor Latch High Register
__sfr __at (0xE2) UR2_IER;// High Speed UART2 Interrupt Enable Register
__sfr __at (0xE3) UR2_FCR;// High Speed UART2 FIFO Control Register for Writing
__sfr __at (0xE3) UR2_IIR;// High Speed UART2 Interrupt Identification Register for Reading
__sfr __at (0xE4) UR2_LCR;// High Speed UART2 Line Control Register
__sfr __at (0xE5) UR2_MCR;// High Speed UART2 Modem Control Register
__sfr __at (0xE6) UR2_LSR;// High Speed UART2 Line Status Register
__sfr __at (0xE7) UR2_MSR;// High Speed UART2 Modem Status Register
__sfr __at (0xE8) EIE; // External Interrupt Enable
__sfr __at (0xE9) STATUS; // Status Register
__sfr __at (0xEA) MXAX; // MOVX @Ri Extended Register
__sfr __at (0xEB) TA; // Timed Access Protection
__sfr __at (0xF0) B; // B Working Register
__sfr __at (0xF8) EIP; // Extended Interrupt Priority Register
__sfr __at (0xF9) MD0; // MDU Data 0
__sfr __at (0xFA) MD1; // MDU Data 1
__sfr __at (0xFB) MD2; // MDU Data 2
__sfr __at (0xFC) MD3; // MDU Data 3
__sfr __at (0xFD) MD4; // MDU Data 4
__sfr __at (0xFE) MD5; // MDU Data 5
__sfr __at (0xFF) ARCON ;// MDU Control Register
/* Bit Registers */
/* P0 (0x80) Bit Registers */
__sbit __at (0x80) P0_0;
__sbit __at (0x81) P0_1;
__sbit __at (0x82) P0_2;
__sbit __at (0x83) P0_3;
__sbit __at (0x84) P0_4;
__sbit __at (0x85) P0_5;
__sbit __at (0x86) P0_6;
__sbit __at (0x87) P0_7;
/* DPS (0x86) Bit Values */
#define SEL_ 0x01
#define TSL_ 0x20
#define ID0_ 0x40
#define ID1_ 0x80
/* PCON (0x87) Bit Values */
#define PMM_ 0x01
#define STOP_ 0x02
#define SWB_ 0x04
#define PWE_ 0x10
#define SMOD1_ 0x40
#define SMOD2_ 0x80
/* TCON (0x88) Bit Registers */
__sbit __at (0x88) IT0;
__sbit __at (0x89) IE0;
__sbit __at (0x8A) IT1;
__sbit __at (0x8B) IE1;
__sbit __at (0x8C) TR0;
__sbit __at (0x8D) TF0;
__sbit __at (0x8E) TR1;
__sbit __at (0x8F) TF1;
/* TMOD (0x89) Bit Values */
#define T0_M0_ 0x01
#define T0_M1_ 0x02
#define T0_CT_ 0x04
#define T0_GATE_ 0x08
#define T1_M0_ 0x10
#define T1_M1_ 0x20
#define T1_CT_ 0x40
#define T1_GATE_ 0x80
#define T1_MASK_ 0xF0
#define T0_MASK_ 0x0F
/* CKCON (0x8E) Bit Values */
#define MD0_ 0x01
#define MD1_ 0x02
#define MD2_ 0x04
#define T0M_ 0x08
#define T1M_ 0x10
#define T2M_ 0x20
#define WD0_ 0x40
#define WD1_ 0x80
/* CSREPR (0x8F) Bit Values */
#define SW_RST 0x01
#define SW_RBT 0x02
#define FARM 0x04
#define FAES 0x08
#define PMS 0x10
#define SCS_100M 0xC0
#define SCS_75M 0x80
#define SCS_50M 0x40
#define SCS_25M 0x00
/* P1 (0x90) Bit Registers */
__sbit __at (0x90) P1_0;
__sbit __at (0x91) P1_1;
__sbit __at (0x92) P1_2;
__sbit __at (0x93) P1_3;
__sbit __at (0x94) P1_4;
__sbit __at (0x95) P1_5;
__sbit __at (0x96) P1_6;
__sbit __at (0x97) P1_7;
/* EIF (0x91) Bit Values */
#define INT2F 0x01
#define INT3F 0x02
#define INT4F 0x04
#define INT5F 0x08
#define INT6F 0x10
/* SCON0 (0x98) Bit Registers */
__sbit __at (0x98) RI0;
__sbit __at (0x99) TI0;
__sbit __at (0x9A) RB08;
__sbit __at (0x9B) TB08;
__sbit __at (0x9C) REN0;
__sbit __at (0x9D) SM02;
__sbit __at (0x9E) SM01;
__sbit __at (0x9F) SM00;
/* DBAR (0x9A) Bit Values */
#define BUS_REQ 0x01
#define BUS_GRANT 0x80
/* ACON (0x9D) Bit Values */
#define FLAT_MODE 0x02
#define LARGE_MODE 0x00
/* PISSR1 (0x9E) Bit Values */
#define LB_INT_STU 0x01
#define LB_EXT_INT_STU 0x02
#define ETH_INT_STU 0x04
#define TOE_INT_STU 0x08
#define OW_INT_STU 0x10
#define SPI_INT_STU 0x20
#define I2C_INT_STU 0x40
#define CAN_INT_STU 0x80
/* PISSR2 (0x9F) Bit Values */
#define UART2_INT_STU 0x01
/* P2 (0xA0) Bit Registers */
__sbit __at (0xA0) P2_0;
__sbit __at (0xA1) P2_1;
__sbit __at (0xA2) P2_2;
__sbit __at (0xA3) P2_3;
__sbit __at (0xA4) P2_4;
__sbit __at (0xA5) P2_5;
__sbit __at (0xA6) P2_6;
__sbit __at (0xA7) P2_7;
/* IE (0xA8) Bit Registers */
__sbit __at (0xA8) EX0; /* 1=Enable External interrupt 0 */
__sbit __at (0xA9) ET0; /* 1=Enable Timer 0 interrupt */
__sbit __at (0xAA) EX1; /* 1=Enable External interrupt 1 */
__sbit __at (0xAB) ET1; /* 1=Enable Timer 1 interrupt */
__sbit __at (0xAC) ES0; /* 1=Enable Serial port 0 interrupt */
__sbit __at (0xAD) ET2; /* 1=Enable Timer 2 interrupt */
__sbit __at (0xAE) ES1; /* 1=Enable Serial port 1 interrupt */
__sbit __at (0xAF) EA; /* 0=Disable all interrupts */
/* P3 (0xB0) Bit Registers (Mnemonics & Ports) */
__sbit __at (0xB0) P3_0;
__sbit __at (0xB1) P3_1;
__sbit __at (0xB2) P3_2;
__sbit __at (0xB3) P3_3;
__sbit __at (0xB4) P3_4;
__sbit __at (0xB5) P3_5;
__sbit __at (0xB6) P3_6;
__sbit __at (0xB7) P3_7;
__sbit __at (0xB0) RXD; /* Serial data input */
__sbit __at (0xB1) TXD; /* Serial data output */
__sbit __at (0xB2) INT0; /* External interrupt 0 */
__sbit __at (0xB3) INT1; /* External interrupt 1 */
__sbit __at (0xB4) T0; /* Timer 0 external input */
__sbit __at (0xB5) T1; /* Timer 1 external input */
__sbit __at (0xB6) WR; /* External data memory write strobe */
__sbit __at (0xB7) RD; /* External data memory read strobe */
/* IP (0xB8) Bit Registers */
__sbit __at (0xB8) PX0;
__sbit __at (0xB9) PT0;
__sbit __at (0xBA) PX1;
__sbit __at (0xBB) PT1;
__sbit __at (0xBC) PS0;
__sbit __at (0xBD) PT2;
__sbit __at (0xBE) PS1;
/* SCON1 (0xC0) Bit Registers */
__sbit __at (0xC0) RI1;
__sbit __at (0xC1) TI1;
__sbit __at (0xC2) RB18;
__sbit __at (0xC3) TB18;
__sbit __at (0xC4) REN1;
__sbit __at (0xC5) SM12;
__sbit __at (0xC6) SM11;
__sbit __at (0xC7) SM10;
/* CMOM (0xC2) Bit Values */
#define PCA_ECF 0x01
#define PCA_T0_OF 0x08
#define PCA_EXT_CLK 0x0E
#define PCA_GATE_OFF 0x80
/* CCON (0xC3) Bit Values */
#define PCA_CCF0 0x01
#define PCA_CCF1 0x02
#define PCA_CCF2 0x04
#define PCA_CCF3 0x08
#define PCA_CCF4 0x10
#define PCA_CR 0x40
#define PCA_CF 0x80
/* T2CON (0xC8) Bit Registers */
__sbit __at (0xC8) CPRL2;
__sbit __at (0xC9) CT2;
__sbit __at (0xCA) TR2;
__sbit __at (0xCB) EXEN2;
__sbit __at (0xCC) TCLK;
__sbit __at (0xCD) RCLK;
__sbit __at (0xCE) EXF2;
__sbit __at (0xCF) TF2;
/* PSW (0xD0) Bit Registers */
__sbit __at (0xD0) P;
__sbit __at (0xD1) F1;
__sbit __at (0xD2) OV;
__sbit __at (0xD3) RS0;
__sbit __at (0xD4) RS1;
__sbit __at (0xD5) F0;
__sbit __at (0xD6) AC;
__sbit __at (0xD7) CY;
/* CCAPM0-4 (0xD1-0xD5) Bit Values */
#define ECCFs 0x01
#define PWMs 0x02
#define TOGs 0x04
#define MATs 0x08
#define CAPNs 0x10
#define CAPPs 0x20
#define ECOMs 0x40
#define CEXs 0x80
/* PSW (0xD8) Bit Registers */
__sbit __at (0xD8) RWT;
__sbit __at (0xD9) EWT;
__sbit __at (0xDA) WTRF;
__sbit __at (0xDB) WDIF;
/* Interrupt Vectors: Address = (N * 8) + 3 */
#define IE0_VECTOR 0 /* 0x03 External Interrupt 0 */
#define TF0_VECTOR 1 /* 0x0B Timer 0 */
#define IE1_VECTOR 2 /* 0x13 External Interrupt 1 */
#define TF1_VECTOR 3 /* 0x1B Timer 1 */
#define SIO0_VECTOR 4 /* 0x23 Serial port */
#define TF2_VECTOR 5 /* 0x2B Timer 2 */
#define SIO1_VECTOR 6 /* 0x33 Serial port */
#define DMA_VECTOR 7 /* 0x3B Internal DMA Transfer */
#define PCA_VECTOR 8 /* 0x43 Internal Programmable Counter Array */
#define PIR_VECTOR 9 /* 0x4B Internal Peripherial IRQ */
#define SDMA_VECTOR 10 /* 0x53 Internal Software DMA */
#define WU_VECTOR 11 /* 0x5B Wake-Up */
#define WDT_VECTOR 12 /* 0x63 Internal Watchdog */
/* UR2_IER (0xE2) Bit Values */
#define UR2_RDI_ENB 0x01
#define UR2_THRI_ENB 0x02
#define UR2_RLSI_ENB 0x04
#define UR2_MSI_ENB 0x08
/* UR2_IIR (0xE3) Bit Values */
#define UR2_NONE_INTR 0x01
#define UR2_RLS_INTR 0x06
#define UR2_RD_TRIG_INTR 0x04
#define UR2_RD_TI_INTR 0x0C
#define UR2_THRE_INTR 0x02
#define UR2_MS_INTR 0x00
/* UR2_FCR (0xE3) Bit Values */
#define UR2_FIFO_MODE 0x01
#define UR2_RXFIFO_RST 0x02
#define UR2_TXFIFO_RST 0x04
#define UR2_TRIG_01 0x00
#define UR2_TRIG_04 0x40
#define UR2_TRIG_08 0x80
#define UR2_TRIG_14 0xC0
/* UR2_LCR (0xE4) Bit Values */
#define UR2_CHAR_5 0x00
#define UR2_CHAR_6 0x01
#define UR2_CHAR_7 0x02
#define UR2_CHAR_8 0x03
#define UR2_STOP_10 0x00
#define UR2_STOP_15 0x04
#define UR2_PARITY_ENB 0x08
#define UR2_EVEN_PARITY 0x10
#define UR2_STICK_PARITY 0x20
#define UR2_BREAK_ENB 0x40
#define UR2_DLAB_ENB 0x80
/* UR2_MCR (0xE5) Bit Values */
#define UR2_DTR 0x01
#define UR2_RTS 0x02
#define UR2_OUT1 0x04
#define UR2_OUT2 0x08
#define UR2_LOOPBACK 0x10
#define UR2_RS485_RECEIVE 0x40
#define UR2_RS485_DRIVE 0x80
/* UR2_LSR (0xE6) Bit Values */
#define UR2_DR 0x01
#define UR2_OE 0x02
#define UR2_PE 0x04
#define UR2_FE 0x08
#define UR2_BI 0x10
#define UR2_THRE 0x20
#define UR2_TEMT 0x40
#define UR2_FRAME_ERR 0x80
/* UR2_MSR (0xE7) Bit Values */
#define UR2_DCTS 0x01
#define UR2_DDSR 0x02
#define UR2_TERI 0x04
#define UR2_DDCD 0x08
#define UR2_CTS 0x10
#define UR2_DSR 0x20
#define UR2_RI 0x40
#define UR2_DCD 0x80
/* EIE (0xE8) Bit Registers */
__sbit __at (0xE8) EINT2;
__sbit __at (0xE9) EINT3;
__sbit __at (0xEA) EINT4;
__sbit __at (0xEB) EINT5;
__sbit __at (0xEC) EINT6;
__sbit __at (0xED) EWDI;
/* EIP (0xF8) Bit Registers */
__sbit __at (0xF8) PINT2;
__sbit __at (0xF9) PINT3;
__sbit __at (0xFA) PINT4;
__sbit __at (0xFB) PINT5;
__sbit __at (0xFC) PINT6;
__sbit __at (0xFD) PWDI;
#endif

View file

@ -0,0 +1,177 @@
#include "ax110xx.h"
#include "interrupt_ax110xx.h"
#include "cpu_ax110xx.h"
#include "types_ax110xx.h"
static unsigned char globeInt = 0;
static unsigned char cpuSysClk = 0;
static unsigned char memShadow = 0;
static unsigned char progWtst = 0;
static unsigned char dataStretch = 0;
void AX11000_Init(void)
{
EA = 0; // turn off globe interrupt
P0 = 0xFF;
P1 = 0xFF;
P2 = 0xFF;
P3 = 0xFF;
/* Check program wait-state and data memory wait-state */
if (CSREPR & PMS)
{
memShadow = 1;
/* for real chip */
switch (CSREPR & (BIT6|BIT7))
{
case SCS_100M :
cpuSysClk = SCS_100M;
WTST = 0x01;
CKCON = 0x01;
break;
case SCS_50M :
cpuSysClk = SCS_50M;
WTST = 0x00;
CKCON = 0x01;
break;
case SCS_25M :
cpuSysClk = SCS_25M;
WTST = 0x00;
CKCON = 0x01;
break;
}
}
else
{
memShadow = 0;
/* for real chip */
switch (CSREPR & (BIT6|BIT7))
{
case SCS_100M :
cpuSysClk = SCS_100M;
WTST = 0x07;
CKCON = 0x01;
break;
case SCS_50M :
cpuSysClk = SCS_50M;
WTST = 0x03;
CKCON = 0x01;
break;
case SCS_25M :
cpuSysClk = SCS_25M;
WTST = 0x01;
CKCON = 0x01;
break;
}
}
progWtst = WTST & 0x07;
dataStretch = CKCON & 0x07;
PCON &= ~SWB_; // Turn off switchback function.
EIF &= ~INT5F; // Clear the flag of interrupt 5.
EIF &= ~INT6F; // Clear the flag of interrupt 6.
if (WTRF)
{
CSREPR |= SW_RST;
WTRF = 0; // Clear Watch Dog Time Out Reset Flag.
}
PINT2 = 1; // INT2 priority is at high level for DMA request.
EXTINT0(OFF); // EINT0 interrupt.
EXTINT1(OFF); // EINT1 interrupt.
EXTINT2(OFF); // EINT2 interrupt for DMA request.
EXTINT3(OFF); // EINT3 interrupt for PCA.
EXTINT4(OFF); // EINT4 interrupt for peripheral device.
EXTINT5(OFF); // EINT5 interrupt for software timer.
EXTINT6(OFF); // EINT6 interrupt for wake-up of power management mode and stop mode.
if (globeInt & BIT7)
EA = globeInt & BIT0;
else
EA = 1; // Enable the globe interrupt.
}
unsigned char AX11000_GetSysClk(void)
{
return cpuSysClk;
}
unsigned char AX11000_GetMemSdw(void)
{
return memShadow;
}
unsigned char AX11000_GetProgWst(void)
{
return progWtst;
}
unsigned char AX11000_GetDataSth(void)
{
return dataStretch;
}
void AX11000_SoftReset(void)
{
if (EA)
globeInt = BIT0 | BIT7; // BIT0:EA bit record ; BIT7:Software reset record.
else
globeInt = BIT7;
EA = 0;
CSREPR |= SW_RST;
}
void AX11000_SoftReboot(void)
{
CSREPR |= SW_RBT;
}
void AX11000_WatchDogSetting(unsigned char wdIntrEnb, unsigned char wdRstEnb, unsigned char wdPrty, unsigned char wdTime)
{
CKCON |= wdTime;
if (wdIntrEnb & WD_INTR_ENABLE)
{
EWDI = 1;
}
else
{
EWDI = 0;
}
if (wdRstEnb & WD_RESET_ENABLE)
{
TA = 0xAA;
TA = 0x55;
EWT = 1;
}
else
{
TA = 0xAA;
TA = 0x55;
EWT = 0;
}
if (wdPrty & WD_HIGH_PRIORITY)
{
PWDI = 1;
}
else
{
PWDI = 0;
}
TA = 0xAA;
TA = 0x55;
RWT = 1;
WTRF = 0;
WDIF = 0;
}

View file

@ -0,0 +1,61 @@
#ifndef AX11000_H
#define AX11000_H
#define GET_SYS_VALUE 1 // 1:get the system globe value information
#define AX_SWRST_ENB 0 // 1:use software reset function ; 0:not use
#define AX_SWRBT_ENB 0 // 1:use software reboot function ; 0:not use
#define STOE_ENABLE 0
#define AX_WATCHDOG_ENB 0 // 1:involve watchdog function ; 0:not use
/*-------------------------------------------------------------*/
#define RUNTIME_CODE_START_AT_0H 0 /* 0: runtime code start at 0h */
#define RUNTIME_CODE_START_AT_24kH 1 /* 1: runtime code start at 24kh. */
#define RUNTIME_CODE_START_ADDRESS (RUNTIME_CODE_START_AT_0H)
/* MACRO DECLARATIONS */
#define AX_DBG_LED(value) {P1 = value;} // debug LED port, default is P1
/* NAMING CONSTANT DECLARATIONS */
#define PROG_WTST_0 0
#define PROG_WTST_1 1
#define PROG_WTST_2 2
#define PROG_WTST_3 3
#define PROG_WTST_4 4
#define PROG_WTST_5 5
#define PROG_WTST_6 6
#define PROG_WTST_7 7
#define DATA_STRETCH_0 0
#define DATA_STRETCH_1 1
#define DATA_STRETCH_2 2
#define DATA_STRETCH_3 3
#define DATA_STRETCH_4 4
#define DATA_STRETCH_5 5
#define DATA_STRETCH_6 6
#define DATA_STRETCH_7 7
#define SHADOW_MEM_ENB 0x10
#define SYS_CLK_100M 0xC0
#define SYS_CLK_50M 0x40
#define SYS_CLK_25M 0x00
#define WD_INTR_ENABLE 1
#define WD_INTR_DISABLE 0
#define WD_RESET_ENABLE 1
#define WD_RESET_DISABLE 0
#define WD_HIGH_PRIORITY 1
#define WD_LOW_PRIORITY 0
#define WD_INTERVAL_131K 0x00
#define WD_INTERVAL_1M WD0_
#define WD_INTERVAL_8M WD1_
#define WD_INTERVAL_67M WD1_|WD0_
void AX11000_Init(void);
unsigned char AX11000_GetSysClk(void);
unsigned char AX11000_GetMemSdw(void);
unsigned char AX11000_GetProgWst(void);
unsigned char AX11000_GetDataSth(void);
void AX11000_SoftReset(void);
void AX11000_SoftReboot(void);
void AX11000_WatchDogSetting(unsigned char wdIntrEnb, unsigned char wdRstEnb, unsigned char wdPrty, unsigned char wdTime);
#endif /* End of AX11000_H */

View file

@ -0,0 +1,188 @@
#include "ax110xx.h"
#include "cpu_ax110xx.h"
#include "interrupt_ax110xx.h"
#include "types_ax110xx.h"
#if LBI_IRQ_ENABLE
#include "lbi.h"
#endif
#if ETH_IRQ_ENABLE
#include "ethernet/mac.h"
#include "ethernet/stoe.h"
#endif
#if I2C_IRQ_ENABLE
#include "i2c.h"
#endif
#if SPI_IRQ_ENABLE
#include "spi.h"
#endif
#if ONEWIRE_IRQ_ENABLE
#include "onewire.h"
#endif
#if CAN_IRQ_ENABLE
#include "can.h"
#endif
#if HSUART_IRQ_ENABLE
#include "hsuart.h"
#endif
void ax11000_PeripherialISR(void) __interrupt 9;
#if POWER_MANAGEMENT_IRQ_ENABLE
void ax11000_PmmISR(void);
#endif
#if WATCHDOG_IRQ_ENB
void ax11000_WatchDogISR(void);
#endif
void ax11000_PeripherialISR(void) __interrupt 9
{
unsigned int intrStt1 = 0;
unsigned int intrStt2 = 0;
/* Interrupt type check */
while (1)
{
EA = 0;
intrStt1 = PISSR1;
intrStt2 = PISSR2;
EA = 1;
if ((intrStt1 == 0) && (intrStt2 == 0))
break;
#if LBI_IRQ_ENABLE
if (intrStt1 & LB_INT_STU)
{
LocalBusFunc();
}
if (intrStt1 & LB_EXT_INT_STU)
{
LocalBusAccessCompleteFunc();
}
#endif
#if ETH_IRQ_ENABLE
#if (MAC_GET_INTSTATUS_MODE == MAC_INTERRUPT_MODE)
if (intrStt1 & ETH_INT_STU)
{
MAC_SetInterruptFlag();
}
#endif
#endif
#if ETH_IRQ_ENABLE
#if (STOE_GET_INTSTATUS_MODE == STOE_INTERRUPT_MODE)
if (intrStt1 & TOE_INT_STU)
{
STOE_SetInterruptFlag();
}
#endif
#endif
#if CAN_IRQ_ENABLE
if (intrStt1 & CAN_INT_STU)
{
CAN_Func();
}
#endif
#if I2C_IRQ_ENABLE
if (intrStt1 & I2C_INT_STU)
{
I2C_Func();
}
#endif
#if SPI_IRQ_ENABLE
if (intrStt1 & SPI_INT_STU)
{
SPI_Func();
}
#endif
#if ONEWIRE_IRQ_ENABLE
if (intrStt1 & OW_INT_STU)
{
ONEWIRE_Func();
}
#endif
#if HSUART_IRQ_ENABLE
if (intrStt2 & UART2_INT_STU)
{
HSUR_Func();
}
#endif
}
}
#if POWER_MANAGEMENT_IRQ_ENABLE
void ax11000_PmmISR(void) __interrupt 11
{
unsigned int wakeStatus = 0;
unsigned int mode = 0;
unsigned int sysClk = 0;
unsigned int canReg = 0;
unsigned int intEnb = 0;
EA = 0;
EIF &= ~INT6F; // Clear the flag of interrupt 6.
EA = 1;
wakeStatus = PCON;
if (!(wakeStatus & SWB_))
{
PCON &= ~ (PMM_ | STOP_);
}
#if ETH_IRQ_ENABLE
/* Ethernet wake up function */
/* disable wake up interrupt */
MDR = 0;
MCIR = MAC_STOP_PMM_INT_ENABLE_REG;
/* clear MAC status register */
CLI_MacRd((ULONG)MAC_STOP_PMM_INT_STATUS_REG, &WakeStatus, 1);
STOE_Standby = 0;
#endif
#if CAN_IRQ_ENABLE
/* CAN wake up function */
CAN_WakeUpEvent(0); // 0 for exit power management mode
#endif
}
#endif
#if WATCHDOG_IRQ_ENB
ax11000_WatchDogISR(void) __interrupt 12
{
if (EWDI)
{
if (EWT)
{
TA = 0xAA;
TA = 0x55;
WDIF = 0; // clear WatchDog Interrupt Flag.
WTRF = 0; // clear the Watchdog Timer Reset Flag.
RWT = 1; // reset watchdog timer.
}
else
{
TA = 0xAA;
TA = 0x55;
WDIF = 0; //clear WatchDog Interrupt Flag.
RWT = 1; // reset watchdog timer.
}
}
}
#endif

View file

@ -0,0 +1,25 @@
#ifndef INTERRUPT_AX110XX_H
#define INTERRUPT_AX110XX_H
#define LBI_IRQ_ENABLE 0 // Local Bus IRQ; 1:On 2:Off
#define ETH_IRQ_ENABLE 0 // Ethernet IRQ; 1:On 2:Off
#define I2C_IRQ_ENABLE 0 // I2C IRQ; 1:On 2:Off
#define SPI_IRQ_ENABLE 0 // SPI IRQ; 1:On 2:Off
#define ONEWIRE_IRQ_ENABLE 0 // OneWire IRQ; 1:On 2:Off
#define CAN_IRQ_ENABLE 0 // CAN IRQ; 1:On 2:Off
#define HSUART_IRQ_ENABLE 0 // HS-Uart IRQ; 1:On 2:Off
#define BOOTLDR_IRQ 0 // Bootloader Source Code; 1:On 2:Off
#define POWER_MANAGEMENT_IRQ_ENABLE 0 // Power Management Wake-Up IRQ; 1:On 2:Off
#define WATCHDOG_IRQ_ENABLE 0 // Watchdog IRQ; 1:On 2:Off
#define ON 1
#define OFF 0
#define EXTINT0(val) {EX0 = val;}
#define EXTINT1(val) {EX1 = val;}
#define EXTINT2(val) {EINT2 = val;}
#define EXTINT3(val) {EINT3 = val;}
#define EXTINT4(val) {EINT4 = val;}
#define EXTINT5(val) {EINT5 = val;}
#define EXTINT6(val) {EINT6 = val;}
#endif

View file

@ -0,0 +1,162 @@
#include <8052.h>
#include "ax110xx.h"
#include "interrupt_ax110xx.h"
#include "cpu_ax110xx.h"
#include "types_ax110xx.h"
#include "uart/uart.h"
#define ERASE_EVENT 1
#define WRITE_EVENT 2
#define READ_EVENT 3
extern void ax11000_PeripherialISR(void) __interrupt 9;
#if UART0_ENABLE
extern void uart0_ISR(void) __interrupt 4 __using 2;
#endif
#if UART1_ENABLE
extern void uart1_ISR(void) __interrupt 6 __using 2;
#endif
volatile unsigned char hi_flag = 1;
volatile unsigned char timer = 0;
volatile unsigned char tstate = 0;
void timer0_irq_proc(void) __interrupt 1 using 2
{
timer++;
if (timer == 0)
{
tstate = 1;
}
switch(tstate)
{
case 1:
case 16:
P1_0 = 0;
break;
case 8:
case 24:
P1_0 = 1;
break;
default: break;
}
if(tstate)
tstate++;
TR0 = 0; /* Stop Timer 0 counting */
TH0 = 0x00;
TL0 = 0x00;
TR0 = 1; /* Start counting again */
}
void pause(unsigned char len)
{
unsigned char a;
unsigned int b;
a=len;
b=0xFFFF;
while(a--)
{
while(b--)
{
__asm
nop
__endasm;
}
}
}
unsigned char _sdcc_external_startup()
{
return 0;
}
void putstring(char *string)
{
unsigned char sc;
sc = 0;
while(string[sc] != 0)
putchar(string[sc++]);
}
const char hval[16] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' };
void putHexB(unsigned char b)
{
putchar(hval[b>>4]);
putchar(hval[b&0x0F]);
}
void putHexW(unsigned int w)
{
putHexB(w>>8);
putHexB(w&0xFF);
}
void putHexD(unsigned long d)
{
putHexW(d>>16);
putHexW(d&0xFFFF);
}
void main(void)
{
AX11000_Init();
switch (CSREPR & (BIT6|BIT7))
{
case SCS_100M :
goto three;
break;
case SCS_50M :
goto two;
break;
case SCS_25M :
goto one;
break;
}
goto none;
three:
P1 = 0x00;
pause(0x07);
P1 = 0xFF;
pause(0x07);
two:
P1 = 0x00;
pause(0x07);
P1 = 0xFF;
pause(0x07);
one:
P1 = 0x00;
pause(0x07);
P1 = 0xFF;
none:
TCON = 0; /* timer control register, byte operation */
TH0 = 0x00;
TL0 = 0x00;
TR0 = 1; /* start timer0 */
ET0 = 1; /* Enable Timer 0 overflow interrupt IE.1 */
TI = 0; /* clear this out */
UART_SetPort(0);
TMOD = (TMOD & 0xF0) | 0x01; /* timer control mode, byte operation */
EA = 1; /* Enable Interrupts */
while (1)
{
pause(0x0F);
putstring("Hello World!\n\r");
}
}

View file

@ -0,0 +1,162 @@
#include <8052.h>
#include "ax110xx.h"
#include "interrupt_ax110xx.h"
#include "cpu_ax110xx.h"
#include "types_ax110xx.h"
#include "uart/uart.h"
#define ERASE_EVENT 1
#define WRITE_EVENT 2
#define READ_EVENT 3
extern void ax11000_PeripherialISR(void) __interrupt 9;
#if UART0_ENABLE
extern void uart0_ISR(void) __interrupt 4 __using 2;
#endif
#if UART1_ENABLE
extern void uart1_ISR(void) __interrupt 6 __using 2;
#endif
volatile unsigned char hi_flag = 1;
volatile unsigned char timer = 0;
volatile unsigned char tstate = 0;
void timer0_irq_proc(void) __interrupt 1 using 2
{
timer++;
if (timer == 0)
{
tstate = 1;
}
switch(tstate)
{
case 1:
case 16:
P1_0 = 0;
break;
case 8:
case 24:
P1_0 = 1;
break;
default: break;
}
if(tstate)
tstate++;
TR0 = 0; /* Stop Timer 0 counting */
TH0 = 0x00;
TL0 = 0x00;
TR0 = 1; /* Start counting again */
}
void pause(unsigned char len)
{
unsigned char a;
unsigned int b;
a=len;
b=0xFFFF;
while(a--)
{
while(b--)
{
__asm
nop
__endasm;
}
}
}
unsigned char _sdcc_external_startup()
{
return 0;
}
void putstring(char *string)
{
unsigned char sc;
sc = 0;
while(string[sc] != 0)
putchar(string[sc++]);
}
const char hval[16] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' };
void putHexB(unsigned char b)
{
putchar(hval[b>>4]);
putchar(hval[b&0x0F]);
}
void putHexW(unsigned int w)
{
putHexB(w>>8);
putHexB(w&0xFF);
}
void putHexD(unsigned long d)
{
putHexW(d>>16);
putHexW(d&0xFFFF);
}
void main(void)
{
AX11000_Init();
switch (CSREPR & (BIT6|BIT7))
{
case SCS_100M :
goto three;
break;
case SCS_50M :
goto two;
break;
case SCS_25M :
goto one;
break;
}
goto none;
three:
P1 = 0x00;
pause(0x07);
P1 = 0xFF;
pause(0x07);
two:
P1 = 0x00;
pause(0x07);
P1 = 0xFF;
pause(0x07);
one:
P1 = 0x00;
pause(0x07);
P1 = 0xFF;
none:
TCON = 0; /* timer control register, byte operation */
TH0 = 0x00;
TL0 = 0x00;
TR0 = 1; /* start timer0 */
ET0 = 1; /* Enable Timer 0 overflow interrupt IE.1 */
TI = 0; /* clear this out */
UART_SetPort(0);
TMOD = (TMOD & 0xF0) | 0x01; /* timer control mode, byte operation */
EA = 1; /* Enable Interrupts */
while (1)
{
pause(0x0F);
putstring("Hello betty World!\n\r");
}
}

View file

@ -0,0 +1,88 @@
/*
*********************************************************************************
* Copyright (c) 2005 ASIX Electronic Corporation All rights reserved.
*
* This is unpublished proprietary source code of ASIX Electronic Corporation
*
* The copyright notice above does not evidence any actual or intended
* publication of such source code.
*********************************************************************************
*/
/*================================================================================
* Module Name : types.h
* Purpose : Definition of type.
* Author : Robin Lee
* Date : 2005-12-28
* Notes : None.
* $Log: types.h,v $
* Revision 1.1 2006/04/07 11:36:17 robin6633
* no message
*
*================================================================================
*/
#ifndef TYPES_H
#define TYPES_H
#ifndef NULL
#define NULL ((void *) 0L)
#endif
typedef unsigned short int BOOL;
#define TRUE 1
#define FALSE 0
/* Bit Definitions for Bitwise Operation */
#define BIT0 0x00000001
#define BIT1 0x00000002
#define BIT2 0x00000004
#define BIT3 0x00000008
#define BIT4 0x00000010
#define BIT5 0x00000020
#define BIT6 0x00000040
#define BIT7 0x00000080
#define BIT8 0x00000100
#define BIT9 0x00000200
#define BIT10 0x00000400
#define BIT11 0x00000800
#define BIT12 0x00001000
#define BIT13 0x00002000
#define BIT14 0x00004000
#define BIT15 0x00008000
#define BIT16 0x00010000
#define BIT17 0x00020000
#define BIT18 0x00040000
#define BIT19 0x00080000
#define BIT20 0x00100000
#define BIT21 0x00200000
#define BIT22 0x00400000
#define BIT23 0x00800000
#define BIT24 0x01000000
#define BIT25 0x02000000
#define BIT26 0x04000000
#define BIT27 0x08000000
#define BIT28 0x10000000
#define BIT29 0x20000000
#define BIT30 0x40000000
#define BIT31 0x80000000
#define LOW_BYTE(word) (unsigned char)(word & 0x00FF)
#define HIGH_BYTE(word) (unsigned char)((word & 0xFF00) >> 8)
/* Keil compiler user define */
#define XDATA xdata
#define IDATA idata
#define BDATA bdata
#define CODE code
#define FAR far
/* Serial interface command direction */
#define SI_WR BIT0
#define SI_RD BIT1
#define FLASH_WR_ENB (PCON |= PWE_)
#define FLASH_WR_DISB (PCON &= ~PWE_)
#endif /* end of TYPES_H */

View file

@ -0,0 +1,821 @@
/*
*********************************************************************************
* Copyright (c) 2005 ASIX Electronic Corporation All rights reserved.
*
* This is unpublished proprietary source code of ASIX Electronic Corporation
*
* The copyright notice above does not evidence any actual or intended
* publication of such source code.
*********************************************************************************
*/
/*================================================================================
* Module Name : uart.c
* Purpose : The UART module driver. It manages the character
* buffer and handles the ISR. This driver includes UART0 and UART1.
* Author : Robin Lee
* Date : 2006-01-10
* Notes : None.
* $Log: uart.c,v $
* Revision 1.1 2006/04/07 11:39:14 robin6633
* no message
*
*================================================================================
*/
/* INCLUDE FILE DECLARATIONS */
#include "../ax110xx.h"
#include "uart.h"
#if HSUR_ENABLE
#include "hsuart.h"
#endif
/* STATIC VARIABLE DECLARATIONS */
#if UART0_ENABLE
static unsigned char uart0_TxBuf[MAX_TX_UART0_BUF_SIZE];
static unsigned int uart0_TxHead = 0;
static unsigned int uart0_TxTail = 0;
static unsigned int uart0_TxCount = 0;
static unsigned char uart0_TxFlag = 0;
static unsigned char uart0_RxBuf[MAX_RX_UART0_BUF_SIZE];
static unsigned int uart0_RxHead = 0;
static unsigned int uart0_RxTail = 0;
static unsigned char uart0_Mode = 0;
unsigned int uart0_RxCount = 0;
#endif
#if UART1_ENABLE
static unsigned char uart1_TxBuf[MAX_TX_UART1_BUF_SIZE];
static unsigned int uart1_TxHead = 0;
static unsigned int uart1_TxTail = 0;
static unsigned int uart1_TxCount = 0;
static unsigned char uart1_TxFlag = 0;
static unsigned char uart1_RxBuf[MAX_RX_UART1_BUF_SIZE];
static unsigned int uart1_RxHead = 0;
static unsigned int uart1_RxTail = 0;
static unsigned char uart1_Mode = 0;
unsigned int uart1_RxCount = 0;
#endif
static unsigned char uartPort = 0;
/* LOCAL SUBPROGRAM DECLARATIONS */
#if UART0_ENABLE
//void uart0_ISR(void);
static void uart0_Init(void);
static signed char uart0_PutChar(signed char c);
static signed char uart0_GetKey(void);
static signed char UART0_NoBlockGetkey(void);
#endif
#if UART1_ENABLE
//void uart1_ISR(void);
static void uart1_Init(void);
static signed char uart1_PutChar(signed char c);
static signed char uart1_GetKey(void);
static signed char uart1_NoBlockGetkey(void);
#endif
/* LOCAL SUBPROGRAM BODIES */
#if UART0_ENABLE
/*
* ----------------------------------------------------------------------------
* static void UART0_ISR(void)
* Purpose : UART0 interrupt service routine. For sending out, it puts data
* from software buffer into hardware serial buffer register (SBUF0).
* For receiving, it gets data from hardware serial buffer register
* (SBUF0) and stores into software buffer.
* Params : none
* Returns : none
* Note : none
* ----------------------------------------------------------------------------
*/
void uart0_ISR(void) __interrupt 4 __using 2
{
unsigned char parity = 0;
if (RI0)
{
EA = 0;
if (uart0_RxCount != MAX_RX_UART0_BUF_SIZE)
{
uart0_RxBuf[uart0_RxHead] = SBUF0;
if (uart0_Mode & BIT1)
{
parity = UART_ParityChk((unsigned char)uart0_RxBuf[uart0_RxHead]);
if (RB08 != parity)
P3 = 0xE7;
}
uart0_RxCount++;
uart0_RxHead++;
uart0_RxHead &= MAX_RX_UART0_MASK;
}
RI0 = 0;
EA = 1;
} /* End of if(RI0) */
if (TI0)
{
EA = 0;
uart0_TxTail++;
uart0_TxTail &= MAX_TX_UART0_MASK;
uart0_TxCount--;
if (uart0_TxCount > 0)
{
SBUF0 = uart0_TxBuf[uart0_TxTail];
if (uart0_Mode & BIT1)
{
parity = UART_ParityChk((unsigned char)uart0_TxBuf[uart0_TxTail]);
if (parity)
TB08 = 1;
else
TB08 = 0;
}
}
else
uart0_TxFlag = 0;
TI0 = 0;
EA = 1;
} /* End of if(TI0) */
} /* End of UART_Int */
/*
* ----------------------------------------------------------------------------
* static void uart0_Init(void)
* Purpose : Setting operation mode of UART0 and initiating the global values.
* Params : none
* Returns : none
* Note : none
* ----------------------------------------------------------------------------
*/
static void uart0_Init(void)
{
unsigned char sysClk = 0;
unsigned int i;
uart0_TxHead = 0;
uart0_TxTail = 0;
uart0_TxCount = 0;
uart0_TxFlag = 0;
uart0_RxHead = 0;
uart0_RxTail = 0;
uart0_RxCount = 0;
for (i=0 ; i<MAX_TX_UART0_BUF_SIZE ; i++)
uart0_TxBuf[i] = 0;
for (i=0 ; i<MAX_RX_UART0_BUF_SIZE ; i++)
uart0_RxBuf[i] = 0;
// Initialize TIMER1 for standard 8051 UART clock
PCON = 0x80; // Disable BaudRate doubler.
SM01 = 1; // Use serial port 0 in mode 1 with 8-bits data.
REN0 = 1; // Enable UART0 receiver.
TMOD = 0x20; // Use timer 1 in mode 2, 8-bit counter with auto-reload.
uart0_Mode = 1;
sysClk = CSREPR & 0xC0;
switch (sysClk)
{
case SCS_100M :
TH1 = 0xE4; // Baud rate = 9600 @ 100MHz.
break;
case SCS_50M :
TH1 = 0xF9; // Baud rate = 9600 @ 50MHz.
break;
case SCS_25M :
TH1 = 0xF9; // Baud rate = 9600 @ 25MHz.
break;
default :
TH1 = 0xF9; // Baud rate = 9600 @ 25MHz.
break;
}
ES0 = 1; // Enable serial port Interrupt request
TR1 = 1; // Run Timer 1
TI0 = 0;
} /* End of UART_Init */
/*
* ----------------------------------------------------------------------------
* static signed char uart0_PutChar(signed char c)
* Purpose : UART0 output function. This function puts one byte data into the
* software character buffer.
* Params : c - one byte character.
* Returns : c - one byte character.
* Note : none
* ----------------------------------------------------------------------------
*/
static signed char uart0_PutChar(signed char c)
{
unsigned int count = 0;
if (c == 0xa)
{
do
{
EA = 0;
count = uart0_TxCount;
EA = 1;
} while (count == MAX_TX_UART0_BUF_SIZE);
uart0_TxBuf[uart0_TxHead] = 0xd;
EA = 0;
uart0_TxCount++;
EA = 1;
uart0_TxHead++;
uart0_TxHead &= MAX_TX_UART0_MASK;
}
do
{
EA = 0;
count = uart0_TxCount;
EA = 1;
} while (count == MAX_TX_UART0_BUF_SIZE);
uart0_TxBuf[uart0_TxHead] = c;
EA = 0;
uart0_TxCount++;
EA = 1;
uart0_TxHead++;
uart0_TxHead &= MAX_TX_UART0_MASK;
if (!uart0_TxFlag)
{
uart0_TxFlag = 1;
SBUF0 = uart0_TxBuf[uart0_TxTail];
}
return c;
}
/*
* ----------------------------------------------------------------------------
* static signed char uart0_GetKey(void)
* Purpose : UART0 input function. This function replies one byte data from the
* software character buffer.
* Params : none
* Returns : c - one byte character.
* Note : none
* ----------------------------------------------------------------------------
*/
static signed char uart0_GetKey (void)
{
/* NAMING CONSTANT DECLARATIONS */
/* LOCAL VARIABLE DECLARATIONS */
signed char c = 0;
/* BODY */
while(uart0_RxCount == 0);
EA = 0;
uart0_RxCount--;
EA = 1;
c = uart0_RxBuf[uart0_RxTail];
uart0_RxTail++;
uart0_RxTail &= MAX_RX_UART0_MASK;
return c;
}
/*
* ----------------------------------------------------------------------------
* static signed char uart0_NoBlockGetkey(void)
* Purpose : UART0 input function. This function replies one byte data from the
* software character buffer. But it only check the buffer one time.
* If no data, it will reply a FALSE condition.
* Params : none
* Returns : c - one byte character.
* Note : none
* ----------------------------------------------------------------------------
*/
static signed char UART0_NoBlockGetkey (void)
{
char c = 0;
if (uart0_RxCount !=0 )
{
EA = 0;
uart0_RxCount--;
EA = 1;
c = uart0_RxBuf[uart0_RxTail];
uart0_RxTail++;
uart0_RxTail &= MAX_RX_UART0_MASK;
return c;
}
else
{
return FALSE;
}
}
#endif
#if UART1_ENABLE
////////////////////////////////////////////////////////////////////////////////
/*
* ----------------------------------------------------------------------------
* static void UART1_ISR(void)
* Purpose : UART1 interrupt service routine. For sending out, it puts data
* from software buffer into hardware serial buffer register (SBUF1).
* For receiving, it gets data from hardware serial buffer register
* (SBUF1) and stores into software buffer.
* Params : none
* Returns : none
* Note : none
* ----------------------------------------------------------------------------
*/
uart1_ISR(void) __interrupt 6 __using 2
{
unsigned char parity = 0;
if (RI1)
{
EA = 0;
if (uart1_RxCount != MAX_RX_UART1_BUF_SIZE)
{
uart1_RxBuf[uart1_RxHead] = SBUF1;
if (uart1_Mode & BIT1)
{
parity = UART_ParityChk((unsigned char)uart1_RxBuf[uart1_RxHead]);
if (RB18 != parity)
P3 = 0xE7;
}
uart1_RxCount++;
uart1_RxHead++;
uart1_RxHead &= MAX_RX_UART1_MASK;
}
RI1 = 0;
EA = 1;
} /* End of if(RI0) */
if (TI1)
{
EA = 0;
uart1_TxTail++;
uart1_TxTail &= MAX_TX_UART1_MASK;
uart1_TxCount--;
if (uart1_TxCount > 0)
{
SBUF1 = uart1_TxBuf[uart1_TxTail];
if (uart1_Mode & BIT1)
{
parity = UART_ParityChk((unsigned char)uart1_TxBuf[uart1_TxTail]);
if (parity)
TB18 = 1;
else
TB18 = 0;
}
}
else
uart1_TxFlag = 0;
TI1 = 0;
EA = 1;
} /* End of if(TI0) */
}
/*
* ----------------------------------------------------------------------------
* static void uart1_Init(void)
* Purpose : Setting operation mode of UART1 and initiating the global values.
* Params : none
* Returns : none
* Note : none
* ----------------------------------------------------------------------------
*/
static void uart1_Init(void)
{
unsigned char sysClk = 0;
unsigned int i;
uart1_TxHead = 0;
uart1_TxTail = 0;
uart1_TxCount = 0;
uart1_TxFlag = 0;
uart1_RxHead = 0;
uart1_RxTail = 0;
uart1_RxCount = 0;
for (i=0 ; i<MAX_TX_UART1_BUF_SIZE ; i++)
uart1_TxBuf[i] = 0;
for (i=0 ; i<MAX_RX_UART1_BUF_SIZE ; i++)
uart1_RxBuf[i] = 0;
// Initialize TIMER1 for standard 8051 UART clock
PCON = 0; // Disable BaudRate doubler.
SM10 = 0;
SM11 = 1; // Use serial port 1 in mode 1 with 8-bits data.
REN1 = 1; // Enable UART1 receiver.
TMOD = 0x20; // Use timer 1 in mode 2, 8-bit counter with auto-reload.
uart1_Mode = 1;
sysClk = CSREPR & 0xC0;
switch (sysClk)
{
case SCS_100M :
TH1 = 0xE4; // Baud rate = 9600 @ 100MHz.
break;
case SCS_50M :
TH1 = 0xF2; // Baud rate = 9600 @ 50MHz.
break;
case SCS_25M :
TH1 = 0xF9; // Baud rate = 9600 @ 25MHz.
break;
default :
TH1 = 0xF9; // Baud rate = 9600 @ 25MHz.
break;
}
ES1 = 1; // Enable serial port Interrupt request
TR1 = 1; // Run Timer 1
TI1 = 0;
}
/*
* ----------------------------------------------------------------------------
* static signed char uart1_PutChar(signed char c)
* Purpose : UART1 output function. This function puts one byte data into the
* software character buffer.
* Params : c - one byte character.
* Returns : c - one byte character.
* Note : none
* ----------------------------------------------------------------------------
*/
static signed char uart1_PutChar(signed char c)
{
unsigned int count = 0;
if (c == 0xa)
{
do
{
EA = 0;
count = uart1_TxCount;
EA = 1;
} while (count == MAX_TX_UART1_BUF_SIZE);
uart1_TxBuf[uart1_TxHead] = 0xd;
EA = 0;
uart1_TxCount++;
EA = 1;
uart1_TxHead++;
uart1_TxHead &= MAX_TX_UART1_MASK;
}
do
{
EA = 0;
count = uart1_TxCount;
EA = 1;
} while (count == MAX_TX_UART1_BUF_SIZE);
uart1_TxBuf[uart1_TxHead] = c;
EA = 0;
uart1_TxCount++;
EA = 1;
uart1_TxHead++;
uart1_TxHead &= MAX_TX_UART1_MASK;
if (!uart1_TxFlag)
{
uart1_TxFlag = 1;
SBUF1 = uart1_TxBuf[uart1_TxTail];
}
return c;
}
/*
* ----------------------------------------------------------------------------
* static signed char uart1_GetKey(void)
* Purpose : UART1 input function. This function replies one byte data from the
* software character buffer.
* Params : none
* Returns : c - one byte character.
* Note : none
* ----------------------------------------------------------------------------
*/
static signed char uart1_GetKey (void)
{
/* NAMING CONSTANT DECLARATIONS */
/* LOCAL VARIABLE DECLARATIONS */
signed char c;
/* BODY */
while(uart1_RxCount==0);
EA = 0;
uart1_RxCount--;
EA = 1;
c = uart1_RxBuf[uart1_RxTail];
uart1_RxTail++;
uart1_RxTail &= MAX_RX_UART1_MASK;
return c;
}
/*
* ----------------------------------------------------------------------------
* static signed char uart1_NoBlockGetkey(void)
* Purpose : UART1 input function. This function replies one byte data from the
* software character buffer. But it only check the buffer one time.
* If no data, it will reply a FALSE condition.
* Params : none
* Returns : c - one byte character.
* Note : none
* ----------------------------------------------------------------------------
*/
static signed char uart1_NoBlockGetkey (void)
{
char c = 0;
if (uart1_RxCount !=0 )
{
EA = 0;
uart1_RxCount--;
EA = 1;
c = uart1_RxBuf[uart1_RxTail];
uart1_RxTail++;
uart1_RxTail &= MAX_RX_UART1_MASK;
return c;
}
else
{
return FALSE;
}
}
#endif
/* EXPORTED SUBPROGRAM BODIES */
/*
* ----------------------------------------------------------------------------
* signed char _getkey (void)
* Purpose : UART getkey function. This function is the entry of getting
* characters from software buffer of system's UART ports,
* UART0, UART1 and HSUR.
* Params : none
* Returns : ch - one byte character.
* Note : The default UART port is UART0.
* ----------------------------------------------------------------------------
*/
signed char _getkey (void)
{
signed char ch = 0;
switch (uartPort)
{
#if UART0_ENABLE
case 0 :
ch = uart0_GetKey();
break;
#endif
#if UART1_ENABLE
case 1 :
ch = uart1_GetKey();
break;
#endif
#if HSUR_ENABLE
case 2 :
ch = HSUR_GetChar();
break;
#endif
}
return ch;
}
/*
* ----------------------------------------------------------------------------
* signed char putchar(signed char c)
* Purpose : UART putchar function. This function is the entry of putting
* characters into software buffer of system's UART ports,
* UART0, UART1 and HSUR.
* Params : c - one byte character to be put.
* Returns : ch - the same character to be replied.
* Note : The default UART port is UART0.
* ----------------------------------------------------------------------------
*/
signed char putchar(signed char c)
{
signed char ch = 0;
switch (uartPort)
{
#if UART0_ENABLE
case 0 :
ch = uart0_PutChar(c);
break;
#endif
#if UART1_ENABLE
case 1 :
ch = uart1_PutChar(c);
break;
#endif
#if HSUR_ENABLE
case 2 :
ch = HSUR_PutChar(c);
break;
#endif
}
return ch;
}
/*
* ----------------------------------------------------------------------------
* void UART_Init(void)
* Purpose : UART initial function. It will call a real initial function
* corresponding to the used UART port.
* Params : none
* Returns : none
* Note : none
* ----------------------------------------------------------------------------
*/
void UART_Init(void)
{
switch (uartPort)
{
#if UART0_ENABLE
case 0 :
uart0_Init();
break;
#endif
#if UART1_ENABLE
case 1 :
uart1_Init();
break;
#endif
#if HSUR_ENABLE
case 2 :
HSUR_Init();
HSUR_Setup(0x0060, (UR2_CHAR_8|UR2_STOP_10), (UR2_RDI_ENB|UR2_RLSI_ENB),
(UR2_FIFO_MODE|UR2_RXFIFO_RST|UR2_TXFIFO_RST|UR2_TRIG_08), UR2_RTS);
break;
#endif
}
}
/*
* ----------------------------------------------------------------------------
* signed char NOBLK_getkey (void)
* Purpose : UART no blocking getkey function with one checked. This function
* is the entry of getting characters from software buffer of
* system's UART ports, UART0, UART1 and HSUR.
* Params : none
* Returns : ch - one byte character.
* Note : The default UART port is UART0.
* ----------------------------------------------------------------------------
*/
signed char NOBLK_getkey (void)
{
signed char c = 0;
switch (uartPort)
{
#if UART0_ENABLE
case 0 :
c = UART0_NoBlockGetkey();
break;
#endif
#if UART1_ENABLE
case 1 :
c = uart1_NoBlockGetkey();
break;
#endif
}
return c;
}
/*
* ----------------------------------------------------------------------------
* BOOL UART_ParityChk(signed char checkByte)
* Purpose : UART parity checked function in one byte transfer.
* Params : checkByte - one byte character.
* Returns : TRUE - odd parity ; FALSE - even parity.
* Note : none
* ----------------------------------------------------------------------------
*/
BOOL UART_ParityChk(signed char checkByte)
{
unsigned char oneNum = 0;
unsigned int i;
oneNum = 0;
for (i=0 ; i<=7 ; i++)
{
if (checkByte & (BIT0<<i))
{
oneNum ++;
}
}
if ((oneNum % 2) == 0)
return FALSE; // if '1' number is even, return 0
else
return TRUE; // if '1' number is odd, return 1
}
/*
* ----------------------------------------------------------------------------
* void UART0_SetMode(unsigned char mode)
* Purpose : Setting operation mode of UART0.
* Params : mode - operation mode (0~3).
* Returns : none
* Note : none
* ----------------------------------------------------------------------------
*/
#if UART0_ENABLE
void UART0_SetMode(unsigned char mode)
{
uart0_Mode = mode;
}
#endif
/*
* ----------------------------------------------------------------------------
* void UART1_SetMode(unsigned char mode)
* Purpose : Setting operation mode of UART0.
* Params : mode - operation mode (0~3).
* Returns : none
* Note : none
* ----------------------------------------------------------------------------
*/
#if UART1_ENABLE
void UART1_SetMode(unsigned char mode)
{
uart1_Mode = mode;
}
#endif
/*
* ----------------------------------------------------------------------------
* BOOL UART_SetPort(unsigned char portNum)
* Purpose : Setting which UART port will be used.
* Params : portNum - uart port number (0~2).
* Returns : none
* Note : none
* ----------------------------------------------------------------------------
*/
BOOL UART_SetPort(unsigned char portNum)
{
uartPort = portNum & 0x03;
UART_Init();
return TRUE;
}
/*
* ----------------------------------------------------------------------------
* void PMM_Uart0Init(void)
* Purpose : Initiating the UART0 to work in power management mode.
* Params : none
* Returns : none
* Note : none
* ----------------------------------------------------------------------------
*/
#if UART_PMM_ENABLE
void PMM_Uart0Init(void)
{
unsigned int i;
uart0_TxHead = 0;
uart0_TxTail = 0;
uart0_TxCount = 0;
uart0_TxFlag = 0;
uart0_RxHead = 0;
uart0_RxTail = 0;
uart0_RxCount = 0;
for (i=0 ; i<MAX_TX_UART0_BUF_SIZE ; i++)
uart0_TxBuf[i] = 0;
for (i=0 ; i<MAX_RX_UART0_BUF_SIZE ; i++)
uart0_RxBuf[i] = 0;
// Initialize TIMER1 for standard 8051 UART clock
PCON = BIT7; // Enable BaudRate doubler.
SM01 = 1; // Use serial port 0 in mode 1 with 8-bits data.
REN0 = 1; // Enable UART0 receiver.
TMOD = 0x20; // Use timer 1 in mode 2, 8-bit counter with auto-reload.
TH1 = 0xFE; // Baud rate = 1200 @ 25MHz.
ES0 = 1; // Enable serial port Interrupt request
TR1 = 1; // Run Timer 1
TI0 = 0;
}
#endif
/* End of uart.c */

View file

@ -0,0 +1,74 @@
/*
******************************************************************************
* Copyright (c) 2005 ASIX Electronic Corporation All rights reserved.
*
* This is unpublished proprietary source code of ASIX Electronic Corporation
*
* The copyright notice above does not evidence any actual or intended
* publication of such source code.
******************************************************************************
*/
/*================================================================================
* Module Name : uart.h
* Purpose : A header file of uart.c includes UART0 and UART1 module.
* Author : Robin Lee
* Date : 2006-01-10
* Notes :
* $Log: uart.h,v $
* Revision 1.1 2006/04/07 11:39:14 robin6633
* no message
*
*================================================================================
*/
#ifndef __UART_H__
#define __UART_H__
#include "../types_ax110xx.h"
#define UART0_ENABLE 1 // 1:enable UART0 ; 0:disable UART0
#define UART1_ENABLE 0 // 1:enable UART1 ; 0:disable UART1
#define HSUR_ENABLE 0 // 1:enable Hihg Speed UART ; 0:disable Hihg Speed UART
#define UART_PMM_ENABLE 0 // 1:use UART in PMM mode ; 0:disable
/* NAMING CONSTANT DECLARATIONS */
#if UART0_ENABLE
#define MAX_TX_UART0_BUF_SIZE 512
#define MAX_TX_UART0_MASK (MAX_TX_UART0_BUF_SIZE - 1)
#define MAX_RX_UART0_BUF_SIZE 512
#define MAX_RX_UART0_MASK (MAX_RX_UART0_BUF_SIZE - 1)
#endif
#if UART1_ENABLE
#define MAX_TX_UART1_BUF_SIZE 512
#define MAX_TX_UART1_MASK (MAX_TX_UART1_BUF_SIZE - 1)
#define MAX_RX_UART1_BUF_SIZE 512
#define MAX_RX_UART1_MASK (MAX_RX_UART1_BUF_SIZE - 1)
#endif
/* GLOBAL VARIABLES */
#if UART0_ENABLE
extern unsigned int uart0_RxCount;
#endif
#if UART1_ENABLE
extern unsigned int uart1_RxCount;
#endif
/* EXPORTED SUBPROGRAM SPECIFICATIONS */
void UART_Init(void);
signed char putchar(signed char);
signed char _getkey(void);
signed char NOBLK_getkey(void);
BOOL UART_ParityChk(signed char checkbyte);
void UART0_SetMode(unsigned char mode);
void UART1_SetMode(unsigned char mode);
BOOL UART_SetPort(unsigned char portNum);
void PMM_Uart0Init(void);
#endif /* End of __UART_H__ */
/* End of uart.h */

2
Asixtool/sdcc/README Normal file
View file

@ -0,0 +1,2 @@
See https://sourceforge.net/projects/sdcc/forums/forum/1864/topic/1881955

103
Asixtool/sdcc/ax110xx.patch Normal file
View file

@ -0,0 +1,103 @@
diff -crB sdcc/ChangeLog sdcc-asix/ChangeLog
*** sdcc/ChangeLog 2007-11-17 20:23:59.000000000 +0100
--- sdcc-asix/ChangeLog 2007-11-30 05:16:07.136379144 +0100
***************
*** 1,3 ****
--- 1,8 ----
+ 2007-11-30 Christian Klippel <ck AT mamalala.net>
+
+ * src/ds390/main.c: added ax110xx target to ds390 (option --use-asix)
+ * src/SDCCglobl.h: added ax110xx target to ds390 (option --use-asix)
+
2007-11-17 Raphael Neider <rneider AT web.de>
* src/pic/main.c (_asmCmd): include debug arguments (-g as $3)
diff -crB sdcc/src/ds390/main.c sdcc-asix/src/ds390/main.c
*** sdcc/src/ds390/main.c 2007-06-18 20:24:42.000000000 +0200
--- sdcc-asix/src/ds390/main.c 2007-11-30 05:12:58.453530081 +0100
***************
*** 21,26 ****
--- 21,27 ----
#define OPTION_STACK_8BIT "--stack-8bit"
#define OPTION_FLAT24_MODEL "--model-flat24"
#define OPTION_STACK_SIZE "--stack-size"
+ #define OPTION_USE_ASIX "--use-asix"
static OPTION _ds390_options[] =
{
***************
*** 33,38 ****
--- 34,40 ----
{ 0, "--use-accelerator", &options.useAccelerator, "generate code for ds390 arithmetic accelerator"},
{ 0, "--protect-sp-update", &options.protect_sp_update, "will disable interrupts during ESP:SP updates"},
{ 0, "--parms-in-bank1", &options.parms_in_bank1, "use Bank1 for parameter passing"},
+ { 0, OPTION_USE_ASIX, &options.use_asix, "generate code for the asix chip" },
{ 0, NULL }
};
***************
*** 253,258 ****
--- 255,265 ----
fputs ("ma\t=\t0xD3\n", of);
fputs ("mb\t=\t0xD4\n", of);
fputs ("mc\t=\t0xD5\n", of);
+ if(options.use_asix)
+ {
+ fputs ("ta\t=\t0xEB\n", of);
+ fputs ("acon\t=\t0x9D\n", of);
+ }
fputs ("F1\t=\t0xD1\t; user flag\n", of);
if (options.parms_in_bank1) {
int i ;
***************
*** 290,295 ****
--- 297,311 ----
return TRUE;
}
+ if(options.use_asix)
+ {
+ fprintf (stderr,
+ "*** warning: targeting for asix\n");
+ dbuf_printf (oBuf, ".flat24 off\n");
+ dbuf_printf (oBuf, "\tljmp\t__reset_vect\n");
+ dbuf_printf (oBuf, ".flat24 on\n");
+ }
+ else
dbuf_printf (oBuf, "\tajmp\t__reset_vect\n");
/* now for the other interrupts */
***************
*** 305,310 ****
--- 321,336 ----
}
}
+ if(options.use_asix)
+ {
+ dbuf_printf (oBuf, ".flat24 off\n");
+ dbuf_printf (oBuf, "__reset_vect:\n");
+ dbuf_printf (oBuf, "\tmov ta,#0xAA\n");
+ dbuf_printf (oBuf, "\tmov ta,#0x55\n");
+ dbuf_printf (oBuf, "\tmov acon,#0x02\n");
+ dbuf_printf (oBuf, ".flat24 on\n");
+ }
+ else
dbuf_printf (oBuf, "__reset_vect:\n\tljmp\t__sdcc_gsinit_startup\n");
return TRUE;
diff -crB sdcc/src/SDCCglobl.h sdcc-asix/src/SDCCglobl.h
*** sdcc/src/SDCCglobl.h 2007-07-27 22:23:22.000000000 +0200
--- sdcc-asix/src/SDCCglobl.h 2007-11-30 05:06:54.000000000 +0100
***************
*** 291,296 ****
--- 291,297 ----
int unsigned_char; /* use unsigned for char without signed/unsigned modifier */
char *code_seg; /* segment name to use instead of CSEG */
char *const_seg; /* segment name to use instead of CONST */
+ bool use_asix; /* since xram_size=0 is a possibility */
/* sets */
set *calleeSavesSet; /* list of functions using callee save */
set *excludeRegsSet; /* registers excluded from saving */

View file

@ -0,0 +1,37 @@
###############################################################
#####
##### Makefile for asixtool
#####
###############################################################
###############################################################
#####
##### PATHS (default installation)
#####
###############################################################
INSTALLDIR_BIN=/usr/local/bin
-include Makefile.local
BASE = D:\Programmieren\Cygwin
INCLUDEPATH = $(BASE)\usr\include
##LIBPATH = $(BASE)\lib\gcc\i686-pc-cygwin\3.4.4\include
###############################################################
#####
##### Do the whole shabang
#####
###############################################################
all: asixtool
asixtool: asix_serial.c asix_serial.h bootcom.c bootcom.h infohelper.h infohelper.c main.c
$(BASE)/bin/gcc.exe -Os -Wall asix_serial.c bootcom.c infohelper.c main.c -o asixtool
strip asixtool
clean:
$(RM) *.o *~ asixtool
### EOF

674
Asixtool/trunk/LICENSE Normal file
View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

33
Asixtool/trunk/Makefile Normal file
View file

@ -0,0 +1,33 @@
###############################################################
#####
##### Makefile for asixtool
#####
###############################################################
###############################################################
#####
##### PATHS (default installation)
#####
###############################################################
INSTALLDIR_BIN=/usr/local/bin
-include Makefile.local
###############################################################
#####
##### Do the whole shabang
#####
###############################################################
all: asixtool
asixtool: asix_serial.c asix_serial.h bootcom.c bootcom.h infohelper.h infohelper.c main.c
gcc -Os -Wall asix_serial.c bootcom.c infohelper.c main.c -o asixtool
strip asixtool
clean:
$(RM) *.o *~ asixtool
### EOF

View file

@ -0,0 +1,237 @@
/*
asix-serial.c - serial port routines (host) to access the asix chip
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "asix_serial.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <termios.h>
#include <errno.h>
#include "infohelper.h"
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
static int serialDev = -1;
static struct termios term;
void setBaud(unsigned int baud)
{
// change baudrate
switch(baud)
{
case 921600:
cfsetispeed(&term,B921600);
cfsetospeed(&term,B921600);
break;
default:
cfsetispeed(&term,B115200);
cfsetospeed(&term,B115200);
break;
}
}
void setFlow(unsigned char flow)
{
if(flow == 0)
{
term.c_iflag&=~(IXON|IXOFF|IXANY|INLCR|ICRNL);
}
else
{
term.c_iflag&=~(INLCR|ICRNL|IXANY);
term.c_iflag|=(IXON|IXOFF);
}
}
void setTimeout(unsigned int tout)
{
term.c_cc[VMIN]=0;
term.c_cc[VTIME]=tout; // 10 seconds timeout
}
int openSerial(char *dev, unsigned int speed)
{
serialDev=open(dev,O_RDWR);
if(serialDev<0) {
printf("cannot acces %s\n",dev);
return serialDev;
}
setDTR(0);
setRTS(0);
tcgetattr(serialDev,&term);
setBaud(speed);
term.c_cflag = (term.c_cflag & ~CSIZE) | CS8 | PARENB;
term.c_cflag |= CLOCAL | CREAD;
term.c_cflag &= ~CSTOPB;
term.c_iflag=IGNBRK;
term.c_iflag |= IXON | IXOFF;
term.c_lflag=0;
term.c_oflag=0;
setTimeout(2);
setFlow(0);
if (tcsetattr(serialDev, TCSANOW, &term)!=0)
return printError("setattr stage 1 failed");
if (tcgetattr(serialDev, &term)!=0)
return printError("getattr failed");
term.c_cflag &= ~CRTSCTS;
if (tcsetattr(serialDev, TCSANOW, &term)!=0)
return printError("setattr stage 2 failed");
return serialDev;
}
int closeSerial(void)
{
if(serialDev)
{
tcflush(serialDev, TCIOFLUSH);
close(serialDev);
return 0;
}
else
return serialDev;
}
int reconfSerial(unsigned int baud, unsigned char flow, unsigned char tout)
{
if(serialDev > 0)
{
setBaud(baud);
setFlow(flow);
setTimeout(tout);
return tcsetattr(serialDev,TCSANOW,&term);
}
else
return serialDev;
}
#define XFERSIZE 16
int sendBuf(unsigned int len, char *buf)
{
unsigned int boff;
int ret;
if(serialDev > 0)
{
boff = 0;
while (boff < len)
{
ret = write (serialDev, buf+boff, MIN (len - boff, XFERSIZE));
if (ret < 0 && errno != EAGAIN)
{
perror ("error writing to serial port");
return 0;
}
boff += ret;
}
return boff;
}
return 0;
}
int sendBufE(unsigned int len, char *buf)
{
return(getBuf(sendBuf(len,buf), buf));
}
int getBuf(unsigned int len, char *buf)
{
unsigned int boff;
int ret;
if(serialDev > 0)
{
boff = 0;
ret = read (serialDev, buf+boff, MIN (len - boff, XFERSIZE));
if (ret < 0 && errno != EAGAIN)
{
perror ("error reading from serial port");
return 0;
}
boff += ret;
return boff;
}
return 0;
}
void setDTR(unsigned char val)
{
int mcs;
if(serialDev)
{
ioctl (serialDev, TIOCMGET, &mcs);
if(val)
{
mcs |= TIOCM_DTR;
ioctl (serialDev, TIOCMSET, &mcs);
}
else
{
mcs &= ~TIOCM_DTR;
ioctl (serialDev, TIOCMSET, &mcs);
}
}
}
void setRTS(unsigned char val)
{
int mcs;
if(serialDev)
{
ioctl (serialDev, TIOCMGET, &mcs);
if(val)
{
mcs |= TIOCM_RTS;
ioctl (serialDev, TIOCMSET, &mcs);
}
else
{
mcs &= ~TIOCM_RTS;
ioctl (serialDev, TIOCMSET, &mcs);
}
}
}

View file

@ -0,0 +1,30 @@
/*
asix-serial.h - serial port routines (host) to access the asix chip
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ASIX_SERIAL_H
#define ASIX_DERIAL_H
int openSerial(char *dev, unsigned int speed);
int closeSerial(void);
int reconfSerial(unsigned int baud, unsigned char flow, unsigned char tout);
int sendBuf(unsigned int len, char *buf);
int getBuf(unsigned int len, char *buf);
void setDTR(unsigned char val);
void setRTS(unsigned char val);
#endif

389
Asixtool/trunk/bootcom.c Normal file
View file

@ -0,0 +1,389 @@
/*
bootcom.c - com routines for the asix on.chip bootloader
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "bootcom.h"
#include "stdio.h"
#include "asix_serial.h"
#include "infohelper.h"
#include "fcntl.h"
#include "unistd.h"
#define MAXSECT 11
extern char verbosity;
char buf[5];
char fbuf[0x080000];
int do_erase;
unsigned int sectors[MAXSECT+1] = {
0x00000,
0x04000,
0x06000,
0x08000,
0x10000,
0x20000,
0x30000,
0x40000,
0x50000,
0x60000,
0x70000,
0x80000
};
int findSect(unsigned long adr)
{
int secnum = 0;
while((sectors[secnum] < adr) && (secnum < MAXSECT))
{
secnum++;
}
if(sectors[secnum] > adr)
return secnum-1;
else
return secnum;
}
void dumpBuf()
{
printf("%02X %02X %02X %02X %02X\n",(unsigned char)buf[0],(unsigned char)buf[1],(unsigned char)buf[2],(unsigned char)buf[3],(unsigned char)buf[4]);
}
void sendCMD(unsigned char a, unsigned char b, unsigned char c, unsigned char d, unsigned char e)
{
buf[0] = a;
buf[1] = b;
buf[2] = c;
buf[3] = d;
buf[4] = e;
sendBuf(5, buf);
}
int setAccessTime(unsigned char val)
{
sendCMD(0x81, 0x00, 0x00, 0x00, val);
getBuf(1, buf);
if(buf[0] == val)
return 1;
return 0;
}
int setIntervallTime(unsigned char val)
{
sendCMD(0x82, 0x00, 0x00, 0x00, val);
getBuf(1, buf);
if(buf[0] == val)
return 1;
return 0;
}
int readFlash(char *name, unsigned int start, unsigned int len)
{
FILE *outfile;
unsigned int ret, count, cdone;
unsigned char rollover = 0;
outfile = fopen(name,"w");
sendCMD(0x00, 0x00, 0x00, 0x00, 0x00);
ret = getBuf(5, buf);
cdone = 0;
count = start+len;
printInfoH(1, "bytes to read: ",len);
for(;start<count;start++)
{
sendCMD(0x00, start & 0xFF, (start & 0xFF00) >> 8, (start & 0xFF0000) >> 16, 0x00);
ret = getBuf(1, buf);
if(ret == 1)
{
fprintf(outfile, "%c",(unsigned char)buf[0]);
fflush(outfile);
}
else
{
printf("FAIL: %02i - %06X - %02X\n",ret, start, (unsigned char) buf[0]);
fprintf(outfile, "%c",(unsigned char)buf[0]);
fflush(outfile);
}
cdone++;
if(rollover == 0)
printProgress(0, "reading", cdone, len);
rollover++;
rollover &= 0x3F;
}
printProgress(0, "reading", cdone, len);
fclose(outfile);
return 1;
}
void resetFlash(unsigned int start)
{
sendCMD(0x80, 0x33, 0x03, (start & 0xFF0000) >> 16, 0xF0);
getBuf(1, buf);
}
void closeWrite(unsigned int start)
{
sendCMD(0x80, 0x33, 0x03, (start & 0xFF0000) >> 16, 0x90);
getBuf(1, buf);
resetFlash(start);
}
int eraseFlash(unsigned int adr)
{
unsigned char base = (adr & 0xFF0000) >> 16;
printInfoH(1, "erasing flash at ", adr & 0x00FF0000);
sendCMD(0x80, 0x55, 0x05, base, 0xAA);
if(!getBuf(1, buf))
{
goto bailOut;
}
sendCMD(0x80, 0xAA, 0x02, base, 0x55);
if(!getBuf(1, buf))
{
goto bailOut;
}
sendCMD(0x80, 0x55, 0x05, base, 0x80);
if(!getBuf(1, buf))
{
goto bailOut;
}
sendCMD(0x80, 0x55, 0x05, base, 0xAA);
if(!getBuf(1, buf))
{
goto bailOut;
}
sendCMD(0x80, 0xAA, 0x02, base, 0x55);
if(!getBuf(1, buf))
{
goto bailOut;
}
sendCMD(0x80, 0x55, 0x05, base, 0x10);
if(!getBuf(1, buf))
{
goto bailOut;
}
waitErase:
sendCMD(0x00, 0x00, 0x00, base, 0x00);
if(!getBuf(1, buf))
{
goto bailOut1;
}
if(buf[0] == 0x0A || buf[0] == 0x4E)
goto waitErase;
if((unsigned char)buf[0] != 0xFF)
goto bailOut2;
printInfoS(1, "successfully erased flash", 0);
resetFlash(adr);
return 1;
bailOut:
return printError("cant issue chip erase sequence, aborting!");
bailOut1:
return printError("no response during chip erase active, aborting");
bailOut2:
return printError("cant erase chip, aborting");
}
int eraseSector(unsigned int adr)
{
unsigned char baseH = (adr & 0xFF0000) >> 16;
unsigned char baseM = (adr & 0xFF00) >> 8;
unsigned char baseL = adr & 0xFF;
printInfoH(1, "erasing sector at ", adr);
sendCMD(0x80, 0x55, 0x05, 0x00, 0xAA);
if(!getBuf(1, buf))
{
goto bailOut;
}
sendCMD(0x80, 0xAA, 0x02, 0x00, 0x55);
if(!getBuf(1, buf))
{
goto bailOut;
}
sendCMD(0x80, 0x55, 0x05, 0x00, 0x80);
if(!getBuf(1, buf))
{
goto bailOut;
}
sendCMD(0x80, 0x55, 0x05, 0x00, 0xAA);
if(!getBuf(1, buf))
{
goto bailOut;
}
sendCMD(0x80, 0xAA, 0x02, 0x00, 0x55);
if(!getBuf(1, buf))
{
goto bailOut;
}
sendCMD(0x80, baseL, baseM, baseH, 0x30);
if(!getBuf(1, buf))
{
goto bailOut;
}
waitErase:
sendCMD(0x00, baseL, baseM, baseH, 0x00);
if(!getBuf(1, buf))
{
goto bailOut1;
}
if(buf[0] == 0x0A || buf[0] == 0x4E)
goto waitErase;
if((unsigned char)buf[0] != 0xFF)
goto bailOut2;
printInfoS(1, "successfully erased sector",0);
resetFlash(adr);
return 1;
bailOut:
return printError("cant issue sector erase sequence");
bailOut1:
return printError("no response during secttor erase active");
bailOut2:
return printError("cant erase sector");
}
unsigned int writeFlash(char *name, unsigned int start, unsigned int len)
{
int infile, flen;
unsigned int ret, count, cdone;
unsigned char rollover = 0;
sendCMD(0x00, 0x00, 0x00, 0x00, 0x00);
ret = getBuf(1, buf);
infile = open(name,O_RDONLY);
flen = read(infile, fbuf, 0x80000);
if(flen < len)
{
printInfoH(1, "adjusting number of bytes to ",flen);
len = flen;
}
cdone = 0;
count = start+len;
if(do_erase)
{
unsigned char startsec, endsec;
startsec = findSect(start);
endsec = findSect(start+len-1);
nextsect:
if(!eraseSector(sectors[startsec]))
{
return(printError("error at auto-erase"));
}
if(startsec != endsec)
{
startsec++;
goto nextsect;
}
}
printInfoH(1, "bytes to write: ",len);
retry:
sendCMD(0x80, 0x55, 0x05, (start & 0xFF0000) >> 16, 0xAA);
ret = getBuf(1, buf);
sendCMD(0x80, 0xAA, 0x02, (start & 0xFF0000) >> 16, 0x55);
ret = getBuf(1, buf);
sendCMD(0x80, 0x55, 0x05, (start & 0xFF0000) >> 16, 0x20);
ret = getBuf(1, buf);
for(;start<count;start++)
{
sendCMD(0x80, 0x33, 0x03, (start & 0xFF0000) >> 16, 0xA0);
ret = getBuf(1, buf);
sendCMD(0xC0, start & 0xFF, (start & 0xFF00) >> 8, (start & 0xFF0000) >> 16, (unsigned char) fbuf[cdone]);
ret = getBuf(2, buf);
if(ret == 1)
{
sleep(1);
closeWrite(start);
printf("\nretrying\n");
goto retry;
}
if((ret != 2))
{
closeWrite(start);
return printError("error during write: short response");
}
if((unsigned char)fbuf[cdone] != (unsigned char)buf[1])
{
closeWrite(start);
return printError("error during write: data mismatch");
}
cdone++;
if(rollover == 0)
printProgress(0, "writing", cdone, len);
rollover++;
rollover &= 0x3F;
}
printProgress(0, "writing", cdone, len);
closeWrite(start);
close(infile);
return len;
}

28
Asixtool/trunk/bootcom.h Normal file
View file

@ -0,0 +1,28 @@
/*
bootcom.h - com routines for the asix on.chip bootloader
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BOOTCOM_H
#define BOOTCOM_H
int readFlash(char *name, unsigned int start, unsigned int len);
unsigned int writeFlash(char *name, unsigned int start, unsigned int len);
int eraseFlash(unsigned int adr);
int eraseSector(unsigned int adr);
#endif

View file

@ -0,0 +1,97 @@
/*
infohelper.c - info-display routines (host)
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "infohelper.h"
char verbosity;
int printError(char *err)
{
printf("ERROR: %s\n",err);
return 0;
}
int printErrorS(char *err, char *xtra)
{
if(xtra)
printf("ERROR: %s %s\n", err, xtra);
else
printf("ERROR: %s\n", err);
return 0;
}
int printInfoS(unsigned char level, char *msg, char *xtra)
{
if(level <= verbosity)
{
if(xtra)
printf("Info : %s %s\n", msg, xtra);
else
printf("Info : %s\n", msg);
return 1;
}
return 0;
}
int printInfoH(unsigned char level, char *msg, unsigned int val)
{
if(level <= verbosity)
{
printf("Info : %s 0x%08X\n", msg, val);
return 1;
}
return 0;
}
const char heartbeat[] = { ".oOo" };
int printProgress(unsigned char level, char *msg, float cval, float maxval)
{
unsigned int cur, cnt;
static int beat = 0;
if(level <= verbosity)
{
cur = (35 / maxval) * cval;
cnt = 35-cur;
printf("Progress: [");
while(cur--)
printf("*");
if(cnt)
printf("%c",heartbeat[beat]);
else
printf("*");
while(cnt--)
printf(" ");
printf("\b]\r");
fflush(stdout);
beat++;
beat &= 0x03;
}
return 0;
}

View file

@ -0,0 +1,30 @@
/*
infohelper.h - info-display routines (host)
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TOOL_INFOHELPER
#define TOOL_INFOHELPER
extern char verbosity;
int printError(char *err);
int printErrorS(char *err, char *xtra);
int printInfoS(unsigned char level, char *msg, char *xtra);
int printInfoH(unsigned char level, char *msg, unsigned int val);
int printProgress(unsigned char level, char *msg, float cval, float maxval);
#endif

312
Asixtool/trunk/main.c Normal file
View file

@ -0,0 +1,312 @@
/*
main.c - main program
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "stdio.h"
#include "asix_serial.h"
#include "infohelper.h"
#include "fcntl.h"
#include "unistd.h"
#include <string.h>
#include "bootcom.h"
#define VERSION_MAJOR 0
#define VERSION_MINOR 1
extern char verbosity;
extern int do_erase;
unsigned long radr, f0adr, f0len;
void printHeader(void)
{
printf("\nasixtool V%i.%i\n\n", VERSION_MAJOR, VERSION_MINOR);
printf("This Software is free Software under GNU GPL 3 or later\n");
printf("(c) 2007 Ch. Klippel <ck@mamalala.net>\n\n");
}
void printUsage(void)
{
printf("usage: asixtool [-d NAME] [-a [NAME] [-A ADRDESS]] [-e] [-S] [-c] [-N]\n\n");
printf(" -d NAME specify serial device, default is /dev/ttyS0\n");
printf(" -r NAME specify file to read flash into, default is flash_dump.bin\n");
printf(" -a NAME specify file to write to flash, default is flash.bin\n");
printf(" -A ADDRESS optionally specifies the start-address to load into/read from flash\n");
printf(" default is 0x000000 - must be specified in hex\n");
printf(" -L ADDRESS optionally specifies the maximum number of bytes to load into/read from flash\n");
printf(" default is 0x080000 - must be specified in hex\n");
printf(" -e completely erase the flash before writing\n");
printf(" default is no erase\n");
printf(" -s erase flash sectors as needed.\n");
printf(" this is a lot faster if only a few sectors are used\n");
printf(" -? print this help\n");
printf("\n");
printf("ATTENTION: commands are order-sensitive! for example, to set an address, you MUST\n");
printf("specify the address with -A before you specify any of the -r or -w commands. this\n");
printf("allows you to upload serveral binary files to serveral places with one command.\n");
}
unsigned long parseHex(char *buf)
{
unsigned char cnt;
unsigned long adr;
cnt = 0;
adr = 0;
while(buf[cnt])
{
adr <<= 4;
if(buf[cnt] >= '0' && buf[cnt] <= '9')
{
adr += (buf[cnt] - '0');
}
else if(buf[cnt] >= 'A' && buf[cnt] <= 'F')
{
adr += (buf[cnt] - 'A' + 10);
}
else if(buf[cnt] >= 'a' && buf[cnt] <= 'f')
{
adr += (buf[cnt] - 'a' + 10);
}
else if(buf[cnt] == 'x' || buf[cnt] == 'X')
{
adr = 0;
}
else
{
}
cnt++;
}
return adr;
}
int main(int argc,char **argv)
{
char sname[256];
char rname[256];
char f0name[256];
int isOpen;
int numw;
unsigned int baud;
unsigned char i, cmd;
baud = 115200;
do_erase = 0;
numw = 0;
isOpen = 0;
sprintf(sname,"/dev/ttyS0");
sprintf(rname,"flash_dump.bin");
sprintf(f0name,"flash.bin");
f0adr = 0x000000;
f0len = 0x080000;
printHeader();
verbosity = 1;
if(argc <= 1)
goto bailout;
rescan:
for(i=1;i<argc;i++)
{
if(argv[i][0] == '-')
{
cmd = 0;
if(argv[i][1] == '-')
{
cmd = argv[i][2];
}
else
{
cmd = argv[i][1];
}
if(isOpen == 0)
{
switch(cmd)
{
case 'h':
baud = 921600;
break;
case 'd':
if((argc > i+1) && (argv[i+1][0] != '-'))
{
strncpy(sname,argv[++i],256);
printInfoS(1,"opening serial device",sname);
if(isOpen)
{
if(closeSerial() == 0)
{
isOpen = 0;
}
else
{
printError("cant close port");
return 0;
}
}
if(openSerial(sname, baud))
{
isOpen = 1;
}
else
{
printError("cant open port");
return 0;
}
}
else
{
printError("Error in device argument");
goto bailout;
}
break;
}
}
else
{
switch(cmd)
{
case 'd':
if((argc > i+1) && (argv[i+1][0] != '-'))
{
strncpy(sname,argv[++i],256);
printInfoS(1,"closing serial device",sname);
if(closeSerial() == 0)
{
isOpen = 0;
}
else
{
printError("cant close port");
return 0;
}
printInfoS(1,"opening serial device",sname);
if(openSerial(sname, baud))
{
isOpen = 1;
}
else
{
printError("cant open port");
return 0;
}
}
else
{
printError("Error in device argument");
goto bailout;
}
break;
case 'r':
if((argc > i+1) && (argv[i+1][0] != '-'))
{
strncpy(rname,argv[++i],256);
}
printInfoS(1,"reading flash image",rname);
numw = readFlash(rname, f0adr, f0len);
if(numw)
{
printInfoS(1, "done reading memory ",0);
}
else
{
printErrorS("Error in reading memory-image",rname);
return 0;
}
break;
case 'a':
if((argc > i+1) && (argv[i+1][0] != '-'))
{
strncpy(f0name,argv[++i],256);
}
printInfoS(1,"writing flash image",f0name);
numw = writeFlash(f0name, f0adr, f0len);
if(numw)
{
printInfoS(1, "done writing memory ",0);
f0len = numw;
}
else
{
printErrorS("Error in writing memory-image",f0name);
return 0;
}
break;
case 'A':
if((argc > i+1) && (argv[i+1][0] != '-'))
{
f0adr = parseHex(argv[++i]);
printInfoH(1,"setting address for flash @",f0adr);
}
else
printInfoH(1,"used -A but no address given, using default",f0adr);
f0len = 0x080000;
break;
case 'L':
if((argc > i+1) && (argv[i+1][0] != '-'))
{
f0len = parseHex(argv[++i]);
printInfoH(1,"setting length for flash @",f0len);
}
else
printInfoH(1,"used -L but no address given, using default",f0len);
break;
case 'e':
printInfoS(1,"erasing flash before write",0);
if(!eraseFlash(f0adr))
{
printError("cant erase flash");
return 0;
}
break;
case 's':
printInfoS(1,"erasing sectors as needed",0);
do_erase = 1;
break;
}
}
}
else
{
bailout:
printUsage();
return 0;
}
}
if((isOpen == 0) && (argc > 1))
{
printInfoS(1,"using serial device",sname);
if(openSerial(sname, baud))
{
isOpen = 1;
goto rescan;
}
}
else if(isOpen != 0)
{
printInfoS(1,"closing serial device",sname);
closeSerial();
}
return 1;
}

View file

@ -0,0 +1,72 @@
# makfile configuration
NAME = TAE_MSP
CSOURCES = cc1100.c hardware.c main.c rf.c
#~ ASOURCES =
CPU = msp430f1121
CPU_CLOCK = 4500000
COMPORT = /dev/ttyUSB2
GDBPORT = 3333
BSLOPT = --invert-reset --comport=${COMPORT}
ASFLAGS = -mmcu=${CPU} -D_GNU_ASSEMBLER_ -I .
CFLAGS = -mmcu=${CPU} -Os -Wall -g --std=gnu99 -I . -D F_CPU=${CPU_CLOCK} -D HAS_CONFIG_H
#LDFLAGS = -lmspgcc
#switch the compiler (for the internal make rules)
CC = msp430-gcc
AS = msp430-gcc
OBJECTS = ${CSOURCES:.c=.o} ${ASOURCES:.S=.o}
.PHONY: all FORCE clean download download-jtag download-bsl
#all should be the first target. it's built when make is run without args
all: ${NAME}.elf ${NAME}.a43 ${NAME}.lst dependencies.d
#confgigure the next line if you want to use the serial download
program: download-jtag
#~ download: download-bsl
#additional rules for files
${NAME}.elf: ${OBJECTS}
${CC} -mmcu=${CPU} -o $@ ${OBJECTS} $(LDFLAGS)
${NAME}.a43: ${NAME}.elf
msp430-objcopy -O ihex $^ $@
${NAME}.lst: ${NAME}.elf
# non uniarch msp430-objdump -dSt --size-sort $^ >$@
msp430-objdump -dSt $^ >$@
@echo "----- RAM/Flash Usage -----"
msp430-size $^
msp430-nm --size-sort $^
download-jtag: all
# mspdebug rf2500 "prog ${NAME}.elf"
mspdebug -d ${COMPORT} uif -j "prog ${NAME}.elf"
# msp430-jtag -e ${NAME}.elf
download-bsl: all
msp430-bsl $(BSLOPT) -e ${NAME}.elf
debug: all
# mspdebug rf2500 "prog ${NAME}.elf" "setbreak main" run "gdb ${GDBPORT}"
# mspdebug -d ${COMPORT} uif -j "prog ${NAME}.elf" reset "gdb ${GDBPORT}"
mspdebug -d ${COMPORT} uif -j "prog ${NAME}.elf" "setbreak main" run "delbreak 0" "gdb ${GDBPORT}"
clean:
rm -f ${NAME}.elf ${NAME}.a43 ${NAME}.lst ${OBJECTS} dependencies.d
#dummy target as dependecy if something has to be build everytime
FORCE:
#project dependencies
dependencies.d:
$(CC) -MM ${CFLAGS} ${CSOURCES} > dependencies.d
ifdef ASOURCES
$(CC) -MM ${ASFLAGS} ${ASOURCES} >> dependencies.d
endif
-include dependencies.d

View file

@ -0,0 +1,158 @@
/*
cc1100.c
Copyright (C) 2009 <telekatz@gmx.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "cc1100.h"
#include "hardware.h"
#include <msp430.h>
//#include <signal.h>
//#include <iomacros.h>
//#include <mspgcc/util.h>
unsigned char WORsend;
unsigned char cc1100Addr;
const unsigned char conf[0x2f] = {
0x29 , 0x06 , 0x06 , 0x47 , 0xD3 , 0x91 , 0x3E , 0x1A ,
0x45 , cc1100_addr , cc1100_chan , 0x06 , 0x00 , 0x10 , 0x0B , 0xDA ,
0x8A , 0x75 , 0x13 , 0x22 , 0xC1 , 0x35 , 0x07 , 0x0C ,
0x18 , 0x16 , 0x6C , 0x43 , 0x40 , 0x91 , 0x46 , 0x50 ,
0x78 , 0x56 , 0x10 , 0xA9 , 0x0A , 0x00 , 0x11 , 0x41 ,
0x00 , 0x57 , 0x7F , 0x3F , 0x98 , 0x31 , 0x0B
};
void CC1100_Select(void) {
P1OUT &= ~CC_CS;
while (P1IN & CC_MISO);
}
void CC1100_DeSelect(void) {
P1OUT |= CC_CS;
}
void cc1100_init(void) {
unsigned char i;
P1OUT = (P1OUT & ~CC_MOSI) | (CC_CS | CC_SCLK);
P1DIR |= CC_CS;
P1OUT &= ~CC_CS;
delay(40);
P1OUT |= CC_CS;
delay(240);
CC1100_Select();
spi_rw(SRES);
while (P1IN & CC_MISO);
spi_rw(0x00 | BURST);
for (i=0; i < 0x2f; i++)
spi_rw(conf[i]);
CC1100_DeSelect();
cc1100Addr = conf[0x09];
WORsend=0;
}
unsigned char cc1100_write(unsigned char addr,unsigned char* dat, unsigned char lenght) {
unsigned char i;
unsigned char status;
CC1100_Select();
status = spi_rw(addr | WRITE);
for (i=0; i < lenght; i++)
spi_rw(dat[i]);
CC1100_DeSelect();
return(status);
}
unsigned char cc1100_write1(unsigned char addr,unsigned char dat) {
unsigned char status;
CC1100_Select();
status = spi_rw(addr | WRITE);
spi_rw(dat);
CC1100_DeSelect();
return(status);
}
unsigned char cc1100_read(unsigned char addr, unsigned char* dat, unsigned char lenght) {
unsigned char i;
unsigned char status;
CC1100_Select();
status = spi_rw(addr | READ);
for (i=0; i < lenght; i++)
dat[i]=spi_rw(0x00);
CC1100_DeSelect();
return(status);
}
unsigned char cc1100_read1(unsigned char addr) {
unsigned char r;
CC1100_Select();
r = spi_rw(addr | READ);
r=spi_rw(0x00);
CC1100_DeSelect();
return(r);
}
unsigned char cc1100_strobe(unsigned char cmd) {
unsigned char status;
CC1100_Select();
status = spi_rw(cmd);
CC1100_DeSelect();
return(status);
}
unsigned char spi_rw(unsigned char write) {
unsigned char z;
for (z= 8; z > 0; z--) {
P1OUT &= ~CC_SCLK; //SCK = 0;
if (write & 0x80)
P1OUT |= CC_MOSI; //MOSI1 = 1;
else
P1OUT &= ~CC_MOSI; //MOSI1 = 0;
P1OUT |= CC_SCLK; //SCK = 1;
write <<=1;
if (P1IN & CC_MISO)
write |= 0x01;
}
P1OUT &= ~CC_SCLK;
return(write);
}

View file

@ -0,0 +1,57 @@
/*
cc1100.h
Copyright (C) 2009 <telekatz@gmx.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef cc1100_H
#define cc1100_H
#define WRITE 0x00
#define BURST 0x40
#define READ 0x80
#define TX_fifo 0x7F
#define RX_fifo 0xff
#define SRES 0x30
#define SFSTXON 0x31
#define SXOFF 0x32
#define SCAL 0x33
#define SRX 0x34
#define STX 0x35
#define SIDLE 0x36
#define SWOR 0x38
#define SPWD 0x39
#define SFRX 0x3A
#define SFTX 0x3B
#define SWORRST 0x3C
#define SNOP 0x3D
#define PTABLE 0x3E
#define cc1100_chan 0x01
#define cc1100_addr 0x02
const unsigned char conf[0x2F];
void cc1100_init(void);
unsigned char cc1100_write(unsigned char addr, unsigned char* dat, unsigned char lenght);
unsigned char cc1100_write1(unsigned char addr,unsigned char dat);
unsigned char cc1100_read(unsigned char addr, unsigned char* dat, unsigned char lenght);
unsigned char cc1100_read1(unsigned char addr);
unsigned char cc1100_strobe(unsigned char cmd);
unsigned char spi_rw(unsigned char write);
#endif

View file

@ -0,0 +1,61 @@
/*
hardware.h - TAE hardware
Copyright (C) 2009 <telekatz@gmx.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hardware.h"
#include <msp430.h>
void init_clock(void) {
unsigned char step;
int last, delta;
DCOCTL = 0x70;
BCSCTL1 = XT2OFF | DIVA_3 | (DCO_RSEL & 0xF);
BCSCTL2 = 0x00;
last = 0;
TACTL = TASSEL_2 /* Timer A clock source select: 2 - SMCLK */
| MC_2 /* Timer A mode control: 2 - Continous up */
| TACLR;
TACCTL2 = CM1 /* Capture mode 1 */
| CCIS_1 | SCS | CAP;
for (step = 0x40; step > 0; step >>= 1) {
while (!(TACCTL2 & CCIFG));
delta = TACCR2 - last;
if (delta < DCO_ACLK_DELTA) {
DCOCTL += step;
}
else {
DCOCTL -= step;
}
last = TACCR2;
TACCTL2 &= ~CCIFG;
}
BCSCTL1 &= ~DIVA_3;
BCSCTL2 = DIVS_1;
TACTL = TASSEL1 /* Timer A clock source select 0 */
| MC_2 /* Timer A mode control: 2 - Continous up */
| TACLR;
}

View file

@ -0,0 +1,58 @@
/*
hardware.h - TAE hardware
Copyright (C) 2009 <telekatz@gmx.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HARDWARE_H
#define HARDWARE_H
#define DCO_RSEL 7
#define DCO_ACLK_DELTA (((F_CPU) + 2047) / 4096)
//Port 1
#define CC_CS (1<<0)
#define CC_SCLK (1<<1)
#define CC_MOSI (1<<2)
#define CC_MISO (1<<3)
#define WD_RST (1<<4)
#define CC1100_POWER (1<<5)
#define EXTRA_CURRENT (1<<6)
#define CC1100_APOWER (1<<7)
//Port2
#define ACLK (1<<0)
#define VEGA_CLK (1<<1)
#define VEGA_MOSI (1<<2)
#define VEGA_MISO (1<<3)
#define ADC_IN1 (1<<4)
#define LINE_CONTROL (1<<5)
#define XIN (1<<6)
#define XOUT (1<<7)
void init_clock(void);
static void __inline__ delay(register unsigned int n)
{
__asm__ __volatile__ (
"1: \n"
" dec %[n] \n"
" nop \n"
" jne 1b \n"
: [n] "+r"(n));
}
#endif

View file

@ -0,0 +1,67 @@
/*
main.c - TAE MSP
Copyright (C) 2009 <telekatz@gmx.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "hardware.h"
#include <msp430.h>
#include <signal.h>
//#include <mspgcc/util.h> // delay()
#include "rf.h"
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1OUT = 0;//CC_CS | CC1100_POWER | CC1100_APOWER | EXTRA_CURRENT;
P1DIR = CC_SCLK | CC_MOSI | CC_CS | WD_RST | CC1100_POWER | CC1100_APOWER | EXTRA_CURRENT;
P1SEL = 0;
P1IES = CC_MISO;
P1IFG = 0;
P2OUT = 0;
P2DIR = ACLK | VEGA_MISO | ADC_IN1 | LINE_CONTROL;
P2SEL = ACLK | XIN | XOUT;
delay(0xffff);
P1OUT = CC_CS | CC1100_POWER | EXTRA_CURRENT;
P2OUT = LINE_CONTROL;
delay(0xffff);
init_clock();
RF_init();
RF_sendWOR(0);
eint();
for (;;)
{
TACTL = TASSEL_1 //ACLK
| MC_2 /* Timer A mode control: 2 - Continous up */
| TACLR;
while(TAR < 0x3200);
P1OUT ^= WD_RST;
//P1OUT ^= CC_SCLK;
//delay(0x8000);
//RF_sendWOR(0);
}
}

163
betty_TAE/MSP430/trunk/rf.c Normal file
View file

@ -0,0 +1,163 @@
/*
rf.c -
Copyright (C) 2008
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "cc1100.h"
#include "hardware.h"
#include "rf.h"
#include <msp430.h>
#include <signal.h>
//#include <mspgcc/util.h>
unsigned char RFbuf[64];
volatile unsigned char RFstatus;
unsigned char cc1100Addr;
void switch_to_idle(void) {
cc1100_strobe(SIDLE);
while (cc1100_read1(0x35 | READ | BURST) != 01);
}
void RF_init (void) {
cc1100_init();
RFstatus = 0;
cc1100Addr = conf[0x09];
cc1100_strobe(SRX);
P1IE = CC_MISO;
}
void waitTX(void)
{
unsigned char status;
unsigned char x;
x=1;
while (x) {
status = cc1100_strobe(SNOP);
switch ( 0xf0 & status) {
case 0x70:
cc1100_strobe(SFTX);
break;
case 0x10:
if (RFstatus & WORsend)
cc1100_strobe(SIDLE);
x=0;
break;
case 0x00:
if (!(RFstatus & WORsend))
cc1100_strobe(SRX);
x=0;
break;
}
}
}
void RF_send(unsigned char* b) {
unsigned char P1IE_state;
P1IE_state = (P1IE & CC_MISO);
P1IE &= ~CC_MISO;
cc1100_write(TX_fifo | BURST,b,b[0]+1);
cc1100_strobe(STX);
waitTX();
P1IE |= P1IE_state;
}
void RF_getfifo(unsigned char* b) {
cc1100_read(RX_fifo, b,1);
cc1100_read(RX_fifo, &b[1],b[0]);
}
void RF_sendWOR(unsigned char addr) {
unsigned char b[2];
b[0]=0x01;
b[1]=addr;
RFstatus |= WORsend;
cc1100_write1(0x18,conf[0x18] & 0xCF);
cc1100_strobe(SIDLE);
cc1100_strobe(SCAL);
waitTX();
TACTL = TASSEL_1 //ACLK
| MC_2 /* Timer A mode control: 2 - Continous up */
| TACLR;
while(TAR < 0x3800) {
cc1100_write(TX_fifo | BURST,b,2);
cc1100_strobe(STX);
waitTX();
}
cc1100_write1(0x18,conf[0x18]);
RFstatus &= ~WORsend;
waitTX();
P1OUT ^= WD_RST;
}
interrupt (PORT1_VECTOR) RF_IRQ (void) {
if (cc1100_read1(0x3B | READ | BURST) > 0) {
RF_getfifo(RFbuf);
cc1100_strobe(SIDLE);
cc1100_strobe(SFRX);
cc1100_strobe(SRX);
struct cc1100frame_ *RXframe;
RXframe = (struct cc1100frame_ *)&RFbuf[0];
if (RXframe->len > 3) {
switch ( RXframe->packetType) {
case 0x01:
break;
case 0x02:
if (RXframe->data[0] == 0x01) {
RXframe->destAddr = RXframe->srcAddr;
RXframe->srcAddr = cc1100Addr;
RXframe->data[0] = 0x02;
RXframe->len = 0x04;
switch_to_idle();
RF_send(RFbuf);
P1OUT ^= WD_RST;
}
else if (RFbuf[headerLen] == 0x02) {
RFstatus |= Received;
}
break;
case 0x03:
break;
}
}
}
waitTX();
P1IFG = 0;
P1OUT ^= WD_RST;
}

View file

@ -0,0 +1,45 @@
/*
rf.h -
Copyright (C) 2008
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef RF_H
#define RF_H
#define Received 0x01
#define WORsend 0x02
struct cc1100frame_ {
unsigned char len;
unsigned char destAddr;
unsigned char srcAddr;
unsigned char packetType;
unsigned char data[];
};
#define headerLen 0x04
unsigned char RFbuf[64];
volatile unsigned char RFstatus;
void RF_IRQ (void);
void RF_init (void);
void RF_getfifo(unsigned char* b);
void RF_send(unsigned char* b);
void RF_sendWOR(unsigned char addr);
void waitTX(void);
#endif

674
betty_scart/trunk/LICENSE Normal file
View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View file

@ -0,0 +1,95 @@
###############################################################
#####
##### Makefile for betty_scart
##### Created at 30.8.2007 02:26 am
#####
##### scart_terminal V0.1 by telekatz - telekatz@gmx.de
#####
###############################################################
###############################################################
#####
##### PATHS (default installation)
#####
##### You can put your path-config into Makefile.local
##### to override these defaults
#####
###############################################################
SDCCBASE=F:/Tools/SDCC
INCLUDEPATH=$(SDCCBASE)/include
SDCCPATH=$(SDCCBASE)/bin
PACKER = $(SDCCPATH)/packihx
IMGMAKER = $(SDCCPATH)/makebin
CC=$(SDCCPATH)/sdcc
-include Makefile.local
# Target file name.
TARGET = betty_scart
# List C source files here.
SRC = main.c \
serial.c \
cc1100.c \
cmd.c \
rf.c \
timer.c
# Compiler flags.
FLAGS = -mmcs51 --iram-size 0x100
FLAGS += --model-small
FLAGS += --code-size 8096
FLAGS += -I$(INCLUDEPATH)
FLAGS += --std-sdcc99
# For newer SDCC
FLAGS += -Dcode=__code -Didata=__idata -Dbit=__bit
# Define all object files.
OBJ = $(SRC:.c=.rel)
# Default target.
all: $(TARGET).bin
program: $(TARGET).bin
#ScartProg -a -u -d 'UniProg A'
ScartProg -a
main.rel: main.c
$(CC) $(FLAGS) -c main.c
serial.rel: serial.c serial.h
$(CC) $(FLAGS) -c serial.c
cc1100.rel: cc1100.c cc1100.h
$(CC) $(FLAGS) -c cc1100.c
cmd.rel: cmd.c cmd.h
$(CC) $(FLAGS) -c cmd.c
rf.rel: rf.c rf.h
$(CC) $(FLAGS) -c rf.c
timer.rel: timer.c timer.h
$(CC) $(FLAGS) -c timer.c
$(TARGET).bin: $(TARGET).hex
cat $(TARGET).hex | $(IMGMAKER) -s 8096 > $(TARGET).bin
$(TARGET).hex: $(TARGET).ihx
$(PACKER) $(TARGET).ihx > $(TARGET).hex
$(TARGET).ihx: $(OBJ)
@echo
@echo Linking $(OBJ)
$(CC) $(FLAGS) $(OBJ) -o $(TARGET).ihx
clean:
$(RM) -v *.rel *.rst *.sym *.lst *.hex *.asm *.mem *.map *.lnk *.ihx *.bin *~

View file

@ -0,0 +1,22 @@
###############################################################
#####
##### Makefile.local.WinSDCC for betty_scart
#####
##### Makefile.local.WinSDCC
#####
###############################################################
###############################################################
#####
##### PATHS (default installation)
#####
##### You can put your path-config into Makefile.local
##### to override these defaults
#####
###############################################################
SDCCBASE=F:/Tools/SDCC
INCLUDEPATH=$(SDCCBASE)/include
SDCCPATH=$(SDCCBASE)/bin
######################## EOF ##################################

View file

@ -0,0 +1,22 @@
###############################################################
#####
##### Makefile.local.linuxSDCC for betty_scart
#####
##### Makefile.local.linuxARM
#####
###############################################################
###############################################################
#####
##### PATHS (default installation)
#####
##### You can put your path-config into Makefile.local
##### to override these defaults
#####
###############################################################
SDCCBASE=/opt/sdcc
INCLUDEPATH=$(SDCCBASE)/include
SDCCPATH=$(SDCCBASE)/bin
######################## EOF ##################################

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,86 @@
#!/usr/bin/env python
# based on http://blog.theroyweb.com/embedding-a-binary-file-as-an-array-in-firmware
# Convert binary file to a hex encoded array for inclusion in C projects
import os
import sys
import struct
class BinToArray:
def __init__(self):
pass
def ConvertFileToArray(self, strInFile, strOutFile, ignoreBytes):
""" Reads binary file at location strInFile and writes out a C array of hex values
Parameters -
strInFile - Path and filename of binary file to convert
strOutFile - Path and filename of output. Suggested extension is .c or .cpp
ignoreBytes - Number of bytes to ignore at the beginning of binary file. Helps
strip out file headers and only encode the payload/data.
"""
strVarType = "const unsigned char"
strVarName = "scart_image"
strValSpace = ""
ValsPerLine = 15
ValCount = 0
ValsTotal = 0x1C00 #7168
# Open input file
try:
fileIn = open(strInFile, 'rb')
except IOError, err:
logging.debug("Could not open input file %s" % (strInFile))
return
# end try
# Open output file
try:
fileOut = open(strOutFile, 'w')
except IOError, err:
logging.debug("Could not open output file %s" % (strOutFile))
return
# end try
# Start array definition preamble
inFileName = os.path.basename(strInFile)
fileOut.write("// Array representation of binary file %s\n\n\n" % (inFileName))
fileOut.write("%s %s[] = \n{\n" % (strVarType, strVarName) )
# Convert and write array into C file
# ignore header
fileIn.seek(ignoreBytes)
# output hex bytes linewise
while True:
if ValCount + ValsPerLine > ValsTotal:
ValsPerLine = ValsTotal - ValCount
if ValsPerLine == 0:
break
ValCount += ValsPerLine
# read data
bufChunk = fileIn.read(ValsPerLine)
# write line of hex bytes
fileOut.write("\t")
for byteVal in bufChunk:
fileOut.write("0x%02x,%s" % (ord(byteVal), strValSpace))
fileOut.write("\n")
# Close files
fileIn.close()
fileOut.write("};\n")
fileOut.close()
sys.stderr.write("Converted %d values.\n\n" % (ValCount))
if __name__ == "__main__":
converter = BinToArray()
converter.ConvertFileToArray("betty_scart.bin", "../../boop/trunk/tools/scart_image_data.h", 0, )

221
betty_scart/trunk/cc1100.c Normal file
View file

@ -0,0 +1,221 @@
/*
cc1100.c
Copyright (C) 2007
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <P89LPC932.h>
#include "cc1100.h"
code unsigned char conf[0x2F] = {
0x29 , //IOCFG2
0x2E , //IOCFG1
0x06 , //IOCFG0
0x47 , //FIFOTHR
0xD3 , //SYNC1
0x91 , //SYNC0
0x3E , //PKTLEN
0x1A , //PKTCTRL1
0x45 , //PKTCTRL0
0x01 , //ADDR
0x01 , //CHANNR
0x06 , //FSCTRL1
0x00 , //FSCTRL0
0x10 , //FREQ2
0x0B , //FREQ1
0xDA , //FREQ0
0x8A , //MDMCFG4
0x75 , //MDMCFG3
0x13 , //MDMCFG2
0x22 , //MDMCFG1
0xC1 , //MDMCFG0
0x35 , //DEVIATN
0x07 , //MCSM2
0x03 , //MCSM1 0c
0x38 , //MCSM0
0x16 , //FOCCFG
0x6C , //BSCFG
0x43 , //AGCCTRL2
0x40 , //AGCCTRL1
0x91 , //AGCCTRL0
0x46 , //WOREVT1
0x50 , //WOREVT0
0x78 , //WORCTRL
0x56 , //FREND1
0x10 , //FREND0
0xA9 , //FSCAL3
0x0A , //FSCAL2
0x00 , //FSCAL1
0x11 , //FSCAL0
0x41 , //RCCTRL1
0x00 , //RCCTRL0
0x57 , //FSTEST
0x7F , //PTEST
0x3F , //AGCTEST
0x98 , //TEST2
0x31 , //TEST1
0x0B //TEST0
};
unsigned char spi_rw(unsigned char write) {
unsigned char z;
for (z= 8; z; z--) {
SCK = 0;
MOSI1 = (write & 0x80);
SCK = 1;
write <<=1;
if (MISO1)
write |= 0x01;
}
SCK = 0;
return(write);
}
unsigned char spi_r() {
unsigned char z;
unsigned char ret = 0;
MOSI1 = 0;
SCK = 0;
for (z= 8; z; z--) {
SCK = 1;
ret <<=1;
if (MISO1)
ret |= 0x01;
SCK = 0;
}
return(ret);
}
void cc1100_init(void) {
unsigned char i = 0xff;
SCK = 1;
MOSI1 = 0;
CS = 0;
while(i) {
i--;
}
CS = 1;
i=0xff;
while(i) {
i--;
}
CS = 0;
SCK = 0;
while (MISO1);
spi_rw(SRES);
while (MISO1);
spi_rw(0x00 | BURST);
for (i=0; i < 0x2f; i++)
spi_rw(conf[i]);
CS = 1;
cc1100_write1(PATABLE,0xC0);
cc1100_strobe(SIDLE);
cc1100_strobe(SCAL);
cc1100_strobe(SFRX);
cc1100_strobe(SRX);
}
unsigned char cc1100_write(unsigned char addr, unsigned char* dat, unsigned char lenght) {
unsigned char i;
unsigned char status;
CS = 0;
while (MISO1);
status = spi_rw(addr | WRITE);
for (i=0; i < lenght; i++)
spi_rw(dat[i]);
CS = 1;
return(status);
}
unsigned char cc1100_write1(unsigned char addr,unsigned char dat) {
unsigned char status;
CS = 0;
while (MISO1);
status = spi_rw(addr | WRITE);
spi_rw(dat);
CS = 1;
return(status);
}
unsigned char cc1100_read(unsigned char addr, unsigned char* dat, unsigned char lenght) {
unsigned char i;
unsigned char status;
CS = 0;
while (MISO1);
status = spi_rw(addr | READ);
for (i=0;lenght; lenght--)
dat[i++]=spi_r();
CS = 1;
return(status);
}
unsigned char cc1100_read1(unsigned char addr) {
unsigned char r;
CS = 0;
while (MISO1);
r = spi_rw(addr | READ);
r=spi_rw(0x00);
CS = 1;
return(r);
}
unsigned char cc1100_strobe(unsigned char cmd) {
unsigned char status;
CS = 0;
while (MISO1);
status = spi_rw(cmd);
CS = 1;
return(status);
}
unsigned char cc1100_single(unsigned char b,bit end) {
unsigned char status;
if (CS == 1) {
CS = 0;
while (MISO1);
}
status = spi_rw(b);
if (end)
CS = 1;
return(status);
}

128
betty_scart/trunk/cc1100.h Normal file
View file

@ -0,0 +1,128 @@
/*
cc1100.h
Copyright (C) 2007
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef cc1100_H
#define cc1100_H
#define MISO1 RST
#define MOSI1 OCB
#define SCK OCC
#define CS KB1
#define GDO0 KB6
#define WRITE 0x00
#define BURST 0x40
#define READ 0x80
#define TX_fifo 0x7F
#define RX_fifo 0xff
#define PATABLE 0x3E
//Command Strobes
#define SRES 0x30
#define SFSTXON 0x31
#define SXOFF 0x32
#define SCAL 0x33
#define SRX 0x34
#define STX 0x35
#define SIDLE 0x36
#define SWOR 0x38
#define SPWD 0x39
#define SFRX 0x3A
#define SFTX 0x3B
#define SWORRST 0x3C
#define SNOP 0x3D
//Status Registers
#define PARTNUM (0x30 | READ | BURST)
#define VERSION (0x31 | READ | BURST)
#define FREQEST (0x32 | READ | BURST)
#define LQI (0x33 | READ | BURST)
#define RSSI (0x34 | READ | BURST)
#define MARCSTATE (0x35 | READ | BURST)
#define WORTIME1 (0x36 | READ | BURST)
#define WORTIME0 (0x37 | READ | BURST)
#define PKTSTATUS (0x38 | READ | BURST)
#define VCO_VC_DAC (0x39 | READ | BURST)
#define TXBYTES (0x3A | READ | BURST)
#define RXBYTES (0x3B | READ | BURST)
#define RCCTRL1_STATUS (0x3C | READ | BURST)
#define RCCTRL0_STATUS (0x3D | READ | BURST)
//Configuration Registers
#define IOCFG2 0x00 // GDO2 output pin configuration
#define IOCFG1 0x01 // GDO1 output pin configuration
#define IOCFG0 0x02 // GDO0 output pin configuration
#define FIFOTHR 0x03 // RX FIFO and TX FIFO thresholds
#define SYNC1 0x04 // Sync word, high byte
#define SYNC0 0x05 // Sync word, low byte
#define PKTLEN 0x06 // Packet length
#define PKTCTRL1 0x07 // Packet automation control
#define PKTCTRL0 0x08 // Packet automation control
#define ADDR 0x09 // Device address
#define CHANNR 0x0A // Channel number
#define FSCTRL1 0x0B // Frequency synthesizer control
#define FSCTRL0 0x0C // Frequency synthesizer control
#define FREQ2 0x0D // Frequency control word, high byte
#define FREQ1 0x0E // Frequency control word, middle byte
#define FREQ0 0x0F // Frequency control word, low byte
#define MDMCFG4 0x10 // Modem configuration
#define MDMCFG3 0x11 // Modem configuration
#define MDMCFG2 0x12 // Modem configuration
#define MDMCFG1 0x13 // Modem configuration
#define MDMCFG0 0x14 // Modem configuration
#define DEVIATN 0x15 // Modem deviation setting
#define MCSM2 0x16 // Main Radio Cntrl State Machine config
#define MCSM1 0x17 // Main Radio Cntrl State Machine config
#define MCSM0 0x18 // Main Radio Cntrl State Machine config
#define FOCCFG 0x19 // Frequency Offset Compensation config
#define BSCFG 0x1A // Bit Synchronization configuration
#define AGCCTRL2 0x1B // AGC control
#define AGCCTRL1 0x1C // AGC control
#define AGCCTRL0 0x1D // AGC control
#define WOREVT1 0x1E // High byte Event 0 timeout
#define WOREVT0 0x1F // Low byte Event 0 timeout
#define WORCTRL 0x20 // Wake On Radio control
#define FREND1 0x21 // Front end RX configuration
#define FREND0 0x22 // Front end TX configuration
#define FSCAL3 0x23 // Frequency synthesizer calibration
#define FSCAL2 0x24 // Frequency synthesizer calibration
#define FSCAL1 0x25 // Frequency synthesizer calibration
#define FSCAL0 0x26 // Frequency synthesizer calibration
#define RCCTRL1 0x27 // RC oscillator configuration
#define RCCTRL0 0x28 // RC oscillator configuration
#define FSTEST 0x29 // Frequency synthesizer cal control
#define PTEST 0x2A // Production test
#define AGCTEST 0x2B // AGC test
#define TEST2 0x2C // Various test settings
#define TEST1 0x2D // Various test settings
#define TEST0 0x2E // Various test settings
#define MARCSTATE_IDLE 0x01
#define MARCSTATE_RX 0x0d
extern code unsigned char conf[0x2F];
void cc1100_init(void);
unsigned char cc1100_write(unsigned char addr, unsigned char* dat, unsigned char lenght);
unsigned char cc1100_write1(unsigned char addr,unsigned char dat);
unsigned char cc1100_read(unsigned char addr, unsigned char* dat, unsigned char lenght);
unsigned char cc1100_read1(unsigned char addr);
unsigned char cc1100_strobe(unsigned char cmd);
unsigned char cc1100_single(unsigned char b,bit end);
#endif

217
betty_scart/trunk/cmd.c Normal file
View file

@ -0,0 +1,217 @@
/*
cmd.c
Copyright (C) 2007
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "serial.h"
#include "cc1100.h"
#include <P89LPC932.h>
#include "cmd.h"
#include "rf.h"
unsigned char redir_dest = 0;
unsigned char redir_baud = baud_19200;
void transmit(unsigned char len) {
struct cc1100frame_ header;
sendWOR(0);
EKBI = 0;
cc1100_strobe(SIDLE);
while (cc1100_read1(0x35 | READ | BURST) != 01);
header.len = len + headerLen - 1;
header.destAddr = 0;
header.srcAddr = cc1100Addr;
header.packetType = packet_test;
cc1100_write(TX_fifo,(unsigned char *)&header,headerLen);
cc1100_single(TX_fifo | BURST,0);
while(len--) {
cc1100_single(get_inbuf(),0);
}
CS = 1;
cc1100_strobe(STX);
EKBI = 1;
send_string("TX Done");
}
void transmitRedir(unsigned char len, unsigned char dest) {
struct cc1100frame_ header;
header.len = len + headerLen - 1;
header.destAddr = dest;
header.srcAddr = cc1100Addr;
header.packetType = packet_redirDAT;
EKBI = 0;
cc1100_write(TX_fifo,(unsigned char *)&header,headerLen);
cc1100_single(TX_fifo | BURST,0);
while(len--) {
cc1100_single(get_inbuf(),0);
}
CS = 1;
cc1100_strobe(STX);
EKBI = 1;
}
void transmitB(void) {
unsigned char l;
unsigned char x;
unsigned char i;
while(!inbuflen);
l=get_inbuf();
if (l < 62) {
cc1100_single(TX_fifo ,0);
cc1100_single(l ,0);
for(i=0; i<l; i++) {
while(!inbuflen);
x=get_inbuf();
cc1100_single(x ,0 );
}
CS = 1;
cc1100_strobe(STX);
waitTX();
}
else {
send_byte(0x00);
}
}
void print_cc1100confi(void) {
unsigned char x;
cc1100_single(0x00 | BURST | READ,0);
for (x=0 ;x < 0x2F; x++) {
send_string("Reg 0x");
send_hexC(x);
send_string(" = 0x");
send_hexC(cc1100_single(0x00,0));
if ( (x & 3) == 3)
send_string(crlf);
else
send_string(" ");
}
CS = 1;
send_string(crlf);
cc1100_single(PATABLE | BURST | READ,0);
for (x=0 ;x < 0x08; x++) {
send_string("PATABLE[");
send_hexC(x);
send_string("] = 0x");
send_hexC(cc1100_single(0x00,0));
if ( (x & 3) == 3)
send_string(crlf);
else
send_string(" ");
}
CS = 1;
}
void print_cc1100status(void) {
send_string("CC1100 Read Status: ");
send_hexC(cc1100_strobe(SNOP | READ));
send_string(" Write Status: ");
send_hexC(cc1100_strobe(SNOP | WRITE));
}
void read_byteB(void) {
unsigned char x;
x=get_inbuf_wait();
cc1100_single(x | READ,0);
x = cc1100_single(0,1);
send_byte(x);
}
void write_byteB(void) {
unsigned char x;
x=get_inbuf_wait();
cc1100_single(x | WRITE ,0);
while (!RI);
x = SBUF;
RI = 0;
cc1100_single(x,1);
}
void read_burst_byteB(void) {
unsigned char l;
unsigned char x;
unsigned char i;
l=get_inbuf_wait();
x=get_inbuf_wait();
cc1100_single(x | READ | BURST ,0);
for(i=0; i<l; i++) {
x= cc1100_single(0 ,0 );
send_byte(x);
}
CS = 1;
}
void write_burst_byteB(void) {
unsigned char l;
unsigned char x;
unsigned char i;
l=get_inbuf_wait();
x=get_inbuf_wait();
cc1100_single(x | WRITE | BURST ,0);
for(i=0; i<l; i++) {
while (!RI);
x = SBUF;
RI = 0;
cc1100_single(x ,0 );
}
CS = 1;
}
void cmd_strobeB(void) {
unsigned char x;
x=get_inbuf_wait();
send_byte(cc1100_strobe(x));
}
void send_WORb(void) {
unsigned char x;
x=get_inbuf_wait();
sendWOR(x);
}

43
betty_scart/trunk/cmd.h Normal file
View file

@ -0,0 +1,43 @@
/*
cmd.h
Copyright (C) 2007
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef cmd_H
#define cmd_H
#define redir_ACK 0
#define redir_SET 1
#define redir_START 2
#define redir_STOP 3
#define redir_PING 4
extern unsigned char redir_dest;
extern unsigned char redir_baud;
void transmit(unsigned char len);
void transmitRedir(unsigned char len, unsigned char dest);
void transmitB(void);
void print_cc1100confi(void);
void print_cc1100status(void);
void read_byteB(void);
void write_byteB(void);
void read_burst_byteB(void);
void write_burst_byteB(void);
void cmd_strobeB(void);
void send_WORb(void);
#endif

176
betty_scart/trunk/main.c Normal file
View file

@ -0,0 +1,176 @@
/*
main.c
Copyright (C) 2007
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <P89LPC932.h> // special function register declarations
// for the Philips P89C931 device
#include "rf.h"
#include "serial.h"
#include "cmd.h"
#include "cc1100.h"
#include "timer.h"
volatile bit terminal;
volatile bit redirector;
__sfr __at (0xAD) CMP2_ ;
void main(void) {
unsigned char x;
unsigned char len;
P0M1 &= 0x6c;
P0M2 |= 0x92;
P0 = 0x83;
P1M1 &= 0x3e;
P1M2 |= 0xcd;
P1 = 0xcd;
P3M1 &= 0xfe;
P3M2 |= 0x01;
P3 = 0;
/*PT0AD = 0x24;
TMOD = 0x22;
TAMOD = 0x10;
TCON = 0x50;
AUXR1 = 0x20;
TH0 = 0x22;
TH1 = 0x80;
CMP2_ = 0x24;
*/
initTimer0();
initSerial();
RF_init();
RF_startIRQ();
EA = 1;
send_string(crlf);
send_string("Ready");
send_string(crlf);
terminal = 1;
//redirector = 1;
len =0;
while (1) {
if(redirector) {
if(inbuflen >= 58) {
transmitRedir(58,redir_dest);
}
else if(inbuflen && TF0) {
transmitRedir(inbuflen,redir_dest);
}
}
else if (terminal) {
if(len < inbuflen) {
x=get_inbuf_index(len++);
if (x == 0x0d) {
send_string(crlf);
inbuf[(inbufindex + len-1) & 0x3F] = 0;
x=get_inbuf();
len--;
if(len) {
switch(x) {
case 't':
if (inbuflen) {
transmit(len);
len = 0;
send_string(crlf);
}
break;
case 'r':
if (inbuflen) {
transmitRedir(len,0);
len = 0;
send_string("TX Done");
}
break;
case 's':
print_cc1100status();
break;
case 'c':
print_cc1100confi();
break;
case 'b':
terminal = 0;
send_byte(0x01);
break;
case 'w':
sendWOR(0x00);
break;
default:
send_string("Syntax error");
}
while(len) {
get_inbuf();
len--;
}
}
else {
send_string("Ready");
}
send_string(crlf);
}
else {
send_byte(x);
}
}
}
else {
if (inbuflen) {
x=get_inbuf();
switch(x) {
case 0x00:
break;
case 0x01:
transmitB();
break;
case 0x02:
cmd_strobeB();
break;
case 0x03:
read_byteB();
break;
case 0x04:
write_byteB();
break;
case 0x05:
read_burst_byteB();
break;
case 0x06:
write_burst_byteB();
break;
case 0x07:
send_WORb();
break;
default:
send_byte(0x00);
}
if (!terminal)
send_byte(0x01);
}
}
}
}

View file

@ -0,0 +1,45 @@
To run the programm the following µC settings has to be changend:
(with Betty-Heaven -> Scart -> Konfiguration)
UCFG1: 07
UCFG2: FF
Boot Vector: 00
Status Byte: 00
If you use the SCART-Betty-Kombiinterface remove R2, otherwise the programm will not work!
Serial settings: 38400,n,8,1, no handshake
Commands:
Terminal Mode:
==============
t<data> transmitt <data>
s show cc1100 status bytes
c show cc1100 configuration registers
b switch to binary mode
w send WOR packet
Binary mode:
============
0x00 NOP
0x01 <n> <data_1> ... <data_n> transmitt n Bytes (n<=61)
0x02 <cmd> send command strobe to cc1100, get status byte
0x03 <addr> read cc1100 single byte
0x04 <addr> <value> write cc1100 single byte
0x05 <n> <addr> read n bytes cc1100 burst mode
0x06 <n> <addr> <data_1> ... <data_n> write n bytes cc1100 burst mode
0x07 <addr> send WOR packet
Return value
0x00 syntax error
0x01 ready
0x02 <n> <data_1> ... <data_n> n bytes data received

223
betty_scart/trunk/rf.c Normal file
View file

@ -0,0 +1,223 @@
/*
rf.c
Copyright (C) 2009 Telekatz <telekatz@gmx.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <P89LPC932.h>
#include "cc1100.h"
#include "cmd.h"
#include "rf.h"
#include "serial.h"
bit WORsend;
unsigned char cc1100Addr;
extern volatile bit terminal;
extern volatile bit redirector;
void RF_init (void) {
cc1100_init();
WORsend=0;
cc1100Addr = conf[0x09];
}
void RF_startIRQ (void) {
KBPATN = 0x40;
KBMASK = 0x40;
KBCON = 0x02;
EKBI = 1;
}
void RF_isr (void) __interrupt (7) {
struct cc1100frameheader_ RXframe;
unsigned char i;
if(KBPATN & 0x40) {
KBPATN = 0x00; //IRQ on low level
KBCON = 0x02;
return;
}
RXframe.len = cc1100_read1(RXBYTES);
if (RXframe.len) {
bit startTX = 0;
if(RXframe.len > 3)
cc1100_read(RX_fifo, &RXframe.len,4);
else
cc1100_read(RX_fifo, &RXframe.len,RXframe.len);
if (RXframe.len > 3) {
if(terminal || redirector) {
bit ACK = 0;
switch ( RXframe.packetType) {
case packet_ping:
if (cc1100_read1(RX_fifo) == 0x01) {
RXframe.len = 0x04;
RXframe.destAddr = RXframe.srcAddr;
RXframe.srcAddr = cc1100Addr;
RXframe.packetType = packet_ping;
cc1100_write(TX_fifo,(unsigned char*)RXframe,4);
cc1100_write1(TX_fifo,0x02);
startTX = 1;
}
break;
case packet_redirDAT:
cc1100_single(RX_fifo | BURST | READ,0);
for(i=3;i<RXframe.len;i++) {
send_byte(cc1100_single(0,0));
}
CS = 1;
break;
case packet_redirCMD:
switch (cc1100_read1(RX_fifo)) {
case redir_ACK:
break;
case redir_SET:
if (RXframe.len > 4) {
unsigned char x;
x = cc1100_read1(RX_fifo);
if(x <= baud_115200) {
redir_baud = x;
}
ACK = 1;
}
break;
case redir_START:
redir_dest = RXframe.srcAddr;
setbaud(redir_baud);
redirector = 1;
ACK = 1;
break;
case redir_STOP:
redirector = 0;
setbaud(baud_default);
ACK = 1;
break;
case redir_PING:
ACK = 1;
break;
}
if(ACK) {
RXframe.len = 0x04;
RXframe.destAddr = RXframe.srcAddr;
RXframe.srcAddr = cc1100Addr;
RXframe.packetType = packet_redirCMD;
cc1100_write(TX_fifo,(unsigned char*)RXframe,4);
cc1100_write1(TX_fifo,redir_ACK);
startTX = 1;
}
break;
default:
if ((RXframe.len > 3) && terminal) {
send_string(crlf);
send_string("RX: ");
cc1100_single(RX_fifo | BURST | READ,0);
for(i=3;i<RXframe.len;i++) {
send_byte(cc1100_single(0,0));
}
CS = 1;
send_string(crlf);
}
}
}
else {
send_byte(0x02);
send_bytes(&RXframe.len, 4);
cc1100_single(RX_fifo | BURST | READ,0);
for(i=3;i<RXframe.len;i++) {
send_byte(cc1100_single(0,0));
}
CS = 1;
}
}
cc1100_strobe(SIDLE);
while (cc1100_read1(MARCSTATE) != MARCSTATE_IDLE);
cc1100_strobe(SFRX);
if(startTX)
cc1100_strobe(STX);
else
cc1100_strobe(SRX);
}
else {
if(cc1100_read1(MARCSTATE) != MARCSTATE_RX) {
cc1100_strobe(SIDLE);
while (cc1100_read1(MARCSTATE) != MARCSTATE_IDLE);
cc1100_strobe(SFRX);
cc1100_strobe(SFTX);
cc1100_strobe(SRX);
}
}
KBPATN = 0x40; //IRQ on high level
KBCON = 0x02;
}
void waitTX(void)
{
unsigned char status;
unsigned char x;
x=1;
while (x) {
status = cc1100_strobe(SNOP);
switch ( 0xf0 & status) {
case 0x70:
cc1100_strobe(SFTX);
break;
case 0x10:
if (WORsend)
cc1100_strobe(SIDLE);
x=0;
break;
case 0x00:
if (!(WORsend))
cc1100_strobe(SRX);
x=0;
break;
}
}
}
void sendWOR(unsigned char addr) {
unsigned char b[2];
unsigned int i;
b[0]=0x01;
b[1]=addr;
EKBI = 0;
WORsend=1;
cc1100_write1(0x18,conf[0x18] & 0xCF);
cc1100_strobe(SIDLE);
cc1100_strobe(SCAL);
waitTX();
i=0;
while (i++ < 250) {
cc1100_write(TX_fifo | BURST,b,2);
cc1100_strobe(STX);
waitTX();
}
cc1100_write1(0x18,conf[0x18]);
WORsend=0;
waitTX();
KBCON = 0x02;
EKBI = 1;
}

53
betty_scart/trunk/rf.h Normal file
View file

@ -0,0 +1,53 @@
/*
rf.h
Copyright (C) 2009 Telekatz <telekatz@gmx.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef RF_H
#define RF_H
#define packet_test 0x01
#define packet_ping 0x02
#define packet_time 0x03
#define packet_RFenc 0x04
#define packet_redirDAT 0x05
#define packet_redirCMD 0x06
extern unsigned char cc1100Addr;
struct cc1100frame_ {
unsigned char len;
unsigned char destAddr;
unsigned char srcAddr;
unsigned char packetType;
unsigned char dat[];
};
#define headerLen 0x04
struct cc1100frameheader_ {
unsigned char len;
unsigned char destAddr;
unsigned char srcAddr;
unsigned char packetType;
};
void RF_init (void);
void waitTX(void);
void sendWOR(unsigned char addr);
void RF_isr (void) __interrupt (7);
void RF_startIRQ (void);
#endif

178
betty_scart/trunk/serial.c Normal file
View file

@ -0,0 +1,178 @@
/*
serial.c
Copyright (C) 2007
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "serial.h"
#include "cmd.h"
#include <P89LPC932.h>
unsigned char inbufindex = 0;
volatile unsigned char inbuflen = 0;
idata unsigned char inbuf[64];
unsigned char outbufindex;
volatile unsigned char outbuflen;
idata unsigned char outbuf[64];
code unsigned char crlf[] = { 0x0d, 0x0a, 0x00 };
const unsigned char baudtable[10][2] = { {45, 27}, //1200
{22,133}, //2400
{11, 59}, //4800
{ 5,149}, //9600
{ 3,180}, //14400
{ 2,195}, //19200
{ 1,210}, //28800
{ 1, 89}, //38400
{ 0,225}, //57600
{ 0,104}}; //115200
void setbaud(unsigned char baud) {
BRGR0 = baudtable[baud][1];
BRGR1 = baudtable[baud][0];
}
void initSerial(void) {
SCON = (1<<4) | (1<<6) | (1<<1); // Mode1; Enable serial reception
SSTAT |= (1<<7) | (1<<5);
setbaud(baud_default);
BRGCON = 0x03;
RI = 0;
ESR = 1; //Enable serial receive interrupt
TI = 1;
PSR = 1; //Serial receive interrupt priority level 1
PST = 1; //Serial transmit interrupt priority level 1
}
void send_string(const unsigned char* string) {
unsigned char i=0;
while (string[i] != 0) {
send_byte(string[i++]);
}
}
void send_bytes(unsigned char* h, unsigned char l) {
unsigned char i=0;
while (i<l) {
send_byte(h[i++]);
}
}
void send_byte(unsigned char h) {
while(!put_outbuf(h))
EST = 1;
EST = 1;
}
void send_hexC(unsigned char c) {
unsigned char cn;
cn = (c>>4) & 0x0f;
cn += 0x30;
if (cn > 0x39)
cn += 0x07;
send_byte(cn);
cn = c & 0x0f;
cn += 0x30;
if (cn > 0x39)
cn += 0x07;
send_byte(cn);
}
void serial_in_isr (void) __interrupt (4) {
if (inbuflen < 64) {
put_inbuf(SBUF);
}
RI = 0;
TF0 = 0;
TH0 = 0;
}
void serial_out_isr (void) __interrupt (13) {
if (outbuflen) {
SBUF = get_outbuf();
TI=0;
}
else {
EST = 0;
}
}
unsigned char get_inbuf(void) {
unsigned char x = 0;
EA = 0;
if(inbuflen) {
inbuflen--;
x = inbuf[(inbufindex++) & 0x3F];
}
EA = 1;
return(x);
}
unsigned char get_outbuf(void) {
unsigned char x = 0;
EA = 0;
if(outbuflen) {
outbuflen--;
x = outbuf[(outbufindex++) & 0x3F];
}
EA = 1;
return(x);
}
unsigned char get_inbuf_wait(void) {
unsigned char x;
while(!inbuflen);
EA = 0;
inbuflen--;
x = inbuf[(inbufindex++) & 0x3F];
EA = 1;
return(x);
}
unsigned char get_inbuf_index(unsigned char index) {
return(inbuf[(inbufindex + index) & 0x3F]);
}
void put_inbuf(unsigned char dat) {
if (inbuflen < 64)
inbuf[(inbufindex + inbuflen++) & 0x3F] = dat;
}
unsigned char put_outbuf(unsigned char dat) {
EA = 0;
if (outbuflen < 64) {
outbuf[(outbufindex + outbuflen++) & 0x3F] = dat;
EA = 1;
return 1;
}
EA = 1;
return 0;
}

View file

@ -0,0 +1,63 @@
/*
serial.h
Copyright (C) 2007
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef serial_H
#define serial_H
#define CTS P0_4
#define baud_1200 0
#define baud_2400 1
#define baud_4800 2
#define baud_9600 3
#define baud_14400 4
#define baud_19200 5
#define baud_28800 6
#define baud_38400 7
#define baud_57600 8
#define baud_115200 9
#define baud_default baud_38400
__sbit __at (0xFE) PST;
extern code unsigned char crlf[];
extern unsigned char inbufindex;
extern volatile unsigned char inbuflen;
extern idata unsigned char inbuf[64];
extern unsigned char outbufindex;
extern volatile unsigned char outbuflen;
extern idata unsigned char outbuf[64];
void setbaud(unsigned char baud);
void initSerial(void);
void send_string(const unsigned char* string);
void send_hexC(unsigned char c);
void send_bytes(unsigned char* h, unsigned char l);
void send_byte(unsigned char h);
void serial_in_isr (void) __interrupt (4);
void serial_out_isr (void) __interrupt (13);
unsigned char get_inbuf(void) ;
unsigned char get_outbuf(void);
unsigned char get_inbuf_wait(void);
unsigned char get_inbuf_index(unsigned char index);
void put_inbuf(unsigned char dat);
unsigned char put_outbuf(unsigned char dat);
#endif

27
betty_scart/trunk/timer.c Normal file
View file

@ -0,0 +1,27 @@
/*
timer.c
Copyright (C) 2009 Telekatz <telekatz@gmx.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <P89LPC932.h>
void initTimer0(void) {
TMOD |= (1<<0); //Timer0 mode1
TR0 = 1; //Timer0 run
}

25
betty_scart/trunk/timer.h Normal file
View file

@ -0,0 +1,25 @@
/*
timer.h
Copyright (C) 2009 Telekatz <telekatz@gmx.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef timer_H
#define timer_H
void initTimer0(void);
#endif

69
bmp2b/trunk/Makefile Normal file
View file

@ -0,0 +1,69 @@
# native builds
CC = gcc
CFLAGS = -Wall -I/usr/src/linux/include
# cross build
ARCH = arm-elf
CROSS_CC = $(ARCH)-gcc
CROSS_AS = $(ARCH)-as
CROSS_LD = $(ARCH)-ld
CROSS_OBJCOPY = $(ARCH)-objcopy
CROSS_OPTS = -mcpu=arm7tdmi-s
CROSS_CFLAGS = $(CROSS_OPTS) -Wall -Os
CROSS_ASLAGS = $(CROSS_OPTS) --gstabs
CROSS_RAM_LDFLAGS = -Tlpc2220_ram.ld -nostartfiles -nostdlib
CROSS_ROM_LDFLAGS = -Tlpc2220_rom.ld -nostartfiles -nostdlib
# build objects
HOST_TARGET = lpcload fwdump font2b
CROSS_TARGET = fwbc.hex fwflash.hex betty.hex
# betty deps
BETTY_DEPS = system.o uart.o buttons.o spi.o display.o flash.o functions.o
BETTY_DEPS += interrupts.o pwm.o #pffs.o
# all projects
all: $(HOST_TARGET) $(CROSS_TARGET)
# bmp2b / font2b
links:
bmp.c: links
bmp.o: bmp.c
$(CC) -c $(CFLAGS) -o $@ $<
bmp2b: bmp.o
# arm code
arm: arm_clean $(CROSS_TARGET)
# .o out of .c
%.o: %.c
$(CROSS_CC) -c $(CROSS_CFLAGS) -o $@ $<
# .o out of .s
%.o: %.s
$(CROSS_AS) $(CROSS_ASLAGS) -o $@ $<
# .elf out of .o
%.elf: %.o startup.o interrupts.o
$(CROSS_LD) $(CROSS_RAM_LDFLAGS) startup.o interrupts.o -o $@ $<
# betty is special ;)
betty.elf: betty.o startup.o $(BETTY_DEPS)
#$(CROSS_LD) $(CROSS_ROM_LDFLAGS) startup.o $(BETTY_DEPS) -o $@ $<
$(CROSS_LD) $(CROSS_RAM_LDFLAGS) startup.o $(BETTY_DEPS) -o $@ $<
# .hex out of .elf
%.hex: %.elf
$(CROSS_OBJCOPY) -O ihex $< $@
# host clean
clean:
rm -vf lpcload fwdump
# arm clean
arm_clean:
rm -vf *.o *.hex *.elf

34
bmp2b/trunk/README1ST Normal file
View file

@ -0,0 +1,34 @@
folgendes:
um ein Bild betty-tauglich umzuwandeln:
1. das bild MUSS (!!!1einself) im 24bit-rgb-farbraum sein
2. das bild MUSS 128 px breit und 160 px hoch sein
3. "make bmp2b" eingeben
4. "./bmp2b -c -i bild.bmp -o out" eingeben, wobei bild.bmp die eingangsdatei ist und out die ausgangsdatei
5. es werden zwei dateien erzeugt: erstens "out", also die ausgabedatei; zweitens blook_bild.bmp
in dieser zweiten datei wird das bild mit 4 graustufen dargestellt, so wie es voraussichtlich auf der
betty aussieht
6. das bild kann verwendet werden. zur benutzung als logo zB einfach nach display/boop_logo kopieren.
...fertig
viel erfolg.
damaltor
das grundprogramm kommt von hackbard@hackdaworld.org, ich habe das makefile etwas angepasst und die ersten zeilen
der ausgabe angepasst.
zur erzeugung eines 24bpp bildes aus einem 8bpp:
gimp öffnen
neue datei
128x160 und rgb auswählen
das bild hineinkopieren
speichern als bmp, erweiterte optionen -> 24 bpp auswählen (!!)
fertig

BIN
bmp2b/trunk/betty.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

BIN
bmp2b/trunk/betty2.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

219
bmp2b/trunk/bmp.c Normal file
View file

@ -0,0 +1,219 @@
/* bmp.c -- bmp write/read api
*
* author: hackbard@hackdaworld.dyndns.org
*
*/
#include "bmp.h"
int bmp_init(t_bmp *bmp,int outfd) {
dprintf(outfd,"[bmp] initializing bmp api ...\n");
memset(bmp,0,sizeof(t_bmp));
bmp->outfd=outfd;
return B_SUCCESS;
}
int bmp_shutdown(t_bmp *bmp) {
if(bmp->map!=NULL) {
dprintf(bmp->outfd,"[bmp] free pixmap memory\n");
free(bmp->map);
}
dprintf(bmp->outfd,"[bmp] shutdown\n");
return B_SUCCESS;
}
int bmp_check_header_and_info(t_bmp *bmp) {
dprintf(bmp->outfd,"[bmp] magic identifier: %c%c\n",
bmp->hdr.identifier&0xff,bmp->hdr.identifier>>8);
if(bmp->info.compression!=0) {
dprintf(bmp->outfd,"[bmp] compression not supported\n");
return B_NO_SUPPORT;
}
if(bmp->info.bpp!=24) {
dprintf(bmp->outfd,"[bmp] only true color (24bpp) supported\n");
return B_NO_SUPPORT;
}
if(bmp->hdr.offset!=BMP_H_SIZE+BMP_I_SIZE) {
dprintf(bmp->outfd,"[bmp] files with %d bytes offset not supported\n",
bmp->hdr.offset);
return B_NO_SUPPORT;
}
if(bmp->info.size!=BMP_I_SIZE) {
dprintf(bmp->outfd,"[bmp] files with %d bytes info size not supported\n",
bmp->info.size);
return B_NO_SUPPORT;
}
return B_SUCCESS;
}
int bmp_alloc_map(t_bmp *bmp) {
int size;
size=bmp->width*bmp->height*3;
dprintf(bmp->outfd,"[bmp] alloc map memory (%d bytes)\n",size);
if((bmp->map=(t_pixel *)malloc(size))==NULL) {
dprintf(bmp->outfd,"[bmp] memory map alloc failed\n");
return B_E_MEM;
}
return B_SUCCESS;
}
int bmp_write_file(t_bmp *bmp) {
int fill,xsize,size;
int y;
unsigned char buf[3];
memset(buf,0,3);
if(!(bmp->mode&WRITE)) {
dprintf(bmp->outfd,"[bmp] write mode not specified\n");
return B_WRONG_MODE;
}
xsize=bmp->width*3;
fill=(4-(xsize%4))%4;
size=(xsize+fill)*bmp->height;
/* construct it */
bmp->hdr.identifier='B'|('M'<<8);
bmp->hdr.size=size+BMP_H_SIZE+BMP_I_SIZE;
bmp->hdr.offset=BMP_H_SIZE+BMP_I_SIZE;
bmp->info.size=BMP_I_SIZE;
bmp->info.width=bmp->width;
bmp->info.height=bmp->height;
bmp->info.planes=1;
bmp->info.bpp=24;
bmp->info.imagesize=size;
if(bmp->info.xres==0) bmp->info.xres=2048;
if(bmp->info.yres==0) bmp->info.yres=2048;
bmp->info.noc=0;
bmp->info.ic=0;
/* write it */
if((bmp->fd=open(bmp->file,O_WRONLY|O_CREAT))<0) {
dprintf(bmp->outfd,"[bmp] unable to open file %s\n",bmp->file);
return B_NO_FILE;
}
if(write(bmp->fd,&(bmp->hdr),BMP_H_SIZE)<BMP_H_SIZE) {
dprintf(bmp->outfd,"[bmp] unable to write bmp header\n");
return B_E_WRITE_DATA;
}
if(write(bmp->fd,&(bmp->info),BMP_I_SIZE)<BMP_I_SIZE) {
dprintf(bmp->outfd,"[bmp] unable to write bmp info\n");
return B_E_WRITE_DATA;
}
for(y=0;y<bmp->height;y++) {
if(write(bmp->fd,bmp->map+y*bmp->width,xsize)<xsize) {
dprintf(bmp->outfd,"[bmp] unable to write image data line %d\n",y);
return B_E_WRITE_DATA;
}
if(write(bmp->fd,buf,fill)<fill) {
dprintf(bmp->outfd,"[bmp] unable to write fill bytes\n");
return B_E_WRITE_DATA;
}
}
close(bmp->fd);
return B_SUCCESS;
}
int bmp_cut_grab_bottom(t_bmp *dst,t_bmp *src,int dz,unsigned char m) {
int off;
dst->width=src->width;
dst->height=dz;
if(dz>src->height) {
dprintf(src->outfd,"[bmp] cut region greater than image height\n");
return B_E_GEOMETRY;
}
if(bmp_alloc_map(dst)!=B_SUCCESS) {
dprintf(dst->outfd,"[bmp] no map memory\n");
return B_E_MEM;
}
off=(m==GRAB)?0:(src->height-dz)*src->width;
memcpy(dst->map,src->map+off,dz*src->width*sizeof(t_pixel));
return B_SUCCESS;
}
int bmp_read_file(t_bmp *bmp) {
unsigned char buf[BMP_H_SIZE+BMP_I_SIZE];
int y,xsize;
int crop;
if(!(bmp->mode&READ)) {
dprintf(bmp->outfd,"[bmp] read mode not specified\n");
return B_WRONG_MODE;
}
if((bmp->fd=open(bmp->file,O_RDONLY))<0) {
dprintf(bmp->outfd,"[bmp] unable to open file %s\n",bmp->file);
return B_NO_FILE;
}
if(read(bmp->fd,buf,BMP_H_SIZE+BMP_I_SIZE)<BMP_H_SIZE+BMP_I_SIZE) {
dprintf(bmp->outfd,"[bmp] error reading bmp header & info\n");
return B_NO_HI;
}
memcpy(&(bmp->hdr),buf,BMP_H_SIZE);
memcpy(&(bmp->info),buf+BMP_H_SIZE,BMP_I_SIZE);
if(bmp_check_header_and_info(bmp)!=B_SUCCESS) {
dprintf(bmp->outfd,"[bmp] header/info check failed\n");
return B_HI_FAIL;
}
bmp->width=bmp->info.width;
bmp->height=bmp->info.height;
bmp->map=(t_pixel *)malloc(bmp->width*bmp->height*sizeof(t_pixel));
if(bmp->map==NULL) {
dprintf(bmp->outfd,"[bmp] malloc of map memory failed\n");
return B_E_MEM;
}
crop=bmp->info.imagesize/bmp->height-bmp->width*(bmp->info.bpp/8);
xsize=(bmp->info.bpp/8)*bmp->width;
for(y=0;y<bmp->height;y++) {
if(read(bmp->fd,bmp->map+y*bmp->width,xsize)<xsize) {
dprintf(bmp->outfd,"[bmp] reading image data of line %d failed\n",y);
return B_E_READ_DATA;
}
if(read(bmp->fd,buf,crop)<crop) {
dprintf(bmp->outfd,"[bmp] failed reading rest of line\n");
return B_E_READ_DATA;
}
}
close(bmp->fd);
return B_SUCCESS;
}

85
bmp2b/trunk/bmp.h Normal file
View file

@ -0,0 +1,85 @@
/* bmp.h -- bmp headers */
#ifndef BMP_H
#define BMP_H
/* includes */
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
/* defines */
#define B_SUCCESS 1
#define B_ERROR -1
#define B_WRONG_MODE -2
#define B_NO_FILE -3
#define B_NO_HI -4
#define B_NO_SUPPORT -5
#define B_HI_FAIL -6
#define B_E_MEM -7
#define B_E_READ_DATA -8
#define B_E_WRITE_DATA -9
#define B_E_GEOMETRY -10
#define MAX_CHARS_FILE 128
#define BMP_H_SIZE 14
#define BMP_I_SIZE 40
#define GRAB 'g'
/* bmp specific variables */
typedef struct s_bmp_hdr {
unsigned short int identifier;
unsigned int size;
unsigned short int reserved1;
unsigned short int reserved2;
unsigned int offset; /* <- 14 + 40 bytes = 0x36 */
} __attribute__ ((packed)) t_bmp_hdr; /* 14 bytes */
typedef struct s_bmp_info {
unsigned int size; /* 40 bytes = 0x28 */
int width;
int height;
unsigned short int planes;
unsigned short int bpp;
unsigned int compression;
unsigned int imagesize;
unsigned int xres;
unsigned int yres;
unsigned int noc;
unsigned int ic;
} __attribute__ ((packed)) t_bmp_info; /* 40 bytes */
typedef struct s_pixel {
unsigned char b;
unsigned char g;
unsigned char r;
} __attribute__ ((packed)) t_pixel;
typedef struct s_bmp {
int outfd;
int width;
int height;
unsigned char mode;
#define READ (1<<0)
#define WRITE (1<<1)
char file[MAX_CHARS_FILE];
int fd;
t_bmp_hdr hdr;
t_bmp_info info;
t_pixel *map;
} t_bmp;
/* function prototypes */
int bmp_init(t_bmp *bmp,int outfd);
int bmp_shutdown(t_bmp *bmp);
int bmp_check_header_and_info(t_bmp *bmp);
int bmp_alloc_map(t_bmp *bmp);
int bmp_write_file(t_bmp *bmp);
int bmp_cut_grab_bottom(t_bmp *dst,t_bmp *src,int dz,unsigned char m);
int bmp_read_file(t_bmp *bmp);
#endif

168
bmp2b/trunk/bmp2b.c Normal file
View file

@ -0,0 +1,168 @@
/*
* bmp2b.c - convert colored 24 bit bmp to the betty display ram format
*
* author: hackbard@hackdaworld.org
* changed: damaltor@gmail.com
* changelog: edited the first lines of output to fit boop's requirements
* the old line is still there, but commented
*
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "bmp.h"
#define DX 128
#define DY 160
#define PM (DY/8)
#define BINARY 1
#define CHAR 2
#define SHOW 3
int main(int argc,char **argv) {
int i,fd;
t_bmp src,dst;
char in[128];
char out[128];
char blook[128+8];
unsigned char stat;
unsigned char buf[2];
int page,col;
int b,pix;
stat=0;
for(i=1;i<argc;i++) {
if(argv[i][0]!='-')
continue;
switch(argv[i][1]) {
case 'i':
strncpy(in,argv[++i],128);
break;
case 'o':
strncpy(out,argv[++i],128);
break;
case 'b':
stat=BINARY;
break;
case 'c':
stat=CHAR;
break;
default:
printf("usage:\n\n");
printf("%s -i <bitmap> -o <out file> [-b/c]\n",
argv[0]);
printf("\n");
printf(" -b: binary out\n");
printf(" -c: char array\n\n");
return -1;
}
}
/* the bitmap infile */
bmp_init(&src,1);
src.mode=READ;
strncpy(src.file,in,128);
bmp_read_file(&src);
/* the bitmap outfile */
sprintf(blook,"blook_%s",in);
bmp_init(&dst,1);
dst.mode=WRITE;
strncpy(dst.file,blook,128+8);
dst.width=src.width;
dst.height=src.height;
bmp_alloc_map(&dst);
if((src.width!=DX)|(src.height=!DY)) {
printf("wrong dimensions: %d %d (need: %d %d)\n",
src.width,src.height,DX,DY);
return -1;
}
/* out file */
fd=open(out,O_WRONLY|O_CREAT);
if(fd<0) {
perror("open outfile");
return fd;
}
if(stat==CHAR)
dprintf(fd,"const unsigned char b_w = %d;\nconst unsigned char b_h = %d;\nconst char b_data[] = {\n",DX,DY);
// dprintf(fd,"const unsigned char default_logo[%d]={\n",DX*PM*2);
// was the old function
for(page=0;page<PM;page++) {
for(col=0;col<DX;col++) {
buf[0]=0;
buf[1]=0;
for(i=0;i<8;i++) {
// bmp: bottom rows first ... (i forgot that!)
pix=((DY-1-(page*8+i))*DX)+col;
b=src.map[pix].r+src.map[pix].g+src.map[pix].b;
b/=3;
if(b<=(0.25*255)) {
buf[0]|=(1<<i);
buf[1]|=(1<<i); // 1 1
dst.map[pix].r=0;
dst.map[pix].g=0;
dst.map[pix].b=0;
continue;
}
if(b<=(0.5*255)) {
buf[0]|=(1<<i); // 1 0
dst.map[pix].r=0.25*255;
dst.map[pix].g=0.25*255;
dst.map[pix].b=0.25*255;
continue;
}
if(b<=(0.75*255)) {
buf[1]|=(1<<i); // 0 1
dst.map[pix].r=0.75*255;
dst.map[pix].g=0.75*255;
dst.map[pix].b=0.75*255;
continue;
}
// 0 0 .. do nothing!
dst.map[pix].r=255;
dst.map[pix].g=255;
dst.map[pix].b=255;
}
if(stat==BINARY) {
i=write(fd,buf,2);
if(i<0) {
perror("bin write");
return i;
}
if(i!=2) {
printf("write failure\n");
return -1;
}
}
else if(stat==CHAR) {
dprintf(fd,"\t0x%02x,0x%02x%c\n",buf[0],buf[1],
((page+1==PM)&(col+1==DX))?' ':',');
}
}
}
if(stat==CHAR)
dprintf(fd,"};\n");
bmp_write_file(&dst);
close(fd);
bmp_shutdown(&src);
bmp_shutdown(&dst);
return 0;
}

BIN
bmp2b/trunk/bmp2b.tar.bz2 Normal file

Binary file not shown.

View file

@ -0,0 +1 @@
In this directory you find mini boop versions running from RAM. See README in each directory.

View file

@ -0,0 +1 @@
<Project name="Boop"><File path="Boop.pnproj"></File><File path="crt.s"></File><File path="externs.h"></File><File path="flash.c"></File><File path="flash.h"></File><File path="fonty.c"></File><File path="fonty.h"></File><File path="irq.c"></File><File path="irq.h"></File><File path="keyboard.c"></File><File path="keyboard.h"></File><File path="lcd.c"></File><File path="lcd.h"></File><File path="lpc2220.h"></File><File path="lpc2220.ld"></File><File path="main.c"></File><File path="Makefile"></File><File path="soundcore.c"></File><File path="soundcore.h"></File><File path="Makefile.local"></File><File path="lpc2220_rom.ld"></File><File path="serial.h"></File><File path="serial.c"></File></Project>

View file

@ -0,0 +1,2 @@
06.12.2007 <ck@mamalala.org>:
- starting complete code rework

View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View file

@ -0,0 +1,4 @@
SUBDIRS := adc audio cc1100 display flash games gui infrared interrupt \
keyboard rtc serial timer tools
SRCS := crt.s main.c global.c

View file

@ -0,0 +1,98 @@
###############################################################
#####
##### Makefile for boop - communicate with betty
##### Created at 30.8.2007 02:26 am
#####
##### boop V0.1 by netguy - ck@mamalala.net
##### Makefile V0.1 by alterego - alteregon@gmx.net
#####
###############################################################
###############################################################
#####
##### PATHS (default installation)
#####
##### You can put your path-config into Makefile.local
##### to override these defaults
#####
###############################################################
ARMBASE=/opt/toolchains/gcc-arm-none-eabi-4_9-2014q4
INCLUDEPATH=$(ARMBASE)/include
ARMPATH=$(ARMBASE)/bin
TOOLPREFIX=/arm-none-eabi-
BOOTLOADER_DEVICE=/dev/ttyUSB0
###############################################################
#####
##### Compiler, Linker and Tools
#####
###############################################################
CC=$(ARMPATH)$(TOOLPREFIX)gcc
AS=$(ARMPATH)$(TOOLPREFIX)as
#LD=$(ARMPATH)$(TOOLPREFIX)ld
LD=$(CC)
OC=$(ARMPATH)$(TOOLPREFIX)objcopy
OD=$(ARMPATH)$(TOOLPREFIX)objdump
CPUFLAGS=-mcpu=arm7tdmi-s
OPTFLAGS=-Os
CFLAGS=$(CPUFLAGS) -c -Wall -mthumb-interwork -msoft-float -I$(INCLUDEPATH) -ggdb
ASFLAGS=$(CPUFLAGS) -D --gstabs -mthumb-interwork -mfpu=softfpa
LDFLAGS = -mthumb-interwork -nostartfiles -Xlinker -Map -Xlinker boop.map -Tlpc2220.ld
THUMBFLAGS=-mthumb
-include Makefile.local
###############################################################
#####
##### Do the boop
#####
###############################################################
all: boop_rom.bin
boop_rom.bin: boop_ram.elf
$(OC) -O binary boop_ram.elf boop_ram.bin
$(OC) -O ihex boop_ram.elf boop_ram.hex
boop_ram.elf: crt.o lcd.o fonty.o main.o irq.o keyboard.o soundcore.o
$(LD) -o boop_ram.elf crt.o lcd.o fonty.o main.o irq.o keyboard.o soundcore.o $(LDFLAGS)
test: boop_ram.elf
$(OD) -h boop_ram.elf
crt.o: crt.s
$(AS) $(ASFLAGS) -o crt.o crt.s
irq.o: irq.c irq.h
$(CC) $(CFLAGS) $(OPTFLAGS) -o irq.o irq.c
keyboard.o: keyboard.c keyboard.h
$(CC) $(CFLAGS) -o keyboard.o keyboard.c
soundcore.o: soundcore.c soundcore.h
$(CC) $(CFLAGS) -o soundcore.o soundcore.c
lcd.o: lcd.c lcd.h
$(CC) $(CFLAGS) $(OPTFLAGS) $(THUMBFLAGS) -o lcd.o lcd.c
fonty.o: fonty.c fonty.h
$(CC) $(CFLAGS) $(OPTFLAGS) $(THUMBFLAGS) -o fonty.o fonty.c
main.o: main.c
$(CC) $(CFLAGS) $(OPTFLAGS) -o main.o main.c
ramload: boop_ram.bin
lpctool -d $(BOOTLOADER_DEVICE) -r boop_ram.bin
resident: boop_ram.bin
lpctool -d $(BOOTLOADER_DEVICE) -i -v -e -a boop_ram.bin
clean:
$(RM) -v *.o *.elf *.bin *.hex *~
### EOF

View file

@ -0,0 +1,24 @@
###############################################################
#####
##### Makefile.local.WinARM for boop
##### Created in the early morninghours
#####
##### Makefile.local.WinARM V1.0 by alterego - alteregon@gmx.net
#####
###############################################################
###############################################################
#####
##### PATHS (default installation)
#####
##### You can put your path-config into Makefile.local
##### to override these defaults
#####
###############################################################
ARMBASE=/opt/toolchains/gcc-arm-none-eabi-4_9-2014q4
INCLUDEPATH=$(ARMBASE)/include
ARMPATH=$(ARMBASE)/bin
TOOLPREFIX=/arm-none-eabi-
######################## EOF ##################################

View file

@ -0,0 +1,23 @@
###############################################################
#####
##### Makefile.local.WinARM for boop
##### Created in the early morninghours
#####
##### Makefile.local.WinARM V1.0 by alterego - alteregon@gmx.net
#####
##### Copy this file to Makefile.local for your Windows
##### installation
#####
###############################################################
ARMBASE = F:/Tools/WinARM
INCLUDEPATH = $(ARMBASE)/include
LIBPATH = $(ARMBASE)/arm-elf/lib/interwork
ARMPATH = $(ARMBASE)/bin
TOOLPREFIX = arm-elf-
LPCTOOL = lpctool.exe
CFLAGS = -Wall -mthumb-interwork -msoft-float -ggdb
######################## EOF ##################################

View file

@ -0,0 +1,20 @@
###############################################################
#####
##### Makefile.local.WinARM for boop
##### Created in the early morninghours
#####
##### Makefile.local.WinARM V1.0 by alterego - alteregon@gmx.net
#####
##### Copy this file to Makefile.local for your Windows
##### installation
#####
###############################################################
ARMBASE = c:/WinARM/
INCLUDEPATH = $(ARMBASE)/include
LIBPATH = $(ARMBASE)/arm-elf/lib/interwork
ARMPATH = $(ARMBASE)/bin
TOOLPREFIX = arm-elf-
LPCTOOL = lpctool.exe
######################## EOF ##################################

View file

@ -0,0 +1,25 @@
###############################################################
#####
##### Makefile.local.linuxARM for boop
##### Created in the early morninghours
#####
##### Makefile.local.linuxARM
#####
###############################################################
###############################################################
#####
##### PATHS (default installation)
#####
##### You can put your path-config into Makefile.local
##### to override these defaults
#####
###############################################################
ARMBASE=/opt/armtool/4.1.1
INCLUDEPATH=$(ARMBASE)/include
LIBPATH=$(ARMBASE)/arm-elf/lib/interwork
ARMPATH=$(ARMBASE)/bin
TOOLPREFIX=/arm-elf-
######################## EOF ##################################

View file

@ -0,0 +1,25 @@
24.7.2009:
boop for running in RAM. Created by telekatz for testing sound features.
Run it with
lpctool -r boop_rom.bin -d /dev/ttyUSB2
See Thread
http://bettyhacks.com/forum/index.php?topic=215.0
9.11.2007:
- serial console:
115200 baud, 8N1, no handshake
- serial commands:
0 - backlight off
1 - dimmed backlight
2 - full backlight
. - prints "HELO"
S - prints RCA_Encode status (hex value)
I - prints irIRQ status (hex value)
K - prints keyIRQ status (hex value)
all other inputs are echoed
- flash boop_rom.bin:
lpctool -i -e -a ./boop_rom.bin -d /dev/<serial_device>

View file

@ -0,0 +1,24 @@
const unsigned char b_w = 128;
const unsigned char b_h = 160;
const char b_data[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0x80,0xC0,0xE0,0xE0,0xC0,0xE0,0xF0,0xF0,0xE0,0xF0,0xE8,0xF8,0xF0,0xF8,0xE0,0xF8,0x64,0xF8,0x24,0xFC,0x30,0xFC,0x32,0xFC,0x3A,0xFE,0x78,0xFE,0xF8,0xFE,0xF9,0xFE,0xFD,0xFE,0xFD,0xFE,0xFD,0xFE,0xFF,0xFE,0xFF,0xFE,0xFD,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x05,0x07,0x0F,0x1F,0x2F,0x7F,0xBF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0xFF,0x80,0xF8,0x07,0xC1,0x3E,0x07,0xF8,0xFF,0x00,0xFF,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x7F,0xFF,0x7F,0xBF,0x3F,0xFF,0xF0,0x08,0xC0,0xE0,0xC0,0xE0,0xE0,0xC0,0xE0,0xF0,0xE0,0xF0,0x80,0x60,0x80,0xC0,0x80,0xC0,0xC0,0x80,0xC0,0x80,0xC0,0x80,0xC0,0x80,0xC0,0x80,0x80,0xC0,0x80,0xD0,0xF0,0xD0,0xF0,0xE0,0xE0,0xD0,0x80,0x40,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x20,0xE0,0x40,0xE0,0x60,0xE0,0xE0,0xE1,0xE2,0xE3,0xFF,0xE7,0xDF,0xE7,0xDB,0xEF,0xF7,0xE7,0x7B,0xE7,0x3B,0xE7,0xBA,0xE3,0xB4,0xE3,0xB0,0xF1,0xE2,0xF1,0xE2,0xF1,0xF8,0xF9,0xF0,0xF8,0xFD,0xFC,0xF9,0xFC,0x7F,0xBE,0x4D,0xFF,0xCA,0xFF,0xFB,0xFF,0xFD,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF7,0xFF,0xE3,0xFF,0xE3,0xFF,0xE3,0xFF,0xE3,0xFF,0xE3,0xFF,0xE3,0xFF,0xE3,0xFF,0xC3,0xFF,0xC3,0xEF,0x97,0xCF,0xB7,0x9F,0x67,0x9F,0x6F,0x3F,0xDE,0x7E,0x9F,0xFE,0x3C,0xFC,0x7C,0xF8,0xFC,0xF8,0xFC,0xFC,0xFA,0xFE,0xFC,0x3C,0xD8,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x14,0x3C,0xD8,0xF8,0xFC,0xFC,0xF8,0xFE,0xC5,0xFF,0xC3,0xFF,0xE1,0xFF,0x71,0x7F,0xF9,0x7F,0xFF,0xFF,0x7F,0xFF,0x7F,0x7F,0xDF,0x5F,0x2F,0x1F,0x2F,0x1F,0x2F,0x1F,0x2F,0x1F,0x3F,0x1F,0x3F,0x3F,0x1F,0x3F,0x7F,0x18,0x67,0x3F,0x5C,0x1F,0x3F,0x1F,0x0F,0x0F,0x1F,0x0F,0x17,0x07,0x0F,0x07,0x0B,0x03,0x0F,0x8B,0x57,0x9F,0xCF,0x9F,0x8F,0x8F,0x17,0x03,0x0D,0x03,0x0D,0x03,0x05,0x03,0x1D,0x33,0x1D,0x7F,0x33,0x7F,0x3F,0x7F,0x3F,0x3F,0x5F,0x1F,0x7F,0x3F,0xDF,0x7F,0xBE,0xFE,0xFD,0xFE,0xF9,0xFF,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xF8,0xF6,0xE0,0xF0,0xE0,0xC0,0xE0,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0xC0,0x80,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0xC0,0x80,0xC0,0x80,0x80,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0xC0,0x60,0xCF,0xF3,0xFF,0xFF,0xFF,0xFF,0x3F,0xDF,0x1F,0xAC,0x00,0x1F,0x00,0x01,0x00,0x00,0x00,0x80,0xF0,0x08,0x1C,0x22,0x06,0x02,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x01,0x01,0x00,0x83,0x40,0x06,0x83,0x0C,0x86,0x08,0xD4,0x10,0x08,0x10,0x80,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x04,0x0E,0x15,0x1C,0x3F,0x1F,0xBC,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0x3F,0x5F,0x0F,0x17,0x03,0x05,0x01,0x03,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x04,0x18,0x3C,0x38,0x30,0x30,0x78,0x70,0x31,0x71,0x60,0x71,0x60,0x71,0x21,0x33,0x61,0x1F,0x23,0x07,0x03,0x0E,0x07,0x0C,0x1E,0x38,0x10,0x60,0xD0,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x03,0x07,0x8A,0x0F,0x96,0xF6,0x19,0xE0,0xF0,0xE0,0xF2,0x83,0x70,0x00,0x7D,0xF0,0x08,0x00,0x1F,0x04,0x0A,0x04,0x08,0x0C,0xD2,0x0E,0xDD,0x5C,0xA8,0x7C,0xFA,0xF0,0x6A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x1C,0xE1,0x83,0x04,0x02,0x01,0x01,0x12,0x03,0x34,0x07,0x73,0x37,0x4A,0x3F,0xDE,0x7C,0x9B,0x00,0x38,0x00,0x00,0x00,0x00,0x0C,0x32,0x3C,0xFE,0x7C,0xBA,0xFC,0x7F,0xFF,0x7E,0xFF,0x7F,0xFF,0x7F,0xFF,0x7F,0xFF,0x71,0x70,0xF0,0x70,0x38,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x18,0x38,0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0xE3,0x1F,0xE7,0x3F,0xC7,0x5F,0xA3,0x00,0xE7,0x00,0x80,0x00,0x85,0x02,0x05,0x00,0x06,0x0C,0x00,0x00,0x04,0x04,0x09,0x00,0x1F,0x03,0x04,0x01,0x04,0x00,0x00,0x00,0x00,0x00,0x80,0x88,0x48,0xC8,0x98,0x80,0xC0,0x80,0xC0,0x80,0x00,0x80,0x00,0x00,0x80,0x80,0x03,0x81,0x00,0x80,0x07,0x82,0x01,0x00,0x82,0x02,0x85,0x00,0x83,0x01,0x82,0x00,0xC2,0x00,0xC0,0x00,0xC0,0x00,0x60,0x00,0x60,0x00,0x70,0x00,0x3F,0x00,0x1F,0x00,0x17,0x00,0x1F,0x00,0x3F,0x00,0x1F,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x72,0x23,0xE3,0x62,0xC3,0xE7,0xC3,0xC7,0xC7,0x83,0x87,0xC7,0x87,0x8E,0x8E,0x07,0x0E,0x8E,0x0C,0x9E,0x1C,0x08,0x18,0x30,0xE0,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x03,0x00,0x03,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x03,0x00,0x03,0x00,0xFB,0xFC,0xFB,0xFE,0xFD,0xFE,0x7F,0xFE,0x7F,0xFF,0x2E,0xFF,0xFE,0x1F,0xEE,0x0F,0x1F,0x0F,0x07,0x0F,0x06,0x0F,0x1E,0x0F,0x1F,0x0F,0x1F,0x0F,0xDE,0xFF,0xCF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x1E,0xFF,0x0E,0xFE,0x8F,0xFE,0xFF,0xFC,0xFE,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x01,0x03,0x03,0x01,0x03,0x01,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x01,0x01,0x03,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0xF8,0x77,0xFF,0xC7,0xFF,0x81,0xFF,0xFC,0xFF,0xF0,0xFB,0xE4,0xFF,0xE1,0xF0,0xCF,0x80,0x60,0x00,0xF0,0xC0,0x38,0xC0,0xB0,0xE0,0xF0,0xF8,0xF4,0xFF,0xF0,0xF9,0xE6,0xFF,0xF0,0xFF,0xFC,0xFF,0xFF,0xFF,0x0F,0xFF,0x00,0xFF,0xE0,0xFF,0xF8,0xFF,0xFF,0x7F,0xBF,0x0F,0x13,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x80,0xC0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xC0,0xC0,0xE0,0xC0,0xC0,0x80,0xC0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0xF9,0x06,0xFF,0x37,0xFF,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0xFF,0xFF,0x7F,0xFF,0xFE,0xFC,0xFB,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0xFF,0x3F,0xFF,0x1F,0xFF,0x8F,0xFF,0xEF,0xFF,0xEF,0xFF,0xFF,0xFF,0xFF,0xFF,0xBF,0x1F,0xAF,0x03,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF3,0x25,0xEF,0xF7,0xF9,0xE1,0xF1,0xE0,0xE1,0xE0,0xE1,0xC1,0xC1,0xC1,0xC1,0x83,0xC3,0x83,0x83,0xC7,0x87,0xC3,0x87,0x8E,0x8E,0x9C,0xF8,0xB4,0x00,0x80,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0xB0,0x00,0x98,0x08,0xD6,0x0F,0xDA,0x1F,0xC0,0x1F,0xF8,0x3F,0xDE,0x7F,0xBF,0x7F,0x9F,0x0F,0x35,0x0E,0x15,0x07,0x0A,0x07,0x0F,0x0F,0x97,0x9F,0x33,0x3F,0xF1,0xFF,0x78,0xFF,0xFC,0xFF,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0xFF,0x7F,0xFF,0x7F,0x0F,0x3F,0x47,0x3F,0x46,0x3C,0x02,0x38,0x04,0x30,0x68,0x60,0x80,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x83,0x40,0xC0,0xE1,0xE0,0xE0,0xE0,0xF0,0xF0,0xE1,0xF0,0xE1,0xE1,0xF0,0xE1,0xE1,0xE1,0xC3,0xC3,0xE1,0xC3,0x83,0x83,0x07,0x07,0x03,0x07,0x07,0x07,0x0F,0x07,0x0F,0x0F,0x07,0x0F,0x0F,0x0F,0x1F,0x3F,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x04,0x3A,0x08,0xF7,0xCC,0x33,0x28,0x57,0x18,0x27,0x1C,0xE3,0x18,0xE7,0x10,0x29,0x00,0x39,0x10,0x29,0x10,0x29,0x00,0x3D,0x00,0xBF,0x00,0xFC,0x80,0x78,0xE1,0x1A,0x7D,0x82,0x1C,0xEF,0x0E,0xC5,0x07,0xC3,0x03,0xC1,0x01,0x83,0x01,0x80,0x00,0x81,0x00,0x80,0x80,0x00,0x80,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xE0,0x00,0xFF,0xC0,0x3F,0x3F,0xC0,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x11,0x38,0x11,0x70,0x30,0xE0,0x70,0xE0,0xE1,0xE0,0xC1,0xC1,0xE0,0xC1,0xC1,0xC1,0xC1,0xC1,0x83,0xC3,0x83,0xC3,0x87,0xC7,0xCE,0xFC,0x6A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x01,0xFE,0xF0,0x0E,0x00,0x00,0x00,0x07,0x00,0xFE,0x00,0x80,0x00,0xC0,0x00,0xE0,0xC0,0x38,0x38,0x46,0x0C,0x13,0x03,0x04,0x01,0x02,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x0F,0x0F,0x90,0x0F,0xF7,0x0F,0xF5,0x8F,0x76,0xCF,0xB2,0xFC,0xE3,0xFC,0x33,0x0E,0x31,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0xC0,0xE0,0xE0,0xE0,0xE0,0xF0,0xF0,0xE1,0xF1,0xE1,0xE1,0xF3,0xE3,0xE1,0xE3,0xC3,0xC3,0xE3,0xC3,0x83,0x83,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x00,0x7E,0x01,0x1E,0x00,0x0F,0x01,0x1E,0x00,0xFE,0x00,0x80,0x00,0x1F,0xF8,0x07,0x18,0x67,0x03,0x1C,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x80,0x70,0xC0,0xB8,0xE0,0xDC,0xF0,0xEE,0xF8,0xF7,0xFC,0x7B,0xFE,0xFD,0xFF,0xFE,0x3F,0x5F,0x0F,0x17,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x11,0x38,0x11,0x70,0x30,0xE0,0x70,0xE0,0xE1,0xE0,0xC1,0xC1,0xE0,0xC1,0xC1,0xC1,0xC1,0xC1,0x83,0xC3,0x83,0xC3,0x87,0xC7,0xCE,0xFC,0x6A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x63,0x9C,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x3C,0xC3,0xFC,0x02,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x18,0xE6,0x04,0x0B,0x02,0x05,0x00,0x03,0x00,0x01,0x03,0x0C,0x1F,0x0F,0x07,0x0B,0x03,0x05,0x1F,0x27,0x3F,0x0F,0x01,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0xA0,0xE0,0xE0,0xE0,0xF0,0xF0,0xE0,0xF0,0xE1,0xE1,0xF1,0xE1,0xE3,0xE3,0xC1,0xC3,0xE3,0xC3,0x83,0x83,0x83,0x03,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x78,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x03,0x07,0xF8,0x07,0xF8,0x30,0xCF,0x00,0xF8,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x02,0x0D,0x00,0x3C,0x00,0xF0,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0xC0,0x00,0xC0,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0x40,0x00,0x80,0x00,0x80,0x00,0xC0,0x00,0x40,0x00,0xC0,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x0C,0x7E,0x7C,0x1E,0x3C,0x1C,0x1E,0x1C,0x3C,0x3C,0x18,0x3C,0x38,0x38,0x7C,0x79,0x3A,0x7B,0x7F,0x78,0xFD,0xF0,0x78,0xF0,0x70,0xE0,0xF0,0xE0,0xE1,0xE0,0xC1,0xC1,0xE1,0xC1,0xC3,0xC3,0x83,0xC7,0x83,0xCE,0x84,0xF8,0x74,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x1E,0x00,0xF0,0x00,0x80,0x00,0x0F,0x00,0xFF,0x00,0xF0,0x01,0x0E,0x1C,0xE3,0x60,0x9E,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x2C,0xD2,0xC0,0x26,0x80,0x41,0x80,0x40,0x00,0xFC,0x00,0x3D,0x01,0x02,0x00,0x1F,0x00,0xF6,0x20,0x12,0x70,0xA0,0xC0,0x20,0x00,0x00,0x00,0x00,0x00,0x30,0x10,0x78,0x70,0xC3,0x00,0x46,0x00,0x9C,0x20,0x59,0x20,0x13,0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x01,0x01,0x01,0x03,0x03,0x01,0x03,0x03,0x03,0x03,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x08,0x37,0x00,0xFF,0x03,0xFC,0x80,0x78,0x00,0x1F,0x00,0xFF,0x03,0xFC,0x1C,0xE3,0x00,0xF8,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x80,0x7F,0x80,0xC1,0xC3,0x84,0x40,0xAF,0xE0,0x1C,0x80,0x40,0x00,0xC0,0x00,0xF0,0x00,0xE0,0x00,0x20,0x00,0x47,0x4C,0xA0,0x4C,0xE2,0x2C,0xD2,0x00,0xA4,0x00,0x60,0x00,0x40,0x00,0x6F,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x05,0x0E,0x31,0xE0,0x1F,0x00,0x07,0x00,0xFF,0x00,0xD7,0xC0,0xBF,0xFC,0xE3,0x00,0x7C,0x00,0x00,0x00,0x00,0x00,0xBF,0x9F,0x60,0x9F,0x6F,0xCF,0x17,0x80,0x07,0x00,0x00,0x01,0x00,0x03,0x0D,0x1F,0x08,0x0E,0x19,0x0E,0x05,0x0E,0x05,0x0E,0x01,0x0E,0x05,0x0F,0x9C,0x1F,0x6C,0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x70,0x28,0x78,0x07,0x78,0xE7,0x40,0xA1,0x3F,0xC0,0x3F,0x5F,0xFF,0x3F,0xF0,0x28,0xF0,0x00,0x78,0xF6,0x7F,0x3E,0x1F,0x3F,0x7F,0x3C,0x3F,0x48,0x03,0x2C,0x00,0x3E,0x00,0x38,0x00,0x20,0x00,0x60,0x00,0x40,0x00,0x47,0x02,0x45,0x00,0x67,0x00,0x61,0x00,0x65,0x00,0x76,0x00,0x66,0x20,0x56,0x04,0x60,0x20,0x1C,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};

View file

@ -0,0 +1,80 @@
/*
batt.c -
Copyright (C) 2007
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "lpc2220.h"
#include "batt.h"
#include "lcd.h"
void initADC(void)
{
/* Setup A/D: 10-bit AIN0 @ 4,2MHz "Non-Burst"-Mode */
//PINSEL1 |= (1UL<<28); // set function P0.29 as AIN2
// sample AIN0 only => bit 0 = 1
// CLKDIV = 14 (59/14 = 4.21 < 4.5 MHz) => Bits 8ff = 14-1
// BURST = 1 => set Bit 16 - wuff: disabled below
// PDN = 1 => set Bit 21
ADCR = ( 1<<5 | ((14-1)<<8) /*| (1UL<<16)*/ | (1UL<<21) );
}
unsigned int getADCvalue(void)
{
unsigned int val=0;
ADCR = ( 1<<5 | ((14-1)<<8) /*| (1UL<<16)*/ | (1UL<<21) );
ADCR |= (1UL<<24); /* Start A/D Conversion (START:0=1) */
while ((ADDR & (1UL<<31)) == 0); /* Wait for the conversion to complete (DONE=1)*/
val = ((ADDR >> 6) & 0x03FF); /* Extract the A/D result */
ADCR &=~(1UL<<21);
return val;
}
void draw_battery(unsigned char x, unsigned char y)
{
unsigned int val=0;
unsigned char w=0;
draw_rect(x,y,14,7,1,3,DRAW_PUT);
draw_vline(x+14,y+2,3,3,DRAW_PUT);
draw_block(x+1,y+1,12,5,2,DRAW_ERASE);
val=getADCvalue();
if (val<0x320)
val=0x320;
if (val>0x380)
val=0x380;
w= (val-0x320)/8;
draw_block(x+1,y+1,w,5,2,DRAW_PUT);
}
void draw_ant(unsigned char x, unsigned char y, unsigned char m) {
draw_vline(x+3,y,7,3,m);
draw_pixel(x,y,3,m);
draw_pixel(x+1,y+1,3,m);
draw_pixel(x+2,y+2,3,m);
draw_pixel(x+6,y,3,m);
draw_pixel(x+5,y+1,3,m);
draw_pixel(x+4,y+2,3,m);
}

View file

@ -0,0 +1,27 @@
/*
batt.h -
Copyright (C) 2007
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BATT_H
#define BATT_H
void initADC(void);
unsigned int getADCvalue(void);
void draw_battery(unsigned char x, unsigned char y);
void draw_ant(unsigned char x, unsigned char y, unsigned char m);
#endif

View file

@ -0,0 +1 @@
<pd><ViewState><e p="Boop" x="true"></e></ViewState></pd>

View file

@ -0,0 +1 @@
<Workspace name="New Project Group"><Project path="Boop.pnproj"></Project><Project path="L:\Betty\Neuer Ordner\trunk\Boop_flash.pnproj"></Project></Workspace>

View file

@ -0,0 +1,158 @@
/*
batt.c -
Copyright (C) 2007
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "lpc2220.h"
#include "cc1100.h"
#include "irq.h"
const unsigned char conf[0x2F] = { 0x29 , 0x2E , 0x07 , 0x00 , 0xD3 , 0x91 , 0x3D , 0x0C ,
0x05 , 0x00 , 0x00 , 0x06 , 0x00 , 0x20 , 0x28 , 0xC5 ,
0xF5 , 0x75 , 0x83 , 0x22 , 0xE5 , 0x14 , 0x07 , 0x30 ,
0x18 , 0x16 , 0x6C , 0x03 , 0x40 , 0x91 , 0x87 , 0x6B ,
0xF8 , 0x56 , 0x10 , 0xE9 , 0x2A , 0x00 , 0x1F , 0x41 ,
0x00 , 0x59 , 0x7F , 0x3F , 0x81 , 0x35 , 0x09 };
volatile unsigned char cc1100rx;
void cc1100_init(void) {
unsigned long xx = 0x200;
PINSEL1 &= ~((1<<3) | (1<<5) | (1<<7));
PCONP &= 0xfffffbff;
PCONP |= (1<<21);
FIOSET0 = SCK1;
FIOCLR0 = MOSI1;
FIOCLR0 = CS1;
while(xx) {
asm volatile("nop" : :);
xx--;
}
FIOSET0 = CS1;
xx=0x200;
while(xx) {
asm volatile("nop" : :);
xx--;
}
FIOCLR0 = CS1;
FIOCLR0 = SCK1;
while (FIOPIN0 & MISO1);
PINSEL1 |= 0x000002A8; //((1<<3) | (1<<5) | (1<<7));
SSPCR0 = 0x0007;
SSPCPSR = 0x02;
SSPCR1 = 0x02;
SSPDR = SRES;
while (FIOPIN0 & MISO1);
while (SSPSR & (1<<4));
xx = SSPDR;
cc1100_write((0x00 | BURST ),conf,0x2f);
}
unsigned char cc1100_write(unsigned char addr,unsigned char* data, unsigned char lenght) {
unsigned short i;
unsigned char status;
unsigned char x;
FIOCLR0 = CS1;
while (FIOPIN0 & MISO1);
SSPDR = (addr | WRITE);
while ((SSPSR & (1<<4)));
status = SSPDR;
for (i=0; i < lenght; i++) {
SSPDR = data[i];
while ((SSPSR & (1<<4)));
x=SSPDR;
}
FIOSET0 = CS1;
return(status);
}
unsigned char cc1100_read(unsigned char addr, unsigned char* data, unsigned char lenght) {
unsigned short i;
unsigned char status;
FIOCLR0 = CS1;
while (FIOPIN0 & MISO1);
SSPDR = (addr | READ);
while ((SSPSR & (1<<4)));
status = SSPDR;
for (i=0; i < lenght; i++) {
SSPDR = 0x00;
while ((SSPSR & (1<<4)));
data[i]=SSPDR;
}
FIOSET0 = CS1;
return(status);
}
unsigned char cc1100_strobe(unsigned char cmd) {
unsigned short status;
FIOCLR0 = CS1;
while (FIOPIN0 & MISO1);
SSPDR = cmd;
while ((SSPSR & (1<<4)));
status = SSPDR;
FIOSET0 = CS1;
return(status);
}
void startcc1100IRQ(void) {
PINSEL1 |= 1;
EXTMODE |= 1;
EXTPOLAR |= 1;
EXTINT |= 1;
VICVectAddr1 = (unsigned long)&(cc1100IRQ);
VICVectCntl1 = VIC_SLOT_EN | INT_SRC_EINT0;
VICIntEnable = INT_EINT0;
}
void cc1100_getfifo(unsigned char* b) {
unsigned char cnt;
cc1100_read(RX_fifo, &cnt,1);
cc1100_read(RX_fifo, b,cnt+2);
b[cnt]=0;
}
void __attribute__ ((interrupt("IRQ"))) cc1100IRQ (void) {
EXTINT = 0x01;
cc1100rx =1;
VICVectAddr = 0;
}

View file

@ -0,0 +1,56 @@
/*
batt.h -
Copyright (C) 2007
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef cc1100_H
#define cc1100_H
#define MISO1 (1<<18)
#define MOSI1 (1<<19)
#define SCK1 (1<<17)
#define CS1 (1<<23)
#define WRITE 0x00
#define BURST 0x40
#define READ 0x80
#define TX_fifo 0x7F
#define RX_fifo 0xff
#define SRES 0x30
#define SFSTXON 0x31
#define SXOFF 0x32
#define SCLA 0x33
#define SRX 0x34
#define STX 0x35
#define SIDLE 0x36
#define SWOR 0x38
#define SPWD 0x39
#define SFRX 0x3A
#define SFTX 0x3B
#define SWORRST 0x3C
#define SNOP 0x3D
void cc1100_init(void);
unsigned char cc1100_write(unsigned char addr, unsigned char* data, unsigned char lenght);
unsigned char cc1100_read(unsigned char addr, unsigned char* data, unsigned char lenght);
unsigned char cc1100_strobe(unsigned char cmd);
void startcc1100IRQ(void);
void __attribute__ ((interrupt("IRQ"))) cc1100IRQ (void);
void cc1100_getfifo(unsigned char* b);
#endif

View file

@ -0,0 +1,199 @@
/*
crt.s - startup code
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
.global main
.global _etext
.global _data
.global _edata
.global __bss_start
.global __bss_end__
.global _stack
/* Stack Sizes */
.set UND_STACK_SIZE, 0x00000004 /* stack for "undefined instruction" interrupts is 4 bytes */
.set ABT_STACK_SIZE, 0x00000004 /* stack for "abort" interrupts is 4 bytes */
.set FIQ_STACK_SIZE, 0x00000004 /* stack for "FIQ" interrupts is 4 bytes */
.set IRQ_STACK_SIZE, 0X00000100 /* stack for "IRQ" normal interrupts is 4 bytes */
.set SVC_STACK_SIZE, 0x00000004 /* stack for "SVC" supervisor mode is 4 bytes */
/* Standard definitions of Mode bits and Interrupt (I & F) flags in PSRs */
.set MODE_USR, 0x10 /* Normal User Mode */
.set MODE_FIQ, 0x11 /* FIQ Processing Fast Interrupts Mode */
.set MODE_IRQ, 0x12 /* IRQ Processing Standard Interrupts Mode */
.set MODE_SVC, 0x13 /* Supervisor Processing Software Interrupts Mode */
.set MODE_ABT, 0x17 /* Abort Processing memory Faults Mode */
.set MODE_UND, 0x1B /* Undefined Processing Undefined Instructions Mode */
.set MODE_SYS, 0x1F /* System Running Priviledged Operating System Tasks Mode */
.set I_BIT, 0x80 /* when I bit is set, IRQ is disabled (program status registers) */
.set F_BIT, 0x40 /* when F bit is set, FIQ is disabled (program status registers) */
.text
.arm
.global Reset_Handler
.global _startup
.global _endstartup
.global ramvectors
.func ramvectors
ramvectors:
ldr PC, Ram_Reset_Addr
ldr PC, Ram_Undef_Addr
ldr PC, Ram_SWI_Addr
ldr PC, Ram_PAbt_Addr
ldr PC, Ram_DAbt_Addr
nop /* Reserved Vector (holds Philips ISP checksum) */
ldr PC, [PC,#-0xFF0] /* Route IRQ to VIC */
ldr PC, Ram_FIQ_Addr
Ram_Reset_Addr: .word Reset_Handler /* defined in this module below */
Ram_Undef_Addr: .word UNDEF_Routine /* defined in main.c */
Ram_SWI_Addr: .word SWI_Routine /* defined in main.c */
Ram_PAbt_Addr: .word UNDEF_Routine /* defined in main.c */
Ram_DAbt_Addr: .word UNDEF_Routine /* defined in main.c */
Ram_IRQ_Addr: .word IRQ_Routine /* defined in main.c */
Ram_FIQ_Addr: .word FIQ_Routine /* defined in main.c */
.word 0 /* rounds vectors to 64 bytes total */
.endfunc
.section .text
.func _startup
_startup:
# Exception Vectors
_vectors:
ldr PC, Reset_Addr
Reset_Addr: .word Reset_Handler
# Reset Handler
Reset_Handler:
/* Setup a stack for each mode - note that this only sets up a usable stack
for User mode. Also each mode is setup with interrupts initially disabled. */
ldr r0, =_stack_end
msr CPSR_c, #MODE_UND|I_BIT|F_BIT /* Undefined Instruction Mode */
mov sp, r0
sub r0, r0, #UND_STACK_SIZE
msr CPSR_c, #MODE_ABT|I_BIT|F_BIT /* Abort Mode */
mov sp, r0
sub r0, r0, #ABT_STACK_SIZE
msr CPSR_c, #MODE_FIQ|I_BIT|F_BIT /* FIQ Mode */
mov sp, r0
sub r0, r0, #FIQ_STACK_SIZE
msr CPSR_c, #MODE_IRQ|I_BIT|F_BIT /* IRQ Mode */
mov sp, r0
sub r0, r0, #IRQ_STACK_SIZE
msr CPSR_c, #MODE_SVC|I_BIT|F_BIT /* Supervisor Mode */
mov sp, r0
sub r0, r0, #SVC_STACK_SIZE
msr CPSR_c, #MODE_SYS|I_BIT|F_BIT /* User Mode */
mov sp, r0
/* Setup Pins and Memory */
ldr r0,=BCFG0
ldr r1, =0x10000420
str r1,[r0]
str r1,[r0,#0x08]
ldr r0, =BCFG1
ldr r1, =0xc42
str r1, [r0]
ldr r0, =PINSEL0
ldr r1, =0x00008005
str r1, [r0]
ldr r0, =PINSEL1
ldr r1, =0x20000000
str r1, [r0]
ldr r0, =PINSEL2
ldr r1, =0x0de049d4
str r1, [r0]
ldr r0, = IO2SET
ldr r1, =0x1FC0000
str r1, [r0]
str r1, [r0,#0x04]
ldr r0, = IO0DIR
ldr r1, =0x002018D0
str r1, [r0]
/* Setup PLL */
ldr r0, =0xe01fc000
ldr r2, =0xaa
ldr r3, =0x55
ldr r1, =0x03
str r1, [r0,#0x80]
ldr r1, =0x0
str r1, [r0,#0x100]
ldr r1, =0x42
str r1,[r0,#0x84]
str r2, [r0,#0x8c]
str r3, [r0,#0x8c]
_endstartup:
/* Copy .fastcode & .data section (Copy from ROM to RAM) */
ldr R0, =ramvectors /*_etext*/
ldr r3, entry_mask /* this and the next instruction are an workaround */
and r0, r0, r3 /* for some ugly bug in winarm to force msb to 0x80 */
ldr R1, =0x40000000 /*_data*/
ldr R2, =_startup
1:
cmp r1,r2
ldmltia r0!,{r3}
stmltia r1!,{r3}
blt 1b
/* Clear .bss section (Zero init) */
mov R0, #0
ldr R1, =_bss_start
ldr R2, =_bss_end
2:
cmp R1, R2
strlo R0, [R1], #4
blo 2b
ldr r0, =MEMMAP
ldr r1, =0x02 /* irq vectors in ram */
str r1, [r0]
mov r0,#0
mov r1,r0
mov r2,r0
mov fp,r0
mov r7,r0
ldr r10,=main
mov lr,pc
bx r10
.endfunc
entry_mask: .word 0x4FFFFFFF /* defined in this module below */
.end

View file

@ -0,0 +1,7 @@
#ifndef EXTERNS_H
#define EXTERNS_H
extern unsigned int keys[2];
extern unsigned char autorepeat;
#endif

View file

@ -0,0 +1,174 @@
/*
flash.c - writing/erasing flash
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "flash.h"
#include "serial.h"
#include "lcd.h"
const unsigned long secaddr[19] =
{ 0x00000,
0x02000,
0x03000,
0x04000,
0x08000,
0x10000,
0x18000,
0x20000,
0x28000,
0x30000,
0x38000,
0x40000,
0x48000,
0x50000,
0x58000,
0x60000,
0x68000,
0x70000,
0x78000 };
unsigned long flash_base;
int eraseSector(unsigned char chip, unsigned char secnum)
{
if(chip == 0)
flash_base = FLASH0_BASE;
else
flash_base = FLASH1_BASE;
serial_puts("Erasing Sector: 0x");
putHexW(flash_base + (secaddr[secnum]<<1));
*((volatile unsigned short *)(flash_base | 0xAAA)) = 0xAA;
*((volatile unsigned short *)(flash_base | 0x554)) = 0x55;
*((volatile unsigned short *)(flash_base | 0xAAA)) = 0x80;
*((volatile unsigned short *)(flash_base | 0xAAA)) = 0xAA;
*((volatile unsigned short *)(flash_base | 0x554)) = 0x55;
*((volatile unsigned short *)(flash_base + (secaddr[secnum]<<1))) = 0x30;
if((*((volatile unsigned short *)(flash_base)) & 0x44) == (*((volatile unsigned short *)(flash_base)) & 0x44))
{
serial_puts(" -- ERROR\n");
*((volatile unsigned short *)(flash_base)) = 0xF0;
return -1;
}
while ((*((volatile unsigned short *)(flash_base)) & 0x44) != (*((volatile unsigned short *)(flash_base)) & 0x44))
{}
serial_puts(" +> OK\n");
return 0;
}
int eraseFlash(unsigned char chip)
{
if(chip == 0)
flash_base = FLASH0_BASE;
else
flash_base = FLASH1_BASE;
*((volatile unsigned short *)(flash_base | 0xAAA)) = 0xAA;
*((volatile unsigned short *)(flash_base | 0x554)) = 0x55;
*((volatile unsigned short *)(flash_base | 0xAAA)) = 0x80;
*((volatile unsigned short *)(flash_base | 0xAAA)) = 0xAA;
*((volatile unsigned short *)(flash_base | 0x554)) = 0x55;
*((volatile unsigned short *)(flash_base | 0xAAA)) = 0x10;
if((*((volatile unsigned short *)(flash_base)) & 0x44) == (*((volatile unsigned short *)(flash_base)) & 0x44))
{
*((volatile unsigned short *)(flash_base)) = 0xF0;
return -1;
}
while ((*((volatile unsigned short *)(flash_base)) & 0x44) != (*((volatile unsigned short *)(flash_base)) & 0x44))
{}
return 0;
}
int writeWord(unsigned long addr, unsigned short data)
{
flash_base = addr & 0xFF000000;
*((volatile unsigned short *)(flash_base | 0xAAA)) = 0xAA;
*((volatile unsigned short *)(flash_base | 0x554)) = 0x55;
*((volatile unsigned short *)(flash_base | 0xAAA)) = 0xA0;
*((volatile unsigned short *)(addr)) = data;
if(*((volatile unsigned short *)(addr)) == *((volatile unsigned short *)(addr)))
{
serial_puts("NACK");
*((volatile unsigned short *)(flash_base)) = 0xF0;
return -1;
}
while(*((volatile unsigned short *)(addr)) != *((volatile unsigned short *)(addr)))
{}
return 0;
}
void prepareBulk(unsigned long dst)
{
flash_base = dst & 0xFF000000;
*((volatile unsigned short *)(flash_base | 0xAAA)) = 0xAA;
*((volatile unsigned short *)(flash_base | 0x554)) = 0x55;
*((volatile unsigned short *)(flash_base | 0xAAA)) = 0x20;
}
void endBulk(unsigned long dst)
{
flash_base = dst & 0xFF000000;
*((volatile unsigned short *)(flash_base)) = 0x90;
*((volatile unsigned short *)(flash_base)) = 0x00;
}
int writeBulk(unsigned long src, unsigned long dst, unsigned long cnt)
{
unsigned short check1, check2;
while(cnt--)
{
*((volatile unsigned short *)dst) = 0xA0;
*((volatile unsigned short *)dst) = *((volatile unsigned short *)src);
retry:
check1 = *((volatile unsigned short *)dst);
check2 = *((volatile unsigned short *)dst);
if((check1 & 0x40) == (check2 & 0x40))
goto done;
if(!(check2 & 0x20))
goto retry;
check1 = *((volatile unsigned short *)dst);
check2 = *((volatile unsigned short *)dst);
if((check1 & 0x40) == (check2 & 0x40))
goto done;
*((volatile unsigned short *)dst) = 0xF0;
return -1;
done:
check1 = *((volatile unsigned short *)dst);
check2 = *((volatile unsigned short *)dst);
if(check1 != check2)
goto retry;
src+=2;
dst+=2;
}
return 0;
}

View file

@ -0,0 +1,33 @@
/*
flash.h - writing/erasing flash
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FLASH_H
#define FLASH_H
#define FLASH0_BASE 0x80000000
#define FLASH1_BASE 0x82000000
void prepareBulk(unsigned long dst);
void endBulk(unsigned long dst);
int eraseSector(unsigned char chip, unsigned char secnum);
int eraseFlash(unsigned char chip);
int writeWord(unsigned long addr, unsigned short data);
int writeBulk(unsigned long src, unsigned long dst, unsigned long cnt);
void lcd_set(unsigned char s);
#endif

View file

@ -0,0 +1,118 @@
const unsigned char charset_bits[] = {
0x80, 0xc0, 0x80, 0xe0, 0x80, 0xc0, 0x80, 0xf0, 0x01, 0x03, 0x01, 0x07,
0x01, 0x03, 0x01, 0x0f, 0x80, 0x88, 0xaa, 0xff, 0xff, 0xaa, 0x88, 0x80,
0x00, 0xc0, 0x00, 0xe0, 0x00, 0xc0, 0x00, 0xf0, 0x00, 0x03, 0x00, 0x07,
0x00, 0x03, 0x00, 0x0f, 0x80, 0x88, 0xaa, 0xab, 0xab, 0xaa, 0x88, 0x80,
0x80, 0x80, 0x80, 0x70, 0x01, 0x01, 0x01, 0x0e, 0x0e, 0x01, 0x01, 0x01,
0x70, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x24,
0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x80, 0x00, 0x80,
0x00, 0x80, 0x00, 0x92, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0xaa,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x80, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xaa, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x81,
0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0xaa, 0x02, 0x05, 0x02, 0x00,
0x3e, 0x41, 0x41, 0x22, 0x02, 0x05, 0x02, 0x00, 0x7f, 0x09, 0x09, 0x01,
0x1c, 0x22, 0x41, 0x4f, 0x41, 0x22, 0x1c, 0x1c, 0x22, 0x41, 0x4f, 0x47,
0x22, 0x1c, 0x1c, 0x22, 0x41, 0x4f, 0x4f, 0x2e, 0x1c, 0x1c, 0x22, 0x41,
0x4f, 0x5f, 0x3e, 0x1c, 0x1c, 0x22, 0x41, 0x7f, 0x7f, 0x3e, 0x1c, 0x1c,
0x22, 0x71, 0x7f, 0x7f, 0x3e, 0x1c, 0x1c, 0x3a, 0x79, 0x7f, 0x7f, 0x3e,
0x1c, 0x1c, 0x3e, 0x7d, 0x7f, 0x7f, 0x3e, 0x1c, 0x1c, 0x3e, 0x7f, 0x7f,
0x7f, 0x3e, 0x1c, 0x00, 0x00, 0x5f, 0x03, 0x00, 0x03, 0x14, 0x7f, 0x14,
0x7f, 0x14, 0x24, 0x4a, 0xff, 0x4a, 0x32, 0x63, 0x13, 0x08, 0x64, 0x63,
0x36, 0x49, 0x55, 0x22, 0x50, 0x03, 0x1c, 0x22, 0x41, 0x41, 0x22, 0x1c,
0x14, 0x08, 0x3e, 0x08, 0x14, 0x08, 0x08, 0x3e, 0x08, 0x08, 0x80, 0x60,
0x60, 0x08, 0x08, 0x08, 0x08, 0x08, 0x60, 0x60, 0xc0, 0x30, 0x0c, 0x03,
0x3e, 0x51, 0x49, 0x45, 0x3e, 0x00, 0x42, 0x7f, 0x40, 0x00, 0x42, 0x61,
0x51, 0x49, 0x46, 0x22, 0x41, 0x49, 0x49, 0x36, 0x18, 0x14, 0x12, 0x7f,
0x10, 0x27, 0x45, 0x45, 0x45, 0x39, 0x3e, 0x49, 0x49, 0x49, 0x32, 0x61,
0x11, 0x09, 0x05, 0x03, 0x36, 0x49, 0x49, 0x49, 0x36, 0x26, 0x49, 0x49,
0x49, 0x3e, 0x6c, 0x6c, 0x80, 0x6c, 0x6c, 0x08, 0x14, 0x22, 0x41, 0x14,
0x14, 0x14, 0x14, 0x41, 0x22, 0x14, 0x08, 0x02, 0x01, 0x51, 0x09, 0x06,
0x3e, 0x41, 0x59, 0x55, 0x5e, 0x7e, 0x09, 0x09, 0x09, 0x7e, 0x7f, 0x49,
0x49, 0x49, 0x36, 0x3e, 0x41, 0x41, 0x41, 0x22, 0x7f, 0x41, 0x41, 0x41,
0x3e, 0x7f, 0x49, 0x49, 0x41, 0x41, 0x7f, 0x09, 0x09, 0x01, 0x01, 0x3e,
0x41, 0x41, 0x49, 0x3a, 0x7f, 0x08, 0x08, 0x08, 0x7f, 0x41, 0x7f, 0x41,
0x30, 0x41, 0x41, 0x41, 0x3f, 0x7f, 0x08, 0x14, 0x22, 0x41, 0x7f, 0x40,
0x40, 0x40, 0x40, 0x7f, 0x02, 0x0c, 0x02, 0x7f, 0x7f, 0x02, 0x04, 0x08,
0x7f, 0x3e, 0x41, 0x41, 0x41, 0x3e, 0x7f, 0x09, 0x09, 0x09, 0x06, 0x3e,
0x41, 0x41, 0x41, 0xbe, 0x7f, 0x09, 0x09, 0x09, 0x76, 0x26, 0x49, 0x49,
0x49, 0x32, 0x01, 0x01, 0x7f, 0x01, 0x01, 0x3f, 0x40, 0x40, 0x40, 0x3f,
0x1f, 0x20, 0x40, 0x20, 0x1f, 0x7f, 0x20, 0x10, 0x20, 0x7f, 0x41, 0x22,
0x1c, 0x22, 0x41, 0x07, 0x08, 0x70, 0x08, 0x07, 0x61, 0x51, 0x49, 0x45,
0x43, 0x7f, 0x41, 0x41, 0x03, 0x0c, 0x30, 0xc0, 0x41, 0x41, 0x7f, 0x02,
0x01, 0x02, 0x80, 0x80, 0x80, 0x80, 0x80, 0x01, 0x02, 0x20, 0x54, 0x54,
0x78, 0x7f, 0x48, 0x48, 0x30, 0x38, 0x44, 0x44, 0x24, 0x30, 0x48, 0x48,
0x7f, 0x38, 0x54, 0x54, 0x18, 0x08, 0x7e, 0x09, 0x02, 0x98, 0xa4, 0xa4,
0x78, 0x7f, 0x08, 0x08, 0x70, 0x44, 0x7d, 0x40, 0x44, 0x84, 0x7d, 0x7f,
0x10, 0x28, 0x44, 0x41, 0x7f, 0x40, 0x7c, 0x04, 0x18, 0x04, 0x78, 0x7c,
0x08, 0x04, 0x78, 0x38, 0x44, 0x44, 0x38, 0xfc, 0x24, 0x24, 0x18, 0x18,
0x24, 0x24, 0xfc, 0x7c, 0x08, 0x04, 0x08, 0x48, 0x54, 0x54, 0x24, 0x04,
0x3f, 0x44, 0x3c, 0x40, 0x20, 0x7c, 0x1c, 0x20, 0x40, 0x20, 0x1c, 0x3c,
0x40, 0x30, 0x40, 0x3c, 0x44, 0x28, 0x10, 0x28, 0x44, 0x9c, 0xa0, 0xa0,
0x7c, 0x64, 0x54, 0x54, 0x4c, 0x08, 0x36, 0x41, 0x77, 0x41, 0x36, 0x08,
0x08, 0x08, 0x2a, 0x1c, 0x08, 0x08, 0x1c, 0x2a, 0x08, 0x08, 0x00, 0x00,
0x00, 0xdf, 0xdf, 0x07, 0x07, 0x00, 0x07, 0x07, 0x14, 0x3e, 0x14, 0x3e,
0x14, 0x24, 0x4a, 0xff, 0x4a, 0x32, 0xf3, 0xfb, 0x18, 0xdf, 0xc7, 0x36,
0x49, 0x55, 0x22, 0x50, 0x04, 0x07, 0x03, 0x3c, 0x7e, 0xc3, 0x81, 0x81,
0xc3, 0x7e, 0x3c, 0x14, 0x08, 0x3e, 0x08, 0x14, 0x18, 0x7e, 0x7e, 0x18,
0x80, 0x60, 0x60, 0x18, 0x18, 0x18, 0x18, 0x18, 0x60, 0x60, 0xc0, 0xf0,
0x3c, 0x0f, 0x03, 0x7e, 0xff, 0xc3, 0xff, 0x7e, 0x04, 0xc6, 0xff, 0xff,
0xc0, 0xe6, 0xf7, 0xd3, 0xdf, 0xce, 0x42, 0xc3, 0xdb, 0xff, 0x76, 0x38,
0x3c, 0x36, 0xff, 0xff, 0x5f, 0xdf, 0xdb, 0xfb, 0x73, 0x7e, 0xff, 0xdb,
0xfb, 0x72, 0x03, 0xf3, 0xfb, 0x0f, 0x07, 0x76, 0xff, 0xdb, 0xff, 0x76,
0x4e, 0xdf, 0xdb, 0xff, 0x7e, 0x6c, 0x6c, 0x80, 0x6c, 0x6c, 0x18, 0x3c,
0x66, 0xc3, 0x81, 0x36, 0x36, 0x36, 0x36, 0x81, 0xc3, 0x66, 0x3c, 0x18,
0x06, 0xd3, 0xd9, 0x0f, 0x06, 0x7e, 0xc3, 0xdb, 0xd7, 0xde, 0xfe, 0xff,
0x33, 0xff, 0xfe, 0xff, 0xff, 0xdb, 0xff, 0x66, 0x7e, 0xff, 0xc3, 0xe7,
0x66, 0xff, 0xff, 0xc3, 0xff, 0x7e, 0xff, 0xff, 0xdb, 0xdb, 0xc3, 0xff,
0xff, 0x1b, 0x1b, 0x03, 0x7e, 0xff, 0xc3, 0xfb, 0x7a, 0xff, 0xff, 0x18,
0xff, 0xff, 0xc3, 0xff, 0xff, 0xc3, 0x60, 0xe3, 0xc3, 0xff, 0x7f, 0xff,
0xff, 0x1c, 0xf7, 0xe3, 0xff, 0xff, 0xc0, 0xc0, 0xc0, 0xff, 0xfe, 0x0c,
0xfe, 0xff, 0xff, 0xfe, 0x18, 0x7f, 0xff, 0x7e, 0xff, 0xc3, 0xff, 0x7e,
0xff, 0xff, 0x1b, 0x1f, 0x0e, 0x7e, 0xff, 0xc3, 0x7f, 0xde, 0xff, 0xff,
0x1b, 0xff, 0xee, 0x4e, 0xdf, 0xdb, 0xfb, 0x72, 0x03, 0xff, 0xff, 0x03,
0x03, 0x7f, 0xff, 0xc0, 0xff, 0x7f, 0x3f, 0x7f, 0xc0, 0x7f, 0x3f, 0xff,
0x7f, 0x30, 0x7f, 0xff, 0xe7, 0xe7, 0x18, 0x18, 0xe7, 0xe7, 0x0f, 0x1f,
0xf0, 0x1f, 0x0f, 0xe3, 0xf3, 0xdb, 0xcf, 0xc7, 0xff, 0xff, 0xc3, 0xc3,
0x03, 0x0f, 0x3c, 0xf0, 0xc0, 0xc3, 0xc3, 0xff, 0xff, 0x04, 0x06, 0x03,
0x06, 0x04, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x03, 0x07, 0x60, 0xf4, 0xd4,
0xf4, 0xf8, 0xff, 0xff, 0xcc, 0xfc, 0x78, 0x78, 0xfc, 0xcc, 0xcc, 0x48,
0x78, 0xfc, 0xcc, 0xff, 0xff, 0x78, 0xfc, 0xac, 0xbc, 0xb8, 0x18, 0xfe,
0xff, 0x1b, 0x1b, 0xb8, 0xbc, 0xac, 0xfc, 0x78, 0xff, 0xff, 0x18, 0xf8,
0xf0, 0xcc, 0xfd, 0xfd, 0xc0, 0xc0, 0xcc, 0xfd, 0x7d, 0xff, 0xff, 0x10,
0xfc, 0xec, 0x7f, 0xff, 0xc0, 0xc0, 0xfc, 0xfc, 0x0c, 0xfc, 0x0c, 0xfc,
0xf8, 0xfc, 0xf8, 0x0c, 0xfc, 0xf8, 0x78, 0xfc, 0xcc, 0xfc, 0x78, 0xfc,
0xfc, 0x6c, 0x7c, 0x38, 0x38, 0x7c, 0x6c, 0xfc, 0xf8, 0xfc, 0xf8, 0x0c,
0x1c, 0x18, 0xd8, 0xdc, 0xfc, 0xec, 0x6c, 0x0c, 0x7f, 0xff, 0xcc, 0xcc,
0x7c, 0xfc, 0xc0, 0x7c, 0xfc, 0x3c, 0x7c, 0xc0, 0x7c, 0x3c, 0x7c, 0xfc,
0xc0, 0x60, 0xc0, 0xfc, 0x7c, 0xcc, 0xfc, 0x30, 0xfc, 0xdc, 0x9c, 0xbc,
0xb0, 0xfc, 0x7c, 0xcc, 0xec, 0xfc, 0xdc, 0xcc, 0x10, 0x56, 0xef, 0x81,
0xef, 0xef, 0x81, 0xee, 0x56, 0x10, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x18,
0x3c, 0x7e, 0x18, 0x18, 0x8f, 0xc7, 0xe3, 0xf1, 0xf8, 0x7c, 0x3e, 0x1f,
0xc7, 0xe3, 0xf1, 0xf8, 0x7c, 0x3e, 0x1f, 0x8f, 0xe3, 0xf1, 0xf8, 0x7c,
0x3e, 0x1f, 0x8f, 0xc7, 0xf1, 0xf8, 0x7c, 0x3e, 0x1f, 0x8f, 0xc7, 0xe3,
0xf8, 0x7c, 0x3e, 0x1f, 0x8f, 0xc7, 0xe3, 0xf1, 0x7c, 0x3e, 0x1f, 0x8f,
0xc7, 0xe3, 0xf1, 0xf8, 0x3e, 0x1f, 0x8f, 0xc7, 0xe3, 0xf1, 0xf8, 0x7c,
0x1f, 0x8f, 0xc7, 0xe3, 0xf1, 0xf8, 0x7c, 0x3e, 0xff, 0xff, 0xe7, 0xc3,
0xc3, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xc3, 0xc3, 0xe7, 0xff, 0xff,
0xff, 0xf8, 0xe0, 0xc0, 0xc0, 0xe0, 0xf8, 0xff, 0xff, 0x1f, 0x07, 0x03,
0x03, 0x07, 0x1f, 0xff, 0x1c, 0x3e, 0x77, 0x63, 0x77, 0x3e, 0x1c, 0x1c,
0x36, 0x63, 0x41, 0x63, 0x36, 0x1c, 0x1c, 0x08, 0x41, 0x63, 0x41, 0x08,
0x1c, 0x08, 0x14, 0x22, 0x49, 0x22, 0x14, 0x08, 0x55, 0xaa, 0x55, 0xaa,
0x55, 0xaa, 0x55, 0xaa, 0x33, 0x33, 0xcc, 0xcc, 0x33, 0x33, 0xcc, 0xcc,
0x33, 0x33, 0x0e, 0x11, 0x0e, 0x12, 0x1f, 0x10, 0x19, 0x15, 0x12, 0x11,
0x15, 0x0a, 0x07, 0x04, 0x1e, 0x17, 0x15, 0x09, 0x0e, 0x15, 0x09, 0x01,
0x1d, 0x03, 0x0a, 0x15, 0x0a, 0x12, 0x15, 0x0e, 0x0a, 0x10, 0x0a, 0x04,
0x0a, 0x11, 0x0a, 0x0a, 0x0a, 0x11, 0x0a, 0x04, 0x01, 0x15, 0x02, 0x01,
0x03, 0x07, 0x03, 0x01, 0x04, 0x06, 0x07, 0x06, 0x04, 0x04, 0x0e, 0x1f,
0x1f, 0x0e, 0x04, 0x18, 0x3c, 0x7e, 0x7e, 0x3c, 0x18, 0x3c, 0x42, 0x81,
0x81, 0x81, 0x81, 0x42, 0x3c, 0x3c, 0x42, 0x99, 0xbd, 0xbd, 0x99, 0x42,
0x3c, 0x7f, 0x49, 0x41, 0x6b, 0x41, 0x49, 0x7f, 0x80, 0x40, 0x20, 0x10,
0x0f, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x07, 0x3e, 0x01, 0x01, 0x01,
0x01, 0x02, 0x04, 0x38, 0x08, 0x08, 0x08, 0x08, 0x01, 0x01, 0x01, 0x01,
0x15, 0x0a, 0x15, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

View file

@ -0,0 +1,22 @@
const unsigned char charset_info[] = {
0x08, 0x84, 0x48, 0x84, 0x44, 0x44, 0x48, 0x88, // 0- 15 graticule & borders
0x88, 0x88, 0x88, 0x87, 0x77, 0x77, 0x77, 0x77, // 16- 31 graticule & symbols
0x21, 0x35, 0x55, 0x51, 0x33, 0x55, 0x35, 0x24, // 32- 47 ascii, font 1
0x55, 0x55, 0x55, 0x55, 0x55, 0x23, 0x44, 0x45, // 48- 63 ascii, font 1
0x55, 0x55, 0x55, 0x55, 0x53, 0x55, 0x55, 0x55, // 64- 80 ascii, font 1
0x55, 0x55, 0x55, 0x55, 0x55, 0x53, 0x43, 0x35, // 80- 95 ascii, font 1
0x24, 0x44, 0x44, 0x44, 0x43, 0x34, 0x35, 0x44, // 96-112 ascii, font 1
0x44, 0x44, 0x34, 0x55, 0x54, 0x43, 0x13, 0x55, // 112-127 ascii, font 1
0x32, 0x55, 0x55, 0x53, 0x44, 0x54, 0x35, 0x25, // 128-143 ascii, bold font
0x55, 0x55, 0x55, 0x55, 0x55, 0x23, 0x54, 0x55, // 144-159 ascii, bold font
0x55, 0x55, 0x55, 0x55, 0x54, 0x55, 0x55, 0x55, // 160-175 ascii, bold font
0x55, 0x55, 0x55, 0x55, 0x65, 0x54, 0x54, 0x55, // 176-191 ascii, bold font
0x25, 0x55, 0x55, 0x55, 0x54, 0x45, 0x47, 0x55, // 192-207 ascii, bold font
0x55, 0x55, 0x55, 0x57, 0x55, 0x54, 0x24, 0x55, // 208-223 ascii, bold font
0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x77, 0x77, // 224-239 symbols
0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 240-255 symbols
0x33, 0x33, 0x33, 0x33, 0x33, 0x12, 0x33, 0x33, // 256-271 small numbers
0x55, 0x33, 0x68, 0x87, 0x84, 0x44, 0x44, 0x44 // 272-288 symbols
};
const unsigned char charset_dlines = 1;

View file

@ -0,0 +1,279 @@
const unsigned char smooth_mt_bits[] = {
0x00, 0x00, 0x00, 0xfc, 0xfc, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x20, 0x20,
0xe0, 0x3c, 0x20, 0xe0, 0x3c, 0x20, 0x20, 0xe0, 0xf0, 0x10, 0xfc, 0x10,
0x30, 0x60, 0x78, 0xfc, 0x84, 0xfc, 0x78, 0x00, 0x80, 0x20, 0x18, 0x84,
0x80, 0x80, 0x00, 0x80, 0xc0, 0x7c, 0x64, 0xc4, 0x84, 0x0c, 0x00, 0x40,
0xc0, 0x40, 0x00, 0x3c, 0x3c, 0xe0, 0xf8, 0x0c, 0x04, 0x04, 0x08, 0xf0,
0x80, 0x00, 0x50, 0x60, 0xfc, 0x60, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xc0, 0x78, 0x0c, 0xf0, 0xf8, 0x04, 0x04, 0x04,
0x0c, 0xf8, 0xc0, 0x08, 0x08, 0xfc, 0xfc, 0x00, 0x00, 0x18, 0x04, 0x04,
0x04, 0x8c, 0xf8, 0x30, 0x08, 0x04, 0x44, 0x44, 0x44, 0xbc, 0x98, 0x00,
0x00, 0x80, 0x40, 0x30, 0x08, 0xfc, 0xfc, 0x00, 0x7c, 0x44, 0x44, 0x44,
0x44, 0x84, 0x00, 0xe0, 0xf8, 0x4c, 0x44, 0x44, 0xc4, 0x8c, 0x00, 0x0c,
0x04, 0x04, 0x04, 0xc4, 0x74, 0x0c, 0x00, 0x10, 0xb8, 0x44, 0x44, 0x44,
0xfc, 0xb8, 0x00, 0x70, 0xf8, 0x04, 0x04, 0x04, 0x8c, 0xf8, 0xc0, 0xc0,
0x00, 0x00, 0xc0, 0x00, 0x80, 0x80, 0x80, 0xc0, 0x40, 0x40, 0x20, 0x20,
0x30, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x30, 0x20,
0x20, 0x40, 0x40, 0xc0, 0x80, 0x80, 0x80, 0x08, 0x04, 0x84, 0x84, 0xc4,
0x78, 0x10, 0x80, 0xc0, 0x20, 0x10, 0x80, 0xc8, 0x48, 0x08, 0x88, 0x90,
0x10, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x18, 0x1c, 0xf8, 0xc0,
0x00, 0x00, 0x00, 0x04, 0xfc, 0xfc, 0x84, 0x84, 0x84, 0xc4, 0x78, 0x30,
0xe0, 0xf0, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x18, 0x00, 0x04, 0xfc,
0xfc, 0x04, 0x04, 0x04, 0x04, 0x08, 0xf0, 0xe0, 0x04, 0x04, 0xfc, 0xfc,
0x84, 0x84, 0x84, 0xe4, 0x0c, 0x04, 0xfc, 0xfc, 0x84, 0x84, 0x84, 0x84,
0xe4, 0x0c, 0xe0, 0xf0, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x00,
0x04, 0xfc, 0xfc, 0x84, 0x80, 0x80, 0x80, 0x84, 0xfc, 0xfc, 0x04, 0x04,
0xfc, 0xfc, 0x04, 0x00, 0x00, 0x04, 0x04, 0xfc, 0xfc, 0x04, 0x04, 0xfc,
0xfc, 0xc4, 0x20, 0x20, 0x14, 0x0c, 0x04, 0x04, 0x00, 0x04, 0xfc, 0xfc,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xfc, 0x1c, 0x38, 0xf0, 0xc0,
0x00, 0x00, 0x80, 0x60, 0x18, 0xfc, 0xfc, 0x04, 0x04, 0xfc, 0x1c, 0x38,
0x60, 0xc0, 0x80, 0x00, 0x04, 0xfc, 0x04, 0x04, 0xe0, 0xf0, 0x08, 0x04,
0x04, 0x04, 0x04, 0x04, 0x18, 0xf0, 0x80, 0x04, 0xfc, 0xfc, 0x84, 0x84,
0x84, 0xc4, 0x78, 0x30, 0xe0, 0xf0, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04,
0x18, 0xf0, 0x80, 0x04, 0xfc, 0xfc, 0x84, 0x84, 0x84, 0x84, 0x7c, 0x38,
0x00, 0x00, 0x38, 0x7c, 0xc4, 0x84, 0x84, 0x84, 0x1c, 0x18, 0x0c, 0x04,
0x04, 0x04, 0xfc, 0xfc, 0x04, 0x04, 0x04, 0x0c, 0x04, 0xfc, 0xfc, 0x04,
0x00, 0x00, 0x00, 0x04, 0xfc, 0xfc, 0x04, 0x04, 0x0c, 0x3c, 0xe4, 0x80,
0x00, 0x00, 0x80, 0x64, 0x0c, 0x04, 0x04, 0x0c, 0xfc, 0xc4, 0x00, 0x00,
0xe0, 0x1c, 0x7c, 0xc0, 0x00, 0x00, 0xe4, 0x1c, 0x04, 0x04, 0x04, 0x1c,
0x7c, 0xe0, 0xc0, 0x34, 0x0c, 0x04, 0x04, 0x04, 0x0c, 0x1c, 0x74, 0xe0,
0x80, 0x40, 0x14, 0x0c, 0x04, 0x0c, 0x04, 0x04, 0x84, 0xc4, 0x74, 0x3c,
0x0c, 0x04, 0xfc, 0xfc, 0x04, 0x00, 0x0c, 0x78, 0xc0, 0x00, 0x00, 0x04,
0x04, 0xfc, 0xfc, 0x20, 0x10, 0x18, 0x0c, 0x04, 0x0c, 0x10, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0c, 0x00, 0x40,
0x60, 0x20, 0x20, 0x20, 0xc0, 0x80, 0x00, 0x00, 0x04, 0xfc, 0xfc, 0x20,
0x20, 0x20, 0xc0, 0x80, 0x80, 0xc0, 0x20, 0x20, 0x20, 0x20, 0x40, 0x80,
0xc0, 0x20, 0x20, 0x24, 0xfc, 0xfc, 0x00, 0x00, 0x80, 0xc0, 0x20, 0x20,
0x20, 0x20, 0xc0, 0x00, 0x20, 0xf8, 0xfc, 0x24, 0x24, 0x04, 0x00, 0x80,
0xc0, 0x20, 0x20, 0x20, 0xe0, 0xe0, 0x20, 0x04, 0xfc, 0xfc, 0x20, 0x20,
0x20, 0xe0, 0x80, 0x00, 0x20, 0xec, 0xe0, 0x00, 0x00, 0x00, 0x20, 0xec,
0xec, 0x04, 0xfc, 0xfc, 0x00, 0xa0, 0x60, 0x20, 0x20, 0x04, 0xfc, 0xfc,
0x00, 0x20, 0xe0, 0xe0, 0x20, 0x20, 0x20, 0xe0, 0xc0, 0x20, 0x20, 0x20,
0xe0, 0x80, 0x00, 0x20, 0xe0, 0xe0, 0x20, 0x20, 0x20, 0xe0, 0x80, 0x00,
0x80, 0xc0, 0x20, 0x20, 0x20, 0x60, 0xc0, 0x00, 0x20, 0xe0, 0xe0, 0x20,
0x20, 0x20, 0x60, 0xc0, 0x00, 0x80, 0xc0, 0x20, 0x20, 0x20, 0xe0, 0xe0,
0x20, 0x20, 0xe0, 0xe0, 0x20, 0x20, 0x60, 0x60, 0xc0, 0xe0, 0x20, 0x20,
0x60, 0x60, 0x20, 0xf8, 0xf8, 0x20, 0x20, 0x00, 0x20, 0xe0, 0xe0, 0x00,
0x00, 0x20, 0xe0, 0xe0, 0x00, 0x20, 0x60, 0xe0, 0x20, 0x00, 0x00, 0xa0,
0x60, 0x20, 0x20, 0x60, 0xe0, 0x20, 0x00, 0x80, 0xe0, 0x80, 0x00, 0x20,
0xe0, 0x20, 0x20, 0x60, 0xe0, 0x00, 0x80, 0xe0, 0x20, 0x20, 0x20, 0x20,
0xe0, 0xa0, 0x00, 0x00, 0xa0, 0x60, 0x20, 0x60, 0x60, 0x20, 0x20, 0xe0,
0xe0, 0x20, 0x00, 0x00, 0xf8, 0x7c, 0x04, 0x04, 0xfc, 0xfc, 0x04, 0x04,
0xfc, 0xf0, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00,
0x80, 0x40, 0x6c, 0x20, 0x20, 0x2c, 0xc0, 0x80, 0x00, 0x80, 0xc0, 0x2c,
0x20, 0x20, 0x6c, 0xc0, 0x00, 0x20, 0xe0, 0xec, 0x00, 0x00, 0x2c, 0xe0,
0xe0, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x39, 0x1c, 0xf9, 0xc0, 0x00, 0x00,
0x00, 0xe0, 0xf0, 0x08, 0x05, 0x04, 0x04, 0x05, 0x04, 0x18, 0xf0, 0x80,
0x04, 0xfc, 0xfc, 0x04, 0x01, 0x00, 0x00, 0x05, 0xfc, 0xfc, 0x04, 0x00,
0x00, 0xf8, 0xfc, 0x04, 0x64, 0xf4, 0x8c, 0x00, 0x00 };
const unsigned char smooth_lt_bits[] = {
0x00, 0x00, 0x00, 0xfc, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
0xf8, 0x6c, 0x00, 0xf0, 0x7c, 0x04, 0x00, 0xc0, 0xa0, 0x10, 0xfc, 0x10,
0x60, 0x10, 0x30, 0x4c, 0x84, 0x4c, 0x30, 0x00, 0x40, 0x70, 0x80, 0x8c,
0x80, 0x00, 0x00, 0x00, 0xd8, 0x38, 0x4c, 0x84, 0x04, 0x00, 0x0c, 0x00,
0x40, 0x00, 0x00, 0x3c, 0x00, 0xc0, 0x30, 0x00, 0x00, 0x00, 0x3c, 0xf8,
0x40, 0xd8, 0x50, 0x10, 0xfc, 0x10, 0x50, 0xd8, 0x00, 0x00, 0x00, 0x00,
0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xa0, 0xb4, 0x14, 0xe0, 0x18, 0x08, 0x04, 0x04,
0x18, 0xf0, 0x20, 0x10, 0x04, 0xfc, 0x00, 0x00, 0x18, 0x0c, 0x00, 0x00,
0x04, 0xc4, 0x7c, 0x78, 0x04, 0x08, 0x00, 0x44, 0xe4, 0xe8, 0x38, 0x00,
0x00, 0x80, 0xe0, 0x00, 0x1c, 0xfc, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x40,
0x80, 0xc0, 0x80, 0xd0, 0x90, 0x80, 0x04, 0x44, 0x04, 0x88, 0x00, 0x0c,
0x00, 0x00, 0x00, 0x80, 0xac, 0x1c, 0x04, 0xa8, 0xfc, 0xec, 0x44, 0x44,
0x28, 0x98, 0x00, 0xf8, 0x8c, 0x8c, 0x04, 0x04, 0x00, 0xf0, 0x20, 0xc0,
0xc0, 0x00, 0xc0, 0xc0, 0x00, 0x80, 0xc0, 0x00, 0xc0, 0x60, 0x60, 0x20,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x60, 0x60, 0xc0, 0x00, 0xc0, 0x80, 0x00, 0x04, 0x08, 0x04, 0x84, 0x0c,
0x7c, 0x28, 0x00, 0xe0, 0x70, 0x10, 0xd8, 0x00, 0x00, 0x48, 0x80, 0x88,
0x30, 0x30, 0xe0, 0x80, 0x00, 0x00, 0x80, 0x40, 0x2c, 0x2c, 0x70, 0xa0,
0x00, 0x00, 0x00, 0x00, 0xfc, 0x84, 0x00, 0x00, 0x84, 0x8c, 0xfc, 0x08,
0xd0, 0x38, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x08, 0x0c, 0x18, 0x00, 0xfc,
0x04, 0x00, 0x04, 0x04, 0x08, 0x1c, 0x38, 0xd0, 0x00, 0x00, 0xfc, 0x84,
0x00, 0x00, 0x00, 0xe0, 0x1c, 0x00, 0x04, 0xfc, 0x00, 0x00, 0x00, 0x00,
0xe0, 0x1c, 0xd0, 0x38, 0x0c, 0x00, 0x04, 0x00, 0x04, 0x08, 0x1c, 0x18,
0x00, 0x04, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0xfc, 0x00, 0x00,
0x04, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x04, 0x00, 0x00, 0x04,
0xfc, 0x80, 0xc0, 0x10, 0x08, 0x04, 0x04, 0x00, 0x00, 0x00, 0x04, 0xfc,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x0c, 0x7c, 0x60, 0x80,
0x80, 0x00, 0x00, 0x10, 0x04, 0xfc, 0x04, 0x00, 0x00, 0xfc, 0x0c, 0x30,
0xf0, 0xc0, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0xd0, 0x38, 0x1c, 0x00,
0x04, 0x00, 0x04, 0x08, 0x28, 0xf0, 0x60, 0x00, 0x04, 0xfc, 0x00, 0x00,
0x84, 0x0c, 0xfc, 0x08, 0xd0, 0x38, 0x1c, 0x00, 0x04, 0x00, 0x04, 0x08,
0x28, 0xf0, 0x60, 0x00, 0x04, 0xfc, 0x00, 0x80, 0x84, 0x84, 0xc8, 0x70,
0x00, 0x00, 0x70, 0xe8, 0xc4, 0xc0, 0x84, 0x84, 0x88, 0x04, 0x1c, 0x00,
0x00, 0x00, 0xfc, 0x04, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x04, 0xfc, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0xfc, 0x00, 0x00, 0x14, 0x7c, 0xf0, 0x40,
0x00, 0x00, 0x40, 0xb0, 0x14, 0x00, 0x00, 0x14, 0x7c, 0xa0, 0x00, 0x00,
0x50, 0x2c, 0xb8, 0xa0, 0x00, 0x00, 0x10, 0x24, 0x00, 0x00, 0x0c, 0x0c,
0x3c, 0xf0, 0xe0, 0x00, 0x1c, 0x04, 0x00, 0x00, 0x04, 0x3c, 0x38, 0xc0,
0xc0, 0xe0, 0x3c, 0x04, 0x00, 0x1c, 0x00, 0x00, 0x00, 0xe0, 0x60, 0x1c,
0x1c, 0x00, 0xfc, 0x04, 0x00, 0x04, 0x14, 0xb4, 0xa0, 0x00, 0x00, 0x00,
0x00, 0xfc, 0x00, 0x20, 0x30, 0x08, 0x0c, 0x0c, 0x18, 0x18, 0x10, 0x20,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x08, 0x20,
0x20, 0x20, 0x20, 0x60, 0xe0, 0x40, 0x00, 0x04, 0x00, 0xfc, 0x40, 0x00,
0x00, 0x20, 0x60, 0xc0, 0xc0, 0x60, 0x60, 0x20, 0x20, 0x40, 0x20, 0xc0,
0x60, 0x20, 0x00, 0x00, 0x44, 0xfc, 0x00, 0x00, 0xc0, 0x60, 0x60, 0x20,
0x20, 0x40, 0xc0, 0x80, 0x00, 0xfc, 0x24, 0x04, 0x04, 0x04, 0x04, 0xc0,
0x60, 0x20, 0x00, 0x00, 0x40, 0xe0, 0x00, 0x00, 0xfc, 0x40, 0x00, 0x00,
0x60, 0xc0, 0x40, 0x00, 0x00, 0xe4, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x24,
0xe4, 0x00, 0xfc, 0x00, 0x80, 0x40, 0x20, 0x20, 0x00, 0x00, 0xfc, 0x00,
0x00, 0x00, 0xe0, 0x40, 0x00, 0x00, 0x60, 0xc0, 0x40, 0x00, 0x00, 0x60,
0xc0, 0x40, 0x00, 0x00, 0xe0, 0x40, 0x00, 0x00, 0x60, 0xc0, 0x40, 0x00,
0xc0, 0x60, 0x60, 0x20, 0x20, 0x00, 0xc0, 0x80, 0x00, 0xe0, 0x40, 0x40,
0x00, 0x20, 0x00, 0xc0, 0x80, 0xc0, 0x60, 0x20, 0x00, 0x00, 0x40, 0xe0,
0x00, 0x00, 0xe0, 0x40, 0x00, 0x00, 0x20, 0x60, 0xc0, 0x80, 0x20, 0x20,
0x20, 0x40, 0x00, 0xfc, 0x24, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00,
0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0xa0, 0xe0, 0x80, 0x00, 0x00, 0x00,
0xa0, 0x00, 0x00, 0xa0, 0xe0, 0x00, 0x00, 0x40, 0x60, 0x40, 0x00, 0x80,
0x60, 0x20, 0x20, 0x20, 0xe0, 0x80, 0x00, 0x20, 0x60, 0x00, 0x00, 0x60,
0xe0, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x60, 0x20, 0x00, 0x80, 0xa0,
0x60, 0x60, 0x00, 0x80, 0xfc, 0x84, 0x04, 0x00, 0xfc, 0x00, 0x00, 0x04,
0x78, 0x88, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00,
0x00, 0x20, 0x24, 0x2c, 0x20, 0x64, 0xec, 0x40, 0x00, 0xc0, 0x6c, 0x64,
0x20, 0x2c, 0x04, 0xc0, 0x80, 0x00, 0xec, 0x04, 0x00, 0x0c, 0x04, 0xe0,
0x00, 0x00, 0x00, 0x00, 0x00, 0xe1, 0x55, 0x2c, 0x75, 0xa1, 0x00, 0x00,
0x00, 0xd0, 0x38, 0x1c, 0x00, 0x05, 0x00, 0x04, 0x09, 0x28, 0xf0, 0x60,
0x00, 0x04, 0xfc, 0x01, 0x00, 0x00, 0x01, 0x00, 0x04, 0xfc, 0x00, 0x00,
0x00, 0xf8, 0x00, 0x04, 0xf4, 0x9c, 0x08, 0x08, 0x00 };
const unsigned char smooth_mb_bits[] = {
0x00, 0x00, 0x00, 0x1b, 0x03, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x1e,
0x03, 0x02, 0x1e, 0x03, 0x02, 0x02, 0x00, 0x08, 0x19, 0x11, 0xff, 0x12,
0x1e, 0x0c, 0x00, 0x00, 0x00, 0x08, 0x04, 0x01, 0x00, 0x06, 0x0f, 0x10,
0x10, 0x1f, 0x0f, 0x07, 0x0c, 0x10, 0x10, 0x10, 0x11, 0x13, 0x0e, 0x1e,
0x11, 0x10, 0x10, 0x00, 0x00, 0x0f, 0x1f, 0x20, 0x40, 0x40, 0x30, 0x1f,
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
0x1f, 0x1f, 0x01, 0x01, 0x01, 0x20, 0x38, 0x08, 0x01, 0x01, 0x01, 0x01,
0x18, 0x00, 0x30, 0x1e, 0x03, 0x00, 0x00, 0x07, 0x0f, 0x10, 0x10, 0x10,
0x18, 0x0f, 0x01, 0x10, 0x10, 0x1f, 0x1f, 0x10, 0x00, 0x18, 0x1c, 0x16,
0x13, 0x11, 0x10, 0x18, 0x0c, 0x10, 0x10, 0x10, 0x10, 0x18, 0x0f, 0x02,
0x03, 0x02, 0x02, 0x12, 0x12, 0x1f, 0x1f, 0x12, 0x0c, 0x10, 0x10, 0x10,
0x10, 0x0f, 0x07, 0x07, 0x0f, 0x10, 0x10, 0x10, 0x18, 0x0f, 0x02, 0x00,
0x00, 0x18, 0x0e, 0x01, 0x00, 0x00, 0x00, 0x07, 0x0f, 0x10, 0x10, 0x10,
0x18, 0x0f, 0x02, 0x00, 0x18, 0x11, 0x11, 0x11, 0x08, 0x07, 0x00, 0x18,
0x00, 0x00, 0x38, 0x08, 0x01, 0x01, 0x02, 0x02, 0x06, 0x04, 0x04, 0x0c,
0x08, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x08, 0x0c,
0x04, 0x04, 0x06, 0x02, 0x02, 0x01, 0x01, 0x00, 0x00, 0x1b, 0x00, 0x00,
0x00, 0x00, 0x0f, 0x3f, 0x20, 0x42, 0x8f, 0x98, 0x90, 0x90, 0x9f, 0x1f,
0x10, 0x08, 0x07, 0x01, 0x10, 0x18, 0x13, 0x02, 0x02, 0x02, 0x02, 0x13,
0x1e, 0x18, 0x10, 0x10, 0x1f, 0x1f, 0x10, 0x10, 0x10, 0x10, 0x1f, 0x0e,
0x03, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x18, 0x0c, 0x00, 0x10, 0x1f,
0x1f, 0x10, 0x10, 0x10, 0x10, 0x08, 0x07, 0x03, 0x10, 0x10, 0x1f, 0x1f,
0x10, 0x10, 0x10, 0x11, 0x18, 0x10, 0x1f, 0x1f, 0x10, 0x10, 0x00, 0x00,
0x01, 0x00, 0x03, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x11, 0x1f, 0x0f,
0x10, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x10, 0x1f, 0x1f, 0x10, 0x10,
0x1f, 0x1f, 0x10, 0xc0, 0x80, 0x80, 0x80, 0x7f, 0x3f, 0x00, 0x10, 0x1f,
0x1f, 0x10, 0x01, 0x02, 0x0c, 0x1c, 0x18, 0x10, 0x00, 0x10, 0x1f, 0x1f,
0x10, 0x10, 0x10, 0x10, 0x10, 0x1c, 0x10, 0x1f, 0x10, 0x10, 0x00, 0x01,
0x07, 0x06, 0x01, 0x00, 0x10, 0x1f, 0x1f, 0x10, 0x10, 0x1f, 0x10, 0x10,
0x00, 0x00, 0x03, 0x06, 0x0c, 0x1f, 0x00, 0x00, 0x03, 0x07, 0x08, 0x10,
0x10, 0x10, 0x10, 0x10, 0x0c, 0x07, 0x00, 0x10, 0x1f, 0x1f, 0x10, 0x10,
0x00, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x08, 0x10, 0x10, 0x10, 0x30, 0x50,
0x4c, 0x07, 0x00, 0x10, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x01, 0x07, 0x1c,
0x10, 0x00, 0x0c, 0x1c, 0x10, 0x10, 0x10, 0x11, 0x0f, 0x0f, 0x00, 0x00,
0x00, 0x10, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x18,
0x10, 0x10, 0x10, 0x10, 0x0f, 0x07, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0f,
0x1c, 0x0c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x1e, 0x0e,
0x00, 0x00, 0x00, 0x07, 0x1e, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x10, 0x1c,
0x12, 0x01, 0x03, 0x17, 0x1c, 0x18, 0x10, 0x00, 0x00, 0x00, 0x10, 0x1f,
0x1f, 0x10, 0x00, 0x00, 0x00, 0x18, 0x1c, 0x16, 0x13, 0x10, 0x10, 0x10,
0x10, 0x18, 0x7f, 0x7f, 0x40, 0x00, 0x00, 0x00, 0x03, 0x1e, 0x30, 0x40,
0x40, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x0e,
0x1f, 0x11, 0x11, 0x11, 0x1f, 0x1f, 0x10, 0x00, 0x10, 0x1f, 0x1f, 0x10,
0x10, 0x10, 0x0f, 0x07, 0x07, 0x0f, 0x10, 0x10, 0x10, 0x08, 0x04, 0x07,
0x0f, 0x10, 0x10, 0x10, 0x1f, 0x1f, 0x10, 0x00, 0x07, 0x0f, 0x11, 0x11,
0x11, 0x11, 0x0d, 0x00, 0x10, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x47,
0xcf, 0x90, 0x90, 0x90, 0xff, 0x7f, 0x00, 0x10, 0x1f, 0x1f, 0x10, 0x00,
0x10, 0x1f, 0x1f, 0x10, 0x10, 0x1f, 0x1f, 0x10, 0xc0, 0x80, 0x80, 0xff,
0x7f, 0x10, 0x1f, 0x1f, 0x11, 0x12, 0x1c, 0x18, 0x10, 0x10, 0x1f, 0x1f,
0x10, 0x10, 0x1f, 0x1f, 0x10, 0x00, 0x10, 0x1f, 0x1f, 0x10, 0x00, 0x10,
0x1f, 0x1f, 0x00, 0x10, 0x1f, 0x1f, 0x10, 0x00, 0x10, 0x1f, 0x1f, 0x10,
0x07, 0x0f, 0x10, 0x10, 0x10, 0x18, 0x0f, 0x03, 0x80, 0xff, 0xff, 0x90,
0x10, 0x10, 0x18, 0x0f, 0x03, 0x07, 0x0f, 0x10, 0x10, 0x90, 0xff, 0xff,
0x80, 0x10, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x18, 0x19, 0x13, 0x13,
0x1e, 0x0e, 0x00, 0x0f, 0x1f, 0x10, 0x18, 0x08, 0x00, 0x0f, 0x1f, 0x10,
0x10, 0x00, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x01, 0x07, 0x1c, 0x0c, 0x03,
0x00, 0x00, 0x00, 0x00, 0x03, 0x1e, 0x1c, 0x03, 0x00, 0x0f, 0x1c, 0x07,
0x00, 0x00, 0x10, 0x18, 0x14, 0x03, 0x17, 0x1c, 0x18, 0x10, 0x00, 0xc0,
0x80, 0xc7, 0x3c, 0x0c, 0x01, 0x00, 0x00, 0x10, 0x1c, 0x1e, 0x13, 0x11,
0x10, 0x18, 0x01, 0x01, 0x7e, 0xfc, 0x80, 0x80, 0xff, 0xff, 0x80, 0x80,
0xfe, 0x3f, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
0x00, 0x0e, 0x1f, 0x11, 0x11, 0x11, 0x1f, 0x1f, 0x10, 0x07, 0x0f, 0x10,
0x10, 0x10, 0x18, 0x0f, 0x03, 0x00, 0x0f, 0x1f, 0x10, 0x10, 0x00, 0x1f,
0x1f, 0x10, 0x10, 0x18, 0x17, 0x03, 0x02, 0x02, 0x02, 0x17, 0x1e, 0x18,
0x10, 0x03, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0c, 0x07, 0x00,
0x00, 0x03, 0x0f, 0x18, 0x10, 0x10, 0x10, 0x10, 0x0f, 0x07, 0x00, 0x00,
0x10, 0x1f, 0x1f, 0x18, 0x10, 0x10, 0x11, 0x1b, 0x0e };
const unsigned char smooth_lb_bits[] = {
0x00, 0x00, 0x00, 0x1b, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x1f,
0x07, 0x00, 0x1b, 0x0f, 0x00, 0x00, 0x00, 0x19, 0x11, 0x13, 0xff, 0x13,
0x06, 0x0e, 0x00, 0x00, 0x10, 0x10, 0x02, 0x02, 0x00, 0x09, 0x1f, 0x19,
0x10, 0x09, 0x06, 0x0f, 0x1b, 0x08, 0x10, 0x01, 0x13, 0x0e, 0x0c, 0x0c,
0x1a, 0x00, 0x00, 0x00, 0x00, 0x07, 0x38, 0x40, 0x00, 0x00, 0x68, 0x3f,
0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1f, 0x01, 0x00, 0x00, 0x00, 0x50, 0x18, 0x10, 0x00, 0x00, 0x00, 0x00,
0x18, 0x18, 0x28, 0x2d, 0x05, 0x00, 0x00, 0x03, 0x0c, 0x08, 0x10, 0x10,
0x0c, 0x07, 0x02, 0x10, 0x10, 0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x18,
0x18, 0x18, 0x18, 0x1c, 0x1c, 0x08, 0x10, 0x00, 0x10, 0x01, 0x0f, 0x05,
0x02, 0x03, 0x00, 0x10, 0x10, 0x1f, 0x12, 0x10, 0x1c, 0x18, 0x10, 0x10,
0x18, 0x18, 0x0f, 0x03, 0x18, 0x08, 0x00, 0x10, 0x00, 0x0f, 0x05, 0x00,
0x00, 0x10, 0x15, 0x03, 0x00, 0x00, 0x00, 0x0f, 0x18, 0x18, 0x10, 0x10,
0x00, 0x1f, 0x05, 0x00, 0x01, 0x11, 0x11, 0x10, 0x1d, 0x0f, 0x03, 0x18,
0x18, 0x60, 0x38, 0x10, 0x01, 0x03, 0x03, 0x06, 0x00, 0x06, 0x0c, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
0x0c, 0x06, 0x00, 0x06, 0x03, 0x03, 0x01, 0x00, 0x00, 0x1f, 0x18, 0x00,
0x00, 0x00, 0x17, 0x18, 0x60, 0x45, 0x5f, 0x00, 0x90, 0x00, 0x08, 0xdf,
0x40, 0x0c, 0x0f, 0x02, 0x00, 0x1c, 0x06, 0x03, 0x02, 0x02, 0x03, 0x07,
0x1f, 0x14, 0x00, 0x00, 0x1f, 0x10, 0x00, 0x00, 0x10, 0x11, 0x09, 0x07,
0x05, 0x0e, 0x18, 0x00, 0x00, 0x10, 0x10, 0x00, 0x0c, 0x04, 0x00, 0x1f,
0x10, 0x00, 0x10, 0x10, 0x08, 0x1c, 0x0e, 0x05, 0x00, 0x10, 0x1f, 0x10,
0x10, 0x10, 0x10, 0x11, 0x1c, 0x00, 0x10, 0x1f, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x05, 0x0e, 0x1c, 0x08, 0x10, 0x00, 0x11, 0x10, 0x01, 0x0f,
0x00, 0x10, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x1f, 0x00, 0x00,
0x10, 0x1f, 0x00, 0x40, 0x80, 0x80, 0xc0, 0xff, 0x40, 0x00, 0x00, 0x10,
0x1f, 0x01, 0x03, 0x07, 0x06, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1f,
0x10, 0x10, 0x10, 0x10, 0x10, 0x18, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x03,
0x07, 0x06, 0x02, 0x00, 0x00, 0x1f, 0x10, 0x00, 0x00, 0x1f, 0x00, 0x00,
0x00, 0x01, 0x01, 0x07, 0x1c, 0x1f, 0x00, 0x00, 0x05, 0x0e, 0x1c, 0x00,
0x10, 0x00, 0x10, 0x08, 0x0a, 0x07, 0x03, 0x00, 0x10, 0x1f, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x05, 0x06, 0x1c, 0x00, 0x10, 0x30, 0x30, 0x08,
0x0a, 0x07, 0x03, 0x00, 0x10, 0x1f, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x1a,
0x10, 0x10, 0x1c, 0x08, 0x10, 0x10, 0x01, 0x11, 0x1b, 0x06, 0x00, 0x00,
0x00, 0x00, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0f, 0x04,
0x10, 0x00, 0x10, 0x18, 0x1c, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x02, 0x17,
0x1a, 0x1a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0b, 0x1d, 0x15,
0x01, 0x00, 0x00, 0x0b, 0x1d, 0x15, 0x01, 0x00, 0x00, 0x00, 0x18, 0x18,
0x07, 0x00, 0x01, 0x0e, 0x1e, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10,
0x1f, 0x00, 0x00, 0x00, 0x00, 0x10, 0x1c, 0x1f, 0x11, 0x11, 0x10, 0x10,
0x10, 0x1c, 0x7f, 0x40, 0x00, 0x40, 0x00, 0x00, 0x05, 0x2d, 0x28, 0x00,
0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x0c,
0x1a, 0x11, 0x01, 0x08, 0x1f, 0x10, 0x00, 0x10, 0x00, 0x1f, 0x08, 0x00,
0x00, 0x10, 0x18, 0x0f, 0x0f, 0x18, 0x18, 0x10, 0x10, 0x14, 0x0c, 0x0f,
0x18, 0x10, 0x00, 0x00, 0x08, 0x1f, 0x00, 0x10, 0x0b, 0x1d, 0x18, 0x10,
0x10, 0x08, 0x09, 0x05, 0x00, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x8f,
0x98, 0x90, 0x80, 0x80, 0x48, 0x3f, 0x00, 0x00, 0x1f, 0x10, 0x00, 0x00,
0x00, 0x1f, 0x10, 0x00, 0x00, 0x1f, 0x10, 0x00, 0x40, 0x80, 0x80, 0x40,
0x7f, 0x00, 0x1f, 0x12, 0x03, 0x07, 0x1c, 0x10, 0x10, 0x00, 0x1f, 0x10,
0x00, 0x00, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x1f, 0x10, 0x00, 0x10, 0x00,
0x1f, 0x10, 0x10, 0x00, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x1f, 0x10, 0x00,
0x0f, 0x1c, 0x18, 0x10, 0x10, 0x00, 0x0f, 0x04, 0x00, 0xff, 0x88, 0x08,
0x00, 0x10, 0x00, 0x0f, 0x04, 0x0f, 0x18, 0x10, 0x00, 0x00, 0x88, 0xff,
0x00, 0x00, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x09, 0x11, 0x11, 0x12,
0x07, 0x0c, 0x00, 0x1f, 0x10, 0x10, 0x18, 0x00, 0x00, 0x1f, 0x18, 0x10,
0x00, 0x18, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x1a, 0x1a, 0x01,
0x00, 0x00, 0x00, 0x00, 0x05, 0x0f, 0x18, 0x04, 0x01, 0x17, 0x18, 0x0a,
0x01, 0x00, 0x00, 0x10, 0x0b, 0x03, 0x07, 0x1c, 0x10, 0x10, 0x00, 0xc0,
0x81, 0x0b, 0x5e, 0x06, 0x03, 0x00, 0x00, 0x18, 0x18, 0x16, 0x17, 0x13,
0x10, 0x18, 0x01, 0x03, 0x7f, 0x42, 0x80, 0x00, 0xff, 0x00, 0x00, 0xc0,
0x7c, 0x42, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00,
0x01, 0x0c, 0x1a, 0x11, 0x01, 0x08, 0x1f, 0x10, 0x00, 0x0f, 0x1c, 0x18,
0x10, 0x10, 0x00, 0x0f, 0x04, 0x00, 0x1f, 0x18, 0x10, 0x00, 0x18, 0x1f,
0x10, 0x00, 0x00, 0x14, 0x1e, 0x12, 0x02, 0x02, 0x03, 0x03, 0x1f, 0x14,
0x00, 0x05, 0x0e, 0x1c, 0x00, 0x10, 0x00, 0x10, 0x08, 0x0a, 0x07, 0x03,
0x00, 0x04, 0x0f, 0x04, 0x10, 0x00, 0x10, 0x18, 0x1c, 0x0f, 0x00, 0x10,
0x00, 0x1f, 0x00, 0x08, 0x10, 0x11, 0x11, 0x07, 0x0f };

View file

@ -0,0 +1,17 @@
const unsigned char smooth_info[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3, 2, 4,10, 7,13,12, 2, 4, 4, 7, 9, 3, 4, 2, 5,
8, 5, 8, 8, 8, 7, 8, 8, 8, 8, 2, 3, 9, 9, 9, 7,
14,11, 9,10,10, 9, 9,10,11, 4, 7,10,10,14,12,11,
9,11,11, 8,10,11,11,15,10,10, 9, 4, 5, 4, 9, 7,
4, 8, 9, 7, 9, 8, 7, 8, 9, 4, 5, 8, 4,14, 9, 8,
9, 8, 7, 6, 6, 9, 9,12, 8, 9, 7, 6, 2, 6, 9, 0,
8, 8, 9,11, 11, 11, 10
};
const unsigned char smooth_dlines = 2;

View file

@ -0,0 +1,433 @@
/*
fonty.c - drawing text & font handling
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "lcd.h"
#include "fonty.h"
#include "fonts/charset.info"
#include "fonts/charset.bits"
/*
#include "fonts/smooth.info"
#include "fonts/smooth.bits"
*/
static unsigned char tx, ty, coff, dbl;
unsigned char *font_bits, *font_info, font_dlines;
unsigned char *font_bitsUM, *font_bitsUL, *font_bitsMM, *font_bitsML, *font_bitsLM, *font_bitsLL;
void set_font(unsigned char f)
{
switch(f)
{
/*
case 2:
coff = 0;
dbl = 16;
font_info = (unsigned char*) smooth_info;
font_bitsUM = (unsigned char*) smooth_mt_bits;
font_bitsUL = (unsigned char*) smooth_lt_bits;
font_bitsLM = (unsigned char*) smooth_mb_bits;
font_bitsLL = (unsigned char*) smooth_lb_bits;
font_dlines = smooth_dlines;
break;
*/
case 1:
coff = 0;
dbl = 1;
font_bits = (unsigned char*) charset_bits;
font_info = (unsigned char*) charset_info;
font_dlines = charset_dlines;
break;
default:
coff = 0;
dbl = 0;
font_bits = (unsigned char*) charset_bits;
font_info = (unsigned char*) charset_info;
font_dlines = charset_dlines;
break;
}
}
void _draw_char(unsigned int ch, unsigned char c, unsigned char m)
{
unsigned char p,q,r,s,t;
unsigned int cpos, cnt;
cpos = 0;
for(cnt=0; cnt<ch; cnt++)
{
if(cnt & 0x01)
{
cpos += (font_info[cnt>>1] & 0x0F);
}
else
{
cpos += (font_info[cnt>>1] >> 4);
}
}
p = font_info[ch>>1];
if(ch & 0x01)
{
p &= 0x0F;
}
else
{
p >>= 4;
}
if(dbl == 1)
{
if(ty & 0x07)
{
t = ty & 0x07;
p <<= 1;
for(cnt=0;cnt<p;cnt+=2)
{
r = p-cnt-1;
s = font_bits[cpos+(cnt>>1)];
q = 0x00;
if(s & 0x01)
q += 0x03;;
if(s & 0x02)
q += 0x0C;;
if(s & 0x04)
q += 0x30;;
if(s & 0x08)
q += 0xC0;;
if(c & 0x02)
s = q << t;
else
s = 0x00;
drawbuf[0][r] = s;
drawbuf[0][r-1] = s;
if(c & 0x01)
s = q << t;
else
s = 0x00;
drawbuf[1][r] = s;
drawbuf[1][r-1] = s;
}
do_rcu(tx,ty,p,m);
for(cnt=0;cnt<p;cnt+=2)
{
r = p-cnt-1;
s = font_bits[cpos+(cnt>>1)];
q = 0x00;
if(s & 0x01)
q += 0x03;;
if(s & 0x02)
q += 0x0C;;
if(s & 0x04)
q += 0x30;;
if(s & 0x08)
q += 0xC0;;
if(c & 0x02)
s = q >> (8-t);
else
s = 0x00;
drawbuf[0][r] = s;
drawbuf[0][r-1] = s;
if(c & 0x01)
s = q >> (8-t);
else
s = 0x00;
drawbuf[1][r] = s;
drawbuf[1][r-1] = s;
}
do_rcu(tx,ty+8,p,m);
for(cnt=0;cnt<p;cnt+=2)
{
r = p-cnt-1;
s = font_bits[cpos+(cnt>>1)];
q = 0x00;
if(s & 0x10)
q += 0x03;;
if(s & 0x20)
q += 0x0C;;
if(s & 0x40)
q += 0x30;;
if(s & 0x80)
q += 0xC0;;
if(c & 0x02)
s = q << t;
else
s = 0x00;
drawbuf[0][r] = s;
drawbuf[0][r-1] = s;
if(c & 0x01)
s = q << t;
else
s = 0x00;
drawbuf[1][r] = s;
drawbuf[1][r-1] = s;
}
do_rcu(tx,ty+8,p,m);
for(cnt=0;cnt<p;cnt+=2)
{
r = p-cnt-1;
s = font_bits[cpos+(cnt>>1)];
q = 0x00;
if(s & 0x10)
q += 0x03;;
if(s & 0x20)
q += 0x0C;;
if(s & 0x40)
q += 0x30;;
if(s & 0x80)
q += 0xC0;;
if(c & 0x02)
s = q >> (8-t);
else
s = 0x00;
drawbuf[0][r] = s;
drawbuf[0][r-1] = s;
if(c & 0x01)
s = q >> (8-t);
else
s = 0x00;
drawbuf[1][r] = s;
drawbuf[1][r-1] = s;
}
do_rcu(tx,ty+16,p,m);
}
else
{
p <<= 1;
for(cnt=0;cnt<p;cnt+=2)
{
r = p-cnt-1;
s = font_bits[cpos+(cnt>>1)];
q = 0x00;
if(s & 0x01)
q += 0x03;;
if(s & 0x02)
q += 0x0C;;
if(s & 0x04)
q += 0x30;;
if(s & 0x08)
q += 0xC0;;
if(c & 0x02)
s = q;
else
s = 0x00;
drawbuf[0][r] = s;
drawbuf[0][r-1] = s;
if(c & 0x01)
s = q;
else
s = 0x00;
drawbuf[1][r] = s;
drawbuf[1][r-1] = s;
}
do_rcu(tx,ty,p,m);
for(cnt=0;cnt<p;cnt+=2)
{
r = p-cnt-1;
s = font_bits[cpos+(cnt>>1)];
q = 0x00;
if(s & 0x10)
q += 0x03;;
if(s & 0x20)
q += 0x0C;;
if(s & 0x40)
q += 0x30;;
if(s & 0x80)
q += 0xC0;;
if(c & 0x02)
s = q;
else
s = 0x00;
drawbuf[0][r] = s;
drawbuf[0][r-1] = s;
if(c & 0x01)
s = q;
else
s = 0x00;
drawbuf[1][r] = s;
drawbuf[1][r-1] = s;
}
do_rcu(tx,ty+8,p,m);
}
tx += p+2;
}
else
{
if(ty & 0x07)
{
s = ty & 0x07;
for(cnt=0;cnt<p;cnt++)
{
if(c & 0x02)
drawbuf[0][p-cnt-1] = font_bits[cpos+cnt] << s;
else
drawbuf[0][p-cnt-1] = 0x00;
if(c & 0x01)
drawbuf[1][p-cnt-1] = font_bits[cpos+cnt] << s;
else
drawbuf[1][p-cnt-1] = 0x00;
}
do_rcu(tx,ty,p,m);
for(cnt=0;cnt<p;cnt++)
{
if(c & 0x02)
drawbuf[0][p-cnt-1] = font_bits[cpos+cnt] >> (8-s);
else
drawbuf[0][p-cnt-1] = 0x00;
if(c & 0x01)
drawbuf[1][p-cnt-1] = font_bits[cpos+cnt] >> (8-s);
else
drawbuf[1][p-cnt-1] = 0x00;
}
do_rcu(tx,ty+8,p,m);
}
else
{
for(cnt=0;cnt<p;cnt++)
{
if(c & 0x02)
drawbuf[0][p-cnt-1] = font_bits[cpos+cnt];
else
drawbuf[0][p-cnt-1] = 0x00;
if(c & 0x01)
drawbuf[1][p-cnt-1] = font_bits[cpos+cnt];
else
drawbuf[1][p-cnt-1] = 0x00;
}
do_rcu(tx,ty,p,m);
}
tx += (p+1);
}
}
void _draw_charB(unsigned int ch, unsigned char c, unsigned char m)
{
unsigned char p;
unsigned int cpos, cnt;
cpos = 0;
for(cnt=0; cnt<ch; cnt++)
{
cpos += font_info[cnt];
}
p = font_info[ch];
if(dbl == 16)
{
for(cnt=0;cnt<p;cnt++)
{
drawbuf[0][p-cnt-1] = font_bitsUM[cpos+cnt];
drawbuf[1][p-cnt-1] = font_bitsUL[cpos+cnt];
}
do_rcu(tx,ty,p,m);
for(cnt=0;cnt<p;cnt++)
{
drawbuf[0][p-cnt-1] = font_bitsLM[cpos+cnt];
drawbuf[1][p-cnt-1] = font_bitsLL[cpos+cnt];
}
do_rcu(tx,ty+8,p,m);
tx += (p+1);
}
}
void draw_char(unsigned char x, unsigned char y, unsigned char ch, unsigned char c, unsigned char m)
{
tx = x;
ty = y;
_draw_char(ch+coff, c, m);
}
void draw_string(unsigned char x, unsigned char y, char *st, unsigned char c, unsigned char m)
{
unsigned char cp;
tx = x;
ty = y;
cp = 0;
if(dbl < 15)
{
while(st[cp] != 0)
{
_draw_char(st[cp]+coff, c, m);
cp++;
}
}
else
{
while(st[cp] != 0)
{
_draw_charB(st[cp]+coff, c, m);
cp++;
}
}
}
extern char hval[16];
void draw_hexC(unsigned char x, unsigned char y, const unsigned char v, unsigned char c, unsigned char m)
{
tx = x;
ty = y;
_draw_char(hval[v>>4]+coff, c, m);
_draw_char(hval[v & 0x0F]+coff, c, m);
}
void draw_hexS(unsigned char x, unsigned char y, const unsigned short v, unsigned char c, unsigned char m)
{
tx = x;
ty = y;
draw_hexC(x, y, v >> 8, c, m);
draw_hexC(tx, ty, v & 0xFF, c, m);
}
void draw_hexW(unsigned char x, unsigned char y, const unsigned long v, unsigned char c, unsigned char m)
{
draw_hexS(x, y, v >> 16, c, m);
draw_hexS(tx, ty, v & 0xFFFF, c, m);
}

View file

@ -0,0 +1,31 @@
/*
fonty.h - drawing text & font handling
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FONTY_H
#define FONTY_H
extern unsigned char drawbuf[2][128];
void set_font(unsigned char f);
void draw_char(unsigned char x, unsigned char y, unsigned char ch, unsigned char c, unsigned char m);
void draw_string(unsigned char x, unsigned char y, char *st, unsigned char c, unsigned char m);
void draw_hexC(unsigned char x, unsigned char y, const unsigned char v, unsigned char c, unsigned char m);
void draw_hexS(unsigned char x, unsigned char y, const unsigned short v, unsigned char c, unsigned char m);
void draw_hexW(unsigned char x, unsigned char y, const unsigned long v, unsigned char c, unsigned char m);
#endif

View file

@ -0,0 +1,46 @@
/*
global.c
Copyright (C) 2007 Colibri <colibri_dvb@lycos.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "lpc2220.h"
void *memcpy(void *dest,void *src,int count)
{
char *tmp = (char *) dest, *s = (char *) src;
while (count--)
*tmp++ = *s++;
return dest;
}
int memcmp(const void * cs,const void * ct,int count)
{
const unsigned char *su1, *su2;
signed char res = 0;
for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
if ((res = *su1 - *su2) != 0)
break;
return res;
}
unsigned char GetHWversion(void) {
if(((IOPIN2 >> 28) & 3) == 3)
return(((((IOPIN0 >> 5) & 1) << 4) | (((IOPIN2 >> 30) & 1) << 3) | (((IOPIN2 >> 16) & 1) << 2) | 3));
return(((IOPIN2 >> 27) & 2) + ((IOPIN2 >> 29) & 1) + (((IOPIN1 >> 23) & 7) << 2));
}

View file

@ -0,0 +1,57 @@
/*
global.h
Copyright (C) 2007 Colibri <colibri_dvb@lycos.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GLOBAL_H
#define GLOBAL_H
//Uncomment if you want compile with demo sound
//#define WITH_SOUND
typedef unsigned char BOOL;
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
#define false 0
#define true 1
#define NULL 0
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define SPEED_30 0
#define SPEED_60 1
#define SYS_IR 0x20
#define SYS_KEY 0x40
#define SYS_TURBO 0x80
#ifndef __MAIN_C__
extern char sysInfo;
#endif /* __MAIN_C__ */
#define PCON_IDLE 0x01
#define PCON_PDOWN 0x02
void *memcpy(void *dest,void *src,int count);
int memcmp(const void * cs,const void * ct,int count);
unsigned char GetHWversion(void);
#endif

View file

@ -0,0 +1,181 @@
/*
infrared.c - ir carrier generation and encoding core
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "infrared.h"
#include "irq.h"
#include "lpc2220.h"
#include "keyboard.h"
#include "externs.h"
static unsigned char c_cnt;
static unsigned int b_len;
unsigned char mod_enable;
unsigned char hi_border;
unsigned char lo_border;
unsigned int cycles;
ir_fn irEncoder;
ir_fn irSend;
ir_fn irRepeat;
ir_fn irStop;
const struct irModule defModule = { defIR, defSender, defRepeater, defStopper, 20, 0, 3 };
unsigned long keyMap[42];
void initIR(void)
{
setIR(defModule);
}
void startIrIRQ(void)
{
T1TCR = 0x02;
T1TC = 0;
T1PC = 0;
T1PR = 0x00;
T1MCR = 0x03;
T1TCR = 0x01;
VICVectAddr1 = (unsigned long)&(irIRQ);
VICVectCntl1 = VIC_SLOT_EN | INT_SRC_TIMER1;
VICIntEnable = INT_TIMER1;
}
void setIR(struct irModule module)
{
T1TCR = 0x02;
irEncoder = module.encoder;
irSend = module.sender;
irRepeat = module.repeater;
irStop = module.stopper;
T1MR0 = module.tval;
hi_border = module.hi_border;
lo_border = module.lo_border;
cycles = 100;
T1TCR = 0x01;
}
/* Stubs for various interrupts (may be replaced later) */
/* ---------------------------------------------------- */
void defIR(void)
{
return;
}
void defSender(void)
{
return;
}
void defRepeater(void)
{
return;
}
void defStopper(void)
{
return;
}
void __attribute__ ((interrupt("IRQ"))) irIRQ(void)
{
c_cnt++;
if(c_cnt <= hi_border)
{
FIOSET0 = (mod_enable<<21);
}
else
{
FIOCLR0 = (1<<21);
if(c_cnt >= lo_border)
{
c_cnt = 0;
b_len++;
if(b_len >= cycles)
{
irEncoder();
b_len = 0;
}
}
}
T1IR = 1;
VICVectAddr = 0;
}
void runIR(void)
{
T1TCR = 0x01;
}
void stopIR(void)
{
T1TCR = 0x03;
}
#define doKey( _X, _Y ) if(_X) return keyMap[_Y]; else
unsigned long getCode(void)
{
doKey(KEY_A, 0);
doKey(KEY_B, 1);
doKey(KEY_C, 2);
doKey(KEY_D, 3);
doKey(KEY_Betty, 4);
doKey(KEY_Exit, 5);
doKey(KEY_Up, 6);
doKey(KEY_Down, 7);
doKey(KEY_Left, 8);
doKey(KEY_Right, 9);
doKey(KEY_OK, 10);
doKey(KEY_Vplus, 11);
doKey(KEY_Vminus, 12);
doKey(KEY_Mute, 13);
doKey(KEY_Pplus, 14);
doKey(KEY_Pminus, 15);
doKey(KEY_1, 16);
doKey(KEY_2, 17);
doKey(KEY_3, 18);
doKey(KEY_4, 19);
doKey(KEY_5, 20);
doKey(KEY_6, 21);
doKey(KEY_7, 22);
doKey(KEY_8, 23);
doKey(KEY_9, 24);
doKey(KEY_0, 25);
doKey(KEY_Minus, 26);
doKey(KEY_AV, 27);
doKey(KEY_Menu, 28);
doKey(KEY_PiP, 29);
doKey(KEY_AB, 30);
doKey(KEY_16_9, 31);
doKey(KEY_Info, 32);
doKey(KEY_VTX1, 33);
doKey(KEY_VTX2, 34);
doKey(KEY_VTX3, 35);
doKey(KEY_Blue, 36);
doKey(KEY_Yellow, 37);
doKey(KEY_Green, 38);
doKey(KEY_Red, 39);
doKey(KEY_TV, 40);
doKey(KEY_Power, 41);
return 0xFFFFFFFF;
}

View file

@ -0,0 +1,60 @@
/*
infrared.h - ir carrier generation and encoding core
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INFRARED_H
#define INFRARED_H
typedef void(*ir_fn)(void);
extern ir_fn irSend;
extern ir_fn irRepeat;
extern ir_fn irStop;
typedef struct irModule
{
ir_fn encoder;
ir_fn sender;
ir_fn repeater;
ir_fn stopper;
int tval;
unsigned int hi_border;
unsigned int lo_border;
} irModule;
extern unsigned char mod_enable;
extern unsigned char hi_border;
extern unsigned char lo_border;
extern unsigned int cycles;
extern unsigned long keyMap[42];
void defIR(void);
void defSender(void);
void defRepeater(void);
void defStopper(void);
void irIRQ (void) __attribute__ ((interrupt("IRQ"))) ;
void initIR(void);
void startIrIRQ(void);
void setIR(struct irModule module);
void runIR(void);
void stopIR(void);
unsigned long getCode(void);
#endif

View file

@ -0,0 +1,228 @@
/*
ir_itt.c - itt protocoll encoder
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "infrared.h"
#include "ir_itt.h"
#include "itt_codes.h"
const struct irModule ITT_Module =
{
ITT_Encode,
ITT_Send,
ITT_Repeat,
ITT_Stop,
43, // carrier
2, // carrier-on
3 // carrier-off
};
const struct irModule ITT2_Module =
{
ITT_Encode,
ITT_Send,
ITT_Repeat,
ITT_Stop,
46, // carrier
1, // carrier-on
3 // carrier-off
};
static unsigned short itt_cmd;
static unsigned short itt_actcmd;
static unsigned char itt_state;
static unsigned char itt_bit;
static unsigned char itt_numbits;
static unsigned char itt_wait;
static unsigned char itt_leadtime;
static unsigned char itt_bittime0;
static unsigned char itt_bittime1;
#define ITT_IDLE 0x00
#define ITT_LEADIN_A 0x01
#define ITT_LEADIN_B 0x02
#define ITT_START_A 0x03
#define ITT_START_B 0x04
#define ITT_BIT_A 0x05
#define ITT_BIT_B 0x06
#define ITT_LEADOUT_A 0x07
#define ITT_LEADOUT_B 0x08
#define ITT_STOP 0x09
#define ITT_WAIT 0x0A
#define ITT_LEADTIME 13
#define ITT_BITTIME_0 4
#define ITT_BITTIME_1 8
#define ITT_WAITTIME 130
#define ITT2_LEADTIME 15
#define ITT2_BITTIME_0 4
#define ITT2_BITTIME_1 9
void ITT_Encode (void)
{
switch(itt_state)
{
case ITT_IDLE:
mod_enable = 0;
break;
case ITT_LEADIN_A:
case ITT_START_A:
case ITT_BIT_A:
case ITT_LEADOUT_A:
case ITT_STOP:
cycles = 1;
mod_enable = 1;
itt_state++;
break;
case ITT_LEADIN_B:
case ITT_LEADOUT_B:
mod_enable = 0;
cycles = itt_leadtime;
itt_state++;
break;
case ITT_START_B:
mod_enable = 0;
cycles = itt_bittime0;
itt_state++;
break;
case ITT_BIT_B:
mod_enable = 0;
if(itt_cmd & 0x01)
cycles = itt_bittime1;
else
cycles = itt_bittime0;
itt_cmd >>= 1;
itt_bit++;
if(itt_bit == itt_numbits)
itt_state++;
else
itt_state--;
break;
case ITT_WAIT:
mod_enable = 0;
cycles = 40;
itt_wait++;
if(itt_wait >= ITT_WAITTIME)
{
itt_bit = 0;
itt_wait = 0;
itt_state = ITT_IDLE;
}
break;
}
}
void ITT_Init(unsigned char map)
{
itt_state = ITT_IDLE;
itt_cmd = 0x0000;
itt_actcmd = 0x0000;
itt_bit = 0x00;
itt_numbits = 0x0A;
itt_wait = 0;
ITT_LoadMap(map);
cycles = 1;
}
void ITT_Send(void)
{
itt_actcmd = getCode();
ITT_Repeat();
}
void ITT_Repeat(void)
{
if(itt_actcmd != 0x0000)
{
if(itt_state == ITT_IDLE)
{
itt_cmd = itt_actcmd;
itt_state++;
runIR();
}
}
}
void ITT_Stop(void)
{
waitend1:
if(itt_state != ITT_IDLE)
goto waitend1;
itt_state++;
if(itt_actcmd != 0x00000000)
{
waitend2:
if(itt_state != ITT_IDLE)
goto waitend2;
}
itt_actcmd = 0x0000;
stopIR();
}
void ITT_CopyMap(unsigned short *map)
{
int x;
for(x=0;x<42;x++)
{
keyMap[x] = map[x];
}
}
void ITT_LoadMap(unsigned char map)
{
switch(map)
{
case 0:
itt_leadtime = ITT_LEADTIME;
itt_bittime0 = ITT_BITTIME_0;
itt_bittime1 = ITT_BITTIME_1;
setIR(ITT_Module);
ITT_CopyMap((unsigned short*)ITT_seleco_019);
break;
case 1:
itt_leadtime = ITT_LEADTIME;
itt_bittime0 = ITT_BITTIME_0;
itt_bittime1 = ITT_BITTIME_1;
setIR(ITT_Module);
ITT_CopyMap((unsigned short*)ITT_seleco_049);
break;
case 2:
itt_leadtime = ITT2_LEADTIME;
itt_bittime0 = ITT2_BITTIME_0;
itt_bittime1 = ITT2_BITTIME_1;
setIR(ITT2_Module);
ITT_CopyMap((unsigned short*)ITT_seleco_108);
break;
default:
itt_leadtime = ITT_LEADTIME;
itt_bittime0 = ITT_BITTIME_0;
itt_bittime1 = ITT_BITTIME_1;
setIR(ITT_Module);
ITT_CopyMap((unsigned short*)ITT_seleco_131);
break;
}
}

View file

@ -0,0 +1,30 @@
/*
ir_itt.h - itt protocol ir encoder
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IR_ITT_H
#define IR_ITT_H
void ITT_Encode (void) ;
void ITT_Init(unsigned char map);
void ITT_Send(void);
void ITT_Repeat(void);
void ITT_Stop(void);
void ITT_LoadMap(unsigned char map);
#endif

View file

@ -0,0 +1,221 @@
/*
ir_nrc17.c - nokia remote control 17 encoder
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "infrared.h"
#include "ir_nrc17.h"
#include "nrc17_codes.h"
#define NRC17_IDLE 0x00
#define NRC17_PRE_A 0x01
#define NRC17_PRE_B 0x02
#define NRC17_START_A 0x03
#define NRC17_START_B 0x04
#define NRC17_BIT_A 0x05
#define NRC17_BIT_B 0x06
#define NRC17_WAIT 0x07
#define NRC17_BONTIME 19
#define NRC17_BOFFTIME 19
#define NRC17_PTIME 95
#define NRC17_GTIME 156
#define NRC17_WTIME 38
#define NRC17_STARTSTOP_DBOX2 0xFEFF
#define NRC17_STARTSTOP_TP720 0x01FF
const struct irModule NRC17_Module =
{
NRC17_Encode,
NRC17_Send,
NRC17_Repeat,
NRC17_Stop,
40, // carrier
1, // carrier-on
4 // carrier-off
};
static unsigned short nrc17_cmd;
static unsigned short nrc17_actcmd;
static unsigned short nrc17_startstop;
static unsigned char nrc17_state;
static unsigned char nrc17_bit;
static unsigned char nrc17_numbits;
static unsigned short nrc17_wait;
static unsigned short nrc17_pause;
void NRC17_Encode(void)
{
switch(nrc17_state)
{
case NRC17_IDLE:
mod_enable = 0;
break;
case NRC17_PRE_A:
case NRC17_START_A:
cycles = NRC17_BONTIME; // 0.5 ms
mod_enable = 1;
nrc17_state++;
break;
case NRC17_PRE_B:
case NRC17_START_B:
if(nrc17_state == NRC17_PRE_B)
cycles = NRC17_PTIME; // 2,5 ms
else
cycles = NRC17_BOFFTIME; // 0.5 ms
mod_enable = 0;
nrc17_state++;
break;
case NRC17_BIT_A:
if(nrc17_cmd & 0x0001)
mod_enable = 1;
else
mod_enable = 0;
nrc17_cmd >>= 1;
nrc17_state++;
break;
case NRC17_BIT_B:
if(mod_enable == 1)
mod_enable = 0;
else
mod_enable = 1;
nrc17_bit++;
if(nrc17_bit == nrc17_numbits)
nrc17_state++;
else
nrc17_state--;
break;
case NRC17_WAIT:
mod_enable = 0;
nrc17_wait++;
cycles = NRC17_BONTIME; // 1 ms
if(nrc17_wait >= nrc17_pause)
{
nrc17_bit = 0;
nrc17_wait = 0;
nrc17_pause = NRC17_PTIME;
nrc17_state = NRC17_IDLE;
}
break;
}
}
void NRC17_CopyMap(unsigned char xtra, unsigned short *map)
{
int x;
for(x=0;x<42;x++)
{
keyMap[x] = map[x];
}
}
void NRC17_LoadMap(unsigned char map)
{
switch(map)
{
case 0: // nokia dbox2, 16 bit data
NRC17_CopyMap(0x00, (unsigned short*)NRC17_dbox2);
nrc17_startstop = NRC17_STARTSTOP_DBOX2;
nrc17_numbits = 16;
break;
case 1: // tp720 - tv, 9 bit data
NRC17_CopyMap(0x00, (unsigned short*)NRC17_grundig_tp720);
nrc17_startstop = NRC17_STARTSTOP_TP720;
nrc17_numbits = 9;
break;
case 2 : // tp720 - sat, 9 bit data
NRC17_CopyMap(0x40, (unsigned short*)NRC17_grundig_tp720);
nrc17_startstop = NRC17_STARTSTOP_TP720;
nrc17_numbits = 9;
break;
default : // tp720 - video, 9 bit data
NRC17_CopyMap(0x80, (unsigned short*)NRC17_grundig_tp720);
nrc17_startstop = NRC17_STARTSTOP_TP720;
nrc17_numbits = 9;
break;
}
}
void NRC17_Init(unsigned char map)
{
nrc17_state = NRC17_IDLE;
nrc17_cmd = 0x0000;
nrc17_actcmd = 0x0000;
nrc17_bit = 0x00;
nrc17_numbits = 16;
nrc17_wait = 0;
nrc17_pause = NRC17_BONTIME;
NRC17_LoadMap(map);
setIR(NRC17_Module);
}
void NRC17_Send(void)
{
nrc17_actcmd = getCode();
if(nrc17_actcmd != 0x0000)
{
if(nrc17_state == NRC17_IDLE)
{
nrc17_pause = NRC17_WTIME;
nrc17_cmd = nrc17_startstop;
nrc17_state++;
runIR();
}
}
}
void NRC17_Repeat(void)
{
if(nrc17_actcmd != 0x0000)
{
if(nrc17_state == NRC17_IDLE)
{
nrc17_pause = NRC17_GTIME;
nrc17_cmd = nrc17_actcmd;
nrc17_state++;
}
}
}
void NRC17_Stop(void)
{
if(nrc17_actcmd != 0x0000)
{
retry:
if(nrc17_state == NRC17_IDLE)
{
nrc17_cmd = nrc17_startstop;
nrc17_state++;
}
else
goto retry;
waitend:
if(nrc17_state != NRC17_IDLE)
goto waitend;
}
nrc17_actcmd = 0x0000;
stopIR();
}

View file

@ -0,0 +1,30 @@
/*
ir_nrc17.h - nokia remote control 17 encoder
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IR_NRC17_H
#define IR_NRC17_H
void NRC17_Encode (void) ;
void NRC17_LoadMap(unsigned char map);
void NRC17_Init(unsigned char map);
void NRC17_Send(void);
void NRC17_Repeat(void);
void NRC17_Stop(void);
#endif

View file

@ -0,0 +1,171 @@
/*
ir_rc5.c - phillips rc5 protocoll encoder
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "infrared.h"
#include "ir_rc5.h"
#include "rc5_codes.h"
const struct irModule RC5_Module =
{
RC5_Encode,
RC5_Send,
RC5_Repeat,
RC5_Stop,
42, // carrier
1, // carrier-on
4 // carrier-off
};
static unsigned short rc5_cmd;
static unsigned short rc5_actcmd;
static unsigned char rc5_state;
static unsigned char rc5_bit;
static unsigned char rc5_wait;
static unsigned char rc5_toggle;
#define RC5_IDLE 0x00
#define RC5_START_A 0x01
#define RC5_START_B 0x02
#define RC5_BIT_A 0x03
#define RC5_BIT_B 0x04
#define RC5_WAIT 0x05
#define RC5_BITTIME 32
#define RC5_WAITTIME 100
void RC5_Encode (void)
{
switch(rc5_state)
{
case RC5_IDLE:
mod_enable = 0;
break;
case RC5_START_A:
mod_enable = 0;
rc5_state++;
break;
case RC5_START_B:
mod_enable = 1;
rc5_state++;
break;
case RC5_BIT_A:
if(rc5_cmd & 0x1000)
mod_enable = 0;
else
mod_enable = 1;
rc5_cmd <<= 1;
rc5_state++;
break;
case RC5_BIT_B:
if(mod_enable == 0)
mod_enable = 1;
else
mod_enable = 0;
rc5_bit++;
if(rc5_bit == 13)
rc5_state++;
else
rc5_state--;
break;
case RC5_WAIT:
mod_enable = 0;
rc5_wait++;
if(rc5_wait >= RC5_WAITTIME)
{
rc5_bit = 0;
rc5_wait = 0;
rc5_state = RC5_IDLE;
}
break;
}
}
void RC5_Init(unsigned char map)
{
rc5_state = RC5_IDLE;
rc5_cmd = 0x0000;
rc5_actcmd = 0x0000;
rc5_bit = 0x00;
rc5_wait = 0;
RC5_LoadMap(map);
setIR(RC5_Module);
cycles = RC5_BITTIME;
}
void RC5_Send(void)
{
rc5_actcmd = getCode();
if(rc5_toggle & 0x01)
rc5_actcmd &= 0xF7FF;
RC5_Repeat();
}
void RC5_Repeat(void)
{
if(rc5_actcmd != 0x0000)
{
if(rc5_state == RC5_IDLE)
{
rc5_cmd = rc5_actcmd;
rc5_state++;
runIR();
}
}
}
void RC5_Stop(void)
{
if(rc5_actcmd != 0x00000000)
{
waitend:
if(rc5_state != RC5_IDLE)
goto waitend;
}
rc5_toggle++;
rc5_actcmd = 0x0000;
stopIR();
}
void RC5_CopyMap(unsigned short *map)
{
int x;
for(x=0;x<42;x++)
{
keyMap[x] = map[x];
}
}
void RC5_LoadMap(unsigned char map)
{
switch(map)
{
default:
RC5_CopyMap((unsigned short*)RC5_tv);
break;
}
}

View file

@ -0,0 +1,30 @@
/*
ir_rc5.h - phillips rc5 protocoll encoder
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IR_RC5_H
#define IR_RC5_H
void RC5_Encode (void) ;
void RC5_Init(unsigned char map);
void RC5_Send(void);
void RC5_Repeat(void);
void RC5_Stop(void);
void RC5_LoadMap(unsigned char map);
#endif

View file

@ -0,0 +1,184 @@
/*
ir_rca.c - space modulated protocoll encoder
Copyright (C) 2007 Ch. Klippel <ck@mamalala.net>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "infrared.h"
#include "ir_rca.h"
#include "rca_codes.h"
const struct irModule RCA_Module =
{
RCA_Encode,
RCA_Send,
RCA_Repeat,
RCA_Stop,
37, // carrier
1, // carrier-on
3 // carrier-off
};
static unsigned int rca_cmd;
static unsigned int rca_actcmd;
static unsigned char rca_state;
static unsigned char rca_bit;
static unsigned char rca_wait;
#define RCA_IDLE 0x00
#define RCA_PRE_A 0x01
#define RCA_PRE_B 0x02
#define RCA_BIT_A 0x03
#define RCA_BIT_B 0x04
#define RCA_IBIT_A 0x05
#define RCA_IBIT_B 0x06
#define RCA_STOP 0x07
#define RCA_WAIT 0x08
#define RCA_NUMBITS 12
#define RCA_BITTIME 28
#define RCA_BIT0 2*RCA_BITTIME
#define RCA_BIT1 4*RCA_BITTIME
#define RCA_PRETIME 8*RCA_BITTIME
#define RCA_WAITTIME 30
void RCA_Encode (void)
{
switch(rca_state)
{
case RCA_IDLE:
mod_enable = 0;
break;
case RCA_PRE_A:
cycles = RCA_PRETIME;
mod_enable = 1;
rca_state++;
break;
case RCA_PRE_B:
mod_enable = 0;
rca_cmd = rca_actcmd;
rca_state++;
break;
case RCA_BIT_A:
case RCA_IBIT_A:
case RCA_STOP:
cycles = RCA_BITTIME;
mod_enable = 1;
rca_state++;
break;
case RCA_BIT_B:
case RCA_IBIT_B:
mod_enable = 0;
if(rca_cmd & 0x0800)
cycles = RCA_BIT1;
else
cycles = RCA_BIT0;
rca_cmd <<= 1;
rca_bit++;
if(rca_bit == RCA_NUMBITS)
{
if(rca_state == RCA_BIT_B)
{
rca_cmd = ~rca_actcmd;
rca_bit = 0;
}
rca_state++;
}
else
rca_state--;
break;
case RCA_WAIT:
mod_enable = 0;
cycles = RCA_BITTIME;
rca_wait++;
if(rca_wait >= RCA_WAITTIME)
{
rca_bit = 0;
rca_wait = 0;
rca_state = RCA_IDLE;
}
break;
}
}
void RCA_Init(unsigned char map)
{
rca_state = RCA_IDLE;
rca_cmd = 0x0000;
rca_actcmd = 0x0000;
rca_bit = 0x00;
rca_wait = 0;
RCA_LoadMap(map);
setIR(RCA_Module);
cycles = RCA_BITTIME;
}
void RCA_Send(void)
{
rca_actcmd = getCode();
RCA_Repeat();
}
void RCA_Repeat(void)
{
if(rca_actcmd != 0x0000)
{
if(rca_state == RCA_IDLE)
{
rca_state++;
runIR();
}
}
}
void RCA_Stop(void)
{
if(rca_actcmd != 0x00000000)
{
waitend:
if(rca_state != RCA_IDLE)
goto waitend;
}
stopIR();
}
void RCA_CopyMapPC(unsigned short pre, unsigned char *map)
{
int x;
for(x=0;x<42;x++)
{
if(map[x] != 0)
keyMap[x] = pre | map[x];
else
keyMap[x] = 0x0000;
}
}
void RCA_LoadMap(unsigned char map)
{
switch(map)
{
default:
RCA_CopyMapPC(0x0500, (unsigned char*)RCA_xbox);
break;
}
}

Some files were not shown because too many files have changed in this diff Show more