changeset 74:8138a6380ae3

pirexplore: attempt to play with SPCA552E
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sat, 27 Jul 2013 07:30:08 +0000
parents c54c6ad1c66f
children c9768f5fb329
files target-utils/pirexplore/Makefile target-utils/pirexplore/cmdtab.c target-utils/pirexplore/lcd.c target-utils/pirexplore/main.c
diffstat 4 files changed, 37 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/target-utils/pirexplore/Makefile	Fri Jul 26 21:12:03 2013 +0000
+++ b/target-utils/pirexplore/Makefile	Sat Jul 27 07:30:08 2013 +0000
@@ -5,7 +5,7 @@
 OBJCOPY=arm-elf-objcopy
 
 PROG=	pirexplore
-OBJS=	crt0.o cmdtab.o main.o mygetchar.o rtc.o
+OBJS=	crt0.o cmdtab.o lcd.o main.o mygetchar.o rtc.o
 LIBS=	../libcommon/libcommon.a ../libprintf/libprintf.a
 LDS=	../env/iram.lds
 
--- a/target-utils/pirexplore/cmdtab.c	Fri Jul 26 21:12:03 2013 +0000
+++ b/target-utils/pirexplore/cmdtab.c	Sat Jul 27 07:30:08 2013 +0000
@@ -8,6 +8,7 @@
 extern void cmd_r32();
 extern void cmd_rtc();
 extern void cmd_rtccomp();
+extern void cmd_spca();
 extern void cmd_w8();
 extern void cmd_w16();
 extern void cmd_w32();
@@ -21,6 +22,7 @@
 	{"r32", cmd_r32},
 	{"rtc", cmd_rtc},
 	{"rtccomp", cmd_rtccomp},
+	{"spca", cmd_spca},
 	{"w8", cmd_w8},
 	{"w16", cmd_w16},
 	{"w32", cmd_w32},
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/target-utils/pirexplore/lcd.c	Sat Jul 27 07:30:08 2013 +0000
@@ -0,0 +1,23 @@
+#include <sys/types.h>
+#include "types.h"
+
+void
+cmd_spca(argbulk)
+	char *argbulk;
+{
+	char *argv[3];
+	u_long addr, data;
+
+	if (parse_args(argbulk, 2, 2, argv, 0) < 0)
+		return;
+	if (parse_hexarg(argv[0], 4, &addr) < 0) {
+		printf("ERROR: arg1 must be a valid 16-bit hex value\n");
+		return;
+	}
+	if (parse_hexarg(argv[1], 4, &data) < 0) {
+		printf("ERROR: arg2 must be a valid 16-bit hex value\n");
+		return;
+	}
+	*(volatile u16 *)0x02800000 = addr;
+	*(volatile u16 *)0x02800002 = data;
+}
--- a/target-utils/pirexplore/main.c	Fri Jul 26 21:12:03 2013 +0000
+++ b/target-utils/pirexplore/main.c	Sat Jul 27 07:30:08 2013 +0000
@@ -21,6 +21,17 @@
 	*(volatile u16 *)0xfffffb02 = 0x00A4;
 	*(volatile u16 *)0xfffffb06 = 0x00A4;
 	*(volatile u16 *)0xfffef006 = 0x0008;
+	/*
+	 * Other register settings replicating what OsmocomBB does
+	 * in board/pirelli_dpl10/init.c
+	 */
+	*(volatile u16 *)0xfffef008 = 0x7090;
+	*(volatile u16 *)0xfffef00a = 0x021F;
+	*(volatile u16 *)0xfffe4804 = 0xFF6D;
+	*(volatile u16 *)0xfffe4802 = 0x0000;
+	*(volatile u16 *)0xfffe4802 = 0x0012;
+	/* nCS4 setup for SPCA552E */
+	*(volatile u16 *)0xfffffb0a = 0x00A7;
 	for (;;) {
 		putchar('=');
 		if (command_entry())