annotate target-utils/pirexplore/main.c @ 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 a323b4cc69e6
children 07b686248ab7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
67
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 #include "types.h"
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 #include "romvars.h"
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 extern struct boot_rom_vars rom_vars;
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 extern char *uart_name;
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 main()
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 {
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 uart_select_init();
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 printf("Pirelli hardware exploration utility running\n");
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 printf("Loaded via UART %d (%s) at baud rate #%d\n", rom_vars.uart_id,
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 uart_name, rom_vars.baud_rate_code);
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 printf("TCXO clock input autodetected to be %d MHz\n",
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 rom_vars.clktcxo_13mhz ? 13 : 26);
68
a323b4cc69e6 pirexplore: XRAM/flash access init like in the pirelli.init script
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 67
diff changeset
16 /*
a323b4cc69e6 pirexplore: XRAM/flash access init like in the pirelli.init script
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 67
diff changeset
17 * Make the same register settings as in the init script used by
a323b4cc69e6 pirexplore: XRAM/flash access init like in the pirelli.init script
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 67
diff changeset
18 * fc-loadtool and fc-xram: ../../loadtools/scripts/pirelli.init
a323b4cc69e6 pirexplore: XRAM/flash access init like in the pirelli.init script
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 67
diff changeset
19 */
a323b4cc69e6 pirexplore: XRAM/flash access init like in the pirelli.init script
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 67
diff changeset
20 *(volatile u16 *)0xfffffb00 = 0x00A4;
a323b4cc69e6 pirexplore: XRAM/flash access init like in the pirelli.init script
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 67
diff changeset
21 *(volatile u16 *)0xfffffb02 = 0x00A4;
a323b4cc69e6 pirexplore: XRAM/flash access init like in the pirelli.init script
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 67
diff changeset
22 *(volatile u16 *)0xfffffb06 = 0x00A4;
a323b4cc69e6 pirexplore: XRAM/flash access init like in the pirelli.init script
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 67
diff changeset
23 *(volatile u16 *)0xfffef006 = 0x0008;
74
8138a6380ae3 pirexplore: attempt to play with SPCA552E
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 68
diff changeset
24 /*
8138a6380ae3 pirexplore: attempt to play with SPCA552E
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 68
diff changeset
25 * Other register settings replicating what OsmocomBB does
8138a6380ae3 pirexplore: attempt to play with SPCA552E
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 68
diff changeset
26 * in board/pirelli_dpl10/init.c
8138a6380ae3 pirexplore: attempt to play with SPCA552E
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 68
diff changeset
27 */
8138a6380ae3 pirexplore: attempt to play with SPCA552E
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 68
diff changeset
28 *(volatile u16 *)0xfffef008 = 0x7090;
8138a6380ae3 pirexplore: attempt to play with SPCA552E
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 68
diff changeset
29 *(volatile u16 *)0xfffef00a = 0x021F;
8138a6380ae3 pirexplore: attempt to play with SPCA552E
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 68
diff changeset
30 *(volatile u16 *)0xfffe4804 = 0xFF6D;
8138a6380ae3 pirexplore: attempt to play with SPCA552E
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 68
diff changeset
31 *(volatile u16 *)0xfffe4802 = 0x0000;
8138a6380ae3 pirexplore: attempt to play with SPCA552E
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 68
diff changeset
32 *(volatile u16 *)0xfffe4802 = 0x0012;
8138a6380ae3 pirexplore: attempt to play with SPCA552E
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 68
diff changeset
33 /* nCS4 setup for SPCA552E */
8138a6380ae3 pirexplore: attempt to play with SPCA552E
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 68
diff changeset
34 *(volatile u16 *)0xfffffb0a = 0x00A7;
67
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 for (;;) {
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 putchar('=');
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 if (command_entry())
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 command_dispatch();
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 }
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 }