summaryrefslogtreecommitdiff
path: root/usrp2
diff options
context:
space:
mode:
authormatt2008-12-07 01:33:22 +0000
committermatt2008-12-07 01:33:22 +0000
commitb399cfc25429a232aa7a46c8d6ee0765f275588e (patch)
treeee4308cf2fd5408e7c1df0c990931c2ce571831f /usrp2
parenta14e59f1ad50f2b637e8916e8c4fa2328956b5aa (diff)
downloadgnuradio-b399cfc25429a232aa7a46c8d6ee0765f275588e.tar.gz
gnuradio-b399cfc25429a232aa7a46c8d6ee0765f275588e.tar.bz2
gnuradio-b399cfc25429a232aa7a46c8d6ee0765f275588e.zip
more tests, for ram and sd card
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10108 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'usrp2')
-rw-r--r--usrp2/firmware/apps/factory_test.c92
1 files changed, 89 insertions, 3 deletions
diff --git a/usrp2/firmware/apps/factory_test.c b/usrp2/firmware/apps/factory_test.c
index cd0a645cc..5c2a4fc8b 100644
--- a/usrp2/firmware/apps/factory_test.c
+++ b/usrp2/firmware/apps/factory_test.c
@@ -38,6 +38,7 @@
#include <i2c.h>
#include <usrp2_i2c_addr.h>
#include <clocks.h>
+#include "sd.h"
#define HW_REV_MAJOR 3
#define HW_REV_MINOR 0
@@ -256,12 +257,79 @@ buffer_irq_handler(unsigned irq)
dbsm_process_status(&dsp_rx_sm, status);
}
+int test_ram()
+{
+ int i,j,k;
+ output_regs->ram_page = 1<<10;
+
+ extram[0] = 0xDEADBEEF;
+ extram[1] = 0xF00D1234;
+ extram[7] = 0x76543210;
+
+ output_regs->ram_page = 2<<10;
+ extram[7] = 0x55555555;
+ extram[1] = 0xaaaaaaaa;
+ extram[0] = 0xeeeeeeee;
+
+ output_regs->ram_page = 1<<10;
+
+ i = extram[0];
+ k = extram[1];
+ j = extram[7];
+
+ if((i != 0xDEADBEEF)||(j!=0x76543210)||(k!=0xF00D1234)) {
+ puts("RAM FAIL1!\n");
+ puthex32_nl(i);
+ puthex32_nl(j);
+ puthex32_nl(k);
+ return 0;
+ }
+
+ output_regs->ram_page = 2<<10;
+
+ j = extram[7];
+ k = extram[1];
+ i = extram[0];
+
+ if((i != 0xeeeeeeee)||(j!=0x55555555)||(k!=0xaaaaaaaa)) {
+ puts("RAM FAIL2!\n");
+ puthex32_nl(i);
+ puthex32_nl(j);
+ puthex32_nl(k);
+ return 0;
+ }
+ return 1;
+}
+
+int test_sd()
+{
+ int i = sd_init();
+ if(i==0) {
+ puts("FAILED INIT of Card\n");
+ return 0;
+ }
+
+ unsigned char buf[512];
+ i = sd_read_block(2048,buf);
+ if(i == 0) {
+ puts("READ Command Rejected\n");
+ return 0;
+ }
+ if((buf[0]==0xb8)&&(buf[1]==0x08)&&(buf[2]==0x00)&&(buf[3]==0x50))
+ ;
+ else {
+ puts("Read bad data from SD Card\n");
+ return 0;
+ }
+ return 1;
+}
+
int
main(void)
{
u2_init();
- putstr("\nset_hw_rev\n");
+ putstr("\nFactory Test TXRX\n");
bool ok = true;
unsigned char maj = HW_REV_MAJOR;
@@ -269,12 +337,30 @@ main(void)
ok = eeprom_write(I2C_ADDR_MBOARD, MBOARD_REV_MSB, &maj, 1);
ok &= eeprom_write(I2C_ADDR_MBOARD, MBOARD_REV_LSB, &min, 1);
+ putstr("\nset_hw_rev\n");
if (ok)
printf("OK: set h/w rev to %d.%d\n", HW_REV_MAJOR, HW_REV_MINOR);
- else
+ else {
printf("FAILED to set h/w rev to %d.%d\n", HW_REV_MAJOR, HW_REV_MINOR);
+ hal_finish();
+ return 0;
+ }
+
+ if(test_sd())
+ puts("SD OK\n");
+ else {
+ puts("SD FAIL\n");
+ hal_finish();
+ return 0;
+ }
+ if(test_ram())
+ puts("RAM OK\n");
+ else {
+ puts("RAM FAIL\n");
+ hal_finish();
+ return 0;
+ }
- putstr("\nFactory Test TXRX\n");
print_mac_addr(ethernet_mac_addr()->addr);
newline();