annotate target-utils/pirexplore/main.c @ 638:0b5f226bfdf4

gsm-fw/services/pcm: import from Leonardo source (FFS)
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Wed, 03 Sep 2014 16:26:27 +0000
parents fcbe1332b197
children a7b0b426f9ca
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 */
77
fcbe1332b197 pirexplore: LCD init and BL control work now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 76
diff changeset
28 *(volatile u16 *)0xfffef008 = 0x7090;
74
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 /* nCS4 setup for SPCA552E */
8138a6380ae3 pirexplore: attempt to play with SPCA552E
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 68
diff changeset
33 *(volatile u16 *)0xfffffb0a = 0x00A7;
77
fcbe1332b197 pirexplore: LCD init and BL control work now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 76
diff changeset
34 /* initialize PWL registers like OsmocomBB does */
fcbe1332b197 pirexplore: LCD init and BL control work now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 76
diff changeset
35 *(volatile u8 *)0xfffe8000 = 0x32;
fcbe1332b197 pirexplore: LCD init and BL control work now
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 76
diff changeset
36 *(volatile u8 *)0xfffe8001 = 0x01;
67
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 for (;;) {
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 putchar('=');
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 if (command_entry())
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 command_dispatch();
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 }
b8f335553000 pirexplore utility started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 }