annotate target-utils/libcommon/uartsel.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 40f607bb0a2c
children a7b0b426f9ca
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 * uart_select_init() figures out which UART was used to load us
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 * through the boot ROM, and sets things up for us to use the same
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 * UART for our communication.
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 */
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 #include "types.h"
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 #include "romvars.h"
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 #include "ns16550.h"
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 #include "halt.h"
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 extern struct boot_rom_vars rom_vars;
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 struct ns16550_regs *uart_base;
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 char *uart_name;
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 uart_select_init()
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 {
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 switch (rom_vars.uart_id) {
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20 case 0:
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 uart_base = (struct ns16550_regs *) 0xFFFF5800;
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 uart_name = "MODEM";
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 break;
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 case 1:
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 uart_base = (struct ns16550_regs *) 0xFFFF5000;
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 uart_name = "IrDA";
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 break;
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 default:
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 _exit(HALTCODE_INVALIDUART);
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 }
40f607bb0a2c target-utils refactored
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 }