1
0
mirror of git://projects.qi-hardware.com/nn-usb-fpga.git synced 2025-04-21 12:27:27 +03:00

Adding a simple plasma example read write char short int, adding simulations

for this example
This commit is contained in:
Carlos Camargo
2010-04-30 22:21:55 -05:00
parent 0348078440
commit 622f59856f
16 changed files with 212 additions and 630 deletions

43
plasma/gpio/Makefile Normal file
View File

@@ -0,0 +1,43 @@
VHDL_DIR = ../logic
TOOLS_DIR = ../bin
LIB_DIR = ../lib
TARGET = gpio
CROSS = mips-elf
GCC = $(CROSS)-gcc
AS = $(CROSS)-as
LD = $(CROSS)-ld
DUMP = $(CROSS)-objdump
OBJCOPY = $(CROSS)-objcopy
INC_PATH = ../include
CFLAGS = -O2 -I$(INC_PATH) -Wall -c -s
ILDFLAGS = -Ttext 0 -eentry -Map $@.map -s -N
LDFLAGS = -Ttext 0x10000000 -eentry -Map $@.map -s -N
#Internal RAM 0x00
#External RAM 0x10000000
vpath %.c $(LIB_DIR)
vpath %.S $(LIB_DIR)
.c.o:
$(GCC) $(CFLAGS) $<
.S.o:
$(AS) -o $@ $<
all: $(TARGET)
clean:
-rm -rf *.o *.txt *.map *.lst *.bin opcodes_iram opcodes_ram test bootldr $(TARGET)
$(TARGET): crt0.o $(TARGET).o no_os.o ddr_init.o
$(LD) $(ILDFLAGS) -o $@ $^
$(OBJCOPY) -I elf32-big -O binary $@ $@.bin
vhdl_mem: $(TARGET)
$(TOOLS_DIR)/ramimage $(VHDL_DIR)/ram_xilinx.vhd $^.bin $(VHDL_DIR)/ram_image.vhd
upload: $(TARGET)
sudo cat $^.bin > /dev/ttyUSB0
run: $(TARGET)
$(TOOLS_DIR)/mlite $^.bin

61
plasma/gpio/gpio.c Normal file
View File

@@ -0,0 +1,61 @@
#include "plasma.h"
#define MemoryRead(A) (*(volatile unsigned long*)(A))
#define MemoryWrite(A,V) *(volatile unsigned long*)(A)=(V)
typedef unsigned long uint32;
typedef unsigned short uint16;
int main(void)
{
volatile unsigned char *data8;
volatile unsigned short *data16;
volatile unsigned int *data32;
unsigned char test8;
unsigned short test16;
unsigned int test32, tmp;
data8 = (unsigned char *)(0x20001000);
data16 = (unsigned short *)(0x20002000);
data32 = (unsigned int *)(0x20003000);
*data8 = 0x10;
data8++;
*data8 = 0x11;
data8++;
*data8 = 0x12;
data8++;
*data8 = 0x13;
data8++;
*data8 = 0x14;
*data16 = 0x2020;
data16++;
*data16 = 0x2121;
data16++;
*data16 = 0x2222;
data16++;
*data32 = 0x30303030;
test8 = *data8;
test16 = *data16;
test32 = *data32;
data8 += 4;
data16++;
data32++;
test8 = *data8;
test16 = *data16;
test32 = *data32;
tmp = test8 + test16 + test32;
*data32 = 0xAAAAAAAA;
return 0;
}