annotate target-utils/c139explore/main.c @ 922:3152e23399a2

document SE K2x0 FFS quirks and our support for them
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 02 Jan 2023 00:50:19 +0000
parents fc3592a27317
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #include "types.h"
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2
526
fc3592a27317 c139explore boot delay adjusted for running at 26 MHz
Mychaela Falconia <falcon@freecalypso.org>
parents: 503
diff changeset
3 #define DELAY_1MS 6500 /* ARM7 core runs at 26 MHz here, not 52 MHz */
503
da53ea0a38ba c139explore: osmo_delay_ms-ectomy and GPIO init fix
Mychaela Falconia <falcon@freecalypso.org>
parents: 37
diff changeset
4
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 main()
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 {
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 /* delay kludge workaround for defect in fc-compalram */
503
da53ea0a38ba c139explore: osmo_delay_ms-ectomy and GPIO init fix
Mychaela Falconia <falcon@freecalypso.org>
parents: 37
diff changeset
8 wait_ARM_cycles(DELAY_1MS * 30);
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 printf("C139 hardware exploration utility running\n");
503
da53ea0a38ba c139explore: osmo_delay_ms-ectomy and GPIO init fix
Mychaela Falconia <falcon@freecalypso.org>
parents: 37
diff changeset
10 /* GPIO init, compatible with both C139 and SE J100 */
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 *(volatile u16 *)0xfffe4802 = 0x0002;
503
da53ea0a38ba c139explore: osmo_delay_ms-ectomy and GPIO init fix
Mychaela Falconia <falcon@freecalypso.org>
parents: 37
diff changeset
12 *(volatile u16 *)0xfffe4804 = 0x2A59;
37
f24b31082605 c139explore: turn on ARMIO module clock, needed to exercise the buzzer
Mychaela Falconia <falcon@freecalypso.org>
parents: 0
diff changeset
13 *(volatile u16 *)0xfffe4806 = 0xFFF3; /* enable ARMIO clock */
0
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 /* take peripherals out of reset */
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 *(volatile u16 *)0xfffffd04 = 0xFFF3;
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 abb_init();
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 uwire_init();
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 for (;;) {
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 putchar('=');
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 if (command_entry())
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 command_dispatch();
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 }
e7502631a0f9 initial import from freecalypso-sw rev 1033:5ab737ac3ad7
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 }