summaryrefslogtreecommitdiffstats
path: root/s3estarter
diff options
context:
space:
mode:
authorBert Lange <b.lange@fzd.de>2011-01-11 10:52:21 +0100
committerBert Lange <b.lange@fzd.de>2011-01-11 10:52:21 +0100
commit83148d9ec0772f4d4989e3268760d4be56a6dfcd (patch)
treee0f39e6225b110948a7e31e54135227643e50e55 /s3estarter
parenta9365c30df406c05a700ecac7b1f4a78de797881 (diff)
downloadzpu-83148d9ec0772f4d4989e3268760d4be56a6dfcd.zip
zpu-83148d9ec0772f4d4989e3268760d4be56a6dfcd.tar.gz
add: and test irq functionality
Diffstat (limited to 's3estarter')
-rw-r--r--s3estarter/rtl/box.vhd8
-rw-r--r--s3estarter/rtl_tb/top_tb.vhd2
-rw-r--r--s3estarter/sim/Makefile4
-rw-r--r--s3estarter/software/include/peripherie.h20
-rw-r--r--s3estarter/software/libhal/hw.c1
-rw-r--r--s3estarter/software/test/test.c41
-rw-r--r--s3estarter/syn/Makefile4
7 files changed, 62 insertions, 18 deletions
diff --git a/s3estarter/rtl/box.vhd b/s3estarter/rtl/box.vhd
index 8e874e7..09a0e14 100644
--- a/s3estarter/rtl/box.vhd
+++ b/s3estarter/rtl/box.vhd
@@ -210,7 +210,7 @@ begin
timeout => 11,
nahbm => 3,
nahbs => 3,
- disirq => 1, -- disable interrupt routing
+ disirq => 0, -- enable interrupt routing
enbusmon => 0, -- enable bus monitor
assertwarn => 1, -- enable assertions for warnings
asserterr => 1 -- enable assertions for errors
@@ -524,9 +524,9 @@ begin
generic map (
pindex => 8,
paddr => 8,
- imask => 16#0000#, -- interrupt mask (+ enable per software)
- syncrst => 1, -- only synchronous reset
- nbits => 32 -- number of port bits
+ imask => 16#00000FF0#, -- interrupt mask (+ enable per software)
+ syncrst => 1, -- only synchronous reset
+ nbits => 32 -- number of port bits
)
port map (
rst => reset_n,
diff --git a/s3estarter/rtl_tb/top_tb.vhd b/s3estarter/rtl_tb/top_tb.vhd
index 6ce5787..54466f2 100644
--- a/s3estarter/rtl_tb/top_tb.vhd
+++ b/s3estarter/rtl_tb/top_tb.vhd
@@ -214,7 +214,7 @@ begin
tb_BTN_EAST <= '0';
tb_BTN_NORTH <= '0';
tb_BTN_SOUTH <= '0';
- tb_BTN_WEST <= '0';
+ tb_BTN_WEST <= '0', '1' after 600 us, '0' after 650 us;
tb_SD_CK_FB <= transport tb_SD_CK_P after 3 ns; -- time is wild guess
diff --git a/s3estarter/sim/Makefile b/s3estarter/sim/Makefile
index 65341d0..d74e6ae 100644
--- a/s3estarter/sim/Makefile
+++ b/s3estarter/sim/Makefile
@@ -27,8 +27,8 @@ all: compile simulate
compile: lib deplibs $(vhdltargets)
deplibs:
- #make --directory ../software/test/ test | ccze -A
- make --directory ../software/ethernet_speed | ccze -A
+ make --directory ../software/test/ test | ccze -A
+ #make --directory ../software/ethernet_speed | ccze -A
make compile --directory ../../zpu/sim | ccze -A
make compile --directory ../../global/sim | ccze -A
diff --git a/s3estarter/software/include/peripherie.h b/s3estarter/software/include/peripherie.h
index 3e3a163..73e1e2c 100644
--- a/s3estarter/software/include/peripherie.h
+++ b/s3estarter/software/include/peripherie.h
@@ -227,12 +227,29 @@ typedef struct {
} dcm_ctrl_t;
+// debug console (for simulation)
char debug_putchar( char c);
-
// function pointer for putchar
extern char (* putchar_fp) ( char);
+
+// iqr
+typedef struct {
+ volatile uint32_t irq_level; // 0x00
+ volatile uint32_t irq_pending; // 0x04
+ volatile uint32_t irq_force; // 0x08
+ volatile uint32_t irq_clear; // 0x0c
+ volatile uint32_t mp_status; // 0x10
+ volatile uint32_t broadcast; // 0x14 (NCPU > 1)
+ volatile uint32_t dummy[10]; // 0x18 - 0x3c
+ volatile uint32_t irq_mask; // 0x40
+ // open: interrupt force, extended interrupt acknowledge
+} irqmp_t;
+
+
+
+
////////////////////
// hardware units
@@ -250,6 +267,7 @@ extern char (* putchar_fp) ( char);
extern apbuart_t *uart0;
extern gptimer_t *timer0;
+extern irqmp_t *irqmp0;
extern apbvga_t *vga0;
extern grgpio_t *gpio0;
extern greth_t *ether0;
diff --git a/s3estarter/software/libhal/hw.c b/s3estarter/software/libhal/hw.c
index cb454b8..7e153e0 100644
--- a/s3estarter/software/libhal/hw.c
+++ b/s3estarter/software/libhal/hw.c
@@ -2,6 +2,7 @@
apbuart_t *uart0 = (apbuart_t *) 0x80000100;
gptimer_t *timer0 = (gptimer_t *) 0x80000200;
+irqmp_t *irqmp0 = (irqmp_t *) 0x80000300;
apbvga_t *vga0 = (apbvga_t *) 0x80000600;
grgpio_t *gpio0 = (grgpio_t *) 0x80000800;
greth_t *ether0 = (greth_t *) 0x80000c00;
diff --git a/s3estarter/software/test/test.c b/s3estarter/software/test/test.c
index b86c04b..b6c7b99 100644
--- a/s3estarter/software/test/test.c
+++ b/s3estarter/software/test/test.c
@@ -28,7 +28,7 @@
uint32_t simulation_active;
-
+volatile uint32_t running_direction;
////////////////////////////////////////
@@ -42,10 +42,27 @@ char combined_putchar( char c)
}
+// zpu interrupt function
+void _zpu_interrupt( void)
+{
+ running_direction = !running_direction;
+ irqmp0->irq_clear = BUTTON_WEST; // clear interrupt
+ return;
+}
+
+
void running_light_init( void)
{
// enable output drivers
- gpio0->iodir |= 0x000000FF;
+ gpio0->iodir |= 0x000000FF;
+ running_direction = 0;
+
+ // enable interrupt on key west
+ //gpio0->irqpol |= BUTTON_WEST; // 0=act_low, 1=act_high / 0=falling edge, 1=rising_edge
+ gpio0->irqedge |= BUTTON_WEST; // 0=level, 1=edge sensitive
+ gpio0->irqmask |= BUTTON_WEST; // set this after polarity and edge to avoid interrupt
+
+ irqmp0->irq_mask = BUTTON_WEST; // enable global interrupts
}
@@ -63,7 +80,15 @@ void running_light( uint32_t simulation_active)
{
gpio0->ioout = 0x000000ff & pattern;
- pattern = (pattern << 1) | (pattern >> 31);
+ if (running_direction)
+ {
+ pattern = (pattern << 1) | (pattern >> 31);
+ }
+ else
+ {
+ pattern = (pattern << 31) | (pattern >> 1);
+ }
+
if (simulation_active)
{
@@ -890,8 +915,8 @@ int main(void)
//lcd_init();
vga_init();
ddr_init();
- //running_light_init();
- ether_init();
+ running_light_init();
+ //ether_init();
putstr("test.c ");
if (simulation_active)
@@ -977,9 +1002,9 @@ int main(void)
*/
//ether_test();
- uint8_t i;
- for ( i=0; i<3; i++)
- ether_test_tx_packet();
+ //uint8_t i;
+ //for ( i=0; i<3; i++)
+ // ether_test_tx_packet();
//ether_test_read_mdio();
//uart_test();
diff --git a/s3estarter/syn/Makefile b/s3estarter/syn/Makefile
index a14ba72..1607428 100644
--- a/s3estarter/syn/Makefile
+++ b/s3estarter/syn/Makefile
@@ -3,8 +3,8 @@ DEVICE = xc3s500e-fg320-4
#UCF_FILE = D:/home/bl5599/projects/s3estarter/syn/s3estarter.ucf
UCF_FILE = s3estarter.ucf
-SOFTWARE = ../software/ethernet_speed
-#SOFTWARE = ../software/test
+#SOFTWARE = ../software/ethernet_speed
+SOFTWARE = ../software/test
all:
OpenPOWER on IntegriCloud