X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=fx2%2Ffx2.c;h=aa8d4cbdcaee79318c4df015192418fdee587de0;hb=b2ba08089cf51703bbf546f3171a3aeaef6b450f;hp=ddea7340199b2e948666bdc886812fc5c5def410;hpb=a202fa20f103558b6e86400c60f9bc33fae2e576;p=my-code%2Ffpga.git diff --git a/fx2/fx2.c b/fx2/fx2.c index ddea734..aa8d4cb 100644 --- a/fx2/fx2.c +++ b/fx2/fx2.c @@ -22,8 +22,8 @@ typedef unsigned short u16; typedef unsigned int u32; /* fx2 register */ -xdata at 0xb5 volatile u8 OED; -xdata at 0xb0 volatile u8 IOD; +sfr at 0xb5 OED; +sfr at 0xb0 IOD; void power_on() { @@ -31,10 +31,51 @@ void power_on() { IOD|=(1<<7); } -void main() { +void slave_fifo_init() { + + /* set bit 0 and 1 - fifo slave config */ + IFCONFIG|=0x03; + + /* async mode */ + IFCONFIG|=0x04; + + /* 8 bit fifo to all endpoints */ + EP2FIFOCFG&=^(1<<0); + EP4FIFOCFG&=^(1<<0); + EP6FIFOCFG&=^(1<<0); + EP8FIFOCFG&=^(1<<0); + + /* default indexed flag configuration: + * + * flag a: programmable level + * flag b: full + * flag c: empty + * + * todo: -> fixed configuration + */ + + +} + +void fx2_init() { + + /* swicth on power */ + power_on(); + + /* slave fifo init */ + slave_fifo_init(); - power_on; } +void main() { + + /* initialize the fx2 */ + fx2_init(); + /* do the job ... */ + while(1) { + } + +} +