contrib/firmware: add new adapter ANGIE's firmware/bitstream code
[openocd.git] / contrib / firmware / angie / c / src / gpif.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2
3 /*
4 This program configures the General Programmable Interface (GPIF) for FX2.
5 Please do not modify sections of text which are marked as "DO NOT EDIT ...".
6 */
7
8 /* GPIF Program Code */
9
10 #include "reg_ezusb.h"
11 #include "delay.h"
12
13 /****************************** GPIF PROGRAM CODE ********************************/
14 /* DO NOT EDIT ... */
15 const char wavedata[128] = {
16 /* Wave 0 */
17 /* LenBr */ 0x01, 0x3F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07,
18 /* Opcode*/ 0x02, 0x07, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00,
19 /* Output*/ 0x04, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
20 /* LFun */ 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F,
21 /* Wave 1 */
22 /* LenBr */ 0x88, 0x01, 0x3F, 0x01, 0x01, 0x01, 0x01, 0x07,
23 /* Opcode*/ 0x01, 0x02, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00,
24 /* Output*/ 0x07, 0x05, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
25 /* LFun */ 0x09, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x3F,
26 /* Wave 2 */
27 /* LenBr */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07,
28 /* Opcode*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
29 /* Output*/ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
30 /* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F,
31 /* Wave 3 */
32 /* LenBr */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07,
33 /* Opcode*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
34 /* Output*/ 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
35 /* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F,
36 };
37 /* END DO NOT EDIT */
38
39 /* DO NOT EDIT ... */
40 const char flowstates[36] = {
41 /* Wave 0 flowstates */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
42 /* Wave 1 flowstates */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
43 /* Wave 2 flowstates */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
44 /* Wave 3 flowstates */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
45 };
46 /* END DO NOT EDIT */
47
48 /* DO NOT EDIT ... */
49 const char initdata[7] = {
50 /* Regs */ 0xE0, 0x00, 0x00, 0x07, 0xEE, 0xF2, 0x00
51 };
52 /* END DO NOT EDIT */
53
54 void gpif_init(void)
55 {
56 uint8_t i;
57
58 IFCONFIG = 0xEE;
59
60 GPIFABORT = 0xFF; /* abort any waveforms pending */
61 GPIFREADYCFG = initdata[0];
62 GPIFCTLCFG = initdata[1];
63 GPIFIDLECS = initdata[2];
64 GPIFIDLECTL = initdata[3];
65 GPIFWFSELECT = initdata[5];
66 GPIFREADYSTAT = initdata[6];
67
68 /* use dual autopointer feature... */
69 AUTOPTRSETUP = 0x07;
70
71 /* source */
72 AUTOPTRH1 = (uint8_t)(((uint16_t)(&wavedata) >> 8) & 0xff);
73 AUTOPTRL1 = (uint8_t)((uint16_t)(&wavedata) & 0xff);
74
75 /* destination */
76 AUTOPTRH2 = 0xE4;
77 AUTOPTRL2 = 0x00;
78
79 /* transfer */
80 for (i = 0x00; i < 128; i++)
81 EXTAUTODAT2 = EXTAUTODAT1;
82
83 /* GPIF address pins update when GPIFADRH/L written */
84 syncdelay(3);
85 GPIFADRH = 0x00; /* bits[7:1] always 0 */
86 syncdelay(3);
87 GPIFADRL = 0x00; /* point to PERIPHERAL address 0x0000 */
88
89 /* Configure GPIF flowstates registers for Wave 0 of wavedata */
90 FLOWSTATE = flowstates[0];
91 FLOWLOGIC = flowstates[1];
92 FLOWEQ0CTL = flowstates[2];
93 FLOWEQ1CTL = flowstates[3];
94 FLOWHOLDOFF = flowstates[4];
95 FLOWSTB = flowstates[5];
96 FLOWSTBEDGE = flowstates[6];
97 FLOWSTBHPERIOD = flowstates[7];
98 }

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)