[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6875 - gnuradio/branches/developers/matt/u2f/firmware
From: |
eb |
Subject: |
[Commit-gnuradio] r6875 - gnuradio/branches/developers/matt/u2f/firmware |
Date: |
Mon, 12 Nov 2007 19:34:00 -0700 (MST) |
Author: eb
Date: 2007-11-12 19:33:59 -0700 (Mon, 12 Nov 2007)
New Revision: 6875
Added:
gnuradio/branches/developers/matt/u2f/firmware/buf_ram_test.c
Modified:
gnuradio/branches/developers/matt/u2f/firmware/
gnuradio/branches/developers/matt/u2f/firmware/Makefile.am
Log:
new: buf_ram_test
Property changes on: gnuradio/branches/developers/matt/u2f/firmware
___________________________________________________________________
Name: svn:ignore
- *-stamp
*.a
*.bin
*.dump
*.log
*.rom
Makefile
Makefile.in
aclocal.m4
autom4te.cache
blink_leds
blink_leds2
build
compile
config.h
config.h.in
config.log
config.status
configure
depcomp
eth_test
gen_eth_packets
ibs_rx_test
ibs_tx_test
install-sh
libtool
ltmain.sh
missing
py-compile
rcv_eth_packets
run_tests.sh
stamp-h1
test1
test_phy_comm
timer_test
+ *-stamp
*.a
*.bin
*.dump
*.log
*.rom
Makefile
Makefile.in
aclocal.m4
autom4te.cache
blink_leds
blink_leds2
build
compile
config.h
config.h.in
config.log
config.status
configure
depcomp
eth_test
gen_eth_packets
ibs_rx_test
ibs_tx_test
install-sh
libtool
ltmain.sh
missing
py-compile
rcv_eth_packets
run_tests.sh
stamp-h1
test1
test_phy_comm
timer_test
buf_ram_test
Modified: gnuradio/branches/developers/matt/u2f/firmware/Makefile.am
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/Makefile.am 2007-11-12
23:53:17 UTC (rev 6874)
+++ gnuradio/branches/developers/matt/u2f/firmware/Makefile.am 2007-11-13
02:33:59 UTC (rev 6875)
@@ -57,6 +57,7 @@
noinst_PROGRAMS = \
blink_leds \
blink_leds2 \
+ buf_ram_test \
eth_test \
gen_eth_packets \
ibs_rx_test \
Added: gnuradio/branches/developers/matt/u2f/firmware/buf_ram_test.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/buf_ram_test.c
(rev 0)
+++ gnuradio/branches/developers/matt/u2f/firmware/buf_ram_test.c
2007-11-13 02:33:59 UTC (rev 6875)
@@ -0,0 +1,113 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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, or (at your option)
+ * any later version.
+ *
+ * GNU Radio 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, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+// check communication with ethernet PHY chip
+
+#include "u2_init.h"
+#include "memory_map.h"
+#include "hal_io.h"
+#include "eth_driver.h"
+#include "eth_mac.h"
+#include "pic.h"
+#include "bool.h"
+
+
+// Delay about one millisecond.
+//
+// Need 33,333 cycles at 33 MHz.
+// Each time around the loop is 10 cycles
+
+void
+delay_1ms(void)
+{
+ int i;
+ for (i = 0; i < 3333; i++){
+ asm volatile ("or r0, r0, r0\n\
+ or r0, r0, r0\n\
+ or r0, r0, r0\n\
+ or r0, r0, r0\n\
+ or r0, r0, r0\n\
+ or r0, r0, r0\n\
+ or r0, r0, r0\n");
+ }
+}
+
+// delay about ms milliseconds
+static void
+mdelay(int ms)
+{
+ int i;
+ for (i = 0; i < ms; i++)
+ delay_1ms();
+}
+
+static void
+write_bufs(void)
+{
+ int i, n;
+ int counter = 0;
+
+ for (n = 0; n < NBUFFERS; n++){
+ volatile int *p = buffer_ram(n);
+ for (i = 0; i < BUFFER_POOL_BUFFER_SIZE; i++)
+ p[i] = counter++;
+ }
+}
+
+// return number of errors detected
+static int
+check_bufs(void)
+{
+ int i, n;
+ int counter = 0;
+ int nerrors = 0;
+
+ for (n = 0; n < NBUFFERS; n++){
+ volatile int *p = buffer_ram(n);
+ for (i = 0; i < BUFFER_POOL_BUFFER_SIZE; i++)
+ if (p[i] != counter++)
+ nerrors++;
+ }
+ return nerrors;
+}
+
+
+int
+main(void)
+{
+ u2_init();
+
+ output_regs->leds = 0;
+ mdelay(100);
+ output_regs->leds = 0x3;
+ mdelay(100);
+ output_regs->leds = 0;
+
+ write_bufs();
+ int nerrors = check_bufs();
+
+ if (nerrors == 0)
+ output_regs->leds = 0x3; // leds on -> PASS
+ else
+ output_regs->leds = 0x0; // leds off -> FAIL
+
+ return 0;
+}
Property changes on:
gnuradio/branches/developers/matt/u2f/firmware/buf_ram_test.c
___________________________________________________________________
Name: svn:eol-style
+ native
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6875 - gnuradio/branches/developers/matt/u2f/firmware,
eb <=